aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@redhat.com>2005-11-20 07:33:40 +0000
committerDiego Novillo <dnovillo@redhat.com>2005-11-20 07:33:40 +0000
commit334cb8612fc07d2479533d3e589ab678753adaf8 (patch)
treefd3fd3000ec4c751ee405ae2a84ea17169a0126b
parent69231c6769016efb611e7d2476a74e13a0f8a0db (diff)
Mainline merge as of 2005-11-18.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gomp-20050608-branch@107245 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog393
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/ada/ChangeLog1364
-rw-r--r--gcc/ada/Make-lang.in2694
-rw-r--r--gcc/ada/Makefile.in331
-rw-r--r--gcc/ada/Makefile.rtl5
-rw-r--r--gcc/ada/a-astaco.adb2
-rw-r--r--gcc/ada/a-calend-mingw.adb9
-rw-r--r--gcc/ada/a-calend-vms.adb2
-rw-r--r--gcc/ada/a-calend-vms.ads2
-rw-r--r--gcc/ada/a-calend.adb2
-rw-r--r--gcc/ada/a-calend.ads2
-rw-r--r--gcc/ada/a-cdlili.adb301
-rw-r--r--gcc/ada/a-cdlili.ads102
-rw-r--r--gcc/ada/a-cgaaso.adb2
-rw-r--r--gcc/ada/a-cgaaso.ads2
-rw-r--r--gcc/ada/a-cgarso.adb2
-rw-r--r--gcc/ada/a-cgcaso.adb2
-rwxr-xr-xgcc/ada/a-chacon.adb2
-rwxr-xr-xgcc/ada/a-chacon.ads2
-rw-r--r--gcc/ada/a-chahan.adb8
-rw-r--r--gcc/ada/a-chahan.ads2
-rw-r--r--gcc/ada/a-chlat9.ads2
-rw-r--r--gcc/ada/a-chtgke.adb2
-rw-r--r--gcc/ada/a-chtgke.ads2
-rw-r--r--gcc/ada/a-chtgop.adb2
-rw-r--r--gcc/ada/a-chzla1.ads2
-rw-r--r--gcc/ada/a-chzla9.ads2
-rw-r--r--gcc/ada/a-cidlli.adb344
-rw-r--r--gcc/ada/a-cidlli.ads99
-rw-r--r--gcc/ada/a-cihama.adb45
-rw-r--r--gcc/ada/a-cihama.ads84
-rw-r--r--gcc/ada/a-cihase.adb124
-rw-r--r--gcc/ada/a-cihase.ads19
-rw-r--r--gcc/ada/a-ciorma.adb399
-rw-r--r--gcc/ada/a-ciorma.ads89
-rw-r--r--gcc/ada/a-ciormu.adb361
-rw-r--r--gcc/ada/a-ciormu.ads89
-rw-r--r--gcc/ada/a-ciorse.adb300
-rw-r--r--gcc/ada/a-ciorse.ads19
-rw-r--r--gcc/ada/a-cohama.adb51
-rw-r--r--gcc/ada/a-cohama.ads55
-rw-r--r--gcc/ada/a-cohase.adb88
-rw-r--r--gcc/ada/a-cohase.ads19
-rw-r--r--gcc/ada/a-cohata.ads2
-rw-r--r--gcc/ada/a-coinve.adb189
-rw-r--r--gcc/ada/a-coinve.ads109
-rw-r--r--gcc/ada/a-colien.adb3
-rw-r--r--gcc/ada/a-colien.ads2
-rw-r--r--gcc/ada/a-colire.adb2
-rw-r--r--gcc/ada/a-colire.ads2
-rw-r--r--gcc/ada/a-comlin.adb2
-rw-r--r--gcc/ada/a-comlin.ads2
-rw-r--r--gcc/ada/a-convec.adb191
-rw-r--r--gcc/ada/a-convec.ads107
-rw-r--r--gcc/ada/a-coorma.adb357
-rw-r--r--gcc/ada/a-coorma.ads67
-rw-r--r--gcc/ada/a-coormu.adb315
-rw-r--r--gcc/ada/a-coormu.ads95
-rw-r--r--gcc/ada/a-coorse.adb281
-rw-r--r--gcc/ada/a-coorse.ads19
-rw-r--r--gcc/ada/a-coprnu.adb2
-rw-r--r--gcc/ada/a-crbltr.ads2
-rw-r--r--gcc/ada/a-crbtgk.adb2
-rw-r--r--gcc/ada/a-crbtgo.adb308
-rw-r--r--gcc/ada/a-crbtgo.ads11
-rw-r--r--gcc/ada/a-cwila1.ads2
-rw-r--r--gcc/ada/a-cwila9.ads2
-rw-r--r--gcc/ada/a-decima.adb2
-rw-r--r--gcc/ada/a-decima.ads2
-rw-r--r--gcc/ada/a-diocst.ads2
-rw-r--r--gcc/ada/a-direct.adb2
-rw-r--r--gcc/ada/a-direct.ads2
-rw-r--r--gcc/ada/a-direio.adb2
-rw-r--r--gcc/ada/a-direio.ads2
-rw-r--r--gcc/ada/a-dirval-mingw.adb2
-rw-r--r--gcc/ada/a-dirval.adb2
-rw-r--r--gcc/ada/a-dirval.ads2
-rw-r--r--gcc/ada/a-elchha.adb2
-rw-r--r--gcc/ada/a-excach.adb4
-rw-r--r--gcc/ada/a-except.adb128
-rw-r--r--gcc/ada/a-except.ads2
-rw-r--r--gcc/ada/a-exctra.ads2
-rw-r--r--gcc/ada/a-exexda.adb4
-rw-r--r--gcc/ada/a-exexpr-gcc.adb726
-rw-r--r--gcc/ada/a-exexpr.adb689
-rw-r--r--gcc/ada/a-exextr.adb2
-rw-r--r--gcc/ada/a-exstat.adb2
-rw-r--r--gcc/ada/a-filico.ads2
-rw-r--r--gcc/ada/a-finali.ads2
-rw-r--r--gcc/ada/a-interr.ads2
-rw-r--r--gcc/ada/a-intnam-aix.ads23
-rw-r--r--gcc/ada/a-intnam-darwin.ads19
-rw-r--r--gcc/ada/a-intnam-dummy.ads2
-rw-r--r--gcc/ada/a-intnam-freebsd.ads2
-rw-r--r--gcc/ada/a-intnam-interix.ads2
-rw-r--r--gcc/ada/a-intnam-linux.ads23
-rw-r--r--gcc/ada/a-intnam-lynxos.ads16
-rw-r--r--gcc/ada/a-intnam-mingw.ads9
-rw-r--r--gcc/ada/a-intnam-solaris.ads23
-rw-r--r--gcc/ada/a-intnam-tru64.ads19
-rw-r--r--gcc/ada/a-intnam-unixware.ads16
-rw-r--r--gcc/ada/a-intnam-vms.ads6
-rw-r--r--gcc/ada/a-intnam-vxworks.ads2
-rw-r--r--gcc/ada/a-intsig.adb4
-rw-r--r--gcc/ada/a-intsig.ads6
-rw-r--r--gcc/ada/a-ngcefu.adb2
-rw-r--r--gcc/ada/a-ngcoty.adb3
-rw-r--r--gcc/ada/a-ngcoty.ads2
-rw-r--r--gcc/ada/a-nudira.adb4
-rw-r--r--gcc/ada/a-nudira.ads2
-rw-r--r--gcc/ada/a-nuflra.adb2
-rw-r--r--gcc/ada/a-numaux-darwin.adb19
-rw-r--r--gcc/ada/a-numaux-darwin.ads2
-rw-r--r--gcc/ada/a-numaux-libc-x86.ads2
-rw-r--r--gcc/ada/a-numaux-vxworks.ads2
-rw-r--r--gcc/ada/a-numaux-x86.ads2
-rw-r--r--gcc/ada/a-numaux.ads2
-rw-r--r--gcc/ada/a-rbtgso.adb2
-rw-r--r--gcc/ada/a-reatim.ads2
-rw-r--r--gcc/ada/a-secain.adb2
-rw-r--r--gcc/ada/a-sequio.adb2
-rw-r--r--gcc/ada/a-sequio.ads3
-rw-r--r--gcc/ada/a-shcain.adb4
-rw-r--r--gcc/ada/a-siocst.ads2
-rw-r--r--gcc/ada/a-slcain.adb4
-rw-r--r--gcc/ada/a-ssicst.ads2
-rw-r--r--gcc/ada/a-stmaco.ads2
-rw-r--r--gcc/ada/a-storio.adb2
-rw-r--r--gcc/ada/a-strbou.adb2
-rw-r--r--gcc/ada/a-strbou.ads2
-rw-r--r--gcc/ada/a-stream.ads2
-rw-r--r--gcc/ada/a-strfix.adb18
-rw-r--r--gcc/ada/a-strhas.adb2
-rw-r--r--gcc/ada/a-strmap.adb2
-rw-r--r--gcc/ada/a-strmap.ads2
-rw-r--r--gcc/ada/a-strsea.adb2
-rw-r--r--gcc/ada/a-strsea.ads2
-rw-r--r--gcc/ada/a-strsup.adb2
-rw-r--r--gcc/ada/a-strsup.ads2
-rw-r--r--gcc/ada/a-strunb.adb2
-rw-r--r--gcc/ada/a-strunb.ads2
-rw-r--r--gcc/ada/a-stunha.adb2
-rw-r--r--gcc/ada/a-stunha.ads2
-rw-r--r--gcc/ada/a-stwibo.adb2
-rw-r--r--gcc/ada/a-stwibo.ads2
-rw-r--r--gcc/ada/a-stwifi.adb10
-rw-r--r--gcc/ada/a-stwiha.adb2
-rw-r--r--gcc/ada/a-stwima.adb2
-rw-r--r--gcc/ada/a-stwima.ads2
-rw-r--r--gcc/ada/a-stwise.adb2
-rw-r--r--gcc/ada/a-stwise.ads2
-rw-r--r--gcc/ada/a-stwisu.adb2
-rw-r--r--gcc/ada/a-stwisu.ads2
-rw-r--r--gcc/ada/a-stwiun.adb2
-rw-r--r--gcc/ada/a-stwiun.ads2
-rw-r--r--gcc/ada/a-stzbou.adb2
-rw-r--r--gcc/ada/a-stzbou.ads2
-rw-r--r--gcc/ada/a-stzfix.adb2
-rw-r--r--gcc/ada/a-stzhas.adb2
-rw-r--r--gcc/ada/a-stzmap.adb2
-rw-r--r--gcc/ada/a-stzmap.ads2
-rw-r--r--gcc/ada/a-stzsea.adb2
-rw-r--r--gcc/ada/a-stzsea.ads2
-rw-r--r--gcc/ada/a-stzsup.adb2
-rw-r--r--gcc/ada/a-stzsup.ads2
-rw-r--r--gcc/ada/a-stzunb.adb2
-rw-r--r--gcc/ada/a-stzunb.ads2
-rw-r--r--gcc/ada/a-suteio.adb2
-rw-r--r--gcc/ada/a-suteio.ads2
-rw-r--r--gcc/ada/a-swmwco.ads2
-rw-r--r--gcc/ada/a-swuwha.ads2
-rw-r--r--gcc/ada/a-swuwti.adb2
-rw-r--r--gcc/ada/a-swuwti.ads2
-rw-r--r--gcc/ada/a-sytaco.adb2
-rw-r--r--gcc/ada/a-sytaco.ads2
-rw-r--r--gcc/ada/a-szuzha.adb2
-rw-r--r--gcc/ada/a-szuzha.ads2
-rw-r--r--gcc/ada/a-szuzti.adb2
-rw-r--r--gcc/ada/a-szuzti.ads2
-rw-r--r--gcc/ada/a-tags.adb556
-rw-r--r--gcc/ada/a-tags.ads204
-rw-r--r--gcc/ada/a-tasatt.adb10
-rw-r--r--gcc/ada/a-taside.adb2
-rw-r--r--gcc/ada/a-taside.ads2
-rw-r--r--gcc/ada/a-teioed.adb2
-rw-r--r--gcc/ada/a-textio.adb2
-rw-r--r--gcc/ada/a-textio.ads2
-rw-r--r--gcc/ada/a-ticoau.adb2
-rw-r--r--gcc/ada/a-ticoau.ads2
-rw-r--r--gcc/ada/a-ticoio.adb2
-rw-r--r--gcc/ada/a-tideau.adb2
-rw-r--r--gcc/ada/a-tideio.adb2
-rw-r--r--gcc/ada/a-tienau.adb2
-rw-r--r--gcc/ada/a-tienio.adb2
-rw-r--r--gcc/ada/a-tifiio.adb2
-rw-r--r--gcc/ada/a-tiflio.adb2
-rw-r--r--gcc/ada/a-tigeau.adb2
-rw-r--r--gcc/ada/a-tigeau.ads2
-rw-r--r--gcc/ada/a-tiinau.adb2
-rw-r--r--gcc/ada/a-tiinio.adb2
-rw-r--r--gcc/ada/a-timoau.adb2
-rw-r--r--gcc/ada/a-timoio.adb2
-rw-r--r--gcc/ada/a-timoio.ads2
-rw-r--r--gcc/ada/a-tiocst.ads2
-rw-r--r--gcc/ada/a-titest.adb2
-rwxr-xr-xgcc/ada/a-wichun.adb4
-rwxr-xr-xgcc/ada/a-wichun.ads2
-rw-r--r--gcc/ada/a-witeio.adb2
-rw-r--r--gcc/ada/a-witeio.ads2
-rw-r--r--gcc/ada/a-wtcoau.adb2
-rw-r--r--gcc/ada/a-wtcoau.ads2
-rw-r--r--gcc/ada/a-wtcoio.adb2
-rw-r--r--gcc/ada/a-wtcstr.ads2
-rw-r--r--gcc/ada/a-wtdeau.adb2
-rw-r--r--gcc/ada/a-wtdeio.adb2
-rw-r--r--gcc/ada/a-wtedit.adb2
-rw-r--r--gcc/ada/a-wtedit.ads2
-rw-r--r--gcc/ada/a-wtenau.adb2
-rw-r--r--gcc/ada/a-wtenio.adb2
-rw-r--r--gcc/ada/a-wtfiio.adb2
-rw-r--r--gcc/ada/a-wtflio.adb2
-rw-r--r--gcc/ada/a-wtgeau.adb2
-rw-r--r--gcc/ada/a-wtinau.adb2
-rw-r--r--gcc/ada/a-wtinio.adb2
-rw-r--r--gcc/ada/a-wtmoau.adb2
-rw-r--r--gcc/ada/a-wtmoio.adb2
-rw-r--r--gcc/ada/a-wttest.adb2
-rwxr-xr-xgcc/ada/a-zchuni.adb2
-rwxr-xr-xgcc/ada/a-zchuni.ads2
-rw-r--r--gcc/ada/a-ztcoau.adb2
-rw-r--r--gcc/ada/a-ztcoau.ads2
-rw-r--r--gcc/ada/a-ztcoio.adb2
-rw-r--r--gcc/ada/a-ztcstr.adb2
-rw-r--r--gcc/ada/a-ztcstr.ads2
-rw-r--r--gcc/ada/a-ztdeau.adb2
-rw-r--r--gcc/ada/a-ztdeau.ads2
-rw-r--r--gcc/ada/a-ztdeio.adb3
-rw-r--r--gcc/ada/a-ztdeio.ads2
-rw-r--r--gcc/ada/a-ztedit.adb2
-rw-r--r--gcc/ada/a-ztedit.ads2
-rw-r--r--gcc/ada/a-ztenau.ads2
-rw-r--r--gcc/ada/a-ztenio.adb2
-rw-r--r--gcc/ada/a-ztenio.ads2
-rw-r--r--gcc/ada/a-ztexio.adb2
-rw-r--r--gcc/ada/a-ztexio.ads2
-rw-r--r--gcc/ada/a-ztfiio.adb2
-rw-r--r--gcc/ada/a-ztfiio.ads2
-rw-r--r--gcc/ada/a-ztflau.adb2
-rw-r--r--gcc/ada/a-ztflau.ads2
-rw-r--r--gcc/ada/a-ztflio.adb2
-rw-r--r--gcc/ada/a-ztflio.ads2
-rw-r--r--gcc/ada/a-ztgeau.adb2
-rw-r--r--gcc/ada/a-ztgeau.ads2
-rw-r--r--gcc/ada/a-ztinau.adb2
-rw-r--r--gcc/ada/a-ztinau.ads2
-rw-r--r--gcc/ada/a-ztinio.adb2
-rw-r--r--gcc/ada/a-ztmoau.ads2
-rw-r--r--gcc/ada/a-ztmoio.adb2
-rw-r--r--gcc/ada/a-ztmoio.ads2
-rw-r--r--gcc/ada/a-zttest.adb2
-rw-r--r--gcc/ada/adaint.c38
-rw-r--r--gcc/ada/adaint.h7
-rw-r--r--gcc/ada/ali-util.adb2
-rw-r--r--gcc/ada/ali.adb21
-rw-r--r--gcc/ada/ali.ads7
-rw-r--r--gcc/ada/atree.adb6
-rw-r--r--gcc/ada/back_end.adb4
-rw-r--r--gcc/ada/binde.adb63
-rw-r--r--gcc/ada/bindgen.adb4
-rw-r--r--gcc/ada/bindusg.adb12
-rw-r--r--gcc/ada/butil.adb2
-rw-r--r--gcc/ada/butil.ads2
-rw-r--r--gcc/ada/checks.adb50
-rw-r--r--gcc/ada/checks.ads4
-rw-r--r--gcc/ada/cio.c2
-rw-r--r--gcc/ada/clean.adb701
-rw-r--r--gcc/ada/comperr.adb4
-rw-r--r--gcc/ada/csets.ads2
-rw-r--r--gcc/ada/cstand.adb2
-rw-r--r--gcc/ada/cuintp.c38
-rw-r--r--gcc/ada/debug.adb18
-rw-r--r--gcc/ada/debug.ads2
-rw-r--r--gcc/ada/decl.c277
-rw-r--r--gcc/ada/einfo.adb148
-rw-r--r--gcc/ada/einfo.ads103
-rw-r--r--gcc/ada/elists.ads6
-rw-r--r--gcc/ada/err_vars.ads2
-rw-r--r--gcc/ada/errno.c2
-rw-r--r--gcc/ada/errout.adb4
-rw-r--r--gcc/ada/errout.ads7
-rw-r--r--gcc/ada/erroutc.adb2
-rw-r--r--gcc/ada/erroutc.ads2
-rw-r--r--gcc/ada/errutil.adb2
-rw-r--r--gcc/ada/errutil.ads10
-rw-r--r--gcc/ada/eval_fat.adb4
-rw-r--r--gcc/ada/exp_aggr.adb566
-rw-r--r--gcc/ada/exp_attr.adb338
-rw-r--r--gcc/ada/exp_ch11.adb2
-rw-r--r--gcc/ada/exp_ch11.ads2
-rw-r--r--gcc/ada/exp_ch2.adb2
-rw-r--r--gcc/ada/exp_ch3.adb276
-rw-r--r--gcc/ada/exp_ch3.ads66
-rw-r--r--gcc/ada/exp_ch4.adb322
-rw-r--r--gcc/ada/exp_ch5.adb261
-rw-r--r--gcc/ada/exp_ch6.adb298
-rw-r--r--gcc/ada/exp_ch7.adb27
-rw-r--r--gcc/ada/exp_ch7.ads10
-rw-r--r--gcc/ada/exp_ch9.adb1913
-rw-r--r--gcc/ada/exp_ch9.ads16
-rw-r--r--gcc/ada/exp_dbug.adb68
-rw-r--r--gcc/ada/exp_dbug.ads74
-rw-r--r--gcc/ada/exp_disp.adb2342
-rw-r--r--gcc/ada/exp_disp.ads205
-rw-r--r--gcc/ada/exp_dist.adb151
-rw-r--r--gcc/ada/exp_fixd.adb155
-rw-r--r--gcc/ada/exp_imgv.adb18
-rw-r--r--gcc/ada/exp_imgv.ads2
-rw-r--r--gcc/ada/exp_intr.adb169
-rw-r--r--gcc/ada/exp_intr.ads2
-rw-r--r--gcc/ada/exp_pakd.adb2
-rw-r--r--gcc/ada/exp_prag.adb2
-rw-r--r--gcc/ada/exp_prag.ads2
-rw-r--r--gcc/ada/exp_smem.adb2
-rw-r--r--gcc/ada/exp_strm.adb12
-rw-r--r--gcc/ada/exp_tss.adb2
-rw-r--r--gcc/ada/exp_tss.ads2
-rw-r--r--gcc/ada/exp_util.adb271
-rw-r--r--gcc/ada/exp_util.ads47
-rw-r--r--gcc/ada/exp_vfpt.adb89
-rw-r--r--gcc/ada/exp_vfpt.ads2
-rw-r--r--gcc/ada/expander.adb2
-rw-r--r--gcc/ada/expander.ads2
-rw-r--r--gcc/ada/expect.c29
-rw-r--r--gcc/ada/fe.h2
-rw-r--r--gcc/ada/fmap.adb2
-rw-r--r--gcc/ada/freeze.adb11
-rw-r--r--gcc/ada/freeze.ads4
-rw-r--r--gcc/ada/frontend.adb2
-rw-r--r--gcc/ada/frontend.ads2
-rw-r--r--gcc/ada/g-arrspl.adb4
-rw-r--r--gcc/ada/g-arrspl.ads4
-rw-r--r--gcc/ada/g-awk.adb16
-rw-r--r--gcc/ada/g-awk.ads2
-rw-r--r--gcc/ada/g-boumai.ads2
-rw-r--r--gcc/ada/g-calend.adb2
-rw-r--r--gcc/ada/g-calend.ads2
-rw-r--r--gcc/ada/g-catiio.adb4
-rw-r--r--gcc/ada/g-comlin.adb2
-rw-r--r--gcc/ada/g-comlin.ads118
-rw-r--r--gcc/ada/g-comver.adb2
-rw-r--r--gcc/ada/g-crc32.adb6
-rw-r--r--gcc/ada/g-crc32.ads16
-rw-r--r--gcc/ada/g-ctrl_c.ads10
-rw-r--r--gcc/ada/g-curexc.ads4
-rw-r--r--gcc/ada/g-debpoo.adb152
-rw-r--r--gcc/ada/g-debpoo.ads10
-rw-r--r--gcc/ada/g-debuti.adb9
-rw-r--r--gcc/ada/g-diopit.adb6
-rw-r--r--gcc/ada/g-diopit.ads2
-rw-r--r--gcc/ada/g-dirope.adb2
-rw-r--r--gcc/ada/g-dirope.ads2
-rw-r--r--gcc/ada/g-dyntab.adb4
-rw-r--r--gcc/ada/g-dyntab.ads7
-rw-r--r--gcc/ada/g-eacodu-vms.adb4
-rw-r--r--gcc/ada/g-enblsp-vms-alpha.adb10
-rw-r--r--gcc/ada/g-enblsp-vms-ia64.adb10
-rw-r--r--gcc/ada/g-excact.adb2
-rw-r--r--gcc/ada/g-excact.ads4
-rw-r--r--gcc/ada/g-except.ads4
-rw-r--r--gcc/ada/g-exctra.adb8
-rw-r--r--gcc/ada/g-exctra.ads10
-rw-r--r--gcc/ada/g-expect-vms.adb12
-rw-r--r--gcc/ada/g-expect.adb14
-rw-r--r--gcc/ada/g-expect.ads2
-rw-r--r--gcc/ada/g-flocon.ads2
-rw-r--r--gcc/ada/g-heasor.ads15
-rw-r--r--gcc/ada/g-hesorg.ads6
-rw-r--r--gcc/ada/g-io.adb6
-rw-r--r--gcc/ada/g-locfil.ads2
-rw-r--r--gcc/ada/g-md5.adb10
-rw-r--r--gcc/ada/g-md5.ads5
-rw-r--r--gcc/ada/g-moreex.adb2
-rw-r--r--gcc/ada/g-os_lib.adb118
-rw-r--r--gcc/ada/g-os_lib.ads20
-rw-r--r--gcc/ada/g-pehage.adb4
-rw-r--r--gcc/ada/g-pehage.ads2
-rw-r--r--gcc/ada/g-regexp.adb20
-rw-r--r--gcc/ada/g-regexp.ads5
-rw-r--r--gcc/ada/g-regist.adb36
-rw-r--r--gcc/ada/g-regist.ads23
-rw-r--r--gcc/ada/g-regpat.adb46
-rw-r--r--gcc/ada/g-regpat.ads83
-rw-r--r--gcc/ada/g-semaph.adb2
-rw-r--r--gcc/ada/g-signal.adb2
-rw-r--r--gcc/ada/g-signal.ads2
-rw-r--r--gcc/ada/g-soccon-aix.ads13
-rw-r--r--gcc/ada/g-soccon-darwin.ads11
-rw-r--r--gcc/ada/g-soccon-freebsd.ads11
-rw-r--r--gcc/ada/g-soccon-hpux-ia64.ads181
-rw-r--r--gcc/ada/g-soccon-hpux.ads11
-rw-r--r--gcc/ada/g-soccon-interix.ads2
-rw-r--r--gcc/ada/g-soccon-irix.ads11
-rw-r--r--gcc/ada/g-soccon-linux-64.ads181
-rw-r--r--gcc/ada/g-soccon-linux-ppc.ads181
-rw-r--r--gcc/ada/g-soccon-linux-x86.ads181
-rw-r--r--gcc/ada/g-soccon-mingw.ads11
-rw-r--r--gcc/ada/g-soccon-solaris-64.ads181
-rw-r--r--gcc/ada/g-soccon-solaris.ads11
-rw-r--r--gcc/ada/g-soccon-tru64.ads11
-rw-r--r--gcc/ada/g-soccon-unixware.ads2
-rw-r--r--gcc/ada/g-soccon-vms.ads11
-rw-r--r--gcc/ada/g-soccon-vxworks.ads21
-rw-r--r--gcc/ada/g-soccon.ads16
-rw-r--r--gcc/ada/g-socket.adb289
-rw-r--r--gcc/ada/g-socket.ads58
-rw-r--r--gcc/ada/g-socthi-mingw.adb25
-rw-r--r--gcc/ada/g-socthi-mingw.ads26
-rw-r--r--gcc/ada/g-socthi-vms.adb14
-rw-r--r--gcc/ada/g-socthi-vms.ads106
-rw-r--r--gcc/ada/g-socthi-vxworks.adb27
-rw-r--r--gcc/ada/g-socthi-vxworks.ads112
-rw-r--r--gcc/ada/g-socthi.adb5
-rw-r--r--gcc/ada/g-socthi.ads23
-rw-r--r--gcc/ada/g-soliop-mingw.ads2
-rw-r--r--gcc/ada/g-soliop-solaris.ads2
-rw-r--r--gcc/ada/g-soliop-unixware.ads2
-rw-r--r--gcc/ada/g-soliop.ads2
-rw-r--r--gcc/ada/g-spipat.adb2
-rw-r--r--gcc/ada/g-spipat.ads2
-rw-r--r--gcc/ada/g-spitbo.adb4
-rw-r--r--gcc/ada/g-sptabo.ads2
-rw-r--r--gcc/ada/g-sptain.ads2
-rw-r--r--gcc/ada/g-sptavs.ads2
-rw-r--r--gcc/ada/g-string.ads2
-rw-r--r--gcc/ada/g-tasloc.adb2
-rw-r--r--gcc/ada/g-tasloc.ads2
-rw-r--r--gcc/ada/g-trasym-vms-alpha.adb2
-rw-r--r--gcc/ada/g-trasym-vms-ia64.adb2
-rw-r--r--gcc/ada/g-trasym.adb10
-rw-r--r--gcc/ada/g-trasym.ads2
-rw-r--r--gcc/ada/gen-soccon.c52
-rw-r--r--gcc/ada/gigi.h23
-rw-r--r--gcc/ada/gnat-style.texi7
-rw-r--r--gcc/ada/gnat_rm.texi419
-rw-r--r--gcc/ada/gnat_ugn.texi715
-rw-r--r--gcc/ada/gnatbind.adb24
-rw-r--r--gcc/ada/gnatbind.ads2
-rw-r--r--gcc/ada/gnatchop.adb5
-rw-r--r--gcc/ada/gnatcmd.adb4
-rw-r--r--gcc/ada/gnatdll.adb6
-rw-r--r--gcc/ada/gnatfind.adb2
-rw-r--r--gcc/ada/gnatlbr.adb6
-rw-r--r--gcc/ada/gnatmake.ads11
-rw-r--r--gcc/ada/gnatmem.adb4
-rw-r--r--gcc/ada/gnatprep.adb3
-rw-r--r--gcc/ada/gnatprep.ads6
-rw-r--r--gcc/ada/gnatsym.adb4
-rw-r--r--gcc/ada/gnatvsn.ads4
-rw-r--r--gcc/ada/gnatxref.adb4
-rw-r--r--gcc/ada/gprep.adb53
-rw-r--r--gcc/ada/gprep.ads4
-rw-r--r--gcc/ada/gprmake.adb4
-rw-r--r--gcc/ada/gsocket.h6
-rw-r--r--gcc/ada/i-fortra.adb14
-rw-r--r--gcc/ada/i-fortra.ads12
-rw-r--r--gcc/ada/impunit.adb14
-rw-r--r--gcc/ada/indepsw.ads4
-rw-r--r--gcc/ada/init.c7
-rw-r--r--gcc/ada/inline.adb13
-rw-r--r--gcc/ada/interfac.ads26
-rw-r--r--gcc/ada/layout.adb4
-rw-r--r--gcc/ada/lib-writ.adb38
-rw-r--r--gcc/ada/lib-writ.ads14
-rw-r--r--gcc/ada/lib-xref.adb15
-rw-r--r--gcc/ada/live.adb4
-rw-r--r--gcc/ada/make.adb631
-rw-r--r--gcc/ada/make.ads12
-rw-r--r--gcc/ada/makegpr.adb15
-rw-r--r--gcc/ada/makegpr.ads4
-rw-r--r--gcc/ada/makeutl.adb2
-rw-r--r--gcc/ada/makeutl.ads2
-rw-r--r--gcc/ada/mdll-fil.adb4
-rw-r--r--gcc/ada/mdll-fil.ads4
-rw-r--r--gcc/ada/mdll-utl.ads4
-rw-r--r--gcc/ada/mdll.adb37
-rw-r--r--gcc/ada/memroot.adb1
-rw-r--r--gcc/ada/memroot.ads4
-rw-r--r--gcc/ada/memtrack.adb12
-rw-r--r--gcc/ada/mlib-fil.adb2
-rw-r--r--gcc/ada/mlib-fil.ads6
-rw-r--r--gcc/ada/mlib-prj.adb418
-rw-r--r--gcc/ada/mlib-prj.ads2
-rw-r--r--gcc/ada/mlib-tgt-aix.adb17
-rw-r--r--gcc/ada/mlib-tgt-darwin.adb13
-rw-r--r--gcc/ada/mlib-tgt-hpux.adb13
-rw-r--r--gcc/ada/mlib-tgt-irix.adb13
-rw-r--r--gcc/ada/mlib-tgt-linux.adb13
-rw-r--r--gcc/ada/mlib-tgt-lynxos.adb9
-rw-r--r--gcc/ada/mlib-tgt-mingw.adb11
-rw-r--r--gcc/ada/mlib-tgt-solaris.adb9
-rw-r--r--gcc/ada/mlib-tgt-tru64.adb13
-rw-r--r--gcc/ada/mlib-tgt-vms-alpha.adb10
-rw-r--r--gcc/ada/mlib-tgt-vms-ia64.adb10
-rw-r--r--gcc/ada/mlib-tgt-vxworks.adb9
-rw-r--r--gcc/ada/mlib-tgt.adb11
-rw-r--r--gcc/ada/mlib-tgt.ads6
-rw-r--r--gcc/ada/mlib-utl.adb2
-rw-r--r--gcc/ada/mlib-utl.ads2
-rw-r--r--gcc/ada/mlib.adb22
-rw-r--r--gcc/ada/mlib.ads2
-rw-r--r--gcc/ada/namet.h7
-rw-r--r--gcc/ada/nlists.adb2
-rw-r--r--gcc/ada/nlists.ads2
-rw-r--r--gcc/ada/opt.ads68
-rw-r--r--gcc/ada/osint-c.adb11
-rw-r--r--gcc/ada/osint-l.adb2
-rw-r--r--gcc/ada/osint-l.ads2
-rw-r--r--gcc/ada/osint-m.adb13
-rw-r--r--gcc/ada/osint-m.ads2
-rw-r--r--gcc/ada/osint.adb6
-rw-r--r--gcc/ada/osint.ads52
-rw-r--r--gcc/ada/output.adb4
-rw-r--r--gcc/ada/par-ch10.adb25
-rw-r--r--gcc/ada/par-ch11.adb2
-rw-r--r--gcc/ada/par-ch12.adb4
-rw-r--r--gcc/ada/par-ch2.adb2
-rw-r--r--gcc/ada/par-ch3.adb14
-rw-r--r--gcc/ada/par-ch4.adb4
-rw-r--r--gcc/ada/par-ch5.adb2
-rw-r--r--gcc/ada/par-ch6.adb4
-rw-r--r--gcc/ada/par-ch9.adb10
-rw-r--r--gcc/ada/par-endh.adb4
-rw-r--r--gcc/ada/par-labl.adb10
-rw-r--r--gcc/ada/par-load.adb2
-rw-r--r--gcc/ada/par-prag.adb30
-rw-r--r--gcc/ada/par-tchk.adb6
-rw-r--r--gcc/ada/par.adb4
-rw-r--r--gcc/ada/par.ads2
-rw-r--r--gcc/ada/prep.adb63
-rw-r--r--gcc/ada/prepcomp.adb19
-rw-r--r--gcc/ada/prepcomp.ads4
-rw-r--r--gcc/ada/prj-attr-pm.ads8
-rw-r--r--gcc/ada/prj-attr.adb5
-rw-r--r--gcc/ada/prj-attr.ads5
-rw-r--r--gcc/ada/prj-com.ads4
-rw-r--r--gcc/ada/prj-dect.adb4
-rw-r--r--gcc/ada/prj-dect.ads2
-rw-r--r--gcc/ada/prj-env.adb38
-rw-r--r--gcc/ada/prj-env.ads2
-rw-r--r--gcc/ada/prj-err.ads19
-rw-r--r--gcc/ada/prj-ext.adb60
-rw-r--r--gcc/ada/prj-ext.ads6
-rw-r--r--gcc/ada/prj-makr.adb2
-rw-r--r--gcc/ada/prj-makr.ads4
-rw-r--r--gcc/ada/prj-nmsc.adb285
-rw-r--r--gcc/ada/prj-nmsc.ads4
-rw-r--r--gcc/ada/prj-pars.adb2
-rw-r--r--gcc/ada/prj-pars.ads2
-rw-r--r--gcc/ada/prj-part.adb15
-rw-r--r--gcc/ada/prj-part.ads4
-rw-r--r--gcc/ada/prj-pp.adb24
-rw-r--r--gcc/ada/prj-pp.ads36
-rw-r--r--gcc/ada/prj-proc.adb4
-rw-r--r--gcc/ada/prj-proc.ads12
-rw-r--r--gcc/ada/prj-strt.adb18
-rw-r--r--gcc/ada/prj-strt.ads4
-rw-r--r--gcc/ada/prj-tree.adb2
-rw-r--r--gcc/ada/prj-tree.ads30
-rw-r--r--gcc/ada/prj-util.adb2
-rw-r--r--gcc/ada/prj-util.ads37
-rw-r--r--gcc/ada/prj.adb10
-rw-r--r--gcc/ada/prj.ads100
-rw-r--r--gcc/ada/raise-gcc.c1151
-rw-r--r--gcc/ada/raise.c1122
-rw-r--r--gcc/ada/repinfo.adb143
-rw-r--r--gcc/ada/repinfo.ads7
-rw-r--r--gcc/ada/repinfo.h3
-rw-r--r--gcc/ada/rtsfind.adb4
-rw-r--r--gcc/ada/rtsfind.ads85
-rw-r--r--gcc/ada/s-auxdec-empty.adb36
-rw-r--r--gcc/ada/s-auxdec-empty.ads49
-rw-r--r--gcc/ada/s-bitops.adb2
-rw-r--r--gcc/ada/s-chepoo.ads28
-rw-r--r--gcc/ada/s-exnllf.adb6
-rw-r--r--gcc/ada/s-fatflt.ads2
-rw-r--r--gcc/ada/s-fatgen.adb121
-rw-r--r--gcc/ada/s-fatgen.ads13
-rw-r--r--gcc/ada/s-fatlfl.ads2
-rw-r--r--gcc/ada/s-fatllf.ads2
-rw-r--r--gcc/ada/s-fatsfl.ads2
-rw-r--r--gcc/ada/s-fileio.ads4
-rw-r--r--gcc/ada/s-filofl.ads54
-rw-r--r--gcc/ada/s-finroo.adb12
-rw-r--r--gcc/ada/s-finroo.ads11
-rw-r--r--gcc/ada/s-fishfl.ads54
-rw-r--r--gcc/ada/s-fvadfl.ads56
-rw-r--r--gcc/ada/s-fvaffl.ads56
-rw-r--r--gcc/ada/s-fvagfl.ads56
-rw-r--r--gcc/ada/s-gloloc-mingw.adb4
-rw-r--r--gcc/ada/s-imgwch.ads2
-rw-r--r--gcc/ada/s-imgwiu.adb2
-rw-r--r--gcc/ada/s-imgwiu.ads2
-rw-r--r--gcc/ada/s-inmaop-dummy.adb5
-rw-r--r--gcc/ada/s-inmaop-vms.adb5
-rw-r--r--gcc/ada/s-inmaop.ads20
-rw-r--r--gcc/ada/s-interr-sigaction.adb2
-rw-r--r--gcc/ada/s-mastop-tru64.adb4
-rw-r--r--gcc/ada/s-mastop-vms.adb8
-rw-r--r--gcc/ada/s-osinte-fsu.adb4
-rw-r--r--gcc/ada/s-pack03.adb4
-rw-r--r--gcc/ada/s-pack03.ads2
-rw-r--r--gcc/ada/s-pack05.adb4
-rw-r--r--gcc/ada/s-pack05.ads2
-rw-r--r--gcc/ada/s-pack06.adb4
-rw-r--r--gcc/ada/s-pack06.ads2
-rw-r--r--gcc/ada/s-pack07.adb4
-rw-r--r--gcc/ada/s-pack07.ads2
-rw-r--r--gcc/ada/s-pack09.adb4
-rw-r--r--gcc/ada/s-pack09.ads2
-rw-r--r--gcc/ada/s-pack10.adb4
-rw-r--r--gcc/ada/s-pack10.ads2
-rw-r--r--gcc/ada/s-pack11.adb4
-rw-r--r--gcc/ada/s-pack11.ads2
-rw-r--r--gcc/ada/s-pack12.adb4
-rw-r--r--gcc/ada/s-pack12.ads2
-rw-r--r--gcc/ada/s-pack13.adb4
-rw-r--r--gcc/ada/s-pack13.ads2
-rw-r--r--gcc/ada/s-pack14.adb6
-rw-r--r--gcc/ada/s-pack14.ads2
-rw-r--r--gcc/ada/s-pack15.adb4
-rw-r--r--gcc/ada/s-pack15.ads2
-rw-r--r--gcc/ada/s-pack17.adb4
-rw-r--r--gcc/ada/s-pack17.ads2
-rw-r--r--gcc/ada/s-pack18.adb6
-rw-r--r--gcc/ada/s-pack18.ads2
-rw-r--r--gcc/ada/s-pack19.adb4
-rw-r--r--gcc/ada/s-pack19.ads2
-rw-r--r--gcc/ada/s-pack20.adb6
-rw-r--r--gcc/ada/s-pack20.ads2
-rw-r--r--gcc/ada/s-pack21.adb4
-rw-r--r--gcc/ada/s-pack21.ads2
-rw-r--r--gcc/ada/s-pack22.adb6
-rw-r--r--gcc/ada/s-pack22.ads2
-rw-r--r--gcc/ada/s-pack23.adb4
-rw-r--r--gcc/ada/s-pack23.ads2
-rw-r--r--gcc/ada/s-pack24.adb6
-rw-r--r--gcc/ada/s-pack24.ads2
-rw-r--r--gcc/ada/s-pack25.adb2
-rw-r--r--gcc/ada/s-pack25.ads2
-rw-r--r--gcc/ada/s-pack26.adb6
-rw-r--r--gcc/ada/s-pack26.ads2
-rw-r--r--gcc/ada/s-pack27.adb4
-rw-r--r--gcc/ada/s-pack27.ads2
-rw-r--r--gcc/ada/s-pack28.adb6
-rw-r--r--gcc/ada/s-pack28.ads2
-rw-r--r--gcc/ada/s-pack29.adb4
-rw-r--r--gcc/ada/s-pack29.ads2
-rw-r--r--gcc/ada/s-pack30.adb6
-rw-r--r--gcc/ada/s-pack30.ads2
-rw-r--r--gcc/ada/s-pack31.adb4
-rw-r--r--gcc/ada/s-pack31.ads2
-rw-r--r--gcc/ada/s-pack33.adb4
-rw-r--r--gcc/ada/s-pack33.ads2
-rw-r--r--gcc/ada/s-pack34.adb6
-rw-r--r--gcc/ada/s-pack34.ads2
-rw-r--r--gcc/ada/s-pack35.adb4
-rw-r--r--gcc/ada/s-pack35.ads2
-rw-r--r--gcc/ada/s-pack36.adb6
-rw-r--r--gcc/ada/s-pack36.ads2
-rw-r--r--gcc/ada/s-pack37.adb4
-rw-r--r--gcc/ada/s-pack37.ads2
-rw-r--r--gcc/ada/s-pack38.adb6
-rw-r--r--gcc/ada/s-pack38.ads2
-rw-r--r--gcc/ada/s-pack39.adb4
-rw-r--r--gcc/ada/s-pack39.ads2
-rw-r--r--gcc/ada/s-pack40.adb6
-rw-r--r--gcc/ada/s-pack40.ads2
-rw-r--r--gcc/ada/s-pack41.adb4
-rw-r--r--gcc/ada/s-pack41.ads2
-rw-r--r--gcc/ada/s-pack42.adb6
-rw-r--r--gcc/ada/s-pack42.ads2
-rw-r--r--gcc/ada/s-pack43.adb4
-rw-r--r--gcc/ada/s-pack43.ads2
-rw-r--r--gcc/ada/s-pack44.adb6
-rw-r--r--gcc/ada/s-pack44.ads2
-rw-r--r--gcc/ada/s-pack45.adb4
-rw-r--r--gcc/ada/s-pack45.ads2
-rw-r--r--gcc/ada/s-pack46.adb6
-rw-r--r--gcc/ada/s-pack46.ads2
-rw-r--r--gcc/ada/s-pack47.adb4
-rw-r--r--gcc/ada/s-pack47.ads2
-rw-r--r--gcc/ada/s-pack48.adb6
-rw-r--r--gcc/ada/s-pack48.ads2
-rw-r--r--gcc/ada/s-pack49.adb4
-rw-r--r--gcc/ada/s-pack49.ads2
-rw-r--r--gcc/ada/s-pack50.adb6
-rw-r--r--gcc/ada/s-pack50.ads2
-rw-r--r--gcc/ada/s-pack51.adb4
-rw-r--r--gcc/ada/s-pack51.ads2
-rw-r--r--gcc/ada/s-pack52.adb6
-rw-r--r--gcc/ada/s-pack52.ads2
-rw-r--r--gcc/ada/s-pack53.adb4
-rw-r--r--gcc/ada/s-pack53.ads2
-rw-r--r--gcc/ada/s-pack54.adb6
-rw-r--r--gcc/ada/s-pack54.ads2
-rw-r--r--gcc/ada/s-pack55.adb4
-rw-r--r--gcc/ada/s-pack55.ads2
-rw-r--r--gcc/ada/s-pack56.adb6
-rw-r--r--gcc/ada/s-pack56.ads2
-rw-r--r--gcc/ada/s-pack57.adb4
-rw-r--r--gcc/ada/s-pack57.ads2
-rw-r--r--gcc/ada/s-pack58.adb6
-rw-r--r--gcc/ada/s-pack58.ads2
-rw-r--r--gcc/ada/s-pack59.adb4
-rw-r--r--gcc/ada/s-pack59.ads2
-rw-r--r--gcc/ada/s-pack60.adb6
-rw-r--r--gcc/ada/s-pack60.ads2
-rw-r--r--gcc/ada/s-pack61.adb4
-rw-r--r--gcc/ada/s-pack61.ads2
-rw-r--r--gcc/ada/s-pack62.adb6
-rw-r--r--gcc/ada/s-pack62.ads2
-rw-r--r--gcc/ada/s-pack63.adb4
-rw-r--r--gcc/ada/s-pack63.ads2
-rw-r--r--gcc/ada/s-parame-mingw.adb2
-rw-r--r--gcc/ada/s-parint.adb4
-rw-r--r--gcc/ada/s-parint.ads2
-rw-r--r--gcc/ada/s-purexc.ads2
-rw-r--r--gcc/ada/s-restri.adb2
-rw-r--r--gcc/ada/s-restri.ads2
-rw-r--r--gcc/ada/s-scaval.adb2
-rw-r--r--gcc/ada/s-scaval.ads2
-rw-r--r--gcc/ada/s-secsta.adb2
-rw-r--r--gcc/ada/s-secsta.ads2
-rw-r--r--gcc/ada/s-sequio.adb2
-rw-r--r--gcc/ada/s-sequio.ads2
-rw-r--r--gcc/ada/s-stoele.adb10
-rw-r--r--gcc/ada/s-stratt.adb92
-rw-r--r--gcc/ada/s-stratt.ads81
-rw-r--r--gcc/ada/s-strxdr.adb87
-rw-r--r--gcc/ada/s-taprop-posix.adb1
-rw-r--r--gcc/ada/s-taprop-solaris.adb12
-rw-r--r--gcc/ada/s-tasini.adb11
-rw-r--r--gcc/ada/s-tassta.adb20
-rw-r--r--gcc/ada/s-tasuti.adb8
-rw-r--r--gcc/ada/s-traceb-hpux.adb8
-rw-r--r--gcc/ada/s-traceb-mastop.adb6
-rw-r--r--gcc/ada/s-traceb.adb2
-rw-r--r--gcc/ada/s-traceb.ads4
-rw-r--r--gcc/ada/s-traces-default.adb6
-rw-r--r--gcc/ada/s-trafor-default.ads1
-rw-r--r--gcc/ada/s-tratas-default.adb74
-rw-r--r--gcc/ada/s-vaflop-vms-alpha.adb6
-rw-r--r--gcc/ada/s-vaflop.adb26
-rw-r--r--gcc/ada/s-vaflop.ads8
-rw-r--r--gcc/ada/s-valboo.adb13
-rw-r--r--gcc/ada/s-valboo.ads4
-rw-r--r--gcc/ada/s-valcha.adb3
-rw-r--r--gcc/ada/s-valcha.ads4
-rw-r--r--gcc/ada/s-valdec.adb6
-rw-r--r--gcc/ada/s-valdec.ads5
-rw-r--r--gcc/ada/s-valint.adb8
-rw-r--r--gcc/ada/s-valint.ads8
-rw-r--r--gcc/ada/s-vallld.adb9
-rw-r--r--gcc/ada/s-vallld.ads8
-rw-r--r--gcc/ada/s-vallli.adb3
-rw-r--r--gcc/ada/s-vallli.ads2
-rw-r--r--gcc/ada/s-valllu.adb9
-rw-r--r--gcc/ada/s-valllu.ads8
-rw-r--r--gcc/ada/s-valrea.adb15
-rw-r--r--gcc/ada/s-valrea.ads8
-rw-r--r--gcc/ada/s-valuns.adb11
-rw-r--r--gcc/ada/s-valuns.ads12
-rw-r--r--gcc/ada/s-valuti.adb5
-rw-r--r--gcc/ada/s-valuti.ads5
-rw-r--r--gcc/ada/s-valwch.ads2
-rw-r--r--gcc/ada/s-veboop.adb2
-rw-r--r--gcc/ada/s-veboop.ads2
-rw-r--r--gcc/ada/s-vercon.adb3
-rw-r--r--gcc/ada/s-vercon.ads2
-rw-r--r--gcc/ada/s-wchcnv.adb2
-rw-r--r--gcc/ada/s-wchcnv.ads2
-rw-r--r--gcc/ada/s-wchcon.ads2
-rw-r--r--gcc/ada/s-wchjis.adb2
-rw-r--r--gcc/ada/s-wchjis.ads2
-rw-r--r--gcc/ada/s-wchstw.adb6
-rw-r--r--gcc/ada/s-wchstw.ads2
-rw-r--r--gcc/ada/s-wchwts.adb2
-rw-r--r--gcc/ada/s-wchwts.ads2
-rw-r--r--gcc/ada/s-widboo.adb2
-rw-r--r--gcc/ada/s-widboo.ads2
-rw-r--r--gcc/ada/s-widcha.adb2
-rw-r--r--gcc/ada/s-widcha.ads2
-rw-r--r--gcc/ada/s-widenu.adb2
-rw-r--r--gcc/ada/s-widenu.ads2
-rw-r--r--gcc/ada/s-widlli.adb2
-rw-r--r--gcc/ada/s-widlli.ads2
-rw-r--r--gcc/ada/s-widllu.adb2
-rw-r--r--gcc/ada/s-widllu.ads2
-rw-r--r--gcc/ada/s-widwch.adb2
-rw-r--r--gcc/ada/s-widwch.ads2
-rw-r--r--gcc/ada/s-wwdcha.adb2
-rw-r--r--gcc/ada/s-wwdcha.ads2
-rw-r--r--gcc/ada/s-wwdenu.adb2
-rw-r--r--gcc/ada/s-wwdenu.ads2
-rw-r--r--gcc/ada/scans.ads35
-rw-r--r--gcc/ada/scng.adb11
-rw-r--r--gcc/ada/sem.adb12
-rw-r--r--gcc/ada/sem.ads4
-rw-r--r--gcc/ada/sem_aggr.adb31
-rw-r--r--gcc/ada/sem_aggr.ads2
-rw-r--r--gcc/ada/sem_attr.adb93
-rw-r--r--gcc/ada/sem_case.adb2
-rw-r--r--gcc/ada/sem_case.ads26
-rw-r--r--gcc/ada/sem_cat.ads4
-rw-r--r--gcc/ada/sem_ch10.adb118
-rw-r--r--gcc/ada/sem_ch11.adb2
-rw-r--r--gcc/ada/sem_ch12.adb404
-rw-r--r--gcc/ada/sem_ch12.ads9
-rw-r--r--gcc/ada/sem_ch3.adb434
-rw-r--r--gcc/ada/sem_ch3.ads21
-rw-r--r--gcc/ada/sem_ch4.adb29
-rw-r--r--gcc/ada/sem_ch5.adb15
-rw-r--r--gcc/ada/sem_ch5.ads11
-rw-r--r--gcc/ada/sem_ch6.adb201
-rw-r--r--gcc/ada/sem_ch6.ads2
-rw-r--r--gcc/ada/sem_ch7.adb101
-rw-r--r--gcc/ada/sem_ch7.ads8
-rw-r--r--gcc/ada/sem_ch8.adb282
-rw-r--r--gcc/ada/sem_ch9.adb155
-rw-r--r--gcc/ada/sem_disp.adb17
-rw-r--r--gcc/ada/sem_dist.ads2
-rw-r--r--gcc/ada/sem_elab.adb220
-rw-r--r--gcc/ada/sem_elab.ads2
-rw-r--r--gcc/ada/sem_elim.ads2
-rw-r--r--gcc/ada/sem_eval.adb32
-rw-r--r--gcc/ada/sem_eval.ads2
-rw-r--r--gcc/ada/sem_intr.adb11
-rw-r--r--gcc/ada/sem_intr.ads2
-rw-r--r--gcc/ada/sem_maps.adb2
-rw-r--r--gcc/ada/sem_maps.ads12
-rw-r--r--gcc/ada/sem_prag.adb138
-rw-r--r--gcc/ada/sem_prag.ads78
-rw-r--r--gcc/ada/sem_res.adb193
-rw-r--r--gcc/ada/sem_res.ads2
-rw-r--r--gcc/ada/sem_type.adb80
-rw-r--r--gcc/ada/sem_type.ads6
-rw-r--r--gcc/ada/sem_util.adb155
-rw-r--r--gcc/ada/sem_util.ads6
-rw-r--r--gcc/ada/sem_warn.adb219
-rw-r--r--gcc/ada/sem_warn.ads11
-rw-r--r--gcc/ada/sfn_scan.adb2
-rw-r--r--gcc/ada/sfn_scan.ads2
-rw-r--r--gcc/ada/sinfo.adb52
-rw-r--r--gcc/ada/sinfo.ads122
-rw-r--r--gcc/ada/sinput.adb4
-rw-r--r--gcc/ada/sinput.ads4
-rw-r--r--gcc/ada/snames.adb4
-rw-r--r--gcc/ada/snames.ads1418
-rw-r--r--gcc/ada/snames.h171
-rw-r--r--gcc/ada/socket.c41
-rw-r--r--gcc/ada/sprint.ads4
-rw-r--r--gcc/ada/stand.ads18
-rw-r--r--gcc/ada/stringt.adb2
-rw-r--r--gcc/ada/stringt.ads2
-rw-r--r--gcc/ada/styleg.ads6
-rw-r--r--gcc/ada/switch-b.adb42
-rw-r--r--gcc/ada/switch-c.adb281
-rw-r--r--gcc/ada/switch-m.adb48
-rw-r--r--gcc/ada/switch.adb47
-rw-r--r--gcc/ada/switch.ads23
-rw-r--r--gcc/ada/symbols.adb2
-rw-r--r--gcc/ada/symbols.ads4
-rw-r--r--gcc/ada/system-aix.ads2
-rw-r--r--gcc/ada/system-darwin-ppc.ads2
-rw-r--r--gcc/ada/system-freebsd-x86.ads2
-rw-r--r--gcc/ada/system-hpux-ia64.ads2
-rw-r--r--gcc/ada/system-hpux.ads2
-rw-r--r--gcc/ada/system-interix.ads2
-rw-r--r--gcc/ada/system-irix-n32.ads2
-rw-r--r--gcc/ada/system-irix-o32.ads2
-rw-r--r--gcc/ada/system-linux-hppa.ads2
-rw-r--r--gcc/ada/system-linux-ia64.ads2
-rw-r--r--gcc/ada/system-linux-ppc.ads2
-rw-r--r--gcc/ada/system-linux-x86.ads2
-rw-r--r--gcc/ada/system-linux-x86_64.ads2
-rw-r--r--gcc/ada/system-lynxos-ppc.ads24
-rw-r--r--gcc/ada/system-lynxos-x86.ads24
-rw-r--r--gcc/ada/system-mingw.ads2
-rw-r--r--gcc/ada/system-os2.ads2
-rw-r--r--gcc/ada/system-solaris-sparc.ads2
-rw-r--r--gcc/ada/system-solaris-sparcv9.ads2
-rw-r--r--gcc/ada/system-solaris-x86.ads2
-rw-r--r--gcc/ada/system-tru64.ads2
-rw-r--r--gcc/ada/system-unixware.ads2
-rw-r--r--gcc/ada/system-vms-zcx.ads2
-rw-r--r--gcc/ada/system-vms.ads7
-rw-r--r--gcc/ada/system-vms_64.ads7
-rw-r--r--gcc/ada/table.ads6
-rw-r--r--gcc/ada/targparm.adb2
-rw-r--r--gcc/ada/targparm.ads6
-rw-r--r--gcc/ada/tb-alvms.c2
-rw-r--r--gcc/ada/tb-alvxw.c2
-rw-r--r--gcc/ada/tb-gcc.c15
-rw-r--r--gcc/ada/tbuild.adb2
-rw-r--r--gcc/ada/tempdir.adb7
-rw-r--r--gcc/ada/tracebak.c16
-rw-r--r--gcc/ada/trans.c224
-rw-r--r--gcc/ada/tree_io.ads4
-rw-r--r--gcc/ada/treepr.adb2
-rw-r--r--gcc/ada/treeprs.adt2
-rw-r--r--gcc/ada/ttypef.ads2
-rw-r--r--gcc/ada/ttypes.ads4
-rw-r--r--gcc/ada/types.adb2
-rw-r--r--gcc/ada/types.ads21
-rw-r--r--gcc/ada/ug_words2
-rw-r--r--gcc/ada/uintp.adb30
-rw-r--r--gcc/ada/uintp.ads30
-rw-r--r--gcc/ada/uname.ads2
-rw-r--r--gcc/ada/urealp.ads24
-rw-r--r--gcc/ada/usage.adb16
-rw-r--r--gcc/ada/usage.ads2
-rw-r--r--gcc/ada/utils.c100
-rw-r--r--gcc/ada/utils2.c127
-rw-r--r--gcc/ada/validsw.ads13
-rw-r--r--gcc/ada/vms_conv.adb4
-rw-r--r--gcc/ada/vms_conv.ads2
-rw-r--r--gcc/ada/vms_data.ads40
-rw-r--r--gcc/ada/vxaddr2line.adb8
-rw-r--r--gcc/ada/widechar.adb2
-rw-r--r--gcc/ada/widechar.ads2
-rw-r--r--gcc/ada/xeinfo.adb2
-rw-r--r--gcc/ada/xgnatugn.adb14
-rw-r--r--gcc/ada/xnmake.adb2
-rw-r--r--gcc/ada/xr_tabls.adb12
-rw-r--r--gcc/ada/xr_tabls.ads85
-rw-r--r--gcc/ada/xref_lib.adb9
-rw-r--r--gcc/ada/xref_lib.ads18
-rw-r--r--gcc/ada/xsinfo.adb2
-rw-r--r--gcc/ada/xsnames.adb2
-rw-r--r--gcc/ada/xtreeprs.adb2
-rw-r--r--gcc/c-common.c2
-rw-r--r--gcc/c-decl.c9
-rw-r--r--gcc/c-tree.h1
-rw-r--r--gcc/c.opt3
-rw-r--r--gcc/combine.c20
-rw-r--r--gcc/config.gcc9
-rw-r--r--gcc/config.in6
-rw-r--r--gcc/config/alpha/alpha.c22
-rw-r--r--gcc/config/arm/arm.c102
-rw-r--r--gcc/config/arm/arm.md25
-rw-r--r--gcc/config/arm/lib1funcs.asm20
-rw-r--r--gcc/config/arm/libunwind.S12
-rw-r--r--gcc/config/arm/linux-eabi.h17
-rw-r--r--gcc/config/arm/pr-support.c4
-rw-r--r--gcc/config/arm/unwind-arm.c191
-rw-r--r--gcc/config/arm/unwind-arm.h93
-rw-r--r--gcc/config/bfin/bfin.h5
-rw-r--r--gcc/config/bfin/bfin.md7
-rw-r--r--gcc/config/bfin/crti.s17
-rw-r--r--gcc/config/bfin/crtlibid.s32
-rw-r--r--gcc/config/bfin/crtn.s6
-rw-r--r--gcc/config/bfin/elf.h2
-rw-r--r--gcc/config/bfin/t-bfin-elf9
-rw-r--r--gcc/config/bfin/uclinux.h2
-rw-r--r--gcc/config/cris/cris.md22
-rw-r--r--gcc/config/darwin-c.c2
-rw-r--r--gcc/config/darwin.h42
-rw-r--r--gcc/config/i386/darwin.h1
-rw-r--r--gcc/config/i386/i386.c3
-rw-r--r--gcc/config/ia64/unwind-ia64.c6
-rw-r--r--gcc/config/pa/hpux-unwind.h316
-rw-r--r--gcc/config/pa/linux-unwind.h7
-rw-r--r--gcc/config/pa/pa-hpux.h2
-rw-r--r--gcc/config/pa/pa-hpux11.h2
-rw-r--r--gcc/config/pa/pa-linux.h33
-rw-r--r--gcc/config/pa/pa.h70
-rw-r--r--gcc/config/pa/pa64-hpux.h14
-rw-r--r--gcc/config/pa/som.h9
-rw-r--r--gcc/config/rs6000/aix52.h1
-rw-r--r--gcc/config/rs6000/darwin.h5
-rw-r--r--gcc/config/rs6000/predicates.md5
-rw-r--r--gcc/config/rs6000/rs6000-c.c10
-rw-r--r--gcc/config/rs6000/rs6000.c5
-rw-r--r--gcc/config/rs6000/rs6000.h29
-rw-r--r--gcc/config/rs6000/rs6000.md60
-rw-r--r--gcc/config/rs6000/rs6000.opt8
-rwxr-xr-xgcc/configure46
-rw-r--r--gcc/configure.ac15
-rw-r--r--gcc/cp/ChangeLog72
-rw-r--r--gcc/cp/cxx-pretty-print.c9
-rw-r--r--gcc/cp/decl.c90
-rw-r--r--gcc/cp/error.c3
-rw-r--r--gcc/cp/method.c10
-rw-r--r--gcc/cp/name-lookup.c28
-rw-r--r--gcc/cp/name-lookup.h1
-rw-r--r--gcc/cp/parser.c176
-rw-r--r--gcc/cp/pt.c8
-rw-r--r--gcc/cp/typeck.c20
-rw-r--r--gcc/crtstuff.c6
-rw-r--r--gcc/defaults.h2
-rw-r--r--gcc/doc/invoke.texi89
-rw-r--r--gcc/doc/tm.texi21
-rw-r--r--gcc/dwarf2out.c126
-rw-r--r--gcc/expmed.c23
-rw-r--r--gcc/expr.c2
-rw-r--r--gcc/fold-const.c63
-rw-r--r--gcc/fortran/ChangeLog20
-rw-r--r--gcc/fortran/gfortran.h2
-rw-r--r--gcc/fortran/module.c2
-rw-r--r--gcc/fortran/options.c17
-rw-r--r--gcc/fortran/scanner.c16
-rw-r--r--gcc/fortran/trans-types.c9
-rw-r--r--gcc/function.c13
-rw-r--r--gcc/gcc.c11
-rw-r--r--gcc/ipa-inline.c6
-rw-r--r--gcc/loop-invariant.c1
-rw-r--r--gcc/loop-unroll.c10
-rw-r--r--gcc/loop.c6
-rw-r--r--gcc/mklibgcc.in2
-rw-r--r--gcc/params.def4
-rw-r--r--gcc/postreload.c2
-rw-r--r--gcc/regrename.c45
-rw-r--r--gcc/reload1.c131
-rw-r--r--gcc/simplify-rtx.c11
-rw-r--r--gcc/testsuite/ChangeLog111
-rwxr-xr-xgcc/testsuite/ada/acats/run_all.sh19
-rw-r--r--gcc/testsuite/g++.dg/cpp/string-2.C7
-rw-r--r--gcc/testsuite/g++.dg/eh/forced1.C7
-rw-r--r--gcc/testsuite/g++.dg/eh/forced2.C4
-rw-r--r--gcc/testsuite/g++.dg/eh/forced3.C4
-rw-r--r--gcc/testsuite/g++.dg/eh/forced4.C4
-rw-r--r--gcc/testsuite/g++.dg/eh/simd-2.C1
-rw-r--r--gcc/testsuite/g++.dg/eh/spec8.C11
-rw-r--r--gcc/testsuite/g++.dg/eh/synth2.C24
-rw-r--r--gcc/testsuite/g++.dg/lookup/ambig4.C6
-rw-r--r--gcc/testsuite/g++.dg/lookup/ambig5.C4
-rw-r--r--gcc/testsuite/g++.dg/lookup/strong-using-2.C4
-rw-r--r--gcc/testsuite/g++.dg/parse/ambig4.C18
-rw-r--r--gcc/testsuite/g++.dg/parse/crash22.C8
-rw-r--r--gcc/testsuite/g++.dg/tc1/dr101.C4
-rw-r--r--gcc/testsuite/g++.dg/template/crash43.C8
-rw-r--r--gcc/testsuite/g++.dg/warn/Wcast-qual1.C7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/unused.C7
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20051113-1.c71
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr24851.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp2
-rw-r--r--gcc/testsuite/gcc.dg/attr-weakref-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-10.c5
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-11.c5
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-5.c3
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-8.c5
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-9.c5
-rw-r--r--gcc/testsuite/gcc.dg/fold-overflow-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/pack-test-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr19340.c1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-14.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr24840.c17
-rw-r--r--gcc/testsuite/gcc.dg/uninit-12.c12
-rw-r--r--gcc/testsuite/gcc.dg/uninit-13.c10
-rw-r--r--gcc/testsuite/gcc.dg/winline-5.c2
-rw-r--r--gcc/testsuite/gfortran.dg/open_access_append_1.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/open_access_append_2.f905
-rw-r--r--gcc/tree-flow.h14
-rw-r--r--gcc/tree-scalar-evolution.c63
-rw-r--r--gcc/tree-ssa-dom.c16
-rw-r--r--gcc/tree-ssa.c23
-rw-r--r--gcc/tree-vrp.c7
-rw-r--r--gcc/tree.def4
-rw-r--r--gcc/unwind-c.c2
-rw-r--r--gcc/unwind-dw2.c10
-rw-r--r--gcc/unwind-sjlj.c19
-rw-r--r--gcc/unwind.inc5
-rw-r--r--gcc/var-tracking.c5
-rw-r--r--gcc/varasm.c7
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/include/cpplib.h2
-rw-r--r--libgfortran/ChangeLog27
-rw-r--r--libgfortran/Makefile.am10
-rw-r--r--libgfortran/Makefile.in157
-rw-r--r--libgfortran/config/fpu-glibc.h3
-rwxr-xr-xlibgfortran/configure616
-rw-r--r--libgfortran/configure.ac2
-rw-r--r--libgfortran/generated/matmul_c10.c24
-rw-r--r--libgfortran/generated/matmul_c16.c24
-rw-r--r--libgfortran/generated/matmul_c4.c24
-rw-r--r--libgfortran/generated/matmul_c8.c24
-rw-r--r--libgfortran/generated/matmul_i16.c24
-rw-r--r--libgfortran/generated/matmul_i4.c24
-rw-r--r--libgfortran/generated/matmul_i8.c24
-rw-r--r--libgfortran/generated/matmul_l16.c16
-rw-r--r--libgfortran/generated/matmul_l4.c16
-rw-r--r--libgfortran/generated/matmul_l8.c16
-rw-r--r--libgfortran/generated/matmul_r10.c24
-rw-r--r--libgfortran/generated/matmul_r16.c24
-rw-r--r--libgfortran/generated/matmul_r4.c24
-rw-r--r--libgfortran/generated/matmul_r8.c24
-rw-r--r--libgfortran/io/io.h2
-rw-r--r--libgfortran/io/open.c15
-rw-r--r--libgfortran/m4/matmul.m424
-rw-r--r--libgfortran/m4/matmull.m416
-rw-r--r--libjava/ChangeLog256
-rw-r--r--libjava/Makefile.in546
-rw-r--r--libjava/classpath/.classpath4
-rw-r--r--libjava/classpath/.settings/org.eclipse.jdt.core.prefs18
-rw-r--r--libjava/classpath/.settings/org.eclipse.jdt.ui.prefs5
-rw-r--r--libjava/classpath/AUTHORS7
-rw-r--r--libjava/classpath/BUGS2
-rw-r--r--libjava/classpath/ChangeLog10233
-rw-r--r--libjava/classpath/INSTALL35
-rw-r--r--libjava/classpath/LICENSE14
-rw-r--r--libjava/classpath/Makefile.am3
-rw-r--r--libjava/classpath/Makefile.in17
-rw-r--r--libjava/classpath/NEWS55
-rw-r--r--libjava/classpath/aclocal.m437
-rwxr-xr-xlibjava/classpath/autogen.sh2
-rwxr-xr-xlibjava/classpath/config.guess614
-rwxr-xr-xlibjava/classpath/config.sub185
-rwxr-xr-xlibjava/classpath/configure2635
-rw-r--r--libjava/classpath/configure.ac167
-rw-r--r--libjava/classpath/doc/Makefile.in12
-rw-r--r--libjava/classpath/doc/api/Makefile.in12
-rw-r--r--libjava/classpath/doc/www.gnu.org/announce/20050906.wml221
-rw-r--r--libjava/classpath/doc/www.gnu.org/announce/20051102.wml247
-rw-r--r--libjava/classpath/doc/www.gnu.org/corba.wml37
-rwxr-xr-xlibjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml9
-rw-r--r--libjava/classpath/doc/www.gnu.org/downloads/downloads.wml20
-rw-r--r--libjava/classpath/doc/www.gnu.org/home.wml2
-rw-r--r--libjava/classpath/doc/www.gnu.org/include/layout.wml2
-rw-r--r--libjava/classpath/doc/www.gnu.org/newsitems.txt10
-rwxr-xr-xlibjava/classpath/doc/www.gnu.org/tasks.wml338
-rw-r--r--libjava/classpath/examples/Makefile.am7
-rw-r--r--libjava/classpath/examples/Makefile.in19
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java4
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java31
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/comServer.java)10
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comServant.java)32
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester.java)16
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java40
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java56
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis.java)9
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHelper.java)19
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHolder.java)14
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis.java)9
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHelper.java)17
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHolder.java)14
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/node.java)15
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHelper.java)44
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHolder.java)32
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException.java)11
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserExceptionHelper.java)18
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterImplBase.java)31
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java (renamed from libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterStub.java)37
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/README.html493
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java307
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java80
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java417
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java99
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java68
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java135
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java124
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java236
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Player.java96
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java275
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java512
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/State.java82
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java175
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java214
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java207
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java212
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java397
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java137
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java284
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch19
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java360
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java214
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java228
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java184
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java219
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java141
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java249
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java488
-rw-r--r--libjava/classpath/external/Makefile.in12
-rw-r--r--libjava/classpath/external/sax/Makefile.in12
-rw-r--r--libjava/classpath/external/w3c_dom/Makefile.in12
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java (renamed from libjava/classpath/gnu/CORBA/CDR/cdrInput.java)704
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java (renamed from libjava/classpath/gnu/CORBA/CDR/cdrOutput.java)162
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractDataInput.java (renamed from libjava/classpath/gnu/CORBA/CDR/abstractDataInputStream.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractDataOutput.java (renamed from libjava/classpath/gnu/CORBA/CDR/abstractDataOutputStream.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AligningInput.java (renamed from libjava/classpath/gnu/CORBA/CDR/aligningInputStream.java)39
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AligningOutput.java (renamed from libjava/classpath/gnu/CORBA/CDR/aligningOutputStream.java)37
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/ArrayValueHelper.java254
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/BufferedCdrOutput.java (renamed from libjava/classpath/gnu/CORBA/CDR/cdrBufOutput.java)69
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/BufferredCdrInput.java (renamed from libjava/classpath/gnu/CORBA/CDR/cdrBufInput.java)58
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/EncapsulationStream.java (renamed from libjava/classpath/gnu/CORBA/CDR/encapsulatedOutput.java)12
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java749
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/IDLTypeHelper.java169
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/UnknownExceptionCtxHandler.java292
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/VMVio.java101
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/Vio.java1459
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java336
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/gnuValueStream.java71
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/noHeaderInput.java166
-rw-r--r--libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java (renamed from libjava/classpath/gnu/CORBA/cdrEncapsCodec.java)58
-rw-r--r--libjava/classpath/gnu/CORBA/Connected_objects.java11
-rw-r--r--libjava/classpath/gnu/CORBA/CorbaList.java (renamed from libjava/classpath/gnu/CORBA/corbaArrayList.java)8
-rw-r--r--libjava/classpath/gnu/CORBA/DefaultSocketFactory.java79
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java (renamed from libjava/classpath/gnu/CORBA/DynAn/abstractDynAny.java)14
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java (renamed from libjava/classpath/gnu/CORBA/DynAn/anyDivideable.java)16
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/RecordAny.java (renamed from libjava/classpath/gnu/CORBA/DynAn/abstractRecord.java)18
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java (renamed from libjava/classpath/gnu/CORBA/DynAn/anyUndivideable.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java (renamed from libjava/classpath/gnu/CORBA/DynAn/valueChangedListener.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java28
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java8
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java14
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java2
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java2
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java4
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java10
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java14
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java6
-rw-r--r--libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java1
-rw-r--r--libjava/classpath/gnu/CORBA/ExceptionCreator.java245
-rw-r--r--libjava/classpath/gnu/CORBA/ForwardRequestHelper.java1
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java5
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java10
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java (renamed from libjava/classpath/gnu/CORBA/GIOP/cxCodeSet.java)26
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java (renamed from libjava/classpath/gnu/CORBA/GIOP/contextSupportingHeader.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java23
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java200
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java10
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java10
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java88
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java14
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java14
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java16
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java27
-rw-r--r--libjava/classpath/gnu/CORBA/GeneralHolder.java (renamed from libjava/classpath/gnu/CORBA/universalHolder.java)26
-rw-r--r--libjava/classpath/gnu/CORBA/HolderLocator.java (renamed from libjava/classpath/gnu/CORBA/holderFactory.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/IOR.java96
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java83
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/Registrator.java8
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java4
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java44
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java20
-rw-r--r--libjava/classpath/gnu/CORBA/IorDelegate.java (renamed from libjava/classpath/gnu/CORBA/IOR_Delegate.java)92
-rw-r--r--libjava/classpath/gnu/CORBA/IorObject.java (renamed from libjava/classpath/gnu/CORBA/IOR_contructed_object.java)21
-rw-r--r--libjava/classpath/gnu/CORBA/IorProvider.java (renamed from libjava/classpath/org/omg/CORBA/IDLEntity.java)20
-rw-r--r--libjava/classpath/gnu/CORBA/Minor.java282
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/Ext.java2
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java (renamed from libjava/classpath/gnu/CORBA/NamingService/cmpNameComponent.java)10
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameParser.java197
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java (renamed from libjava/classpath/gnu/CORBA/NamingService/snConverter.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NamingMap.java2
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java10
-rw-r--r--libjava/classpath/gnu/CORBA/ObjectCreator.java397
-rw-r--r--libjava/classpath/gnu/CORBA/OctetHolder.java4
-rw-r--r--libjava/classpath/gnu/CORBA/OrbFocused.java375
-rw-r--r--libjava/classpath/gnu/CORBA/OrbFunctional.java (renamed from libjava/classpath/gnu/CORBA/Functional_ORB.java)481
-rw-r--r--libjava/classpath/gnu/CORBA/OrbRestricted.java (renamed from libjava/classpath/gnu/CORBA/Restricted_ORB.java)41
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/AOM.java (renamed from libjava/classpath/gnu/CORBA/Poa/activeObjectMap.java)26
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java (renamed from libjava/classpath/gnu/CORBA/Poa/vPolicy.java)4
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java (renamed from libjava/classpath/gnu/CORBA/Poa/dynImpHandler.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java16
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java79
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/LocalRequest.java42
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java51
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java (renamed from libjava/classpath/gnu/CORBA/Poa/servantDelegate.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java (renamed from libjava/classpath/gnu/CORBA/Poa/policySets.java)8
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuPOA.java471
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java60
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java60
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java2
-rw-r--r--libjava/classpath/gnu/CORBA/RawReply.java (renamed from libjava/classpath/gnu/CORBA/binaryReply.java)12
-rw-r--r--libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java (renamed from libjava/classpath/gnu/CORBA/bufferedResponseHandler.java)18
-rw-r--r--libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java10
-rw-r--r--libjava/classpath/gnu/CORBA/SimpleDelegate.java (renamed from libjava/classpath/gnu/CORBA/Simple_delegate.java)48
-rw-r--r--libjava/classpath/gnu/CORBA/SocketRepository.java86
-rw-r--r--libjava/classpath/gnu/CORBA/StreamBasedRequest.java (renamed from libjava/classpath/gnu/CORBA/streamRequest.java)6
-rw-r--r--libjava/classpath/gnu/CORBA/StreamHolder.java (renamed from libjava/classpath/gnu/CORBA/streamReadyHolder.java)11
-rw-r--r--libjava/classpath/gnu/CORBA/StubLocator.java (renamed from libjava/classpath/gnu/CORBA/stubFinder.java)8
-rw-r--r--libjava/classpath/gnu/CORBA/TypeCodeHelper.java35
-rw-r--r--libjava/classpath/gnu/CORBA/TypeKindNamer.java (renamed from libjava/classpath/gnu/CORBA/typeNamer.java)75
-rw-r--r--libjava/classpath/gnu/CORBA/Version.java26
-rw-r--r--libjava/classpath/gnu/CORBA/WCharHolder.java4
-rw-r--r--libjava/classpath/gnu/CORBA/WStringHolder.java6
-rw-r--r--libjava/classpath/gnu/CORBA/_PolicyImplBase.java3
-rw-r--r--libjava/classpath/gnu/CORBA/gnuAny.java139
-rw-r--r--libjava/classpath/gnu/CORBA/gnuCodecFactory.java2
-rw-r--r--libjava/classpath/gnu/CORBA/gnuContextList.java2
-rw-r--r--libjava/classpath/gnu/CORBA/gnuExceptionList.java2
-rw-r--r--libjava/classpath/gnu/CORBA/gnuNVList.java6
-rw-r--r--libjava/classpath/gnu/CORBA/gnuRequest.java134
-rw-r--r--libjava/classpath/gnu/CORBA/gnuValueHolder.java2
-rw-r--r--libjava/classpath/gnu/CORBA/interfaces/SocketFactory.java95
-rw-r--r--libjava/classpath/gnu/CORBA/interfaces/package.html49
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/AliasTypeCode.java (renamed from libjava/classpath/gnu/CORBA/aliasTypeCode.java)16
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/ArrayTypeCode.java (renamed from libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java)21
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java (renamed from libjava/classpath/gnu/CORBA/fixedTypeCode.java)19
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/GeneralTypeCode.java (renamed from libjava/classpath/gnu/CORBA/generalTypeCode.java)40
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/PrimitiveTypeCode.java (renamed from libjava/classpath/gnu/CORBA/primitiveTypeCode.java)15
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/RecordTypeCode.java (renamed from libjava/classpath/gnu/CORBA/recordTypeCode.java)21
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java (renamed from libjava/classpath/gnu/CORBA/recursiveTypeCode.java)16
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/StringTypeCode.java (renamed from libjava/classpath/gnu/CORBA/stringTypeCode.java)16
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/package.html (renamed from libjava/classpath/gnu/java/net/protocol/http/event/package.html)10
-rw-r--r--libjava/classpath/gnu/classpath/ByteArray.java109
-rw-r--r--libjava/classpath/gnu/classpath/SystemProperties.java6
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java85
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java2
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java2
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java3
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java13
-rw-r--r--libjava/classpath/gnu/java/awt/AWTUtilities.java9
-rw-r--r--libjava/classpath/gnu/java/awt/EmbeddedWindow.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java29
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java12
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java53
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java5
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java3
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java7
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java3
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java9
-rw-r--r--libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java4
-rw-r--r--libjava/classpath/gnu/java/beans/DummyAppletContext.java37
-rw-r--r--libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java4
-rw-r--r--libjava/classpath/gnu/java/io/PlatformHelper.java5
-rw-r--r--libjava/classpath/gnu/java/net/LineInputStream.java13
-rw-r--r--libjava/classpath/gnu/java/net/protocol/file/Connection.java51
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java123
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java2
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/Cookie.java2
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java174
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java108
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/Headers.java85
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java220
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/Request.java191
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/Response.java55
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/ResponseBodyReader.java70
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/event/RequestListener.java70
-rw-r--r--libjava/classpath/gnu/java/net/protocol/jar/Connection.java83
-rw-r--r--libjava/classpath/gnu/java/nio/SocketChannelImpl.java2
-rw-r--r--libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java3
-rw-r--r--libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java19
-rw-r--r--libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java2
-rw-r--r--libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java6
-rw-r--r--libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java2
-rw-r--r--libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java350
-rw-r--r--libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java2
-rw-r--r--libjava/classpath/gnu/java/rmi/server/UnicastServer.java5
-rw-r--r--libjava/classpath/gnu/java/security/PolicyFile.java6
-rw-r--r--libjava/classpath/gnu/java/security/der/BitString.java13
-rw-r--r--libjava/classpath/gnu/java/security/der/DERReader.java2
-rw-r--r--libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java123
-rw-r--r--libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java86
-rw-r--r--libjava/classpath/gnu/java/security/provider/Gnu.java15
-rw-r--r--libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java2
-rw-r--r--libjava/classpath/gnu/java/security/x509/ext/Extension.java10
-rw-r--r--libjava/classpath/gnu/java/text/BaseBreakIterator.java7
-rw-r--r--libjava/classpath/gnu/javax/crypto/DiffieHellmanImpl.java159
-rw-r--r--libjava/classpath/gnu/javax/crypto/GnuDHPrivateKey.java (renamed from libjava/classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java)75
-rw-r--r--libjava/classpath/gnu/javax/crypto/RSACipherImpl.java311
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPDecoder.java169
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPException.java47
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPFileHeader.java128
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPImageReader.java153
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java123
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java201
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java104
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeBF32.java108
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB1.java96
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB24.java77
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB4.java92
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB8.java (renamed from libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerImpl.java)88
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE4.java176
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE8.java143
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/CorbaInput.java297
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/CorbaOutput.java219
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java85
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java76
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java352
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/RmiUtilities.java946
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java262
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/TieTargetRecord.java93
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java714
-rw-r--r--libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java163
-rw-r--r--libjava/classpath/gnu/javax/rmi/PortableServer.java141
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java130
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java216
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java519
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java131
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java153
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java173
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java745
-rw-r--r--libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java2
-rw-r--r--libjava/classpath/gnu/xml/aelfred2/SAXDriver.java4
-rw-r--r--libjava/classpath/gnu/xml/dom/DomDocument.java50
-rw-r--r--libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java48
-rw-r--r--libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java2
-rw-r--r--libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java3
-rw-r--r--libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java81
-rw-r--r--libjava/classpath/gnu/xml/transform/StreamSerializer.java6
-rw-r--r--libjava/classpath/gnu/xml/transform/TransformerImpl.java8
-rw-r--r--libjava/classpath/include/Makefile.am14
-rw-r--r--libjava/classpath/include/Makefile.in26
-rw-r--r--libjava/classpath/include/config.h.in9
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h1
-rw-r--r--libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h1
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h21
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h20
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h19
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h25
-rw-r--r--libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h29
-rw-r--r--libjava/classpath/java/applet/Applet.java76
-rw-r--r--libjava/classpath/java/awt/BorderLayout.java130
-rw-r--r--libjava/classpath/java/awt/Button.java2
-rw-r--r--libjava/classpath/java/awt/Canvas.java14
-rw-r--r--libjava/classpath/java/awt/Checkbox.java11
-rw-r--r--libjava/classpath/java/awt/CheckboxMenuItem.java2
-rw-r--r--libjava/classpath/java/awt/Choice.java4
-rw-r--r--libjava/classpath/java/awt/Color.java2
-rw-r--r--libjava/classpath/java/awt/ColorPaintContext.java4
-rw-r--r--libjava/classpath/java/awt/Component.java122
-rw-r--r--libjava/classpath/java/awt/Container.java146
-rw-r--r--libjava/classpath/java/awt/DefaultKeyboardFocusManager.java4
-rw-r--r--libjava/classpath/java/awt/Dialog.java2
-rw-r--r--libjava/classpath/java/awt/EventQueue.java1
-rw-r--r--libjava/classpath/java/awt/Font.java2070
-rw-r--r--libjava/classpath/java/awt/FontMetrics.java21
-rw-r--r--libjava/classpath/java/awt/Frame.java2
-rw-r--r--libjava/classpath/java/awt/Graphics.java1291
-rw-r--r--libjava/classpath/java/awt/GraphicsConfiguration.java5
-rw-r--r--libjava/classpath/java/awt/GridBagLayout.java23
-rw-r--r--libjava/classpath/java/awt/Image.java20
-rw-r--r--libjava/classpath/java/awt/KeyboardFocusManager.java75
-rw-r--r--libjava/classpath/java/awt/List.java15
-rw-r--r--libjava/classpath/java/awt/Menu.java2
-rw-r--r--libjava/classpath/java/awt/MenuComponent.java4
-rw-r--r--libjava/classpath/java/awt/MenuItem.java2
-rw-r--r--libjava/classpath/java/awt/Point.java4
-rw-r--r--libjava/classpath/java/awt/Polygon.java1
-rw-r--r--libjava/classpath/java/awt/PopupMenu.java2
-rw-r--r--libjava/classpath/java/awt/Rectangle.java4
-rw-r--r--libjava/classpath/java/awt/ScrollPane.java4
-rw-r--r--libjava/classpath/java/awt/ScrollPaneAdjustable.java8
-rw-r--r--libjava/classpath/java/awt/TextArea.java2
-rw-r--r--libjava/classpath/java/awt/TextComponent.java2
-rw-r--r--libjava/classpath/java/awt/TextField.java2
-rw-r--r--libjava/classpath/java/awt/Window.java110
-rw-r--r--libjava/classpath/java/awt/color/ICC_Profile.java18
-rw-r--r--libjava/classpath/java/awt/event/InputEvent.java41
-rw-r--r--libjava/classpath/java/awt/event/InvocationEvent.java25
-rw-r--r--libjava/classpath/java/awt/event/KeyEvent.java2
-rw-r--r--libjava/classpath/java/awt/event/MouseEvent.java23
-rw-r--r--libjava/classpath/java/awt/geom/Area.java2
-rw-r--r--libjava/classpath/java/awt/geom/GeneralPath.java3
-rw-r--r--libjava/classpath/java/awt/im/InputContext.java3
-rw-r--r--libjava/classpath/java/awt/im/InputMethodHighlight.java5
-rw-r--r--libjava/classpath/java/awt/im/InputMethodRequests.java2
-rw-r--r--libjava/classpath/java/awt/im/spi/InputMethod.java10
-rw-r--r--libjava/classpath/java/awt/im/spi/InputMethodContext.java4
-rw-r--r--libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java3
-rw-r--r--libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java2
-rw-r--r--libjava/classpath/java/awt/image/BufferedImage.java18
-rw-r--r--libjava/classpath/java/awt/image/ColorModel.java2
-rw-r--r--libjava/classpath/java/awt/image/ComponentSampleModel.java8
-rw-r--r--libjava/classpath/java/awt/image/ImageConsumer.java2
-rw-r--r--libjava/classpath/java/awt/image/MemoryImageSource.java2
-rw-r--r--libjava/classpath/java/awt/image/PackedColorModel.java6
-rw-r--r--libjava/classpath/java/awt/image/SampleModel.java3
-rw-r--r--libjava/classpath/java/awt/print/PrinterJob.java7
-rw-r--r--libjava/classpath/java/beans/IndexedPropertyDescriptor.java610
-rw-r--r--libjava/classpath/java/beans/PropertyDescriptor.java17
-rw-r--r--libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java2
-rw-r--r--libjava/classpath/java/beans/beancontext/BeanContextSupport.java2
-rw-r--r--libjava/classpath/java/io/ByteArrayOutputStream.java5
-rw-r--r--libjava/classpath/java/io/DataOutputStream.java6
-rw-r--r--libjava/classpath/java/io/File.java39
-rw-r--r--libjava/classpath/java/io/FilePermission.java8
-rw-r--r--libjava/classpath/java/io/FileWriter.java2
-rw-r--r--libjava/classpath/java/io/FilterReader.java2
-rw-r--r--libjava/classpath/java/io/InputStreamReader.java25
-rw-r--r--libjava/classpath/java/io/LineNumberReader.java6
-rw-r--r--libjava/classpath/java/io/ObjectInputStream.java588
-rw-r--r--libjava/classpath/java/io/ObjectOutputStream.java79
-rw-r--r--libjava/classpath/java/io/ObjectStreamClass.java17
-rw-r--r--libjava/classpath/java/io/ObjectStreamField.java2
-rw-r--r--libjava/classpath/java/io/OutputStreamWriter.java160
-rw-r--r--libjava/classpath/java/io/PipedInputStream.java2
-rw-r--r--libjava/classpath/java/io/PrintWriter.java75
-rw-r--r--libjava/classpath/java/io/PushbackInputStream.java9
-rw-r--r--libjava/classpath/java/lang/Boolean.java32
-rw-r--r--libjava/classpath/java/lang/Byte.java32
-rw-r--r--libjava/classpath/java/lang/Character.java275
-rw-r--r--libjava/classpath/java/lang/Class.java11
-rw-r--r--libjava/classpath/java/lang/ClassLoader.java36
-rw-r--r--libjava/classpath/java/lang/Double.java23
-rw-r--r--libjava/classpath/java/lang/EnumConstantNotPresentException.java93
-rw-r--r--libjava/classpath/java/lang/Float.java22
-rw-r--r--libjava/classpath/java/lang/Integer.java4
-rw-r--r--libjava/classpath/java/lang/Long.java153
-rw-r--r--libjava/classpath/java/lang/Object.java4
-rw-r--r--libjava/classpath/java/lang/Process.java1
-rw-r--r--libjava/classpath/java/lang/Readable.java1
-rw-r--r--libjava/classpath/java/lang/RuntimePermission.java1
-rw-r--r--libjava/classpath/java/lang/SecurityManager.java30
-rw-r--r--libjava/classpath/java/lang/Short.java44
-rw-r--r--libjava/classpath/java/lang/StrictMath.java10
-rw-r--r--libjava/classpath/java/lang/String.java207
-rw-r--r--libjava/classpath/java/lang/StringBuffer.java259
-rw-r--r--libjava/classpath/java/lang/StringBuilder.java65
-rw-r--r--libjava/classpath/java/lang/System.java2
-rw-r--r--libjava/classpath/java/lang/Thread.java12
-rw-r--r--libjava/classpath/java/lang/ThreadLocal.java1
-rw-r--r--libjava/classpath/java/lang/ref/Reference.java6
-rw-r--r--libjava/classpath/java/lang/ref/WeakReference.java2
-rw-r--r--libjava/classpath/java/lang/reflect/Member.java4
-rw-r--r--libjava/classpath/java/lang/reflect/Proxy.java19
-rw-r--r--libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java2
-rw-r--r--libjava/classpath/java/math/BigDecimal.java19
-rw-r--r--libjava/classpath/java/math/BigInteger.java19
-rw-r--r--libjava/classpath/java/net/DatagramSocket.java1
-rw-r--r--libjava/classpath/java/net/Inet4Address.java2
-rw-r--r--libjava/classpath/java/net/InetSocketAddress.java2
-rw-r--r--libjava/classpath/java/net/ServerSocket.java4
-rw-r--r--libjava/classpath/java/net/Socket.java9
-rw-r--r--libjava/classpath/java/net/URL.java12
-rw-r--r--libjava/classpath/java/net/URLClassLoader.java192
-rw-r--r--libjava/classpath/java/net/URLConnection.java8
-rw-r--r--libjava/classpath/java/net/URLStreamHandler.java22
-rw-r--r--libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java6
-rw-r--r--libjava/classpath/java/nio/charset/Charset.java27
-rw-r--r--libjava/classpath/java/rmi/activation/ActivationGroup_Stub.java110
-rw-r--r--libjava/classpath/java/rmi/server/LoaderHandler.java6
-rw-r--r--libjava/classpath/java/rmi/server/RMIClassLoader.java312
-rw-r--r--libjava/classpath/java/rmi/server/RemoteObject.java4
-rw-r--r--libjava/classpath/java/rmi/server/RemoteRef.java6
-rw-r--r--libjava/classpath/java/security/AccessControlContext.java34
-rw-r--r--libjava/classpath/java/security/AccessController.java16
-rw-r--r--libjava/classpath/java/security/Identity.java8
-rw-r--r--libjava/classpath/java/security/ProtectionDomain.java4
-rw-r--r--libjava/classpath/java/security/Security.java4
-rw-r--r--libjava/classpath/java/text/AttributedString.java48
-rw-r--r--libjava/classpath/java/text/AttributedStringIterator.java183
-rw-r--r--libjava/classpath/java/text/CharacterIterator.java2
-rw-r--r--libjava/classpath/java/text/DateFormat.java3
-rw-r--r--libjava/classpath/java/text/ParsePosition.java9
-rw-r--r--libjava/classpath/java/text/RuleBasedCollator.java2
-rw-r--r--libjava/classpath/java/text/StringCharacterIterator.java12
-rw-r--r--libjava/classpath/java/util/ArrayList.java4
-rw-r--r--libjava/classpath/java/util/Arrays.java180
-rw-r--r--libjava/classpath/java/util/Calendar.java23
-rw-r--r--libjava/classpath/java/util/Collections.java17
-rw-r--r--libjava/classpath/java/util/GregorianCalendar.java14
-rw-r--r--libjava/classpath/java/util/HashMap.java2
-rw-r--r--libjava/classpath/java/util/InvalidPropertiesFormatException.java57
-rw-r--r--libjava/classpath/java/util/Locale.java4
-rw-r--r--libjava/classpath/java/util/Map.java8
-rw-r--r--libjava/classpath/java/util/Properties.java348
-rw-r--r--libjava/classpath/java/util/Random.java2
-rw-r--r--libjava/classpath/java/util/ResourceBundle.java9
-rw-r--r--libjava/classpath/java/util/SimpleTimeZone.java3
-rw-r--r--libjava/classpath/java/util/Timer.java93
-rw-r--r--libjava/classpath/java/util/TreeMap.java2
-rw-r--r--libjava/classpath/java/util/WeakHashMap.java28
-rw-r--r--libjava/classpath/java/util/jar/Manifest.java8
-rw-r--r--libjava/classpath/java/util/logging/FileHandler.java4
-rw-r--r--libjava/classpath/java/util/logging/Handler.java6
-rw-r--r--libjava/classpath/java/util/logging/LogManager.java4
-rw-r--r--libjava/classpath/java/util/logging/LoggingPermission.java2
-rw-r--r--libjava/classpath/java/util/logging/SimpleFormatter.java2
-rw-r--r--libjava/classpath/java/util/logging/XMLFormatter.java2
-rw-r--r--libjava/classpath/java/util/prefs/Preferences.java28
-rw-r--r--libjava/classpath/java/util/regex/Matcher.java8
-rw-r--r--libjava/classpath/java/util/zip/PendingBuffer.java2
-rw-r--r--libjava/classpath/java/util/zip/ZipFile.java17
-rw-r--r--libjava/classpath/javax/imageio/IIOException.java3
-rw-r--r--libjava/classpath/javax/imageio/IIOImage.java137
-rw-r--r--libjava/classpath/javax/imageio/IIOParam.java364
-rw-r--r--libjava/classpath/javax/imageio/IIOParamController.java13
-rw-r--r--libjava/classpath/javax/imageio/ImageIO.java609
-rw-r--r--libjava/classpath/javax/imageio/ImageReadParam.java2
-rw-r--r--libjava/classpath/javax/imageio/ImageReader.java1724
-rw-r--r--libjava/classpath/javax/imageio/ImageTranscoder.java48
-rw-r--r--libjava/classpath/javax/imageio/ImageTypeSpecifier.java467
-rw-r--r--libjava/classpath/javax/imageio/ImageWriteParam.java3
-rw-r--r--libjava/classpath/javax/imageio/ImageWriter.java1125
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOAttr.java378
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOMetadata.java114
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java842
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java157
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIONamedNodeMap.java138
-rw-r--r--libjava/classpath/javax/imageio/metadata/IIONodeList.java72
-rw-r--r--libjava/classpath/javax/imageio/package.html45
-rw-r--r--libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java86
-rw-r--r--libjava/classpath/javax/naming/CompoundName.java25
-rw-r--r--libjava/classpath/javax/naming/Name.java4
-rw-r--r--libjava/classpath/javax/print/DocFlavor.java4
-rw-r--r--libjava/classpath/javax/print/attribute/Attribute.java20
-rw-r--r--libjava/classpath/javax/print/attribute/AttributeSet.java147
-rw-r--r--libjava/classpath/javax/print/attribute/AttributeSetUtilities.java87
-rw-r--r--libjava/classpath/javax/print/attribute/DateTimeSyntax.java16
-rw-r--r--libjava/classpath/javax/print/attribute/DocAttribute.java19
-rw-r--r--libjava/classpath/javax/print/attribute/DocAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/EnumSyntax.java122
-rw-r--r--libjava/classpath/javax/print/attribute/HashAttributeSet.java190
-rw-r--r--libjava/classpath/javax/print/attribute/HashDocAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java22
-rw-r--r--libjava/classpath/javax/print/attribute/IntegerSyntax.java25
-rw-r--r--libjava/classpath/javax/print/attribute/PrintJobAttribute.java19
-rw-r--r--libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/PrintRequestAttribute.java14
-rw-r--r--libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/PrintServiceAttribute.java19
-rw-r--r--libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java35
-rw-r--r--libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java186
-rw-r--r--libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java20
-rw-r--r--libjava/classpath/javax/print/attribute/URISyntax.java18
-rw-r--r--libjava/classpath/javax/print/attribute/UnmodifiableSetException.java12
-rw-r--r--libjava/classpath/javax/print/attribute/package.html9
-rw-r--r--libjava/classpath/javax/print/event/PrintEvent.java6
-rw-r--r--libjava/classpath/javax/print/event/PrintJobAdapter.java34
-rw-r--r--libjava/classpath/javax/print/event/PrintJobAttributeEvent.java10
-rw-r--r--libjava/classpath/javax/print/event/PrintJobAttributeListener.java6
-rw-r--r--libjava/classpath/javax/print/event/PrintJobEvent.java27
-rw-r--r--libjava/classpath/javax/print/event/PrintJobListener.java15
-rw-r--r--libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java10
-rw-r--r--libjava/classpath/javax/print/event/PrintServiceAttributeListener.java6
-rw-r--r--libjava/classpath/javax/print/event/package.html8
-rw-r--r--libjava/classpath/javax/rmi/BAD_OPERATION.java4
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ClassDesc.java33
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ObjectImpl.java9
-rw-r--r--libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java84
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Stub.java170
-rw-r--r--libjava/classpath/javax/rmi/CORBA/StubDelegate.java56
-rw-r--r--libjava/classpath/javax/rmi/CORBA/SystemException.java4
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Tie.java101
-rw-r--r--libjava/classpath/javax/rmi/CORBA/Util.java413
-rw-r--r--libjava/classpath/javax/rmi/CORBA/UtilDelegate.java285
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ValueHandler.java101
-rw-r--r--libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java94
-rw-r--r--libjava/classpath/javax/rmi/CORBA/package.html36
-rw-r--r--libjava/classpath/javax/rmi/ORB.java4
-rw-r--r--libjava/classpath/javax/rmi/PortableRemoteObject.java201
-rw-r--r--libjava/classpath/javax/rmi/package.html36
-rw-r--r--libjava/classpath/javax/security/auth/Subject.java12
-rw-r--r--libjava/classpath/javax/security/auth/SubjectDomainCombiner.java7
-rw-r--r--libjava/classpath/javax/security/auth/login/Configuration.java46
-rw-r--r--libjava/classpath/javax/security/auth/login/LoginContext.java4
-rw-r--r--libjava/classpath/javax/security/auth/x500/X500Principal.java16
-rw-r--r--libjava/classpath/javax/security/sasl/AuthenticationException.java4
-rw-r--r--libjava/classpath/javax/security/sasl/AuthorizeCallback.java10
-rw-r--r--libjava/classpath/javax/security/sasl/RealmCallback.java4
-rw-r--r--libjava/classpath/javax/security/sasl/RealmChoiceCallback.java4
-rw-r--r--libjava/classpath/javax/security/sasl/Sasl.java2
-rw-r--r--libjava/classpath/javax/security/sasl/SaslClient.java6
-rw-r--r--libjava/classpath/javax/security/sasl/SaslClientFactory.java4
-rw-r--r--libjava/classpath/javax/security/sasl/SaslException.java6
-rw-r--r--libjava/classpath/javax/security/sasl/SaslServer.java8
-rw-r--r--libjava/classpath/javax/security/sasl/SaslServerFactory.java4
-rw-r--r--libjava/classpath/javax/sound/midi/ControllerEventListener.java58
-rw-r--r--libjava/classpath/javax/sound/midi/Instrument.java77
-rw-r--r--libjava/classpath/javax/sound/midi/InvalidMidiDataException.java90
-rw-r--r--libjava/classpath/javax/sound/midi/MetaEventListener.java (renamed from libjava/classpath/gnu/java/awt/FocusManager.java)26
-rw-r--r--libjava/classpath/javax/sound/midi/MetaMessage.java176
-rw-r--r--libjava/classpath/javax/sound/midi/MidiChannel.java236
-rw-r--r--libjava/classpath/javax/sound/midi/MidiDevice.java220
-rw-r--r--libjava/classpath/javax/sound/midi/MidiEvent.java95
-rw-r--r--libjava/classpath/javax/sound/midi/MidiFileFormat.java158
-rw-r--r--libjava/classpath/javax/sound/midi/MidiMessage.java126
-rw-r--r--libjava/classpath/javax/sound/midi/MidiSystem.java566
-rw-r--r--libjava/classpath/javax/sound/midi/MidiUnavailableException.java90
-rw-r--r--libjava/classpath/javax/sound/midi/Patch.java86
-rw-r--r--libjava/classpath/javax/sound/midi/Receiver.java66
-rw-r--r--libjava/classpath/javax/sound/midi/Sequence.java248
-rw-r--r--libjava/classpath/javax/sound/midi/Sequencer.java402
-rw-r--r--libjava/classpath/javax/sound/midi/ShortMessage.java344
-rw-r--r--libjava/classpath/javax/sound/midi/Soundbank.java101
-rw-r--r--libjava/classpath/javax/sound/midi/SoundbankResource.java104
-rw-r--r--libjava/classpath/javax/sound/midi/Synthesizer.java173
-rw-r--r--libjava/classpath/javax/sound/midi/SysexMessage.java139
-rw-r--r--libjava/classpath/javax/sound/midi/Track.java160
-rw-r--r--libjava/classpath/javax/sound/midi/Transmitter.java70
-rw-r--r--libjava/classpath/javax/sound/midi/VoiceStatus.java79
-rw-r--r--libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java90
-rw-r--r--libjava/classpath/javax/sound/midi/spi/MidiFileReader.java125
-rw-r--r--libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java143
-rw-r--r--libjava/classpath/javax/sound/midi/spi/SoundbankReader.java97
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioFileFormat.java242
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioFormat.java345
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioInputStream.java258
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioPermission.java70
-rw-r--r--libjava/classpath/javax/sound/sampled/AudioSystem.java744
-rw-r--r--libjava/classpath/javax/sound/sampled/BooleanControl.java145
-rw-r--r--libjava/classpath/javax/sound/sampled/Clip.java115
-rw-r--r--libjava/classpath/javax/sound/sampled/CompoundControl.java102
-rw-r--r--libjava/classpath/javax/sound/sampled/Control.java (renamed from libjava/classpath/gnu/java/net/protocol/http/event/RequestEvent.java)98
-rw-r--r--libjava/classpath/javax/sound/sampled/DataLine.java265
-rw-r--r--libjava/classpath/javax/sound/sampled/EnumControl.java126
-rw-r--r--libjava/classpath/javax/sound/sampled/FloatControl.java267
-rw-r--r--libjava/classpath/javax/sound/sampled/Line.java150
-rw-r--r--libjava/classpath/javax/sound/sampled/LineEvent.java150
-rw-r--r--libjava/classpath/javax/sound/sampled/LineListener.java (renamed from libjava/classpath/gnu/java/net/protocol/http/event/ConnectionListener.java)25
-rw-r--r--libjava/classpath/javax/sound/sampled/LineUnavailableException.java61
-rw-r--r--libjava/classpath/javax/sound/sampled/Mixer.java206
-rw-r--r--libjava/classpath/javax/sound/sampled/Port.java135
-rw-r--r--libjava/classpath/javax/sound/sampled/ReverbType.java144
-rw-r--r--libjava/classpath/javax/sound/sampled/SourceDataLine.java77
-rw-r--r--libjava/classpath/javax/sound/sampled/TargetDataLine.java79
-rw-r--r--libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java65
-rw-r--r--libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java146
-rw-r--r--libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java131
-rw-r--r--libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java179
-rw-r--r--libjava/classpath/javax/sound/sampled/spi/MixerProvider.java86
-rw-r--r--libjava/classpath/javax/swing/AbstractButton.java123
-rw-r--r--libjava/classpath/javax/swing/AbstractSpinnerModel.java1
-rw-r--r--libjava/classpath/javax/swing/ActionMap.java9
-rw-r--r--libjava/classpath/javax/swing/BorderFactory.java2
-rw-r--r--libjava/classpath/javax/swing/BoundedRangeModel.java4
-rw-r--r--libjava/classpath/javax/swing/Box.java21
-rw-r--r--libjava/classpath/javax/swing/BoxLayout.java693
-rw-r--r--libjava/classpath/javax/swing/ButtonGroup.java5
-rw-r--r--libjava/classpath/javax/swing/ButtonModel.java260
-rw-r--r--libjava/classpath/javax/swing/CellEditor.java2
-rw-r--r--libjava/classpath/javax/swing/CellRendererPane.java38
-rw-r--r--libjava/classpath/javax/swing/ComboBoxEditor.java2
-rw-r--r--libjava/classpath/javax/swing/ComponentInputMap.java26
-rw-r--r--libjava/classpath/javax/swing/DebugGraphics.java308
-rw-r--r--libjava/classpath/javax/swing/DefaultButtonModel.java1
-rw-r--r--libjava/classpath/javax/swing/DefaultCellEditor.java7
-rw-r--r--libjava/classpath/javax/swing/DefaultComboBoxModel.java172
-rw-r--r--libjava/classpath/javax/swing/DefaultDesktopManager.java4
-rw-r--r--libjava/classpath/javax/swing/DefaultListCellRenderer.java14
-rw-r--r--libjava/classpath/javax/swing/DefaultListSelectionModel.java60
-rw-r--r--libjava/classpath/javax/swing/DesktopManager.java2
-rw-r--r--libjava/classpath/javax/swing/FocusManager.java425
-rw-r--r--libjava/classpath/javax/swing/ImageIcon.java9
-rw-r--r--libjava/classpath/javax/swing/InputMap.java12
-rw-r--r--libjava/classpath/javax/swing/InputVerifier.java1
-rw-r--r--libjava/classpath/javax/swing/JApplet.java60
-rw-r--r--libjava/classpath/javax/swing/JButton.java7
-rw-r--r--libjava/classpath/javax/swing/JCheckBox.java70
-rw-r--r--libjava/classpath/javax/swing/JCheckBoxMenuItem.java13
-rw-r--r--libjava/classpath/javax/swing/JColorChooser.java2
-rw-r--r--libjava/classpath/javax/swing/JComboBox.java115
-rw-r--r--libjava/classpath/javax/swing/JComponent.java1058
-rw-r--r--libjava/classpath/javax/swing/JDesktopPane.java3
-rw-r--r--libjava/classpath/javax/swing/JDialog.java48
-rw-r--r--libjava/classpath/javax/swing/JEditorPane.java472
-rw-r--r--libjava/classpath/javax/swing/JFileChooser.java767
-rw-r--r--libjava/classpath/javax/swing/JFrame.java57
-rw-r--r--libjava/classpath/javax/swing/JInternalFrame.java45
-rw-r--r--libjava/classpath/javax/swing/JLabel.java18
-rw-r--r--libjava/classpath/javax/swing/JLayeredPane.java137
-rw-r--r--libjava/classpath/javax/swing/JList.java856
-rw-r--r--libjava/classpath/javax/swing/JMenu.java30
-rw-r--r--libjava/classpath/javax/swing/JMenuBar.java206
-rw-r--r--libjava/classpath/javax/swing/JMenuItem.java34
-rw-r--r--libjava/classpath/javax/swing/JOptionPane.java160
-rw-r--r--libjava/classpath/javax/swing/JPanel.java134
-rw-r--r--libjava/classpath/javax/swing/JPasswordField.java1
-rw-r--r--libjava/classpath/javax/swing/JPopupMenu.java343
-rw-r--r--libjava/classpath/javax/swing/JProgressBar.java5
-rw-r--r--libjava/classpath/javax/swing/JRadioButton.java4
-rw-r--r--libjava/classpath/javax/swing/JRadioButtonMenuItem.java8
-rw-r--r--libjava/classpath/javax/swing/JRootPane.java252
-rw-r--r--libjava/classpath/javax/swing/JScrollPane.java220
-rw-r--r--libjava/classpath/javax/swing/JSeparator.java2
-rw-r--r--libjava/classpath/javax/swing/JSlider.java3
-rw-r--r--libjava/classpath/javax/swing/JSpinner.java42
-rw-r--r--libjava/classpath/javax/swing/JSplitPane.java123
-rw-r--r--libjava/classpath/javax/swing/JTabbedPane.java130
-rw-r--r--libjava/classpath/javax/swing/JTable.java1012
-rw-r--r--libjava/classpath/javax/swing/JTextArea.java61
-rw-r--r--libjava/classpath/javax/swing/JTextField.java183
-rw-r--r--libjava/classpath/javax/swing/JTextPane.java45
-rw-r--r--libjava/classpath/javax/swing/JToggleButton.java24
-rw-r--r--libjava/classpath/javax/swing/JToolBar.java4
-rw-r--r--libjava/classpath/javax/swing/JToolTip.java3
-rw-r--r--libjava/classpath/javax/swing/JTree.java4337
-rw-r--r--libjava/classpath/javax/swing/JViewport.java579
-rw-r--r--libjava/classpath/javax/swing/JWindow.java48
-rw-r--r--libjava/classpath/javax/swing/KeyStroke.java1
-rw-r--r--libjava/classpath/javax/swing/KeyboardManager.java280
-rw-r--r--libjava/classpath/javax/swing/ListCellRenderer.java8
-rw-r--r--libjava/classpath/javax/swing/ListSelectionModel.java34
-rw-r--r--libjava/classpath/javax/swing/LookAndFeel.java115
-rw-r--r--libjava/classpath/javax/swing/MenuElement.java84
-rw-r--r--libjava/classpath/javax/swing/MenuSelectionManager.java9
-rw-r--r--libjava/classpath/javax/swing/MutableComboBoxModel.java4
-rw-r--r--libjava/classpath/javax/swing/OverlayLayout.java507
-rw-r--r--libjava/classpath/javax/swing/Popup.java112
-rw-r--r--libjava/classpath/javax/swing/PopupFactory.java33
-rw-r--r--libjava/classpath/javax/swing/ProgressMonitor.java567
-rw-r--r--libjava/classpath/javax/swing/ProgressMonitorInputStream.java291
-rw-r--r--libjava/classpath/javax/swing/Renderer.java32
-rw-r--r--libjava/classpath/javax/swing/RepaintManager.java292
-rw-r--r--libjava/classpath/javax/swing/RootPaneContainer.java96
-rw-r--r--libjava/classpath/javax/swing/ScrollPaneLayout.java426
-rw-r--r--libjava/classpath/javax/swing/Scrollable.java17
-rw-r--r--libjava/classpath/javax/swing/SingleSelectionModel.java81
-rw-r--r--libjava/classpath/javax/swing/SizeRequirements.java211
-rw-r--r--libjava/classpath/javax/swing/SizeSequence.java399
-rw-r--r--libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java2
-rw-r--r--libjava/classpath/javax/swing/SpinnerListModel.java415
-rw-r--r--libjava/classpath/javax/swing/Spring.java1
-rw-r--r--libjava/classpath/javax/swing/SpringLayout.java43
-rw-r--r--libjava/classpath/javax/swing/SwingUtilities.java26
-rw-r--r--libjava/classpath/javax/swing/Timer.java106
-rw-r--r--libjava/classpath/javax/swing/ToolTipManager.java241
-rw-r--r--libjava/classpath/javax/swing/TransferHandler.java57
-rw-r--r--libjava/classpath/javax/swing/UIDefaults.java10
-rw-r--r--libjava/classpath/javax/swing/UIManager.java100
-rw-r--r--libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java8
-rw-r--r--libjava/classpath/javax/swing/ViewportLayout.java5
-rw-r--r--libjava/classpath/javax/swing/WindowConstants.java43
-rw-r--r--libjava/classpath/javax/swing/border/AbstractBorder.java46
-rw-r--r--libjava/classpath/javax/swing/border/BevelBorder.java13
-rw-r--r--libjava/classpath/javax/swing/border/Border.java6
-rw-r--r--libjava/classpath/javax/swing/border/CompoundBorder.java57
-rw-r--r--libjava/classpath/javax/swing/border/EmptyBorder.java4
-rw-r--r--libjava/classpath/javax/swing/border/EtchedBorder.java45
-rw-r--r--libjava/classpath/javax/swing/border/LineBorder.java44
-rw-r--r--libjava/classpath/javax/swing/border/MatteBorder.java4
-rw-r--r--libjava/classpath/javax/swing/border/SoftBevelBorder.java12
-rw-r--r--libjava/classpath/javax/swing/border/TitledBorder.java112
-rw-r--r--libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java35
-rw-r--r--libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java3
-rw-r--r--libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java3
-rw-r--r--libjava/classpath/javax/swing/event/EventListenerList.java1
-rw-r--r--libjava/classpath/javax/swing/event/InternalFrameAdapter.java147
-rw-r--r--libjava/classpath/javax/swing/event/ListDataListener.java55
-rw-r--r--libjava/classpath/javax/swing/event/MouseInputListener.java13
-rw-r--r--libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java7
-rw-r--r--libjava/classpath/javax/swing/event/TreeModelEvent.java8
-rw-r--r--libjava/classpath/javax/swing/filechooser/FileFilter.java77
-rw-r--r--libjava/classpath/javax/swing/filechooser/FileSystemView.java181
-rw-r--r--libjava/classpath/javax/swing/filechooser/FileView.java152
-rw-r--r--libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java47
-rw-r--r--libjava/classpath/javax/swing/plaf/ActionMapUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/BorderUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ButtonUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ColorChooserUI.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/ColorUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ComboBoxUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/ComponentUI.java10
-rw-r--r--libjava/classpath/javax/swing/plaf/DesktopIconUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/DesktopPaneUI.java5
-rw-r--r--libjava/classpath/javax/swing/plaf/DimensionUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/FileChooserUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/FontUIResource.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/IconUIResource.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/InputMapUIResource.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/InsetsUIResource.java3
-rw-r--r--libjava/classpath/javax/swing/plaf/InternalFrameUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/LabelUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ListUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/MenuBarUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/MenuItemUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/PanelUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/PopupMenuUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ProgressBarUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/RootPaneUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ScrollBarUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ScrollPaneUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/SeparatorUI.java1
-rw-r--r--libjava/classpath/javax/swing/plaf/SliderUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/SpinnerUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/SplitPaneUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TabbedPaneUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TableHeaderUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TableUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TextUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ToolBarUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/ToolTipUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/TreeUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/UIResource.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/ViewportUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java406
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicBorders.java92
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java11
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java145
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java23
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java6
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java20
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java45
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java72
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java778
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java60
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java80
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java11
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java908
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java9
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java1
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java26
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java169
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java691
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java18
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicListUI.java683
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java170
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java105
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java685
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java89
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java81
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java28
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java7
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java47
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java419
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java4
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java39
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java119
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java362
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java418
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java73
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java51
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java16
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java1
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java360
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java1524
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java63
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java590
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java47
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java22
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java38
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java190
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java65
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java5
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java61
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java99
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java1528
-rw-r--r--libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java177
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalBorders.java862
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalButtonListener.java86
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java173
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java15
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java7
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalComboBoxButton.java241
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java143
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java9
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java264
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java10
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java430
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java1392
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java337
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java120
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java19
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java434
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java88
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java10
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java101
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java128
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java13
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java431
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java483
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java19
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java63
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java220
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java2
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java41
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java30
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java32
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java148
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java112
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java270
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java175
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/MetalUtils.java353
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/OceanTheme.java243
-rw-r--r--libjava/classpath/javax/swing/plaf/metal/package.html13
-rw-r--r--libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java1
-rw-r--r--libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java49
-rw-r--r--libjava/classpath/javax/swing/table/JTableHeader.java109
-rw-r--r--libjava/classpath/javax/swing/table/TableColumn.java10
-rw-r--r--libjava/classpath/javax/swing/table/TableColumnModel.java4
-rw-r--r--libjava/classpath/javax/swing/text/AbstractDocument.java308
-rw-r--r--libjava/classpath/javax/swing/text/AttributeSet.java6
-rw-r--r--libjava/classpath/javax/swing/text/BoxView.java289
-rw-r--r--libjava/classpath/javax/swing/text/ComponentView.java298
-rw-r--r--libjava/classpath/javax/swing/text/CompositeView.java134
-rw-r--r--libjava/classpath/javax/swing/text/DefaultCaret.java435
-rw-r--r--libjava/classpath/javax/swing/text/DefaultEditorKit.java45
-rw-r--r--libjava/classpath/javax/swing/text/DefaultFormatter.java15
-rw-r--r--libjava/classpath/javax/swing/text/DefaultHighlighter.java2
-rw-r--r--libjava/classpath/javax/swing/text/DefaultStyledDocument.java1032
-rw-r--r--libjava/classpath/javax/swing/text/DefaultTextUI.java61
-rw-r--r--libjava/classpath/javax/swing/text/EditorKit.java10
-rw-r--r--libjava/classpath/javax/swing/text/FieldView.java17
-rw-r--r--libjava/classpath/javax/swing/text/FlowView.java73
-rw-r--r--libjava/classpath/javax/swing/text/GapContent.java382
-rw-r--r--libjava/classpath/javax/swing/text/GlyphView.java649
-rw-r--r--libjava/classpath/javax/swing/text/IconView.java79
-rw-r--r--libjava/classpath/javax/swing/text/InternationalFormatter.java5
-rw-r--r--libjava/classpath/javax/swing/text/JTextComponent.java211
-rw-r--r--libjava/classpath/javax/swing/text/LabelView.java242
-rw-r--r--libjava/classpath/javax/swing/text/LayoutQueue.java1
-rw-r--r--libjava/classpath/javax/swing/text/ParagraphView.java143
-rw-r--r--libjava/classpath/javax/swing/text/PlainDocument.java118
-rw-r--r--libjava/classpath/javax/swing/text/PlainView.java371
-rw-r--r--libjava/classpath/javax/swing/text/Segment.java4
-rw-r--r--libjava/classpath/javax/swing/text/SimpleAttributeSet.java57
-rw-r--r--libjava/classpath/javax/swing/text/StringContent.java3
-rw-r--r--libjava/classpath/javax/swing/text/StyleConstants.java6
-rw-r--r--libjava/classpath/javax/swing/text/StyleContext.java19
-rw-r--r--libjava/classpath/javax/swing/text/StyledDocument.java191
-rw-r--r--libjava/classpath/javax/swing/text/StyledEditorKit.java24
-rw-r--r--libjava/classpath/javax/swing/text/TabSet.java3
-rw-r--r--libjava/classpath/javax/swing/text/TabStop.java3
-rw-r--r--libjava/classpath/javax/swing/text/Utilities.java410
-rw-r--r--libjava/classpath/javax/swing/text/View.java76
-rw-r--r--libjava/classpath/javax/swing/text/WrappedPlainView.java700
-rw-r--r--libjava/classpath/javax/swing/text/html/CSS.java461
-rw-r--r--libjava/classpath/javax/swing/text/html/HTML.java13
-rw-r--r--libjava/classpath/javax/swing/text/html/HTMLDocument.java215
-rw-r--r--libjava/classpath/javax/swing/text/html/HTMLEditorKit.java38
-rw-r--r--libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java4
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/ContentModel.java5
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/DTD.java6
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/DocumentParser.java7
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/Element.java2
-rw-r--r--libjava/classpath/javax/swing/text/html/parser/Parser.java10
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java1
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java23
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java27
-rw-r--r--libjava/classpath/javax/swing/tree/DefaultTreeModel.java1
-rw-r--r--libjava/classpath/javax/swing/tree/TreeCellRenderer.java34
-rw-r--r--libjava/classpath/javax/swing/tree/TreeModel.java122
-rw-r--r--libjava/classpath/javax/swing/undo/CannotRedoException.java4
-rw-r--r--libjava/classpath/javax/swing/undo/CannotUndoException.java1
-rw-r--r--libjava/classpath/javax/xml/namespace/QName.java56
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerConfigurationException.java6
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerException.java22
-rw-r--r--libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java2
-rw-r--r--libjava/classpath/javax/xml/xpath/XPathException.java2
-rw-r--r--libjava/classpath/javax/xml/xpath/XPathExpressionException.java1
-rw-r--r--libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java1
-rw-r--r--libjava/classpath/javax/xml/xpath/XPathFunctionException.java1
-rw-r--r--libjava/classpath/lib/Makefile.am8
-rw-r--r--libjava/classpath/lib/Makefile.in69
-rw-r--r--libjava/classpath/lib/copy-vmresources.sh.in41
-rwxr-xr-xlibjava/classpath/lib/gen-classlist.sh.in6
-rwxr-xr-xlibjava/classpath/lib/split-for-gcj.sh2
-rw-r--r--libjava/classpath/lib/standard.omit3
-rw-r--r--libjava/classpath/ltmain.sh52
-rw-r--r--libjava/classpath/m4/acattribute.m425
-rw-r--r--libjava/classpath/m4/acinclude.m453
-rw-r--r--libjava/classpath/native/Makefile.in12
-rw-r--r--libjava/classpath/native/fdlibm/Makefile.in12
-rw-r--r--libjava/classpath/native/fdlibm/java-assert.h6
-rw-r--r--libjava/classpath/native/fdlibm/mprec.h5
-rw-r--r--libjava/classpath/native/jawt/Makefile.in12
-rw-r--r--libjava/classpath/native/jawt/jawt.c4
-rw-r--r--libjava/classpath/native/jni/Makefile.am13
-rw-r--r--libjava/classpath/native/jni/Makefile.in20
-rw-r--r--libjava/classpath/native/jni/classpath/Makefile.am1
-rw-r--r--libjava/classpath/native/jni/classpath/Makefile.in17
-rw-r--r--libjava/classpath/native/jni/classpath/jcl.c16
-rw-r--r--libjava/classpath/native/jni/classpath/primlib.c724
-rw-r--r--libjava/classpath/native/jni/classpath/primlib.h119
-rw-r--r--libjava/classpath/native/jni/gtk-peer/Makefile.am6
-rw-r--r--libjava/classpath/native/jni/gtk-peer/Makefile.in19
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c5
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c42
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c66
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c234
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c8
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c76
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c4
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c2
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c6
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c99
-rw-r--r--libjava/classpath/native/jni/gtk-peer/gtkpeer.h11
-rw-r--r--libjava/classpath/native/jni/java-io/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-io/Makefile.in62
-rw-r--r--libjava/classpath/native/jni/java-lang/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-lang/Makefile.in64
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c5
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c3
-rw-r--r--libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c1
-rw-r--r--libjava/classpath/native/jni/java-net/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-net/Makefile.in62
-rw-r--r--libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c3
-rw-r--r--libjava/classpath/native/jni/java-net/javanet.c14
-rw-r--r--libjava/classpath/native/jni/java-nio/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-nio/Makefile.in62
-rw-r--r--libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c2
-rw-r--r--libjava/classpath/native/jni/java-util/Makefile.am2
-rw-r--r--libjava/classpath/native/jni/java-util/Makefile.in62
-rw-r--r--libjava/classpath/native/jni/midi-alsa/.cvsignore9
-rw-r--r--libjava/classpath/native/jni/midi-alsa/Makefile.am11
-rw-r--r--libjava/classpath/native/jni/midi-alsa/Makefile.in563
-rw-r--r--libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c148
-rw-r--r--libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c59
-rw-r--r--libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c150
-rw-r--r--libjava/classpath/native/jni/midi-dssi/.cvsignore9
-rw-r--r--libjava/classpath/native/jni/midi-dssi/Makefile.am11
-rw-r--r--libjava/classpath/native/jni/midi-dssi/Makefile.in562
-rw-r--r--libjava/classpath/native/jni/midi-dssi/README134
-rw-r--r--libjava/classpath/native/jni/midi-dssi/dssi_data.h121
-rw-r--r--libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c139
-rw-r--r--libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c584
-rw-r--r--libjava/classpath/native/jni/qt-peer/Makefile.in12
-rw-r--r--libjava/classpath/native/jni/qt-peer/componentevent.cpp1
-rw-r--r--libjava/classpath/native/jni/xmlj/Makefile.in12
-rw-r--r--libjava/classpath/native/target/Linux/Makefile.in12
-rw-r--r--libjava/classpath/native/target/Makefile.in12
-rw-r--r--libjava/classpath/native/target/generic/Makefile.in12
-rw-r--r--libjava/classpath/org/ietf/jgss/GSSCredential.java10
-rw-r--r--libjava/classpath/org/ietf/jgss/GSSException.java47
-rw-r--r--libjava/classpath/org/ietf/jgss/GSSName.java9
-rw-r--r--libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java102
-rw-r--r--libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java100
-rw-r--r--libjava/classpath/org/omg/CORBA/AnyHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/AnySeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/AnySeqHolder.java6
-rwxr-xr-xlibjava/classpath/org/omg/CORBA/BAD_OPERATION.java92
-rw-r--r--libjava/classpath/org/omg/CORBA/BAD_QOS.java99
-rw-r--r--libjava/classpath/org/omg/CORBA/BooleanHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/ByteHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java103
-rw-r--r--libjava/classpath/org/omg/CORBA/CharHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/CharSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/CharSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/CompletionStatus.java10
-rw-r--r--libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java20
-rw-r--r--libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/DoubleHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/DynamicImplementation.java111
-rw-r--r--libjava/classpath/org/omg/CORBA/FieldNameHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/FixedHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/FloatHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/FloatSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/FloatSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/IDLTypeHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java100
-rw-r--r--libjava/classpath/org/omg/CORBA/IdentifierHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/IntHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/LocalObject.java128
-rw-r--r--libjava/classpath/org/omg/CORBA/LongHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/LongSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/LongSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/MARSHAL.java260
-rw-r--r--libjava/classpath/org/omg/CORBA/NO_RESOURCES.java70
-rw-r--r--libjava/classpath/org/omg/CORBA/NameValuePairHelper.java15
-rw-r--r--libjava/classpath/org/omg/CORBA/OMGVMCID.java100
-rw-r--r--libjava/classpath/org/omg/CORBA/ORB.java274
-rw-r--r--libjava/classpath/org/omg/CORBA/ObjectHelper.java7
-rw-r--r--libjava/classpath/org/omg/CORBA/ObjectHolder.java8
-rw-r--r--libjava/classpath/org/omg/CORBA/OctetSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/OctetSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/PERSIST_STORE.java2
-rw-r--r--libjava/classpath/org/omg/CORBA/ParameterModeHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyError.java8
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java115
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java158
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java103
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyHelper.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/PolicyListHelper.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/PrincipalHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/REBIND.java99
-rw-r--r--libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ShortHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ShortSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ShortSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/StringHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/StringSeqHelper.java4
-rwxr-xr-xlibjava/classpath/org/omg/CORBA/StringSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/StringValueHelper.java19
-rw-r--r--libjava/classpath/org/omg/CORBA/StructMemberHelper.java7
-rw-r--r--libjava/classpath/org/omg/CORBA/SystemException.java87
-rw-r--r--libjava/classpath/org/omg/CORBA/TIMEOUT.java98
-rw-r--r--libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java99
-rw-r--r--libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java99
-rw-r--r--libjava/classpath/org/omg/CORBA/TypeCodeHolder.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java2
-rw-r--r--libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java2
-rw-r--r--libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/ULongSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ULongSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/UShortSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/UShortSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/UnionMemberHelper.java7
-rw-r--r--libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java157
-rw-r--r--libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java103
-rw-r--r--libjava/classpath/org/omg/CORBA/ValueBaseHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/ValueBaseHolder.java10
-rw-r--r--libjava/classpath/org/omg/CORBA/ValueMemberHelper.java7
-rw-r--r--libjava/classpath/org/omg/CORBA/VersionSpecHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/VisibilityHelper.java14
-rw-r--r--libjava/classpath/org/omg/CORBA/WCharSeqHelper.java4
-rw-r--r--libjava/classpath/org/omg/CORBA/WCharSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/WStringSeqHelper.java4
-rwxr-xr-xlibjava/classpath/org/omg/CORBA/WStringSeqHolder.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/WStringValueHelper.java19
-rw-r--r--libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java151
-rw-r--r--libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java103
-rw-r--r--libjava/classpath/org/omg/CORBA/_IDLTypeStub.java6
-rw-r--r--libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java4
-rw-r--r--libjava/classpath/org/omg/CORBA_2_3/ORB.java8
-rw-r--r--libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java18
-rw-r--r--libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java66
-rw-r--r--libjava/classpath/org/omg/CosNaming/BindingHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java32
-rw-r--r--libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java5
-rw-r--r--libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java3
-rw-r--r--libjava/classpath/org/omg/CosNaming/IstringHelper.java4
-rw-r--r--libjava/classpath/org/omg/CosNaming/NameComponent.java14
-rw-r--r--libjava/classpath/org/omg/CosNaming/NameComponentHelper.java3
-rw-r--r--libjava/classpath/org/omg/CosNaming/NameHelper.java3
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java32
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java4
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextHelper.java32
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPOA.java4
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java7
-rw-r--r--libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java5
-rw-r--r--libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java4
-rw-r--r--libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java6
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java32
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynStructHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/DynValueHelper.java19
-rw-r--r--libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java4
-rw-r--r--libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java2
-rw-r--r--libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java10
-rw-r--r--libjava/classpath/org/omg/IOP/CodecFactoryHelper.java19
-rw-r--r--libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java2
-rw-r--r--libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java2
-rw-r--r--libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java2
-rw-r--r--libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java2
-rw-r--r--libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java60
-rw-r--r--libjava/classpath/org/omg/IOP/IORHelper.java3
-rw-r--r--libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java3
-rw-r--r--libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java56
-rw-r--r--libjava/classpath/org/omg/IOP/ServiceContextHelper.java3
-rw-r--r--libjava/classpath/org/omg/IOP/ServiceContextListHelper.java7
-rw-r--r--libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java61
-rw-r--r--libjava/classpath/org/omg/IOP/TaggedComponentHelper.java5
-rw-r--r--libjava/classpath/org/omg/IOP/TaggedProfileHelper.java13
-rw-r--r--libjava/classpath/org/omg/Messaging/SyncScopeHelper.java8
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java55
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java119
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java144
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java119
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java30
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java55
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/HOLDING.java55
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java57
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java52
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java6
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java59
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java195
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java106
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java90
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java57
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java119
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java17
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java1
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java10
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java121
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java57
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java150
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java105
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java69
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java78
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java144
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java103
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java169
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java104
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java119
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java38
-rw-r--r--libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java272
-rw-r--r--libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAHelper.java10
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java11
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java2
-rw-r--r--libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/Servant.java4
-rw-r--r--libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java31
-rw-r--r--libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java30
-rw-r--r--libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java6
-rw-r--r--libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java6
-rw-r--r--libjava/classpath/resource/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider3
-rw-r--r--libjava/classpath/resource/Makefile.in12
-rw-r--r--libjava/classpath/scripts/Makefile.in12
-rwxr-xr-xlibjava/classpath/scripts/loc44
-rw-r--r--libjava/classpath/test/native/lib/PrimlibInterface.c162
-rw-r--r--libjava/classpath/test/native/lib/PrimlibInterface.h141
-rw-r--r--libjava/classpath/test/native/lib/PrimlibTest.java88
-rw-r--r--libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java16
-rw-r--r--libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java3
-rw-r--r--libjava/classpath/vm/reference/java/io/VMObjectInputStream.java10
-rw-r--r--libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java11
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMClassLoader.java123
-rw-r--r--libjava/classpath/vm/reference/java/lang/VMThread.java9
-rw-r--r--libjava/classpath/vm/reference/java/security/VMAccessController.java42
-rw-r--r--libjava/classpath/vm/reference/standard.omit1
-rwxr-xr-xlibjava/gnu/awt/xlib/XGraphicsDevice.java58
-rwxr-xr-xlibjava/gnu/awt/xlib/XGraphicsEnvironment.java59
-rw-r--r--libjava/gnu/awt/xlib/XToolkit.java2
-rw-r--r--libjava/gnu/java/net/natPlainSocketImplPosix.cc58
-rw-r--r--libjava/gnu/java/net/natPlainSocketImplWin32.cc7
-rw-r--r--libjava/gnu/java/net/protocol/file/Connection.java368
-rw-r--r--libjava/gnu/java/net/protocol/file/Handler.java91
-rw-r--r--libjava/include/jvm.h7
-rw-r--r--libjava/java/io/ObjectInputStream.java30
-rw-r--r--libjava/java/io/ObjectStreamClass.java929
-rw-r--r--libjava/java/net/ServerSocket.java609
-rw-r--r--libjava/java/net/URLClassLoader.java159
-rw-r--r--libjava/java/net/URLConnection.java8
-rw-r--r--libjava/java/net/natVMNetworkInterfaceWin32.cc1
-rw-r--r--libjava/java/text/Collator.java23
-rw-r--r--libjava/java/text/DateFormat.java55
-rw-r--r--libjava/java/text/DateFormatSymbols.java46
-rw-r--r--libjava/java/text/DecimalFormatSymbols.java15
-rw-r--r--libjava/java/text/SimpleDateFormat.java1237
-rw-r--r--libjava/java/util/Calendar.java25
-rw-r--r--libjava/java/util/Date.java1261
-rw-r--r--libjava/java/util/GregorianCalendar.java14
-rw-r--r--libjava/java/util/ResourceBundle.java2
-rw-r--r--libjava/java/util/SimpleTimeZone.java1078
-rw-r--r--libjava/java/util/zip/ZipEntry.java408
-rw-r--r--libjava/java/util/zip/ZipFile.java551
-rw-r--r--libjava/posix-threads.cc21
-rw-r--r--libjava/prims.cc18
-rwxr-xr-xlibjava/scripts/makemake.tcl2
-rw-r--r--libjava/sources.am546
-rw-r--r--libstdc++-v3/ChangeLog68
-rw-r--r--libstdc++-v3/acinclude.m426
-rw-r--r--libstdc++-v3/config/os/bsd/darwin/ppc-extra.ver1
-rwxr-xr-xlibstdc++-v3/configure32
-rw-r--r--libstdc++-v3/configure.host3
-rw-r--r--libstdc++-v3/include/bits/cpp_type_traits.h20
-rw-r--r--libstdc++-v3/include/ext/rc_string_base.h181
-rw-r--r--libstdc++-v3/include/ext/sso_string_base.h45
-rw-r--r--libstdc++-v3/include/ext/vstring.h3
-rw-r--r--libstdc++-v3/include/ext/vstring.tcc24
-rw-r--r--libstdc++-v3/include/ext/vstring_util.h59
-rw-r--r--libstdc++-v3/libsupc++/eh_arm.cc43
-rw-r--r--libstdc++-v3/libsupc++/eh_personality.cc14
-rw-r--r--libstdc++-v3/libsupc++/eh_throw.cc2
-rw-r--r--libstdc++-v3/src/Makefile.am18
-rw-r--r--libstdc++-v3/src/Makefile.in28
-rw-r--r--libstdc++-v3/src/compatibility.cc25
2418 files changed, 133352 insertions, 48098 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 37cf1ef1f3a..031402b5d18 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,396 @@
+2005-11-18 Richard Earnshaw <richard.earnshaw@arm.com>
+
+ PR target/24914
+ * arm.c (arm_hard_regno_mode_ok): Co-processor registers aren't ok
+ when not generating code to use that co-processor.
+
+2005-11-18 James A. Morrison <phython@gcc.gnu.org>
+
+ * tree-flow.h (reserve_phi_args_for_new_edge, create_phi_node,
+ add_phi_arg, remove_phi_args, remove_phi_node phi_reverse): Mention that
+ these functions are now in tree-phinodes.c.
+
+2005-11-18 Jie Zhang <jie.zhang@analog.com>
+
+ * config/bfin/bfin.md (trap): New pattern.
+
+2005-11-18 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * tree-ssa-dom.c (extract_range_from_cond): Deal with variable bounds
+ on types.
+
+ * expr.c (expand_expr_real): Don't call record_block_change unless
+ ib_boundaries_block is non-null
+
+ * postreload.c (reload_cse_move2add): Don't try to work with BImode.
+
+ * fold-const.c (build_range_check): Use proper type for subtraction
+ when merging lower bound.
+
+2005-11-18 Zdenek Dvorak <dvorakz@suse.cz>
+
+ PR rtl-optimization/24497
+ * loop-unroll.c (apply_opt_in_copies): Do not verify equality of
+ the copied insn.
+
+2005-11-18 Zdenek Dvorak <dvorakz@suse.cz>
+
+ * tree-scalar-evolution.c (expression_expensive_p): New function.
+ (scev_const_prop): Use compute_overall_effect_of_inner_loop.
+
+2005-11-18 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/crtlibid.s: New file.
+
+2005-11-17 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR target/24348
+ * config.gcc (hppa*-*-hpux*): Add pa/t-slibgcc-elf-ver to tmake config
+ when not using sjlj exceptions.
+ * config/pa/pa64-hpux.h (LIB_SPEC): Add -lpthread in static links.
+ * config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
+ * config/pa/som.h (ASM_PREFERRED_EH_DATA_FORMAT): Delete define.
+ * config/pa/linux-unwind.h (pa32_fallback_frame_state): Use
+ DWARF_ALT_FRAME_RETURN_COLUMN instead of column 0 as return column.
+ * config/pa/pa-hpux.h (MD_UNWIND_SUPPORT): New define.
+ * config/pa/pa-linux.h (INCOMING_RETURN_ADDR_RTX,
+ DWARF_FRAME_RETURN_COLUMN, ASM_PREFERRED_EH_DATA_FORMAT,
+ ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): Delete defines.
+ * config/pa/pa.h (ARG_POINTER_CFA_OFFSET): Delete.
+ (FRAME_POINTER_CFA_OFFSET, INCOMING_RETURN_ADDR_RTX,
+ DWARF_FRAME_RETURN_COLUMN, DWARF_ALT_FRAME_RETURN_COLUMN,
+ ASM_PREFERRED_EH_DATA_FORMAT, ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): New
+ defines.
+ * config/pa/hpux-unwind.h: New file.
+
+2005-11-17 Alexandre Oliva <aoliva@redhat.com>
+
+ * config/rs6000/rs6000.h (ASM_OUTPUT_WEAKREF): Define.
+ * defaults.h (ASM_OUTPUT_WEAKREF): Add decl argument.
+ * varasm.c (do_assemble_alias): Adjust call.
+ (weak_finish): Don't use ASM_WEAKEN_LABEL if ASM_WEAKEN_DECL
+ is defined.
+ * doc/tm.texi (ASM_OUTPUT_WEAKREF): Document it.
+
+2005-11-17 James E Wilson <wilson@specifix.com>
+
+ * tree.def (FUNCTION_DECL): Correct typo in comment.
+
+2005-11-17 Richard Henderson <rth@redhat.com>
+
+ * dwarf2out.c (dw_cfi_oprnd_struct): Reduce dw_cfi_reg_num to int.
+ (lookup_cfa_1): Apply data alignment to DW_CFA_def_cfa_offset_sf
+ and DW_CFA_def_cfa_sf.
+ (def_cfa_1): Use DW_CFA_def_cfa_offset_sf with negative values.
+ (dbx_reg_number): Don't assert particular registers here.
+ (based_loc_descr): ... do it here instead. Fold in ...
+ (eliminate_reg_to_offset): ... this function.
+ (compute_frame_pointer_to_cfa_displacement): Fold in the effects
+ of eliminate_reg_to_offset; use FRAME_POINTER_CFA_OFFSET.
+ * unwind-dw2.c (execute_cfa_program): Apply data align factor
+ to DW_CFA_def_cfa_offset_sf and DW_CFA_def_cfa_sf.
+ * function.c (instantiate_new_reg): Use FRAME_POINTER_CFA_OFFSET.
+ (instantiate_virtual_regs): Likewise.
+ * var-tracking.c (adjust_stack_reference): Likewise.
+ * doc/tm.texi (FRAME_POINTER_CFA_OFFSET): New.
+
+2005-11-17 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/elf.h (STARTFILE_SPEC): Add "crtlibid%O%s"
+ * config/bfin/uclinux.h (STARFILE_SPEC): Likewise.
+ * config/bfin/t-bfin-elf (EXTRA_PARTS, EXTRA_MULTILIB_PARTS): Add
+ crtlibid.o.
+ ($(T)crtlibid.o): New rule.
+
+2005-11-16 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/24851
+ * fold-const.c (extract_array_ref): Return byte offset
+ in all cases.
+ (fold_binary): Fold &x[a] CMP &x[b] to
+ a*sizeof(*x) CMP b*sizeof(*x) to get correct overflow
+ behavior.
+
+2005-11-16 Richard Henderson <rth@redhat.com>
+
+ PR middle-end/23497
+ * tree-ssa.c (warn_uninitialized_var): Skip real and imaginary
+ parts of an SSA_NAME.
+
+2005-11-16 Richard Earnshaw <richard.earnshaw@arm.com>
+
+ PR target/24861
+ * arm.md (split for movsf with immediate): Restrict split to insns
+ that set a general register.
+
+2005-11-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * config/ia64/unwind-ia64.c (uw_advance_context): New. Call
+ uw_update_context.
+ * unwind-dw2.c (uw_advance_context): Likewise.
+ * unwind-sjlj.c (uw_advance_context): Likewise. Also call
+ _Unwind_SjLj_Unregister.
+ * unwind.inc (_Unwind_ForcedUnwind_Phase2): Call uw_advance_context.
+
+2005-11-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * unwind-sjlj.c (_Unwind_GetCFA): Handle the builtin_setjmp case.
+
+2005-11-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/alpha/alpha.c (alpha_init_builtins): Use type_for_mode
+ langhook to get a DImode integer type.
+
+2005-11-16 Richard Henderson <rth@redhat.com>
+ J"orn Rennecke <joern.rennecke@st.com>
+ Ulrich Weigand <uweigand@de.ibm.com>
+
+ PR rtl-opt/24160
+ PR target/24621
+ * reload1.c (reg_equiv_invariant): New.
+ (reload): Allocate, initialize, and free it.
+ (calculate_needs_all_insns): Check it when skipping equivalence
+ setting insns.
+ (alter_reg): Likewise.
+ (eliminate_regs_1): Rename from eliminate_regs. Add new
+ may_use_invariant argument; only use reg_equiv_invariant when true.
+ (eliminate_regs): New.
+ (eliminate_regs_in_insn): Use eliminate_regs_1; track when we're in
+ a context for which may_use_invariant may be true.
+
+2005-11-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * fold-const.c (const_binop): Don't constant fold the operation
+ if the result has overflowed and flag_trapping_math.
+ * simplify-rtx.c (simplify_const_binary_operation): Likewise.
+
+2005-11-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * config/arm/unwind-arm.c (abort): Add prototype here.
+ (UCB_FORCED_STOP_ARG): Correct typo in macro argument.
+ (struct phase1_vrs): Add prev_sp.
+ (unwind_phase2_forced): Save the original core registers instead of
+ modifying entry_vrs. Take a new flag argument for resuming unwinding
+ and set action flags accordingly. Always set _US_END_OF_STACK when
+ get_eit_entry fails. Unwind before calling the stop function.
+ (_Unwind_GetCFA): New function.
+ (__gnu_Unwind_ForcedUnwind): Update call to unwind_phase2_forced.
+ (__gnu_Unwind_Resume_or_Rethrow): Likewise.
+ (__gnu_Unwind_Resume): Do not unwind here for forced unwinding;
+ just call unwind_phase2_forced.
+ (_Unwind_GetDataRelBase, _Unwind_GetTextRelBase): Move to here.
+ * config/arm/unwind-arm.h (abort): Remove prototype.
+ (_Unwind_GetDataRelBase, _Unwind_GetTextRelBase): Change to
+ prototypes.
+ (_Unwind_GetCFA): New prototype.
+ * config/arm/pr-support.c (abort): Add prototype here.
+ * unwind-c.c (PERSONALITY_FUNCTION) [__ARM_EABI_UNWINDER__]: Handle
+ forced unwinding.
+ * config/arm/arm.c (arm_expand_prologue, thumb_expand_prologue): Do
+ not schedule the prologue with non-call exceptions and EABI.
+
+2005-11-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * config/arm/unwind-arm.h: Reorder interface function declarations.
+ (_URC_END_OF_STACK): New enumeration value.
+ (_US_UNWIND_ACTION_MASK, _US_FORCE_UNWIND, _US_END_OF_STACK): Likewise.
+ (struct _Unwind_Control_Block): Document reserved field use.
+ (_Unwind_Stop_Fn): New typedef.
+ (_Unwind_ForcedUnwind): Declare.
+ (_Unwind_Resume_or_Rethrow): Declare.
+ * gcc/config/arm/libunwind.S (UNWIND_WRAPER): Add nargs
+ argument. Adjust.
+ (_Unwind_Resume_or_Rethrow, _Unwind_ForcedUnwind): New.
+ * config/arm/unwind-arm.c (UCB_FORCED_STOP_FN)
+ (UCB_FORCED_STOP_ARG): New.
+ (search_EIT_table): Update boundary condition checks.
+ (get_eit_entry): Return _URC_END_OF_STACK when cannot unwind.
+ (unwind_phase2): Replace for with do..while.
+ (unwind_phase2_forced): New.
+ (__gnu_Unwind_RaiseException): Replace for with do..while.
+ (__gnu_Unwind_ForcedUnwind): New.
+ (__gnu_Unwind_Resume): Set FORCE_UNWIND flag, if forced unwinding.
+ Use appropriate phase2 unwinder.
+ (__gnu_Unwind_Resume_or_Rethrow): New.
+ (__gnu_unwind_pr_common): Cope with forced unwinding.
+
+2005-11-16 David Edelsohn <edelsohn@gnu.org>
+
+ PR target/24772
+ * config/rs6000/predicates.md (vrsave_operation): SET_SRC is a VEC.
+
+ * config/rs6000/rs6000.md (btruncsf2, ceilsf2, floorsf2,
+ roundsf2): Remove "s" from mnemonic.
+
+2005-11-16 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/crti.s (__init, __fini): Use appropriate prologue if
+ __PIC__ is defined.
+ * config/bfin/crtn.s: Change epilogues to match.
+ * config/bfin/t-bfin-elf (EXTRA_MULTILIB_PARTS): Define.
+ * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): If flag_pic, define
+ __PIC__ and __pic__.
+
+2005-11-16 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
+
+ PR 24357
+ * doc/invoke.texi: Distinguish between free and fixed form instead of
+ Fortran and Fortran 90/95. Remove ratfor from the list of supported
+ languages.
+ * gcc.c (default_compilers): Remove double entries, add entries for
+ suffixes '.F90' and '.F95'.
+
+2005-11-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/alpha/alpha.c (alpha_expand_prologue): Fix off-by-one bug
+ in the stack probing loop.
+
+2005-11-15 David Edelsohn <edelsohn@gnu.org>
+
+ * configure.ac: Use .machine power5 not power5x.
+ * configure: Regenerate.
+
+2005-11-15 Mike Stump <mrs@apple.com>
+
+ * c-decl.c (lookup_name_two): Add.
+ * c-tree.h (lookup_name_two): Likewise.
+ * c-common.c (handle_cleanup_attribute): Use lookup_name_two instead.
+ * config/darwin-c.c (darwin_pragma_unused): Likewise.
+
+2005-11-16 Alan Modra <amodra@bigpond.net.au>
+
+ PR rtl-optimization/23392
+ * regrename.c (enum scan_actions) Add mark_access.
+ (scan_actions_name): Ditto.
+ (scan_rtx_reg): Handle mark_access.
+ (scan_rtx_address): Do nothing for mark_access.
+ (build_def_use): Mark source registers in REG_FRAME_RELATED_EXPR
+ and regs in REG_INC notes before closing chains for dead regs.
+ Mark destination regs in REG_FRAME_RELATED_EXPR notes after
+ opening chains for new writes.
+
+2005-11-15 David Edelsohn <edelsohn@gnu.org>
+
+ * c.opt (ffixed-line-length-none): New.
+
+2005-11-15 Steve Ellcey <sje@cup.hp.com>
+
+ * mklibgcc.in: Change contents of eh_dummy.c.
+
+2005-11-15 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * loop.c (scan_loop): Do not insert temporaries for hard registers.
+
+2005-11-15 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * config/arm/lib1funcs.asm (div0) [L_dvmd_lnx]: Call raise instead
+ of making syscalls.
+ * config/arm/linux-eabi.h (CLEAR_INSN_CACHE): Define. Set r7 also.
+
+2005-11-15 Jan Hubicka <jh@suse.cz>
+
+ * invoke.texi (large-unit-insns): Document.
+ * ipa-inline.c (cgraph_decide_inlining): Use large-unit-insns param.
+ * params.def (large-unit-insns): New param.
+
+2005-11-15 Hans-Peter Nilsson <hp@axis.com>
+
+ PR target/24869
+ * config/cris/cris.md ("*mov_sidesisf_mem"): Do not match
+ special register for operand 3. Reindent constraints to align
+ them vertically.
+
+2005-11-14 David Edelsohn <edelsohn@gnu.org>
+
+ * doc/invoke.texi (RS/6000 and PowerPC Options): Add -mmfcrf,
+ -mpopcntb, -mfprnd. Add -mcpu=power5+.
+ * configure.ac: Add test for FP rounding instructions.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+ * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Define
+ _ARCH_PPCSQ, _ARCH_PPCGR, _ARCH_PWR4, _ARCH_PWR5, _ARCH_PWR5X if
+ features enabled.
+ * config/rs6000/rs6000.opt (mfprnd): New.
+ * config/rs6000/rs6000.c (processor_target_table): Add power5+.
+ (POWERPC_MASKS): Add MASK_POPCNTB and MASK_FPRND.
+ * config/rs6000/aix52.h (ASM_CPU_SPEC): Add -mpower5+.
+ * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add -mpower5+.
+ (TARGET_FPRND): New.
+ * config/rs6000/rs6000.md (UNSPEC_FRIM, UNSPEC_FRIN, UNSPEC_FRIP,
+ UNSPEC_FRIZ): New.
+ (btrunc<mode>2): New.
+ (ceil<mode>2): New.
+ (floor<mode>2): New.
+ (round<mode>2): New.
+
+2005-11-14 Geoffrey Keating <geoffk@apple.com>
+
+ * gcc.c (version_compare_spec_function): Use fatal() rather than
+ abort().
+
+ * config/rs6000/darwin.h (DARWIN_CRT2_SPEC): New.
+ (SUBTARGET_EXTRA_SPECS): Define %(darwin_crt2).
+ * config/i386/darwin.h (SUBTARGET_EXTRA_SPECS): Define %(darwin_crt2)
+ as empty.
+ * config/darwin.h (STARTFILE_SPEC): Use %(darwin_crt2) to possibly
+ link in crt2.o.
+
+ * config/darwin.h (REAL_LIBGCC_SPEC): Link in shared libgcc depending
+ on -mmacosx-version-min setting.
+
+2005-11-14 Diego Novillo <dnovillo@redhat.com>
+
+ PR 24840
+ * tree-vrp.c (infer_value_range): Return false if STMT is a
+ block terminator and its basic block has no successors.
+
+2005-11-14 Mike Stump <mrs@apple.com>
+
+ * config/i386/i386.c (override_options): -masm=intel isn't
+ supported on darwin.
+ * doc/invoke.texi (i386 and x86-64 Options): Likewise.
+
+2005-11-15 Joseph S. Myers <joseph@codesourcery.com>
+
+ * crtstuff.c: Undefine gid_t, pid_t, rlim_t, ssize_t, uid_t and
+ vfork after including auto-host.h.
+
+2005-11-15 Alan Modra <amodra@bigpond.net.au>
+
+ PR rtl-optimization/22002
+ * combine.c (distribute_notes): Detect cases where a reg dies
+ two or more times in a bb, including on the insn we are combining,
+ and place the death note on the correct range.
+
+2005-11-14 Dale Johannesen <dalej@apple.com>
+
+ * expmed.c (store_bit_field): Add offset unconditionally for
+ memory targets.
+ (extract_bit_field): Don't force extzv or extv operand into
+ a register if field is too big.
+
+2005-11-14 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * config/arm/arm.c (pic_labelno): New.
+ (arm_load_pic_register): Use an UNSPEC_PIC_LABEL instead of a
+ LABEL_REF. Pass only the labelno to PIC insns.
+ (arm_call_tls_get_addr, legitimize_tls_address): Likewise.
+ (arm_output_addr_const_extra): Handle UNSPEC_PIC_LABEL.
+ * arm.md (UNSPEC_PIC_LABEL): New constant.
+ (pic_add_dot_plus_four, pic_add_dot_plus_eight)
+ (tls_load_dot_plus_eight): Expect a labelno instead of a LABEL_REF.
+ Use the correct label prefix.
+
+2005-11-14 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * config/arm/arm.c (legitimize_tls_address): Use correct rtx for
+ REQ_EQUIV note.
+
+2005-11-14 Richard Earnshaw <richard.earnshaw@arm.com>
+
+ * loop-invariant.c: Include tm_p.h.
+ * Makefile.in: Updated.
+
2005-11-13 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa.c (store_reg): Revise generation of frame notes in large frames.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 338bf3f9c4a..fe460c49669 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20051113
+20051118
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 19e052eb49f..c43bec328f9 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2330,7 +2330,7 @@ loop-iv.o : loop-iv.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(BASIC_BLOCK_H) \
output.h intl.h
loop-invariant.o : loop-invariant.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) coretypes.h \
- $(TM_H) function.h $(FLAGS_H) $(DF_H) $(OBSTACK_H) output.h
+ $(TM_H) $(TM_P_H) function.h $(FLAGS_H) $(DF_H) $(OBSTACK_H) output.h
cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(CFGLAYOUT_H) output.h \
coretypes.h $(TM_H) cfghooks.h $(OBSTACK_H)
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index dff3b6cbcca..99ec0728970 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,1367 @@
+2005-11-18 Laurent GUERBY <laurent@guerby.net>
+
+ PR ada/24857
+ * Makefile.in: Use s-auxdec-empty for RTEMS.
+
+2005-11-17 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ PR ada/22333
+ * trans.c (gnat_gimplify_expr, case ADDR_EXPR): Always make
+ a temporary if taking the address of something that is neither
+ reference, declaration, or constant, since the gimplifier
+ can't handle that case.
+
+2005-11-17 Laurent GUERBY <laurent@guerby.net>
+
+ PR ada/24857
+ * s-auxdec-empty.ads, s-auxdec-empty.adb: New files.
+
+2005-11-16 Richard Guenther <rguenther@suse.de>
+
+ * Makefile.in: Add EH_MECHANISM=-gcc to s390(x) linux.
+
+2005-11-16 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ PR ada/24855
+ * raise-gcc.c: Add missing stdarg.h include.
+
+2005-11-16 Richard Guenther <rguenther@suse.de>
+
+ * Make-lang.in (ada/decl.o): Add $(EXPR_H) dependency.
+ (ada/misc.o): Likewise.
+
+2005-11-14 Thomas Quinot <quinot@adacore.com>
+
+ * g-soccon.ads: Minor reformatting. Update comments.
+
+ * gsocket.h: Include <sys/times.h> in the VxWorks case, in order to
+ gain visibility on the declaration of struct timeval.
+
+ * g-soccon-freebsd.ads,
+ g-soccon-darwin.ads,
+ g-soccon-tru64.ads,
+ g-soccon-aix.ads,
+ g-soccon-irix.ads,
+ g-soccon-hpux.ads,
+ g-soccon-solaris.ads,
+ g-soccon-vms.ads,
+ g-soccon-mingw.ads,
+ g-soccon-vxworks.ads (SIZEOF_tv_sec, SIZEOF_tv_usec): New constants.
+
+ * g-soccon-hpux-ia64.ads, g-soccon-linux-ppc.ads,
+ g-soccon-solaris-64.ads, g-soccon-linux-64.ads,
+ g-soccon-linux-x86.ads: New files.
+
+ * g-socthi-mingw.adb:
+ (Socket_Error_Message): Remove redundant use of GNAT.Sockets.Constants
+
+ * g-socthi-vxworks.ads, g-socthi-vms.ads, g-socthi-mingw.ads
+ (time_t, suseconds_t): New types constructed to match the tv_sec
+ and tv_usec fields of C struct timeval.
+ (Timeval): Construct structure in terms of the new types.
+ (Host_Errno): New function (imported from socket.c), returns last hosts
+ database error.
+
+ * g-socthi-vxworks.adb: Add error handling circuitry.
+
+ * g-socket.ads, g-socket.adb (To_Timeval): Reflect change of type for
+ components of struct timeval.
+ (Get_Host_By_Name, Get_Host_By_Address): Fix error reporting circuitry.
+ (Check_Selector): In error conditions, clear internal socket sets to
+ avoid a memory leak.
+ (Get_Socket_Option, Set_Socket_Option): Support for Multicast_If,
+ Send_Timeout, Receive_Timeout.
+
+ * g-socthi.ads (time_t, suseconds_t): New types constructed to match
+ the tv_sec and tv_usec fields of C struct timeval.
+ (Timeval): Construct structure in terms of the new types.
+ (Host_Errno): New function (imported from socket.c), returns last hosts
+ database error.
+
+ * socket.c (__gnat_get_h_errno): New function to retrieve h_errno, the
+ hosts database last error code.
+
+ * gen-soccon.c: Complete value expansion should not be performed on
+ TARGET, as it has the form of a math expression, and some components
+ may be platform-defined macros.
+ For VxWorks, generate the OK and ERROR values.
+ New constants giving the sizes of the components of C struct timeval.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+
+ PR ada/18434
+
+ * types.ads: Include All_Checks in Suppress_Array
+
+ * checks.adb (Check_Needed): Remove kludge for a/=b rewritten as
+ not(a=b), since we no longer do this rewriting, and hence it is not
+ needed.
+ (Elaboration_Checks_Suppressed): Add special casing to
+ deal with different cases of static and dynamic elaboration checks (all
+ checks does not count in the first case, but does in the second).
+ (Expr_Known_Valid): Do not assume that the result of any arbitrary
+ function call is valid, since this is not the case.
+ (Ensure_Valid): Do not apply validity check to a real literal
+ in a universal or fixed context
+
+ * exp_ch4.adb (Expand_N_Op_Ne): Don't expand a/=b to not(a=b) for
+ elementary types using the operator in standard. It is cleaner not to
+ modify the programmers intent, especially in the case of floating-point.
+ (Rewrite_Comparison): Fix handling of /= (this was always wrong, but
+ it did not matter because we always rewrote a/=b to not(a=b).
+ (Expand_Allocator_Expression): For an allocator expression whose nominal
+ subtype is an unconstrained packed type, convert the expression to its
+ actual constrained subtype.
+ Implement warning for <= or >= where < or > not possible
+ Fix to Vax_Float tests (too early in many routines, causing premature
+ Vax_Float expansions.
+
+ * sem_prag.adb (Analyze_Pragma, case Obsolescent): Allow this pragma
+ to be used with packages and generic packages as well as with
+ subprograms.
+ (Suppress): Set All_Checks, but not Elaboration_Check, for case
+ of pragma Suppress (All_Checks)
+ (Analyze_Pragma, case Warnings): Implement first argument allowed to be
+ a string literal for precise control over warnings.
+ Avoid raise of pragma in case of unrecognized pragma and just return
+ instead.
+
+ * sem_prag.ads: Minor reformatting
+
+ * switch-c.adb (Scan_Front_End_Switches): Replace "raise Bad_Switch;"
+ with call to new procedure Bad_Switch. Call Scan_Pos with new parameter
+ Switch. Do not handle any exception.
+ Include -gnatwx as part of -gnatg (warn on redundant parens)
+ Allow optional = after -gnatm
+ (Scan_Front_End_Switches): The -gnatp switch sets All_Checks, but no
+ longer sets Elaboration_Checks.
+ Code to set warning mode moved to Sem_Warn
+ so that it can be shared by pragma processing.
+
+ * s-mastop-tru64.adb (Pop_Frame): Remove redundant parentheses in if
+ statement.
+
+ * s-taprop-solaris.adb:
+ Change some <= to =, to avoid new warning
+
+ * a-exexda.adb, prj-proc.adb:
+ Fix obvious typo (Num_Tracebacks compared <= 0 instead of < 0)
+ Fix obvious typo (Total_Errors_Detected <= 0 should be = 0)
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * exp_vfpt.adb: Handle /= case
+ (Expand_Vax_Conversion): Properly recognize Conversion_OK flag
+ so that we do not get duplicate scaling for fixed point conversions.
+
+ * s-vaflop.ads, s-vaflop.adb: (Ne_F): New function
+
+2005-11-14 Matthew Gingell <gingell@adacore.com>
+
+ * system-lynxos-ppc.ads, system-lynxos-x86.ads:
+ Increase default priority on Lynx from 15 to 17, and meet the Ada
+ requirement that Default_Priority be ((Priority'First +
+ Priority'Last) / 2) by increasing the range of Interrupt_Priority.
+
+2005-11-14 Vincent Celier <celier@adacore.com>
+
+ * mlib-tgt-tru64.adb, mlib-tgt-aix.adb, mlib-tgt-irix.adb,
+ mlib-tgt-hpux.adb, mlib-tgt-hpux.adb, mlib-tgt-linux.adb,
+ mlib-tgt-solaris.adb, mlib-tgt-vms-alpha.adb, mlib-tgt-vms-alpha.adb,
+ mlib-tgt-vms-ia64.adb, mlib-tgt-mingw.adb, mlib-tgt-vxworks.adb,
+ mlib-tgt-darwin.adb, mlib-tgt.adb, mlib-tgt.ads,
+ mlib-tgt-lynxos.adb (DLL_Prefix): New function
+
+2005-11-14 Doug Rupp <rupp@adacore.com>
+
+ * system-vms.ads, system-vms_64.ads: ADA$GNAT: New exported object in
+ private part.
+
+2005-11-14 Arnaud Charlet <charlet@adacore.com>
+
+ * s-traces-default.adb, s-trafor-default.ads,
+ s-tratas-default.adb: Fix compilation errors.
+
+2005-11-14 Jose Ruiz <ruiz@adacore.com>
+
+ * s-taprop-posix.adb (Initialize_Lock): Destroy mutex attribute before
+ raising the exception so the memory used is freed.
+
+2005-11-14 Arnaud Charlet <charlet@adacore.com>
+
+ * adaint.h, adaint.c (__gnat_is_cross_compiler): New constant.
+ (Gnat_Install_Locks, __gnatlib_install_locks): Removed, no longer used.
+ (convert_address): Update comments and list of platforms using this.
+
+ * s-tasini.adb (Gnat_Install_Locks, __gnatlib_install_locks): Removed,
+ no longer used.
+
+2005-11-14 Pascal Obry <obry@adacore.com>
+ Vincent Celier <celier@adacore.com>
+
+ * gnatdll.adb (Parse_Command_Line): Remove redundant use of
+ GNAT.Command_Line.
+
+ * memroot.adb: Remove redundant with/use clause on
+ System.Storage_Elements.
+
+2005-11-14 Arnaud Charlet <charlet@adacore.com>
+
+ * a-except.adb (Zero_Cost_Exceptions): Removed, no longer used.
+ (builtin_longjmp, Process_Raise_Exceeption): Move setjmp/longjmp
+ related code to a-exexpr.adb
+ (Save_Occurrence_And_Private): Move GCC EH related code to
+ a-exexpr-gcc.adb
+ (Raise_Current_Excep): Add new variable Id with pragma
+ volatile, to ensure that the variable lives on stack.
+
+ * a-exexpr-gcc.adb, raise-gcc.c: New file.
+
+ * a-exexpr.adb (builtin_longjmp, Propagate_Exception): Moved here code
+ from a-except.adb.
+ Move GCC EH related code to a-exexpr-gcc.adb
+
+ * Makefile.in: Add or update g-soccon LIBGNAT pairs for Linux/PPC and
+ 64-bit Solaris
+ Split the Linux version of g-soccon into separate variants for 32 and 64
+ bit platforms.
+ (gnatlib): Use $(AR_FOR_TARGET) and $(RANLIB_FOR_TARGET)
+ vice $(AR) and $(RANLIB). Remove use of host variable $(RANLIB_FLAGS).
+ install-gnatlib: Use $(RANLIB_FOR_TARGET) vice $(RANLIB). Remove use
+ of host variable $(RANLIB_FLAGS).
+ (alpha64-dec-*vms*): Fix translations for 64 bit compiler.
+ Code clean up: remove unused/obsolete targets.
+ (EH_MECHANISM): New variable introduced to differenciate between the
+ two EH mechanisms statically.
+ (gnatlib-zcx, gnatlib-sjlj): Force EH_MECHANISM manually.
+ (LIBGNAT_OBJS): Add raise-gcc.o
+ (LIBGNAT_TARGET_PAIRS for ppc-vxworks): Use an specialized version of
+ s-osinte.adb, s-tpopsp.adb, and system.ads for the run time that
+ supports VxWorks 6 RTPs.
+ (EXTRA_GNATRTL_NONTASKING_OBJS for ppc-vxworks): Remove the use of
+ i-vxworks and i-vxwoio from the run time that supports VxWorks 6 RTPs.
+
+ * raise.c: Move all GCC EH-related routines to raise-gcc.c
+
+2005-11-14 Jose Ruiz <ruiz@adacore.com>
+
+ * s-tassta.adb (Create_Task): Move the code in charge of resetting the
+ deferral level, when abort is not allowed, to a later stage (the
+ Task_Wrapper).
+ (Task_Wrapper): If Abort is not allowed, reset the deferral level since
+ it will not get changed by the generated code. It was previously done
+ in Create_Task.
+
+2005-11-14 Thomas Quinot <quinot@adacore.com>
+ Olivier Hainque <hainque@adacore.com>
+ Eric Botcazou <ebotcazou@adacore.com>
+
+ * decl.c:
+ Factor common code to build a storage type for an unconstrained object
+ from a fat or thin pointer type and a constrained object type.
+ (annotate_value): Handle BIT_AND_EXPR.
+ (annotate_rep): Don't restrict the back annotation of inherited
+ components to the type_annotate_only case.
+ (gnat_to_gnu_entity) <E_Array_Type>: Do not invoke create_type_decl if
+ we are not defining the type.
+ <E_Record_Type>: Likewise.
+ (gnat_to_gnu_entity) <object, renaming>: Adjust comments and structure
+ to get advantage of the new maybe_stabilize_reference interface, to
+ ensure that what we reference is indeed stabilized instead of relying
+ on assumptions on what the stabilizer does.
+ (gnat_to_gnu_entity) <E_Incomplete_Type>: If the entity is an incomplete
+ type imported through a limited_with clause, use its non-limited view.
+ (Has_Stdcall_Convention): New macro, to centralize the Windows vs others
+ differentiation.
+ (gnat_to_gnu_entity): Use Has_Stdcall_Convention instead of a spread mix
+ of #if sections + explicit comparisons of convention identifiers.
+ (gnat_to_gnu_entity) <E_Variable>: Decrement force_global if necessary
+ before early-returning for certain types when code generation is
+ disabled.
+ (gnat_to_gnu_entity) <object>: Adjust comment attached to the
+ nullification of gnu_expr we do for objects with address clause and
+ that we are not defining.
+ (elaborate_expression_1): Do not create constants when creating
+ variables needed by the debug info: the dwarf2 writer considers that
+ CONST_DECLs is used only to represent enumeration constants, and emits
+ nothing for them.
+ (gnat_to_gnu_entity) <object>: When turning a non-definition of an
+ object with an address clause into an indirect reference, drop the
+ initializing expression.
+ Include "expr.h".
+ (STACK_CHECK_BUILTIN): Delete.
+ (STACK_CHECK_PROBE_INTERVAL): Likewise.
+ (STACK_CHECK_MAX_FRAME_SIZE): Likewise.
+ (STACK_CHECK_MAX_VAR_SIZE): Likewise.
+ (gnat_to_gnu_entity): If gnat_entity is a renaming, do not mark the tree
+ corresponding to the renamed object as ignored for debugging purposes.
+
+ * trans.c (tree_transform, case N_Attribute_Reference, case Attr_Size &
+ related): For a prefix that is a dereference of a fat or thin pointer,
+ if there is an actual subtype provided by the front-end, use that
+ subtype to build an actual type with bounds template.
+ (tree_transform, case N_Free_Statement): If an Actual_Designated_Subtype
+ is provided by the front-end, use that subtype to compute the size of
+ the deallocated object.
+ (gnat_to_gnu): When adding a statement into an elaboration procedure,
+ check for a potential violation of a No_Elaboration_Code restriction.
+ (maybe_stabilize_reference): New function, like gnat_stabilize_reference
+ with extra arguments to control whether to recurse through non-values
+ and to let the caller know if the stabilization has succeeded.
+ (gnat_stabilize_reference): Now a simple wrapper around
+ maybe_stabilize, for common uses without restriction on lvalues and
+ without need to check for the success indication.
+ (gnat_to_gnu, call_to_gnu): Adjust calls to gnat_stabilize_reference, to
+ pass false instead of 0 as the FORCE argument which is a bool.
+ (Identifier_to_gnu): Remove checks ensuring that an renamed object
+ attached to a renaming pointer has been properly stabilized, as no such
+ object is attached otherwise.
+ (call_to_gnu): Invoke create_var_decl to create the temporary when the
+ function uses the "target pointer" return mechanism.
+ Reinstate conversion of the actual to the type of the formal
+ parameter before any other specific treatment based on the passing
+ mechanism. This turns out to be necessary in order for PLACEHOLDER
+ substitution to work properly when the latter type is unconstrained.
+
+ * gigi.h (build_unc_object_type_from_ptr): New subprogram, factoring a
+ common pattern.
+ (maybe_stabilize_reference): New function, like gnat_stabilize_reference
+ with extra arguments to control whether to recurse through non-values
+ and to let the caller know if the stabilization has succeeded.
+
+ * utils2.c (gnat_build_constructor): Only sort the fields for possible
+ static output of record constructor if all the components are constant.
+ (gnat_build_constructor): For a record type, sort the list of field
+ initializers in increasing bit position order.
+ Factor common code to build a storage type for an unconstrained object
+ from a fat or thin pointer type and a constrained object type.
+ (build_unary_op) <ADDR_EXPR>: Always recurse down conversions between
+ types variants, and process special cases of VIEW_CONVERT expressions
+ as their NOP_EXPR counterpart to ensure we get to the
+ CORRESPONDING_VARs associated with CONST_DECls.
+ (build_binary_op) <MODIFY_EXPR>: Do not strip VIEW_CONVERT_EXPRs
+ on the right-hand side.
+
+ * utils.c (build_unc_object_type_from_ptr): New subprogram, factoring
+ a common pattern.
+ (convert) <VIEW_CONVERT_EXPR>: Return the inner operand directly if we
+ are converting back to its original type.
+ (convert) <JM input>: Fallthrough regular conversion code instead of
+ extracting the object if converting to a type variant.
+ (create_var_decl): When a variable has an initializer requiring code
+ generation and we are at the top level, check for a potential violation
+ of a No_Elaboration_Code restriction.
+ (create_var_decl): call expand_decl for CONST_DECLs, to set MODE, ALIGN
+ SIZE and SIZE_UNIT which we need for later back-annotations.
+ * utils.c: (convert) <STRING_CST>: Remove obsolete code.
+ <VIEW_CONVERT_EXPR>: Do not lift the conversion if the target type
+ is an unchecked union.
+ (pushdecl): Set DECL_NO_STATIC_CHAIN on imported nested functions.
+ (convert) <VIEW_CONVERT_EXPR>: When the types have the same
+ main variant, just replace the VIEW_CONVERT_EXPR.
+ <UNION_TYPE>: Revert 2005-03-02 change.
+
+ * repinfo.h, repinfo.ads: Add tcode for BIT_AND_EXPR.
+
+ * repinfo.adb (Print_Expr, Rep_Value): Handle Bit_And_Expressions.
+
+2005-11-14 Matthew Heaney <heaney@adacore.com>
+
+ * a-crbtgo.ads, a-crbtgo.adb, a-coorse.ads, a-coorse.adb, a-convec.ads,
+ a-convec.adb, a-coinve.ads, a-coinve.adb, a-cohama.ads, a-cohama.adb,
+ a-ciorse.ads, a-ciorse.adb, a-cihama.ads, a-cihama.adb, a-cidlli.ads,
+ a-cidlli.adb, a-cdlili.ads, a-cdlili.adb, a-coormu.adb, a-ciormu.adb,
+ a-cihase.adb, a-cihase.ads, a-cohase.adb, a-cohase.ads, a-ciorma.ads,
+ a-coorma.ads, a-ciormu.ads, a-coormu.ads, a-ciorma.adb, a-coorma.adb:
+ Compiles against the spec for ordered maps described in sections
+ A.18.6 of the most recent (August 2005) AI-302 draft.
+
+2005-11-14 Olivier Hainque <hainque@adacore.com>
+
+ * cuintp.c (UI_To_gnu): Use a proper type for intermediate computations
+ to ensure bias adjustments take place when need be and to prevent
+ occurrences of intermediate overflows.
+
+2005-11-14 Matthew Gingell <gingell@adacore.com>
+ Olivier Hainque <hainque@adacore.com>
+
+ * tb-gcc.c (trace_callback): Work around problem with _Unwind_GetIP on
+ ia64 HP-UX.
+
+ * tracebak.c (ia64 configuration): Enable _Unwind_Backtrace driven
+ tracebacks on ia64 HP-UX and provide explanatory comment.
+ Enable backtraces on ia64 GNU/Linux.
+ (x86 configuration): Bump FRAME_LEVEL to 1 to ensure we retrieve a real
+ base pointer from builtin_frame_address. Adjust BASE_SKIP accordingly.
+
+2005-11-14 Hristian Kirtchev <kirtchev@adacore.com>
+ Javier Miranda <miranda@adacore.com>
+
+ * rtsfind.ads, exp_util.adb, exp_util.ads, exp_disp.adb, exp_disp.ads,
+ exp_ch7.adb, sem_ch9.adb, snames.adb, snames.ads,
+ exp_ch9.adb, exp_ch9.ads, exp_ch6.adb, exp_ch3.adb, exp_ch3.ads,
+ einfo.ads, einfo.adb: Complete support for Ada 2005 interfaces.
+
+ * a-tags.ads, a-tags.adb: Major rewrite and additions to implement
+ properly new Ada 2005 interfaces (AI-345) and add run-time checks (via
+ assertions).
+
+ * exp_dbug.ads, exp_dbug.adb (Get_Secondary_DT_External_Name): New
+ subprogram that generates the external name associated with a
+ secondary dispatch table.
+ (Get_Secondary_DT_External_Name): New subprogram that generates the
+ external name associated with a secondary dispatch table.
+
+2005-11-14 Emmanuel Briot <briot@adacore.com>
+
+ * xref_lib.adb (Parse_Identifier_Info): It is possible for an entity
+ line in the ALI file to include both an instantiation reference, and a
+ returned value.
+
+2005-11-14 Vincent Celier <celier@adacore.com>
+
+ * clean.adb (Check_Project): Look for Ada code in extending project,
+ even if Ada is not specified as a language.
+ Use new function DLL_Prefix for DLL_Name
+ (Clean_Interface_Copy_Directory): New procedure
+ (Clean_Library_Directory): New procedure
+ (Clean_Directory): Remove procedure, no longer used
+ (Clean_Project): Do not delete any file in an externally built project
+
+ * prj-env.adb (Set_Ada_Paths.Add.Recursive_Add): Add the object
+ directory of an extending project, even when there are no Ada source
+ present.
+ (Ada_Objects_Path.Add): Add Library_ALI_Dir, not Library_Dir to the path
+ (Set_Ada_Paths.Add.Recursive_Add): Ditto
+
+ * mlib-prj.adb (Check_Library): For all library projects, get the
+ library file timestamp.
+ (Build_Library): Copy ALI files in Library_ALI_Dir, not in Library_Dir
+ (Build_Library): Use new function DLL_Prefix for the DLL_Name
+ (Clean): Remove procedure, no longer used
+ (Ultimate_Extension_Of): New function
+ (Build_Library): When cleaning the library directory, only remove an
+ existing library file and any ALI file of a source of the project.
+ When cleaning the interface copy directory, remove any source that
+ could be a source of the project.
+
+ * prj.ads, prj.adb (Project_Empty): Add values of new components
+ Library_TS and All_Imported_Projects.
+ (Project_Empty): Add values for new components of Project_Data:
+ Library_ALI_Dir and Display_Library_ALI_Dir
+
+ * prj-attr.adb: New project level attribute name Library_ALI_Dir
+
+ * prj-nmsc.adb (Check_Library_Attributes): Take into account new
+ attribute Library_ALI_Dir.
+ (Check_Library_Attributes): The library directory cannot be the same as
+ any source directory of the project tree.
+ (Check_Stand_Alone_Library): The interface copy directory cannot be
+ the same as any source directory of the project tree.
+
+ * mlib.adb: Use Prj.Com.Fail, instead of Osint.Fail directly, to delete
+ all temporary files.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+
+ * sem_elab.adb: Change name Is_Package to Is_Package_Or_Generic_Package
+ (Check_Elab_Call): A call within a protected body is never an
+ elaboration call, and does not require checking.
+ (Same_Elaboration_Scope): Take into account protected types for both
+ entities.
+ (Activate_Elaborate_All_Desirable): New procedure
+
+ * ali.ads, ali.adb: Implement new AD/ED for Elaborate_All/Elaborate
+ desirable
+
+ * binde.adb: Implement new AD/ED for Elaborate_All/Elaborate desirable
+ (Elab_Error_Msg): Use -da to include internal unit links, not -de.
+
+ * lib-writ.ads, lib-writ.adb:
+ Implement new AD/ED for Elaborate_All/Elaborate desirable
+ Use new Elaborate_All_Desirable flag in N_With_Clause node
+
+ * sinfo.ads, sinfo.adb (Actual_Designated_Subtype): New attribute for
+ N_Free_Statement nodes.
+ Define new class N_Subprogram_Instantiation
+ Add Elaborate_Desirable flag to N_With_Clause node
+ Add N_Delay_Statement (covering two kinds of delay)
+
+ * debug.adb: Introduce d.f flag for compiler
+ Add -da switch for binder
+
+2005-11-14 Ed Schonberg <schonberg@adacore.com>
+ Cyrille Comar <comar@adacore.com>
+
+ * exp_aggr.adb (Build_Record_Aggr_Code): Do not create master entity
+ for task component, in the case of a limited aggregate. The enclosed
+ object declaration will create it earlier. Otherwise, in the case of a
+ nested aggregate, the object may appear in the wrong scope.
+ (Convert_Aggr_In_Object_Decl): Create a transient scope when needed.
+ (Gen_Assign): If the component being assigned is an array type and the
+ expression is itself an aggregate, wrap the assignment in a block to
+ force finalization actions on the temporary created for each row of the
+ enclosing object.
+ (Build_Record_Aggr_Code): Significant rewrite insuring that ctrl
+ structures are initialized after all discriminants are set so that
+ they can be accessed even when their offset is dynamic.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+ Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_attr.adb: Implement Machine_Rounding attribute
+ (Analyze_Access_Attribute): The access attribute may appear within an
+ aggregate that has been expanded into a loop.
+ (Check_Task_Prefix): Add semantic check for attribute 'Callable and
+ 'Terminated whenever the prefix is of a task interface class-wide type.
+ (Analyze_Attribute): Add semantic check for attribute 'Identity whenever
+ the prefix is of a task interface class-wide type.
+
+ * s-vaflop-vms-alpha.adb: Valid_D, Valid_F, Valid_G: Make Val constant
+ to avoid warnings.
+
+ * s-fatgen.ads, s-fatgen.adb (Machine_Rounding): New function
+ Remove pragma Inline for [Unaligned_]Valid.
+ Add comments that Valid routines do not work for Vax_Float
+
+ * exp_attr.adb: Implement Machine_Rounding attribute
+
+ * snames.h: Add entry for Machine_Rounding attribute
+
+2005-11-14 Javier Miranda <miranda@adacore.com>
+ Robert Dewar <dewar@adacore.com>
+ Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_attr.adb (Expand_N_Attribute_Reference, cases of Attribute_Size
+ and related): For a prefix that is an explicit dereference of an
+ access to unconstrained packed array type, annotate the dereference
+ with an actual subtype so GIGI can make a correct size computation.
+ (Expand_N_Attribute_Reference): In case of 'Unchecked_Access and
+ 'Unrestricted_Access, if the designated type is an interface we
+ add a type conversion to force the displacement of the pointer
+ to the secondary dispatch table.
+ Use Universal_Real instead of Long_Long_Float when we need a high
+ precision float type for the generated code (prevents gratuitous
+ Vax_Float stuff when pragma Float_Representation (Vax_Float) used)
+ (Expand_N_Attribute_Reference): Add support for attribute 'Callable and
+ 'Terminated for task interface class-wide objects. Generate a call to
+ the predefined dispatching routine used to retrieve the _task_id from
+ a task corresponding record.
+ (Expand_Fpt_Attribute): Major change to properly handle Vax_Float
+
+ * sem_disp.adb: Change name Is_Package to Is_Package_Or_Generic_Package
+ (Check_Dispatching_Operation): Protect the frontend againts
+ previously detected errors.
+
+ * Makefile.rtl: Add new instantiations of system.fat_gen
+
+ * s-fatflt.ads, s-fatlfl.ads, s-fatllf.ads, s-fatsfl.ads:
+ Change name of instantiated package for better consistency
+ with newly added system.fat_gen instantiations.
+
+ * s-filofl.ads, s-fishfl.ads, s-fvadfl.ads, s-fvaffl.ads,
+ s-fvagfl.ads: New files.
+
+2005-11-14 Cyrille Comar <comar@adacore.com>
+ Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch5.adb (Expand_N_Assignment_Statement, Tagged_Case): For an
+ assignment of a value of a tagged type that has been rewritten to a
+ block statement, it is known by construction that no checks are
+ necessary for the statements within the block: analyze it with checks
+ suppressed.
+ (Expand_N_If_Statement): When killing a dead then-branch in an
+ if-statement that has elsif_parts, recompute the Current_Value node
+ for any entity whose value is known from the condition of the first
+ elsif_part.
+ (Expand_N_Return_Statement): When returning a mutable record, convert
+ the return value into its actual subtype in order to help the backend
+ to return the actual size instead of the maximum. This is another
+ aftermath of not returning mutable records on the sec-stack anymore.
+
+ * sem_ch5.ads, sem_ch5.adb (Analyze_Iteration_Scheme): Minor change to
+ handling of error msg for suspicious reverse range iteration.
+ (Check_Possible_Current_Value_Condition): Move declaration from body to
+ spec, to allow this subprogram to be called from exp_ch5.
+
+2005-11-14 Thomas Quinot <quinot@adacore.com>
+
+ * exp_dist.adb (Append_Array_Traversal): Modify constrained case to
+ generate a set of nested array aggregates instead of a single flat
+ aggregate for multi-dimensional arrays.
+
+2005-11-14 Pascal Obry <obry@adacore.com>
+
+ * expect.c (__gnat_kill) [Win32]: Fix implementation, the pid returned
+ by spawnve is a process handle, no need to convert. Add a parameter
+ close to control wether the process handle must be closed.
+ (__gnat_waitpid): Fix implementation, the pid returned by spawnve is
+ a process handle, not need to convert.
+ (__gnat_kill) [*]: Add dummy parameter close to match the Win32 spec.
+
+ * g-expect.adb: (Kill): Document the new close parameter.
+ (Close): Do not release the process handle in the kill there as
+ waitpid() is using it.
+ (Send_Signal): Release the process handle.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * exp_fixd.adb: Use Universal_Real instead of Long_Long_Float when we
+ need a high precision float type for the generated code (prevents
+ gratuitous Vax_Float stuff when pragma Float_Representation (Vax_Float)
+ used).
+
+ * exp_imgv.adb: Use Universal_Real instead of Long_Long_Float when we
+ need a high precision float type for the generated code (prevents
+ gratuitous Vax_Float stuff when pragma Float_Representation (Vax_Float)
+ used).
+ (Expand_Width_Attribute): In configurable run-time, the attribute is not
+ allowed on non-static enumeration subtypes. Force a load error to emit
+ the correct diagnostic.
+
+2005-11-14 Thomas Quinot <quinot@adacore.com>
+ Robert Dewar <dewar@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+
+ * exp_intr.adb (Expand_Unc_Deallocation): If GIGI needs an actual
+ subtype to compute the size of the designated object at run-time,
+ create such a subtype and store it in the Actual_Designated_Subtype
+ attribute of the N_Free_Statement.
+ Generate itype for classwide designated object in both cases of
+ user-specified storage pool: specific and class-wide, not only in the
+ specific case.
+ Raise CE when trying to set a not null access type object to null.
+ (Expand_Dispatching_Constructor_Call): Retrieve subprogram actual with
+ an explicit loop, because freeze nodes make its position variable.
+
+ * sem_intr.adb (Check_Intrinsic_Call): Given warning for freeing not
+ null object.
+
+2005-11-14 Javier Miranda <miranda@adacore.com>
+
+ * exp_strm.adb (Build_Stream_Attr_Profile, Build_Stream_Function,
+ Build_Stream_Procedure): Add the null-excluding attribute to the first
+ formal.
+ This has no semantic meaning under Ada95 mode but it is a
+ requirement under Ada05 mode.
+
+ * par-ch3.adb (P_Access_Definition): Addition of warning message if
+ the null exclusion is used under Ada95 mode
+ (P_Null_Exclusion): The qualifier has no semantic meaning in Ada 95.
+ (P_Access_Definition): Remove assertion that forbids the use of
+ the null-exclusion feature in Ada95.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * impunit.adb: Exclude container helper units not intended for use by
+ users.
+
+2005-11-14 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Freeze_Entity): For an access formal that is an access
+ to subprogram, freeze the anonymous subprogram type at the same time,
+ to prevent later freezing in the wrong scope, such as the enclosing
+ subprogram body.
+ (Freeze_Entity): Freeze the equivalent_type of an access_to_protected_
+ subprogram whenever available.
+
+2005-11-14 Arnaud Charlet <charlet@adacore.com>
+
+ PR ada/23732
+ * gnatvsn.ads (Library_Version): Bump to 4.1
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * g-debpoo.adb (Set_Valid): Use Integer_Address instead of
+ Storage_Offset to avoid wrap around causing invalid results.
+
+2005-11-14 Pascal Obry <obry@adacore.com>
+
+ * gnatbind.adb (Is_Cross_Compiler): New function returning True for
+ cross-compiler.
+ (Scan_Bind_Arg): Fail with an error message if -M option is used
+ on a native compiler.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+ Vincent Celier <celier@adacore.com>
+
+ * gprep.adb: Implement -C switch to scan comments
+
+ * scng.adb: Scan comment symbol separately if Replace_In_Comments set
+
+ * scans.ads: Comment updates (including new use of Tok_Comment in
+ preprocessing)
+
+ * opt.ads: Add documentation for flags that are used by gprmake,
+ currently and in the next version of gprmake.
+ (Verbosity_Level): New variable
+ Add Replace_In_Comments switch
+
+ * vms_data.ads: Add VMS equivalent for new gnatmake switches -vl, -vm
+ and -vm.
+ Add /REPLACE_IN_COMMENTS for gnatprep -C switch
+
+2005-11-14 Arnaud Charlet <charlet@adacore.com>
+
+ * g-regpat.adb (Fail): raise Expression_Error including the diagnostic
+ message, friendlier.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * g-spitbo.adb: (Hash): Rotate by 3 instead of 1
+
+2005-11-14 Doug Rupp <rupp@adacore.com>
+
+ * init.c [VMS]: Don't install __gnat_error_handler if DBG$TDBG defined.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * interfac.ads: Change declarations of IEEE float types so that we no
+ longer need a separate version of this package for VMS.
+
+2005-11-14 Ed Schonberg <schonberg@adacore.com>
+
+ * lib-xref.adb (Generate_Definition, Generate_Reference): Treat the
+ internal entity created for the declaration of a child subprogram body
+ with no spec as coming from source, to generate proper cross-reference
+ information.
+
+2005-11-14 Vincent Celier <celier@adacore.com>
+
+ * make.adb (Compile_Sources): Change verbose message to minimum
+ verbosity level High for "is in an Ada library", "is a read-only
+ library" and "is an internal library",
+ (Create_Binder_Mapping_File): Path name of ALI file for library project
+ must include the library directory, not the object directory.
+ (Scan_Make_Arg): Make sure that Switch.M.Scan_Make_Switches is called
+ for new switches -vl, -vm and -vh.
+ (Verbose_Msg): Add new defaulted parameter Minimum_Verbosity
+ (Check): Use minimum verbosity Medium for some Verbose_Msg calls
+ (Compile_Sources): Do not attempt to compile if an ALI file is missing
+ in a project that is externally built.
+ (Compute_All_Imported_Projects): New procedure
+ (Gnatmake): Check if importing libraries should be regenerated because
+ at least an imported library is more recent.
+ (Initialize): For each project compute the list of the projects it
+ imports directly or indirectly.
+ (Add_Library_Search_Dir): New procedure, used in place of
+ Add_Lib_Search_Dir in procedure Scan_Make_Arg so that absolute paths are
+ put in the search paths.
+ (Add_Source_Search_Dir): New procedure, used in place of
+ Add_Src_Search_Dir in procedure Scan_Make_Arg so that absolute paths are
+ put in the search paths.
+ (Mark_Directory): Resolve the absolute path the directory before marking
+ it.
+
+ * switch-m.adb (Scan_Make_Switches): Replace "raise Bad_Switch;" with
+ call to new procedure Bad_Switch. Call Scan_Pos with new parameter
+ Switch. Do not handle any exception.
+ (Scan_Make_Switches): Increment Ptr for new switches -vl, -vm and -vh
+ so that the switch is recognized as valid.
+ (Scan_Make_Switches): Implement new switches -vl, -vm and -vh.
+
+2005-11-14 GNAT Script <nobody@adacore.com>
+
+ * Make-lang.in: Makefile automatically updated
+
+2005-11-14 Pascal Obry <obry@adacore.com>
+
+ * mdll.adb (Build_Reloc_DLL): Fix parameter handling when a map file is
+ used.
+ (Ada_Build_Reloc_DLL): Fix parameter handling when a map file is used.
+ In both cases the last argument was dropped.
+
+2005-11-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * namet.h: (Column_Numbe): New type.
+ (Get_Column_Number): Define to sinput__get_column_number.
+ (Instantiation): Define to sinput__instantiation.
+ (Get_Column_Number): Declare.
+ (Instantiation): Likewise.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * par-ch10.adb (P_Compilation_Unit): Add defenses against junk unit
+ syntax, which could cause compiler hangs.
+
+2005-11-14 Vincent Celier <celier@adacore.com>
+
+ * prj-ext.adb: Take into account new environment variable
+ GPR_PROJECT_PATH. Warn if both GPR_PROJECT_PATH and ADA_PROJECT_PATH
+ are defined.
+ (Prj.Ext elaboration): For each directory in the ADA_PROJECT_PATH,
+ normalize its path name, making it absolute and resolving symbolic
+ links, and replace the original if resolved path is different.
+
+2005-11-14 Vincent Celier <celier@adacore.com>
+
+ * prj-part.adb (Create_Virtual_Extending_Project): Put virtual project
+ into Prj.Tree.Tree_Private_Part.Projects_Htable for GPS.
+
+2005-11-14 Emmanuel Briot <briot@adacore.com>
+
+ * prj-pp.adb (Print): Do not output the with statement if the
+ associated name is empty, which happens for virtual extending projects.
+ (Print): Preserve the "extends all" attribute when printing the project.
+
+ * prj-tree.ads (String_Value_Of): Add comment about returned value for
+ a virtual extending project.
+
+2005-11-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Resolve_Aggregate): An others choice is legal on the
+ rhs of an assignment even if the type is unconstrained, when the
+ context is non-expanding.
+ In an inlined body, if the context type is private,
+ resolve with its full view, which must be a composite type.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch10.adb: Change name Is_Package to Is_Package_Or_Generic_Package
+ Do not give obsolescent warning on with of subprogram (since we
+ diagnose calls)
+ (Analyze_With_Clause): Add test for obsolescent package
+ (Install_Context_Clauses): If the unit is the body of a child unit, do
+ not install twice the private declarations of the parents, to prevent
+ circular lists of Use_Clauses in a parent.
+ (Implicit_With_On_Parent): Do add duplicate with_clause on parent when
+ compiling body of child unit.
+ Use new class N_Subprogram_Instantiation
+ (Expand_With_Clause): If this is a private with_clause for a child unit,
+ appearing in the context of a package declaration, then the implicit
+ with_clauses generated for parent units are private as well.
+ (License_Check): Do not generate message if with'ed unit is internal
+
+2005-11-14 Gary Dismukes <dismukes@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+ Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch12.ads, sem_ch12.adb (Map_Entities): Exclude entities whose
+ names are internal, because they will not have a corresponding partner
+ in the actual package.
+ (Analyze_Formal_Package): Move the setting of the formal package spec's
+ Generic_Parent field so that it occurs prior to analyzing the package,
+ to allow proper operation of Install_Parent_Private_Declarations.
+ (Analyze_Package_Instantiation): Set the instantiated package entity's
+ Package_Instantiation field.
+ (Get_Package_Instantiation_Node): Move declaration to package spec.
+ Retrieve the N_Package_Instantiation node when the Package_Instantiation
+ field is present.
+ (Check_Generic_Child_Unit): Within an inlined call, the only possible
+ instantiation is Unchecked_Conversion, for which no parents are needed.
+ (Inline_Instance_Body): Deinstall and record the use_clauses for all
+ parent scopes of a scope being removed prior to inlining an instance
+ body.
+ (Analyze_Package_Instantiation): Do not perform front-end inlining when
+ the current context is itself an instance within a non-instance child
+ unit, to prevent scope stack errors.
+ (Save_References): If the node is an aggregate that is an actual in a
+ call, rewrite as a qualified expression to preserve some type
+ information, to resolve possible ambiguities in the instance.
+ (Instance_Parent_Unit): New global variable to record the ultimate
+ parent unit associated with a generic child unit instance (associated
+ with the existing Parent_Unit_Visible flag).
+ (type Instance_Env): New component Instance_Parent_Unit for stacking
+ parents recorded in the global Instance_Parent_Unit.
+ (Init_Env): Save value of Instance_Parent_Unit in the Instance_Env
+ stack.
+ (Install_Spec): Save the parent unit entity in Instance_Parent_Unit when
+ it's not a top-level unit, and only do this if Instance_Parent_Unit is
+ not already set. Replace test of Is_Child_Unit with test of parent's
+ scope against package Standard. Add comments and a ??? comment.
+ (Remove_Parent): Revise condition for resetting Is_Immediately_Visible
+ on a child instance parent to test that the parent equals
+ Instance_Parent rather than simply checking that the unit is not a
+ child unit.
+ (Restore_Env): Restore value of Instance_Parent_Unit from Instance_Env.
+ (Validate_Derived_Interface_Type_Instance): Verify that all ancestors of
+ a formal interface are ancestors of the corresponding actual.
+ (Validate_Formal_Interface_Type): Additional legality checks.
+ (Analyze_Formal_Derived_Interface_Type): New procedure to handle formal
+ interface types with ancestors.
+ (Analyze_Formal_Package): If formal is a renaming, use renamed entity
+ to diagnose attempts to use generic within its own declaration.
+
+2005-11-14 Ed Schonberg <schonberg@adacore.com>
+ Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.ads, sem_ch3.adb (Build_Discriminal): Add link to original
+ discriminant.
+ (Build_Private_Derived_Type): The entity of the created full view of the
+ derived type does not come from source. If after installing the private
+ declarations of the parent scope the parent is still private, use its
+ full view to construct the full declaration of the derived type.
+ (Build_Derived_Record_Type): Relax the condition that controls the
+ execution of the check that verifies that the partial view and
+ the full view agree in the set of implemented interfaces. In
+ addition, this test now only takes into account the progenitors.
+ (Derive_Interface_Subprograms): No need to derive subprograms
+ of ancestors that are interfaces.
+ (Derive_Subprograms): Remove formal No_Predefined_Prims and the
+ associated code.
+ Change name Is_Package to Is_Package_Or_Generic_Package
+ (Complete_Subprograms_Derivation): Handle the case in which the full
+ view is a transitive derivation of the ancestor of the partial view.
+ (Process_Full_View): Rename local subprogram Find_Interface_In_
+ Descendant to Find_Ancestor_Interface to leave the code more clear.
+ Remove wrong code that avoids the generation of an error message
+ when the immediate ancestor of the partial view is an interface.
+ In addition some minor reorganization of the code has been done to
+ leave it more clear.
+ (Analyze_Type_Declaration): If type has previous incomplete tagged
+ partial view, inherit properly its primitive operations.
+ (Collect_Interfaces): Make public, for analysis of formal
+ interfaces.
+ (Analyze_Interface_Declaration): New procedure for use for regular and
+ formal interface declarations.
+ (Build_Derived_Record_Type): Add support for private types to the code
+ that checks if a tagged type implements abstract interfaces.
+ (Check_Aliased_Component_Type): The test applies in the spec of an
+ instance as well.
+ (Access_Type_Declaration): Clean up declaration of malformed type
+ declared as an access to its own classwide type, to prevent cascaded
+ crash.
+ (Collect_Interfaces): For private extensions and for derived task types
+ and derived protected types, the parent may be an interface that must
+ be included in the interface list.
+ (Access_Definition): If the designated type is an interface that may
+ contain tasks, create Master_Id for it before analyzing the expression
+ of the declaration, which may be an allocator.
+ (Record_Type_Declaration): Set properly the interface kind, for use
+ in allocators, the creation of master id's for task interfaces, etc.
+
+2005-11-14 Javier Miranda <miranda@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Check_Conformance): The null-exclusion feature can be
+ omitted in case of stream attribute subprograms.
+ (Check_Inline_Pragma): Handle Inline and Inline_Always pragmas that
+ appear immediately after a subprogram body, when there is no previous
+ subprogram declaration.
+ Change name Is_Package to Is_Package_Or_Generic_Package
+ (Process_Formals): A non null qualifier on a non null named access
+ type is not an error, and is a warning only if Redundant_Constructs
+ are flagged.
+
+2005-11-14 Gary Dismukes <dismukes@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch7.adb (Install_Parent_Private_Declarations): New procedure
+ nested within Analyze_Package_Specification to install the private
+ declarations and use clauses within each of the parent units of a
+ package instance of a generic child package.
+ (Analyze_Package_Specification): When entering a private part of a
+ package associated with a generic instance or formal package, the
+ private declarations of the parent must be installed (by calling new
+ procedure Install_Parent_Private_Declarations).
+ Change name Is_Package to Is_Package_Or_Generic_Package
+ (Preserve_Full_Attributes): For a synchronized type, the corresponding
+ record is absent in a generic context, which does not indicate a
+ compiler error.
+
+2005-11-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Analyze_Subprogram_Renaming): In a generic context, do
+ not try to rewrite a renamed stream attribute, because the operations
+ on the type may not have been generated.
+ Handle properly a renaming_as_body generated for a stream operation
+ whose default is abstract because the object type itself is abstract.
+ (Find_Type): If the type is incomplete and appears as the prefix of a
+ 'Class reference, it is tagged, and its list of primitive operations
+ must be initialized properly.
+ (Chain_Use_Clauses): When chaining the use clauses that appear in the
+ private declaration of a parent unit, prior to compiling the private
+ part of a child unit, find on the scope stack the proper parent entity
+ on which to link the use clause.
+ (Note_Redundant_Use): Emit a warning when a redundant use clause is
+ detected.
+ (Analyze_Object_Renaming): An attribute reference is not a legal object
+ if it is not a function call.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+
+ * sem_eval.adb: Implement d.f flag
+ (Subtype_Statically_Match): A generic actual type has unknown
+ discriminants when the corresponding actual has a similar partial view.
+ If the routine is called to validate the signature of an inherited
+ operation in a child instance, the generic actual matches the full view,
+
+2005-11-14 Hristian Kirtchev <kirtchev@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+ Robert Dewar <dewar@adacore.com>
+ Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb (Resolve_Call): Provide a better error message whenever
+ a procedure call is used as a select statement trigger and is not an
+ entry renaming or a primitive of a limited interface.
+ (Valid_Conversion): If the operand has a single interpretation do not
+ remove address operations.
+ (Check_Infinite_Recursion): Skip freeze nodes when looking for a raise
+ statement to inhibit warning.
+ (Resolve_Unary_Op): Do not produce a warning when
+ processing an expression of the form -(A mod B)
+ Use Universal_Real instead of Long_Long_Float when we need a high
+ precision float type for the generated code (prevents gratuitous
+ Vax_Float stuff when pragma Float_Representation (Vax_Float) used)
+ (Resolve_Concatenation_Arg): Improve error message when argument is an
+ ambiguous call to a function that returns an array.
+ (Make_Call_Into_Operator, Operand_Type_In_Scope): Do not check that
+ there is an implicit operator in the given scope if we are within an
+ instance: legality check has been performed on the generic.
+ (Resolve_Unary_Op): Apply warnings checks on argument of Abs operator
+ after resolving operand, to avoid false warnings on overloaded calls.
+
+2005-11-14 Ed Schonberg <schonberg@adacore.com>
+ Javier Miranda <miranda@adacore.com>
+
+ PR ada/15604
+
+ * sem_type.adb (Covers): In an inlined body, a composite type matches
+ a private type whose full view is a composite type.
+ (Interface_Present_In_Ancestor): Protect the frontend against
+ previously detected errors to ensure that its compilation
+ with assertions enabled gives the same output that its
+ compilation without assertions.
+ (Interface_Present_In_Ancestor): Add support for private types.
+ Change name In_Actual to In_Generic_Actual (clean up)
+ (Disambiguate): New predicate In_Actual, to recognize expressions that
+ appear in the renaming declaration generated for generic actuals, and
+ which must be resolved in the outer context.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+ Thomas Quinot <quinot@adacore.com>
+ Hristian Kirtchev <kirtchev@adacore.com>
+ Ed Schonberg <schonberg@adacore.com>
+
+ * sem_util.ads, sem_util.adb: Change name Is_Package to
+ Is_Package_Or_Generic_Package.
+ (Check_Obsolescent): New procedure.
+ (Set_Is_Public): Remove obsolete junk test.
+ (Set_Public_Status): Do not set Is_Public on an object whose declaration
+ occurs within a handled_sequence_of_statemets.
+ (Is_Controlling_Limited_Procedure): Factor some of the logic, account
+ for a parameterless procedure.
+ (Enter_Name): Recognize renaming declarations created for private
+ component of a protected type within protected operations, so that
+ the source name of the component can be used in the debugger.
+
+2005-11-14 Ed Schonberg <schonberg@adacore.com>
+ Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.ads, sem_warn.adb (Publicly_Referenceable): Generic formals
+ of a generic subprogram are not visible outside the body.
+ (Set_Warning_Switch): New procedure (code to set warning mode moved
+ here from Switch.C so that it can be shared by pragma processing.
+ (Check_References): Special case warning for non-modified non-imported
+ volatile objects.
+ * par-prag.adb: Modify processing of pragma Warnings to accomodate new
+ form with a string literal argument
+
+2005-11-14 Javier Miranda <miranda@adacore.com>
+
+ * s-finroo.ads, s-finroo.adb (Read): Addition of "not null" to the
+ anonymous access.
+ (Write): Addition of "not null" to the anonymous access.
+ (Read): Addition of "not null" to the anonymous access.
+ (Write): Addition of "not null" to the anonymous access.
+
+ * s-strxdr.adb, s-stratt.ads, s-stratt.adb (I_AD, I_AS, I_B, I_C, I_F,
+ I_I, I_LF, I_LI, I_LLF, I_LLI, I_LLU, I_LU, I_SF, I_SI, I_SSI, I_SSU,
+ I_SU, I_U, I_WC): Addition of "not null" to the anonymous access.
+ (W_AD, W_AS, W_B, W_C, W_F, W_I, W_LF, W_LI, W_LLF, W_LLI, W_LLU,
+ W_LU, W_SF, W_SI, W_SSI, W_SSU, W_SU, W_U, W_WC): Addition of
+ "not null" to the anonymous access.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * s-stoele.adb: Fix code for Address mod Storage_Offset for negative
+ offset values
+
+2005-11-14 Vincent Celier <celier@adacore.com>
+
+ * switch.adb (Bad_Switch): New procedure
+ (Scan_Nat, Scan_Pos): Directly call Osint.Fail with the appropriate
+ message when in error.
+
+ * switch.ads (Bad_Switch, Bad_Switch_Value, Missing_Switch_Value,
+ Too_Many_Output_Files): Remove declarations, no longer used.
+ (Scan_Nat): New parameter Switch
+ (Scan_Pos): Ditto
+ (Bad_Switch): New procedure
+
+ * switch-b.adb (Scan_Binder_Switches): Replace "raise Bad_Switch;"
+ with call to new procedure Bad_Switch. Call Scan_Pos and Scan_Natwith
+ new parameter Switch. Replace "raise Too_Many_Output_Files;" with call
+ to Osint.Fail. Do not handle any exception.
+
+2005-11-14 Vincent Celier <celier@adacore.com>
+
+ * tempdir.adb (Tempdir): Do not use environment variable TMPDIR if it
+ designates a non existent directory.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * xgnatugn.adb: Replace invalid membership test by 'Valid
+
+2005-11-14 Vincent Celier <celier@adacore.com>
+
+ * makegpr.adb (Gprmake): Do not attempt to build the global archive if
+ there is no object directory.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * usage.adb: Minor adjustment to output format, use nn instead of nnn
+ (so that -gnateInnn does not run into next column)
+
+2005-11-14 Ed Falis <falis@adacore.com>
+
+ * s-bitops.adb (Bits_Array): corrected comment: "unconstrained" =>
+ "constrained"
+
+2005-11-14 Cyrille Comar <comar@adacore.com>
+
+ * s-chepoo.ads: Add comments on Dereference.
+ Remove unnecessary inherited abstract primitives.
+ Cosmetic cleanup.
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * sem_cat.ads (Validate_Access_Type_Declaration): Remove declaration
+ node parameter, not needed, since it is available as Declaration_Node.
+
+2005-11-14 Geert Bosch <bosch@adacore.com>
+
+ * s-exnllf.adb (Exn_LLF): Fix comment to be more precise and
+ grammatically correct.
+
+2005-11-14 Vincent Celier <celier@adacore.com>
+
+ * s-fileio.ads: Correct spelling error in comment
+
+2005-11-14 Cyrille Comar <comar@adacore.com>
+ Robert Dewar <dewar@adacore.com>
+ Vincent Celier <celier@adacore.com>
+ Ben Brosgol <brosgol@adacore.com>
+ Jose Ruiz <ruiz@adacore.com>
+ Pascal Obry <obry@adacore.com>
+
+ * gnat_ugn.texi:
+ Document that -fstack-check is needed for strict compliance with the
+ Ada 95 Reference Manual.
+ Correct reference to VAX systems to meet HP guidelines
+ Add documentation for new gnatmake switches -vl, -vm and -vh
+ Replace DEC Ada by HP Ada
+ Replace DIGITAL by HP
+ Remove empty section on tools in compatibility section
+ Clarify the Windows convention semantics.
+ Document the Win32 calling convention.
+ The Stdcall, Win32 and DLL convention are synonyms.
+ Add a note in -gnatR description about zero size record components
+ Note on new >= and <= warnings for -gnatwc
+ Document that equal sign after -gnatm is optional.
+ Note that strip is working fine on DLL built with a Library
+ Project. The restriction apply only to DLL built with gnatdll.
+ Update section about the way to debug a DLL.
+ Update information about the DLL convention.
+ Document -C switch for gnatprep
+ Document new attribute Library_ALI_Dir
+ Update elaboration doc to include implicit Elaborate pragmas now
+ generated for subprogram instantiations.
+ Document limitation on executable names that include spaces for --GCC,
+ --GNATBIND, and --GNATLINK switches.
+ Document that -w causes -gnatws to be added at start of gcc switches
+
+ * gnat_rm.texi: Document that -mieee is needed for generating infinite
+ and NaN values in case of overflow on machines that are not fully
+ compliant with the IEEE floating-point standard.
+ Create a section describing the set of compiler options needed for
+ strict compliance with the Ada 95 Reference Manual.
+ Add documentation for pragma Obsolescent applied to a package
+ Clarify potential issues of mixed language programs related to the
+ I/O buffering enabling in the elaboration of the GNAT runtime.
+ Add extra documentation for pragma Restrictions (No_Elaboration_Code)
+ This documentation only patch adds extra documentsion for pragma
+ Restrictions (No_Elaboration_Code), explaining why it is not possible
+ to document this restriction in terms of allowed source constructs.
+ Document string literal form of pragma Warnings
+ Document new attribute Library_ALI_Dir
+ Add documentation on stable attributes in project files that was missing
+
+ * gnat-style.texi: Indicate that paragraphs within a single comment
+ should be separated by empty comment lines
+
+ * ug_words: Added replacements for -gnat95 and -gnat05 (/95 and
+ /05 respectively)
+
+ * bindusg.adb: Minor cleanup, put -m before -M for consistency
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ * a-secain.adb, a-slcain.adb, a-shcain.adb, a-chtgke.ads, a-chtgke.adb,
+ a-stwiha.adb, a-strhas.adb, a-chzla1.ads, a-chzla9.ads, a-stzbou.adb,
+ a-stzbou.ads, a-stzfix.adb, a-stzhas.adb, a-stzmap.adb, a-stzmap.ads,
+ a-stzsea.adb, a-stzsea.ads, a-stzsup.adb, a-stzsup.ads, a-stzunb.adb,
+ a-stzunb.ads, a-szuzha.adb, a-szuzha.ads, a-szuzti.adb, a-szuzti.ads,
+ a-ztcoau.adb, a-ztcoau.ads, a-ztcoio.adb, a-ztcstr.adb, a-ztcstr.ads,
+ a-ztdeau.adb, a-ztdeau.ads, a-ztdeio.adb, a-ztdeio.ads, a-ztedit.adb,
+ a-ztedit.ads, a-ztenau.ads, a-ztenio.adb, a-ztenio.ads, a-ztexio.adb,
+ a-ztexio.ads, a-ztfiio.adb, a-ztfiio.ads, a-ztflau.adb, a-ztflau.ads,
+ a-ztflio.adb, a-ztflio.ads, a-ztgeau.adb, a-ztgeau.ads, a-ztinau.adb,
+ a-ztinau.ads, a-ztinio.adb, a-ztmoau.ads, a-ztmoio.adb, a-ztmoio.ads,
+ a-zttest.adb, g-enblsp-vms-alpha.adb, g-enblsp-vms-alpha.adb,
+ g-enblsp-vms-ia64.adb, g-enblsp-vms-ia64.adb, system-linux-hppa.ads,
+ a-chacon.adb, a-chacon.ads, a-wichun.adb, a-wichun.ads, a-zchuni.adb,
+ a-zchuni.ads, g-trasym-vms-alpha.adb, g-trasym-vms-ia64.adb,
+ system-hpux-ia64.ads, g-soccon-unixware.ads, g-soliop-unixware.ads,
+ g-soccon-interix.ads, g-soliop-solaris.ads, g-eacodu-vms.adb,
+ g-expect-vms.adb, g-socthi-vms.adb, g-soliop-mingw.ads,
+ a-intnam-unixware.ads, a-intnam-lynxos.ads, a-intnam-tru64.ads,
+ a-intnam-aix.ads, a-intnam-linux.ads, a-intnam-linux.ads,
+ a-intnam-dummy.ads, a-numaux-libc-x86.ads, a-intnam-interix.ads,
+ a-intnam-solaris.ads, a-calend-vms.adb, a-calend-vms.ads,
+ a-intnam-vms.ads, a-calend-mingw.adb, a-intnam-mingw.ads,
+ a-intnam-vxworks.ads, a-numaux-vxworks.ads, system-unixware.ads,
+ system-linux-ia64.ads, a-intnam-freebsd.ads, system-freebsd-x86.ads,
+ system-lynxos-ppc.ads, system-linux-x86_64.ads, a-stunha.adb,
+ a-cgaaso.ads, a-cgaaso.adb, a-chtgop.adb, a-cgcaso.adb, a-cgarso.adb,
+ a-cohata.ads, a-crbtgk.adb, a-crbltr.ads, a-coprnu.adb, a-rbtgso.adb,
+ a-intnam-darwin.ads, system-darwin-ppc.ads, gprmake.adb, makegpr.ads,
+ system-tru64.ads, system-aix.ads, system-solaris-x86.ads,
+ system-irix-o32.ads, s-interr-sigaction.adb, system-irix-n32.ads,
+ s-parame-mingw.adb, system-hpux.ads, s-traceb-hpux.adb,
+ system-linux-x86.ads, s-inmaop-dummy.adb, system-os2.ads,
+ system-interix.ads, system-solaris-sparc.ads,
+ system-solaris-sparcv9.ads, s-inmaop-vms.adb,
+ s-mastop-vms.adb, expander.adb, expander.ads, s-gloloc-mingw.adb,
+ system-mingw.ads, system-vms-zcx.ads, s-osinte-fsu.adb,
+ s-traceb-mastop.adb, a-exextr.adb, a-exstat.adb, a-filico.ads,
+ a-finali.ads, a-interr.ads, a-intsig.adb, a-intsig.ads,
+ a-except.ads, a-numaux-x86.ads, a-astaco.adb, a-calend.adb,
+ a-calend.ads, a-chahan.adb, a-chahan.ads, a-chlat9.ads,
+ a-colien.adb, a-colien.ads, a-colire.adb, a-colire.ads,
+ a-comlin.adb, a-comlin.ads, a-cwila1.ads, a-cwila9.ads,
+ a-elchha.adb, a-decima.adb, a-decima.ads, a-diocst.ads,
+ a-direio.adb, a-direio.ads, a-excach.adb, a-excach.adb,
+ a-exctra.ads, ali-util.adb, a-ngcefu.adb, a-ngcoty.adb,
+ a-ngcoty.ads, a-nudira.adb, a-nudira.ads, a-nuflra.adb,
+ a-numaux.ads, a-reatim.ads, a-sequio.adb, a-sequio.ads,
+ a-siocst.ads, a-ssicst.ads, a-stmaco.ads, a-storio.adb,
+ a-strbou.adb, a-strbou.ads, a-stream.ads, a-strfix.adb,
+ a-strmap.adb, a-strmap.ads, a-strsea.adb, a-strsea.ads,
+ a-strsup.adb, a-strsup.ads, a-strunb.adb, a-strunb.ads,
+ a-stwibo.adb, a-stwibo.ads, a-stwifi.adb, a-stwima.adb,
+ a-stwima.ads, a-stwise.adb, a-stwise.ads, a-stwisu.adb,
+ a-stwisu.ads, a-stwiun.adb, a-stwiun.ads, a-suteio.adb,
+ a-suteio.ads, a-swmwco.ads, a-swuwti.adb, a-swuwti.ads,
+ a-sytaco.adb, a-sytaco.ads, a-tasatt.adb, a-taside.adb,
+ a-taside.ads, a-teioed.adb, a-textio.adb, a-textio.ads,
+ a-ticoau.adb, a-ticoau.ads, a-ticoio.adb, a-tideau.adb,
+ a-tideio.adb, a-tienau.adb, a-tienio.adb, a-tifiio.adb,
+ a-tiflio.adb, a-tigeau.adb, a-tigeau.ads, a-tiinau.adb,
+ a-tiinio.adb, a-timoau.adb, a-timoio.adb, a-timoio.ads,
+ a-tiocst.ads, a-titest.adb, atree.adb, a-witeio.adb,
+ a-witeio.ads, a-wtcoau.adb, a-wtcoau.ads, a-wtcoio.adb,
+ a-wtcstr.ads, a-wtdeau.adb, a-wtdeio.adb, a-wtedit.adb,
+ a-wtedit.ads, a-wtenau.adb, a-wtenio.adb, a-wtfiio.adb,
+ a-wtflio.adb, a-wtgeau.adb, a-wtinau.adb, a-wtinio.adb,
+ a-wtmoau.adb, a-wtmoio.adb, a-wttest.adb, back_end.adb,
+ bindgen.adb, butil.adb, butil.ads, checks.ads, cio.c, comperr.adb,
+ csets.ads, cstand.adb, debug.ads, elists.ads, errno.c, errout.adb,
+ errout.ads, erroutc.adb, erroutc.ads, errutil.adb, errutil.ads,
+ errutil.ads, err_vars.ads, eval_fat.adb, exp_ch11.adb, exp_ch11.ads,
+ exp_ch2.adb, exp_ch7.ads, exp_imgv.ads, exp_pakd.adb, exp_prag.adb,
+ exp_prag.ads, exp_tss.adb, exp_tss.ads, exp_vfpt.ads, fe.h, fmap.adb,
+ freeze.ads, frontend.adb, frontend.ads, g-arrspl.adb, g-arrspl.ads,
+ g-awk.adb, g-awk.ads, g-boumai.ads, g-calend.adb, g-calend.ads,
+ g-catiio.adb, g-comlin.adb, g-comlin.ads, g-comlin.ads, g-comlin.ads,
+ g-comver.adb, g-crc32.adb, g-crc32.ads, g-ctrl_c.ads, g-curexc.ads,
+ g-debpoo.ads, g-debuti.adb, g-diopit.adb, g-diopit.ads, g-dirope.adb,
+ g-dirope.ads, g-dyntab.adb, g-dyntab.ads, g-excact.adb, g-excact.ads,
+ g-except.ads, g-exctra.adb, g-exctra.ads, g-expect.ads, g-flocon.ads,
+ g-hesorg.ads, g-io.adb, g-locfil.ads, g-md5.adb, g-md5.ads, g-md5.ads,
+ g-moreex.adb, g-signal.ads, g-signal.adb, gnatbind.ads, gnatchop.adb,
+ gnatcmd.adb, gnatfind.adb, gnatlbr.adb, gnatmake.ads, gnatmem.adb,
+ gnatprep.adb, gnatprep.ads, gnatsym.adb, gnatxref.adb, g-os_lib.adb,
+ g-os_lib.ads, g-pehage.adb, g-pehage.ads, gprep.ads, g-regexp.adb,
+ g-regexp.ads, g-regist.adb, g-regist.ads, g-regpat.ads, g-semaph.adb,
+ g-socthi.adb, g-soliop.ads, g-spipat.adb, g-spipat.ads, g-sptabo.ads,
+ g-sptain.ads, g-sptavs.ads, g-string.ads, g-tasloc.adb, g-tasloc.ads,
+ g-trasym.adb, g-trasym.ads, i-fortra.adb, i-fortra.ads, inline.adb,
+ layout.adb, live.adb, make.ads, makeutl.ads, makeutl.adb, mdll-fil.adb,
+ mdll-fil.ads, mdll-utl.ads, memroot.ads, memtrack.adb, mlib.ads,
+ mlib-fil.adb, mlib-fil.ads, mlib-prj.ads, mlib-utl.adb, mlib-utl.ads,
+ nlists.adb, nlists.ads, osint.adb, osint.ads, osint-c.adb, osint-l.adb,
+ osint-l.ads, osint-m.ads, output.adb, par.adb, par.adb, par.ads,
+ par-ch11.adb, par-ch12.adb, par-ch2.adb, par-ch4.adb, par-ch5.adb,
+ par-ch6.adb, par-ch9.adb, par-endh.adb, par-labl.adb, par-load.adb,
+ par-tchk.adb, prep.adb, prepcomp.adb, prepcomp.ads, prj-attr.ads,
+ prj-com.ads, prj-dect.adb, prj-dect.ads, prj-env.ads, prj-err.ads,
+ prj-ext.ads, prj-makr.adb, prj-makr.ads, prj-nmsc.ads, prj-pars.adb,
+ prj-pars.ads, prj-part.ads, prj-pp.ads, prj-proc.ads, prj-strt.adb,
+ prj-strt.ads, prj-tree.adb, prj-util.adb, prj-util.ads, rtsfind.adb,
+ sem.adb, sem.ads, sem_case.adb, sem_case.ads, sem_ch11.adb,
+ sem_ch4.adb, sem_ch6.ads, sem_ch7.ads, sem_dist.ads, sem_elab.ads,
+ sem_elim.ads, sem_eval.ads, sem_intr.ads, sem_maps.adb, sem_maps.ads,
+ sem_maps.ads, sem_res.ads, sem_type.ads, sfn_scan.adb, sfn_scan.ads,
+ s-imgwch.ads, s-imgwiu.adb, s-imgwiu.ads, s-inmaop.ads, sinput.adb,
+ sinput.ads, s-pack03.adb, s-pack03.ads, s-pack05.adb, s-pack05.ads,
+ s-pack06.adb, s-pack06.ads, s-pack07.adb, s-pack07.ads, s-pack09.adb,
+ s-pack09.ads, s-pack10.adb, s-pack10.ads, s-pack11.adb, s-pack11.ads,
+ s-pack12.adb, s-pack12.ads, s-pack13.adb, s-pack13.ads, s-pack14.adb,
+ s-pack14.ads, s-pack15.adb, s-pack15.ads, s-pack17.adb, s-pack17.ads,
+ s-pack18.adb, s-pack18.ads, s-pack19.adb, s-pack19.ads, s-pack20.adb,
+ s-pack20.ads, s-pack21.adb, s-pack21.ads, s-pack22.adb, s-pack22.ads,
+ s-pack23.adb, s-pack23.ads, s-pack24.adb, s-pack24.ads, s-pack25.adb,
+ s-pack25.ads, s-pack26.adb, s-pack26.ads, s-pack27.adb, s-pack27.ads,
+ s-pack28.adb, s-pack28.ads, s-pack29.adb, s-pack29.ads, s-pack30.adb,
+ s-pack30.ads, s-pack31.adb, s-pack31.ads, s-pack33.adb, s-pack33.ads,
+ s-pack34.adb, s-pack34.ads, s-pack35.adb, s-pack35.ads, s-pack36.adb,
+ s-pack36.ads, s-pack37.adb, s-pack37.ads, s-pack38.adb, s-pack38.ads,
+ s-pack39.adb, s-pack39.ads, s-pack40.adb, s-pack40.ads, s-pack41.adb,
+ s-pack41.ads, s-pack42.adb, s-pack42.ads, s-pack43.adb, s-pack43.ads,
+ s-pack44.adb, s-pack44.ads, s-pack45.adb, s-pack45.ads, s-pack46.adb,
+ s-pack46.ads, s-pack47.adb, s-pack47.ads, s-pack48.adb, s-pack48.ads,
+ s-pack49.adb, s-pack49.ads, s-pack50.adb, s-pack50.ads, s-pack51.adb,
+ s-pack51.ads, s-pack52.adb, s-pack52.ads, s-pack53.adb, s-pack53.ads,
+ s-pack54.adb, s-pack54.ads, s-pack55.adb, s-pack55.ads, s-pack56.adb,
+ s-pack56.ads, s-pack57.adb, s-pack57.ads, s-pack58.adb, s-pack58.ads,
+ s-pack59.adb, s-pack59.ads, s-pack60.adb, s-pack60.adb, s-pack60.ads,
+ s-pack61.adb, s-pack61.ads, s-pack62.adb, s-pack62.ads, s-pack63.adb,
+ s-pack63.ads, s-parint.adb, s-parint.adb, s-parint.ads, sprint.ads,
+ s-purexc.ads, s-restri.ads, s-restri.adb, s-scaval.adb, s-scaval.ads,
+ s-secsta.adb, s-secsta.ads, s-sequio.adb, s-sequio.ads, stand.ads,
+ s-tasuti.adb, s-traceb.adb, s-traceb.ads, stringt.adb, stringt.ads,
+ styleg.ads, s-valboo.adb, s-valboo.ads, s-valcha.adb, s-valcha.ads,
+ s-valdec.adb, s-valdec.ads, s-valint.adb, s-valint.ads, s-valint.ads,
+ s-vallld.adb, s-vallld.ads, s-vallli.adb, s-vallli.ads, s-valllu.adb,
+ s-valllu.ads, s-valrea.adb, s-valrea.ads, s-valuns.adb, s-valuns.ads,
+ s-valuti.adb, s-valuti.ads, s-valwch.ads, s-veboop.adb, s-veboop.ads,
+ s-vercon.adb, s-vercon.ads, s-wchcnv.adb, s-wchcnv.ads, s-wchcon.ads,
+ s-wchjis.adb, s-wchjis.ads, s-wchstw.adb, s-wchstw.adb, s-wchstw.ads,
+ s-wchwts.adb, s-wchwts.ads, s-widboo.adb, s-widboo.ads, s-widcha.adb,
+ s-widcha.ads, s-widenu.adb, s-widenu.ads, s-widlli.adb, s-widlli.ads,
+ s-widllu.adb, s-widllu.ads, s-widwch.adb, s-widwch.ads, s-wwdcha.adb,
+ s-wwdcha.ads, s-wwdenu.adb, s-wwdenu.ads, symbols.adb, symbols.ads,
+ table.ads, targparm.adb, targparm.ads, tb-alvms.c, tb-alvxw.c,
+ tbuild.adb, tree_io.ads, treepr.adb, treeprs.adt, ttypef.ads,
+ ttypes.ads, types.adb, uintp.adb, uintp.ads, uname.ads, urealp.ads,
+ usage.ads, validsw.ads, vxaddr2line.adb, widechar.adb, widechar.ads,
+ xeinfo.adb, xnmake.adb, xref_lib.ads, xr_tabls.adb, xr_tabls.ads,
+ xsinfo.adb, xtreeprs.adb, xsnames.adb, vms_conv.ads, vms_conv.adb,
+ a-dirval.ads, a-dirval.adb, a-dirval-mingw.adb, a-direct.ads,
+ a-direct.adb, indepsw.ads, prj-attr-pm.ads, system-linux-ppc.ads,
+ a-numaux-darwin.ads, a-numaux-darwin.adb,
+ a-swuwha.ads, a-stunha.ads: Minor reformatting
+
+2005-11-14 Robert Dewar <dewar@adacore.com>
+
+ PR ada/18434
+ * osint-m.adb: Add pragma Elaborate_All for Osint
+
2005-11-10 Eric Botcazou <ebotcazou@adacore.com>
PR ada/23995
diff --git a/gcc/ada/Make-lang.in b/gcc/ada/Make-lang.in
index 8b476305152..d6f78bdf501 100644
--- a/gcc/ada/Make-lang.in
+++ b/gcc/ada/Make-lang.in
@@ -1049,10 +1049,10 @@ ada/decl.o : ada/decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
flags.h toplev.h convert.h target.h ada/ada.h ada/types.h ada/atree.h \
ada/nlists.h ada/elists.h ada/uintp.h ada/sinfo.h ada/einfo.h ada/snames.h \
ada/namet.h ada/stringt.h ada/repinfo.h ada/fe.h $(ADA_TREE_H) ada/gigi.h \
- gt-ada-decl.h
+ gt-ada-decl.h $(EXPR_H)
ada/misc.o : ada/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(RTL_H) expr.h insn-codes.h insn-flags.h insn-config.h recog.h flags.h \
+ $(RTL_H) $(EXPR_H) insn-codes.h insn-flags.h recog.h flags.h \
diagnostic.h output.h except.h $(TM_P_H) langhooks.h debug.h \
$(LANGHOOKS_DEF_H) libfuncs.h $(OPTABS_H) ada/ada.h ada/types.h \
ada/atree.h ada/nlists.h ada/elists.h ada/sinfo.h ada/einfo.h ada/namet.h \
@@ -1092,23 +1092,21 @@ ada/a-chlat1.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.ads \
ada/system.ads
ada/a-elchha.o : ada/ada.ads ada/a-except.ads ada/a-elchha.ads \
- ada/a-elchha.adb ada/system.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/a-elchha.adb ada/system.ads ada/s-parame.ads ada/s-stalib.ads \
ada/s-traent.ads ada/unchconv.ads
ada/a-except.o : ada/ada.ads ada/a-except.ads ada/a-except.adb \
ada/a-excach.adb ada/a-exexda.adb ada/a-exexpr.adb ada/a-exextr.adb \
ada/a-elchha.ads ada/a-excpol.adb ada/a-exstat.adb ada/a-unccon.ads \
ada/a-uncdea.ads ada/interfac.ads ada/system.ads ada/s-exctab.ads \
- ada/s-mastop.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traceb.ads ada/s-traent.ads ada/s-traent.adb ada/s-unstyp.ads \
- ada/unchconv.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traceb.ads \
+ ada/s-traent.ads ada/s-traent.adb ada/s-unstyp.ads ada/unchconv.ads
ada/a-ioexce.o : ada/ada.ads ada/a-except.ads ada/a-ioexce.ads \
ada/system.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/unchconv.ads
+ ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/unchconv.ads
ada/ada.o : ada/ada.ads ada/system.ads
@@ -1116,17 +1114,18 @@ ada/ali-util.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads ada/ali.ads \
ada/ali-util.ads ada/ali-util.adb ada/alloc.ads ada/binderr.ads \
ada/casing.ads ada/csets.ads ada/debug.ads ada/err_vars.ads \
ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
- ada/namet.ads ada/namet.adb ada/opt.ads ada/osint.ads ada/output.ads \
- ada/rident.ads ada/scans.ads ada/scng.ads ada/scng.adb ada/sinput.ads \
- ada/sinput.adb ada/sinput-c.ads ada/snames.ads ada/stringt.ads \
- ada/stringt.adb ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb \
- ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb ada/s-memory.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
+ ada/g-utf_32.ads ada/g-utf_32.adb ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/lib.ads ada/namet.ads ada/namet.adb ada/opt.ads \
+ ada/osint.ads ada/output.ads ada/rident.ads ada/scans.ads ada/scng.ads \
+ ada/scng.adb ada/sinput.ads ada/sinput.adb ada/sinput-c.ads \
+ ada/snames.ads ada/stringt.ads ada/stringt.adb ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
+ ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-htable.adb ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
ada/widechar.ads
@@ -1136,11 +1135,11 @@ ada/ali.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads ada/ali.ads \
ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads \
ada/namet.adb ada/opt.ads ada/osint.ads ada/output.ads ada/rident.ads \
ada/system.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads \
- ada/s-htable.adb ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
+ ada/s-htable.adb ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
ada/alloc.o : ada/alloc.ads ada/system.ads
@@ -1148,15 +1147,15 @@ ada/atree.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads ada/alloc.ads \
ada/atree.ads ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads \
ada/einfo.adb ada/elists.ads ada/elists.adb ada/gnat.ads \
ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-htable.adb ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/hostparm.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/system.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/back_end.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/back_end.ads ada/back_end.adb ada/casing.ads \
@@ -1168,29 +1167,29 @@ ada/back_end.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/switch.ads ada/switch-c.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/bcheck.o : ada/ada.ads ada/a-except.ads ada/ali.ads ada/ali-util.ads \
ada/ali-util.adb ada/alloc.ads ada/bcheck.ads ada/bcheck.adb \
ada/binderr.ads ada/butil.ads ada/casing.ads ada/csets.ads \
ada/debug.ads ada/err_vars.ads ada/fname.ads ada/gnat.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/namet.ads \
- ada/namet.adb ada/opt.ads ada/osint.ads ada/output.ads ada/rident.ads \
- ada/scans.ads ada/scng.ads ada/scng.adb ada/sinput.ads ada/sinput-c.ads \
- ada/snames.ads ada/stringt.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
+ ada/namet.ads ada/namet.adb ada/opt.ads ada/osint.ads ada/output.ads \
+ ada/rident.ads ada/scans.ads ada/scng.ads ada/scng.adb ada/sinput.ads \
+ ada/sinput-c.ads ada/snames.ads ada/stringt.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/binde.o : ada/ada.ads ada/a-except.ads ada/ali.ads ada/alloc.ads \
ada/binde.ads ada/binde.adb ada/binderr.ads ada/butil.ads \
@@ -1198,27 +1197,28 @@ ada/binde.o : ada/ada.ads ada/a-except.ads ada/ali.ads ada/alloc.ads \
ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/lib.ads ada/namet.ads ada/namet.adb ada/opt.ads \
ada/output.ads ada/rident.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/widechar.ads
+ ada/s-htable.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tree_io.ads ada/types.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
ada/binderr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/binderr.ads \
ada/binderr.adb ada/butil.ads ada/debug.ads ada/gnat.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
ada/namet.ads ada/opt.ads ada/output.ads ada/system.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \
+ ada/unchdeal.ads
ada/bindgen.o : ada/ada.ads ada/a-except.ads ada/ali.ads ada/alloc.ads \
- ada/binde.ads ada/bindgen.ads ada/bindgen.adb ada/butil.ads \
- ada/casing.ads ada/debug.ads ada/fname.ads ada/gnat.ads \
- ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads ada/opt.ads \
- ada/osint.ads ada/osint-b.ads ada/output.ads ada/rident.ads \
- ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-memory.ads \
+ ada/binde.ads ada/bindgen.ads ada/bindgen.adb ada/casing.ads \
+ ada/debug.ads ada/fname.ads ada/gnat.ads ada/g-hesora.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
+ ada/hostparm.ads ada/namet.ads ada/opt.ads ada/osint.ads \
+ ada/osint-b.ads ada/output.ads ada/rident.ads ada/system.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-memory.ads ada/s-parame.ads \
ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads \
ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads ada/s-traent.ads \
@@ -1235,38 +1235,39 @@ ada/butil.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/butil.ads \
ada/butil.adb ada/debug.ads ada/gnat.ads ada/g-os_lib.ads \
ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads \
ada/opt.ads ada/output.ads ada/system.ads ada/s-exctab.ads \
- ada/s-memory.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/casing.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/casing.ads \
ada/casing.adb ada/csets.ads ada/csets.adb ada/debug.ads ada/gnat.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
ada/namet.ads ada/opt.ads ada/output.ads ada/system.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/widechar.ads
+ ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/widechar.ads
ada/checks.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch7.ads \
- ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \
- ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads ada/itypes.ads \
- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
- ada/lib-sort.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \
- ada/sem.ads ada/sem_cat.ads ada/sem_ch7.ads ada/sem_ch8.ads \
- ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads \
- ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
+ ada/eval_fat.ads ada/exp_aggr.ads ada/exp_ch2.ads ada/exp_ch7.ads \
+ ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
+ ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
+ ada/itypes.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
+ ada/lib-load.ads ada/lib-sort.adb ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
+ ada/rtsfind.adb ada/sem.ads ada/sem_cat.ads ada/sem_ch3.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_dist.ads ada/sem_eval.ads \
+ ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
+ ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
+ ada/stringt.adb ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
@@ -1286,12 +1287,12 @@ ada/comperr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/output.adb ada/sdefault.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/sinput.adb ada/snames.ads ada/sprint.ads \
ada/stand.ads ada/stringt.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/treepr.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/treepr.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/csets.o : ada/csets.ads ada/csets.adb ada/gnat.ads ada/g-string.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/opt.ads ada/system.ads \
@@ -1304,10 +1305,10 @@ ada/cstand.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
ada/exp_tss.ads ada/exp_util.ads ada/fname.ads ada/freeze.ads \
ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \
- ada/layout.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/layout.ads ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/rident.ads ada/rtsfind.ads \
ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
ada/sem_ch8.ads ada/sem_eval.ads ada/sem_mech.ads ada/sem_res.ads \
ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads \
@@ -1315,13 +1316,14 @@ ada/cstand.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypef.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/urealp.adb ada/widechar.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tree_io.ads ada/ttypef.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
+ ada/widechar.ads
ada/debug.o : ada/debug.ads ada/debug.adb ada/system.ads
@@ -1329,14 +1331,14 @@ ada/debug_a.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/debug_a.ads \
ada/debug_a.adb ada/einfo.ads ada/elists.ads ada/gnat.ads \
ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/nlists.ads ada/nlists.adb ada/opt.ads \
- ada/output.ads ada/sinfo.ads ada/sinput.ads ada/snames.ads \
+ ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \
+ ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinput.ads ada/snames.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/einfo.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -1345,28 +1347,29 @@ ada/einfo.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/snames.adb \
ada/stand.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/elists.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/elists.ads ada/elists.adb ada/gnat.ads ada/g-os_lib.ads \
ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/opt.ads \
ada/output.ads ada/system.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
- ada/unchconv.ads ada/unchdeal.ads
+ ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/err_vars.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/err_vars.ads ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/opt.ads ada/output.ads \
ada/system.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads \
- ada/s-memory.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
+ ada/unchdeal.ads
ada/errout.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
@@ -1380,11 +1383,11 @@ ada/errout.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/erroutc.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/casing.ads \
ada/debug.ads ada/err_vars.ads ada/erroutc.ads ada/erroutc.adb \
@@ -1392,10 +1395,10 @@ ada/erroutc.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/casing.ads \
ada/hostparm.ads ada/namet.ads ada/opt.ads ada/output.ads \
ada/output.adb ada/rident.ads ada/sinput.ads ada/sinput.adb \
ada/snames.ads ada/system.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-rident.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads
+ ada/s-parame.ads ada/s-rident.ads ada/s-stalib.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
ada/eval_fat.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -1406,19 +1409,19 @@ ada/eval_fat.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/rident.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/snames.ads ada/stand.ads ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tree_io.ads ada/ttypef.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/urealp.adb
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tree_io.ads ada/ttypef.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
ada/exp_aggr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
- ada/exp_aggr.ads ada/exp_aggr.adb ada/exp_ch11.ads ada/exp_ch2.ads \
- ada/exp_ch3.ads ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_tss.ads \
+ ada/exp_aggr.ads ada/exp_aggr.adb ada/exp_ch2.ads ada/exp_ch3.ads \
+ ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_pakd.ads ada/exp_tss.ads \
ada/exp_util.ads ada/exp_util.adb ada/expander.ads ada/fname.ads \
ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
@@ -1432,35 +1435,36 @@ ada/exp_aggr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \
ada/stand.ads ada/stringt.ads ada/stringt.adb ada/system.ads \
ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/validsw.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
ada/exp_attr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
- ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \
- ada/errout.ads ada/erroutc.ads ada/exp_attr.ads ada/exp_attr.adb \
- ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch7.ads ada/exp_ch9.ads \
- ada/exp_imgv.ads ada/exp_pakd.ads ada/exp_strm.ads ada/exp_tss.ads \
- ada/exp_util.ads ada/exp_util.adb ada/fname.ads ada/fname-uf.ads \
- ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
- ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
- ada/inline.ads ada/interfac.ads ada/itypes.ads ada/lib.ads \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
- ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
+ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads \
+ ada/exp_attr.ads ada/exp_attr.adb ada/exp_ch2.ads ada/exp_ch7.ads \
+ ada/exp_ch9.ads ada/exp_imgv.ads ada/exp_pakd.ads ada/exp_strm.ads \
+ ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/exp_vfpt.ads \
+ ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
+ ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
+ ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_ch7.ads \
+ ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
@@ -1470,31 +1474,25 @@ ada/exp_attr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/widechar.ads
ada/exp_ch11.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
- ada/atree.adb ada/casing.ads ada/casing.adb ada/checks.ads \
- ada/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \
- ada/exp_ch11.adb ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads \
- ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
- ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
- ada/interfac.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads ada/namet.adb \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
- ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
- ada/sem.ads ada/sem_ch5.ads ada/sem_ch8.ads ada/sem_eval.ads \
- ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
- ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/atree.adb ada/casing.ads ada/casing.adb ada/csets.ads ada/debug.ads \
+ ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \
+ ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads ada/exp_ch11.adb \
+ ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \
+ ada/fname-uf.ads ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads \
+ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
+ ada/opt.ads ada/output.ads ada/restrict.ads ada/restrict.adb \
+ ada/rident.ads ada/rtsfind.ads ada/sem.ads ada/sem_ch8.ads \
+ ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/exp_ch12.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
@@ -1504,14 +1502,14 @@ ada/exp_ch12.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
ada/rident.ads ada/rtsfind.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/exp_ch13.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
@@ -1525,16 +1523,17 @@ ada/exp_ch13.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-carun8.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
- ada/tree_io.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/types.adb \
+ ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads
ada/exp_ch2.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \
- ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads ada/exp_ch2.ads \
+ ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads ada/exp_ch2.ads \
ada/exp_ch2.adb ada/exp_ch7.ads ada/exp_smem.ads ada/exp_tss.ads \
ada/exp_util.ads ada/exp_util.adb ada/exp_vfpt.ads ada/get_targ.ads \
ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
@@ -1542,16 +1541,16 @@ ada/exp_ch2.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
ada/rident.ads ada/rtsfind.ads ada/sem.ads ada/sem_ch8.ads \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_util.ads ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/validsw.ads
+ ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
+ ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/system.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
ada/exp_ch3.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
@@ -1559,45 +1558,45 @@ ada/exp_ch3.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch3.ads \
ada/exp_ch3.adb ada/exp_ch4.ads ada/exp_ch7.ads ada/exp_ch9.ads \
- ada/exp_disp.ads ada/exp_dist.ads ada/exp_smem.ads ada/exp_strm.ads \
- ada/exp_tss.ads ada/exp_tss.adb ada/exp_util.ads ada/fname.ads \
- ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/lib.ads ada/namet.ads ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/sem.ads ada/sem_ch3.ads ada/sem_ch8.ads ada/sem_eval.ads \
- ada/sem_mech.ads ada/sem_res.ads ada/sem_util.ads ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
- ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
- ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/validsw.ads
+ ada/exp_disp.ads ada/exp_dist.ads ada/exp_pakd.ads ada/exp_smem.ads \
+ ada/exp_strm.ads ada/exp_tss.ads ada/exp_tss.adb ada/exp_util.ads \
+ ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads ada/namet.ads \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
+ ada/rtsfind.ads ada/sem.ads ada/sem_attr.ads ada/sem_ch3.ads \
+ ada/sem_ch8.ads ada/sem_eval.ads ada/sem_mech.ads ada/sem_res.ads \
+ ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
+ ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
ada/exp_ch4.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
- ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch3.ads \
- ada/exp_ch4.ads ada/exp_ch4.adb ada/exp_ch7.ads ada/exp_ch9.ads \
- ada/exp_disp.ads ada/exp_fixd.ads ada/exp_pakd.ads ada/exp_tss.ads \
- ada/exp_util.ads ada/exp_util.adb ada/exp_vfpt.ads ada/freeze.ads \
- ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
- ada/itypes.ads ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/rident.ads ada/rtsfind.ads ada/sem.ads ada/sem_cat.ads \
- ada/sem_ch13.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_eval.adb \
+ ada/exp_aggr.ads ada/exp_ch2.ads ada/exp_ch3.ads ada/exp_ch4.ads \
+ ada/exp_ch4.adb ada/exp_ch7.ads ada/exp_ch9.ads ada/exp_fixd.ads \
+ ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
+ ada/exp_vfpt.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
+ ada/hostparm.ads ada/inline.ads ada/itypes.ads ada/lib.ads \
+ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
+ ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
+ ada/rtsfind.ads ada/sem.ads ada/sem_cat.ads ada/sem_ch13.ads \
+ ada/sem_ch3.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_eval.adb \
ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
- ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
+ ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
@@ -1608,29 +1607,30 @@ ada/exp_ch4.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/exp_ch5.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
- ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch5.ads \
- ada/exp_ch5.adb ada/exp_ch7.ads ada/exp_dbug.ads ada/exp_pakd.ads \
- ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \
- ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
- ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_ch13.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \
+ ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
+ ada/eval_fat.ads ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads \
+ ada/exp_ch5.ads ada/exp_ch5.adb ada/exp_ch7.ads ada/exp_dbug.ads \
+ ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
+ ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
+ ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
+ ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_ch13.ads \
+ ada/sem_ch3.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \
ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
ada/widechar.ads
@@ -1638,61 +1638,62 @@ ada/exp_ch6.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch3.ads \
+ ada/eval_fat.ads ada/exp_aggr.ads ada/exp_ch2.ads ada/exp_ch3.ads \
ada/exp_ch6.ads ada/exp_ch6.adb ada/exp_ch7.ads ada/exp_ch9.ads \
ada/exp_dbug.ads ada/exp_disp.ads ada/exp_dist.ads ada/exp_intr.ads \
ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
- ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
- ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads \
- ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
- ada/opt.ads ada/output.ads ada/restrict.ads ada/restrict.adb \
- ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
- ada/scng.adb ada/sem.ads ada/sem_ch12.ads ada/sem_ch13.ads \
- ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
- ada/widechar.ads
-
-ada/exp_ch7.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
- ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
- ada/einfo.adb ada/elists.ads ada/err_vars.ads ada/errout.ads \
- ada/erroutc.ads ada/exp_ch11.ads ada/exp_ch7.ads ada/exp_ch7.adb \
- ada/exp_ch9.ads ada/exp_dbug.ads ada/exp_tss.ads ada/exp_util.ads \
- ada/exp_util.adb ada/fname.ads ada/fname-uf.ads ada/freeze.ads \
- ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
- ada/itypes.ads ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/sem.ads \
- ada/sem_ch3.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_eval.ads \
- ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/inline.ads ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \
+ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
+ ada/sem_ch12.ads ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
+ ada/sem_eval.ads ada/sem_mech.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \
+ ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
+
+ada/exp_ch7.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
+ ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
+ ada/einfo.adb ada/elists.ads ada/err_vars.ads ada/errout.ads \
+ ada/erroutc.ads ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch7.ads \
+ ada/exp_ch7.adb ada/exp_ch9.ads ada/exp_dbug.ads ada/exp_tss.ads \
+ ada/exp_util.ads ada/exp_util.adb ada/fname.ads ada/fname-uf.ads \
+ ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
+ ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/inline.ads ada/itypes.ads ada/lib.ads ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
+ ada/sem.ads ada/sem_ch3.ads ada/sem_ch7.ads ada/sem_ch8.ads \
+ ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
ada/exp_ch8.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
ada/einfo.adb ada/elists.ads ada/err_vars.ads ada/errout.ads \
- ada/erroutc.ads ada/exp_ch11.ads ada/exp_ch7.ads ada/exp_ch8.ads \
+ ada/erroutc.ads ada/exp_aggr.ads ada/exp_ch7.ads ada/exp_ch8.ads \
ada/exp_ch8.adb ada/exp_dbug.ads ada/exp_tss.ads ada/exp_util.ads \
ada/exp_util.adb ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
@@ -1700,43 +1701,45 @@ ada/exp_ch8.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads \
ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
ada/sem.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \
- ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
+ ada/sem_type.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/validsw.ads
ada/exp_ch9.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \
- ada/exp_ch3.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_ch9.ads \
- ada/exp_ch9.adb ada/exp_dbug.ads ada/exp_smem.ads ada/exp_tss.ads \
- ada/exp_util.ads ada/exp_util.adb ada/fname.ads ada/fname-uf.ads \
- ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
- ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
- ada/inline.ads ada/interfac.ads ada/itypes.ads ada/lib.ads \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_ch11.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_elab.ads \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
+ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads \
+ ada/exp_ch11.ads ada/exp_ch3.ads ada/exp_ch6.ads ada/exp_ch7.ads \
+ ada/exp_ch9.ads ada/exp_ch9.adb ada/exp_dbug.ads ada/exp_smem.ads \
+ ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \
+ ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
+ ada/itypes.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/restrict.ads ada/restrict.adb ada/rident.ads \
+ ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
+ ada/sem.ads ada/sem_ch11.ads ada/sem_ch6.ads ada/sem_ch8.ads \
+ ada/sem_elab.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
+ ada/widechar.ads
ada/exp_code.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
@@ -1744,20 +1747,20 @@ ada/exp_code.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/errout.ads ada/erroutc.ads ada/eval_fat.ads ada/exp_code.ads \
ada/exp_code.adb ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \
ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib.adb \
- ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads \
- ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
- ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
- ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
- ada/sem.ads ada/sem_cat.ads ada/sem_ch8.ads ada/sem_eval.ads \
- ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
- ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
+ ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/rident.ads ada/rtsfind.ads \
+ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
+ ada/sem_cat.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_eval.adb \
+ ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
@@ -1774,24 +1777,23 @@ ada/exp_dbug.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_eval.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
ada/widechar.ads
ada/exp_disp.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \
+ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads \
ada/exp_ch7.ads ada/exp_disp.ads ada/exp_disp.adb ada/exp_tss.ads \
ada/exp_tss.adb ada/exp_util.ads ada/exp_util.adb ada/fname.ads \
- ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
+ ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
+ ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_ch8.ads \
@@ -1800,12 +1802,12 @@ ada/exp_disp.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
ada/widechar.ads
@@ -1813,20 +1815,21 @@ ada/exp_dist.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads \
ada/alloc.ads ada/atree.ads ada/atree.adb ada/casing.ads ada/debug.ads \
ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
ada/exp_dist.ads ada/exp_dist.adb ada/exp_strm.ads ada/exp_tss.ads \
- ada/exp_util.ads ada/fname.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-sort.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/rident.ads ada/rtsfind.ads ada/sem.ads ada/sem_ch3.ads \
- ada/sem_ch8.ads ada/sem_dist.ads ada/sem_util.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-htable.adb ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/types.ads \
+ ada/exp_util.ads ada/fname.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-sort.adb ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/sem.ads \
+ ada/sem_ch3.ads ada/sem_ch8.ads ada/sem_dist.ads ada/sem_eval.ads \
+ ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
ada/unchdeal.ads ada/urealp.ads
@@ -1842,12 +1845,12 @@ ada/exp_fixd.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tbuild.ads ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
ada/exp_imgv.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
@@ -1859,22 +1862,23 @@ ada/exp_imgv.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/sem_res.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads
ada/exp_intr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
- ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \
- ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads ada/exp_ch4.ads \
- ada/exp_ch7.ads ada/exp_code.ads ada/exp_fixd.ads ada/exp_intr.ads \
- ada/exp_intr.adb ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
- ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
- ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
+ ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
+ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_aggr.ads \
+ ada/exp_ch11.ads ada/exp_ch4.ads ada/exp_ch7.ads ada/exp_code.ads \
+ ada/exp_disp.ads ada/exp_fixd.ads ada/exp_intr.ads ada/exp_intr.adb \
+ ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \
+ ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
ada/itypes.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \
ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
@@ -1883,10 +1887,10 @@ ada/exp_intr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \
ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
- ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
@@ -1899,7 +1903,7 @@ ada/exp_pakd.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
- ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch7.ads ada/exp_dbug.ads \
+ ada/exp_aggr.ads ada/exp_ch2.ads ada/exp_ch7.ads ada/exp_dbug.ads \
ada/exp_pakd.ads ada/exp_pakd.adb ada/exp_tss.ads ada/exp_util.ads \
ada/exp_util.adb ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
@@ -1907,17 +1911,17 @@ ada/exp_pakd.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
ada/rtsfind.ads ada/sem.ads ada/sem_ch13.ads ada/sem_ch3.ads \
- ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_util.ads \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
- ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/validsw.ads
+ ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
+ ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
ada/exp_prag.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/casing.adb ada/csets.ads ada/debug.ads \
@@ -1930,14 +1934,14 @@ ada/exp_prag.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/rident.ads ada/rtsfind.ads ada/sem.ads ada/sem_eval.ads \
ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/snames.ads ada/snames.adb ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-carun8.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/types.ads \
- ada/types.adb ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/exp_smem.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -1949,12 +1953,13 @@ ada/exp_smem.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/rtsfind.ads ada/sem.ads ada/sem_util.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads
ada/exp_strm.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -1963,15 +1968,15 @@ ada/exp_strm.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads \
ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
- ada/rtsfind.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/rtsfind.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/exp_tss.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -1984,16 +1989,16 @@ ada/exp_tss.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/snames.ads ada/stand.ads ada/stringt.ads ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/exp_util.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \
- ada/errout.ads ada/erroutc.ads ada/eval_fat.ads ada/exp_ch11.ads \
+ ada/errout.ads ada/erroutc.ads ada/eval_fat.ads ada/exp_aggr.ads \
ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
ada/fname.ads ada/fname-uf.ads ada/get_targ.ads ada/gnat.ads \
ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
@@ -2006,13 +2011,14 @@ ada/exp_util.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/stringt.adb ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
+ ada/validsw.ads
ada/exp_vfpt.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -2022,12 +2028,13 @@ ada/exp_vfpt.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/rtsfind.ads \
ada/sem_res.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/snames.ads ada/stand.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tbuild.ads ada/tree_io.ads \
- ada/ttypef.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
+ ada/tree_io.ads ada/ttypef.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/urealp.adb
ada/expander.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/debug_a.ads \
@@ -2038,25 +2045,25 @@ ada/expander.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/exp_ch7.ads ada/exp_ch8.ads ada/exp_ch9.ads ada/exp_prag.ads \
ada/expander.ads ada/expander.adb ada/gnat.ads ada/g-htable.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
- ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \
+ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \
ada/rtsfind.ads ada/sem.ads ada/sem_ch8.ads ada/sem_util.ads \
ada/sinfo.ads ada/sinput.ads ada/snames.ads ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads
ada/fmap.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads ada/alloc.ads \
ada/debug.ads ada/fmap.ads ada/fmap.adb ada/gnat.ads ada/g-htable.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
ada/namet.ads ada/opt.ads ada/osint.ads ada/output.ads ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/fname-uf.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads \
ada/alloc.ads ada/casing.ads ada/debug.ads ada/fmap.ads ada/fname.ads \
@@ -2064,29 +2071,29 @@ ada/fname-uf.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
ada/krunch.ads ada/namet.ads ada/opt.ads ada/osint.ads ada/output.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb \
- ada/s-memory.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uname.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
ada/fname.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/fname.ads ada/fname.adb ada/gnat.ads ada/g-os_lib.ads \
ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads \
ada/opt.ads ada/output.ads ada/system.ads ada/s-exctab.ads \
- ada/s-memory.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/freeze.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/exp_ch11.ads ada/exp_ch7.ads ada/exp_pakd.ads ada/exp_tss.ads \
+ ada/exp_ch7.ads ada/exp_disp.ads ada/exp_pakd.ads ada/exp_tss.ads \
ada/exp_util.ads ada/expander.ads ada/fname.ads ada/freeze.ads \
ada/freeze.adb ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
- ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
- ada/interfac.ads ada/itypes.ads ada/layout.ads ada/lib.ads \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads \
+ ada/hostparm.ads ada/interfac.ads ada/itypes.ads ada/layout.ads \
+ ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \
@@ -2099,38 +2106,40 @@ ada/freeze.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/frontend.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads \
ada/cstand.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \
- ada/exp_dbug.ads ada/fmap.ads ada/fname.ads ada/fname-uf.ads \
- ada/frontend.ads ada/frontend.adb ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
+ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_dbug.ads \
+ ada/fmap.ads ada/fname.ads ada/fname-uf.ads ada/frontend.ads \
+ ada/frontend.adb ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads \
+ ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/lib.ads \
ada/lib.adb ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb \
- ada/live.ads ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/osint.ads ada/output.ads ada/par.ads \
- ada/prepcomp.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_ch8.ads ada/sem_elab.ads ada/sem_prag.ads ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
- ada/sinput-l.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
- ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/live.ads ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb \
+ ada/nmake.ads ada/nmake.adb ada/opt.ads ada/osint.ads ada/output.ads \
+ ada/par.ads ada/prepcomp.ads ada/restrict.ads ada/rident.ads \
+ ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
+ ada/sem.ads ada/sem_ch8.ads ada/sem_elab.ads ada/sem_prag.ads \
+ ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/sinput.adb ada/sinput-l.ads ada/snames.ads ada/sprint.ads \
+ ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
+ ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/g-hesora.o : ada/gnat.ads ada/g-hesora.ads ada/g-hesora.adb \
ada/system.ads
@@ -2151,7 +2160,8 @@ ada/g-speche.o : ada/gnat.ads ada/g-speche.ads ada/g-speche.adb \
ada/g-string.o : ada/gnat.ads ada/g-string.ads ada/g-string.adb \
ada/system.ads ada/unchdeal.ads
-ada/g-utf_32.o : ada/gnat.ads ada/g-utf_32.ads ada/g-utf_32.adb
+ada/g-utf_32.o : ada/gnat.ads ada/g-utf_32.ads ada/g-utf_32.adb \
+ ada/system.ads
ada/get_targ.o : ada/get_targ.ads ada/get_targ.adb ada/system.ads \
ada/s-exctab.ads ada/s-stalib.ads ada/s-unstyp.ads ada/types.ads \
@@ -2175,13 +2185,14 @@ ada/gnat1drv.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
ada/sinput-l.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-assert.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tree_gen.ads ada/tree_io.ads ada/treepr.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/usage.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tree_gen.ads ada/tree_io.ads ada/treepr.ads \
+ ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/usage.ads \
+ ada/widechar.ads
ada/gnatbind.o : ada/ada.ads ada/a-except.ads ada/ali.ads ada/ali-util.ads \
ada/alloc.ads ada/bcheck.ads ada/binde.ads ada/binderr.ads \
@@ -2190,14 +2201,14 @@ ada/gnatbind.o : ada/ada.ads ada/a-except.ads ada/ali.ads ada/ali-util.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatbind.ads ada/gnatbind.adb \
ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads ada/opt.ads \
ada/osint.ads ada/osint-b.ads ada/output.ads ada/rident.ads \
- ada/switch.ads ada/switch-b.ads ada/system.ads ada/s-casuti.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads \
- ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tree_io.ads ada/types.ads ada/unchconv.ads \
- ada/unchdeal.ads
+ ada/snames.ads ada/switch.ads ada/switch-b.ads ada/system.ads \
+ ada/s-casuti.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco4.ads \
+ ada/s-sopco5.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tree_io.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/gnatvsn.o : ada/gnatvsn.ads ada/gnatvsn.adb ada/system.ads \
ada/s-secsta.ads ada/s-stoele.ads ada/s-stoele.adb ada/unchconv.ads
@@ -2217,31 +2228,31 @@ ada/impunit.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/namet.adb ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/widechar.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/inline.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
ada/elists.ads ada/elists.adb ada/err_vars.ads ada/errout.ads \
- ada/erroutc.ads ada/exp_ch11.ads ada/exp_ch7.ads ada/exp_tss.ads \
- ada/exp_tss.adb ada/exp_util.ads ada/fname.ads ada/fname-uf.ads \
- ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
- ada/inline.adb ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-sort.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/opt.ads ada/output.ads ada/rtsfind.ads ada/sem_ch10.ads \
- ada/sem_ch12.ads ada/sem_ch8.ads ada/sem_util.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/erroutc.ads ada/exp_ch7.ads ada/exp_tss.ads ada/exp_tss.adb \
+ ada/exp_util.ads ada/fname.ads ada/fname-uf.ads ada/gnat.ads \
+ ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads ada/inline.adb \
+ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/namet.ads \
+ ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \
+ ada/rtsfind.ads ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch8.ads \
+ ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/system.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/interfac.o : ada/interfac.ads ada/system.ads
@@ -2253,11 +2264,11 @@ ada/itypes.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/output.ads ada/sem.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/snames.ads ada/stand.ads ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/krunch.o : ada/hostparm.ads ada/krunch.ads ada/krunch.adb \
ada/system.ads ada/s-stoele.ads ada/s-stoele.adb ada/unchconv.ads
@@ -2268,78 +2279,80 @@ ada/layout.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/errout.ads ada/erroutc.ads ada/exp_ch3.ads ada/exp_tss.ads \
ada/exp_util.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \
ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/layout.ads \
- ada/layout.adb ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/repinfo.ads ada/repinfo.adb ada/restrict.ads \
- ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
- ada/scng.adb ada/sem.ads ada/sem_ch13.ads ada/sem_ch8.ads \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \
+ ada/layout.ads ada/layout.adb ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/repinfo.ads \
+ ada/repinfo.adb ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
+ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
+ ada/sem_ch13.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/lib-load.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
ada/einfo.adb ada/elists.ads ada/err_vars.ads ada/errout.ads \
ada/erroutc.ads ada/fname.ads ada/fname-uf.ads ada/gnat.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib-load.ads \
- ada/lib-load.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/nmake.ads ada/nmake.adb ada/opt.ads ada/osint.ads ada/osint-c.ads \
- ada/output.ads ada/par.ads ada/restrict.ads ada/rident.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/sinput-l.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
+ ada/lib-load.ads ada/lib-load.adb ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/osint.ads ada/osint-c.ads ada/output.ads ada/par.ads \
+ ada/restrict.ads ada/rident.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/sinput-l.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-crc32.adb \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/lib-util.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/lib.ads ada/lib-util.ads ada/lib-util.adb \
ada/namet.ads ada/opt.ads ada/osint.ads ada/osint-c.ads ada/output.ads \
- ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/lib-writ.o : ada/ada.ads ada/a-except.ads ada/ali.ads ada/alloc.ads \
ada/atree.ads ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads \
ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \
ada/errout.ads ada/erroutc.ads ada/fname.ads ada/fname-uf.ads \
ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
- ada/lib-util.ads ada/lib-util.adb ada/lib-writ.ads ada/lib-writ.adb \
- ada/lib-xref.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/nmake.ads ada/nmake.adb ada/opt.ads ada/osint.ads ada/osint-c.ads \
- ada/output.ads ada/par.ads ada/restrict.ads ada/rident.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
- ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
- ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/types.ads \
- ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \
+ ada/lib.ads ada/lib-util.ads ada/lib-util.adb ada/lib-writ.ads \
+ ada/lib-writ.adb ada/lib-xref.ads ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/osint.ads ada/osint-c.ads ada/output.ads ada/par.ads \
+ ada/restrict.ads ada/rident.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-casuti.ads ada/s-carun8.ads \
+ ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/types.ads ada/types.adb \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/lib-xref.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
@@ -2349,14 +2362,16 @@ ada/lib-xref.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/hostparm.ads ada/lib.ads ada/lib-util.ads ada/lib-util.adb \
ada/lib-xref.ads ada/lib-xref.adb ada/namet.ads ada/nlists.ads \
ada/nlists.adb ada/opt.ads ada/osint.ads ada/osint-c.ads ada/output.ads \
- ada/sem_prag.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/restrict.ads ada/rident.ads ada/sem.ads ada/sem_prag.ads \
+ ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/widechar.ads
ada/lib.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -2367,12 +2382,12 @@ ada/lib.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/sinput.adb ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/widechar.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/live.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -2383,37 +2398,39 @@ ada/live.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/nlists.adb ada/opt.ads ada/output.ads ada/sem_util.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads
ada/memtrack.o : ada/ada.ads ada/a-except.ads ada/gnat.ads ada/g-io.ads \
- ada/system.ads ada/s-memory.ads ada/memtrack.adb ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traceb.ads ada/s-traent.ads ada/s-traent.adb ada/unchconv.ads
+ ada/system.ads ada/s-memory.ads ada/memtrack.adb ada/s-parame.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traceb.ads ada/s-traent.ads ada/s-traent.adb \
+ ada/unchconv.ads
ada/namet.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/namet.ads ada/namet.adb ada/opt.ads ada/output.ads \
ada/system.ads ada/s-carun8.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/types.adb \
+ ada/s-parame.ads ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/types.adb \
ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
ada/nlists.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/elists.ads \
ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/nlists.ads ada/nlists.adb \
- ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinput.ads ada/snames.ads \
- ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinput.ads \
+ ada/snames.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/nmake.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/elists.ads \
@@ -2422,38 +2439,39 @@ ada/nmake.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/opt.o : ada/ada.ads ada/a-except.ads ada/gnat.ads ada/g-os_lib.ads \
ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/opt.ads \
- ada/opt.adb ada/system.ads ada/s-exctab.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/opt.adb ada/system.ads ada/s-exctab.ads ada/s-parame.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/tree_io.ads ada/types.ads ada/unchconv.ads \
+ ada/unchdeal.ads
ada/osint-b.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/namet.ads ada/opt.ads ada/osint.ads \
ada/osint-b.ads ada/osint-b.adb ada/output.ads ada/system.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \
- ada/unchdeal.ads
+ ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
+ ada/unchconv.ads ada/unchdeal.ads
ada/osint-c.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/namet.ads ada/namet.adb ada/opt.ads ada/osint.ads \
ada/osint-c.ads ada/osint-c.adb ada/output.ads ada/system.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/widechar.ads
+ ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
ada/osint.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads ada/alloc.ads \
ada/debug.ads ada/fmap.ads ada/gnat.ads ada/g-htable.ads \
@@ -2461,11 +2479,12 @@ ada/osint.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads ada/alloc.ads \
ada/namet.ads ada/namet.adb ada/opt.ads ada/osint.ads ada/osint.adb \
ada/output.ads ada/sdefault.ads ada/system.ads ada/s-casuti.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads \
- ada/s-sopco4.ads ada/s-sopco5.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-strops.ads \
+ ada/s-sopco3.ads ada/s-sopco4.ads ada/s-sopco5.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/widechar.ads
ada/output.o : ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads \
ada/output.ads ada/output.adb ada/system.ads ada/s-exctab.ads \
@@ -2477,30 +2496,30 @@ ada/par.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/einfo.adb ada/elists.ads ada/elists.adb ada/err_vars.ads \
ada/errout.ads ada/erroutc.ads ada/fname.ads ada/fname-uf.ads \
ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
- ada/g-speche.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
- ada/interfac.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-load.ads ada/lib-sort.adb ada/namet.ads ada/namet.adb \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/osint.ads ada/output.ads ada/par.ads ada/par.adb ada/par-ch10.adb \
- ada/par-ch11.adb ada/par-ch12.adb ada/par-ch13.adb ada/par-ch2.adb \
- ada/par-ch3.adb ada/par-ch4.adb ada/par-ch5.adb ada/par-ch6.adb \
- ada/par-ch7.adb ada/par-ch8.adb ada/par-ch9.adb ada/par-endh.adb \
- ada/par-labl.adb ada/par-load.adb ada/par-prag.adb ada/par-sync.adb \
- ada/par-tchk.adb ada/par-util.adb ada/restrict.ads ada/rident.ads \
- ada/scans.ads ada/scans.adb ada/scn.ads ada/scng.ads ada/scng.adb \
- ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
- ada/sinput.adb ada/sinput-l.ads ada/snames.ads ada/snames.adb \
- ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
- ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb \
- ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
- ada/widechar.ads
+ ada/g-speche.ads ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads \
+ ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/namet.ads \
+ ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
+ ada/opt.ads ada/osint.ads ada/output.ads ada/par.ads ada/par.adb \
+ ada/par-ch10.adb ada/par-ch11.adb ada/par-ch12.adb ada/par-ch13.adb \
+ ada/par-ch2.adb ada/par-ch3.adb ada/par-ch4.adb ada/par-ch5.adb \
+ ada/par-ch6.adb ada/par-ch7.adb ada/par-ch8.adb ada/par-ch9.adb \
+ ada/par-endh.adb ada/par-labl.adb ada/par-load.adb ada/par-prag.adb \
+ ada/par-sync.adb ada/par-tchk.adb ada/par-util.adb ada/restrict.ads \
+ ada/rident.ads ada/scans.ads ada/scans.adb ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \
+ ada/sinput.ads ada/sinput.adb ada/sinput-l.ads ada/snames.ads \
+ ada/snames.adb ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \
+ ada/s-crc32.adb ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/types.ads ada/types.adb \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/widechar.ads
ada/prep.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/casing.ads \
ada/csets.ads ada/debug.ads ada/err_vars.ads ada/gnat.ads \
@@ -2509,24 +2528,25 @@ ada/prep.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/casing.ads \
ada/namet.ads ada/opt.ads ada/osint.ads ada/output.ads ada/prep.ads \
ada/prep.adb ada/scans.ads ada/sinput.ads ada/snames.ads \
ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-carun8.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/prepcomp.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads \
ada/alloc.ads ada/casing.ads ada/csets.ads ada/debug.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \
ada/g-dyntab.ads ada/g-dyntab.adb ada/g-hesorg.ads ada/g-os_lib.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \
- ada/lib.ads ada/lib-writ.ads ada/namet.ads ada/opt.ads ada/osint.ads \
- ada/output.ads ada/prep.ads ada/prepcomp.ads ada/prepcomp.adb \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sinput.ads \
- ada/sinput.adb ada/sinput-l.ads ada/snames.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
- ada/s-crc32.adb ada/s-exctab.ads ada/s-memory.ads ada/s-secsta.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/lib.ads ada/lib-writ.ads ada/namet.ads \
+ ada/namet.adb ada/opt.ads ada/osint.ads ada/output.ads ada/prep.ads \
+ ada/prepcomp.ads ada/prepcomp.adb ada/scans.ads ada/scn.ads \
+ ada/scng.ads ada/scng.adb ada/sinput.ads ada/sinput.adb \
+ ada/sinput-l.ads ada/snames.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-crc32.adb \
+ ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
@@ -2542,11 +2562,12 @@ ada/repinfo.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/repinfo.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/widechar.ads
ada/restrict.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -2559,11 +2580,12 @@ ada/restrict.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/rident.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/rident.o : ada/rident.ads ada/system.ads ada/s-rident.ads
@@ -2575,24 +2597,27 @@ ada/rtsfind.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads \
ada/lib.adb ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb \
ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/rtsfind.ads \
- ada/rtsfind.adb ada/sem.ads ada/sem_ch7.ads ada/sem_util.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb ada/sem.ads \
+ ada/sem_ch7.ads ada/sem_dist.ads ada/sem_util.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-exctab.adb \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tbuild.ads ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/s-addope.o : ada/system.ads ada/s-addope.ads ada/s-addope.adb \
ada/unchconv.ads
ada/s-assert.o : ada/ada.ads ada/a-except.ads ada/system.ads \
ada/s-assert.ads ada/s-assert.adb ada/s-exctab.ads ada/s-exctab.adb \
- ada/s-htable.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/unchconv.ads
+ ada/s-htable.ads ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/unchconv.ads
ada/s-carun8.o : ada/system.ads ada/s-addope.ads ada/s-addope.adb \
ada/s-carun8.ads ada/s-carun8.adb ada/s-stoele.ads ada/s-stoele.adb \
@@ -2607,8 +2632,9 @@ ada/s-crtl.o : ada/system.ads ada/s-crtl.ads ada/s-parame.ads
ada/s-exctab.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads \
ada/system.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads \
- ada/s-htable.adb ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/unchconv.ads
+ ada/s-htable.adb ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/unchconv.ads
ada/s-htable.o : ada/ada.ads ada/a-uncdea.ads ada/system.ads \
ada/s-htable.ads ada/s-htable.adb
@@ -2616,9 +2642,8 @@ ada/s-htable.o : ada/ada.ads ada/a-uncdea.ads ada/system.ads \
ada/s-imgenu.o : ada/system.ads ada/s-imgenu.ads ada/s-imgenu.adb \
ada/s-secsta.ads ada/s-stoele.ads ada/s-stoele.adb ada/unchconv.ads
-ada/s-mastop.o : ada/ada.ads ada/a-except.ads ada/system.ads \
- ada/s-mastop.ads ada/s-mastop.adb ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/unchconv.ads
+ada/s-mastop.o : ada/system.ads ada/s-mastop.ads ada/s-mastop.adb \
+ ada/s-stoele.ads ada/s-stoele.adb ada/unchconv.ads
ada/s-memory.o : ada/ada.ads ada/a-except.ads ada/system.ads \
ada/s-crtl.ads ada/s-memory.ads ada/s-memory.adb ada/s-parame.ads \
@@ -2635,9 +2660,9 @@ ada/s-secsta.o : ada/ada.ads ada/a-except.ads ada/system.ads \
ada/s-traent.ads ada/unchconv.ads ada/unchdeal.ads
ada/s-soflin.o : ada/ada.ads ada/a-except.ads ada/system.ads \
- ada/s-mastop.ads ada/s-parame.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-soflin.adb ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/unchconv.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-soflin.adb \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/unchconv.ads
ada/s-sopco3.o : ada/system.ads ada/s-secsta.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-strops.ads ada/s-sopco3.ads ada/s-sopco3.adb \
@@ -2655,9 +2680,9 @@ ada/s-stache.o : ada/system.ads ada/s-stache.ads ada/s-stache.adb \
ada/s-stoele.ads ada/s-stoele.adb ada/unchconv.ads
ada/s-stalib.o : ada/ada.ads ada/a-except.ads ada/system.ads \
- ada/s-memory.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stalib.adb ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/unchconv.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stalib.adb ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/unchconv.ads
ada/s-stoele.o : ada/system.ads ada/s-stoele.ads ada/s-stoele.adb \
ada/unchconv.ads
@@ -2684,48 +2709,50 @@ ada/s-wchjis.o : ada/system.ads ada/s-wchjis.ads ada/s-wchjis.adb
ada/scans.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/opt.ads ada/output.ads ada/scans.ads ada/scans.adb \
- ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/scn.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/namet.ads \
- ada/namet.adb ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \
- ada/scans.ads ada/scn.ads ada/scn.adb ada/scng.ads ada/scng.adb \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/g-utf_32.ads ada/g-utf_32.adb ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/nlists.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/rident.ads ada/scans.ads ada/scn.ads ada/scn.adb ada/scng.ads \
+ ada/scng.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
ada/snames.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
- ada/widechar.ads
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/types.adb ada/uintp.ads \
+ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/urealp.adb ada/widechar.ads
ada/scng.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/casing.ads \
ada/csets.ads ada/debug.ads ada/err_vars.ads ada/gnat.ads \
- ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
- ada/interfac.ads ada/namet.ads ada/opt.ads ada/output.ads ada/scans.ads \
- ada/scng.ads ada/scng.adb ada/sinput.ads ada/snames.ads ada/stringt.ads \
- ada/styleg.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads \
+ ada/hostparm.ads ada/interfac.ads ada/namet.ads ada/opt.ads \
+ ada/output.ads ada/scans.ads ada/scng.ads ada/scng.adb ada/sinput.ads \
+ ada/snames.ads ada/stringt.ads ada/styleg.ads ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/sem.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/debug_a.ads \
ada/debug_a.adb ada/einfo.ads ada/einfo.adb ada/elists.ads \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/expander.ads \
- ada/fname.ads ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads \
- ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hlo.ads \
- ada/hostparm.ads ada/inline.ads ada/lib.ads ada/lib.adb \
+ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_tss.ads \
+ ada/expander.ads ada/fname.ads ada/gnat.ads ada/g-hesora.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
+ ada/hlo.ads ada/hostparm.ads ada/inline.ads ada/lib.ads ada/lib.adb \
ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/namet.ads \
ada/nlists.ads ada/nlists.adb ada/opt.ads ada/output.ads \
ada/restrict.ads ada/rident.ads ada/sem.ads ada/sem.adb \
@@ -2735,63 +2762,66 @@ ada/sem.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_ch8.ads ada/sem_ch9.ads ada/sem_prag.ads ada/sem_util.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-carun8.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
+ ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/sem_aggr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch7.ads \
- ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/fname.ads \
- ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
- ada/g-os_lib.ads ada/g-speche.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
- ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
- ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \
- ada/sem_aggr.adb ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch8.ads \
+ ada/eval_fat.ads ada/exp_aggr.ads ada/exp_ch2.ads ada/exp_ch7.ads \
+ ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
+ ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-speche.ads ada/g-string.ads \
+ ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
+ ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sem.ads ada/sem_aggr.ads ada/sem_aggr.adb \
+ ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch8.ads \
ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads \
ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \
ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/validsw.ads ada/widechar.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
+ ada/widechar.ads
ada/sem_attr.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.ads \
ada/a-except.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
ada/casing.ads ada/checks.ads ada/checks.adb ada/debug.ads \
ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
- ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch7.ads ada/exp_tss.ads \
- ada/exp_util.ads ada/exp_util.adb ada/expander.ads ada/freeze.ads \
- ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
- ada/itypes.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
- ada/sdefault.ads ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \
- ada/sem_attr.adb ada/sem_cat.ads ada/sem_ch4.ads ada/sem_ch6.ads \
- ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
- ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads \
- ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
- ada/snames.ads ada/snames.adb ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-carun8.ads \
- ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/exp_aggr.ads ada/exp_ch2.ads ada/exp_ch7.ads ada/exp_disp.ads \
+ ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
+ ada/expander.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
+ ada/hostparm.ads ada/inline.ads ada/itypes.ads ada/lib.ads \
+ ada/lib-xref.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \
+ ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/sdefault.ads ada/sem.ads \
+ ada/sem_aggr.ads ada/sem_attr.ads ada/sem_attr.adb ada/sem_cat.ads \
+ ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads \
+ ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_eval.ads \
+ ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
+ ada/snames.adb ada/sprint.ads ada/stand.ads ada/stringt.ads \
+ ada/stringt.adb ada/system.ads ada/s-carun8.ads ada/s-exctab.ads \
+ ada/s-exctab.adb ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
@@ -2810,11 +2840,12 @@ ada/sem_case.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tbuild.ads ada/tree_io.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads
ada/sem_cat.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -2827,19 +2858,20 @@ ada/sem_cat.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_cat.adb ada/sem_eval.ads ada/sem_util.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads
ada/sem_ch10.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
- ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_tss.ads \
- ada/exp_util.ads ada/fname.ads ada/fname-uf.ads ada/freeze.ads \
- ada/get_targ.ads ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads \
- ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \
+ ada/errout.ads ada/erroutc.ads ada/exp_tss.ads ada/exp_util.ads \
+ ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
ada/impunit.ads ada/inline.ads ada/interfac.ads ada/lib.ads ada/lib.adb \
ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-xref.ads \
ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
@@ -2853,13 +2885,13 @@ ada/sem_ch10.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_ch11.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
@@ -2872,12 +2904,12 @@ ada/sem_ch11.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_ch11.adb ada/sem_ch5.ads ada/sem_ch8.ads ada/sem_res.ads \
ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/snames.ads ada/stand.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/sem_ch12.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads \
ada/alloc.ads ada/atree.ads ada/atree.adb ada/casing.ads ada/checks.ads \
@@ -2886,28 +2918,29 @@ ada/sem_ch12.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads \
ada/exp_tss.ads ada/exp_util.ads ada/expander.ads ada/fname.ads \
ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
- ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads ada/namet.adb \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch12.adb \
- ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads \
- ada/sem_ch8.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \
- ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \
- ada/sinput.ads ada/sinput-l.ads ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
- ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-htable.adb \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/widechar.ads
+ ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
+ ada/interfac.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
+ ada/lib-load.ads ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads \
+ ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
+ ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
+ ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
+ ada/sem.ads ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch12.ads \
+ ada/sem_ch12.adb ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch6.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_elab.ads \
+ ada/sem_elim.ads ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads ada/sinput-l.ads \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
+ ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb \
+ ada/s-htable.ads ada/s-htable.adb ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/urealp.adb ada/widechar.ads
ada/sem_ch13.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/debug.ads ada/einfo.ads \
@@ -2922,13 +2955,13 @@ ada/sem_ch13.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
ada/sem_ch2.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/elists.ads \
@@ -2939,39 +2972,41 @@ ada/sem_ch2.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_ch2.ads ada/sem_ch2.adb ada/sem_ch8.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/system.ads ada/s-carun8.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/types.adb \
- ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/types.adb ada/uintp.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads
ada/sem_ch3.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/csets.ads ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \
ada/elists.ads ada/elists.adb ada/err_vars.ads ada/errout.ads \
- ada/erroutc.ads ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads \
- ada/exp_ch3.ads ada/exp_ch7.ads ada/exp_dist.ads ada/exp_tss.ads \
- ada/exp_util.ads ada/exp_util.adb ada/expander.ads ada/fname.ads \
- ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
- ada/layout.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads ada/namet.adb \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_aggr.ads ada/sem_attr.ads ada/sem_case.ads ada/sem_case.adb \
- ada/sem_cat.ads ada/sem_cat.adb ada/sem_ch13.ads ada/sem_ch3.ads \
- ada/sem_ch3.adb ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch7.ads \
- ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
- ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads \
- ada/sem_mech.ads ada/sem_res.ads ada/sem_res.adb ada/sem_smem.ads \
- ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
- ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
+ ada/erroutc.ads ada/eval_fat.ads ada/exp_aggr.ads ada/exp_ch2.ads \
+ ada/exp_ch3.ads ada/exp_ch7.ads ada/exp_disp.ads ada/exp_dist.ads \
+ ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb \
+ ada/expander.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/inline.ads ada/interfac.ads ada/itypes.ads ada/layout.ads \
+ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \
+ ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \
+ ada/sem_attr.ads ada/sem_case.ads ada/sem_case.adb ada/sem_cat.ads \
+ ada/sem_cat.adb ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch3.adb \
+ ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch7.ads ada/sem_ch8.ads \
+ ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads \
+ ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_mech.ads \
+ ada/sem_res.ads ada/sem_res.adb ada/sem_smem.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \
+ ada/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
+ ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
@@ -2983,25 +3018,26 @@ ada/sem_ch3.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_ch4.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch7.ads \
- ada/exp_tss.ads ada/exp_util.ads ada/expander.ads ada/fname.ads \
- ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-speche.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/itypes.ads \
- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
- ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \
- ada/sem_attr.ads ada/sem_cat.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch4.adb ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
- ada/sem_dist.ads ada/sem_elab.ads ada/sem_eval.ads ada/sem_intr.ads \
- ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
+ ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
+ ada/exp_ch7.ads ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads \
+ ada/expander.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-speche.ads ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads \
+ ada/hostparm.ads ada/interfac.ads ada/itypes.ads ada/lib.ads \
+ ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \
+ ada/sem_cat.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch4.adb \
+ ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
+ ada/sem_elab.ads ada/sem_eval.ads ada/sem_intr.ads ada/sem_res.ads \
+ ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
+ ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
+ ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
@@ -3013,27 +3049,28 @@ ada/sem_ch5.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/csets.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/eval_fat.ads \
- ada/exp_ch2.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.ads \
- ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
- ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_case.ads \
- ada/sem_case.adb ada/sem_cat.ads ada/sem_ch3.ads ada/sem_ch5.ads \
- ada/sem_ch5.adb ada/sem_ch8.ads ada/sem_disp.ads ada/sem_eval.ads \
- ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
- ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/exp_ch2.ads ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads \
+ ada/expander.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads \
+ ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
+ ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
+ ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
+ ada/sem.ads ada/sem_case.ads ada/sem_case.adb ada/sem_cat.ads \
+ ada/sem_ch3.ads ada/sem_ch5.ads ada/sem_ch5.adb ada/sem_ch8.ads \
+ ada/sem_disp.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads \
+ ada/sprint.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
ada/widechar.ads
@@ -3043,23 +3080,24 @@ ada/sem_ch6.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch7.ads \
ada/exp_tss.ads ada/exp_util.ads ada/expander.ads ada/fname.ads \
ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/lib.ads \
- ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads \
- ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
- ada/scng.adb ada/sem.ads ada/sem_cat.ads ada/sem_ch12.ads \
- ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads \
- ada/sem_ch6.adb ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
- ada/sem_elim.ads ada/sem_eval.ads ada/sem_mech.ads ada/sem_prag.ads \
- ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads \
- ada/sinput.ads ada/sinput.adb ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
- ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
+ ada/itypes.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
+ ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
+ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
+ ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch3.ads \
+ ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch6.adb \
+ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elim.ads \
+ ada/sem_eval.ads ada/sem_mech.ads ada/sem_prag.ads ada/sem_res.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
+ ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
@@ -3073,11 +3111,11 @@ ada/sem_ch7.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_dbug.ads \
ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \
ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/lib.ads \
- ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads \
- ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads ada/interfac.ads \
+ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \
+ ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
ada/scng.adb ada/sem.ads ada/sem_cat.ads ada/sem_ch10.ads \
ada/sem_ch12.ads ada/sem_ch3.ads ada/sem_ch6.ads ada/sem_ch7.ads \
@@ -3087,42 +3125,43 @@ ada/sem_ch7.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/snames.ads ada/snames.adb ada/stand.ads ada/stringt.ads \
ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_ch8.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.ads \
- ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-speche.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
- ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
- ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-xref.ads \
- ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
- ada/scng.adb ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \
- ada/sem_cat.ads ada/sem_ch12.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_ch8.adb ada/sem_disp.ads \
- ada/sem_dist.ads ada/sem_elab.ads ada/sem_eval.ads ada/sem_intr.ads \
- ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb ada/snames.ads \
- ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
- ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/exp_ch7.ads ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads \
+ ada/expander.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-speche.ads ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads \
+ ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
+ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
+ ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
+ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
+ ada/sem_aggr.ads ada/sem_attr.ads ada/sem_cat.ads ada/sem_ch12.ads \
+ ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads \
+ ada/sem_ch8.adb ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
+ ada/sem_eval.ads ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
+ ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_ch9.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
@@ -3130,24 +3169,25 @@ ada/sem_ch9.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/csets.ads ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \
ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
ada/eval_fat.ads ada/exp_ch2.ads ada/exp_ch7.ads ada/exp_ch9.ads \
- ada/exp_tss.ads ada/exp_util.ads ada/expander.ads ada/fname.ads \
- ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/interfac.ads ada/itypes.ads ada/lib.ads \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_aggr.ads ada/sem_attr.ads ada/sem_cat.ads ada/sem_ch3.ads \
- ada/sem_ch4.ads ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch8.ads \
- ada/sem_ch9.ads ada/sem_ch9.adb ada/sem_disp.ads ada/sem_dist.ads \
- ada/sem_elab.ads ada/sem_eval.ads ada/sem_intr.ads ada/sem_res.ads \
- ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/sinput.adb ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/exp_disp.ads ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads \
+ ada/expander.ads ada/fname.ads ada/fname-uf.ads ada/freeze.ads \
+ ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \
+ ada/sem_attr.ads ada/sem_cat.ads ada/sem_ch3.ads ada/sem_ch4.ads \
+ ada/sem_ch5.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_ch9.ads \
+ ada/sem_ch9.adb ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
+ ada/sem_eval.ads ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
@@ -3162,10 +3202,10 @@ ada/sem_disp.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch7.ads \
ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \
ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
- ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
- ada/interfac.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads \
- ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads \
- ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
+ ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads \
+ ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/rident.ads ada/rtsfind.ads \
ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_disp.adb \
ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
@@ -3173,32 +3213,31 @@ ada/sem_disp.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/widechar.ads
+ ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_dist.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
ada/exp_dist.ads ada/exp_tss.ads ada/gnat.ads ada/g-htable.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
- ada/lib.ads ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/rident.ads ada/rtsfind.ads ada/sem.ads ada/sem_dist.ads \
+ ada/namet.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
+ ada/opt.ads ada/output.ads ada/rtsfind.ads ada/sem.ads ada/sem_dist.ads \
ada/sem_dist.adb ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-carun8.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/types.ads \
- ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/tbuild.ads ada/tree_io.ads ada/types.ads ada/types.adb \
+ ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads
ada/sem_elab.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
@@ -3206,26 +3245,27 @@ ada/sem_elab.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_tss.ads \
ada/exp_util.ads ada/expander.ads ada/fname.ads ada/fname-uf.ads \
ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib.adb \
- ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-xref.ads \
- ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
- ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_cat.ads \
- ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_elab.ads ada/sem_elab.adb \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
+ ada/lib.adb ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb \
+ ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
+ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
+ ada/sem_cat.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_elab.ads \
+ ada/sem_elab.adb ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/sinput.adb ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
+ ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
+ ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/sem_elim.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads \
ada/alloc.ads ada/atree.ads ada/atree.adb ada/casing.ads ada/debug.ads \
@@ -3237,38 +3277,39 @@ ada/sem_elim.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads \
ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
ada/stand.ads ada/stringt.ads ada/system.ads ada/s-exctab.ads \
ada/s-htable.ads ada/s-htable.adb ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_eval.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/eval_fat.ads ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads \
- ada/expander.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \
- ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/itypes.ads \
- ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
- ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \
- ada/sem_attr.ads ada/sem_cat.ads ada/sem_ch4.ads ada/sem_ch6.ads \
- ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
- ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads \
- ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
- ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
- ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
+ ada/eval_fat.ads ada/exp_ch7.ads ada/exp_disp.ads ada/exp_tss.ads \
+ ada/exp_util.ads ada/expander.ads ada/fname.ads ada/freeze.ads \
+ ada/get_targ.ads ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \
+ ada/sem_cat.ads ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads \
+ ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_eval.ads \
+ ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/widechar.ads
ada/sem_intr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
@@ -3281,12 +3322,13 @@ ada/sem_intr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_eval.ads ada/sem_intr.ads ada/sem_intr.adb ada/sem_util.ads \
ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads
ada/sem_maps.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -3296,11 +3338,11 @@ ada/sem_maps.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_maps.ads ada/sem_maps.adb ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/snames.ads ada/stand.ads ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/sem_mech.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
@@ -3311,73 +3353,74 @@ ada/sem_mech.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_mech.ads ada/sem_mech.adb ada/sem_util.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tree_io.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads
ada/sem_prag.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
- ada/atree.adb ada/casing.ads ada/casing.adb ada/checks.ads \
- ada/csets.ads ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \
- ada/elists.ads ada/elists.adb ada/err_vars.ads ada/errout.ads \
- ada/erroutc.ads ada/eval_fat.ads ada/exp_ch7.ads ada/exp_dist.ads \
+ ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
+ ada/debug_a.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
+ ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
+ ada/eval_fat.ads ada/exp_ch7.ads ada/exp_disp.ads ada/exp_dist.ads \
ada/exp_tss.ads ada/exp_util.ads ada/expander.ads ada/fname.ads \
ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-speche.ads \
- ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \
- ada/itypes.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-sort.adb ada/lib-writ.ads ada/lib-xref.ads ada/namet.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-sort.adb ada/lib-writ.ads ada/lib-xref.ads \
+ ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
+ ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads ada/sem_aggr.ads \
+ ada/sem_attr.ads ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch3.ads \
+ ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
+ ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \
+ ada/sem_eval.adb ada/sem_intr.ads ada/sem_mech.ads ada/sem_prag.ads \
+ ada/sem_prag.adb ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/sem_vfpt.ads ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads \
+ ada/sinput.adb ada/snames.ads ada/snames.adb ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
+ ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
+ ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/urealp.adb ada/validsw.ads ada/widechar.ads
+
+ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
+ ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
+ ada/csets.ads ada/debug.ads ada/debug_a.ads ada/debug_a.adb \
+ ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \
+ ada/errout.ads ada/erroutc.ads ada/eval_fat.ads ada/exp_aggr.ads \
+ ada/exp_ch2.ads ada/exp_ch7.ads ada/exp_disp.ads ada/exp_pakd.ads \
+ ada/exp_tss.ads ada/exp_util.ads ada/exp_util.adb ada/expander.ads \
+ ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/inline.ads ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads \
ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb \
ada/opt.ads ada/output.ads ada/restrict.ads ada/restrict.adb \
ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
ada/scng.adb ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \
- ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
- ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads ada/sem_eval.adb \
- ada/sem_intr.ads ada/sem_mech.ads ada/sem_prag.ads ada/sem_prag.adb \
- ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_vfpt.ads ada/sem_warn.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinfo-cn.ads ada/sinput.ads ada/sinput.adb \
- ada/snames.ads ada/snames.adb ada/stand.ads ada/stringt.ads \
+ ada/sem_cat.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads \
+ ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads \
+ ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads \
+ ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
+ ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/snames.ads ada/sprint.ads ada/stand.ads ada/stringt.ads \
ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
ada/styleg-c.ads ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
- ada/s-crc32.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \
- ada/widechar.ads
-
-ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
- ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
- ada/csets.ads ada/debug.ads ada/debug_a.ads ada/debug_a.adb \
- ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \
- ada/errout.ads ada/erroutc.ads ada/eval_fat.ads ada/exp_ch11.ads \
- ada/exp_ch2.ads ada/exp_ch7.ads ada/exp_tss.ads ada/exp_util.ads \
- ada/exp_util.adb ada/expander.ads ada/fname.ads ada/fname-uf.ads \
- ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_aggr.ads ada/sem_attr.ads ada/sem_cat.ads ada/sem_ch4.ads \
- ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_dist.ads \
- ada/sem_elab.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads \
- ada/sem_res.ads ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
- ada/s-carun8.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
@@ -3394,36 +3437,37 @@ ada/sem_smem.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/nlists.adb ada/opt.ads ada/output.ads ada/sem_smem.ads \
ada/sem_smem.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/snames.ads ada/stand.ads ada/system.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads
ada/sem_type.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
- ada/einfo.ads ada/einfo.adb ada/elists.ads ada/err_vars.ads \
- ada/errout.ads ada/erroutc.ads ada/exp_tss.ads ada/exp_util.ads \
- ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
- ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads \
- ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
- ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
- ada/sem.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_eval.ads \
- ada/sem_res.ads ada/sem_type.ads ada/sem_type.adb ada/sem_util.ads \
- ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/einfo.ads ada/einfo.adb ada/elists.ads ada/elists.adb \
+ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_tss.ads \
+ ada/exp_util.ads ada/fname.ads ada/freeze.ads ada/get_targ.ads \
+ ada/gnat.ads ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads \
+ ada/g-string.ads ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/interfac.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
+ ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \
+ ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads \
+ ada/scng.adb ada/sem.ads ada/sem_ch6.ads ada/sem_ch8.ads \
+ ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_type.adb \
+ ada/sem_util.ads ada/sem_util.adb ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_util.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/casing.adb ada/checks.ads \
@@ -3432,25 +3476,26 @@ ada/sem_util.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/eval_fat.ads ada/exp_tss.ads ada/exp_util.ads ada/fname.ads \
ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
- ada/lib.adb ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb \
- ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \
- ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sem.ads \
- ada/sem_cat.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_eval.ads \
- ada/sem_eval.adb ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/sem_warn.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/sinput.adb ada/snames.ads ada/stand.ads \
- ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads ada/system.ads \
- ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
- ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \
+ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
+ ada/lib-sort.adb ada/lib-xref.ads ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
+ ada/rtsfind.adb ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
+ ada/sem.ads ada/sem_cat.ads ada/sem_ch7.ads ada/sem_ch8.ads \
+ ada/sem_dist.ads ada/sem_eval.ads ada/sem_eval.adb ada/sem_res.ads \
+ ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/stand.ads ada/stringt.ads ada/stringt.adb \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \
+ ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
ada/widechar.ads
@@ -3462,12 +3507,12 @@ ada/sem_vfpt.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/rident.ads ada/sem_vfpt.ads ada/sem_vfpt.adb ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tree_io.ads ada/ttypef.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tree_io.ads \
+ ada/ttypef.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/sem_warn.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/checks.ads ada/csets.ads ada/debug.ads \
@@ -3475,10 +3520,10 @@ ada/sem_warn.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/errout.ads ada/erroutc.ads ada/exp_tss.ads ada/exp_util.ads \
ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/lib.ads \
- ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/lib-xref.ads \
- ada/namet.ads ada/namet.adb ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/opt.ads ada/output.ads ada/restrict.ads ada/rident.ads \
+ ada/g-utf_32.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \
+ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb \
+ ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/rident.ads \
ada/rtsfind.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
ada/sem.ads ada/sem_ch8.ads ada/sem_eval.ads ada/sem_res.ads \
ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb ada/sem_warn.ads \
@@ -3486,92 +3531,95 @@ ada/sem_warn.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads ada/types.ads \
- ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sinfo-cn.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/elists.ads \
ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/nlists.ads ada/nlists.adb \
- ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo-cn.ads \
- ada/sinfo-cn.adb ada/sinput.ads ada/snames.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads \
+ ada/sinfo-cn.ads ada/sinfo-cn.adb ada/sinput.ads ada/snames.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/sinfo.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/elists.ads \
ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/nlists.ads ada/nlists.adb \
- ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/system.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads
ada/sinput-c.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/alloc.ads ada/casing.ads ada/debug.ads ada/gnat.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
ada/namet.ads ada/opt.ads ada/output.ads ada/sinput.ads \
ada/sinput-c.ads ada/sinput-c.adb ada/system.ads ada/s-exctab.ads \
- ada/s-memory.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \
- ada/unchdeal.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
+ ada/unchconv.ads ada/unchdeal.ads
ada/sinput-d.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/casing.ads \
ada/debug.ads ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/opt.ads ada/osint.ads \
ada/osint-c.ads ada/output.ads ada/sinput.ads ada/sinput-d.ads \
ada/sinput-d.adb ada/system.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
- ada/unchconv.ads ada/unchdeal.ads
+ ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/sinput-l.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
ada/gnat.ads ada/g-dyntab.ads ada/g-dyntab.adb ada/g-hesorg.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/interfac.ads ada/namet.ads ada/nlists.ads \
- ada/nlists.adb ada/opt.ads ada/osint.ads ada/output.ads ada/prep.ads \
- ada/prepcomp.ads ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput-l.ads \
- ada/sinput-l.adb ada/snames.ads ada/stringt.ads ada/style.ads \
- ada/styleg.ads ada/styleg.adb ada/styleg-c.ads ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/g-utf_32.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/namet.ads \
+ ada/namet.adb ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads \
+ ada/output.ads ada/prep.ads ada/prepcomp.ads ada/scans.ads ada/scn.ads \
+ ada/scng.ads ada/scng.adb ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/sinput-l.ads ada/sinput-l.adb ada/snames.ads ada/stringt.ads \
+ ada/style.ads ada/styleg.ads ada/styleg.adb ada/styleg-c.ads \
+ ada/stylesw.ads ada/system.ads ada/s-crc32.ads ada/s-crc32.adb \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sinput.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/casing.ads \
ada/debug.ads ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads ada/namet.adb \
ada/opt.ads ada/output.ads ada/sinput.ads ada/sinput.adb ada/system.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-secsta.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
+ ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/widechar.ads
ada/snames.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/namet.ads ada/opt.ads ada/output.ads \
ada/snames.ads ada/snames.adb ada/system.ads ada/s-exctab.ads \
- ada/s-memory.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/sprint.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
@@ -3584,28 +3632,28 @@ ada/sprint.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sinput-d.ads ada/snames.ads ada/sprint.ads ada/sprint.adb \
ada/stand.ads ada/stringt.ads ada/stringt.adb ada/system.ads \
ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
ada/stand.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/namet.ads ada/opt.ads ada/output.ads ada/stand.ads \
ada/stand.adb ada/system.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
- ada/unchconv.ads ada/unchdeal.ads
+ ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/stringt.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/namet.ads ada/opt.ads ada/output.ads \
ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-carun8.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/types.adb ada/unchconv.ads \
- ada/unchdeal.ads
+ ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/types.adb \
+ ada/unchconv.ads ada/unchdeal.ads
ada/style.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
@@ -3617,11 +3665,11 @@ ada/style.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/snames.ads ada/stand.ads ada/style.ads ada/styleg.ads \
ada/styleg.adb ada/styleg-c.ads ada/styleg-c.adb ada/stylesw.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/styleg-c.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
@@ -3630,19 +3678,20 @@ ada/styleg-c.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/output.ads ada/sinfo.ads ada/sinput.ads ada/snames.ads \
ada/stand.ads ada/styleg.ads ada/styleg-c.ads ada/styleg-c.adb \
ada/stylesw.ads ada/system.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads
ada/styleg.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/casing.ads \
ada/csets.ads ada/debug.ads ada/err_vars.ads ada/gnat.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
ada/opt.ads ada/output.ads ada/scans.ads ada/sinput.ads ada/styleg.ads \
ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-exctab.ads \
- ada/s-memory.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads
ada/stylesw.o : ada/gnat.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/opt.ads ada/stylesw.ads ada/stylesw.adb \
@@ -3652,26 +3701,26 @@ ada/stylesw.o : ada/gnat.ads ada/g-string.ads ada/gnatvsn.ads \
ada/switch-b.o : ada/ada.ads ada/a-except.ads ada/debug.ads ada/gnat.ads \
ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads \
ada/opt.ads ada/osint.ads ada/switch.ads ada/switch-b.ads \
- ada/switch-b.adb ada/system.ads ada/s-exctab.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/types.ads \
- ada/unchconv.ads ada/unchdeal.ads
+ ada/switch-b.adb ada/system.ads ada/s-exctab.ads ada/s-parame.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/switch-c.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/lib.ads ada/opt.ads ada/osint.ads ada/output.ads \
ada/prepcomp.ads ada/stylesw.ads ada/switch.ads ada/switch-c.ads \
ada/switch-c.adb ada/system.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/validsw.ads
+ ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads ada/validsw.ads
ada/switch.o : ada/ada.ads ada/a-except.ads ada/switch.ads ada/switch.adb \
ada/system.ads ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/types.ads \
- ada/unchconv.ads ada/unchdeal.ads
+ ada/s-parame.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/system.o : ada/system.ads
@@ -3685,29 +3734,30 @@ ada/targparm.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/csets.ads \
ada/debug.ads ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads ada/namet.adb \
ada/opt.ads ada/osint.ads ada/output.ads ada/rident.ads ada/system.ads \
- ada/s-exctab.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-rident.ads \
- ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/targparm.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/widechar.ads
+ ada/s-exctab.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/targparm.adb ada/tree_io.ads ada/types.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
ada/tbuild.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
- ada/elists.ads ada/fname.ads ada/gnat.ads ada/g-hesora.ads \
- ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-sort.adb ada/namet.ads ada/namet.adb ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/rident.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/elists.ads ada/elists.adb ada/fname.ads ada/gnat.ads \
+ ada/g-hesora.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-sort.adb ada/namet.ads ada/namet.adb \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/restrict.ads ada/rident.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/system.ads ada/s-exctab.ads \
+ ada/s-htable.ads ada/s-imgenu.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/tree_gen.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/casing.ads ada/debug.ads ada/einfo.ads ada/elists.ads ada/fname.ads \
@@ -3716,17 +3766,17 @@ ada/tree_gen.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/osint.ads ada/osint-c.ads ada/output.ads ada/repinfo.ads \
ada/sinfo.ads ada/sinput.ads ada/snames.ads ada/stand.ads \
ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_gen.ads ada/tree_gen.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads
+ ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_gen.ads \
+ ada/tree_gen.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/tree_io.o : ada/ada.ads ada/a-except.ads ada/debug.ads ada/gnat.ads \
ada/g-os_lib.ads ada/g-string.ads ada/output.ads ada/system.ads \
- ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/tree_io.ads ada/tree_io.adb \
- ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-parame.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/tree_io.ads \
+ ada/tree_io.adb ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/treepr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/atree.adb ada/casing.ads ada/csets.ads ada/debug.ads ada/einfo.ads \
@@ -3738,20 +3788,21 @@ ada/treepr.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/sem_mech.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/treepr.ads ada/treepr.adb ada/treeprs.ads \
- ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/treepr.ads ada/treepr.adb \
+ ada/treeprs.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/treeprs.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/opt.ads ada/output.ads ada/sinfo.ads \
- ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/treeprs.ads ada/types.ads \
- ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/treeprs.ads \
+ ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads
ada/ttypef.o : ada/system.ads ada/ttypef.ads
@@ -3760,18 +3811,18 @@ ada/ttypes.o : ada/get_targ.ads ada/system.ads ada/s-exctab.ads \
ada/unchconv.ads ada/unchdeal.ads
ada/types.o : ada/ada.ads ada/a-except.ads ada/system.ads ada/s-carun8.ads \
- ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/types.ads ada/types.adb \
- ada/unchconv.ads ada/unchdeal.ads
+ ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-parame.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/types.ads \
+ ada/types.adb ada/unchconv.ads ada/unchdeal.ads
ada/uintp.o : ada/ada.ads ada/a-except.ads ada/a-uncdea.ads ada/alloc.ads \
ada/debug.ads ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads \
ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/opt.ads \
ada/output.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-htable.adb ada/s-memory.ads ada/s-stalib.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/s-htable.adb ada/s-memory.ads ada/s-parame.ads ada/s-stalib.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
ada/unchconv.ads ada/unchdeal.ads
ada/uname.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
@@ -3783,28 +3834,29 @@ ada/uname.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/atree.ads \
ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imgenu.ads \
- ada/s-memory.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/uname.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/s-memory.ads ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uintp.adb \
+ ada/uname.ads ada/uname.adb ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/urealp.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-htable.ads ada/g-os_lib.ads ada/g-string.ads \
ada/gnatvsn.ads ada/hostparm.ads ada/opt.ads ada/output.ads \
ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-memory.ads \
- ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/urealp.adb
+ ada/s-parame.ads ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
ada/usage.o : ada/ada.ads ada/a-except.ads ada/alloc.ads ada/debug.ads \
ada/gnat.ads ada/g-os_lib.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/namet.ads ada/opt.ads ada/osint.ads ada/output.ads \
- ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/tree_io.ads ada/types.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/usage.ads ada/usage.adb
+ ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-parame.ads \
+ ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/usage.ads ada/usage.adb
ada/validsw.o : ada/gnat.ads ada/g-string.ads ada/gnatvsn.ads \
ada/hostparm.ads ada/opt.ads ada/system.ads ada/s-exctab.ads \
@@ -3813,10 +3865,10 @@ ada/validsw.o : ada/gnat.ads ada/g-string.ads ada/gnatvsn.ads \
ada/widechar.o : ada/ada.ads ada/a-except.ads ada/gnat.ads \
ada/g-string.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \
- ada/opt.ads ada/system.ads ada/s-exctab.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcnv.ads ada/s-wchcnv.adb \
- ada/s-wchcon.ads ada/s-wchjis.ads ada/types.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/widechar.ads ada/widechar.adb
+ ada/opt.ads ada/system.ads ada/s-exctab.ads ada/s-parame.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcnv.ads \
+ ada/s-wchcnv.adb ada/s-wchcon.ads ada/s-wchjis.ads ada/types.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads ada/widechar.adb
# end of regular dependencies
diff --git a/gcc/ada/Makefile.in b/gcc/ada/Makefile.in
index f13fed7fb76..2d7224056fe 100644
--- a/gcc/ada/Makefile.in
+++ b/gcc/ada/Makefile.in
@@ -348,6 +348,11 @@ s-osprim.adb<s-osprim-posix.adb \
s-taprop.adb<s-taprop-dummy.adb \
s-taspri.ads<s-taspri-dummy.ads
+# When using the GCC exception handling mechanism, we need to use an
+# alternate body for a-exexpr.adb (a-exexpr-gcc.adb)
+
+EH_MECHANISM=
+
# Default shared object option. Note that we rely on the fact that the "soname"
# option will always be present and last in this flag, so that we can have
# $(SO_OPTS)libgnat-x.xx
@@ -381,103 +386,6 @@ LIB_VERSION = $(strip $(shell grep ' Library_Version :' $(fsrcpfx)gnatvsn.ads |
# $(strip STRING) removes leading and trailing spaces from STRING.
# If what's left is null then it's a match.
-ifeq ($(strip $(filter-out %86 os2 OS2 os2_emx,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-excpol.adb<a-excpol-abort.adb \
- a-intnam.ads<a-intnam-dummy.ads \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- s-inmaop.adb<s-inmaop-dummy.adb \
- s-interr.adb<s-interr-dummy.adb \
- s-intman.adb<s-intman-dummy.adb \
- s-osinte.adb<s-osinte-os2.adb \
- s-osinte.ads<s-osinte-os2.ads \
- s-osprim.adb<s-osprim-os2.adb \
- s-parame.adb<s-parame-os2.adb \
- system.ads<system-os2.ads \
- s-taprop.adb<s-taprop-os2.adb \
- s-taspri.ads<s-taspri-os2.ads
-
- EXTRA_GNATRTL_NONTASKING_OBJS = \
- i-os2err.o \
- i-os2lib.o \
- i-os2syn.o \
- i-os2thr.o
-endif
-
-ifeq ($(strip $(filter-out %86 interix%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-excpol.adb<a-excpol-interix.adb \
- a-intnam.ads<a-intnam-interix.ads \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- g-soccon.ads<g-soccon-interix.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-fsu.adb \
- s-osinte.ads<s-osinte-interix.ads \
- s-osprim.adb<s-osprim-unix.adb \
- s-taprop.adb<s-taprop-posix.adb \
- system.ads<system-interix.ads \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb
-
- THREADSLIB = -lgthreads -lmalloc
- PREFIX_OBJS=$(PREFIX_REAL_OBJS)
-endif
-
-# sysv5uw is SCO UnixWare 7
-ifeq ($(strip $(filter-out %86 sysv5uw%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
- a-excpol.adb<a-excpol-abort.adb \
- a-intnam.ads<a-intnam-unixware.ads \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.ads<s-osinte-unixware.ads \
- s-osinte.adb<s-osinte-unixware.adb \
- s-osprim.adb<s-osprim-unix.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- system.ads<system-unixware.ads \
- g-soccon.ads<g-soccon-unixware.ads \
- g-soliop.ads<g-soliop-unixware.ads
-
- THREADSLIB = -lthread
- PREFIX_OBJS=$(PREFIX_REAL_OBJS)
- SO_OPTS = -Wl,-h,
- GNATLIB_SHARED = gnatlib-shared-dual
- LIBRARY_VERSION := $(LIB_VERSION)
-endif
-
-ifeq ($(strip $(filter-out alpha% dec vx%,$(targ))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-vxworks.ads \
- a-numaux.ads<a-numaux-vxworks.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-interr.adb<s-interr-vxworks.adb \
- s-intman.ads<s-intman-vxworks.ads \
- s-intman.adb<s-intman-vxworks.adb \
- s-osinte.adb<s-osinte-vxworks.adb \
- s-osinte.ads<s-osinte-vxworks.ads \
- s-osprim.adb<s-osprim-vxworks.adb \
- s-parame.ads<s-parame-vxworks.ads \
- s-stchop.adb<s-stchop-vxworks.adb \
- s-taprop.adb<s-taprop-vxworks.adb \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
- s-taspri.ads<s-taspri-vxworks.ads \
- s-vxwork.ads<s-vxwork-alpha.ads \
- g-soccon.ads<g-soccon-vxworks.ads \
- g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- system.ads<system-vxworks-alpha.ads
-
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o
- EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
-endif
-
ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-vxworks.ads \
@@ -523,19 +431,16 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),)
s-interr.adb<s-interr-vxworks.adb \
s-intman.ads<s-intman-vxworks.ads \
s-intman.adb<s-intman-vxworks.adb \
- s-osinte.adb<s-osinte-vxworks.adb \
s-osinte.ads<s-osinte-vxworks.ads \
s-osprim.adb<s-osprim-vxworks.adb \
s-parame.ads<s-parame-vxworks.ads \
s-stchop.adb<s-stchop-vxworks.adb \
s-taprop.adb<s-taprop-vxworks.adb \
s-taspri.ads<s-taspri-vxworks.ads \
- s-tpopsp.adb<s-tpopsp-vxworks.adb \
s-vxwork.ads<s-vxwork-ppc.ads \
g-soccon.ads<g-soccon-vxworks.ads \
g-socthi.ads<g-socthi-vxworks.ads \
- g-socthi.adb<g-socthi-vxworks.adb \
- system.ads<system-vxworks-ppc.ads
+ g-socthi.adb<g-socthi-vxworks.adb
TOOLS_TARGET_PAIRS=mlib-tgt.adb<mlib-tgt-vxworks.adb
@@ -548,7 +453,22 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),)
s-tfsetr.adb<s-tfsetr-vxworks.adb
endif
- EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
+ ifeq ($(strip $(filter-out rtp,$(THREAD_KIND))),)
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.adb<s-osinte-vxworks-rtp.adb \
+ s-tpopsp.adb<s-tpopsp-vxworks-rtp.adb \
+ system.ads<system-vxworks-ppc-rtp.ads
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
+ else
+ LIBGNAT_TARGET_PAIRS += \
+ s-osinte.adb<s-osinte-vxworks.adb \
+ s-tpopsp.adb<s-tpopsp-vxworks.adb \
+ system.ads<system-vxworks-ppc.ads
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=i-vxwork.o i-vxwoio.o s-vxwexc.o
+ endif
+
EXTRA_GNATRTL_TASKING_OBJS=s-vxwork.o
endif
@@ -695,6 +615,7 @@ ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
TOOLS_TARGET_PAIRS=mlib-tgt.adb<mlib-tgt-solaris.adb
+ EH_MECHANISM=-gcc
THREADSLIB = -lposix4 -lthread
MISCLIB = -lposix4 -lnsl -lsocket
SO_OPTS = -Wl,-h,
@@ -703,24 +624,6 @@ ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
PREFIX_OBJS = $(PREFIX_REAL_OBJS)
LIBRARY_VERSION := $(LIB_VERSION)
- ifeq ($(strip $(filter-out fsu FSU,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-solaris.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-solaris.adb \
- s-osinte.adb<s-osinte-fsu.adb \
- s-osinte.ads<s-osinte-solaris-fsu.ads \
- s-osprim.adb<s-osprim-solaris.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb \
- g-soccon.ads<g-soccon-solaris.ads \
- g-soliop.ads<g-soliop-solaris.ads \
- system.ads<system-solaris-sparc.ads
-
- THREADSLIB = -lgthreads -lmalloc
- endif
-
ifeq ($(strip $(filter-out pthread PTHREAD,$(THREAD_KIND))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-solaris.ads \
@@ -753,7 +656,7 @@ ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
s-tasinf.ads<s-tasinf-solaris.ads \
s-taspri.ads<s-taspri-solaris.ads \
s-tpopsp.adb<s-tpopsp-solaris.adb \
- g-soccon.ads<g-soccon-solaris.ads \
+ g-soccon.ads<g-soccon-solaris-64.ads \
g-soliop.ads<g-soliop-solaris.ads \
system.ads<system-solaris-sparcv9.ads
endif
@@ -795,6 +698,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
a-intnam.ads<a-intnam-linux.ads \
a-numaux.adb<a-numaux-x86.adb \
a-numaux.ads<a-numaux-x86.ads \
+ g-soccon.ads<g-soccon-linux-x86.ads \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
s-osinte.adb<s-osinte-posix.adb \
@@ -810,29 +714,12 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
mlib-tgt.adb<mlib-tgt-linux.adb \
indepsw.adb<indepsw-gnu.adb
+ EH_MECHANISM=-gcc
THREADSLIB = -lpthread
GNATLIB_SHARED = gnatlib-shared-dual
GMEM_LIB = gmemlib
PREFIX_OBJS = $(PREFIX_REAL_OBJS)
LIBRARY_VERSION := $(LIB_VERSION)
-
- ifeq ($(strip $(filter-out fsu FSU,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-linux.ads \
- a-numaux.adb<a-numaux-x86.adb \
- a-numaux.ads<a-numaux-x86.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-fsu.adb \
- s-osinte.ads<s-osinte-linux-fsu.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb \
- system.ads<system-linux-x86.ads
-
- THREADSLIB = -lgthreads -lmalloc
- endif
endif
ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
@@ -893,6 +780,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
TOOLS_TARGET_PAIRS = \
mlib-tgt.adb<mlib-tgt-linux.adb
+ EH_MECHANISM=-gcc
THREADSLIB = -lpthread
GNATLIB_SHARED = gnatlib-shared-dual
PREFIX_OBJS = $(PREFIX_REAL_OBJS)
@@ -923,26 +811,15 @@ ifeq ($(strip $(filter-out mips sgi irix%,$(targ))),)
GNATLIB_SHARED = gnatlib-shared-default
else
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-irix.ads \
- s-inmaop.adb<s-inmaop-dummy.adb \
- s-interr.adb<s-interr-sigaction.adb \
- s-intman.adb<s-intman-irix-athread.adb \
+ LIBGNAT_TARGET_PAIRS += \
s-mastop.adb<s-mastop-irix.adb \
- s-osinte.adb<s-osinte-irix.adb \
- s-osinte.ads<s-osinte-irix-athread.ads \
s-osprim.adb<s-osprim-posix.adb \
- s-proinf.adb<s-proinf-irix-athread.adb \
- s-proinf.ads<s-proinf-irix-athread.ads \
- s-taprop.adb<s-taprop-irix-athread.adb \
- s-tasinf.adb<s-tasinf-irix-athread.adb \
- s-tasinf.ads<s-tasinf-irix-athread.ads \
- s-taspri.ads<s-taspri-posix.ads \
s-traceb.adb<s-traceb-mastop.adb \
g-soccon.ads<g-soccon-irix.ads \
system.ads<system-irix-o32.ads
endif
+ EH_MECHANISM=-gcc
TOOLS_TARGET_PAIRS = mlib-tgt.adb<mlib-tgt-irix.adb
TGT_LIB = -lexc
MISCLIB = -lexc
@@ -967,6 +844,7 @@ ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
g-soccon.ads<g-soccon-hpux.ads \
system.ads<system-hpux.ads
+ EH_MECHANISM=-gcc
PREFIX_OBJS = $(PREFIX_REAL_OBJS)
endif
@@ -987,6 +865,7 @@ ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
system.ads<system-hpux.ads
TOOLS_TARGET_PAIRS = mlib-tgt.adb<mlib-tgt-hpux.adb
+ EH_MECHANISM=-gcc
TGT_LIB = /usr/lib/libcl.a
THREADSLIB = -lpthread
GMEM_LIB = gmemlib
@@ -995,27 +874,6 @@ ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
PREFIX_OBJS = $(PREFIX_REAL_OBJS)
GNATLIB_SHARED = gnatlib-shared-dual
LIBRARY_VERSION := $(LIB_VERSION)
-
- ifeq ($(strip $(filter-out dce DCE,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS = \
- a-excpol.adb<a-excpol-abort.adb \
- a-intnam.ads<a-intnam-hpux.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-interr.adb<s-interr-sigaction.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-hpux-dce.adb \
- s-osinte.ads<s-osinte-hpux-dce.ads \
- s-parame.ads<s-parame-hpux.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-hpux-dce.adb \
- s-taspri.ads<s-taspri-hpux-dce.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb \
- g-soccon.ads<g-soccon-hpux.ads \
- system.ads<system-hpux.ads
-
- TGT_LIB =
- THREADSLIB = -lcma
- endif
endif
ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
@@ -1035,23 +893,6 @@ ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
THREADSLIB = -lpthreads
PREFIX_OBJS=$(PREFIX_REAL_OBJS)
- ifeq ($(strip $(filter-out fsu FSU,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-aix.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-fsu.adb \
- s-osinte.ads<s-osinte-aix-fsu.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb \
- g-soccon.ads<g-soccon-aix.ads \
- system.ads<system-aix.ads
-
- THREADSLIB = -lgthreads -lmalloc
- endif
-
TOOLS_TARGET_PAIRS = \
mlib-tgt.adb<mlib-tgt-aix.adb \
indepsw.adb<indepsw-aix.adb
@@ -1086,27 +927,13 @@ ifeq ($(strip $(filter-out lynxos,$(osys))),)
a-intnam.ads<a-intnam-lynxos.ads \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-lynxos-3.adb \
- s-osinte.ads<s-osinte-lynxos-3.ads \
+ s-osinte.adb<s-osinte-lynxos.adb \
+ s-osinte.ads<s-osinte-lynxos.ads \
s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
- s-tpopsp.adb<s-tpopsp-posix.adb \
+ s-taprop.adb<s-taprop-lynxos.adb \
+ s-taspri.ads<s-taspri-lynxos.ads \
+ s-tpopsp.adb<s-tpopsp-lynxos.adb \
system.ads<system-lynxos-ppc.ads
-
- ifeq ($(strip $(filter-out pthread PTHREAD,$(THREAD_KIND))),)
- LIBGNAT_TARGET_PAIRS = \
- a-intnam.ads<a-intnam-lynxos.ads \
- s-inmaop.adb<s-inmaop-posix.adb \
- s-intman.adb<s-intman-posix.adb \
- s-osinte.adb<s-osinte-lynxos.adb \
- s-osinte.ads<s-osinte-lynxos.ads \
- s-osprim.adb<s-osprim-posix.adb \
- s-taprop.adb<s-taprop-lynxos.adb \
- s-taspri.ads<s-taspri-lynxos.ads \
- s-tpopsp.adb<s-tpopsp-lynxos.adb \
- system.ads<system-lynxos-ppc.ads
- endif
endif
endif
@@ -1121,6 +948,8 @@ ifeq ($(strip $(filter-out rtems%,$(osys))),)
s-parame.adb<s-parame-rtems.adb \
s-taprop.adb<s-taprop-posix.adb \
s-taspri.ads<s-taspri-posix.ads \
+ s-auxdec.ads<s-auxdec-empty.ads \
+ s-auxdec.adb<s-auxdec-empty.adb \
s-tpopsp.adb<s-tpopsp-rtems.adb
endif
@@ -1143,6 +972,7 @@ ifeq ($(strip $(filter-out alpha% dec osf%,$(targ))),)
TOOLS_TARGET_PAIRS=mlib-tgt.adb<mlib-tgt-tru64.adb
+ EH_MECHANISM=-gcc
GMEM_LIB=gmemlib
THREADSLIB = -lpthread -lmach -lexc -lrt
PREFIX_OBJS = $(PREFIX_REAL_OBJS)
@@ -1150,42 +980,42 @@ ifeq ($(strip $(filter-out alpha% dec osf%,$(targ))),)
LIBRARY_VERSION := $(LIB_VERSION)
endif
-ifeq ($(strip $(filter-out alpha% ia64 dec hp vms% openvms% alphavms%,$(host))),)
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host))),)
soext = .exe
hyphen = _
LN = cp -p
LN_S = cp -p
-ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
-AR = iar
-endif
-
.SUFFIXES: .sym
.o.sym:
@ gnu:[bin]vmssymvec $<
endif
-ifeq ($(strip $(filter-out alpha% ia64 dec hp vms% openvms% alphavms%,$(targ))),)
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ))),)
ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
LIBGNAT_TARGET_PAIRS_AUX1 = \
g-enblsp.adb<g-enblsp-vms-ia64.adb \
+ g-trasym.adb<g-trasym-vms-ia64.adb \
s-auxdec.ads<s-auxdec-vms_64.ads \
s-crtl.ads<s-crtl-vms64.ads \
s-osinte.adb<s-osinte-vms-ia64.adb \
s-osinte.ads<s-osinte-vms-ia64.ads \
+ s-vaflop.adb<s-vaflop-vms-ia64.adb \
system.ads<system-vms_64.ads
else
-ifeq ($(strip $(filter-out alpha% dec vms% openvms% alphavms%,$(targ))),)
+ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
LIBGNAT_TARGET_PAIRS_AUX1 = \
g-enblsp.adb<g-enblsp-vms-alpha.adb \
+ g-trasym.adb<g-trasym-vms-alpha.adb \
s-asthan.adb<s-asthan-vms-alpha.adb \
- s-crtl.ads<s-crtl-vms.ads \
+ s-auxdec.ads<s-auxdec-vms_64.ads \
+ s-crtl.ads<s-crtl-vms64.ads \
s-osinte.adb<s-osinte-vms.adb \
s-osinte.ads<s-osinte-vms.ads \
s-vaflop.adb<s-vaflop-vms-alpha.adb \
- system.ads<system-vms-zcx.ads
+ system.ads<system-vms_64.ads
endif
endif
ifeq ($(strip $(filter-out express EXPRESS,$(THREAD_KIND))),)
@@ -1208,10 +1038,7 @@ endif
g-soccon.ads<g-soccon-vms.ads \
g-socthi.ads<g-socthi-vms.ads \
g-socthi.adb<g-socthi-vms.adb \
- g-trasym.adb<g-trasym-vms.adb \
i-cstrea.adb<i-cstrea-vms.adb \
- i-cpp.adb<i-cpp-vms.adb \
- interfac.ads<interfac-vms.ads \
s-inmaop.adb<s-inmaop-vms.adb \
s-interr.adb<s-interr-vms.adb \
s-intman.adb<s-intman-vms.adb \
@@ -1240,8 +1067,9 @@ else
symbols-processing.adb<symbols-processing-vms-alpha.adb
endif
+ EH_MECHANISM=-gcc
GNATLIB_SHARED=gnatlib-shared-vms
-ifeq ($(strip $(filter-out alpha% dec vms% openvms% alphavms%,$(targ))),)
+ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
EXTRA_LIBGNAT_SRCS=vmshandler.asm
EXTRA_LIBGNAT_OBJS=vmshandler.o
endif
@@ -1285,6 +1113,7 @@ ifeq ($(strip $(filter-out cygwin32% mingw32% pe,$(osys))),)
mlib-tgt.adb<mlib-tgt-mingw.adb \
indepsw.adb<indepsw-mingw.adb
+ EH_MECHANISM=-gcc
MISCLIB = -lwsock32
GMEM_LIB = gmemlib
PREFIX_OBJS = $(PREFIX_REAL_OBJS)
@@ -1301,6 +1130,7 @@ endif
ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
+ g-soccon.ads<g-soccon-linux-ppc.ads \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
s-osinte.adb<s-osinte-posix.adb \
@@ -1316,6 +1146,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(arch) $(osys))),)
mlib-tgt.adb<mlib-tgt-linux.adb \
indepsw.adb<indepsw-gnu.adb
+ EH_MECHANISM=-gcc
THREADSLIB = -lpthread
GNATLIB_SHARED = gnatlib-shared-dual
GMEM_LIB = gmemlib
@@ -1341,6 +1172,7 @@ ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
mlib-tgt.adb<mlib-tgt-linux.adb \
indepsw.adb<indepsw-gnu.adb
+ EH_MECHANISM=-gcc
THREADSLIB = -lpthread
GNATLIB_SHARED = gnatlib-shared-dual
GMEM_LIB = gmemlib
@@ -1366,6 +1198,7 @@ ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
mlib-tgt.adb<mlib-tgt-linux.adb \
indepsw.adb<indepsw-gnu.adb
+ EH_MECHANISM=-gcc
THREADSLIB = -lpthread
GNATLIB_SHARED = gnatlib-shared-dual
GMEM_LIB = gmemlib
@@ -1377,6 +1210,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
a-numaux.ads<a-numaux-libc-x86.ads \
+ g-soccon.ads<g-soccon-linux-64.ads \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
s-osinte.ads<s-osinte-linux.ads \
@@ -1391,6 +1225,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
mlib-tgt.adb<mlib-tgt-linux.adb \
indepsw.adb<indepsw-gnu.adb
+ EH_MECHANISM=-gcc
MISCLIB=
THREADSLIB=-lpthread
GNATLIB_SHARED=gnatlib-shared-dual
@@ -1416,6 +1251,7 @@ ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
mlib-tgt.adb<mlib-tgt-linux.adb \
indepsw.adb<indepsw-gnu.adb
+ EH_MECHANISM=-gcc
MISCLIB=
THREADSLIB=-lpthread
GNATLIB_SHARED=gnatlib-shared-dual
@@ -1428,6 +1264,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
a-intnam.ads<a-intnam-linux.ads \
a-numaux.adb<a-numaux-x86.adb \
a-numaux.ads<a-numaux-x86.ads \
+ g-soccon.ads<g-soccon-linux-64.ads \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
s-osinte.ads<s-osinte-linux.ads \
@@ -1442,6 +1279,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
mlib-tgt.adb<mlib-tgt-linux.adb \
indepsw.adb<indepsw-gnu.adb
+ EH_MECHANISM=-gcc
THREADSLIB=-lpthread
GNATLIB_SHARED=gnatlib-shared-dual
GMEM_LIB = gmemlib
@@ -1468,6 +1306,7 @@ ifeq ($(strip $(filter-out powerpc darwin%,$(arch) $(osys))),)
TOOLS_TARGET_PAIRS = \
mlib-tgt.adb<mlib-tgt-darwin.adb
+ EH_MECHANISM=-gcc
GNATLIB_SHARED = gnatlib-shared-darwin
SO_OPTS = -Wl,-flat_namespace
RANLIB = ranlib -c
@@ -1477,6 +1316,12 @@ ifeq ($(strip $(filter-out powerpc darwin%,$(arch) $(osys))),)
soext = .dylib
endif
+ifneq ($(EH_MECHANISM),)
+ LIBGNAT_TARGET_PAIRS += a-exexpr.adb<a-exexpr$(EH_MECHANISM).adb
+ EXTRA_LIBGNAT_SRCS+=raise$(EH_MECHANISM).c
+ EXTRA_LIBGNAT_OBJS+=raise$(EH_MECHANISM).o
+endif
+
# The runtime library for gnat comprises two directories. One contains the
# Ada source files that the compiler (gnat1) needs -- these files are listed
# by ADA_INCLUDE_SRCS -- and the other contains the object files and their
@@ -1493,8 +1338,8 @@ LIBGNAT_SRCS = ada.h adaint.c adaint.h argv.c cio.c cstreams.c \
$(EXTRA_LIBGNAT_SRCS)
LIBGNAT_OBJS = adaint.o argv.o cio.o cstreams.o ctrl_c.o errno.o exit.o \
- raise.o sysdep.o aux-io.o init.o initialize.o seh_init.o cal.o final.o \
- tracebak.o expect.o mkdir.o socket.o $(EXTRA_LIBGNAT_OBJS)
+ raise.o sysdep.o aux-io.o init.o initialize.o seh_init.o cal.o \
+ final.o tracebak.o expect.o mkdir.o socket.o $(EXTRA_LIBGNAT_OBJS)
# NOTE ??? - when the -I option for compiling Ada code is made to work,
# the library installation will change and there will be a
@@ -1665,7 +1510,7 @@ install-gnatlib: ../stamp-gnatlib
-$(INSTALL_DATA) rts/g-trasym$(objext) $(DESTDIR)$(ADA_RTL_OBJ_DIR)
-cd rts; for file in *$(arext);do \
$(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
- $(RANLIB) $(RANLIB_FLAGS) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \
+ $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \
done
-$(foreach file, $(EXTRA_ADALIB_FILES), \
$(INSTALL_DATA_DATE) rts/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \
@@ -1761,19 +1606,21 @@ gnatlib: ../stamp-gnatlib1 ../stamp-gnatlib2
-f ../Makefile \
$(GNATRTL_OBJS)
$(RM) rts/libgnat$(arext) rts/libgnarl$(arext)
- $(AR) $(AR_FLAGS) rts/libgnat$(arext) \
+ $(AR_FOR_TARGET) $(AR_FLAGS) rts/libgnat$(arext) \
$(addprefix rts/,$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS))
ifneq ($(PREFIX_OBJS),)
- $(AR) $(AR_FLAGS) rts/libgccprefix$(arext) $(PREFIX_OBJS);
- -$(RANLIB) rts/libgccprefix$(arext)
+ $(AR_FOR_TARGET) $(AR_FLAGS) rts/libgccprefix$(arext) \
+ $(PREFIX_OBJS);
+ $(RANLIB_FOR_TARGET) rts/libgccprefix$(arext)
endif
- -$(RANLIB) $(RANLIB_FLAGS) rts/libgnat$(arext)
- $(AR) $(AR_FLAGS) rts/libgnarl$(arext) \
+ $(RANLIB_FOR_TARGET) rts/libgnat$(arext)
+ $(AR_FOR_TARGET) $(AR_FLAGS) rts/libgnarl$(arext) \
$(addprefix rts/,$(GNATRTL_TASKING_OBJS))
- -$(RANLIB) $(RANLIB_FLAGS) rts/libgnarl$(arext)
+ $(RANLIB_FOR_TARGET) rts/libgnarl$(arext)
ifeq ($(GMEM_LIB),gmemlib)
- $(AR) $(AR_FLAGS) rts/libgmem$(arext) rts/memtrack.o
- -$(RANLIB) $(RANLIB_FLAGS) rts/libgmem$(arext)
+ $(AR_FOR_TARGET) $(AR_FLAGS) rts/libgmem$(arext) \
+ rts/memtrack.o
+ $(RANLIB_FOR_TARGET) rts/libgmem$(arext)
endif
$(CHMOD) a-wx rts/*.ali
touch ../stamp-gnatlib
@@ -1914,7 +1761,8 @@ gnatlib-shared:
TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
$(GNATLIB_SHARED)
-gnatlib-sjlj: ../stamp-gnatlib1
+gnatlib-sjlj:
+ $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="" ../stamp-gnatlib1
sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := False;/' rts/system.ads > rts/s.ads
$(MV) rts/s.ads rts/system.ads
$(MAKE) $(FLAGS_TO_PASS) \
@@ -1923,7 +1771,8 @@ gnatlib-sjlj: ../stamp-gnatlib1
THREAD_KIND="$(THREAD_KIND)" \
TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
-gnatlib-zcx: ../stamp-gnatlib1
+gnatlib-zcx:
+ $(MAKE) $(FLAGS_TO_PASS) EH_MECHANISM="-gcc" ../stamp-gnatlib1
sed -e 's/ZCX_By_Default.*/ZCX_By_Default : constant Boolean := True;/' rts/system.ads > rts/s.ads
$(MV) rts/s.ads rts/system.ads
$(MAKE) $(FLAGS_TO_PASS) \
@@ -1998,16 +1847,18 @@ adadecode.o : adadecode.c adadecode.h
aux-io.o : aux-io.c
argv.o : argv.c
cal.o : cal.c
-deftarg.o : deftarg.c
+deftarg.o : deftarg.c
errno.o : errno.c
-exit.o : raise.h exit.c
+exit.o : adaint.h exit.c
expect.o : expect.c
-final.o : raise.h final.c
+final.o : final.c
gmem.o : gmem.c
link.o : link.c
mkdir.o : mkdir.c
socket.o : socket.c gsocket.h
sysdep.o : sysdep.c
+raise-gcc.o : raise-gcc.c raise.h
+raise.o : raise.c raise.h
gen-soccon: gen-soccon.c gsocket.h
$(CC) $(ALL_CFLAGS) $(ADA_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
@@ -2032,10 +1883,6 @@ seh_init.o : seh_init.c raise.h
$(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) -O0 \
$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
-raise.o : raise.c raise.h
- $(CC) -c $(ALL_CFLAGS) $(ADA_CFLAGS) \
- $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
-
# Need to keep the frame pointer in this file to pop the stack properly on
# some targets.
tracebak.o : tracebak.c tb-alvms.c tb-alvxw.c
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index aa92689fb11..d1d34ee958f 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -391,9 +391,14 @@ GNATRTL_NONTASKING_OBJS= \
s-fatsfl$(objext) \
s-ficobl$(objext) \
s-fileio$(objext) \
+ s-filofl$(objext) \
+ s-fishfl$(objext) \
s-finimp$(objext) \
s-finroo$(objext) \
s-fore$(objext) \
+ s-fvadfl$(objext) \
+ s-fvaffl$(objext) \
+ s-fvagfl$(objext) \
s-geveop$(objext) \
s-htable$(objext) \
s-imgbiu$(objext) \
diff --git a/gcc/ada/a-astaco.adb b/gcc/ada/a-astaco.adb
index 1df42f37121..b13f426c0e4 100644
--- a/gcc/ada/a-astaco.adb
+++ b/gcc/ada/a-astaco.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-calend-mingw.adb b/gcc/ada/a-calend-mingw.adb
index 71599bd419c..0ec1ca94a8c 100644
--- a/gcc/ada/a-calend-mingw.adb
+++ b/gcc/ada/a-calend-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -33,6 +33,9 @@
-- This is the Windows NT/95 version
+-- Why do we need separate version ???
+-- Do we need *this* much code duplication???
+
with System.OS_Primitives;
-- used for Clock
@@ -173,7 +176,6 @@ package body Ada.Calendar is
DM : Month_Number;
DD : Day_Number;
DS : Day_Duration;
-
begin
Split (Date, DY, DM, DD, DS);
return DD;
@@ -203,7 +205,6 @@ package body Ada.Calendar is
DM : Month_Number;
DD : Day_Number;
DS : Day_Duration;
-
begin
Split (Date, DY, DM, DD, DS);
return DS;
@@ -366,7 +367,7 @@ package body Ada.Calendar is
Sub_Sec : constant Duration := Seconds - Duration (Int_Secs);
begin
Date := Time ((Now - epoch_1970) * system_time_ns / Sec_Unit) +
- Sub_Sec;
+ Sub_Sec;
end;
if Add_One_Day then
diff --git a/gcc/ada/a-calend-vms.adb b/gcc/ada/a-calend-vms.adb
index 391e9fb69a7..2a5c70f6bf8 100644
--- a/gcc/ada/a-calend-vms.adb
+++ b/gcc/ada/a-calend-vms.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-calend-vms.ads b/gcc/ada/a-calend-vms.ads
index 1242ef6d65b..ed3c9648458 100644
--- a/gcc/ada/a-calend-vms.ads
+++ b/gcc/ada/a-calend-vms.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-calend.adb b/gcc/ada/a-calend.adb
index c0180e4e995..581295818e1 100644
--- a/gcc/ada/a-calend.adb
+++ b/gcc/ada/a-calend.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-calend.ads b/gcc/ada/a-calend.ads
index 108d1a8883e..a394e2bbcaf 100644
--- a/gcc/ada/a-calend.ads
+++ b/gcc/ada/a-calend.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-cdlili.adb b/gcc/ada/a-cdlili.adb
index a0a6f3277f5..958a105a734 100644
--- a/gcc/ada/a-cdlili.adb
+++ b/gcc/ada/a-cdlili.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -34,6 +34,7 @@
------------------------------------------------------------------------------
with System; use type System.Address;
+
with Ada.Unchecked_Deallocation;
package body Ada.Containers.Doubly_Linked_Lists is
@@ -129,7 +130,8 @@ package body Ada.Containers.Doubly_Linked_Lists is
procedure Append
(Container : in out List;
New_Item : Element_Type;
- Count : Count_Type := 1) is
+ Count : Count_Type := 1)
+ is
begin
Insert (Container, No_Element, New_Item, Count);
end Append;
@@ -185,7 +187,8 @@ package body Ada.Containers.Doubly_Linked_Lists is
function Contains
(Container : List;
- Item : Element_Type) return Boolean is
+ Item : Element_Type) return Boolean
+ is
begin
return Find (Container, Item) /= No_Element;
end Contains;
@@ -202,8 +205,6 @@ package body Ada.Containers.Doubly_Linked_Lists is
X : Node_Access;
begin
- pragma Assert (Vet (Position), "bad cursor in Delete");
-
if Position.Node = null then
raise Constraint_Error;
end if;
@@ -212,13 +213,16 @@ package body Ada.Containers.Doubly_Linked_Lists is
raise Program_Error;
end if;
+ pragma Assert (Vet (Position), "bad cursor in Delete");
+
if Position.Node = Container.First then
Delete_First (Container, Count);
- Position := First (Container);
+ Position := No_Element; -- Post-York behavior
return;
end if;
if Count = 0 then
+ Position := No_Element; -- Post-York behavior
return;
end if;
@@ -247,6 +251,8 @@ package body Ada.Containers.Doubly_Linked_Lists is
Free (X);
end loop;
+
+ Position := No_Element; -- Post-York behavior
end Delete;
------------------
@@ -329,12 +335,12 @@ package body Ada.Containers.Doubly_Linked_Lists is
function Element (Position : Cursor) return Element_Type is
begin
- pragma Assert (Vet (Position), "bad cursor in Element");
-
if Position.Node = null then
raise Constraint_Error;
end if;
+ pragma Assert (Vet (Position), "bad cursor in Element");
+
return Position.Node.Element;
end Element;
@@ -354,11 +360,11 @@ package body Ada.Containers.Doubly_Linked_Lists is
Node := Container.First;
else
- pragma Assert (Vet (Position), "bad cursor in Find");
-
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
+
+ pragma Assert (Vet (Position), "bad cursor in Find");
end if;
while Node /= null loop
@@ -604,12 +610,12 @@ package body Ada.Containers.Doubly_Linked_Lists is
New_Node : Node_Access;
begin
- pragma Assert (Vet (Before), "bad cursor in Insert");
+ if Before.Container /= null then
+ if Before.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- if Before.Container /= null
- and then Before.Container /= Container'Unrestricted_Access
- then
- raise Program_Error;
+ pragma Assert (Vet (Before), "bad cursor in Insert");
end if;
if Count = 0 then
@@ -656,12 +662,12 @@ package body Ada.Containers.Doubly_Linked_Lists is
New_Node : Node_Access;
begin
- pragma Assert (Vet (Before), "bad cursor in Insert");
+ if Before.Container /= null then
+ if Before.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- if Before.Container /= null
- and then Before.Container /= Container'Unrestricted_Access
- then
- raise Program_Error;
+ pragma Assert (Vet (Before), "bad cursor in Insert");
end if;
if Count = 0 then
@@ -937,12 +943,12 @@ package body Ada.Containers.Doubly_Linked_Lists is
Process : not null access procedure (Element : in Element_Type))
is
begin
- pragma Assert (Vet (Position), "bad cursor in Query_Element");
-
if Position.Node = null then
raise Constraint_Error;
end if;
+ pragma Assert (Vet (Position), "bad cursor in Query_Element");
+
declare
C : List renames Position.Container.all'Unrestricted_Access.all;
B : Natural renames C.Busy;
@@ -1018,97 +1024,46 @@ package body Ada.Containers.Doubly_Linked_Lists is
end loop;
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
- (Position : Cursor;
- By : Element_Type)
+ (Container : in out List;
+ Position : Cursor;
+ New_Item : Element_Type)
is
begin
- pragma Assert (Vet (Position), "bad cursor in Replace_Element");
-
if Position.Container = null then
raise Constraint_Error;
end if;
- if Position.Container.Lock > 0 then
+ if Position.Container /= Container'Unchecked_Access then
raise Program_Error;
end if;
- Position.Node.Element := By;
- end Replace_Element;
-
- ------------------
- -- Reverse_Find --
- ------------------
-
- function Reverse_Find
- (Container : List;
- Item : Element_Type;
- Position : Cursor := No_Element) return Cursor
- is
- Node : Node_Access := Position.Node;
-
- begin
- if Node = null then
- Node := Container.Last;
-
- else
- pragma Assert (Vet (Position), "bad cursor in Reverse_Find");
-
- if Position.Container /= Container'Unrestricted_Access then
- raise Program_Error;
- end if;
+ if Container.Lock > 0 then
+ raise Program_Error;
end if;
- while Node /= null loop
- if Node.Element = Item then
- return Cursor'(Container'Unchecked_Access, Node);
- end if;
-
- Node := Node.Prev;
- end loop;
-
- return No_Element;
- end Reverse_Find;
-
- ---------------------
- -- Reverse_Iterate --
- ---------------------
-
- procedure Reverse_Iterate
- (Container : List;
- Process : not null access procedure (Position : Cursor))
- is
- C : List renames Container'Unrestricted_Access.all;
- B : Natural renames C.Busy;
-
- Node : Node_Access := Container.Last;
-
- begin
- B := B + 1;
-
- begin
- while Node /= null loop
- Process (Cursor'(Container'Unchecked_Access, Node));
- Node := Node.Prev;
- end loop;
- exception
- when others =>
- B := B - 1;
- raise;
- end;
+ pragma Assert (Vet (Position), "bad cursor in Replace_Element");
- B := B - 1;
- end Reverse_Iterate;
+ Position.Node.Element := New_Item;
+ end Replace_Element;
- ------------------
- -- Reverse_List --
- ------------------
+ ----------------------
+ -- Reverse_Elements --
+ ----------------------
- procedure Reverse_List (Container : in out List) is
+ procedure Reverse_Elements (Container : in out List) is
I : Node_Access := Container.First;
J : Node_Access := Container.Last;
@@ -1152,7 +1107,7 @@ package body Ada.Containers.Doubly_Linked_Lists is
end if;
end Swap;
- -- Start of processing for Reverse_List
+ -- Start of processing for Reverse_Elements
begin
if Container.Length <= 1 then
@@ -1188,7 +1143,72 @@ package body Ada.Containers.Doubly_Linked_Lists is
pragma Assert (Container.First.Prev = null);
pragma Assert (Container.Last.Next = null);
- end Reverse_List;
+ end Reverse_Elements;
+
+ ------------------
+ -- Reverse_Find --
+ ------------------
+
+ function Reverse_Find
+ (Container : List;
+ Item : Element_Type;
+ Position : Cursor := No_Element) return Cursor
+ is
+ Node : Node_Access := Position.Node;
+
+ begin
+ if Node = null then
+ Node := Container.Last;
+
+ else
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position), "bad cursor in Reverse_Find");
+ end if;
+
+ while Node /= null loop
+ if Node.Element = Item then
+ return Cursor'(Container'Unchecked_Access, Node);
+ end if;
+
+ Node := Node.Prev;
+ end loop;
+
+ return No_Element;
+ end Reverse_Find;
+
+ ---------------------
+ -- Reverse_Iterate --
+ ---------------------
+
+ procedure Reverse_Iterate
+ (Container : List;
+ Process : not null access procedure (Position : Cursor))
+ is
+ C : List renames Container'Unrestricted_Access.all;
+ B : Natural renames C.Busy;
+
+ Node : Node_Access := Container.Last;
+
+ begin
+ B := B + 1;
+
+ begin
+ while Node /= null loop
+ Process (Cursor'(Container'Unchecked_Access, Node));
+ Node := Node.Prev;
+ end loop;
+
+ exception
+ when others =>
+ B := B - 1;
+ raise;
+ end;
+
+ B := B - 1;
+ end Reverse_Iterate;
------------
-- Splice --
@@ -1200,12 +1220,12 @@ package body Ada.Containers.Doubly_Linked_Lists is
Source : in out List)
is
begin
- pragma Assert (Vet (Before), "bad cursor in Splice");
+ if Before.Container /= null then
+ if Before.Container /= Target'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- if Before.Container /= null
- and then Before.Container /= Target'Unrestricted_Access
- then
- raise Program_Error;
+ pragma Assert (Vet (Before), "bad cursor in Splice");
end if;
if Target'Address = Source'Address
@@ -1274,13 +1294,12 @@ package body Ada.Containers.Doubly_Linked_Lists is
Position : Cursor)
is
begin
- pragma Assert (Vet (Before), "bad Before cursor in Splice");
- pragma Assert (Vet (Position), "bad Position cursor in Splice");
+ if Before.Container /= null then
+ if Before.Container /= Target'Unchecked_Access then
+ raise Program_Error;
+ end if;
- if Before.Container /= null
- and then Before.Container /= Target'Unchecked_Access
- then
- raise Program_Error;
+ pragma Assert (Vet (Before), "bad Before cursor in Splice");
end if;
if Position.Node = null then
@@ -1291,6 +1310,8 @@ package body Ada.Containers.Doubly_Linked_Lists is
raise Program_Error;
end if;
+ pragma Assert (Vet (Position), "bad Position cursor in Splice");
+
if Position.Node = Before.Node
or else Position.Node.Next = Before.Node
then
@@ -1378,13 +1399,12 @@ package body Ada.Containers.Doubly_Linked_Lists is
return;
end if;
- pragma Assert (Vet (Before), "bad Before cursor in Splice");
- pragma Assert (Vet (Position), "bad Position cursor in Splice");
+ if Before.Container /= null then
+ if Before.Container /= Target'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- if Before.Container /= null
- and then Before.Container /= Target'Unrestricted_Access
- then
- raise Program_Error;
+ pragma Assert (Vet (Before), "bad Before cursor in Splice");
end if;
if Position.Node = null then
@@ -1395,6 +1415,8 @@ package body Ada.Containers.Doubly_Linked_Lists is
raise Program_Error;
end if;
+ pragma Assert (Vet (Position), "bad Position cursor in Splice");
+
if Target.Length = Count_Type'Last then
raise Constraint_Error;
end if;
@@ -1474,18 +1496,20 @@ package body Ada.Containers.Doubly_Linked_Lists is
-- Swap --
----------
- procedure Swap (I, J : Cursor) is
+ procedure Swap
+ (Container : in out List;
+ I, J : Cursor)
+ is
begin
- pragma Assert (Vet (I), "bad I cursor in Swap");
- pragma Assert (Vet (J), "bad J cursor in Swap");
-
if I.Node = null
or else J.Node = null
then
raise Constraint_Error;
end if;
- if I.Container /= J.Container then
+ if I.Container /= Container'Unchecked_Access
+ or else J.Container /= Container'Unchecked_Access
+ then
raise Program_Error;
end if;
@@ -1493,15 +1517,19 @@ package body Ada.Containers.Doubly_Linked_Lists is
return;
end if;
- if I.Container.Lock > 0 then
+ if Container.Lock > 0 then
raise Program_Error;
end if;
+ pragma Assert (Vet (I), "bad I cursor in Swap");
+ pragma Assert (Vet (J), "bad J cursor in Swap");
+
declare
EI : Element_Type renames I.Node.Element;
EJ : Element_Type renames J.Node.Element;
EI_Copy : constant Element_Type := EI;
+
begin
EI := EJ;
EJ := EI_Copy;
@@ -1514,11 +1542,9 @@ package body Ada.Containers.Doubly_Linked_Lists is
procedure Swap_Links
(Container : in out List;
- I, J : Cursor) is
+ I, J : Cursor)
+ is
begin
- pragma Assert (Vet (I), "bad I cursor in Swap_Links");
- pragma Assert (Vet (J), "bad J cursor in Swap_Links");
-
if I.Node = null
or else J.Node = null
then
@@ -1539,6 +1565,9 @@ package body Ada.Containers.Doubly_Linked_Lists is
raise Program_Error;
end if;
+ pragma Assert (Vet (I), "bad I cursor in Swap_Links");
+ pragma Assert (Vet (J), "bad J cursor in Swap_Links");
+
declare
I_Next : constant Cursor := Next (I);
@@ -1570,20 +1599,24 @@ package body Ada.Containers.Doubly_Linked_Lists is
--------------------
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Element : in out Element_Type))
+ (Container : in out List;
+ Position : Cursor;
+ Process : not null access procedure (Element : in out Element_Type))
is
begin
- pragma Assert (Vet (Position), "bad cursor in Update_Element");
-
if Position.Node = null then
raise Constraint_Error;
end if;
+ if Position.Container /= Container'Unchecked_Access then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position), "bad cursor in Update_Element");
+
declare
- C : List renames Position.Container.all'Unrestricted_Access.all;
- B : Natural renames C.Busy;
- L : Natural renames C.Lock;
+ B : Natural renames Container.Busy;
+ L : Natural renames Container.Lock;
begin
B := B + 1;
@@ -1761,4 +1794,12 @@ package body Ada.Containers.Doubly_Linked_Lists is
end loop;
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Doubly_Linked_Lists;
diff --git a/gcc/ada/a-cdlili.ads b/gcc/ada/a-cdlili.ads
index 70c0f806f5b..3682104cba9 100644
--- a/gcc/ada/a-cdlili.ads
+++ b/gcc/ada/a-cdlili.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -63,49 +63,51 @@ package Ada.Containers.Doubly_Linked_Lists is
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out List;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Element : in out Element_Type));
-
- procedure Replace_Element
- (Position : Cursor;
- By : Element_Type);
+ (Container : in out List;
+ Position : Cursor;
+ Process : not null access procedure (Element : in out Element_Type));
procedure Move
(Target : in out List;
Source : in out List);
- procedure Prepend
+ procedure Insert
(Container : in out List;
+ Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1);
- procedure Append
+ procedure Insert
(Container : in out List;
+ Before : Cursor;
New_Item : Element_Type;
+ Position : out Cursor;
Count : Count_Type := 1);
procedure Insert
(Container : in out List;
Before : Cursor;
- New_Item : Element_Type;
+ Position : out Cursor;
Count : Count_Type := 1);
- procedure Insert
+ procedure Prepend
(Container : in out List;
- Before : Cursor;
New_Item : Element_Type;
- Position : out Cursor;
Count : Count_Type := 1);
- procedure Insert
+ procedure Append
(Container : in out List;
- Before : Cursor;
- Position : out Cursor;
+ New_Item : Element_Type;
Count : Count_Type := 1);
procedure Delete
@@ -121,21 +123,11 @@ package Ada.Containers.Doubly_Linked_Lists is
(Container : in out List;
Count : Count_Type := 1);
- generic
- with function "<" (Left, Right : Element_Type) return Boolean is <>;
- package Generic_Sorting is
-
- function Is_Sorted (Container : List) return Boolean;
-
- procedure Sort (Container : in out List);
+ procedure Reverse_Elements (Container : in out List);
- procedure Merge (Target, Source : in out List);
-
- end Generic_Sorting;
-
- procedure Reverse_List (Container : in out List);
-
- procedure Swap (I, J : Cursor);
+ procedure Swap
+ (Container : in out List;
+ I, J : Cursor);
procedure Swap_Links
(Container : in out List;
@@ -149,13 +141,13 @@ package Ada.Containers.Doubly_Linked_Lists is
procedure Splice
(Target : in out List;
Before : Cursor;
- Position : Cursor);
+ Source : in out List;
+ Position : in out Cursor);
procedure Splice
(Target : in out List;
Before : Cursor;
- Source : in out List;
- Position : in out Cursor);
+ Position : Cursor);
function First (Container : List) return Cursor;
@@ -165,9 +157,13 @@ package Ada.Containers.Doubly_Linked_Lists is
function Last_Element (Container : List) return Element_Type;
- function Contains
- (Container : List;
- Item : Element_Type) return Boolean;
+ function Next (Position : Cursor) return Cursor;
+
+ procedure Next (Position : in out Cursor);
+
+ function Previous (Position : Cursor) return Cursor;
+
+ procedure Previous (Position : in out Cursor);
function Find
(Container : List;
@@ -179,13 +175,9 @@ package Ada.Containers.Doubly_Linked_Lists is
Item : Element_Type;
Position : Cursor := No_Element) return Cursor;
- function Next (Position : Cursor) return Cursor;
-
- function Previous (Position : Cursor) return Cursor;
-
- procedure Next (Position : in out Cursor);
-
- procedure Previous (Position : in out Cursor);
+ function Contains
+ (Container : List;
+ Item : Element_Type) return Boolean;
function Has_Element (Position : Cursor) return Boolean;
@@ -197,6 +189,18 @@ package Ada.Containers.Doubly_Linked_Lists is
(Container : List;
Process : not null access procedure (Position : Cursor));
+ generic
+ with function "<" (Left, Right : Element_Type) return Boolean is <>;
+ package Generic_Sorting is
+
+ function Is_Sorted (Container : List) return Boolean;
+
+ procedure Sort (Container : in out List);
+
+ procedure Merge (Target, Source : in out List);
+
+ end Generic_Sorting;
+
private
type Node_Type;
type Node_Access is access Node_Type;
@@ -248,6 +252,18 @@ private
Node : Node_Access;
end record;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
+
+ for Cursor'Write use Write;
+
No_Element : constant Cursor := Cursor'(null, null);
end Ada.Containers.Doubly_Linked_Lists;
diff --git a/gcc/ada/a-cgaaso.adb b/gcc/ada/a-cgaaso.adb
index 6727c034d2e..cd4cfaba076 100644
--- a/gcc/ada/a-cgaaso.adb
+++ b/gcc/ada/a-cgaaso.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-cgaaso.ads b/gcc/ada/a-cgaaso.ads
index 6f8cb1d502e..e9d031990d7 100644
--- a/gcc/ada/a-cgaaso.ads
+++ b/gcc/ada/a-cgaaso.ads
@@ -7,7 +7,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-cgarso.adb b/gcc/ada/a-cgarso.adb
index 60eef4cae73..8d5a08b4f14 100644
--- a/gcc/ada/a-cgarso.adb
+++ b/gcc/ada/a-cgarso.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-cgcaso.adb b/gcc/ada/a-cgcaso.adb
index 73cfac69d4b..bef6fb0793a 100644
--- a/gcc/ada/a-cgcaso.adb
+++ b/gcc/ada/a-cgcaso.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-chacon.adb b/gcc/ada/a-chacon.adb
index 4049b937580..9884337fea7 100755
--- a/gcc/ada/a-chacon.adb
+++ b/gcc/ada/a-chacon.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-chacon.ads b/gcc/ada/a-chacon.ads
index 7c36c817784..9ce9337291e 100755
--- a/gcc/ada/a-chacon.ads
+++ b/gcc/ada/a-chacon.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-chahan.adb b/gcc/ada/a-chahan.adb
index 3af220ef05d..61a23d858db 100644
--- a/gcc/ada/a-chahan.adb
+++ b/gcc/ada/a-chahan.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,9 +31,9 @@
-- --
------------------------------------------------------------------------------
-with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
-with Ada.Strings.Maps; use Ada.Strings.Maps;
-with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
+with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
+with Ada.Strings.Maps; use Ada.Strings.Maps;
+with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
package body Ada.Characters.Handling is
diff --git a/gcc/ada/a-chahan.ads b/gcc/ada/a-chahan.ads
index 7bc2ded790b..ccb5825b9bb 100644
--- a/gcc/ada/a-chahan.ads
+++ b/gcc/ada/a-chahan.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-chlat9.ads b/gcc/ada/a-chlat9.ads
index 30f351af829..b183a477fad 100644
--- a/gcc/ada/a-chlat9.ads
+++ b/gcc/ada/a-chlat9.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-chtgke.adb b/gcc/ada/a-chtgke.adb
index 2caddad7ce2..5203890a594 100644
--- a/gcc/ada/a-chtgke.adb
+++ b/gcc/ada/a-chtgke.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-chtgke.ads b/gcc/ada/a-chtgke.ads
index e56c31b3f4e..de91de72c07 100644
--- a/gcc/ada/a-chtgke.ads
+++ b/gcc/ada/a-chtgke.ads
@@ -7,7 +7,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-chtgop.adb b/gcc/ada/a-chtgop.adb
index 9793f967e01..137b27c0061 100644
--- a/gcc/ada/a-chtgop.adb
+++ b/gcc/ada/a-chtgop.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-chzla1.ads b/gcc/ada/a-chzla1.ads
index 13496b66dc0..f6ffe5bd195 100644
--- a/gcc/ada/a-chzla1.ads
+++ b/gcc/ada/a-chzla1.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-chzla9.ads b/gcc/ada/a-chzla9.ads
index 67459241dc7..8e95cb6f4f3 100644
--- a/gcc/ada/a-chzla9.ads
+++ b/gcc/ada/a-chzla9.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-cidlli.adb b/gcc/ada/a-cidlli.adb
index becdae2ecb5..46d94449b03 100644
--- a/gcc/ada/a-cidlli.adb
+++ b/gcc/ada/a-cidlli.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -211,7 +211,8 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
function Contains
(Container : List;
- Item : Element_Type) return Boolean is
+ Item : Element_Type) return Boolean
+ is
begin
return Find (Container, Item) /= No_Element;
end Contains;
@@ -228,23 +229,28 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
X : Node_Access;
begin
- pragma Assert (Vet (Position), "bad cursor in Delete");
-
if Position.Node = null then
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
+ pragma Assert (Vet (Position), "bad cursor in Delete");
+
if Position.Node = Container.First then
Delete_First (Container, Count);
- Position := First (Container);
+ Position := No_Element; -- Post-York behavior
return;
end if;
if Count = 0 then
+ Position := No_Element; -- Post-York behavior
return;
end if;
@@ -273,6 +279,8 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
Free (X);
end loop;
+
+ Position := No_Element; -- Post-York behavior
end Delete;
------------------
@@ -355,12 +363,16 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
function Element (Position : Cursor) return Element_Type is
begin
- pragma Assert (Vet (Position), "bad cursor in Element");
-
if Position.Node = null then
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position), "bad cursor in Element");
+
return Position.Node.Element.all;
end Element;
@@ -380,11 +392,15 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
Node := Container.First;
else
- pragma Assert (Vet (Position), "bad cursor in Find");
+ if Node.Element = null then
+ raise Program_Error;
+ end if;
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
+
+ pragma Assert (Vet (Position), "bad cursor in Find");
end if;
while Node /= null loop
@@ -635,12 +651,18 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
New_Node : Node_Access;
begin
- pragma Assert (Vet (Before), "bad cursor in Insert");
+ if Before.Container /= null then
+ if Before.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- if Before.Container /= null
- and then Before.Container /= Container'Unrestricted_Access
- then
- raise Program_Error;
+ if Before.Node = null
+ or else Before.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Before), "bad cursor in Insert");
end if;
if Count = 0 then
@@ -942,12 +964,16 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
Process : not null access procedure (Element : in Element_Type))
is
begin
- pragma Assert (Vet (Position), "bad cursor in Query_Element");
-
if Position.Node = null then
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position), "bad cursor in Query_Element");
+
declare
C : List renames Position.Container.all'Unrestricted_Access.all;
B : Natural renames C.Busy;
@@ -1024,102 +1050,56 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
end loop;
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
- (Position : Cursor;
- By : Element_Type)
+ (Container : in out List;
+ Position : Cursor;
+ New_Item : Element_Type)
is
begin
- pragma Assert (Vet (Position), "bad cursor in Replace_Element");
-
if Position.Container = null then
raise Constraint_Error;
end if;
- if Position.Container.Lock > 0 then
+ if Position.Container /= Container'Unchecked_Access then
raise Program_Error;
end if;
- declare
- X : Element_Access := Position.Node.Element;
- begin
- Position.Node.Element := new Element_Type'(By);
- Free (X);
- end;
- end Replace_Element;
-
- ------------------
- -- Reverse_Find --
- ------------------
-
- function Reverse_Find
- (Container : List;
- Item : Element_Type;
- Position : Cursor := No_Element) return Cursor
- is
- Node : Node_Access := Position.Node;
-
- begin
- if Node = null then
- Node := Container.Last;
-
- else
- pragma Assert (Vet (Position), "bad cursor in Reverse_Find");
-
- if Position.Container /= Container'Unrestricted_Access then
- raise Program_Error;
- end if;
+ if Position.Container.Lock > 0 then
+ raise Program_Error;
end if;
- while Node /= null loop
- if Node.Element.all = Item then
- return Cursor'(Container'Unchecked_Access, Node);
- end if;
-
- Node := Node.Prev;
- end loop;
-
- return No_Element;
- end Reverse_Find;
-
- ---------------------
- -- Reverse_Iterate --
- ---------------------
-
- procedure Reverse_Iterate
- (Container : List;
- Process : not null access procedure (Position : in Cursor))
- is
- C : List renames Container'Unrestricted_Access.all;
- B : Natural renames C.Busy;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
- Node : Node_Access := Container.Last;
+ pragma Assert (Vet (Position), "bad cursor in Replace_Element");
- begin
- B := B + 1;
+ declare
+ X : Element_Access := Position.Node.Element;
begin
- while Node /= null loop
- Process (Cursor'(Container'Unchecked_Access, Node));
- Node := Node.Prev;
- end loop;
- exception
- when others =>
- B := B - 1;
- raise;
+ Position.Node.Element := new Element_Type'(New_Item);
+ Free (X);
end;
+ end Replace_Element;
- B := B - 1;
- end Reverse_Iterate;
-
- ------------------
- -- Reverse_List --
- ------------------
+ ----------------------
+ -- Reverse_Elements --
+ ----------------------
- procedure Reverse_List (Container : in out List) is
+ procedure Reverse_Elements (Container : in out List) is
I : Node_Access := Container.First;
J : Node_Access := Container.Last;
@@ -1163,7 +1143,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
end if;
end Swap;
- -- Start of processing for Reverse_List
+ -- Start of processing for Reverse_Elements
begin
if Container.Length <= 1 then
@@ -1199,7 +1179,75 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
pragma Assert (Container.First.Prev = null);
pragma Assert (Container.Last.Next = null);
- end Reverse_List;
+ end Reverse_Elements;
+
+ ------------------
+ -- Reverse_Find --
+ ------------------
+
+ function Reverse_Find
+ (Container : List;
+ Item : Element_Type;
+ Position : Cursor := No_Element) return Cursor
+ is
+ Node : Node_Access := Position.Node;
+
+ begin
+ if Node = null then
+ Node := Container.Last;
+
+ else
+ if Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position), "bad cursor in Reverse_Find");
+ end if;
+
+ while Node /= null loop
+ if Node.Element.all = Item then
+ return Cursor'(Container'Unchecked_Access, Node);
+ end if;
+
+ Node := Node.Prev;
+ end loop;
+
+ return No_Element;
+ end Reverse_Find;
+
+ ---------------------
+ -- Reverse_Iterate --
+ ---------------------
+
+ procedure Reverse_Iterate
+ (Container : List;
+ Process : not null access procedure (Position : in Cursor))
+ is
+ C : List renames Container'Unrestricted_Access.all;
+ B : Natural renames C.Busy;
+
+ Node : Node_Access := Container.Last;
+
+ begin
+ B := B + 1;
+
+ begin
+ while Node /= null loop
+ Process (Cursor'(Container'Unchecked_Access, Node));
+ Node := Node.Prev;
+ end loop;
+ exception
+ when others =>
+ B := B - 1;
+ raise;
+ end;
+
+ B := B - 1;
+ end Reverse_Iterate;
------------
-- Splice --
@@ -1211,12 +1259,18 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
Source : in out List)
is
begin
- pragma Assert (Vet (Before), "bad cursor in Splice");
+ if Before.Container /= null then
+ if Before.Container /= Target'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- if Before.Container /= null
- and then Before.Container /= Target'Unrestricted_Access
- then
- raise Program_Error;
+ if Before.Node = null
+ or else Before.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Before), "bad cursor in Splice");
end if;
if Target'Address = Source'Address
@@ -1284,23 +1338,34 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
Position : Cursor)
is
begin
- pragma Assert (Vet (Before), "bad Before cursor in Splice");
- pragma Assert (Vet (Position), "bad Position cursor in Splice");
+ if Before.Container /= null then
+ if Before.Container /= Target'Unchecked_Access then
+ raise Program_Error;
+ end if;
- if Before.Container /= null
- and then Before.Container /= Target'Unchecked_Access
- then
- raise Program_Error;
+ if Before.Node = null
+ or else Before.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Before), "bad Before cursor in Splice");
end if;
if Position.Node = null then
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
if Position.Container /= Target'Unrestricted_Access then
raise Program_Error;
end if;
+ pragma Assert (Vet (Position), "bad Position cursor in Splice");
+
if Position.Node = Before.Node
or else Position.Node.Next = Before.Node
then
@@ -1388,23 +1453,34 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
return;
end if;
- pragma Assert (Vet (Before), "bad Before cursor in Splice");
- pragma Assert (Vet (Position), "bad Position cursor in Splice");
+ if Before.Container /= null then
+ if Before.Container /= Target'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- if Before.Container /= null
- and then Before.Container /= Target'Unrestricted_Access
- then
- raise Program_Error;
+ if Before.Node = null
+ or else Before.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Before), "bad Before cursor in Splice");
end if;
if Position.Node = null then
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
if Position.Container /= Source'Unrestricted_Access then
raise Program_Error;
end if;
+ pragma Assert (Vet (Position), "bad Position cursor in Splice");
+
if Target.Length = Count_Type'Last then
raise Constraint_Error;
end if;
@@ -1484,18 +1560,20 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
-- Swap --
----------
- procedure Swap (I, J : Cursor) is
+ procedure Swap
+ (Container : in out List;
+ I, J : Cursor)
+ is
begin
- pragma Assert (Vet (I), "bad I cursor in Swap");
- pragma Assert (Vet (J), "bad J cursor in Swap");
-
if I.Node = null
or else J.Node = null
then
raise Constraint_Error;
end if;
- if I.Container /= J.Container then
+ if I.Container /= Container'Unchecked_Access
+ or else J.Container /= Container'Unchecked_Access
+ then
raise Program_Error;
end if;
@@ -1503,12 +1581,16 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
return;
end if;
- if I.Container.Lock > 0 then
+ if Container.Lock > 0 then
raise Program_Error;
end if;
+ pragma Assert (Vet (I), "bad I cursor in Swap");
+ pragma Assert (Vet (J), "bad J cursor in Swap");
+
declare
EI_Copy : constant Element_Access := I.Node.Element;
+
begin
I.Node.Element := J.Node.Element;
J.Node.Element := EI_Copy;
@@ -1524,9 +1606,6 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
I, J : Cursor)
is
begin
- pragma Assert (Vet (I), "bad I cursor in Swap_Links");
- pragma Assert (Vet (J), "bad J cursor in Swap_Links");
-
if I.Node = null
or else J.Node = null
then
@@ -1547,6 +1626,9 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
raise Program_Error;
end if;
+ pragma Assert (Vet (I), "bad I cursor in Swap_Links");
+ pragma Assert (Vet (J), "bad J cursor in Swap_Links");
+
declare
I_Next : constant Cursor := Next (I);
@@ -1580,20 +1662,28 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
--------------------
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Element : in out Element_Type))
+ (Container : in out List;
+ Position : Cursor;
+ Process : not null access procedure (Element : in out Element_Type))
is
begin
- pragma Assert (Vet (Position), "bad cursor in Update_Element");
-
if Position.Node = null then
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ if Position.Container /= Container'Unchecked_Access then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position), "bad cursor in Update_Element");
+
declare
- C : List renames Position.Container.all'Unrestricted_Access.all;
- B : Natural renames C.Busy;
- L : Natural renames C.Lock;
+ B : Natural renames Container.Busy;
+ L : Natural renames Container.Lock;
begin
B := B + 1;
@@ -1775,4 +1865,12 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
end loop;
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Indefinite_Doubly_Linked_Lists;
diff --git a/gcc/ada/a-cidlli.ads b/gcc/ada/a-cidlli.ads
index eb8657fe4fd..9e2d2351268 100644
--- a/gcc/ada/a-cidlli.ads
+++ b/gcc/ada/a-cidlli.ads
@@ -7,7 +7,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -62,46 +62,47 @@ package Ada.Containers.Indefinite_Doubly_Linked_Lists is
procedure Clear (Container : in out List);
- function Element (Position : Cursor)
- return Element_Type;
+ function Element (Position : Cursor) return Element_Type;
+
+ procedure Replace_Element
+ (Container : in out List;
+ Position : Cursor;
+ New_Item : Element_Type);
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Element : in out Element_Type));
-
- procedure Replace_Element
- (Position : Cursor;
- By : Element_Type);
+ (Container : in out List;
+ Position : Cursor;
+ Process : not null access procedure (Element : in out Element_Type));
procedure Move
(Target : in out List;
Source : in out List);
- procedure Prepend
+ procedure Insert
(Container : in out List;
+ Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1);
- procedure Append
+ procedure Insert
(Container : in out List;
+ Before : Cursor;
New_Item : Element_Type;
+ Position : out Cursor;
Count : Count_Type := 1);
- procedure Insert
+ procedure Prepend
(Container : in out List;
- Before : Cursor;
New_Item : Element_Type;
Count : Count_Type := 1);
- procedure Insert
+ procedure Append
(Container : in out List;
- Before : Cursor;
New_Item : Element_Type;
- Position : out Cursor;
Count : Count_Type := 1);
procedure Delete
@@ -117,21 +118,9 @@ package Ada.Containers.Indefinite_Doubly_Linked_Lists is
(Container : in out List;
Count : Count_Type := 1);
- generic
- with function "<" (Left, Right : Element_Type) return Boolean is <>;
- package Generic_Sorting is
-
- function Is_Sorted (Container : List) return Boolean;
-
- procedure Sort (Container : in out List);
-
- procedure Merge (Target, Source : in out List);
-
- end Generic_Sorting;
+ procedure Reverse_Elements (Container : in out List);
- procedure Reverse_List (Container : in out List);
-
- procedure Swap (I, J : Cursor);
+ procedure Swap (Container : in out List; I, J : Cursor);
procedure Swap_Links (Container : in out List; I, J : Cursor);
@@ -143,13 +132,13 @@ package Ada.Containers.Indefinite_Doubly_Linked_Lists is
procedure Splice
(Target : in out List;
Before : Cursor;
- Position : Cursor);
+ Source : in out List;
+ Position : in out Cursor);
procedure Splice
(Target : in out List;
Before : Cursor;
- Source : in out List;
- Position : in out Cursor);
+ Position : Cursor);
function First (Container : List) return Cursor;
@@ -159,9 +148,13 @@ package Ada.Containers.Indefinite_Doubly_Linked_Lists is
function Last_Element (Container : List) return Element_Type;
- function Contains
- (Container : List;
- Item : Element_Type) return Boolean;
+ function Next (Position : Cursor) return Cursor;
+
+ procedure Next (Position : in out Cursor);
+
+ function Previous (Position : Cursor) return Cursor;
+
+ procedure Previous (Position : in out Cursor);
function Find
(Container : List;
@@ -173,13 +166,9 @@ package Ada.Containers.Indefinite_Doubly_Linked_Lists is
Item : Element_Type;
Position : Cursor := No_Element) return Cursor;
- function Next (Position : Cursor) return Cursor;
-
- function Previous (Position : Cursor) return Cursor;
-
- procedure Next (Position : in out Cursor);
-
- procedure Previous (Position : in out Cursor);
+ function Contains
+ (Container : List;
+ Item : Element_Type) return Boolean;
function Has_Element (Position : Cursor) return Boolean;
@@ -191,6 +180,18 @@ package Ada.Containers.Indefinite_Doubly_Linked_Lists is
(Container : List;
Process : not null access procedure (Position : Cursor));
+ generic
+ with function "<" (Left, Right : Element_Type) return Boolean is <>;
+ package Generic_Sorting is
+
+ function Is_Sorted (Container : List) return Boolean;
+
+ procedure Sort (Container : in out List);
+
+ procedure Merge (Target, Source : in out List);
+
+ end Generic_Sorting;
+
private
type Node_Type;
type Node_Access is access Node_Type;
@@ -244,6 +245,18 @@ private
Node : Node_Access;
end record;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
+
+ for Cursor'Write use Write;
+
No_Element : constant Cursor := Cursor'(null, null);
end Ada.Containers.Indefinite_Doubly_Linked_Lists;
diff --git a/gcc/ada/a-cihama.adb b/gcc/ada/a-cihama.adb
index dc5fa0f82cb..3836f7eb035 100644
--- a/gcc/ada/a-cihama.adb
+++ b/gcc/ada/a-cihama.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -713,6 +713,14 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
Read_Nodes (Stream, Container.HT);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------
-- Read_Node --
---------------
@@ -787,7 +795,11 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
-- Replace_Element --
---------------------
- procedure Replace_Element (Position : Cursor; By : Element_Type) is
+ procedure Replace_Element
+ (Container : in out Map;
+ Position : Cursor;
+ New_Item : Element_Type)
+ is
begin
pragma Assert (Vet (Position), "bad cursor in Replace_Element");
@@ -795,6 +807,10 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
raise Constraint_Error;
end if;
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
+
if Position.Container.HT.Lock > 0 then
raise Program_Error;
end if;
@@ -803,7 +819,7 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
X : Element_Access := Position.Node.Element;
begin
- Position.Node.Element := new Element_Type'(By);
+ Position.Node.Element := new Element_Type'(New_Item);
Free_Element (X);
end;
end Replace_Element;
@@ -834,9 +850,10 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
--------------------
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Key : Key_Type;
- Element : in out Element_Type))
+ (Container : in out Map;
+ Position : Cursor;
+ Process : not null access procedure (Key : Key_Type;
+ Element : in out Element_Type))
is
begin
pragma Assert (Vet (Position), "bad cursor in Update_Element");
@@ -845,9 +862,12 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
raise Constraint_Error;
end if;
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
+
declare
- M : Map renames Position.Container.all;
- HT : Hash_Table_Type renames M.HT'Unrestricted_Access.all;
+ HT : Hash_Table_Type renames Container.HT;
B : Natural renames HT.Busy;
L : Natural renames HT.Lock;
@@ -859,7 +879,6 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
declare
K : Key_Type renames Position.Node.Key.all;
E : Element_Type renames Position.Node.Element.all;
-
begin
Process (K, E);
exception
@@ -951,6 +970,14 @@ package body Ada.Containers.Indefinite_Hashed_Maps is
Write_Nodes (Stream, Container.HT);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
----------------
-- Write_Node --
----------------
diff --git a/gcc/ada/a-cihama.ads b/gcc/ada/a-cihama.ads
index 93bdd81e8a2..18963d5048c 100644
--- a/gcc/ada/a-cihama.ads
+++ b/gcc/ada/a-cihama.ads
@@ -7,7 +7,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -57,6 +57,12 @@ package Ada.Containers.Indefinite_Hashed_Maps is
function "=" (Left, Right : Map) return Boolean;
+ function Capacity (Container : Map) return Count_Type;
+
+ procedure Reserve_Capacity
+ (Container : in out Map;
+ Capacity : Count_Type);
+
function Length (Container : Map) return Count_Type;
function Is_Empty (Container : Map) return Boolean;
@@ -67,20 +73,22 @@ package Ada.Containers.Indefinite_Hashed_Maps is
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out Map;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Key : Key_Type;
Element : Element_Type));
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Key : Key_Type;
+ (Container : in out Map;
+ Position : Cursor;
+ Process : not null access procedure (Key : Key_Type;
Element : in out Element_Type));
- procedure Replace_Element
- (Position : Cursor;
- By : Element_Type);
-
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
@@ -105,29 +113,11 @@ package Ada.Containers.Indefinite_Hashed_Maps is
Key : Key_Type;
New_Item : Element_Type);
- procedure Delete
- (Container : in out Map;
- Key : Key_Type);
+ procedure Exclude (Container : in out Map; Key : Key_Type);
- procedure Delete
- (Container : in out Map;
- Position : in out Cursor);
+ procedure Delete (Container : in out Map; Key : Key_Type);
- procedure Exclude
- (Container : in out Map;
- Key : Key_Type);
-
- function Contains
- (Container : Map;
- Key : Key_Type) return Boolean;
-
- function Find
- (Container : Map;
- Key : Key_Type) return Cursor;
-
- function Element
- (Container : Map;
- Key : Key_Type) return Element_Type;
+ procedure Delete (Container : in out Map; Position : in out Cursor);
function First (Container : Map) return Cursor;
@@ -135,29 +125,24 @@ package Ada.Containers.Indefinite_Hashed_Maps is
procedure Next (Position : in out Cursor);
+ function Find (Container : Map; Key : Key_Type) return Cursor;
+
+ function Contains (Container : Map; Key : Key_Type) return Boolean;
+
+ function Element (Container : Map; Key : Key_Type) return Element_Type;
+
function Has_Element (Position : Cursor) return Boolean;
- function Equivalent_Keys (Left, Right : Cursor)
- return Boolean;
+ function Equivalent_Keys (Left, Right : Cursor) return Boolean;
- function Equivalent_Keys
- (Left : Cursor;
- Right : Key_Type) return Boolean;
+ function Equivalent_Keys (Left : Cursor; Right : Key_Type) return Boolean;
- function Equivalent_Keys
- (Left : Key_Type;
- Right : Cursor) return Boolean;
+ function Equivalent_Keys (Left : Key_Type; Right : Cursor) return Boolean;
procedure Iterate
(Container : Map;
Process : not null access procedure (Position : Cursor));
- function Capacity (Container : Map) return Count_Type;
-
- procedure Reserve_Capacity
- (Container : in out Map;
- Capacity : Count_Type);
-
private
pragma Inline ("=");
pragma Inline (Length);
@@ -194,6 +179,7 @@ private
use HT_Types;
use Ada.Finalization;
+ use Ada.Streams;
procedure Adjust (Container : in out Map);
@@ -208,12 +194,22 @@ private
Node : Node_Access;
end record;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
+
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
No_Element : constant Cursor :=
(Container => null,
Node => null);
- use Ada.Streams;
-
procedure Write
(Stream : access Root_Stream_Type'Class;
Container : Map);
diff --git a/gcc/ada/a-cihase.adb b/gcc/ada/a-cihase.adb
index 8e747eadf08..9503e8859a2 100644
--- a/gcc/ada/a-cihase.adb
+++ b/gcc/ada/a-cihase.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -73,6 +73,12 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
function Hash_Node (Node : Node_Access) return Hash_Type;
pragma Inline (Hash_Node);
+ procedure Insert
+ (HT : in out Hash_Table_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access;
+ Inserted : out Boolean);
+
function Is_In (HT : Hash_Table_Type; Key : Node_Access) return Boolean;
pragma Inline (Is_In);
@@ -326,13 +332,16 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
begin
if not Is_In (Right.HT, L_Node) then
declare
- Indx : constant Hash_Type :=
- Hash (L_Node.Element.all) mod Buckets'Length;
-
+ Src : Element_Type renames L_Node.Element.all;
+ Indx : constant Hash_Type := Hash (Src) mod Buckets'Length;
Bucket : Node_Access renames Buckets (Indx);
-
+ Tgt : Element_Access := new Element_Type'(Src);
begin
- Bucket := new Node_Type'(L_Node.Element, Bucket);
+ Bucket := new Node_Type'(Tgt, Bucket);
+ exception
+ when others =>
+ Free_Element (Tgt);
+ raise;
end;
Length := Length + 1;
@@ -644,6 +653,32 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
Position : out Cursor;
Inserted : out Boolean)
is
+ begin
+ Insert (Container.HT, New_Item, Position.Node, Inserted);
+ Position.Container := Container'Unchecked_Access;
+ end Insert;
+
+ procedure Insert
+ (Container : in out Set;
+ New_Item : Element_Type)
+ is
+ Position : Cursor;
+ Inserted : Boolean;
+
+ begin
+ Insert (Container, New_Item, Position, Inserted);
+
+ if not Inserted then
+ raise Constraint_Error;
+ end if;
+ end Insert;
+
+ procedure Insert
+ (HT : in out Hash_Table_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access;
+ Inserted : out Boolean)
+ is
function New_Node (Next : Node_Access) return Node_Access;
pragma Inline (New_Node);
@@ -665,8 +700,6 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
raise;
end New_Node;
- HT : Hash_Table_Type renames Container.HT;
-
-- Start of processing for Insert
begin
@@ -674,30 +707,13 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
HT_Ops.Reserve_Capacity (HT, 1);
end if;
- Local_Insert (HT, New_Item, Position.Node, Inserted);
+ Local_Insert (HT, New_Item, Node, Inserted);
if Inserted
and then HT.Length > HT_Ops.Capacity (HT)
then
HT_Ops.Reserve_Capacity (HT, HT.Length);
end if;
-
- Position.Container := Container'Unchecked_Access;
- end Insert;
-
- procedure Insert
- (Container : in out Set;
- New_Item : Element_Type)
- is
- Position : Cursor;
- Inserted : Boolean;
-
- begin
- Insert (Container, New_Item, Position, Inserted);
-
- if not Inserted then
- raise Constraint_Error;
- end if;
end Insert;
------------------
@@ -787,13 +803,20 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
begin
if Is_In (Right.HT, L_Node) then
declare
- Indx : constant Hash_Type :=
- Hash (L_Node.Element.all) mod Buckets'Length;
+ Src : Element_Type renames L_Node.Element.all;
+
+ Indx : constant Hash_Type := Hash (Src) mod Buckets'Length;
Bucket : Node_Access renames Buckets (Indx);
+ Tgt : Element_Access := new Element_Type'(Src);
+
begin
- Bucket := new Node_Type'(L_Node.Element, Bucket);
+ Bucket := new Node_Type'(Tgt, Bucket);
+ exception
+ when others =>
+ Free_Element (Tgt);
+ raise;
end;
Length := Length + 1;
@@ -1040,6 +1063,14 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
Read_Nodes (Stream, Container.HT);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------
-- Read_Node --
---------------
@@ -1502,6 +1533,20 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
return (Controlled with HT => (Buckets, Length, 0, 0));
end Symmetric_Difference;
+ ------------
+ -- To_Set --
+ ------------
+
+ function To_Set (New_Item : Element_Type) return Set is
+ HT : Hash_Table_Type;
+ Node : Node_Access;
+ Inserted : Boolean;
+
+ begin
+ Insert (HT, New_Item, Node, Inserted);
+ return Set'(Controlled with HT);
+ end To_Set;
+
-----------
-- Union --
-----------
@@ -1609,13 +1654,20 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
-------------
procedure Process (L_Node : Node_Access) is
- J : constant Hash_Type :=
- Hash (L_Node.Element.all) mod Buckets'Length;
+ Src : Element_Type renames L_Node.Element.all;
+
+ J : constant Hash_Type := Hash (Src) mod Buckets'Length;
Bucket : Node_Access renames Buckets (J);
+ Tgt : Element_Access := new Element_Type'(Src);
+
begin
- Bucket := new Node_Type'(L_Node.Element, Bucket);
+ Bucket := new Node_Type'(Tgt, Bucket);
+ exception
+ when others =>
+ Free_Element (Tgt);
+ raise;
end Process;
-- Start of processing for Process
@@ -1751,6 +1803,14 @@ package body Ada.Containers.Indefinite_Hashed_Sets is
Write_Nodes (Stream, Container.HT);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
----------------
-- Write_Node --
----------------
diff --git a/gcc/ada/a-cihase.ads b/gcc/ada/a-cihase.ads
index 4ecca1ca0bf..bde7917ff37 100644
--- a/gcc/ada/a-cihase.ads
+++ b/gcc/ada/a-cihase.ads
@@ -7,7 +7,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -63,6 +63,8 @@ package Ada.Containers.Indefinite_Hashed_Sets is
function Equivalent_Sets (Left, Right : Set) return Boolean;
+ function To_Set (New_Item : Element_Type) return Set;
+
function Capacity (Container : Set) return Count_Type;
procedure Reserve_Capacity
@@ -225,6 +227,7 @@ private
use HT_Types;
use Ada.Finalization;
+ use Ada.Streams;
type Set_Access is access all Set;
for Set_Access'Storage_Size use 0;
@@ -235,12 +238,22 @@ private
Node : Node_Access;
end record;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
+
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
No_Element : constant Cursor :=
(Container => null,
Node => null);
- use Ada.Streams;
-
procedure Write
(Stream : access Root_Stream_Type'Class;
Container : Set);
diff --git a/gcc/ada/a-ciorma.adb b/gcc/ada/a-ciorma.adb
index 9847aaad7a8..256304281a8 100644
--- a/gcc/ada/a-ciorma.adb
+++ b/gcc/ada/a-ciorma.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -135,16 +135,56 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
function "<" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Key = null
+ or else Right.Node.Key = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left.Node.Key.all < Right.Node.Key.all;
end "<";
function "<" (Left : Cursor; Right : Key_Type) return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Key = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
return Left.Node.Key.all < Right;
end "<";
function "<" (Left : Key_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Right.Node.Key = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left < Right.Node.Key.all;
end "<";
@@ -163,16 +203,56 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
function ">" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Key = null
+ or else Right.Node.Key = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
return Right.Node.Key.all < Left.Node.Key.all;
end ">";
function ">" (Left : Cursor; Right : Key_Type) return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Key = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
return Right < Left.Node.Key.all;
end ">";
function ">" (Left : Key_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Right.Node.Key = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
return Right.Node.Key.all < Left;
end ">";
@@ -194,12 +274,13 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
function Ceiling (Container : Map; Key : Key_Type) return Cursor is
Node : constant Node_Access := Key_Ops.Ceiling (Container.Tree, Key);
+
begin
if Node = null then
return No_Element;
- else
- return Cursor'(Container'Unrestricted_Access, Node);
end if;
+
+ return Cursor'(Container'Unrestricted_Access, Node);
end Ceiling;
-----------
@@ -268,11 +349,20 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
raise Constraint_Error;
end if;
- if Position.Container /= Map_Access'(Container'Unrestricted_Access) then
+ if Position.Node.Key = null
+ or else Position.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
- Delete_Node_Sans_Free (Container.Tree, Position.Node);
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Delete");
+
+ Tree_Operations.Delete_Node_Sans_Free (Container.Tree, Position.Node);
Free (Position.Node);
Position.Container := null;
@@ -280,13 +370,14 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
procedure Delete (Container : in out Map; Key : Key_Type) is
X : Node_Access := Key_Ops.Find (Container.Tree, Key);
+
begin
if X = null then
raise Constraint_Error;
- else
- Delete_Node_Sans_Free (Container.Tree, X);
- Free (X);
end if;
+
+ Delete_Node_Sans_Free (Container.Tree, X);
+ Free (X);
end Delete;
------------------
@@ -295,6 +386,7 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
procedure Delete_First (Container : in out Map) is
X : Node_Access := Container.Tree.First;
+
begin
if X /= null then
Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
@@ -308,6 +400,7 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
procedure Delete_Last (Container : in out Map) is
X : Node_Access := Container.Tree.Last;
+
begin
if X /= null then
Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
@@ -321,15 +414,46 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
function Element (Position : Cursor) return Element_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Element");
+
return Position.Node.Element.all;
end Element;
function Element (Container : Map; Key : Key_Type) return Element_Type is
Node : constant Node_Access := Key_Ops.Find (Container.Tree, Key);
+
begin
+ if Node = null then
+ raise Constraint_Error;
+ end if;
+
return Node.Element.all;
end Element;
+ ---------------------
+ -- Equivalent_Keys --
+ ---------------------
+
+ function Equivalent_Keys (Left, Right : Key_Type) return Boolean is
+ begin
+ if Left < Right
+ or else Right < Left
+ then
+ return False;
+ else
+ return True;
+ end if;
+ end Equivalent_Keys;
+
-------------
-- Exclude --
-------------
@@ -339,7 +463,7 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
begin
if X /= null then
- Delete_Node_Sans_Free (Container.Tree, X);
+ Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
Free (X);
end if;
end Exclude;
@@ -350,12 +474,13 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
function Find (Container : Map; Key : Key_Type) return Cursor is
Node : constant Node_Access := Key_Ops.Find (Container.Tree, Key);
+
begin
if Node = null then
return No_Element;
- else
- return Cursor'(Container'Unrestricted_Access, Node);
end if;
+
+ return Cursor'(Container'Unrestricted_Access, Node);
end Find;
-----------
@@ -363,12 +488,14 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
-----------
function First (Container : Map) return Cursor is
+ T : Tree_Type renames Container.Tree;
+
begin
- if Container.Tree.First = null then
+ if T.First = null then
return No_Element;
- else
- return Cursor'(Container'Unrestricted_Access, Container.Tree.First);
end if;
+
+ return Cursor'(Container'Unrestricted_Access, T.First);
end First;
-------------------
@@ -376,8 +503,14 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
-------------------
function First_Element (Container : Map) return Element_Type is
+ T : Tree_Type renames Container.Tree;
+
begin
- return Container.Tree.First.Element.all;
+ if T.First = null then
+ raise Constraint_Error;
+ end if;
+
+ return T.First.Element.all;
end First_Element;
---------------
@@ -385,8 +518,14 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
---------------
function First_Key (Container : Map) return Key_Type is
+ T : Tree_Type renames Container.Tree;
+
begin
- return Container.Tree.First.Key.all;
+ if T.First = null then
+ raise Constraint_Error;
+ end if;
+
+ return T.First.Key.all;
end First_Key;
-----------
@@ -395,12 +534,13 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
function Floor (Container : Map; Key : Key_Type) return Cursor is
Node : constant Node_Access := Key_Ops.Floor (Container.Tree, Key);
+
begin
if Node = null then
return No_Element;
- else
- return Cursor'(Container'Unrestricted_Access, Node);
end if;
+
+ return Cursor'(Container'Unrestricted_Access, Node);
end Floor;
----------
@@ -410,11 +550,16 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
procedure Free (X : in out Node_Access) is
procedure Deallocate is
new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
+
begin
if X = null then
return;
end if;
+ X.Parent := X;
+ X.Left := X;
+ X.Right := X;
+
begin
Free_Key (X.Key);
exception
@@ -664,6 +809,17 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
function Key (Position : Cursor) return Key_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Position.Node.Key = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Key");
+
return Position.Node.Key.all;
end Key;
@@ -672,12 +828,14 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
----------
function Last (Container : Map) return Cursor is
+ T : Tree_Type renames Container.Tree;
+
begin
- if Container.Tree.Last = null then
+ if T.Last = null then
return No_Element;
- else
- return Cursor'(Container'Unrestricted_Access, Container.Tree.Last);
end if;
+
+ return Cursor'(Container'Unrestricted_Access, T.Last);
end Last;
------------------
@@ -685,8 +843,14 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
------------------
function Last_Element (Container : Map) return Element_Type is
+ T : Tree_Type renames Container.Tree;
+
begin
- return Container.Tree.Last.Element.all;
+ if T.Last = null then
+ raise Constraint_Error;
+ end if;
+
+ return T.Last.Element.all;
end Last_Element;
--------------
@@ -694,8 +858,14 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
--------------
function Last_Key (Container : Map) return Key_Type is
+ T : Tree_Type renames Container.Tree;
+
begin
- return Container.Tree.Last.Key.all;
+ if T.Last = null then
+ raise Constraint_Error;
+ end if;
+
+ return T.Last.Key.all;
end Last_Key;
----------
@@ -738,8 +908,16 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
return No_Element;
end if;
+ pragma Assert (Position.Node /= null);
+ pragma Assert (Position.Node.Key /= null);
+ pragma Assert (Position.Node.Element /= null);
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Next");
+
declare
- Node : constant Node_Access := Tree_Operations.Next (Position.Node);
+ Node : constant Node_Access :=
+ Tree_Operations.Next (Position.Node);
+
begin
if Node = null then
return No_Element;
@@ -773,9 +951,16 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
return No_Element;
end if;
+ pragma Assert (Position.Node /= null);
+ pragma Assert (Position.Node.Key /= null);
+ pragma Assert (Position.Node.Element /= null);
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Previous");
+
declare
Node : constant Node_Access :=
- Tree_Operations.Previous (Position.Node);
+ Tree_Operations.Previous (Position.Node);
+
begin
if Node = null then
return No_Element;
@@ -799,29 +984,46 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
Process : not null access procedure (Key : Key_Type;
Element : Element_Type))
is
- K : Key_Type renames Position.Node.Key.all;
- E : Element_Type renames Position.Node.Element.all;
+ begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
- T : Tree_Type renames Position.Container.Tree;
+ if Position.Node.Key = null
+ or else Position.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
- B : Natural renames T.Busy;
- L : Natural renames T.Lock;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Query_Element");
- begin
- B := B + 1;
- L := L + 1;
+ declare
+ T : Tree_Type renames Position.Container.Tree;
+
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
- Process (K, E);
- exception
- when others =>
- L := L - 1;
- B := B - 1;
- raise;
- end;
+ B := B + 1;
+ L := L + 1;
- L := L - 1;
- B := B - 1;
+ declare
+ K : Key_Type renames Position.Node.Key.all;
+ E : Element_Type renames Position.Node.Element.all;
+
+ begin
+ Process (K, E);
+ exception
+ when others =>
+ L := L - 1;
+ B := B - 1;
+ raise;
+ end;
+
+ L := L - 1;
+ B := B - 1;
+ end;
end Query_Element;
----------
@@ -863,6 +1065,14 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
Read (Stream, Container.Tree);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
-------------
-- Replace --
-------------
@@ -908,15 +1118,40 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
-- Replace_Element --
---------------------
- procedure Replace_Element (Position : Cursor; By : Element_Type) is
- X : Element_Access := Position.Node.Element;
+ procedure Replace_Element
+ (Container : in out Map;
+ Position : Cursor;
+ New_Item : Element_Type)
+ is
begin
- if Position.Container.Tree.Lock > 0 then
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Position.Node.Key = null
+ or else Position.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
- Position.Node.Element := new Element_Type'(By);
- Free_Element (X);
+ if Container.Tree.Lock > 0 then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Replace_Element");
+
+ declare
+ X : Element_Access := Position.Node.Element;
+
+ begin
+ Position.Node.Element := new Element_Type'(New_Item);
+ Free_Element (X);
+ end;
end Replace_Element;
---------------------
@@ -1010,33 +1245,55 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
--------------------
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Key : Key_Type;
- Element : in out Element_Type))
+ (Container : in out Map;
+ Position : Cursor;
+ Process : not null access procedure (Key : Key_Type;
+ Element : in out Element_Type))
is
- K : Key_Type renames Position.Node.Key.all;
- E : Element_Type renames Position.Node.Element.all;
+ begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
- T : Tree_Type renames Position.Container.Tree;
+ if Position.Node.Key = null
+ or else Position.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
- B : Natural renames T.Busy;
- L : Natural renames T.Lock;
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- begin
- B := B + 1;
- L := L + 1;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Update_Element");
+
+ declare
+ T : Tree_Type renames Position.Container.Tree;
+
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
- Process (K, E);
- exception
- when others =>
- L := L - 1;
- B := B - 1;
- raise;
- end;
+ B := B + 1;
+ L := L + 1;
- L := L - 1;
- B := B - 1;
+ declare
+ K : Key_Type renames Position.Node.Key.all;
+ E : Element_Type renames Position.Node.Element.all;
+
+ begin
+ Process (K, E);
+ exception
+ when others =>
+ L := L - 1;
+ B := B - 1;
+ raise;
+ end;
+
+ L := L - 1;
+ B := B - 1;
+ end;
end Update_Element;
-----------
@@ -1074,4 +1331,12 @@ package body Ada.Containers.Indefinite_Ordered_Maps is
Write (Stream, Container.Tree);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Indefinite_Ordered_Maps;
diff --git a/gcc/ada/a-ciorma.ads b/gcc/ada/a-ciorma.ads
index 4815ebd2e35..8837e048e00 100644
--- a/gcc/ada/a-ciorma.ads
+++ b/gcc/ada/a-ciorma.ads
@@ -7,7 +7,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -40,16 +40,16 @@ with Ada.Streams;
generic
type Key_Type (<>) is private;
-
type Element_Type (<>) is private;
with function "<" (Left, Right : Key_Type) return Boolean is <>;
-
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Indefinite_Ordered_Maps is
pragma Preelaborate;
+ function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
+
type Map is tagged private;
type Cursor is private;
@@ -70,17 +70,21 @@ package Ada.Containers.Indefinite_Ordered_Maps is
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out Map;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Key : Key_Type;
Element : Element_Type));
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Key : Key_Type;
- Element : in out Element_Type));
-
- procedure Replace_Element (Position : Cursor; By : Element_Type);
+ (Container : in out Map;
+ Position : Cursor;
+ Process : not null access procedure (Key : Key_Type;
+ Element : in out Element_Type));
procedure Move (Target : in out Map; Source : in out Map);
@@ -106,54 +110,28 @@ package Ada.Containers.Indefinite_Ordered_Maps is
Key : Key_Type;
New_Item : Element_Type);
- procedure Delete
- (Container : in out Map;
- Key : Key_Type);
+ procedure Exclude (Container : in out Map; Key : Key_Type);
- procedure Delete
- (Container : in out Map;
- Position : in out Cursor);
+ procedure Delete (Container : in out Map; Key : Key_Type);
+
+ procedure Delete (Container : in out Map; Position : in out Cursor);
procedure Delete_First (Container : in out Map);
procedure Delete_Last (Container : in out Map);
- procedure Exclude
- (Container : in out Map;
- Key : Key_Type);
-
- function Contains
- (Container : Map;
- Key : Key_Type) return Boolean;
-
- function Find
- (Container : Map;
- Key : Key_Type) return Cursor;
-
- function Element
- (Container : Map;
- Key : Key_Type) return Element_Type;
-
- function Floor
- (Container : Map;
- Key : Key_Type) return Cursor;
-
- function Ceiling
- (Container : Map;
- Key : Key_Type) return Cursor;
-
function First (Container : Map) return Cursor;
- function First_Key (Container : Map) return Key_Type;
-
function First_Element (Container : Map) return Element_Type;
- function Last (Container : Map) return Cursor;
+ function First_Key (Container : Map) return Key_Type;
- function Last_Key (Container : Map) return Key_Type;
+ function Last (Container : Map) return Cursor;
function Last_Element (Container : Map) return Element_Type;
+ function Last_Key (Container : Map) return Key_Type;
+
function Next (Position : Cursor) return Cursor;
procedure Next (Position : in out Cursor);
@@ -162,6 +140,16 @@ package Ada.Containers.Indefinite_Ordered_Maps is
procedure Previous (Position : in out Cursor);
+ function Find (Container : Map; Key : Key_Type) return Cursor;
+
+ function Element (Container : Map; Key : Key_Type) return Element_Type;
+
+ function Floor (Container : Map; Key : Key_Type) return Cursor;
+
+ function Ceiling (Container : Map; Key : Key_Type) return Cursor;
+
+ function Contains (Container : Map; Key : Key_Type) return Boolean;
+
function Has_Element (Position : Cursor) return Boolean;
function "<" (Left, Right : Cursor) return Boolean;
@@ -216,8 +204,9 @@ private
use Red_Black_Trees;
use Tree_Types;
use Ada.Finalization;
+ use Ada.Streams;
- type Map_Access is access Map;
+ type Map_Access is access all Map;
for Map_Access'Storage_Size use 0;
type Cursor is record
@@ -225,9 +214,19 @@ private
Node : Node_Access;
end record;
- No_Element : constant Cursor := Cursor'(null, null);
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
- use Ada.Streams;
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ No_Element : constant Cursor := Cursor'(null, null);
procedure Write
(Stream : access Root_Stream_Type'Class;
diff --git a/gcc/ada/a-ciormu.adb b/gcc/ada/a-ciormu.adb
index 9e24d3e7973..458e42e4225 100644
--- a/gcc/ada/a-ciormu.adb
+++ b/gcc/ada/a-ciormu.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -87,6 +87,11 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
procedure Free (X : in out Node_Access);
+ procedure Insert_Sans_Hint
+ (Tree : in out Tree_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access);
+
procedure Insert_With_Hint
(Dst_Tree : in out Tree_Type;
Dst_Hint : Node_Access;
@@ -157,16 +162,56 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
function "<" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Element = null
+ or else Right.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left.Node.Element.all < Right.Node.Element.all;
end "<";
function "<" (Left : Cursor; Right : Element_Type) return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
return Left.Node.Element.all < Right;
end "<";
function "<" (Left : Element_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Right.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left < Right.Node.Element.all;
end "<";
@@ -183,20 +228,60 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
-- ">" --
---------
- function ">" (Left : Cursor; Right : Element_Type) return Boolean is
- begin
- return Right < Left.Node.Element.all;
- end ">";
-
function ">" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Element = null
+ or else Right.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
-- L > R same as R < L
return Right.Node.Element.all < Left.Node.Element.all;
end ">";
+ function ">" (Left : Cursor; Right : Element_Type) return Boolean is
+ begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
+ return Right < Left.Node.Element.all;
+ end ">";
+
function ">" (Left : Element_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Right.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
return Right.Node.Element.all < Left;
end ">";
@@ -313,6 +398,9 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Delete");
+
Tree_Operations.Delete_Node_Sans_Free (Container.Tree, Position.Node);
Free (Position.Node);
@@ -375,9 +463,35 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
function Element (Position : Cursor) return Element_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Element");
+
return Position.Node.Element.all;
end Element;
+ -------------------------
+ -- Equivalent_Elements --
+ -------------------------
+
+ function Equivalent_Elements (Left, Right : Element_Type) return Boolean is
+ begin
+ if Left < Right
+ or else Right < Left
+ then
+ return False;
+ else
+ return True;
+ end if;
+ end Equivalent_Elements;
+
---------------------
-- Equivalent_Sets --
---------------------
@@ -420,6 +534,7 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
Node : Node_Access := Element_Keys.Ceiling (Tree, Item);
Done : constant Node_Access := Element_Keys.Upper_Bound (Tree, Item);
X : Node_Access;
+
begin
while Node /= Done loop
X := Node;
@@ -464,6 +579,14 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
function First_Element (Container : Set) return Element_Type is
begin
+ if Container.Tree.First = null then
+ raise Constraint_Error;
+ end if;
+
+ if Container.Tree.First.Element = null then
+ raise Program_Error;
+ end if;
+
return Container.Tree.First.Element.all;
end First_Element;
@@ -490,11 +613,16 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
procedure Free (X : in out Node_Access) is
procedure Deallocate is
new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
+
begin
if X = null then
return;
end if;
+ X.Parent := X;
+ X.Left := X;
+ X.Right := X;
+
begin
Free_Element (X.Element);
exception
@@ -538,34 +666,6 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
- ---------
- -- "<" --
- ---------
-
- function "<" (Left : Key_Type; Right : Cursor) return Boolean is
- begin
- return Left < Right.Node.Element.all;
- end "<";
-
- function "<" (Left : Cursor; Right : Key_Type) return Boolean is
- begin
- return Right > Left.Node.Element.all;
- end "<";
-
- ---------
- -- ">" --
- ---------
-
- function ">" (Left : Key_Type; Right : Cursor) return Boolean is
- begin
- return Left > Right.Node.Element.all;
- end ">";
-
- function ">" (Left : Cursor; Right : Key_Type) return Boolean is
- begin
- return Right < Left.Node.Element.all;
- end ">";
-
-------------
-- Ceiling --
-------------
@@ -621,11 +721,32 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
-------------
function Element (Container : Set; Key : Key_Type) return Element_Type is
- Node : constant Node_Access := Key_Keys.Find (Container.Tree, Key);
+ Node : constant Node_Access :=
+ Key_Keys.Find (Container.Tree, Key);
+
begin
+ if Node = null then
+ raise Constraint_Error;
+ end if;
+
return Node.Element.all;
end Element;
+ ---------------------
+ -- Equivalent_Keys --
+ ---------------------
+
+ function Equivalent_Keys (Left, Right : Key_Type) return Boolean is
+ begin
+ if Left < Right
+ or else Right < Left
+ then
+ return False;
+ else
+ return True;
+ end if;
+ end Equivalent_Keys;
+
-------------
-- Exclude --
-------------
@@ -681,9 +802,10 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
function Is_Greater_Key_Node
(Left : Key_Type;
- Right : Node_Access) return Boolean is
+ Right : Node_Access) return Boolean
+ is
begin
- return Left > Right.Element.all;
+ return Key (Right.Element.all) < Left;
end Is_Greater_Key_Node;
----------------------
@@ -692,9 +814,10 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
function Is_Less_Key_Node
(Left : Key_Type;
- Right : Node_Access) return Boolean is
+ Right : Node_Access) return Boolean
+ is
begin
- return Left < Right.Element.all;
+ return Left < Key (Right.Element.all);
end Is_Less_Key_Node;
-------------
@@ -746,6 +869,17 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
function Key (Position : Cursor) return Key_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Key");
+
return Key (Position.Node.Element.all);
end Key;
@@ -812,13 +946,20 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Update_Element_Preserving_Key");
+
declare
E : Element_Type renames Position.Node.Element.all;
- K : Key_Type renames Key (E);
+ K : constant Key_Type := Key (E);
B : Natural renames Tree.Busy;
L : Natural renames Tree.Lock;
@@ -839,11 +980,7 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
L := L - 1;
B := B - 1;
- if K < E
- or else K > E
- then
- null;
- else
+ if Equivalent_Keys (Left => K, Right => Key (E)) then
return;
end if;
end;
@@ -884,6 +1021,24 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
New_Item : Element_Type;
Position : out Cursor)
is
+ begin
+ Insert_Sans_Hint
+ (Container.Tree,
+ New_Item,
+ Position.Node);
+
+ Position.Container := Container'Unrestricted_Access;
+ end Insert;
+
+ ----------------------
+ -- Insert_Sans_Hint --
+ ----------------------
+
+ procedure Insert_Sans_Hint
+ (Tree : in out Tree_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access)
+ is
function New_Node return Node_Access;
pragma Inline (New_Node);
@@ -904,7 +1059,7 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
return new Node_Type'(Parent => null,
Left => null,
Right => null,
- Color => Red,
+ Color => Red_Black_Trees.Red,
Element => X);
exception
@@ -913,16 +1068,14 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
raise;
end New_Node;
- -- Start of processing for Insert
+ -- Start of processing for Insert_Sans_Hint
begin
Unconditional_Insert_Sans_Hint
- (Container.Tree,
+ (Tree,
New_Item,
- Position.Node);
-
- Position.Container := Container'Unrestricted_Access;
- end Insert;
+ Node);
+ end Insert_Sans_Hint;
----------------------
-- Insert_With_Hint --
@@ -1156,6 +1309,10 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
function Last_Element (Container : Set) return Element_Type is
begin
+ if Container.Tree.Last = null then
+ raise Constraint_Error;
+ end if;
+
return Container.Tree.Last.Element.all;
end Last_Element;
@@ -1199,6 +1356,9 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Next");
+
declare
Node : constant Node_Access :=
Tree_Operations.Next (Position.Node);
@@ -1245,6 +1405,9 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Previous");
+
declare
Node : constant Node_Access :=
Tree_Operations.Previous (Position.Node);
@@ -1271,29 +1434,40 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
- E : Element_Type renames Position.Node.Element.all;
+ begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
- S : Set renames Position.Container.all;
- T : Tree_Type renames S.Tree'Unrestricted_Access.all;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
- B : Natural renames T.Busy;
- L : Natural renames T.Lock;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Query_Element");
- begin
- B := B + 1;
- L := L + 1;
+ declare
+ T : Tree_Type renames Position.Container.Tree;
+
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
- Process (E);
- exception
- when others =>
- L := L - 1;
- B := B - 1;
- raise;
- end;
+ B := B + 1;
+ L := L + 1;
- L := L - 1;
- B := B - 1;
+ begin
+ Process (Position.Node.Element.all);
+ exception
+ when others =>
+ L := L - 1;
+ B := B - 1;
+ raise;
+ end;
+
+ L := L - 1;
+ B := B - 1;
+ end;
end Query_Element;
----------
@@ -1334,6 +1508,14 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
Read (Stream, Container.Tree);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------------
-- Replace_Element --
---------------------
@@ -1382,6 +1564,11 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
function New_Node return Node_Access is
begin
Node.Element := new Element_Type'(Item); -- OK if fails
+ Node.Color := Red_Black_Trees.Red;
+ Node.Parent := null;
+ Node.Left := null;
+ Node.Right := null;
+
return Node;
end New_Node;
@@ -1403,22 +1590,27 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
end Replace_Element;
procedure Replace_Element
- (Container : Set;
+ (Container : in out Set;
Position : Cursor;
- By : Element_Type)
+ New_Item : Element_Type)
is
- Tree : Tree_Type renames Position.Container.Tree'Unrestricted_Access.all;
-
begin
if Position.Node = null then
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
- Replace_Element (Tree, Position.Node, By);
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Replace_Element");
+
+ Replace_Element (Container.Tree, Position.Node, New_Item);
end Replace_Element;
---------------------
@@ -1563,6 +1755,19 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
return Set'(Controlled with Tree);
end Symmetric_Difference;
+ ------------
+ -- To_Set --
+ ------------
+
+ function To_Set (New_Item : Element_Type) return Set is
+ Tree : Tree_Type;
+ Node : Node_Access;
+
+ begin
+ Insert_Sans_Hint (Tree, New_Item, Node);
+ return Set'(Controlled with Tree);
+ end To_Set;
+
-----------
-- Union --
-----------
@@ -1613,4 +1818,12 @@ package body Ada.Containers.Indefinite_Ordered_Multisets is
Write (Stream, Container.Tree);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Indefinite_Ordered_Multisets;
diff --git a/gcc/ada/a-ciormu.ads b/gcc/ada/a-ciormu.ads
index d2bf68dfd68..1240aca4d66 100644
--- a/gcc/ada/a-ciormu.ads
+++ b/gcc/ada/a-ciormu.ads
@@ -7,7 +7,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -47,6 +47,8 @@ generic
package Ada.Containers.Indefinite_Ordered_Multisets is
pragma Preelaborate;
+ function Equivalent_Elements (Left, Right : Element_Type) return Boolean;
+
type Set is tagged private;
type Cursor is private;
@@ -59,6 +61,8 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
function Equivalent_Sets (Left, Right : Set) return Boolean;
+ function To_Set (New_Item : Element_Type) return Set;
+
function Length (Container : Set) return Count_Type;
function Is_Empty (Container : Set) return Boolean;
@@ -67,15 +71,15 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out Set;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
- procedure Replace_Element
- (Container : Set;
- Position : Cursor;
- By : Element_Type);
-
procedure Move (Target : in out Set; Source : in out Set);
procedure Insert
@@ -85,6 +89,14 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
procedure Insert (Container : in out Set; New_Item : Element_Type);
+-- TODO: include Replace too???
+--
+-- procedure Replace
+-- (Container : in out Set;
+-- New_Item : Element_Type);
+
+ procedure Exclude (Container : in out Set; Item : Element_Type);
+
procedure Delete (Container : in out Set; Item : Element_Type);
procedure Delete (Container : in out Set; Position : in out Cursor);
@@ -93,10 +105,7 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
procedure Delete_Last (Container : in out Set);
- procedure Exclude (Container : in out Set; Item : Element_Type);
-
- procedure Union (Target : in out Set;
- Source : Set);
+ procedure Union (Target : in out Set; Source : Set);
function Union (Left, Right : Set) return Set;
@@ -124,14 +133,6 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean;
- function Contains (Container : Set; Item : Element_Type) return Boolean;
-
- function Find (Container : Set; Item : Element_Type) return Cursor;
-
- function Floor (Container : Set; Item : Element_Type) return Cursor;
-
- function Ceiling (Container : Set; Item : Element_Type) return Cursor;
-
function First (Container : Set) return Cursor;
function First_Element (Container : Set) return Element_Type;
@@ -148,6 +149,14 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
procedure Previous (Position : in out Cursor);
+ function Find (Container : Set; Item : Element_Type) return Cursor;
+
+ function Floor (Container : Set; Item : Element_Type) return Cursor;
+
+ function Ceiling (Container : Set; Item : Element_Type) return Cursor;
+
+ function Contains (Container : Set; Item : Element_Type) return Boolean;
+
function Has_Element (Position : Cursor) return Boolean;
function "<" (Left, Right : Cursor) return Boolean;
@@ -181,42 +190,31 @@ package Ada.Containers.Indefinite_Ordered_Multisets is
Process : not null access procedure (Position : Cursor));
generic
-
- type Key_Type (<>) is limited private;
+ type Key_Type (<>) is private;
with function Key (Element : Element_Type) return Key_Type;
- with function "<" (Left : Key_Type; Right : Element_Type)
- return Boolean is <>;
-
- with function ">" (Left : Key_Type; Right : Element_Type)
- return Boolean is <>;
+ with function "<" (Left, Right : Key_Type) return Boolean is <>;
package Generic_Keys is
- function Contains (Container : Set; Key : Key_Type) return Boolean;
-
- function Find (Container : Set; Key : Key_Type) return Cursor;
-
- function Floor (Container : Set; Key : Key_Type) return Cursor;
-
- function Ceiling (Container : Set; Key : Key_Type) return Cursor;
+ function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
function Key (Position : Cursor) return Key_Type;
function Element (Container : Set; Key : Key_Type) return Element_Type;
- procedure Delete (Container : in out Set; Key : Key_Type);
-
procedure Exclude (Container : in out Set; Key : Key_Type);
- function "<" (Left : Cursor; Right : Key_Type) return Boolean;
+ procedure Delete (Container : in out Set; Key : Key_Type);
- function ">" (Left : Cursor; Right : Key_Type) return Boolean;
+ function Find (Container : Set; Key : Key_Type) return Cursor;
- function "<" (Left : Key_Type; Right : Cursor) return Boolean;
+ function Floor (Container : Set; Key : Key_Type) return Cursor;
- function ">" (Left : Key_Type; Right : Cursor) return Boolean;
+ function Ceiling (Container : Set; Key : Key_Type) return Cursor;
+
+ function Contains (Container : Set; Key : Key_Type) return Boolean;
procedure Update_Element_Preserving_Key
(Container : in out Set;
@@ -266,6 +264,7 @@ private
use Red_Black_Trees;
use Tree_Types;
use Ada.Finalization;
+ use Ada.Streams;
type Set_Access is access all Set;
for Set_Access'Storage_Size use 0;
@@ -275,9 +274,19 @@ private
Node : Node_Access;
end record;
- No_Element : constant Cursor := Cursor'(null, null);
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
- use Ada.Streams;
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ No_Element : constant Cursor := Cursor'(null, null);
procedure Write (Stream : access Root_Stream_Type'Class; Container : Set);
diff --git a/gcc/ada/a-ciorse.adb b/gcc/ada/a-ciorse.adb
index 2de8cda37e3..bb441a3201c 100644
--- a/gcc/ada/a-ciorse.adb
+++ b/gcc/ada/a-ciorse.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -59,6 +59,12 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
procedure Free (X : in out Node_Access);
+ procedure Insert_Sans_Hint
+ (Tree : in out Tree_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access;
+ Inserted : out Boolean);
+
procedure Insert_With_Hint
(Dst_Tree : in out Tree_Type;
Dst_Hint : Node_Access;
@@ -144,16 +150,56 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function "<" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Element = null
+ or else Right.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left.Node.Element.all < Right.Node.Element.all;
end "<";
function "<" (Left : Cursor; Right : Element_Type) return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
return Left.Node.Element.all < Right;
end "<";
function "<" (Left : Element_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Right.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left < Right.Node.Element.all;
end "<";
@@ -190,6 +236,24 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function ">" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Element = null
+ or else Right.Node.Element = null
+ then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
-- L > R same as R < L
return Right.Node.Element.all < Left.Node.Element.all;
@@ -197,11 +261,33 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function ">" (Left : Cursor; Right : Element_Type) return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Left.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
return Right < Left.Node.Element.all;
end ">";
function ">" (Left : Element_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Right.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
return Right.Node.Element.all < Left;
end ">";
@@ -296,6 +382,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Delete");
+
Tree_Operations.Delete_Node_Sans_Free (Container.Tree, Position.Node);
Free (Position.Node);
Position.Container := null;
@@ -310,7 +399,7 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
raise Constraint_Error;
end if;
- Delete_Node_Sans_Free (Container.Tree, X);
+ Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
Free (X);
end Delete;
@@ -366,6 +455,17 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function Element (Position : Cursor) return Element_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Element");
+
return Position.Node.Element.all;
end Element;
@@ -467,6 +567,10 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function First_Element (Container : Set) return Element_Type is
begin
+ if Container.Tree.First = null then
+ raise Constraint_Error;
+ end if;
+
return Container.Tree.First.Element.all;
end First_Element;
@@ -491,7 +595,6 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
----------
procedure Free (X : in out Node_Access) is
-
procedure Deallocate is
new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
@@ -500,6 +603,10 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
return;
end if;
+ X.Parent := X;
+ X.Left := X;
+ X.Right := X;
+
begin
Free_Element (X.Element);
exception
@@ -593,6 +700,10 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
Key_Keys.Find (Container.Tree, Key);
begin
+ if Node = null then
+ raise Constraint_Error;
+ end if;
+
return Node.Element.all;
end Element;
@@ -685,6 +796,17 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function Key (Position : Cursor) return Key_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Key");
+
return Key (Position.Node.Element.all);
end Key;
@@ -724,10 +846,17 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Update_Element_Preserving_Key");
+
declare
E : Element_Type renames Position.Node.Element.all;
K : constant Key_Type := Key (E);
@@ -811,13 +940,44 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
Position : out Cursor;
Inserted : out Boolean)
is
+ begin
+ Insert_Sans_Hint
+ (Container.Tree,
+ New_Item,
+ Position.Node,
+ Inserted);
+
+ Position.Container := Container'Unrestricted_Access;
+ end Insert;
+
+ procedure Insert (Container : in out Set; New_Item : Element_Type) is
+ Position : Cursor;
+ Inserted : Boolean;
+ begin
+ Insert (Container, New_Item, Position, Inserted);
+
+ if not Inserted then
+ raise Constraint_Error;
+ end if;
+ end Insert;
+
+ ----------------------
+ -- Insert_Sans_Hint --
+ ----------------------
+
+ procedure Insert_Sans_Hint
+ (Tree : in out Tree_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access;
+ Inserted : out Boolean)
+ is
function New_Node return Node_Access;
pragma Inline (New_Node);
procedure Insert_Post is
new Element_Keys.Generic_Insert_Post (New_Node);
- procedure Insert_Sans_Hint is
+ procedure Conditional_Insert_Sans_Hint is
new Element_Keys.Generic_Conditional_Insert (Insert_Post);
--------------
@@ -826,11 +986,12 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function New_Node return Node_Access is
Element : Element_Access := new Element_Type'(New_Item);
+
begin
return new Node_Type'(Parent => null,
Left => null,
Right => null,
- Color => Red,
+ Color => Red_Black_Trees.Red,
Element => Element);
exception
when others =>
@@ -838,28 +999,15 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
raise;
end New_Node;
- -- Start of processing for Insert
+ -- Start of processing for Insert_Sans_Hint
begin
- Insert_Sans_Hint
- (Container.Tree,
+ Conditional_Insert_Sans_Hint
+ (Tree,
New_Item,
- Position.Node,
+ Node,
Inserted);
-
- Position.Container := Container'Unrestricted_Access;
- end Insert;
-
- procedure Insert (Container : in out Set; New_Item : Element_Type) is
- Position : Cursor;
- Inserted : Boolean;
- begin
- Insert (Container, New_Item, Position, Inserted);
-
- if not Inserted then
- raise Constraint_Error;
- end if;
- end Insert;
+ end Insert_Sans_Hint;
----------------------
-- Insert_With_Hint --
@@ -1047,6 +1195,10 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function Last_Element (Container : Set) return Element_Type is
begin
+ if Container.Tree.Last = null then
+ raise Constraint_Error;
+ end if;
+
return Container.Tree.Last.Element.all;
end Last_Element;
@@ -1095,6 +1247,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Next");
+
declare
Node : constant Node_Access :=
Tree_Operations.Next (Position.Node);
@@ -1141,6 +1296,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Previous");
+
declare
Node : constant Node_Access :=
Tree_Operations.Previous (Position.Node);
@@ -1162,29 +1320,40 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
- E : Element_Type renames Position.Node.Element.all;
+ begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
- S : Set renames Position.Container.all;
- T : Tree_Type renames S.Tree'Unrestricted_Access.all;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
- B : Natural renames T.Busy;
- L : Natural renames T.Lock;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Query_Element");
- begin
- B := B + 1;
- L := L + 1;
+ declare
+ T : Tree_Type renames Position.Container.Tree;
+
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
- Process (E);
- exception
- when others =>
- L := L - 1;
- B := B - 1;
- raise;
- end;
+ B := B + 1;
+ L := L + 1;
- L := L - 1;
- B := B - 1;
+ begin
+ Process (Position.Node.Element.all);
+ exception
+ when others =>
+ L := L - 1;
+ B := B - 1;
+ raise;
+ end;
+
+ L := L - 1;
+ B := B - 1;
+ end;
end Query_Element;
----------
@@ -1227,6 +1396,14 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
Read (Stream, Container.Tree);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
-------------
-- Replace --
-------------
@@ -1242,6 +1419,10 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
raise Constraint_Error;
end if;
+ if Container.Tree.Lock > 0 then
+ raise Program_Error;
+ end if;
+
X := Node.Element;
Node.Element := new Element_Type'(New_Item);
Free_Element (X);
@@ -1295,6 +1476,11 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function New_Node return Node_Access is
begin
Node.Element := new Element_Type'(Item); -- OK if fails
+ Node.Color := Red;
+ Node.Parent := null;
+ Node.Right := null;
+ Node.Left := null;
+
return Node;
end New_Node;
@@ -1340,6 +1526,11 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
function New_Node return Node_Access is
begin
+ Node.Color := Red;
+ Node.Parent := null;
+ Node.Right := null;
+ Node.Left := null;
+
return Node;
end New_Node;
@@ -1372,10 +1563,17 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
raise Constraint_Error;
end if;
+ if Position.Node.Element = null then
+ raise Program_Error;
+ end if;
+
if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Replace_Element");
+
Replace_Element (Container.Tree, Position.Node, New_Item);
end Replace_Element;
@@ -1482,6 +1680,20 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
return Set'(Controlled with Tree);
end Symmetric_Difference;
+ ------------
+ -- To_Set --
+ ------------
+
+ function To_Set (New_Item : Element_Type) return Set is
+ Tree : Tree_Type;
+ Node : Node_Access;
+ Inserted : Boolean;
+
+ begin
+ Insert_Sans_Hint (Tree, New_Item, Node, Inserted);
+ return Set'(Controlled with Tree);
+ end To_Set;
+
-----------
-- Union --
-----------
@@ -1532,4 +1744,12 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
Write (Stream, Container.Tree);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Indefinite_Ordered_Sets;
diff --git a/gcc/ada/a-ciorse.ads b/gcc/ada/a-ciorse.ads
index 76349600060..1c1c7860332 100644
--- a/gcc/ada/a-ciorse.ads
+++ b/gcc/ada/a-ciorse.ads
@@ -7,7 +7,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -61,6 +61,8 @@ package Ada.Containers.Indefinite_Ordered_Sets is
function Equivalent_Sets (Left, Right : Set) return Boolean;
+ function To_Set (New_Item : Element_Type) return Set;
+
function Length (Container : Set) return Count_Type;
function Is_Empty (Container : Set) return Boolean;
@@ -266,6 +268,7 @@ private
use Red_Black_Trees;
use Tree_Types;
use Ada.Finalization;
+ use Ada.Streams;
type Set_Access is access all Set;
for Set_Access'Storage_Size use 0;
@@ -275,9 +278,19 @@ private
Node : Node_Access;
end record;
- No_Element : constant Cursor := Cursor'(null, null);
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
- use Ada.Streams;
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ No_Element : constant Cursor := Cursor'(null, null);
procedure Write
(Stream : access Root_Stream_Type'Class;
diff --git a/gcc/ada/a-cohama.adb b/gcc/ada/a-cohama.adb
index 1a165499f90..d235d0b0c79 100644
--- a/gcc/ada/a-cohama.adb
+++ b/gcc/ada/a-cohama.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -624,6 +624,7 @@ package body Ada.Containers.Hashed_Maps is
declare
HT : Hash_Table_Type renames Position.Container.HT;
Node : constant Node_Access := HT_Ops.Next (HT, Position.Node);
+
begin
if Node = null then
return No_Element;
@@ -695,6 +696,14 @@ package body Ada.Containers.Hashed_Maps is
Read_Nodes (Stream, Container.HT);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------
-- Read_Node --
---------------
@@ -743,7 +752,11 @@ package body Ada.Containers.Hashed_Maps is
-- Replace_Element --
---------------------
- procedure Replace_Element (Position : Cursor; By : Element_Type) is
+ procedure Replace_Element
+ (Container : in out Map;
+ Position : Cursor;
+ New_Item : Element_Type)
+ is
begin
pragma Assert (Vet (Position), "bad cursor in Replace_Element");
@@ -751,11 +764,15 @@ package body Ada.Containers.Hashed_Maps is
raise Constraint_Error;
end if;
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
+
if Position.Container.HT.Lock > 0 then
raise Program_Error;
end if;
- Position.Node.Element := By;
+ Position.Node.Element := New_Item;
end Replace_Element;
----------------------
@@ -784,9 +801,10 @@ package body Ada.Containers.Hashed_Maps is
--------------------
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Key : Key_Type;
- Element : in out Element_Type))
+ (Container : in out Map;
+ Position : Cursor;
+ Process : not null access procedure (Key : Key_Type;
+ Element : in out Element_Type))
is
begin
pragma Assert (Vet (Position), "bad cursor in Update_Element");
@@ -795,12 +813,14 @@ package body Ada.Containers.Hashed_Maps is
raise Constraint_Error;
end if;
- declare
- M : Map renames Position.Container.all;
- HT : Hash_Table_Type renames M.HT'Unrestricted_Access.all;
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- B : Natural renames HT.Busy;
- L : Natural renames HT.Lock;
+ declare
+ HT : Hash_Table_Type renames Container.HT;
+ B : Natural renames HT.Busy;
+ L : Natural renames HT.Lock;
begin
B := B + 1;
@@ -809,7 +829,6 @@ package body Ada.Containers.Hashed_Maps is
declare
K : Key_Type renames Position.Node.Key;
E : Element_Type renames Position.Node.Element;
-
begin
Process (K, E);
exception
@@ -891,6 +910,14 @@ package body Ada.Containers.Hashed_Maps is
Write_Nodes (Stream, Container.HT);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
----------------
-- Write_Node --
----------------
diff --git a/gcc/ada/a-cohama.ads b/gcc/ada/a-cohama.ads
index 0c74943506e..42b1cada502 100644
--- a/gcc/ada/a-cohama.ads
+++ b/gcc/ada/a-cohama.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -39,13 +39,10 @@ with Ada.Finalization;
generic
type Key_Type is private;
-
type Element_Type is private;
with function Hash (Key : Key_Type) return Hash_Type;
-
with function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
-
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Hashed_Maps is
@@ -61,6 +58,11 @@ package Ada.Containers.Hashed_Maps is
function "=" (Left, Right : Map) return Boolean;
+ function Capacity (Container : Map) return Count_Type;
+
+ procedure Reserve_Capacity (Container : in out Map;
+ Capacity : Count_Type);
+
function Length (Container : Map) return Count_Type;
function Is_Empty (Container : Map) return Boolean;
@@ -71,18 +73,22 @@ package Ada.Containers.Hashed_Maps is
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out Map;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : Element_Type));
procedure Update_Element
- (Position : Cursor;
- Process : not null access
+ (Container : in out Map;
+ Position : Cursor;
+ Process : not null access
procedure (Key : Key_Type; Element : in out Element_Type));
- procedure Replace_Element (Position : Cursor; By : Element_Type);
-
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
@@ -113,17 +119,11 @@ package Ada.Containers.Hashed_Maps is
Key : Key_Type;
New_Item : Element_Type);
- procedure Delete (Container : in out Map; Key : Key_Type);
-
- procedure Delete (Container : in out Map; Position : in out Cursor);
-
procedure Exclude (Container : in out Map; Key : Key_Type);
- function Contains (Container : Map; Key : Key_Type) return Boolean;
-
- function Find (Container : Map; Key : Key_Type) return Cursor;
+ procedure Delete (Container : in out Map; Key : Key_Type);
- function Element (Container : Map; Key : Key_Type) return Element_Type;
+ procedure Delete (Container : in out Map; Position : in out Cursor);
function First (Container : Map) return Cursor;
@@ -131,6 +131,12 @@ package Ada.Containers.Hashed_Maps is
procedure Next (Position : in out Cursor);
+ function Find (Container : Map; Key : Key_Type) return Cursor;
+
+ function Contains (Container : Map; Key : Key_Type) return Boolean;
+
+ function Element (Container : Map; Key : Key_Type) return Element_Type;
+
function Has_Element (Position : Cursor) return Boolean;
function Equivalent_Keys (Left, Right : Cursor) return Boolean;
@@ -143,11 +149,6 @@ package Ada.Containers.Hashed_Maps is
(Container : Map;
Process : not null access procedure (Position : Cursor));
- function Capacity (Container : Map) return Count_Type;
-
- procedure Reserve_Capacity (Container : in out Map;
- Capacity : Count_Type);
-
private
pragma Inline ("=");
pragma Inline (Length);
@@ -211,6 +212,18 @@ private
Node : Node_Access;
end record;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
+
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
No_Element : constant Cursor := (Container => null, Node => null);
end Ada.Containers.Hashed_Maps;
diff --git a/gcc/ada/a-cohase.adb b/gcc/ada/a-cohase.adb
index 05a2416c7b5..afb219055d5 100644
--- a/gcc/ada/a-cohase.adb
+++ b/gcc/ada/a-cohase.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -72,6 +72,12 @@ package body Ada.Containers.Hashed_Sets is
function Hash_Node (Node : Node_Access) return Hash_Type;
pragma Inline (Hash_Node);
+ procedure Insert
+ (HT : in out Hash_Table_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access;
+ Inserted : out Boolean);
+
function Is_In
(HT : Hash_Table_Type;
Key : Node_Access) return Boolean;
@@ -595,6 +601,32 @@ package body Ada.Containers.Hashed_Sets is
Position : out Cursor;
Inserted : out Boolean)
is
+ begin
+ Insert (Container.HT, New_Item, Position.Node, Inserted);
+ Position.Container := Container'Unchecked_Access;
+ end Insert;
+
+ procedure Insert
+ (Container : in out Set;
+ New_Item : Element_Type)
+ is
+ Position : Cursor;
+ Inserted : Boolean;
+
+ begin
+ Insert (Container, New_Item, Position, Inserted);
+
+ if not Inserted then
+ raise Constraint_Error;
+ end if;
+ end Insert;
+
+ procedure Insert
+ (HT : in out Hash_Table_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access;
+ Inserted : out Boolean)
+ is
function New_Node (Next : Node_Access) return Node_Access;
pragma Inline (New_Node);
@@ -606,13 +638,10 @@ package body Ada.Containers.Hashed_Sets is
--------------
function New_Node (Next : Node_Access) return Node_Access is
- Node : constant Node_Access := new Node_Type'(New_Item, Next);
begin
- return Node;
+ return new Node_Type'(New_Item, Next);
end New_Node;
- HT : Hash_Table_Type renames Container.HT;
-
-- Start of processing for Insert
begin
@@ -620,30 +649,13 @@ package body Ada.Containers.Hashed_Sets is
HT_Ops.Reserve_Capacity (HT, 1);
end if;
- Local_Insert (HT, New_Item, Position.Node, Inserted);
+ Local_Insert (HT, New_Item, Node, Inserted);
if Inserted
and then HT.Length > HT_Ops.Capacity (HT)
then
HT_Ops.Reserve_Capacity (HT, HT.Length);
end if;
-
- Position.Container := Container'Unchecked_Access;
- end Insert;
-
- procedure Insert
- (Container : in out Set;
- New_Item : Element_Type)
- is
- Position : Cursor;
- Inserted : Boolean;
-
- begin
- Insert (Container, New_Item, Position, Inserted);
-
- if not Inserted then
- raise Constraint_Error;
- end if;
end Insert;
------------------
@@ -970,6 +982,14 @@ package body Ada.Containers.Hashed_Sets is
Read_Nodes (Stream, Container.HT);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------
-- Read_Node --
---------------
@@ -1366,6 +1386,20 @@ package body Ada.Containers.Hashed_Sets is
return (Controlled with HT => (Buckets, Length, 0, 0));
end Symmetric_Difference;
+ ------------
+ -- To_Set --
+ ------------
+
+ function To_Set (New_Item : Element_Type) return Set is
+ HT : Hash_Table_Type;
+ Node : Node_Access;
+ Inserted : Boolean;
+
+ begin
+ Insert (HT, New_Item, Node, Inserted);
+ return Set'(Controlled with HT);
+ end To_Set;
+
-----------
-- Union --
-----------
@@ -1595,6 +1629,14 @@ package body Ada.Containers.Hashed_Sets is
Write_Nodes (Stream, Container.HT);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
----------------
-- Write_Node --
----------------
diff --git a/gcc/ada/a-cohase.ads b/gcc/ada/a-cohase.ads
index e4734c885cc..19aad2911fa 100644
--- a/gcc/ada/a-cohase.ads
+++ b/gcc/ada/a-cohase.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -62,6 +62,8 @@ package Ada.Containers.Hashed_Sets is
function Equivalent_Sets (Left, Right : Set) return Boolean;
+ function To_Set (New_Item : Element_Type) return Set;
+
function Capacity (Container : Set) return Count_Type;
procedure Reserve_Capacity
@@ -222,6 +224,7 @@ private
use HT_Types;
use Ada.Finalization;
+ use Ada.Streams;
type Set_Access is access all Set;
for Set_Access'Storage_Size use 0;
@@ -232,9 +235,19 @@ private
Node : Node_Access;
end record;
- No_Element : constant Cursor := (Container => null, Node => null);
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
- use Ada.Streams;
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ No_Element : constant Cursor := (Container => null, Node => null);
procedure Write
(Stream : access Root_Stream_Type'Class;
diff --git a/gcc/ada/a-cohata.ads b/gcc/ada/a-cohata.ads
index d453da2a347..d9b07535b75 100644
--- a/gcc/ada/a-cohata.ads
+++ b/gcc/ada/a-cohata.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index 8af2f4c7302..b3c7cd8e910 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -475,44 +475,6 @@ package body Ada.Containers.Indefinite_Vectors is
Count);
end Append;
- ------------
- -- Assign --
- ------------
-
- procedure Assign
- (Target : in out Vector;
- Source : Vector)
- is
- N : constant Count_Type := Length (Source);
-
- begin
- if Target'Address = Source'Address then
- return;
- end if;
-
- Clear (Target);
-
- if N = 0 then
- return;
- end if;
-
- if N > Capacity (Target) then
- Reserve_Capacity (Target, Capacity => N);
- end if;
-
- for J in Index_Type'First .. Source.Last loop
- declare
- EA : constant Element_Access := Source.Elements (J);
- begin
- if EA /= null then
- Target.Elements (J) := new Element_Type'(EA.all);
- end if;
- end;
-
- Target.Last := J;
- end loop;
- end Assign;
-
--------------
-- Capacity --
--------------
@@ -553,7 +515,8 @@ package body Ada.Containers.Indefinite_Vectors is
function Contains
(Container : Vector;
- Item : Element_Type) return Boolean is
+ Item : Element_Type) return Boolean
+ is
begin
return Find_Index (Container, Item) /= No_Index;
end Contains;
@@ -649,8 +612,7 @@ package body Ada.Containers.Indefinite_Vectors is
raise Constraint_Error;
end if;
- if Position.Container /=
- Vector_Access'(Container'Unchecked_Access)
+ if Position.Container /= Container'Unchecked_Access
or else Position.Index > Container.Last
then
raise Program_Error;
@@ -658,11 +620,7 @@ package body Ada.Containers.Indefinite_Vectors is
Delete (Container, Position.Index, Count);
- if Position.Index <= Container.Last then
- Position := (Container'Unchecked_Access, Position.Index);
- else
- Position := No_Element;
- end if;
+ Position := No_Element; -- See comment in a-convec.adb
end Delete;
------------------
@@ -738,7 +696,16 @@ package body Ada.Containers.Indefinite_Vectors is
raise Constraint_Error;
end if;
- return Container.Elements (Index).all;
+ declare
+ EA : constant Element_Access := Container.Elements (Index);
+
+ begin
+ if EA = null then
+ raise Constraint_Error;
+ end if;
+
+ return EA.all;
+ end;
end Element;
function Element (Position : Cursor) return Element_Type is
@@ -773,13 +740,12 @@ package body Ada.Containers.Indefinite_Vectors is
function Find
(Container : Vector;
Item : Element_Type;
- Position : Cursor := No_Element) return Cursor is
-
+ Position : Cursor := No_Element) return Cursor
+ is
begin
if Position.Container /= null
- and then (Position.Container /=
- Vector_Access'(Container'Unchecked_Access)
- or else Position.Index > Container.Last)
+ and then (Position.Container /= Container'Unchecked_Access
+ or else Position.Index > Container.Last)
then
raise Program_Error;
end if;
@@ -802,7 +768,8 @@ package body Ada.Containers.Indefinite_Vectors is
function Find_Index
(Container : Vector;
Item : Element_Type;
- Index : Index_Type := Index_Type'First) return Extended_Index is
+ Index : Index_Type := Index_Type'First) return Extended_Index
+ is
begin
for Indx in Index .. Container.Last loop
if Container.Elements (Indx) /= null
@@ -1287,7 +1254,7 @@ package body Ada.Containers.Indefinite_Vectors is
begin
if Before.Container /= null
- and then Before.Container /= Vector_Access'(Container'Unchecked_Access)
+ and then Before.Container /= Container'Unchecked_Access
then
raise Program_Error;
end if;
@@ -1843,6 +1810,10 @@ package body Ada.Containers.Indefinite_Vectors is
raise Constraint_Error;
end if;
+ if V.Elements (Index) = null then
+ raise Constraint_Error;
+ end if;
+
B := B + 1;
L := L + 1;
@@ -1907,14 +1878,22 @@ package body Ada.Containers.Indefinite_Vectors is
end loop;
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Position : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
- (Container : Vector;
+ (Container : in out Vector;
Index : Index_Type;
- By : Element_Type)
+ New_Item : Element_Type)
is
begin
if Index > Container.Last then
@@ -1928,18 +1907,26 @@ package body Ada.Containers.Indefinite_Vectors is
declare
X : Element_Access := Container.Elements (Index);
begin
- Container.Elements (Index) := new Element_Type'(By);
+ Container.Elements (Index) := new Element_Type'(New_Item);
Free (X);
end;
end Replace_Element;
- procedure Replace_Element (Position : Cursor; By : Element_Type) is
+ procedure Replace_Element
+ (Container : in out Vector;
+ Position : Cursor;
+ New_Item : Element_Type)
+ is
begin
if Position.Container = null then
raise Constraint_Error;
end if;
- Replace_Element (Position.Container.all, Position.Index, By);
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
+
+ Replace_Element (Container, Position.Index, New_Item);
end Replace_Element;
----------------------
@@ -2083,6 +2070,41 @@ package body Ada.Containers.Indefinite_Vectors is
end;
end Reserve_Capacity;
+ ----------------------
+ -- Reverse_Elements --
+ ----------------------
+
+ procedure Reverse_Elements (Container : in out Vector) is
+ begin
+ if Container.Length <= 1 then
+ return;
+ end if;
+
+ if Container.Lock > 0 then
+ raise Program_Error;
+ end if;
+
+ declare
+ I : Index_Type := Index_Type'First;
+ J : Index_Type := Container.Last;
+ E : Elements_Type renames Container.Elements.all;
+
+ begin
+ while I < J loop
+ declare
+ EI : constant Element_Access := E (I);
+
+ begin
+ E (I) := E (J);
+ E (J) := EI;
+ end;
+
+ I := I + 1;
+ J := J - 1;
+ end loop;
+ end;
+ end Reverse_Elements;
+
------------------
-- Reverse_Find --
------------------
@@ -2096,8 +2118,7 @@ package body Ada.Containers.Indefinite_Vectors is
begin
if Position.Container /= null
- and then Position.Container /=
- Vector_Access'(Container'Unchecked_Access)
+ and then Position.Container /= Container'Unchecked_Access
then
raise Program_Error;
end if;
@@ -2230,7 +2251,7 @@ package body Ada.Containers.Indefinite_Vectors is
----------
procedure Swap
- (Container : Vector;
+ (Container : in out Vector;
I, J : Index_Type)
is
begin
@@ -2260,7 +2281,9 @@ package body Ada.Containers.Indefinite_Vectors is
end;
end Swap;
- procedure Swap (I, J : Cursor)
+ procedure Swap
+ (Container : in out Vector;
+ I, J : Cursor)
is
begin
if I.Container = null
@@ -2269,11 +2292,13 @@ package body Ada.Containers.Indefinite_Vectors is
raise Constraint_Error;
end if;
- if I.Container /= J.Container then
+ if I.Container /= Container'Unrestricted_Access
+ or else J.Container /= Container'Unrestricted_Access
+ then
raise Program_Error;
end if;
- Swap (I.Container.all, I.Index, J.Index);
+ Swap (Container, I.Index, J.Index);
end Swap;
---------------
@@ -2387,24 +2412,27 @@ package body Ada.Containers.Indefinite_Vectors is
--------------------
procedure Update_Element
- (Container : Vector;
+ (Container : in out Vector;
Index : Index_Type;
Process : not null access procedure (Element : in out Element_Type))
is
- V : Vector renames Container'Unrestricted_Access.all;
- B : Natural renames V.Busy;
- L : Natural renames V.Lock;
+ B : Natural renames Container.Busy;
+ L : Natural renames Container.Lock;
begin
if Index > Container.Last then
raise Constraint_Error;
end if;
+ if Container.Elements (Index) = null then
+ raise Constraint_Error;
+ end if;
+
B := B + 1;
L := L + 1;
begin
- Process (V.Elements (Index).all);
+ Process (Container.Elements (Index).all);
exception
when others =>
L := L - 1;
@@ -2417,15 +2445,20 @@ package body Ada.Containers.Indefinite_Vectors is
end Update_Element;
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Element : in out Element_Type))
+ (Container : in out Vector;
+ Position : Cursor;
+ Process : not null access procedure (Element : in out Element_Type))
is
begin
if Position.Container = null then
raise Constraint_Error;
end if;
- Update_Element (Position.Container.all, Position.Index, Process);
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
+
+ Update_Element (Container, Position.Index, Process);
end Update_Element;
-----------
@@ -2466,4 +2499,12 @@ package body Ada.Containers.Indefinite_Vectors is
end;
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Position : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Indefinite_Vectors;
diff --git a/gcc/ada/a-coinve.ads b/gcc/ada/a-coinve.ads
index 6ccfda5f7fa..822e797f04a 100644
--- a/gcc/ada/a-coinve.ads
+++ b/gcc/ada/a-coinve.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -38,7 +38,6 @@ with Ada.Streams;
generic
type Index_Type is range <>;
-
type Element_Type (<>) is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
@@ -52,8 +51,6 @@ package Ada.Containers.Indefinite_Vectors is
No_Index : constant Extended_Index := Extended_Index'First;
- subtype Index_Subtype is Index_Type;
-
type Vector is tagged private;
type Cursor is private;
@@ -62,6 +59,8 @@ package Ada.Containers.Indefinite_Vectors is
No_Element : constant Cursor;
+ function "=" (Left, Right : Vector) return Boolean;
+
function To_Vector (Length : Count_Type) return Vector;
function To_Vector
@@ -76,8 +75,6 @@ package Ada.Containers.Indefinite_Vectors is
function "&" (Left, Right : Element_Type) return Vector;
- function "=" (Left, Right : Vector) return Boolean;
-
function Capacity (Container : Vector) return Count_Type;
procedure Reserve_Capacity
@@ -86,6 +83,10 @@ package Ada.Containers.Indefinite_Vectors is
function Length (Container : Vector) return Count_Type;
+ procedure Set_Length
+ (Container : in out Vector;
+ Length : Count_Type);
+
function Is_Empty (Container : Vector) return Boolean;
procedure Clear (Container : in out Vector);
@@ -102,6 +103,16 @@ package Ada.Containers.Indefinite_Vectors is
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out Vector;
+ Index : Index_Type;
+ New_Item : Element_Type);
+
+ procedure Replace_Element
+ (Container : in out Vector;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Container : Vector;
Index : Index_Type;
@@ -112,24 +123,14 @@ package Ada.Containers.Indefinite_Vectors is
Process : not null access procedure (Element : Element_Type));
procedure Update_Element
- (Container : Vector;
+ (Container : in out Vector;
Index : Index_Type;
Process : not null access procedure (Element : in out Element_Type));
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Element : in out Element_Type));
-
- procedure Replace_Element
- (Container : Vector;
- Index : Index_Type;
- By : Element_Type);
-
- procedure Replace_Element
- (Position : Cursor;
- By : Element_Type);
-
- procedure Assign (Target : in out Vector; Source : Vector);
+ (Container : in out Vector;
+ Position : Cursor;
+ Process : not null access procedure (Element : in out Element_Type));
procedure Move (Target : in out Vector; Source : in out Vector);
@@ -197,10 +198,6 @@ package Ada.Containers.Indefinite_Vectors is
Position : out Cursor;
Count : Count_Type := 1);
- procedure Set_Length
- (Container : in out Vector;
- Length : Count_Type);
-
procedure Delete
(Container : in out Vector;
Index : Extended_Index;
@@ -219,6 +216,12 @@ package Ada.Containers.Indefinite_Vectors is
(Container : in out Vector;
Count : Count_Type := 1);
+ procedure Reverse_Elements (Container : in out Vector);
+
+ procedure Swap (Container : in out Vector; I, J : Index_Type);
+
+ procedure Swap (Container : in out Vector; I, J : Cursor);
+
function First_Index (Container : Vector) return Index_Type;
function First (Container : Vector) return Cursor;
@@ -231,21 +234,13 @@ package Ada.Containers.Indefinite_Vectors is
function Last_Element (Container : Vector) return Element_Type;
- procedure Swap (Container : Vector; I, J : Index_Type);
-
- procedure Swap (I, J : Cursor);
-
- generic
- with function "<" (Left, Right : Element_Type) return Boolean is <>;
- package Generic_Sorting is
-
- function Is_Sorted (Container : Vector) return Boolean;
+ function Next (Position : Cursor) return Cursor;
- procedure Sort (Container : in out Vector);
+ procedure Next (Position : in out Cursor);
- procedure Merge (Target, Source : in out Vector);
+ function Previous (Position : Cursor) return Cursor;
- end Generic_Sorting;
+ procedure Previous (Position : in out Cursor);
function Find_Index
(Container : Vector;
@@ -255,30 +250,22 @@ package Ada.Containers.Indefinite_Vectors is
function Find
(Container : Vector;
Item : Element_Type;
- Position : Cursor := No_Element) return Cursor;
+ Position : Cursor := No_Element) return Cursor;
function Reverse_Find_Index
(Container : Vector;
Item : Element_Type;
Index : Index_Type := Index_Type'Last) return Extended_Index;
- function Reverse_Find (Container : Vector;
- Item : Element_Type;
- Position : Cursor := No_Element)
- return Cursor;
+ function Reverse_Find
+ (Container : Vector;
+ Item : Element_Type;
+ Position : Cursor := No_Element) return Cursor;
function Contains
(Container : Vector;
Item : Element_Type) return Boolean;
- function Next (Position : Cursor) return Cursor;
-
- function Previous (Position : Cursor) return Cursor;
-
- procedure Next (Position : in out Cursor);
-
- procedure Previous (Position : in out Cursor);
-
function Has_Element (Position : Cursor) return Boolean;
procedure Iterate
@@ -289,6 +276,18 @@ package Ada.Containers.Indefinite_Vectors is
(Container : Vector;
Process : not null access procedure (Position : Cursor));
+ generic
+ with function "<" (Left, Right : Element_Type) return Boolean is <>;
+ package Generic_Sorting is
+
+ function Is_Sorted (Container : Vector) return Boolean;
+
+ procedure Sort (Container : in out Vector);
+
+ procedure Merge (Target : in out Vector; Source : in out Vector);
+
+ end Generic_Sorting;
+
private
pragma Inline (First_Index);
@@ -346,6 +345,18 @@ private
Index : Index_Type := Index_Type'First;
end record;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Position : Cursor);
+
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Position : out Cursor);
+
+ for Cursor'Read use Read;
+
No_Element : constant Cursor := Cursor'(null, Index_Type'First);
end Ada.Containers.Indefinite_Vectors;
diff --git a/gcc/ada/a-colien.adb b/gcc/ada/a-colien.adb
index 0f76ad1a960..881fb0c32f4 100644
--- a/gcc/ada/a-colien.adb
+++ b/gcc/ada/a-colien.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with System;
+
package body Ada.Command_Line.Environment is
-----------------------
diff --git a/gcc/ada/a-colien.ads b/gcc/ada/a-colien.ads
index 7a683c88c96..404845bcc09 100644
--- a/gcc/ada/a-colien.ads
+++ b/gcc/ada/a-colien.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-colire.adb b/gcc/ada/a-colire.adb
index de273b50f1a..096c166b8dd 100644
--- a/gcc/ada/a-colire.adb
+++ b/gcc/ada/a-colire.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-colire.ads b/gcc/ada/a-colire.ads
index 8c5a518575e..e0c038806f7 100644
--- a/gcc/ada/a-colire.ads
+++ b/gcc/ada/a-colire.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-comlin.adb b/gcc/ada/a-comlin.adb
index 36d88fa1266..ab438788d45 100644
--- a/gcc/ada/a-comlin.adb
+++ b/gcc/ada/a-comlin.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-comlin.ads b/gcc/ada/a-comlin.ads
index 1ddc3e1da6e..da9e583ae31 100644
--- a/gcc/ada/a-comlin.ads
+++ b/gcc/ada/a-comlin.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-convec.adb b/gcc/ada/a-convec.adb
index fb3a88bb873..b298fd6a736 100644
--- a/gcc/ada/a-convec.adb
+++ b/gcc/ada/a-convec.adb
@@ -303,37 +303,6 @@ package body Ada.Containers.Vectors is
Count);
end Append;
- ------------
- -- Assign --
- ------------
-
- procedure Assign
- (Target : in out Vector;
- Source : Vector)
- is
- N : constant Count_Type := Length (Source);
-
- begin
- if Target'Address = Source'Address then
- return;
- end if;
-
- Clear (Target);
-
- if N = 0 then
- return;
- end if;
-
- if N > Capacity (Target) then
- Reserve_Capacity (Target, Capacity => N);
- end if;
-
- Target.Elements (Index_Type'First .. Source.Last) :=
- Source.Elements (Index_Type'First .. Source.Last);
-
- Target.Last := Source.Last;
- end Assign;
-
--------------
-- Capacity --
--------------
@@ -443,8 +412,7 @@ package body Ada.Containers.Vectors is
raise Constraint_Error;
end if;
- if Position.Container /=
- Vector_Access'(Container'Unchecked_Access)
+ if Position.Container /= Container'Unrestricted_Access
or else Position.Index > Container.Last
then
raise Program_Error;
@@ -452,11 +420,17 @@ package body Ada.Containers.Vectors is
Delete (Container, Position.Index, Count);
- if Position.Index <= Container.Last then
- Position := (Container'Unchecked_Access, Position.Index);
- else
- Position := No_Element;
- end if;
+ -- This is the old behavior, prior to the York API (2005/06):
+
+ -- if Position.Index <= Container.Last then
+ -- Position := (Container'Unchecked_Access, Position.Index);
+ -- else
+ -- Position := No_Element;
+ -- end if;
+
+ -- This is the behavior specified by the York API:
+
+ Position := No_Element;
end Delete;
------------------
@@ -539,6 +513,7 @@ package body Ada.Containers.Vectors is
procedure Finalize (Container : in out Vector) is
X : Elements_Access := Container.Elements;
+
begin
if Container.Busy > 0 then
raise Program_Error;
@@ -556,13 +531,12 @@ package body Ada.Containers.Vectors is
function Find
(Container : Vector;
Item : Element_Type;
- Position : Cursor := No_Element) return Cursor is
-
+ Position : Cursor := No_Element) return Cursor
+ is
begin
if Position.Container /= null
- and then (Position.Container /=
- Vector_Access'(Container'Unchecked_Access)
- or else Position.Index > Container.Last)
+ and then (Position.Container /= Container'Unrestricted_Access
+ or else Position.Index > Container.Last)
then
raise Program_Error;
end if;
@@ -583,7 +557,8 @@ package body Ada.Containers.Vectors is
function Find_Index
(Container : Vector;
Item : Element_Type;
- Index : Index_Type := Index_Type'First) return Extended_Index is
+ Index : Index_Type := Index_Type'First) return Extended_Index
+ is
begin
for Indx in Index .. Container.Last loop
if Container.Elements (Indx) = Item then
@@ -1152,6 +1127,31 @@ package body Ada.Containers.Vectors is
Position := Cursor'(Container'Unchecked_Access, Index);
end Insert;
+ procedure Insert
+ (Container : in out Vector;
+ Before : Extended_Index;
+ Count : Count_Type := 1)
+ is
+ New_Item : Element_Type; -- Default-initialized value
+ pragma Warnings (Off, New_Item);
+
+ begin
+ Insert (Container, Before, New_Item, Count);
+ end Insert;
+
+ procedure Insert
+ (Container : in out Vector;
+ Before : Cursor;
+ Position : out Cursor;
+ Count : Count_Type := 1)
+ is
+ New_Item : Element_Type; -- Default-initialized value
+ pragma Warnings (Off, New_Item);
+
+ begin
+ Insert (Container, Before, New_Item, Position, Count);
+ end Insert;
+
------------------
-- Insert_Space --
------------------
@@ -1339,7 +1339,7 @@ package body Ada.Containers.Vectors is
Index := Before.Index;
end if;
- Insert_Space (Container, Index, Count);
+ Insert_Space (Container, Index, Count => Count);
Position := Cursor'(Container'Unchecked_Access, Index);
end Insert_Space;
@@ -1365,7 +1365,6 @@ package body Ada.Containers.Vectors is
B : Natural renames V.Busy;
begin
-
B := B + 1;
begin
@@ -1379,7 +1378,6 @@ package body Ada.Containers.Vectors is
end;
B := B - 1;
-
end Iterate;
----------
@@ -1620,14 +1618,22 @@ package body Ada.Containers.Vectors is
end loop;
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Position : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------------
-- Replace_Element --
---------------------
procedure Replace_Element
- (Container : Vector;
+ (Container : in out Vector;
Index : Index_Type;
- By : Element_Type)
+ New_Item : Element_Type)
is
begin
if Index > Container.Last then
@@ -1638,16 +1644,24 @@ package body Ada.Containers.Vectors is
raise Program_Error;
end if;
- Container.Elements (Index) := By;
+ Container.Elements (Index) := New_Item;
end Replace_Element;
- procedure Replace_Element (Position : Cursor; By : Element_Type) is
+ procedure Replace_Element
+ (Container : in out Vector;
+ Position : Cursor;
+ New_Item : Element_Type)
+ is
begin
if Position.Container = null then
raise Constraint_Error;
end if;
- Replace_Element (Position.Container.all, Position.Index, By);
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
+
+ Replace_Element (Container, Position.Index, New_Item);
end Replace_Element;
----------------------
@@ -1799,6 +1813,41 @@ package body Ada.Containers.Vectors is
end;
end Reserve_Capacity;
+ ----------------------
+ -- Reverse_Elements --
+ ----------------------
+
+ procedure Reverse_Elements (Container : in out Vector) is
+ begin
+ if Container.Length <= 1 then
+ return;
+ end if;
+
+ if Container.Lock > 0 then
+ raise Program_Error;
+ end if;
+
+ declare
+ I : Index_Type := Index_Type'First;
+ J : Index_Type := Container.Last;
+ E : Elements_Type renames Container.Elements.all;
+
+ begin
+ while I < J loop
+ declare
+ EI : constant Element_Type := E (I);
+
+ begin
+ E (I) := E (J);
+ E (J) := EI;
+ end;
+
+ I := I + 1;
+ J := J - 1;
+ end loop;
+ end;
+ end Reverse_Elements;
+
------------------
-- Reverse_Find --
------------------
@@ -1921,7 +1970,7 @@ package body Ada.Containers.Vectors is
-- Swap --
----------
- procedure Swap (Container : Vector; I, J : Index_Type) is
+ procedure Swap (Container : in out Vector; I, J : Index_Type) is
begin
if I > Container.Last
or else J > Container.Last
@@ -1949,7 +1998,7 @@ package body Ada.Containers.Vectors is
end;
end Swap;
- procedure Swap (I, J : Cursor) is
+ procedure Swap (Container : in out Vector; I, J : Cursor) is
begin
if I.Container = null
or else J.Container = null
@@ -1957,11 +2006,13 @@ package body Ada.Containers.Vectors is
raise Constraint_Error;
end if;
- if I.Container /= J.Container then
+ if I.Container /= Container'Unrestricted_Access
+ or else J.Container /= Container'Unrestricted_Access
+ then
raise Program_Error;
end if;
- Swap (I.Container.all, I.Index, J.Index);
+ Swap (Container, I.Index, J.Index);
end Swap;
---------------
@@ -2057,13 +2108,12 @@ package body Ada.Containers.Vectors is
--------------------
procedure Update_Element
- (Container : Vector;
+ (Container : in out Vector;
Index : Index_Type;
Process : not null access procedure (Element : in out Element_Type))
is
- V : Vector renames Container'Unrestricted_Access.all;
- B : Natural renames V.Busy;
- L : Natural renames V.Lock;
+ B : Natural renames Container.Busy;
+ L : Natural renames Container.Lock;
begin
if Index > Container.Last then
@@ -2074,7 +2124,7 @@ package body Ada.Containers.Vectors is
L := L + 1;
begin
- Process (V.Elements (Index));
+ Process (Container.Elements (Index));
exception
when others =>
L := L - 1;
@@ -2087,15 +2137,20 @@ package body Ada.Containers.Vectors is
end Update_Element;
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Element : in out Element_Type))
+ (Container : in out Vector;
+ Position : Cursor;
+ Process : not null access procedure (Element : in out Element_Type))
is
begin
if Position.Container = null then
raise Constraint_Error;
end if;
- Update_Element (Position.Container.all, Position.Index, Process);
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
+
+ Update_Element (Container, Position.Index, Process);
end Update_Element;
-----------
@@ -2114,4 +2169,12 @@ package body Ada.Containers.Vectors is
end loop;
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Position : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Vectors;
diff --git a/gcc/ada/a-convec.ads b/gcc/ada/a-convec.ads
index 9b5c9bb82cf..5b268b5e3f0 100644
--- a/gcc/ada/a-convec.ads
+++ b/gcc/ada/a-convec.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -50,8 +50,6 @@ package Ada.Containers.Vectors is
No_Index : constant Extended_Index := Extended_Index'First;
- subtype Index_Subtype is Index_Type;
-
type Vector is tagged private;
type Cursor is private;
@@ -60,6 +58,8 @@ package Ada.Containers.Vectors is
No_Element : constant Cursor;
+ function "=" (Left, Right : Vector) return Boolean;
+
function To_Vector (Length : Count_Type) return Vector;
function To_Vector
@@ -74,8 +74,6 @@ package Ada.Containers.Vectors is
function "&" (Left, Right : Element_Type) return Vector;
- function "=" (Left, Right : Vector) return Boolean;
-
function Capacity (Container : Vector) return Count_Type;
procedure Reserve_Capacity
@@ -84,6 +82,10 @@ package Ada.Containers.Vectors is
function Length (Container : Vector) return Count_Type;
+ procedure Set_Length
+ (Container : in out Vector;
+ Length : Count_Type);
+
function Is_Empty (Container : Vector) return Boolean;
procedure Clear (Container : in out Vector);
@@ -100,6 +102,16 @@ package Ada.Containers.Vectors is
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out Vector;
+ Index : Index_Type;
+ New_Item : Element_Type);
+
+ procedure Replace_Element
+ (Container : in out Vector;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Container : Vector;
Index : Index_Type;
@@ -110,22 +122,14 @@ package Ada.Containers.Vectors is
Process : not null access procedure (Element : Element_Type));
procedure Update_Element
- (Container : Vector;
+ (Container : in out Vector;
Index : Index_Type;
Process : not null access procedure (Element : in out Element_Type));
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Element : in out Element_Type));
-
- procedure Replace_Element
- (Container : Vector;
- Index : Index_Type;
- By : Element_Type);
-
- procedure Replace_Element (Position : Cursor; By : Element_Type);
-
- procedure Assign (Target : in out Vector; Source : Vector);
+ (Container : in out Vector;
+ Position : Cursor;
+ Process : not null access procedure (Element : in out Element_Type));
procedure Move (Target : in out Vector; Source : in out Vector);
@@ -164,6 +168,17 @@ package Ada.Containers.Vectors is
Position : out Cursor;
Count : Count_Type := 1);
+ procedure Insert
+ (Container : in out Vector;
+ Before : Extended_Index;
+ Count : Count_Type := 1);
+
+ procedure Insert
+ (Container : in out Vector;
+ Before : Cursor;
+ Position : out Cursor;
+ Count : Count_Type := 1);
+
procedure Prepend
(Container : in out Vector;
New_Item : Vector);
@@ -193,10 +208,6 @@ package Ada.Containers.Vectors is
Position : out Cursor;
Count : Count_Type := 1);
- procedure Set_Length
- (Container : in out Vector;
- Length : Count_Type);
-
procedure Delete
(Container : in out Vector;
Index : Extended_Index;
@@ -215,6 +226,12 @@ package Ada.Containers.Vectors is
(Container : in out Vector;
Count : Count_Type := 1);
+ procedure Reverse_Elements (Container : in out Vector);
+
+ procedure Swap (Container : in out Vector; I, J : Index_Type);
+
+ procedure Swap (Container : in out Vector; I, J : Cursor);
+
function First_Index (Container : Vector) return Index_Type;
function First (Container : Vector) return Cursor;
@@ -227,21 +244,13 @@ package Ada.Containers.Vectors is
function Last_Element (Container : Vector) return Element_Type;
- procedure Swap (Container : Vector; I, J : Index_Type);
-
- procedure Swap (I, J : Cursor);
-
- generic
- with function "<" (Left, Right : Element_Type) return Boolean is <>;
- package Generic_Sorting is
-
- function Is_Sorted (Container : Vector) return Boolean;
+ function Next (Position : Cursor) return Cursor;
- procedure Sort (Container : in out Vector);
+ procedure Next (Position : in out Cursor);
- procedure Merge (Target, Source : in out Vector);
+ function Previous (Position : Cursor) return Cursor;
- end Generic_Sorting;
+ procedure Previous (Position : in out Cursor);
function Find_Index
(Container : Vector;
@@ -267,14 +276,6 @@ package Ada.Containers.Vectors is
(Container : Vector;
Item : Element_Type) return Boolean;
- function Next (Position : Cursor) return Cursor;
-
- function Previous (Position : Cursor) return Cursor;
-
- procedure Next (Position : in out Cursor);
-
- procedure Previous (Position : in out Cursor);
-
function Has_Element (Position : Cursor) return Boolean;
procedure Iterate
@@ -285,6 +286,18 @@ package Ada.Containers.Vectors is
(Container : Vector;
Process : not null access procedure (Position : Cursor));
+ generic
+ with function "<" (Left, Right : Element_Type) return Boolean is <>;
+ package Generic_Sorting is
+
+ function Is_Sorted (Container : Vector) return Boolean;
+
+ procedure Sort (Container : in out Vector);
+
+ procedure Merge (Target : in out Vector; Source : in out Vector);
+
+ end Generic_Sorting;
+
private
pragma Inline (First_Index);
@@ -340,6 +353,18 @@ private
Index : Index_Type := Index_Type'First;
end record;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Position : Cursor);
+
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Position : out Cursor);
+
+ for Cursor'Read use Read;
+
No_Element : constant Cursor := Cursor'(null, Index_Type'First);
end Ada.Containers.Vectors;
diff --git a/gcc/ada/a-coorma.adb b/gcc/ada/a-coorma.adb
index ba363b72436..fad63d4e498 100644
--- a/gcc/ada/a-coorma.adb
+++ b/gcc/ada/a-coorma.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -81,6 +81,8 @@ package body Ada.Containers.Ordered_Maps is
function Copy_Node (Source : Node_Access) return Node_Access;
pragma Inline (Copy_Node);
+ procedure Free (X : in out Node_Access);
+
function Is_Equal_Node_Node (L, R : Node_Access) return Boolean;
pragma Inline (Is_Equal_Node_Node);
@@ -98,8 +100,6 @@ package body Ada.Containers.Ordered_Maps is
-- Local Instantiations --
--------------------------
- procedure Free is new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
-
package Tree_Operations is
new Red_Black_Trees.Generic_Operations (Tree_Types);
@@ -127,16 +127,42 @@ package body Ada.Containers.Ordered_Maps is
function "<" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left.Node.Key < Right.Node.Key;
end "<";
function "<" (Left : Cursor; Right : Key_Type) return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
return Left.Node.Key < Right;
end "<";
function "<" (Left : Key_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left < Right.Node.Key;
end "<";
@@ -155,16 +181,42 @@ package body Ada.Containers.Ordered_Maps is
function ">" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
return Right.Node.Key < Left.Node.Key;
end ">";
function ">" (Left : Cursor; Right : Key_Type) return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
return Right < Left.Node.Key;
end ">";
function ">" (Left : Key_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
return Right.Node.Key < Left;
end ">";
@@ -231,12 +283,12 @@ package body Ada.Containers.Ordered_Maps is
function Copy_Node (Source : Node_Access) return Node_Access is
Target : constant Node_Access :=
- new Node_Type'(Parent => null,
- Left => null,
- Right => null,
- Color => Source.Color,
+ new Node_Type'(Color => Source.Color,
Key => Source.Key,
- Element => Source.Element);
+ Element => Source.Element,
+ Parent => null,
+ Left => null,
+ Right => null);
begin
return Target;
end Copy_Node;
@@ -246,16 +298,20 @@ package body Ada.Containers.Ordered_Maps is
------------
procedure Delete (Container : in out Map; Position : in out Cursor) is
+ Tree : Tree_Type renames Container.Tree;
+
begin
if Position.Node = null then
raise Constraint_Error;
end if;
- if Position.Container /= Map_Access'(Container'Unrestricted_Access) then
+ if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
- Tree_Operations.Delete_Node_Sans_Free (Container.Tree, Position.Node);
+ pragma Assert (Vet (Tree, Position.Node), "bad cursor in Delete");
+
+ Tree_Operations.Delete_Node_Sans_Free (Tree, Position.Node);
Free (Position.Node);
Position.Container := null;
@@ -269,7 +325,7 @@ package body Ada.Containers.Ordered_Maps is
raise Constraint_Error;
end if;
- Delete_Node_Sans_Free (Container.Tree, X);
+ Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
Free (X);
end Delete;
@@ -279,6 +335,7 @@ package body Ada.Containers.Ordered_Maps is
procedure Delete_First (Container : in out Map) is
X : Node_Access := Container.Tree.First;
+
begin
if X /= null then
Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
@@ -292,6 +349,7 @@ package body Ada.Containers.Ordered_Maps is
procedure Delete_Last (Container : in out Map) is
X : Node_Access := Container.Tree.Last;
+
begin
if X /= null then
Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
@@ -305,15 +363,42 @@ package body Ada.Containers.Ordered_Maps is
function Element (Position : Cursor) return Element_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Element");
+
return Position.Node.Element;
end Element;
function Element (Container : Map; Key : Key_Type) return Element_Type is
Node : constant Node_Access := Key_Ops.Find (Container.Tree, Key);
+
begin
+ if Node = null then
+ raise Constraint_Error;
+ end if;
+
return Node.Element;
end Element;
+ ---------------------
+ -- Equivalent_Keys --
+ ---------------------
+
+ function Equivalent_Keys (Left, Right : Key_Type) return Boolean is
+ begin
+ if Left < Right
+ or else Right < Left
+ then
+ return False;
+ else
+ return True;
+ end if;
+ end Equivalent_Keys;
+
-------------
-- Exclude --
-------------
@@ -323,7 +408,7 @@ package body Ada.Containers.Ordered_Maps is
begin
if X /= null then
- Delete_Node_Sans_Free (Container.Tree, X);
+ Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
Free (X);
end if;
end Exclude;
@@ -348,12 +433,14 @@ package body Ada.Containers.Ordered_Maps is
-----------
function First (Container : Map) return Cursor is
+ T : Tree_Type renames Container.Tree;
+
begin
- if Container.Tree.First = null then
+ if T.First = null then
return No_Element;
end if;
- return Cursor'(Container'Unrestricted_Access, Container.Tree.First);
+ return Cursor'(Container'Unrestricted_Access, T.First);
end First;
-------------------
@@ -361,8 +448,14 @@ package body Ada.Containers.Ordered_Maps is
-------------------
function First_Element (Container : Map) return Element_Type is
+ T : Tree_Type renames Container.Tree;
+
begin
- return Container.Tree.First.Element;
+ if T.First = null then
+ raise Constraint_Error;
+ end if;
+
+ return T.First.Element;
end First_Element;
---------------
@@ -370,8 +463,14 @@ package body Ada.Containers.Ordered_Maps is
---------------
function First_Key (Container : Map) return Key_Type is
+ T : Tree_Type renames Container.Tree;
+
begin
- return Container.Tree.First.Key;
+ if T.First = null then
+ raise Constraint_Error;
+ end if;
+
+ return T.First.Key;
end First_Key;
-----------
@@ -389,6 +488,26 @@ package body Ada.Containers.Ordered_Maps is
return Cursor'(Container'Unrestricted_Access, Node);
end Floor;
+ ----------
+ -- Free --
+ ----------
+
+ procedure Free (X : in out Node_Access) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
+
+ begin
+ if X = null then
+ return;
+ end if;
+
+ X.Parent := X;
+ X.Left := X;
+ X.Right := X;
+
+ Deallocate (X);
+ end Free;
+
-----------------
-- Has_Element --
-----------------
@@ -444,15 +563,13 @@ package body Ada.Containers.Ordered_Maps is
--------------
function New_Node return Node_Access is
- Node : constant Node_Access :=
- new Node_Type'(Parent => null,
- Left => null,
- Right => null,
- Color => Red,
- Key => Key,
- Element => New_Item);
begin
- return Node;
+ return new Node_Type'(Key => Key,
+ Element => New_Item,
+ Color => Red_Black_Trees.Red,
+ Parent => null,
+ Left => null,
+ Right => null);
end New_Node;
-- Start of processing for Insert
@@ -507,18 +624,13 @@ package body Ada.Containers.Ordered_Maps is
--------------
function New_Node return Node_Access is
- Node : Node_Access := new Node_Type;
-
begin
- begin
- Node.Key := Key;
- exception
- when others =>
- Free (Node);
- raise;
- end;
-
- return Node;
+ return new Node_Type'(Key => Key,
+ Element => <>,
+ Color => Red_Black_Trees.Red,
+ Parent => null,
+ Left => null,
+ Right => null);
end New_Node;
-- Start of processing for Insert
@@ -633,6 +745,13 @@ package body Ada.Containers.Ordered_Maps is
function Key (Position : Cursor) return Key_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Key");
+
return Position.Node.Key;
end Key;
@@ -641,12 +760,14 @@ package body Ada.Containers.Ordered_Maps is
----------
function Last (Container : Map) return Cursor is
+ T : Tree_Type renames Container.Tree;
+
begin
- if Container.Tree.Last = null then
+ if T.Last = null then
return No_Element;
end if;
- return Cursor'(Container'Unrestricted_Access, Container.Tree.Last);
+ return Cursor'(Container'Unrestricted_Access, T.Last);
end Last;
------------------
@@ -654,8 +775,14 @@ package body Ada.Containers.Ordered_Maps is
------------------
function Last_Element (Container : Map) return Element_Type is
+ T : Tree_Type renames Container.Tree;
+
begin
- return Container.Tree.Last.Element;
+ if T.Last = null then
+ raise Constraint_Error;
+ end if;
+
+ return T.Last.Element;
end Last_Element;
--------------
@@ -663,8 +790,14 @@ package body Ada.Containers.Ordered_Maps is
--------------
function Last_Key (Container : Map) return Key_Type is
+ T : Tree_Type renames Container.Tree;
+
begin
- return Container.Tree.Last.Key;
+ if T.Last = null then
+ raise Constraint_Error;
+ end if;
+
+ return T.Last.Key;
end Last_Key;
----------
@@ -712,6 +845,9 @@ package body Ada.Containers.Ordered_Maps is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Next");
+
declare
Node : constant Node_Access :=
Tree_Operations.Next (Position.Node);
@@ -749,6 +885,9 @@ package body Ada.Containers.Ordered_Maps is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Previous");
+
declare
Node : constant Node_Access :=
Tree_Operations.Previous (Position.Node);
@@ -771,29 +910,40 @@ package body Ada.Containers.Ordered_Maps is
Process : not null access procedure (Key : Key_Type;
Element : Element_Type))
is
- K : Key_Type renames Position.Node.Key;
- E : Element_Type renames Position.Node.Element;
+ begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
- T : Tree_Type renames Position.Container.Tree;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Query_Element");
- B : Natural renames T.Busy;
- L : Natural renames T.Lock;
+ declare
+ T : Tree_Type renames Position.Container.Tree;
- begin
- B := B + 1;
- L := L + 1;
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
- Process (K, E);
- exception
- when others =>
- L := L - 1;
- B := B - 1;
- raise;
- end;
+ B := B + 1;
+ L := L + 1;
- L := L - 1;
- B := B - 1;
+ declare
+ K : Key_Type renames Position.Node.Key;
+ E : Element_Type renames Position.Node.Element;
+
+ begin
+ Process (K, E);
+ exception
+ when others =>
+ L := L - 1;
+ B := B - 1;
+ raise;
+ end;
+
+ L := L - 1;
+ B := B - 1;
+ end;
end Query_Element;
----------
@@ -835,6 +985,14 @@ package body Ada.Containers.Ordered_Maps is
Read (Stream, Container.Tree);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
-------------
-- Replace --
-------------
@@ -863,15 +1021,28 @@ package body Ada.Containers.Ordered_Maps is
-- Replace_Element --
---------------------
- procedure Replace_Element (Position : Cursor; By : Element_Type) is
- E : Element_Type renames Position.Node.Element;
-
+ procedure Replace_Element
+ (Container : in out Map;
+ Position : Cursor;
+ New_Item : Element_Type)
+ is
begin
- if Position.Container.Tree.Lock > 0 then
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ if Position.Container /= Container'Unrestricted_Access then
raise Program_Error;
end if;
- E := By;
+ if Container.Tree.Lock > 0 then
+ raise Program_Error;
+ end if;
+
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Replace_Element");
+
+ Position.Node.Element := New_Item;
end Replace_Element;
---------------------
@@ -968,33 +1139,49 @@ package body Ada.Containers.Ordered_Maps is
--------------------
procedure Update_Element
- (Position : Cursor;
- Process : not null access procedure (Key : Key_Type;
- Element : in out Element_Type))
+ (Container : in out Map;
+ Position : Cursor;
+ Process : not null access procedure (Key : Key_Type;
+ Element : in out Element_Type))
is
- K : Key_Type renames Position.Node.Key;
- E : Element_Type renames Position.Node.Element;
+ begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
- T : Tree_Type renames Position.Container.Tree;
+ if Position.Container /= Container'Unrestricted_Access then
+ raise Program_Error;
+ end if;
- B : Natural renames T.Busy;
- L : Natural renames T.Lock;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Update_Element");
- begin
- B := B + 1;
- L := L + 1;
+ declare
+ T : Tree_Type renames Container.Tree;
+
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
- Process (K, E);
- exception
- when others =>
- L := L - 1;
- B := B - 1;
- raise;
- end;
+ B := B + 1;
+ L := L + 1;
- L := L - 1;
- B := B - 1;
+ declare
+ K : Key_Type renames Position.Node.Key;
+ E : Element_Type renames Position.Node.Element;
+
+ begin
+ Process (K, E);
+ exception
+ when others =>
+ L := L - 1;
+ B := B - 1;
+ raise;
+ end;
+
+ L := L - 1;
+ B := B - 1;
+ end;
end Update_Element;
-----------
@@ -1032,4 +1219,12 @@ package body Ada.Containers.Ordered_Maps is
Write (Stream, Container.Tree);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Ordered_Maps;
diff --git a/gcc/ada/a-coorma.ads b/gcc/ada/a-coorma.ads
index 0efa16fbbb0..7f8386b4b13 100644
--- a/gcc/ada/a-coorma.ads
+++ b/gcc/ada/a-coorma.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -38,9 +38,7 @@ with Ada.Finalization;
with Ada.Streams;
generic
-
type Key_Type is private;
-
type Element_Type is private;
with function "<" (Left, Right : Key_Type) return Boolean is <>;
@@ -49,6 +47,8 @@ generic
package Ada.Containers.Ordered_Maps is
pragma Preelaborate;
+ function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
+
type Map is tagged private;
type Cursor is private;
@@ -69,18 +69,22 @@ package Ada.Containers.Ordered_Maps is
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out Map;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : Element_Type));
procedure Update_Element
- (Position : Cursor;
- Process : not null access
+ (Container : in out Map;
+ Position : Cursor;
+ Process : not null access
procedure (Key : Key_Type; Element : in out Element_Type));
- procedure Replace_Element (Position : Cursor; By : in Element_Type);
-
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
@@ -111,6 +115,8 @@ package Ada.Containers.Ordered_Maps is
Key : Key_Type;
New_Item : Element_Type);
+ procedure Exclude (Container : in out Map; Key : Key_Type);
+
procedure Delete (Container : in out Map; Key : Key_Type);
procedure Delete (Container : in out Map; Position : in out Cursor);
@@ -119,30 +125,18 @@ package Ada.Containers.Ordered_Maps is
procedure Delete_Last (Container : in out Map);
- procedure Exclude (Container : in out Map; Key : Key_Type);
-
- function Contains (Container : Map; Key : Key_Type) return Boolean;
-
- function Find (Container : Map; Key : Key_Type) return Cursor;
-
- function Element (Container : Map; Key : Key_Type) return Element_Type;
-
- function Floor (Container : Map; Key : Key_Type) return Cursor;
-
- function Ceiling (Container : Map; Key : Key_Type) return Cursor;
-
function First (Container : Map) return Cursor;
- function First_Key (Container : Map) return Key_Type;
-
function First_Element (Container : Map) return Element_Type;
- function Last (Container : Map) return Cursor;
+ function First_Key (Container : Map) return Key_Type;
- function Last_Key (Container : Map) return Key_Type;
+ function Last (Container : Map) return Cursor;
function Last_Element (Container : Map) return Element_Type;
+ function Last_Key (Container : Map) return Key_Type;
+
function Next (Position : Cursor) return Cursor;
procedure Next (Position : in out Cursor);
@@ -151,6 +145,16 @@ package Ada.Containers.Ordered_Maps is
procedure Previous (Position : in out Cursor);
+ function Find (Container : Map; Key : Key_Type) return Cursor;
+
+ function Element (Container : Map; Key : Key_Type) return Element_Type;
+
+ function Floor (Container : Map; Key : Key_Type) return Cursor;
+
+ function Ceiling (Container : Map; Key : Key_Type) return Cursor;
+
+ function Contains (Container : Map; Key : Key_Type) return Boolean;
+
function Has_Element (Position : Cursor) return Boolean;
function "<" (Left, Right : Cursor) return Boolean;
@@ -202,8 +206,9 @@ private
use Red_Black_Trees;
use Tree_Types;
use Ada.Finalization;
+ use Ada.Streams;
- type Map_Access is access Map;
+ type Map_Access is access all Map;
for Map_Access'Storage_Size use 0;
type Cursor is record
@@ -211,9 +216,19 @@ private
Node : Node_Access;
end record;
- No_Element : constant Cursor := Cursor'(null, null);
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
- use Ada.Streams;
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ No_Element : constant Cursor := Cursor'(null, null);
procedure Write
(Stream : access Root_Stream_Type'Class;
diff --git a/gcc/ada/a-coormu.adb b/gcc/ada/a-coormu.adb
index caa44144d0f..eb1e3656229 100644
--- a/gcc/ada/a-coormu.adb
+++ b/gcc/ada/a-coormu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -84,6 +84,13 @@ package body Ada.Containers.Ordered_Multisets is
function Copy_Node (Source : Node_Access) return Node_Access;
pragma Inline (Copy_Node);
+ procedure Free (X : in out Node_Access);
+
+ procedure Insert_Sans_Hint
+ (Tree : in out Tree_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access);
+
procedure Insert_With_Hint
(Dst_Tree : in out Tree_Type;
Dst_Hint : Node_Access;
@@ -115,9 +122,6 @@ package body Ada.Containers.Ordered_Multisets is
-- Local Instantiations --
--------------------------
- procedure Free is
- new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
-
package Tree_Operations is
new Red_Black_Trees.Generic_Operations (Tree_Types);
@@ -154,18 +158,44 @@ package body Ada.Containers.Ordered_Multisets is
function "<" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left.Node.Element < Right.Node.Element;
end "<";
function "<" (Left : Cursor; Right : Element_Type)
return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
return Left.Node.Element < Right;
end "<";
function "<" (Left : Element_Type; Right : Cursor)
return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left < Right.Node.Element;
end "<";
@@ -184,6 +214,18 @@ package body Ada.Containers.Ordered_Multisets is
function ">" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
-- L > R same as R < L
return Right.Node.Element < Left.Node.Element;
@@ -192,12 +234,26 @@ package body Ada.Containers.Ordered_Multisets is
function ">" (Left : Cursor; Right : Element_Type)
return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
return Right < Left.Node.Element;
end ">";
function ">" (Left : Element_Type; Right : Cursor)
return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
return Right.Node.Element < Left;
end ">";
@@ -299,7 +355,7 @@ package body Ada.Containers.Ordered_Multisets is
end loop;
end Delete;
- procedure Delete (Container : in out Set; Position : in out Cursor) is
+ procedure Delete (Container : in out Set; Position : in out Cursor) is
begin
if Position.Node = null then
raise Constraint_Error;
@@ -309,6 +365,9 @@ package body Ada.Containers.Ordered_Multisets is
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Delete");
+
Delete_Node_Sans_Free (Container.Tree, Position.Node);
Free (Position.Node);
@@ -371,9 +430,31 @@ package body Ada.Containers.Ordered_Multisets is
function Element (Position : Cursor) return Element_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Element");
+
return Position.Node.Element;
end Element;
+ -------------------------
+ -- Equivalent_Elements --
+ -------------------------
+
+ function Equivalent_Elements (Left, Right : Element_Type) return Boolean is
+ begin
+ if Left < Right
+ or else Right < Left
+ then
+ return False;
+ else
+ return True;
+ end if;
+ end Equivalent_Elements;
+
---------------------
-- Equivalent_Sets --
---------------------
@@ -460,6 +541,10 @@ package body Ada.Containers.Ordered_Multisets is
function First_Element (Container : Set) return Element_Type is
begin
+ if Container.Tree.First = null then
+ raise Constraint_Error;
+ end if;
+
return Container.Tree.First.Element;
end First_Element;
@@ -479,6 +564,24 @@ package body Ada.Containers.Ordered_Multisets is
return Cursor'(Container'Unrestricted_Access, Node);
end Floor;
+ ----------
+ -- Free --
+ ----------
+
+ procedure Free (X : in out Node_Access) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
+
+ begin
+ if X /= null then
+ X.Parent := X;
+ X.Left := X;
+ X.Right := X;
+
+ Deallocate (X);
+ end if;
+ end Free;
+
------------------
-- Generic_Keys --
------------------
@@ -510,34 +613,6 @@ package body Ada.Containers.Ordered_Multisets is
Is_Less_Key_Node => Is_Less_Key_Node,
Is_Greater_Key_Node => Is_Greater_Key_Node);
- ---------
- -- "<" --
- ---------
-
- function "<" (Left : Key_Type; Right : Cursor) return Boolean is
- begin
- return Left < Right.Node.Element;
- end "<";
-
- function "<" (Left : Cursor; Right : Key_Type) return Boolean is
- begin
- return Right > Left.Node.Element;
- end "<";
-
- ---------
- -- ">" --
- ---------
-
- function ">" (Left : Cursor; Right : Key_Type) return Boolean is
- begin
- return Right < Left.Node.Element;
- end ">";
-
- function ">" (Left : Key_Type; Right : Cursor) return Boolean is
- begin
- return Left > Right.Node.Element;
- end ">";
-
-------------
-- Ceiling --
-------------
@@ -596,9 +671,28 @@ package body Ada.Containers.Ordered_Multisets is
Node : constant Node_Access :=
Key_Keys.Find (Container.Tree, Key);
begin
+ if Node = null then
+ raise Constraint_Error;
+ end if;
+
return Node.Element;
end Element;
+ ---------------------
+ -- Equivalent_Keys --
+ ---------------------
+
+ function Equivalent_Keys (Left, Right : Key_Type) return Boolean is
+ begin
+ if Left < Right
+ or else Right < Left
+ then
+ return False;
+ else
+ return True;
+ end if;
+ end Equivalent_Keys;
+
-------------
-- Exclude --
-------------
@@ -608,6 +702,7 @@ package body Ada.Containers.Ordered_Multisets is
Node : Node_Access := Key_Keys.Ceiling (Tree, Key);
Done : constant Node_Access := Key_Keys.Upper_Bound (Tree, Key);
X : Node_Access;
+
begin
while Node /= Done loop
X := Node;
@@ -657,7 +752,7 @@ package body Ada.Containers.Ordered_Multisets is
(Left : Key_Type;
Right : Node_Access) return Boolean is
begin
- return Left > Right.Element;
+ return Key (Right.Element) < Left;
end Is_Greater_Key_Node;
----------------------
@@ -668,7 +763,7 @@ package body Ada.Containers.Ordered_Multisets is
(Left : Key_Type;
Right : Node_Access) return Boolean is
begin
- return Left < Right.Element;
+ return Left < Key (Right.Element);
end Is_Less_Key_Node;
-------------
@@ -720,6 +815,13 @@ package body Ada.Containers.Ordered_Multisets is
function Key (Position : Cursor) return Key_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Key");
+
return Key (Position.Node.Element);
end Key;
@@ -786,9 +888,12 @@ package body Ada.Containers.Ordered_Multisets is
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Update_Element_Preserving_Key");
+
declare
E : Element_Type renames Position.Node.Element;
- K : Key_Type renames Key (E);
+ K : constant Key_Type := Key (E);
B : Natural renames Tree.Busy;
L : Natural renames Tree.Lock;
@@ -809,11 +914,7 @@ package body Ada.Containers.Ordered_Multisets is
L := L - 1;
B := B - 1;
- if K < E
- or else K > E
- then
- null;
- else
+ if Equivalent_Keys (Left => K, Right => Key (E)) then
return;
end if;
end;
@@ -854,6 +955,24 @@ package body Ada.Containers.Ordered_Multisets is
New_Item : Element_Type;
Position : out Cursor)
is
+ begin
+ Insert_Sans_Hint
+ (Container.Tree,
+ New_Item,
+ Position.Node);
+
+ Position.Container := Container'Unrestricted_Access;
+ end Insert;
+
+ ----------------------
+ -- Insert_Sans_Hint --
+ ----------------------
+
+ procedure Insert_Sans_Hint
+ (Tree : in out Tree_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access)
+ is
function New_Node return Node_Access;
pragma Inline (New_Node);
@@ -869,25 +988,23 @@ package body Ada.Containers.Ordered_Multisets is
function New_Node return Node_Access is
Node : constant Node_Access :=
- new Node_Type'(Parent => null,
- Left => null,
- Right => null,
- Color => Red,
+ new Node_Type'(Parent => null,
+ Left => null,
+ Right => null,
+ Color => Red_Black_Trees.Red,
Element => New_Item);
begin
return Node;
end New_Node;
- -- Start of processing for Insert
+ -- Start of processing for Insert_Sans_Hint
begin
Unconditional_Insert_Sans_Hint
- (Container.Tree,
+ (Tree,
New_Item,
- Position.Node);
-
- Position.Container := Container'Unrestricted_Access;
- end Insert;
+ Node);
+ end Insert_Sans_Hint;
----------------------
-- Insert_With_Hint --
@@ -1116,6 +1233,10 @@ package body Ada.Containers.Ordered_Multisets is
function Last_Element (Container : Set) return Element_Type is
begin
+ if Container.Tree.Last = null then
+ raise Constraint_Error;
+ end if;
+
return Container.Tree.Last.Element;
end Last_Element;
@@ -1165,6 +1286,9 @@ package body Ada.Containers.Ordered_Multisets is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Next");
+
declare
Node : constant Node_Access :=
Tree_Operations.Next (Position.Node);
@@ -1211,6 +1335,9 @@ package body Ada.Containers.Ordered_Multisets is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Previous");
+
declare
Node : constant Node_Access :=
Tree_Operations.Previous (Position.Node);
@@ -1231,29 +1358,36 @@ package body Ada.Containers.Ordered_Multisets is
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
- E : Element_Type renames Position.Node.Element;
+ begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
- S : Set renames Position.Container.all;
- T : Tree_Type renames S.Tree'Unrestricted_Access.all;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Query_Element");
- B : Natural renames T.Busy;
- L : Natural renames T.Lock;
+ declare
+ T : Tree_Type renames Position.Container.Tree;
- begin
- B := B + 1;
- L := L + 1;
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
- Process (E);
- exception
- when others =>
- L := L - 1;
- B := B - 1;
- raise;
- end;
+ B := B + 1;
+ L := L + 1;
- L := L - 1;
- B := B - 1;
+ begin
+ Process (Position.Node.Element);
+ exception
+ when others =>
+ L := L - 1;
+ B := B - 1;
+ raise;
+ end;
+
+ L := L - 1;
+ B := B - 1;
+ end;
end Query_Element;
----------
@@ -1294,6 +1428,14 @@ package body Ada.Containers.Ordered_Multisets is
Read (Stream, Container.Tree);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
---------------------
-- Replace_Element --
---------------------
@@ -1336,6 +1478,11 @@ package body Ada.Containers.Ordered_Multisets is
function New_Node return Node_Access is
begin
Node.Element := Item;
+ Node.Color := Red_Black_Trees.Red;
+ Node.Parent := null;
+ Node.Left := null;
+ Node.Right := null;
+
return Node;
end New_Node;
@@ -1354,12 +1501,10 @@ package body Ada.Containers.Ordered_Multisets is
end Replace_Element;
procedure Replace_Element
- (Container : Set;
+ (Container : in out Set;
Position : Cursor;
- By : Element_Type)
+ New_Item : Element_Type)
is
- Tree : Tree_Type renames Container.Tree'Unrestricted_Access.all;
-
begin
if Position.Node = null then
raise Constraint_Error;
@@ -1369,7 +1514,10 @@ package body Ada.Containers.Ordered_Multisets is
raise Program_Error;
end if;
- Replace_Element (Tree, Position.Node, By);
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Replace_Element");
+
+ Replace_Element (Container.Tree, Position.Node, New_Item);
end Replace_Element;
---------------------
@@ -1514,6 +1662,19 @@ package body Ada.Containers.Ordered_Multisets is
return Set'(Controlled with Tree);
end Symmetric_Difference;
+ ------------
+ -- To_Set --
+ ------------
+
+ function To_Set (New_Item : Element_Type) return Set is
+ Tree : Tree_Type;
+ Node : Node_Access;
+
+ begin
+ Insert_Sans_Hint (Tree, New_Item, Node);
+ return Set'(Controlled with Tree);
+ end To_Set;
+
-----------
-- Union --
-----------
@@ -1564,4 +1725,12 @@ package body Ada.Containers.Ordered_Multisets is
Write (Stream, Container.Tree);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Ordered_Multisets;
diff --git a/gcc/ada/a-coormu.ads b/gcc/ada/a-coormu.ads
index cb42f07d349..ab3d4d4d01e 100644
--- a/gcc/ada/a-coormu.ads
+++ b/gcc/ada/a-coormu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -46,6 +46,8 @@ generic
package Ada.Containers.Ordered_Multisets is
pragma Preelaborate;
+ function Equivalent_Elements (Left, Right : Element_Type) return Boolean;
+
type Set is tagged private;
type Cursor is private;
@@ -58,6 +60,8 @@ package Ada.Containers.Ordered_Multisets is
function Equivalent_Sets (Left, Right : Set) return Boolean;
+ function To_Set (New_Item : Element_Type) return Set;
+
function Length (Container : Set) return Count_Type;
function Is_Empty (Container : Set) return Boolean;
@@ -66,18 +70,16 @@ package Ada.Containers.Ordered_Multisets is
function Element (Position : Cursor) return Element_Type;
+ procedure Replace_Element
+ (Container : in out Set;
+ Position : Cursor;
+ New_Item : Element_Type);
+
procedure Query_Element
(Position : Cursor;
Process : not null access procedure (Element : Element_Type));
- procedure Replace_Element
- (Container : Set;
- Position : Cursor;
- By : Element_Type);
-
- procedure Move
- (Target : in out Set;
- Source : in out Set);
+ procedure Move (Target : in out Set; Source : in out Set);
procedure Insert
(Container : in out Set;
@@ -88,6 +90,16 @@ package Ada.Containers.Ordered_Multisets is
(Container : in out Set;
New_Item : Element_Type);
+-- TODO: include Replace too???
+--
+-- procedure Replace
+-- (Container : in out Set;
+-- New_Item : Element_Type);
+
+ procedure Exclude
+ (Container : in out Set;
+ Item : Element_Type);
+
procedure Delete
(Container : in out Set;
Item : Element_Type);
@@ -100,10 +112,6 @@ package Ada.Containers.Ordered_Multisets is
procedure Delete_Last (Container : in out Set);
- procedure Exclude
- (Container : in out Set;
- Item : Element_Type);
-
procedure Union (Target : in out Set; Source : Set);
function Union (Left, Right : Set) return Set;
@@ -132,14 +140,6 @@ package Ada.Containers.Ordered_Multisets is
function Is_Subset (Subset : Set; Of_Set : Set) return Boolean;
- function Contains (Container : Set; Item : Element_Type) return Boolean;
-
- function Find (Container : Set; Item : Element_Type) return Cursor;
-
- function Floor (Container : Set; Item : Element_Type) return Cursor;
-
- function Ceiling (Container : Set; Item : Element_Type) return Cursor;
-
function First (Container : Set) return Cursor;
function First_Element (Container : Set) return Element_Type;
@@ -156,6 +156,14 @@ package Ada.Containers.Ordered_Multisets is
procedure Previous (Position : in out Cursor);
+ function Find (Container : Set; Item : Element_Type) return Cursor;
+
+ function Floor (Container : Set; Item : Element_Type) return Cursor;
+
+ function Ceiling (Container : Set; Item : Element_Type) return Cursor;
+
+ function Contains (Container : Set; Item : Element_Type) return Boolean;
+
function Has_Element (Position : Cursor) return Boolean;
function "<" (Left, Right : Cursor) return Boolean;
@@ -189,47 +197,37 @@ package Ada.Containers.Ordered_Multisets is
Process : not null access procedure (Position : Cursor));
generic
- type Key_Type (<>) is limited private;
+ type Key_Type (<>) is private;
with function Key (Element : Element_Type) return Key_Type;
- with function "<" (Left : Key_Type; Right : Element_Type)
- return Boolean is <>;
-
- with function ">" (Left : Key_Type; Right : Element_Type)
- return Boolean is <>;
+ with function "<" (Left, Right : Key_Type) return Boolean is <>;
package Generic_Keys is
- function Contains (Container : Set; Key : Key_Type) return Boolean;
-
- function Find (Container : Set; Key : Key_Type) return Cursor;
-
- function Floor (Container : Set; Key : Key_Type) return Cursor;
-
- function Ceiling (Container : Set; Key : Key_Type) return Cursor;
+ function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
function Key (Position : Cursor) return Key_Type;
function Element (Container : Set; Key : Key_Type) return Element_Type;
- procedure Delete (Container : in out Set; Key : Key_Type);
-
procedure Exclude (Container : in out Set; Key : Key_Type);
- function "<" (Left : Cursor; Right : Key_Type) return Boolean;
+ procedure Delete (Container : in out Set; Key : Key_Type);
+
+ function Find (Container : Set; Key : Key_Type) return Cursor;
- function ">" (Left : Cursor; Right : Key_Type) return Boolean;
+ function Floor (Container : Set; Key : Key_Type) return Cursor;
- function "<" (Left : Key_Type; Right : Cursor) return Boolean;
+ function Ceiling (Container : Set; Key : Key_Type) return Cursor;
- function ">" (Left : Key_Type; Right : Cursor) return Boolean;
+ function Contains (Container : Set; Key : Key_Type) return Boolean;
procedure Update_Element_Preserving_Key
(Container : in out Set;
Position : Cursor;
Process : not null access
- procedure (Element : in out Element_Type));
+ procedure (Element : in out Element_Type));
procedure Iterate
(Container : Set;
@@ -271,6 +269,7 @@ private
use Red_Black_Trees;
use Tree_Types;
use Ada.Finalization;
+ use Ada.Streams;
type Set_Access is access all Set;
for Set_Access'Storage_Size use 0;
@@ -280,9 +279,19 @@ private
Node : Node_Access;
end record;
- No_Element : constant Cursor := Cursor'(null, null);
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
- use Ada.Streams;
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ No_Element : constant Cursor := Cursor'(null, null);
procedure Write
(Stream : access Root_Stream_Type'Class;
diff --git a/gcc/ada/a-coorse.adb b/gcc/ada/a-coorse.adb
index 04652f80444..9060552302b 100644
--- a/gcc/ada/a-coorse.adb
+++ b/gcc/ada/a-coorse.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -84,6 +84,14 @@ package body Ada.Containers.Ordered_Sets is
function Copy_Node (Source : Node_Access) return Node_Access;
pragma Inline (Copy_Node);
+ procedure Free (X : in out Node_Access);
+
+ procedure Insert_Sans_Hint
+ (Tree : in out Tree_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access;
+ Inserted : out Boolean);
+
procedure Insert_With_Hint
(Dst_Tree : in out Tree_Type;
Dst_Hint : Node_Access;
@@ -115,9 +123,6 @@ package body Ada.Containers.Ordered_Sets is
-- Local Instantiations --
--------------------------
- procedure Free is
- new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
-
package Tree_Operations is
new Red_Black_Trees.Generic_Operations (Tree_Types);
@@ -154,16 +159,42 @@ package body Ada.Containers.Ordered_Sets is
function "<" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left.Node.Element < Right.Node.Element;
end "<";
function "<" (Left : Cursor; Right : Element_Type) return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in ""<""");
+
return Left.Node.Element < Right;
end "<";
function "<" (Left : Element_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in ""<""");
+
return Left < Right.Node.Element;
end "<";
@@ -182,6 +213,18 @@ package body Ada.Containers.Ordered_Sets is
function ">" (Left, Right : Cursor) return Boolean is
begin
+ if Left.Node = null
+ or else Right.Node = null
+ then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
-- L > R same as R < L
return Right.Node.Element < Left.Node.Element;
@@ -189,11 +232,25 @@ package body Ada.Containers.Ordered_Sets is
function ">" (Left : Element_Type; Right : Cursor) return Boolean is
begin
+ if Right.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Right.Container.Tree, Right.Node),
+ "bad Right cursor in "">""");
+
return Right.Node.Element < Left;
end ">";
function ">" (Left : Cursor; Right : Element_Type) return Boolean is
begin
+ if Left.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Left.Container.Tree, Left.Node),
+ "bad Left cursor in "">""");
+
return Right < Left.Node.Element;
end ">";
@@ -287,6 +344,9 @@ package body Ada.Containers.Ordered_Sets is
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Delete");
+
Tree_Operations.Delete_Node_Sans_Free (Container.Tree, Position.Node);
Free (Position.Node);
Position.Container := null;
@@ -356,6 +416,13 @@ package body Ada.Containers.Ordered_Sets is
function Element (Position : Cursor) return Element_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Element");
+
return Position.Node.Element;
end Element;
@@ -455,6 +522,10 @@ package body Ada.Containers.Ordered_Sets is
function First_Element (Container : Set) return Element_Type is
begin
+ if Container.Tree.First = null then
+ raise Constraint_Error;
+ end if;
+
return Container.Tree.First.Element;
end First_Element;
@@ -474,6 +545,24 @@ package body Ada.Containers.Ordered_Sets is
return Cursor'(Container'Unrestricted_Access, Node);
end Floor;
+ ----------
+ -- Free --
+ ----------
+
+ procedure Free (X : in out Node_Access) is
+ procedure Deallocate is
+ new Ada.Unchecked_Deallocation (Node_Type, Node_Access);
+
+ begin
+ if X /= null then
+ X.Parent := X;
+ X.Left := X;
+ X.Right := X;
+
+ Deallocate (X);
+ end if;
+ end Free;
+
------------------
-- Generic_Keys --
------------------
@@ -550,13 +639,15 @@ package body Ada.Containers.Ordered_Sets is
-- Element --
-------------
- function Element
- (Container : Set;
- Key : Key_Type) return Element_Type
- is
- Node : constant Node_Access := Key_Keys.Find (Container.Tree, Key);
+ function Element (Container : Set; Key : Key_Type) return Element_Type is
+ Node : constant Node_Access :=
+ Key_Keys.Find (Container.Tree, Key);
begin
+ if Node = null then
+ raise Constraint_Error;
+ end if;
+
return Node.Element;
end Element;
@@ -649,6 +740,13 @@ package body Ada.Containers.Ordered_Sets is
function Key (Position : Cursor) return Key_Type is
begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
+
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Key");
+
return Key (Position.Node.Element);
end Key;
@@ -691,6 +789,9 @@ package body Ada.Containers.Ordered_Sets is
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Update_Element_Preserving_Key");
+
declare
E : Element_Type renames Position.Node.Element;
K : constant Key_Type := Key (E);
@@ -770,32 +871,6 @@ package body Ada.Containers.Ordered_Sets is
Position : out Cursor;
Inserted : out Boolean)
is
- function New_Node return Node_Access;
- pragma Inline (New_Node);
-
- procedure Insert_Post is
- new Element_Keys.Generic_Insert_Post (New_Node);
-
- procedure Insert_Sans_Hint is
- new Element_Keys.Generic_Conditional_Insert (Insert_Post);
-
- --------------
- -- New_Node --
- --------------
-
- function New_Node return Node_Access is
- Node : constant Node_Access :=
- new Node_Type'(Parent => null,
- Left => null,
- Right => null,
- Color => Red,
- Element => New_Item);
- begin
- return Node;
- end New_Node;
-
- -- Start of processing for Insert
-
begin
Insert_Sans_Hint
(Container.Tree,
@@ -822,6 +897,48 @@ package body Ada.Containers.Ordered_Sets is
end Insert;
----------------------
+ -- Insert_Sans_Hint --
+ ----------------------
+
+ procedure Insert_Sans_Hint
+ (Tree : in out Tree_Type;
+ New_Item : Element_Type;
+ Node : out Node_Access;
+ Inserted : out Boolean)
+ is
+ function New_Node return Node_Access;
+ pragma Inline (New_Node);
+
+ procedure Insert_Post is
+ new Element_Keys.Generic_Insert_Post (New_Node);
+
+ procedure Conditional_Insert_Sans_Hint is
+ new Element_Keys.Generic_Conditional_Insert (Insert_Post);
+
+ --------------
+ -- New_Node --
+ --------------
+
+ function New_Node return Node_Access is
+ begin
+ return new Node_Type'(Parent => null,
+ Left => null,
+ Right => null,
+ Color => Red_Black_Trees.Red,
+ Element => New_Item);
+ end New_Node;
+
+ -- Start of processing for Insert_Sans_Hint
+
+ begin
+ Conditional_Insert_Sans_Hint
+ (Tree,
+ New_Item,
+ Node,
+ Inserted);
+ end Insert_Sans_Hint;
+
+ ----------------------
-- Insert_With_Hint --
----------------------
@@ -1012,6 +1129,10 @@ package body Ada.Containers.Ordered_Sets is
function Last_Element (Container : Set) return Element_Type is
begin
+ if Container.Tree.Last = null then
+ raise Constraint_Error;
+ end if;
+
return Container.Tree.Last.Element;
end Last_Element;
@@ -1055,6 +1176,9 @@ package body Ada.Containers.Ordered_Sets is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Next");
+
declare
Node : constant Node_Access :=
Tree_Operations.Next (Position.Node);
@@ -1101,6 +1225,9 @@ package body Ada.Containers.Ordered_Sets is
return No_Element;
end if;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Previous");
+
declare
Node : constant Node_Access :=
Tree_Operations.Previous (Position.Node);
@@ -1127,29 +1254,36 @@ package body Ada.Containers.Ordered_Sets is
(Position : Cursor;
Process : not null access procedure (Element : Element_Type))
is
- E : Element_Type renames Position.Node.Element;
+ begin
+ if Position.Node = null then
+ raise Constraint_Error;
+ end if;
- S : Set renames Position.Container.all;
- T : Tree_Type renames S.Tree'Unrestricted_Access.all;
+ pragma Assert (Vet (Position.Container.Tree, Position.Node),
+ "bad cursor in Query_Element");
- B : Natural renames T.Busy;
- L : Natural renames T.Lock;
+ declare
+ T : Tree_Type renames Position.Container.Tree;
- begin
- B := B + 1;
- L := L + 1;
+ B : Natural renames T.Busy;
+ L : Natural renames T.Lock;
begin
- Process (E);
- exception
- when others =>
- L := L - 1;
- B := B - 1;
- raise;
- end;
+ B := B + 1;
+ L := L + 1;
- L := L - 1;
- B := B - 1;
+ begin
+ Process (Position.Node.Element);
+ exception
+ when others =>
+ L := L - 1;
+ B := B - 1;
+ raise;
+ end;
+
+ L := L - 1;
+ B := B - 1;
+ end;
end Query_Element;
----------
@@ -1192,6 +1326,14 @@ package body Ada.Containers.Ordered_Sets is
Read (Stream, Container.Tree);
end Read;
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Read;
+
-------------
-- Replace --
-------------
@@ -1254,6 +1396,11 @@ package body Ada.Containers.Ordered_Sets is
function New_Node return Node_Access is
begin
Node.Element := Item;
+ Node.Color := Red;
+ Node.Parent := null;
+ Node.Right := null;
+ Node.Left := null;
+
return Node;
end New_Node;
@@ -1294,6 +1441,11 @@ package body Ada.Containers.Ordered_Sets is
function New_Node return Node_Access is
begin
+ Node.Color := Red;
+ Node.Parent := null;
+ Node.Right := null;
+ Node.Left := null;
+
return Node;
end New_Node;
@@ -1330,6 +1482,9 @@ package body Ada.Containers.Ordered_Sets is
raise Program_Error;
end if;
+ pragma Assert (Vet (Container.Tree, Position.Node),
+ "bad cursor in Replace_Element");
+
Replace_Element (Container.Tree, Position.Node, New_Item);
end Replace_Element;
@@ -1436,6 +1591,20 @@ package body Ada.Containers.Ordered_Sets is
return Set'(Controlled with Tree);
end Symmetric_Difference;
+ ------------
+ -- To_Set --
+ ------------
+
+ function To_Set (New_Item : Element_Type) return Set is
+ Tree : Tree_Type;
+ Node : Node_Access;
+ Inserted : Boolean;
+
+ begin
+ Insert_Sans_Hint (Tree, New_Item, Node, Inserted);
+ return Set'(Controlled with Tree);
+ end To_Set;
+
-----------
-- Union --
-----------
@@ -1486,4 +1655,12 @@ package body Ada.Containers.Ordered_Sets is
Write (Stream, Container.Tree);
end Write;
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor)
+ is
+ begin
+ raise Program_Error;
+ end Write;
+
end Ada.Containers.Ordered_Sets;
diff --git a/gcc/ada/a-coorse.ads b/gcc/ada/a-coorse.ads
index db5cfe5eae6..8afbd01e96f 100644
--- a/gcc/ada/a-coorse.ads
+++ b/gcc/ada/a-coorse.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -60,6 +60,8 @@ package Ada.Containers.Ordered_Sets is
function Equivalent_Sets (Left, Right : Set) return Boolean;
+ function To_Set (New_Item : Element_Type) return Set;
+
function Length (Container : Set) return Count_Type;
function Is_Empty (Container : Set) return Boolean;
@@ -255,6 +257,7 @@ private
use Red_Black_Trees;
use Tree_Types;
use Ada.Finalization;
+ use Ada.Streams;
type Set_Access is access all Set;
for Set_Access'Storage_Size use 0;
@@ -264,9 +267,19 @@ private
Node : Node_Access;
end record;
- No_Element : constant Cursor := Cursor'(null, null);
+ procedure Write
+ (Stream : access Root_Stream_Type'Class;
+ Item : Cursor);
- use Ada.Streams;
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ No_Element : constant Cursor := Cursor'(null, null);
procedure Write
(Stream : access Root_Stream_Type'Class;
diff --git a/gcc/ada/a-coprnu.adb b/gcc/ada/a-coprnu.adb
index af3d1648348..fd7f34580a8 100644
--- a/gcc/ada/a-coprnu.adb
+++ b/gcc/ada/a-coprnu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-crbltr.ads b/gcc/ada/a-crbltr.ads
index 9df13623d43..391892920f8 100644
--- a/gcc/ada/a-crbltr.ads
+++ b/gcc/ada/a-crbltr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-crbtgk.adb b/gcc/ada/a-crbtgk.adb
index aeed115edff..6d748a30ec3 100644
--- a/gcc/ada/a-crbtgk.adb
+++ b/gcc/ada/a-crbtgk.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-crbtgo.adb b/gcc/ada/a-crbtgo.adb
index 8dd62a5ce44..4720f8cbb48 100644
--- a/gcc/ada/a-crbtgo.adb
+++ b/gcc/ada/a-crbtgo.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -49,91 +49,91 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
procedure Left_Rotate (Tree : in out Tree_Type; X : Node_Access);
procedure Right_Rotate (Tree : in out Tree_Type; Y : Node_Access);
- ---------------------
- -- Check_Invariant --
- ---------------------
-
- procedure Check_Invariant (Tree : Tree_Type) is
- Root : constant Node_Access := Tree.Root;
-
- function Check (Node : Node_Access) return Natural;
-
- -----------
- -- Check --
- -----------
-
- function Check (Node : Node_Access) return Natural is
- begin
- if Node = null then
- return 0;
- end if;
-
- if Color (Node) = Red then
- declare
- L : constant Node_Access := Left (Node);
- begin
- pragma Assert (L = null or else Color (L) = Black);
- null;
- end;
-
- declare
- R : constant Node_Access := Right (Node);
- begin
- pragma Assert (R = null or else Color (R) = Black);
- null;
- end;
-
- declare
- NL : constant Natural := Check (Left (Node));
- NR : constant Natural := Check (Right (Node));
- begin
- pragma Assert (NL = NR);
- return NL;
- end;
- end if;
-
- declare
- NL : constant Natural := Check (Left (Node));
- NR : constant Natural := Check (Right (Node));
- begin
- pragma Assert (NL = NR);
- return NL + 1;
- end;
- end Check;
-
- -- Start of processing for Check_Invariant
-
- begin
- if Root = null then
- pragma Assert (Tree.First = null);
- pragma Assert (Tree.Last = null);
- pragma Assert (Tree.Length = 0);
- null;
-
- else
- pragma Assert (Color (Root) = Black);
- pragma Assert (Tree.Length > 0);
- pragma Assert (Tree.Root /= null);
- pragma Assert (Tree.First /= null);
- pragma Assert (Tree.Last /= null);
- pragma Assert (Parent (Tree.Root) = null);
- pragma Assert ((Tree.Length > 1)
- or else (Tree.First = Tree.Last
- and Tree.First = Tree.Root));
- pragma Assert (Left (Tree.First) = null);
- pragma Assert (Right (Tree.Last) = null);
-
- declare
- L : constant Node_Access := Left (Root);
- R : constant Node_Access := Right (Root);
- NL : constant Natural := Check (L);
- NR : constant Natural := Check (R);
- begin
- pragma Assert (NL = NR);
- null;
- end;
- end if;
- end Check_Invariant;
+-- ---------------------
+-- -- Check_Invariant --
+-- ---------------------
+
+-- procedure Check_Invariant (Tree : Tree_Type) is
+-- Root : constant Node_Access := Tree.Root;
+--
+-- function Check (Node : Node_Access) return Natural;
+--
+-- -----------
+-- -- Check --
+-- -----------
+--
+-- function Check (Node : Node_Access) return Natural is
+-- begin
+-- if Node = null then
+-- return 0;
+-- end if;
+--
+-- if Color (Node) = Red then
+-- declare
+-- L : constant Node_Access := Left (Node);
+-- begin
+-- pragma Assert (L = null or else Color (L) = Black);
+-- null;
+-- end;
+--
+-- declare
+-- R : constant Node_Access := Right (Node);
+-- begin
+-- pragma Assert (R = null or else Color (R) = Black);
+-- null;
+-- end;
+--
+-- declare
+-- NL : constant Natural := Check (Left (Node));
+-- NR : constant Natural := Check (Right (Node));
+-- begin
+-- pragma Assert (NL = NR);
+-- return NL;
+-- end;
+-- end if;
+--
+-- declare
+-- NL : constant Natural := Check (Left (Node));
+-- NR : constant Natural := Check (Right (Node));
+-- begin
+-- pragma Assert (NL = NR);
+-- return NL + 1;
+-- end;
+-- end Check;
+--
+-- -- Start of processing for Check_Invariant
+--
+-- begin
+-- if Root = null then
+-- pragma Assert (Tree.First = null);
+-- pragma Assert (Tree.Last = null);
+-- pragma Assert (Tree.Length = 0);
+-- null;
+--
+-- else
+-- pragma Assert (Color (Root) = Black);
+-- pragma Assert (Tree.Length > 0);
+-- pragma Assert (Tree.Root /= null);
+-- pragma Assert (Tree.First /= null);
+-- pragma Assert (Tree.Last /= null);
+-- pragma Assert (Parent (Tree.Root) = null);
+-- pragma Assert ((Tree.Length > 1)
+-- or else (Tree.First = Tree.Last
+-- and Tree.First = Tree.Root));
+-- pragma Assert (Left (Tree.First) = null);
+-- pragma Assert (Right (Tree.Last) = null);
+--
+-- declare
+-- L : constant Node_Access := Left (Root);
+-- R : constant Node_Access := Right (Root);
+-- NL : constant Natural := Check (L);
+-- NR : constant Natural := Check (R);
+-- begin
+-- pragma Assert (NL = NR);
+-- null;
+-- end;
+-- end if;
+-- end Check_Invariant;
------------------
-- Delete_Fixup --
@@ -249,22 +249,22 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
raise Program_Error;
end if;
- pragma Assert (Tree.Length > 0);
- pragma Assert (Tree.Root /= null);
- pragma Assert (Tree.First /= null);
- pragma Assert (Tree.Last /= null);
- pragma Assert (Parent (Tree.Root) = null);
- pragma Assert ((Tree.Length > 1)
- or else (Tree.First = Tree.Last
- and then Tree.First = Tree.Root));
- pragma Assert ((Left (Node) = null)
- or else (Parent (Left (Node)) = Node));
- pragma Assert ((Right (Node) = null)
- or else (Parent (Right (Node)) = Node));
- pragma Assert (((Parent (Node) = null) and then (Tree.Root = Node))
- or else ((Parent (Node) /= null) and then
- ((Left (Parent (Node)) = Node)
- or else (Right (Parent (Node)) = Node))));
+-- pragma Assert (Tree.Length > 0);
+-- pragma Assert (Tree.Root /= null);
+-- pragma Assert (Tree.First /= null);
+-- pragma Assert (Tree.Last /= null);
+-- pragma Assert (Parent (Tree.Root) = null);
+-- pragma Assert ((Tree.Length > 1)
+-- or else (Tree.First = Tree.Last
+-- and then Tree.First = Tree.Root));
+-- pragma Assert ((Left (Node) = null)
+-- or else (Parent (Left (Node)) = Node));
+-- pragma Assert ((Right (Node) = null)
+-- or else (Parent (Right (Node)) = Node));
+-- pragma Assert (((Parent (Node) = null) and then (Tree.Root = Node))
+-- or else ((Parent (Node) /= null) and then
+-- ((Left (Parent (Node)) = Node)
+-- or else (Right (Parent (Node)) = Node))));
if Left (Z) = null then
if Right (Z) = null then
@@ -545,7 +545,6 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
P, X : Node_Access;
begin
-
if Right (Source_Root) /= null then
Set_Right
(Node => Target_Root,
@@ -586,7 +585,6 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
when others =>
Delete_Tree (Target_Root);
raise;
-
end Generic_Copy_Tree;
-------------------------
@@ -1049,4 +1047,106 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
Set_Parent (Y, X);
end Right_Rotate;
+ ---------
+ -- Vet --
+ ---------
+
+ function Vet (Tree : Tree_Type; Node : Node_Access) return Boolean is
+ begin
+ if Node = null then
+ return True;
+ end if;
+
+ if Parent (Node) = Node
+ or else Left (Node) = Node
+ or else Right (Node) = Node
+ then
+ return False;
+ end if;
+
+ if Tree.Length = 0
+ or else Tree.Root = null
+ or else Tree.First = null
+ or else Tree.Last = null
+ then
+ return False;
+ end if;
+
+ if Parent (Tree.Root) /= null then
+ return False;
+ end if;
+
+ if Left (Tree.First) /= null then
+ return False;
+ end if;
+
+ if Right (Tree.Last) /= null then
+ return False;
+ end if;
+
+ if Tree.Length = 1 then
+ if Tree.First /= Tree.Last
+ or else Tree.First /= Tree.Root
+ then
+ return False;
+ end if;
+
+ if Node /= Tree.First then
+ return False;
+ end if;
+
+ if Parent (Node) /= null
+ or else Left (Node) /= null
+ or else Right (Node) /= null
+ then
+ return False;
+ end if;
+
+ return True;
+ end if;
+
+ if Tree.First = Tree.Last then
+ return False;
+ end if;
+
+ if Tree.Length = 2 then
+ if Tree.First /= Tree.Root
+ and then Tree.Last /= Tree.Root
+ then
+ return False;
+ end if;
+
+ if Tree.First /= Node
+ and then Tree.Last /= Node
+ then
+ return False;
+ end if;
+ end if;
+
+ if Left (Node) /= null
+ and then Parent (Left (Node)) /= Node
+ then
+ return False;
+ end if;
+
+ if Right (Node) /= null
+ and then Parent (Right (Node)) /= Node
+ then
+ return False;
+ end if;
+
+ if Parent (Node) = null then
+ if Tree.Root /= Node then
+ return False;
+ end if;
+
+ elsif Left (Parent (Node)) /= Node
+ and then Right (Parent (Node)) /= Node
+ then
+ return False;
+ end if;
+
+ return True;
+ end Vet;
+
end Ada.Containers.Red_Black_Trees.Generic_Operations;
diff --git a/gcc/ada/a-crbtgo.ads b/gcc/ada/a-crbtgo.ads
index 8b3ab50f7f8..a213a283010 100644
--- a/gcc/ada/a-crbtgo.ads
+++ b/gcc/ada/a-crbtgo.ads
@@ -7,7 +7,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -56,7 +56,14 @@ package Ada.Containers.Red_Black_Trees.Generic_Operations is
function Max (Node : Node_Access) return Node_Access;
- procedure Check_Invariant (Tree : Tree_Type);
+ -- NOTE: The Check_Invariant operation was used during early
+ -- development of the red-black tree. Now that the tree type
+ -- implementation has matured, we don't really need Check_Invariant
+ -- anymore.
+
+ -- procedure Check_Invariant (Tree : Tree_Type);
+
+ function Vet (Tree : Tree_Type; Node : Node_Access) return Boolean;
function Next (Node : Node_Access) return Node_Access;
diff --git a/gcc/ada/a-cwila1.ads b/gcc/ada/a-cwila1.ads
index 0237237bd19..b75ecf671d6 100644
--- a/gcc/ada/a-cwila1.ads
+++ b/gcc/ada/a-cwila1.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-cwila9.ads b/gcc/ada/a-cwila9.ads
index 94fcad9f27a..ff1d22480b7 100644
--- a/gcc/ada/a-cwila9.ads
+++ b/gcc/ada/a-cwila9.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-decima.adb b/gcc/ada/a-decima.adb
index c255efa20d8..80be38f920d 100644
--- a/gcc/ada/a-decima.adb
+++ b/gcc/ada/a-decima.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-decima.ads b/gcc/ada/a-decima.ads
index 960c9c04e7c..9fdbaa292ea 100644
--- a/gcc/ada/a-decima.ads
+++ b/gcc/ada/a-decima.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-diocst.ads b/gcc/ada/a-diocst.ads
index 947e19739fe..3681646ede0 100644
--- a/gcc/ada/a-diocst.ads
+++ b/gcc/ada/a-diocst.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-direct.adb b/gcc/ada/a-direct.adb
index 3d0216672b9..318d1044502 100644
--- a/gcc/ada/a-direct.adb
+++ b/gcc/ada/a-direct.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-direct.ads b/gcc/ada/a-direct.ads
index 5f381ef3aa7..3e2a2b239c4 100644
--- a/gcc/ada/a-direct.ads
+++ b/gcc/ada/a-direct.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived for use with GNAT from AI-00248, which is --
-- expected to be a part of a future expected revised Ada Reference Manual. --
diff --git a/gcc/ada/a-direio.adb b/gcc/ada/a-direio.adb
index b5f79391a71..a5351f54b55 100644
--- a/gcc/ada/a-direio.adb
+++ b/gcc/ada/a-direio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-direio.ads b/gcc/ada/a-direio.ads
index 97fcf85deae..a98e93f5fba 100644
--- a/gcc/ada/a-direio.ads
+++ b/gcc/ada/a-direio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-dirval-mingw.adb b/gcc/ada/a-dirval-mingw.adb
index 55aba243b3f..760102c9e10 100644
--- a/gcc/ada/a-dirval-mingw.adb
+++ b/gcc/ada/a-dirval-mingw.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- (Windows Version) --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-dirval.adb b/gcc/ada/a-dirval.adb
index 31dd70b5dc9..206af7fc665 100644
--- a/gcc/ada/a-dirval.adb
+++ b/gcc/ada/a-dirval.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- (POSIX Version) --
-- --
--- Copyright (C) 2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-dirval.ads b/gcc/ada/a-dirval.ads
index 12a03f60e15..9785f30f7c4 100644
--- a/gcc/ada/a-dirval.ads
+++ b/gcc/ada/a-dirval.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-elchha.adb b/gcc/ada/a-elchha.adb
index 34530edea41..c2b38e4e9f2 100644
--- a/gcc/ada/a-elchha.adb
+++ b/gcc/ada/a-elchha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-excach.adb b/gcc/ada/a-excach.adb
index f4113150904..e10352d0764 100644
--- a/gcc/ada/a-excach.adb
+++ b/gcc/ada/a-excach.adb
@@ -2,11 +2,11 @@
-- --
-- GNAT COMPILER COMPONENTS --
-- --
--- ADA.EXCEPTIONS.CALL_CHAIN --
+-- A D A . E X C E P T I O N S . C A L L _ C H A I N --
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-except.adb b/gcc/ada/a-except.adb
index a676b91c2ed..fb14eda5b08 100644
--- a/gcc/ada/a-except.adb
+++ b/gcc/ada/a-except.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -41,23 +41,11 @@ with System.Soft_Links; use System.Soft_Links;
package body Ada.Exceptions is
- procedure builtin_longjmp (buffer : Address; Flag : Integer);
- pragma No_Return (builtin_longjmp);
- pragma Import (C, builtin_longjmp, "_gnat_builtin_longjmp");
-
pragma Suppress (All_Checks);
-- We definitely do not want exceptions occurring within this unit, or
-- we are in big trouble. If an exceptional situation does occur, better
-- that it not be raised, since raising it can cause confusing chaos.
- Zero_Cost_Exceptions : Integer;
- pragma Import (C, Zero_Cost_Exceptions, "__gl_zero_cost_exceptions");
- -- Boolean indicating if we are handling exceptions using a zero cost
- -- mechanism.
- --
- -- Note that although we currently do not support it, the GCC3 back-end
- -- tables are also potentially useable for setjmp/longjmp processing.
-
-----------------------
-- Local Subprograms --
-----------------------
@@ -409,12 +397,6 @@ package body Ada.Exceptions is
-- The following procedures provide an internal interface to help making
-- this explicit.
- procedure Save_Occurrence_And_Private
- (Target : out Exception_Occurrence;
- Source : Exception_Occurrence);
- -- Copy all the components of Source to Target as well as the
- -- Private_Data pointer.
-
procedure Save_Occurrence_No_Private
(Target : out Exception_Occurrence;
Source : Exception_Occurrence);
@@ -783,81 +765,15 @@ package body Ada.Exceptions is
is
pragma Inspection_Point (E);
-- This is so the debugger can reliably inspect the parameter
-
- Jumpbuf_Ptr : constant Address := Get_Jmpbuf_Address.all;
- Excep : constant EOA := Get_Current_Excep.all;
-
begin
- -- WARNING : There should be no exception handler for this body
+ -- WARNING: There should be no exception handler for this body
-- because this would cause gigi to prepend a setup for a new
- -- jmpbuf to the sequence of statements. We would then always get
- -- this new buf in Jumpbuf_Ptr instead of the one for the exception
- -- we are handling, which would completely break the whole design
- -- of this procedure.
-
- -- Processing varies between zero cost and setjmp/lonjmp processing
-
- if Zero_Cost_Exceptions /= 0 then
-
- -- Use the GCC back-end to propagate the exception. Backtrace
- -- computation is performed, if required, by the underlying routine.
- -- Notifications for the debugger are also not performed here,
- -- because we do not yet know if the exception is handled.
-
- Exception_Propagation.Propagate_Exception (From_Signal_Handler);
-
- else
- -- Compute the backtrace for this occurrence if corresponding binder
- -- option has been set. Call_Chain takes care of the reraise case.
-
- Call_Chain (Excep);
-
- -- Note on above call to Call_Chain:
-
- -- We used to only do this if From_Signal_Handler was not set,
- -- based on the assumption that backtracing from a signal handler
- -- would not work due to stack layout oddities. However, since
-
- -- 1. The flag is never set in tasking programs (Notify_Exception
- -- performs regular raise statements), and
-
- -- 2. No problem has shown up in tasking programs around here so
- -- far, this turned out to be too strong an assumption.
-
- -- As, in addition, the test was
-
- -- 1. preventing the production of backtraces in non-tasking
- -- programs, and
-
- -- 2. introducing a behavior inconsistency between
- -- the tasking and non-tasking cases,
+ -- jmpbuf to the sequence of statements in case of built-in sjljl.
+ -- We would then always get this new buf in Jumpbuf_Ptr instead of the
+ -- one for the exception we are handling, which would completely break
+ -- the whole design of this procedure.
- -- we have simply removed it
-
- -- If the jump buffer pointer is non-null, transfer control using
- -- it. Otherwise announce an unhandled exception (note that this
- -- means that we have no finalizations to do other than at the outer
- -- level). Perform the necessary notification tasks in both cases.
-
- if Jumpbuf_Ptr /= Null_Address then
-
- if not Excep.Exception_Raised then
- Excep.Exception_Raised := True;
- Exception_Traces.Notify_Handled_Exception;
- end if;
-
- builtin_longjmp (Jumpbuf_Ptr, 1);
-
- else
- -- The pragma Inspection point here ensures that the debugger
- -- can inspect the parameter.
-
- pragma Inspection_Point (E);
-
- Exception_Traces.Notify_Unhandled_Exception;
- Exception_Traces.Unhandled_Exception_Terminate;
- end if;
- end if;
+ Exception_Propagation.Propagate_Exception (From_Signal_Handler);
end Process_Raise_Exception;
----------------------------
@@ -892,8 +808,23 @@ package body Ada.Exceptions is
-------------------------
procedure Raise_Current_Excep (E : Exception_Id) is
+
pragma Inspection_Point (E);
- -- This is so the debugger can reliably inspect the parameter
+ -- This is so the debugger can reliably inspect the parameter when
+ -- inserting a breakpoint at the start of this procedure.
+
+ Id : Exception_Id := E;
+ pragma Volatile (Id);
+ pragma Warnings (Off, Id);
+ -- In order to provide support for breakpoints on unhandled exceptions,
+ -- the debugger will also need to be able to inspect the value of E from
+ -- another (inner) frame. So we need to make sure that if E is passed in
+ -- a register, its value is also spilled on stack. For this, we store
+ -- the parameter value in a local variable, and add a pragma Volatile to
+ -- make sure it is spilled. The pragma Warnings (Off) is needed because
+ -- the compiler knows that Id is not referenced and that this use of
+ -- pragma Volatile is peculiar!
+
begin
Process_Raise_Exception (E => E, From_Signal_Handler => False);
end Raise_Current_Excep;
@@ -1263,19 +1194,6 @@ package body Ada.Exceptions is
end Save_Occurrence;
--------------------------------
- -- Save_Occurrence_And_Private --
- --------------------------------
-
- procedure Save_Occurrence_And_Private
- (Target : out Exception_Occurrence;
- Source : Exception_Occurrence)
- is
- begin
- Save_Occurrence_No_Private (Target, Source);
- Target.Private_Data := Source.Private_Data;
- end Save_Occurrence_And_Private;
-
- --------------------------------
-- Save_Occurrence_No_Private --
--------------------------------
diff --git a/gcc/ada/a-except.ads b/gcc/ada/a-except.ads
index a93f056544e..fae4d4a4386 100644
--- a/gcc/ada/a-except.ads
+++ b/gcc/ada/a-except.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-exctra.ads b/gcc/ada/a-exctra.ads
index bc31fd08760..07ffb0b9c64 100644
--- a/gcc/ada/a-exctra.ads
+++ b/gcc/ada/a-exctra.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-exexda.adb b/gcc/ada/a-exexda.adb
index 6049ccd3285..6b3b802d117 100644
--- a/gcc/ada/a-exexda.adb
+++ b/gcc/ada/a-exexda.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -386,7 +386,7 @@ package body Exception_Data is
Ptr : in out Natural)
is
begin
- if X.Num_Tracebacks <= 0 then
+ if X.Num_Tracebacks = 0 then
return;
end if;
diff --git a/gcc/ada/a-exexpr-gcc.adb b/gcc/ada/a-exexpr-gcc.adb
new file mode 100644
index 00000000000..22f057d18a4
--- /dev/null
+++ b/gcc/ada/a-exexpr-gcc.adb
@@ -0,0 +1,726 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- A D A . E X C E P T I O N S . E X C E P T I O N _ P R O P A G A T I O N --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the version using the GCC EH mechanism
+
+with Ada.Unchecked_Conversion;
+with Ada.Unchecked_Deallocation;
+
+with System.Storage_Elements; use System.Storage_Elements;
+
+separate (Ada.Exceptions)
+package body Exception_Propagation is
+
+ ------------------------------------------------
+ -- Entities to interface with the GCC runtime --
+ ------------------------------------------------
+
+ -- These come from "C++ ABI for Itanium: Exception handling", which is
+ -- the reference for GCC. They are used only when we are relying on
+ -- back-end tables for exception propagation, which in turn is currenly
+ -- only the case for Zero_Cost_Exceptions in GNAT5.
+
+ -- Return codes from the GCC runtime functions used to propagate
+ -- an exception.
+
+ type Unwind_Reason_Code is
+ (URC_NO_REASON,
+ URC_FOREIGN_EXCEPTION_CAUGHT,
+ URC_PHASE2_ERROR,
+ URC_PHASE1_ERROR,
+ URC_NORMAL_STOP,
+ URC_END_OF_STACK,
+ URC_HANDLER_FOUND,
+ URC_INSTALL_CONTEXT,
+ URC_CONTINUE_UNWIND);
+
+ pragma Unreferenced
+ (URC_FOREIGN_EXCEPTION_CAUGHT,
+ URC_PHASE2_ERROR,
+ URC_PHASE1_ERROR,
+ URC_NORMAL_STOP,
+ URC_END_OF_STACK,
+ URC_HANDLER_FOUND,
+ URC_INSTALL_CONTEXT,
+ URC_CONTINUE_UNWIND);
+
+ pragma Convention (C, Unwind_Reason_Code);
+
+ -- Phase identifiers
+
+ type Unwind_Action is
+ (UA_SEARCH_PHASE,
+ UA_CLEANUP_PHASE,
+ UA_HANDLER_FRAME,
+ UA_FORCE_UNWIND);
+
+ for Unwind_Action use
+ (UA_SEARCH_PHASE => 1,
+ UA_CLEANUP_PHASE => 2,
+ UA_HANDLER_FRAME => 4,
+ UA_FORCE_UNWIND => 8);
+
+ pragma Convention (C, Unwind_Action);
+
+ -- Mandatory common header for any exception object handled by the
+ -- GCC unwinding runtime.
+
+ type Exception_Class is mod 2 ** 64;
+
+ GNAT_Exception_Class : constant Exception_Class := 16#474e552d41646100#;
+ -- "GNU-Ada\0"
+
+ type Unwind_Word is mod 2 ** System.Word_Size;
+ for Unwind_Word'Size use System.Word_Size;
+ -- Map the corresponding C type used in Unwind_Exception below
+
+ type Unwind_Exception is record
+ Class : Exception_Class := GNAT_Exception_Class;
+ Cleanup : System.Address := System.Null_Address;
+ Private1 : Unwind_Word;
+ Private2 : Unwind_Word;
+ end record;
+ -- Map the GCC struct used for exception handling
+
+ for Unwind_Exception'Alignment use Standard'Maximum_Alignment;
+ -- The C++ ABI mandates the common exception header to be at least
+ -- doubleword aligned, and the libGCC implementation actually makes it
+ -- maximally aligned (see unwind.h). See additional comments on the
+ -- alignment below.
+
+ --------------------------------------------------------------
+ -- GNAT Specific Entities To Deal With The GCC EH Circuitry --
+ --------------------------------------------------------------
+
+ -- A GNAT exception object to be dealt with by the personality routine
+ -- called by the GCC unwinding runtime.
+
+ type GNAT_GCC_Exception is record
+ Header : Unwind_Exception;
+ -- ABI Exception header first
+
+ Id : Exception_Id;
+ -- GNAT Exception identifier. This is filled by Propagate_Exception
+ -- and then used by the personality routine to determine if the context
+ -- it examines contains a handler for the exception beeing propagated.
+
+ N_Cleanups_To_Trigger : Integer;
+ -- Number of cleanup only frames encountered in SEARCH phase. This is
+ -- initialized to 0 by Propagate_Exception and maintained by the
+ -- personality routine to control a forced unwinding phase triggering
+ -- all the cleanups before calling Unhandled_Exception_Terminate when
+ -- an exception is not handled.
+
+ Next_Exception : EOA;
+ -- Used to create a linked list of exception occurrences
+ end record;
+
+ pragma Convention (C, GNAT_GCC_Exception);
+
+ -- There is a subtle issue with the common header alignment, since the C
+ -- version is aligned on BIGGEST_ALIGNMENT, the Ada version is aligned on
+ -- Standard'Maximum_Alignment, and those two values don't quite represent
+ -- the same concepts and so may be decoupled someday. One typical reason
+ -- is that BIGGEST_ALIGNMENT may be larger than what the underlying system
+ -- allocator guarantees, and there are extra costs involved in allocating
+ -- objects aligned to such factors.
+
+ -- To deal with the potential alignment differences between the C and Ada
+ -- representations, the Ada part of the whole structure is only accessed
+ -- by the personality routine through the accessors declared below. Ada
+ -- specific fields are thus always accessed through consistent layout, and
+ -- we expect the actual alignment to always be large enough to avoid traps
+ -- from the C accesses to the common header. Besides, accessors aleviate
+ -- the need for a C struct whole conterpart, both painful and errorprone
+ -- to maintain anyway.
+
+ type GNAT_GCC_Exception_Access is access all GNAT_GCC_Exception;
+
+ function To_GNAT_GCC_Exception is new
+ Unchecked_Conversion (System.Address, GNAT_GCC_Exception_Access);
+
+ procedure Free is new Unchecked_Deallocation
+ (GNAT_GCC_Exception, GNAT_GCC_Exception_Access);
+
+ procedure Free is new Unchecked_Deallocation
+ (Exception_Occurrence, EOA);
+
+ function CleanupUnwind_Handler
+ (UW_Version : Integer;
+ UW_Phases : Unwind_Action;
+ UW_Eclass : Exception_Class;
+ UW_Exception : access GNAT_GCC_Exception;
+ UW_Context : System.Address;
+ UW_Argument : System.Address) return Unwind_Reason_Code;
+ -- Hook called at each step of the forced unwinding we perform to
+ -- trigger cleanups found during the propagation of an unhandled
+ -- exception.
+
+ -- GCC runtime functions used. These are C non-void functions, actually,
+ -- but we ignore the return values. See raise.c as to why we are using
+ -- __gnat stubs for these.
+
+ procedure Unwind_RaiseException
+ (UW_Exception : access GNAT_GCC_Exception);
+ pragma Import (C, Unwind_RaiseException, "__gnat_Unwind_RaiseException");
+
+ procedure Unwind_ForcedUnwind
+ (UW_Exception : access GNAT_GCC_Exception;
+ UW_Handler : System.Address;
+ UW_Argument : System.Address);
+ pragma Import (C, Unwind_ForcedUnwind, "__gnat_Unwind_ForcedUnwind");
+
+ ------------------------------------------------------------------
+ -- Occurrence Stack Management Facilities for the GCC-EH Scheme --
+ ------------------------------------------------------------------
+
+ function Remove
+ (Top : EOA;
+ Excep : GNAT_GCC_Exception_Access) return Boolean;
+ -- Remove Excep from the stack starting at Top.
+ -- Return True if Excep was found and removed, false otherwise.
+
+ -- Hooks called when entering/leaving an exception handler for a given
+ -- occurrence, aimed at handling the stack of active occurrences. The
+ -- calls are generated by gigi in tree_transform/N_Exception_Handler.
+
+ procedure Begin_Handler (GCC_Exception : GNAT_GCC_Exception_Access);
+ pragma Export (C, Begin_Handler, "__gnat_begin_handler");
+
+ procedure End_Handler (GCC_Exception : GNAT_GCC_Exception_Access);
+ pragma Export (C, End_Handler, "__gnat_end_handler");
+
+ Setup_Key : constant := 16#DEAD#;
+ -- To handle the case of a task "transferring" an exception occurrence to
+ -- another task, for instance via Exceptional_Complete_Rendezvous, we need
+ -- to be able to identify occurrences which have been Setup and not yet
+ -- Propagated. We hijack one of the common header fields for that purpose,
+ -- setting it to a special key value during the setup process, clearing it
+ -- at the very beginning of the propagation phase, and expecting it never
+ -- to be reset to the special value later on. A 16-bit value is used rather
+ -- than a 32-bit value for static compatibility with 16-bit targets such as
+ -- AAMP (where type Unwind_Word will be 16 bits).
+
+ function Is_Setup_And_Not_Propagated (E : EOA) return Boolean;
+
+ procedure Set_Setup_And_Not_Propagated (E : EOA);
+ procedure Clear_Setup_And_Not_Propagated (E : EOA);
+
+ procedure Save_Occurrence_And_Private
+ (Target : out Exception_Occurrence;
+ Source : Exception_Occurrence);
+ -- Copy all the components of Source to Target as well as the
+ -- Private_Data pointer.
+
+ ------------------------------------------------------------
+ -- Accessors to basic components of a GNAT exception data --
+ ------------------------------------------------------------
+
+ -- As of today, these are only used by the C implementation of the
+ -- GCC propagation personality routine to avoid having to rely on a C
+ -- counterpart of the whole exception_data structure, which is both
+ -- painful and error prone. These subprograms could be moved to a
+ -- more widely visible location if need be.
+
+ function Is_Handled_By_Others (E : Exception_Data_Ptr) return Boolean;
+ pragma Export (C, Is_Handled_By_Others, "__gnat_is_handled_by_others");
+
+ function Language_For (E : Exception_Data_Ptr) return Character;
+ pragma Export (C, Language_For, "__gnat_language_for");
+
+ function Import_Code_For (E : Exception_Data_Ptr) return Exception_Code;
+ pragma Export (C, Import_Code_For, "__gnat_import_code_for");
+
+ function EID_For (GNAT_Exception : GNAT_GCC_Exception_Access)
+ return Exception_Id;
+ pragma Export (C, EID_For, "__gnat_eid_for");
+
+ procedure Adjust_N_Cleanups_For
+ (GNAT_Exception : GNAT_GCC_Exception_Access;
+ Adjustment : Integer);
+ pragma Export (C, Adjust_N_Cleanups_For, "__gnat_adjust_n_cleanups_for");
+
+ ---------------------------------------------------------------------------
+ -- Objects to materialize "others" and "all others" in the GCC EH tables --
+ ---------------------------------------------------------------------------
+
+ -- Currently, these only have their address taken and compared so there is
+ -- no real point having whole exception data blocks allocated. In any case
+ -- the types should match what gigi and the personality routine expect.
+ -- The initial value is an arbitrary value that will not exceed the range
+ -- of Integer on 16-bit targets (such as AAMP).
+
+ Others_Value : constant Integer := 16#7FFF#;
+ pragma Export (C, Others_Value, "__gnat_others_value");
+
+ All_Others_Value : constant Integer := 16#7FFF#;
+ pragma Export (C, All_Others_Value, "__gnat_all_others_value");
+
+ ------------
+ -- Remove --
+ ------------
+
+ function Remove
+ (Top : EOA;
+ Excep : GNAT_GCC_Exception_Access) return Boolean
+ is
+ Prev : GNAT_GCC_Exception_Access := null;
+ Iter : EOA := Top;
+ GCC_Exception : GNAT_GCC_Exception_Access;
+
+ begin
+ -- Pop stack
+
+ loop
+ pragma Assert (Iter.Private_Data /= System.Null_Address);
+
+ GCC_Exception := To_GNAT_GCC_Exception (Iter.Private_Data);
+
+ if GCC_Exception = Excep then
+ if Prev = null then
+
+ -- Special case for the top of the stack: shift the contents
+ -- of the next item to the top, since top is at a fixed
+ -- location and can't be changed.
+
+ Iter := GCC_Exception.Next_Exception;
+
+ if Iter = null then
+
+ -- Stack is now empty
+
+ Top.Private_Data := System.Null_Address;
+
+ else
+ Save_Occurrence_And_Private (Top.all, Iter.all);
+ Free (Iter);
+ end if;
+
+ else
+ Prev.Next_Exception := GCC_Exception.Next_Exception;
+ Free (Iter);
+ end if;
+
+ Free (GCC_Exception);
+
+ return True;
+ end if;
+
+ exit when GCC_Exception.Next_Exception = null;
+
+ Prev := GCC_Exception;
+ Iter := GCC_Exception.Next_Exception;
+ end loop;
+
+ return False;
+ end Remove;
+
+ ---------------------------
+ -- CleanupUnwind_Handler --
+ ---------------------------
+
+ function CleanupUnwind_Handler
+ (UW_Version : Integer;
+ UW_Phases : Unwind_Action;
+ UW_Eclass : Exception_Class;
+ UW_Exception : access GNAT_GCC_Exception;
+ UW_Context : System.Address;
+ UW_Argument : System.Address) return Unwind_Reason_Code
+ is
+ pragma Unreferenced
+ (UW_Version, UW_Phases, UW_Eclass, UW_Context, UW_Argument);
+
+ begin
+ -- Terminate as soon as we know there is nothing more to run. The
+ -- count is maintained by the personality routine.
+
+ if UW_Exception.N_Cleanups_To_Trigger = 0 then
+ Unhandled_Exception_Terminate;
+ end if;
+
+ -- We know there is at least one cleanup further up. Return so that it
+ -- is searched and entered, after which Unwind_Resume will be called
+ -- and this hook will gain control (with an updated count) again.
+
+ return URC_NO_REASON;
+ end CleanupUnwind_Handler;
+
+ ---------------------------------
+ -- Is_Setup_And_Not_Propagated --
+ ---------------------------------
+
+ function Is_Setup_And_Not_Propagated (E : EOA) return Boolean is
+ GCC_E : constant GNAT_GCC_Exception_Access :=
+ To_GNAT_GCC_Exception (E.Private_Data);
+ begin
+ return GCC_E /= null and then GCC_E.Header.Private1 = Setup_Key;
+ end Is_Setup_And_Not_Propagated;
+
+ ------------------------------------
+ -- Clear_Setup_And_Not_Propagated --
+ ------------------------------------
+
+ procedure Clear_Setup_And_Not_Propagated (E : EOA) is
+ GCC_E : constant GNAT_GCC_Exception_Access :=
+ To_GNAT_GCC_Exception (E.Private_Data);
+ begin
+ pragma Assert (GCC_E /= null);
+ GCC_E.Header.Private1 := 0;
+ end Clear_Setup_And_Not_Propagated;
+
+ ----------------------------------
+ -- Set_Setup_And_Not_Propagated --
+ ----------------------------------
+
+ procedure Set_Setup_And_Not_Propagated (E : EOA) is
+ GCC_E : constant GNAT_GCC_Exception_Access :=
+ To_GNAT_GCC_Exception (E.Private_Data);
+ begin
+ pragma Assert (GCC_E /= null);
+ GCC_E.Header.Private1 := Setup_Key;
+ end Set_Setup_And_Not_Propagated;
+
+ --------------------------------
+ -- Save_Occurrence_And_Private --
+ --------------------------------
+
+ procedure Save_Occurrence_And_Private
+ (Target : out Exception_Occurrence;
+ Source : Exception_Occurrence)
+ is
+ begin
+ Save_Occurrence_No_Private (Target, Source);
+ Target.Private_Data := Source.Private_Data;
+ end Save_Occurrence_And_Private;
+
+ ---------------------
+ -- Setup_Exception --
+ ---------------------
+
+ -- In the GCC-EH implementation of the propagation scheme, this
+ -- subprogram should be understood as: Setup the exception occurrence
+ -- stack headed at Current for a forthcoming raise of Excep.
+
+ procedure Setup_Exception
+ (Excep : EOA;
+ Current : EOA;
+ Reraised : Boolean := False)
+ is
+ Top : constant EOA := Current;
+ Next : EOA;
+ GCC_Exception : GNAT_GCC_Exception_Access;
+
+ begin
+ -- The exception Excep is soon to be propagated, and the
+ -- storage used for that will be the occurrence statically allocated
+ -- for the current thread. This storage might currently be used for a
+ -- still active occurrence, so we need to push it on the thread's
+ -- occurrence stack (headed at that static occurrence) before it gets
+ -- clobbered.
+
+ -- What we do here is to trigger this push when need be, and allocate a
+ -- Private_Data block for the forthcoming Propagation.
+
+ -- Some tasking rendez-vous attempts lead to an occurrence transfer
+ -- from the server to the client (see Exceptional_Complete_Rendezvous).
+ -- In those cases Setup is called twice for the very same occurrence
+ -- before it gets propagated: once from the server, because this is
+ -- where the occurrence contents is elaborated and known, and then
+ -- once from the client when it detects the case and actually raises
+ -- the exception in its own context.
+
+ -- The Is_Setup_And_Not_Propagated predicate tells us when we are in
+ -- the second call to Setup for a Transferred occurrence, and there is
+ -- nothing to be done here in this situation. This predicate cannot be
+ -- True if we are dealing with a Reraise, and we may even be called
+ -- with a raw uninitialized Excep occurrence in this case so we should
+ -- not check anyway. Observe the front-end expansion for a "raise;" to
+ -- see that happening. We get a local occurrence and a direct call to
+ -- Save_Occurrence without the intermediate init-proc call.
+
+ if not Reraised and then Is_Setup_And_Not_Propagated (Excep) then
+ return;
+ end if;
+
+ -- Allocate what will be the Private_Data block for the exception
+ -- to be propagated.
+
+ GCC_Exception := new GNAT_GCC_Exception;
+
+ -- If the Top of the occurrence stack is not currently used for an
+ -- active exception (the stack is empty) we just need to setup the
+ -- Private_Data pointer.
+
+ -- Otherwise, we also need to shift the contents of the Top of the
+ -- stack in a freshly allocated entry and link everything together.
+
+ if Top.Private_Data /= System.Null_Address then
+ Next := new Exception_Occurrence;
+ Save_Occurrence_And_Private (Next.all, Top.all);
+
+ GCC_Exception.Next_Exception := Next;
+ Top.Private_Data := GCC_Exception.all'Address;
+ end if;
+
+ Top.Private_Data := GCC_Exception.all'Address;
+
+ Set_Setup_And_Not_Propagated (Top);
+ end Setup_Exception;
+
+ -------------------
+ -- Begin_Handler --
+ -------------------
+
+ procedure Begin_Handler (GCC_Exception : GNAT_GCC_Exception_Access) is
+ pragma Unreferenced (GCC_Exception);
+
+ begin
+ -- Every necessary operation related to the occurrence stack has
+ -- already been performed by Propagate_Exception. This hook remains for
+ -- potential future necessity in optimizing the overall scheme, as well
+ -- a useful debugging tool.
+
+ null;
+ end Begin_Handler;
+
+ -----------------
+ -- End_Handler --
+ -----------------
+
+ procedure End_Handler (GCC_Exception : GNAT_GCC_Exception_Access) is
+ Removed : Boolean;
+ begin
+ Removed := Remove (Get_Current_Excep.all, GCC_Exception);
+ pragma Assert (Removed);
+ end End_Handler;
+
+ -------------------------
+ -- Propagate_Exception --
+ -------------------------
+
+ -- Build an object suitable for the libgcc processing and call
+ -- Unwind_RaiseException to actually throw, taking care of handling
+ -- the two phase scheme it implements.
+
+ procedure Propagate_Exception (From_Signal_Handler : Boolean) is
+ pragma Unreferenced (From_Signal_Handler);
+
+ Excep : constant EOA := Get_Current_Excep.all;
+ GCC_Exception : GNAT_GCC_Exception_Access;
+
+ begin
+ pragma Assert (Excep.Private_Data /= System.Null_Address);
+
+ -- Retrieve the Private_Data for this occurrence and set the useful
+ -- flags for the personality routine, which will be called for each
+ -- frame via Unwind_RaiseException below.
+
+ GCC_Exception := To_GNAT_GCC_Exception (Excep.Private_Data);
+
+ Clear_Setup_And_Not_Propagated (Excep);
+
+ GCC_Exception.Id := Excep.Id;
+ GCC_Exception.N_Cleanups_To_Trigger := 0;
+
+ -- Compute the backtrace for this occurrence if the corresponding
+ -- binder option has been set. Call_Chain takes care of the reraise
+ -- case.
+
+ -- ??? Using Call_Chain here means we are going to walk up the stack
+ -- once only for backtracing purposes before doing it again for the
+ -- propagation per se.
+
+ -- The first inspection is much lighter, though, as it only requires
+ -- partial unwinding of each frame. Additionally, although we could use
+ -- the personality routine to record the addresses while propagating,
+ -- this method has two drawbacks:
+
+ -- 1) the trace is incomplete if the exception is handled since we
+ -- don't walk past the frame with the handler,
+
+ -- and
+
+ -- 2) we would miss the frames for which our personality routine is not
+ -- called, e.g. if C or C++ calls are on the way.
+
+ Call_Chain (Excep);
+
+ -- Perform a standard raise first. If a regular handler is found, it
+ -- will be entered after all the intermediate cleanups have run. If
+ -- there is no regular handler, control will get back to after the
+ -- call, with N_Cleanups_To_Trigger set to the number of frames with
+ -- cleanups found on the way up, and none of these already run.
+
+ Unwind_RaiseException (GCC_Exception);
+
+ -- If we get here we know the exception is not handled, as otherwise
+ -- Unwind_RaiseException arranges for the handler to be entered. Take
+ -- the necessary steps to enable the debugger to gain control while the
+ -- stack is still intact.
+
+ Notify_Unhandled_Exception;
+
+ -- Now, if cleanups have been found, run a forced unwind to trigger
+ -- them. Control should not resume there, as the unwinding hook calls
+ -- Unhandled_Exception_Terminate as soon as the last cleanup has been
+ -- triggered.
+
+ if GCC_Exception.N_Cleanups_To_Trigger /= 0 then
+ Unwind_ForcedUnwind (GCC_Exception,
+ CleanupUnwind_Handler'Address,
+ System.Null_Address);
+ end if;
+
+ -- We get here when there is no handler or cleanup to be run at all.
+ -- The debugger has been notified before the second step above.
+
+ Unhandled_Exception_Terminate;
+ end Propagate_Exception;
+
+ ---------------------------
+ -- Adjust_N_Cleanups_For --
+ ---------------------------
+
+ procedure Adjust_N_Cleanups_For
+ (GNAT_Exception : GNAT_GCC_Exception_Access;
+ Adjustment : Integer)
+ is
+ begin
+ GNAT_Exception.N_Cleanups_To_Trigger :=
+ GNAT_Exception.N_Cleanups_To_Trigger + Adjustment;
+ end Adjust_N_Cleanups_For;
+
+ -------------
+ -- EID_For --
+ -------------
+
+ function EID_For
+ (GNAT_Exception : GNAT_GCC_Exception_Access) return Exception_Id
+ is
+ begin
+ return GNAT_Exception.Id;
+ end EID_For;
+
+ ---------------------
+ -- Import_Code_For --
+ ---------------------
+
+ function Import_Code_For
+ (E : SSL.Exception_Data_Ptr) return Exception_Code
+ is
+ begin
+ return E.all.Import_Code;
+ end Import_Code_For;
+
+ --------------------------
+ -- Is_Handled_By_Others --
+ --------------------------
+
+ function Is_Handled_By_Others (E : SSL.Exception_Data_Ptr) return Boolean is
+ begin
+ return not E.all.Not_Handled_By_Others;
+ end Is_Handled_By_Others;
+
+ ------------------
+ -- Language_For --
+ ------------------
+
+ function Language_For (E : SSL.Exception_Data_Ptr) return Character is
+ begin
+ return E.all.Lang;
+ end Language_For;
+
+ -----------
+ -- Notes --
+ -----------
+
+ -- The current model implemented for the stack of occurrences is a
+ -- simplification of previous attempts, which all prooved to be flawed or
+ -- would have needed significant additional circuitry to be made to work
+ -- correctly.
+
+ -- We now represent every propagation by a new entry on the stack, which
+ -- means that an exception occurrence may appear more than once (e.g. when
+ -- it is reraised during the course of its own handler).
+
+ -- This may seem overcostly compared to the C++ model as implemented in
+ -- the g++ v3 libstd. This is actually understandable when one considers
+ -- the extra variations of possible run-time configurations induced by the
+ -- freedom offered by the Save_Occurrence/Reraise_Occurrence public
+ -- interface.
+
+ -- The basic point is that arranging for an occurrence to always appear at
+ -- most once on the stack requires a way to determine if a given occurence
+ -- is already there, which is not as easy as it might seem.
+
+ -- An attempt was made to use the Private_Data pointer for this purpose.
+ -- It did not work because:
+
+ -- 1) The Private_Data has to be saved by Save_Occurrence to be usable
+ -- as a key in case of a later reraise,
+
+ -- 2) There is no easy way to synchronize End_Handler for an occurrence
+ -- and the data attached to potential copies, so these copies may end
+ -- up pointing to stale data. Moreover ...
+
+ -- 3) The same address may be reused for different occurrences, which
+ -- defeats the idea of using it as a key.
+
+ -- The example below illustrates:
+
+ -- Saved_CE : Exception_Occurrence;
+
+ -- begin
+ -- raise Constraint_Error;
+ -- exception
+ -- when CE: others =>
+ -- Save_Occurrence (Saved_CE, CE); <= Saved_CE.PDA = CE.PDA
+ -- end;
+
+ -- <= Saved_CE.PDA is stale (!)
+
+ -- begin
+ -- raise Program_Error; <= Saved_CE.PDA = PE.PDA (!!)
+ -- exception
+ -- when others =>
+ -- Reraise_Occurrence (Saved_CE);
+ -- end;
+
+ -- Not releasing the Private_Data via End_Handler could be an option,
+ -- but making this to work while still avoiding memory leaks is far
+ -- from trivial.
+
+ -- The current scheme has the advantage of beeing simple, and induces
+ -- extra costs only in reraise cases which is acceptable.
+
+end Exception_Propagation;
diff --git a/gcc/ada/a-exexpr.adb b/gcc/ada/a-exexpr.adb
index 8cccf1699e9..165b5cef3d8 100644
--- a/gcc/ada/a-exexpr.adb
+++ b/gcc/ada/a-exexpr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,10 +31,8 @@
-- --
------------------------------------------------------------------------------
-with Interfaces;
-
-with Ada.Unchecked_Conversion;
-with Ada.Unchecked_Deallocation;
+-- This is the default version, using the __builtin_setjmp/longjmp EH
+-- mechanism.
with System.Storage_Elements; use System.Storage_Elements;
@@ -45,681 +43,80 @@ pragma Warnings (Off);
separate (Ada.Exceptions)
package body Exception_Propagation is
- ------------------------------------------------
- -- Entities to interface with the GCC runtime --
- ------------------------------------------------
-
- -- These come from "C++ ABI for Itanium: Exception handling", which is
- -- the reference for GCC. They are used only when we are relying on
- -- back-end tables for exception propagation, which in turn is currenly
- -- only the case for Zero_Cost_Exceptions in GNAT5.
-
- -- Return codes from the GCC runtime functions used to propagate
- -- an exception.
-
- type Unwind_Reason_Code is
- (URC_NO_REASON,
- URC_FOREIGN_EXCEPTION_CAUGHT,
- URC_PHASE2_ERROR,
- URC_PHASE1_ERROR,
- URC_NORMAL_STOP,
- URC_END_OF_STACK,
- URC_HANDLER_FOUND,
- URC_INSTALL_CONTEXT,
- URC_CONTINUE_UNWIND);
-
- pragma Unreferenced
- (URC_FOREIGN_EXCEPTION_CAUGHT,
- URC_PHASE2_ERROR,
- URC_PHASE1_ERROR,
- URC_NORMAL_STOP,
- URC_END_OF_STACK,
- URC_HANDLER_FOUND,
- URC_INSTALL_CONTEXT,
- URC_CONTINUE_UNWIND);
-
- pragma Convention (C, Unwind_Reason_Code);
-
- -- Phase identifiers
-
- type Unwind_Action is
- (UA_SEARCH_PHASE,
- UA_CLEANUP_PHASE,
- UA_HANDLER_FRAME,
- UA_FORCE_UNWIND);
-
- for Unwind_Action use
- (UA_SEARCH_PHASE => 1,
- UA_CLEANUP_PHASE => 2,
- UA_HANDLER_FRAME => 4,
- UA_FORCE_UNWIND => 8);
-
- pragma Convention (C, Unwind_Action);
-
- -- Mandatory common header for any exception object handled by the
- -- GCC unwinding runtime.
-
- subtype Exception_Class is Interfaces.Unsigned_64;
-
- GNAT_Exception_Class : constant Exception_Class := 16#474e552d41646100#;
- -- "GNU-Ada\0"
-
- type Unwind_Word is mod 2 ** System.Word_Size;
- for Unwind_Word'Size use System.Word_Size;
- -- Map the corresponding C type used in Unwind_Exception below
-
- type Unwind_Exception is record
- Class : Exception_Class := GNAT_Exception_Class;
- Cleanup : System.Address := System.Null_Address;
- Private1 : Unwind_Word;
- Private2 : Unwind_Word;
- end record;
- -- Map the GCC struct used for exception handling
-
- for Unwind_Exception'Alignment use Standard'Maximum_Alignment;
- -- The C++ ABI mandates the common exception header to be at least
- -- doubleword aligned, and the libGCC implementation actually makes it
- -- maximally aligned (see unwind.h). See additional comments on the
- -- alignment below.
-
- --------------------------------------------------------------
- -- GNAT Specific Entities To Deal With The GCC EH Circuitry --
- --------------------------------------------------------------
-
- -- A GNAT exception object to be dealt with by the personality routine
- -- called by the GCC unwinding runtime.
-
- type GNAT_GCC_Exception is record
- Header : Unwind_Exception;
- -- ABI Exception header first
-
- Id : Exception_Id;
- -- GNAT Exception identifier. This is filled by Propagate_Exception
- -- and then used by the personality routine to determine if the context
- -- it examines contains a handler for the exception beeing propagated.
-
- N_Cleanups_To_Trigger : Integer;
- -- Number of cleanup only frames encountered in SEARCH phase. This is
- -- initialized to 0 by Propagate_Exception and maintained by the
- -- personality routine to control a forced unwinding phase triggering
- -- all the cleanups before calling Unhandled_Exception_Terminate when
- -- an exception is not handled.
-
- Next_Exception : EOA;
- -- Used to create a linked list of exception occurrences
- end record;
-
- pragma Convention (C, GNAT_GCC_Exception);
-
- -- There is a subtle issue with the common header alignment, since the C
- -- version is aligned on BIGGEST_ALIGNMENT, the Ada version is aligned on
- -- Standard'Maximum_Alignment, and those two values don't quite represent
- -- the same concepts and so may be decoupled someday. One typical reason
- -- is that BIGGEST_ALIGNMENT may be larger than what the underlying system
- -- allocator guarantees, and there are extra costs involved in allocating
- -- objects aligned to such factors.
-
- -- To deal with the potential alignment differences between the C and Ada
- -- representations, the Ada part of the whole structure is only accessed
- -- by the personality routine through the accessors declared below. Ada
- -- specific fields are thus always accessed through consistent layout, and
- -- we expect the actual alignment to always be large enough to avoid traps
- -- from the C accesses to the common header. Besides, accessors aleviate
- -- the need for a C struct whole conterpart, both painful and errorprone
- -- to maintain anyway.
-
- type GNAT_GCC_Exception_Access is access all GNAT_GCC_Exception;
-
- function To_GNAT_GCC_Exception is new
- Unchecked_Conversion (System.Address, GNAT_GCC_Exception_Access);
-
- procedure Free is new Unchecked_Deallocation
- (GNAT_GCC_Exception, GNAT_GCC_Exception_Access);
-
- procedure Free is new Unchecked_Deallocation
- (Exception_Occurrence, EOA);
-
- function CleanupUnwind_Handler
- (UW_Version : Integer;
- UW_Phases : Unwind_Action;
- UW_Eclass : Exception_Class;
- UW_Exception : access GNAT_GCC_Exception;
- UW_Context : System.Address;
- UW_Argument : System.Address) return Unwind_Reason_Code;
- -- Hook called at each step of the forced unwinding we perform to
- -- trigger cleanups found during the propagation of an unhandled
- -- exception.
-
- -- GCC runtime functions used. These are C non-void functions, actually,
- -- but we ignore the return values. See raise.c as to why we are using
- -- __gnat stubs for these.
-
- procedure Unwind_RaiseException
- (UW_Exception : access GNAT_GCC_Exception);
- pragma Import (C, Unwind_RaiseException, "__gnat_Unwind_RaiseException");
-
- procedure Unwind_ForcedUnwind
- (UW_Exception : access GNAT_GCC_Exception;
- UW_Handler : System.Address;
- UW_Argument : System.Address);
- pragma Import (C, Unwind_ForcedUnwind, "__gnat_Unwind_ForcedUnwind");
-
- ------------------------------------------------------------------
- -- Occurrence Stack Management Facilities for the GCC-EH Scheme --
- ------------------------------------------------------------------
-
- function Remove
- (Top : EOA;
- Excep : GNAT_GCC_Exception_Access) return Boolean;
- -- Remove Excep from the stack starting at Top.
- -- Return True if Excep was found and removed, false otherwise.
-
- -- Hooks called when entering/leaving an exception handler for a given
- -- occurrence, aimed at handling the stack of active occurrences. The
- -- calls are generated by gigi in tree_transform/N_Exception_Handler.
-
- procedure Begin_Handler (GCC_Exception : GNAT_GCC_Exception_Access);
- pragma Export (C, Begin_Handler, "__gnat_begin_handler");
-
- procedure End_Handler (GCC_Exception : GNAT_GCC_Exception_Access);
- pragma Export (C, End_Handler, "__gnat_end_handler");
-
- Setup_Key : constant := 16#DEAD#;
- -- To handle the case of a task "transferring" an exception occurrence to
- -- another task, for instance via Exceptional_Complete_Rendezvous, we need
- -- to be able to identify occurrences which have been Setup and not yet
- -- Propagated. We hijack one of the common header fields for that purpose,
- -- setting it to a special key value during the setup process, clearing it
- -- at the very beginning of the propagation phase, and expecting it never
- -- to be reset to the special value later on. A 16-bit value is used rather
- -- than a 32-bit value for static compatibility with 16-bit targets such as
- -- AAMP (where type Unwind_Word will be 16 bits).
-
- function Is_Setup_And_Not_Propagated (E : EOA) return Boolean;
-
- procedure Set_Setup_And_Not_Propagated (E : EOA);
- procedure Clear_Setup_And_Not_Propagated (E : EOA);
-
- ------------------------------------------------------------
- -- Accessors to basic components of a GNAT exception data --
- ------------------------------------------------------------
-
- -- As of today, these are only used by the C implementation of the
- -- GCC propagation personality routine to avoid having to rely on a C
- -- counterpart of the whole exception_data structure, which is both
- -- painful and error prone. These subprograms could be moved to a
- -- more widely visible location if need be.
-
- function Is_Handled_By_Others (E : Exception_Data_Ptr) return Boolean;
- pragma Export (C, Is_Handled_By_Others, "__gnat_is_handled_by_others");
-
- function Language_For (E : Exception_Data_Ptr) return Character;
- pragma Export (C, Language_For, "__gnat_language_for");
-
- function Import_Code_For (E : Exception_Data_Ptr) return Exception_Code;
- pragma Export (C, Import_Code_For, "__gnat_import_code_for");
-
- function EID_For (GNAT_Exception : GNAT_GCC_Exception_Access)
- return Exception_Id;
- pragma Export (C, EID_For, "__gnat_eid_for");
-
- procedure Adjust_N_Cleanups_For
- (GNAT_Exception : GNAT_GCC_Exception_Access;
- Adjustment : Integer);
- pragma Export (C, Adjust_N_Cleanups_For, "__gnat_adjust_n_cleanups_for");
-
- ---------------------------------------------------------------------------
- -- Objects to materialize "others" and "all others" in the GCC EH tables --
- ---------------------------------------------------------------------------
-
- -- Currently, these only have their address taken and compared so there is
- -- no real point having whole exception data blocks allocated. In any case
- -- the types should match what gigi and the personality routine expect.
- -- The initial value is an arbitrary value that will not exceed the range
- -- of Integer on 16-bit targets (such as AAMP).
-
- Others_Value : constant Integer := 16#7FFF#;
- pragma Export (C, Others_Value, "__gnat_others_value");
-
- All_Others_Value : constant Integer := 16#7FFF#;
- pragma Export (C, All_Others_Value, "__gnat_all_others_value");
-
- ------------
- -- Remove --
- ------------
-
- function Remove
- (Top : EOA;
- Excep : GNAT_GCC_Exception_Access) return Boolean
- is
- Prev : GNAT_GCC_Exception_Access := null;
- Iter : EOA := Top;
- GCC_Exception : GNAT_GCC_Exception_Access;
-
- begin
- -- Pop stack
-
- loop
- pragma Assert (Iter.Private_Data /= System.Null_Address);
-
- GCC_Exception := To_GNAT_GCC_Exception (Iter.Private_Data);
-
- if GCC_Exception = Excep then
- if Prev = null then
-
- -- Special case for the top of the stack: shift the contents
- -- of the next item to the top, since top is at a fixed
- -- location and can't be changed.
-
- Iter := GCC_Exception.Next_Exception;
-
- if Iter = null then
-
- -- Stack is now empty
-
- Top.Private_Data := System.Null_Address;
-
- else
- Save_Occurrence_And_Private (Top.all, Iter.all);
- Free (Iter);
- end if;
-
- else
- Prev.Next_Exception := GCC_Exception.Next_Exception;
- Free (Iter);
- end if;
-
- Free (GCC_Exception);
-
- return True;
- end if;
-
- exit when GCC_Exception.Next_Exception = null;
-
- Prev := GCC_Exception;
- Iter := GCC_Exception.Next_Exception;
- end loop;
-
- return False;
- end Remove;
-
- ---------------------------
- -- CleanupUnwind_Handler --
- ---------------------------
-
- function CleanupUnwind_Handler
- (UW_Version : Integer;
- UW_Phases : Unwind_Action;
- UW_Eclass : Exception_Class;
- UW_Exception : access GNAT_GCC_Exception;
- UW_Context : System.Address;
- UW_Argument : System.Address) return Unwind_Reason_Code
- is
- begin
- -- Terminate as soon as we know there is nothing more to run. The
- -- count is maintained by the personality routine.
-
- if UW_Exception.N_Cleanups_To_Trigger = 0 then
- Unhandled_Exception_Terminate;
- end if;
-
- -- We know there is at least one cleanup further up. Return so that it
- -- is searched and entered, after which Unwind_Resume will be called
- -- and this hook will gain control (with an updated count) again.
-
- return URC_NO_REASON;
- end CleanupUnwind_Handler;
-
- ---------------------------------
- -- Is_Setup_And_Not_Propagated --
- ---------------------------------
-
- function Is_Setup_And_Not_Propagated (E : EOA) return Boolean is
- GCC_E : GNAT_GCC_Exception_Access :=
- To_GNAT_GCC_Exception (E.Private_Data);
- begin
- return GCC_E /= null and then GCC_E.Header.Private1 = Setup_Key;
- end Is_Setup_And_Not_Propagated;
-
- ------------------------------------
- -- Clear_Setup_And_Not_Propagated --
- ------------------------------------
-
- procedure Clear_Setup_And_Not_Propagated (E : EOA) is
- GCC_E : GNAT_GCC_Exception_Access :=
- To_GNAT_GCC_Exception (E.Private_Data);
- begin
- pragma Assert (GCC_E /= null);
- GCC_E.Header.Private1 := 0;
- end Clear_Setup_And_Not_Propagated;
-
- ----------------------------------
- -- Set_Setup_And_Not_Propagated --
- ----------------------------------
-
- procedure Set_Setup_And_Not_Propagated (E : EOA) is
- GCC_E : GNAT_GCC_Exception_Access :=
- To_GNAT_GCC_Exception (E.Private_Data);
- begin
- pragma Assert (GCC_E /= null);
- GCC_E.Header.Private1 := Setup_Key;
- end Set_Setup_And_Not_Propagated;
+ procedure builtin_longjmp (buffer : Address; Flag : Integer);
+ pragma No_Return (builtin_longjmp);
+ pragma Import (C, builtin_longjmp, "_gnat_builtin_longjmp");
---------------------
-- Setup_Exception --
---------------------
- -- In the GCC-EH implementation of the propagation scheme, this
- -- subprogram should be understood as : Setup the exception occurrence
- -- stack headed at Current for a forthcoming raise of Excep.
-
- -- In the GNAT-SJLJ case this "stack" only exists implicitely, by way of
- -- local occurrence declarations together with save/restore operations
- -- generated by the front-end, and this routine has nothing to do.
-
- -- The differenciation is done here and not in the callers to avoid having
- -- to spread out the test in numerous places.
-
procedure Setup_Exception
(Excep : EOA;
Current : EOA;
Reraised : Boolean := False)
is
- Top : constant EOA := Current;
- Next : EOA;
- GCC_Exception : GNAT_GCC_Exception_Access;
-
- begin
- -- Just return if we're not in the GCC-EH case. What is otherwise
- -- performed is useless and even harmful since it potentially involves
- -- dynamic allocations that would never be released, and participates
- -- in the Setup_And_Not_Propagated predicate management, only properly
- -- handled by the rest of the GCC-EH scheme.
-
- if Zero_Cost_Exceptions = 0 then
- return;
- end if;
-
- -- Otherwise, the exception Excep is soon to be propagated, and the
- -- storage used for that will be the occurrence statically allocated
- -- for the current thread. This storage might currently be used for a
- -- still active occurrence, so we need to push it on the thread's
- -- occurrence stack (headed at that static occurrence) before it gets
- -- clobbered.
-
- -- What we do here is to trigger this push when need be, and allocate a
- -- Private_Data block for the forthcoming Propagation.
-
- -- Some tasking rendez-vous attempts lead to an occurrence transfer
- -- from the server to the client (see Exceptional_Complete_Rendezvous).
- -- In those cases Setup is called twice for the very same occurrence
- -- before it gets propagated: once from the server, because this is
- -- where the occurrence contents is elaborated and known, and then
- -- once from the client when it detects the case and actually raises
- -- the exception in its own context.
-
- -- The Is_Setup_And_Not_Propagated predicate tells us when we are in
- -- the second call to Setup for a Transferred occurrence, and there is
- -- nothing to be done here in this situation. This predicate cannot be
- -- True if we are dealing with a Reraise, and we may even be called
- -- with a raw uninitialized Excep occurrence in this case so we should
- -- not check anyway. Observe the front-end expansion for a "raise;" to
- -- see that happening. We get a local occurrence and a direct call to
- -- Save_Occurrence without the intermediate init-proc call.
-
- if not Reraised and then Is_Setup_And_Not_Propagated (Excep) then
- return;
- end if;
-
- -- Allocate what will be the Private_Data block for the exception
- -- to be propagated.
-
- GCC_Exception := new GNAT_GCC_Exception;
-
- -- If the Top of the occurrence stack is not currently used for an
- -- active exception (the stack is empty) we just need to setup the
- -- Private_Data pointer.
-
- -- Otherwise, we also need to shift the contents of the Top of the
- -- stack in a freshly allocated entry and link everything together.
-
- if Top.Private_Data /= System.Null_Address then
- Next := new Exception_Occurrence;
- Save_Occurrence_And_Private (Next.all, Top.all);
-
- GCC_Exception.Next_Exception := Next;
- Top.Private_Data := GCC_Exception.all'Address;
- end if;
-
- Top.Private_Data := GCC_Exception.all'Address;
-
- Set_Setup_And_Not_Propagated (Top);
- end Setup_Exception;
-
- -------------------
- -- Begin_Handler --
- -------------------
-
- procedure Begin_Handler (GCC_Exception : GNAT_GCC_Exception_Access) is
+ pragma Unreferenced (Excep, Current, Reraised);
begin
- -- Every necessary operation related to the occurrence stack has
- -- already been performed by Propagate_Exception. This hook remains for
- -- potential future necessity in optimizing the overall scheme, as well
- -- a useful debugging tool.
+ -- In the GNAT-SJLJ case this "stack" only exists implicitely, by way of
+ -- local occurrence declarations together with save/restore operations
+ -- generated by the front-end, and this routine has nothing to do.
null;
- end Begin_Handler;
-
- -----------------
- -- End_Handler --
- -----------------
-
- procedure End_Handler (GCC_Exception : GNAT_GCC_Exception_Access) is
- Removed : Boolean;
- begin
- Removed := Remove (Get_Current_Excep.all, GCC_Exception);
- pragma Assert (Removed);
- end End_Handler;
+ end Setup_Exception;
-------------------------
-- Propagate_Exception --
-------------------------
- -- Build an object suitable for the libgcc processing and call
- -- Unwind_RaiseException to actually throw, taking care of handling
- -- the two phase scheme it implements.
-
procedure Propagate_Exception (From_Signal_Handler : Boolean) is
- Excep : EOA := Get_Current_Excep.all;
- GCC_Exception : GNAT_GCC_Exception_Access;
-
+ Jumpbuf_Ptr : constant Address := Get_Jmpbuf_Address.all;
+ Excep : constant EOA := Get_Current_Excep.all;
begin
- pragma Assert (Excep.Private_Data /= System.Null_Address);
+ -- Compute the backtrace for this occurrence if corresponding binder
+ -- option has been set. Call_Chain takes care of the reraise case.
- -- Retrieve the Private_Data for this occurrence and set the useful
- -- flags for the personality routine, which will be called for each
- -- frame via Unwind_RaiseException below.
-
- GCC_Exception := To_GNAT_GCC_Exception (Excep.Private_Data);
-
- Clear_Setup_And_Not_Propagated (Excep);
-
- GCC_Exception.Id := Excep.Id;
- GCC_Exception.N_Cleanups_To_Trigger := 0;
-
- -- Compute the backtrace for this occurrence if the corresponding
- -- binder option has been set. Call_Chain takes care of the reraise
- -- case.
+ Call_Chain (Excep);
- -- ??? Using Call_Chain here means we are going to walk up the stack
- -- once only for backtracing purposes before doing it again for the
- -- propagation per se.
+ -- Note on above call to Call_Chain:
- -- The first inspection is much lighter, though, as it only requires
- -- partial unwinding of each frame. Additionally, although we could use
- -- the personality routine to record the addresses while propagating,
- -- this method has two drawbacks:
+ -- We used to only do this if From_Signal_Handler was not set,
+ -- based on the assumption that backtracing from a signal handler
+ -- would not work due to stack layout oddities. However, since
- -- 1) the trace is incomplete if the exception is handled since we
- -- don't walk past the frame with the handler,
+ -- 1. The flag is never set in tasking programs (Notify_Exception
+ -- performs regular raise statements), and
- -- and
+ -- 2. No problem has shown up in tasking programs around here so
+ -- far, this turned out to be too strong an assumption.
- -- 2) we would miss the frames for which our personality routine is not
- -- called, e.g. if C or C++ calls are on the way.
+ -- As, in addition, the test was
- Call_Chain (Excep);
+ -- 1. preventing the production of backtraces in non-tasking
+ -- programs, and
- -- Perform a standard raise first. If a regular handler is found, it
- -- will be entered after all the intermediate cleanups have run. If
- -- there is no regular handler, control will get back to after the
- -- call, with N_Cleanups_To_Trigger set to the number of frames with
- -- cleanups found on the way up, and none of these already run.
+ -- 2. introducing a behavior inconsistency between
+ -- the tasking and non-tasking cases,
- Unwind_RaiseException (GCC_Exception);
+ -- we have simply removed it
- -- If we get here we know the exception is not handled, as otherwise
- -- Unwind_RaiseException arranges for the handler to be entered. Take
- -- the necessary steps to enable the debugger to gain control while the
- -- stack is still intact.
+ -- If the jump buffer pointer is non-null, transfer control using
+ -- it. Otherwise announce an unhandled exception (note that this
+ -- means that we have no finalizations to do other than at the outer
+ -- level). Perform the necessary notification tasks in both cases.
- Notify_Unhandled_Exception;
+ if Jumpbuf_Ptr /= Null_Address then
+ if not Excep.Exception_Raised then
+ Excep.Exception_Raised := True;
+ Exception_Traces.Notify_Handled_Exception;
+ end if;
- -- Now, if cleanups have been found, run a forced unwind to trigger
- -- them. Control should not resume there, as the unwinding hook calls
- -- Unhandled_Exception_Terminate as soon as the last cleanup has been
- -- triggered.
+ builtin_longjmp (Jumpbuf_Ptr, 1);
- if GCC_Exception.N_Cleanups_To_Trigger /= 0 then
- Unwind_ForcedUnwind (GCC_Exception,
- CleanupUnwind_Handler'Address,
- System.Null_Address);
+ else
+ Exception_Traces.Notify_Unhandled_Exception;
+ Exception_Traces.Unhandled_Exception_Terminate;
end if;
-
- -- We get here when there is no handler or cleanup to be run at
- -- all. The debugger has been notified before the second step above.
-
- Unhandled_Exception_Terminate;
end Propagate_Exception;
- ---------------------------
- -- Adjust_N_Cleanups_For --
- ---------------------------
-
- procedure Adjust_N_Cleanups_For
- (GNAT_Exception : GNAT_GCC_Exception_Access;
- Adjustment : Integer)
- is
- begin
- GNAT_Exception.N_Cleanups_To_Trigger :=
- GNAT_Exception.N_Cleanups_To_Trigger + Adjustment;
- end Adjust_N_Cleanups_For;
-
- -------------
- -- EID_For --
- -------------
-
- function EID_For
- (GNAT_Exception : GNAT_GCC_Exception_Access) return Exception_Id
- is
- begin
- return GNAT_Exception.Id;
- end EID_For;
-
- ---------------------
- -- Import_Code_For --
- ---------------------
-
- function Import_Code_For
- (E : SSL.Exception_Data_Ptr) return Exception_Code
- is
- begin
- return E.all.Import_Code;
- end Import_Code_For;
-
- --------------------------
- -- Is_Handled_By_Others --
- --------------------------
-
- function Is_Handled_By_Others
- (E : SSL.Exception_Data_Ptr) return Boolean
- is
- begin
- return not E.all.Not_Handled_By_Others;
- end Is_Handled_By_Others;
-
- ------------------
- -- Language_For --
- ------------------
-
- function Language_For
- (E : SSL.Exception_Data_Ptr) return Character
- is
- begin
- return E.all.Lang;
- end Language_For;
-
- -----------
- -- Notes --
- -----------
-
- -- The current model implemented for the stack of occurrences is a
- -- simplification of previous attempts, which all prooved to be flawed or
- -- would have needed significant additional circuitry to be made to work
- -- correctly.
-
- -- We now represent every propagation by a new entry on the stack, which
- -- means that an exception occurrence may appear more than once (e.g. when
- -- it is reraised during the course of its own handler).
-
- -- This may seem overcostly compared to the C++ model as implemented in
- -- the g++ v3 libstd. This is actually understandable when one considers
- -- the extra variations of possible run-time configurations induced by the
- -- freedom offered by the Save_Occurrence/Reraise_Occurrence public
- -- interface.
-
- -- The basic point is that arranging for an occurrence to always appear at
- -- most once on the stack requires a way to determine if a given occurence
- -- is already there, which is not as easy as it might seem.
-
- -- An attempt was made to use the Private_Data pointer for this purpose.
- -- It did not work because:
-
- -- 1) The Private_Data has to be saved by Save_Occurrence to be usable
- -- as a key in case of a later reraise,
-
- -- 2) There is no easy way to synchronize End_Handler for an occurrence
- -- and the data attached to potential copies, so these copies may end
- -- up pointing to stale data. Moreover ...
-
- -- 3) The same address may be reused for different occurrences, which
- -- defeats the idea of using it as a key.
-
- -- The example below illustrates:
-
- -- Saved_CE : Exception_Occurrence;
-
- -- begin
- -- raise Constraint_Error;
- -- exception
- -- when CE: others =>
- -- Save_Occurrence (Saved_CE, CE); <= Saved_CE.PDA = CE.PDA
- -- end;
-
- -- <= Saved_CE.PDA is stale (!)
-
- -- begin
- -- raise Program_Error; <= Saved_CE.PDA = PE.PDA (!!)
- -- exception
- -- when others =>
- -- Reraise_Occurrence (Saved_CE);
- -- end;
-
- -- Not releasing the Private_Data via End_Handler could be an option,
- -- but making this to work while still avoiding memory leaks is far
- -- from trivial.
-
- -- The current scheme has the advantage of beeing simple, and induces
- -- extra costs only in reraise cases which is acceptable.
-
end Exception_Propagation;
diff --git a/gcc/ada/a-exextr.adb b/gcc/ada/a-exextr.adb
index caeb23c321d..b50dbc9b492 100644
--- a/gcc/ada/a-exextr.adb
+++ b/gcc/ada/a-exextr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-exstat.adb b/gcc/ada/a-exstat.adb
index d227c45c623..142065f3719 100644
--- a/gcc/ada/a-exstat.adb
+++ b/gcc/ada/a-exstat.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-filico.ads b/gcc/ada/a-filico.ads
index 624ba5fa7ef..5295a06be79 100644
--- a/gcc/ada/a-filico.ads
+++ b/gcc/ada/a-filico.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-finali.ads b/gcc/ada/a-finali.ads
index c2ae4210ca6..598c2926018 100644
--- a/gcc/ada/a-finali.ads
+++ b/gcc/ada/a-finali.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-interr.ads b/gcc/ada/a-interr.ads
index 941af5894fa..8c9c7212b6d 100644
--- a/gcc/ada/a-interr.ads
+++ b/gcc/ada/a-interr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-intnam-aix.ads b/gcc/ada/a-intnam-aix.ads
index e45c029b5ef..279db9db339 100644
--- a/gcc/ada/a-intnam-aix.ads
+++ b/gcc/ada/a-intnam-aix.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,20 +31,20 @@
-- --
------------------------------------------------------------------------------
--- This is a AIX version of this package.
---
+-- This is a AIX version of this package
+
-- The following signals are reserved by the run time (native threads):
---
+
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGABRT, SIGTRAP, SIGINT, SIGTERM,
-- SIGSTOP, SIGKILL
---
+
-- The following signals are reserved by the run time (FSU threads):
---
+
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGABRT, SIGTRAP, SIGINT, SIGALRM,
-- SIGWAITING, SIGSTOP, SIGKILL
---
+
-- The pragma Unreserve_All_Interrupts affects the following signal(s):
---
+
-- SIGINT: made available for Ada handler
-- This target-dependent package spec contains names of interrupts
@@ -55,10 +55,9 @@ with System.OS_Interface;
package Ada.Interrupts.Names is
- -- Beware that the mapping of names to signals may be
- -- many-to-one. There may be aliases. Also, for all
- -- signal names that are not supported on the current system
- -- the value of the corresponding constant will be zero.
+ -- Beware that the mapping of names to signals may be many-to-one. There
+ -- may be aliases. Also, for all signal names that are not supported on the
+ -- current system the value of the corresponding constant will be zero.
SIGHUP : constant Interrupt_ID :=
System.OS_Interface.SIGHUP; -- hangup
diff --git a/gcc/ada/a-intnam-darwin.ads b/gcc/ada/a-intnam-darwin.ads
index 1ac9b82b32e..23d12f1de50 100644
--- a/gcc/ada/a-intnam-darwin.ads
+++ b/gcc/ada/a-intnam-darwin.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,14 +31,14 @@
-- --
------------------------------------------------------------------------------
--- This is the Darwin version of this package.
---
+-- This is the Darwin version of this package
+
-- The following signals are reserved by the run time:
---
+
-- SIGSTOP, SIGKILL
---
+
-- The pragma Unreserve_All_Interrupts affects the following signal(s):
---
+
-- SIGINT: made available for Ada handler
-- This target-dependent package spec contains names of interrupts
@@ -49,10 +49,9 @@ with System.OS_Interface;
package Ada.Interrupts.Names is
- -- Beware that the mapping of names to signals may be
- -- many-to-one. There may be aliases. Also, for all
- -- signal names that are not supported on the current system
- -- the value of the corresponding constant will be zero.
+ -- Beware that the mapping of names to signals may be many-to-one. There
+ -- may be aliases. Also, for all signal names that are not supported on the
+ -- current system the value of the corresponding constant will be zero.
SIGHUP : constant Interrupt_ID :=
System.OS_Interface.SIGHUP; -- hangup
diff --git a/gcc/ada/a-intnam-dummy.ads b/gcc/ada/a-intnam-dummy.ads
index 76210c03198..f2b418795fe 100644
--- a/gcc/ada/a-intnam-dummy.ads
+++ b/gcc/ada/a-intnam-dummy.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (No Tasking Version) --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-intnam-freebsd.ads b/gcc/ada/a-intnam-freebsd.ads
index 3b72036904d..329b0f6508f 100644
--- a/gcc/ada/a-intnam-freebsd.ads
+++ b/gcc/ada/a-intnam-freebsd.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-intnam-interix.ads b/gcc/ada/a-intnam-interix.ads
index f56f5dd33a4..a6fa5cb6860 100644
--- a/gcc/ada/a-intnam-interix.ads
+++ b/gcc/ada/a-intnam-interix.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-intnam-linux.ads b/gcc/ada/a-intnam-linux.ads
index 4246765cfd8..70fb471b084 100644
--- a/gcc/ada/a-intnam-linux.ads
+++ b/gcc/ada/a-intnam-linux.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,20 +31,20 @@
-- --
------------------------------------------------------------------------------
--- This is a GNU/Linux version of this package.
---
+-- This is a GNU/Linux version of this package
+
-- The following signals are reserved by the run time (FSU threads):
---
+
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGTRAP, SIGABRT, SIGINT,
-- SIGALRM, SIGVTALRM, SIGUNUSED, SIGSTOP, SIGKILL
---
+
-- The following signals are reserved by the run time (LinuxThreads):
---
+
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGTRAP, SIGABRT, SIGINT,
-- SIGUSR1, SIGUSR2, SIGVTALRM, SIGUNUSED, SIGSTOP, SIGKILL
---
+
-- The pragma Unreserve_All_Interrupts affects the following signal(s):
---
+
-- SIGINT: made available for Ada handler
-- This target-dependent package spec contains names of interrupts
@@ -55,10 +55,9 @@ with System.OS_Interface;
package Ada.Interrupts.Names is
- -- Beware that the mapping of names to signals may be
- -- many-to-one. There may be aliases. Also, for all
- -- signal names that are not supported on the current system
- -- the value of the corresponding constant will be zero.
+ -- Beware that the mapping of names to signals may be many-to-one. There
+ -- may be aliases. Also, for all signal names that are not supported on the
+ -- current system the value of the corresponding constant will be zero.
SIGHUP : constant Interrupt_ID :=
System.OS_Interface.SIGHUP; -- hangup
diff --git a/gcc/ada/a-intnam-lynxos.ads b/gcc/ada/a-intnam-lynxos.ads
index 7e484d57367..850eb2af033 100644
--- a/gcc/ada/a-intnam-lynxos.ads
+++ b/gcc/ada/a-intnam-lynxos.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,15 +31,15 @@
-- --
------------------------------------------------------------------------------
--- This is a LynxOS version of this package.
---
+-- This is a LynxOS version of this package
+
-- The following signals are reserved by the run time:
---
+
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGTRAP, SIGABRT, SIGINT,
-- SIGWAITING, SIGLWP, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF, SIGSTOP, SIGKILL
---
+
-- The pragma Unreserve_All_Interrupts affects the following signal(s):
---
+
-- SIGINT: made available for Ada handler
with System.OS_Interface;
@@ -47,8 +47,8 @@ with System.OS_Interface;
package Ada.Interrupts.Names is
- -- Beware that the mapping of names to signals may be
- -- many-to-one. There may be aliases.
+ -- Beware that the mapping of names to signals may be many-to-one. There
+ -- may be aliases.
SIGHUP : constant Interrupt_ID :=
System.OS_Interface.SIGHUP; -- hangup
diff --git a/gcc/ada/a-intnam-mingw.ads b/gcc/ada/a-intnam-mingw.ads
index 13038fe2410..a8c5e4ee11a 100644
--- a/gcc/ada/a-intnam-mingw.ads
+++ b/gcc/ada/a-intnam-mingw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -41,10 +41,9 @@ with System.OS_Interface;
package Ada.Interrupts.Names is
- -- Beware that the mapping of names to signals may be
- -- many-to-one. There may be aliases. Also, for all
- -- signal names that are not supported on the current system
- -- the value of the corresponding constant will be zero.
+ -- Beware that the mapping of names to signals may be many-to-one. There
+ -- may be aliases. Also, for all signal names that are not supported on the
+ -- current system the value of the corresponding constant will be zero.
SIGINT : constant Interrupt_ID :=
System.OS_Interface.SIGINT; -- interrupt (rubout)
diff --git a/gcc/ada/a-intnam-solaris.ads b/gcc/ada/a-intnam-solaris.ads
index f65b861786e..4b4adcf109c 100644
--- a/gcc/ada/a-intnam-solaris.ads
+++ b/gcc/ada/a-intnam-solaris.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,20 +31,20 @@
-- --
------------------------------------------------------------------------------
--- This is a Solaris version of this package.
---
+-- This is a Solaris version of this package
+
-- The following signals are reserved by the run time (native threads):
---
+
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGTRAP, SIGABRT, SIGINT,
-- SIGLWP, SIGWAITING, SIGCANCEL, SIGSTOP, SIGKILL
---
+
-- The following signals are reserved by the run time (FSU threads):
---
+
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGTRAP, SIGTERM, SIGABRT, SIGINT,
-- SIGLWP, SIGALRM, SIGVTALRM, SIGAITING, SIGSTOP, SIGKILL
---
+
-- The pragma Unreserve_All_Interrupts affects the following signal(s):
---
+
-- SIGINT: made available for Ada handlers
with System.OS_Interface;
@@ -52,10 +52,9 @@ with System.OS_Interface;
package Ada.Interrupts.Names is
- -- Beware that the mapping of names to signals may be
- -- many-to-one. There may be aliases. Also, for all
- -- signal names that are not supported on the current system
- -- the value of the corresponding constant will be zero.
+ -- Beware that the mapping of names to signals may be many-to-one. There
+ -- may be aliases. Also, for all signal names that are not supported on the
+ -- current system the value of the corresponding constant will be zero.
SIGHUP : constant Interrupt_ID :=
System.OS_Interface.SIGHUP; -- hangup
diff --git a/gcc/ada/a-intnam-tru64.ads b/gcc/ada/a-intnam-tru64.ads
index 579be22556e..8b6a838c101 100644
--- a/gcc/ada/a-intnam-tru64.ads
+++ b/gcc/ada/a-intnam-tru64.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,15 +31,15 @@
-- --
------------------------------------------------------------------------------
--- This is the DEC Unix 4.0 version of this package.
---
+-- This is the DEC Unix 4.0 version of this package
+
-- The following signals are reserved by the run time:
---
+
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGABRT, SIGTRAP, SIGINT, SIGALRM,
-- SIGSTOP, SIGKILL
---
+
-- The pragma Unreserve_All_Interrupts affects the following signal(s):
---
+
-- SIGINT: made available for Ada handler
with System.OS_Interface;
@@ -47,10 +47,9 @@ with System.OS_Interface;
package Ada.Interrupts.Names is
- -- Beware that the mapping of names to signals may be
- -- many-to-one. There may be aliases. Also, for all
- -- signal names that are not supported on the current system
- -- the value of the corresponding constant will be zero.
+ -- Beware that the mapping of names to signals may be many-to-one. There
+ -- may be aliases. Also, for all signal names that are not supported on the
+ -- current system the value of the corresponding constant will be zero.
SIGHUP : constant Interrupt_ID :=
System.OS_Interface.SIGHUP; -- hangup
diff --git a/gcc/ada/a-intnam-unixware.ads b/gcc/ada/a-intnam-unixware.ads
index 956470cc40a..ff8a6c801c4 100644
--- a/gcc/ada/a-intnam-unixware.ads
+++ b/gcc/ada/a-intnam-unixware.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,15 +31,15 @@
-- --
------------------------------------------------------------------------------
--- This is a SCO UnixWare version of this package.
---
+-- This is a SCO UnixWare version of this package
+
-- The following signals are reserved by the run time:
---
+
-- SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGTRAP, SIGABRT, SIGINT,
-- SIGWAITING, SIGLWP, SIGTTIN, SIGTTOU, SIGTSTP, SIGPROF, SIGSTOP, SIGKILL
---
+
-- The pragma Unreserve_All_Interrupts affects the following signal(s):
---
+
-- SIGINT: made available for Ada handler
with System.OS_Interface;
@@ -47,8 +47,8 @@ with System.OS_Interface;
package Ada.Interrupts.Names is
- -- Beware that the mapping of names to signals may be
- -- many-to-one. There may be aliases.
+ -- Beware that the mapping of names to signals may be many-to-one. There
+ -- may be aliases.
SIGHUP : constant Interrupt_ID :=
System.OS_Interface.SIGHUP; -- hangup
diff --git a/gcc/ada/a-intnam-vms.ads b/gcc/ada/a-intnam-vms.ads
index e079f0274a7..3b745d17ccb 100644
--- a/gcc/ada/a-intnam-vms.ads
+++ b/gcc/ada/a-intnam-vms.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,8 +31,8 @@
-- --
------------------------------------------------------------------------------
--- This is a OpenVMS/Alpha version of this package.
---
+-- This is a OpenVMS/Alpha version of this package
+
-- This target-dependent package spec contains names of interrupts
-- supported by the local system.
diff --git a/gcc/ada/a-intnam-vxworks.ads b/gcc/ada/a-intnam-vxworks.ads
index beb915be0b0..7a2427a7725 100644
--- a/gcc/ada/a-intnam-vxworks.ads
+++ b/gcc/ada/a-intnam-vxworks.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-intsig.adb b/gcc/ada/a-intsig.adb
index 80a9441e434..2099cd8b6ff 100644
--- a/gcc/ada/a-intsig.adb
+++ b/gcc/ada/a-intsig.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with System.Interrupt_Management.Operations;
+
package body Ada.Interrupts.Signal is
------------------------
@@ -43,4 +44,5 @@ package body Ada.Interrupts.Signal is
System.Interrupt_Management.Operations.Interrupt_Self_Process
(System.Interrupt_Management.Interrupt_ID (Interrupt));
end Generate_Interrupt;
+
end Ada.Interrupts.Signal;
diff --git a/gcc/ada/a-intsig.ads b/gcc/ada/a-intsig.ads
index 0150622c1f5..5160123539a 100644
--- a/gcc/ada/a-intsig.ads
+++ b/gcc/ada/a-intsig.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,10 +35,10 @@
-- by user programs and avoids importing low level children of System
-- (e.g. System.Interrupt_Management.Operations), or defining an interface
-- to complex system calls.
---
+
package Ada.Interrupts.Signal is
procedure Generate_Interrupt (Interrupt : Interrupt_ID);
- -- Generate Interrupt at the process level
+ -- Generate interrupt at the process level
end Ada.Interrupts.Signal;
diff --git a/gcc/ada/a-ngcefu.adb b/gcc/ada/a-ngcefu.adb
index 44216466cb4..d0e203d2780 100644
--- a/gcc/ada/a-ngcefu.adb
+++ b/gcc/ada/a-ngcefu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ngcoty.adb b/gcc/ada/a-ngcoty.adb
index aa8c9955d0f..f0abc80ec37 100644
--- a/gcc/ada/a-ngcoty.adb
+++ b/gcc/ada/a-ngcoty.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with Ada.Numerics.Aux; use Ada.Numerics.Aux;
+
package body Ada.Numerics.Generic_Complex_Types is
subtype R is Real'Base;
diff --git a/gcc/ada/a-ngcoty.ads b/gcc/ada/a-ngcoty.ads
index fd6c9071b4a..0e006d24cb9 100644
--- a/gcc/ada/a-ngcoty.ads
+++ b/gcc/ada/a-ngcoty.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-nudira.adb b/gcc/ada/a-nudira.adb
index 9cdd8a149e1..dd8408f2d81 100644
--- a/gcc/ada/a-nudira.adb
+++ b/gcc/ada/a-nudira.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with Ada.Calendar;
+
with Interfaces; use Interfaces;
package body Ada.Numerics.Discrete_Random is
@@ -201,7 +202,6 @@ package body Ada.Numerics.Discrete_Random is
procedure Reset (Gen : Generator; From_State : State) is
Genp : constant Pointer := Gen.Gen_State'Unrestricted_Access;
-
begin
Genp.all := From_State;
end Reset;
diff --git a/gcc/ada/a-nudira.ads b/gcc/ada/a-nudira.ads
index 275e89825fd..c6b2b3e9f30 100644
--- a/gcc/ada/a-nudira.ads
+++ b/gcc/ada/a-nudira.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-nuflra.adb b/gcc/ada/a-nuflra.adb
index 5f43c97df6b..379d58fe7b4 100644
--- a/gcc/ada/a-nuflra.adb
+++ b/gcc/ada/a-nuflra.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-numaux-darwin.adb b/gcc/ada/a-numaux-darwin.adb
index d9235a10649..af0f1d5bd0f 100644
--- a/gcc/ada/a-numaux-darwin.adb
+++ b/gcc/ada/a-numaux-darwin.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- (Apple OS X Version) --
-- --
--- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,7 +32,7 @@
-- --
------------------------------------------------------------------------------
--- File a-numaux.adb <- a-numaux-darwin.adb
+-- File a-numaux.adb <- a-numaux-d arwin.adb
package body Ada.Numerics.Aux is
@@ -95,7 +95,8 @@ package body Ada.Numerics.Aux is
P5 : constant Double := Double'Leading_Part (Half_Pi - P1 - P2 - P3
- P4, HM);
P6 : constant Double := Double'Model (Half_Pi - P1 - P2 - P3 - P4 - P5);
- K : Double := X * Two_Over_Pi;
+ K : Double;
+
begin
-- For X < 2.0**HM, all products below are computed exactly.
-- Due to cancellation effects all subtractions are exact as well.
@@ -103,17 +104,17 @@ package body Ada.Numerics.Aux is
-- zeros after the binary point, the result will be the correctly
-- rounded result of X - K * (Pi / 2.0).
- while abs K >= 2.0**HM loop
+ K := X * Two_Over_Pi;
+ while abs K >= 2.0 ** HM loop
K := K * M - (K * M - K);
- X := (((((X - K * P1) - K * P2) - K * P3)
- - K * P4) - K * P5) - K * P6;
+ X :=
+ (((((X - K * P1) - K * P2) - K * P3) - K * P4) - K * P5) - K * P6;
K := X * Two_Over_Pi;
end loop;
- if K /= K then
-
- -- K is not a number, because X was not finite
+ -- If K is not a number (because X was not finite) raise exception
+ if K /= K then
raise Constraint_Error;
end if;
diff --git a/gcc/ada/a-numaux-darwin.ads b/gcc/ada/a-numaux-darwin.ads
index 67faa0f9982..77f5badf937 100644
--- a/gcc/ada/a-numaux-darwin.ads
+++ b/gcc/ada/a-numaux-darwin.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (Apple OS X Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-numaux-libc-x86.ads b/gcc/ada/a-numaux-libc-x86.ads
index 8e94fa0176d..ac2df18d310 100644
--- a/gcc/ada/a-numaux-libc-x86.ads
+++ b/gcc/ada/a-numaux-libc-x86.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (C Library Version for x86) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-numaux-vxworks.ads b/gcc/ada/a-numaux-vxworks.ads
index db71c046444..70f07ca3582 100644
--- a/gcc/ada/a-numaux-vxworks.ads
+++ b/gcc/ada/a-numaux-vxworks.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (C Library Version, VxWorks) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-numaux-x86.ads b/gcc/ada/a-numaux-x86.ads
index 97cf691b127..7cfb612f37b 100644
--- a/gcc/ada/a-numaux-x86.ads
+++ b/gcc/ada/a-numaux-x86.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (Machine Version for x86) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-numaux.ads b/gcc/ada/a-numaux.ads
index fb09ad1009b..694ca8069f2 100644
--- a/gcc/ada/a-numaux.ads
+++ b/gcc/ada/a-numaux.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (C Library Version, non-x86) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-rbtgso.adb b/gcc/ada/a-rbtgso.adb
index 4a46be1181c..6742e285291 100644
--- a/gcc/ada/a-rbtgso.adb
+++ b/gcc/ada/a-rbtgso.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-reatim.ads b/gcc/ada/a-reatim.ads
index c761354d51f..ae87c0a322a 100644
--- a/gcc/ada/a-reatim.ads
+++ b/gcc/ada/a-reatim.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-secain.adb b/gcc/ada/a-secain.adb
index 777af4e27e3..74d222d6a59 100644
--- a/gcc/ada/a-secain.adb
+++ b/gcc/ada/a-secain.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-sequio.adb b/gcc/ada/a-sequio.adb
index 1a5966b7a91..6d4d84f9d2f 100644
--- a/gcc/ada/a-sequio.adb
+++ b/gcc/ada/a-sequio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-sequio.ads b/gcc/ada/a-sequio.ads
index 3a01364c3a3..2aba80abfc5 100644
--- a/gcc/ada/a-sequio.ads
+++ b/gcc/ada/a-sequio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -36,6 +36,7 @@
------------------------------------------------------------------------------
with Ada.IO_Exceptions;
+
with System.Sequential_IO;
generic
diff --git a/gcc/ada/a-shcain.adb b/gcc/ada/a-shcain.adb
index c41c2e6cdfb..4b6000c26be 100644
--- a/gcc/ada/a-shcain.adb
+++ b/gcc/ada/a-shcain.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -33,7 +33,7 @@
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
-with Ada.Characters.Handling; use Ada.Characters.Handling;
+with Ada.Characters.Handling; use Ada.Characters.Handling;
-- Note: source of this algorithm: GNAT.HTable.Hash (g-htable.adb)
diff --git a/gcc/ada/a-siocst.ads b/gcc/ada/a-siocst.ads
index 949e398b5c6..26a9af94eab 100644
--- a/gcc/ada/a-siocst.ads
+++ b/gcc/ada/a-siocst.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-slcain.adb b/gcc/ada/a-slcain.adb
index 5ce584e2710..5a5b8928c43 100644
--- a/gcc/ada/a-slcain.adb
+++ b/gcc/ada/a-slcain.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -33,7 +33,7 @@
-- This unit was originally developed by Matthew J Heaney. --
------------------------------------------------------------------------------
-with Ada.Characters.Handling; use Ada.Characters.Handling;
+with Ada.Characters.Handling; use Ada.Characters.Handling;
function Ada.Strings.Less_Case_Insensitive
(Left, Right : String) return Boolean
diff --git a/gcc/ada/a-ssicst.ads b/gcc/ada/a-ssicst.ads
index 1d56f0f07ed..d5f2d6a4ea9 100644
--- a/gcc/ada/a-ssicst.ads
+++ b/gcc/ada/a-ssicst.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stmaco.ads b/gcc/ada/a-stmaco.ads
index 660f557a266..86e1bb948eb 100644
--- a/gcc/ada/a-stmaco.ads
+++ b/gcc/ada/a-stmaco.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- ACopyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-storio.adb b/gcc/ada/a-storio.adb
index 3f50e730ad1..ebf6168cdfb 100644
--- a/gcc/ada/a-storio.adb
+++ b/gcc/ada/a-storio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-strbou.adb b/gcc/ada/a-strbou.adb
index 6bcf0b4755a..015123a8faf 100644
--- a/gcc/ada/a-strbou.adb
+++ b/gcc/ada/a-strbou.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-strbou.ads b/gcc/ada/a-strbou.ads
index 74bb8f697a1..d0dbe8c9ce0 100644
--- a/gcc/ada/a-strbou.ads
+++ b/gcc/ada/a-strbou.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stream.ads b/gcc/ada/a-stream.ads
index 0b68692857a..5bca4a2cc5b 100644
--- a/gcc/ada/a-stream.ads
+++ b/gcc/ada/a-stream.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-strfix.adb b/gcc/ada/a-strfix.adb
index 5eee9348f27..3385baac868 100644
--- a/gcc/ada/a-strfix.adb
+++ b/gcc/ada/a-strfix.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,14 +31,14 @@
-- --
------------------------------------------------------------------------------
--- Note: This code is derived from the ADAR.CSH public domain Ada 83
--- versions of the Appendix C string handling packages. One change is
--- to avoid the use of Is_In, so that we are not dependent on inlining.
--- Note that the search function implementations are to be found in the
--- auxiliary package Ada.Strings.Search. Also the Move procedure is
--- directly incorporated (ADAR used a subunit for this procedure). A
--- number of errors having to do with bounds of function return results
--- were also fixed, and use of & removed for efficiency reasons.
+-- Note: This code is derived from the ADAR.CSH public domain Ada 83 versions
+-- of the Appendix C string handling packages. One change is to avoid the use
+-- of Is_In, so that we are not dependent on inlining. Note that the search
+-- function implementations are to be found in the auxiliary package
+-- Ada.Strings.Search. Also the Move procedure is directly incorporated (ADAR
+-- used a subunit for this procedure). number of errors having to do with
+-- bounds of function return results were also fixed, and use of & removed for
+-- efficiency reasons.
with Ada.Strings.Maps; use Ada.Strings.Maps;
with Ada.Strings.Search;
diff --git a/gcc/ada/a-strhas.adb b/gcc/ada/a-strhas.adb
index a22c27c66ee..ba02a75c68c 100644
--- a/gcc/ada/a-strhas.adb
+++ b/gcc/ada/a-strhas.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-strmap.adb b/gcc/ada/a-strmap.adb
index f5e324914da..ee0179ef8a8 100644
--- a/gcc/ada/a-strmap.adb
+++ b/gcc/ada/a-strmap.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-strmap.ads b/gcc/ada/a-strmap.ads
index 3331a2f1666..bd1b98f00cc 100644
--- a/gcc/ada/a-strmap.ads
+++ b/gcc/ada/a-strmap.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-strsea.adb b/gcc/ada/a-strsea.adb
index f98617cde74..322aeaa7fb1 100644
--- a/gcc/ada/a-strsea.adb
+++ b/gcc/ada/a-strsea.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-strsea.ads b/gcc/ada/a-strsea.ads
index f9d81c74c70..6c7a5c297da 100644
--- a/gcc/ada/a-strsea.ads
+++ b/gcc/ada/a-strsea.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-strsup.adb b/gcc/ada/a-strsup.adb
index 28654129357..1b1c9090c92 100644
--- a/gcc/ada/a-strsup.adb
+++ b/gcc/ada/a-strsup.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-strsup.ads b/gcc/ada/a-strsup.ads
index cf27f4a7495..e00b09011c6 100644
--- a/gcc/ada/a-strsup.ads
+++ b/gcc/ada/a-strsup.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-strunb.adb b/gcc/ada/a-strunb.adb
index cf5cde63cc6..34720704a36 100644
--- a/gcc/ada/a-strunb.adb
+++ b/gcc/ada/a-strunb.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-strunb.ads b/gcc/ada/a-strunb.ads
index 0869995a167..5755ed202aa 100644
--- a/gcc/ada/a-strunb.ads
+++ b/gcc/ada/a-strunb.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stunha.adb b/gcc/ada/a-stunha.adb
index 8052bdcf77f..34db5634116 100644
--- a/gcc/ada/a-stunha.adb
+++ b/gcc/ada/a-stunha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stunha.ads b/gcc/ada/a-stunha.ads
index 81716555389..acf04716762 100644
--- a/gcc/ada/a-stunha.ads
+++ b/gcc/ada/a-stunha.ads
@@ -6,8 +6,6 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
--- --
-- This specification is adapted from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
diff --git a/gcc/ada/a-stwibo.adb b/gcc/ada/a-stwibo.adb
index 136b439205d..36ec17d1baa 100644
--- a/gcc/ada/a-stwibo.adb
+++ b/gcc/ada/a-stwibo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stwibo.ads b/gcc/ada/a-stwibo.ads
index 4c056650fc9..4033543e866 100644
--- a/gcc/ada/a-stwibo.ads
+++ b/gcc/ada/a-stwibo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stwifi.adb b/gcc/ada/a-stwifi.adb
index 13fe4ffe0ff..9f721bfb0f1 100644
--- a/gcc/ada/a-stwifi.adb
+++ b/gcc/ada/a-stwifi.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,7 +31,7 @@
-- --
------------------------------------------------------------------------------
-with Ada.Strings.Wide_Maps; use Ada.Strings.Wide_Maps;
+with Ada.Strings.Wide_Maps; use Ada.Strings.Wide_Maps;
with Ada.Strings.Wide_Search;
package body Ada.Strings.Wide_Fixed is
@@ -296,7 +296,11 @@ package body Ada.Strings.Wide_Fixed is
Tlength : constant Integer := Target'Length;
function Is_Padding (Item : Wide_String) return Boolean;
- -- Determinbe if all characters in Item are pad characters
+ -- Determine if all characters in Item are pad characters
+
+ ----------------
+ -- Is_Padding --
+ ----------------
function Is_Padding (Item : Wide_String) return Boolean is
begin
diff --git a/gcc/ada/a-stwiha.adb b/gcc/ada/a-stwiha.adb
index c9068717a37..dd38568440d 100644
--- a/gcc/ada/a-stwiha.adb
+++ b/gcc/ada/a-stwiha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stwima.adb b/gcc/ada/a-stwima.adb
index 3ec637321f3..d56fb11ca8b 100644
--- a/gcc/ada/a-stwima.adb
+++ b/gcc/ada/a-stwima.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stwima.ads b/gcc/ada/a-stwima.ads
index 001f5da201e..e63ac3169df 100644
--- a/gcc/ada/a-stwima.ads
+++ b/gcc/ada/a-stwima.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stwise.adb b/gcc/ada/a-stwise.adb
index 3121a16c6c1..f2be824df0f 100644
--- a/gcc/ada/a-stwise.adb
+++ b/gcc/ada/a-stwise.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stwise.ads b/gcc/ada/a-stwise.ads
index 35241fc25e5..da4d3e1a4a7 100644
--- a/gcc/ada/a-stwise.ads
+++ b/gcc/ada/a-stwise.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stwisu.adb b/gcc/ada/a-stwisu.adb
index 10529684de2..5984e5e117f 100644
--- a/gcc/ada/a-stwisu.adb
+++ b/gcc/ada/a-stwisu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stwisu.ads b/gcc/ada/a-stwisu.ads
index 721e2a80481..f5e688332f9 100644
--- a/gcc/ada/a-stwisu.ads
+++ b/gcc/ada/a-stwisu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stwiun.adb b/gcc/ada/a-stwiun.adb
index 05b3fa734be..45ab546a3c2 100644
--- a/gcc/ada/a-stwiun.adb
+++ b/gcc/ada/a-stwiun.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stwiun.ads b/gcc/ada/a-stwiun.ads
index e2cb3644566..4ac93acc84c 100644
--- a/gcc/ada/a-stwiun.ads
+++ b/gcc/ada/a-stwiun.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stzbou.adb b/gcc/ada/a-stzbou.adb
index 53089bff5c0..fee2026a61f 100644
--- a/gcc/ada/a-stzbou.adb
+++ b/gcc/ada/a-stzbou.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stzbou.ads b/gcc/ada/a-stzbou.ads
index e4ad260871b..7650ef58aa9 100644
--- a/gcc/ada/a-stzbou.ads
+++ b/gcc/ada/a-stzbou.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stzfix.adb b/gcc/ada/a-stzfix.adb
index 5517404c42e..c01e2a7141a 100644
--- a/gcc/ada/a-stzfix.adb
+++ b/gcc/ada/a-stzfix.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stzhas.adb b/gcc/ada/a-stzhas.adb
index 7881ea6d11b..ec5e928edc1 100644
--- a/gcc/ada/a-stzhas.adb
+++ b/gcc/ada/a-stzhas.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stzmap.adb b/gcc/ada/a-stzmap.adb
index 4f5880f8525..35a03853fde 100644
--- a/gcc/ada/a-stzmap.adb
+++ b/gcc/ada/a-stzmap.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stzmap.ads b/gcc/ada/a-stzmap.ads
index f71e3dde106..b69357af4c0 100644
--- a/gcc/ada/a-stzmap.ads
+++ b/gcc/ada/a-stzmap.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-stzsea.adb b/gcc/ada/a-stzsea.adb
index 5b0b326c1ac..2e29415e0c1 100644
--- a/gcc/ada/a-stzsea.adb
+++ b/gcc/ada/a-stzsea.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stzsea.ads b/gcc/ada/a-stzsea.ads
index eef55151bfd..f598db656f7 100644
--- a/gcc/ada/a-stzsea.ads
+++ b/gcc/ada/a-stzsea.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stzsup.adb b/gcc/ada/a-stzsup.adb
index b6a96fd2ca4..9e4fbcd20f1 100644
--- a/gcc/ada/a-stzsup.adb
+++ b/gcc/ada/a-stzsup.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stzsup.ads b/gcc/ada/a-stzsup.ads
index 33b9ecb03f7..ab84ad46f8b 100644
--- a/gcc/ada/a-stzsup.ads
+++ b/gcc/ada/a-stzsup.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stzunb.adb b/gcc/ada/a-stzunb.adb
index 5f5302dc817..7f4c54a94c3 100644
--- a/gcc/ada/a-stzunb.adb
+++ b/gcc/ada/a-stzunb.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-stzunb.ads b/gcc/ada/a-stzunb.ads
index b069e934dd2..95b8eb17269 100644
--- a/gcc/ada/a-stzunb.ads
+++ b/gcc/ada/a-stzunb.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-suteio.adb b/gcc/ada/a-suteio.adb
index c5f586b2877..98034e2b110 100644
--- a/gcc/ada/a-suteio.adb
+++ b/gcc/ada/a-suteio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-suteio.ads b/gcc/ada/a-suteio.ads
index 7bcf5edac58..4369a452cf0 100644
--- a/gcc/ada/a-suteio.ads
+++ b/gcc/ada/a-suteio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-swmwco.ads b/gcc/ada/a-swmwco.ads
index 269b3f8d5b4..76b5976b620 100644
--- a/gcc/ada/a-swmwco.ads
+++ b/gcc/ada/a-swmwco.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-swuwha.ads b/gcc/ada/a-swuwha.ads
index 078094a8025..1fcb41007f8 100644
--- a/gcc/ada/a-swuwha.ads
+++ b/gcc/ada/a-swuwha.ads
@@ -6,8 +6,6 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
--- --
-- This specification is adapted from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
diff --git a/gcc/ada/a-swuwti.adb b/gcc/ada/a-swuwti.adb
index 1436aed2e7f..1e6bb2e7eab 100644
--- a/gcc/ada/a-swuwti.adb
+++ b/gcc/ada/a-swuwti.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-swuwti.ads b/gcc/ada/a-swuwti.ads
index b5a4defb009..219a360a394 100644
--- a/gcc/ada/a-swuwti.ads
+++ b/gcc/ada/a-swuwti.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-sytaco.adb b/gcc/ada/a-sytaco.adb
index 98fcfaa5f98..3d0aaaa8c3b 100644
--- a/gcc/ada/a-sytaco.adb
+++ b/gcc/ada/a-sytaco.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-sytaco.ads b/gcc/ada/a-sytaco.ads
index 5e6315cdba5..96480cf26e8 100644
--- a/gcc/ada/a-sytaco.ads
+++ b/gcc/ada/a-sytaco.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-szuzha.adb b/gcc/ada/a-szuzha.adb
index 97c97905d96..fff8114e656 100644
--- a/gcc/ada/a-szuzha.adb
+++ b/gcc/ada/a-szuzha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-szuzha.ads b/gcc/ada/a-szuzha.ads
index 2aaf66bd485..1e07fbdbd2b 100644
--- a/gcc/ada/a-szuzha.ads
+++ b/gcc/ada/a-szuzha.ads
@@ -6,8 +6,6 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
--- --
-- This specification is adapted from the Ada Reference Manual for use with --
-- GNAT. In accordance with the copyright of that document, you can freely --
-- copy and modify this specification, provided that if you redistribute a --
diff --git a/gcc/ada/a-szuzti.adb b/gcc/ada/a-szuzti.adb
index d543bc4f18f..850ae78cca2 100644
--- a/gcc/ada/a-szuzti.adb
+++ b/gcc/ada/a-szuzti.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-szuzti.ads b/gcc/ada/a-szuzti.ads
index c48d404d406..01111695e23 100644
--- a/gcc/ada/a-szuzti.ads
+++ b/gcc/ada/a-szuzti.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tags.adb b/gcc/ada/a-tags.adb
index 4a21e15c693..8c9312e205c 100644
--- a/gcc/ada/a-tags.adb
+++ b/gcc/ada/a-tags.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -39,43 +39,64 @@ pragma Elaborate_All (System.HTable);
package body Ada.Tags is
--- Structure of the GNAT Dispatch Table
+-- Structure of the GNAT Primary Dispatch Table
-- +-----------------------+
+-- | Signature |
+-- +-----------------------+
-- | Offset_To_Top |
-- +-----------------------+
--- | Typeinfo_Ptr/TSD_Ptr |----> Type Specific Data
+-- | Typeinfo_Ptr/TSD_Ptr | ---> Type Specific Data
-- Tag ---> +-----------------------+ +-------------------+
-- | table of | | inheritance depth |
-- : primitive ops : +-------------------+
--- | pointers | | expanded name |
+-- | pointers | | access level |
-- +-----------------------+ +-------------------+
--- | external tag |
--- +-------------------+
--- | Hash table link |
+-- | expanded name |
-- +-------------------+
--- | Remotely Callable |
--- +-------------------+
--- | Rec Ctrler offset |
+-- | external tag |
-- +-------------------+
--- | Num_Interfaces |
+-- | hash table link |
-- +-------------------+
--- | table of |
--- : ancestor :
--- | tags |
+-- | remotely callable |
-- +-------------------+
--- | table of |
--- : interface :
--- | tags |
+-- | rec ctrler offset |
-- +-------------------+
--- | table of |
--- : primitive op :
--- | kinds |
+-- | num prim ops |
-- +-------------------+
--- | table of |
--- : entry :
--- | indices |
+-- | num interfaces |
-- +-------------------+
+-- Select Specific Data <--- | SSD_Ptr |
+-- +-----------------------+ +-------------------+
+-- | table of primitive | | table of |
+-- : operation : : ancestor :
+-- | kinds | | tags |
+-- +-----------------------+ +-------------------+
+-- | table of | | table of |
+-- : entry : : interface :
+-- | indices | | tags |
+-- +-----------------------+ +-------------------+
+
+-- Structure of the GNAT Secondary Dispatch Table
+
+-- +-----------------------+
+-- | Signature |
+-- +-----------------------+
+-- | Offset_To_Top |
+-- +-----------------------+
+-- | OSD_Ptr |---> Object Specific Data
+-- Tag ---> +-----------------------+ +---------------+
+-- | table of | | num prim ops |
+-- : primitive op : +---------------+
+-- | thunk pointers | | table of |
+-- +-----------------------+ + primitive |
+-- | op offsets |
+-- +---------------+
+
+ Offset_To_Signature : constant SSE.Storage_Count :=
+ DT_Typeinfo_Ptr_Size
+ + DT_Offset_To_Top_Size
+ + DT_Signature_Size;
subtype Cstring is String (Positive);
type Cstring_Ptr is access all Cstring;
@@ -87,13 +108,39 @@ package body Ada.Tags is
pragma Suppress_Initialization (Tag_Table);
pragma Suppress (Index_Check, On => Tag_Table);
- type Prim_Op_Kind_Table is array (Natural range <>) of Prim_Op_Kind;
- pragma Suppress_Initialization (Prim_Op_Kind_Table);
- pragma Suppress (Index_Check, On => Prim_Op_Kind_Table);
+ -- Object specific data types
+
+ type Object_Specific_Data_Array is array (Positive range <>) of Positive;
+
+ type Object_Specific_Data (Nb_Prim : Positive) is record
+ Num_Prim_Ops : Natural;
+ -- Number of primitive operations of the dispatch table. This field is
+ -- used by the run-time check routines that are activated when the
+ -- run-time is compiled with assertions enabled.
+
+ OSD_Table : Object_Specific_Data_Array (1 .. Nb_Prim);
+ -- Table used in secondary DT to reference their counterpart in the
+ -- select specific data (in the TSD of the primary DT). This construct
+ -- is used in the handling of dispatching triggers in select statements.
+ -- Nb_Prim is the number of non-predefined primitive operations.
+ end record;
+
+ -- Select specific data types
+
+ type Select_Specific_Data_Element is record
+ Index : Positive;
+ Kind : Prim_Op_Kind;
+ end record;
+
+ type Select_Specific_Data_Array is
+ array (Positive range <>) of Select_Specific_Data_Element;
+
+ type Select_Specific_Data (Nb_Prim : Positive) is record
+ SSD_Table : Select_Specific_Data_Array (1 .. Nb_Prim);
+ -- NOTE: Nb_Prim is the number of non-predefined primitive operations
+ end record;
- type Entry_Index_Table is array (Natural range <>) of Positive;
- pragma Suppress_Initialization (Entry_Index_Table);
- pragma Suppress (Index_Check, On => Entry_Index_Table);
+ -- Type specific data types
type Type_Specific_Data is record
Idepth : Natural;
@@ -124,11 +171,22 @@ package body Ada.Tags is
-- Controller Offset: Used to give support to tagged controlled objects
-- (see Get_Deep_Controller at s-finimp)
+ Num_Prim_Ops : Natural;
+ -- Number of primitive operations of the dispatch table. This field is
+ -- used for additional run-time checks when the run-time is compiled
+ -- with assertions enabled.
+
Num_Interfaces : Natural;
-- Number of abstract interface types implemented by the tagged type.
-- The value Idepth+Num_Interfaces indicates the end of the second table
-- stored in the Tags_Table component. It is used to implement the
- -- membership test associated with interfaces (Ada 2005:AI-251)
+ -- membership test associated with interfaces (Ada 2005:AI-251).
+
+ SSD_Ptr : System.Address;
+ -- Pointer to a table of records used in dispatching selects. This
+ -- field has a meaningful value for all tagged types that implement
+ -- a limited, protected, synchronized or task interfaces and have
+ -- non-predefined primitive operations.
Tags_Table : Tag_Table (0 .. 1);
-- The size of the Tags_Table array actually depends on the tagged type
@@ -138,21 +196,9 @@ package body Ada.Tags is
-- purpose we are using the same mechanism as for the Prims_Ptr array in
-- the Dispatch_Table record. See comments below on Prims_Ptr for
-- further details.
-
- POK_Table : Prim_Op_Kind_Table (1 .. 1);
- Ent_Index_Table : Entry_Index_Table (1 .. 1);
- -- Two auxiliary tables used for dispatching in asynchronous,
- -- conditional and timed selects. Their size depends on the number
- -- of primitive operations. Indexing in these two tables is performed
- -- by subtracting the number of predefined primitive operations from
- -- the given index value. POK_Table contains the callable entity kinds
- -- of all non-predefined primitive operations. Ent_Index_Table contains
- -- the entry index of primitive entry wrappers.
end record;
type Dispatch_Table is record
- -- Offset_To_Top : Natural;
- -- Typeinfo_Ptr : System.Address;
-- According to the C++ ABI the components Offset_To_Top and
-- Typeinfo_Ptr are stored just "before" the dispatch table (that is,
@@ -164,6 +210,9 @@ package body Ada.Tags is
-- enough space for these additional components, and generates code that
-- displaces the _Tag to point after these components.
+ -- Offset_To_Top : Natural;
+ -- Typeinfo_Ptr : System.Address;
+
Prims_Ptr : Address_Array (1 .. 1);
-- The size of the Prims_Ptr array actually depends on the tagged type
-- to which it applies. For each tagged type, the expander computes the
@@ -185,6 +234,20 @@ package body Ada.Tags is
-- only to declare the corresponding access type.
end record;
+ -- Run-time check types and subprograms: These subprograms are used only
+ -- when the run-time is compiled with assertions enabled.
+
+ type Signature_Type is
+ (Must_Be_Primary_DT,
+ Must_Be_Secondary_DT,
+ Must_Be_Primary_Or_Secondary_DT,
+ Must_Be_Interface,
+ Must_Be_Primary_Or_Interface);
+ -- Type of signature accepted by primitives in this package that are called
+ -- during the elaboration of tagged types. This type is used by the routine
+ -- Check_Signature that is called only when the run-time is compiled with
+ -- assertions enabled.
+
---------------------------------------------
-- Unchecked Conversions for String Fields --
---------------------------------------------
@@ -199,6 +262,12 @@ package body Ada.Tags is
-- Unchecked Conversions for other components --
------------------------------------------------
+ type Acc_Size
+ is access function (A : System.Address) return Long_Long_Integer;
+
+ function To_Acc_Size is new Unchecked_Conversion (System.Address, Acc_Size);
+ -- The profile of the implicitly defined _size primitive
+
type Storage_Offset_Ptr is access System.Storage_Elements.Storage_Offset;
function To_Storage_Offset_Ptr is
@@ -208,6 +277,30 @@ package body Ada.Tags is
-- Local Subprograms --
-----------------------
+ function Check_Index
+ (T : Tag;
+ Index : Natural) return Boolean;
+ -- Check that Index references a valid entry of the dispatch table of T
+
+ function Check_Signature (T : Tag; Kind : Signature_Type) return Boolean;
+ -- Check that the signature of T is valid and corresponds with the subset
+ -- specified by the signature Kind.
+
+ function Check_Size
+ (Old_T : Tag;
+ New_T : Tag;
+ Entry_Count : Natural) return Boolean;
+ -- Verify that Old_T and New_T have at least Entry_Count entries
+
+ function Get_Num_Prim_Ops (T : Tag) return Natural;
+ -- Retrieve the number of primitive operations in the dispatch table of T
+
+ function Is_Primary_DT (T : Tag) return Boolean;
+ pragma Inline_Always (Is_Primary_DT);
+ -- Given a tag returns True if it has the signature of a primary dispatch
+ -- table. This is Inline_Always since it is called from other Inline_
+ -- Always subprograms where we want no out of line code to be generated.
+
function Length (Str : Cstring_Ptr) return Natural;
-- Length of string represented by the given pointer (treating the string
-- as a C-style string, which is Nul terminated).
@@ -261,9 +354,9 @@ package body Ada.Tags is
package body HTable_Subprograms is
- -----------
- -- Equal --
- -----------
+ -----------
+ -- Equal --
+ -----------
function Equal (A, B : System.Address) return Boolean is
Str1 : constant Cstring_Ptr := To_Cstring_Ptr (A);
@@ -313,6 +406,93 @@ package body Ada.Tags is
end HTable_Subprograms;
+ -----------------
+ -- Check_Index --
+ -----------------
+
+ function Check_Index
+ (T : Tag;
+ Index : Natural) return Boolean
+ is
+ Max_Entries : constant Natural := Get_Num_Prim_Ops (T);
+
+ begin
+ return Index /= 0 and then Index <= Max_Entries;
+ end Check_Index;
+
+ ---------------------
+ -- Check_Signature --
+ ---------------------
+
+ function Check_Signature (T : Tag; Kind : Signature_Type) return Boolean is
+ Offset_To_Top_Ptr : constant Storage_Offset_Ptr :=
+ To_Storage_Offset_Ptr (To_Address (T)
+ - Offset_To_Signature);
+
+ Signature : constant Signature_Values :=
+ To_Signature_Values (Offset_To_Top_Ptr.all);
+
+ Signature_Id : Signature_Kind;
+
+ begin
+ if Signature (1) /= Valid_Signature then
+ Signature_Id := Unknown;
+
+ elsif Signature (2) in Primary_DT .. Abstract_Interface then
+ Signature_Id := Signature (2);
+
+ else
+ Signature_Id := Unknown;
+ end if;
+
+ case Signature_Id is
+ when Primary_DT =>
+ if Kind = Must_Be_Secondary_DT
+ or else Kind = Must_Be_Interface
+ then
+ return False;
+ end if;
+
+ when Secondary_DT =>
+ if Kind = Must_Be_Primary_DT
+ or else Kind = Must_Be_Interface
+ then
+ return False;
+ end if;
+
+ when Abstract_Interface =>
+ if Kind = Must_Be_Primary_DT
+ or else Kind = Must_Be_Secondary_DT
+ or else Kind = Must_Be_Primary_Or_Secondary_DT
+ then
+ return False;
+ end if;
+
+ when others =>
+ return False;
+
+ end case;
+
+ return True;
+ end Check_Signature;
+
+ ----------------
+ -- Check_Size --
+ ----------------
+
+ function Check_Size
+ (Old_T : Tag;
+ New_T : Tag;
+ Entry_Count : Natural) return Boolean
+ is
+ Max_Entries_Old : constant Natural := Get_Num_Prim_Ops (Old_T);
+ Max_Entries_New : constant Natural := Get_Num_Prim_Ops (New_T);
+
+ begin
+ return Entry_Count <= Max_Entries_Old
+ and then Entry_Count <= Max_Entries_New;
+ end Check_Size;
+
-------------------
-- CW_Membership --
-------------------
@@ -334,8 +514,11 @@ package body Ada.Tags is
-- = Typ'tag
function CW_Membership (Obj_Tag : Tag; Typ_Tag : Tag) return Boolean is
- Pos : constant Integer := TSD (Obj_Tag).Idepth - TSD (Typ_Tag).Idepth;
+ Pos : Integer;
begin
+ pragma Assert (Check_Signature (Obj_Tag, Must_Be_Primary_DT));
+ pragma Assert (Check_Signature (Typ_Tag, Must_Be_Primary_DT));
+ Pos := TSD (Obj_Tag).Idepth - TSD (Typ_Tag).Idepth;
return Pos >= 0 and then TSD (Obj_Tag).Tags_Table (Pos) = Typ_Tag;
end CW_Membership;
@@ -353,23 +536,34 @@ package body Ada.Tags is
-- Obj is in Iface'Class if Iface'Tag is found in the table of interfaces
-- that are contained in the dispatch table referenced by Obj'Tag.
- function IW_Membership
- (This : System.Address;
- T : Tag) return Boolean
- is
+ function IW_Membership (This : System.Address; T : Tag) return Boolean is
Curr_DT : constant Tag := To_Tag_Ptr (This).all;
- Obj_Base : constant System.Address := This - Offset_To_Top (Curr_DT);
- Obj_DT : constant Tag := To_Tag_Ptr (Obj_Base).all;
-
- Obj_TSD : constant Type_Specific_Data_Ptr := TSD (Obj_DT);
- Last_Id : constant Natural := Obj_TSD.Idepth + Obj_TSD.Num_Interfaces;
- Id : Natural;
+ Id : Natural;
+ Last_Id : Natural;
+ Obj_Base : System.Address;
+ Obj_DT : Tag;
+ Obj_TSD : Type_Specific_Data_Ptr;
begin
+ pragma Assert
+ (Check_Signature (Curr_DT, Must_Be_Primary_Or_Secondary_DT));
+ pragma Assert
+ (Check_Signature (T, Must_Be_Primary_Or_Interface));
+
+ Obj_Base := This - Offset_To_Top (Curr_DT);
+ Obj_DT := To_Tag_Ptr (Obj_Base).all;
+
+ pragma Assert
+ (Check_Signature (Curr_DT, Must_Be_Primary_DT));
+
+ Obj_TSD := TSD (Obj_DT);
+ Last_Id := Obj_TSD.Idepth + Obj_TSD.Num_Interfaces;
+
if Obj_TSD.Num_Interfaces > 0 then
-- Traverse the ancestor tags table plus the interface tags table.
- -- The former part is required to give support to:
+ -- The former part is required for:
+
-- Iface_CW in Typ'Class
Id := 0;
@@ -391,9 +585,13 @@ package body Ada.Tags is
--------------------
function Descendant_Tag (External : String; Ancestor : Tag) return Tag is
- Int_Tag : constant Tag := Internal_Tag (External);
+ Int_Tag : Tag;
begin
+ pragma Assert (Check_Signature (Ancestor, Must_Be_Primary_DT));
+ Int_Tag := Internal_Tag (External);
+ pragma Assert (Check_Signature (Int_Tag, Must_Be_Primary_DT));
+
if not Is_Descendant_At_Same_Level (Int_Tag, Ancestor) then
raise Tag_Error;
end if;
@@ -413,6 +611,7 @@ package body Ada.Tags is
raise Tag_Error;
end if;
+ pragma Assert (Check_Signature (T, Must_Be_Primary_Or_Interface));
Result := TSD (T).Expanded_Name;
return Result (1 .. Length (Result));
end Expanded_Name;
@@ -423,11 +622,13 @@ package body Ada.Tags is
function External_Tag (T : Tag) return String is
Result : Cstring_Ptr;
+
begin
if T = No_Tag then
raise Tag_Error;
end if;
+ pragma Assert (Check_Signature (T, Must_Be_Primary_Or_Interface));
Result := TSD (T).External_Tag;
return Result (1 .. Length (Result));
@@ -439,6 +640,7 @@ package body Ada.Tags is
function Get_Access_Level (T : Tag) return Natural is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
return TSD (T).Access_Level;
end Get_Access_Level;
@@ -446,11 +648,12 @@ package body Ada.Tags is
-- Get_Entry_Index --
---------------------
- function Get_Entry_Index
- (T : Tag;
- Position : Positive) return Positive is
+ function Get_Entry_Index (T : Tag; Position : Positive) return Positive is
+ Index : constant Integer := Position - Default_Prim_Op_Count;
begin
- return TSD (T).Ent_Index_Table (Position - Default_Prim_Op_Count);
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
+ pragma Assert (Index > 0);
+ return SSD (T).SSD_Table (Index).Index;
end Get_Entry_Index;
----------------------
@@ -459,17 +662,36 @@ package body Ada.Tags is
function Get_External_Tag (T : Tag) return System.Address is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
return To_Address (TSD (T).External_Tag);
end Get_External_Tag;
+ ----------------------
+ -- Get_Num_Prim_Ops --
+ ----------------------
+
+ function Get_Num_Prim_Ops (T : Tag) return Natural is
+ begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_Or_Secondary_DT));
+
+ if Is_Primary_DT (T) then
+ return TSD (T).Num_Prim_Ops;
+ else
+ return OSD (Interface_Tag (T)).Num_Prim_Ops;
+ end if;
+ end Get_Num_Prim_Ops;
+
-------------------------
-- Get_Prim_Op_Address --
-------------------------
function Get_Prim_Op_Address
(T : Tag;
- Position : Positive) return System.Address is
+ Position : Positive) return System.Address
+ is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_Or_Secondary_DT));
+ pragma Assert (Check_Index (T, Position));
return T.Prims_Ptr (Position);
end Get_Prim_Op_Address;
@@ -479,17 +701,37 @@ package body Ada.Tags is
function Get_Prim_Op_Kind
(T : Tag;
- Position : Positive) return Prim_Op_Kind is
+ Position : Positive) return Prim_Op_Kind
+ is
+ Index : constant Integer := Position - Default_Prim_Op_Count;
begin
- return TSD (T).POK_Table (Position - Default_Prim_Op_Count);
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
+ pragma Assert (Index > 0);
+ return SSD (T).SSD_Table (Index).Kind;
end Get_Prim_Op_Kind;
+ ----------------------
+ -- Get_Offset_Index --
+ ----------------------
+
+ function Get_Offset_Index
+ (T : Interface_Tag;
+ Position : Positive) return Positive
+ is
+ Index : constant Integer := Position - Default_Prim_Op_Count;
+ begin
+ pragma Assert (Check_Signature (Tag (T), Must_Be_Secondary_DT));
+ pragma Assert (Index > 0);
+ return OSD (T).OSD_Table (Index);
+ end Get_Offset_Index;
+
-------------------
-- Get_RC_Offset --
-------------------
function Get_RC_Offset (T : Tag) return SSE.Storage_Offset is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
return TSD (T).RC_Offset;
end Get_RC_Offset;
@@ -499,6 +741,7 @@ package body Ada.Tags is
function Get_Remotely_Callable (T : Tag) return Boolean is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
return TSD (T).Remotely_Callable;
end Get_Remotely_Callable;
@@ -506,12 +749,12 @@ package body Ada.Tags is
-- Inherit_DT --
----------------
- procedure Inherit_DT
- (Old_T : Tag;
- New_T : Tag;
- Entry_Count : Natural)
- is
+ procedure Inherit_DT (Old_T : Tag; New_T : Tag; Entry_Count : Natural) is
begin
+ pragma Assert (Check_Signature (Old_T, Must_Be_Primary_Or_Secondary_DT));
+ pragma Assert (Check_Signature (New_T, Must_Be_Primary_Or_Secondary_DT));
+ pragma Assert (Check_Size (Old_T, New_T, Entry_Count));
+
if Old_T /= null then
New_T.Prims_Ptr (1 .. Entry_Count) :=
Old_T.Prims_Ptr (1 .. Entry_Count);
@@ -523,17 +766,22 @@ package body Ada.Tags is
-----------------
procedure Inherit_TSD (Old_Tag : Tag; New_Tag : Tag) is
- New_TSD_Ptr : constant Type_Specific_Data_Ptr := TSD (New_Tag);
+ New_TSD_Ptr : Type_Specific_Data_Ptr;
Old_TSD_Ptr : Type_Specific_Data_Ptr;
begin
+ pragma Assert (Check_Signature (New_Tag, Must_Be_Primary_Or_Interface));
+ New_TSD_Ptr := TSD (New_Tag);
+
if Old_Tag /= null then
+ pragma Assert
+ (Check_Signature (Old_Tag, Must_Be_Primary_Or_Interface));
Old_TSD_Ptr := TSD (Old_Tag);
New_TSD_Ptr.Idepth := Old_TSD_Ptr.Idepth + 1;
New_TSD_Ptr.Num_Interfaces := Old_TSD_Ptr.Num_Interfaces;
-- Copy the "table of ancestor tags" plus the "table of interfaces"
- -- of the parent
+ -- of the parent.
New_TSD_Ptr.Tags_Table
(1 .. New_TSD_Ptr.Idepth + New_TSD_Ptr.Num_Interfaces) :=
@@ -557,7 +805,7 @@ package body Ada.Tags is
begin
-- Make a copy of the string representing the external tag with
- -- a null at the end
+ -- a null at the end.
Ext_Copy (External'Range) := External;
Ext_Copy (Ext_Copy'Last) := ASCII.NUL;
@@ -567,6 +815,7 @@ package body Ada.Tags is
declare
Msg1 : constant String := "unknown tagged type: ";
Msg2 : String (1 .. Msg1'Length + External'Length);
+
begin
Msg2 (1 .. Msg1'Length) := Msg1;
Msg2 (Msg1'Length + 1 .. Msg1'Length + External'Length) :=
@@ -591,6 +840,20 @@ package body Ada.Tags is
and then TSD (Descendant).Access_Level = TSD (Ancestor).Access_Level;
end Is_Descendant_At_Same_Level;
+ -------------------
+ -- Is_Primary_DT --
+ -------------------
+
+ function Is_Primary_DT (T : Tag) return Boolean is
+ Offset_To_Top_Ptr : constant Storage_Offset_Ptr :=
+ To_Storage_Offset_Ptr (To_Address (T)
+ - Offset_To_Signature);
+ Signature : constant Signature_Values :=
+ To_Signature_Values (Offset_To_Top_Ptr.all);
+ begin
+ return Signature (2) = Primary_DT;
+ end Is_Primary_DT;
+
------------
-- Length --
------------
@@ -617,32 +880,45 @@ package body Ada.Tags is
To_Storage_Offset_Ptr (To_Address (T)
- DT_Typeinfo_Ptr_Size
- DT_Offset_To_Top_Size);
+
begin
return Offset_To_Top_Ptr.all;
end Offset_To_Top;
+ ---------
+ -- OSD --
+ ---------
+
+ function OSD
+ (T : Interface_Tag) return Object_Specific_Data_Ptr
+ is
+ OSD_Ptr : Addr_Ptr;
+
+ begin
+ OSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size);
+ return To_Object_Specific_Data_Ptr (OSD_Ptr.all);
+ end OSD;
+
-----------------
-- Parent_Size --
-----------------
- type Acc_Size
- is access function (A : System.Address) return Long_Long_Integer;
-
- function To_Acc_Size is new Unchecked_Conversion (System.Address, Acc_Size);
- -- The profile of the implicitly defined _size primitive
-
function Parent_Size
(Obj : System.Address;
T : Tag) return SSE.Storage_Count
is
- Parent_Tag : constant Tag := TSD (T).Tags_Table (1);
+ Parent_Tag : Tag;
-- The tag of the parent type through the dispatch table
- F : constant Acc_Size := To_Acc_Size (Parent_Tag.Prims_Ptr (1));
+ F : Acc_Size;
-- Access to the _size primitive of the parent. We assume that it is
- -- always in the first slot of the dispatch table
+ -- always in the first slot of the dispatch table.
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
+ Parent_Tag := TSD (T).Tags_Table (1);
+ F := To_Acc_Size (Parent_Tag.Prims_Ptr (1));
+
-- Here we compute the size of the _parent field of the object
return SSE.Storage_Count (F.all (Obj));
@@ -658,6 +934,8 @@ package body Ada.Tags is
raise Tag_Error;
end if;
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
+
-- The Parent_Tag of a root-level tagged type is defined to be No_Tag.
-- The first entry in the Ancestors_Tags array will be null for such
-- a type, but it's better to be explicit about returning No_Tag in
@@ -674,20 +952,24 @@ package body Ada.Tags is
-- Register_Interface_Tag --
----------------------------
- procedure Register_Interface_Tag
- (T : Tag;
- Interface_T : Tag)
- is
- New_T_TSD : constant Type_Specific_Data_Ptr := TSD (T);
+ procedure Register_Interface_Tag (T : Tag; Interface_T : Tag) is
+ New_T_TSD : Type_Specific_Data_Ptr;
Index : Natural;
+
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
+ pragma Assert (Check_Signature (Interface_T, Must_Be_Interface));
+
+ New_T_TSD := TSD (T);
+
-- Check if the interface is already registered
if New_T_TSD.Num_Interfaces > 0 then
declare
- Id : Natural := New_T_TSD.Idepth + 1;
- Last_Id : constant Natural := New_T_TSD.Idepth
+ Id : Natural := New_T_TSD.Idepth + 1;
+ Last_Id : constant Natural := New_T_TSD.Idepth
+ New_T_TSD.Num_Interfaces;
+
begin
loop
if New_T_TSD.Tags_Table (Id) = Interface_T then
@@ -720,6 +1002,7 @@ package body Ada.Tags is
procedure Set_Access_Level (T : Tag; Value : Natural) is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
TSD (T).Access_Level := Value;
end Set_Access_Level;
@@ -730,9 +1013,14 @@ package body Ada.Tags is
procedure Set_Entry_Index
(T : Tag;
Position : Positive;
- Value : Positive) is
+ Value : Positive)
+ is
+ Index : constant Integer := Position - Default_Prim_Op_Count;
+
begin
- TSD (T).Ent_Index_Table (Position - Default_Prim_Op_Count) := Value;
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
+ pragma Assert (Index > 0);
+ SSD (T).SSD_Table (Index).Index := Value;
end Set_Entry_Index;
-----------------------
@@ -741,6 +1029,8 @@ package body Ada.Tags is
procedure Set_Expanded_Name (T : Tag; Value : System.Address) is
begin
+ pragma Assert
+ (Check_Signature (T, Must_Be_Primary_Or_Interface));
TSD (T).Expanded_Name := To_Cstring_Ptr (Value);
end Set_Expanded_Name;
@@ -750,9 +1040,41 @@ package body Ada.Tags is
procedure Set_External_Tag (T : Tag; Value : System.Address) is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_Or_Interface));
TSD (T).External_Tag := To_Cstring_Ptr (Value);
end Set_External_Tag;
+ ----------------------
+ -- Set_Num_Prim_Ops --
+ ----------------------
+
+ procedure Set_Num_Prim_Ops (T : Tag; Value : Natural) is
+ begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_Or_Secondary_DT));
+
+ if Is_Primary_DT (T) then
+ TSD (T).Num_Prim_Ops := Value;
+ else
+ OSD (Interface_Tag (T)).Num_Prim_Ops := Value;
+ end if;
+ end Set_Num_Prim_Ops;
+
+ ----------------------
+ -- Set_Offset_Index --
+ ----------------------
+
+ procedure Set_Offset_Index
+ (T : Interface_Tag;
+ Position : Positive;
+ Value : Positive)
+ is
+ Index : constant Integer := Position - Default_Prim_Op_Count;
+ begin
+ pragma Assert (Check_Signature (Tag (T), Must_Be_Secondary_DT));
+ pragma Assert (Index > 0);
+ OSD (T).OSD_Table (Index) := Value;
+ end Set_Offset_Index;
+
-----------------------
-- Set_Offset_To_Top --
-----------------------
@@ -766,9 +1088,22 @@ package body Ada.Tags is
- DT_Typeinfo_Ptr_Size
- DT_Offset_To_Top_Size);
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_Or_Secondary_DT));
Offset_To_Top_Ptr.all := Value;
end Set_Offset_To_Top;
+ -------------
+ -- Set_OSD --
+ -------------
+
+ procedure Set_OSD (T : Interface_Tag; Value : System.Address) is
+ OSD_Ptr : Addr_Ptr;
+ begin
+ pragma Assert (Check_Signature (Tag (T), Must_Be_Secondary_DT));
+ OSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size);
+ OSD_Ptr.all := Value;
+ end Set_OSD;
+
-------------------------
-- Set_Prim_Op_Address --
-------------------------
@@ -776,8 +1111,11 @@ package body Ada.Tags is
procedure Set_Prim_Op_Address
(T : Tag;
Position : Positive;
- Value : System.Address) is
+ Value : System.Address)
+ is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_Or_Secondary_DT));
+ pragma Assert (Check_Index (T, Position));
T.Prims_Ptr (Position) := Value;
end Set_Prim_Op_Address;
@@ -788,9 +1126,13 @@ package body Ada.Tags is
procedure Set_Prim_Op_Kind
(T : Tag;
Position : Positive;
- Value : Prim_Op_Kind) is
+ Value : Prim_Op_Kind)
+ is
+ Index : constant Integer := Position - Default_Prim_Op_Count;
begin
- TSD (T).POK_Table (Position - Default_Prim_Op_Count) := Value;
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
+ pragma Assert (Index > 0);
+ SSD (T).SSD_Table (Index).Kind := Value;
end Set_Prim_Op_Kind;
-------------------
@@ -799,6 +1141,7 @@ package body Ada.Tags is
procedure Set_RC_Offset (T : Tag; Value : SSE.Storage_Offset) is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
TSD (T).RC_Offset := Value;
end Set_RC_Offset;
@@ -808,20 +1151,41 @@ package body Ada.Tags is
procedure Set_Remotely_Callable (T : Tag; Value : Boolean) is
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
TSD (T).Remotely_Callable := Value;
end Set_Remotely_Callable;
-------------
+ -- Set_SSD --
+ -------------
+
+ procedure Set_SSD (T : Tag; Value : System.Address) is
+ begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_DT));
+ TSD (T).SSD_Ptr := Value;
+ end Set_SSD;
+
+ -------------
-- Set_TSD --
-------------
procedure Set_TSD (T : Tag; Value : System.Address) is
- TSD_Ptr : constant Addr_Ptr :=
- To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size);
+ TSD_Ptr : Addr_Ptr;
begin
+ pragma Assert (Check_Signature (T, Must_Be_Primary_Or_Interface));
+ TSD_Ptr := To_Addr_Ptr (To_Address (T) - DT_Typeinfo_Ptr_Size);
TSD_Ptr.all := Value;
end Set_TSD;
+ ---------
+ -- SSD --
+ ---------
+
+ function SSD (T : Tag) return Select_Specific_Data_Ptr is
+ begin
+ return To_Select_Specific_Data_Ptr (TSD (T).SSD_Ptr);
+ end SSD;
+
------------------
-- Typeinfo_Ptr --
------------------
diff --git a/gcc/ada/a-tags.ads b/gcc/ada/a-tags.ads
index 34d7d63b097..46e6c204167 100644
--- a/gcc/ada/a-tags.ads
+++ b/gcc/ada/a-tags.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -53,31 +53,38 @@ package Ada.Tags is
function Internal_Tag (External : String) return Tag;
- function Descendant_Tag (External : String; Ancestor : Tag) return Tag;
+ function Descendant_Tag
+ (External : String;
+ Ancestor : Tag) return Tag;
+ pragma Ada_05 (Descendant_Tag);
function Is_Descendant_At_Same_Level
(Descendant : Tag;
Ancestor : Tag) return Boolean;
+ pragma Ada_05 (Is_Descendant_At_Same_Level);
function Parent_Tag (T : Tag) return Tag;
+ pragma Ada_05 (Parent_Tag);
Tag_Error : exception;
private
+ -- The following subprogram specifications are placed here instead of
+ -- the package body to see them from the frontend through rtsfind.
---------------------------------------------------------------
-- Abstract Procedural Interface For The GNAT Dispatch Table --
---------------------------------------------------------------
-- GNAT's Dispatch Table format is customizable in order to match the
- -- format used in another language. GNAT supports programs that use
- -- two different dispatch table formats at the same time: the native
- -- format that supports Ada 95 tagged types and which is described in
- -- Ada.Tags, and a foreign format for types that are imported from some
- -- other language (typically C++) which is described in Interfaces.CPP.
- -- The runtime information kept for each tagged type is separated into
- -- two objects: the Dispatch Table and the Type Specific Data record.
- -- These two objects are allocated statically using the constants:
+ -- format used in another language. GNAT supports programs that use two
+ -- different dispatch table formats at the same time: the native format
+ -- that supports Ada 95 tagged types and which is described in Ada.Tags,
+ -- and a foreign format for types that are imported from some other
+ -- language (typically C++) which is described in Interfaces.CPP. The
+ -- runtime information kept for each tagged type is separated into two
+ -- objects: the Dispatch Table and the Type Specific Data record. These
+ -- two objects are allocated statically using the constants:
-- DT Size = DT_Prologue_Size + Nb_Prim * DT_Entry_Size
-- TSD Size = TSD_Prologue_Size + (1 + Idepth) * TSD_Entry_Size
@@ -85,9 +92,9 @@ private
-- where Nb_prim is the number of primitive operations of the given
-- type and Idepth its inheritance depth.
- -- The compiler generates calls to the following SET routines to
- -- initialize those structures and uses the GET functions to
- -- retreive the information when needed
+ -- In order to set or retrieve information from the Dispatch Table or
+ -- the Type Specific Data record, GNAT generates calls to Set_XXX or
+ -- Get_XXX routines, where XXX is the name of the field of interest.
type Dispatch_Table;
type Tag is access all Dispatch_Table;
@@ -95,6 +102,19 @@ private
No_Tag : constant Tag := null;
+ type Object_Specific_Data (Nb_Prim : Positive);
+ type Object_Specific_Data_Ptr is access all Object_Specific_Data;
+ -- Information associated with the secondary dispatch table of tagged-type
+ -- objects implementing abstract interfaces.
+
+ type Select_Specific_Data (Nb_Prim : Positive);
+ type Select_Specific_Data_Ptr is access all Select_Specific_Data;
+ -- A table used to store the primitive operation kind and entry index of
+ -- primitive subprograms of a type that implements a limited interface.
+ -- The Select Specific Data table resides in the Type Specific Data of a
+ -- type. This construct is used in the handling of dispatching triggers
+ -- in select statements.
+
type Type_Specific_Data;
type Type_Specific_Data_Ptr is access all Type_Specific_Data;
@@ -109,17 +129,16 @@ private
POK_Protected_Function,
POK_Protected_Procedure,
POK_Task_Entry,
+ POK_Task_Function,
POK_Task_Procedure);
- -- Number of predefined primitive operations added by the Expander
- -- for a tagged type. It is utilized for indexing in the two auxiliary
- -- tables used for dispatching asynchronous, conditional and timed
- -- selects. In order to be space efficien, indexing is performed by
- -- subtracting this constant value from the provided position in the
- -- auxiliary tables.
- -- This value is mirrored from Exp_Disp.ads.
-
- Default_Prim_Op_Count : constant Positive := 14;
+ Default_Prim_Op_Count : constant Positive := 15;
+ -- Number of predefined primitive operations added by the Expander for a
+ -- tagged type. It is utilized for indexing in the two auxiliary tables
+ -- used for dispatching asynchronous, conditional and timed selects. In
+ -- order to be space efficient, indexing is performed by subtracting this
+ -- constant value from the provided position in the auxiliary tables (must
+ -- match Exp_Disp.Default_Prim_Op_Count).
package SSE renames System.Storage_Elements;
@@ -127,9 +146,7 @@ private
-- Given the tag of an object and the tag associated to a type, return
-- true if Obj is in Typ'Class.
- function IW_Membership
- (This : System.Address;
- T : Tag) return Boolean;
+ function IW_Membership (This : System.Address; T : Tag) return Boolean;
-- Ada 2005 (AI-251): General routine that checks if a given object
-- implements a tagged type. Its common usage is to check if Obj is in
-- Iface'Class, but it is also used to check if a class-wide interface
@@ -147,22 +164,27 @@ private
-- Given the tag associated with a type, returns the accessibility level
-- of the type.
- function Get_Entry_Index
- (T : Tag;
- Position : Positive) return Positive;
+ function Get_Entry_Index (T : Tag; Position : Positive) return Positive;
-- Return a primitive operation's entry index (if entry) given a dispatch
-- table T and a position of a primitive operation in T.
function Get_External_Tag (T : Tag) return System.Address;
-- Retrieve the address of a null terminated string containing
- -- the external name
+ -- the external name.
+
+ function Get_Offset_Index
+ (T : Interface_Tag;
+ Position : Positive) return Positive;
+ -- Given a pointer to a secondary dispatch table (T) and a position of an
+ -- operation in the DT, retrieve the corresponding operation's position in
+ -- the primary dispatch table from the Offset Specific Data table of T.
function Get_Prim_Op_Address
(T : Tag;
Position : Positive) return System.Address;
-- Given a pointer to a dispatch table (T) and a position in the DT
-- this function returns the address of the virtual function stored
- -- in it (used for dispatching calls)
+ -- in it (used for dispatching calls).
function Get_Prim_Op_Kind
(T : Tag;
@@ -182,10 +204,7 @@ private
function Get_Remotely_Callable (T : Tag) return Boolean;
-- Return the value previously set by Set_Remotely_Callable
- procedure Inherit_DT
- (Old_T : Tag;
- New_T : Tag;
- Entry_Count : Natural);
+ procedure Inherit_DT (Old_T : Tag; New_T : Tag; Entry_Count : Natural);
-- Entry point used to initialize the DT of a type knowing the tag
-- of the direct ancestor and the number of primitive ops that are
-- inherited (Entry_Count).
@@ -193,21 +212,23 @@ private
procedure Inherit_TSD (Old_Tag : Tag; New_Tag : Tag);
-- Initialize the TSD of a type knowing the tag of the direct ancestor
+ function OSD (T : Interface_Tag) return Object_Specific_Data_Ptr;
+ -- Ada 2005 (AI-251): Given a pointer T to a secondary dispatch table,
+ -- retrieve the address of the record containing the Objet Specific
+ -- Data table.
+
function Parent_Size
(Obj : System.Address;
T : Tag) return SSE.Storage_Count;
- -- Computes the size the ancestor part of a tagged extension object
- -- whose address is 'obj' by calling the indirectly _size function of
- -- the ancestor. The ancestor is the parent of the type represented by
- -- tag T. This function assumes that _size is always in slot 1 of
- -- the dispatch table.
+ -- Computes the size the ancestor part of a tagged extension object whose
+ -- address is 'obj' by calling indirectly the ancestor _size function. The
+ -- ancestor is the parent of the type represented by tag T. This function
+ -- assumes that _size is always in slot one of the dispatch table.
pragma Export (Ada, Parent_Size, "ada__tags__parent_size");
-- This procedure is used in s-finimp and is thus exported manually
- procedure Register_Interface_Tag
- (T : Tag;
- Interface_T : Tag);
+ procedure Register_Interface_Tag (T : Tag; Interface_T : Tag);
-- Ada 2005 (AI-251): Used to initialize the table of interfaces
-- implemented by a type. Required to give support to IW_Membership.
@@ -215,13 +236,21 @@ private
-- Insert the Tag and its associated external_tag in a table for the
-- sake of Internal_Tag
- procedure Set_Entry_Index
- (T : Tag;
- Position : Positive;
- Value : Positive);
+ procedure Set_Entry_Index (T : Tag; Position : Positive; Value : Positive);
-- Set the entry index of a primitive operation in T's TSD table indexed
-- by Position.
+ procedure Set_Num_Prim_Ops (T : Tag; Value : Natural);
+ -- Set the number of primitive operations in the dispatch table of T. This
+ -- is used for debugging purposes.
+
+ procedure Set_Offset_Index
+ (T : Interface_Tag;
+ Position : Positive;
+ Value : Positive);
+ -- Set the offset value of a primitive operation in a secondary dispatch
+ -- table denoted by T, indexed by Position.
+
procedure Set_Offset_To_Top
(T : Tag;
Value : System.Storage_Elements.Storage_Offset);
@@ -230,6 +259,10 @@ private
-- is always 0; in secondary dispatch tables this is the offset to the base
-- of the enclosing type.
+ procedure Set_OSD (T : Interface_Tag; Value : System.Address);
+ -- Given a pointer T to a secondary dispatch table, store the pointer to
+ -- the record containing the Object Specific Data generated by GNAT.
+
procedure Set_Prim_Op_Address
(T : Tag;
Position : Positive;
@@ -245,6 +278,10 @@ private
-- Set the kind of a primitive operation in T's TSD table indexed by
-- Position.
+ procedure Set_SSD (T : Tag; Value : System.Address);
+ -- Given a pointer T to a dispatch Table, stores the pointer to the record
+ -- containing the Select Specific Data generated by GNAT.
+
procedure Set_TSD (T : Tag; Value : System.Address);
-- Given a pointer T to a dispatch Table, stores the address of the record
-- containing the Type Specific Data generated by GNAT.
@@ -269,15 +306,24 @@ private
-- Set to true if the type has been declared in a context described
-- in E.4 (18).
+ function SSD (T : Tag) return Select_Specific_Data_Ptr;
+ -- Given a pointer T to a dispatch Table, retrieves the address of the
+ -- record containing the Select Specific Data in T's TSD.
+
function TSD (T : Tag) return Type_Specific_Data_Ptr;
- -- Given a pointer T to a dispatch Table, retreives the address of the
- -- record containing the Type Specific Data generated by GNAT
+ -- Given a pointer T to a dispatch Table, retrieves the address of the
+ -- record containing the Type Specific Data generated by GNAT.
DT_Prologue_Size : constant SSE.Storage_Count :=
SSE.Storage_Count
- (2 * (Standard'Address_Size / System.Storage_Unit));
+ (3 * (Standard'Address_Size / System.Storage_Unit));
-- Size of the first part of the dispatch table
+ DT_Signature_Size : constant SSE.Storage_Count :=
+ SSE.Storage_Count
+ (Standard'Address_Size / System.Storage_Unit);
+ -- Size of the Signature field of the dispatch table
+
DT_Offset_To_Top_Size : constant SSE.Storage_Count :=
SSE.Storage_Count
(Standard'Address_Size / System.Storage_Unit);
@@ -295,7 +341,7 @@ private
TSD_Prologue_Size : constant SSE.Storage_Count :=
SSE.Storage_Count
- (8 * (Standard'Address_Size / System.Storage_Unit));
+ (10 * (Standard'Address_Size / System.Storage_Unit));
-- Size of the first part of the type specific data
TSD_Entry_Size : constant SSE.Storage_Count :=
@@ -308,22 +354,57 @@ private
-- of this type are declared with a dummy size of 1, the actual size
-- depending on the number of primitive operations.
- -- Unchecked Conversions for Tag and TSD
+ type Signature_Kind is
+ (Unknown,
+ Valid_Signature,
+ Primary_DT,
+ Secondary_DT,
+ Abstract_Interface);
+ for Signature_Kind'Size use 8;
+ -- Kind of signature found in the header of the dispatch table. These
+ -- signatures are generated by the frontend and are used by the Check_XXX
+ -- routines to ensure that the kind of dispatch table managed by each of
+ -- the routines in this package is correct. This additional check is only
+ -- performed with this run-time package is compiled with assertions enabled
+
+ -- The signature is a sequence of two bytes. The first byte must have the
+ -- value Valid_Signature, and the second byte must have a value in the
+ -- range Primary_DT .. Abstract_Interface. The Unknown value is used by
+ -- the Check_XXX routines to indicate that the signature is wrong.
+
+ -- Unchecked Conversions
+
+ type Addr_Ptr is access System.Address;
+ type Tag_Ptr is access Tag;
+
+ type Signature_Values is
+ array (1 .. DT_Signature_Size) of Signature_Kind;
+ -- Type used to see the signature as a sequence of Signature_Kind values
+
+ function To_Addr_Ptr is
+ new Unchecked_Conversion (System.Address, Addr_Ptr);
function To_Type_Specific_Data_Ptr is
new Unchecked_Conversion (System.Address, Type_Specific_Data_Ptr);
function To_Address is
- new Unchecked_Conversion (Type_Specific_Data_Ptr, System.Address);
+ new Unchecked_Conversion (Interface_Tag, System.Address);
function To_Address is
new Unchecked_Conversion (Tag, System.Address);
- type Addr_Ptr is access System.Address;
- type Tag_Ptr is access Tag;
+ function To_Address is
+ new Unchecked_Conversion (Type_Specific_Data_Ptr, System.Address);
- function To_Addr_Ptr is
- new Unchecked_Conversion (System.Address, Addr_Ptr);
+ function To_Object_Specific_Data_Ptr is
+ new Unchecked_Conversion (System.Address, Object_Specific_Data_Ptr);
+
+ function To_Select_Specific_Data_Ptr is
+ new Unchecked_Conversion (System.Address, Select_Specific_Data_Ptr);
+
+ function To_Signature_Values is
+ new Unchecked_Conversion (System.Storage_Elements.Storage_Offset,
+ Signature_Values);
function To_Tag_Ptr is
new Unchecked_Conversion (System.Address, Tag_Ptr);
@@ -334,21 +415,32 @@ private
pragma Inline_Always (CW_Membership);
pragma Inline_Always (IW_Membership);
pragma Inline_Always (Get_Access_Level);
+ pragma Inline_Always (Get_Entry_Index);
+ pragma Inline_Always (Get_Offset_Index);
pragma Inline_Always (Get_Prim_Op_Address);
+ pragma Inline_Always (Get_Prim_Op_Kind);
pragma Inline_Always (Get_RC_Offset);
pragma Inline_Always (Get_Remotely_Callable);
pragma Inline_Always (Inherit_DT);
pragma Inline_Always (Inherit_TSD);
+ pragma Inline_Always (OSD);
pragma Inline_Always (Register_Interface_Tag);
pragma Inline_Always (Register_Tag);
pragma Inline_Always (Set_Access_Level);
+ pragma Inline_Always (Set_Entry_Index);
pragma Inline_Always (Set_Expanded_Name);
pragma Inline_Always (Set_External_Tag);
+ pragma Inline_Always (Set_Num_Prim_Ops);
+ pragma Inline_Always (Set_Offset_Index);
pragma Inline_Always (Set_Offset_To_Top);
pragma Inline_Always (Set_Prim_Op_Address);
+ pragma Inline_Always (Set_Prim_Op_Kind);
pragma Inline_Always (Set_RC_Offset);
pragma Inline_Always (Set_Remotely_Callable);
+ pragma Inline_Always (Set_OSD);
+ pragma Inline_Always (Set_SSD);
pragma Inline_Always (Set_TSD);
+ pragma Inline_Always (SSD);
pragma Inline_Always (TSD);
end Ada.Tags;
diff --git a/gcc/ada/a-tasatt.adb b/gcc/ada/a-tasatt.adb
index 5afab9eca4c..21c1e471367 100644
--- a/gcc/ada/a-tasatt.adb
+++ b/gcc/ada/a-tasatt.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- --
-- Copyright (C) 1991-1994, Florida State University --
--- Copyright (C) 1995-2005, Ada Core Technologies --
+-- Copyright (C) 1995-2005, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -56,10 +56,9 @@
-- attribute is a potential source of dangling references.
-- When a task goes away, we want to be able to recover all the storage
--- associated with its attributes. The Ada mechanism for this is
--- finalization, via controlled attribute types. For this reason, the ARM
--- requires finalization of attribute values when the associated task
--- terminates.
+-- associated with its attributes. The Ada mechanism for this is finalization,
+-- via controlled attribute types. For this reason, the ARM requires
+-- finalization of attribute values when the associated task terminates.
-- This finalization must be triggered by the tasking runtime system, during
-- termination of the task. Given the active set of instantiations of
@@ -376,7 +375,6 @@ package body Ada.Task_Attributes is
procedure Deallocate (P : in out Access_Node) is
T : Access_Wrapper := To_Access_Wrapper (P.Wrapper);
-
begin
Free (T);
end Deallocate;
diff --git a/gcc/ada/a-taside.adb b/gcc/ada/a-taside.adb
index a63719d5cbe..88722ac9603 100644
--- a/gcc/ada/a-taside.adb
+++ b/gcc/ada/a-taside.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-taside.ads b/gcc/ada/a-taside.ads
index fcceff5de57..acef0f1375d 100644
--- a/gcc/ada/a-taside.ads
+++ b/gcc/ada/a-taside.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-teioed.adb b/gcc/ada/a-teioed.adb
index 86a3b7c12cd..b4280c370ad 100644
--- a/gcc/ada/a-teioed.adb
+++ b/gcc/ada/a-teioed.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-textio.adb b/gcc/ada/a-textio.adb
index dfd65574159..145eaf5563e 100644
--- a/gcc/ada/a-textio.adb
+++ b/gcc/ada/a-textio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-textio.ads b/gcc/ada/a-textio.ads
index dbb9a1ad519..50ba549285a 100644
--- a/gcc/ada/a-textio.ads
+++ b/gcc/ada/a-textio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-ticoau.adb b/gcc/ada/a-ticoau.adb
index 4f6b1fbfdc3..9d543202377 100644
--- a/gcc/ada/a-ticoau.adb
+++ b/gcc/ada/a-ticoau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ticoau.ads b/gcc/ada/a-ticoau.ads
index 89dab7a40b7..c91804a0644 100644
--- a/gcc/ada/a-ticoau.ads
+++ b/gcc/ada/a-ticoau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ticoio.adb b/gcc/ada/a-ticoio.adb
index 858e6f2ae2c..f620945775a 100644
--- a/gcc/ada/a-ticoio.adb
+++ b/gcc/ada/a-ticoio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tideau.adb b/gcc/ada/a-tideau.adb
index 4bdb53c4157..82ed8492763 100644
--- a/gcc/ada/a-tideau.adb
+++ b/gcc/ada/a-tideau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tideio.adb b/gcc/ada/a-tideio.adb
index 8c5a1ceef6e..3f945025042 100644
--- a/gcc/ada/a-tideio.adb
+++ b/gcc/ada/a-tideio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tienau.adb b/gcc/ada/a-tienau.adb
index d7fdc3025ae..3e6506cfac7 100644
--- a/gcc/ada/a-tienau.adb
+++ b/gcc/ada/a-tienau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tienio.adb b/gcc/ada/a-tienio.adb
index 769dda424c3..4d1bdedd44c 100644
--- a/gcc/ada/a-tienio.adb
+++ b/gcc/ada/a-tienio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tifiio.adb b/gcc/ada/a-tifiio.adb
index 6a06f8be7dc..6b612a42f90 100644
--- a/gcc/ada/a-tifiio.adb
+++ b/gcc/ada/a-tifiio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tiflio.adb b/gcc/ada/a-tiflio.adb
index 29f8a9182d4..3961a65f1c8 100644
--- a/gcc/ada/a-tiflio.adb
+++ b/gcc/ada/a-tiflio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tigeau.adb b/gcc/ada/a-tigeau.adb
index d9474b40e0a..425011c764c 100644
--- a/gcc/ada/a-tigeau.adb
+++ b/gcc/ada/a-tigeau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tigeau.ads b/gcc/ada/a-tigeau.ads
index 7e0b35cc806..3803e9a2385 100644
--- a/gcc/ada/a-tigeau.ads
+++ b/gcc/ada/a-tigeau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tiinau.adb b/gcc/ada/a-tiinau.adb
index 75c006ab1fd..e5f24e32d12 100644
--- a/gcc/ada/a-tiinau.adb
+++ b/gcc/ada/a-tiinau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-tiinio.adb b/gcc/ada/a-tiinio.adb
index c172cbbad27..ea8b397b47f 100644
--- a/gcc/ada/a-tiinio.adb
+++ b/gcc/ada/a-tiinio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-timoau.adb b/gcc/ada/a-timoau.adb
index a0fad033887..e23ea309601 100644
--- a/gcc/ada/a-timoau.adb
+++ b/gcc/ada/a-timoau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-timoio.adb b/gcc/ada/a-timoio.adb
index e4ca508ed47..afb9b5db85d 100644
--- a/gcc/ada/a-timoio.adb
+++ b/gcc/ada/a-timoio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-timoio.ads b/gcc/ada/a-timoio.ads
index c553c88a026..bdfa77d393a 100644
--- a/gcc/ada/a-timoio.ads
+++ b/gcc/ada/a-timoio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1993-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1993-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-tiocst.ads b/gcc/ada/a-tiocst.ads
index 670670baed8..8c5bafddb99 100644
--- a/gcc/ada/a-tiocst.ads
+++ b/gcc/ada/a-tiocst.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-titest.adb b/gcc/ada/a-titest.adb
index aec11a1c6a4..98f9c0b00df 100644
--- a/gcc/ada/a-titest.adb
+++ b/gcc/ada/a-titest.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wichun.adb b/gcc/ada/a-wichun.adb
index 0c3cf519dd4..f0ca9e093fe 100755
--- a/gcc/ada/a-wichun.adb
+++ b/gcc/ada/a-wichun.adb
@@ -4,9 +4,9 @@
-- --
-- A D A . W I D E _ C H A R A C T E R T S . U N I C O D E --
-- --
--- B o d y --
+-- B o d y --
-- --
--- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wichun.ads b/gcc/ada/a-wichun.ads
index 26da25e8f7e..b112a61b3ba 100755
--- a/gcc/ada/a-wichun.ads
+++ b/gcc/ada/a-wichun.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-witeio.adb b/gcc/ada/a-witeio.adb
index 073319239cf..7071df138c2 100644
--- a/gcc/ada/a-witeio.adb
+++ b/gcc/ada/a-witeio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-witeio.ads b/gcc/ada/a-witeio.ads
index bb024f46945..9430187ca98 100644
--- a/gcc/ada/a-witeio.ads
+++ b/gcc/ada/a-witeio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-wtcoau.adb b/gcc/ada/a-wtcoau.adb
index 655948ec58d..c567b04c880 100644
--- a/gcc/ada/a-wtcoau.adb
+++ b/gcc/ada/a-wtcoau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtcoau.ads b/gcc/ada/a-wtcoau.ads
index f169a4514c3..de9bb7f6281 100644
--- a/gcc/ada/a-wtcoau.ads
+++ b/gcc/ada/a-wtcoau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtcoio.adb b/gcc/ada/a-wtcoio.adb
index 510b09d3a3d..eedbfc0ee25 100644
--- a/gcc/ada/a-wtcoio.adb
+++ b/gcc/ada/a-wtcoio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtcstr.ads b/gcc/ada/a-wtcstr.ads
index 7f89f53b525..f2b80a41d9d 100644
--- a/gcc/ada/a-wtcstr.ads
+++ b/gcc/ada/a-wtcstr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtdeau.adb b/gcc/ada/a-wtdeau.adb
index 9dfca970ce2..bffe3c53f32 100644
--- a/gcc/ada/a-wtdeau.adb
+++ b/gcc/ada/a-wtdeau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtdeio.adb b/gcc/ada/a-wtdeio.adb
index 3d611ee479b..376e7f72440 100644
--- a/gcc/ada/a-wtdeio.adb
+++ b/gcc/ada/a-wtdeio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtedit.adb b/gcc/ada/a-wtedit.adb
index 7f10a6e1f3b..b4736232310 100644
--- a/gcc/ada/a-wtedit.adb
+++ b/gcc/ada/a-wtedit.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtedit.ads b/gcc/ada/a-wtedit.ads
index eff8fbd942c..f275f8052de 100644
--- a/gcc/ada/a-wtedit.ads
+++ b/gcc/ada/a-wtedit.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-wtenau.adb b/gcc/ada/a-wtenau.adb
index 9f60e29ac15..4a231e52595 100644
--- a/gcc/ada/a-wtenau.adb
+++ b/gcc/ada/a-wtenau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtenio.adb b/gcc/ada/a-wtenio.adb
index d44f394c371..fd40df538e6 100644
--- a/gcc/ada/a-wtenio.adb
+++ b/gcc/ada/a-wtenio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtfiio.adb b/gcc/ada/a-wtfiio.adb
index 00130d92bff..405f17d15ad 100644
--- a/gcc/ada/a-wtfiio.adb
+++ b/gcc/ada/a-wtfiio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtflio.adb b/gcc/ada/a-wtflio.adb
index 71108d256ef..1d331d41f37 100644
--- a/gcc/ada/a-wtflio.adb
+++ b/gcc/ada/a-wtflio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtgeau.adb b/gcc/ada/a-wtgeau.adb
index 03dc7b0df56..c020589ee8c 100644
--- a/gcc/ada/a-wtgeau.adb
+++ b/gcc/ada/a-wtgeau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtinau.adb b/gcc/ada/a-wtinau.adb
index 7ffe9ea1cae..1d51e0f0e88 100644
--- a/gcc/ada/a-wtinau.adb
+++ b/gcc/ada/a-wtinau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtinio.adb b/gcc/ada/a-wtinio.adb
index e187bb4e3d8..deb3a519040 100644
--- a/gcc/ada/a-wtinio.adb
+++ b/gcc/ada/a-wtinio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtmoau.adb b/gcc/ada/a-wtmoau.adb
index 1ae6a5ec06f..0a9dca44c7a 100644
--- a/gcc/ada/a-wtmoau.adb
+++ b/gcc/ada/a-wtmoau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wtmoio.adb b/gcc/ada/a-wtmoio.adb
index 10225152104..e9bf8775367 100644
--- a/gcc/ada/a-wtmoio.adb
+++ b/gcc/ada/a-wtmoio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-wttest.adb b/gcc/ada/a-wttest.adb
index 5c3d1c8f3dc..536395d18d9 100644
--- a/gcc/ada/a-wttest.adb
+++ b/gcc/ada/a-wttest.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-zchuni.adb b/gcc/ada/a-zchuni.adb
index c3c05288c83..bfeeedfd8e4 100755
--- a/gcc/ada/a-zchuni.adb
+++ b/gcc/ada/a-zchuni.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-zchuni.ads b/gcc/ada/a-zchuni.ads
index c93ec754ac1..ddd3a390a91 100755
--- a/gcc/ada/a-zchuni.ads
+++ b/gcc/ada/a-zchuni.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztcoau.adb b/gcc/ada/a-ztcoau.adb
index e899a821593..8d7b1310f33 100644
--- a/gcc/ada/a-ztcoau.adb
+++ b/gcc/ada/a-ztcoau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztcoau.ads b/gcc/ada/a-ztcoau.ads
index 7e175dfe9cc..d7ee61281a9 100644
--- a/gcc/ada/a-ztcoau.ads
+++ b/gcc/ada/a-ztcoau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztcoio.adb b/gcc/ada/a-ztcoio.adb
index 8661f35eed4..97e58a18a92 100644
--- a/gcc/ada/a-ztcoio.adb
+++ b/gcc/ada/a-ztcoio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztcstr.adb b/gcc/ada/a-ztcstr.adb
index 9f0f0a5d967..f6b23d7b8a2 100644
--- a/gcc/ada/a-ztcstr.adb
+++ b/gcc/ada/a-ztcstr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztcstr.ads b/gcc/ada/a-ztcstr.ads
index 92be2015eb8..6d6ed73f2fd 100644
--- a/gcc/ada/a-ztcstr.ads
+++ b/gcc/ada/a-ztcstr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztdeau.adb b/gcc/ada/a-ztdeau.adb
index a5be8471d6d..b6b9b94c440 100644
--- a/gcc/ada/a-ztdeau.adb
+++ b/gcc/ada/a-ztdeau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztdeau.ads b/gcc/ada/a-ztdeau.ads
index 3769bd24c6a..ba9ffcb42d3 100644
--- a/gcc/ada/a-ztdeau.ads
+++ b/gcc/ada/a-ztdeau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztdeio.adb b/gcc/ada/a-ztdeio.adb
index af2240ab861..796dfc80456 100644
--- a/gcc/ada/a-ztdeio.adb
+++ b/gcc/ada/a-ztdeio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO.Decimal_Aux;
+
with System.WCh_Con; use System.WCh_Con;
with System.WCh_WtS; use System.WCh_WtS;
diff --git a/gcc/ada/a-ztdeio.ads b/gcc/ada/a-ztdeio.ads
index 3b435edb34a..73d6c23baa5 100644
--- a/gcc/ada/a-ztdeio.ads
+++ b/gcc/ada/a-ztdeio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-ztedit.adb b/gcc/ada/a-ztedit.adb
index 57478426e8b..f763bdc3920 100644
--- a/gcc/ada/a-ztedit.adb
+++ b/gcc/ada/a-ztedit.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztedit.ads b/gcc/ada/a-ztedit.ads
index 028265339b0..3a2f49a4d71 100644
--- a/gcc/ada/a-ztedit.ads
+++ b/gcc/ada/a-ztedit.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-ztenau.ads b/gcc/ada/a-ztenau.ads
index 9555076320a..6683be974df 100644
--- a/gcc/ada/a-ztenau.ads
+++ b/gcc/ada/a-ztenau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztenio.adb b/gcc/ada/a-ztenio.adb
index 24bc6d6b6a3..4b95295c563 100644
--- a/gcc/ada/a-ztenio.adb
+++ b/gcc/ada/a-ztenio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztenio.ads b/gcc/ada/a-ztenio.ads
index 05ceacef735..5de801f5413 100644
--- a/gcc/ada/a-ztenio.ads
+++ b/gcc/ada/a-ztenio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-ztexio.adb b/gcc/ada/a-ztexio.adb
index 8530e5a9a85..2742255b9ff 100644
--- a/gcc/ada/a-ztexio.adb
+++ b/gcc/ada/a-ztexio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztexio.ads b/gcc/ada/a-ztexio.ads
index 7c465ab249d..000d104e16b 100644
--- a/gcc/ada/a-ztexio.ads
+++ b/gcc/ada/a-ztexio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-ztfiio.adb b/gcc/ada/a-ztfiio.adb
index 1670e5b3653..db12fc82fbb 100644
--- a/gcc/ada/a-ztfiio.adb
+++ b/gcc/ada/a-ztfiio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztfiio.ads b/gcc/ada/a-ztfiio.ads
index 0e606daab86..2fc4fabfddf 100644
--- a/gcc/ada/a-ztfiio.ads
+++ b/gcc/ada/a-ztfiio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-ztflau.adb b/gcc/ada/a-ztflau.adb
index 9d550c93d74..11ca1a6b433 100644
--- a/gcc/ada/a-ztflau.adb
+++ b/gcc/ada/a-ztflau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztflau.ads b/gcc/ada/a-ztflau.ads
index fd6da730117..57c7fcdcefa 100644
--- a/gcc/ada/a-ztflau.ads
+++ b/gcc/ada/a-ztflau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztflio.adb b/gcc/ada/a-ztflio.adb
index 97368413b4f..bd8e535fcbd 100644
--- a/gcc/ada/a-ztflio.adb
+++ b/gcc/ada/a-ztflio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztflio.ads b/gcc/ada/a-ztflio.ads
index 1c9d80be7e1..32dafd198a1 100644
--- a/gcc/ada/a-ztflio.ads
+++ b/gcc/ada/a-ztflio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-ztgeau.adb b/gcc/ada/a-ztgeau.adb
index 3f2bf9ce52a..21b9608db80 100644
--- a/gcc/ada/a-ztgeau.adb
+++ b/gcc/ada/a-ztgeau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztgeau.ads b/gcc/ada/a-ztgeau.ads
index 4446bf53202..38a17cf70b0 100644
--- a/gcc/ada/a-ztgeau.ads
+++ b/gcc/ada/a-ztgeau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztinau.adb b/gcc/ada/a-ztinau.adb
index 8c8bf0a5ffe..74f84a02f73 100644
--- a/gcc/ada/a-ztinau.adb
+++ b/gcc/ada/a-ztinau.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztinau.ads b/gcc/ada/a-ztinau.ads
index 1a213d0e806..b37a9d1a7a8 100644
--- a/gcc/ada/a-ztinau.ads
+++ b/gcc/ada/a-ztinau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztinio.adb b/gcc/ada/a-ztinio.adb
index 98c42eb3958..8369edce3dd 100644
--- a/gcc/ada/a-ztinio.adb
+++ b/gcc/ada/a-ztinio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztmoau.ads b/gcc/ada/a-ztmoau.ads
index 2bce97573e8..057162993fc 100644
--- a/gcc/ada/a-ztmoau.ads
+++ b/gcc/ada/a-ztmoau.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztmoio.adb b/gcc/ada/a-ztmoio.adb
index 169b202c74b..8d97e8cdd92 100644
--- a/gcc/ada/a-ztmoio.adb
+++ b/gcc/ada/a-ztmoio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/a-ztmoio.ads b/gcc/ada/a-ztmoio.ads
index 91d1a536bc0..aeef4ceb50d 100644
--- a/gcc/ada/a-ztmoio.ads
+++ b/gcc/ada/a-ztmoio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/a-zttest.adb b/gcc/ada/a-zttest.adb
index 49c480c1c8f..fda7b924394 100644
--- a/gcc/ada/a-zttest.adb
+++ b/gcc/ada/a-zttest.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 65fa75bb8c6..d73665be1da 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -195,6 +195,13 @@ struct vstring
#define DIR_SEPARATOR '/'
#endif
+/* Check for cross-compilation */
+#ifdef CROSS_COMPILE
+int __gnat_is_cross_compiler = 1;
+#else
+int __gnat_is_cross_compiler = 0;
+#endif
+
char __gnat_dir_separator = DIR_SEPARATOR;
char __gnat_path_separator = PATH_SEPARATOR;
@@ -2535,8 +2542,10 @@ _flush_cache()
#endif
#if defined (CROSS_COMPILE) \
- || (! (defined (sparc) && defined (sun) && defined (__SVR4)) \
+ || (! ((defined (sparc) || defined (i386)) && defined (sun) \
+ && defined (__SVR4)) \
&& ! (defined (linux) && (defined (i386) || defined (__x86_64__))) \
+ && ! (defined (linux) && defined (__ia64__)) \
&& ! defined (__FreeBSD__) \
&& ! defined (__hpux__) \
&& ! defined (__APPLE__) \
@@ -2545,9 +2554,9 @@ _flush_cache()
&& ! defined (__MINGW32__) \
&& ! (defined (__mips) && defined (__sgi)))
-/* Dummy function to satisfy g-trasym.o. Currently Solaris sparc, HP/UX,
- GNU/Linux x86{_64}, Tru64 & Windows provide a non-dummy version of this
- procedure in libaddr2line.a. */
+/* Dummy function to satisfy g-trasym.o. See the preprocessor conditional
+ just above for a list of native platforms that provide a non-dummy
+ version of this procedure in libaddr2line.a. */
void
convert_addresses (void *addrs ATTRIBUTE_UNUSED,
@@ -2629,27 +2638,6 @@ __gnat_copy_attribs (char *from, char *to, int mode)
#endif
}
-/* This function is installed in libgcc.a. */
-extern void __gnat_install_locks (void (*) (void), void (*) (void));
-
-/* This function offers a hook for libgnarl to set the
- locking subprograms for libgcc_eh.
- This is only needed on OpenVMS, since other platforms use standard
- --enable-threads=posix option, or similar. */
-
-void
-__gnatlib_install_locks (void (*lock) (void) ATTRIBUTE_UNUSED,
- void (*unlock) (void) ATTRIBUTE_UNUSED)
-{
-#if defined (IN_RTS) && defined (VMS)
- __gnat_install_locks (lock, unlock);
- /* There is a bootstrap path issue if adaint is build with this
- symbol unresolved for the stage1 compiler. Since the compiler
- does not use tasking, we simply make __gnatlib_install_locks
- a no-op in this case. */
-#endif
-}
-
int
__gnat_lseek (int fd, long offset, int whence)
{
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index af83407e011..70ee1d0a594 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -6,7 +6,7 @@
* *
* C Header File *
* *
- * Copyright (C) 1992-2005 Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2005, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -164,10 +164,5 @@ extern void __gnat_plist_init (void);
/* This function returns the version of GCC being used. Here it's GCC 3. */
extern int get_gcc_version (void);
-/* This function offers a hook for libgnarl to set the
- locking subprograms for libgcc_eh. */
-extern void __gnatlib_install_locks (void (*) (void),
- void (*) (void));
-
extern int __gnat_binder_supports_auto_init (void);
extern int __gnat_sals_init_using_constructors (void);
diff --git a/gcc/ada/ali-util.adb b/gcc/ada/ali-util.adb
index b3e88cb5881..28819c743f3 100644
--- a/gcc/ada/ali-util.adb
+++ b/gcc/ada/ali-util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb
index c1ea6c46930..2bafec0295d 100644
--- a/gcc/ada/ali.adb
+++ b/gcc/ada/ali.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1556,6 +1556,7 @@ package body ALI is
Withs.Table (Withs.Last).Uname := Get_Name;
Withs.Table (Withs.Last).Elaborate := False;
Withs.Table (Withs.Last).Elaborate_All := False;
+ Withs.Table (Withs.Last).Elab_Desirable := False;
Withs.Table (Withs.Last).Elab_All_Desirable := False;
Withs.Table (Withs.Last).SAL_Interface := False;
@@ -1571,12 +1572,24 @@ package body ALI is
Withs.Table (Withs.Last).Sfile := Get_Name (Lower => True);
Withs.Table (Withs.Last).Afile := Get_Name;
- -- Scan out possible E, EA, and NE parameters
+ -- Scan out possible E, EA, ED, and AD parameters
while not At_Eol loop
Skip_Space;
- if Nextc = 'E' then
+ if Nextc = 'A' then
+ P := P + 1;
+ Checkc ('D');
+ Check_At_End_Of_Field;
+
+ -- Store AD indication unless ignore required
+
+ if not Ignore_ED then
+ Withs.Table (Withs.Last).Elab_All_Desirable :=
+ True;
+ end if;
+
+ elsif Nextc = 'E' then
P := P + 1;
if At_End_Of_Field then
@@ -1594,7 +1607,7 @@ package body ALI is
-- Store ED indication unless ignore required
if not Ignore_ED then
- Withs.Table (Withs.Last).Elab_All_Desirable :=
+ Withs.Table (Withs.Last).Elab_Desirable :=
True;
end if;
end if;
diff --git a/gcc/ada/ali.ads b/gcc/ada/ali.ads
index 6582a1a19bc..f00220f59e6 100644
--- a/gcc/ada/ali.ads
+++ b/gcc/ada/ali.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -473,6 +473,9 @@ package ALI is
-- Indicates presence of EA parameter
Elab_All_Desirable : Boolean;
+ -- Indicates presence of AD parameter
+
+ Elab_Desirable : Boolean;
-- Indicates presence of ED parameter
SAL_Interface : Boolean := False;
@@ -872,7 +875,7 @@ package ALI is
-- switch description settings.
--
-- Ignore_ED is normally False. If set to True, it indicates that
- -- all ED (elaboration desirable) indications in the ALI file are
+ -- all AD/ED (elaboration desirable) indications in the ALI file are
-- to be ignored. This parameter is obsolete now that the -f switch
-- is removed from gnatbind, and should be removed ???
--
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index 20ea715f9b3..119cf62d080 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -1169,7 +1169,7 @@ package body Atree is
function Copy_Elist_With_Replacement
(Old_Elist : Elist_Id) return Elist_Id;
- -- Called during second phase to copy element list doing replacements.
+ -- Called during second phase to copy element list doing replacements
procedure Copy_Itype_With_Replacement (New_Itype : Entity_Id);
-- Called during the second phase to process a copied Itype. The actual
@@ -1178,7 +1178,7 @@ package body Atree is
-- the copied Itype and copy them where necessary.
function Copy_List_With_Replacement (Old_List : List_Id) return List_Id;
- -- Called during second phase to copy list doing replacements.
+ -- Called during second phase to copy list doing replacements
function Copy_Node_With_Replacement (Old_Node : Node_Id) return Node_Id;
-- Called during second phase to copy node doing replacements
@@ -1775,7 +1775,7 @@ package body Atree is
Visit_Field (Union_Id (Scalar_Range (Old_Itype)), Old_Itype);
elsif Has_Discriminants (Base_Type (Old_Itype)) then
- -- ??? This should involve call to Visit_Field.
+ -- ??? This should involve call to Visit_Field
Visit_Elist (Discriminant_Constraint (Old_Itype));
elsif Is_Array_Type (Old_Itype) then
diff --git a/gcc/ada/back_end.adb b/gcc/ada/back_end.adb
index d6fd7cbed68..5453dd3ab30 100644
--- a/gcc/ada/back_end.adb
+++ b/gcc/ada/back_end.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -141,7 +141,7 @@ package body Back_End is
type Arg_Array is array (Nat) of BSP;
type Arg_Array_Ptr is access Arg_Array;
- -- Import flag_stack_check from toplev.c.
+ -- Import flag_stack_check from toplev.c
flag_stack_check : Int;
pragma Import (C, flag_stack_check); -- Import from toplev.c
diff --git a/gcc/ada/binde.adb b/gcc/ada/binde.adb
index 2985b90b9e9..acba7846418 100644
--- a/gcc/ada/binde.adb
+++ b/gcc/ada/binde.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -72,11 +72,16 @@ package body Binde is
-- elaborated before unit X is elaborated. The Elab_All_Link list
-- traces the dependencies in the latter case.
- Elab_Desirable,
+ Elab_All_Desirable,
-- This is just like Elab_All, except that the elaborate all was not
-- explicitly present in the source, but rather was created by the
-- front end, which decided that it was "desirable".
+ Elab_Desirable,
+ -- This is just like Elab, except that the elaborate was not
+ -- explicitly present in the source, but rather was created by the
+ -- front end, which decided that it was "desirable".
+
Spec_First);
-- After is a body, and Before is the corresponding spec
@@ -249,7 +254,7 @@ package body Binde is
Link : Elab_All_Id);
-- Used to compute the transitive closure of elaboration links for an
-- Elaborate_All pragma (Reason = Elab_All) or for an indication of
- -- Elaborate_All_Desirable (Reason = Elab_Desirable). Unit After has
+ -- Elaborate_All_Desirable (Reason = Elab_All_Desirable). Unit After has
-- a pragma Elaborate_All or the front end has determined that a reference
-- probably requires Elaborate_All is required, and unit Before must be
-- previously elaborated. First a link is built making sure that unit
@@ -268,8 +273,7 @@ package body Binde is
function Make_Elab_Entry
(Unam : Unit_Name_Type;
- Link : Elab_All_Id)
- return Elab_All_Id;
+ Link : Elab_All_Id) return Elab_All_Id;
-- Make an Elab_All_Entries table entry with the given Unam and Link
function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id;
@@ -800,9 +804,9 @@ package body Binde is
SL : Successor_Link renames Succ.Table (S);
begin
- -- Nothing to do if internal unit involved and no -de flag
+ -- Nothing to do if internal unit involved and no -da flag
- if not Debug_Flag_E
+ if not Debug_Flag_A
and then
(Is_Internal_File_Name (Units.Table (SL.Before).Sfile)
or else
@@ -841,7 +845,7 @@ package body Binde is
(" reason: pragma Elaborate_All in unit &",
Info => True);
- when Elab_Desirable =>
+ when Elab_All_Desirable =>
Error_Msg_Output
(" reason: implicit Elaborate_All in unit &",
Info => True);
@@ -850,6 +854,15 @@ package body Binde is
(" recompile & with -gnatwl for full details",
Info => True);
+ when Elab_Desirable =>
+ Error_Msg_Output
+ (" reason: implicit Elaborate in unit &",
+ Info => True);
+
+ Error_Msg_Output
+ (" recompile & with -gnatwl for full details",
+ Info => True);
+
when Spec_First =>
Error_Msg_Output
(" reason: spec always elaborated before body",
@@ -1092,7 +1105,7 @@ package body Binde is
-- Now establish all the links we need
Elab_All_Links
- (Withed_Unit, U, Elab_Desirable,
+ (Withed_Unit, U, Elab_All_Desirable,
Make_Elab_Entry
(Withs.Table (W).Uname, No_Elab_All_Link));
@@ -1116,6 +1129,18 @@ package body Binde is
(Corresponding_Body (Withed_Unit), U, Elab);
end if;
+ -- Elaborate_Desirable case, for this we establish
+ -- the same links as above, but with a different reason.
+
+ elsif Withs.Table (W).Elab_Desirable then
+ Build_Link (Withed_Unit, U, Withed);
+
+ if Units.Table (Withed_Unit).Utype = Is_Spec then
+ Build_Link
+ (Corresponding_Body (Withed_Unit),
+ U, Elab_Desirable);
+ end if;
+
-- Case of normal WITH with no elaboration pragmas, just
-- build the single link to the directly referenced unit
@@ -1137,8 +1162,7 @@ package body Binde is
function Make_Elab_Entry
(Unam : Unit_Name_Type;
- Link : Elab_All_Id)
- return Elab_All_Id
+ Link : Elab_All_Id) return Elab_All_Id
is
begin
Elab_All_Entries.Increment_Last;
@@ -1153,7 +1177,6 @@ package body Binde is
function Unit_Id_Of (Uname : Unit_Name_Type) return Unit_Id is
Info : constant Int := Get_Name_Table_Info (Uname);
-
begin
pragma Assert (Info /= 0 and then Unit_Id (Info) /= No_Unit_Id);
return Unit_Id (Info);
@@ -1172,12 +1195,20 @@ package body Binde is
-- Determines if U is a waiting body, defined as a body which has
-- not been elaborated, but whose spec has been elaborated.
+ ---------------
+ -- Body_Unit --
+ ---------------
+
function Body_Unit (U : Unit_Id) return Boolean is
begin
return Units.Table (U).Utype = Is_Body
or else Units.Table (U).Utype = Is_Body_Only;
end Body_Unit;
+ ------------------
+ -- Waiting_Body --
+ ------------------
+
function Waiting_Body (U : Unit_Id) return Boolean is
begin
return Units.Table (U).Utype = Is_Body and then
@@ -1186,10 +1217,10 @@ package body Binde is
-- Start of processing for Worse_Choice
- -- Note: the checks here are applied in sequence, and the ordering is
- -- significant (i.e. the more important criteria are applied first).
-
begin
+ -- Note: the checks here are applied in sequence, and the ordering is
+ -- significant (i.e. the more important criteria are applied first).
+
-- If either unit is internal, then use Better_Choice, since the
-- language requires that predefined units not mess up in the choice
-- of elaboration order, and for internal units, any problems are
@@ -1277,7 +1308,7 @@ package body Binde is
First_Name : Boolean := True;
begin
- if ST.Reason in Elab_All .. Elab_Desirable then
+ if ST.Reason in Elab_All .. Elab_All_Desirable then
L := ST.Elab_All_Link;
while L /= No_Elab_All_Link loop
Nam := Elab_All_Entries.Table (L).Needed_By;
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index bdb864fe3ef..99625301d48 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -2442,7 +2442,7 @@ package body Bindgen is
-- When building libraries, the version number of each unit can
-- not be computed, since the binder does not know the full list
-- of units. Therefore, the 'Version and 'Body_Version
- -- attributes can not supported in this case.
+ -- attributes cannot supported in this case.
return;
end if;
@@ -2510,7 +2510,7 @@ package body Bindgen is
-- When building libraries, the version number of each unit can
-- not be computed, since the binder does not know the full list
-- of units. Therefore, the 'Version and 'Body_Version
- -- attributes can not supported.
+ -- attributes cannot supported.
return;
end if;
diff --git a/gcc/ada/bindusg.adb b/gcc/ada/bindusg.adb
index 60deb26b374..667c982efb9 100644
--- a/gcc/ada/bindusg.adb
+++ b/gcc/ada/bindusg.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -132,17 +132,17 @@ begin
Write_Str ("renamed to xyzinit/final, implies -n");
Write_Eol;
- -- Line for -M switch
-
- Write_Str (" -Mxyz Rename generated main program from main to xyz");
- Write_Eol;
-
-- Line for -m switch
Write_Str (" -mnnn Limit number of detected error");
Write_Str ("s to nnn (1-999999)");
Write_Eol;
+ -- Line for -M switch
+
+ Write_Str (" -Mxyz Rename generated main program from main to xyz");
+ Write_Eol;
+
-- Line for -n switch
Write_Str (" -n No Ada main program (foreign main routine)");
diff --git a/gcc/ada/butil.adb b/gcc/ada/butil.adb
index a3f5288553f..1366313c4e6 100644
--- a/gcc/ada/butil.adb
+++ b/gcc/ada/butil.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/butil.ads b/gcc/ada/butil.ads
index b96b63b30c2..4ed78bb7223 100644
--- a/gcc/ada/butil.ads
+++ b/gcc/ada/butil.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 8bb91714202..d53dcc07d8f 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -2481,13 +2481,11 @@ package body Checks is
exit when N = Right_Opnd (P)
and then Nkind (Left_Opnd (P)) = N_Op_Eq;
- -- And/And then case, left operand must be inequality test. Note that
- -- at this stage, the expander will have changed a/=b to not (a=b).
+ -- And/And then case, left operand must be inequality test
elsif K = N_Op_And or else K = N_And_Then then
exit when N = Right_Opnd (P)
- and then Nkind (Left_Opnd (P)) = N_Op_Not
- and then Nkind (Right_Opnd (Left_Opnd (P))) = N_Op_Eq;
+ and then Nkind (Left_Opnd (P)) = N_Op_Ne;
end if;
N := P;
@@ -3259,15 +3257,32 @@ package body Checks is
function Elaboration_Checks_Suppressed (E : Entity_Id) return Boolean is
begin
+ -- The complication in this routine is that if we are in the dynamic
+ -- model of elaboration, we also check All_Checks, since All_Checks
+ -- does not set Elaboration_Check explicitly.
+
if Present (E) then
if Kill_Elaboration_Checks (E) then
return True;
+
elsif Checks_May_Be_Suppressed (E) then
- return Is_Check_Suppressed (E, Elaboration_Check);
+ if Is_Check_Suppressed (E, Elaboration_Check) then
+ return True;
+ elsif Dynamic_Elaboration_Checks then
+ return Is_Check_Suppressed (E, All_Checks);
+ else
+ return False;
+ end if;
end if;
end if;
- return Scope_Suppress (Elaboration_Check);
+ if Scope_Suppress (Elaboration_Check) then
+ return True;
+ elsif Dynamic_Elaboration_Checks then
+ return Scope_Suppress (All_Checks);
+ else
+ return False;
+ end if;
end Elaboration_Checks_Suppressed;
---------------------------
@@ -3690,6 +3705,15 @@ package body Checks is
then
return;
+ -- No check on a univeral real constant. The context will eventually
+ -- convert it to a machine number for some target type, or report an
+ -- illegality.
+
+ elsif Nkind (Expr) = N_Real_Literal
+ and then Etype (Expr) = Universal_Real
+ then
+ return;
+
-- An annoying special case. If this is an out parameter of a scalar
-- type, then the value is not going to be accessed, therefore it is
-- inappropriate to do any validity check at the call site.
@@ -3845,11 +3869,10 @@ package body Checks is
then
return Expr_Known_Valid (Expression (Expr));
- -- The result of any function call or operator is always considered
- -- valid, since we assume the necessary checks are done by the call.
- -- For operators on floating-point operations, we must also check
- -- when the operation is the right-hand side of an assignment, or
- -- is an actual in a call.
+ -- The result of any operator is always considered valid, since we
+ -- assume the necessary checks are done by the operator. For operators
+ -- on floating-point operations, we must also check when the operation
+ -- is the right-hand side of an assignment, or is an actual in a call.
elsif
Nkind (Expr) in N_Binary_Op or else Nkind (Expr) in N_Unary_Op
@@ -3866,9 +3889,6 @@ package body Checks is
return True;
end if;
- elsif Nkind (Expr) = N_Function_Call then
- return True;
-
-- For all other cases, we do not know the expression is valid
else
diff --git a/gcc/ada/checks.ads b/gcc/ada/checks.ads
index c16495dd1a2..168da4c25c0 100644
--- a/gcc/ada/checks.ads
+++ b/gcc/ada/checks.ads
@@ -247,7 +247,7 @@ package Checks is
-- be discarded, even if they are not in the current statement range.
procedure Kill_All_Checks;
- -- This procedure kills all remembered checks.
+ -- This procedure kills all remembered checks
-----------------------------
-- Length and Range Checks --
@@ -548,7 +548,7 @@ package Checks is
-- If all possible stored values are valid, then any uninitialized
-- value must be valid.
- -- Literals, including enumeration literals, are clearly always valid.
+ -- Literals, including enumeration literals, are clearly always valid
-- Constants are always assumed valid, with a validity check being
-- performed on the initializing value where necessary to ensure that
diff --git a/gcc/ada/cio.c b/gcc/ada/cio.c
index c3fdde15bdd..6fba5a0b0cb 100644
--- a/gcc/ada/cio.c
+++ b/gcc/ada/cio.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2005 Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2005, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb
index c70cec7ff1e..e5682d08b30 100644
--- a/gcc/ada/clean.adb
+++ b/gcc/ada/clean.adb
@@ -24,8 +24,6 @@
-- --
------------------------------------------------------------------------------
-with Ada.Command_Line; use Ada.Command_Line;
-
with ALI; use ALI;
with Csets;
with Gnatvsn;
@@ -45,6 +43,8 @@ with Snames;
with Table;
with Types; use Types;
+with Ada.Command_Line; use Ada.Command_Line;
+
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.IO; use GNAT.IO;
with GNAT.OS_Lib; use GNAT.OS_Lib;
@@ -191,13 +191,17 @@ package body Clean is
-- Delete a global archive or a fake library project archive and the
-- dependency file, if they exist.
- procedure Clean_Directory (Dir : Name_Id);
- -- Delete all regular files in a library directory or in a library
- -- interface dir.
-
procedure Clean_Executables;
-- Do the cleaning work when no project file is specified
+ procedure Clean_Interface_Copy_Directory (Project : Project_Id);
+ -- Delete files in an interface coy directory directory: any file that is
+ -- a copy of a source of the project.
+
+ procedure Clean_Library_Directory (Project : Project_Id);
+ -- Delete the library file in a library directory and any ALI file
+ -- of a source of the project in a library ALI directory.
+
procedure Clean_Project (Project : Project_Id);
-- Do the cleaning work when a project file is specified.
-- This procedure calls itself recursively when there are several
@@ -241,6 +245,11 @@ package body Clean is
-- Returns True iff Prj is an extension of Of_Project or if Of_Project is
-- an extension of Prj.
+ function Ultimate_Extension_Of (Project : Project_Id) return Project_Id;
+ -- Returns either Project, if it is not extended by another project, or
+ -- the project that extends Project, directly or indirectly, and that is
+ -- not itself extended. Returns No_Project if Project is No_Project.
+
procedure Usage;
-- Display the usage.
-- If called several times, the usage is displayed only the first time.
@@ -356,46 +365,6 @@ package body Clean is
Change_Dir (Current_Dir);
end Clean_Archive;
- ---------------------
- -- Clean_Directory --
- ---------------------
-
- procedure Clean_Directory (Dir : Name_Id) is
- Directory : constant String := Get_Name_String (Dir);
- Current : constant Dir_Name_Str := Get_Current_Dir;
-
- Direc : Dir_Type;
-
- Name : String (1 .. 200);
- Last : Natural;
-
- begin
- Change_Dir (Directory);
- Open (Direc, ".");
-
- -- For each regular file in the directory, if switch -n has not been
- -- specified, make it writable and delete the file.
-
- loop
- Read (Direc, Name, Last);
- exit when Last = 0;
-
- if Is_Regular_File (Name (1 .. Last)) then
- if not Do_Nothing then
- Set_Writable (Name (1 .. Last));
- end if;
-
- Delete (Directory, Name (1 .. Last));
- end if;
- end loop;
-
- Close (Direc);
-
- -- Restore the initial working directory
-
- Change_Dir (Current);
- end Clean_Directory;
-
-----------------------
-- Clean_Executables --
-----------------------
@@ -550,6 +519,242 @@ package body Clean is
end loop;
end Clean_Executables;
+ ------------------------------------
+ -- Clean_Interface_Copy_Directory --
+ ------------------------------------
+
+ procedure Clean_Interface_Copy_Directory (Project : Project_Id) is
+ Current : constant String := Get_Current_Dir;
+ Data : constant Project_Data := Project_Tree.Projects.Table (Project);
+
+ Direc : Dir_Type;
+
+ Name : String (1 .. 200);
+ Last : Natural;
+
+ Delete_File : Boolean;
+ Unit : Unit_Data;
+
+ begin
+ if Data.Library and then Data.Library_Src_Dir /= No_Name then
+ declare
+ Directory : constant String :=
+ Get_Name_String (Data.Library_Src_Dir);
+
+ begin
+ Change_Dir (Get_Name_String (Data.Library_Src_Dir));
+ Open (Direc, ".");
+
+ -- For each regular file in the directory, if switch -n has not
+ -- been specified, make it writable and delete the file if it is
+ -- a copy of a source of the project.
+
+ loop
+ Read (Direc, Name, Last);
+ exit when Last = 0;
+
+ if Is_Regular_File (Name (1 .. Last)) then
+ Canonical_Case_File_Name (Name (1 .. Last));
+ Delete_File := False;
+
+ -- Compare with source file names of the project
+
+ for Index in 1 .. Unit_Table.Last (Project_Tree.Units) loop
+ Unit := Project_Tree.Units.Table (Index);
+
+ if Ultimate_Extension_Of
+ (Unit.File_Names (Body_Part).Project) = Project
+ and then
+ Get_Name_String
+ (Unit.File_Names (Body_Part).Name) =
+ Name (1 .. Last)
+ then
+ Delete_File := True;
+ exit;
+ end if;
+
+ if Ultimate_Extension_Of
+ (Unit.File_Names (Specification).Project) = Project
+ and then
+ Get_Name_String
+ (Unit.File_Names (Specification).Name) =
+ Name (1 .. Last)
+ then
+ Delete_File := True;
+ exit;
+ end if;
+ end loop;
+
+ if Delete_File then
+ if not Do_Nothing then
+ Set_Writable (Name (1 .. Last));
+ end if;
+
+ Delete (Directory, Name (1 .. Last));
+ end if;
+ end if;
+ end loop;
+
+ Close (Direc);
+
+ -- Restore the initial working directory
+
+ Change_Dir (Current);
+ end;
+ end if;
+ end Clean_Interface_Copy_Directory;
+
+ -----------------------------
+ -- Clean_Library_Directory --
+ -----------------------------
+
+ procedure Clean_Library_Directory (Project : Project_Id) is
+ Current : constant String := Get_Current_Dir;
+ Data : constant Project_Data := Project_Tree.Projects.Table (Project);
+
+ Lib_Filename : constant String := Get_Name_String (Data.Library_Name);
+ DLL_Name : constant String :=
+ DLL_Prefix & Lib_Filename & "." & DLL_Ext;
+ Archive_Name : constant String :=
+ "lib" & Lib_Filename & "." & Archive_Ext;
+ Direc : Dir_Type;
+
+ Name : String (1 .. 200);
+ Last : Natural;
+
+ Delete_File : Boolean;
+
+ begin
+ if Data.Library then
+ declare
+ Lib_Directory : constant String :=
+ Get_Name_String (Data.Library_Dir);
+ Lib_ALI_Directory : constant String :=
+ Get_Name_String (Data.Library_ALI_Dir);
+
+ begin
+ Change_Dir (Lib_Directory);
+ Open (Direc, ".");
+
+ -- For each regular file in the directory, if switch -n has not
+ -- been specified, make it writable and delete the file if it is
+ -- the library file.
+
+ loop
+ Read (Direc, Name, Last);
+ exit when Last = 0;
+
+ if Is_Regular_File (Name (1 .. Last)) then
+ Canonical_Case_File_Name (Name (1 .. Last));
+ Delete_File := False;
+
+ if (Data.Library_Kind = Static and then
+ Name (1 .. Last) = Archive_Name)
+ or else
+ ((Data.Library_Kind = Dynamic or else
+ Data.Library_Kind = Relocatable)
+ and then
+ Name (1 .. Last) = DLL_Name)
+ then
+ if not Do_Nothing then
+ Set_Writable (Name (1 .. Last));
+ end if;
+
+ Delete (Lib_Directory, Name (1 .. Last));
+ exit;
+ end if;
+ end if;
+ end loop;
+
+ Close (Direc);
+
+ Change_Dir (Lib_ALI_Directory);
+ Open (Direc, ".");
+
+ -- For each regular file in the directory, if switch -n has not
+ -- been specified, make it writable and delete the file if it is
+ -- any ALI file of a source of the project.
+
+ loop
+ Read (Direc, Name, Last);
+ exit when Last = 0;
+
+ if Is_Regular_File (Name (1 .. Last)) then
+ Canonical_Case_File_Name (Name (1 .. Last));
+ Delete_File := False;
+
+ if Last > 4 and then Name (Last - 3 .. Last) = ".ali" then
+ declare
+ Unit : Unit_Data;
+ begin
+ -- Compare with ALI file names of the project
+
+ for
+ Index in 1 .. Unit_Table.Last (Project_Tree.Units)
+ loop
+ Unit := Project_Tree.Units.Table (Index);
+
+ if Unit.File_Names (Body_Part).Project /=
+ No_Project
+ then
+ if Ultimate_Extension_Of
+ (Unit.File_Names (Body_Part).Project) =
+ Project
+ then
+ Get_Name_String
+ (Unit.File_Names (Body_Part).Name);
+ Name_Len := Name_Len -
+ File_Extension
+ (Name (1 .. Name_Len))'Length;
+ if Name_Buffer (1 .. Name_Len) =
+ Name (1 .. Last - 4)
+ then
+ Delete_File := True;
+ exit;
+ end if;
+ end if;
+
+ elsif Ultimate_Extension_Of
+ (Unit.File_Names (Specification).Project) =
+ Project
+ then
+ Get_Name_String
+ (Unit.File_Names (Specification).Name);
+ Name_Len := Name_Len -
+ File_Extension
+ (Name (1 .. Name_Len))'Length;
+
+ if Name_Buffer (1 .. Name_Len) =
+ Name (1 .. Last - 4)
+ then
+ Delete_File := True;
+ exit;
+ end if;
+ end if;
+ end loop;
+ end;
+ end if;
+
+ if Delete_File then
+ if not Do_Nothing then
+ Set_Writable (Name (1 .. Last));
+ end if;
+
+ Delete (Lib_ALI_Directory, Name (1 .. Last));
+ end if;
+
+ end if;
+ end loop;
+
+ Close (Direc);
+
+ -- Restore the initial working directory
+
+ Change_Dir (Current);
+ end;
+ end if;
+ end Clean_Library_Directory;
+
-------------------
-- Clean_Project --
-------------------
@@ -588,251 +793,271 @@ package body Clean is
("Cannot specify executable(s) for a Library Project File");
end if;
- if Verbose_Mode then
- Put ("Cleaning project """);
- Put (Get_Name_String (Data.Name));
- Put_Line ("""");
- end if;
+ -- Nothing to clean in an externally built project
- -- Add project to the list of processed projects
+ if Data.Externally_Built then
+ if Verbose_Mode then
+ Put ("Nothing to do to clean externally built project """);
+ Put (Get_Name_String (Data.Name));
+ Put_Line ("""");
+ end if;
- Processed_Projects.Increment_Last;
- Processed_Projects.Table (Processed_Projects.Last) := Project;
+ else
+ if Verbose_Mode then
+ Put ("Cleaning project """);
+ Put (Get_Name_String (Data.Name));
+ Put_Line ("""");
+ end if;
- if Data.Object_Directory /= No_Name then
- declare
- Obj_Dir : constant String :=
- Get_Name_String (Data.Object_Directory);
+ -- Add project to the list of processed projects
- begin
- Change_Dir (Obj_Dir);
+ Processed_Projects.Increment_Last;
+ Processed_Projects.Table (Processed_Projects.Last) := Project;
- -- First, deal with Ada
+ if Data.Object_Directory /= No_Name then
+ declare
+ Obj_Dir : constant String :=
+ Get_Name_String (Data.Object_Directory);
- -- Look through the units to find those that are either immediate
- -- sources or inherited sources of the project.
+ begin
+ Change_Dir (Obj_Dir);
- if Data.Languages (Ada_Language_Index) then
- for Unit in Unit_Table.First ..
- Unit_Table.Last (Project_Tree.Units)
- loop
- U_Data := Project_Tree.Units.Table (Unit);
- File_Name1 := No_Name;
- File_Name2 := No_Name;
+ -- First, deal with Ada
- -- If either the spec or the body is a source of the
- -- project, check for the corresponding ALI file in the
- -- object directory.
+ -- Look through the units to find those that are either
+ -- immediate sources or inherited sources of the project.
+ -- Extending projects may have no language specified, if
+ -- Source_Dirs or Source_Files is specified as an empty list,
+ -- so always look for Ada units in extending projects.
- if In_Extension_Chain
- (U_Data.File_Names (Body_Part).Project, Project)
- or else
- In_Extension_Chain
- (U_Data.File_Names (Specification).Project, Project)
- then
- File_Name1 := U_Data.File_Names (Body_Part).Name;
- Index1 := U_Data.File_Names (Body_Part).Index;
- File_Name2 := U_Data.File_Names (Specification).Name;
- Index2 := U_Data.File_Names (Specification).Index;
-
- -- If there is no body file name, then there may be only
- -- a spec.
-
- if File_Name1 = No_Name then
- File_Name1 := File_Name2;
- Index1 := Index2;
- File_Name2 := No_Name;
- Index2 := 0;
+ if Data.Languages (Ada_Language_Index)
+ or else Data.Extends /= No_Project
+ then
+ for Unit in Unit_Table.First ..
+ Unit_Table.Last (Project_Tree.Units)
+ loop
+ U_Data := Project_Tree.Units.Table (Unit);
+ File_Name1 := No_Name;
+ File_Name2 := No_Name;
+
+ -- If either the spec or the body is a source of the
+ -- project, check for the corresponding ALI file in the
+ -- object directory.
+
+ if In_Extension_Chain
+ (U_Data.File_Names (Body_Part).Project, Project)
+ or else
+ In_Extension_Chain
+ (U_Data.File_Names (Specification).Project, Project)
+ then
+ File_Name1 := U_Data.File_Names (Body_Part).Name;
+ Index1 := U_Data.File_Names (Body_Part).Index;
+ File_Name2 := U_Data.File_Names (Specification).Name;
+ Index2 := U_Data.File_Names (Specification).Index;
+
+ -- If there is no body file name, then there may be
+ -- only a spec.
+
+ if File_Name1 = No_Name then
+ File_Name1 := File_Name2;
+ Index1 := Index2;
+ File_Name2 := No_Name;
+ Index2 := 0;
+ end if;
end if;
- end if;
- -- If there is either a spec or a body, look for files
- -- in the object directory.
+ -- If there is either a spec or a body, look for files
+ -- in the object directory.
- if File_Name1 /= No_Name then
- Lib_File := Osint.Lib_File_Name (File_Name1, Index1);
+ if File_Name1 /= No_Name then
+ Lib_File := Osint.Lib_File_Name (File_Name1, Index1);
- declare
- Asm : constant String := Assembly_File_Name (Lib_File);
- ALI : constant String := ALI_File_Name (Lib_File);
- Obj : constant String := Object_File_Name (Lib_File);
- Adt : constant String := Tree_File_Name (Lib_File);
- Deb : constant String :=
- Debug_File_Name (File_Name1);
- Rep : constant String :=
- Repinfo_File_Name (File_Name1);
- Del : Boolean := True;
+ declare
+ Asm : constant String :=
+ Assembly_File_Name (Lib_File);
+ ALI : constant String :=
+ ALI_File_Name (Lib_File);
+ Obj : constant String :=
+ Object_File_Name (Lib_File);
+ Adt : constant String :=
+ Tree_File_Name (Lib_File);
+ Deb : constant String :=
+ Debug_File_Name (File_Name1);
+ Rep : constant String :=
+ Repinfo_File_Name (File_Name1);
+ Del : Boolean := True;
- begin
- -- If the ALI file exists and is read-only, no file
- -- is deleted.
+ begin
+ -- If the ALI file exists and is read-only, no file
+ -- is deleted.
- if Is_Regular_File (ALI) then
- if Is_Writable_File (ALI) then
- Delete (Obj_Dir, ALI);
+ if Is_Regular_File (ALI) then
+ if Is_Writable_File (ALI) then
+ Delete (Obj_Dir, ALI);
- else
- Del := False;
+ else
+ Del := False;
- if Verbose_Mode then
- Put ('"');
- Put (Obj_Dir);
+ if Verbose_Mode then
+ Put ('"');
+ Put (Obj_Dir);
- if Obj_Dir (Obj_Dir'Last) /=
+ if Obj_Dir (Obj_Dir'Last) /=
Dir_Separator
- then
- Put (Dir_Separator);
- end if;
+ then
+ Put (Dir_Separator);
+ end if;
- Put (ALI);
- Put_Line (""" is read-only");
+ Put (ALI);
+ Put_Line (""" is read-only");
+ end if;
end if;
end if;
- end if;
- if Del then
+ if Del then
- -- Object file
+ -- Object file
- if Is_Regular_File (Obj) then
- Delete (Obj_Dir, Obj);
- end if;
+ if Is_Regular_File (Obj) then
+ Delete (Obj_Dir, Obj);
+ end if;
- -- Assembly file
+ -- Assembly file
- if Is_Regular_File (Asm) then
- Delete (Obj_Dir, Asm);
- end if;
+ if Is_Regular_File (Asm) then
+ Delete (Obj_Dir, Asm);
+ end if;
- -- Tree file
+ -- Tree file
- if Is_Regular_File (Adt) then
- Delete (Obj_Dir, Adt);
- end if;
+ if Is_Regular_File (Adt) then
+ Delete (Obj_Dir, Adt);
+ end if;
- -- First expanded source file
+ -- First expanded source file
- if Is_Regular_File (Deb) then
- Delete (Obj_Dir, Deb);
- end if;
+ if Is_Regular_File (Deb) then
+ Delete (Obj_Dir, Deb);
+ end if;
- -- Repinfo file
+ -- Repinfo file
- if Is_Regular_File (Rep) then
- Delete (Obj_Dir, Rep);
- end if;
+ if Is_Regular_File (Rep) then
+ Delete (Obj_Dir, Rep);
+ end if;
- -- Second expanded source file
-
- if File_Name2 /= No_Name then
- declare
- Deb : constant String :=
- Debug_File_Name (File_Name2);
- Rep : constant String :=
- Repinfo_File_Name (File_Name2);
- begin
- if Is_Regular_File (Deb) then
- Delete (Obj_Dir, Deb);
- end if;
+ -- Second expanded source file
- if Is_Regular_File (Rep) then
- Delete (Obj_Dir, Rep);
- end if;
- end;
+ if File_Name2 /= No_Name then
+ declare
+ Deb : constant String :=
+ Debug_File_Name (File_Name2);
+ Rep : constant String :=
+ Repinfo_File_Name (File_Name2);
+
+ begin
+ if Is_Regular_File (Deb) then
+ Delete (Obj_Dir, Deb);
+ end if;
+
+ if Is_Regular_File (Rep) then
+ Delete (Obj_Dir, Rep);
+ end if;
+ end;
+ end if;
end if;
- end if;
- end;
- end if;
- end loop;
- end if;
+ end;
+ end if;
+ end loop;
+ end if;
- -- Check if a global archive and it dependency file could have
- -- been created and, if they exist, delete them.
+ -- Check if a global archive and it dependency file could have
+ -- been created and, if they exist, delete them.
- if Project = Main_Project and then not Data.Library then
- Global_Archive := False;
+ if Project = Main_Project and then not Data.Library then
+ Global_Archive := False;
- for Proj in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if Project_Tree.Projects.Table
+ for Proj in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
+ if Project_Tree.Projects.Table
(Proj).Other_Sources_Present
- then
- Global_Archive := True;
- exit;
- end if;
- end loop;
+ then
+ Global_Archive := True;
+ exit;
+ end if;
+ end loop;
- if Global_Archive then
- Clean_Archive (Project);
+ if Global_Archive then
+ Clean_Archive (Project);
+ end if;
end if;
- end if;
-
- if Data.Other_Sources_Present then
- -- There is non-Ada code: delete the object files and
- -- the dependency files if they exist.
+ if Data.Other_Sources_Present then
- Source_Id := Data.First_Other_Source;
+ -- There is non-Ada code: delete the object files and
+ -- the dependency files if they exist.
- while Source_Id /= No_Other_Source loop
- Source :=
- Project_Tree.Other_Sources.Table (Source_Id);
+ Source_Id := Data.First_Other_Source;
+ while Source_Id /= No_Other_Source loop
+ Source :=
+ Project_Tree.Other_Sources.Table (Source_Id);
- if Is_Regular_File
+ if Is_Regular_File
(Get_Name_String (Source.Object_Name))
- then
- Delete (Obj_Dir, Get_Name_String (Source.Object_Name));
- end if;
+ then
+ Delete (Obj_Dir, Get_Name_String (Source.Object_Name));
+ end if;
- if Is_Regular_File (Get_Name_String (Source.Dep_Name)) then
- Delete (Obj_Dir, Get_Name_String (Source.Dep_Name));
- end if;
+ if
+ Is_Regular_File (Get_Name_String (Source.Dep_Name))
+ then
+ Delete (Obj_Dir, Get_Name_String (Source.Dep_Name));
+ end if;
- Source_Id := Source.Next;
- end loop;
+ Source_Id := Source.Next;
+ end loop;
- -- If it is a library with only non Ada sources, delete
- -- the fake archive and the dependency file, if they exist.
+ -- If it is a library with only non Ada sources, delete
+ -- the fake archive and the dependency file, if they exist.
- if Data.Library
- and then not Data.Languages (Ada_Language_Index)
- then
- Clean_Archive (Project);
+ if Data.Library
+ and then not Data.Languages (Ada_Language_Index)
+ then
+ Clean_Archive (Project);
+ end if;
end if;
- end if;
- end;
- end if;
+ end;
+ end if;
- -- If this is a library project, clean the library directory, the
- -- interface copy dir and, for a Stand-Alone Library, the binder
- -- generated files of the library.
+ -- If this is a library project, clean the library directory, the
+ -- interface copy dir and, for a Stand-Alone Library, the binder
+ -- generated files of the library.
- -- The directories are cleaned only if switch -c is not specified
+ -- The directories are cleaned only if switch -c is not specified
- if Data.Library then
- if not Compile_Only then
- Clean_Directory (Data.Library_Dir);
+ if Data.Library then
+ if not Compile_Only then
+ Clean_Library_Directory (Project);
+
+ if Data.Library_Src_Dir /= No_Name then
+ Clean_Interface_Copy_Directory (Project);
+ end if;
+ end if;
- if Data.Library_Src_Dir /= No_Name
- and then Data.Library_Src_Dir /= Data.Library_Dir
+ if Data.Standalone_Library and then
+ Data.Object_Directory /= No_Name
then
- Clean_Directory (Data.Library_Src_Dir);
+ Delete_Binder_Generated_Files
+ (Get_Name_String (Data.Object_Directory), Data.Library_Name);
end if;
end if;
- if Data.Standalone_Library and then
- Data.Object_Directory /= No_Name
- then
- Delete_Binder_Generated_Files
- (Get_Name_String (Data.Object_Directory), Data.Library_Name);
+ if Verbose_Mode then
+ New_Line;
end if;
end if;
- if Verbose_Mode then
- New_Line;
- end if;
-
-- If switch -r is specified, call Clean_Project recursively for the
-- imported projects and the project being extended.
@@ -1610,6 +1835,26 @@ package body Clean is
return Src & Tree_Suffix;
end Tree_File_Name;
+ ---------------------------
+ -- Ultimate_Extension_Of --
+ ---------------------------
+
+ function Ultimate_Extension_Of (Project : Project_Id) return Project_Id is
+ Result : Project_Id := Project;
+ Data : Project_Data;
+
+ begin
+ if Project /= No_Project then
+ loop
+ Data := Project_Tree.Projects.Table (Result);
+ exit when Data.Extended_By = No_Project;
+ Result := Data.Extended_By;
+ end loop;
+ end if;
+
+ return Result;
+ end Ultimate_Extension_Of;
+
-----------
-- Usage --
-----------
diff --git a/gcc/ada/comperr.adb b/gcc/ada/comperr.adb
index 7fc27860c5e..59d0bd28afc 100644
--- a/gcc/ada/comperr.adb
+++ b/gcc/ada/comperr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -99,7 +99,7 @@ package body Comperr is
-- Start of processing for Compiler_Abort
begin
- -- Prevent recursion through Compiler_Abort, e.g. via SIGSEGV.
+ -- Prevent recursion through Compiler_Abort, e.g. via SIGSEGV
if Abort_In_Progress then
Exit_Program (E_Abort);
diff --git a/gcc/ada/csets.ads b/gcc/ada/csets.ads
index 5b612b315c3..44ef68cee38 100644
--- a/gcc/ada/csets.ads
+++ b/gcc/ada/csets.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/cstand.adb b/gcc/ada/cstand.adb
index efd3237bf75..cbe596962e9 100644
--- a/gcc/ada/cstand.adb
+++ b/gcc/ada/cstand.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/cuintp.c b/gcc/ada/cuintp.c
index ff2dfb9027b..7adc057ce7c 100644
--- a/gcc/ada/cuintp.c
+++ b/gcc/ada/cuintp.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2003 Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2005 Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -41,6 +41,7 @@
#include "stringt.h"
#include "fe.h"
#include "gigi.h"
+#include "ada-tree.h"
/* Universal integers are represented by the Uint type which is an index into
the Uints_Ptr table containing Uint_Entry values. A Uint_Entry contains an
@@ -74,22 +75,41 @@ UI_To_gnu (Uint Input, tree type)
{
tree gnu_ret;
+ /* We might have a TYPE with biased representation and be passed an
+ unbiased value that doesn't fit. We always use an unbiased type able
+ to hold any such possible value for intermediate computations, and
+ then rely on a conversion back to TYPE to perform the bias adjustment
+ when need be. */
+
+ int biased_type_p
+ = (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_BIASED_REPRESENTATION_P (type));
+
+ tree comp_type = biased_type_p ? get_base_type (type) : type;
+
if (Input <= Uint_Direct_Last)
- gnu_ret = build_cst_from_int (type, Input - Uint_Direct_Bias);
+ gnu_ret = build_cst_from_int (comp_type, Input - Uint_Direct_Bias);
else
{
Int Idx = Uints_Ptr[Input].Loc;
Pos Length = Uints_Ptr[Input].Length;
Int First = Udigits_Ptr[Idx];
- /* Do computations in integer type or TYPE whichever is wider, then
- convert later. This avoid overflow if type is short integer. */
- tree comp_type
- = ((TREE_CODE (type) == REAL_TYPE
- || TYPE_PRECISION (type) >= TYPE_PRECISION (integer_type_node))
- ? type : integer_type_node);
- tree gnu_base = build_cst_from_int (comp_type, Base);
+ tree gnu_base;
gcc_assert (Length > 0);
+
+ /* The computations we perform below always require a type at least as
+ large as an integer not to overflow. REAL types are always fine, but
+ INTEGER or ENUMERAL types we are handed may be too short. We use a
+ base integer type node for the computations in this case and will
+ convert the final result back to the incoming type later on. */
+
+ if (TREE_CODE (comp_type) != REAL_TYPE
+ && TYPE_PRECISION (comp_type) < TYPE_PRECISION (integer_type_node))
+ comp_type = integer_type_node;
+
+ gnu_base = build_cst_from_int (comp_type, Base);
+
gnu_ret = build_cst_from_int (comp_type, First);
if (First < 0)
for (Idx++, Length--; Length; Idx++, Length--)
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb
index 2fd5b25c673..96e9ca74e7b 100644
--- a/gcc/ada/debug.adb
+++ b/gcc/ada/debug.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -98,7 +98,7 @@ package body Debug is
-- d.c
-- d.d
-- d.e
- -- d.f
+ -- d.f Inhibit folding of static expressions
-- d.g
-- d.h
-- d.i
@@ -132,7 +132,7 @@ package body Debug is
-- Debug flags for binder (GNATBIND)
- -- da
+ -- da All links (including internal units) listed if there is a cycle
-- db
-- dc List units as they are chosen
-- dd
@@ -410,7 +410,7 @@ package body Debug is
-- indications. This debug flag disconnects the tracking of constant
-- values (see Exp_Ch2.Expand_Current_Value).
- -- dN Do not generate file name information in exception messages.
+ -- dN Do not generate file name information in exception messages
-- dO Output immediate error messages. This causes error messages to
-- be output as soon as they are generated (disconnecting several
@@ -461,6 +461,10 @@ package body Debug is
-- had Configurable_Run_Time_Mode set to True. This is useful in
-- testing high integrity mode.
+ -- d.f Suppress folding of static expressions. This of course results
+ -- in seriously non-conforming behavior, but is useful sometimes
+ -- when tracking down handling of complex expressions.
+
-- d.x No exception handlers in generated code. This causes exception
-- handlers to be eliminated from the generated code. They are still
-- fully compiled and analyzed, they just get eliminated from the
@@ -511,6 +515,12 @@ package body Debug is
-- Documentation for Binder Debug Flags --
------------------------------------------
+ -- da Normally if there is an elaboration circularity, then in describing
+ -- the cycle, links involving internal units are omitted, since they
+ -- are irrelevant and confusing. This debug flag causes all links to
+ -- be listed, and is useful when diagnosing circularities introduced
+ -- by incorrect changes to the run-time library itself.
+
-- dc List units as they are chosen. As units are selected for addition to
-- the elaboration order, a line of output is generated showing which
-- unit has been selected.
diff --git a/gcc/ada/debug.ads b/gcc/ada/debug.ads
index 48d71de72ea..2a1ae50ce97 100644
--- a/gcc/ada/debug.ads
+++ b/gcc/ada/debug.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index 5a9c931dca6..bbbb471a3ae 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -35,6 +35,7 @@
#include "ggc.h"
#include "obstack.h"
#include "target.h"
+#include "expr.h"
#include "ada.h"
#include "types.h"
@@ -52,21 +53,14 @@
#include "ada-tree.h"
#include "gigi.h"
-/* Provide default values for the macros controlling stack checking.
- This is copied from GCC's expr.h. */
+/* Convention_Stdcall should be processed in a specific way on Windows targets
+ only. The macro below is a helper to avoid having to check for a Windows
+ specific attribute throughout this unit. */
-#ifndef STACK_CHECK_BUILTIN
-#define STACK_CHECK_BUILTIN 0
-#endif
-#ifndef STACK_CHECK_PROBE_INTERVAL
-#define STACK_CHECK_PROBE_INTERVAL 4096
-#endif
-#ifndef STACK_CHECK_MAX_FRAME_SIZE
-#define STACK_CHECK_MAX_FRAME_SIZE \
- (STACK_CHECK_PROBE_INTERVAL - UNITS_PER_WORD)
-#endif
-#ifndef STACK_CHECK_MAX_VAR_SIZE
-#define STACK_CHECK_MAX_VAR_SIZE (STACK_CHECK_MAX_FRAME_SIZE / 100)
+#if TARGET_DLLIMPORT_DECL_ATTRIBUTES
+#define Has_Stdcall_Convention(E) (Convention (E) == Convention_Stdcall)
+#else
+#define Has_Stdcall_Convention(E) (0)
#endif
/* These two variables are used to defer recursively expanding incomplete
@@ -531,6 +525,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|| TREE_CODE (gnu_type) == VOID_TYPE)
{
gcc_assert (type_annotate_only);
+ if (this_global)
+ force_global--;
return error_mark_node;
}
@@ -670,11 +666,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
{
tree gnu_fat
= TREE_TYPE (gnat_to_gnu_type (Base_Type (Etype (gnat_entity))));
- tree gnu_temp_type
- = TREE_TYPE (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_fat))));
gnu_type
- = build_unc_object_type (gnu_temp_type, gnu_type,
+ = build_unc_object_type_from_ptr (gnu_fat, gnu_type,
concat_id_with_name (gnu_entity_id,
"UNC"));
}
@@ -729,18 +723,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
(TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (gnu_type)))))))
gnu_expr = convert (gnu_type, gnu_expr);
- /* See if this is a renaming. If this is a constant renaming, treat
- it as a normal variable whose initial value is what is being
- renamed. We cannot do this if the type is unconstrained or
- class-wide.
+ /* See if this is a renaming, and handle appropriately depending on
+ what is renamed and in which context. There are three major
+ cases:
+
+ 1/ This is a constant renaming and we can just make an object
+ with what is renamed as its initial value,
- Otherwise, if what we are renaming is a reference, we can simply
- return a stabilized version of that reference, after forcing any
- SAVE_EXPRs to be evaluated. But, if this is at global level, we
- can only do this if we know no SAVE_EXPRs will be made.
+ 2/ We can reuse a stabilized version of what is renamed in place
+ of the renaming,
- Otherwise, make this into a constant pointer to the object we are
- to rename. */
+ 3/ If neither 1 or 2 applies, we make the renaming entity a constant
+ pointer to what is being renamed. */
if (Present (Renamed_Object (gnat_entity)))
{
@@ -756,6 +750,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_type = TREE_TYPE (gnu_expr);
}
+ /* Case 1: If this is a constant renaming, treat it as a normal
+ object whose initial value is what is being renamed. We cannot
+ do this if the type is unconstrained or class-wide. */
if (const_flag
&& !TREE_SIDE_EFFECTS (gnu_expr)
&& TREE_CODE (gnu_type) != UNCONSTRAINED_ARRAY_TYPE
@@ -764,49 +761,100 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& !Is_Array_Type (Etype (gnat_entity)))
;
- /* If this is a declaration or reference that we can stabilize,
- just use that declaration or reference as this entity unless
- the latter has to be materialized. */
- else if ((DECL_P (gnu_expr) || REFERENCE_CLASS_P (gnu_expr))
- && !Materialize_Entity (gnat_entity)
- && (!global_bindings_p ()
- || (staticp (gnu_expr)
- && !TREE_SIDE_EFFECTS (gnu_expr))))
- {
- gnu_decl = gnat_stabilize_reference (gnu_expr, true);
- save_gnu_tree (gnat_entity, gnu_decl, true);
- saved = true;
- break;
- }
-
- /* Otherwise, make this into a constant pointer to the object we
- are to rename and attach the object to the pointer. We need
- to stabilize too since the renaming evaluation may directly
- reference the renamed object instead of the pointer we will
- attach it to. We don't want variables in the expression to
- be evaluated every time the renaming is used, since their
- value may change in between. */
+ /* Otherwise, see if we can proceed with a stabilized version of
+ the renamed entity or if we need to make a pointer. */
else
{
- bool has_side_effects = TREE_SIDE_EFFECTS (gnu_expr);
- inner_const_flag = TREE_READONLY (gnu_expr);
- const_flag = true;
- gnu_type = build_reference_type (gnu_type);
- renamed_obj = gnat_stabilize_reference (gnu_expr, true);
- gnu_expr = build_unary_op (ADDR_EXPR, gnu_type, renamed_obj);
-
- if (!global_bindings_p ())
+ bool stabilized;
+ tree maybe_stable_expr = NULL_TREE;
+
+ /* Case 2: If the renaming entity need not be materialized and
+ the renamed expression is something we can stabilize, use
+ that for the renaming after forcing the evaluation of any
+ SAVE_EXPR. At the global level, we can only do this if we
+ know no SAVE_EXPRs will be made. */
+ if (!Materialize_Entity (gnat_entity)
+ && (!global_bindings_p ()
+ || (staticp (gnu_expr)
+ && !TREE_SIDE_EFFECTS (gnu_expr))))
{
- /* If the original expression had side effects, put a
- SAVE_EXPR around this whole thing. */
- if (has_side_effects)
- gnu_expr = save_expr (gnu_expr);
+ maybe_stable_expr
+ = maybe_stabilize_reference (gnu_expr, true, false,
+ &stabilized);
+
+ if (stabilized)
+ {
+ gnu_decl = maybe_stable_expr;
+ save_gnu_tree (gnat_entity, gnu_decl, true);
+ saved = true;
+ break;
+ }
- add_stmt (gnu_expr);
+ /* The stabilization failed. Keep maybe_stable_expr
+ untouched here to let the pointer case below know
+ about that failure. */
}
- gnu_size = NULL_TREE;
- used_by_ref = true;
+ /* Case 3: Make this into a constant pointer to the object we
+ are to rename and attach the object to the pointer if it is
+ an lvalue that can be stabilized.
+
+ From the proper scope, attached objects will be referenced
+ directly instead of indirectly via the pointer to avoid
+ subtle aliasing problems with non addressable entities.
+ They have to be stable because we must not evaluate the
+ variables in the expression every time the renaming is used.
+ They also have to be lvalues because the context in which
+ they are reused sometimes requires so. We call pointers
+ with an attached object "renaming" pointers.
+
+ In the rare cases where we cannot stabilize the renamed
+ object, we just make a "bare" pointer, and the renamed
+ entity is always accessed indirectly through it. */
+ {
+ bool has_side_effects = TREE_SIDE_EFFECTS (gnu_expr);
+ inner_const_flag = TREE_READONLY (gnu_expr);
+ const_flag = true;
+ gnu_type = build_reference_type (gnu_type);
+
+ /* If a previous attempt at unrestricted
+ stabilization failed, there is no point trying
+ again and we can reuse the result without
+ attaching it to the pointer. */
+ if (maybe_stable_expr)
+ ;
+
+ /* Otherwise, try to stabilize now, restricting to
+ lvalues only, and attach the expression to the pointer
+ if the stabilization succeeds. */
+ else
+ {
+ maybe_stable_expr
+ = maybe_stabilize_reference (gnu_expr, true, true,
+ &stabilized);
+
+ if (stabilized)
+ renamed_obj = maybe_stable_expr;
+ /* Attaching is actually performed downstream, as soon
+ as we have a DECL for the pointer we make. */
+ }
+
+ gnu_expr
+ = build_unary_op (ADDR_EXPR, gnu_type, maybe_stable_expr);
+
+ if (!global_bindings_p ())
+ {
+ /* If the original expression had side effects, put a
+ SAVE_EXPR around this whole thing. */
+ if (has_side_effects)
+ gnu_expr = save_expr (gnu_expr);
+
+ add_stmt (gnu_expr);
+ }
+
+ gnu_size = NULL_TREE;
+ used_by_ref = true;
+ }
}
}
@@ -894,10 +942,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
imported. */
if ((!definition && Present (Address_Clause (gnat_entity)))
|| (Is_Imported (gnat_entity)
- && Convention (gnat_entity) == Convention_Stdcall))
+ && Has_Stdcall_Convention (gnat_entity)))
{
gnu_type = build_reference_type (gnu_type);
gnu_size = NULL_TREE;
+
+ gnu_expr = NULL_TREE;
+ /* No point in taking the address of an initializing expression
+ that isn't going to be used. */
+
used_by_ref = true;
}
@@ -1495,19 +1548,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
TYPE_READONLY (gnu_template_type) = 1;
/* Make a node for the array. If we are not defining the array
- suppress expanding incomplete types and save the node as the type
- for GNAT_ENTITY. */
+ suppress expanding incomplete types. */
gnu_type = make_node (UNCONSTRAINED_ARRAY_TYPE);
+
if (!definition)
- {
- defer_incomplete_level++;
- this_deferred = this_made_decl = true;
- gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list,
- !Comes_From_Source (gnat_entity),
- debug_info_p, gnat_entity);
- save_gnu_tree (gnat_entity, gnu_decl, false);
- saved = true;
- }
+ defer_incomplete_level++, this_deferred = true;
/* Build the fat pointer type. Use a "void *" object instead of
a pointer to the array type since we don't have the array type
@@ -2310,9 +2355,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
}
/* Make a node for the record. If we are not defining the record,
- suppress expanding incomplete types and save the node as the type
- for GNAT_ENTITY. We use the same RECORD_TYPE as for a dummy type
- and reset TYPE_DUMMY_P to show it's no longer a dummy.
+ suppress expanding incomplete types. We use the same RECORD_TYPE
+ as for a dummy type and reset TYPE_DUMMY_P to show it's no longer
+ a dummy.
It is very tempting to delay resetting this bit until we are done
with completing the type, e.g. to let possible intermediate
@@ -2335,15 +2380,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
TYPE_PACKED (gnu_type) = packed || has_rep;
if (!definition)
- {
- defer_incomplete_level++;
- this_deferred = true;
- gnu_decl = create_type_decl (gnu_entity_id, gnu_type, attr_list,
- !Comes_From_Source (gnat_entity),
- debug_info_p, gnat_entity);
- save_gnu_tree (gnat_entity, gnu_decl, false);
- this_made_decl = saved = true;
- }
+ defer_incomplete_level++, this_deferred = true;
/* If both a size and rep clause was specified, put the size in
the record type now so that it can get the proper mode. */
@@ -3642,8 +3679,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (list_length (gnu_return_list) == 1)
gnu_return_type = TREE_TYPE (TREE_PURPOSE (gnu_return_list));
-#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
- if (Convention (gnat_entity) == Convention_Stdcall)
+ if (Has_Stdcall_Convention (gnat_entity))
{
struct attrib *attr
= (struct attrib *) xmalloc (sizeof (struct attrib));
@@ -3655,7 +3691,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
attr->error_point = gnat_entity;
attr_list = attr;
}
-#endif
/* Both lists ware built in reverse. */
gnu_param_list = nreverse (gnu_param_list);
@@ -3766,14 +3801,23 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
compiling, then just get the type from its Etype. */
if (No (Full_View (gnat_entity)))
{
- /* If this is an incomplete type with no full view, it must
- be a Taft Amendement type, so just return a dummy type. */
+ /* If this is an incomplete type with no full view, it must be
+ either a limited view brought in by a limited_with clause, in
+ which case we use the non-limited view, or a Taft Amendement
+ type, in which case we just return a dummy type. */
if (kind == E_Incomplete_Type)
- gnu_type = make_dummy_type (gnat_entity);
+ {
+ if (From_With_Type (gnat_entity)
+ && Present (Non_Limited_View (gnat_entity)))
+ gnu_decl = gnat_to_gnu_entity (Non_Limited_View (gnat_entity),
+ NULL_TREE, 0);
+ else
+ gnu_type = make_dummy_type (gnat_entity);
+ }
- else if (Present (Underlying_Full_View (gnat_entity)))
- gnu_decl = gnat_to_gnu_entity (Underlying_Full_View (gnat_entity),
- NULL_TREE, 0);
+ else if (Present (Underlying_Full_View (gnat_entity)))
+ gnu_decl = gnat_to_gnu_entity (Underlying_Full_View (gnat_entity),
+ NULL_TREE, 0);
else
{
gnu_decl = gnat_to_gnu_entity (Etype (gnat_entity),
@@ -4087,7 +4131,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
DECL_ARTIFICIAL (gnu_decl) = 1;
if (!debug_info_p && DECL_P (gnu_decl)
- && TREE_CODE (gnu_decl) != FUNCTION_DECL)
+ && TREE_CODE (gnu_decl) != FUNCTION_DECL
+ && No (Renamed_Object (gnat_entity)))
DECL_IGNORED_P (gnu_decl) = 1;
/* If we haven't already, associate the ..._DECL node that we just made with
@@ -4703,9 +4748,9 @@ elaborate_expression_1 (Node_Id gnat_expr, Entity_Id gnat_entity,
gnu_decl
= create_var_decl (create_concat_name (gnat_entity,
IDENTIFIER_POINTER (gnu_name)),
- NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, true,
- Is_Public (gnat_entity), !definition, false, NULL,
- gnat_entity);
+ NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr,
+ !need_debug, Is_Public (gnat_entity),
+ !definition, false, NULL, gnat_entity);
/* We only need to use this variable if we are in global context since GCC
can do the right thing in the local case. */
@@ -5812,6 +5857,7 @@ annotate_value (tree gnu_size)
case TRUTH_OR_EXPR: tcode = Truth_Or_Expr; break;
case TRUTH_XOR_EXPR: tcode = Truth_Xor_Expr; break;
case TRUTH_NOT_EXPR: tcode = Truth_Not_Expr; break;
+ case BIT_AND_EXPR: tcode = Bit_And_Expr; break;
case LT_EXPR: tcode = Lt_Expr; break;
case LE_EXPR: tcode = Le_Expr; break;
case GT_EXPR: tcode = Gt_Expr; break;
@@ -5898,8 +5944,7 @@ annotate_rep (Entity_Id gnat_entity, tree gnu_type)
Set_Esize (gnat_field,
annotate_value (DECL_SIZE (TREE_PURPOSE (gnu_entry))));
}
- else if (type_annotate_only
- && Is_Tagged_Type (gnat_entity)
+ else if (Is_Tagged_Type (gnat_entity)
&& Is_Derived_Type (gnat_entity))
{
/* If there is no gnu_entry, this is an inherited component whose
@@ -6638,32 +6683,28 @@ rm_size (tree gnu_type)
tree
create_concat_name (Entity_Id gnat_entity, const char *suffix)
{
+ Entity_Kind kind = Ekind (gnat_entity);
+
const char *str = (!suffix ? "" : suffix);
String_Template temp = {1, strlen (str)};
Fat_Pointer fp = {str, &temp};
Get_External_Name_With_Suffix (gnat_entity, fp);
-#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
/* A variable using the Stdcall convention (meaning we are running
on a Windows box) live in a DLL. Here we adjust its name to use
the jump-table, the _imp__NAME contains the address for the NAME
variable. */
- {
- Entity_Kind kind = Ekind (gnat_entity);
- const char *prefix = "_imp__";
- int plen = strlen (prefix);
+ if ((kind == E_Variable || kind == E_Constant)
+ && Has_Stdcall_Convention (gnat_entity))
+ {
+ const char *prefix = "_imp__";
+ int k, plen = strlen (prefix);
- if ((kind == E_Variable || kind == E_Constant)
- && Convention (gnat_entity) == Convention_Stdcall)
- {
- int k;
- for (k = 0; k <= Name_Len; k++)
- Name_Buffer [Name_Len - k + plen] = Name_Buffer [Name_Len - k];
- strncpy (Name_Buffer, prefix, plen);
- }
- }
-#endif
+ for (k = 0; k <= Name_Len; k++)
+ Name_Buffer [Name_Len - k + plen] = Name_Buffer [Name_Len - k];
+ strncpy (Name_Buffer, prefix, plen);
+ }
return get_identifier (Name_Buffer);
}
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index db446143abb..c126bd88e33 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -214,8 +214,10 @@ package body Einfo is
-- Abstract_Interfaces Elist24
-- Abstract_Interface_Alias Node25
+ -- Current_Use_Clause Node25
-- Overridden_Operation Node26
+ -- Package_Instantiation Node26
-- Wrapped_Entity Node27
@@ -388,7 +390,7 @@ package body Einfo is
-- Has_Recursive_Call Flag143
-- Is_Unsigned_Type Flag144
-- Strict_Alignment Flag145
- -- Elaborate_All_Desirable Flag146
+ -- (unused) Flag146
-- Needs_Debug_Info Flag147
-- Suppress_Elaboration_Warnings Flag148
-- Is_Compilation_Unit Flag149
@@ -444,12 +446,13 @@ package body Einfo is
-- Is_Local_Anonymous_Access Flag194
-- Is_Primitive_Wrapper Flag195
-- Was_Hidden Flag196
+ -- Is_Limited_Interface Flag197
+ -- Is_Protected_Interface Flag198
+ -- Is_Synchronized_Interface Flag199
+ -- Is_Task_Interface Flag200
+
+ -- Has_Anon_Block_Suffix Flag201
- -- (unused) Flag197
- -- (unused) Flag198
- -- (unused) Flag199
- -- (unused) Flag200
- -- (unused) Flag201
-- (unused) Flag202
-- (unused) Flag203
-- (unused) Flag204
@@ -698,6 +701,12 @@ package body Einfo is
return Node22 (Id);
end Corresponding_Remote_Type;
+ function Current_Use_Clause (Id : E) return E is
+ begin
+ pragma Assert (Ekind (Id) = E_Package);
+ return Node25 (Id);
+ end Current_Use_Clause;
+
function Current_Value (Id : E) return N is
begin
pragma Assert (Ekind (Id) in Object_Kind);
@@ -839,11 +848,6 @@ package body Einfo is
return Node16 (Id);
end DTC_Entity;
- function Elaborate_All_Desirable (Id : E) return B is
- begin
- return Flag146 (Id);
- end Elaborate_All_Desirable;
-
function Elaboration_Entity (Id : E) return E is
begin
pragma Assert
@@ -1073,6 +1077,11 @@ package body Einfo is
return Flag79 (Id);
end Has_All_Calls_Remote;
+ function Has_Anon_Block_Suffix (Id : E) return B is
+ begin
+ return Flag201 (Id);
+ end Has_Anon_Block_Suffix;
+
function Has_Atomic_Components (Id : E) return B is
begin
return Flag86 (Implementation_Base_Type (Id));
@@ -1667,6 +1676,12 @@ package body Einfo is
return Flag106 (Id);
end Is_Limited_Composite;
+ function Is_Limited_Interface (Id : E) return B is
+ begin
+ pragma Assert (Is_Interface (Id));
+ return Flag197 (Id);
+ end Is_Limited_Interface;
+
function Is_Limited_Record (Id : E) return B is
begin
return Flag25 (Id);
@@ -1750,6 +1765,12 @@ package body Einfo is
return Flag53 (Id);
end Is_Private_Descendant;
+ function Is_Protected_Interface (Id : E) return B is
+ begin
+ pragma Assert (Is_Interface (Id));
+ return Flag198 (Id);
+ end Is_Protected_Interface;
+
function Is_Public (Id : E) return B is
begin
pragma Assert (Nkind (Id) in N_Entity);
@@ -1792,6 +1813,12 @@ package body Einfo is
return Flag28 (Id);
end Is_Statically_Allocated;
+ function Is_Synchronized_Interface (Id : E) return B is
+ begin
+ pragma Assert (Is_Interface (Id));
+ return Flag199 (Id);
+ end Is_Synchronized_Interface;
+
function Is_Tag (Id : E) return B is
begin
pragma Assert (Nkind (Id) in N_Entity);
@@ -1803,6 +1830,12 @@ package body Einfo is
return Flag55 (Id);
end Is_Tagged_Type;
+ function Is_Task_Interface (Id : E) return B is
+ begin
+ pragma Assert (Is_Interface (Id));
+ return Flag200 (Id);
+ end Is_Task_Interface;
+
function Is_Thread_Body (Id : E) return B is
begin
return Flag77 (Id);
@@ -2016,7 +2049,8 @@ package body Einfo is
function Obsolescent_Warning (Id : E) return N is
begin
- pragma Assert (Is_Subprogram (Id));
+ pragma Assert
+ (Is_Subprogram (Id) or else Is_Package_Or_Generic_Package (Id));
return Node24 (Id);
end Obsolescent_Warning;
@@ -2048,6 +2082,15 @@ package body Einfo is
return Node26 (Id);
end Overridden_Operation;
+ function Package_Instantiation (Id : E) return N is
+ begin
+ pragma Assert
+ (False
+ or else Ekind (Id) = E_Generic_Package
+ or else Ekind (Id) = E_Package);
+ return Node26 (Id);
+ end Package_Instantiation;
+
function Packed_Array_Type (Id : E) return E is
begin
pragma Assert (Is_Array_Type (Id));
@@ -2744,7 +2787,13 @@ package body Einfo is
Set_Node22 (Id, V);
end Set_Corresponding_Remote_Type;
- procedure Set_Current_Value (Id : E; V : E) is
+ procedure Set_Current_Use_Clause (Id : E; V : E) is
+ begin
+ pragma Assert (Ekind (Id) = E_Package);
+ Set_Node25 (Id, V);
+ end Set_Current_Use_Clause;
+
+ procedure Set_Current_Value (Id : E; V : N) is
begin
pragma Assert (Ekind (Id) in Object_Kind or else Ekind (Id) = E_Void);
Set_Node9 (Id, V);
@@ -2888,11 +2937,6 @@ package body Einfo is
Set_Node16 (Id, V);
end Set_DTC_Entity;
- procedure Set_Elaborate_All_Desirable (Id : E; V : B := True) is
- begin
- Set_Flag146 (Id, V);
- end Set_Elaborate_All_Desirable;
-
procedure Set_Elaboration_Entity (Id : E; V : E) is
begin
pragma Assert
@@ -3126,6 +3170,11 @@ package body Einfo is
Set_Flag79 (Id, V);
end Set_Has_All_Calls_Remote;
+ procedure Set_Has_Anon_Block_Suffix (Id : E; V : B := True) is
+ begin
+ Set_Flag201 (Id, V);
+ end Set_Has_Anon_Block_Suffix;
+
procedure Set_Has_Atomic_Components (Id : E; V : B := True) is
begin
pragma Assert (not Is_Type (Id) or else Base_Type (Id) = Id);
@@ -3754,6 +3803,12 @@ package body Einfo is
Set_Flag106 (Id, V);
end Set_Is_Limited_Composite;
+ procedure Set_Is_Limited_Interface (Id : E; V : B := True) is
+ begin
+ pragma Assert (Is_Interface (Id));
+ Set_Flag197 (Id, V);
+ end Set_Is_Limited_Interface;
+
procedure Set_Is_Limited_Record (Id : E; V : B := True) is
begin
Set_Flag25 (Id, V);
@@ -3838,6 +3893,12 @@ package body Einfo is
Set_Flag53 (Id, V);
end Set_Is_Private_Descendant;
+ procedure Set_Is_Protected_Interface (Id : E; V : B := True) is
+ begin
+ pragma Assert (Is_Interface (Id));
+ Set_Flag198 (Id, V);
+ end Set_Is_Protected_Interface;
+
procedure Set_Is_Public (Id : E; V : B := True) is
begin
pragma Assert (Nkind (Id) in N_Entity);
@@ -3886,6 +3947,12 @@ package body Einfo is
Set_Flag28 (Id, V);
end Set_Is_Statically_Allocated;
+ procedure Set_Is_Synchronized_Interface (Id : E; V : B := True) is
+ begin
+ pragma Assert (Is_Interface (Id));
+ Set_Flag199 (Id, V);
+ end Set_Is_Synchronized_Interface;
+
procedure Set_Is_Tag (Id : E; V : B := True) is
begin
pragma Assert (Nkind (Id) in N_Entity);
@@ -3902,6 +3969,12 @@ package body Einfo is
Set_Flag77 (Id, V);
end Set_Is_Thread_Body;
+ procedure Set_Is_Task_Interface (Id : E; V : B := True) is
+ begin
+ pragma Assert (Is_Interface (Id));
+ Set_Flag200 (Id, V);
+ end Set_Is_Task_Interface;
+
procedure Set_Is_True_Constant (Id : E; V : B := True) is
begin
Set_Flag163 (Id, V);
@@ -4108,7 +4181,8 @@ package body Einfo is
procedure Set_Obsolescent_Warning (Id : E; V : N) is
begin
- pragma Assert (Is_Subprogram (Id));
+ pragma Assert
+ (Is_Subprogram (Id) or else Is_Package_Or_Generic_Package (Id));
Set_Node24 (Id, V);
end Set_Obsolescent_Warning;
@@ -4140,6 +4214,15 @@ package body Einfo is
Set_Node26 (Id, V);
end Set_Overridden_Operation;
+ procedure Set_Package_Instantiation (Id : E; V : N) is
+ begin
+ pragma Assert
+ (Ekind (Id) = E_Void
+ or else Ekind (Id) = E_Generic_Package
+ or else Ekind (Id) = E_Package);
+ Set_Node26 (Id, V);
+ end Set_Package_Instantiation;
+
procedure Set_Packed_Array_Type (Id : E; V : E) is
begin
pragma Assert (Is_Array_Type (Id));
@@ -5693,17 +5776,17 @@ package body Einfo is
end if;
end Is_Limited_Type;
- ----------------
- -- Is_Package --
- ----------------
+ -----------------------------------
+ -- Is_Package_Or_Generic_Package --
+ -----------------------------------
- function Is_Package (Id : E) return B is
+ function Is_Package_Or_Generic_Package (Id : E) return B is
begin
return
Ekind (Id) = E_Package
or else
Ekind (Id) = E_Generic_Package;
- end Is_Package;
+ end Is_Package_Or_Generic_Package;
--------------------------
-- Is_Protected_Private --
@@ -6466,7 +6549,6 @@ package body Einfo is
W ("Delay_Subprogram_Descriptors", Flag50 (Id));
W ("Depends_On_Private", Flag14 (Id));
W ("Discard_Names", Flag88 (Id));
- W ("Elaborate_All_Desirable", Flag146 (Id));
W ("Elaboration_Entity_Required", Flag174 (Id));
W ("Entry_Accepted", Flag152 (Id));
W ("Finalize_Storage_Only", Flag158 (Id));
@@ -6475,6 +6557,7 @@ package body Einfo is
W ("Has_Aliased_Components", Flag135 (Id));
W ("Has_Alignment_Clause", Flag46 (Id));
W ("Has_All_Calls_Remote", Flag79 (Id));
+ W ("Has_Anon_Block_Suffix", Flag201 (Id));
W ("Has_Atomic_Components", Flag86 (Id));
W ("Has_Biased_Representation", Flag139 (Id));
W ("Has_Completion", Flag26 (Id));
@@ -6580,6 +6663,7 @@ package body Einfo is
W ("Is_Known_Valid", Flag37 (Id));
W ("Is_Known_Valid", Flag170 (Id));
W ("Is_Limited_Composite", Flag106 (Id));
+ W ("Is_Limited_Interface", Flag197 (Id));
W ("Is_Limited_Record", Flag25 (Id));
W ("Is_Machine_Code_Subprogram", Flag137 (Id));
W ("Is_Non_Static_Subtype", Flag109 (Id));
@@ -6595,6 +6679,7 @@ package body Einfo is
W ("Is_Primitive_Wrapper", Flag195 (Id));
W ("Is_Private_Composite", Flag107 (Id));
W ("Is_Private_Descendant", Flag53 (Id));
+ W ("Is_Protected_Interface", Flag198 (Id));
W ("Is_Public", Flag10 (Id));
W ("Is_Pure", Flag44 (Id));
W ("Is_Pure_Unit_Access_Type", Flag189 (Id));
@@ -6602,9 +6687,11 @@ package body Einfo is
W ("Is_Remote_Types", Flag61 (Id));
W ("Is_Renaming_Of_Object", Flag112 (Id));
W ("Is_Shared_Passive", Flag60 (Id));
+ W ("Is_Synchronized_Interface", Flag199 (Id));
W ("Is_Statically_Allocated", Flag28 (Id));
W ("Is_Tag", Flag78 (Id));
W ("Is_Tagged_Type", Flag55 (Id));
+ W ("Is_Task_Interface", Flag200 (Id));
W ("Is_Thread_Body", Flag77 (Id));
W ("Is_True_Constant", Flag163 (Id));
W ("Is_Unchecked_Union", Flag117 (Id));
@@ -7526,7 +7613,9 @@ package body Einfo is
E_Record_Subtype_With_Private =>
Write_Str ("Abstract_Interfaces");
- when Subprogram_Kind =>
+ when Subprogram_Kind |
+ E_Package |
+ E_Generic_Package =>
Write_Str ("Obsolescent_Warning");
when Task_Kind =>
@@ -7548,6 +7637,9 @@ package body Einfo is
E_Function =>
Write_Str ("Abstract_Interface_Alias");
+ when E_Package =>
+ Write_Str ("Current_Use_Clause");
+
when others =>
Write_Str ("Field25??");
end case;
@@ -7560,6 +7652,10 @@ package body Einfo is
procedure Write_Field26_Name (Id : Entity_Id) is
begin
case Ekind (Id) is
+ when E_Generic_Package |
+ E_Package =>
+ Write_Str ("Package_Instantiation");
+
when E_Procedure |
E_Function =>
Write_Str ("Overridden_Operation");
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 189a9ecfffe..fa1e5841674 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -594,6 +594,11 @@ package Einfo is
-- created at the same time as the discriminal, and used to replace
-- occurrences of the discriminant within the type declaration.
+-- Current_Use_Clause (Node25)
+-- Present in packages. Indicates the use clause currently in scope
+-- that makes the package use_visible. Used to detect redundant use
+-- clauses for the same package.
+
-- Current_Value (Node9)
-- Present in E_Variable, E_Out_Parameter and E_In_Out_Parameter
-- entities. Set non-Empty if the (constant) current value of the
@@ -801,13 +806,6 @@ package Einfo is
-- Present in all entities. Contains a value of the enumeration type
-- Entity_Kind declared in a subsequent section in this spec.
--- Elaborate_All_Desirable (Flag146)
--- Present in package and subprogram entities, and in generic package
--- and subprogram entities. Set if internal analysis of a client that
--- with's this unit determines that Elaborate_All is desirable, i.e.
--- that there is a possibility that Program_Error may be raised if
--- Elaborate_All conditions cannot be met.
-
-- Elaboration_Entity (Node13)
-- Present in generic and non-generic package and subprogram
-- entities. This is a boolean entity associated with the unit that
@@ -1230,6 +1228,11 @@ package Einfo is
-- be RCI entities, so the flag Is_Remote_Call_Interface will always
-- be set if this flag is set.
+-- Has_Anon_Block_Suffix (Flag201)
+-- Present in all entities. Set if the entity is nested within one or
+-- more anonymous blocks and the Chars field contains a name with an
+-- anonymous block suffix (see Exp_Dbug for furthert details).
+
-- Has_Atomic_Components (Flag86) [implementation base type only]
-- Present in all types and objects. Set only for an array type or
-- an array object if a valid pragma Atomic_Components applies to the
@@ -2106,6 +2109,10 @@ package Einfo is
-- do not become visible until the immediate scope of the composite
-- type itself (RM 7.3.1 (5)).
+-- Is_Limited_Interface (Flag197)
+-- Present in types that are interfaces. True if interface is declared
+-- limited, or is derived from limited interfaces.
+
-- Is_Limited_Record (Flag25)
-- Present in all entities. Set to true for record (sub)types if the
-- record is declared to be limited. Note that this flag is not set
@@ -2159,8 +2166,8 @@ package Einfo is
-- including generic formal parameters.
-- Is_Obsolescent (Flag153)
--- Present in all entities. Set only for subprograms when a valid pragma
--- Obsolescent applies to the subprogram.
+-- Present in all entities. Set only for packages and subprograms to
+-- which a valid pragma Obsolescent applies.
-- Is_Optional_Parameter (Flag134)
-- Present in parameter entities. Set if the parameter is specified as
@@ -2175,7 +2182,7 @@ package Einfo is
-- Present in subprograms. Set if the subprogram is a primitive
-- operation of a derived type, that overrides an inherited operation.
--- Is_Package (synthesized)
+-- Is_Package_Or_Generic_Package (synthesized)
-- Applies to all entities. True for packages and generic packages.
-- False for all other entities.
@@ -2264,6 +2271,10 @@ package Einfo is
-- Applies to all entities, true for private types and subtypes,
-- as well as for record with private types as subtypes
+-- Is_Protected_Interface (Flag198)
+-- Present in types that are interfaces. True if interface is declared
+-- protected, or is derived from protected interfaces.
+
-- Is_Protected_Type (synthesized)
-- Applies to all entities, true for protected types and subtypes
@@ -2358,6 +2369,10 @@ package Einfo is
-- or a string slice type, or an array type with one dimension and a
-- component type that is a character type.
+-- Is_Synchronized_Interface (Flag199)
+-- Present_types that are interfaces. True is interface is declared
+-- synchronized, or is derived from synchronized interfaces.
+
-- Is_Tag (Flag78)
-- Present in E_Component. For regular tagged type this flag is set on
-- the tag component (whose name is Name_uTag) and for CPP_Class tagged
@@ -2367,6 +2382,10 @@ package Einfo is
-- Is_Tagged_Type (Flag55)
-- Present in all entities, true for an entity for a tagged type.
+-- Is_Task_Interface (Flag200)
+-- Present in types that are interfaces. True is interface is declared
+-- as such, or if it is derived from task interfaces.
+
-- Is_Task_Record_Type (synthesized)
-- Applies to all entities, true if Is_Concurrent_Record_Type
-- Corresponding_Concurrent_Type is a task type.
@@ -2732,8 +2751,8 @@ package Einfo is
-- formals as a value of type Pos.
-- Obsolescent_Warning (Node24)
--- Present in subprogram entities. Set non-empty only if the pragma
--- Obsolescent had a string argument, in which case it records the
+-- Present in package and subprogram entities. Set non-empty only if the
+-- pragma Obsolescent had a string argument, in which case it records the
-- contents of the corresponding string literal node.
-- Original_Access_Type (Node21)
@@ -2778,6 +2797,18 @@ package Einfo is
-- Present in subprograms. For overriding operations, points to the
-- user-defined parent subprogram that is being overridden.
+-- Package_Instantiation (Node26)
+-- Present in packages and generic packages. When present, this field
+-- references an N_Package_Instantiation node associated with an
+-- instantiated package. In the case where the referenced node has
+-- been rewritten to an N_Package_Specification, the instantiation
+-- node is available from the Original_Node field of the package spec
+-- node. This is currently not guaranteed to be set in all cases, but
+-- when set, the field is used in Get_Package_Instantiation_Node as
+-- one of the means of obtaining the instantiation node. Eventually
+-- it should be set in all cases, including package entities associated
+-- with formal packages. ???
+
-- Packed_Array_Type (Node23)
-- Present in array types and subtypes, including the string literal
-- subtype case, if the corresponding type is packed (either bit packed
@@ -4009,6 +4040,7 @@ package Einfo is
-- Can_Never_Be_Null (Flag38)
-- Checks_May_Be_Suppressed (Flag31)
-- Debug_Info_Off (Flag166)
+ -- Has_Anon_Block_Suffix (Flag201)
-- Has_Controlled_Component (Flag43) (base type only)
-- Has_Convention_Pragma (Flag119)
-- Has_Delayed_Freeze (Flag18)
@@ -4123,6 +4155,10 @@ package Einfo is
-- Is_Frozen (Flag4)
-- Is_Generic_Actual_Type (Flag94)
-- Is_Generic_Type (Flag13)
+ -- Is_Limited_Interface (Flag197)
+ -- Is_Protected_Interface (Flag198)
+ -- Is_Synchronized_Interface (Flag199)
+ -- Is_Task_Interface (Flag200)
-- Is_Non_Static_Subtype (Flag109)
-- Is_Packed (Flag51) (base type only)
-- Is_Private_Composite (Flag107)
@@ -4428,7 +4464,6 @@ package Einfo is
-- Delay_Cleanups (Flag114)
-- Delay_Subprogram_Descriptors (Flag50)
-- Discard_Names (Flag88)
- -- Elaborate_All_Desirable (Flag146)
-- Has_Completion (Flag26)
-- Has_Controlling_Result (Flag98)
-- Has_Master_Entity (Flag21)
@@ -4596,10 +4631,12 @@ package Einfo is
-- Generic_Renamings (Elist23) (for an instance)
-- Inner_Instances (Elist23) (generic case only)
-- Limited_View (Node23) (non-generic, not instance)
+ -- Obsolescent_Warning (Node24)
+ -- Current_Use_Clause (Node25)
+ -- Package_Instantiation (Node26)
-- Delay_Subprogram_Descriptors (Flag50)
-- Body_Needed_For_SAL (Flag40)
-- Discard_Names (Flag88)
- -- Elaborate_All_Desirable (Flag146)
-- Elaboration_Entity_Required (Flag174)
-- From_With_Type (Flag159)
-- Has_All_Calls_Remote (Flag79)
@@ -4678,7 +4715,6 @@ package Einfo is
-- Delay_Cleanups (Flag114)
-- Delay_Subprogram_Descriptors (Flag50)
-- Discard_Names (Flag88)
- -- Elaborate_All_Desirable (Flag146)
-- Has_Completion (Flag26)
-- Has_Master_Entity (Flag21)
-- Has_Nested_Block_With_Handler (Flag101)
@@ -5145,6 +5181,7 @@ package Einfo is
function Corresponding_Equality (Id : E) return E;
function Corresponding_Record_Type (Id : E) return E;
function Corresponding_Remote_Type (Id : E) return E;
+ function Current_Use_Clause (Id : E) return E;
function Current_Value (Id : E) return N;
function Debug_Info_Off (Id : E) return B;
function Debug_Renaming_Link (Id : E) return E;
@@ -5168,7 +5205,6 @@ package Einfo is
function Discriminant_Constraint (Id : E) return L;
function Discriminant_Default_Value (Id : E) return N;
function Discriminant_Number (Id : E) return U;
- function Elaborate_All_Desirable (Id : E) return B;
function Elaboration_Entity (Id : E) return E;
function Elaboration_Entity_Required (Id : E) return B;
function Enclosing_Scope (Id : E) return E;
@@ -5208,6 +5244,7 @@ package Einfo is
function Has_Aliased_Components (Id : E) return B;
function Has_Alignment_Clause (Id : E) return B;
function Has_All_Calls_Remote (Id : E) return B;
+ function Has_Anon_Block_Suffix (Id : E) return B;
function Has_Atomic_Components (Id : E) return B;
function Has_Biased_Representation (Id : E) return B;
function Has_Completion (Id : E) return B;
@@ -5314,6 +5351,7 @@ package Einfo is
function Is_Known_Non_Null (Id : E) return B;
function Is_Known_Valid (Id : E) return B;
function Is_Limited_Composite (Id : E) return B;
+ function Is_Limited_Interface (Id : E) return B;
function Is_Machine_Code_Subprogram (Id : E) return B;
function Is_Non_Static_Subtype (Id : E) return B;
function Is_Null_Init_Proc (Id : E) return B;
@@ -5328,6 +5366,7 @@ package Einfo is
function Is_Private_Composite (Id : E) return B;
function Is_Private_Descendant (Id : E) return B;
+ function Is_Protected_Interface (Id : E) return B;
function Is_Public (Id : E) return B;
function Is_Pure (Id : E) return B;
function Is_Pure_Unit_Access_Type (Id : E) return B;
@@ -5336,8 +5375,10 @@ package Einfo is
function Is_Renaming_Of_Object (Id : E) return B;
function Is_Shared_Passive (Id : E) return B;
function Is_Statically_Allocated (Id : E) return B;
+ function Is_Synchronized_Interface (Id : E) return B;
function Is_Tag (Id : E) return B;
function Is_Tagged_Type (Id : E) return B;
+ function Is_Task_Interface (Id : E) return B;
function Is_Thread_Body (Id : E) return B;
function Is_True_Constant (Id : E) return B;
function Is_Unchecked_Union (Id : E) return B;
@@ -5379,6 +5420,7 @@ package Einfo is
function Original_Array_Type (Id : E) return E;
function Original_Record_Component (Id : E) return E;
function Overridden_Operation (Id : E) return E;
+ function Package_Instantiation (Id : E) return N;
function Packed_Array_Type (Id : E) return E;
function Parent_Subtype (Id : E) return E;
function Primitive_Operations (Id : E) return L;
@@ -5519,7 +5561,7 @@ package Einfo is
function Is_Dynamic_Scope (Id : E) return B;
function Is_Indefinite_Subtype (Id : E) return B;
function Is_Limited_Type (Id : E) return B;
- function Is_Package (Id : E) return B;
+ function Is_Package_Or_Generic_Package (Id : E) return B;
function Is_Protected_Private (Id : E) return B;
function Is_Protected_Record_Type (Id : E) return B;
function Is_Return_By_Reference_Type (Id : E) return B;
@@ -5638,6 +5680,7 @@ package Einfo is
procedure Set_Corresponding_Equality (Id : E; V : E);
procedure Set_Corresponding_Record_Type (Id : E; V : E);
procedure Set_Corresponding_Remote_Type (Id : E; V : E);
+ procedure Set_Current_Use_Clause (Id : E; V : E);
procedure Set_Current_Value (Id : E; V : N);
procedure Set_Debug_Info_Off (Id : E; V : B := True);
procedure Set_Debug_Renaming_Link (Id : E; V : E);
@@ -5661,7 +5704,6 @@ package Einfo is
procedure Set_Discriminant_Constraint (Id : E; V : L);
procedure Set_Discriminant_Default_Value (Id : E; V : N);
procedure Set_Discriminant_Number (Id : E; V : U);
- procedure Set_Elaborate_All_Desirable (Id : E; V : B := True);
procedure Set_Elaboration_Entity (Id : E; V : E);
procedure Set_Elaboration_Entity_Required (Id : E; V : B := True);
procedure Set_Enclosing_Scope (Id : E; V : E);
@@ -5700,6 +5742,7 @@ package Einfo is
procedure Set_Has_Aliased_Components (Id : E; V : B := True);
procedure Set_Has_Alignment_Clause (Id : E; V : B := True);
procedure Set_Has_All_Calls_Remote (Id : E; V : B := True);
+ procedure Set_Has_Anon_Block_Suffix (Id : E; V : B := True);
procedure Set_Has_Atomic_Components (Id : E; V : B := True);
procedure Set_Has_Biased_Representation (Id : E; V : B := True);
procedure Set_Has_Completion (Id : E; V : B := True);
@@ -5810,6 +5853,7 @@ package Einfo is
procedure Set_Is_Known_Non_Null (Id : E; V : B := True);
procedure Set_Is_Known_Valid (Id : E; V : B := True);
procedure Set_Is_Limited_Composite (Id : E; V : B := True);
+ procedure Set_Is_Limited_Interface (Id : E; V : B := True);
procedure Set_Is_Limited_Record (Id : E; V : B := True);
procedure Set_Is_Machine_Code_Subprogram (Id : E; V : B := True);
procedure Set_Is_Non_Static_Subtype (Id : E; V : B := True);
@@ -5823,9 +5867,9 @@ package Einfo is
procedure Set_Is_Potentially_Use_Visible (Id : E; V : B := True);
procedure Set_Is_Preelaborated (Id : E; V : B := True);
procedure Set_Is_Primitive_Wrapper (Id : E; V : B := True);
-
procedure Set_Is_Private_Composite (Id : E; V : B := True);
procedure Set_Is_Private_Descendant (Id : E; V : B := True);
+ procedure Set_Is_Protected_Interface (Id : E; V : B := True);
procedure Set_Is_Public (Id : E; V : B := True);
procedure Set_Is_Pure (Id : E; V : B := True);
procedure Set_Is_Pure_Unit_Access_Type (Id : E; V : B := True);
@@ -5834,8 +5878,10 @@ package Einfo is
procedure Set_Is_Renaming_Of_Object (Id : E; V : B := True);
procedure Set_Is_Shared_Passive (Id : E; V : B := True);
procedure Set_Is_Statically_Allocated (Id : E; V : B := True);
+ procedure Set_Is_Synchronized_Interface (Id : E; V : B := True);
procedure Set_Is_Tag (Id : E; V : B := True);
procedure Set_Is_Tagged_Type (Id : E; V : B := True);
+ procedure Set_Is_Task_Interface (Id : E; V : B := True);
procedure Set_Is_Thread_Body (Id : E; V : B := True);
procedure Set_Is_True_Constant (Id : E; V : B := True);
procedure Set_Is_Unchecked_Union (Id : E; V : B := True);
@@ -5876,6 +5922,7 @@ package Einfo is
procedure Set_Original_Array_Type (Id : E; V : E);
procedure Set_Original_Record_Component (Id : E; V : E);
procedure Set_Overridden_Operation (Id : E; V : E);
+ procedure Set_Package_Instantiation (Id : E; V : N);
procedure Set_Packed_Array_Type (Id : E; V : E);
procedure Set_Parent_Subtype (Id : E; V : E);
procedure Set_Primitive_Operations (Id : E; V : L);
@@ -6185,6 +6232,7 @@ package Einfo is
pragma Inline (Corresponding_Equality);
pragma Inline (Corresponding_Record_Type);
pragma Inline (Corresponding_Remote_Type);
+ pragma Inline (Current_Use_Clause);
pragma Inline (Current_Value);
pragma Inline (Debug_Info_Off);
pragma Inline (Debug_Renaming_Link);
@@ -6208,7 +6256,6 @@ package Einfo is
pragma Inline (Discriminant_Constraint);
pragma Inline (Discriminant_Default_Value);
pragma Inline (Discriminant_Number);
- pragma Inline (Elaborate_All_Desirable);
pragma Inline (Elaboration_Entity);
pragma Inline (Elaboration_Entity_Required);
pragma Inline (Enclosing_Scope);
@@ -6247,6 +6294,7 @@ package Einfo is
pragma Inline (Has_Aliased_Components);
pragma Inline (Has_Alignment_Clause);
pragma Inline (Has_All_Calls_Remote);
+ pragma Inline (Has_Anon_Block_Suffix);
pragma Inline (Has_Atomic_Components);
pragma Inline (Has_Biased_Representation);
pragma Inline (Has_Completion);
@@ -6377,6 +6425,7 @@ package Einfo is
pragma Inline (Is_Known_Non_Null);
pragma Inline (Is_Known_Valid);
pragma Inline (Is_Limited_Composite);
+ pragma Inline (Is_Limited_Interface);
pragma Inline (Is_Limited_Record);
pragma Inline (Is_Machine_Code_Subprogram);
pragma Inline (Is_Modular_Integer_Type);
@@ -6400,6 +6449,7 @@ package Einfo is
pragma Inline (Is_Private_Composite);
pragma Inline (Is_Private_Descendant);
pragma Inline (Is_Private_Type);
+ pragma Inline (Is_Protected_Interface);
pragma Inline (Is_Protected_Type);
pragma Inline (Is_Public);
pragma Inline (Is_Pure);
@@ -6414,8 +6464,10 @@ package Einfo is
pragma Inline (Is_Signed_Integer_Type);
pragma Inline (Is_Statically_Allocated);
pragma Inline (Is_Subprogram);
+ pragma Inline (Is_Synchronized_Interface);
pragma Inline (Is_Tag);
pragma Inline (Is_Tagged_Type);
+ pragma Inline (Is_Task_Interface);
pragma Inline (Is_Thread_Body);
pragma Inline (Is_True_Constant);
pragma Inline (Is_Task_Type);
@@ -6459,6 +6511,7 @@ package Einfo is
pragma Inline (Original_Array_Type);
pragma Inline (Original_Record_Component);
pragma Inline (Overridden_Operation);
+ pragma Inline (Package_Instantiation);
pragma Inline (Packed_Array_Type);
pragma Inline (Parameter_Mode);
pragma Inline (Parent_Subtype);
@@ -6552,6 +6605,7 @@ package Einfo is
pragma Inline (Set_Corresponding_Equality);
pragma Inline (Set_Corresponding_Record_Type);
pragma Inline (Set_Corresponding_Remote_Type);
+ pragma Inline (Set_Current_Use_Clause);
pragma Inline (Set_Current_Value);
pragma Inline (Set_Debug_Info_Off);
pragma Inline (Set_Debug_Renaming_Link);
@@ -6574,7 +6628,6 @@ package Einfo is
pragma Inline (Set_Discriminant_Constraint);
pragma Inline (Set_Discriminant_Default_Value);
pragma Inline (Set_Discriminant_Number);
- pragma Inline (Set_Elaborate_All_Desirable);
pragma Inline (Set_Elaboration_Entity);
pragma Inline (Set_Elaboration_Entity_Required);
pragma Inline (Set_Enclosing_Scope);
@@ -6611,6 +6664,7 @@ package Einfo is
pragma Inline (Set_Has_Aliased_Components);
pragma Inline (Set_Has_Alignment_Clause);
pragma Inline (Set_Has_All_Calls_Remote);
+ pragma Inline (Set_Has_Anon_Block_Suffix);
pragma Inline (Set_Has_Atomic_Components);
pragma Inline (Set_Has_Biased_Representation);
pragma Inline (Set_Has_Completion);
@@ -6720,6 +6774,7 @@ package Einfo is
pragma Inline (Set_Is_Known_Non_Null);
pragma Inline (Set_Is_Known_Valid);
pragma Inline (Set_Is_Limited_Composite);
+ pragma Inline (Set_Is_Limited_Interface);
pragma Inline (Set_Is_Limited_Record);
pragma Inline (Set_Is_Machine_Code_Subprogram);
pragma Inline (Set_Is_Non_Static_Subtype);
@@ -6736,6 +6791,7 @@ package Einfo is
pragma Inline (Set_Is_Private_Composite);
pragma Inline (Set_Is_Private_Descendant);
+ pragma Inline (Set_Is_Protected_Interface);
pragma Inline (Set_Is_Public);
pragma Inline (Set_Is_Pure);
pragma Inline (Set_Is_Pure_Unit_Access_Type);
@@ -6744,8 +6800,10 @@ package Einfo is
pragma Inline (Set_Is_Renaming_Of_Object);
pragma Inline (Set_Is_Shared_Passive);
pragma Inline (Set_Is_Statically_Allocated);
+ pragma Inline (Set_Is_Synchronized_Interface);
pragma Inline (Set_Is_Tag);
pragma Inline (Set_Is_Tagged_Type);
+ pragma Inline (Set_Is_Task_Interface);
pragma Inline (Set_Is_Thread_Body);
pragma Inline (Set_Is_True_Constant);
pragma Inline (Set_Is_Unchecked_Union);
@@ -6786,6 +6844,7 @@ package Einfo is
pragma Inline (Set_Original_Array_Type);
pragma Inline (Set_Original_Record_Component);
pragma Inline (Set_Overridden_Operation);
+ pragma Inline (Set_Package_Instantiation);
pragma Inline (Set_Packed_Array_Type);
pragma Inline (Set_Parent_Subtype);
pragma Inline (Set_Primitive_Operations);
@@ -6849,7 +6908,7 @@ package Einfo is
-- things here which are small, but not of the canonical attribute
-- access/set format that can be handled by xeinfo.
- pragma Inline (Is_Package);
+ pragma Inline (Is_Package_Or_Generic_Package);
pragma Inline (Is_Wrapper_Package);
pragma Inline (Known_RM_Size);
pragma Inline (Known_Static_Component_Bit_Offset);
diff --git a/gcc/ada/elists.ads b/gcc/ada/elists.ads
index 0482ff31d27..f7e347cca3c 100644
--- a/gcc/ada/elists.ads
+++ b/gcc/ada/elists.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -122,10 +122,10 @@ package Elists is
-- that contains no items.
procedure Append_Elmt (Node : Node_Id; To : Elist_Id);
- -- Appends Node at the end of To, allocating a new element.
+ -- Appends Node at the end of To, allocating a new element
procedure Prepend_Elmt (Node : Node_Id; To : Elist_Id);
- -- Appends Node at the beginning of To, allocating a new element.
+ -- Appends Node at the beginning of To, allocating a new element
procedure Insert_Elmt_After (Node : Node_Id; Elmt : Elmt_Id);
-- Add a new element (Node) right after the pre-existing element Elmt
diff --git a/gcc/ada/err_vars.ads b/gcc/ada/err_vars.ads
index 04ef8b20018..1abc4acbe12 100644
--- a/gcc/ada/err_vars.ads
+++ b/gcc/ada/err_vars.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/errno.c b/gcc/ada/errno.c
index 50e852139c2..93981d60a8f 100644
--- a/gcc/ada/errno.c
+++ b/gcc/ada/errno.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2005 Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2005, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 5da299a419e..d699828d395 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1122,9 +1122,9 @@ package body Errout is
-- Brief Error mode
if Brief_Output or (not Full_List and not Verbose_Mode) then
- E := First_Error_Msg;
Set_Standard_Error;
+ E := First_Error_Msg;
while E /= No_Error_Msg loop
if not Errors.Table (E).Deleted and then not Debug_Flag_KK then
if Full_Path_Name_For_Brief_Errors then
diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads
index ff254683d04..5aa7f7f13d5 100644
--- a/gcc/ada/errout.ads
+++ b/gcc/ada/errout.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -333,7 +333,10 @@ package Errout is
-- passed to the error message routine for insertion sequences described
-- above. The reason these are passed globally is that the insertion
-- mechanism is essentially an untyped one in which the appropriate
- -- variables are set dependingon the specific insertion characters used.
+ -- variables are set depending on the specific insertion characters used.
+
+ -- Note that is mandatory that the caller ensure that global variables
+ -- are set before the Error_Msg call, otherwise the result is undefined.
Error_Msg_Col : Column_Number renames Err_Vars.Error_Msg_Col;
-- Column for @ insertion character in message
diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb
index 2a962964eb9..05d17c91a8d 100644
--- a/gcc/ada/erroutc.adb
+++ b/gcc/ada/erroutc.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads
index ea6fda053ec..bde057483b8 100644
--- a/gcc/ada/erroutc.ads
+++ b/gcc/ada/erroutc.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/errutil.adb b/gcc/ada/errutil.adb
index e0a68645484..b70f18d2ce8 100644
--- a/gcc/ada/errutil.adb
+++ b/gcc/ada/errutil.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1991-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1991-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/errutil.ads b/gcc/ada/errutil.ads
index 07359ddb431..a2688b0d6a1 100644
--- a/gcc/ada/errutil.ads
+++ b/gcc/ada/errutil.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -27,7 +27,7 @@
-- This package contains routines to output error messages and the
-- corresponding instantiation of Styleg, suitable to instantiate Scng.
--- It is not dependent on the GNAT tree packages (Atree, Sinfo, ...).
+-- It is not dependent on the GNAT tree packages (Atree, Sinfo, ...)
-- It uses the same global variables as Errout, located in package
-- Err_Vars. Like Errout, it also uses the common variables and routines
@@ -222,10 +222,10 @@ package Errutil is
-- preprocessor).
procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr);
- -- Output a message at specified location.
+ -- Output a message at specified location
procedure Error_Msg_S (Msg : String);
- -- Output a message at current scan pointer location.
+ -- Output a message at current scan pointer location
procedure Error_Msg_SC (Msg : String);
-- Output a message at the start of the current token, unless we are at
@@ -233,7 +233,7 @@ package Errutil is
-- last real token in the file.
procedure Error_Msg_SP (Msg : String);
- -- Output a message at the start of the previous token.
+ -- Output a message at the start of the previous token
procedure Set_Ignore_Errors (To : Boolean);
-- Indicate, when To = True, that all reported errors should
diff --git a/gcc/ada/eval_fat.adb b/gcc/ada/eval_fat.adb
index bbe66537ee1..99db7769b1a 100644
--- a/gcc/ada/eval_fat.adb
+++ b/gcc/ada/eval_fat.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -419,7 +419,7 @@ package body Eval_Fat is
Exponent := Exponent + 1;
end if;
- -- Put back sign after applying the rounding.
+ -- Put back sign after applying the rounding
if UR_Is_Negative (X) then
Fraction := -Fraction;
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index c17a1664ee9..6699b422c24 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1045,6 +1045,26 @@ package body Exp_Aggr is
if Present (Comp_Type) and then Controlled_Type (Comp_Type) then
Set_No_Ctrl_Actions (A);
+
+ -- If this is an aggregate for an array of arrays, each
+ -- subaggregate will be expanded as well, and even with
+ -- No_Ctrl_Actions the assignments of inner components will
+ -- require attachment in their assignments to temporaries.
+ -- These temporaries must be finalized for each subaggregate,
+ -- to prevent multiple attachments of the same temporary
+ -- location to same finalization chain (and consequently
+ -- circular lists). To ensure that finalization takes place
+ -- for each subaggregate we wrap the assignment in a block.
+
+ if Is_Array_Type (Comp_Type)
+ and then Nkind (Expr) = N_Aggregate
+ then
+ A :=
+ Make_Block_Statement (Loc,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ Statements => New_List (A)));
+ end if;
end if;
Append_To (L, A);
@@ -1574,7 +1594,6 @@ package body Exp_Aggr is
is
Loc : constant Source_Ptr := Sloc (N);
L : constant List_Id := New_List;
- Start_L : constant List_Id := New_List;
N_Typ : constant Entity_Id := Etype (N);
Comp : Node_Id;
@@ -1600,6 +1619,7 @@ package body Exp_Aggr is
Init_Typ : Entity_Id := Empty;
Attach : Node_Id;
+ Ctrl_Stuff_Done : Boolean := False;
function Get_Constraint_Association (T : Entity_Id) return Node_Id;
-- Returns the first discriminant association in the constraint
@@ -1627,6 +1647,10 @@ package body Exp_Aggr is
-- it to finalization list F. Init_Pr conditions the call to the
-- init proc since it may already be done due to ancestor initialization
+ procedure Gen_Ctrl_Actions_For_Aggr;
+ -- Deal with the various controlled type data structure
+ -- initializations
+
---------------------------------
-- Ancestor_Discriminant_Value --
---------------------------------
@@ -1821,6 +1845,7 @@ package body Exp_Aggr is
is
L : constant List_Id := New_List;
Ref : Node_Id;
+ RC : RE_Id;
begin
-- Generate:
@@ -1854,51 +1879,233 @@ package body Exp_Aggr is
and then Present (Etype (Prefix (Expression (Target))))
and then Is_Limited_Type (Etype (Prefix (Expression (Target)))))
then
- if Init_Pr then
- Append_List_To (L,
- Build_Initialization_Call (Loc,
- Id_Ref => Ref,
- Typ => RTE (RE_Limited_Record_Controller),
- In_Init_Proc => Within_Init_Proc));
- end if;
-
- Append_To (L,
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Reference_To
- (Find_Prim_Op
- (RTE (RE_Limited_Record_Controller), Name_Initialize),
- Loc),
- Parameter_Associations => New_List (New_Copy_Tree (Ref))));
-
+ RC := RE_Limited_Record_Controller;
else
- if Init_Pr then
- Append_List_To (L,
- Build_Initialization_Call (Loc,
- Id_Ref => Ref,
- Typ => RTE (RE_Record_Controller),
- In_Init_Proc => Within_Init_Proc));
- end if;
-
- Append_To (L,
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Reference_To
- (Find_Prim_Op
- (RTE (RE_Record_Controller), Name_Initialize),
- Loc),
- Parameter_Associations => New_List (New_Copy_Tree (Ref))));
+ RC := RE_Record_Controller;
+ end if;
+ if Init_Pr then
+ Append_List_To (L,
+ Build_Initialization_Call (Loc,
+ Id_Ref => Ref,
+ Typ => RTE (RC),
+ In_Init_Proc => Within_Init_Proc));
end if;
Append_To (L,
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Reference_To (
+ Find_Prim_Op (RTE (RC), Name_Initialize), Loc),
+ Parameter_Associations =>
+ New_List (New_Copy_Tree (Ref))));
+
+ Append_To (L,
Make_Attach_Call (
Obj_Ref => New_Copy_Tree (Ref),
Flist_Ref => F,
With_Attach => Attach));
+
return L;
end Init_Controller;
+ -------------------------------
+ -- Gen_Ctrl_Actions_For_Aggr --
+ -------------------------------
+
+ procedure Gen_Ctrl_Actions_For_Aggr is
+ begin
+ if Present (Obj)
+ and then Finalize_Storage_Only (Typ)
+ and then (Is_Library_Level_Entity (Obj)
+ or else Entity (Constant_Value (RTE (RE_Garbage_Collected))) =
+ Standard_True)
+ then
+ Attach := Make_Integer_Literal (Loc, 0);
+
+ elsif Nkind (Parent (N)) = N_Qualified_Expression
+ and then Nkind (Parent (Parent (N))) = N_Allocator
+ then
+ Attach := Make_Integer_Literal (Loc, 2);
+
+ else
+ Attach := Make_Integer_Literal (Loc, 1);
+ end if;
+
+ -- Determine the external finalization list. It is either the
+ -- finalization list of the outer-scope or the one coming from
+ -- an outer aggregate. When the target is not a temporary, the
+ -- proper scope is the scope of the target rather than the
+ -- potentially transient current scope.
+
+ if Controlled_Type (Typ) then
+ if Present (Flist) then
+ External_Final_List := New_Copy_Tree (Flist);
+
+ elsif Is_Entity_Name (Target)
+ and then Present (Scope (Entity (Target)))
+ then
+ External_Final_List
+ := Find_Final_List (Scope (Entity (Target)));
+
+ else
+ External_Final_List := Find_Final_List (Current_Scope);
+ end if;
+
+ else
+ External_Final_List := Empty;
+ end if;
+
+ -- Initialize and attach the outer object in the is_controlled case
+
+ if Is_Controlled (Typ) then
+ if Ancestor_Is_Subtype_Mark then
+ Ref := Convert_To (Init_Typ, New_Copy_Tree (Target));
+ Set_Assignment_OK (Ref);
+ Append_To (L,
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Reference_To
+ (Find_Prim_Op (Init_Typ, Name_Initialize), Loc),
+ Parameter_Associations => New_List (New_Copy_Tree (Ref))));
+ end if;
+
+ if not Has_Controlled_Component (Typ) then
+ Ref := New_Copy_Tree (Target);
+ Set_Assignment_OK (Ref);
+ Append_To (L,
+ Make_Attach_Call (
+ Obj_Ref => Ref,
+ Flist_Ref => New_Copy_Tree (External_Final_List),
+ With_Attach => Attach));
+ end if;
+ end if;
+
+ -- In the Has_Controlled component case, all the intermediate
+ -- controllers must be initialized
+
+ if Has_Controlled_Component (Typ)
+ and not Is_Limited_Ancestor_Expansion
+ then
+ declare
+ Inner_Typ : Entity_Id;
+ Outer_Typ : Entity_Id;
+ At_Root : Boolean;
+
+ begin
+
+ Outer_Typ := Base_Type (Typ);
+
+ -- Find outer type with a controller
+
+ while Outer_Typ /= Init_Typ
+ and then not Has_New_Controlled_Component (Outer_Typ)
+ loop
+ Outer_Typ := Etype (Outer_Typ);
+ end loop;
+
+ -- Attach it to the outer record controller to the
+ -- external final list
+
+ if Outer_Typ = Init_Typ then
+ Append_List_To (L,
+ Init_Controller (
+ Target => Target,
+ Typ => Outer_Typ,
+ F => External_Final_List,
+ Attach => Attach,
+ Init_Pr => False));
+
+ At_Root := True;
+ Inner_Typ := Init_Typ;
+
+ else
+ Append_List_To (L,
+ Init_Controller (
+ Target => Target,
+ Typ => Outer_Typ,
+ F => External_Final_List,
+ Attach => Attach,
+ Init_Pr => True));
+
+ Inner_Typ := Etype (Outer_Typ);
+ At_Root :=
+ not Is_Tagged_Type (Typ) or else Inner_Typ = Outer_Typ;
+ end if;
+
+ -- The outer object has to be attached as well
+
+ if Is_Controlled (Typ) then
+ Ref := New_Copy_Tree (Target);
+ Set_Assignment_OK (Ref);
+ Append_To (L,
+ Make_Attach_Call (
+ Obj_Ref => Ref,
+ Flist_Ref => New_Copy_Tree (External_Final_List),
+ With_Attach => New_Copy_Tree (Attach)));
+ end if;
+
+ -- Initialize the internal controllers for tagged types with
+ -- more than one controller.
+
+ while not At_Root and then Inner_Typ /= Init_Typ loop
+ if Has_New_Controlled_Component (Inner_Typ) then
+ F :=
+ Make_Selected_Component (Loc,
+ Prefix =>
+ Convert_To (Outer_Typ, New_Copy_Tree (Target)),
+ Selector_Name =>
+ Make_Identifier (Loc, Name_uController));
+ F :=
+ Make_Selected_Component (Loc,
+ Prefix => F,
+ Selector_Name => Make_Identifier (Loc, Name_F));
+
+ Append_List_To (L,
+ Init_Controller (
+ Target => Target,
+ Typ => Inner_Typ,
+ F => F,
+ Attach => Make_Integer_Literal (Loc, 1),
+ Init_Pr => True));
+ Outer_Typ := Inner_Typ;
+ end if;
+
+ -- Stop at the root
+
+ At_Root := Inner_Typ = Etype (Inner_Typ);
+ Inner_Typ := Etype (Inner_Typ);
+ end loop;
+
+ -- If not done yet attach the controller of the ancestor part
+
+ if Outer_Typ /= Init_Typ
+ and then Inner_Typ = Init_Typ
+ and then Has_Controlled_Component (Init_Typ)
+ then
+ F :=
+ Make_Selected_Component (Loc,
+ Prefix => Convert_To (Outer_Typ, New_Copy_Tree (Target)),
+ Selector_Name =>
+ Make_Identifier (Loc, Name_uController));
+ F :=
+ Make_Selected_Component (Loc,
+ Prefix => F,
+ Selector_Name => Make_Identifier (Loc, Name_F));
+
+ Attach := Make_Integer_Literal (Loc, 1);
+ Append_List_To (L,
+ Init_Controller (
+ Target => Target,
+ Typ => Init_Typ,
+ F => F,
+ Attach => Attach,
+ Init_Pr => Ancestor_Is_Expression));
+ end if;
+ end;
+ end if;
+ end Gen_Ctrl_Actions_For_Aggr;
+
-- Start of processing for Build_Record_Aggr_Code
begin
@@ -1908,6 +2115,7 @@ package body Exp_Aggr is
if Nkind (N) = N_Extension_Aggregate then
declare
A : constant Node_Id := Ancestor_Part (N);
+ Assign : List_Id;
begin
-- If the ancestor part is a subtype mark "T", we generate
@@ -1975,14 +2183,14 @@ package body Exp_Aggr is
if Has_Default_Init_Comps (N)
or else Has_Task (Base_Type (Init_Typ))
then
- Append_List_To (Start_L,
+ Append_List_To (L,
Build_Initialization_Call (Loc,
Id_Ref => Ref,
Typ => Init_Typ,
In_Init_Proc => Within_Init_Proc,
With_Default_Init => True));
else
- Append_List_To (Start_L,
+ Append_List_To (L,
Build_Initialization_Call (Loc,
Id_Ref => Ref,
Typ => Init_Typ,
@@ -2001,7 +2209,7 @@ package body Exp_Aggr is
elsif Is_Limited_Type (Etype (A)) then
Ancestor_Is_Expression := True;
- Append_List_To (Start_L,
+ Append_List_To (L,
Build_Record_Aggr_Code (
N => Expression (A),
Typ => Etype (Expression (A)),
@@ -2017,9 +2225,34 @@ package body Exp_Aggr is
Ancestor_Is_Expression := True;
Init_Typ := Etype (A);
- -- Assign the tag before doing the assignment to make sure
- -- that the dispatching call in the subsequent deep_adjust
- -- works properly (unless Java_VM, where tags are implicit).
+ -- If the ancestor part is an aggregate, force its full
+ -- expansion, which was delayed.
+
+ if Nkind (A) = N_Qualified_Expression
+ and then (Nkind (Expression (A)) = N_Aggregate
+ or else
+ Nkind (Expression (A)) = N_Extension_Aggregate)
+ then
+ Set_Analyzed (A, False);
+ Set_Analyzed (Expression (A), False);
+ end if;
+
+ Ref := Convert_To (Init_Typ, New_Copy_Tree (Target));
+ Set_Assignment_OK (Ref);
+
+ -- Make the assignment without usual controlled actions since
+ -- we only want the post adjust but not the pre finalize here
+ -- Add manual adjust when necessary
+
+ Assign := New_List (
+ Make_OK_Assignment_Statement (Loc,
+ Name => Ref,
+ Expression => A));
+ Set_No_Ctrl_Actions (First (Assign));
+
+ -- Assign the tag now to make sure that the dispatching call in
+ -- the subsequent deep_adjust works properly (unless Java_VM,
+ -- where tags are implicit).
if not Java_VM then
Instr :=
@@ -2039,30 +2272,23 @@ package body Exp_Aggr is
Loc)));
Set_Assignment_OK (Name (Instr));
- Append_To (L, Instr);
+ Append_To (Assign, Instr);
end if;
- -- If the ancestor part is an aggregate, force its full
- -- expansion, which was delayed.
+ -- Call Adjust manually
- if Nkind (A) = N_Qualified_Expression
- and then (Nkind (Expression (A)) = N_Aggregate
- or else
- Nkind (Expression (A)) = N_Extension_Aggregate)
- then
- Set_Analyzed (A, False);
- Set_Analyzed (Expression (A), False);
+ if Controlled_Type (Etype (A)) then
+ Append_List_To (Assign,
+ Make_Adjust_Call (
+ Ref => New_Copy_Tree (Ref),
+ Typ => Etype (A),
+ Flist_Ref => New_Reference_To (
+ RTE (RE_Global_Final_List), Loc),
+ With_Attach => Make_Integer_Literal (Loc, 0)));
end if;
- Ref := Convert_To (Init_Typ, New_Copy_Tree (Target));
- Set_Assignment_OK (Ref);
Append_To (L,
- Make_Unsuppress_Block (Loc,
- Name_Discriminant_Check,
- New_List (
- Make_OK_Assignment_Statement (Loc,
- Name => Ref,
- Expression => A))));
+ Make_Unsuppress_Block (Loc, Name_Discriminant_Check, Assign));
if Has_Discriminants (Init_Typ) then
Check_Ancestor_Discriminants (Init_Typ);
@@ -2160,10 +2386,6 @@ package body Exp_Aggr is
if not Inside_Init_Proc and not Inside_Allocator then
Build_Activation_Chain_Entity (N);
-
- if not Has_Master_Entity (Current_Scope) then
- Build_Master_Entity (Etype (N));
- end if;
end if;
end if;
end;
@@ -2180,11 +2402,23 @@ package body Exp_Aggr is
goto Next_Comp;
end if;
- -- ???
+ -- Prepare for component assignment
if Ekind (Selector) /= E_Discriminant
or else Nkind (N) = N_Extension_Aggregate
then
+
+ -- All the discriminants have now been assigned
+ -- This is now a good moment to initialize and attach all the
+ -- controllers. Their position may depend on the discriminants.
+
+ if Ekind (Selector) /= E_Discriminant
+ and then not Ctrl_Stuff_Done
+ then
+ Gen_Ctrl_Actions_For_Aggr;
+ Ctrl_Stuff_Done := True;
+ end if;
+
Comp_Type := Etype (Selector);
Comp_Expr :=
Make_Selected_Component (Loc,
@@ -2222,7 +2456,8 @@ package body Exp_Aggr is
Internal_Final_List := Empty;
end if;
- -- ???
+ -- Now either create the assignment or generate the code for the
+ -- inner aggregate top-down.
if Is_Delayed_Aggregate (Expr_Q) then
Append_List_To (L,
@@ -2347,199 +2582,15 @@ package body Exp_Aggr is
Append_To (L, Instr);
end if;
- -- Now deal with the various controlled type data structure
- -- initializations
-
- if Present (Obj)
- and then Finalize_Storage_Only (Typ)
- and then
- (Is_Library_Level_Entity (Obj)
- or else Entity (Constant_Value (RTE (RE_Garbage_Collected))) =
- Standard_True)
- then
- Attach := Make_Integer_Literal (Loc, 0);
-
- elsif Nkind (Parent (N)) = N_Qualified_Expression
- and then Nkind (Parent (Parent (N))) = N_Allocator
- then
- Attach := Make_Integer_Literal (Loc, 2);
-
- else
- Attach := Make_Integer_Literal (Loc, 1);
- end if;
-
- -- Determine the external finalization list. It is either the
- -- finalization list of the outer-scope or the one coming from
- -- an outer aggregate. When the target is not a temporary, the
- -- proper scope is the scope of the target rather than the
- -- potentially transient current scope.
-
- if Controlled_Type (Typ) then
- if Present (Flist) then
- External_Final_List := New_Copy_Tree (Flist);
-
- elsif Is_Entity_Name (Target)
- and then Present (Scope (Entity (Target)))
- then
- External_Final_List := Find_Final_List (Scope (Entity (Target)));
-
- else
- External_Final_List := Find_Final_List (Current_Scope);
- end if;
-
- else
- External_Final_List := Empty;
- end if;
-
- -- Initialize and attach the outer object in the is_controlled case
-
- if Is_Controlled (Typ) then
- if Ancestor_Is_Subtype_Mark then
- Ref := Convert_To (Init_Typ, New_Copy_Tree (Target));
- Set_Assignment_OK (Ref);
- Append_To (L,
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Reference_To
- (Find_Prim_Op (Init_Typ, Name_Initialize), Loc),
- Parameter_Associations => New_List (New_Copy_Tree (Ref))));
- end if;
+ -- If the controllers have not been initialized yet (by lack of non-
+ -- discriminant components), let's do it now.
- if not Has_Controlled_Component (Typ) then
- Ref := New_Copy_Tree (Target);
- Set_Assignment_OK (Ref);
- Append_To (Start_L,
- Make_Attach_Call (
- Obj_Ref => Ref,
- Flist_Ref => New_Copy_Tree (External_Final_List),
- With_Attach => Attach));
- end if;
+ if not Ctrl_Stuff_Done then
+ Gen_Ctrl_Actions_For_Aggr;
+ Ctrl_Stuff_Done := True;
end if;
- -- In the Has_Controlled component case, all the intermediate
- -- controllers must be initialized
-
- if Has_Controlled_Component (Typ)
- and not Is_Limited_Ancestor_Expansion
- then
- declare
- Inner_Typ : Entity_Id;
- Outer_Typ : Entity_Id;
- At_Root : Boolean;
-
- begin
-
- Outer_Typ := Base_Type (Typ);
-
- -- Find outer type with a controller
-
- while Outer_Typ /= Init_Typ
- and then not Has_New_Controlled_Component (Outer_Typ)
- loop
- Outer_Typ := Etype (Outer_Typ);
- end loop;
-
- -- Attach it to the outer record controller to the
- -- external final list
-
- if Outer_Typ = Init_Typ then
- Append_List_To (Start_L,
- Init_Controller (
- Target => Target,
- Typ => Outer_Typ,
- F => External_Final_List,
- Attach => Attach,
- Init_Pr => Ancestor_Is_Expression));
-
- At_Root := True;
- Inner_Typ := Init_Typ;
-
- else
- Append_List_To (Start_L,
- Init_Controller (
- Target => Target,
- Typ => Outer_Typ,
- F => External_Final_List,
- Attach => Attach,
- Init_Pr => True));
-
- Inner_Typ := Etype (Outer_Typ);
- At_Root :=
- not Is_Tagged_Type (Typ) or else Inner_Typ = Outer_Typ;
- end if;
-
- -- The outer object has to be attached as well
-
- if Is_Controlled (Typ) then
- Ref := New_Copy_Tree (Target);
- Set_Assignment_OK (Ref);
- Append_To (Start_L,
- Make_Attach_Call (
- Obj_Ref => Ref,
- Flist_Ref => New_Copy_Tree (External_Final_List),
- With_Attach => New_Copy_Tree (Attach)));
- end if;
-
- -- Initialize the internal controllers for tagged types with
- -- more than one controller.
-
- while not At_Root and then Inner_Typ /= Init_Typ loop
- if Has_New_Controlled_Component (Inner_Typ) then
- F :=
- Make_Selected_Component (Loc,
- Prefix => Convert_To (Outer_Typ, New_Copy_Tree (Target)),
- Selector_Name =>
- Make_Identifier (Loc, Name_uController));
- F :=
- Make_Selected_Component (Loc,
- Prefix => F,
- Selector_Name => Make_Identifier (Loc, Name_F));
-
- Append_List_To (Start_L,
- Init_Controller (
- Target => Target,
- Typ => Inner_Typ,
- F => F,
- Attach => Make_Integer_Literal (Loc, 1),
- Init_Pr => True));
- Outer_Typ := Inner_Typ;
- end if;
-
- -- Stop at the root
-
- At_Root := Inner_Typ = Etype (Inner_Typ);
- Inner_Typ := Etype (Inner_Typ);
- end loop;
-
- -- If not done yet attach the controller of the ancestor part
-
- if Outer_Typ /= Init_Typ
- and then Inner_Typ = Init_Typ
- and then Has_Controlled_Component (Init_Typ)
- then
- F :=
- Make_Selected_Component (Loc,
- Prefix => Convert_To (Outer_Typ, New_Copy_Tree (Target)),
- Selector_Name => Make_Identifier (Loc, Name_uController));
- F :=
- Make_Selected_Component (Loc,
- Prefix => F,
- Selector_Name => Make_Identifier (Loc, Name_F));
-
- Attach := Make_Integer_Literal (Loc, 1);
- Append_List_To (Start_L,
- Init_Controller (
- Target => Target,
- Typ => Init_Typ,
- F => F,
- Attach => Attach,
- Init_Pr => Ancestor_Is_Expression));
- end if;
- end;
- end if;
-
- Append_List_To (Start_L, L);
- return Start_L;
+ return L;
end Build_Record_Aggr_Code;
-------------------------------
@@ -2700,6 +2751,11 @@ package body Exp_Aggr is
return;
end if;
+ if Requires_Transient_Scope (Typ) then
+ Establish_Transient_Scope (Aggr, Sec_Stack =>
+ Is_Controlled (Typ) or else Has_Controlled_Component (Typ));
+ end if;
+
Insert_Actions_After (N, Late_Expansion (Aggr, Typ, Occ, Obj => Obj));
Set_No_Initialization (N);
Initialize_Discriminants (N, Typ);
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index b9d7ee1f1df..11bc258d86e 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -85,16 +85,17 @@ package body Exp_Attr is
procedure Expand_Fpt_Attribute
(N : Node_Id;
- Rtp : Entity_Id;
+ Pkg : RE_Id;
Nam : Name_Id;
Args : List_Id);
-- This procedure expands a call to a floating-point attribute function.
-- N is the attribute reference node, and Args is a list of arguments to
- -- be passed to the function call. Rtp is the root type of the floating
- -- point type involved (used to select the proper generic instantiation
- -- of the package containing the attribute routines). The Nam argument
- -- is the attribute processing routine to be called. This is normally
- -- the same as the attribute name, except in the Unaligned_Valid case.
+ -- be passed to the function call. Pkg identifies the package containing
+ -- the appropriate instantiation of System.Fat_Gen. Float arguments in Args
+ -- have already been converted to the floating-point type for which Pkg was
+ -- instantiated. The Nam argument is the relevant attribute processing
+ -- routine to be called. This is the same as the attribute name, except in
+ -- the Unaligned_Valid case.
procedure Expand_Fpt_Attribute_R (N : Node_Id);
-- This procedure expands a call to a floating-point attribute function
@@ -123,6 +124,15 @@ package body Exp_Attr is
-- A reference to a type within its own scope is resolved to a reference
-- to the current instance of the type in its initialization procedure.
+ procedure Find_Fat_Info
+ (T : Entity_Id;
+ Fat_Type : out Entity_Id;
+ Fat_Pkg : out RE_Id);
+ -- Given a floating-point type T, identifies the package containing the
+ -- attributes for this type (returned in Fat_Pkg), and the corresponding
+ -- type for which this package was instantiated from Fat_Gen. Error if T
+ -- is not a floating-point type.
+
function Find_Stream_Subprogram
(Typ : Entity_Id;
Nam : TSS_Name_Type) return Entity_Id;
@@ -176,7 +186,7 @@ package body Exp_Attr is
if Check then
Insert_Action (N, Decl);
else
- Insert_Action (N, Decl, All_Checks);
+ Insert_Action (N, Decl, Suppress => All_Checks);
end if;
if Installed then
@@ -260,18 +270,17 @@ package body Exp_Attr is
procedure Expand_Fpt_Attribute
(N : Node_Id;
- Rtp : Entity_Id;
+ Pkg : RE_Id;
Nam : Name_Id;
Args : List_Id)
is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
- Pkg : RE_Id;
Fnm : Node_Id;
begin
- -- The function name is the selected component Fat_xxx.yyy where xxx
- -- is the floating-point root type, and yyy is the argument Nam.
+ -- The function name is the selected component Attr_xxx.yyy where
+ -- Attr_xxx is the package name, and yyy is the argument Nam.
-- Note: it would be more usual to have separate RE entries for each
-- of the entities in the Fat packages, but first they have identical
@@ -279,16 +288,6 @@ package body Exp_Attr is
-- meet the normal RE rule of separate names for all runtime entities),
-- and second there would be an awful lot of them!
- if Rtp = Standard_Short_Float then
- Pkg := RE_Fat_Short_Float;
- elsif Rtp = Standard_Float then
- Pkg := RE_Fat_Float;
- elsif Rtp = Standard_Long_Float then
- Pkg := RE_Fat_Long_Float;
- else
- Pkg := RE_Fat_Long_Long_Float;
- end if;
-
Fnm :=
Make_Selected_Component (Loc,
Prefix => New_Reference_To (RTE (Pkg), Loc),
@@ -302,7 +301,7 @@ package body Exp_Attr is
Rewrite (N,
Unchecked_Convert_To (Base_Type (Etype (N)),
Make_Function_Call (Loc,
- Name => Fnm,
+ Name => Fnm,
Parameter_Associations => Args)));
Analyze_And_Resolve (N, Typ);
@@ -318,12 +317,13 @@ package body Exp_Attr is
procedure Expand_Fpt_Attribute_R (N : Node_Id) is
E1 : constant Node_Id := First (Expressions (N));
- Rtp : constant Entity_Id := Root_Type (Etype (E1));
-
+ Ftp : Entity_Id;
+ Pkg : RE_Id;
begin
+ Find_Fat_Info (Etype (E1), Ftp, Pkg);
Expand_Fpt_Attribute
- (N, Rtp, Attribute_Name (N),
- New_List (Unchecked_Convert_To (Rtp, Relocate_Node (E1))));
+ (N, Pkg, Attribute_Name (N),
+ New_List (Unchecked_Convert_To (Ftp, Relocate_Node (E1))));
end Expand_Fpt_Attribute_R;
-----------------------------
@@ -337,14 +337,15 @@ package body Exp_Attr is
procedure Expand_Fpt_Attribute_RI (N : Node_Id) is
E1 : constant Node_Id := First (Expressions (N));
- Rtp : constant Entity_Id := Root_Type (Etype (E1));
+ Ftp : Entity_Id;
+ Pkg : RE_Id;
E2 : constant Node_Id := Next (E1);
-
begin
+ Find_Fat_Info (Etype (E1), Ftp, Pkg);
Expand_Fpt_Attribute
- (N, Rtp, Attribute_Name (N),
+ (N, Pkg, Attribute_Name (N),
New_List (
- Unchecked_Convert_To (Rtp, Relocate_Node (E1)),
+ Unchecked_Convert_To (Ftp, Relocate_Node (E1)),
Unchecked_Convert_To (Standard_Integer, Relocate_Node (E2))));
end Expand_Fpt_Attribute_RI;
@@ -358,15 +359,16 @@ package body Exp_Attr is
procedure Expand_Fpt_Attribute_RR (N : Node_Id) is
E1 : constant Node_Id := First (Expressions (N));
- Rtp : constant Entity_Id := Root_Type (Etype (E1));
+ Ftp : Entity_Id;
+ Pkg : RE_Id;
E2 : constant Node_Id := Next (E1);
-
begin
+ Find_Fat_Info (Etype (E1), Ftp, Pkg);
Expand_Fpt_Attribute
- (N, Rtp, Attribute_Name (N),
+ (N, Pkg, Attribute_Name (N),
New_List (
- Unchecked_Convert_To (Rtp, Relocate_Node (E1)),
- Unchecked_Convert_To (Rtp, Relocate_Node (E2))));
+ Unchecked_Convert_To (Ftp, Relocate_Node (E1)),
+ Unchecked_Convert_To (Ftp, Relocate_Node (E2))));
end Expand_Fpt_Attribute_RR;
----------------------------------
@@ -1011,8 +1013,31 @@ package body Exp_Attr is
when Attribute_Callable => Callable :
begin
- Rewrite (N,
- Build_Call_With_Task (Pref, RTE (RE_Callable)));
+ -- We have an object of a task interface class-wide type as a prefix
+ -- to Callable. Generate:
+
+ -- callable (Pref._disp_get_task_id);
+
+ if Ada_Version >= Ada_05
+ and then Ekind (Etype (Pref)) = E_Class_Wide_Type
+ and then Is_Interface (Etype (Pref))
+ and then Is_Task_Interface (Etype (Pref))
+ then
+ Rewrite (N,
+ Make_Function_Call (Loc,
+ Name =>
+ New_Reference_To (RTE (RE_Callable), Loc),
+ Parameter_Associations => New_List (
+ Make_Selected_Component (Loc,
+ Prefix =>
+ New_Copy_Tree (Pref),
+ Selector_Name =>
+ Make_Identifier (Loc, Name_uDisp_Get_Task_Id)))));
+ else
+ Rewrite (N,
+ Build_Call_With_Task (Pref, RTE (RE_Callable)));
+ end if;
+
Analyze_And_Resolve (N, Standard_Boolean);
end Callable;
@@ -1630,8 +1655,8 @@ package body Exp_Attr is
-- expands into
- -- Result_Type (System.Fore (Long_Long_Float (Type'First)),
- -- Long_Long_Float (Type'Last))
+ -- Result_Type (System.Fore (Universal_Real (Type'First)),
+ -- Universal_Real (Type'Last))
-- Note that we know that the type is a non-static subtype, or Fore
-- would have itself been computed dynamically in Eval_Attribute.
@@ -1647,12 +1672,12 @@ package body Exp_Attr is
Name => New_Reference_To (RTE (RE_Fore), Loc),
Parameter_Associations => New_List (
- Convert_To (Standard_Long_Long_Float,
+ Convert_To (Universal_Real,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_First)),
- Convert_To (Standard_Long_Long_Float,
+ Convert_To (Universal_Real,
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ptyp, Loc),
Attribute_Name => Name_Last))))));
@@ -2283,6 +2308,17 @@ package body Exp_Attr is
when Attribute_Machine =>
Expand_Fpt_Attribute_R (N);
+ ----------------------
+ -- Machine_Rounding --
+ ----------------------
+
+ -- Transforms 'Machine_Rounding into a call to the floating-point
+ -- attribute function Machine_Rounding in Fat_xxx (where xxx is the root
+ -- type).
+
+ when Attribute_Machine_Rounding =>
+ Expand_Fpt_Attribute_R (N);
+
------------------
-- Machine_Size --
------------------
@@ -2425,7 +2461,7 @@ package body Exp_Attr is
end if;
- Analyze_And_Resolve (N, Btyp, All_Checks);
+ Analyze_And_Resolve (N, Btyp, Suppress => All_Checks);
end Mod_Case;
-----------
@@ -3211,7 +3247,7 @@ package body Exp_Attr is
Rewrite (Prefix (N), New_Occurrence_Of (Entity (Pref), Loc));
return;
- -- For x'Size applied to an object of a class-wide type, transform
+ -- For X'Size applied to an object of a class-wide type, transform
-- X'Size into a call to the primitive operation _Size applied to X.
elsif Is_Class_Wide_Type (Ptyp) then
@@ -3268,8 +3304,8 @@ package body Exp_Attr is
else
Apply_Universal_Integer_Attribute_Checks (N);
- -- If we have Size applied to a formal parameter, that is a
- -- packed array subtype, then apply size to the actual subtype.
+ -- If Size is applied to a formal parameter that is of a packed
+ -- array subtype, then apply Size to the actual subtype.
if Is_Entity_Name (Pref)
and then Is_Formal (Entity (Pref))
@@ -3284,6 +3320,20 @@ package body Exp_Attr is
Analyze_And_Resolve (N, Typ);
end if;
+ -- If Size is applied to a dereference of an access to
+ -- unconstrained packed array, GIGI needs to see its
+ -- unconstrained nominal type, but also a hint to the actual
+ -- constrained type.
+
+ if Nkind (Pref) = N_Explicit_Dereference
+ and then Is_Array_Type (Etype (Pref))
+ and then not Is_Constrained (Etype (Pref))
+ and then Is_Packed (Etype (Pref))
+ then
+ Set_Actual_Designated_Subtype (Pref,
+ Get_Actual_Subtype (Pref));
+ end if;
+
return;
end if;
@@ -3590,7 +3640,28 @@ package body Exp_Attr is
when Attribute_Terminated => Terminated :
begin
- if Restricted_Profile then
+ -- The prefix of Terminated is of a task interface class-wide type.
+ -- Generate:
+
+ -- terminated (Pref._disp_get_task_id);
+
+ if Ada_Version >= Ada_05
+ and then Ekind (Etype (Pref)) = E_Class_Wide_Type
+ and then Is_Interface (Etype (Pref))
+ and then Is_Task_Interface (Etype (Pref))
+ then
+ Rewrite (N,
+ Make_Function_Call (Loc,
+ Name =>
+ New_Reference_To (RTE (RE_Terminated), Loc),
+ Parameter_Associations => New_List (
+ Make_Selected_Component (Loc,
+ Prefix =>
+ New_Copy_Tree (Pref),
+ Selector_Name =>
+ Make_Identifier (Loc, Name_uDisp_Get_Task_Id)))));
+
+ elsif Restricted_Profile then
Rewrite (N,
Build_Call_With_Task (Pref, RTE (RE_Restricted_Terminated)));
@@ -3641,7 +3712,26 @@ package body Exp_Attr is
----------------------
when Attribute_Unchecked_Access =>
- Expand_Access_To_Type (N);
+
+ -- Ada 2005 (AI-251): If the designated type is an interface, then
+ -- rewrite the referenced object as a conversion to force the
+ -- displacement of the pointer to the secondary dispatch table.
+
+ if Is_Interface (Directly_Designated_Type (Btyp)) then
+ declare
+ Ref_Object : constant Node_Id := Get_Referenced_Object (Pref);
+ Conversion : Node_Id;
+ begin
+ Conversion := Convert_To (Typ, New_Copy_Tree (Ref_Object));
+ Rewrite (N, Conversion);
+ Analyze_And_Resolve (N, Typ);
+ end;
+
+ -- Otherwise this is like normal Access without a check
+
+ else
+ Expand_Access_To_Type (N);
+ end if;
-----------------
-- UET_Address --
@@ -3687,7 +3777,26 @@ package body Exp_Attr is
-------------------------
when Attribute_Unrestricted_Access =>
- Expand_Access_To_Type (N);
+
+ -- Ada 2005 (AI-251): If the designated type is an interface, then
+ -- rewrite the referenced object as a conversion to force the
+ -- displacement of the pointer to the secondary dispatch table.
+
+ if Is_Interface (Directly_Designated_Type (Btyp)) then
+ declare
+ Ref_Object : constant Node_Id := Get_Referenced_Object (Pref);
+ Conversion : Node_Id;
+ begin
+ Conversion := Convert_To (Typ, New_Copy_Tree (Ref_Object));
+ Rewrite (N, Conversion);
+ Analyze_And_Resolve (N, Typ);
+ end;
+
+ -- Otherwise this is like Access without a check
+
+ else
+ Expand_Access_To_Type (N);
+ end if;
---------------
-- VADS_Size --
@@ -3824,43 +3933,50 @@ package body Exp_Attr is
if Is_Floating_Point_Type (Ptyp) then
declare
- Rtp : constant Entity_Id := Root_Type (Etype (Pref));
+ Pkg : RE_Id;
+ Ftp : Entity_Id;
begin
-- For vax fpt types, call appropriate routine in special vax
-- floating point unit. We do not have to worry about loads in
-- this case, since these types have no signalling NaN's.
- if Vax_Float (Rtp) then
+ if Vax_Float (Btyp) then
Expand_Vax_Valid (N);
- -- If the floating-point object might be unaligned, we need
- -- to call the special routine Unaligned_Valid, which makes
- -- the needed copy, being careful not to load the value into
- -- any floating-point register. The argument in this case is
- -- obj'Address (see Unchecked_Valid routine in s-fatgen.ads).
+ -- Non VAX float case
- elsif Is_Possibly_Unaligned_Object (Pref) then
- Set_Attribute_Name (N, Name_Unaligned_Valid);
- Expand_Fpt_Attribute
- (N, Rtp, Name_Unaligned_Valid,
- New_List (
- Make_Attribute_Reference (Loc,
- Prefix => Relocate_Node (Pref),
- Attribute_Name => Name_Address)));
+ else
+ Find_Fat_Info (Etype (Pref), Ftp, Pkg);
+
+ -- If the floating-point object might be unaligned, we need
+ -- to call the special routine Unaligned_Valid, which makes
+ -- the needed copy, being careful not to load the value into
+ -- any floating-point register. The argument in this case is
+ -- obj'Address (see Unchecked_Valid routine in Fat_Gen).
+
+ if Is_Possibly_Unaligned_Object (Pref) then
+ Set_Attribute_Name (N, Name_Unaligned_Valid);
+ Expand_Fpt_Attribute
+ (N, Pkg, Name_Unaligned_Valid,
+ New_List (
+ Make_Attribute_Reference (Loc,
+ Prefix => Relocate_Node (Pref),
+ Attribute_Name => Name_Address)));
- -- In the normal case where we are sure the object is aligned,
- -- we generate a call to Valid, and the argument in this case
- -- is obj'Unrestricted_Access (after converting obj to the
- -- right floating-point type).
+ -- In the normal case where we are sure the object is
+ -- aligned, we generate a call to Valid, and the argument in
+ -- this case is obj'Unrestricted_Access (after converting
+ -- obj to the right floating-point type).
- else
- Expand_Fpt_Attribute
- (N, Rtp, Name_Valid,
- New_List (
- Make_Attribute_Reference (Loc,
- Prefix => Unchecked_Convert_To (Rtp, Pref),
- Attribute_Name => Name_Unrestricted_Access)));
+ else
+ Expand_Fpt_Attribute
+ (N, Pkg, Name_Valid,
+ New_List (
+ Make_Attribute_Reference (Loc,
+ Prefix => Unchecked_Convert_To (Ftp, Pref),
+ Attribute_Name => Name_Unrestricted_Access)));
+ end if;
end if;
-- One more task, we still need a range check. Required
@@ -4488,6 +4604,78 @@ package body Exp_Attr is
Reason => CE_Overflow_Check_Failed));
end Expand_Pred_Succ;
+ -------------------
+ -- Find_Fat_Info --
+ -------------------
+
+ procedure Find_Fat_Info
+ (T : Entity_Id;
+ Fat_Type : out Entity_Id;
+ Fat_Pkg : out RE_Id)
+ is
+ Btyp : constant Entity_Id := Base_Type (T);
+ Rtyp : constant Entity_Id := Root_Type (T);
+ Digs : constant Nat := UI_To_Int (Digits_Value (Btyp));
+
+ begin
+ -- If the base type is VAX float, then get appropriate VAX float type
+
+ if Vax_Float (Btyp) then
+ case Digs is
+ when 6 =>
+ Fat_Type := RTE (RE_Fat_VAX_F);
+ Fat_Pkg := RE_Attr_VAX_F_Float;
+
+ when 9 =>
+ Fat_Type := RTE (RE_Fat_VAX_D);
+ Fat_Pkg := RE_Attr_VAX_D_Float;
+
+ when 15 =>
+ Fat_Type := RTE (RE_Fat_VAX_G);
+ Fat_Pkg := RE_Attr_VAX_G_Float;
+
+ when others =>
+ raise Program_Error;
+ end case;
+
+ -- If root type is VAX float, this is the case where the library has
+ -- been recompiled in VAX float mode, and we have an IEEE float type.
+ -- This is when we use the special IEEE Fat packages.
+
+ elsif Vax_Float (Rtyp) then
+ case Digs is
+ when 6 =>
+ Fat_Type := RTE (RE_Fat_IEEE_Short);
+ Fat_Pkg := RE_Attr_IEEE_Short;
+
+ when 15 =>
+ Fat_Type := RTE (RE_Fat_IEEE_Long);
+ Fat_Pkg := RE_Attr_IEEE_Long;
+
+ when others =>
+ raise Program_Error;
+ end case;
+
+ -- If neither the base type nor the root type is VAX_Float then VAX
+ -- float is out of the picture, and we can just use the root type.
+
+ else
+ Fat_Type := Rtyp;
+
+ if Fat_Type = Standard_Short_Float then
+ Fat_Pkg := RE_Attr_Short_Float;
+ elsif Fat_Type = Standard_Float then
+ Fat_Pkg := RE_Attr_Float;
+ elsif Fat_Type = Standard_Long_Float then
+ Fat_Pkg := RE_Attr_Long_Float;
+ elsif Fat_Type = Standard_Long_Long_Float then
+ Fat_Pkg := RE_Attr_Long_Long_Float;
+ else
+ raise Program_Error;
+ end if;
+ end if;
+ end Find_Fat_Info;
+
----------------------------
-- Find_Stream_Subprogram --
----------------------------
diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb
index ec6b9589286..56c3095b2df 100644
--- a/gcc/ada/exp_ch11.adb
+++ b/gcc/ada/exp_ch11.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_ch11.ads b/gcc/ada/exp_ch11.ads
index ff8e82cbdcd..85340d672df 100644
--- a/gcc/ada/exp_ch11.ads
+++ b/gcc/ada/exp_ch11.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_ch2.adb b/gcc/ada/exp_ch2.adb
index 56a294a5bad..0dcde3b24d7 100644
--- a/gcc/ada/exp_ch2.adb
+++ b/gcc/ada/exp_ch2.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 4b829214bf7..3feb7d33aaa 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,13 +79,6 @@ package body Exp_Ch3 is
-- used for attachment of any actions required in its construction.
-- It also supplies the source location used for the procedure.
- procedure Build_Class_Wide_Master (T : Entity_Id);
- -- for access to class-wide limited types we must build a task master
- -- because some subsequent extension may add a task component. To avoid
- -- bringing in the tasking run-time whenever an access-to-class-wide
- -- limited type is used, we use the soft-link mechanism and add a level
- -- of indirection to calls to routines that manipulate Master_Ids.
-
function Build_Discriminant_Formals
(Rec_Id : Entity_Id;
Use_Dl : Boolean) return List_Id;
@@ -651,6 +644,7 @@ package body Exp_Ch3 is
M_Id : Entity_Id;
Decl : Node_Id;
P : Node_Id;
+ Par : Node_Id;
begin
-- Nothing to do if there is no task hierarchy
@@ -659,6 +653,16 @@ package body Exp_Ch3 is
return;
end if;
+ -- Find declaration that created the access type: either a
+ -- type declaration, or an object declaration with an
+ -- access definition, in which case the type is anonymous.
+
+ if Is_Itype (T) then
+ P := Associated_Node_For_Itype (T);
+ else
+ P := Parent (T);
+ end if;
+
-- Nothing to do if we already built a master entity for this scope
if not Has_Master_Entity (Scope (T)) then
@@ -677,24 +681,24 @@ package body Exp_Ch3 is
Make_Explicit_Dereference (Loc,
New_Reference_To (RTE (RE_Current_Master), Loc)));
- P := Parent (T);
Insert_Before (P, Decl);
Analyze (Decl);
Set_Has_Master_Entity (Scope (T));
-- Now mark the containing scope as a task master
- while Nkind (P) /= N_Compilation_Unit loop
- P := Parent (P);
+ Par := P;
+ while Nkind (Par) /= N_Compilation_Unit loop
+ Par := Parent (Par);
-- If we fall off the top, we are at the outer level, and the
-- environment task is our effective master, so nothing to mark.
- if Nkind (P) = N_Task_Body
- or else Nkind (P) = N_Block_Statement
- or else Nkind (P) = N_Subprogram_Body
+ if Nkind (Par) = N_Task_Body
+ or else Nkind (Par) = N_Block_Statement
+ or else Nkind (Par) = N_Subprogram_Body
then
- Set_Is_Task_Master (P, True);
+ Set_Is_Task_Master (Par, True);
exit;
end if;
end loop;
@@ -711,7 +715,7 @@ package body Exp_Ch3 is
Defining_Identifier => M_Id,
Subtype_Mark => New_Reference_To (Standard_Integer, Loc),
Name => Make_Identifier (Loc, Name_uMaster));
- Insert_Before (Parent (T), Decl);
+ Insert_Before (P, Decl);
Analyze (Decl);
Set_Master_Id (T, M_Id);
@@ -1758,10 +1762,18 @@ package body Exp_Ch3 is
Aux_N : Node_Id;
begin
- if not Is_Interface (Typ)
- and then Etype (Typ) /= Typ
- then
- Init_Secondary_Tags_Internal (Etype (Typ));
+ if not Is_Interface (Typ) then
+
+ -- Climb to the ancestor (if any) handling private types
+
+ if Present (Full_View (Etype (Typ))) then
+ if Full_View (Etype (Typ)) /= Typ then
+ Init_Secondary_Tags_Internal (Full_View (Etype (Typ)));
+ end if;
+
+ elsif Etype (Typ) /= Typ then
+ Init_Secondary_Tags_Internal (Etype (Typ));
+ end if;
end if;
if Present (Abstract_Interfaces (Typ))
@@ -1824,7 +1836,14 @@ package body Exp_Ch3 is
-- interfaces.
ADT := Next_Elmt (First_Elmt (Access_Disp_Table (Typ)));
- Init_Secondary_Tags_Internal (Typ);
+
+ -- Handle private types
+
+ if Present (Full_View (Typ)) then
+ Init_Secondary_Tags_Internal (Full_View (Typ));
+ else
+ Init_Secondary_Tags_Internal (Typ);
+ end if;
end Init_Secondary_Tags;
-- Start of processing for Build_Init_Procedure
@@ -2478,6 +2497,13 @@ package body Exp_Ch3 is
return False;
end if;
+ -- If it is a type derived from a type with unknown discriminants,
+ -- we cannot build an initialization procedure for it.
+
+ if Has_Unknown_Discriminants (Rec_Id) then
+ return False;
+ end if;
+
-- Otherwise we need to generate an initialization procedure if
-- Is_CPP_Class is False and at least one of the following applies:
@@ -4547,34 +4573,52 @@ package body Exp_Ch3 is
ADT : Elist_Id := Access_Disp_Table (Def_Id);
procedure Add_Secondary_Tables (Typ : Entity_Id);
- -- Comment required ???
+ -- Internal subprogram, recursively climb to the ancestors
--------------------------
-- Add_Secondary_Tables --
--------------------------
procedure Add_Secondary_Tables (Typ : Entity_Id) is
- E : Entity_Id;
- Result : List_Id;
+ E : Entity_Id;
+ Iface : Elmt_Id;
+ Result : List_Id;
+ Suffix_Index : Int;
begin
- if Etype (Typ) /= Typ then
+ -- Climb to the ancestor (if any) handling private types
+
+ if Present (Full_View (Etype (Typ))) then
+ if Full_View (Etype (Typ)) /= Typ then
+ Add_Secondary_Tables (Full_View (Etype (Typ)));
+ end if;
+
+ elsif Etype (Typ) /= Typ then
Add_Secondary_Tables (Etype (Typ));
end if;
if Present (Abstract_Interfaces (Typ))
- and then not Is_Empty_Elmt_List
- (Abstract_Interfaces (Typ))
+ and then
+ not Is_Empty_Elmt_List (Abstract_Interfaces (Typ))
then
+ Iface := First_Elmt (Abstract_Interfaces (Typ));
+ Suffix_Index := 0;
+
E := First_Entity (Typ);
while Present (E) loop
if Is_Tag (E) and then Chars (E) /= Name_uTag then
- Make_Abstract_Interface_DT
- (AI_Tag => E,
+ Make_Secondary_DT
+ (Typ => Def_Id,
+ Ancestor_Typ => Typ,
+ Suffix_Index => Suffix_Index,
+ Iface => Node (Iface),
+ AI_Tag => E,
Acc_Disp_Tables => ADT,
Result => Result);
Append_Freeze_Actions (Def_Id, Result);
+ Suffix_Index := Suffix_Index + 1;
+ Next_Elmt (Iface);
end if;
Next_Entity (E);
@@ -4585,7 +4629,14 @@ package body Exp_Ch3 is
-- Start of processing to build secondary dispatch tables
begin
- Add_Secondary_Tables (Def_Id);
+ -- Handle private types
+
+ if Present (Full_View (Def_Id)) then
+ Add_Secondary_Tables (Full_View (Def_Id));
+ else
+ Add_Secondary_Tables (Def_Id);
+ end if;
+
Set_Access_Disp_Table (Def_Id, ADT);
Append_Freeze_Actions (Def_Id, Make_DT (Def_Id));
end;
@@ -4699,9 +4750,14 @@ package body Exp_Ch3 is
and then not Is_Interface (Def_Id)
and then not Is_Abstract (Def_Id)
and then not Is_Controlled (Def_Id)
- and then Implements_Limited_Interface (Def_Id)
+ and then
+ Implements_Interface
+ (Typ => Def_Id,
+ Kind => Any_Limited_Interface,
+ Check_Parent => True)
then
- Append_Freeze_Actions (Def_Id, Make_Disp_Select_Tables (Def_Id));
+ Append_Freeze_Actions (Def_Id,
+ Make_Select_Specific_Data_Table (Def_Id));
end if;
end if;
end Freeze_Record_Type;
@@ -5897,6 +5953,7 @@ package body Exp_Ch3 is
-- disp_asynchronous_select
-- disp_conditional_select
-- disp_get_prim_op_kind
+ -- disp_get_task_id
-- disp_timed_select
-- for limited interfaces and tagged types that implement a limited
-- interface.
@@ -5908,50 +5965,36 @@ package body Exp_Ch3 is
or else
(not Is_Abstract (Tag_Typ)
and then not Is_Controlled (Tag_Typ)
- and then Implements_Limited_Interface (Tag_Typ)))
+ and then
+ Implements_Interface
+ (Typ => Tag_Typ,
+ Kind => Any_Limited_Interface,
+ Check_Parent => True)))
then
- if Is_Interface (Tag_Typ) then
- Append_To (Res,
- Make_Abstract_Subprogram_Declaration (Loc,
- Specification =>
- Make_Disp_Asynchronous_Select_Spec (Tag_Typ)));
-
- Append_To (Res,
- Make_Abstract_Subprogram_Declaration (Loc,
- Specification =>
- Make_Disp_Conditional_Select_Spec (Tag_Typ)));
-
- Append_To (Res,
- Make_Abstract_Subprogram_Declaration (Loc,
- Specification =>
- Make_Disp_Get_Prim_Op_Kind_Spec (Tag_Typ)));
-
- Append_To (Res,
- Make_Abstract_Subprogram_Declaration (Loc,
- Specification =>
- Make_Disp_Timed_Select_Spec (Tag_Typ)));
+ Append_To (Res,
+ Make_Subprogram_Declaration (Loc,
+ Specification =>
+ Make_Disp_Asynchronous_Select_Spec (Tag_Typ)));
- else
- Append_To (Res,
- Make_Subprogram_Declaration (Loc,
- Specification =>
- Make_Disp_Asynchronous_Select_Spec (Tag_Typ)));
+ Append_To (Res,
+ Make_Subprogram_Declaration (Loc,
+ Specification =>
+ Make_Disp_Conditional_Select_Spec (Tag_Typ)));
- Append_To (Res,
- Make_Subprogram_Declaration (Loc,
- Specification =>
- Make_Disp_Conditional_Select_Spec (Tag_Typ)));
+ Append_To (Res,
+ Make_Subprogram_Declaration (Loc,
+ Specification =>
+ Make_Disp_Get_Prim_Op_Kind_Spec (Tag_Typ)));
- Append_To (Res,
- Make_Subprogram_Declaration (Loc,
- Specification =>
- Make_Disp_Get_Prim_Op_Kind_Spec (Tag_Typ)));
+ Append_To (Res,
+ Make_Subprogram_Declaration (Loc,
+ Specification =>
+ Make_Disp_Get_Task_Id_Spec (Tag_Typ)));
- Append_To (Res,
- Make_Subprogram_Declaration (Loc,
- Specification =>
- Make_Disp_Timed_Select_Spec (Tag_Typ)));
- end if;
+ Append_To (Res,
+ Make_Subprogram_Declaration (Loc,
+ Specification =>
+ Make_Disp_Timed_Select_Spec (Tag_Typ)));
end if;
-- Specs for finalization actions that may be required in case a
@@ -6310,26 +6353,33 @@ package body Exp_Ch3 is
end if;
-- Generate the bodies for the following primitive operations:
+
-- disp_asynchronous_select
-- disp_conditional_select
-- disp_get_prim_op_kind
+ -- disp_get_task_id
-- disp_timed_select
- -- for tagged types that implement a limited interface.
+
+ -- for limited interfaces and tagged types that implement a limited
+ -- interface. The interface versions will have null bodies.
if Ada_Version >= Ada_05
- and then not Is_Interface (Tag_Typ)
- and then not Is_Abstract (Tag_Typ)
- and then not Is_Controlled (Tag_Typ)
- and then Implements_Limited_Interface (Tag_Typ)
+ and then
+ ((Is_Interface (Tag_Typ) and then Is_Limited_Record (Tag_Typ))
+ or else
+ (not Is_Abstract (Tag_Typ)
+ and then not Is_Controlled (Tag_Typ)
+ and then
+ Implements_Interface
+ (Typ => Tag_Typ,
+ Kind => Any_Limited_Interface,
+ Check_Parent => True)))
then
- Append_To (Res,
- Make_Disp_Asynchronous_Select_Body (Tag_Typ));
- Append_To (Res,
- Make_Disp_Conditional_Select_Body (Tag_Typ));
- Append_To (Res,
- Make_Disp_Get_Prim_Op_Kind_Body (Tag_Typ));
- Append_To (Res,
- Make_Disp_Timed_Select_Body (Tag_Typ));
+ Append_To (Res, Make_Disp_Asynchronous_Select_Body (Tag_Typ));
+ Append_To (Res, Make_Disp_Conditional_Select_Body (Tag_Typ));
+ Append_To (Res, Make_Disp_Get_Prim_Op_Kind_Body (Tag_Typ));
+ Append_To (Res, Make_Disp_Get_Task_Id_Body (Tag_Typ));
+ Append_To (Res, Make_Disp_Timed_Select_Body (Tag_Typ));
end if;
if not Is_Limited_Type (Tag_Typ) then
@@ -6337,23 +6387,23 @@ package body Exp_Ch3 is
-- Body for equality
if Eq_Needed then
+ Decl :=
+ Predef_Spec_Or_Body (Loc,
+ Tag_Typ => Tag_Typ,
+ Name => Eq_Name,
+ Profile => New_List (
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc, Name_X),
+ Parameter_Type => New_Reference_To (Tag_Typ, Loc)),
- Decl := Predef_Spec_Or_Body (Loc,
- Tag_Typ => Tag_Typ,
- Name => Eq_Name,
- Profile => New_List (
- Make_Parameter_Specification (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, Name_X),
- Parameter_Type => New_Reference_To (Tag_Typ, Loc)),
-
- Make_Parameter_Specification (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, Name_Y),
- Parameter_Type => New_Reference_To (Tag_Typ, Loc))),
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc, Name_Y),
+ Parameter_Type => New_Reference_To (Tag_Typ, Loc))),
- Ret_Type => Standard_Boolean,
- For_Body => True);
+ Ret_Type => Standard_Boolean,
+ For_Body => True);
declare
Def : constant Node_Id := Parent (Tag_Typ);
@@ -6403,19 +6453,20 @@ package body Exp_Ch3 is
-- Body for dispatching assignment
- Decl := Predef_Spec_Or_Body (Loc,
- Tag_Typ => Tag_Typ,
- Name => Name_uAssign,
- Profile => New_List (
- Make_Parameter_Specification (Loc,
- Defining_Identifier => Make_Defining_Identifier (Loc, Name_X),
- Out_Present => True,
- Parameter_Type => New_Reference_To (Tag_Typ, Loc)),
-
- Make_Parameter_Specification (Loc,
- Defining_Identifier => Make_Defining_Identifier (Loc, Name_Y),
- Parameter_Type => New_Reference_To (Tag_Typ, Loc))),
- For_Body => True);
+ Decl :=
+ Predef_Spec_Or_Body (Loc,
+ Tag_Typ => Tag_Typ,
+ Name => Name_uAssign,
+ Profile => New_List (
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier => Make_Defining_Identifier (Loc, Name_X),
+ Out_Present => True,
+ Parameter_Type => New_Reference_To (Tag_Typ, Loc)),
+
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier => Make_Defining_Identifier (Loc, Name_Y),
+ Parameter_Type => New_Reference_To (Tag_Typ, Loc))),
+ For_Body => True);
Set_Handled_Statement_Sequence (Decl,
Make_Handled_Sequence_Of_Statements (Loc, New_List (
@@ -6541,6 +6592,7 @@ package body Exp_Ch3 is
return
not (Is_Limited_Type (Typ)
and then not Has_Inheritable_Stream_Attribute)
+ and then not Has_Unknown_Discriminants (Typ)
and then RTE_Available (RE_Tag)
and then RTE_Available (RE_Root_Stream_Type)
and then not Restriction_Active (No_Dispatch)
diff --git a/gcc/ada/exp_ch3.ads b/gcc/ada/exp_ch3.ads
index f4d6097dce0..ce2b7990a11 100644
--- a/gcc/ada/exp_ch3.ads
+++ b/gcc/ada/exp_ch3.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -40,12 +40,21 @@ package Exp_Ch3 is
procedure Expand_Previous_Access_Type (Def_Id : Entity_Id);
-- For a full type declaration that contains tasks, or that is a task,
-- check whether there exists an access type whose designated type is an
- -- incomplete declarations for the current composite type. If so, build
- -- the master for that access type, now that it is known to denote an
- -- object with tasks.
+ -- incomplete declarations for the current composite type. If so, build the
+ -- master for that access type, now that it is known to denote an object
+ -- with tasks.
procedure Expand_Record_Extension (T : Entity_Id; Def : Node_Id);
- -- Add a field _parent in the extension part of the record.
+ -- Add a field _parent in the extension part of the record
+
+ procedure Build_Class_Wide_Master (T : Entity_Id);
+ -- For access to class-wide limited types we must build a task master
+ -- because some subsequent extension may add a task component. To avoid
+ -- bringing in the tasking run-time whenever an access-to-class-wide
+ -- limited type is used, we use the soft-link mechanism and add a level of
+ -- indirection to calls to routines that manipulate Master_Ids. This must
+ -- also be used for anonymous access types whose designated type is a task
+ -- or synchronized interface.
procedure Build_Discr_Checking_Funcs (N : Node_Id);
-- Builds function which checks whether the component name is consistent
@@ -66,10 +75,10 @@ package Exp_Ch3 is
-- constructed tree, and Typ is the type of the entity (the initialization
-- procedure of the base type is the procedure that actually gets called).
-- In_Init_Proc has to be set to True when the call is itself in an init
- -- proc in order to enable the use of discriminals. Enclos_type is the
- -- type of the init proc and it is used for various expansion cases
- -- including the case where Typ is a task type which is a array component,
- -- the indices of the enclosing type are used to build the string that
+ -- proc in order to enable the use of discriminals. Enclos_type is the type
+ -- of the init proc and it is used for various expansion cases including
+ -- the case where Typ is a task type which is a array component, the
+ -- indices of the enclosing type are used to build the string that
-- identifies each task at runtime.
--
-- Discr_Map is used to replace discriminants by their discriminals in
@@ -84,33 +93,32 @@ package Exp_Ch3 is
function Freeze_Type (N : Node_Id) return Boolean;
-- This function executes the freezing actions associated with the given
- -- freeze type node N and returns True if the node is to be deleted.
- -- We delete the node if it is present just for front end purpose and
- -- we don't want Gigi to see the node. This function can't delete the
- -- node itself since it would confuse any remaining processing of the
- -- freeze node.
+ -- freeze type node N and returns True if the node is to be deleted. We
+ -- delete the node if it is present just for front end purpose and we don't
+ -- want Gigi to see the node. This function can't delete the node itself
+ -- since it would confuse any remaining processing of the freeze node.
function Needs_Simple_Initialization (T : Entity_Id) return Boolean;
-- Certain types need initialization even though there is no specific
- -- initialization routine. In this category are access types (which
- -- need initializing to null), packed array types whose implementation
- -- is a modular type, and all scalar types if Normalize_Scalars is set,
- -- as well as private types whose underlying type is present and meets
- -- any of these criteria. Finally, descendants of String and Wide_String
- -- also need initialization in Initialize/Normalize_Scalars mode.
+ -- initialization routine. In this category are access types (which need
+ -- initializing to null), packed array types whose implementation is a
+ -- modular type, and all scalar types if Normalize_Scalars is set, as well
+ -- as private types whose underlying type is present and meets any of these
+ -- criteria. Finally, descendants of String and Wide_String also need
+ -- initialization in Initialize/Normalize_Scalars mode.
function Get_Simple_Init_Val
(T : Entity_Id;
Loc : Source_Ptr;
Size : Uint := No_Uint) return Node_Id;
- -- For a type which Needs_Simple_Initialization (see above), prepares
- -- the tree for an expression representing the required initial value.
- -- Loc is the source location used in constructing this tree which is
- -- returned as the result of the call. The Size parameter indicates the
- -- target size of the object if it is known (indicated by a value that
- -- is not No_Uint and is greater than zero). If Size is not given (Size
- -- set to No_Uint, or non-positive), then the Esize of T is used as an
- -- estimate of the Size. The object size is needed to prepare a known
- -- invalid value for use by Normalize_Scalars.
+ -- For a type which Needs_Simple_Initialization (see above), prepares the
+ -- tree for an expression representing the required initial value. Loc is
+ -- the source location used in constructing this tree which is returned as
+ -- the result of the call. The Size parameter indicates the target size of
+ -- the object if it is known (indicated by a value that is not No_Uint and
+ -- is greater than zero). If Size is not given (Size set to No_Uint, or
+ -- non-positive), then the Esize of T is used as an estimate of the Size.
+ -- The object size is needed to prepare a known invalid value for use by
+ -- Normalize_Scalars.
end Exp_Ch3;
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index fbdb701550a..2e1f38f88e4 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -38,6 +38,7 @@ with Exp_Pakd; use Exp_Pakd;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Exp_VFpt; use Exp_VFpt;
+with Freeze; use Freeze;
with Hostparm; use Hostparm;
with Inline; use Inline;
with Nlists; use Nlists;
@@ -361,14 +362,15 @@ package body Exp_Ch4 is
---------------------------------
procedure Expand_Allocator_Expression (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
- Exp : constant Node_Id := Expression (Expression (N));
- Indic : constant Node_Id := Subtype_Mark (Expression (N));
- PtrT : constant Entity_Id := Etype (N);
- T : constant Entity_Id := Entity (Indic);
- Flist : Node_Id;
- Node : Node_Id;
- Temp : Entity_Id;
+ Loc : constant Source_Ptr := Sloc (N);
+ Exp : constant Node_Id := Expression (Expression (N));
+ Indic : constant Node_Id := Subtype_Mark (Expression (N));
+ PtrT : constant Entity_Id := Etype (N);
+ DesigT : constant Entity_Id := Designated_Type (PtrT);
+ T : constant Entity_Id := Entity (Indic);
+ Flist : Node_Id;
+ Node : Node_Id;
+ Temp : Entity_Id;
Aggr_In_Place : constant Boolean := Is_Delayed_Aggregate (Exp);
@@ -456,7 +458,7 @@ package body Exp_Ch4 is
-- body, so a run-time check is needed in general.
if Ada_Version >= Ada_05
- and then Is_Class_Wide_Type (Designated_Type (PtrT))
+ and then Is_Class_Wide_Type (DesigT)
and then not Scope_Suppress (Accessibility_Check)
and then
(Is_Class_Wide_Type (Etype (Exp))
@@ -539,7 +541,7 @@ package body Exp_Ch4 is
end;
end if;
- if Controlled_Type (Designated_Type (PtrT))
+ if Controlled_Type (DesigT)
and then Controlled_Type (T)
then
declare
@@ -629,14 +631,14 @@ package body Exp_Ch4 is
Rewrite (N, New_Reference_To (Temp, Loc));
Analyze_And_Resolve (N, PtrT);
- elsif Is_Access_Type (Designated_Type (PtrT))
+ elsif Is_Access_Type (DesigT)
and then Nkind (Exp) = N_Allocator
and then Nkind (Expression (Exp)) /= N_Qualified_Expression
then
-- Apply constraint to designated subtype indication
Apply_Constraint_Check (Expression (Exp),
- Designated_Type (Designated_Type (PtrT)),
+ Designated_Type (DesigT),
No_Sliding => True);
if Nkind (Expression (Exp)) = N_Raise_Constraint_Error then
@@ -663,12 +665,12 @@ package body Exp_Ch4 is
-- on the qualified expression does not allow sliding,
-- but this check does (a relaxation from Ada 83).
- if Is_Constrained (Designated_Type (PtrT))
+ if Is_Constrained (DesigT)
and then not Subtypes_Statically_Match
- (T, Designated_Type (PtrT))
+ (T, DesigT)
then
Apply_Constraint_Check
- (Exp, Designated_Type (PtrT), No_Sliding => False);
+ (Exp, DesigT, No_Sliding => False);
-- The nonsliding check should really be performed
-- (unconditionally) against the subtype of the
@@ -677,8 +679,33 @@ package body Exp_Ch4 is
else
Apply_Constraint_Check
- (Exp, Designated_Type (PtrT), No_Sliding => True);
+ (Exp, DesigT, No_Sliding => True);
+ end if;
+
+ -- For an access to unconstrained packed array, GIGI needs
+ -- to see an expression with a constrained subtype in order
+ -- to compute the proper size for the allocator.
+
+ if Is_Array_Type (T)
+ and then not Is_Constrained (T)
+ and then Is_Packed (T)
+ then
+ declare
+ ConstrT : constant Entity_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('A'));
+ Internal_Exp : constant Node_Id := Relocate_Node (Exp);
+ begin
+ Insert_Action (Exp,
+ Make_Subtype_Declaration (Loc,
+ Defining_Identifier => ConstrT,
+ Subtype_Indication =>
+ Make_Subtype_From_Expr (Exp, T)));
+ Freeze_Itype (ConstrT, Exp);
+ Rewrite (Exp, OK_Convert_To (ConstrT, Internal_Exp));
+ end;
end if;
+
end if;
exception
@@ -3854,13 +3881,6 @@ package body Exp_Ch4 is
begin
Binary_Op_Validity_Checks (N);
- -- Vax_Float is a special case
-
- if Vax_Float (Typ) then
- Expand_Vax_Arith (N);
- return;
- end if;
-
-- N / 1 = N for integer types
if Is_Integer_Type (Typ)
@@ -3951,7 +3971,7 @@ package body Exp_Ch4 is
Analyze_And_Resolve (Left_Opnd (N), Universal_Real);
- -- Non-fixed point cases, do zero divide and overflow checks
+ -- Non-fixed point cases, do integer zero divide and overflow checks
elsif Is_Integer_Type (Typ) then
Apply_Divide_Check (N);
@@ -3963,6 +3983,12 @@ package body Exp_Ch4 is
then
Error_Msg_CRT ("64-bit division", N);
end if;
+
+ -- Deal with Vax_Float
+
+ elsif Vax_Float (Typ) then
+ Expand_Vax_Arith (N);
+ return;
end if;
end Expand_N_Op_Divide;
@@ -4023,7 +4049,7 @@ package body Exp_Ch4 is
begin
-- Per-object constrained selected components require special
-- attention. If the enclosing scope of the component is an
- -- Unchecked_Union, we can not reference its discriminants
+ -- Unchecked_Union, we cannot reference its discriminants
-- directly. This is why we use the two extra parameters of
-- the equality function of the enclosing Unchecked_Union.
@@ -4239,14 +4265,13 @@ package body Exp_Ch4 is
return False;
end if;
+ -- We only need to test one component
+
declare
Comp : Node_Id := First (Component_Items (Clist));
begin
while Present (Comp) loop
-
- -- One component is sufficent
-
if Component_Is_Unconstrained_UU (Comp) then
return True;
end if;
@@ -4324,9 +4349,10 @@ package body Exp_Ch4 is
if Ekind (Typl) = E_Private_Type then
Typl := Underlying_Type (Typl);
-
elsif Ekind (Typl) = E_Private_Subtype then
Typl := Underlying_Type (Base_Type (Typl));
+ else
+ null;
end if;
-- It may happen in error situations that the underlying type is not
@@ -4339,15 +4365,9 @@ package body Exp_Ch4 is
Typl := Base_Type (Typl);
- -- Vax float types
-
- if Vax_Float (Typl) then
- Expand_Vax_Comparison (N);
- return;
-
-- Boolean types (requiring handling of non-standard case)
- elsif Is_Boolean_Type (Typl) then
+ if Is_Boolean_Type (Typl) then
Adjust_Condition (Left_Opnd (N));
Adjust_Condition (Right_Opnd (N));
Set_Etype (N, Standard_Boolean);
@@ -4551,11 +4571,18 @@ package body Exp_Ch4 is
end if;
-- If we still have an equality comparison (i.e. it was not rewritten
- -- in some way), then we can test if result is needed at compile time).
+ -- in some way), then we can test if result is known at compile time).
if Nkind (N) = N_Op_Eq then
Rewrite_Comparison (N);
end if;
+
+ -- If we still have comparison for Vax_Float, process it
+
+ if Vax_Float (Typl) and then Nkind (N) in N_Op_Compare then
+ Expand_Vax_Comparison (N);
+ return;
+ end if;
end Expand_N_Op_Eq;
-----------------------
@@ -4870,11 +4897,7 @@ package body Exp_Ch4 is
begin
Binary_Op_Validity_Checks (N);
- if Vax_Float (Typ1) then
- Expand_Vax_Comparison (N);
- return;
-
- elsif Is_Array_Type (Typ1) then
+ if Is_Array_Type (Typ1) then
Expand_Array_Comparison (N);
return;
end if;
@@ -4887,6 +4910,13 @@ package body Exp_Ch4 is
end if;
Rewrite_Comparison (N);
+
+ -- If we still have comparison, and Vax_Float type, process it
+
+ if Vax_Float (Typ1) and then Nkind (N) in N_Op_Compare then
+ Expand_Vax_Comparison (N);
+ return;
+ end if;
end Expand_N_Op_Ge;
--------------------
@@ -4902,11 +4932,7 @@ package body Exp_Ch4 is
begin
Binary_Op_Validity_Checks (N);
- if Vax_Float (Typ1) then
- Expand_Vax_Comparison (N);
- return;
-
- elsif Is_Array_Type (Typ1) then
+ if Is_Array_Type (Typ1) then
Expand_Array_Comparison (N);
return;
end if;
@@ -4919,6 +4945,13 @@ package body Exp_Ch4 is
end if;
Rewrite_Comparison (N);
+
+ -- If we still have comparison, and Vax_Float type, process it
+
+ if Vax_Float (Typ1) and then Nkind (N) in N_Op_Compare then
+ Expand_Vax_Comparison (N);
+ return;
+ end if;
end Expand_N_Op_Gt;
--------------------
@@ -4934,11 +4967,7 @@ package body Exp_Ch4 is
begin
Binary_Op_Validity_Checks (N);
- if Vax_Float (Typ1) then
- Expand_Vax_Comparison (N);
- return;
-
- elsif Is_Array_Type (Typ1) then
+ if Is_Array_Type (Typ1) then
Expand_Array_Comparison (N);
return;
end if;
@@ -4951,6 +4980,13 @@ package body Exp_Ch4 is
end if;
Rewrite_Comparison (N);
+
+ -- If we still have comparison, and Vax_Float type, process it
+
+ if Vax_Float (Typ1) and then Nkind (N) in N_Op_Compare then
+ Expand_Vax_Comparison (N);
+ return;
+ end if;
end Expand_N_Op_Le;
--------------------
@@ -4966,11 +5002,7 @@ package body Exp_Ch4 is
begin
Binary_Op_Validity_Checks (N);
- if Vax_Float (Typ1) then
- Expand_Vax_Comparison (N);
- return;
-
- elsif Is_Array_Type (Typ1) then
+ if Is_Array_Type (Typ1) then
Expand_Array_Comparison (N);
return;
end if;
@@ -4983,6 +5015,13 @@ package body Exp_Ch4 is
end if;
Rewrite_Comparison (N);
+
+ -- If we still have comparison, and Vax_Float type, process it
+
+ if Vax_Float (Typ1) and then Nkind (N) in N_Op_Compare then
+ Expand_Vax_Comparison (N);
+ return;
+ end if;
end Expand_N_Op_Lt;
-----------------------
@@ -5187,13 +5226,6 @@ package body Exp_Ch4 is
end if;
end if;
- -- Deal with VAX float case
-
- if Vax_Float (Typ) then
- Expand_Vax_Arith (N);
- return;
- end if;
-
-- Convert x * 2 ** y to Shift_Left (x, y). Note that the fact that
-- Is_Power_Of_2_For_Shift is set means that we know that our left
-- operand is an integer, as required for this to work.
@@ -5304,6 +5336,12 @@ package body Exp_Ch4 is
elsif Is_Signed_Integer_Type (Etype (N)) then
Apply_Arithmetic_Overflow_Check (N);
+
+ -- Deal with VAX float case
+
+ elsif Vax_Float (Typ) then
+ Expand_Vax_Arith (N);
+ return;
end if;
end Expand_N_Op_Multiply;
@@ -5311,39 +5349,74 @@ package body Exp_Ch4 is
-- Expand_N_Op_Ne --
--------------------
- -- Rewrite node as the negation of an equality operation, and reanalyze.
- -- The equality to be used is defined in the same scope and has the same
- -- signature. It must be set explicitly because in an instance it may not
- -- have the same visibility as in the generic unit.
-
procedure Expand_N_Op_Ne (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
- Neg : Node_Id;
- Ne : constant Entity_Id := Entity (N);
+ Typ : constant Entity_Id := Etype (Left_Opnd (N));
begin
- Binary_Op_Validity_Checks (N);
+ -- Case of elementary type with standard operator
- Neg :=
- Make_Op_Not (Loc,
- Right_Opnd =>
- Make_Op_Eq (Loc,
- Left_Opnd => Left_Opnd (N),
- Right_Opnd => Right_Opnd (N)));
- Set_Paren_Count (Right_Opnd (Neg), 1);
+ if Is_Elementary_Type (Typ)
+ and then Sloc (Entity (N)) = Standard_Location
+ then
+ Binary_Op_Validity_Checks (N);
- if Scope (Ne) /= Standard_Standard then
- Set_Entity (Right_Opnd (Neg), Corresponding_Equality (Ne));
- end if;
+ -- Boolean types (requiring handling of non-standard case)
- -- For navigation purposes, the inequality is treated as an implicit
- -- reference to the corresponding equality. Preserve the Comes_From_
- -- source flag so that the proper Xref entry is generated.
+ if Is_Boolean_Type (Typ) then
+ Adjust_Condition (Left_Opnd (N));
+ Adjust_Condition (Right_Opnd (N));
+ Set_Etype (N, Standard_Boolean);
+ Adjust_Result_Type (N, Typ);
+ end if;
- Preserve_Comes_From_Source (Neg, N);
- Preserve_Comes_From_Source (Right_Opnd (Neg), N);
- Rewrite (N, Neg);
- Analyze_And_Resolve (N, Standard_Boolean);
+ Rewrite_Comparison (N);
+
+ -- If we still have comparison for Vax_Float, process it
+
+ if Vax_Float (Typ) and then Nkind (N) in N_Op_Compare then
+ Expand_Vax_Comparison (N);
+ return;
+ end if;
+
+ -- For all cases other than elementary types, we rewrite node as the
+ -- negation of an equality operation, and reanalyze. The equality to be
+ -- used is defined in the same scope and has the same signature. This
+ -- signature must be set explicitly since in an instance it may not have
+ -- the same visibility as in the generic unit. This avoids duplicating
+ -- or factoring the complex code for record/array equality tests etc.
+
+ else
+ declare
+ Loc : constant Source_Ptr := Sloc (N);
+ Neg : Node_Id;
+ Ne : constant Entity_Id := Entity (N);
+
+ begin
+ Binary_Op_Validity_Checks (N);
+
+ Neg :=
+ Make_Op_Not (Loc,
+ Right_Opnd =>
+ Make_Op_Eq (Loc,
+ Left_Opnd => Left_Opnd (N),
+ Right_Opnd => Right_Opnd (N)));
+ Set_Paren_Count (Right_Opnd (Neg), 1);
+
+ if Scope (Ne) /= Standard_Standard then
+ Set_Entity (Right_Opnd (Neg), Corresponding_Equality (Ne));
+ end if;
+
+ -- For navigation purposes, the inequality is treated as an
+ -- implicit reference to the corresponding equality. Preserve the
+ -- Comes_From_ source flag so that the proper Xref entry is
+ -- generated.
+
+ Preserve_Comes_From_Source (Neg, N);
+ Preserve_Comes_From_Source (Right_Opnd (Neg), N);
+ Rewrite (N, Neg);
+ Analyze_And_Resolve (N, Standard_Boolean);
+ end;
+ end if;
end Expand_N_Op_Ne;
---------------------
@@ -6480,8 +6553,8 @@ package body Exp_Ch4 is
-- then we do not trust it to be in range (might be infinite)
declare
- S_Lo : constant Node_Id := Type_Low_Bound (Xtyp);
- S_Hi : constant Node_Id := Type_High_Bound (Xtyp);
+ S_Lo : constant Node_Id := Type_Low_Bound (Xtyp);
+ S_Hi : constant Node_Id := Type_High_Bound (Xtyp);
begin
if (not Is_Floating_Point_Type (Xtyp)
@@ -6533,9 +6606,9 @@ package body Exp_Ch4 is
(Subtype_Mark (Conv), New_Occurrence_Of (Btyp, Loc));
Set_Etype (Conv, Btyp);
- -- Enable overflow except in the case of integer to float
- -- conversions, where it is never required, since we can
- -- never have overflow in this case.
+ -- Enable overflow except for case of integer to float conversions,
+ -- where it is never required, since we can never have overflow in
+ -- this case.
if not Is_Integer_Type (Etype (Operand)) then
Enable_Overflow_Check (Conv);
@@ -6588,13 +6661,6 @@ package body Exp_Ch4 is
return;
end if;
- -- Deal with Vax floating-point cases
-
- if Vax_Float (Operand_Type) or else Vax_Float (Target_Type) then
- Expand_Vax_Conversion (N);
- return;
- end if;
-
-- Nothing to do if this is the second argument of read. This
-- is a "backwards" conversion that will be handled by the
-- specialized code in attribute processing.
@@ -6881,7 +6947,7 @@ package body Exp_Ch4 is
-- this type with proper overflow checking, and so gigi is doing an
-- approximation of what is required by doing floating-point compares
-- with the end-point. But that can lose precision in some cases, and
- -- give a wrong result. Converting the operand to Long_Long_Float is
+ -- give a wrong result. Converting the operand to Universal_Real is
-- helpful, but still does not catch all cases with 64-bit integers
-- on targets with only 64-bit floats ???
@@ -6889,11 +6955,11 @@ package body Exp_Ch4 is
Rewrite (Operand,
Make_Type_Conversion (Loc,
Subtype_Mark =>
- New_Occurrence_Of (Standard_Long_Long_Float, Loc),
+ New_Occurrence_Of (Universal_Real, Loc),
Expression =>
Relocate_Node (Operand)));
- Set_Etype (Operand, Standard_Long_Long_Float);
+ Set_Etype (Operand, Universal_Real);
Enable_Range_Check (Operand);
Set_Do_Range_Check (Expression (Operand), False);
end if;
@@ -6986,11 +7052,6 @@ package body Exp_Ch4 is
elsif Is_Floating_Point_Type (Target_Type) then
Real_Range_Check;
-
- -- The remaining cases require no front end processing
-
- else
- null;
end if;
-- At this stage, either the conversion node has been transformed
@@ -7065,6 +7126,16 @@ package body Exp_Ch4 is
end if;
end;
end if;
+
+ -- Final step, if the result is a type conversion involving Vax_Float
+ -- types, then it is subject for further special processing.
+
+ if Nkind (N) = N_Type_Conversion
+ and then (Vax_Float (Operand_Type) or else Vax_Float (Target_Type))
+ then
+ Expand_Vax_Conversion (N);
+ return;
+ end if;
end Expand_N_Type_Conversion;
-----------------------------------
@@ -7803,7 +7874,6 @@ package body Exp_Ch4 is
Statements => New_List (If_Stat)));
return Func_Body;
-
end Make_Array_Comparison_Op;
---------------------------
@@ -7960,6 +8030,18 @@ package body Exp_Ch4 is
True_Result := Res in Compare_GE;
False_Result := Res = LT;
+ if Res = LE
+ and then Constant_Condition_Warnings
+ and then Comes_From_Source (Original_Node (N))
+ and then Nkind (Original_Node (N)) = N_Op_Ge
+ and then not In_Instance
+ and then not Warnings_Off (Etype (Left_Opnd (N)))
+ and then Is_Integer_Type (Etype (Left_Opnd (N)))
+ then
+ Error_Msg_N
+ ("can never be greater than, could replace by ""'=""?", N);
+ end if;
+
when N_Op_Gt =>
True_Result := Res = GT;
False_Result := Res in Compare_LE;
@@ -7972,9 +8054,21 @@ package body Exp_Ch4 is
True_Result := Res in Compare_LE;
False_Result := Res = GT;
+ if Res = GE
+ and then Constant_Condition_Warnings
+ and then Comes_From_Source (Original_Node (N))
+ and then Nkind (Original_Node (N)) = N_Op_Le
+ and then not In_Instance
+ and then not Warnings_Off (Etype (Left_Opnd (N)))
+ and then Is_Integer_Type (Etype (Left_Opnd (N)))
+ then
+ Error_Msg_N
+ ("can never be less than, could replace by ""'=""?", N);
+ end if;
+
when N_Op_Ne =>
- True_Result := Res = NE;
- False_Result := Res = LT or else Res = GT or else Res = EQ;
+ True_Result := Res = NE or else Res = GT or else Res = LT;
+ False_Result := Res = EQ;
end case;
if True_Result then
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index 54da8cb4811..af7cd2426f7 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -45,6 +45,7 @@ with Rtsfind; use Rtsfind;
with Sinfo; use Sinfo;
with Sem; use Sem;
with Sem_Ch3; use Sem_Ch3;
+with Sem_Ch5; use Sem_Ch5;
with Sem_Ch8; use Sem_Ch8;
with Sem_Ch13; use Sem_Ch13;
with Sem_Eval; use Sem_Eval;
@@ -1808,7 +1809,11 @@ package body Exp_Ch5 is
end;
end if;
- Analyze (N);
+ -- N has been rewritten to a block statement for which it is
+ -- known by construction that no checks are necessary: analyze
+ -- it with all checks suppressed.
+
+ Analyze (N, Suppress => All_Checks);
return;
end Tagged_Case;
@@ -2259,6 +2264,13 @@ package body Exp_Ch5 is
Set_Condition (N, Condition (Hed));
Set_Then_Statements (N, Then_Statements (Hed));
+ -- Hed might have been captured as the condition determining
+ -- the current value for an entity. Now it is detached from
+ -- the tree, so a Current_Value pointer in the condition might
+ -- need to be updated.
+
+ Check_Possible_Current_Value_Condition (N);
+
if Is_Empty_List (Elsif_Parts (N)) then
Set_Elsif_Parts (N, No_List);
end if;
@@ -2762,123 +2774,38 @@ package body Exp_Ch5 is
Analyze (Exp);
end if;
- -- Implement the rules of 6.5(8-10), which require a tag check in
- -- the case of a limited tagged return type, and tag reassignment
- -- for nonlimited tagged results. These actions are needed when
- -- the return type is a specific tagged type and the result
- -- expression is a conversion or a formal parameter, because in
- -- that case the tag of the expression might differ from the tag
- -- of the specific result type.
-
- if Is_Tagged_Type (Utyp)
- and then not Is_Class_Wide_Type (Utyp)
- and then (Nkind (Exp) = N_Type_Conversion
- or else Nkind (Exp) = N_Unchecked_Type_Conversion
- or else (Is_Entity_Name (Exp)
- and then Ekind (Entity (Exp)) in Formal_Kind))
- then
- -- When the return type is limited, perform a check that the
- -- tag of the result is the same as the tag of the return type.
-
- if Is_Limited_Type (Return_Type) then
- Insert_Action (Exp,
- Make_Raise_Constraint_Error (Loc,
- Condition =>
- Make_Op_Ne (Loc,
- Left_Opnd =>
- Make_Selected_Component (Loc,
- Prefix => Duplicate_Subexpr (Exp),
- Selector_Name =>
- New_Reference_To (First_Tag_Component (Utyp), Loc)),
- Right_Opnd =>
- Unchecked_Convert_To (RTE (RE_Tag),
- New_Reference_To
- (Node (First_Elmt
- (Access_Disp_Table (Base_Type (Utyp)))),
- Loc))),
- Reason => CE_Tag_Check_Failed));
-
- -- If the result type is a specific nonlimited tagged type,
- -- then we have to ensure that the tag of the result is that
- -- of the result type. This is handled by making a copy of the
- -- expression in the case where it might have a different tag,
- -- namely when the expression is a conversion or a formal
- -- parameter. We create a new object of the result type and
- -- initialize it from the expression, which will implicitly
- -- force the tag to be set appropriately.
-
- else
- Result_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
- Result_Exp := New_Reference_To (Result_Id, Loc);
-
- Result_Obj :=
- Make_Object_Declaration (Loc,
- Defining_Identifier => Result_Id,
- Object_Definition => New_Reference_To (Return_Type, Loc),
- Constant_Present => True,
- Expression => Relocate_Node (Exp));
-
- Set_Assignment_OK (Result_Obj);
- Insert_Action (Exp, Result_Obj);
-
- Rewrite (Exp, Result_Exp);
- Analyze_And_Resolve (Exp, Return_Type);
- end if;
-
- -- Ada 2005 (AI-344): If the result type is class-wide, then insert
- -- a check that the level of the return expression's underlying type
- -- is not deeper than the level of the master enclosing the function.
- -- Always generate the check when the type of the return expression
- -- is class-wide, when it's a type conversion, or when it's a formal
- -- parameter. Otherwise, suppress the check in the case where the
- -- return expression has a specific type whose level is known not to
- -- be statically deeper than the function's result type.
-
- elsif Ada_Version >= Ada_05
- and then Is_Class_Wide_Type (Return_Type)
- and then not Scope_Suppress (Accessibility_Check)
- and then
- (Is_Class_Wide_Type (Etype (Exp))
- or else Nkind (Exp) = N_Type_Conversion
- or else Nkind (Exp) = N_Unchecked_Type_Conversion
- or else (Is_Entity_Name (Exp)
- and then Ekind (Entity (Exp)) in Formal_Kind)
- or else Scope_Depth (Enclosing_Dynamic_Scope (Etype (Exp))) >
- Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id)))
- then
- Insert_Action (Exp,
- Make_Raise_Program_Error (Loc,
- Condition =>
- Make_Op_Gt (Loc,
- Left_Opnd =>
- Make_Function_Call (Loc,
- Name =>
- New_Reference_To
- (RTE (RE_Get_Access_Level), Loc),
- Parameter_Associations =>
- New_List (Make_Attribute_Reference (Loc,
- Prefix =>
- Duplicate_Subexpr (Exp),
- Attribute_Name =>
- Name_Tag))),
- Right_Opnd =>
- Make_Integer_Literal (Loc,
- Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id)))),
- Reason => PE_Accessibility_Check_Failed));
- end if;
-
-- Deal with returning variable length objects and controlled types
-- Nothing to do if we are returning by reference, or this is not
-- a type that requires special processing (indicated by the fact
-- that it requires a cleanup scope for the secondary stack case)
- if Is_Return_By_Reference_Type (T)
- or else not Requires_Transient_Scope (Return_Type)
- then
+ if Is_Return_By_Reference_Type (T) then
null;
+ elsif not Requires_Transient_Scope (Return_Type) then
+
+ -- mutable records with no variable length components are not
+ -- returned on the sec-stack so we need to make sure that the
+ -- backend will only copy back the size of the actual value and not
+ -- the maximum size. We create an actual subtype for this purpose
+
+ declare
+ Ubt : constant Entity_Id := Underlying_Type (Base_Type (T));
+ Decl : Node_Id;
+ Ent : Entity_Id;
+ begin
+ if Has_Discriminants (Ubt)
+ and then not Is_Constrained (Ubt)
+ and then not Has_Unchecked_Union (Ubt)
+ then
+ Decl := Build_Actual_Subtype (Ubt, Exp);
+ Ent := Defining_Identifier (Decl);
+ Insert_Action (Exp, Decl);
+ Rewrite (Exp, Unchecked_Convert_To (Ent, Exp));
+ end if;
+ end;
+
-- Case of secondary stack not used
elsif Function_Returns_With_DSP (Scope_Id) then
@@ -3063,6 +2990,12 @@ package body Exp_Ch5 is
then
Set_By_Ref (N);
+ -- Remove side effects from the expression now so that
+ -- other part of the expander do not have to reanalyze
+ -- this node without this optimization
+
+ Rewrite (Exp, Duplicate_Subexpr_No_Checks (Exp));
+
-- For controlled types, do the allocation on the sec-stack
-- manually in order to call adjust at the right time
-- type Anon1 is access Return_Type;
@@ -3128,6 +3061,112 @@ package body Exp_Ch5 is
end if;
end if;
+ -- Implement the rules of 6.5(8-10), which require a tag check in
+ -- the case of a limited tagged return type, and tag reassignment
+ -- for nonlimited tagged results. These actions are needed when
+ -- the return type is a specific tagged type and the result
+ -- expression is a conversion or a formal parameter, because in
+ -- that case the tag of the expression might differ from the tag
+ -- of the specific result type.
+
+ if Is_Tagged_Type (Utyp)
+ and then not Is_Class_Wide_Type (Utyp)
+ and then (Nkind (Exp) = N_Type_Conversion
+ or else Nkind (Exp) = N_Unchecked_Type_Conversion
+ or else (Is_Entity_Name (Exp)
+ and then Ekind (Entity (Exp)) in Formal_Kind))
+ then
+ -- When the return type is limited, perform a check that the
+ -- tag of the result is the same as the tag of the return type.
+
+ if Is_Limited_Type (Return_Type) then
+ Insert_Action (Exp,
+ Make_Raise_Constraint_Error (Loc,
+ Condition =>
+ Make_Op_Ne (Loc,
+ Left_Opnd =>
+ Make_Selected_Component (Loc,
+ Prefix => Duplicate_Subexpr (Exp),
+ Selector_Name =>
+ New_Reference_To (First_Tag_Component (Utyp), Loc)),
+ Right_Opnd =>
+ Unchecked_Convert_To (RTE (RE_Tag),
+ New_Reference_To
+ (Node (First_Elmt
+ (Access_Disp_Table (Base_Type (Utyp)))),
+ Loc))),
+ Reason => CE_Tag_Check_Failed));
+
+ -- If the result type is a specific nonlimited tagged type,
+ -- then we have to ensure that the tag of the result is that
+ -- of the result type. This is handled by making a copy of the
+ -- expression in the case where it might have a different tag,
+ -- namely when the expression is a conversion or a formal
+ -- parameter. We create a new object of the result type and
+ -- initialize it from the expression, which will implicitly
+ -- force the tag to be set appropriately.
+
+ else
+ Result_Id :=
+ Make_Defining_Identifier (Loc, New_Internal_Name ('R'));
+ Result_Exp := New_Reference_To (Result_Id, Loc);
+
+ Result_Obj :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Result_Id,
+ Object_Definition => New_Reference_To (Return_Type, Loc),
+ Constant_Present => True,
+ Expression => Relocate_Node (Exp));
+
+ Set_Assignment_OK (Result_Obj);
+ Insert_Action (Exp, Result_Obj);
+
+ Rewrite (Exp, Result_Exp);
+ Analyze_And_Resolve (Exp, Return_Type);
+ end if;
+
+ -- Ada 2005 (AI-344): If the result type is class-wide, then insert
+ -- a check that the level of the return expression's underlying type
+ -- is not deeper than the level of the master enclosing the function.
+ -- Always generate the check when the type of the return expression
+ -- is class-wide, when it's a type conversion, or when it's a formal
+ -- parameter. Otherwise, suppress the check in the case where the
+ -- return expression has a specific type whose level is known not to
+ -- be statically deeper than the function's result type.
+
+ elsif Ada_Version >= Ada_05
+ and then Is_Class_Wide_Type (Return_Type)
+ and then not Scope_Suppress (Accessibility_Check)
+ and then
+ (Is_Class_Wide_Type (Etype (Exp))
+ or else Nkind (Exp) = N_Type_Conversion
+ or else Nkind (Exp) = N_Unchecked_Type_Conversion
+ or else (Is_Entity_Name (Exp)
+ and then Ekind (Entity (Exp)) in Formal_Kind)
+ or else Scope_Depth (Enclosing_Dynamic_Scope (Etype (Exp))) >
+ Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id)))
+ then
+ Insert_Action (Exp,
+ Make_Raise_Program_Error (Loc,
+ Condition =>
+ Make_Op_Gt (Loc,
+ Left_Opnd =>
+ Make_Function_Call (Loc,
+ Name =>
+ New_Reference_To
+ (RTE (RE_Get_Access_Level), Loc),
+ Parameter_Associations =>
+ New_List (Make_Attribute_Reference (Loc,
+ Prefix =>
+ Duplicate_Subexpr (Exp),
+ Attribute_Name =>
+ Name_Tag))),
+ Right_Opnd =>
+ Make_Integer_Literal (Loc,
+ Scope_Depth (Enclosing_Dynamic_Scope (Scope_Id)))),
+ Reason => PE_Accessibility_Check_Failed));
+ end if;
+
exception
when RE_Not_Available =>
return;
@@ -3175,7 +3214,7 @@ package body Exp_Ch5 is
if not Ctrl_Act then
null;
- -- The left hand side is an uninitialized temporary
+ -- The left hand side is an uninitialized temporary
elsif Nkind (L) = N_Type_Conversion
and then Is_Entity_Name (Expression (L))
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 884d549493b..76dde0e73cb 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -99,10 +99,11 @@ package body Exp_Ch6 is
-- we have an infinite recursion.
procedure Expand_Actuals (N : Node_Id; Subp : Entity_Id);
- -- For each actual of an in-out parameter which is a numeric conversion
- -- of the form T(A), where A denotes a variable, we insert the declaration:
+ -- For each actual of an in-out or out parameter which is a numeric
+ -- (view) conversion of the form T (A), where A denotes a variable,
+ -- we insert the declaration:
--
- -- Temp : T := T (A);
+ -- Temp : T[ := T (A)];
--
-- prior to the call. Then we replace the actual with a reference to Temp,
-- and append the assignment:
@@ -1464,6 +1465,48 @@ package body Exp_Ch6 is
end if;
end if;
+ -- Ada 2005 (AI-345): We have a procedure call as a triggering
+ -- alternative in an asynchronous select or as an entry call in
+ -- a conditional or timed select. Check whether the procedure call
+ -- is a renaming of an entry and rewrite it as an entry call.
+
+ if Ada_Version >= Ada_05
+ and then Nkind (N) = N_Procedure_Call_Statement
+ and then
+ ((Nkind (Parent (N)) = N_Triggering_Alternative
+ and then Triggering_Statement (Parent (N)) = N)
+ or else
+ (Nkind (Parent (N)) = N_Entry_Call_Alternative
+ and then Entry_Call_Statement (Parent (N)) = N))
+ then
+ declare
+ Ren_Decl : Node_Id;
+ Ren_Root : Entity_Id := Subp;
+
+ begin
+ -- This may be a chain of renamings, find the root
+
+ if Present (Alias (Ren_Root)) then
+ Ren_Root := Alias (Ren_Root);
+ end if;
+
+ if Present (Original_Node (Parent (Parent (Ren_Root)))) then
+ Ren_Decl := Original_Node (Parent (Parent (Ren_Root)));
+
+ if Nkind (Ren_Decl) = N_Subprogram_Renaming_Declaration then
+ Rewrite (N,
+ Make_Entry_Call_Statement (Loc,
+ Name =>
+ New_Copy_Tree (Name (Ren_Decl)),
+ Parameter_Associations =>
+ New_Copy_List_Tree (Parameter_Associations (N))));
+
+ return;
+ end if;
+ end if;
+ end;
+ end if;
+
-- First step, compute extra actuals, corresponding to any
-- Extra_Formals present. Note that we do not access Extra_Formals
-- directly, instead we simply note the presence of the extra
@@ -1558,13 +1601,29 @@ package body Exp_Ch6 is
Act_Prev := Expression (Act_Prev);
end loop;
- Add_Extra_Actual (
- Make_Attribute_Reference (Sloc (Prev),
- Prefix =>
- Duplicate_Subexpr_No_Checks
- (Act_Prev, Name_Req => True),
- Attribute_Name => Name_Constrained),
- Extra_Constrained (Formal));
+ -- If the expression is a conversion of a dereference,
+ -- this is internally generated code that manipulates
+ -- addresses, e.g. when building interface tables. No
+ -- check should occur in this case, and the discriminated
+ -- object is not directly a hand.
+
+ if not Comes_From_Source (Actual)
+ and then Nkind (Actual) = N_Unchecked_Type_Conversion
+ and then Nkind (Act_Prev) = N_Explicit_Dereference
+ then
+ Add_Extra_Actual
+ (New_Occurrence_Of (Standard_False, Loc),
+ Extra_Constrained (Formal));
+
+ else
+ Add_Extra_Actual
+ (Make_Attribute_Reference (Sloc (Prev),
+ Prefix =>
+ Duplicate_Subexpr_No_Checks
+ (Act_Prev, Name_Req => True),
+ Attribute_Name => Name_Constrained),
+ Extra_Constrained (Formal));
+ end if;
end;
end if;
end if;
@@ -1591,10 +1650,10 @@ package body Exp_Ch6 is
pragma Assert (Present (Parm_Ent));
if Present (Extra_Accessibility (Parm_Ent)) then
- Add_Extra_Actual (
- New_Occurrence_Of
- (Extra_Accessibility (Parm_Ent), Loc),
- Extra_Accessibility (Formal));
+ Add_Extra_Actual
+ (New_Occurrence_Of
+ (Extra_Accessibility (Parm_Ent), Loc),
+ Extra_Accessibility (Formal));
-- If the actual access parameter does not have an
-- associated extra formal providing its scope level,
@@ -1602,10 +1661,10 @@ package body Exp_Ch6 is
-- accessibility.
else
- Add_Extra_Actual (
- Make_Integer_Literal (Loc,
- Intval => Scope_Depth (Standard_Standard)),
- Extra_Accessibility (Formal));
+ Add_Extra_Actual
+ (Make_Integer_Literal (Loc,
+ Intval => Scope_Depth (Standard_Standard)),
+ Extra_Accessibility (Formal));
end if;
end;
@@ -1613,10 +1672,10 @@ package body Exp_Ch6 is
-- level of the actual's access type.
else
- Add_Extra_Actual (
- Make_Integer_Literal (Loc,
- Intval => Type_Access_Level (Etype (Prev_Orig))),
- Extra_Accessibility (Formal));
+ Add_Extra_Actual
+ (Make_Integer_Literal (Loc,
+ Intval => Type_Access_Level (Etype (Prev_Orig))),
+ Extra_Accessibility (Formal));
end if;
else
@@ -3092,6 +3151,12 @@ package body Exp_Ch6 is
-- If the call is the right side of an assignment or the expression in
-- an object declaration, we don't need to create a temp as the left
-- side will already trigger stack checking if necessary.
+ --
+ -- If the call is a component in an extension aggregate, it will be
+ -- expanded into assignments as well, so no temporary is needed. This
+ -- also solves the problem of functions returning types with unknown
+ -- discriminants, where it is not possible to declare an object of the
+ -- type altogether.
---------------------------
-- Returned_By_Reference --
@@ -3143,6 +3208,9 @@ package body Exp_Ch6 is
and then Expression (Parent (N)) = N
and then Nkind (Parent (Parent (N))) = N_Aggregate
and then Rhs_Of_Assign_Or_Decl (Parent (Parent (N))))
+ or else
+ (Nkind (Parent (N)) = N_Extension_Aggregate
+ and then Is_Private_Type (Etype (Typ)))
then
return True;
else
@@ -4052,8 +4120,8 @@ package body Exp_Ch6 is
-----------------------
procedure Freeze_Subprogram (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
- E : constant Entity_Id := Entity (N);
+ Loc : constant Source_Ptr := Sloc (N);
+ E : constant Entity_Id := Entity (N);
procedure Check_Overriding_Inherited_Interfaces (E : Entity_Id);
-- (Ada 2005): Check if the primitive E covers some interface already
@@ -4068,6 +4136,10 @@ package body Exp_Ch6 is
-- immediate ancestor associated with the interface; otherwise Prim and
-- Ancestor_Iface_Prim have the same info.
+ procedure Register_Predefined_DT_Entry (Prim : Entity_Id);
+ -- (Ada 2005): Register a predefined primitive in all the secondary
+ -- dispatch tables of its primitive type.
+
-------------------------------------------
-- Check_Overriding_Inherited_Interfaces --
-------------------------------------------
@@ -4090,11 +4162,18 @@ package body Exp_Ch6 is
-- Get the entity associated with this primitive operation
Typ := Scope (DTC_Entity (E));
- while Etype (Typ) /= Typ loop
+ loop
+ exit when Etype (Typ) = Typ
+ or else (Present (Full_View (Etype (Typ)))
+ and then Full_View (Etype (Typ)) = Typ);
- -- Climb to the immediate ancestor
+ -- Climb to the immediate ancestor handling private types
- Typ := Etype (Typ);
+ if Present (Full_View (Etype (Typ))) then
+ Typ := Full_View (Etype (Typ));
+ else
+ Typ := Etype (Typ);
+ end if;
if Present (Abstract_Interfaces (Typ)) then
@@ -4192,35 +4271,40 @@ package body Exp_Ch6 is
if not Present (Ancestor_Iface_Prim) then
Prim_Typ := Scope (DTC_Entity (Alias (Prim)));
Iface_Typ := Scope (DTC_Entity (Abstract_Interface_Alias (Prim)));
- Iface_Tag := Find_Interface_Tag
- (T => Prim_Typ,
- Iface => Iface_Typ);
-- Generate the code of the thunk only when this primitive
-- operation is associated with a secondary dispatch table.
- if Etype (Iface_Tag) = RTE (RE_Interface_Tag) then
- Thunk_Id := Make_Defining_Identifier (Loc,
- New_Internal_Name ('T'));
- New_Thunk :=
- Expand_Interface_Thunk
- (N => Prim,
- Thunk_Alias => Alias (Prim),
- Thunk_Id => Thunk_Id,
- Thunk_Tag => Iface_Tag);
-
- Insert_After (N, New_Thunk);
-
- Iface_DT_Ptr :=
- Find_Interface_ADT
- (T => Prim_Typ,
- Iface => Iface_Typ);
-
- Insert_After (New_Thunk,
- Fill_Secondary_DT_Entry (Sloc (Prim),
- Prim => Prim,
- Iface_DT_Ptr => Iface_DT_Ptr,
- Thunk_Id => Thunk_Id));
+ if Is_Interface (Iface_Typ) then
+ Iface_Tag := Find_Interface_Tag
+ (T => Prim_Typ,
+ Iface => Iface_Typ);
+
+ if Etype (Iface_Tag) = RTE (RE_Interface_Tag) then
+ Thunk_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('T'));
+
+ New_Thunk :=
+ Expand_Interface_Thunk
+ (N => Prim,
+ Thunk_Alias => Alias (Prim),
+ Thunk_Id => Thunk_Id,
+ Thunk_Tag => Iface_Tag);
+
+ Insert_After (N, New_Thunk);
+
+ Iface_DT_Ptr :=
+ Find_Interface_ADT
+ (T => Prim_Typ,
+ Iface => Iface_Typ);
+
+ Insert_After (New_Thunk,
+ Fill_Secondary_DT_Entry (Sloc (Prim),
+ Prim => Prim,
+ Iface_DT_Ptr => Iface_DT_Ptr,
+ Thunk_Id => Thunk_Id));
+ end if;
end if;
else
@@ -4243,8 +4327,9 @@ package body Exp_Ch6 is
-- type T is new I with ...
if Etype (Iface_Tag) = RTE (RE_Interface_Tag) then
- Thunk_Id := Make_Defining_Identifier (Loc,
- New_Internal_Name ('T'));
+ Thunk_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('T'));
if Present (Alias (Prim)) then
Prim_Op := Alias (Prim);
@@ -4275,6 +4360,70 @@ package body Exp_Ch6 is
end if;
end Register_Interface_DT_Entry;
+ ----------------------------------
+ -- Register_Predefined_DT_Entry --
+ ----------------------------------
+
+ procedure Register_Predefined_DT_Entry (Prim : Entity_Id) is
+ Iface_DT_Ptr : Elmt_Id;
+ Iface_Tag : Entity_Id;
+ Iface_Typ : Elmt_Id;
+ New_Thunk : Entity_Id;
+ Prim_Typ : Entity_Id;
+ Thunk_Id : Entity_Id;
+
+ begin
+ Prim_Typ := Scope (DTC_Entity (Prim));
+
+ if not Present (Access_Disp_Table (Prim_Typ))
+ or else not Present (Abstract_Interfaces (Prim_Typ))
+ then
+ return;
+ end if;
+
+ -- Skip the first acces-to-dispatch-table pointer since it leads
+ -- to the primary dispatch table. We are only concerned with the
+ -- secondary dispatch table pointers. Note that the access-to-
+ -- dispatch-table pointer corresponds to the first implemented
+ -- interface retrieved below.
+
+ Iface_DT_Ptr := Next_Elmt (First_Elmt (Access_Disp_Table (Prim_Typ)));
+ Iface_Typ := First_Elmt (Abstract_Interfaces (Prim_Typ));
+ while Present (Iface_DT_Ptr) and then Present (Iface_Typ) loop
+ Iface_Tag := Find_Interface_Tag (Prim_Typ, Node (Iface_Typ));
+ pragma Assert (Present (Iface_Tag));
+
+ if Etype (Iface_Tag) = RTE (RE_Interface_Tag) then
+ Thunk_Id := Make_Defining_Identifier (Loc,
+ New_Internal_Name ('T'));
+
+ New_Thunk :=
+ Expand_Interface_Thunk
+ (N => Prim,
+ Thunk_Alias => Prim,
+ Thunk_Id => Thunk_Id,
+ Thunk_Tag => Iface_Tag);
+
+ Insert_After (N, New_Thunk);
+ Insert_After (New_Thunk,
+ Make_DT_Access_Action (Node (Iface_Typ),
+ Action => Set_Prim_Op_Address,
+ Args => New_List (
+ Unchecked_Convert_To (RTE (RE_Tag),
+ New_Reference_To (Node (Iface_DT_Ptr), Loc)),
+
+ Make_Integer_Literal (Loc, DT_Position (Prim)),
+
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (Thunk_Id, Loc),
+ Attribute_Name => Name_Address))));
+ end if;
+
+ Next_Elmt (Iface_DT_Ptr);
+ Next_Elmt (Iface_Typ);
+ end loop;
+ end Register_Predefined_DT_Entry;
+
-- Start of processing for Freeze_Subprogram
begin
@@ -4297,19 +4446,38 @@ package body Exp_Ch6 is
Fill_DT_Entry (Sloc (N), Prim => E));
else
- -- Ada 2005 (AI-251): Check if this entry corresponds with
- -- a subprogram that covers an abstract interface type.
+ declare
+ Typ : constant Entity_Id := Scope (DTC_Entity (E));
- if Present (Abstract_Interface_Alias (E)) then
- Register_Interface_DT_Entry (E);
+ begin
+ -- There is no dispatch table associated with abstract
+ -- interface types; each type implementing interfaces
+ -- will fill the associated secondary DT entries.
- -- Common case: Primitive subprogram
+ if not Is_Interface (Typ)
+ or else Present (Alias (E))
+ then
+ -- Ada 2005 (AI-251): Check if this entry corresponds with
+ -- a subprogram that covers an abstract interface type.
- else
- Insert_After (N,
- Fill_DT_Entry (Sloc (N), Prim => E));
- Check_Overriding_Inherited_Interfaces (E);
- end if;
+ if Present (Abstract_Interface_Alias (E)) then
+ Register_Interface_DT_Entry (E);
+
+ -- Common case: Primitive subprogram
+
+ else
+ -- Generate thunks for all the predefined operations
+
+ if Is_Predefined_Dispatching_Operation (E) then
+ Register_Predefined_DT_Entry (E);
+ end if;
+
+ Insert_After (N,
+ Fill_DT_Entry (Sloc (N), Prim => E));
+ Check_Overriding_Inherited_Interfaces (E);
+ end if;
+ end if;
+ end;
end if;
end if;
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index f7d01197b7c..b0bad8c5718 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -1793,6 +1793,13 @@ package body Exp_Ch7 is
return The_Parent;
end if;
+ -- A raise statement can be wrapped. This will arise when the
+ -- expression in a raise_with_expression uses the secondary
+ -- stack, for example.
+
+ when N_Raise_Statement =>
+ return The_Parent;
+
-- If the expression is within the iteration scheme of a loop,
-- we must create a declaration for it, followed by an assignment
-- in order to have a usable statement to wrap.
@@ -2728,13 +2735,27 @@ package body Exp_Ch7 is
Utyp := Underlying_Type (Base_Type (Utyp));
Set_Assignment_OK (Cref);
- -- Deal with non-tagged derivation of private views
+ -- Deal with non-tagged derivation of private views. If the parent is
+ -- now known to be protected, the finalization routine is the one
+ -- defined on the corresponding record of the ancestor (corresponding
+ -- records do not automatically inherit operations, but maybe they
+ -- should???)
if Is_Untagged_Derivation (Typ) then
- Utyp := Underlying_Type (Root_Type (Base_Type (Typ)));
+ if Is_Protected_Type (Typ) then
+ Utyp := Corresponding_Record_Type (Root_Type (Base_Type (Typ)));
+ else
+ Utyp := Underlying_Type (Root_Type (Base_Type (Typ)));
+ end if;
+
Cref := Unchecked_Convert_To (Utyp, Cref);
+
+ -- We need to set Assignment_OK to prevent problems with unchecked
+ -- conversions, where we do not want them to be converted back in the
+ -- case of untagged record derivation (see code in Make_*_Call
+ -- procedures for similar situations).
+
Set_Assignment_OK (Cref);
- -- To prevent problems with UC see 1.156 RH ???
end if;
-- If the underlying_type is a subtype, we are dealing with
diff --git a/gcc/ada/exp_ch7.ads b/gcc/ada/exp_ch7.ads
index 597755abd98..eb17fe09bf9 100644
--- a/gcc/ada/exp_ch7.ads
+++ b/gcc/ada/exp_ch7.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -164,7 +164,7 @@ package Exp_Ch7 is
function Cleanup_Protected_Object
(N : Node_Id;
Ref : Node_Id) return Node_Id;
- -- Generate code to finalize a protected object without entries.
+ -- Generate code to finalize a protected object without entries
function Cleanup_Record
(N : Node_Id;
@@ -176,10 +176,10 @@ package Exp_Ch7 is
function Cleanup_Task
(N : Node_Id;
Ref : Node_Id) return Node_Id;
- -- Generate code to finalize a task.
+ -- Generate code to finalize a task
function Has_Simple_Protected_Object (T : Entity_Id) return Boolean;
- -- Check whether composite type contains a simple protected component.
+ -- Check whether composite type contains a simple protected component
function Is_Simple_Protected_Type (T : Entity_Id) return Boolean;
-- Check whether argument is a protected type without entries.
@@ -203,7 +203,7 @@ package Exp_Ch7 is
-- secondary stack is brought in, otherwise it isn't.
function Node_To_Be_Wrapped return Node_Id;
- -- return the node to be wrapped if the current scope is transient.
+ -- return the node to be wrapped if the current scope is transient
procedure Store_Before_Actions_In_Scope (L : List_Id);
-- Append the list L of actions to the end of the before-actions store
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 6911d862a59..3943dc4dbc0 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -65,21 +65,33 @@ package body Exp_Ch9 is
-- Select_Expansion_Utilities --
--------------------------------
+ -- The following constant establishes the upper bound for the index of
+ -- an entry family. It is used to limit the allocated size of protected
+ -- types with defaulted discriminant of an integer type, when the bound
+ -- of some entry family depends on a discriminant. The limitation to
+ -- entry families of 128K should be reasonable in all cases, and is a
+ -- documented implementation restriction. It will be lifted when protected
+ -- entry families are re-implemented as a single ordered queue.
+
+ Entry_Family_Bound : constant Int := 2**16;
+
-- The following package contains helper routines used in the expansion of
-- dispatching asynchronous, conditional and timed selects.
package Select_Expansion_Utilities is
function Build_Abort_Block
- (Loc : Source_Ptr;
- Blk_Ent : Entity_Id;
- Blk : Node_Id) return Node_Id;
+ (Loc : Source_Ptr;
+ Abr_Blk_Ent : Entity_Id;
+ Cln_Blk_Ent : Entity_Id;
+ Blk : Node_Id) return Node_Id;
-- Generate:
-- begin
-- Blk
-- exception
-- when Abort_Signal => Abort_Undefer;
-- end;
- -- Blk_Ent is the name of the encapsulated block, Blk is the actual
+ -- Abr_Blk_Ent is the name of the generated block, Cln_Blk_Ent is
+ -- the name of the encapsulated cleanup block, Blk is the actual
-- block node.
function Build_B
@@ -121,28 +133,23 @@ package body Exp_Ch9 is
function Build_S
(Loc : Source_Ptr;
Decls : List_Id;
+ Obj : Entity_Id;
Call_Ent : Entity_Id) return Entity_Id;
-- Generate:
- -- S : constant Integer := DT_Position (Call_Ent);
- -- where Call_Ent is the entity of the dispatching call name. Append
- -- the object declaration to the list and return the name of the
- -- object.
+ -- S : constant Integer :=
+ -- Ada.Tags.Get_Offset_Index (
+ -- Unchecked_Convert_To (Ada.Tags.Interface_Tag, Obj),
+ -- DT_Position (Call_Ent));
+ -- where Obj is the pointer to a secondary table, Call_Ent is the
+ -- entity of the dispatching call name. Append the object declaration
+ -- to the list and return its defining identifier.
- function Build_Wrapping_Procedure
- (Loc : Source_Ptr;
- Nam : Character;
- Decls : List_Id;
- Stmts : List_Id) return Entity_Id;
- -- Generate:
- -- procedure <temp>Nam is
- -- begin
- -- Stmts
- -- end <temp>Nam;
- -- where Nam is the generated procedure name and Stmts are the
- -- encapsulated statements. Append the procedure body to Decls.
- -- Return the internally generated procedure name.
end Select_Expansion_Utilities;
+ -----------------------------------------
+ -- Body for Select_Expansion_Utilities --
+ -----------------------------------------
+
package body Select_Expansion_Utilities is
-----------------------
@@ -150,15 +157,17 @@ package body Exp_Ch9 is
-----------------------
function Build_Abort_Block
- (Loc : Source_Ptr;
- Blk_Ent : Entity_Id;
- Blk : Node_Id) return Node_Id
+ (Loc : Source_Ptr;
+ Abr_Blk_Ent : Entity_Id;
+ Cln_Blk_Ent : Entity_Id;
+ Blk : Node_Id) return Node_Id
is
begin
return
Make_Block_Statement (Loc,
- Declarations =>
- No_List,
+ Identifier => New_Reference_To (Abr_Blk_Ent, Loc),
+
+ Declarations => No_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
@@ -166,7 +175,7 @@ package body Exp_Ch9 is
New_List (
Make_Implicit_Label_Declaration (Loc,
Defining_Identifier =>
- Blk_Ent,
+ Cln_Blk_Ent,
Label_Construct =>
Blk),
Blk),
@@ -194,7 +203,8 @@ package body Exp_Ch9 is
(Loc : Source_Ptr;
Decls : List_Id) return Entity_Id
is
- B : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uB);
+ B : constant Entity_Id := Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('B'));
begin
Append_To (Decls,
@@ -217,7 +227,8 @@ package body Exp_Ch9 is
(Loc : Source_Ptr;
Decls : List_Id) return Entity_Id
is
- C : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uC);
+ C : constant Entity_Id := Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('C'));
begin
Append_To (Decls,
@@ -262,52 +273,30 @@ package body Exp_Ch9 is
function Build_S
(Loc : Source_Ptr;
Decls : List_Id;
+ Obj : Entity_Id;
Call_Ent : Entity_Id) return Entity_Id
is
- S : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uS);
+ S : constant Entity_Id := Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('S'));
begin
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier => S,
Constant_Present => True,
+
Object_Definition =>
New_Reference_To (Standard_Integer, Loc),
+
Expression =>
- Make_Integer_Literal (Loc,
- Intval => DT_Position (Call_Ent))));
+ Make_Function_Call (Loc,
+ Name => New_Reference_To (RTE (RE_Get_Offset_Index), Loc),
+ Parameter_Associations => New_List (
+ Unchecked_Convert_To (RTE (RE_Interface_Tag), Obj),
+ Make_Integer_Literal (Loc, DT_Position (Call_Ent))))));
return S;
end Build_S;
-
- ------------------------------
- -- Build_Wrapping_Procedure --
- ------------------------------
-
- function Build_Wrapping_Procedure
- (Loc : Source_Ptr;
- Nam : Character;
- Decls : List_Id;
- Stmts : List_Id) return Entity_Id
- is
- Proc_Nam : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name (Nam));
- begin
- Append_To (Decls,
- Make_Subprogram_Body (Loc,
- Specification =>
- Make_Procedure_Specification (Loc,
- Defining_Unit_Name =>
- Proc_Nam),
- Declarations =>
- No_List,
- Handled_Statement_Sequence =>
- Make_Handled_Sequence_Of_Statements (Loc,
- Statements =>
- New_Copy_List (Stmts))));
-
- return Proc_Nam;
- end Build_Wrapping_Procedure;
end Select_Expansion_Utilities;
package SEU renames Select_Expansion_Utilities;
@@ -335,6 +324,18 @@ package body Exp_Ch9 is
-- of the System.Address pointer passed to entry barrier functions
-- and entry body procedures.
+ procedure Add_Formal_Renamings
+ (Spec : Node_Id;
+ Decls : List_Id;
+ Ent : Entity_Id;
+ Loc : Source_Ptr);
+ -- Create renaming declarations for the formals, inside the procedure
+ -- that implements an entry body. The renamings make the original names
+ -- of the formals accessible to gdb, and serve no other purpose.
+ -- Spec is the specification of the procedure being built.
+ -- Decls is the list of declarations to be enhanced.
+ -- Ent is the entity for the original entry body.
+
function Build_Accept_Body (Astat : Node_Id) return Node_Id;
-- Transform accept statement into a block with added exception handler.
-- Used both for simple accept statements and for accept alternatives in
@@ -463,8 +464,9 @@ package body Exp_Ch9 is
-- The object is a limited record and therefore a by_reference type.
function Build_Selected_Name
- (Prefix, Selector : Name_Id;
- Append_Char : Character := ' ') return Name_Id;
+ (Prefix : Entity_Id;
+ Selector : Entity_Id;
+ Append_Char : Character := ' ') return Name_Id;
-- Build a name in the form of Prefix__Selector, with an optional
-- character appended. This is used for internal subprograms generated
-- for operations of protected types, including barrier functions.
@@ -572,7 +574,7 @@ package body Exp_Ch9 is
Actuals : List_Id;
Formals : List_Id;
Decls : List_Id;
- Stmts : List_Id) return Node_Id;
+ Stmts : List_Id) return Entity_Id;
-- Set the components of the generated parameter block with the values of
-- the actual parameters. Generate aliased temporaries to capture the
-- values for types that are passed by copy. Otherwise generate a reference
@@ -588,6 +590,7 @@ package body Exp_Ch9 is
function Parameter_Block_Unpack
(Loc : Source_Ptr;
+ P : Entity_Id;
Actuals : List_Id;
Formals : List_Id) return List_Id;
-- Retrieve the values of the components from the parameter block and
@@ -795,6 +798,7 @@ package body Exp_Ch9 is
Pid : Entity_Id;
Loc : Source_Ptr)
is
+ Decl : Node_Id;
Obj_Ptr : Node_Id;
begin
@@ -812,14 +816,16 @@ package body Exp_Ch9 is
New_External_Name
(Chars (Corresponding_Record_Type (Pid)), 'P'));
- Prepend_To (Decls,
+ Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Name_uObject),
Object_Definition => New_Reference_To (Obj_Ptr, Loc),
Expression =>
Unchecked_Convert_To (Obj_Ptr,
- Make_Identifier (Loc, Name_uO))));
+ Make_Identifier (Loc, Name_uO)));
+ Set_Needs_Debug_Info (Defining_Identifier (Decl));
+ Prepend_To (Decls, Decl);
Prepend_To (Decls,
Make_Full_Type_Declaration (Loc,
@@ -829,6 +835,65 @@ package body Exp_Ch9 is
New_Reference_To (Corresponding_Record_Type (Pid), Loc))));
end Add_Object_Pointer;
+ --------------------------
+ -- Add_Formal_Renamings --
+ --------------------------
+
+ procedure Add_Formal_Renamings
+ (Spec : Node_Id;
+ Decls : List_Id;
+ Ent : Entity_Id;
+ Loc : Source_Ptr)
+ is
+ Ptr : constant Entity_Id :=
+ Defining_Identifier
+ (Next (First (Parameter_Specifications (Spec))));
+ -- The name of the formal that holds the address of the parameter block
+ -- for the call.
+
+ Comp : Entity_Id;
+ Decl : Node_Id;
+ Formal : Entity_Id;
+ New_F : Entity_Id;
+
+ begin
+ Formal := First_Formal (Ent);
+ while Present (Formal) loop
+ Comp := Entry_Component (Formal);
+ New_F :=
+ Make_Defining_Identifier (Sloc (Formal), Chars (Formal));
+ Set_Etype (New_F, Etype (Formal));
+ Set_Scope (New_F, Ent);
+ Set_Needs_Debug_Info (New_F); -- That's the whole point.
+
+ if Ekind (Formal) = E_In_Parameter then
+ Set_Ekind (New_F, E_Constant);
+ else
+ Set_Ekind (New_F, E_Variable);
+ Set_Extra_Constrained (New_F, Extra_Constrained (Formal));
+ end if;
+
+ Set_Actual_Subtype (New_F, Actual_Subtype (Formal));
+
+ Decl :=
+ Make_Object_Renaming_Declaration (Loc,
+ Defining_Identifier => New_F,
+ Subtype_Mark => New_Reference_To (Etype (Formal), Loc),
+ Name =>
+ Make_Explicit_Dereference (Loc,
+ Make_Selected_Component (Loc,
+ Prefix =>
+ Unchecked_Convert_To (Entry_Parameters_Type (Ent),
+ Make_Identifier (Loc, Chars (Ptr))),
+ Selector_Name =>
+ New_Reference_To (Comp, Loc))));
+
+ Append (Decl, Decls);
+ Set_Renamed_Object (Formal, New_F);
+ Next_Formal (Formal);
+ end loop;
+ end Add_Formal_Renamings;
+
------------------------------
-- Add_Private_Declarations --
------------------------------
@@ -840,6 +905,7 @@ package body Exp_Ch9 is
Loc : Source_Ptr)
is
Def : constant Node_Id := Protected_Definition (Parent (Typ));
+ Decl : Node_Id;
Body_Ent : constant Entity_Id := Corresponding_Body (Parent (Typ));
P : Node_Id;
Pdef : Entity_Id;
@@ -849,28 +915,30 @@ package body Exp_Ch9 is
if Present (Private_Declarations (Def)) then
P := First (Private_Declarations (Def));
-
while Present (P) loop
if Nkind (P) = N_Component_Declaration then
Pdef := Defining_Identifier (P);
- Prepend_To (Decls,
+ Decl :=
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Prival (Pdef),
Subtype_Mark => New_Reference_To (Etype (Pdef), Loc),
Name =>
Make_Selected_Component (Loc,
Prefix => Make_Identifier (Loc, Name),
- Selector_Name => Make_Identifier (Loc, Chars (Pdef)))));
+ Selector_Name => Make_Identifier (Loc, Chars (Pdef))));
+ Set_Needs_Debug_Info (Defining_Identifier (Decl));
+ Prepend_To (Decls, Decl);
end if;
+
Next (P);
end loop;
end if;
- -- One more "prival" for the object itself, with the right protection
- -- type.
+ -- One more "prival" for object itself, with the right protection type
declare
Protection_Type : RE_Id;
+
begin
if Has_Attach_Handler (Typ) then
if Restricted_Profile then
@@ -906,14 +974,16 @@ package body Exp_Ch9 is
Protection_Type := RE_Protection;
end if;
- Prepend_To (Decls,
+ Decl :=
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Object_Ref (Body_Ent),
Subtype_Mark => New_Reference_To (RTE (Protection_Type), Loc),
Name =>
Make_Selected_Component (Loc,
Prefix => Make_Identifier (Loc, Name),
- Selector_Name => Make_Identifier (Loc, Name_uObject))));
+ Selector_Name => Make_Identifier (Loc, Name_uObject)));
+ Set_Needs_Debug_Info (Defining_Identifier (Decl));
+ Prepend_To (Decls, Decl);
end;
end Add_Private_Declarations;
@@ -931,9 +1001,9 @@ package body Exp_Ch9 is
begin
-- At the end of the statement sequence, Complete_Rendezvous is called.
- -- A label skipping the Complete_Rendezvous, and all other
- -- accept processing, has already been added for the expansion
- -- of requeue statements.
+ -- A label skipping the Complete_Rendezvous, and all other accept
+ -- processing, has already been added for the expansion of requeue
+ -- statements.
Call := Build_Runtime_Call (Loc, RE_Complete_Rendezvous);
Insert_Before (Last (Statements (Stats)), Call);
@@ -1161,7 +1231,6 @@ package body Exp_Ch9 is
E : Entity_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (N);
-
begin
return
Make_Function_Call (Loc,
@@ -1247,7 +1316,8 @@ package body Exp_Ch9 is
Component_List =>
Make_Component_List (Loc,
Component_Items => Cdecls),
- Tagged_Present => Ada_Version >= Ada_05,
+ Tagged_Present =>
+ Ada_Version >= Ada_05 and then Is_Tagged_Type (Ctyp),
Limited_Present => True));
end Build_Corresponding_Record;
@@ -1269,11 +1339,10 @@ package body Exp_Ch9 is
Typ : Entity_Id;
begin
- Ent := First_Entity (Concurrent_Type);
- Eindx := 0;
-
-- Count number of non-family entries
+ Eindx := 0;
+ Ent := First_Entity (Concurrent_Type);
while Present (Ent) loop
if Ekind (Ent) = E_Entry then
Eindx := Eindx + 1;
@@ -1288,7 +1357,6 @@ package body Exp_Ch9 is
Ent := First_Entity (Concurrent_Type);
Comp := First (Component_List);
-
while Present (Ent) loop
if Ekind (Ent) = E_Entry_Family then
while Chars (Ent) /= Chars (Defining_Identifier (Comp)) loop
@@ -1323,75 +1391,97 @@ package body Exp_Ch9 is
is
Actual : Entity_Id;
Comp_Nam : Node_Id;
- Comp_Rec : Node_Id;
Comps : List_Id;
Formal : Entity_Id;
+ Has_Comp : Boolean := False;
+ Rec_Nam : Node_Id;
begin
Actual := First (Actuals);
Comps := New_List;
Formal := Defining_Identifier (First (Formals));
+
while Present (Actual) loop
- -- Generate:
- -- type Ann is access all <actual-type>
+ if not Is_Controlling_Actual (Actual) then
- Comp_Nam :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ -- Generate:
+ -- type Ann is access all <actual-type>
- Append_To (Decls,
- Make_Full_Type_Declaration (Loc,
- Defining_Identifier =>
- Comp_Nam,
- Type_Definition =>
- Make_Access_To_Object_Definition (Loc,
- All_Present =>
- True,
- Constant_Present =>
- Ekind (Formal) = E_In_Parameter,
- Subtype_Indication =>
- New_Reference_To (Etype (Actual), Loc))));
+ Comp_Nam :=
+ Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
- -- Generate:
- -- Param : Ann;
+ Append_To (Decls,
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier =>
+ Comp_Nam,
+ Type_Definition =>
+ Make_Access_To_Object_Definition (Loc,
+ All_Present =>
+ True,
+ Constant_Present =>
+ Ekind (Formal) = E_In_Parameter,
+ Subtype_Indication =>
+ New_Reference_To (Etype (Actual), Loc))));
- Append_To (Comps,
- Make_Component_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, Chars (Formal)),
- Component_Definition =>
- Make_Component_Definition (Loc,
- Aliased_Present =>
- False,
- Subtype_Indication =>
- New_Reference_To (Comp_Nam, Loc))));
+ -- Generate:
+ -- Param : Ann;
+
+ Append_To (Comps,
+ Make_Component_Declaration (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc, Chars (Formal)),
+ Component_Definition =>
+ Make_Component_Definition (Loc,
+ Aliased_Present =>
+ False,
+ Subtype_Indication =>
+ New_Reference_To (Comp_Nam, Loc))));
+
+ Has_Comp := True;
+ end if;
Next_Actual (Actual);
Next_Formal_With_Extras (Formal);
end loop;
- -- Generate:
- -- type Pnn is record
- -- Param1 : Ann1;
- -- ...
- -- ParamN : AnnN;
+ Rec_Nam :=
+ Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
- -- where Pnn is a parameter wrapping record, Param1 .. ParamN are the
- -- original parameter names and Ann1 .. AnnN are the access to actual
- -- types.
+ if Has_Comp then
- Comp_Rec :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
+ -- Generate:
+ -- type Pnn is record
+ -- Param1 : Ann1;
+ -- ...
+ -- ParamN : AnnN;
- Append_To (Decls,
- Make_Full_Type_Declaration (Loc,
- Defining_Identifier =>
- Comp_Rec,
- Type_Definition =>
- Make_Record_Definition (Loc,
- Component_List =>
- Make_Component_List (Loc, Comps))));
+ -- where Pnn is a parameter wrapping record, Param1 .. ParamN are
+ -- the original parameter names and Ann1 .. AnnN are the access to
+ -- actual types.
+
+ Append_To (Decls,
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier =>
+ Rec_Nam,
+ Type_Definition =>
+ Make_Record_Definition (Loc,
+ Component_List =>
+ Make_Component_List (Loc, Comps))));
+ else
+ -- Generate:
+ -- type Pnn is null record;
- return Comp_Rec;
+ Append_To (Decls,
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier =>
+ Rec_Nam,
+ Type_Definition =>
+ Make_Record_Definition (Loc,
+ Null_Present => True,
+ Component_List => Empty)));
+ end if;
+
+ return Rec_Nam;
end Build_Parameter_Block;
------------------------
@@ -1579,8 +1669,8 @@ package body Exp_Ch9 is
-- The two parameters must be mode conformant and have
-- the exact same types.
- if Out_Present (Prim_Op_Param) /= Out_Present (Proc_Param)
- or else In_Present (Prim_Op_Param) /= In_Present (Proc_Param)
+ if Ekind (Defining_Identifier (Prim_Op_Param)) /=
+ Ekind (Defining_Identifier (Proc_Param))
or else Etype (Parameter_Type (Prim_Op_Param)) /=
Etype (Parameter_Type (Proc_Param))
then
@@ -1637,7 +1727,6 @@ package body Exp_Ch9 is
return Type_Conformant_Parameters (
Parameter_Specifications (Prim_Op_Spec),
Parameter_Specifications (Proc_Spec));
-
end Overriding_Possible;
-----------------------------
@@ -1653,25 +1742,22 @@ package body Exp_Ch9 is
begin
Formal := First (Formals);
+ while Present (Formal) loop
- if Present (Formal) then
- while Present (Formal) loop
+ -- Create an explicit copy of the entry parameter
- -- Create an explicit copy of the entry parameter
+ Append_To (New_Formals,
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc,
+ Chars => Chars (Defining_Identifier (Formal))),
+ In_Present => In_Present (Formal),
+ Out_Present => Out_Present (Formal),
+ Parameter_Type => New_Reference_To (Etype (
+ Parameter_Type (Formal)), Loc)));
- Append_To (New_Formals,
- Make_Parameter_Specification (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc,
- Chars => Chars (Defining_Identifier (Formal))),
- In_Present => In_Present (Formal),
- Out_Present => Out_Present (Formal),
- Parameter_Type => New_Reference_To (Etype (
- Parameter_Type (Formal)), Loc)));
-
- Next (Formal);
- end loop;
- end if;
+ Next (Formal);
+ end loop;
return New_Formals;
end Replicate_Entry_Formals;
@@ -1697,10 +1783,13 @@ package body Exp_Ch9 is
if Present (Primitive_Operations (Iface)) then
Iface_Prim_Op_Elmt := First_Elmt (Primitive_Operations (Iface));
-
while Present (Iface_Prim_Op_Elmt) loop
Iface_Prim_Op := Node (Iface_Prim_Op_Elmt);
+ while Present (Alias (Iface_Prim_Op)) loop
+ Iface_Prim_Op := Alias (Iface_Prim_Op);
+ end loop;
+
-- The current primitive operation can be overriden by the
-- generated entry wrapper.
@@ -1897,9 +1986,7 @@ package body Exp_Ch9 is
Spec := Build_Find_Body_Index_Spec (Typ);
Ent := First_Entity (Typ);
-
while Present (Ent) loop
-
if Ekind (Ent) = E_Entry_Family then
Has_F := True;
exit;
@@ -1955,12 +2042,10 @@ package body Exp_Ch9 is
elsif Nkind (Ret) = N_If_Statement then
- -- Ranges are in increasing order, so last one doesn't need a
- -- guard.
+ -- Ranges are in increasing order, so last one doesn't need guard
declare
Nod : constant Node_Id := Last (Elsif_Parts (Ret));
-
begin
Remove (Nod);
Set_Else_Statements (Ret, Then_Statements (Nod));
@@ -2021,7 +2106,8 @@ package body Exp_Ch9 is
S := Scope (E);
-- Ada 2005 (AI-287): Do not set/get the has_master_entity reminder
- -- in internal scopes. Required for nested limited aggregates.
+ -- in internal scopes, unless present already.. Required for nested
+ -- limited aggregates. This could use some more explanation ????
if Ada_Version >= Ada_05 then
while Is_Internal (S) loop
@@ -2110,12 +2196,17 @@ package body Exp_Ch9 is
Espec := Build_Protected_Entry_Specification (Edef, Empty, Loc);
-- <object pointer declaration>
- -- Add object pointer declaration. This is needed by the
- -- discriminal and prival renamings, which should already
- -- have been inserted into the declaration list.
+
+ -- Add object pointer declaration. This is needed by the discriminal and
+ -- prival renamings, which should already have been inserted into the
+ -- declaration list.
Add_Object_Pointer (Op_Decls, Pid, Loc);
+ -- Add renamings for formals for use by debugger
+
+ Add_Formal_Renamings (Espec, Op_Decls, Ent, Loc);
+
if Abort_Allowed
or else Restriction_Active (No_Entry_Queue) = False
or else Number_Entries (Pid) > 1
@@ -2169,6 +2260,9 @@ package body Exp_Ch9 is
RTE (RE_Exceptional_Complete_Single_Entry_Body), Loc);
end if;
+ -- Create body of entry procedure. The renaming declarations are
+ -- placed ahead of the block that contains the actual entry body.
+
return
Make_Subprogram_Body (Loc,
Specification => Espec,
@@ -2248,6 +2342,7 @@ package body Exp_Ch9 is
Ident : Entity_Id) return List_Id
is
Loc : constant Source_Ptr := Sloc (N);
+ Decl : Node_Id;
Formal : Entity_Id;
New_Plist : List_Id;
New_Param : Node_Id;
@@ -2255,7 +2350,6 @@ package body Exp_Ch9 is
begin
New_Plist := New_List;
Formal := First_Formal (Ident);
-
while Present (Formal) loop
New_Param :=
Make_Parameter_Specification (Loc,
@@ -2278,7 +2372,7 @@ package body Exp_Ch9 is
-- to protected subprogram, the parameter is in-out. Otherwise it is
-- an in parameter.
- Prepend_To (New_Plist,
+ Decl :=
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Name_uObject),
@@ -2286,7 +2380,9 @@ package body Exp_Ch9 is
Out_Present =>
(Etype (Ident) = Standard_Void_Type
and then not Is_RTE (Obj_Type, RE_Address)),
- Parameter_Type => New_Reference_To (Obj_Type, Loc)));
+ Parameter_Type => New_Reference_To (Obj_Type, Loc));
+ Set_Needs_Debug_Info (Defining_Identifier (Decl));
+ Prepend_To (New_Plist, Decl);
return New_Plist;
end Build_Protected_Spec;
@@ -2302,9 +2398,7 @@ package body Exp_Ch9 is
is
Loc : constant Source_Ptr := Sloc (N);
Decl : Node_Id;
- Protnm : constant Name_Id := Chars (Prottyp);
Ident : Entity_Id;
- Nam : Name_Id;
New_Id : Entity_Id;
New_Plist : List_Id;
New_Spec : Node_Id;
@@ -2324,7 +2418,6 @@ package body Exp_Ch9 is
end if;
Ident := Defining_Unit_Name (Specification (Decl));
- Nam := Chars (Ident);
New_Plist :=
Build_Protected_Spec (Decl,
@@ -2333,7 +2426,7 @@ package body Exp_Ch9 is
New_Id :=
Make_Defining_Identifier (Loc,
- Chars => Build_Selected_Name (Protnm, Nam, Append_Chr (Mode)));
+ Chars => Build_Selected_Name (Prottyp, Ident, Append_Chr (Mode)));
-- The unprotected operation carries the user code, and debugging
-- information must be generated for it, even though this spec does
@@ -2397,24 +2490,28 @@ package body Exp_Ch9 is
function Is_Exception_Safe (Subprogram : Node_Id) return Boolean is
function Has_Side_Effect (N : Node_Id) return Boolean;
- -- Return True whenever encountering a subprogram call or a
- -- raise statement of any kind in the sequence of statements N
+ -- Return True whenever encountering a subprogram call or raise
+ -- statement of any kind in the sequence of statements
---------------------
-- Has_Side_Effect --
---------------------
- -- What is this doing buried two levels down in exp_ch9. It
- -- seems like a generally useful function, and indeed there
- -- may be code duplication going on here ???
+ -- What is this doing buried two levels down in exp_ch9. It seems
+ -- like a generally useful function, and indeed there may be code
+ -- duplication going on here ???
function Has_Side_Effect (N : Node_Id) return Boolean is
- Stmt : Node_Id := N;
+ Stmt : Node_Id;
Expr : Node_Id;
function Is_Call_Or_Raise (N : Node_Id) return Boolean;
-- Indicate whether N is a subprogram call or a raise statement
+ ----------------------
+ -- Is_Call_Or_Raise --
+ ----------------------
+
function Is_Call_Or_Raise (N : Node_Id) return Boolean is
begin
return Nkind (N) = N_Procedure_Call_Statement
@@ -2428,6 +2525,7 @@ package body Exp_Ch9 is
-- Start of processing for Has_Side_Effect
begin
+ Stmt := N;
while Present (Stmt) loop
if Is_Call_Or_Raise (Stmt) then
return True;
@@ -2485,13 +2583,12 @@ package body Exp_Ch9 is
P_Op_Spec :=
Build_Protected_Sub_Specification (N, Pid, Protected_Mode);
- -- Build a list of the formal parameters of the protected
- -- version of the subprogram to use as the actual parameters
- -- of the unprotected version.
+ -- Build a list of the formal parameters of the protected version of
+ -- the subprogram to use as the actual parameters of the unprotected
+ -- version.
Uactuals := New_List;
Pformal := First (Parameter_Specifications (P_Op_Spec));
-
while Present (Pformal) loop
Append (
Make_Identifier (Loc, Chars (Defining_Identifier (Pformal))),
@@ -2499,8 +2596,8 @@ package body Exp_Ch9 is
Next (Pformal);
end loop;
- -- Make a call to the unprotected version of the subprogram
- -- built above for use by the protected version built below.
+ -- Make a call to the unprotected version of the subprogram built above
+ -- for use by the protected version built below.
if Nkind (Op_Spec) = N_Function_Specification then
if Exc_Safe then
@@ -2711,17 +2808,18 @@ package body Exp_Ch9 is
-------------------------
function Build_Selected_Name
- (Prefix, Selector : Name_Id;
- Append_Char : Character := ' ') return Name_Id
+ (Prefix : Entity_Id;
+ Selector : Entity_Id;
+ Append_Char : Character := ' ') return Name_Id
is
Select_Buffer : String (1 .. Hostparm.Max_Name_Length);
Select_Len : Natural;
begin
- Get_Name_String (Selector);
+ Get_Name_String (Chars (Selector));
Select_Len := Name_Len;
Select_Buffer (1 .. Select_Len) := Name_Buffer (1 .. Name_Len);
- Get_Name_String (Prefix);
+ Get_Name_String (Chars (Prefix));
-- If scope is anonymous type, discard suffix to recover name of
-- single protected object. Otherwise use protected type name.
@@ -2739,12 +2837,28 @@ package body Exp_Ch9 is
Name_Buffer (Name_Len) := Select_Buffer (J);
end loop;
+ -- Now add the Append_Char if specified. The encoding to follow
+ -- depends on the type of entity. If Append_Char is either 'N' or 'P',
+ -- then the entity is associated to a protected type subprogram.
+ -- Otherwise, it is a protected type entry. For each case, the
+ -- encoding to follow for the suffix is documented in exp_dbug.ads.
+
+ -- It would be better to encapsulate this as a routine in Exp_Dbug ???
+
if Append_Char /= ' ' then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := Append_Char;
+ if Append_Char = 'P' or Append_Char = 'N' then
+ Name_Len := Name_Len + 1;
+ Name_Buffer (Name_Len) := Append_Char;
+ return Name_Find;
+ else
+ Name_Buffer (Name_Len + 1) := '_';
+ Name_Buffer (Name_Len + 2) := Append_Char;
+ Name_Len := Name_Len + 2;
+ return New_External_Name (Name_Find, ' ', -1);
+ end if;
+ else
+ return Name_Find;
end if;
-
- return Name_Find;
end Build_Selected_Name;
-----------------------------
@@ -2815,24 +2929,26 @@ package body Exp_Ch9 is
Loc : constant Source_Ptr := Sloc (N);
Parms : constant List_Id := Parameter_Associations (N);
Stats : constant List_Id := New_List;
- Pdecl : Node_Id;
- Xdecl : Node_Id;
- Decls : List_Id;
+ Actual : Node_Id;
+ Call : Node_Id;
+ Comm_Name : Entity_Id;
Conctyp : Node_Id;
+ Decls : List_Id;
Ent : Entity_Id;
Ent_Acc : Entity_Id;
+ Formal : Node_Id;
+ Iface_Tag : Entity_Id;
+ Iface_Typ : Entity_Id;
+ N_Node : Node_Id;
+ N_Var : Node_Id;
P : Entity_Id;
- X : Entity_Id;
- Plist : List_Id;
Parm1 : Node_Id;
Parm2 : Node_Id;
Parm3 : Node_Id;
- Call : Node_Id;
- Actual : Node_Id;
- Formal : Node_Id;
- N_Node : Node_Id;
- N_Var : Node_Id;
- Comm_Name : Entity_Id;
+ Pdecl : Node_Id;
+ Plist : List_Id;
+ X : Entity_Id;
+ Xdecl : Node_Id;
begin
-- Simple entry and entry family cases merge here
@@ -2899,7 +3015,7 @@ package body Exp_Ch9 is
end if;
-- The third parameter is the packaged parameters. If there are
- -- none, then it is just the null address, since nothing is passed
+ -- none, then it is just the null address, since nothing is passed.
if No (Parms) then
Parm3 := New_Reference_To (RTE (RE_Null_Address), Loc);
@@ -2909,8 +3025,8 @@ package body Exp_Ch9 is
-- of a packaged record containing the required parameter values.
else
- -- First build a list of parameter values, which are
- -- references to objects of the parameter types.
+ -- First build a list of parameter values, which are references to
+ -- objects of the parameter types.
Plist := New_List;
@@ -2932,9 +3048,9 @@ package body Exp_Ch9 is
Object_Definition =>
New_Reference_To (Etype (Formal), Loc));
- -- We have to make an assignment statement separate for
- -- the case of limited type. We can not assign it unless
- -- the Assignment_OK flag is set first.
+ -- We have to make an assignment statement separate for the
+ -- case of limited type. We cannot assign it unless the
+ -- Assignment_OK flag is set first.
if Ekind (Formal) /= E_Out_Parameter then
N_Var :=
@@ -2954,8 +3070,36 @@ package body Exp_Ch9 is
Prefix =>
New_Reference_To (Defining_Identifier (N_Node), Loc)));
else
- Append_To (Plist,
- Make_Reference (Loc, Prefix => Relocate_Node (Actual)));
+ -- Interface class-wide formal
+
+ if Ada_Version >= Ada_05
+ and then Ekind (Etype (Formal)) = E_Class_Wide_Type
+ and then Is_Interface (Etype (Formal))
+ then
+ Iface_Typ := Etype (Etype (Formal));
+
+ -- Generate:
+ -- formal_iface_type! (actual.iface_tag)'reference
+
+ Iface_Tag :=
+ Find_Interface_Tag (Etype (Actual), Iface_Typ);
+ pragma Assert (Present (Iface_Tag));
+
+ Append_To (Plist,
+ Make_Reference (Loc,
+ Unchecked_Convert_To (Iface_Typ,
+ Make_Selected_Component (Loc,
+ Prefix =>
+ Relocate_Node (Actual),
+ Selector_Name =>
+ New_Reference_To (Iface_Tag, Loc)))));
+ else
+ -- Generate:
+ -- actual'reference
+
+ Append_To (Plist,
+ Make_Reference (Loc, Relocate_Node (Actual)));
+ end if;
end if;
Next_Actual (Actual);
@@ -3066,8 +3210,8 @@ package body Exp_Ch9 is
Append_To (Stats, Call);
- -- If there are out or in/out parameters by copy
- -- add assignment statements for the result values.
+ -- If there are out or in/out parameters by copy add assignment
+ -- statements for the result values.
if Present (Parms) then
Actual := First_Actual (N);
@@ -3088,17 +3232,17 @@ package body Exp_Ch9 is
Selector_Name =>
Make_Identifier (Loc, Chars (Formal)))));
- -- In all cases (including limited private types) we
- -- want the assignment to be valid.
+ -- In all cases (including limited private types) we want
+ -- the assignment to be valid.
Set_Assignment_OK (Name (N_Node));
-- If the call is the triggering alternative in an
- -- asynchronous select, or the entry_call alternative
- -- of a conditional entry call, the assignments for in-out
- -- parameters are incorporated into the statement list
- -- that follows, so that there are executed only if the
- -- entry call succeeds.
+ -- asynchronous select, or the entry_call alternative of a
+ -- conditional entry call, the assignments for in-out
+ -- parameters are incorporated into the statement list that
+ -- follows, so that there are executed only if the entry
+ -- call succeeds.
if (Nkind (Parent (N)) = N_Triggering_Alternative
and then N = Triggering_Statement (Parent (N)))
@@ -3394,9 +3538,9 @@ package body Exp_Ch9 is
Op_Decls : List_Id;
begin
- -- Make an unprotected version of the subprogram for use
- -- within the same object, with a new name and an additional
- -- parameter representing the object.
+ -- Make an unprotected version of the subprogram for use within the same
+ -- object, with a new name and an additional parameter representing the
+ -- object.
Op_Decls := Declarations (N);
N_Op_Spec :=
@@ -3434,22 +3578,61 @@ package body Exp_Ch9 is
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('F'));
- Efam_Decl :=
- Make_Full_Type_Declaration (Loc,
- Defining_Identifier => Efam_Type,
- Type_Definition =>
- Make_Unconstrained_Array_Definition (Loc,
- Subtype_Marks => (New_List (
- New_Occurrence_Of (
+ declare
+ Bas : Entity_Id :=
Base_Type
- (Etype (Discrete_Subtype_Definition
- (Parent (Efam)))), Loc))),
+ (Etype (Discrete_Subtype_Definition (Parent (Efam))));
+ Bas_Decl : Node_Id := Empty;
+ Lo, Hi : Node_Id;
+
+ begin
+ Get_Index_Bounds
+ (Discrete_Subtype_Definition (Parent (Efam)), Lo, Hi);
+ if Scope (Bas) = Standard_Standard
+ and then Bas = Base_Type (Standard_Integer)
+ and then Has_Discriminants (Conctyp)
+ and then Present
+ (Discriminant_Default_Value (First_Discriminant (Conctyp)))
+ and then
+ (Denotes_Discriminant (Lo, True)
+ or else Denotes_Discriminant (Hi, True))
+ then
+ Bas :=
+ Make_Defining_Identifier (Loc, New_Internal_Name ('B'));
+ Bas_Decl :=
+ Make_Subtype_Declaration (Loc,
+ Defining_Identifier => Bas,
+ Subtype_Indication =>
+ Make_Subtype_Indication (Loc,
+ Subtype_Mark =>
+ New_Occurrence_Of (Standard_Integer, Loc),
+ Constraint =>
+ Make_Range_Constraint (Loc,
+ Range_Expression => Make_Range (Loc,
+ Make_Integer_Literal
+ (Loc, -Entry_Family_Bound),
+ Make_Integer_Literal
+ (Loc, Entry_Family_Bound - 1)))));
+
+ Insert_After (Current_Node, Bas_Decl);
+ Current_Node := Bas_Decl;
+ Analyze (Bas_Decl);
+ end if;
+
+ Efam_Decl :=
+ Make_Full_Type_Declaration (Loc,
+ Defining_Identifier => Efam_Type,
+ Type_Definition =>
+ Make_Unconstrained_Array_Definition (Loc,
+ Subtype_Marks =>
+ (New_List (New_Occurrence_Of (Bas, Loc))),
Component_Definition =>
Make_Component_Definition (Loc,
Aliased_Present => False,
Subtype_Indication =>
New_Reference_To (Standard_Character, Loc))));
+ end;
Insert_After (Current_Node, Efam_Decl);
Current_Node := Efam_Decl;
@@ -3485,8 +3668,8 @@ package body Exp_Ch9 is
-- Concurrent_Ref --
--------------------
- -- The expression returned for a reference to a concurrent
- -- object has the form:
+ -- The expression returned for a reference to a concurrent object has the
+ -- form:
-- taskV!(name)._Task_Id
@@ -3501,8 +3684,8 @@ package body Exp_Ch9 is
-- objectV!(name.all)._Object
-- here taskV and objectV are the types for the associated records, which
- -- contain the required _Task_Id and _Object fields for tasks and
- -- protected objects, respectively.
+ -- contain the required _Task_Id and _Object fields for tasks and protected
+ -- objects, respectively.
-- For the case of a task type name, the expression is
@@ -3514,8 +3697,8 @@ package body Exp_Ch9 is
-- objectR
- -- which is a renaming of the _object field of the current object
- -- object record, passed into protected operations as a parameter.
+ -- which is a renaming of the _object field of the current object object
+ -- record, passed into protected operations as a parameter.
function Concurrent_Ref (N : Node_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (N);
@@ -3560,8 +3743,8 @@ package body Exp_Ch9 is
end if;
end loop;
- -- We know that we are within the task body, so should have
- -- found it in scope.
+ -- We know that we are within the task body, so should have found it
+ -- in scope.
raise Program_Error;
end Is_Current_Task;
@@ -3598,10 +3781,11 @@ package body Exp_Ch9 is
else
declare
Decl : Node_Id;
- T_Self : constant Entity_Id
- := Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
- T_Body : constant Node_Id
- := Parent (Corresponding_Body (Parent (Entity (N))));
+ T_Self : constant Entity_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('T'));
+ T_Body : constant Node_Id :=
+ Parent (Corresponding_Body (Parent (Entity (N))));
begin
Decl := Make_Object_Declaration (Loc,
@@ -3680,22 +3864,22 @@ package body Exp_Ch9 is
S : Node_Id;
begin
- -- The queues of entries and entry families appear in textual
- -- order in the associated record. The entry index is computed as
- -- the sum of the number of queues for all entries that precede the
- -- designated one, to which is added the index expression, if this
- -- expression denotes a member of a family.
+ -- The queues of entries and entry families appear in textual order in
+ -- the associated record. The entry index is computed as the sum of the
+ -- number of queues for all entries that precede the designated one, to
+ -- which is added the index expression, if this expression denotes a
+ -- member of a family.
-- The following is a place holder for the count of simple entries
Num := Make_Integer_Literal (Sloc, 1);
- -- We construct an expression which is a series of addition
- -- operations. The first operand is the number of single entries that
- -- precede this one, the second operand is the index value relative
- -- to the start of the referenced family, and the remaining operands
- -- are the lengths of the entry families that precede this entry, i.e.
- -- the constructed expression is:
+ -- We construct an expression which is a series of addition operations.
+ -- The first operand is the number of single entries that precede this
+ -- one, the second operand is the index value relative to the start of
+ -- the referenced family, and the remaining operands are the lengths of
+ -- the entry families that precede this entry, i.e. the constructed
+ -- expression is:
-- number_simple_entries +
-- (s'pos (index-value) - s'pos (family'first)) + 1 +
@@ -3703,8 +3887,8 @@ package body Exp_Ch9 is
-- where index-value is the given index value, and s is the index
-- subtype (we have to use pos because the subtype might be an
- -- enumeration type preventing direct subtraction).
- -- Note that the task entry array is one-indexed.
+ -- enumeration type preventing direct subtraction). Note that the task
+ -- entry array is one-indexed.
-- The upper bound of the entry family may be a discriminant, so we
-- retrieve the lower bound explicitly to compute offset, rather than
@@ -3770,7 +3954,6 @@ package body Exp_Ch9 is
procedure Establish_Task_Master (N : Node_Id) is
Call : Node_Id;
-
begin
if Restriction_Active (No_Task_Hierarchy) = False then
Call := Build_Runtime_Call (Sloc (N), RE_Enter_Master);
@@ -3822,13 +4005,12 @@ package body Exp_Ch9 is
-- We can distinguish the two cases by seeing whether the accept statement
-- is part of a list. If not, then it must be in an accept alternative.
- -- To expand the requeue statement, a label is provided at the end of
- -- the accept statement or alternative of which it is a part, so that
- -- the statement can be skipped after the requeue is complete.
- -- This label is created here rather than during the expansion of the
- -- accept statement, because it will be needed by any requeue
- -- statements within the accept, which are expanded before the
- -- accept.
+ -- To expand the requeue statement, a label is provided at the end of the
+ -- accept statement or alternative of which it is a part, so that the
+ -- statement can be skipped after the requeue is complete. This label is
+ -- created here rather than during the expansion of the accept statement,
+ -- because it will be needed by any requeue statements within the accept,
+ -- which are expanded before the accept.
procedure Expand_Accept_Declarations (N : Node_Id; Ent : Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
@@ -3864,8 +4046,8 @@ package body Exp_Ch9 is
-- Create and declare two labels to be placed at the end of the
-- accept statement. The first label is used to allow requeues to
- -- skip the remainder of entry processing. The second label is
- -- used to skip the remainder of entry processing if the rendezvous
+ -- skip the remainder of entry processing. The second label is used
+ -- to skip the remainder of entry processing if the rendezvous
-- completes in the middle of the accept body.
if Present (Handled_Statement_Sequence (N)) then
@@ -3952,11 +4134,10 @@ package body Exp_Ch9 is
Next (Alt);
end loop;
- -- If we are the first accept statement, then we have to
- -- create the Ann variable, as for the stand alone case,
- -- except that it is inserted before the selective accept.
- -- Similarly, a label for requeue expansion must be
- -- declared.
+ -- If we are the first accept statement, then we have to create
+ -- the Ann variable, as for the stand alone case, except that
+ -- it is inserted before the selective accept. Similarly, a
+ -- label for requeue expansion must be declared.
if N = Accept_Statement (Alt) then
Ann :=
@@ -3971,8 +4152,8 @@ package body Exp_Ch9 is
Insert_Before (Sel_Acc, Adecl);
Analyze (Adecl);
- -- If we are not the first accept statement, then find the
- -- Ann variable allocated by the first accept and use it.
+ -- If we are not the first accept statement, then find the Ann
+ -- variable allocated by the first accept and use it.
else
Ann :=
@@ -3991,30 +4172,31 @@ package body Exp_Ch9 is
Set_Needs_Debug_Info (Ann);
end if;
- -- Create renaming declarations for the entry formals. Each
- -- reference to a formal becomes a dereference of a component
- -- of the parameter block, whose address is held in Ann.
- -- These declarations are eventually inserted into the accept
- -- block, and analyzed there so that they have the proper scope
- -- for gdb and do not conflict with other declarations.
+ -- Create renaming declarations for the entry formals. Each reference
+ -- to a formal becomes a dereference of a component of the parameter
+ -- block, whose address is held in Ann. These declarations are
+ -- eventually inserted into the accept block, and analyzed there so
+ -- that they have the proper scope for gdb and do not conflict with
+ -- other declarations.
if Present (Parameter_Specifications (N))
and then Present (Handled_Statement_Sequence (N))
then
declare
- Formal : Entity_Id;
- New_F : Entity_Id;
Comp : Entity_Id;
Decl : Node_Id;
+ Formal : Entity_Id;
+ New_F : Entity_Id;
begin
New_Scope (Ent);
Formal := First_Formal (Ent);
while Present (Formal) loop
- Comp := Entry_Component (Formal);
- New_F :=
+ Comp := Entry_Component (Formal);
+ New_F :=
Make_Defining_Identifier (Sloc (Formal), Chars (Formal));
+
Set_Etype (New_F, Etype (Formal));
Set_Scope (New_F, Ent);
Set_Needs_Debug_Info (New_F); -- That's the whole point.
@@ -4030,16 +4212,19 @@ package body Exp_Ch9 is
Decl :=
Make_Object_Renaming_Declaration (Loc,
- Defining_Identifier => New_F,
- Subtype_Mark => New_Reference_To (Etype (Formal), Loc),
- Name =>
- Make_Explicit_Dereference (Loc,
- Make_Selected_Component (Loc,
- Prefix =>
- Unchecked_Convert_To (Entry_Parameters_Type (Ent),
- New_Reference_To (Ann, Loc)),
- Selector_Name =>
- New_Reference_To (Comp, Loc))));
+ Defining_Identifier =>
+ New_F,
+ Subtype_Mark =>
+ New_Reference_To (Etype (Formal), Loc),
+ Name =>
+ Make_Explicit_Dereference (Loc,
+ Make_Selected_Component (Loc,
+ Prefix =>
+ Unchecked_Convert_To (
+ Entry_Parameters_Type (Ent),
+ New_Reference_To (Ann, Loc)),
+ Selector_Name =>
+ New_Reference_To (Comp, Loc))));
if No (Declarations (N)) then
Set_Declarations (N, New_List);
@@ -4065,10 +4250,10 @@ package body Exp_Ch9 is
Comps : List_Id;
T : constant Entity_Id := Defining_Identifier (N);
D_T : constant Entity_Id := Designated_Type (T);
- D_T2 : constant Entity_Id := Make_Defining_Identifier
- (Loc, New_Internal_Name ('D'));
- E_T : constant Entity_Id := Make_Defining_Identifier
- (Loc, New_Internal_Name ('E'));
+ D_T2 : constant Entity_Id := Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('D'));
+ E_T : constant Entity_Id := Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('E'));
P_List : constant List_Id := Build_Protected_Spec
(N, RTE (RE_Address), False, D_T);
Decl1 : Node_Id;
@@ -4099,8 +4284,8 @@ package body Exp_Ch9 is
Analyze (Decl1);
Insert_After (N, Decl1);
- -- Create Equivalent_Type, a record with two components for an
- -- access to object and an access to subprogram.
+ -- Create Equivalent_Type, a record with two components for an access to
+ -- object and an access to subprogram.
Comps := New_List (
Make_Component_Declaration (Loc,
@@ -4154,12 +4339,12 @@ package body Exp_Ch9 is
return;
end if;
- -- The body of the entry barrier must be analyzed in the context of
- -- the protected object, but its scope is external to it, just as any
- -- other unprotected version of a protected operation. The specification
- -- has been produced when the protected type declaration was elaborated.
- -- We build the body, insert it in the enclosing scope, but analyze it
- -- in the current context. A more uniform approach would be to treat a
+ -- The body of the entry barrier must be analyzed in the context of the
+ -- protected object, but its scope is external to it, just as any other
+ -- unprotected version of a protected operation. The specification has
+ -- been produced when the protected type declaration was elaborated. We
+ -- build the body, insert it in the enclosing scope, but analyze it in
+ -- the current context. A more uniform approach would be to treat
-- barrier just as a protected function, and discard the protected
-- version of it because it is never called.
@@ -4178,7 +4363,7 @@ package body Exp_Ch9 is
Update_Prival_Subtypes (B_F);
- Set_Privals (Spec_Decl, N, Loc);
+ Set_Privals (Spec_Decl, N, Loc, After_Barrier => True);
Set_Discriminals (Spec_Decl);
Set_Scope (Func, Scope (Prot));
@@ -4186,16 +4371,16 @@ package body Exp_Ch9 is
Analyze_And_Resolve (Cond, Any_Boolean);
end if;
- -- The Ravenscar profile restricts barriers to simple variables
- -- declared within the protected object. We also allow Boolean
- -- constants, since these appear in several published examples
- -- and are also allowed by the Aonix compiler.
+ -- The Ravenscar profile restricts barriers to simple variables declared
+ -- within the protected object. We also allow Boolean constants, since
+ -- these appear in several published examples and are also allowed by
+ -- the Aonix compiler.
- -- Note that after analysis variables in this context will be
- -- replaced by the corresponding prival, that is to say a renaming
- -- of a selected component of the form _Object.Var. If expansion is
- -- disabled, as within a generic, we check that the entity appears in
- -- the current scope.
+ -- Note that after analysis variables in this context will be replaced
+ -- by the corresponding prival, that is to say a renaming of a selected
+ -- component of the form _Object.Var. If expansion is disabled, as
+ -- within a generic, we check that the entity appears in the current
+ -- scope.
if Is_Entity_Name (Cond) then
@@ -4278,11 +4463,37 @@ package body Exp_Ch9 is
while Present (Tasknm) loop
Count := Count + 1;
- Append_To (Component_Associations (Aggr),
- Make_Component_Association (Loc,
- Choices => New_List (
- Make_Integer_Literal (Loc, Count)),
- Expression => Concurrent_Ref (Tasknm)));
+
+ -- A task interface class-wide type object is being aborted.
+ -- Retrieve its _task_id by calling a dispatching routine.
+
+ if Ada_Version >= Ada_05
+ and then Ekind (Etype (Tasknm)) = E_Class_Wide_Type
+ and then Is_Interface (Etype (Tasknm))
+ and then Is_Task_Interface (Etype (Tasknm))
+ then
+ Append_To (Component_Associations (Aggr),
+ Make_Component_Association (Loc,
+ Choices => New_List (
+ Make_Integer_Literal (Loc, Count)),
+ Expression =>
+
+ -- Tasknm._disp_get_task_id
+
+ Make_Selected_Component (Loc,
+ Prefix =>
+ New_Copy_Tree (Tasknm),
+ Selector_Name =>
+ Make_Identifier (Loc, Name_uDisp_Get_Task_Id))));
+
+ else
+ Append_To (Component_Associations (Aggr),
+ Make_Component_Association (Loc,
+ Choices => New_List (
+ Make_Integer_Literal (Loc, Count)),
+ Expression => Concurrent_Ref (Tasknm)));
+ end if;
+
Next (Tasknm);
end loop;
@@ -4340,10 +4551,10 @@ package body Exp_Ch9 is
-- Exceptional_Complete_Rendezvous (Get_GNAT_Exception);
-- end;
- -- The first three declarations were already inserted ahead of the
- -- accept statement by the Expand_Accept_Declarations procedure, which
- -- was called directly from the semantics during analysis of the accept.
- -- statement, before analyzing its contained statements.
+ -- The first three declarations were already inserted ahead of the accept
+ -- statement by the Expand_Accept_Declarations procedure, which was called
+ -- directly from the semantics during analysis of the accept. statement,
+ -- before analyzing its contained statements.
-- The declarations from the N_Accept_Statement, as noted in Sinfo, come
-- from possible expansion activity (the original source of course does
@@ -4372,7 +4583,11 @@ package body Exp_Ch9 is
function Null_Statements (Stats : List_Id) return Boolean;
-- Check for null statement sequence (i.e a list of labels and
- -- null statements)
+ -- null statements).
+
+ ---------------------
+ -- Null_Statements --
+ ---------------------
function Null_Statements (Stats : List_Id) return Boolean is
Stmt : Node_Id;
@@ -4475,11 +4690,11 @@ package body Exp_Ch9 is
Declarations => Declarations (N),
Handled_Statement_Sequence => Build_Accept_Body (N));
- -- Prepend call to Accept_Call to main statement sequence
- -- If the accept has exception handlers, the statement sequence
- -- is wrapped in a block. Insert call and renaming declarations
- -- in the declarations of the block, so they are elaborated before
- -- the handlers.
+ -- Prepend call to Accept_Call to main statement sequence If the
+ -- accept has exception handlers, the statement sequence is wrapped
+ -- in a block. Insert call and renaming declarations in the
+ -- declarations of the block, so they are elaborated before the
+ -- handlers.
Call :=
Make_Procedure_Call_Statement (Loc,
@@ -4504,28 +4719,28 @@ package body Exp_Ch9 is
D : Node_Id;
Next_D : Node_Id;
Typ : Entity_Id;
+
begin
D := First (Declarations (N));
-
while Present (D) loop
Next_D := Next (D);
if Nkind (D) = N_Object_Renaming_Declaration then
- -- The renaming declarations for the formals were
- -- created during analysis of the accept statement,
- -- and attached to the list of declarations. Place
- -- them now in the context of the accept block or
- -- subprogram.
+
+ -- The renaming declarations for the formals were created
+ -- during analysis of the accept statement, and attached to
+ -- the list of declarations. Place them now in the context
+ -- of the accept block or subprogram.
Remove (D);
Typ := Entity (Subtype_Mark (D));
Insert_After (Call, D);
Analyze (D);
- -- If the formal is class_wide, it does not have an
- -- actual subtype. The analysis of the renaming declaration
- -- creates one, but we need to retain the class-wide
- -- nature of the entity.
+ -- If the formal is class_wide, it does not have an actual
+ -- subtype. The analysis of the renaming declaration creates
+ -- one, but we need to retain the class-wide nature of the
+ -- entity.
if Is_Class_Wide_Type (Typ) then
Set_Etype (Defining_Identifier (D), Typ);
@@ -4691,16 +4906,6 @@ package body Exp_Ch9 is
-- S : constant Integer := DT_Position (<dispatching-call>);
-- U : Boolean;
- -- procedure <temp>A is
- -- begin
- -- <abortable-statements>
- -- end <temp>A;
-
- -- procedure <temp>T is
- -- begin
- -- <triggered-statements>
- -- end <temp>T;
-
-- begin
-- disp_get_prim_op_kind (<object>, S, C);
@@ -4723,7 +4928,7 @@ package body Exp_Ch9 is
-- ParamN := P.ParamN;
-- if Enqueued (Bnn) then
- -- <temp>A;
+ -- <abortable-statements>
-- end if;
-- at end
-- _clean;
@@ -4733,7 +4938,7 @@ package body Exp_Ch9 is
-- end;
-- if not Cancelled (Bnn) then
- -- <temp>T;
+ -- <triggering-statements>
-- end if;
-- elsif C = POK_Task_Entry then
@@ -4756,7 +4961,7 @@ package body Exp_Ch9 is
-- begin
-- begin
-- Abort_Undefer;
- -- <temp>A;
+ -- <abortable-statements>
-- at end
-- _clean;
-- end;
@@ -4765,13 +4970,13 @@ package body Exp_Ch9 is
-- end;
-- if not U then
- -- <temp>T;
+ -- <triggering-statements>
-- end if;
-- end;
-- else
-- <dispatching-call>;
- -- <temp>T;
+ -- <triggering-statements>
-- end if;
-- The job is to convert this to the asynchronous form
@@ -4795,46 +5000,46 @@ package body Exp_Ch9 is
Trig : constant Node_Id := Triggering_Alternative (N);
Tstats : constant List_Id := Statements (Trig);
- Abortable_Block : Node_Id;
- Actuals : List_Id;
- Aproc : Entity_Id;
- Blk_Ent : Entity_Id;
- Blk_Typ : Entity_Id;
- Call : Node_Id;
- Call_Ent : Entity_Id;
- Cancel_Param : Entity_Id;
- Cleanup_Block : Node_Id;
- Cleanup_Stmts : List_Id;
- Concval : Node_Id;
- Dblock_Ent : Entity_Id;
- Decl : Node_Id;
- Decls : List_Id;
- Ecall : Node_Id;
- Ename : Node_Id;
- Enqueue_Call : Node_Id;
- Formals : List_Id;
- Hdle : List_Id;
- Index : Node_Id;
- N_Orig : Node_Id;
- Obj : Entity_Id;
- Param : Node_Id;
- Params : List_Id;
- Pdef : Entity_Id;
- ProtE_Stmts : List_Id;
- ProtP_Stmts : List_Id;
- Stmt : Node_Id;
- Stmts : List_Id;
- Target_Undefer : RE_Id;
- TaskE_Stmts : List_Id;
- Tproc : Entity_Id;
- Undefer_Args : List_Id := No_List;
+ Abort_Block_Ent : Entity_Id;
+ Abortable_Block : Node_Id;
+ Actuals : List_Id;
+ Blk_Ent : Entity_Id;
+ Blk_Typ : Entity_Id;
+ Call : Node_Id;
+ Call_Ent : Entity_Id;
+ Cancel_Param : Entity_Id;
+ Cleanup_Block : Node_Id;
+ Cleanup_Block_Ent : Entity_Id;
+ Cleanup_Stmts : List_Id;
+ Concval : Node_Id;
+ Dblock_Ent : Entity_Id;
+ Decl : Node_Id;
+ Decls : List_Id;
+ Ecall : Node_Id;
+ Ename : Node_Id;
+ Enqueue_Call : Node_Id;
+ Formals : List_Id;
+ Hdle : List_Id;
+ Index : Node_Id;
+ N_Orig : Node_Id;
+ Obj : Entity_Id;
+ Param : Node_Id;
+ Params : List_Id;
+ Pdef : Entity_Id;
+ ProtE_Stmts : List_Id;
+ ProtP_Stmts : List_Id;
+ Stmt : Node_Id;
+ Stmts : List_Id;
+ Target_Undefer : RE_Id;
+ TaskE_Stmts : List_Id;
+ Undefer_Args : List_Id := No_List;
B : Entity_Id; -- Call status flag
Bnn : Entity_Id; -- Communication block
C : Entity_Id; -- Call kind
- P : Node_Id; -- Parameter block
+ P : Entity_Id; -- Parameter block
S : Entity_Id; -- Primitive operation slot
- U : Entity_Id; -- Additional status flag
+ T : Entity_Id; -- Additional status flag
begin
Blk_Ent := Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
@@ -4900,50 +5105,37 @@ package body Exp_Ch9 is
-- Dispatch table slot processing, generate:
-- S : constant Integer :=
- -- DT_Position (<dispatching-procedure>);
+ -- Ada.Tags.Get_Offset_Index (
+ -- Unchecked_Convert_To (Ada.Tags.Interface_Tag, Obj),
+ -- DT_Position (<dispatching-procedure>));
- S := SEU.Build_S (Loc, Decls, Call_Ent);
+ S := SEU.Build_S (Loc, Decls, Obj, Call_Ent);
-- Additional status flag processing, generate:
- U := Make_Defining_Identifier (Loc, Name_uU);
+ T := Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier =>
- U,
+ T,
Object_Definition =>
New_Reference_To (Standard_Boolean, Loc)));
- -- Generate:
- -- procedure <temp>A is
- -- begin
- -- Astmts
- -- end <temp>A;
-
- Aproc := SEU.Build_Wrapping_Procedure (Loc, 'A', Decls, Astats);
-
- -- Generate:
- -- procedure <temp>T is
- -- begin
- -- Tstmts
- -- end <temp>T;
-
- Tproc := SEU.Build_Wrapping_Procedure (Loc, 'T', Decls, Tstats);
-
- -- Generate:
- -- _dispatching_get_prim_op_kind (<object>, S, C);
-
Append_To (Stmts,
Make_Procedure_Call_Statement (Loc,
Name =>
- Make_Identifier (Loc, Name_uDisp_Get_Prim_Op_Kind),
+ New_Reference_To (
+ Find_Prim_Op (Etype (Etype (Obj)),
+ Name_uDisp_Get_Prim_Op_Kind),
+ Loc),
Parameter_Associations =>
New_List (
New_Copy_Tree (Obj),
New_Reference_To (S, Loc),
New_Reference_To (C, Loc))));
+ -- ---------------------------------------------------------------
-- Protected entry handling
-- Generate:
@@ -4951,7 +5143,7 @@ package body Exp_Ch9 is
-- ...
-- ParamN := P.ParamN;
- Cleanup_Stmts := Parameter_Block_Unpack (Loc, Actuals, Formals);
+ Cleanup_Stmts := Parameter_Block_Unpack (Loc, P, Actuals, Formals);
-- Generate:
-- _dispatching_asynchronous_select
@@ -4960,22 +5152,25 @@ package body Exp_Ch9 is
Prepend_To (Cleanup_Stmts,
Make_Procedure_Call_Statement (Loc,
Name =>
- Make_Identifier (Loc, Name_uDisp_Asynchronous_Select),
+ New_Reference_To (
+ Find_Prim_Op (Etype (Etype (Obj)),
+ Name_uDisp_Asynchronous_Select),
+ Loc),
Parameter_Associations =>
New_List (
New_Copy_Tree (Obj),
New_Reference_To (S, Loc),
- P,
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (P, Loc),
+ Attribute_Name => Name_Address),
New_Reference_To (Bnn, Loc),
New_Reference_To (B, Loc))));
-- Generate:
-- if Enqueued (Bnn) then
- -- <temp>A
+ -- <abortable-statements>
-- end if;
- -- where <temp>A is the abort statements wrapping procedure
-
Append_To (Cleanup_Stmts,
Make_If_Statement (Loc,
Condition =>
@@ -4987,12 +5182,7 @@ package body Exp_Ch9 is
New_Reference_To (Bnn, Loc))),
Then_Statements =>
- New_List (
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Reference_To (Aproc, Loc),
- Parameter_Associations =>
- No_List))));
+ New_Copy_List_Tree (Astats)));
-- Wrap the statements in a block. Exp_Ch7.Expand_Cleanup_Actions
-- will then generate a _clean for the communication block Bnn.
@@ -5011,10 +5201,13 @@ package body Exp_Ch9 is
-- _clean;
-- end;
- Cleanup_Block :=
- SEU.Build_Cleanup_Block (Loc, Blk_Ent, Cleanup_Stmts, Bnn);
+ Cleanup_Block_Ent :=
+ Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
+
+ Cleanup_Block := SEU.Build_Cleanup_Block (Loc,
+ Cleanup_Block_Ent, Cleanup_Stmts, Bnn);
- -- Wrap the cleanup block in an exception handling block.
+ -- Wrap the cleanup block in an exception handling block
-- Generate:
-- begin
@@ -5023,17 +5216,22 @@ package body Exp_Ch9 is
-- when Abort_Signal => Abort_Undefer;
-- end;
+ Abort_Block_Ent :=
+ Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+
ProtE_Stmts :=
New_List (
- SEU.Build_Abort_Block (Loc, Blk_Ent, Cleanup_Block));
+ Make_Implicit_Label_Declaration (Loc,
+ Defining_Identifier => Abort_Block_Ent),
+
+ SEU.Build_Abort_Block (Loc,
+ Abort_Block_Ent, Cleanup_Block_Ent, Cleanup_Block));
-- Generate:
-- if not Cancelled (Bnn) then
- -- <temp>T
+ -- <triggering-statements>
-- end if;
- -- there <temp>T is the triggering statements wrapping procedure
-
Append_To (ProtE_Stmts,
Make_If_Statement (Loc,
Condition =>
@@ -5047,14 +5245,9 @@ package body Exp_Ch9 is
New_Reference_To (Bnn, Loc)))),
Then_Statements =>
- New_List (
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Reference_To (Tproc, Loc),
- Parameter_Associations =>
- No_List))));
+ New_Copy_List_Tree (Tstats)));
- -------------------------------------------------------------------
+ -- ---------------------------------------------------------------
-- Task entry handling
-- Generate:
@@ -5062,7 +5255,7 @@ package body Exp_Ch9 is
-- ...
-- ParamN := P.ParamN;
- TaskE_Stmts := Parameter_Block_Unpack (Loc, Actuals, Formals);
+ TaskE_Stmts := Parameter_Block_Unpack (Loc, P, Actuals, Formals);
-- Generate:
-- _dispatching_asynchronous_select
@@ -5071,12 +5264,17 @@ package body Exp_Ch9 is
Prepend_To (TaskE_Stmts,
Make_Procedure_Call_Statement (Loc,
Name =>
- Make_Identifier (Loc, Name_uDisp_Asynchronous_Select),
+ New_Reference_To (
+ Find_Prim_Op (Etype (Etype (Obj)),
+ Name_uDisp_Asynchronous_Select),
+ Loc),
Parameter_Associations =>
New_List (
New_Copy_Tree (Obj),
New_Reference_To (S, Loc),
- New_Copy_Tree (P),
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (P, Loc),
+ Attribute_Name => Name_Address),
New_Reference_To (Bnn, Loc),
New_Reference_To (B, Loc))));
@@ -5092,23 +5290,16 @@ package body Exp_Ch9 is
-- Generate:
-- Abort_Undefer;
- -- <temp>A
-
- -- where <temp>A is the abortable statements wrapping procedure
+ -- <abortable-statements>
- Cleanup_Stmts :=
- New_List (
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Reference_To (RTE (RE_Abort_Undefer), Loc),
- Parameter_Associations =>
- No_List),
+ Cleanup_Stmts := New_Copy_List_Tree (Astats);
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Reference_To (Aproc, Loc),
- Parameter_Associations =>
- No_List));
+ Prepend_To (Cleanup_Stmts,
+ Make_Procedure_Call_Statement (Loc,
+ Name =>
+ New_Reference_To (RTE (RE_Abort_Undefer), Loc),
+ Parameter_Associations =>
+ No_List));
-- Wrap the statements in a block. Exp_Ch7.Expand_Cleanup_Actions
-- will generate a _clean for the additional status flag.
@@ -5125,10 +5316,11 @@ package body Exp_Ch9 is
-- _clean;
-- end;
- Blk_Ent := Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+ Cleanup_Block_Ent :=
+ Make_Defining_Identifier (Loc, New_Internal_Name ('C'));
- Cleanup_Block :=
- SEU.Build_Cleanup_Block (Loc, Blk_Ent, Cleanup_Stmts, U);
+ Cleanup_Block := SEU.Build_Cleanup_Block (Loc,
+ Cleanup_Block_Ent, Cleanup_Stmts, T);
-- Wrap the cleanup block in an exception handling block
@@ -5139,48 +5331,41 @@ package body Exp_Ch9 is
-- when Abort_Signal => Abort_Undefer;
-- end;
+ Abort_Block_Ent :=
+ Make_Defining_Identifier (Loc, New_Internal_Name ('A'));
+
Append_To (TaskE_Stmts,
- SEU.Build_Abort_Block (Loc, Blk_Ent, Cleanup_Block));
+ Make_Implicit_Label_Declaration (Loc,
+ Defining_Identifier => Abort_Block_Ent));
+
+ Append_To (TaskE_Stmts,
+ SEU.Build_Abort_Block (Loc,
+ Abort_Block_Ent, Cleanup_Block_Ent, Cleanup_Block));
-- Generate:
- -- if not U then
- -- <temp>T
+ -- if not T then
+ -- <triggering-statements>
-- end if;
- -- where <temp>T is the triggering statements wrapping procedure
-
Append_To (TaskE_Stmts,
Make_If_Statement (Loc,
Condition =>
Make_Op_Not (Loc,
Right_Opnd =>
- New_Reference_To (U, Loc)),
+ New_Reference_To (T, Loc)),
+
Then_Statements =>
- New_List (
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Reference_To (Tproc, Loc),
- Parameter_Associations =>
- No_List))));
+ New_Copy_List_Tree (Tstats)));
-------------------------------------------------------------------
-- Protected procedure handling
-- Generate:
-- <dispatching-call>;
- -- <temp>T;
+ -- <triggering-statements>
- -- where <temp>T is the triggering statements wrapping procedure
-
- ProtP_Stmts :=
- New_List (
- New_Copy_Tree (Ecall),
-
- Make_Procedure_Call_Statement (Loc,
- Name =>
- New_Reference_To (Tproc, Loc),
- Parameter_Associations =>
- No_List));
+ ProtP_Stmts := New_Copy_List_Tree (Tstats);
+ Prepend_To (ProtP_Stmts, New_Copy_Tree (Ecall));
-- Generate:
-- if C = POK_Procedure_Entry then
@@ -5212,6 +5397,7 @@ package body Exp_Ch9 is
New_Reference_To (C, Loc),
Right_Opnd =>
New_Reference_To (RTE (RE_POK_Task_Entry), Loc)),
+
Then_Statements =>
TaskE_Stmts)),
@@ -5331,6 +5517,7 @@ package body Exp_Ch9 is
Analyze (N);
return;
end if;
+
else
N_Orig := N;
end if;
@@ -5725,10 +5912,11 @@ package body Exp_Ch9 is
Params : List_Id;
Stmt : Node_Id;
Stmts : List_Id;
+ Unpack : List_Id;
B : Entity_Id; -- Call status flag
C : Entity_Id; -- Call kind
- P : Node_Id; -- Parameter block
+ P : Entity_Id; -- Parameter block
S : Entity_Id; -- Primitive operation slot
begin
@@ -5758,9 +5946,11 @@ package body Exp_Ch9 is
-- Dispatch table slot processing, generate:
-- S : constant Integer :=
- -- DT_Position (<dispatching-procedure>);
+ -- Ada.Tags.Get_Offset_Index (
+ -- Unchecked_Convert_To (Ada.Tags.Interface_Tag, Obj),
+ -- DT_Position (<dispatching-procedure>));
- S := SEU.Build_S (Loc, Decls, Call_Ent);
+ S := SEU.Build_S (Loc, Decls, Obj, Call_Ent);
-- Generate:
-- _dispatching_conditional_select (<object>, S, P'address, C, B);
@@ -5768,12 +5958,17 @@ package body Exp_Ch9 is
Append_To (Stmts,
Make_Procedure_Call_Statement (Loc,
Name =>
- Make_Identifier (Loc, Name_uDisp_Conditional_Select),
+ New_Reference_To (
+ Find_Prim_Op (Etype (Etype (Obj)),
+ Name_uDisp_Conditional_Select),
+ Loc),
Parameter_Associations =>
New_List (
New_Copy_Tree (Obj),
New_Reference_To (S, Loc),
- P,
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (P, Loc),
+ Attribute_Name => Name_Address),
New_Reference_To (C, Loc),
New_Reference_To (B, Loc))));
@@ -5786,26 +5981,33 @@ package body Exp_Ch9 is
-- ParamN := P.ParamN;
-- end if;
- Append_To (Stmts,
- Make_If_Statement (Loc,
+ Unpack := Parameter_Block_Unpack (Loc, P, Actuals, Formals);
- Condition =>
- Make_Or_Else (Loc,
- Left_Opnd =>
- Make_Op_Eq (Loc,
- Left_Opnd =>
- New_Reference_To (C, Loc),
- Right_Opnd =>
- New_Reference_To (RTE (RE_POK_Protected_Entry), Loc)),
- Right_Opnd =>
- Make_Op_Eq (Loc,
- Left_Opnd =>
- New_Reference_To (C, Loc),
- Right_Opnd =>
- New_Reference_To (RTE (RE_POK_Task_Entry), Loc))),
+ -- Generate the if statement only when the packed parameters need
+ -- explicit assignments to their corresponding actuals.
- Then_Statements =>
- Parameter_Block_Unpack (Loc, Actuals, Formals)));
+ if Present (Unpack) then
+ Append_To (Stmts,
+ Make_If_Statement (Loc,
+
+ Condition =>
+ Make_Or_Else (Loc,
+ Left_Opnd =>
+ Make_Op_Eq (Loc,
+ Left_Opnd =>
+ New_Reference_To (C, Loc),
+ Right_Opnd =>
+ New_Reference_To (RTE (
+ RE_POK_Protected_Entry), Loc)),
+ Right_Opnd =>
+ Make_Op_Eq (Loc,
+ Left_Opnd =>
+ New_Reference_To (C, Loc),
+ Right_Opnd =>
+ New_Reference_To (RTE (RE_POK_Task_Entry), Loc))),
+
+ Then_Statements => Unpack));
+ end if;
-- Generate:
-- if B then
@@ -5820,7 +6022,7 @@ package body Exp_Ch9 is
-- <else-statements>
-- end if;
- N_Stats := New_Copy_List (Statements (Alt));
+ N_Stats := New_Copy_List_Tree (Statements (Alt));
Prepend_To (N_Stats,
Make_If_Statement (Loc,
@@ -6060,10 +6262,9 @@ package body Exp_Ch9 is
end if;
end if;
- -- Associate privals and discriminals with the next protected
- -- operation body to be expanded. These are used to expand
- -- references to private data objects and discriminants,
- -- respectively.
+ -- Associate privals and discriminals with the next protected operation
+ -- body to be expanded. These are used to expand references to private
+ -- data objects and discriminants, respectively.
Next_Op := Next_Protected_Operation (N);
@@ -6091,16 +6292,15 @@ package body Exp_Ch9 is
return;
end if;
- -- If this entry call is part of an asynchronous select, don't
- -- expand it here; it will be expanded with the select statement.
- -- Don't expand timed entry calls either, as they are translated
- -- into asynchronous entry calls.
+ -- If this entry call is part of an asynchronous select, don't expand it
+ -- here; it will be expanded with the select statement. Don't expand
+ -- timed entry calls either, as they are translated into asynchronous
+ -- entry calls.
- -- ??? This whole approach is questionable; it may be better
- -- to go back to allowing the expansion to take place and then
- -- attempting to fix it up in Expand_N_Asynchronous_Select.
- -- The tricky part is figuring out whether the expanded
- -- call is on a task or protected entry.
+ -- ??? This whole approach is questionable; it may be better to go back
+ -- to allowing the expansion to take place and then attempting to fix it
+ -- up in Expand_N_Asynchronous_Select. The tricky part is figuring out
+ -- whether the expanded call is on a task or protected entry.
if (Nkind (Parent (N)) /= N_Triggering_Alternative
or else N /= Triggering_Statement (Parent (N)))
@@ -6117,17 +6317,17 @@ package body Exp_Ch9 is
-- Expand_N_Entry_Declaration --
--------------------------------
- -- If there are parameters, then first, each of the formals is marked
- -- by setting Is_Entry_Formal. Next a record type is built which is
- -- used to hold the parameter values. The name of this record type is
- -- entryP where entry is the name of the entry, with an additional
- -- corresponding access type called entryPA. The record type has matching
- -- components for each formal (the component names are the same as the
- -- formal names). For elementary types, the component type matches the
- -- formal type. For composite types, an access type is declared (with
- -- the name formalA) which designates the formal type, and the type of
- -- the component is this access type. Finally the Entry_Component of
- -- each formal is set to reference the corresponding record component.
+ -- If there are parameters, then first, each of the formals is marked by
+ -- setting Is_Entry_Formal. Next a record type is built which is used to
+ -- hold the parameter values. The name of this record type is entryP where
+ -- entry is the name of the entry, with an additional corresponding access
+ -- type called entryPA. The record type has matching components for each
+ -- formal (the component names are the same as the formal names). For
+ -- elementary types, the component type matches the formal type. For
+ -- composite types, an access type is declared (with the name formalA)
+ -- which designates the formal type, and the type of the component is this
+ -- access type. Finally the Entry_Component of each formal is set to
+ -- reference the corresponding record component.
procedure Expand_N_Entry_Declaration (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
@@ -6231,11 +6431,11 @@ package body Exp_Ch9 is
-----------------------------
-- Protected bodies are expanded to the completion of the subprograms
- -- created for the corresponding protected type. These are a protected
- -- and unprotected version of each protected subprogram in the object,
- -- a function to calculate each entry barrier, and a procedure to
- -- execute the sequence of statements of each protected entry body.
- -- For example, for protected type ptype:
+ -- created for the corresponding protected type. These are a protected and
+ -- unprotected version of each protected subprogram in the object, a
+ -- function to calculate each entry barrier, and a procedure to execute the
+ -- sequence of statements of each protected entry body. For example, for
+ -- protected type ptype:
-- function entB
-- (O : System.Address;
@@ -6379,7 +6579,6 @@ package body Exp_Ch9 is
Actuals := New_List;
Formal := First (Parameter_Specifications (Spec));
-
while Present (Formal) loop
Append_To (Actuals,
Make_Identifier (Loc, Chars (Defining_Identifier (Formal))));
@@ -6581,10 +6780,9 @@ package body Exp_Ch9 is
Analyze (New_Op_Body);
end if;
- -- Ada 2005 (AI-345): Construct the primitive entry wrapper bodies
- -- after the protected body. At this point the entry specs have been
- -- created, frozen and included in the dispatch table for the
- -- protected type.
+ -- Ada 2005 (AI-345): Construct the primitive entry wrapper bodies after
+ -- the protected body. At this point the entry specs have been created,
+ -- frozen and included in the dispatch table for the protected type.
pragma Assert (Present (Corresponding_Record_Type (Pid)));
@@ -6600,10 +6798,10 @@ package body Exp_Ch9 is
Wrap_Body : Node_Id;
begin
- -- Examine the visible declarations of the protected type,
- -- looking for an entry declaration. We do not consider
- -- entry families since they can not have dispatching
- -- operations, thus they do not need entry wrappers.
+ -- Examine the visible declarations of the protected type, looking
+ -- for an entry declaration. We do not consider entry families
+ -- since they cannot have dispatching operations, thus they do not
+ -- need entry wrappers.
while Present (Vis_Decl) loop
if Nkind (Vis_Decl) = N_Entry_Declaration then
@@ -6658,57 +6856,55 @@ package body Exp_Ch9 is
-- <private data fields>
-- end record;
- -- The discriminants are present only if the corresponding protected
- -- type has discriminants, and they exactly mirror the protected type
- -- discriminants. The private data fields similarly mirror the
- -- private declarations of the protected type.
+ -- The discriminants are present only if the corresponding protected type
+ -- has discriminants, and they exactly mirror the protected type
+ -- discriminants. The private data fields similarly mirror the private
+ -- declarations of the protected type.
- -- The Object field is always present. It contains RTS specific data
- -- used to control the protected object. It is declared as Aliased
- -- so that it can be passed as a pointer to the RTS. This allows the
- -- protected record to be referenced within RTS data structures.
- -- An appropriate Protection type and discriminant are generated.
+ -- The Object field is always present. It contains RTS specific data used
+ -- to control the protected object. It is declared as Aliased so that it
+ -- can be passed as a pointer to the RTS. This allows the protected record
+ -- to be referenced within RTS data structures. An appropriate Protection
+ -- type and discriminant are generated.
-- The Service field is present for protected objects with entries. It
- -- contains sufficient information to allow the entry service procedure
- -- for this object to be called when the object is not known till runtime.
+ -- contains sufficient information to allow the entry service procedure for
+ -- this object to be called when the object is not known till runtime.
-- One entry_family component is present for each entry family in the
-- task definition (see Expand_N_Task_Type_Declaration).
-- When a protected object is declared, an instance of the protected type
- -- value record is created. The elaboration of this declaration creates
- -- the correct bounds for the entry families, and also evaluates the
- -- priority expression if needed. The initialization routine for
- -- the protected type itself then calls Initialize_Protection with
- -- appropriate parameters to initialize the value of the Task_Id field.
- -- Install_Handlers may be also called if a pragma Attach_Handler applies.
-
- -- Note: this record is passed to the subprograms created by the
- -- expansion of protected subprograms and entries. It is an in parameter
- -- to protected functions and an in out parameter to procedures and
- -- entry bodies. The Entity_Id for this created record type is placed
- -- in the Corresponding_Record_Type field of the associated protected
- -- type entity.
-
- -- Next we create a procedure specifications for protected subprograms
- -- and entry bodies. For each protected subprograms two subprograms are
- -- created, an unprotected and a protected version. The unprotected
- -- version is called from within other operations of the same protected
- -- object.
+ -- value record is created. The elaboration of this declaration creates the
+ -- correct bounds for the entry families, and also evaluates the priority
+ -- expression if needed. The initialization routine for the protected type
+ -- itself then calls Initialize_Protection with appropriate parameters to
+ -- initialize the value of the Task_Id field. Install_Handlers may be also
+ -- called if a pragma Attach_Handler applies.
+
+ -- Note: this record is passed to the subprograms created by the expansion
+ -- of protected subprograms and entries. It is an in parameter to protected
+ -- functions and an in out parameter to procedures and entry bodies. The
+ -- Entity_Id for this created record type is placed in the
+ -- Corresponding_Record_Type field of the associated protected type entity.
+
+ -- Next we create a procedure specifications for protected subprograms and
+ -- entry bodies. For each protected subprograms two subprograms are
+ -- created, an unprotected and a protected version. The unprotected version
+ -- is called from within other operations of the same protected object.
-- We also build the call to register the procedure if a pragma
-- Interrupt_Handler applies.
-- A single subprogram is created to service all entry bodies; it has an
- -- additional boolean out parameter indicating that the previous entry
- -- call made by the current task was serviced immediately, i.e. not by
- -- proxy. The O parameter contains a pointer to a record object of the
- -- type described above. An untyped interface is used here to allow this
+ -- additional boolean out parameter indicating that the previous entry call
+ -- made by the current task was serviced immediately, i.e. not by proxy.
+ -- The O parameter contains a pointer to a record object of the type
+ -- described above. An untyped interface is used here to allow this
-- procedure to be called in places where the type of the object to be
- -- serviced is not known. This must be done, for example, when a call
- -- that may have been requeued is cancelled; the corresponding object
- -- must be serviced, but which object that is not known till runtime.
+ -- serviced is not known. This must be done, for example, when a call that
+ -- may have been requeued is cancelled; the corresponding object must be
+ -- serviced, but which object that is not known till runtime.
-- procedure ptypeS
-- (O : System.Address; P : out Boolean);
@@ -6724,9 +6920,8 @@ package body Exp_Ch9 is
procedure Expand_N_Protected_Type_Declaration (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Prottyp : constant Entity_Id := Defining_Identifier (N);
- Protnm : constant Name_Id := Chars (Prottyp);
- Pdef : constant Node_Id := Protected_Definition (N);
+ Pdef : constant Node_Id := Protected_Definition (N);
-- This contains two lists; one for visible and one for private decls
Rec_Decl : Node_Id;
@@ -6748,7 +6943,7 @@ package body Exp_Ch9 is
Object_Comp : Node_Id;
procedure Register_Handler;
- -- for a protected operation that is an interrupt handler, add the
+ -- For a protected operation that is an interrupt handler, add the
-- freeze action that will register it as such.
----------------------
@@ -6803,7 +6998,8 @@ package body Exp_Ch9 is
-- corresponding record type must refer to the discriminants of that
-- record, so we must apply a new renaming to subtypes_indications:
- -- protected discriminant => discriminal => record discriminant.
+ -- protected discriminant => discriminal => record discriminant
+
-- This replacement is not applied to default expressions, for which
-- the discriminal is correct.
@@ -6811,11 +7007,9 @@ package body Exp_Ch9 is
declare
Disc : Entity_Id;
Decl : Node_Id;
-
begin
Disc := First_Discriminant (Prottyp);
Decl := First (Discriminant_Specifications (Rec_Decl));
-
while Present (Disc) loop
Append_Elmt (Discriminal (Disc), Discr_Map);
Append_Elmt (Defining_Identifier (Decl), Discr_Map);
@@ -6827,15 +7021,14 @@ package body Exp_Ch9 is
-- Fill in the component declarations
- -- Add components for entry families. For each entry family,
- -- create an anonymous type declaration with the same size, and
- -- analyze the type.
+ -- Add components for entry families. For each entry family, create an
+ -- anonymous type declaration with the same size, and analyze the type.
Collect_Entry_Families (Loc, Cdecls, Current_Node, Prottyp);
- -- Prepend the _Object field with the right type to the component
- -- list. We need to compute the number of entries, and in some cases
- -- the number of Attach_Handler pragmas.
+ -- Prepend the _Object field with the right type to the component list.
+ -- We need to compute the number of entries, and in some cases the
+ -- number of Attach_Handler pragmas.
declare
Ritem : Node_Id;
@@ -6892,8 +7085,7 @@ package body Exp_Ch9 is
Sloc => Loc,
Constraints => New_List (Entry_Count_Expr)));
- -- The type has explicit entries or generated primitive entry
- -- wrappers.
+ -- Type has explicit entries or generated primitive entry wrappers
elsif Has_Entries (Prottyp)
or else (Ada_Version >= Ada_05
@@ -7039,7 +7231,7 @@ package body Exp_Ch9 is
begin
-- Examine the visible declarations of the protected type, looking
-- for declarations of entries, and subprograms. We do not
- -- consider entry families since they can not have dispatching
+ -- consider entry families since they cannot have dispatching
-- operations, thus they do not need entry wrappers.
Vis_Decl := First (Visible_Declarations (Pdef));
@@ -7096,12 +7288,12 @@ package body Exp_Ch9 is
Entries_Aggr := Empty;
end if;
- -- Build two new procedure specifications for each protected
- -- subprogram; one to call from outside the object and one to
- -- call from inside. Build a barrier function and an entry
- -- body action procedure specification for each protected entry.
- -- Initialize the entry body array. If subprogram is flagged as
- -- eliminated, do not generate any internal operations.
+ -- Build two new procedure specifications for each protected subprogram;
+ -- one to call from outside the object and one to call from inside.
+ -- Build a barrier function and an entry body action procedure
+ -- specification for each protected entry. Initialize the entry body
+ -- array. If subprogram is flagged as eliminated, do not generate any
+ -- internal operations.
E_Count := 0;
@@ -7124,8 +7316,8 @@ package body Exp_Ch9 is
(Defining_Unit_Name (Specification (Comp)),
Defining_Unit_Name (Specification (Sub)));
- -- Make the protected version of the subprogram available
- -- for expansion of external calls.
+ -- Make the protected version of the subprogram available for
+ -- expansion of external calls.
Current_Node := Sub;
@@ -7160,9 +7352,10 @@ package body Exp_Ch9 is
Current_Node := Sub;
end if;
- -- If a pragma Interrupt_Handler applies, build and add
- -- a call to Register_Interrupt_Handler to the freezing actions
- -- of the protected version (Current_Node) of the subprogram:
+ -- If a pragma Interrupt_Handler applies, build and add a call to
+ -- Register_Interrupt_Handler to the freezing actions of the
+ -- protected version (Current_Node) of the subprogram:
+
-- system.interrupts.register_interrupt_handler
-- (prot_procP'address);
@@ -7179,10 +7372,7 @@ package body Exp_Ch9 is
Set_Privals_Chain (Comp_Id, New_Elmt_List);
Edef :=
Make_Defining_Identifier (Loc,
- Build_Selected_Name
- (Protnm,
- New_External_Name (Chars (Comp_Id), Suffix_Index => -1),
- 'E'));
+ Build_Selected_Name (Prottyp, Comp_Id, 'E'));
Sub :=
Make_Subprogram_Declaration (Loc,
Specification =>
@@ -7199,10 +7389,7 @@ package body Exp_Ch9 is
Bdef :=
Make_Defining_Identifier (Loc,
- Build_Selected_Name
- (Protnm,
- New_External_Name (Chars (Comp_Id), Suffix_Index => -1),
- 'B'));
+ Build_Selected_Name (Prottyp, Comp_Id, 'B'));
Sub :=
Make_Subprogram_Declaration (Loc,
Specification =>
@@ -7246,10 +7433,7 @@ package body Exp_Ch9 is
Set_Privals_Chain (Comp_Id, New_Elmt_List);
Edef :=
Make_Defining_Identifier (Loc,
- Build_Selected_Name
- (Protnm,
- New_External_Name (Chars (Comp_Id), Suffix_Index => -1),
- 'E'));
+ Build_Selected_Name (Prottyp, Comp_Id, 'E'));
Sub :=
Make_Subprogram_Declaration (Loc,
@@ -7267,10 +7451,8 @@ package body Exp_Ch9 is
Bdef :=
Make_Defining_Identifier (Loc,
- Build_Selected_Name
- (Protnm,
- New_External_Name (Chars (Comp_Id), Suffix_Index => -1),
- 'B'));
+ Build_Selected_Name (Prottyp, Comp_Id, 'E'));
+
Sub :=
Make_Subprogram_Declaration (Loc,
Specification =>
@@ -7283,9 +7465,8 @@ package body Exp_Ch9 is
Set_Scope (Bdef, Scope (Comp_Id));
Current_Node := Sub;
- -- Collect pointers to the protected subprogram and the
- -- barrier of the current entry, for insertion into
- -- Entry_Bodies_Array.
+ -- Collect pointers to the protected subprogram and the barrier
+ -- of the current entry, for insertion into Entry_Bodies_Array.
Append (
Make_Aggregate (Loc,
@@ -7345,9 +7526,8 @@ package body Exp_Ch9 is
Attribute_Name => Name_Unrestricted_Access))));
end if;
- -- A pointer to this array will be placed in the corresponding
- -- record by its initialization procedure, so this needs to be
- -- analyzed here.
+ -- A pointer to this array will be placed in the corresponding record
+ -- by its initialization procedure so this needs to be analyzed here.
Insert_After (Current_Node, Body_Arr);
Current_Node := Body_Arr;
@@ -7378,11 +7558,11 @@ package body Exp_Ch9 is
--------------------------------
-- A requeue statement is expanded into one of four GNARLI operations,
- -- depending on the source and destination (task or protected object).
- -- In addition, code must be generated to jump around the remainder of
- -- processing for the original entry and, if the destination is a
- -- (different) protected object, to attempt to service it.
- -- The following illustrates the various cases:
+ -- depending on the source and destination (task or protected object). In
+ -- addition, code must be generated to jump around the remainder of
+ -- processing for the original entry and, if the destination is (different)
+ -- protected object, to attempt to service it. The following illustrates
+ -- the various cases:
-- procedure entE
-- (O : System.Address;
@@ -7539,8 +7719,8 @@ package body Exp_Ch9 is
Prepend (Self_Param, Params);
exit;
- -- If neither task type or protected type, must be in some
- -- inner enclosing block, so move on out
+ -- If neither task type or protected type, must be in some inner
+ -- enclosing block, so move on out
else
Oldtyp := Scope (Oldtyp);
@@ -7573,8 +7753,8 @@ package body Exp_Ch9 is
end loop;
-- The last statement is the second label, used for completing the
- -- rendezvous the usual way.
- -- The label we are looking for is right before it.
+ -- rendezvous the usual way. The label we are looking for is right
+ -- before it.
Lab_Node :=
Prev (Last (Statements (Handled_Statement_Sequence (Acc_Stat))));
@@ -7825,9 +8005,9 @@ package body Exp_Ch9 is
-- During the analysis of the body of the accept statement, any
-- zero cost exception handler records were collected in the
- -- Accept_Handler_Records field of the N_Accept_Alternative
- -- node. This is where we move them to where they belong,
- -- namely the newly created procedure.
+ -- Accept_Handler_Records field of the N_Accept_Alternative node.
+ -- This is where we move them to where they belong, namely the
+ -- newly created procedure.
Set_Handler_Records (PB_Ent, Accept_Handler_Records (Alt));
Append (Proc_Body, Body_List);
@@ -7835,8 +8015,8 @@ package body Exp_Ch9 is
else
Null_Body := New_Reference_To (Standard_True, Loc);
- -- if accept statement has declarations, insert above, given
- -- that we are not creating a body for the accept.
+ -- if accept statement has declarations, insert above, given that
+ -- we are not creating a body for the accept.
if Present (Declarations (Acc_Stm)) then
Insert_Actions (N, Declarations (Acc_Stm));
@@ -7931,9 +8111,9 @@ package body Exp_Ch9 is
Alt_Stats := New_List;
end if;
- -- After the call, if any, branch to to trailing statements.
- -- We create a label for each, as well as the corresponding
- -- label declaration.
+ -- After the call, if any, branch to to trailing statements. We
+ -- create a label for each, as well as the corresponding label
+ -- declaration.
Lab := Make_And_Declare_Label (Index);
Append_To (Alt_Stats,
@@ -8067,8 +8247,8 @@ package body Exp_Ch9 is
Append_List (Delay_Alt, Delay_List);
- -- If the delay alternative has a statement part, add a
- -- choice to the case statements for delays.
+ -- If the delay alternative has a statement part, add choice to the
+ -- case statements for delays.
if Present (Statements (Alt)) then
@@ -8437,14 +8617,12 @@ package body Exp_Ch9 is
Discrete_Choices => Choices,
Statements => Alt_Stats));
- -- We make use of the fact that Accept_Index is an integer type,
- -- and generate successive literals for entries for each accept.
- -- Only those for which there is a body or trailing statements are
- -- given a case entry.
+ -- We make use of the fact that Accept_Index is an integer type, and
+ -- generate successive literals for entries for each accept. Only those
+ -- for which there is a body or trailing statements get a case entry.
Alt := First (Select_Alternatives (N));
Proc := First (Body_List);
-
while Present (Alt) loop
if Nkind (Alt) = N_Accept_Alternative then
@@ -8587,8 +8765,8 @@ package body Exp_Ch9 is
Name => New_Reference_To (RTE (RE_Timed_Selective_Wait), Loc),
Parameter_Associations => Parms));
- -- This new call should follow the calculation of the
- -- minimum delay.
+ -- This new call should follow the calculation of the minimum
+ -- delay.
Insert_List_Before (Select_Call, Delay_List);
@@ -8652,9 +8830,9 @@ package body Exp_Ch9 is
--------------------------------------
-- Single task declarations should never be present after semantic
- -- analysis, since we expect them to be replaced by a declaration of
- -- an anonymous task type, followed by a declaration of the task
- -- object. We include this routine to make sure that is happening!
+ -- analysis, since we expect them to be replaced by a declaration of an
+ -- anonymous task type, followed by a declaration of the task object. We
+ -- include this routine to make sure that is happening!
procedure Expand_N_Single_Task_Declaration (N : Node_Id) is
begin
@@ -8699,16 +8877,16 @@ package body Exp_Ch9 is
-- tnameE := True;
- -- In addition, if the task body is an activator, then a call to
- -- activate tasks is added at the start of the statements, before
- -- the call to Complete_Activation, and if in addition the task is
- -- a master then it must be established as a master. These calls are
- -- inserted and analyzed in Expand_Cleanup_Actions, when the
- -- Handled_Sequence_Of_Statements is expanded.
+ -- In addition, if the task body is an activator, then a call to activate
+ -- tasks is added at the start of the statements, before the call to
+ -- Complete_Activation, and if in addition the task is a master then it
+ -- must be established as a master. These calls are inserted and analyzed
+ -- in Expand_Cleanup_Actions, when the Handled_Sequence_Of_Statements is
+ -- expanded.
-- There is one discriminal declaration line generated for each
- -- discriminant that is present to provide an easy reference point
- -- for discriminant references inside the body (see Exp_Ch2.Expand_Name).
+ -- discriminant that is present to provide an easy reference point for
+ -- discriminant references inside the body (see Exp_Ch2.Expand_Name).
-- Note on relationship to GNARLI definition. In the GNARLI definition,
-- task body procedures have a profile (Arg : System.Address). That is
@@ -8777,9 +8955,8 @@ package body Exp_Ch9 is
Rewrite (N, New_N);
Analyze (N);
- -- Set elaboration flag immediately after task body. If the body
- -- is a subunit, the flag is set in the declarative part that
- -- contains the stub.
+ -- Set elaboration flag immediately after task body. If the body is a
+ -- subunit, the flag is set in the declarative part containing the stub.
if Nkind (Parent (N)) /= N_Subunit then
Insert_After (N,
@@ -8789,10 +8966,9 @@ package body Exp_Ch9 is
Expression => New_Reference_To (Standard_True, Loc)));
end if;
- -- Ada 2005 (AI-345): Construct the primitive entry wrapper bodies
- -- after the task body. At this point the entry specs have been
- -- created, frozen and included in the dispatch table for the task
- -- type.
+ -- Ada 2005 (AI-345): Construct the primitive entry wrapper bodies after
+ -- the task body. At this point the entry specs have been created,
+ -- frozen and included in the dispatch table for the task type.
pragma Assert (Present (Corresponding_Record_Type (Ttyp)));
@@ -8814,10 +8990,10 @@ package body Exp_Ch9 is
Current_Node := N;
end if;
- -- Examine the visible declarations of the task type,
- -- looking for an entry declaration. We do not consider
- -- entry families since they can not have dispatching
- -- operations, thus they do not need entry wrappers.
+ -- Examine the visible declarations of the task type, looking for
+ -- an entry declaration. We do not consider entry families since
+ -- they cannot have dispatching operations, thus they do not need
+ -- entry wrappers.
while Present (Vis_Decl) loop
if Nkind (Vis_Decl) = N_Entry_Declaration
@@ -8858,8 +9034,8 @@ package body Exp_Ch9 is
-- taskE : aliased Boolean := False;
- -- Next a variable is declared to hold the task stack size (either
- -- the default : Unspecified_Size, or a value that is set by a pragma
+ -- Next a variable is declared to hold the task stack size (either the
+ -- default : Unspecified_Size, or a value that is set by a pragma
-- Storage_Size). If the value of the pragma Storage_Size is static, then
-- the variable is initialized with this value:
@@ -8881,28 +9057,28 @@ package body Exp_Ch9 is
-- The discriminants are present only if the corresponding task type has
-- discriminants, and they exactly mirror the task type discriminants.
- -- The Id field is always present. It contains the Task_Id value, as
- -- set by the call to Create_Task. Note that although the task is
- -- limited, the task value record type is not limited, so there is no
- -- problem in passing this field as an out parameter to Create_Task.
+ -- The Id field is always present. It contains the Task_Id value, as set by
+ -- the call to Create_Task. Note that although the task is limited, the
+ -- task value record type is not limited, so there is no problem in passing
+ -- this field as an out parameter to Create_Task.
- -- One entry_family component is present for each entry family in the
- -- task definition. The bounds correspond to the bounds of the entry
- -- family (which may depend on discriminants). The element type is
- -- void, since we only need the bounds information for determining
- -- the entry index. Note that the use of an anonymous array would
- -- normally be illegal in this context, but this is a parser check,
- -- and the semantics is quite prepared to handle such a case.
-
- -- The _Size field is present only if a Storage_Size pragma appears in
- -- the task definition. The expression captures the argument that was
- -- present in the pragma, and is used to override the task stack size
- -- otherwise associated with the task type.
+ -- One entry_family component is present for each entry family in the task
+ -- definition. The bounds correspond to the bounds of the entry family
+ -- (which may depend on discriminants). The element type is void, since we
+ -- only need the bounds information for determining the entry index. Note
+ -- that the use of an anonymous array would normally be illegal in this
+ -- context, but this is a parser check, and the semantics is quite prepared
+ -- to handle such a case.
+
+ -- The _Size field is present only if a Storage_Size pragma appears in the
+ -- task definition. The expression captures the argument that was present
+ -- in the pragma, and is used to override the task stack size otherwise
+ -- associated with the task type.
-- The _Priority field is present only if a Priority or Interrupt_Priority
-- pragma appears in the task definition. The expression captures the
- -- argument that was present in the pragma, and is used to provide
- -- the Size parameter to the call to Create_Task.
+ -- argument that was present in the pragma, and is used to provide the Size
+ -- parameter to the call to Create_Task.
-- The _Task_Info field is present only if a Task_Info pragma appears in
-- the task definition. The expression captures the argument that was
@@ -8910,18 +9086,18 @@ package body Exp_Ch9 is
-- to the call to Create_Task.
-- When a task is declared, an instance of the task value record is
- -- created. The elaboration of this declaration creates the correct
- -- bounds for the entry families, and also evaluates the size, priority,
- -- and task_Info expressions if needed. The initialization routine for
- -- the task type itself then calls Create_Task with appropriate
- -- parameters to initialize the value of the Task_Id field.
+ -- created. The elaboration of this declaration creates the correct bounds
+ -- for the entry families, and also evaluates the size, priority, and
+ -- task_Info expressions if needed. The initialization routine for the task
+ -- type itself then calls Create_Task with appropriate parameters to
+ -- initialize the value of the Task_Id field.
-- Note: the address of this record is passed as the "Discriminants"
- -- parameter for Create_Task. Since Create_Task merely passes this onto
- -- the body procedure, it does not matter that it does not quite match
- -- the GNARLI model of what is being passed (the record contains more
- -- than just the discriminants, but the discriminants can be found from
- -- the record value).
+ -- parameter for Create_Task. Since Create_Task merely passes this onto the
+ -- body procedure, it does not matter that it does not quite match the
+ -- GNARLI model of what is being passed (the record contains more than just
+ -- the discriminants, but the discriminants can be found from the record
+ -- value).
-- The Entity_Id for this created record type is placed in the
-- Corresponding_Record_Type field of the associated task type entity.
@@ -9023,9 +9199,9 @@ package body Exp_Ch9 is
Insert_After (Elab_Decl, Size_Decl);
- -- Next build the rest of the corresponding record declaration.
- -- This is done last, since the corresponding record initialization
- -- procedure will reference the previously created entities.
+ -- Next build the rest of the corresponding record declaration. This is
+ -- done last, since the corresponding record initialization procedure
+ -- will reference the previously created entities.
-- Fill in the component declarations -- first the _Task_Id field
@@ -9039,8 +9215,8 @@ package body Exp_Ch9 is
Subtype_Indication => New_Reference_To (RTE (RO_ST_Task_Id),
Loc))));
- -- Declare static ATCB (that is, created by the expander) if we
- -- are using the Restricted run time.
+ -- Declare static ATCB (that is, created by the expander) if we are
+ -- using the Restricted run time.
if Restricted_Profile then
Append_To (Cdecls,
@@ -9062,8 +9238,8 @@ package body Exp_Ch9 is
end if;
- -- Declare static stack (that is, created by the expander) if we
- -- are using the Restricted run time on a bare board configuration.
+ -- Declare static stack (that is, created by the expander) if we are
+ -- using the Restricted run time on a bare board configuration.
if Restricted_Profile
and then Preallocated_Stacks_On_Target
@@ -9102,8 +9278,8 @@ package body Exp_Ch9 is
Append_To (Cdecls, Decl_Stack);
- -- The appropriate alignment for the stack is ensured by the
- -- run-time code in charge of task creation.
+ -- The appropriate alignment for the stack is ensured by the run-time
+ -- code in charge of task creation.
end if;
@@ -9218,14 +9394,14 @@ package body Exp_Ch9 is
Insert_After (Rec_Decl, Body_Decl);
- -- The subprogram does not comes from source, so we have to indicate
- -- the need for debugging information explicitly.
+ -- The subprogram does not comes from source, so we have to indicate the
+ -- need for debugging information explicitly.
Set_Needs_Debug_Info
(Defining_Entity (Proc_Spec), Comes_From_Source (Original_Node (N)));
- -- Ada 2005 (AI-345): Construct the primitive entry wrapper specs
- -- before the corresponding record has been frozen.
+ -- Ada 2005 (AI-345): Construct the primitive entry wrapper specs before
+ -- the corresponding record has been frozen.
if Ada_Version >= Ada_05
and then Present (Taskdef)
@@ -9242,10 +9418,10 @@ package body Exp_Ch9 is
New_N : Node_Id;
begin
- -- Examine the visible declarations of the task type,
- -- looking for an entry declaration. We do not consider
- -- entry families since they can not have dispatching
- -- operations, thus they do not need entry wrappers.
+ -- Examine the visible declarations of the task type, looking for
+ -- an entry declaration. We do not consider entry families since
+ -- they cannot have dispatching operations, thus they do not need
+ -- entry wrappers.
while Present (Vis_Decl) loop
if Nkind (Vis_Decl) = N_Entry_Declaration
@@ -9295,8 +9471,8 @@ package body Exp_Ch9 is
end;
end if;
- -- Complete the expansion of access types to the current task
- -- type, if any were declared.
+ -- Complete the expansion of access types to the current task type, if
+ -- any were declared.
Expand_Previous_Access_Type (Tasktyp);
end Expand_N_Task_Type_Declaration;
@@ -9305,8 +9481,8 @@ package body Exp_Ch9 is
-- Expand_N_Timed_Entry_Call --
-------------------------------
- -- A timed entry call in normal case is not implemented using ATC
- -- mechanism anymore for efficiency reason.
+ -- A timed entry call in normal case is not implemented using ATC mechanism
+ -- anymore for efficiency reason.
-- select
-- T.E;
@@ -9421,12 +9597,13 @@ package body Exp_Ch9 is
Params : List_Id;
Stmt : Node_Id;
Stmts : List_Id;
+ Unpack : List_Id;
B : Entity_Id; -- Call status flag
C : Entity_Id; -- Call kind
D : Entity_Id; -- Delay
M : Entity_Id; -- Delay mode
- P : Node_Id; -- Parameter block
+ P : Entity_Id; -- Parameter block
S : Entity_Id; -- Primitive operation slot
begin
@@ -9576,9 +9753,11 @@ package body Exp_Ch9 is
-- Dispatch table slot processing, generate:
-- S : constant Integer :=
- -- DT_Prosition (<dispatching-procedure>)
+ -- Ada.Tags.Get_Offset_Index (
+ -- Unchecked_Convert_To (Ada.Tags.Interface_Tag, Obj),
+ -- DT_Position (<dispatching-procedure>));
- S := SEU.Build_S (Loc, Decls, Call_Ent);
+ S := SEU.Build_S (Loc, Decls, Obj, Call_Ent);
-- Generate:
-- _dispatching_timed_select (Obj, S, P'address, D, M, C, B);
@@ -9592,7 +9771,9 @@ package body Exp_Ch9 is
Append_To (Params, New_Copy_Tree (Obj));
Append_To (Params, New_Reference_To (S, Loc));
- Append_To (Params, P);
+ Append_To (Params, Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (P, Loc),
+ Attribute_Name => Name_Address));
Append_To (Params, New_Reference_To (D, Loc));
Append_To (Params, New_Reference_To (M, Loc));
Append_To (Params, New_Reference_To (C, Loc));
@@ -9601,7 +9782,10 @@ package body Exp_Ch9 is
Append_To (Stmts,
Make_Procedure_Call_Statement (Loc,
Name =>
- Make_Identifier (Loc, Name_uDisp_Timed_Select),
+ New_Reference_To (
+ Find_Prim_Op (Etype (Etype (Obj)),
+ Name_uDisp_Timed_Select),
+ Loc),
Parameter_Associations =>
Params));
@@ -9614,28 +9798,36 @@ package body Exp_Ch9 is
-- ParamN := P.ParamN;
-- end if;
- Append_To (Stmts,
- Make_If_Statement (Loc,
+ Unpack := Parameter_Block_Unpack (Loc, P, Actuals, Formals);
- Condition =>
- Make_Or_Else (Loc,
- Left_Opnd =>
- Make_Op_Eq (Loc,
- Left_Opnd =>
- New_Reference_To (C, Loc),
- Right_Opnd =>
- New_Reference_To (RTE (RE_POK_Protected_Entry), Loc)),
- Right_Opnd =>
- Make_Op_Eq (Loc,
- Left_Opnd =>
- New_Reference_To (C, Loc),
- Right_Opnd =>
- New_Reference_To (RTE (RE_POK_Task_Entry), Loc))),
+ -- Generate the if statement only when the packed parameters need
+ -- explicit assignments to their corresponding actuals.
- Then_Statements =>
- Parameter_Block_Unpack (Loc, Actuals, Formals)));
+ if Present (Unpack) then
+ Append_To (Stmts,
+ Make_If_Statement (Loc,
+
+ Condition =>
+ Make_Or_Else (Loc,
+ Left_Opnd =>
+ Make_Op_Eq (Loc,
+ Left_Opnd =>
+ New_Reference_To (C, Loc),
+ Right_Opnd =>
+ New_Reference_To (RTE (
+ RE_POK_Protected_Entry), Loc)),
+ Right_Opnd =>
+ Make_Op_Eq (Loc,
+ Left_Opnd =>
+ New_Reference_To (C, Loc),
+ Right_Opnd =>
+ New_Reference_To (RTE (RE_POK_Task_Entry), Loc))),
+
+ Then_Statements => Unpack));
+ end if;
-- Generate:
+
-- if B then
-- if C = POK_Procedure
-- or else C = POK_Protected_Procedure
@@ -9648,7 +9840,7 @@ package body Exp_Ch9 is
-- <delay-statements>
-- end if;
- N_Stats := New_Copy_List (E_Stats);
+ N_Stats := New_Copy_List_Tree (E_Stats);
Prepend_To (N_Stats,
Make_If_Statement (Loc,
@@ -9802,18 +9994,18 @@ package body Exp_Ch9 is
-- Expand_Protected_Body_Declarations --
----------------------------------------
- -- Part of the expansion of a protected body involves the creation of
- -- a declaration that can be referenced from the statement sequences of
- -- the entry bodies:
+ -- Part of the expansion of a protected body involves the creation of a
+ -- declaration that can be referenced from the statement sequences of the
+ -- entry bodies:
-- A : Address;
- -- This declaration is inserted in the declarations of the service
- -- entries procedure for the protected body, and it is important that
- -- it be inserted before the statements of the entry body statement
- -- sequences are analyzed. Thus it would be too late to create this
- -- declaration in the Expand_N_Protected_Body routine, which is why
- -- there is a separate procedure to be called directly from Sem_Ch9.
+ -- This declaration is inserted in the declarations of the service entries
+ -- procedure for the protected body, and it is important that it be
+ -- inserted before the statements of the entry body statement sequences are
+ -- analyzed. Thus it would be too late to create this declaration in the
+ -- Expand_N_Protected_Body routine, which is why there is a separate
+ -- procedure to be called directly from Sem_Ch9.
-- Ann is used to hold the address of the record containing the parameters
-- (see Expand_N_Entry_Call for more details on how this record is built).
@@ -9824,14 +10016,14 @@ package body Exp_Ch9 is
-- Accept_Address stack in the corresponding entry entity, and this element
-- must be set in place before the statements are processed.
- -- No stack is needed for entry bodies, since they cannot be nested, but
- -- it is kept for consistency between protected and task entries. The
- -- stack will never contain more than one element. There is also only one
- -- such variable for a given protected body, but this is placed on the
+ -- No stack is needed for entry bodies, since they cannot be nested, but it
+ -- is kept for consistency between protected and task entries. The stack
+ -- will never contain more than one element. There is also only one such
+ -- variable for a given protected body, but this is placed on the
-- Accept_Address stack of all of the entries, again for consistency.
- -- To expand the requeue statement, a label is provided at the end of
- -- the loop in the entry service routine created by the expander (see
+ -- To expand the requeue statement, a label is provided at the end of the
+ -- loop in the entry service routine created by the expander (see
-- Expand_N_Protected_Body for details), so that the statement can be
-- skipped after the requeue is complete. This label is created during the
-- expansion of the entry body, which will take place after the expansion
@@ -9859,9 +10051,9 @@ package body Exp_Ch9 is
elsif Expander_Active then
- -- Associate privals with the first subprogram or entry
- -- body to be expanded. These are used to expand references
- -- to private data objects.
+ -- Associate privals with the first subprogram or entry body to be
+ -- expanded. These are used to expand references to private data
+ -- objects.
Op := First_Protected_Operation (Declarations (N));
@@ -9991,12 +10183,11 @@ package body Exp_Ch9 is
Ttyp : Entity_Id) return Node_Id
is
function Convert_Discriminant_Ref (Bound : Node_Id) return Node_Id;
- -- If one of the bounds is a reference to a discriminant, replace
- -- with corresponding discriminal of type. Within the body of a task
- -- retrieve the renamed discriminant by simple visibility, using its
- -- generated name. Within a protected object, find the original dis-
- -- criminant and replace it with the discriminal of the current prot-
- -- ected operation.
+ -- If one of the bounds is a reference to a discriminant, replace with
+ -- corresponding discriminal of type. Within the body of a task retrieve
+ -- the renamed discriminant by simple visibility, using its generated
+ -- name. Within a protected object, find the original dis- criminant and
+ -- replace it with the discriminal of the current prot- ected operation.
------------------------------
-- Convert_Discriminant_Ref --
@@ -10019,7 +10210,6 @@ package body Exp_Ch9 is
elsif Is_Protected_Type (Ttyp) then
D := First_Discriminant (Ttyp);
-
while Chars (D) /= Chars (Entity (Bound)) loop
Next_Discriminant (D);
end loop;
@@ -10097,7 +10287,6 @@ package body Exp_Ch9 is
begin
N := First (Visible_Declarations (T));
-
while Present (N) loop
if Nkind (N) = N_Pragma then
if Chars (N) = P then
@@ -10118,7 +10307,6 @@ package body Exp_Ch9 is
end loop;
N := First (Private_Declarations (T));
-
while Present (N) loop
if Nkind (N) = N_Pragma then
if Chars (N) = P then
@@ -10178,10 +10366,9 @@ package body Exp_Ch9 is
Lo : Node_Id := Type_Low_Bound (Etype (Index_Id));
function Replace_Discriminant (Bound : Node_Id) return Node_Id;
- -- The bounds of the entry index may depend on discriminants, so
- -- each declaration of an entry_index_constant must have its own
- -- subtype declaration, using the local renaming of the object discri-
- -- minant.
+ -- The bounds of the entry index may depend on discriminants, so each
+ -- declaration of an entry_index_constant must have its own subtype
+ -- declaration, using the local renaming of the object discriminant.
--------------------------
-- Replace_Discriminant --
@@ -10285,22 +10472,20 @@ package body Exp_Ch9 is
Restricted : constant Boolean := Restricted_Profile;
begin
- -- We may need two calls to properly initialize the object, one
- -- to Initialize_Protection, and possibly one to Install_Handlers
- -- if we have a pragma Attach_Handler.
+ -- We may need two calls to properly initialize the object, one to
+ -- Initialize_Protection, and possibly one to Install_Handlers if we
+ -- have a pragma Attach_Handler.
-- Get protected declaration. In the case of a task type declaration,
- -- this is simply the parent of the protected type entity.
- -- In the single protected object
- -- declaration, this parent will be the implicit type, and we can find
- -- the corresponding single protected object declaration by
- -- searching forward in the declaration list in the tree.
- -- ??? I am not sure that the test for N_Single_Protected_Declaration
- -- is needed here. Nodes of this type should have been removed
- -- during semantic analysis.
+ -- this is simply the parent of the protected type entity. In the single
+ -- protected object declaration, this parent will be the implicit type,
+ -- and we can find the corresponding single protected object declaration
+ -- by searching forward in the declaration list in the tree.
- Pdec := Parent (Ptyp);
+ -- Is the test for N_Single_Protected_Declaration needed here??? Nodes
+ -- of this type should have been removed during semantic analysis.
+ Pdec := Parent (Ptyp);
while Nkind (Pdec) /= N_Protected_Type_Declaration
and then Nkind (Pdec) /= N_Single_Protected_Declaration
loop
@@ -10378,10 +10563,11 @@ package body Exp_Ch9 is
end if;
if Has_Entry then
+
-- Entry_Bodies parameter. This is a pointer to an array of
- -- pointers to the entry body procedures and barrier functions
- -- of the object. If the protected type has no entries this
- -- object will not exist; in this case, pass a null.
+ -- pointers to the entry body procedures and barrier functions of
+ -- the object. If the protected type has no entries this object
+ -- will not exist; in this case, pass a null.
P_Arr := Entry_Bodies_Array (Ptyp);
@@ -10446,11 +10632,14 @@ package body Exp_Ch9 is
if Has_Attach_Handler (Ptyp) then
- -- We have a list of N Attach_Handler (ProcI, ExprI),
- -- and we have to make the following call:
+ -- We have a list of N Attach_Handler (ProcI, ExprI), and we have to
+ -- make the following call:
+
-- Install_Handlers (_object,
-- ((Expr1, Proc1'access), ...., (ExprN, ProcN'access));
+
-- or, in the case of Ravenscar:
+
-- Install_Handlers
-- ((Expr1, Proc1'access), ...., (ExprN, ProcN'access));
@@ -10461,6 +10650,7 @@ package body Exp_Ch9 is
begin
if not Restricted then
+
-- Appends the _object argument
Append_To (Args,
@@ -10536,17 +10726,16 @@ package body Exp_Ch9 is
Ttyp := Corresponding_Concurrent_Type (Task_Rec);
Tnam := Chars (Ttyp);
- -- Get task declaration. In the case of a task type declaration, this
- -- is simply the parent of the task type entity. In the single task
+ -- Get task declaration. In the case of a task type declaration, this is
+ -- simply the parent of the task type entity. In the single task
-- declaration, this parent will be the implicit type, and we can find
- -- the corresponding single task declaration by searching forward in
- -- the declaration list in the tree.
- -- ??? I am not sure that the test for N_Single_Task_Declaration
- -- is needed here. Nodes of this type should have been removed
- -- during semantic analysis.
+ -- the corresponding single task declaration by searching forward in the
+ -- declaration list in the tree.
- Tdec := Parent (Ttyp);
+ -- Is the test for N_Single_Task_Declaration needed here??? Nodes of
+ -- this type should have been removed during semantic analysis.
+ Tdec := Parent (Ttyp);
while Nkind (Tdec) /= N_Task_Type_Declaration
and then Nkind (Tdec) /= N_Single_Task_Declaration
loop
@@ -10741,7 +10930,6 @@ package body Exp_Ch9 is
begin
Next_Op := Next (N);
-
while Present (Next_Op)
and then Nkind (Next_Op) /= N_Subprogram_Body
and then Nkind (Next_Op) /= N_Entry_Body
@@ -10764,12 +10952,14 @@ package body Exp_Ch9 is
Decls : List_Id;
Stmts : List_Id) return Node_Id
is
- Actual : Entity_Id;
- Blk_Nam : Node_Id;
- Formal : Entity_Id;
- Params : List_Id;
- Temp_Asn : Node_Id;
- Temp_Nam : Node_Id;
+ Actual : Entity_Id;
+ Expr : Node_Id := Empty;
+ Formal : Entity_Id;
+ Has_Param : Boolean := False;
+ P : Entity_Id;
+ Params : List_Id;
+ Temp_Asn : Node_Id;
+ Temp_Nam : Node_Id;
begin
Actual := First (Actuals);
@@ -10820,41 +11010,46 @@ package body Exp_Ch9 is
Name_Unchecked_Access,
Prefix =>
New_Reference_To (Temp_Nam, Loc)));
+
+ Has_Param := True;
+
+ -- The controlling parameter is omitted
+
else
- Append_To (Params,
- Make_Reference (Loc, New_Copy_Tree (Actual)));
+ if not Is_Controlling_Actual (Actual) then
+ Append_To (Params,
+ Make_Reference (Loc, New_Copy_Tree (Actual)));
+
+ Has_Param := True;
+ end if;
end if;
Next_Actual (Actual);
Next_Formal_With_Extras (Formal);
end loop;
+ if Has_Param then
+ Expr := Make_Aggregate (Loc, Params);
+ end if;
+
-- Generate:
-- P : Ann := (
-- J1'unchecked_access;
-- <actual2>'reference;
-- ...);
- Blk_Nam := Make_Defining_Identifier (Loc, Name_uP);
+ P := Make_Defining_Identifier (Loc, New_Internal_Name ('P'));
Append_To (Decls,
Make_Object_Declaration (Loc,
Defining_Identifier =>
- Blk_Nam,
+ P,
Object_Definition =>
New_Reference_To (Blk_Typ, Loc),
Expression =>
- Make_Aggregate (Loc, Params)));
-
- -- Return:
- -- P'address
+ Expr));
- return
- Make_Attribute_Reference (Loc,
- Attribute_Name =>
- Name_Address,
- Prefix =>
- New_Reference_To (Blk_Nam, Loc));
+ return P;
end Parameter_Block_Pack;
----------------------------
@@ -10863,26 +11058,23 @@ package body Exp_Ch9 is
function Parameter_Block_Unpack
(Loc : Source_Ptr;
+ P : Entity_Id;
Actuals : List_Id;
Formals : List_Id) return List_Id
is
- Actual : Entity_Id;
- Asnmt : Node_Id;
- Formal : Entity_Id;
- Result : constant List_Id := New_List;
-
- At_Least_One_Asnmt : Boolean := False;
+ Actual : Entity_Id;
+ Asnmt : Node_Id;
+ Formal : Entity_Id;
+ Has_Asnmt : Boolean := False;
+ Result : constant List_Id := New_List;
begin
Actual := First (Actuals);
Formal := Defining_Identifier (First (Formals));
-
while Present (Actual) loop
if Is_By_Copy_Type (Etype (Actual))
and then Ekind (Formal) /= E_In_Parameter
then
- At_Least_One_Asnmt := True;
-
-- Generate:
-- <actual> := P.<formal>;
@@ -10894,24 +11086,25 @@ package body Exp_Ch9 is
Make_Explicit_Dereference (Loc,
Make_Selected_Component (Loc,
Prefix =>
- Make_Identifier (Loc, Name_uP),
+ New_Reference_To (P, Loc),
Selector_Name =>
Make_Identifier (Loc, Chars (Formal)))));
Set_Assignment_OK (Name (Asnmt));
-
Append_To (Result, Asnmt);
+
+ Has_Asnmt := True;
end if;
Next_Actual (Actual);
Next_Formal_With_Extras (Formal);
end loop;
- if At_Least_One_Asnmt then
+ if Has_Asnmt then
return Result;
+ else
+ return New_List (Make_Null_Statement (Loc));
end if;
-
- return New_List (Make_Null_Statement (Loc));
end Parameter_Block_Unpack;
----------------------
@@ -10950,15 +11143,19 @@ package body Exp_Ch9 is
-----------------
procedure Set_Privals
- (Dec : Node_Id;
- Op : Node_Id;
- Loc : Source_Ptr)
+ (Dec : Node_Id;
+ Op : Node_Id;
+ Loc : Source_Ptr;
+ After_Barrier : Boolean := False)
is
- P_Decl : Node_Id;
- P_Id : Entity_Id;
- Priv : Entity_Id;
- Def : Node_Id;
- Body_Ent : Entity_Id;
+ P_Decl : Node_Id;
+ P_Id : Entity_Id;
+ Priv : Entity_Id;
+ Def : Node_Id;
+ Body_Ent : Entity_Id;
+ For_Barrier : constant Boolean :=
+ Nkind (Op) = N_Entry_Body and then not After_Barrier;
+
Prec_Decl : constant Node_Id :=
Parent (Corresponding_Record_Type
(Defining_Identifier (Dec)));
@@ -10976,15 +11173,20 @@ package body Exp_Ch9 is
Def := Protected_Definition (Dec);
if Present (Private_Declarations (Def)) then
-
P_Decl := First (Private_Declarations (Def));
-
while Present (P_Decl) loop
if Nkind (P_Decl) = N_Component_Declaration then
P_Id := Defining_Identifier (P_Decl);
- Priv :=
- Make_Defining_Identifier (Loc,
- New_External_Name (Chars (P_Id), 'P'));
+
+ if For_Barrier then
+ Priv :=
+ Make_Defining_Identifier (Loc,
+ Chars => New_External_Name (Chars (P_Id), 'P'));
+ else
+ Priv :=
+ Make_Defining_Identifier (Loc,
+ Chars => New_External_Name (Chars (P_Id)));
+ end if;
Set_Ekind (Priv, E_Variable);
Set_Etype (Priv, Etype (P_Id));
@@ -11075,7 +11277,6 @@ package body Exp_Ch9 is
if Is_Entity_Name (N) then
declare
E : constant Entity_Id := Entity (N);
-
begin
if Present (E)
and then (Ekind (E) = E_Constant
diff --git a/gcc/ada/exp_ch9.ads b/gcc/ada/exp_ch9.ads
index 044f56d4543..baa5036d821 100644
--- a/gcc/ada/exp_ch9.ads
+++ b/gcc/ada/exp_ch9.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -311,13 +311,21 @@ package Exp_Ch9 is
-- protected type.
procedure Set_Privals
- (Dec : Node_Id;
- Op : Node_Id;
- Loc : Source_Ptr);
+ (Dec : Node_Id;
+ Op : Node_Id;
+ Loc : Source_Ptr;
+ After_Barrier : Boolean := False);
-- Associates a new set of privals (placeholders for later access to
-- private components of protected objects) with the private object
-- declarations of a protected object. These will be used to expand
-- the references to private objects in the next protected
-- subprogram or entry body to be expanded.
+ --
+ -- The flag After_Barrier indicates whether this is called after building
+ -- the barrier function for an entry body. This flag determines whether
+ -- the privals should have source names (which simplifies debugging) or
+ -- internally generated names. Entry barriers contain no debuggable code,
+ -- and there may be visibility conflicts between an entry index and a
+ -- a prival, so privals for barrier function have internal names.
end Exp_Ch9;
diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb
index e7bdcc4e5b3..8281f154183 100644
--- a/gcc/ada/exp_dbug.adb
+++ b/gcc/ada/exp_dbug.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -134,7 +134,7 @@ package body Exp_Dbug is
-- used to determine whether encoding is required for a discrete type.
procedure Output_Homonym_Numbers_Suffix;
- -- If homonym numbers are stored, then output them into Name_Buffer.
+ -- If homonym numbers are stored, then output them into Name_Buffer
procedure Prepend_String_To_Buffer (S : String);
-- Prepend given string to the contents of the string buffer, updating
@@ -250,9 +250,9 @@ package body Exp_Dbug is
then
return True;
- -- Here we check if the static bounds match the natural size, which
- -- is the size passed through with the debugging information. This
- -- is the Esize rounded up to 8, 16, 32 or 64 as appropriate.
+ -- Here we check if the static bounds match the natural size, which is
+ -- the size passed through with the debugging information. This is the
+ -- Esize rounded up to 8, 16, 32 or 64 as appropriate.
else
declare
@@ -305,12 +305,12 @@ package body Exp_Dbug is
Def : Entity_Id;
function Output_Subscript (N : Node_Id; S : String) return Boolean;
- -- Outputs a single subscript value as ?nnn (subscript is compile
- -- time known value with value nnn) or as ?e (subscript is local
- -- constant with name e), where S supplies the proper string to
- -- use for ?. Returns False if the subscript is not of an appropriate
- -- type to output in one of these two forms. The result is prepended
- -- to the name stored in Name_Buffer.
+ -- Outputs a single subscript value as ?nnn (subscript is compile time
+ -- known value with value nnn) or as ?e (subscript is local constant
+ -- with name e), where S supplies the proper string to use for ?.
+ -- Returns False if the subscript is not of an appropriate type to
+ -- output in one of these two forms. The result is prepended to the
+ -- name stored in Name_Buffer.
----------------------
-- Output_Subscript --
@@ -358,9 +358,9 @@ package body Exp_Dbug is
when N_Package_Renaming_Declaration =>
Add_Str_To_Name_Buffer ("___XRP");
- -- If it is a child unit create a fully qualified name,
- -- to disambiguate multiple child units with the same
- -- name and different parents.
+ -- If it is a child unit create a fully qualified name, to
+ -- disambiguate multiple child units with the same name and
+ -- different parents.
if Is_Child_Unit (Ent) then
Prepend_String_To_Buffer ("__");
@@ -386,8 +386,8 @@ package body Exp_Dbug is
when N_Expanded_Name =>
- -- The entity field for an N_Expanded_Name is on the
- -- expanded name node itself, so we are done here too.
+ -- The entity field for an N_Expanded_Name is on the expanded
+ -- name node itself, so we are done here too.
exit;
@@ -713,6 +713,7 @@ package body Exp_Dbug is
-- If this is a library level subprogram (i.e. a subprogram that is a
-- compilation unit other than a subunit), then we prepend _ada_ to
-- ensure distinctions required as described in the spec.
+
-- Check explicitly for child units, because those are not flagged
-- as Compilation_Units by lib. Should they be ???
@@ -880,6 +881,39 @@ package body Exp_Dbug is
end if;
end Get_Variant_Encoding;
+ ------------------------------------
+ -- Get_Secondary_DT_External_Name --
+ ------------------------------------
+
+ procedure Get_Secondary_DT_External_Name
+ (Typ : Entity_Id;
+ Ancestor_Typ : Entity_Id;
+ Suffix_Index : Int) is
+ begin
+ Get_External_Name (Typ, Has_Suffix => False);
+
+ if Ancestor_Typ /= Typ then
+ declare
+ Len : constant Natural := Name_Len;
+ Save_Str : constant String (1 .. Name_Len)
+ := Name_Buffer (1 .. Name_Len);
+ begin
+ Get_External_Name (Ancestor_Typ, Has_Suffix => False);
+
+ -- Append the extended name of the ancestor to the
+ -- extended name of Typ
+
+ Name_Buffer (Len + 2 .. Len + Name_Len + 1) :=
+ Name_Buffer (1 .. Name_Len);
+ Name_Buffer (1 .. Len) := Save_Str;
+ Name_Buffer (Len + 1) := '_';
+ Name_Len := Len + Name_Len + 1;
+ end;
+ end if;
+
+ Add_Nat_To_Name_Buffer (Suffix_Index);
+ end Get_Secondary_DT_External_Name;
+
---------------------------------
-- Make_Packed_Array_Type_Name --
---------------------------------
@@ -1166,7 +1200,6 @@ package body Exp_Dbug is
else
Add_Char_To_Name_Buffer ('X');
end if;
-
end Set_BNPE_Suffix;
---------------------
@@ -1338,7 +1371,6 @@ package body Exp_Dbug is
exit;
end if;
end loop;
-
end Strip_Suffixes;
end Exp_Dbug;
diff --git a/gcc/ada/exp_dbug.ads b/gcc/ada/exp_dbug.ads
index 9100d9c2fab..ccd80f38f8a 100644
--- a/gcc/ada/exp_dbug.ads
+++ b/gcc/ada/exp_dbug.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -360,7 +360,7 @@ package Exp_Dbug is
-- Operations generated for protected entries follow the same encoding.
-- Each entry results in two suprograms: a procedure that holds the
-- entry body, and a function that holds the evaluation of the barrier.
- -- The names of these subprograms include the prefix 'E' or 'B' res-
+ -- The names of these subprograms include the prefix '_E' or '_B' res-
-- pectively. The names also include a numeric suffix to render them
-- unique in the presence of overloaded entries.
@@ -382,8 +382,8 @@ package Exp_Dbug is
-- lock_setN
-- lock_setP
- -- lock_update1sE
- -- lock_udpate2sB
+ -- lock_update_E1s
+ -- lock_udpate_B2s
-- If the protected type implements at least one interface, the
-- following additional operations are created:
@@ -538,6 +538,12 @@ package Exp_Dbug is
-- field, and neither the outer structure name, nor the field name
-- should appear when the value is printed.
+ -- When the debugger sees a record named REP being a field inside
+ -- another record, it should treat the fields inside REP as being
+ -- part of the outer record (this REP field is only present for
+ -- code generation purposes). The REP record should not appear in
+ -- the values printed by the debugger.
+
-----------------------
-- Fixed-Point Types --
-----------------------
@@ -1432,6 +1438,66 @@ package Exp_Dbug is
-- the second enumeration literal would be named QU43 and the
-- value assigned to it would be 1.
+ -----------------------------------------------
+ -- Secondary Dispatch tables of tagged types --
+ -----------------------------------------------
+
+ procedure Get_Secondary_DT_External_Name
+ (Typ : Entity_Id;
+ Ancestor_Typ : Entity_Id;
+ Suffix_Index : Int);
+ -- Set Name_Buffer and Name_Len to the external name of one secondary
+ -- dispatch table of Typ. If the interface has been inherited from some
+ -- ancestor then Ancestor_Typ is such node (in this case the secondary
+ -- DT is needed to handle overriden primitives); if there is no such
+ -- ancestor then Ancestor_Typ is equal to Typ.
+ --
+ -- Internal rule followed for the generation of the external name:
+ --
+ -- Case 1. If the secondary dispatch has not been inherited from some
+ -- ancestor of Typ then the external name is composed as
+ -- follows:
+ -- External_Name (Typ) + Suffix_Number + 'P'
+ --
+ -- Case 2. if the secondary dispatch table has been inherited from some
+ -- ancestor then the external name is composed as follows:
+ -- External_Name (Typ) + '_' + External_Name (Ancestor_Typ)
+ -- + Suffix_Number + 'P'
+ --
+ -- Note: We have to use the external names (instead of simply their
+ -- names) to protect the frontend against programs that give the same
+ -- name to all the interfaces and use the expanded name to reference
+ -- them. The Suffix_Number is used to differentiate all the secondary
+ -- dispatch tables of a given type.
+ --
+ -- Examples:
+ --
+ -- package Pkg1 is | package Pkg2 is | package Pkg3 is
+ -- type Typ is | type Typ is | type Typ is
+ -- interface; | interface; | interface;
+ -- end Pkg1; | end Pkg; | end Pkg3;
+ --
+ -- with Pkg1, Pkg2, Pkg3;
+ -- package Case_1 is
+ -- type Typ is new Pkg1.Typ and Pkg2.Typ and Pkg3.Typ with ...
+ -- end Case_1;
+ --
+ -- with Case_1;
+ -- package Case_2 is
+ -- type Typ is new Case_1.Typ with ...
+ -- end Case_2;
+ --
+ -- These are the external names generated for Case_1.Typ (note that
+ -- Pkg1.Typ is associated with the Primary Dispatch Table, because it
+ -- is the the parent of this type, and hence no external name is
+ -- generated for it).
+ -- case_1__typ0P (associated with Pkg2.Typ)
+ -- case_1__typ1P (associated with Pkg3.Typ)
+ --
+ -- These are the external names generated for Case_2.Typ:
+ -- case_2__typ_case_1__typ0P
+ -- case_2__typ_case_1__typ1P
+
----------------------------
-- Effect of Optimization --
----------------------------
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index 524d6deaf19..20e769e1804 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,6 +31,7 @@ with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
with Exp_Ch7; use Exp_Ch7;
+with Exp_Dbug; use Exp_Dbug;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Itypes; use Itypes;
@@ -74,9 +75,10 @@ package body Exp_Disp is
-- C : out Prim_Op_Kind
procedure Build_Common_Dispatching_Select_Statements
- (Loc : Source_Ptr;
- Typ : Entity_Id;
- Stmts : List_Id);
+ (Loc : Source_Ptr;
+ Typ : Entity_Id;
+ DT_Ptr : Entity_Id;
+ Stmts : List_Id);
-- Ada 2005 (AI-345): Generate statements that are common between
-- asynchronous, conditional and timed select expansion.
@@ -151,21 +153,10 @@ package body Exp_Disp is
procedure Build_Common_Dispatching_Select_Statements
(Loc : Source_Ptr;
Typ : Entity_Id;
+ DT_Ptr : Entity_Id;
Stmts : List_Id)
is
- DT_Ptr : Entity_Id;
- DT_Ptr_Typ : Entity_Id := Typ;
-
begin
- -- Typ may be a derived type, climb the derivation chain in order to
- -- find the root.
-
- while Present (Parent_Subtype (DT_Ptr_Typ)) loop
- DT_Ptr_Typ := Parent_Subtype (DT_Ptr_Typ);
- end loop;
-
- DT_Ptr := Node (First_Elmt (Access_Disp_Table (DT_Ptr_Typ)));
-
-- Generate:
-- C := get_prim_op_kind (tag! (<type>VP), S);
@@ -187,6 +178,7 @@ package body Exp_Disp is
Make_Identifier (Loc, Name_uS)))));
-- Generate:
+
-- if C = POK_Procedure
-- or else C = POK_Protected_Procedure
-- or else C = POK_Task_Procedure;
@@ -317,6 +309,7 @@ package body Exp_Disp is
Get_Access_Level => RE_Get_Access_Level,
Get_Entry_Index => RE_Get_Entry_Index,
Get_External_Tag => RE_Get_External_Tag,
+ Get_Offset_Index => RE_Get_Offset_Index,
Get_Prim_Op_Address => RE_Get_Prim_Op_Address,
Get_Prim_Op_Kind => RE_Get_Prim_Op_Kind,
Get_RC_Offset => RE_Get_RC_Offset,
@@ -329,10 +322,13 @@ package body Exp_Disp is
Set_Entry_Index => RE_Set_Entry_Index,
Set_Expanded_Name => RE_Set_Expanded_Name,
Set_External_Tag => RE_Set_External_Tag,
+ Set_Offset_Index => RE_Set_Offset_Index,
+ Set_OSD => RE_Set_OSD,
Set_Prim_Op_Address => RE_Set_Prim_Op_Address,
Set_Prim_Op_Kind => RE_Set_Prim_Op_Kind,
Set_RC_Offset => RE_Set_RC_Offset,
Set_Remotely_Callable => RE_Set_Remotely_Callable,
+ Set_SSD => RE_Set_SSD,
Set_TSD => RE_Set_TSD,
TSD_Entry_Size => RE_TSD_Entry_Size,
TSD_Prologue_Size => RE_TSD_Prologue_Size);
@@ -345,6 +341,7 @@ package body Exp_Disp is
Get_Access_Level => False,
Get_Entry_Index => False,
Get_External_Tag => False,
+ Get_Offset_Index => False,
Get_Prim_Op_Address => False,
Get_Prim_Op_Kind => False,
Get_Remotely_Callable => False,
@@ -357,10 +354,13 @@ package body Exp_Disp is
Set_Entry_Index => True,
Set_Expanded_Name => True,
Set_External_Tag => True,
+ Set_Offset_Index => True,
+ Set_OSD => True,
Set_Prim_Op_Address => True,
Set_Prim_Op_Kind => True,
Set_RC_Offset => True,
Set_Remotely_Callable => True,
+ Set_SSD => True,
Set_TSD => True,
TSD_Entry_Size => False,
TSD_Prologue_Size => False);
@@ -373,6 +373,7 @@ package body Exp_Disp is
Get_Access_Level => 1,
Get_Entry_Index => 2,
Get_External_Tag => 1,
+ Get_Offset_Index => 2,
Get_Prim_Op_Address => 2,
Get_Prim_Op_Kind => 2,
Get_RC_Offset => 1,
@@ -385,10 +386,13 @@ package body Exp_Disp is
Set_Entry_Index => 3,
Set_Expanded_Name => 2,
Set_External_Tag => 2,
+ Set_Offset_Index => 3,
+ Set_OSD => 2,
Set_Prim_Op_Address => 3,
Set_Prim_Op_Kind => 3,
Set_RC_Offset => 2,
Set_Remotely_Callable => 2,
+ Set_SSD => 2,
Set_TSD => 2,
TSD_Entry_Size => 0,
TSD_Prologue_Size => 0);
@@ -552,21 +556,25 @@ package body Exp_Disp is
elsif TSS_Name = TSS_Deep_Finalize then
return Uint_10;
- elsif Chars (E) = Name_uDisp_Asynchronous_Select then
- return Uint_11;
+ elsif Ada_Version >= Ada_05 then
+ if Chars (E) = Name_uDisp_Asynchronous_Select then
+ return Uint_11;
- elsif Chars (E) = Name_uDisp_Conditional_Select then
- return Uint_12;
+ elsif Chars (E) = Name_uDisp_Conditional_Select then
+ return Uint_12;
- elsif Chars (E) = Name_uDisp_Get_Prim_Op_Kind then
- return Uint_13;
+ elsif Chars (E) = Name_uDisp_Get_Prim_Op_Kind then
+ return Uint_13;
- elsif Chars (E) = Name_uDisp_Timed_Select then
- return Uint_14;
+ elsif Chars (E) = Name_uDisp_Get_Task_Id then
+ return Uint_14;
- else
- raise Program_Error;
+ elsif Chars (E) = Name_uDisp_Timed_Select then
+ return Uint_15;
+ end if;
end if;
+
+ raise Program_Error;
end Default_Prim_Op_Position;
-----------------------------
@@ -1527,7 +1535,6 @@ package body Exp_Disp is
(Etype (First_Entity (Target)),
Make_Explicit_Dereference (Loc,
New_Reference_To (Defining_Identifier (Decl_2), Loc))));
-
end if;
Formal := Next (First (Formals));
@@ -1650,7 +1657,6 @@ package body Exp_Disp is
function Get_Remotely_Callable (Obj : Node_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (Obj);
-
begin
return Make_DT_Access_Action
(Typ => Etype (Obj),
@@ -1675,14 +1681,16 @@ package body Exp_Disp is
AI : Elmt_Id;
begin
- -- No need to inherit primitives if it an abstract interface type
+ -- No need to inherit primitives if we have an abstract interface
+ -- type or a concurrent type.
- if Is_Interface (Typ) then
+ if Is_Interface (Typ) or else Is_Concurrent_Record_Type (Typ) then
return Result;
end if;
AI := Next_Elmt (First_Elmt (Access_Disp_Table (Typ)));
while Present (AI) loop
+
-- All the secondary tables inherit the dispatch table entries
-- associated with predefined primitives.
@@ -1704,759 +1712,6 @@ package body Exp_Disp is
return Result;
end Init_Predefined_Interface_Primitives;
- -------------
- -- Make_DT --
- -------------
-
- function Make_DT (Typ : Entity_Id) return List_Id is
- Loc : constant Source_Ptr := Sloc (Typ);
- Result : constant List_Id := New_List;
- Elab_Code : constant List_Id := New_List;
-
- Tname : constant Name_Id := Chars (Typ);
- Name_DT : constant Name_Id := New_External_Name (Tname, 'T');
- Name_DT_Ptr : constant Name_Id := New_External_Name (Tname, 'P');
- Name_TSD : constant Name_Id := New_External_Name (Tname, 'B');
- Name_Exname : constant Name_Id := New_External_Name (Tname, 'E');
- Name_No_Reg : constant Name_Id := New_External_Name (Tname, 'F');
-
- DT : constant Node_Id := Make_Defining_Identifier (Loc, Name_DT);
- DT_Ptr : constant Node_Id := Make_Defining_Identifier (Loc, Name_DT_Ptr);
- TSD : constant Node_Id := Make_Defining_Identifier (Loc, Name_TSD);
- Exname : constant Node_Id := Make_Defining_Identifier (Loc, Name_Exname);
- No_Reg : constant Node_Id := Make_Defining_Identifier (Loc, Name_No_Reg);
-
- Generalized_Tag : constant Entity_Id := RTE (RE_Tag);
- I_Depth : Int;
- Size_Expr_Node : Node_Id;
- Old_Tag1 : Node_Id;
- Old_Tag2 : Node_Id;
- Num_Ifaces : Int;
- Nb_Prim : Int;
- TSD_Num_Entries : Int;
- Typ_Copy : constant Entity_Id := New_Copy (Typ);
- AI : Elmt_Id;
-
- begin
- if not RTE_Available (RE_Tag) then
- Error_Msg_CRT ("tagged types", Typ);
- return New_List;
- end if;
-
- -- Collect the full list of directly and indirectly implemented
- -- interfaces
-
- Set_Parent (Typ_Copy, Parent (Typ));
- Set_Abstract_Interfaces (Typ_Copy, New_Elmt_List);
- Collect_All_Interfaces (Typ_Copy);
-
- -- Calculate the number of entries required in the table of interfaces
-
- Num_Ifaces := 0;
- AI := First_Elmt (Abstract_Interfaces (Typ_Copy));
- while Present (AI) loop
- Num_Ifaces := Num_Ifaces + 1;
- Next_Elmt (AI);
- end loop;
-
- -- Count ancestors to compute the inheritance depth. For private
- -- extensions, always go to the full view in order to compute the real
- -- inheritance depth.
-
- declare
- Parent_Type : Entity_Id := Typ;
- P : Entity_Id;
-
- begin
- I_Depth := 0;
- loop
- P := Etype (Parent_Type);
-
- if Is_Private_Type (P) then
- P := Full_View (Base_Type (P));
- end if;
-
- exit when P = Parent_Type;
-
- I_Depth := I_Depth + 1;
- Parent_Type := P;
- end loop;
- end;
-
- Nb_Prim := UI_To_Int (DT_Entry_Count (First_Tag_Component (Typ)));
-
- -- Ada 2005 (AI-345): The size of the TSD is increased to accomodate
- -- the two tables used for dispatching in asynchronous, conditional
- -- and timed selects. The tables are solely generated for limited
- -- types that implement a limited interface.
-
- if Ada_Version >= Ada_05
- and then not Is_Interface (Typ)
- and then not Is_Abstract (Typ)
- and then not Is_Controlled (Typ)
- and then Implements_Limited_Interface (Typ)
- then
- TSD_Num_Entries := I_Depth + Num_Ifaces + 1 +
- 2 * (Nb_Prim - Default_Prim_Op_Count);
- else
- TSD_Num_Entries := I_Depth + Num_Ifaces + 1;
- end if;
-
- -- ----------------------------------------------------------------
- -- Dispatch table and related entities are allocated statically
-
- Set_Ekind (DT, E_Variable);
- Set_Is_Statically_Allocated (DT);
-
- Set_Ekind (DT_Ptr, E_Variable);
- Set_Is_Statically_Allocated (DT_Ptr);
-
- Set_Ekind (TSD, E_Variable);
- Set_Is_Statically_Allocated (TSD);
-
- Set_Ekind (Exname, E_Variable);
- Set_Is_Statically_Allocated (Exname);
-
- Set_Ekind (No_Reg, E_Variable);
- Set_Is_Statically_Allocated (No_Reg);
-
- -- Generate code to create the storage for the Dispatch_Table object:
-
- -- DT : Storage_Array (1..DT_Prologue_Size+nb_prim*DT_Entry_Size);
- -- for DT'Alignment use Address'Alignment
-
- Size_Expr_Node :=
- Make_Op_Add (Loc,
- Left_Opnd => Make_DT_Access_Action (Typ, DT_Prologue_Size, No_List),
- Right_Opnd =>
- Make_Op_Multiply (Loc,
- Left_Opnd =>
- Make_DT_Access_Action (Typ, DT_Entry_Size, No_List),
- Right_Opnd =>
- Make_Integer_Literal (Loc, Nb_Prim)));
-
- Append_To (Result,
- Make_Object_Declaration (Loc,
- Defining_Identifier => DT,
- Aliased_Present => True,
- Object_Definition =>
- Make_Subtype_Indication (Loc,
- Subtype_Mark => New_Reference_To (RTE (RE_Storage_Array), Loc),
- Constraint => Make_Index_Or_Discriminant_Constraint (Loc,
- Constraints => New_List (
- Make_Range (Loc,
- Low_Bound => Make_Integer_Literal (Loc, 1),
- High_Bound => Size_Expr_Node))))));
-
- Append_To (Result,
- Make_Attribute_Definition_Clause (Loc,
- Name => New_Reference_To (DT, Loc),
- Chars => Name_Alignment,
- Expression =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (RTE (RE_Integer_Address), Loc),
- Attribute_Name => Name_Alignment)));
-
- -- Generate code to create the pointer to the dispatch table
-
- -- DT_Ptr : Tag := Tag!(DT'Address);
-
- -- According to the C++ ABI, the base of the vtable is located after a
- -- prologue containing Offset_To_Top, and Typeinfo_Ptr. Hence, we move
- -- down the pointer to the real base of the vtable
-
- Append_To (Result,
- Make_Object_Declaration (Loc,
- Defining_Identifier => DT_Ptr,
- Constant_Present => True,
- Object_Definition => New_Reference_To (Generalized_Tag, Loc),
- Expression =>
- Unchecked_Convert_To (Generalized_Tag,
- Make_Op_Add (Loc,
- Left_Opnd =>
- Unchecked_Convert_To (RTE (RE_Storage_Offset),
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (DT, Loc),
- Attribute_Name => Name_Address)),
- Right_Opnd =>
- Make_DT_Access_Action (Typ,
- DT_Prologue_Size, No_List)))));
-
- -- Generate code to define the boolean that controls registration, in
- -- order to avoid multiple registrations for tagged types defined in
- -- multiple-called scopes.
-
- Append_To (Result,
- Make_Object_Declaration (Loc,
- Defining_Identifier => No_Reg,
- Object_Definition => New_Reference_To (Standard_Boolean, Loc),
- Expression => New_Reference_To (Standard_True, Loc)));
-
- -- Set Access_Disp_Table field to be the dispatch table pointer
-
- if not Present (Access_Disp_Table (Typ)) then
- Set_Access_Disp_Table (Typ, New_Elmt_List);
- end if;
-
- Prepend_Elmt (DT_Ptr, Access_Disp_Table (Typ));
-
- -- Generate code to create the storage for the type specific data object
- -- with enough space to store the tags of the ancestors plus the tags
- -- of all the implemented interfaces (as described in a-tags.adb).
- --
- -- TSD: Storage_Array
- -- (1..TSD_Prologue_Size+TSD_Num_Entries*TSD_Entry_Size);
- -- for TSD'Alignment use Address'Alignment
-
- Size_Expr_Node :=
- Make_Op_Add (Loc,
- Left_Opnd =>
- Make_DT_Access_Action (Typ, TSD_Prologue_Size, No_List),
- Right_Opnd =>
- Make_Op_Multiply (Loc,
- Left_Opnd =>
- Make_DT_Access_Action (Typ, TSD_Entry_Size, No_List),
- Right_Opnd =>
- Make_Integer_Literal (Loc, TSD_Num_Entries)));
-
- Append_To (Result,
- Make_Object_Declaration (Loc,
- Defining_Identifier => TSD,
- Aliased_Present => True,
- Object_Definition =>
- Make_Subtype_Indication (Loc,
- Subtype_Mark => New_Reference_To (RTE (RE_Storage_Array), Loc),
- Constraint => Make_Index_Or_Discriminant_Constraint (Loc,
- Constraints => New_List (
- Make_Range (Loc,
- Low_Bound => Make_Integer_Literal (Loc, 1),
- High_Bound => Size_Expr_Node))))));
-
- Append_To (Result,
- Make_Attribute_Definition_Clause (Loc,
- Name => New_Reference_To (TSD, Loc),
- Chars => Name_Alignment,
- Expression =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (RTE (RE_Integer_Address), Loc),
- Attribute_Name => Name_Alignment)));
-
- -- Generate code to put the Address of the TSD in the dispatch table
- -- Set_TSD (DT_Ptr, TSD);
-
- Append_To (Elab_Code,
- Make_DT_Access_Action (Typ,
- Action => Set_TSD,
- Args => New_List (
- New_Reference_To (DT_Ptr, Loc), -- DTptr
- Make_Attribute_Reference (Loc, -- Value
- Prefix => New_Reference_To (TSD, Loc),
- Attribute_Name => Name_Address))));
-
- -- Generate: Exname : constant String := full_qualified_name (typ);
- -- The type itself may be an anonymous parent type, so use the first
- -- subtype to have a user-recognizable name.
-
- Append_To (Result,
- Make_Object_Declaration (Loc,
- Defining_Identifier => Exname,
- Constant_Present => True,
- Object_Definition => New_Reference_To (Standard_String, Loc),
- Expression =>
- Make_String_Literal (Loc,
- Full_Qualified_Name (First_Subtype (Typ)))));
-
- -- Generate: Set_Expanded_Name (DT_Ptr, exname'Address);
-
- Append_To (Elab_Code,
- Make_DT_Access_Action (Typ,
- Action => Set_Expanded_Name,
- Args => New_List (
- Node1 => New_Reference_To (DT_Ptr, Loc),
- Node2 =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Exname, Loc),
- Attribute_Name => Name_Address))));
-
- -- Generate: Set_Access_Level (DT_Ptr, <type's accessibility level>);
-
- Append_To (Elab_Code,
- Make_DT_Access_Action (Typ,
- Action => Set_Access_Level,
- Args => New_List (
- Node1 => New_Reference_To (DT_Ptr, Loc),
- Node2 => Make_Integer_Literal (Loc, Type_Access_Level (Typ)))));
-
- -- Generate:
- -- Set_Offset_To_Top (DT_Ptr, 0);
-
- Append_To (Elab_Code,
- Make_Procedure_Call_Statement (Loc,
- Name => New_Reference_To (RTE (RE_Set_Offset_To_Top), Loc),
- Parameter_Associations => New_List (
- New_Reference_To (DT_Ptr, Loc),
- Make_Integer_Literal (Loc, Uint_0))));
-
- if Typ = Etype (Typ)
- or else Is_CPP_Class (Etype (Typ))
- then
- Old_Tag1 :=
- Unchecked_Convert_To (Generalized_Tag,
- Make_Integer_Literal (Loc, 0));
- Old_Tag2 :=
- Unchecked_Convert_To (Generalized_Tag,
- Make_Integer_Literal (Loc, 0));
-
- else
- Old_Tag1 :=
- New_Reference_To
- (Node (First_Elmt (Access_Disp_Table (Etype (Typ)))), Loc);
- Old_Tag2 :=
- New_Reference_To
- (Node (First_Elmt (Access_Disp_Table (Etype (Typ)))), Loc);
- end if;
-
- if Typ /= Etype (Typ)
- and then not Is_Interface (Typ)
- and then not Is_Interface (Etype (Typ))
- then
- -- Generate: Inherit_DT (parent'tag, DT_Ptr, nb_prim of parent);
-
- Append_To (Elab_Code,
- Make_DT_Access_Action (Typ,
- Action => Inherit_DT,
- Args => New_List (
- Node1 => Old_Tag1,
- Node2 => New_Reference_To (DT_Ptr, Loc),
- Node3 =>
- Make_Integer_Literal (Loc,
- DT_Entry_Count (First_Tag_Component (Etype (Typ)))))));
-
- -- Inherit the secondary dispatch tables of the ancestor
-
- if not Is_CPP_Class (Etype (Typ)) then
- declare
- Sec_DT_Ancestor : Elmt_Id :=
- Next_Elmt
- (First_Elmt
- (Access_Disp_Table (Etype (Typ))));
- Sec_DT_Typ : Elmt_Id :=
- Next_Elmt
- (First_Elmt
- (Access_Disp_Table (Typ)));
-
- procedure Copy_Secondary_DTs (Typ : Entity_Id);
- -- Local procedure required to climb through the ancestors and
- -- copy the contents of all their secondary dispatch tables.
-
- ------------------------
- -- Copy_Secondary_DTs --
- ------------------------
-
- procedure Copy_Secondary_DTs (Typ : Entity_Id) is
- E : Entity_Id;
-
- begin
- if Etype (Typ) /= Typ then
- Copy_Secondary_DTs (Etype (Typ));
- end if;
-
- if Present (Abstract_Interfaces (Typ))
- and then not Is_Empty_Elmt_List
- (Abstract_Interfaces (Typ))
- then
- E := First_Entity (Typ);
- while Present (E)
- and then Present (Node (Sec_DT_Ancestor))
- loop
- if Is_Tag (E) and then Chars (E) /= Name_uTag then
- Append_To (Elab_Code,
- Make_DT_Access_Action (Typ,
- Action => Inherit_DT,
- Args => New_List (
- Node1 => Unchecked_Convert_To
- (RTE (RE_Tag),
- New_Reference_To
- (Node (Sec_DT_Ancestor), Loc)),
- Node2 => Unchecked_Convert_To
- (RTE (RE_Tag),
- New_Reference_To
- (Node (Sec_DT_Typ), Loc)),
- Node3 => Make_Integer_Literal (Loc,
- DT_Entry_Count (E)))));
-
- Next_Elmt (Sec_DT_Ancestor);
- Next_Elmt (Sec_DT_Typ);
- end if;
-
- Next_Entity (E);
- end loop;
- end if;
- end Copy_Secondary_DTs;
-
- begin
- if Present (Node (Sec_DT_Ancestor)) then
- Copy_Secondary_DTs (Typ);
- end if;
- end;
- end if;
- end if;
-
- -- Generate:
- -- Inherit_TSD (parent'tag, DT_Ptr);
-
- Append_To (Elab_Code,
- Make_DT_Access_Action (Typ,
- Action => Inherit_TSD,
- Args => New_List (
- Node1 => Old_Tag2,
- Node2 => New_Reference_To (DT_Ptr, Loc))));
-
- -- For types with no controlled components, generate:
- -- Set_RC_Offset (DT_Ptr, 0);
-
- -- For simple types with controlled components, generate:
- -- Set_RC_Offset (DT_Ptr, type._record_controller'position);
-
- -- For complex types with controlled components where the position
- -- of the record controller is not statically computable, if there are
- -- controlled components at this level, generate:
- -- Set_RC_Offset (DT_Ptr, -1);
- -- to indicate that the _controller field is right after the _parent
-
- -- Or if there are no controlled components at this level, generate:
- -- Set_RC_Offset (DT_Ptr, -2);
- -- to indicate that we need to get the position from the parent.
-
- declare
- Position : Node_Id;
-
- begin
- if not Has_Controlled_Component (Typ) then
- Position := Make_Integer_Literal (Loc, 0);
-
- elsif Etype (Typ) /= Typ and then Has_Discriminants (Etype (Typ)) then
- if Has_New_Controlled_Component (Typ) then
- Position := Make_Integer_Literal (Loc, -1);
- else
- Position := Make_Integer_Literal (Loc, -2);
- end if;
- else
- Position :=
- Make_Attribute_Reference (Loc,
- Prefix =>
- Make_Selected_Component (Loc,
- Prefix => New_Reference_To (Typ, Loc),
- Selector_Name =>
- New_Reference_To (Controller_Component (Typ), Loc)),
- Attribute_Name => Name_Position);
-
- -- This is not proper Ada code to use the attribute 'Position
- -- on something else than an object but this is supported by
- -- the back end (see comment on the Bit_Component attribute in
- -- sem_attr). So we avoid semantic checking here.
-
- -- Is this documented in sinfo.ads??? it should be!
-
- Set_Analyzed (Position);
- Set_Etype (Prefix (Position), RTE (RE_Record_Controller));
- Set_Etype (Prefix (Prefix (Position)), Typ);
- Set_Etype (Selector_Name (Prefix (Position)),
- RTE (RE_Record_Controller));
- Set_Etype (Position, RTE (RE_Storage_Offset));
- end if;
-
- Append_To (Elab_Code,
- Make_DT_Access_Action (Typ,
- Action => Set_RC_Offset,
- Args => New_List (
- Node1 => New_Reference_To (DT_Ptr, Loc),
- Node2 => Position)));
- end;
-
- -- Generate: Set_Remotely_Callable (DT_Ptr, Status); where Status is
- -- described in E.4 (18)
-
- declare
- Status : Entity_Id;
-
- begin
- Status :=
- Boolean_Literals
- (Is_Pure (Typ)
- or else Is_Shared_Passive (Typ)
- or else
- ((Is_Remote_Types (Typ)
- or else Is_Remote_Call_Interface (Typ))
- and then Original_View_In_Visible_Part (Typ))
- or else not Comes_From_Source (Typ));
-
- Append_To (Elab_Code,
- Make_DT_Access_Action (Typ,
- Action => Set_Remotely_Callable,
- Args => New_List (
- New_Occurrence_Of (DT_Ptr, Loc),
- New_Occurrence_Of (Status, Loc))));
- end;
-
- -- Generate: Set_External_Tag (DT_Ptr, exname'Address);
- -- Should be the external name not the qualified name???
-
- if not Has_External_Tag_Rep_Clause (Typ) then
- Append_To (Elab_Code,
- Make_DT_Access_Action (Typ,
- Action => Set_External_Tag,
- Args => New_List (
- Node1 => New_Reference_To (DT_Ptr, Loc),
- Node2 =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Exname, Loc),
- Attribute_Name => Name_Address))));
-
- -- Generate code to register the Tag in the External_Tag hash
- -- table for the pure Ada type only.
-
- -- Register_Tag (Dt_Ptr);
-
- -- Skip this if routine not available, or in No_Run_Time mode
-
- if RTE_Available (RE_Register_Tag)
- and then Is_RTE (Generalized_Tag, RE_Tag)
- and then not No_Run_Time_Mode
- then
- Append_To (Elab_Code,
- Make_Procedure_Call_Statement (Loc,
- Name => New_Reference_To (RTE (RE_Register_Tag), Loc),
- Parameter_Associations =>
- New_List (New_Reference_To (DT_Ptr, Loc))));
- end if;
- end if;
-
- -- Generate:
- -- if No_Reg then
- -- <elab_code>
- -- No_Reg := False;
- -- end if;
-
- Append_To (Elab_Code,
- Make_Assignment_Statement (Loc,
- Name => New_Reference_To (No_Reg, Loc),
- Expression => New_Reference_To (Standard_False, Loc)));
-
- Append_To (Result,
- Make_Implicit_If_Statement (Typ,
- Condition => New_Reference_To (No_Reg, Loc),
- Then_Statements => Elab_Code));
-
- -- Ada 2005 (AI-251): Register the tag of the interfaces into
- -- the table of implemented interfaces
-
- if Present (Abstract_Interfaces (Typ_Copy))
- and then not Is_Empty_Elmt_List (Abstract_Interfaces (Typ_Copy))
- then
- AI := First_Elmt (Abstract_Interfaces (Typ_Copy));
- while Present (AI) loop
-
- -- Generate:
- -- Register_Interface (DT_Ptr, Interface'Tag);
-
- Append_To (Result,
- Make_DT_Access_Action (Typ,
- Action => Register_Interface_Tag,
- Args => New_List (
- Node1 => New_Reference_To (DT_Ptr, Loc),
- Node2 => New_Reference_To
- (Node
- (First_Elmt
- (Access_Disp_Table (Node (AI)))),
- Loc))));
-
- Next_Elmt (AI);
- end loop;
- end if;
-
- return Result;
- end Make_DT;
-
- --------------------------------
- -- Make_Abstract_Interface_DT --
- --------------------------------
-
- procedure Make_Abstract_Interface_DT
- (AI_Tag : Entity_Id;
- Acc_Disp_Tables : in out Elist_Id;
- Result : out List_Id)
- is
- Loc : constant Source_Ptr := Sloc (AI_Tag);
- Name_DT : constant Name_Id := New_Internal_Name ('T');
- Name_DT_Ptr : constant Name_Id := New_Internal_Name ('P');
-
- Iface_DT : constant Node_Id :=
- Make_Defining_Identifier (Loc, Name_DT);
- Iface_DT_Ptr : constant Node_Id :=
- Make_Defining_Identifier (Loc, Name_DT_Ptr);
-
- Generalized_Tag : constant Entity_Id := RTE (RE_Interface_Tag);
- Size_Expr_Node : Node_Id;
- Nb_Prim : Int;
-
- begin
- Result := New_List;
-
- -- Dispatch table and related entities are allocated statically
-
- Set_Ekind (Iface_DT, E_Variable);
- Set_Is_Statically_Allocated (Iface_DT);
-
- Set_Ekind (Iface_DT_Ptr, E_Variable);
- Set_Is_Statically_Allocated (Iface_DT_Ptr);
-
- -- Generate code to create the storage for the Dispatch_Table object
-
- -- DT : Storage_Array (1..DT_Prologue_Size+nb_prim*DT_Entry_Size);
- -- for DT'Alignment use Address'Alignment
-
- Nb_Prim := UI_To_Int (DT_Entry_Count (AI_Tag));
-
- Size_Expr_Node :=
- Make_Op_Add (Loc,
- Left_Opnd => Make_DT_Access_Action (Etype (AI_Tag),
- DT_Prologue_Size,
- No_List),
- Right_Opnd =>
- Make_Op_Multiply (Loc,
- Left_Opnd =>
- Make_DT_Access_Action (Etype (AI_Tag),
- DT_Entry_Size,
- No_List),
- Right_Opnd =>
- Make_Integer_Literal (Loc, Nb_Prim)));
-
- Append_To (Result,
- Make_Object_Declaration (Loc,
- Defining_Identifier => Iface_DT,
- Aliased_Present => True,
- Object_Definition =>
- Make_Subtype_Indication (Loc,
- Subtype_Mark => New_Reference_To (RTE (RE_Storage_Array), Loc),
- Constraint => Make_Index_Or_Discriminant_Constraint (Loc,
- Constraints => New_List (
- Make_Range (Loc,
- Low_Bound => Make_Integer_Literal (Loc, 1),
- High_Bound => Size_Expr_Node)))),
-
- -- Initialize the signature of the interface tag. It is currently
- -- a sequence of four bytes located in the unused Typeinfo_Ptr
- -- field of the prologue). Its current value is the following
- -- sequence: (80, Nb_Prim, 0, 80)
-
- Expression =>
- Make_Aggregate (Loc,
- Component_Associations => New_List (
- Make_Component_Association (Loc,
-
- -- -80, 0, 0, -80
-
- Choices => New_List (
- Make_Integer_Literal (Loc, Uint_5),
- Make_Integer_Literal (Loc, Uint_8)),
- Expression =>
- Make_Integer_Literal (Loc, Uint_80)),
-
- Make_Component_Association (Loc,
- Choices => New_List (
- Make_Integer_Literal (Loc, Uint_2)),
- Expression =>
- Make_Integer_Literal (Loc, Nb_Prim)),
-
- Make_Component_Association (Loc,
- Choices => New_List (
- Make_Others_Choice (Loc)),
- Expression => Make_Integer_Literal (Loc, Uint_0))))));
-
- Append_To (Result,
- Make_Attribute_Definition_Clause (Loc,
- Name => New_Reference_To (Iface_DT, Loc),
- Chars => Name_Alignment,
- Expression =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (RTE (RE_Integer_Address), Loc),
- Attribute_Name => Name_Alignment)));
-
- -- Generate code to create the pointer to the dispatch table
-
- -- Iface_DT_Ptr : Tag := Tag!(DT'Address);
-
- -- According to the C++ ABI, the base of the vtable is located
- -- after the following prologue: Offset_To_Top, and Typeinfo_Ptr.
- -- Hence, move the pointer down to the real base of the vtable.
-
- Append_To (Result,
- Make_Object_Declaration (Loc,
- Defining_Identifier => Iface_DT_Ptr,
- Constant_Present => True,
- Object_Definition => New_Reference_To (Generalized_Tag, Loc),
- Expression =>
- Unchecked_Convert_To (Generalized_Tag,
- Make_Op_Add (Loc,
- Left_Opnd =>
- Unchecked_Convert_To (RTE (RE_Storage_Offset),
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Iface_DT, Loc),
- Attribute_Name => Name_Address)),
- Right_Opnd =>
- Make_DT_Access_Action (Etype (AI_Tag),
- DT_Prologue_Size, No_List)))));
-
- -- Note: Offset_To_Top will be initialized by the init subprogram
-
- -- Set Access_Disp_Table field to be the dispatch table pointer
-
- if not (Present (Acc_Disp_Tables)) then
- Acc_Disp_Tables := New_Elmt_List;
- end if;
-
- Append_Elmt (Iface_DT_Ptr, Acc_Disp_Tables);
- end Make_Abstract_Interface_DT;
-
- ---------------------------
- -- Make_DT_Access_Action --
- ---------------------------
-
- function Make_DT_Access_Action
- (Typ : Entity_Id;
- Action : DT_Access_Action;
- Args : List_Id) return Node_Id
- is
- Action_Name : constant Entity_Id := RTE (Ada_Actions (Action));
- Loc : Source_Ptr;
-
- begin
- if No (Args) then
-
- -- This is a constant
-
- return New_Reference_To (Action_Name, Sloc (Typ));
- end if;
-
- pragma Assert (List_Length (Args) = Action_Nb_Arg (Action));
-
- Loc := Sloc (First (Args));
-
- if Action_Is_Proc (Action) then
- return
- Make_Procedure_Call_Statement (Loc,
- Name => New_Reference_To (Action_Name, Loc),
- Parameter_Associations => Args);
-
- else
- return
- Make_Function_Call (Loc,
- Name => New_Reference_To (Action_Name, Loc),
- Parameter_Associations => Args);
- end if;
- end Make_DT_Access_Action;
-
----------------------------------------
-- Make_Disp_Asynchronous_Select_Body --
----------------------------------------
@@ -2464,27 +1719,30 @@ package body Exp_Disp is
function Make_Disp_Asynchronous_Select_Body
(Typ : Entity_Id) return Node_Id
is
- Conc_Typ : Entity_Id := Empty;
- Decls : constant List_Id := New_List;
- DT_Ptr : Entity_Id;
- DT_Ptr_Typ : Entity_Id;
- Loc : constant Source_Ptr := Sloc (Typ);
- Stmts : constant List_Id := New_List;
+ Conc_Typ : Entity_Id := Empty;
+ Decls : constant List_Id := New_List;
+ DT_Ptr : Entity_Id;
+ Loc : constant Source_Ptr := Sloc (Typ);
+ Stmts : constant List_Id := New_List;
begin
+ if Is_Interface (Typ) then
+ return
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ Make_Disp_Asynchronous_Select_Spec (Typ),
+ Declarations =>
+ New_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ New_List (Make_Null_Statement (Loc))));
+ end if;
+
if Is_Concurrent_Record_Type (Typ) then
Conc_Typ := Corresponding_Concurrent_Type (Typ);
end if;
- -- Typ may be a derived type, climb the derivation chain in order to
- -- find the root.
-
- DT_Ptr_Typ := Typ;
- while Present (Parent_Subtype (DT_Ptr_Typ)) loop
- DT_Ptr_Typ := Parent_Subtype (DT_Ptr_Typ);
- end loop;
-
- DT_Ptr := Node (First_Elmt (Access_Disp_Table (DT_Ptr_Typ)));
+ DT_Ptr := Node (First_Elmt (Access_Disp_Table (Typ)));
if Present (Conc_Typ) then
@@ -2590,11 +1848,11 @@ package body Exp_Disp is
Make_Identifier (Loc, Name_uF)))); -- status flag
end if;
- -- Null implementation for limited tagged types
+ -- Implementation for limited tagged types
else
Append_To (Stmts,
- Make_Null_Statement (Loc));
+ Make_Raise_Program_Error (Loc, Reason => PE_Explicit_Raise));
end if;
return
@@ -2615,6 +1873,9 @@ package body Exp_Disp is
(Typ : Entity_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Typ);
+ Def_Id : constant Node_Id :=
+ Make_Defining_Identifier (Loc,
+ Name_uDisp_Asynchronous_Select);
Params : constant List_Id := New_List;
begin
@@ -2630,12 +1891,12 @@ package body Exp_Disp is
SEU.Build_B (Loc, Params);
SEU.Build_F (Loc, Params);
+ Set_Is_Internal (Def_Id);
+
return
Make_Procedure_Specification (Loc,
- Defining_Unit_Name =>
- Make_Defining_Identifier (Loc, Name_uDisp_Asynchronous_Select),
- Parameter_Specifications =>
- Params);
+ Defining_Unit_Name => Def_Id,
+ Parameter_Specifications => Params);
end Make_Disp_Asynchronous_Select_Spec;
---------------------------------------
@@ -2645,30 +1906,34 @@ package body Exp_Disp is
function Make_Disp_Conditional_Select_Body
(Typ : Entity_Id) return Node_Id
is
- Blk_Nam : Entity_Id;
- Conc_Typ : Entity_Id := Empty;
- Decls : constant List_Id := New_List;
- DT_Ptr : Entity_Id;
- DT_Ptr_Typ : Entity_Id;
- Loc : constant Source_Ptr := Sloc (Typ);
- Stmts : constant List_Id := New_List;
+ Loc : constant Source_Ptr := Sloc (Typ);
+ Blk_Nam : Entity_Id;
+ Conc_Typ : Entity_Id := Empty;
+ Decls : constant List_Id := New_List;
+ DT_Ptr : Entity_Id;
+ Stmts : constant List_Id := New_List;
begin
+ if Is_Interface (Typ) then
+ return
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ Make_Disp_Conditional_Select_Spec (Typ),
+ Declarations =>
+ No_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ New_List (Make_Null_Statement (Loc))));
+ end if;
+
if Is_Concurrent_Record_Type (Typ) then
Conc_Typ := Corresponding_Concurrent_Type (Typ);
end if;
- -- Typ may be a derived type, climb the derivation chain in order to
- -- find the root.
-
- DT_Ptr_Typ := Typ;
- while Present (Parent_Subtype (DT_Ptr_Typ)) loop
- DT_Ptr_Typ := Parent_Subtype (DT_Ptr_Typ);
- end loop;
-
- DT_Ptr := Node (First_Elmt (Access_Disp_Table (DT_Ptr_Typ)));
+ DT_Ptr := Node (First_Elmt (Access_Disp_Table (Typ)));
if Present (Conc_Typ) then
+
-- Generate:
-- I : Integer;
@@ -2694,7 +1959,7 @@ package body Exp_Disp is
-- return;
-- end if;
- SEU.Build_Common_Dispatching_Select_Statements (Loc, Typ, Stmts);
+ SEU.Build_Common_Dispatching_Select_Statements (Loc, Typ, DT_Ptr, Stmts);
if Present (Conc_Typ) then
@@ -2716,7 +1981,7 @@ package body Exp_Disp is
-- Generate:
-- I := get_entry_index (tag! (<type>VP), S);
- -- where I is the entry index and S is the dispatch table slot.
+ -- I is the entry index and S is the dispatch table slot
Append_To (Stmts,
Make_Assignment_Statement (Loc,
@@ -2833,11 +2098,11 @@ package body Exp_Disp is
Make_Identifier (Loc, Name_uF)))); -- status flag
end if;
- -- Null implementation for limited tagged types
+ -- Implementation for limited tagged types
else
Append_To (Stmts,
- Make_Null_Statement (Loc));
+ Make_Raise_Program_Error (Loc, Reason => PE_Explicit_Raise));
end if;
return
@@ -2858,6 +2123,9 @@ package body Exp_Disp is
(Typ : Entity_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Typ);
+ Def_Id : constant Node_Id :=
+ Make_Defining_Identifier (Loc,
+ Name_uDisp_Conditional_Select);
Params : constant List_Id := New_List;
begin
@@ -2873,12 +2141,12 @@ package body Exp_Disp is
SEU.Build_C (Loc, Params);
SEU.Build_F (Loc, Params);
+ Set_Is_Internal (Def_Id);
+
return
Make_Procedure_Specification (Loc,
- Defining_Unit_Name =>
- Make_Defining_Identifier (Loc, Name_uDisp_Conditional_Select),
- Parameter_Specifications =>
- Params);
+ Defining_Unit_Name => Def_Id,
+ Parameter_Specifications => Params);
end Make_Disp_Conditional_Select_Spec;
-------------------------------------
@@ -2888,20 +2156,23 @@ package body Exp_Disp is
function Make_Disp_Get_Prim_Op_Kind_Body
(Typ : Entity_Id) return Node_Id
is
- Loc : constant Source_Ptr := Sloc (Typ);
- DT_Ptr : Entity_Id;
- DT_Ptr_Typ : Entity_Id;
+ Loc : constant Source_Ptr := Sloc (Typ);
+ DT_Ptr : Entity_Id;
begin
- -- Typ may be a derived type, climb the derivation chain in order to
- -- find the root.
-
- DT_Ptr_Typ := Typ;
- while Present (Parent_Subtype (DT_Ptr_Typ)) loop
- DT_Ptr_Typ := Parent_Subtype (DT_Ptr_Typ);
- end loop;
+ if Is_Interface (Typ) then
+ return
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ Make_Disp_Get_Prim_Op_Kind_Spec (Typ),
+ Declarations =>
+ New_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ New_List (Make_Null_Statement (Loc))));
+ end if;
- DT_Ptr := Node (First_Elmt (Access_Disp_Table (DT_Ptr_Typ)));
+ DT_Ptr := Node (First_Elmt (Access_Disp_Table (Typ)));
-- Generate:
-- C := get_prim_op_kind (tag! (<type>VP), S);
@@ -2914,7 +2185,7 @@ package body Exp_Disp is
Specification =>
Make_Disp_Get_Prim_Op_Kind_Spec (Typ),
Declarations =>
- No_List,
+ New_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
New_List (
@@ -2940,6 +2211,9 @@ package body Exp_Disp is
(Typ : Entity_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Typ);
+ Def_Id : constant Node_Id :=
+ Make_Defining_Identifier (Loc,
+ Name_uDisp_Get_Prim_Op_Kind);
Params : constant List_Id := New_List;
begin
@@ -2951,109 +2225,84 @@ package body Exp_Disp is
SEU.Build_S (Loc, Params);
SEU.Build_C (Loc, Params);
+ Set_Is_Internal (Def_Id);
+
return
Make_Procedure_Specification (Loc,
- Defining_Unit_Name =>
- Make_Defining_Identifier (Loc, Name_uDisp_Get_Prim_Op_Kind),
- Parameter_Specifications =>
- Params);
+ Defining_Unit_Name => Def_Id,
+ Parameter_Specifications => Params);
end Make_Disp_Get_Prim_Op_Kind_Spec;
- -----------------------------
- -- Make_Disp_Select_Tables --
- -----------------------------
+ --------------------------------
+ -- Make_Disp_Get_Task_Id_Body --
+ --------------------------------
- function Make_Disp_Select_Tables
- (Typ : Entity_Id) return List_Id
+ function Make_Disp_Get_Task_Id_Body
+ (Typ : Entity_Id) return Node_Id
is
- Assignments : constant List_Id := New_List;
- DT_Ptr : Entity_Id;
- DT_Ptr_Typ : Entity_Id;
- Index : Uint := Uint_1;
- Loc : constant Source_Ptr := Sloc (Typ);
- Prim : Entity_Id;
- Prim_Als : Entity_Id;
- Prim_Elmt : Elmt_Id;
- Prim_Pos : Uint;
+ Loc : constant Source_Ptr := Sloc (Typ);
+ Ret : Node_Id;
begin
- pragma Assert (Present (Primitive_Operations (Typ)));
-
- -- Typ may be a derived type, climb the derivation chain in order to
- -- find the root.
-
- DT_Ptr_Typ := Typ;
- while Present (Parent_Subtype (DT_Ptr_Typ)) loop
- DT_Ptr_Typ := Parent_Subtype (DT_Ptr_Typ);
- end loop;
-
- DT_Ptr := Node (First_Elmt (Access_Disp_Table (DT_Ptr_Typ)));
-
- Prim_Elmt := First_Elmt (Primitive_Operations (Typ));
- while Present (Prim_Elmt) loop
- Prim := Node (Prim_Elmt);
-
- -- Retrieve the root of the alias chain
-
- if Present (Alias (Prim)) then
- Prim_Als := Prim;
- while Present (Alias (Prim_Als)) loop
- Prim_Als := Alias (Prim_Als);
- end loop;
- else
- Prim_Als := Empty;
- end if;
-
- -- We either have a procedure or a wrapper. Set the primitive
- -- operation kind for both cases and set the entry index for
- -- wrappers.
-
- if Ekind (Prim) = E_Procedure
- and then Present (Prim_Als)
- and then Is_Primitive_Wrapper (Prim_Als)
- then
- Prim_Pos := DT_Position (Prim);
-
- -- Generate:
- -- set_prim_op_kind (<tag>, <position>, <kind>);
+ if Is_Concurrent_Record_Type (Typ)
+ and then Ekind (Corresponding_Concurrent_Type (Typ)) = E_Task_Type
+ then
+ Ret :=
+ Make_Return_Statement (Loc,
+ Expression =>
+ Make_Selected_Component (Loc,
+ Prefix =>
+ Make_Identifier (Loc, Name_uT),
+ Selector_Name =>
+ Make_Identifier (Loc, Name_uTask_Id)));
- Append_To (Assignments,
- Make_DT_Access_Action (Typ,
- Action =>
- Set_Prim_Op_Kind,
- Args =>
- New_List (
- Unchecked_Convert_To (RTE (RE_Tag),
- New_Reference_To (DT_Ptr, Loc)),
- Make_Integer_Literal (Loc, Prim_Pos),
- Prim_Op_Kind (Prim, Typ))));
+ -- A null body is constructed for non-task types
- -- The wrapped entity of the alias is an entry
+ else
+ Ret :=
+ Make_Return_Statement (Loc,
+ Expression =>
+ New_Reference_To (RTE (RO_ST_Null_Task), Loc));
+ end if;
- if Ekind (Wrapped_Entity (Prim_Als)) = E_Entry then
- -- Generate:
- -- set_entry_index (<tag>, <position>, <index>);
+ return
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ Make_Disp_Get_Task_Id_Spec (Typ),
+ Declarations =>
+ New_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ New_List (Ret)));
+ end Make_Disp_Get_Task_Id_Body;
- Append_To (Assignments,
- Make_DT_Access_Action (Typ,
- Action =>
- Set_Entry_Index,
- Args =>
- New_List (
- Unchecked_Convert_To (RTE (RE_Tag),
- New_Reference_To (DT_Ptr, Loc)),
- Make_Integer_Literal (Loc, Prim_Pos),
- Make_Integer_Literal (Loc, Index))));
+ --------------------------------
+ -- Make_Disp_Get_Task_Id_Spec --
+ --------------------------------
- Index := Index + 1;
- end if;
- end if;
+ function Make_Disp_Get_Task_Id_Spec
+ (Typ : Entity_Id) return Node_Id
+ is
+ Loc : constant Source_Ptr := Sloc (Typ);
+ Def_Id : constant Node_Id :=
+ Make_Defining_Identifier (Loc,
+ Name_uDisp_Get_Task_Id);
- Next_Elmt (Prim_Elmt);
- end loop;
+ begin
+ Set_Is_Internal (Def_Id);
- return Assignments;
- end Make_Disp_Select_Tables;
+ return
+ Make_Function_Specification (Loc,
+ Defining_Unit_Name => Def_Id,
+ Parameter_Specifications => New_List (
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc, Name_uT),
+ Parameter_Type =>
+ New_Reference_To (Typ, Loc))),
+ Result_Definition =>
+ New_Reference_To (RTE (RO_ST_Task_Id), Loc));
+ end Make_Disp_Get_Task_Id_Spec;
---------------------------------
-- Make_Disp_Timed_Select_Body --
@@ -3062,27 +2311,30 @@ package body Exp_Disp is
function Make_Disp_Timed_Select_Body
(Typ : Entity_Id) return Node_Id
is
- Loc : constant Source_Ptr := Sloc (Typ);
- Conc_Typ : Entity_Id := Empty;
- Decls : constant List_Id := New_List;
- DT_Ptr : Entity_Id;
- DT_Ptr_Typ : Entity_Id;
- Stmts : constant List_Id := New_List;
+ Loc : constant Source_Ptr := Sloc (Typ);
+ Conc_Typ : Entity_Id := Empty;
+ Decls : constant List_Id := New_List;
+ DT_Ptr : Entity_Id;
+ Stmts : constant List_Id := New_List;
begin
+ if Is_Interface (Typ) then
+ return
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ Make_Disp_Timed_Select_Spec (Typ),
+ Declarations =>
+ New_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ New_List (Make_Null_Statement (Loc))));
+ end if;
+
if Is_Concurrent_Record_Type (Typ) then
Conc_Typ := Corresponding_Concurrent_Type (Typ);
end if;
- -- Typ may be a derived type, climb the derivation chain in order to
- -- find the root.
-
- DT_Ptr_Typ := Typ;
- while Present (Parent_Subtype (DT_Ptr_Typ)) loop
- DT_Ptr_Typ := Parent_Subtype (DT_Ptr_Typ);
- end loop;
-
- DT_Ptr := Node (First_Elmt (Access_Disp_Table (DT_Ptr_Typ)));
+ DT_Ptr := Node (First_Elmt (Access_Disp_Table (Typ)));
if Present (Conc_Typ) then
@@ -3111,14 +2363,14 @@ package body Exp_Disp is
-- return;
-- end if;
- SEU.Build_Common_Dispatching_Select_Statements (Loc, Typ, Stmts);
+ SEU.Build_Common_Dispatching_Select_Statements (Loc, Typ, DT_Ptr, Stmts);
if Present (Conc_Typ) then
-- Generate:
-- I := get_entry_index (tag! (<type>VP), S);
- -- where I is the entry index and S is the dispatch table slot.
+ -- I is the entry index and S is the dispatch table slot
Append_To (Stmts,
Make_Assignment_Statement (Loc,
@@ -3218,11 +2470,11 @@ package body Exp_Disp is
Make_Identifier (Loc, Name_uF)))); -- status flag
end if;
- -- Null implementation for limited tagged types
+ -- Implementation for limited tagged types
else
Append_To (Stmts,
- Make_Null_Statement (Loc));
+ Make_Raise_Program_Error (Loc, Reason => PE_Explicit_Raise));
end if;
return
@@ -3243,6 +2495,9 @@ package body Exp_Disp is
(Typ : Entity_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Typ);
+ Def_Id : constant Node_Id :=
+ Make_Defining_Identifier (Loc,
+ Name_uDisp_Timed_Select);
Params : constant List_Id := New_List;
begin
@@ -3275,14 +2530,1189 @@ package body Exp_Disp is
SEU.Build_C (Loc, Params);
SEU.Build_F (Loc, Params);
+ Set_Is_Internal (Def_Id);
+
return
Make_Procedure_Specification (Loc,
- Defining_Unit_Name =>
- Make_Defining_Identifier (Loc, Name_uDisp_Timed_Select),
- Parameter_Specifications =>
- Params);
+ Defining_Unit_Name => Def_Id,
+ Parameter_Specifications => Params);
end Make_Disp_Timed_Select_Spec;
+ -------------
+ -- Make_DT --
+ -------------
+
+ function Make_DT (Typ : Entity_Id) return List_Id is
+ Loc : constant Source_Ptr := Sloc (Typ);
+ Result : constant List_Id := New_List;
+ Elab_Code : constant List_Id := New_List;
+
+ Tname : constant Name_Id := Chars (Typ);
+ Name_DT : constant Name_Id := New_External_Name (Tname, 'T');
+ Name_DT_Ptr : constant Name_Id := New_External_Name (Tname, 'P');
+ Name_SSD : constant Name_Id := New_External_Name (Tname, 'S');
+ Name_TSD : constant Name_Id := New_External_Name (Tname, 'B');
+ Name_Exname : constant Name_Id := New_External_Name (Tname, 'E');
+ Name_No_Reg : constant Name_Id := New_External_Name (Tname, 'F');
+
+ DT : constant Node_Id := Make_Defining_Identifier (Loc, Name_DT);
+ DT_Ptr : constant Node_Id := Make_Defining_Identifier (Loc, Name_DT_Ptr);
+ SSD : constant Node_Id := Make_Defining_Identifier (Loc, Name_SSD);
+ TSD : constant Node_Id := Make_Defining_Identifier (Loc, Name_TSD);
+ Exname : constant Node_Id := Make_Defining_Identifier (Loc, Name_Exname);
+ No_Reg : constant Node_Id := Make_Defining_Identifier (Loc, Name_No_Reg);
+
+ Generalized_Tag : constant Entity_Id := RTE (RE_Tag);
+ I_Depth : Int;
+ Size_Expr_Node : Node_Id;
+ Old_Tag1 : Node_Id;
+ Old_Tag2 : Node_Id;
+ Num_Ifaces : Int;
+ Nb_Prim : Int;
+ TSD_Num_Entries : Int;
+ Typ_Copy : constant Entity_Id := New_Copy (Typ);
+ AI : Elmt_Id;
+
+ begin
+ if not RTE_Available (RE_Tag) then
+ Error_Msg_CRT ("tagged types", Typ);
+ return New_List;
+ end if;
+
+ -- Collect full list of directly and indirectly implemented interfaces
+
+ Set_Parent (Typ_Copy, Parent (Typ));
+ Set_Abstract_Interfaces (Typ_Copy, New_Elmt_List);
+ Collect_All_Interfaces (Typ_Copy);
+
+ -- Calculate the size of the DT and the TSD
+
+ if Is_Interface (Typ) then
+ -- Abstract interfaces need neither the DT nor the ancestors table.
+ -- We reserve a single entry for its DT because at run-time the
+ -- pointer to this dummy DT is the tag of this abstract interface
+ -- type.
+
+ Nb_Prim := 1;
+ TSD_Num_Entries := 0;
+
+ else
+ -- Calculate the number of entries for the table of interfaces
+
+ Num_Ifaces := 0;
+ AI := First_Elmt (Abstract_Interfaces (Typ_Copy));
+ while Present (AI) loop
+ Num_Ifaces := Num_Ifaces + 1;
+ Next_Elmt (AI);
+ end loop;
+
+ -- Count ancestors to compute the inheritance depth. For private
+ -- extensions, always go to the full view in order to compute the
+ -- real inheritance depth.
+
+ declare
+ Parent_Type : Entity_Id := Typ;
+ P : Entity_Id;
+
+ begin
+ I_Depth := 0;
+ loop
+ P := Etype (Parent_Type);
+
+ if Is_Private_Type (P) then
+ P := Full_View (Base_Type (P));
+ end if;
+
+ exit when P = Parent_Type;
+
+ I_Depth := I_Depth + 1;
+ Parent_Type := P;
+ end loop;
+ end;
+
+ TSD_Num_Entries := I_Depth + Num_Ifaces + 1;
+ Nb_Prim := UI_To_Int (DT_Entry_Count (First_Tag_Component (Typ)));
+
+ -- If the number of primitives of Typ is less that the number of
+ -- predefined primitives, we must reserve at least enough space
+ -- for the predefined primitives.
+
+ if Nb_Prim < Default_Prim_Op_Count then
+ Nb_Prim := Default_Prim_Op_Count;
+ end if;
+ end if;
+
+ -- Dispatch table and related entities are allocated statically
+
+ Set_Ekind (DT, E_Variable);
+ Set_Is_Statically_Allocated (DT);
+
+ Set_Ekind (DT_Ptr, E_Variable);
+ Set_Is_Statically_Allocated (DT_Ptr);
+
+ Set_Ekind (SSD, E_Variable);
+ Set_Is_Statically_Allocated (SSD);
+
+ Set_Ekind (TSD, E_Variable);
+ Set_Is_Statically_Allocated (TSD);
+
+ Set_Ekind (Exname, E_Variable);
+ Set_Is_Statically_Allocated (Exname);
+
+ Set_Ekind (No_Reg, E_Variable);
+ Set_Is_Statically_Allocated (No_Reg);
+
+ -- Generate code to create the storage for the Dispatch_Table object:
+
+ -- DT : Storage_Array (1..DT_Prologue_Size+nb_prim*DT_Entry_Size);
+ -- for DT'Alignment use Address'Alignment
+
+ Size_Expr_Node :=
+ Make_Op_Add (Loc,
+ Left_Opnd => Make_DT_Access_Action (Typ, DT_Prologue_Size, No_List),
+ Right_Opnd =>
+ Make_Op_Multiply (Loc,
+ Left_Opnd =>
+ Make_DT_Access_Action (Typ, DT_Entry_Size, No_List),
+ Right_Opnd =>
+ Make_Integer_Literal (Loc, Nb_Prim)));
+
+ Append_To (Result,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => DT,
+ Aliased_Present => True,
+ Object_Definition =>
+ Make_Subtype_Indication (Loc,
+ Subtype_Mark => New_Reference_To
+ (RTE (RE_Storage_Array), Loc),
+ Constraint => Make_Index_Or_Discriminant_Constraint (Loc,
+ Constraints => New_List (
+ Make_Range (Loc,
+ Low_Bound => Make_Integer_Literal (Loc, 1),
+ High_Bound => Size_Expr_Node))))));
+
+ Append_To (Result,
+ Make_Attribute_Definition_Clause (Loc,
+ Name => New_Reference_To (DT, Loc),
+ Chars => Name_Alignment,
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (RTE (RE_Integer_Address), Loc),
+ Attribute_Name => Name_Alignment)));
+
+ -- Initialize the signature of the interface tag. It is a sequence
+ -- two bytes located in the header of the dispatch table.
+
+ Append_To (Result,
+ Make_Assignment_Statement (Loc,
+ Name =>
+ Make_Indexed_Component (Loc,
+ Prefix => New_Occurrence_Of (DT, Loc),
+ Expressions => New_List (
+ Make_Integer_Literal (Loc, Uint_1))),
+ Expression =>
+ Unchecked_Convert_To (RTE (RE_Storage_Element),
+ New_Reference_To (RTE (RE_Valid_Signature), Loc))));
+
+ if not Is_Interface (Typ) then
+
+ -- The signature of a Primary Dispatch table is:
+ -- (Valid_Signature, Primary_DT)
+
+ Append_To (Result,
+ Make_Assignment_Statement (Loc,
+ Name =>
+ Make_Indexed_Component (Loc,
+ Prefix => New_Occurrence_Of (DT, Loc),
+ Expressions => New_List (
+ Make_Integer_Literal (Loc, Uint_2))),
+ Expression =>
+ Unchecked_Convert_To (RTE (RE_Storage_Element),
+ New_Reference_To (RTE (RE_Primary_DT), Loc))));
+
+ else
+ -- The signature of an abstract interface is:
+ -- (Valid_Signature, Abstract_Interface)
+
+ Append_To (Result,
+ Make_Assignment_Statement (Loc,
+ Name =>
+ Make_Indexed_Component (Loc,
+ Prefix => New_Occurrence_Of (DT, Loc),
+ Expressions => New_List (
+ Make_Integer_Literal (Loc, Uint_2))),
+ Expression =>
+ Unchecked_Convert_To (RTE (RE_Storage_Element),
+ New_Reference_To (RTE (RE_Abstract_Interface), Loc))));
+ end if;
+
+ -- Generate code to create the pointer to the dispatch table
+
+ -- DT_Ptr : Tag := Tag!(DT'Address);
+
+ -- According to the C++ ABI, the base of the vtable is located after a
+ -- prologue containing Offset_To_Top, and Typeinfo_Ptr. Hence, we move
+ -- down the pointer to the real base of the vtable
+
+ Append_To (Result,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => DT_Ptr,
+ Constant_Present => True,
+ Object_Definition => New_Reference_To (Generalized_Tag, Loc),
+ Expression =>
+ Unchecked_Convert_To (Generalized_Tag,
+ Make_Op_Add (Loc,
+ Left_Opnd =>
+ Unchecked_Convert_To (RTE (RE_Storage_Offset),
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (DT, Loc),
+ Attribute_Name => Name_Address)),
+ Right_Opnd =>
+ Make_DT_Access_Action (Typ,
+ DT_Prologue_Size, No_List)))));
+
+ -- Generate code to define the boolean that controls registration, in
+ -- order to avoid multiple registrations for tagged types defined in
+ -- multiple-called scopes.
+
+ Append_To (Result,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => No_Reg,
+ Object_Definition => New_Reference_To (Standard_Boolean, Loc),
+ Expression => New_Reference_To (Standard_True, Loc)));
+
+ -- Set Access_Disp_Table field to be the dispatch table pointer
+
+ if not Present (Access_Disp_Table (Typ)) then
+ Set_Access_Disp_Table (Typ, New_Elmt_List);
+ end if;
+
+ Prepend_Elmt (DT_Ptr, Access_Disp_Table (Typ));
+
+ -- Generate code to create the storage for the type specific data object
+ -- with enough space to store the tags of the ancestors plus the tags
+ -- of all the implemented interfaces (as described in a-tags.adb).
+
+ -- TSD: Storage_Array
+ -- (1..TSD_Prologue_Size+TSD_Num_Entries*TSD_Entry_Size);
+ -- for TSD'Alignment use Address'Alignment
+
+ Size_Expr_Node :=
+ Make_Op_Add (Loc,
+ Left_Opnd =>
+ Make_DT_Access_Action (Typ, TSD_Prologue_Size, No_List),
+ Right_Opnd =>
+ Make_Op_Multiply (Loc,
+ Left_Opnd =>
+ Make_DT_Access_Action (Typ, TSD_Entry_Size, No_List),
+ Right_Opnd =>
+ Make_Integer_Literal (Loc, TSD_Num_Entries)));
+
+ Append_To (Result,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => TSD,
+ Aliased_Present => True,
+ Object_Definition =>
+ Make_Subtype_Indication (Loc,
+ Subtype_Mark => New_Reference_To (RTE (RE_Storage_Array), Loc),
+ Constraint => Make_Index_Or_Discriminant_Constraint (Loc,
+ Constraints => New_List (
+ Make_Range (Loc,
+ Low_Bound => Make_Integer_Literal (Loc, 1),
+ High_Bound => Size_Expr_Node))))));
+
+ Append_To (Result,
+ Make_Attribute_Definition_Clause (Loc,
+ Name => New_Reference_To (TSD, Loc),
+ Chars => Name_Alignment,
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (RTE (RE_Integer_Address), Loc),
+ Attribute_Name => Name_Alignment)));
+
+ -- Generate code to put the Address of the TSD in the dispatch table
+ -- Set_TSD (DT_Ptr, TSD);
+
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Set_TSD,
+ Args => New_List (
+ New_Reference_To (DT_Ptr, Loc), -- DTptr
+ Make_Attribute_Reference (Loc, -- Value
+ Prefix => New_Reference_To (TSD, Loc),
+ Attribute_Name => Name_Address))));
+
+ -- Generate:
+ -- Set_Num_Prim_Ops (T'Tag, Nb_Prim)
+
+ if not Is_Interface (Typ) then
+ Append_To (Elab_Code,
+ Make_Procedure_Call_Statement (Loc,
+ Name => New_Reference_To (RTE (RE_Set_Num_Prim_Ops), Loc),
+ Parameter_Associations => New_List (
+ New_Reference_To (DT_Ptr, Loc),
+ Make_Integer_Literal (Loc, Nb_Prim))));
+ end if;
+
+ if Ada_Version >= Ada_05
+ and then not Is_Interface (Typ)
+ and then not Is_Abstract (Typ)
+ and then not Is_Controlled (Typ)
+ and then Implements_Interface (
+ Typ => Typ,
+ Kind => Any_Limited_Interface,
+ Check_Parent => True)
+ and then (Nb_Prim - Default_Prim_Op_Count) > 0
+ then
+ -- Generate the Select Specific Data table for tagged types that
+ -- implement a synchronized interface. The size of the table is
+ -- constrained by the number of non-predefined primitive operations.
+
+ Append_To (Result,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => SSD,
+ Aliased_Present => True,
+ Object_Definition =>
+ Make_Subtype_Indication (Loc,
+ Subtype_Mark => New_Reference_To (
+ RTE (RE_Select_Specific_Data), Loc),
+ Constraint => Make_Index_Or_Discriminant_Constraint (Loc,
+ Constraints => New_List (
+ Make_Integer_Literal (Loc,
+ Nb_Prim - Default_Prim_Op_Count))))));
+
+ -- Set the pointer to the Select Specific Data table in the TSD
+
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Set_SSD,
+ Args => New_List (
+ New_Reference_To (DT_Ptr, Loc), -- DTptr
+ Make_Attribute_Reference (Loc, -- Value
+ Prefix => New_Reference_To (SSD, Loc),
+ Attribute_Name => Name_Address))));
+ end if;
+
+ -- Generate: Exname : constant String := full_qualified_name (typ);
+ -- The type itself may be an anonymous parent type, so use the first
+ -- subtype to have a user-recognizable name.
+
+ Append_To (Result,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Exname,
+ Constant_Present => True,
+ Object_Definition => New_Reference_To (Standard_String, Loc),
+ Expression =>
+ Make_String_Literal (Loc,
+ Full_Qualified_Name (First_Subtype (Typ)))));
+
+ -- Generate: Set_Expanded_Name (DT_Ptr, exname'Address);
+
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Set_Expanded_Name,
+ Args => New_List (
+ Node1 => New_Reference_To (DT_Ptr, Loc),
+ Node2 =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (Exname, Loc),
+ Attribute_Name => Name_Address))));
+
+ if not Is_Interface (Typ) then
+ -- Generate: Set_Access_Level (DT_Ptr, <type's accessibility level>);
+
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Set_Access_Level,
+ Args => New_List (
+ Node1 => New_Reference_To (DT_Ptr, Loc),
+ Node2 => Make_Integer_Literal (Loc, Type_Access_Level (Typ)))));
+ end if;
+
+ if Typ = Etype (Typ)
+ or else Is_CPP_Class (Etype (Typ))
+ or else Is_Interface (Typ)
+ then
+ Old_Tag1 :=
+ Unchecked_Convert_To (Generalized_Tag,
+ Make_Integer_Literal (Loc, 0));
+ Old_Tag2 :=
+ Unchecked_Convert_To (Generalized_Tag,
+ Make_Integer_Literal (Loc, 0));
+
+ else
+ Old_Tag1 :=
+ New_Reference_To
+ (Node (First_Elmt (Access_Disp_Table (Etype (Typ)))), Loc);
+ Old_Tag2 :=
+ New_Reference_To
+ (Node (First_Elmt (Access_Disp_Table (Etype (Typ)))), Loc);
+ end if;
+
+ if Typ /= Etype (Typ)
+ and then not Is_Interface (Typ)
+ then
+ -- Generate: Inherit_DT (parent'tag, DT_Ptr, nb_prim of parent);
+
+ if not Is_Interface (Etype (Typ)) then
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Inherit_DT,
+ Args => New_List (
+ Node1 => Old_Tag1,
+ Node2 => New_Reference_To (DT_Ptr, Loc),
+ Node3 =>
+ Make_Integer_Literal (Loc,
+ DT_Entry_Count (First_Tag_Component (Etype (Typ)))))));
+ end if;
+
+ -- Inherit the secondary dispatch tables of the ancestor
+
+ if not Is_CPP_Class (Etype (Typ)) then
+ declare
+ Sec_DT_Ancestor : Elmt_Id :=
+ Next_Elmt
+ (First_Elmt
+ (Access_Disp_Table (Etype (Typ))));
+ Sec_DT_Typ : Elmt_Id :=
+ Next_Elmt
+ (First_Elmt
+ (Access_Disp_Table (Typ)));
+
+ procedure Copy_Secondary_DTs (Typ : Entity_Id);
+ -- Local procedure required to climb through the ancestors and
+ -- copy the contents of all their secondary dispatch tables.
+
+ ------------------------
+ -- Copy_Secondary_DTs --
+ ------------------------
+
+ procedure Copy_Secondary_DTs (Typ : Entity_Id) is
+ E : Entity_Id;
+ Iface : Elmt_Id;
+
+ begin
+ -- Climb to the ancestor (if any) handling private types
+
+ if Present (Full_View (Etype (Typ))) then
+ if Full_View (Etype (Typ)) /= Typ then
+ Copy_Secondary_DTs (Full_View (Etype (Typ)));
+ end if;
+
+ elsif Etype (Typ) /= Typ then
+ Copy_Secondary_DTs (Etype (Typ));
+ end if;
+
+ if Present (Abstract_Interfaces (Typ))
+ and then not Is_Empty_Elmt_List
+ (Abstract_Interfaces (Typ))
+ then
+ Iface := First_Elmt (Abstract_Interfaces (Typ));
+ E := First_Entity (Typ);
+
+ while Present (E)
+ and then Present (Node (Sec_DT_Ancestor))
+ loop
+ if Is_Tag (E) and then Chars (E) /= Name_uTag then
+ if not Is_Interface (Etype (Typ)) then
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Inherit_DT,
+ Args => New_List (
+ Node1 => Unchecked_Convert_To
+ (RTE (RE_Tag),
+ New_Reference_To
+ (Node (Sec_DT_Ancestor),
+ Loc)),
+ Node2 => Unchecked_Convert_To
+ (RTE (RE_Tag),
+ New_Reference_To
+ (Node (Sec_DT_Typ), Loc)),
+ Node3 => Make_Integer_Literal (Loc,
+ DT_Entry_Count (E)))));
+ end if;
+
+ Next_Elmt (Sec_DT_Ancestor);
+ Next_Elmt (Sec_DT_Typ);
+ Next_Elmt (Iface);
+ end if;
+
+ Next_Entity (E);
+ end loop;
+ end if;
+ end Copy_Secondary_DTs;
+
+ begin
+ if Present (Node (Sec_DT_Ancestor)) then
+
+ -- Handle private types
+
+ if Present (Full_View (Typ)) then
+ Copy_Secondary_DTs (Full_View (Typ));
+ else
+ Copy_Secondary_DTs (Typ);
+ end if;
+ end if;
+ end;
+ end if;
+ end if;
+
+ -- Generate:
+ -- Inherit_TSD (parent'tag, DT_Ptr);
+
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Inherit_TSD,
+ Args => New_List (
+ Node1 => Old_Tag2,
+ Node2 => New_Reference_To (DT_Ptr, Loc))));
+
+ -- For types with no controlled components, generate:
+ -- Set_RC_Offset (DT_Ptr, 0);
+
+ -- For simple types with controlled components, generate:
+ -- Set_RC_Offset (DT_Ptr, type._record_controller'position);
+
+ -- For complex types with controlled components where the position
+ -- of the record controller is not statically computable, if there are
+ -- controlled components at this level, generate:
+ -- Set_RC_Offset (DT_Ptr, -1);
+ -- to indicate that the _controller field is right after the _parent
+
+ -- Or if there are no controlled components at this level, generate:
+ -- Set_RC_Offset (DT_Ptr, -2);
+ -- to indicate that we need to get the position from the parent.
+
+ if not Is_Interface (Typ) then
+ declare
+ Position : Node_Id;
+
+ begin
+ if not Has_Controlled_Component (Typ) then
+ Position := Make_Integer_Literal (Loc, 0);
+
+ elsif Etype (Typ) /= Typ
+ and then Has_Discriminants (Etype (Typ))
+ then
+ if Has_New_Controlled_Component (Typ) then
+ Position := Make_Integer_Literal (Loc, -1);
+ else
+ Position := Make_Integer_Literal (Loc, -2);
+ end if;
+ else
+ Position :=
+ Make_Attribute_Reference (Loc,
+ Prefix =>
+ Make_Selected_Component (Loc,
+ Prefix => New_Reference_To (Typ, Loc),
+ Selector_Name =>
+ New_Reference_To (Controller_Component (Typ), Loc)),
+ Attribute_Name => Name_Position);
+
+ -- This is not proper Ada code to use the attribute 'Position
+ -- on something else than an object but this is supported by
+ -- the back end (see comment on the Bit_Component attribute in
+ -- sem_attr). So we avoid semantic checking here.
+
+ -- Is this documented in sinfo.ads??? it should be!
+
+ Set_Analyzed (Position);
+ Set_Etype (Prefix (Position), RTE (RE_Record_Controller));
+ Set_Etype (Prefix (Prefix (Position)), Typ);
+ Set_Etype (Selector_Name (Prefix (Position)),
+ RTE (RE_Record_Controller));
+ Set_Etype (Position, RTE (RE_Storage_Offset));
+ end if;
+
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Set_RC_Offset,
+ Args => New_List (
+ Node1 => New_Reference_To (DT_Ptr, Loc),
+ Node2 => Position)));
+ end;
+
+ -- Generate: Set_Remotely_Callable (DT_Ptr, Status); where Status is
+ -- described in E.4 (18)
+
+ declare
+ Status : Entity_Id;
+
+ begin
+ Status :=
+ Boolean_Literals
+ (Is_Pure (Typ)
+ or else Is_Shared_Passive (Typ)
+ or else
+ ((Is_Remote_Types (Typ)
+ or else Is_Remote_Call_Interface (Typ))
+ and then Original_View_In_Visible_Part (Typ))
+ or else not Comes_From_Source (Typ));
+
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Set_Remotely_Callable,
+ Args => New_List (
+ New_Occurrence_Of (DT_Ptr, Loc),
+ New_Occurrence_Of (Status, Loc))));
+ end;
+
+ -- Generate:
+ -- Set_Offset_To_Top (DT_Ptr, 0);
+
+ Append_To (Elab_Code,
+ Make_Procedure_Call_Statement (Loc,
+ Name => New_Reference_To (RTE (RE_Set_Offset_To_Top), Loc),
+ Parameter_Associations => New_List (
+ New_Reference_To (DT_Ptr, Loc),
+ Make_Integer_Literal (Loc, Uint_0))));
+ end if;
+
+ -- Generate: Set_External_Tag (DT_Ptr, exname'Address);
+ -- Should be the external name not the qualified name???
+
+ if not Has_External_Tag_Rep_Clause (Typ) then
+ Append_To (Elab_Code,
+ Make_DT_Access_Action (Typ,
+ Action => Set_External_Tag,
+ Args => New_List (
+ Node1 => New_Reference_To (DT_Ptr, Loc),
+ Node2 =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (Exname, Loc),
+ Attribute_Name => Name_Address))));
+
+ -- Generate code to register the Tag in the External_Tag hash
+ -- table for the pure Ada type only.
+
+ -- Register_Tag (Dt_Ptr);
+
+ -- Skip this if routine not available, or in No_Run_Time mode
+ -- or Typ is an abstract interface type (because the table to
+ -- register it is not available in the abstract type but in
+ -- types implementing this interface)
+
+ if not No_Run_Time_Mode
+ and then RTE_Available (RE_Register_Tag)
+ and then Is_RTE (Generalized_Tag, RE_Tag)
+ and then not Is_Interface (Typ)
+ then
+ Append_To (Elab_Code,
+ Make_Procedure_Call_Statement (Loc,
+ Name => New_Reference_To (RTE (RE_Register_Tag), Loc),
+ Parameter_Associations =>
+ New_List (New_Reference_To (DT_Ptr, Loc))));
+ end if;
+ end if;
+
+ -- Generate:
+ -- if No_Reg then
+ -- <elab_code>
+ -- No_Reg := False;
+ -- end if;
+
+ Append_To (Elab_Code,
+ Make_Assignment_Statement (Loc,
+ Name => New_Reference_To (No_Reg, Loc),
+ Expression => New_Reference_To (Standard_False, Loc)));
+
+ Append_To (Result,
+ Make_Implicit_If_Statement (Typ,
+ Condition => New_Reference_To (No_Reg, Loc),
+ Then_Statements => Elab_Code));
+
+ -- Ada 2005 (AI-251): Register the tag of the interfaces into
+ -- the table of implemented interfaces and ...
+
+ if not Is_Interface (Typ)
+ and then Present (Abstract_Interfaces (Typ_Copy))
+ and then not Is_Empty_Elmt_List (Abstract_Interfaces (Typ_Copy))
+ then
+ AI := First_Elmt (Abstract_Interfaces (Typ_Copy));
+ while Present (AI) loop
+
+ -- Generate:
+ -- Register_Interface (DT_Ptr, Interface'Tag);
+
+ Append_To (Result,
+ Make_DT_Access_Action (Typ,
+ Action => Register_Interface_Tag,
+ Args => New_List (
+ Node1 => New_Reference_To (DT_Ptr, Loc),
+ Node2 => New_Reference_To
+ (Node
+ (First_Elmt
+ (Access_Disp_Table (Node (AI)))),
+ Loc))));
+
+ Next_Elmt (AI);
+ end loop;
+ end if;
+
+ return Result;
+ end Make_DT;
+
+ ---------------------------
+ -- Make_DT_Access_Action --
+ ---------------------------
+
+ function Make_DT_Access_Action
+ (Typ : Entity_Id;
+ Action : DT_Access_Action;
+ Args : List_Id) return Node_Id
+ is
+ Action_Name : constant Entity_Id := RTE (Ada_Actions (Action));
+ Loc : Source_Ptr;
+
+ begin
+ if No (Args) then
+
+ -- This is a constant
+
+ return New_Reference_To (Action_Name, Sloc (Typ));
+ end if;
+
+ pragma Assert (List_Length (Args) = Action_Nb_Arg (Action));
+
+ Loc := Sloc (First (Args));
+
+ if Action_Is_Proc (Action) then
+ return
+ Make_Procedure_Call_Statement (Loc,
+ Name => New_Reference_To (Action_Name, Loc),
+ Parameter_Associations => Args);
+
+ else
+ return
+ Make_Function_Call (Loc,
+ Name => New_Reference_To (Action_Name, Loc),
+ Parameter_Associations => Args);
+ end if;
+ end Make_DT_Access_Action;
+
+ -----------------------
+ -- Make_Secondary_DT --
+ -----------------------
+
+ procedure Make_Secondary_DT
+ (Typ : Entity_Id;
+ Ancestor_Typ : Entity_Id;
+ Suffix_Index : Int;
+ Iface : Entity_Id;
+ AI_Tag : Entity_Id;
+ Acc_Disp_Tables : in out Elist_Id;
+ Result : out List_Id)
+ is
+ Loc : constant Source_Ptr := Sloc (AI_Tag);
+ Generalized_Tag : constant Entity_Id := RTE (RE_Interface_Tag);
+ Name_DT : constant Name_Id := New_Internal_Name ('T');
+ Iface_DT : Node_Id;
+ Iface_DT_Ptr : Node_Id;
+ Name_DT_Ptr : Name_Id;
+ Nb_Prim : Int;
+ OSD : Entity_Id;
+ Size_Expr_Node : Node_Id;
+ Tname : Name_Id;
+
+ begin
+ Result := New_List;
+
+ -- Generate a unique external name associated with the secondary
+ -- dispatch table. This external name will be used to declare an
+ -- access to this secondary dispatch table, value that will be used
+ -- for the elaboration of Typ's objects and also for the elaboration
+ -- of objects of any derivation of Typ that do not override any
+ -- primitive operation of Typ.
+
+ Get_Secondary_DT_External_Name (Typ, Ancestor_Typ, Suffix_Index);
+
+ Tname := Name_Find;
+ Name_DT_Ptr := New_External_Name (Tname, "P");
+ Iface_DT := Make_Defining_Identifier (Loc, Name_DT);
+ Iface_DT_Ptr := Make_Defining_Identifier (Loc, Name_DT_Ptr);
+
+ -- Dispatch table and related entities are allocated statically
+
+ Set_Ekind (Iface_DT, E_Variable);
+ Set_Is_Statically_Allocated (Iface_DT);
+
+ Set_Ekind (Iface_DT_Ptr, E_Variable);
+ Set_Is_Statically_Allocated (Iface_DT_Ptr);
+
+ -- Generate code to create the storage for the Dispatch_Table object.
+ -- If the number of primitives of Typ is less that the number of
+ -- predefined primitives, we must reserve at least enough space
+ -- for the predefined primitives.
+
+ Nb_Prim := UI_To_Int (DT_Entry_Count (AI_Tag));
+
+ if Nb_Prim < Default_Prim_Op_Count then
+ Nb_Prim := Default_Prim_Op_Count;
+ end if;
+
+ -- DT : Storage_Array (1..DT_Prologue_Size+nb_prim*DT_Entry_Size);
+ -- for DT'Alignment use Address'Alignment
+
+ Size_Expr_Node :=
+ Make_Op_Add (Loc,
+ Left_Opnd => Make_DT_Access_Action (Etype (AI_Tag),
+ DT_Prologue_Size,
+ No_List),
+ Right_Opnd =>
+ Make_Op_Multiply (Loc,
+ Left_Opnd =>
+ Make_DT_Access_Action (Etype (AI_Tag),
+ DT_Entry_Size,
+ No_List),
+ Right_Opnd =>
+ Make_Integer_Literal (Loc, Nb_Prim)));
+
+ Append_To (Result,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Iface_DT,
+ Aliased_Present => True,
+ Object_Definition =>
+ Make_Subtype_Indication (Loc,
+ Subtype_Mark => New_Reference_To (RTE (RE_Storage_Array), Loc),
+ Constraint => Make_Index_Or_Discriminant_Constraint (Loc,
+ Constraints => New_List (
+ Make_Range (Loc,
+ Low_Bound => Make_Integer_Literal (Loc, 1),
+ High_Bound => Size_Expr_Node))))));
+
+ Append_To (Result,
+ Make_Attribute_Definition_Clause (Loc,
+ Name => New_Reference_To (Iface_DT, Loc),
+ Chars => Name_Alignment,
+ Expression =>
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (RTE (RE_Integer_Address), Loc),
+ Attribute_Name => Name_Alignment)));
+
+ -- Initialize the signature of the interface tag. It is a sequence of
+ -- two bytes located in the header of the dispatch table. The signature
+ -- of a Secondary Dispatch Table is (Valid_Signature, Secondary_DT).
+
+ Append_To (Result,
+ Make_Assignment_Statement (Loc,
+ Name =>
+ Make_Indexed_Component (Loc,
+ Prefix => New_Occurrence_Of (Iface_DT, Loc),
+ Expressions => New_List (
+ Make_Integer_Literal (Loc, Uint_1))),
+ Expression =>
+ Unchecked_Convert_To (RTE (RE_Storage_Element),
+ New_Reference_To (RTE (RE_Valid_Signature), Loc))));
+
+ Append_To (Result,
+ Make_Assignment_Statement (Loc,
+ Name =>
+ Make_Indexed_Component (Loc,
+ Prefix => New_Occurrence_Of (Iface_DT, Loc),
+ Expressions => New_List (
+ Make_Integer_Literal (Loc, Uint_2))),
+ Expression =>
+ Unchecked_Convert_To (RTE (RE_Storage_Element),
+ New_Reference_To (RTE (RE_Secondary_DT), Loc))));
+
+ -- Generate code to create the pointer to the dispatch table
+
+ -- Iface_DT_Ptr : Tag := Tag!(DT'Address);
+
+ -- According to the C++ ABI, the base of the vtable is located
+ -- after the following prologue: Offset_To_Top, and Typeinfo_Ptr.
+ -- Hence, move the pointer down to the real base of the vtable.
+
+ Append_To (Result,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Iface_DT_Ptr,
+ Constant_Present => True,
+ Object_Definition => New_Reference_To (Generalized_Tag, Loc),
+ Expression =>
+ Unchecked_Convert_To (Generalized_Tag,
+ Make_Op_Add (Loc,
+ Left_Opnd =>
+ Unchecked_Convert_To (RTE (RE_Storage_Offset),
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (Iface_DT, Loc),
+ Attribute_Name => Name_Address)),
+ Right_Opnd =>
+ Make_DT_Access_Action (Etype (AI_Tag),
+ DT_Prologue_Size, No_List)))));
+
+ -- Note: Offset_To_Top will be initialized by the init subprogram
+
+ -- Set Access_Disp_Table field to be the dispatch table pointer
+
+ if not (Present (Acc_Disp_Tables)) then
+ Acc_Disp_Tables := New_Elmt_List;
+ end if;
+
+ Append_Elmt (Iface_DT_Ptr, Acc_Disp_Tables);
+
+ -- Step 1: Generate an Object Specific Data (OSD) table
+
+ OSD := Make_Defining_Identifier (Loc, New_Internal_Name ('I'));
+
+ -- Generate:
+ -- OSD : Ada.Tags.Object_Specific_Data
+ -- (Nb_Prims - Default_Prim_Op_Count);
+ -- where the constraint is used to allocate space for the
+ -- non-predefined primitive operations only.
+
+ Append_To (Result,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => OSD,
+ Object_Definition =>
+ Make_Subtype_Indication (Loc,
+ Subtype_Mark => New_Reference_To (
+ RTE (RE_Object_Specific_Data), Loc),
+ Constraint =>
+ Make_Index_Or_Discriminant_Constraint (Loc,
+ Constraints => New_List (
+ Make_Integer_Literal (Loc,
+ Nb_Prim - Default_Prim_Op_Count))))));
+
+ -- Generate:
+ -- Ada.Tags.Set_OSD (Iface_DT_Ptr, OSD);
+
+ Append_To (Result,
+ Make_DT_Access_Action (Typ,
+ Action => Set_OSD,
+ Args => New_List (
+ New_Reference_To (Iface_DT_Ptr, Loc),
+ Make_Attribute_Reference (Loc,
+ Prefix => New_Reference_To (OSD, Loc),
+ Attribute_Name => Name_Address))));
+
+ -- Offset table creation
+
+ if not Is_Interface (Typ)
+ and then not Is_Abstract (Typ)
+ and then not Is_Controlled (Typ)
+ and then Implements_Interface
+ (Typ => Typ,
+ Kind => Any_Limited_Interface,
+ Check_Parent => True)
+ and then (Nb_Prim - Default_Prim_Op_Count) > 0
+ then
+ declare
+ Prim : Entity_Id;
+ Prim_Alias : Entity_Id;
+ Prim_Elmt : Elmt_Id;
+
+ begin
+ -- Step 2: Populate the OSD table
+
+ Prim_Alias := Empty;
+ Prim_Elmt := First_Elmt (Primitive_Operations (Typ));
+ while Present (Prim_Elmt) loop
+ Prim := Node (Prim_Elmt);
+
+ if Present (Abstract_Interface_Alias (Prim)) then
+ Prim_Alias := Abstract_Interface_Alias (Prim);
+ end if;
+
+ if Present (Prim_Alias)
+ and then Present (First_Entity (Prim_Alias))
+ and then Etype (First_Entity (Prim_Alias)) = Iface
+ then
+ -- Generate:
+ -- Ada.Tags.Set_Offset_Index (
+ -- Iface_DT_Ptr, secondary_DT_Pos, primary_DT_pos);
+
+ Append_To (Result,
+ Make_DT_Access_Action (Iface,
+ Action => Set_Offset_Index,
+ Args => New_List (
+ New_Reference_To (Iface_DT_Ptr, Loc),
+ Make_Integer_Literal (Loc, DT_Position (Prim_Alias)),
+ Make_Integer_Literal (Loc, DT_Position (Prim)))));
+
+ Prim_Alias := Empty;
+ end if;
+
+ Next_Elmt (Prim_Elmt);
+ end loop;
+ end;
+ end if;
+
+ -- Generate:
+ -- Set_Num_Prim_Ops (T'Tag, Nb_Prim)
+
+ Append_To (Result,
+ Make_Procedure_Call_Statement (Loc,
+ Name => New_Reference_To (RTE (RE_Set_Num_Prim_Ops), Loc),
+ Parameter_Associations => New_List (
+ Unchecked_Convert_To (RTE (RE_Tag),
+ New_Reference_To (Iface_DT_Ptr, Loc)),
+ Make_Integer_Literal (Loc, Nb_Prim))));
+
+ end Make_Secondary_DT;
+
+ -------------------------------------
+ -- Make_Select_Specific_Data_Table --
+ -------------------------------------
+
+ function Make_Select_Specific_Data_Table
+ (Typ : Entity_Id) return List_Id
+ is
+ Assignments : constant List_Id := New_List;
+ Loc : constant Source_Ptr := Sloc (Typ);
+
+ Conc_Typ : Entity_Id;
+ Decls : List_Id;
+ DT_Ptr : Entity_Id;
+ Prim : Entity_Id;
+ Prim_Als : Entity_Id;
+ Prim_Elmt : Elmt_Id;
+ Prim_Pos : Uint;
+ Nb_Prim : Int := 0;
+
+ type Examined_Array is array (Int range <>) of Boolean;
+
+ function Find_Entry_Index (E : Entity_Id) return Uint;
+ -- Given an entry, find its index in the visible declarations of the
+ -- corresponding concurrent type of Typ.
+
+ ----------------------
+ -- Find_Entry_Index --
+ ----------------------
+
+ function Find_Entry_Index (E : Entity_Id) return Uint is
+ Index : Uint := Uint_1;
+ Subp_Decl : Entity_Id;
+
+ begin
+ if Present (Decls)
+ and then not Is_Empty_List (Decls)
+ then
+ Subp_Decl := First (Decls);
+ while Present (Subp_Decl) loop
+ if Nkind (Subp_Decl) = N_Entry_Declaration then
+ if Defining_Identifier (Subp_Decl) = E then
+ return Index;
+ end if;
+
+ Index := Index + 1;
+ end if;
+
+ Next (Subp_Decl);
+ end loop;
+ end if;
+
+ return Uint_0;
+ end Find_Entry_Index;
+
+ -- Start of processing for Make_Select_Specific_Data_Table
+
+ begin
+ DT_Ptr := Node (First_Elmt (Access_Disp_Table (Typ)));
+
+ if Present (Corresponding_Concurrent_Type (Typ)) then
+ Conc_Typ := Corresponding_Concurrent_Type (Typ);
+
+ if Ekind (Conc_Typ) = E_Protected_Type then
+ Decls := Visible_Declarations (Protected_Definition (
+ Parent (Conc_Typ)));
+ else
+ pragma Assert (Ekind (Conc_Typ) = E_Task_Type);
+ Decls := Visible_Declarations (Task_Definition (
+ Parent (Conc_Typ)));
+ end if;
+ end if;
+
+ -- Count the non-predefined primitive operations
+
+ Prim_Elmt := First_Elmt (Primitive_Operations (Typ));
+ while Present (Prim_Elmt) loop
+ if not Is_Predefined_Dispatching_Operation (Node (Prim_Elmt)) then
+ Nb_Prim := Nb_Prim + 1;
+ end if;
+
+ Next_Elmt (Prim_Elmt);
+ end loop;
+
+ declare
+ Examined_Size : constant Int := Nb_Prim + Default_Prim_Op_Count;
+ Examined : Examined_Array (1 .. Examined_Size) := (others => False);
+
+ begin
+ Prim_Elmt := First_Elmt (Primitive_Operations (Typ));
+ while Present (Prim_Elmt) loop
+ Prim := Node (Prim_Elmt);
+ Prim_Pos := DT_Position (Prim);
+
+ pragma Assert (UI_To_Int (Prim_Pos) <= Examined_Size);
+
+ if Examined (UI_To_Int (Prim_Pos)) then
+ goto Continue;
+ else
+ Examined (UI_To_Int (Prim_Pos)) := True;
+ end if;
+
+ -- The current primitive overrides an interface-level subprogram
+
+ if Present (Abstract_Interface_Alias (Prim)) then
+
+ -- Set the primitive operation kind regardless of subprogram
+ -- type. Generate:
+ -- Ada.Tags.Set_Prim_Op_Kind (DT_Ptr, <position>, <kind>);
+
+ Append_To (Assignments,
+ Make_DT_Access_Action (Typ,
+ Action =>
+ Set_Prim_Op_Kind,
+ Args =>
+ New_List (
+ New_Reference_To (DT_Ptr, Loc),
+ Make_Integer_Literal (Loc, Prim_Pos),
+ Prim_Op_Kind (Prim, Typ))));
+
+ -- Retrieve the root of the alias chain if one is present
+
+ if Present (Alias (Prim)) then
+ Prim_Als := Prim;
+ while Present (Alias (Prim_Als)) loop
+ Prim_Als := Alias (Prim_Als);
+ end loop;
+ else
+ Prim_Als := Empty;
+ end if;
+
+ -- In the case of an entry wrapper, set the entry index
+
+ if Ekind (Prim) = E_Procedure
+ and then Present (Prim_Als)
+ and then Is_Primitive_Wrapper (Prim_Als)
+ and then Ekind (Wrapped_Entity (Prim_Als)) = E_Entry
+ then
+
+ -- Generate:
+ -- Ada.Tags.Set_Entry_Index (DT_Ptr, <position>, <index>);
+
+ Append_To (Assignments,
+ Make_DT_Access_Action (Typ,
+ Action =>
+ Set_Entry_Index,
+ Args =>
+ New_List (
+ New_Reference_To (DT_Ptr, Loc),
+ Make_Integer_Literal (Loc, Prim_Pos),
+ Make_Integer_Literal (Loc,
+ Find_Entry_Index (Wrapped_Entity (Prim_Als))))));
+ end if;
+ end if;
+
+ <<Continue>>
+
+ Next_Elmt (Prim_Elmt);
+ end loop;
+ end;
+
+ return Assignments;
+ end Make_Select_Specific_Data_Table;
+
-----------------------------------
-- Original_View_In_Visible_Part --
-----------------------------------
@@ -3342,6 +3772,11 @@ package body Exp_Disp is
if Ekind (Full_Typ) = E_Protected_Type then
return New_Reference_To (RTE (RE_POK_Protected_Function), Loc);
+ -- Task function
+
+ elsif Ekind (Full_Typ) = E_Task_Type then
+ return New_Reference_To (RTE (RE_POK_Task_Function), Loc);
+
-- Regular function
else
@@ -3638,7 +4073,10 @@ package body Exp_Disp is
-- Ada 2005 (AI-251)
- if Present (Abstract_Interface_Alias (Prim)) then
+ if Present (Abstract_Interface_Alias (Prim))
+ and then Is_Interface (Scope (DTC_Entity
+ (Abstract_Interface_Alias (Prim))))
+ then
Set_DTC_Entity (Prim,
Find_Interface_Tag
(T => Typ,
diff --git a/gcc/ada/exp_disp.ads b/gcc/ada/exp_disp.ads
index 469ea79caf8..bdc1417d4c4 100644
--- a/gcc/ada/exp_disp.ads
+++ b/gcc/ada/exp_disp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -28,8 +28,144 @@
-- dispatching expansion.
with Types; use Types;
+
package Exp_Disp is
+ -------------------------------------
+ -- Predefined primitive operations --
+ -------------------------------------
+
+ -- The predefined primitive operations (PPOs) are subprograms generated
+ -- by GNAT for a particular tagged type. Their role is to provide support
+ -- for different Ada language features such as the attribute 'Size or
+ -- handling of dispatching triggers in select statements. PPOs are created
+ -- when a tagged type is expanded or frozen. These subprograms are later
+ -- collected and inserted into the dispatch table of a tagged type at
+ -- fixed positions. Some of the PPOs that manipulate data in tagged objects
+ -- require the generation of thunks.
+
+ -- List of predefined primitive operations
+
+ -- Leading underscores designate reserved names. Bracketed numerical
+ -- values represent dispatch table slot numbers.
+
+ -- _Size (1) - implementation of the attribute 'Size for any tagged
+ -- type. Constructs of the form Prefix'Size are converted into
+ -- Prefix._Size.
+
+ -- _Alignment (2) - implementation of the attribute 'Alignment for
+ -- any tagged type. Constructs of the form Prefix'Alignment are
+ -- converted into Prefix._Alignment.
+
+ -- TSS_Stream_Read (3) - implementation of the stream attribute Read
+ -- for any tagged type.
+
+ -- TSS_Stream_Write (4) - implementation of the stream attribute Write
+ -- for any tagged type.
+
+ -- TSS_Stream_Input (5) - implementation of the stream attribute Input
+ -- for any tagged type.
+
+ -- TSS_Stream_Output (6) - implementation of the stream attribute
+ -- Output for any tagged type.
+
+ -- Op_Eq (7) - implementation of the equality operator for any non-
+ -- limited tagged type.
+
+ -- _Assign (8) - implementation of the assignment operator for any
+ -- non-limited tagged type.
+
+ -- TSS_Deep_Adjust (9) - implementation of the finalization operation
+ -- Adjust for any non-limited tagged type.
+
+ -- TSS_Deep_Finalize (10) - implementation of the finalization
+ -- operation Finalize for any non-limited tagged type.
+
+ -- _Disp_Asynchronous_Select (11) - used in the expansion of ATC with
+ -- dispatching triggers. Null implementation for limited interfaces,
+ -- full body generation for types that implement limited interfaces,
+ -- not generated for the rest of the cases. See Expand_N_Asynchronous_
+ -- Select in Exp_Ch9 for more information.
+
+ -- _Disp_Conditional_Select (12) - used in the expansion of conditional
+ -- selects with dispatching triggers. Null implementation for limited
+ -- interfaces, full body generation for types that implement limited
+ -- interfaces, not generated for the rest of the cases. See Expand_N_
+ -- Conditional_Entry_Call in Exp_Ch9 for more information.
+
+ -- _Disp_Get_Prim_Op_Kind (13) - helper routine used in the expansion
+ -- of ATC with dispatching triggers. Null implementation for limited
+ -- interfaces, full body generation for types that implement limited
+ -- interfaces, not generated for the rest of the cases.
+
+ -- _Disp_Get_Task_Id (14) - helper routine used in the expansion of
+ -- Abort, attributes 'Callable and 'Terminated for task interface
+ -- class-wide types. Full body generation for task types, null
+ -- implementation for limited interfaces, not generated for the rest
+ -- of the cases. See Expand_N_Attribute_Reference in Exp_Attr and
+ -- Expand_N_Abort_Statement in Exp_Ch9 for more information.
+
+ -- _Disp_Timed_Select (15) - used in the expansion of timed selects
+ -- with dispatching triggers. Null implementation for limited
+ -- interfaces, full body generation for types that implement limited
+ -- interfaces, not generated for the rest of the cases. See Expand_N_
+ -- Timed_Entry_Call for more information.
+
+ -- Lifecycle of predefined primitive operations
+
+ -- The specifications and bodies of the PPOs are created by
+ -- Make_Predefined_Primitive_Specs and Predefined_Primitive_Bodies
+ -- in Exp_Ch3. The generated specifications are immediately analyzed,
+ -- while the bodies are left as freeze actions to the tagged type for
+ -- which they are created.
+
+ -- PPOs are collected and added to the Primitive_Operations list of
+ -- a type by the regular analysis mechanism.
+
+ -- PPOs are frozen in Predefined_Primitive_Freeze in Exp_Ch3.
+
+ -- Thunks for PPOs are created in Freeze_Subprogram in Exp_Ch6, by a
+ -- call to Register_Predefined_DT_Entry, also in Exp_Ch6.
+
+ -- Dispatch table positions of PPOs are set in Set_All_DT_Position in
+ -- Exp_Disp.
+
+ -- Calls to PPOs procede as regular dispatching calls. If the PPO
+ -- has a thunk, a call procedes as a regular dispatching call with
+ -- a thunk.
+
+ -- Guidelines for addition of new predefined primitive operations
+
+ -- Update the value of constant Default_Prim_Op_Count in Exp_Disp.ads
+ -- to reflect the new number of PPOs.
+
+ -- Update the value of constant Default_Prim_Op_Count in A-Tags.ads
+ -- to reflect the new number of PPOs. This value should be the same
+ -- as the one in Exp_Disp.ads.
+
+ -- Introduce a new predefined name for the new PPO in Snames.ads and
+ -- Snames.adb.
+
+ -- Categorize the new PPO name as predefined by adding an entry in
+ -- Is_Predefined_Dispatching_Operation in Exp_Util.adb.
+
+ -- Reserve a dispatch table position for the new PPO by adding an entry
+ -- in Default_Prim_Op_Position in Exp_Disp.adb.
+
+ -- Generate the specification of the new PPO in Make_Predefined_
+ -- Primitive_Spec in Exp_Ch3.adb. The Is_Internal flag of the defining
+ -- identifier of the specification must be set to True.
+
+ -- Generate the body of the new PPO in Predefined_Primitive_Bodies in
+ -- Exp_Ch3.adb. The Is_Internal flag of the defining identifier of the
+ -- specification must be set to True.
+
+ -- If the new PPO requires a thunk, add an entry in Freeze_Subprogram
+ -- in Exp_Ch6.adb.
+
+ -- When generating calls to a PPO, use Find_Prim_Op from Exp_Util.ads
+ -- to retrieve the entity of the operation directly.
+
-- Number of predefined primitive operations added by the Expander
-- for a tagged type. If more predefined primitive operations are
-- added, the following items must be changed:
@@ -38,7 +174,7 @@ package Exp_Disp is
-- Exp_Disp.Default_Prim_Op_Position - indirect use
-- Exp_Disp.Set_All_DT_Position - direct use
- Default_Prim_Op_Count : constant Int := 14;
+ Default_Prim_Op_Count : constant Int := 15;
type DT_Access_Action is
(CW_Membership,
@@ -48,6 +184,7 @@ package Exp_Disp is
Get_Access_Level,
Get_Entry_Index,
Get_External_Tag,
+ Get_Offset_Index,
Get_Prim_Op_Address,
Get_Prim_Op_Kind,
Get_RC_Offset,
@@ -60,10 +197,13 @@ package Exp_Disp is
Set_Entry_Index,
Set_Expanded_Name,
Set_External_Tag,
+ Set_Offset_Index,
+ Set_OSD,
Set_Prim_Op_Address,
Set_Prim_Op_Kind,
Set_RC_Offset,
Set_Remotely_Callable,
+ Set_SSD,
Set_TSD,
TSD_Entry_Size,
TSD_Prologue_Size);
@@ -117,16 +257,6 @@ package Exp_Disp is
-- Ada 2005 (AI-251): Initialize the entries associated with predefined
-- primitives in all the secondary dispatch tables of Typ.
- procedure Make_Abstract_Interface_DT
- (AI_Tag : Entity_Id;
- Acc_Disp_Tables : in out Elist_Id;
- Result : out List_Id);
- -- Ada 2005 (AI-251): Expand the declarations for the secondary Dispatch
- -- Tables corresponding with an abstract interface. The reference to the
- -- dispatch table is appended at the end of Acc_Disp_Tables; it will be
- -- are later used to generate the corresponding initialization statement
- -- (see Exp_Ch3.Build_Init_Procedure).
-
function Make_DT_Access_Action
(Typ : Entity_Id;
Action : DT_Access_Action;
@@ -141,7 +271,8 @@ package Exp_Disp is
function Make_Disp_Asynchronous_Select_Body
(Typ : Entity_Id) return Node_Id;
-- Ada 2005 (AI-345): Generate the body of the primitive operation of type
- -- Typ used for dispatching in asynchronous selects.
+ -- Typ used for dispatching in asynchronous selects. Generate a null body
+ -- if Typ is an interface type.
function Make_Disp_Asynchronous_Select_Spec
(Typ : Entity_Id) return Node_Id;
@@ -151,7 +282,8 @@ package Exp_Disp is
function Make_Disp_Conditional_Select_Body
(Typ : Entity_Id) return Node_Id;
-- Ada 2005 (AI-345): Generate the body of the primitive operation of type
- -- Typ used for dispatching in conditional selects.
+ -- Typ used for dispatching in conditional selects. Generate a null body
+ -- if Typ is an interface type.
function Make_Disp_Conditional_Select_Spec
(Typ : Entity_Id) return Node_Id;
@@ -162,7 +294,7 @@ package Exp_Disp is
(Typ : Entity_Id) return Node_Id;
-- Ada 2005 (AI-345): Generate the body of the primitive operation of type
-- Typ used for retrieving the callable entity kind during dispatching in
- -- asynchronous selects.
+ -- asynchronous selects. Generate a null body if Typ is an interface type.
function Make_Disp_Get_Prim_Op_Kind_Spec
(Typ : Entity_Id) return Node_Id;
@@ -170,23 +302,52 @@ package Exp_Disp is
-- of the type Typ use for retrieving the callable entity kind during
-- dispatching in asynchronous selects.
- function Make_Disp_Select_Tables
- (Typ : Entity_Id) return List_Id;
- -- Ada 2005 (AI-345): Populate the two auxiliary tables in the TSD of Typ
- -- used for dispatching in asynchronous, conditional and timed selects.
- -- Generate code to set the primitive operation kinds and entry indices
- -- of primitive operations and primitive wrappers.
+ function Make_Disp_Get_Task_Id_Body
+ (Typ : Entity_Id) return Node_Id;
+ -- Ada 2005 (AI-345): Generate the body of the primitive operation of type
+ -- Typ used for retrieving the _task_id field of a task interface class-
+ -- wide type. Generate a null body if Typ is an interface or a non-task
+ -- type.
+
+ function Make_Disp_Get_Task_Id_Spec
+ (Typ : Entity_Id) return Node_Id;
+ -- Ada 2005 (AI-345): Generate the specification of the primitive operation
+ -- of type Typ used for retrieving the _task_id field of a task interface
+ -- class-wide type.
function Make_Disp_Timed_Select_Body
(Typ : Entity_Id) return Node_Id;
-- Ada 2005 (AI-345): Generate the body of the primitive operation of type
- -- Typ used for dispatching in timed selects.
+ -- Typ used for dispatching in timed selects. Generate a null body if Nul
+ -- is an interface type.
function Make_Disp_Timed_Select_Spec
(Typ : Entity_Id) return Node_Id;
-- Ada 2005 (AI-345): Generate the specification of the primitive operation
-- of type Typ used for dispatching in timed selects.
+ function Make_Select_Specific_Data_Table
+ (Typ : Entity_Id) return List_Id;
+ -- Ada 2005 (AI-345): Create and populate the auxiliary table in the TSD
+ -- of Typ used for dispatching in asynchronous, conditional and timed
+ -- selects. Generate code to set the primitive operation kinds and entry
+ -- indices of primitive operations and primitive wrappers.
+
+ procedure Make_Secondary_DT
+ (Typ : Entity_Id;
+ Ancestor_Typ : Entity_Id;
+ Suffix_Index : Int;
+ Iface : Entity_Id;
+ AI_Tag : Entity_Id;
+ Acc_Disp_Tables : in out Elist_Id;
+ Result : out List_Id);
+ -- Ada 2005 (AI-251): Expand the declarations for the Secondary Dispatch
+ -- Table of Typ associated with Iface (each abstract interface implemented
+ -- by Typ has a secondary dispatch table). The arguments Typ, Ancestor_Typ
+ -- and Suffix_Index are used to generate an unique external name which
+ -- is added at the end of Acc_Disp_Tables; this external name will be
+ -- used later by the subprogram Exp_Ch3.Build_Init_Procedure.
+
procedure Set_All_DT_Position (Typ : Entity_Id);
-- Set the DT_Position field for each primitive operation. In the CPP
-- Class case check that no pragma CPP_Virtual is missing and that the
diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb
index d0e016d6898..4be4c869c80 100644
--- a/gcc/ada/exp_dist.adb
+++ b/gcc/ada/exp_dist.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -97,7 +97,7 @@ package body Exp_Dist is
-- DSA expansion associates stubs to distributed object types using
-- a hash table on entity ids.
- function Hash (F : Name_Id) return Hash_Index;
+ function Hash (F : Name_Id) return Hash_Index;
-- The generation of subprogram identifiers requires an overload counter
-- to be associated with each remote subprogram names. These counters
-- are maintained in a hash table on name ids.
@@ -270,7 +270,8 @@ package body Exp_Dist is
-- its constrained status.
function Is_RACW_Controlling_Formal
- (Parameter : Node_Id; Stub_Type : Entity_Id) return Boolean;
+ (Parameter : Node_Id;
+ Stub_Type : Entity_Id) return Boolean;
-- Return True if the current parameter is a controlling formal argument
-- of type Stub_Type or access to Stub_Type.
@@ -10177,8 +10178,8 @@ package body Exp_Dist is
-- Find_Numeric_Representation --
---------------------------------
- function Find_Numeric_Representation (Typ : Entity_Id)
- return Entity_Id
+ function Find_Numeric_Representation
+ (Typ : Entity_Id) return Entity_Id
is
FST : constant Entity_Id := First_Subtype (Typ);
P_Size : constant Uint := Esize (FST);
@@ -10286,26 +10287,38 @@ package body Exp_Dist is
Append_To (Indices,
Make_Identifier (Loc, New_External_Name ('L', Depth)));
- if Constrained then
- Inner_Any := Any;
- Inner_Counter := Counter;
- else
+ if not Constrained or else Depth > 1 then
Inner_Any := Make_Defining_Identifier (Loc,
- New_External_Name ('A', Depth));
+ New_External_Name ('A', Depth));
Set_Etype (Inner_Any, RTE (RE_Any));
+ else
+ Inner_Any := Empty;
+ end if;
- if Present (Counter) then
- Inner_Counter := Make_Defining_Identifier (Loc,
- New_External_Name ('J', Depth));
- else
- Inner_Counter := Empty;
- end if;
+ if Present (Counter) then
+ Inner_Counter := Make_Defining_Identifier (Loc,
+ New_External_Name ('J', Depth));
+ else
+ Inner_Counter := Empty;
end if;
- Append_Array_Traversal (Inner_Stmts,
- Any => Inner_Any,
- Counter => Inner_Counter,
- Depth => Depth + 1);
+ declare
+ Loop_Any : Node_Id := Inner_Any;
+ begin
+
+ -- For the first dimension of a constrained array, we add
+ -- elements directly in the corresponding Any; there is no
+ -- intervening inner Any.
+
+ if No (Loop_Any) then
+ Loop_Any := Any;
+ end if;
+
+ Append_Array_Traversal (Inner_Stmts,
+ Any => Loop_Any,
+ Counter => Inner_Counter,
+ Depth => Depth + 1);
+ end;
Loop_Stm :=
Make_Implicit_Loop_Statement (Subprogram,
@@ -10326,11 +10339,6 @@ package body Exp_Dist is
Make_Integer_Literal (Loc, Depth))))),
Statements => Inner_Stmts);
- if Constrained then
- Append_To (Stmts, Loop_Stm);
- return;
- end if;
-
declare
Decls : constant List_Id := New_List;
Dimen_Stmts : constant List_Id := New_List;
@@ -10344,13 +10352,22 @@ package body Exp_Dist is
begin
if Depth = 1 then
- Inner_Any_TypeCode_Expr :=
- Make_Function_Call (Loc,
- Name =>
- New_Occurrence_Of (RTE (RE_Any_Member_Type), Loc),
- Parameter_Associations => New_List (
- New_Occurrence_Of (Any, Loc),
- Make_Integer_Literal (Loc, Ndim)));
+ if Constrained then
+ Inner_Any_TypeCode_Expr :=
+ Make_Function_Call (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_Get_TC), Loc),
+ Parameter_Associations => New_List (
+ New_Occurrence_Of (Any, Loc)));
+ else
+ Inner_Any_TypeCode_Expr :=
+ Make_Function_Call (Loc,
+ Name =>
+ New_Occurrence_Of (RTE (RE_Any_Member_Type), Loc),
+ Parameter_Associations => New_List (
+ New_Occurrence_Of (Any, Loc),
+ Make_Integer_Literal (Loc, Ndim)));
+ end if;
else
Inner_Any_TypeCode_Expr :=
Make_Function_Call (Loc,
@@ -10368,18 +10385,21 @@ package body Exp_Dist is
Object_Definition => New_Occurrence_Of (
RTE (RE_TypeCode), Loc),
Expression => Inner_Any_TypeCode_Expr));
- Append_To (Decls,
- Make_Object_Declaration (Loc,
- Defining_Identifier => Inner_Any,
- Object_Definition =>
- New_Occurrence_Of (RTE (RE_Any), Loc),
- Expression =>
- Make_Function_Call (Loc,
- Name =>
- New_Occurrence_Of (
- RTE (RE_Create_Any), Loc),
- Parameter_Associations => New_List (
- New_Occurrence_Of (Inner_Any_TypeCode, Loc)))));
+
+ if Present (Inner_Any) then
+ Append_To (Decls,
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Inner_Any,
+ Object_Definition =>
+ New_Occurrence_Of (RTE (RE_Any), Loc),
+ Expression =>
+ Make_Function_Call (Loc,
+ Name =>
+ New_Occurrence_Of (
+ RTE (RE_Create_Any), Loc),
+ Parameter_Associations => New_List (
+ New_Occurrence_Of (Inner_Any_TypeCode, Loc)))));
+ end if;
if Present (Inner_Counter) then
Append_To (Decls,
@@ -10391,17 +10411,19 @@ package body Exp_Dist is
Make_Integer_Literal (Loc, 0)));
end if;
- Length_Node := Make_Attribute_Reference (Loc,
- Prefix => New_Occurrence_Of (Arry, Loc),
- Attribute_Name => Name_Length,
- Expressions =>
- New_List (Make_Integer_Literal (Loc, Depth)));
- Set_Etype (Length_Node, RTE (RE_Long_Unsigned));
-
- Add_Process_Element (Dimen_Stmts,
- Datum => Length_Node,
- Any => Inner_Any,
- Counter => Inner_Counter);
+ if not Constrained then
+ Length_Node := Make_Attribute_Reference (Loc,
+ Prefix => New_Occurrence_Of (Arry, Loc),
+ Attribute_Name => Name_Length,
+ Expressions =>
+ New_List (Make_Integer_Literal (Loc, Depth)));
+ Set_Etype (Length_Node, RTE (RE_Long_Unsigned));
+
+ Add_Process_Element (Dimen_Stmts,
+ Datum => Length_Node,
+ Any => Inner_Any,
+ Counter => Inner_Counter);
+ end if;
-- Loop_Stm does approrpriate processing for each element
-- of Inner_Any.
@@ -10410,10 +10432,12 @@ package body Exp_Dist is
-- Link outer and inner any
- Add_Process_Element (Dimen_Stmts,
- Any => Any,
- Counter => Counter,
- Datum => New_Occurrence_Of (Inner_Any, Loc));
+ if Present (Inner_Any) then
+ Add_Process_Element (Dimen_Stmts,
+ Any => Any,
+ Counter => Counter,
+ Datum => New_Occurrence_Of (Inner_Any, Loc));
+ end if;
Append_To (Stmts,
Make_Block_Statement (Loc,
@@ -10532,9 +10556,10 @@ package body Exp_Dist is
-------------------
function Scope_Of_Spec (Spec : Node_Id) return Entity_Id is
- Unit_Name : Node_Id := Defining_Unit_Name (Spec);
+ Unit_Name : Node_Id;
begin
+ Unit_Name := Defining_Unit_Name (Spec);
while Nkind (Unit_Name) /= N_Defining_Identifier loop
Unit_Name := Defining_Identifier (Unit_Name);
end loop;
@@ -10757,7 +10782,8 @@ package body Exp_Dist is
(Loc : Source_Ptr;
Decls : List_Id;
RCI_Locator : Entity_Id;
- Controlling_Parameter : Entity_Id) return RPC_Target is
+ Controlling_Parameter : Entity_Id) return RPC_Target
+ is
begin
case Get_PCS_Name is
when Name_PolyORB_DSA =>
@@ -10798,7 +10824,8 @@ package body Exp_Dist is
Dynamically_Asynchronous : Boolean := False;
Stub_Type : Entity_Id := Empty;
RACW_Type : Entity_Id := Empty;
- Parent_Primitive : Entity_Id := Empty) return Node_Id is
+ Parent_Primitive : Entity_Id := Empty) return Node_Id
+ is
begin
case Get_PCS_Name is
when Name_PolyORB_DSA =>
diff --git a/gcc/ada/exp_fixd.adb b/gcc/ada/exp_fixd.adb
index 511392d5f78..fa1f8403ac8 100644
--- a/gcc/ada/exp_fixd.adb
+++ b/gcc/ada/exp_fixd.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -61,8 +61,7 @@ package body Exp_Fixd is
(N : Node_Id;
Typ : Entity_Id;
Expr : Node_Id;
- Rchk : Boolean := False)
- return Node_Id;
+ Rchk : Boolean := False) return Node_Id;
-- Build an expression that converts the expression Expr to type Typ,
-- taking the source location from Sloc (N). If the conversions involve
-- fixed-point types, then the Conversion_OK flag will be set so that the
@@ -72,21 +71,19 @@ package body Exp_Fixd is
function Build_Divide (N : Node_Id; L, R : Node_Id) return Node_Id;
-- Builds an N_Op_Divide node from the given left and right operand
- -- expressions, using the source location from Sloc (N). The operands
- -- are either both Long_Long_Float, in which case Build_Divide differs
- -- from Make_Op_Divide only in that the Etype of the resulting node is
- -- set (to Long_Long_Float), or they can be integer types. In this case
- -- the integer types need not be the same, and Build_Divide converts
- -- the operand with the smaller sized type to match the type of the
- -- other operand and sets this as the result type. The Rounded_Result
- -- flag of the result in this case is set from the Rounded_Result flag
- -- of node N. On return, the resulting node is analyzed, and has its
- -- Etype set.
+ -- expressions, using the source location from Sloc (N). The operands are
+ -- either both Universal_Real, in which case Build_Divide differs from
+ -- Make_Op_Divide only in that the Etype of the resulting node is set (to
+ -- Universal_Real), or they can be integer types. In this case the integer
+ -- types need not be the same, and Build_Divide converts the operand with
+ -- the smaller sized type to match the type of the other operand and sets
+ -- this as the result type. The Rounded_Result flag of the result in this
+ -- case is set from the Rounded_Result flag of node N. On return, the
+ -- resulting node is analyzed, and has its Etype set.
function Build_Double_Divide
(N : Node_Id;
- X, Y, Z : Node_Id)
- return Node_Id;
+ X, Y, Z : Node_Id) return Node_Id;
-- Returns a node corresponding to the value X/(Y*Z) using the source
-- location from Sloc (N). The division is rounded if the Rounded_Result
-- flag of N is set. The integer types of X, Y, Z may be different. On
@@ -100,37 +97,35 @@ package body Exp_Fixd is
-- Generates a sequence of code for determining the quotient and remainder
-- of the division X/(Y*Z), using the source location from Sloc (N).
-- Entities of appropriate types are allocated for the quotient and
- -- remainder and returned in Qnn and Rnn. The result is rounded if
- -- the Rounded_Result flag of N is set. The Etype fields of Qnn and Rnn
- -- are appropriately set on return.
+ -- remainder and returned in Qnn and Rnn. The result is rounded if the
+ -- Rounded_Result flag of N is set. The Etype fields of Qnn and Rnn are
+ -- appropriately set on return.
function Build_Multiply (N : Node_Id; L, R : Node_Id) return Node_Id;
-- Builds an N_Op_Multiply node from the given left and right operand
- -- expressions, using the source location from Sloc (N). The operands
- -- are either both Long_Long_Float, in which case Build_Divide differs
- -- from Make_Op_Multiply only in that the Etype of the resulting node is
- -- set (to Long_Long_Float), or they can be integer types. In this case
- -- the integer types need not be the same, and Build_Multiply chooses
- -- a type long enough to hold the product (i.e. twice the size of the
- -- longer of the two operand types), and both operands are converted
- -- to this type. The Etype of the result is also set to this value.
- -- However, the result can never overflow Integer_64, so this is the
- -- largest type that is ever generated. On return, the resulting node
- -- is analyzed and has its Etype set.
+ -- expressions, using the source location from Sloc (N). The operands are
+ -- either both Universal_Real, in which case Build_Divide differs from
+ -- Make_Op_Multiply only in that the Etype of the resulting node is set (to
+ -- Universal_Real), or they can be integer types. In this case the integer
+ -- types need not be the same, and Build_Multiply chooses a type long
+ -- enough to hold the product (i.e. twice the size of the longer of the two
+ -- operand types), and both operands are converted to this type. The Etype
+ -- of the result is also set to this value. However, the result can never
+ -- overflow Integer_64, so this is the largest type that is ever generated.
+ -- On return, the resulting node is analyzed and has its Etype set.
function Build_Rem (N : Node_Id; L, R : Node_Id) return Node_Id;
-- Builds an N_Op_Rem node from the given left and right operand
- -- expressions, using the source location from Sloc (N). The operands
- -- are both integer types, which need not be the same. Build_Rem
- -- converts the operand with the smaller sized type to match the type
- -- of the other operand and sets this as the result type. The result
- -- is never rounded (rem operations cannot be rounded in any case!)
- -- On return, the resulting node is analyzed and has its Etype set.
+ -- expressions, using the source location from Sloc (N). The operands are
+ -- both integer types, which need not be the same. Build_Rem converts the
+ -- operand with the smaller sized type to match the type of the other
+ -- operand and sets this as the result type. The result is never rounded
+ -- (rem operations cannot be rounded in any case!) On return, the resulting
+ -- node is analyzed and has its Etype set.
function Build_Scaled_Divide
(N : Node_Id;
- X, Y, Z : Node_Id)
- return Node_Id;
+ X, Y, Z : Node_Id) return Node_Id;
-- Returns a node corresponding to the value X*Y/Z using the source
-- location from Sloc (N). The division is rounded if the Rounded_Result
-- flag of N is set. The integer types of X, Y, Z may be different. On
@@ -183,10 +178,10 @@ package body Exp_Fixd is
function Fpt_Value (N : Node_Id) return Node_Id;
-- Given an operand of fixed-point operation, return an expression that
- -- represents the corresponding Long_Long_Float value. The expression
+ -- represents the corresponding Universal_Real value. The expression
-- can be of integer type, floating-point type, or fixed-point type.
-- The expression returned is neither analyzed and resolved. The Etype
- -- of the result is properly set (to Long_Long_Float).
+ -- of the result is properly set (to Universal_Real).
function Integer_Literal (N : Node_Id; V : Uint) return Node_Id;
-- Given a non-negative universal integer value, build a typed integer
@@ -198,8 +193,8 @@ package body Exp_Fixd is
function Real_Literal (N : Node_Id; V : Ureal) return Node_Id;
-- Build a real literal node from the given value, the Etype of the
- -- returned node is set to Long_Long_Float, since all floating-point
- -- arithmetic operations that we construct use Long_Long_Float
+ -- returned node is set to Universal_Real, since all floating-point
+ -- arithmetic operations that we construct use Universal_Real
function Rounded_Result_Set (N : Node_Id) return Boolean;
-- Returns True if N is a node that contains the Rounded_Result flag
@@ -224,8 +219,7 @@ package body Exp_Fixd is
(N : Node_Id;
Typ : Entity_Id;
Expr : Node_Id;
- Rchk : Boolean := False)
- return Node_Id
+ Rchk : Boolean := False) return Node_Id
is
Loc : constant Source_Ptr := Sloc (N);
Result : Node_Id;
@@ -296,7 +290,6 @@ package body Exp_Fixd is
Set_Etype (Result, Typ);
return Result;
-
end Build_Conversion;
------------------
@@ -314,11 +307,11 @@ package body Exp_Fixd is
-- Deal with floating-point case first
if Is_Floating_Point_Type (Left_Type) then
- pragma Assert (Left_Type = Standard_Long_Long_Float);
- pragma Assert (Right_Type = Standard_Long_Long_Float);
+ pragma Assert (Left_Type = Universal_Real);
+ pragma Assert (Right_Type = Universal_Real);
Rnode := Make_Op_Divide (Loc, L, R);
- Result_Type := Standard_Long_Long_Float;
+ Result_Type := Universal_Real;
-- Integer and fixed-point cases
@@ -384,7 +377,6 @@ package body Exp_Fixd is
end if;
return Rnode;
-
end Build_Divide;
-------------------------
@@ -393,8 +385,7 @@ package body Exp_Fixd is
function Build_Double_Divide
(N : Node_Id;
- X, Y, Z : Node_Id)
- return Node_Id
+ X, Y, Z : Node_Id) return Node_Id
is
Y_Size : constant Int := UI_To_Int (Esize (Etype (Y)));
Z_Size : constant Int := UI_To_Int (Esize (Etype (Z)));
@@ -582,7 +573,6 @@ package body Exp_Fixd is
New_Occurrence_Of (Rnn, Loc),
New_Occurrence_Of (Rnd, Loc))));
end if;
-
end Build_Double_Divide_Code;
--------------------
@@ -603,10 +593,10 @@ package body Exp_Fixd is
-- Deal with floating-point case first
if Is_Floating_Point_Type (Left_Type) then
- pragma Assert (Left_Type = Standard_Long_Long_Float);
- pragma Assert (Right_Type = Standard_Long_Long_Float);
+ pragma Assert (Left_Type = Universal_Real);
+ pragma Assert (Right_Type = Universal_Real);
- Result_Type := Standard_Long_Long_Float;
+ Result_Type := Universal_Real;
Rnode := Make_Op_Multiply (Loc, L, R);
-- Integer and fixed-point cases
@@ -782,8 +772,7 @@ package body Exp_Fixd is
function Build_Scaled_Divide
(N : Node_Id;
- X, Y, Z : Node_Id)
- return Node_Id
+ X, Y, Z : Node_Id) return Node_Id
is
X_Size : constant Int := UI_To_Int (Esize (Etype (X)));
Y_Size : constant Int := UI_To_Int (Esize (Etype (Y)));
@@ -1060,7 +1049,6 @@ package body Exp_Fixd is
Build_Multiply (N,
Build_Divide (N, Fpt_Value (Left), Fpt_Value (Right)),
Real_Literal (N, Frac)));
-
end Do_Divide_Fixed_Fixed;
-------------------------------
@@ -1176,7 +1164,6 @@ package body Exp_Fixd is
Set_Result (N,
Build_Multiply (N, Fpt_Value (Left), Real_Literal (N, Frac)));
-
end Do_Divide_Fixed_Universal;
-------------------------------
@@ -1295,7 +1282,6 @@ package body Exp_Fixd is
Set_Result (N,
Build_Divide (N, Real_Literal (N, Frac), Fpt_Value (Right)));
-
end Do_Divide_Universal_Fixed;
-----------------------------
@@ -1380,7 +1366,6 @@ package body Exp_Fixd is
Build_Multiply (N,
Build_Multiply (N, Fpt_Value (Left), Fpt_Value (Right)),
Real_Literal (N, Frac)));
-
end Do_Multiply_Fixed_Fixed;
---------------------------------
@@ -1420,7 +1405,7 @@ package body Exp_Fixd is
-- If denominator = 1, then for K = 1, the small ratio is an integer, and
-- this is clearly the minimum K case, so set
- -- K = 1, Right_Small = Lit_Value.
+ -- K = 1, Right_Small = Lit_Value
-- If denominator > 1, then set K to the numerator of the fraction, so
-- that the resulting small ratio is the reciprocal of the integer (the
@@ -1498,7 +1483,6 @@ package body Exp_Fixd is
Set_Result (N,
Build_Multiply (N, Fpt_Value (Left), Real_Literal (N, Frac)));
-
end Do_Multiply_Fixed_Universal;
---------------------------------
@@ -1553,7 +1537,6 @@ package body Exp_Fixd is
Ratio_Den := Norm_Den (Small_Ratio);
if Ratio_Den = 1 then
-
if Ratio_Num = 1 then
Set_Result (N, Expr);
return;
@@ -1585,7 +1568,6 @@ package body Exp_Fixd is
Fpt_Value (Expr),
Real_Literal (N, Small_Ratio)),
Rng_Check);
-
end Expand_Convert_Fixed_To_Fixed;
-----------------------------------
@@ -1594,7 +1576,7 @@ package body Exp_Fixd is
-- If the small of the fixed type is 1.0, then we simply convert the
-- integer value directly to the target floating-point type, otherwise
- -- we first have to multiply by the small, in Long_Long_Float, and then
+ -- we first have to multiply by the small, in Universal_Real, and then
-- convert the result to the target floating-point type.
procedure Expand_Convert_Fixed_To_Float (N : Node_Id) is
@@ -1679,7 +1661,6 @@ package body Exp_Fixd is
Fpt_Value (Expr),
Real_Literal (N, Small)),
Rng_Check);
-
end Expand_Convert_Fixed_To_Integer;
-----------------------------------
@@ -1776,7 +1757,6 @@ package body Exp_Fixd is
Fpt_Value (Expr),
Real_Literal (N, Ureal_1 / Small)),
Rng_Check);
-
end Expand_Convert_Integer_To_Fixed;
--------------------------------
@@ -1826,7 +1806,7 @@ package body Exp_Fixd is
-- division or multiplication by the appropriate power of 10.
procedure Expand_Decimal_Divide_Call (N : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
+ Loc : constant Source_Ptr := Sloc (N);
Dividend : Node_Id := First_Actual (N);
Divisor : Node_Id := Next_Actual (Dividend);
@@ -1971,7 +1951,6 @@ package body Exp_Fixd is
Statements => Stmts)));
Analyze (N);
-
end Expand_Decimal_Divide_Call;
-----------------------------------------------
@@ -1999,14 +1978,13 @@ package body Exp_Fixd is
else
Do_Divide_Fixed_Fixed (N);
end if;
-
end Expand_Divide_Fixed_By_Fixed_Giving_Fixed;
-----------------------------------------------
-- Expand_Divide_Fixed_By_Fixed_Giving_Float --
-----------------------------------------------
- -- The division is done in long_long_float, and the result is multiplied
+ -- The division is done in Universal_Real, and the result is multiplied
-- by the small ratio, which is Small (Right) / Small (Left). Special
-- treatment is required for universal operands, which represent their
-- own value and do not require conversion.
@@ -2065,7 +2043,6 @@ package body Exp_Fixd is
Real_Literal (N,
Small_Value (Left_Type) / Small_Value (Right_Type))));
end if;
-
end Expand_Divide_Fixed_By_Fixed_Giving_Float;
-------------------------------------------------
@@ -2075,18 +2052,14 @@ package body Exp_Fixd is
procedure Expand_Divide_Fixed_By_Fixed_Giving_Integer (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
-
begin
if Etype (Left) = Universal_Real then
Do_Divide_Universal_Fixed (N);
-
elsif Etype (Right) = Universal_Real then
Do_Divide_Fixed_Universal (N);
-
else
Do_Divide_Fixed_Fixed (N);
end if;
-
end Expand_Divide_Fixed_By_Fixed_Giving_Integer;
-------------------------------------------------
@@ -2099,7 +2072,6 @@ package body Exp_Fixd is
procedure Expand_Divide_Fixed_By_Integer_Giving_Fixed (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
-
begin
Set_Result (N, Build_Divide (N, Left, Right));
end Expand_Divide_Fixed_By_Integer_Giving_Fixed;
@@ -2118,9 +2090,12 @@ package body Exp_Fixd is
-- as a fixed * fixed multiplication, and convert the argument to
-- the target fixed type.
- procedure Rewrite_Non_Static_Universal (Opnd : Node_Id) is
- Loc : constant Source_Ptr := Sloc (N);
+ ----------------------------------
+ -- Rewrite_Non_Static_Universal --
+ ----------------------------------
+ procedure Rewrite_Non_Static_Universal (Opnd : Node_Id) is
+ Loc : constant Source_Ptr := Sloc (N);
begin
Rewrite (Opnd,
Make_Type_Conversion (Loc,
@@ -2129,6 +2104,8 @@ package body Exp_Fixd is
Analyze_And_Resolve (Opnd, Etype (N));
end Rewrite_Non_Static_Universal;
+ -- Start of processing for Expand_Multiply_Fixed_By_Fixed_Giving_Fixed
+
begin
-- Suppress expansion of a fixed-by-fixed multiplication if the
-- operation is supported directly by the target.
@@ -2158,14 +2135,13 @@ package body Exp_Fixd is
else
Do_Multiply_Fixed_Fixed (N);
end if;
-
end Expand_Multiply_Fixed_By_Fixed_Giving_Fixed;
-------------------------------------------------
-- Expand_Multiply_Fixed_By_Fixed_Giving_Float --
-------------------------------------------------
- -- The multiply is done in long_long_float, and the result is multiplied
+ -- The multiply is done in Universal_Real, and the result is multiplied
-- by the adjustment for the smalls which is Small (Right) * Small (Left).
-- Special treatment is required for universal operands.
@@ -2220,7 +2196,6 @@ package body Exp_Fixd is
Real_Literal (N,
Small_Value (Right_Type) * Small_Value (Left_Type))));
end if;
-
end Expand_Multiply_Fixed_By_Fixed_Giving_Float;
---------------------------------------------------
@@ -2230,18 +2205,14 @@ package body Exp_Fixd is
procedure Expand_Multiply_Fixed_By_Fixed_Giving_Integer (N : Node_Id) is
Left : constant Node_Id := Left_Opnd (N);
Right : constant Node_Id := Right_Opnd (N);
-
begin
if Etype (Left) = Universal_Real then
Do_Multiply_Fixed_Universal (N, Right, Left);
-
elsif Etype (Right) = Universal_Real then
Do_Multiply_Fixed_Universal (N, Left, Right);
-
else
Do_Multiply_Fixed_Fixed (N);
end if;
-
end Expand_Multiply_Fixed_By_Fixed_Giving_Integer;
---------------------------------------------------
@@ -2281,17 +2252,13 @@ package body Exp_Fixd is
if Is_Integer_Type (Typ)
or else Is_Floating_Point_Type (Typ)
then
- return
- Build_Conversion
- (N, Standard_Long_Long_Float, N);
+ return Build_Conversion (N, Universal_Real, N);
-- Fixed-point case, must get integer value first
else
- return
- Build_Conversion (N, Standard_Long_Long_Float, N);
+ return Build_Conversion (N, Universal_Real, N);
end if;
-
end Fpt_Value;
---------------------
@@ -2348,7 +2315,7 @@ package body Exp_Fixd is
-- Set type of result in case used elsewhere (see note at start)
- Set_Etype (L, Standard_Long_Long_Float);
+ Set_Etype (L, Universal_Real);
return L;
end Real_Literal;
@@ -2358,7 +2325,6 @@ package body Exp_Fixd is
function Rounded_Result_Set (N : Node_Id) return Boolean is
K : constant Node_Kind := Nkind (N);
-
begin
if (K = N_Type_Conversion or else
K = N_Op_Divide or else
@@ -2399,7 +2365,6 @@ package body Exp_Fixd is
Rewrite (N, Cnode);
Analyze_And_Resolve (N, Result_Type);
-
end Set_Result;
end Exp_Fixd;
diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb
index 6e25788cfd5..1fdbced6814 100644
--- a/gcc/ada/exp_imgv.adb
+++ b/gcc/ada/exp_imgv.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -831,6 +831,22 @@ package body Exp_Imgv is
else
pragma Assert (Is_Enumeration_Type (Rtyp));
+ if Discard_Names (Rtyp) then
+
+ -- This is a configurable run-time, or else a restriction is in
+ -- effect. In either case the attribute cannot be supported. Force
+ -- a load error from Rtsfind to generate an appropriate message,
+ -- as is done with other ZFP violations.
+
+ declare
+ pragma Warnings (Off); -- since Discard is unreferenced
+ Discard : constant Entity_Id := RTE (RE_Null);
+ pragma Warnings (On);
+ begin
+ return;
+ end;
+ end if;
+
Ttyp := Component_Type (Etype (Lit_Indexes (Rtyp)));
case Attr is
diff --git a/gcc/ada/exp_imgv.ads b/gcc/ada/exp_imgv.ads
index f768872725d..54d4528d3d2 100644
--- a/gcc/ada/exp_imgv.ads
+++ b/gcc/ada/exp_imgv.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb
index 5a402fdeaad..6eb9bedd9b1 100644
--- a/gcc/ada/exp_intr.adb
+++ b/gcc/ada/exp_intr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,7 @@ with Exp_Code; use Exp_Code;
with Exp_Disp; use Exp_Disp;
with Exp_Fixd; use Exp_Fixd;
with Exp_Util; use Exp_Util;
-with Itypes; use Itypes;
+with Freeze; use Freeze;
with Namet; use Namet;
with Nmake; use Nmake;
with Nlists; use Nlists;
@@ -133,13 +133,25 @@ package body Exp_Intr is
Param_Arg : constant Node_Id := Next_Actual (Tag_Arg);
Subp_Decl : constant Node_Id := Parent (Parent (Entity (Name (N))));
Inst_Pkg : constant Node_Id := Parent (Subp_Decl);
- Act_Rename : constant Node_Id :=
- Next (Next (First (Visible_Declarations (Inst_Pkg))));
- Act_Constr : constant Entity_Id := Entity (Name (Act_Rename));
- Result_Typ : constant Entity_Id := Class_Wide_Type (Etype (Act_Constr));
+ Act_Rename : Node_Id;
+ Act_Constr : Entity_Id;
+ Result_Typ : Entity_Id;
Cnstr_Call : Node_Id;
begin
+ -- The subprogram is the third actual in the instantiation, and is
+ -- retrieved from the corresponding renaming declaration. However,
+ -- freeze nodes may appear before, so we retrieve the declaration
+ -- with an explicit loop.
+
+ Act_Rename := First (Visible_Declarations (Inst_Pkg));
+ while Nkind (Act_Rename) /= N_Subprogram_Renaming_Declaration loop
+ Next (Act_Rename);
+ end loop;
+
+ Act_Constr := Entity (Name (Act_Rename));
+ Result_Typ := Class_Wide_Type (Etype (Act_Constr));
+
-- Create the call to the actual Constructor function
Cnstr_Call :=
@@ -829,6 +841,82 @@ package body Exp_Intr is
Append_To (Stmts, Free_Node);
Set_Storage_Pool (Free_Node, Pool);
+ -- Deal with storage pool
+
+ if Present (Pool) then
+
+ -- Freeing the secondary stack is meaningless
+
+ if Is_RTE (Pool, RE_SS_Pool) then
+ null;
+
+ elsif Is_Class_Wide_Type (Etype (Pool)) then
+
+ -- Case of a class-wide pool type: make a dispatching call
+ -- to Deallocate through the class-wide Deallocate_Any.
+
+ Set_Procedure_To_Call (Free_Node,
+ RTE (RE_Deallocate_Any));
+
+ else
+ -- Case of a specific pool type: make a statically bound call
+
+ Set_Procedure_To_Call (Free_Node,
+ Find_Prim_Op (Etype (Pool), Name_Deallocate));
+ end if;
+ end if;
+
+ if Present (Procedure_To_Call (Free_Node)) then
+
+ -- For all cases of a Deallocate call, the back-end needs to be
+ -- able to compute the size of the object being freed. This may
+ -- require some adjustments for objects of dynamic size.
+ --
+ -- If the type is class wide, we generate an implicit type with the
+ -- right dynamic size, so that the deallocate call gets the right
+ -- size parameter computed by GIGI. Same for an access to
+ -- unconstrained packed array.
+
+ if Is_Class_Wide_Type (Desig_T)
+ or else
+ (Is_Array_Type (Desig_T)
+ and then not Is_Constrained (Desig_T)
+ and then Is_Packed (Desig_T))
+ then
+ declare
+ Deref : constant Node_Id :=
+ Make_Explicit_Dereference (Loc,
+ Duplicate_Subexpr_No_Checks (Arg));
+ D_Subtyp : Node_Id;
+ D_Type : Entity_Id;
+
+ begin
+ Set_Etype (Deref, Typ);
+ Set_Parent (Deref, Free_Node);
+ D_Subtyp := Make_Subtype_From_Expr (Deref, Desig_T);
+
+ if Nkind (D_Subtyp) in N_Has_Entity then
+ D_Type := Entity (D_Subtyp);
+
+ else
+ D_Type := Make_Defining_Identifier (Loc,
+ New_Internal_Name ('A'));
+ Insert_Action (N,
+ Make_Subtype_Declaration (Loc,
+ Defining_Identifier => D_Type,
+ Subtype_Indication => D_Subtyp));
+ Freeze_Itype (D_Type, N);
+
+ end if;
+
+ Set_Actual_Designated_Subtype (Free_Node, D_Type);
+ end;
+
+ end if;
+ end if;
+
+ Set_Expression (Free_Node, Free_Arg);
+
-- Make implicit if statement. We omit this if we are the then part
-- of a test of the form:
@@ -881,62 +969,27 @@ package body Exp_Intr is
end if;
end;
- -- Deal with storage pool
-
- if Present (Pool) then
-
- -- Freeing the secondary stack is meaningless
-
- if Is_RTE (Pool, RE_SS_Pool) then
- null;
+ -- Only remaining step is to set result to null, or generate a
+ -- raise of constraint error if the target object is "not null".
- elsif Is_Class_Wide_Type (Etype (Pool)) then
- Set_Procedure_To_Call (Free_Node,
- RTE (RE_Deallocate_Any));
- else
- Set_Procedure_To_Call (Free_Node,
- Find_Prim_Op (Etype (Pool), Name_Deallocate));
+ if Can_Never_Be_Null (Etype (Arg)) then
+ Append_To (Stmts,
+ Make_Raise_Constraint_Error (Loc,
+ Reason => CE_Access_Check_Failed));
- -- If the type is class wide, we generate an implicit type
- -- with the right dynamic size, so that the deallocate call
- -- gets the right size parameter computed by gigi
-
- if Is_Class_Wide_Type (Desig_T) then
- declare
- Acc_Type : constant Entity_Id :=
- Create_Itype (E_Access_Type, N);
- Deref : constant Node_Id :=
- Make_Explicit_Dereference (Loc,
- Duplicate_Subexpr_No_Checks (Arg));
-
- begin
- Set_Etype (Deref, Typ);
- Set_Parent (Deref, Free_Node);
-
- Set_Etype (Acc_Type, Acc_Type);
- Set_Size_Info (Acc_Type, Typ);
- Set_Directly_Designated_Type
- (Acc_Type, Entity (Make_Subtype_From_Expr
- (Deref, Desig_T)));
-
- Free_Arg := Unchecked_Convert_To (Acc_Type, Free_Arg);
- end;
- end if;
- end if;
+ else
+ declare
+ Lhs : constant Node_Id := Duplicate_Subexpr_No_Checks (Arg);
+ begin
+ Set_Assignment_OK (Lhs);
+ Append_To (Stmts,
+ Make_Assignment_Statement (Loc,
+ Name => Lhs,
+ Expression => Make_Null (Loc)));
+ end;
end if;
- Set_Expression (Free_Node, Free_Arg);
-
- declare
- Lhs : constant Node_Id := Duplicate_Subexpr_No_Checks (Arg);
-
- begin
- Set_Assignment_OK (Lhs);
- Append_To (Stmts,
- Make_Assignment_Statement (Loc,
- Name => Lhs,
- Expression => Make_Null (Loc)));
- end;
+ -- Rewrite the call
Rewrite (N, Gen_Code);
Analyze (N);
diff --git a/gcc/ada/exp_intr.ads b/gcc/ada/exp_intr.ads
index 0d0094924bf..81821235872 100644
--- a/gcc/ada/exp_intr.ads
+++ b/gcc/ada/exp_intr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index d27915db961..5b0a10a2bc6 100644
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index 9956ab90104..8c9bf59b340 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_prag.ads b/gcc/ada/exp_prag.ads
index b3722474a93..6ab342df6c6 100644
--- a/gcc/ada/exp_prag.ads
+++ b/gcc/ada/exp_prag.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_smem.adb b/gcc/ada/exp_smem.adb
index 32aea3fcb18..746025d8794 100644
--- a/gcc/ada/exp_smem.adb
+++ b/gcc/ada/exp_smem.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_strm.adb b/gcc/ada/exp_strm.adb
index f6e5d5c61ad..84b321e924c 100644
--- a/gcc/ada/exp_strm.adb
+++ b/gcc/ada/exp_strm.adb
@@ -1447,11 +1447,15 @@ package body Exp_Strm is
Profile : List_Id;
begin
+ -- (Ada 2005: AI-441): Set the null-excluding attribute because it has
+ -- no semantic meaning in Ada 95 but it is a requirement in Ada2005.
+
Profile := New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_S),
Parameter_Type =>
Make_Access_Definition (Loc,
+ Null_Exclusion_Present => True,
Subtype_Mark => New_Reference_To (
Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc))));
@@ -1483,6 +1487,9 @@ package body Exp_Strm is
begin
-- Construct function specification
+ -- (Ada 2005: AI-441): Set the null-excluding attribute because it has
+ -- no semantic meaning in Ada 95 but it is a requirement in Ada2005.
+
Spec :=
Make_Function_Specification (Loc,
Defining_Unit_Name => Fnam,
@@ -1492,6 +1499,7 @@ package body Exp_Strm is
Defining_Identifier => Make_Defining_Identifier (Loc, Name_S),
Parameter_Type =>
Make_Access_Definition (Loc,
+ Null_Exclusion_Present => True,
Subtype_Mark => New_Reference_To (
Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc)))),
@@ -1523,6 +1531,9 @@ package body Exp_Strm is
begin
-- Construct procedure specification
+ -- (Ada 2005: AI-441): Set the null-excluding attribute because it has
+ -- no semantic meaning in Ada 95 but it is a requirement in Ada2005.
+
Spec :=
Make_Procedure_Specification (Loc,
Defining_Unit_Name => Pnam,
@@ -1532,6 +1543,7 @@ package body Exp_Strm is
Defining_Identifier => Make_Defining_Identifier (Loc, Name_S),
Parameter_Type =>
Make_Access_Definition (Loc,
+ Null_Exclusion_Present => True,
Subtype_Mark => New_Reference_To (
Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc))),
diff --git a/gcc/ada/exp_tss.adb b/gcc/ada/exp_tss.adb
index f6c0e418b7c..78f975d3455 100644
--- a/gcc/ada/exp_tss.adb
+++ b/gcc/ada/exp_tss.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_tss.ads b/gcc/ada/exp_tss.ads
index cdacb322346..311997d4c99 100644
--- a/gcc/ada/exp_tss.ads
+++ b/gcc/ada/exp_tss.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index ebef01d303b..c6924e97cb6 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1275,6 +1275,16 @@ package body Exp_Util is
then
null;
+ -- Nothing to be done for derived types with unknown discriminants if
+ -- the parent type also has unknown discriminants.
+
+ elsif Is_Record_Type (Unc_Type)
+ and then not Is_Class_Wide_Type (Unc_Type)
+ and then Has_Unknown_Discriminants (Unc_Type)
+ and then Has_Unknown_Discriminants (Underlying_Type (Unc_Type))
+ then
+ null;
+
-- Nothing to be done if the type of the expression is limited, because
-- in this case the expression cannot be copied, and its use can only
-- be by reference and there is no need for the actual subtype.
@@ -1289,8 +1299,147 @@ package body Exp_Util is
end if;
end Expand_Subtype_From_Expr;
+ --------------------------------
+ -- Find_Implemented_Interface --
+ --------------------------------
+
+ -- Given the following code (XXX denotes irrelevant value):
+
+ -- type Limd_Iface is limited interface;
+ -- type Prot_Iface is protected interface;
+ -- type Sync_Iface is synchronized interface;
+
+ -- type Parent_Subtype is new Limd_Iface and Sync_Iface with ...
+ -- type Child_Subtype is new Parent_Subtype and Prot_Iface with ...
+
+ -- The following calls will return the following values:
+
+ -- Find_Implemented_Interface
+ -- (Child_Subtype, Synchronized_Interface, False) -> Empty
+
+ -- Find_Implemented_Interface
+ -- (Child_Subtype, Synchronized_Interface, True) -> Sync_Iface
+
+ -- Find_Implemented_Interface
+ -- (Child_Subtype, Any_Synchronized_Interface, XXX) -> Prot_Iface
+
+ -- Find_Implemented_Interface
+ -- (Child_Subtype, Any_Limited_Interface, XXX) -> Prot_Iface
+
+ function Find_Implemented_Interface
+ (Typ : Entity_Id;
+ Kind : Interface_Kind;
+ Check_Parent : Boolean := False) return Entity_Id
+ is
+ Iface_Elmt : Elmt_Id;
+
+ function Interface_In_Kind
+ (I : Entity_Id;
+ Kind : Interface_Kind) return Boolean;
+ -- Determine whether an interface falls into a specified kind
+
+ -----------------------
+ -- Interface_In_Kind --
+ -----------------------
+
+ function Interface_In_Kind
+ (I : Entity_Id;
+ Kind : Interface_Kind) return Boolean is
+ begin
+ if Is_Limited_Interface (I)
+ and then (Kind = Any_Interface
+ or else Kind = Any_Limited_Interface
+ or else Kind = Limited_Interface)
+ then
+ return True;
+
+ elsif Is_Protected_Interface (I)
+ and then (Kind = Any_Interface
+ or else Kind = Any_Limited_Interface
+ or else Kind = Any_Synchronized_Interface
+ or else Kind = Protected_Interface)
+ then
+ return True;
+
+ elsif Is_Synchronized_Interface (I)
+ and then (Kind = Any_Interface
+ or else Kind = Any_Limited_Interface
+ or else Kind = Synchronized_Interface)
+ then
+ return True;
+
+ elsif Is_Task_Interface (I)
+ and then (Kind = Any_Interface
+ or else Kind = Any_Limited_Interface
+ or else Kind = Any_Synchronized_Interface
+ or else Kind = Task_Interface)
+ then
+ return True;
+
+ -- Regular interface. This should be the last kind to check since
+ -- all of the previous cases have their Is_Interface flags set.
+
+ elsif Is_Interface (I)
+ and then (Kind = Any_Interface
+ or else Kind = Iface)
+ then
+ return True;
+
+ else
+ return False;
+ end if;
+ end Interface_In_Kind;
+
+ -- Start of processing for Find_Implemented_Interface
+
+ begin
+ if not Is_Tagged_Type (Typ) then
+ return Empty;
+ end if;
+
+ -- Implementations of the form:
+ -- Typ is new Interface ...
+
+ if Is_Interface (Etype (Typ))
+ and then Interface_In_Kind (Etype (Typ), Kind)
+ then
+ return Etype (Typ);
+ end if;
+
+ -- Implementations of the form:
+ -- Typ is new Typ_Parent and Interface ...
+
+ if Present (Abstract_Interfaces (Typ)) then
+ Iface_Elmt := First_Elmt (Abstract_Interfaces (Typ));
+ while Present (Iface_Elmt) loop
+ if Interface_In_Kind (Node (Iface_Elmt), Kind) then
+ return Node (Iface_Elmt);
+ end if;
+
+ Iface_Elmt := Next_Elmt (Iface_Elmt);
+ end loop;
+ end if;
+
+ -- Typ is a derived type and may implement a limited interface
+ -- through its parent subtype. Check the parent subtype as well
+ -- as any interfaces explicitly implemented at this level.
+
+ if Check_Parent
+ and then Ekind (Typ) = E_Record_Type
+ and then Present (Parent_Subtype (Typ))
+ then
+ return Find_Implemented_Interface (
+ Parent_Subtype (Typ), Kind, Check_Parent);
+ end if;
+
+ -- Typ does not implement a limited interface either at this level or
+ -- in any of its parent subtypes.
+
+ return Empty;
+ end Find_Implemented_Interface;
+
------------------------
- -- Find_Interface_Tag --
+ -- Find_Interface_ADT --
------------------------
function Find_Interface_ADT
@@ -1302,7 +1451,7 @@ package body Exp_Util is
Typ : Entity_Id := T;
procedure Find_Secondary_Table (Typ : Entity_Id);
- -- Comment required ???
+ -- Internal subprogram used to recursively climb to the ancestors
--------------------------
-- Find_Secondary_Table --
@@ -1313,10 +1462,23 @@ package body Exp_Util is
AI : Node_Id;
begin
- if Etype (Typ) /= Typ then
+ -- Climb to the ancestor (if any) handling private types
+
+ if Present (Full_View (Etype (Typ))) then
+ if Full_View (Etype (Typ)) /= Typ then
+ Find_Secondary_Table (Full_View (Etype (Typ)));
+ end if;
+
+ elsif Etype (Typ) /= Typ then
Find_Secondary_Table (Etype (Typ));
end if;
+ -- If we already found it there is nothing else to do
+
+ if Found then
+ return;
+ end if;
+
if Present (Abstract_Interfaces (Typ))
and then not Is_Empty_Elmt_List (Abstract_Interfaces (Typ))
then
@@ -1401,9 +1563,14 @@ package body Exp_Util is
return;
end if;
- -- Climb to the root type
+ -- Climb to the root type handling private types
+
+ if Present (Full_View (Etype (Typ))) then
+ if Full_View (Etype (Typ)) /= Typ then
+ Find_Tag (Full_View (Etype (Typ)));
+ end if;
- if Etype (Typ) /= Typ then
+ elsif Etype (Typ) /= Typ then
Find_Tag (Etype (Typ));
end if;
@@ -1437,6 +1604,8 @@ package body Exp_Util is
-- Start of processing for Find_Interface_Tag
begin
+ pragma Assert (Is_Interface (Iface));
+
-- Handle private types
if Has_Private_Declaration (Typ)
@@ -1742,67 +1911,17 @@ package body Exp_Util is
return Count;
end Homonym_Number;
- ----------------------------------
- -- Implements_Limited_Interface --
- ----------------------------------
-
- function Implements_Limited_Interface (Typ : Entity_Id) return Boolean is
- function Contains_Limited_Interface
- (Ifaces : Elist_Id) return Boolean;
- -- Given a list of interfaces, determine whether one of them is limited
-
- --------------------------------
- -- Contains_Limited_Interface --
- --------------------------------
-
- function Contains_Limited_Interface
- (Ifaces : Elist_Id) return Boolean
- is
- Iface_Elmt : Elmt_Id;
-
- begin
- if not Present (Ifaces) then
- return False;
- end if;
-
- Iface_Elmt := First_Elmt (Ifaces);
-
- while Present (Iface_Elmt) loop
- if Is_Limited_Record (Node (Iface_Elmt)) then
- return True;
- end if;
-
- Iface_Elmt := Next_Elmt (Iface_Elmt);
- end loop;
-
- return False;
- end Contains_Limited_Interface;
-
- -- Start of processing for Implements_Limited_Interface
+ --------------------------
+ -- Implements_Interface --
+ --------------------------
+ function Implements_Interface
+ (Typ : Entity_Id;
+ Kind : Interface_Kind;
+ Check_Parent : Boolean := False) return Boolean is
begin
- -- Typ is a derived type and may implement a limited interface
- -- through its parent subtype. Check the parent subtype as well
- -- as any interfaces explicitly implemented at this level.
-
- if Ekind (Typ) = E_Record_Type
- and then Present (Parent_Subtype (Typ))
- then
- return Contains_Limited_Interface (Abstract_Interfaces (Typ))
- or else Implements_Limited_Interface (Parent_Subtype (Typ));
-
- -- Typ is an abstract type derived from some interface
-
- elsif Is_Abstract (Typ) then
- return Is_Interface (Etype (Typ))
- and then Is_Limited_Record (Etype (Typ));
-
- -- Typ may directly implement some interface
-
- else
- return Contains_Limited_Interface (Abstract_Interfaces (Typ));
- end if;
- end Implements_Limited_Interface;
+ return Find_Implemented_Interface (Typ, Kind, Check_Parent) /= Empty;
+ end Implements_Interface;
------------------------------
-- In_Unconditional_Context --
@@ -2436,7 +2555,6 @@ package body Exp_Util is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Insert_Actions (Assoc_Node, Ins_Actions);
@@ -2446,7 +2564,6 @@ package body Exp_Util is
else
declare
Svg : constant Boolean := Scope_Suppress (Suppress);
-
begin
Scope_Suppress (Suppress) := True;
Insert_Actions (Assoc_Node, Ins_Actions);
@@ -2557,12 +2674,12 @@ package body Exp_Util is
return True;
end Is_All_Null_Statements;
- ------------------------
- -- Is_Default_Prim_Op --
- ------------------------
+ -----------------------------------------
+ -- Is_Predefined_Dispatching_Operation --
+ -----------------------------------------
function Is_Predefined_Dispatching_Operation
- (Subp : Entity_Id) return Boolean
+ (Subp : Entity_Id) return Boolean
is
TSS_Name : TSS_Name_Type;
E : Entity_Id := Subp;
@@ -2590,10 +2707,12 @@ package body Exp_Util is
or else Chars (E) = Name_uAssign
or else TSS_Name = TSS_Deep_Adjust
or else TSS_Name = TSS_Deep_Finalize
- or else Chars (E) = Name_uDisp_Asynchronous_Select
- or else Chars (E) = Name_uDisp_Conditional_Select
- or else Chars (E) = Name_uDisp_Get_Prim_Op_Kind
- or else Chars (E) = Name_uDisp_Timed_Select
+ or else (Ada_Version >= Ada_05
+ and then (Chars (E) = Name_uDisp_Asynchronous_Select
+ or else Chars (E) = Name_uDisp_Conditional_Select
+ or else Chars (E) = Name_uDisp_Get_Prim_Op_Kind
+ or else Chars (E) = Name_uDisp_Get_Task_Id
+ or else Chars (E) = Name_uDisp_Timed_Select))
then
return True;
end if;
@@ -3466,7 +3585,7 @@ package body Exp_Util is
return New_Occurrence_Of (CW_Subtype, Loc);
end;
- -- Comment needed (what case is this ???)
+ -- Indefinite record type with discriminants.
else
D := First_Discriminant (Unc_Typ);
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads
index a63cc71c09b..2afb88f8ca6 100644
--- a/gcc/ada/exp_util.ads
+++ b/gcc/ada/exp_util.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -33,6 +33,21 @@ with Types; use Types;
package Exp_Util is
+ -- An enumeration type used to capture all the possible interface
+ -- kinds and their hierarchical relation. These values are used in
+ -- Find_Implemented_Interface and Implements_Interface.
+
+ type Interface_Kind is (
+ Any_Interface, -- Any interface
+ Any_Limited_Interface, -- Only limited interfaces
+ Any_Synchronized_Interface, -- Only synchronized interfaces
+
+ Iface, -- Individual kinds
+ Limited_Interface,
+ Protected_Interface,
+ Synchronized_Interface,
+ Task_Interface);
+
-----------------------------------------------
-- Handling of Actions Associated with Nodes --
-----------------------------------------------
@@ -325,17 +340,27 @@ package Exp_Util is
-- class-wide).
function Find_Interface_ADT
- (T : Entity_Id;
- Iface : Entity_Id) return Entity_Id;
+ (T : Entity_Id;
+ Iface : Entity_Id) return Entity_Id;
-- Ada 2005 (AI-251): Given a type T implementing the interface Iface,
-- return the Access_Disp_Table value of the interface.
function Find_Interface_Tag
- (T : Entity_Id;
- Iface : Entity_Id) return Entity_Id;
+ (T : Entity_Id;
+ Iface : Entity_Id) return Entity_Id;
-- Ada 2005 (AI-251): Given a type T implementing the interface Iface,
-- return the record component containing the tag of Iface.
+ function Find_Implemented_Interface
+ (Typ : Entity_Id;
+ Kind : Interface_Kind;
+ Check_Parent : Boolean := False) return Entity_Id;
+ -- Ada 2005 (AI-345): Find a designated kind of interface implemented by
+ -- Typ or any parent subtype. Return the first encountered interface that
+ -- correspond to the selected class. Return Empty if no such interface is
+ -- found. Use Check_Parent to climb a potential derivation chain and
+ -- examine the parent subtypes for any implementation.
+
function Find_Prim_Op (T : Entity_Id; Name : Name_Id) return Entity_Id;
-- Find the first primitive operation of type T whose name is 'Name'.
-- This function allows the use of a primitive operation which is not
@@ -410,11 +435,13 @@ package Exp_Util is
-- chain, counting only entries in the curren scope. If an entity is not
-- overloaded, the returned number will be one.
- function Implements_Limited_Interface (Typ : Entity_Id) return Boolean;
- -- Ada 2005 (AI-345): Determine whether Typ implements some limited
- -- interface. The interface may be of limited, protected, synchronized
- -- or taks kind. Typ may also be derived from a type that implements a
- -- limited interface.
+ function Implements_Interface
+ (Typ : Entity_Id;
+ Kind : Interface_Kind;
+ Check_Parent : Boolean := False) return Boolean;
+ -- Ada 2005 (AI-345): Determine whether Typ implements a designated kind
+ -- of interface. Use Check_Parent to climb a potential derivation chain
+ -- and examine the parent subtypes for any implementation.
function Inside_Init_Proc return Boolean;
-- Returns True if current scope is within an init proc
diff --git a/gcc/ada/exp_vfpt.adb b/gcc/ada/exp_vfpt.adb
index 98b2b075ce0..de2fae10459 100644
--- a/gcc/ada/exp_vfpt.adb
+++ b/gcc/ada/exp_vfpt.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -196,6 +196,13 @@ package body Exp_VFpt is
Func := RE_Lt_G;
end if;
+ when N_Op_Ne =>
+ if Typc = 'F' then
+ Func := RE_Ne_F;
+ else
+ Func := RE_Ne_G;
+ end if;
+
when others =>
Func := RE_Null;
raise Program_Error;
@@ -295,14 +302,16 @@ package body Exp_VFpt is
end if;
end Call_Type;
+ -------------------------------------------------
+ -- Expand_Multiply_Fixed_By_Fixed_Giving_Fixed --
+ -------------------------------------------------
+
function Equivalent_Integer_Type (T : Entity_Id) return Entity_Id is
begin
if Esize (T) = Esize (Standard_Long_Long_Integer) then
return Standard_Long_Long_Integer;
-
elsif Esize (T) = Esize (Standard_Long_Integer) then
return Standard_Long_Integer;
-
else
return Standard_Integer;
end if;
@@ -320,38 +329,62 @@ package body Exp_VFpt is
Rewrite (N,
Unchecked_Convert_To (T_Typ, Expr));
+ -- Case of conversion of fixed-point type to Vax_Float type
+
elsif Is_Fixed_Point_Type (S_Typ) then
- -- convert the scaled integer value to the target type, and multiply
- -- by 'Small of type.
+ -- If Conversion_OK set, then we introduce an intermediate IEEE
+ -- target type since we are expecting the code generator to handle
+ -- the case of integer to IEEE float.
- Rewrite (N,
- Make_Op_Multiply (Loc,
- Left_Opnd =>
- Make_Type_Conversion (Loc,
- Subtype_Mark => New_Occurrence_Of (T_Typ, Loc),
- Expression =>
- Unchecked_Convert_To (
- Equivalent_Integer_Type (S_Typ), Expr)),
- Right_Opnd =>
- Make_Real_Literal (Loc, Realval => Small_Value (S_Typ))));
+ if Conversion_OK (N) then
+ Rewrite (N,
+ Convert_To (T_Typ, OK_Convert_To (Universal_Real, Expr)));
+
+ -- Otherwise, convert the scaled integer value to the target type,
+ -- and multiply by 'Small of type.
+
+ else
+ Rewrite (N,
+ Make_Op_Multiply (Loc,
+ Left_Opnd =>
+ Make_Type_Conversion (Loc,
+ Subtype_Mark => New_Occurrence_Of (T_Typ, Loc),
+ Expression =>
+ Unchecked_Convert_To (
+ Equivalent_Integer_Type (S_Typ), Expr)),
+ Right_Opnd =>
+ Make_Real_Literal (Loc, Realval => Small_Value (S_Typ))));
+ end if;
+
+ -- Case of conversion of Vax_Float type to fixed-point type
elsif Is_Fixed_Point_Type (T_Typ) then
- -- multiply value by 'small of type, and convert to the corresponding
- -- integer type.
+ -- If Conversion_OK set, then we introduce an intermediate IEEE
+ -- target type, since we are expecting the code generator to handle
+ -- the case of IEEE float to integer.
- Rewrite (N,
- Unchecked_Convert_To (T_Typ,
- Make_Type_Conversion (Loc,
- Subtype_Mark =>
- New_Occurrence_Of (Equivalent_Integer_Type (T_Typ), Loc),
- Expression =>
- Make_Op_Multiply (Loc,
- Left_Opnd => Expr,
- Right_Opnd =>
- Make_Real_Literal (Loc,
- Realval => Ureal_1 / Small_Value (T_Typ))))));
+ if Conversion_OK (N) then
+ Rewrite (N,
+ OK_Convert_To (T_Typ, Convert_To (Universal_Real, Expr)));
+
+ -- Otherwise, multiply value by 'small of type, and convert to the
+ -- corresponding integer type.
+
+ else
+ Rewrite (N,
+ Unchecked_Convert_To (T_Typ,
+ Make_Type_Conversion (Loc,
+ Subtype_Mark =>
+ New_Occurrence_Of (Equivalent_Integer_Type (T_Typ), Loc),
+ Expression =>
+ Make_Op_Multiply (Loc,
+ Left_Opnd => Expr,
+ Right_Opnd =>
+ Make_Real_Literal (Loc,
+ Realval => Ureal_1 / Small_Value (T_Typ))))));
+ end if;
-- All other cases
diff --git a/gcc/ada/exp_vfpt.ads b/gcc/ada/exp_vfpt.ads
index fb33b795db9..f90c64a3613 100644
--- a/gcc/ada/exp_vfpt.ads
+++ b/gcc/ada/exp_vfpt.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb
index feb2d8205e6..1c75aa09dee 100644
--- a/gcc/ada/expander.adb
+++ b/gcc/ada/expander.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/expander.ads b/gcc/ada/expander.ads
index 4756bd20de2..0f085fe2227 100644
--- a/gcc/ada/expander.ads
+++ b/gcc/ada/expander.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/expect.c b/gcc/ada/expect.c
index 69a3364b6d3..dd03b1ca1f8 100644
--- a/gcc/ada/expect.c
+++ b/gcc/ada/expect.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 2001-2005 Ada Core Technologies, Inc. *
+ * Copyright (C) 2001-2005, AdaCore *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -76,17 +76,15 @@
#include <process.h>
void
-__gnat_kill (int pid, int sig)
+__gnat_kill (int pid, int sig, int close)
{
- HANDLE process_handle;
-
if (sig == 9)
{
- process_handle = OpenProcess (PROCESS_TERMINATE, FALSE, pid);
- if (process_handle != NULL)
+ if ((HANDLE)pid != NULL)
{
- TerminateProcess (process_handle, 0);
- CloseHandle (process_handle);
+ TerminateProcess ((HANDLE)pid, 0);
+ if (close)
+ CloseHandle ((HANDLE)pid);
}
}
}
@@ -94,17 +92,14 @@ __gnat_kill (int pid, int sig)
int
__gnat_waitpid (int pid)
{
- HANDLE process_handle;
DWORD exitcode = 1;
DWORD res;
- process_handle = OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, pid);
-
- if (process_handle != NULL)
+ if ((HANDLE)pid != NULL)
{
- res = WaitForSingleObject (process_handle, INFINITE);
- GetExitCodeProcess (process_handle, &exitcode);
- CloseHandle (process_handle);
+ res = WaitForSingleObject ((HANDLE)pid, INFINITE);
+ GetExitCodeProcess ((HANDLE)pid, &exitcode);
+ CloseHandle ((HANDLE)pid);
}
return (int) exitcode;
@@ -337,7 +332,7 @@ typedef long fd_mask;
#endif /* !NO_FD_SET */
void
-__gnat_kill (int pid, int sig)
+__gnat_kill (int pid, int sig, int close)
{
kill (pid, sig);
}
@@ -456,7 +451,7 @@ __gnat_expect_poll (int *fd, int num_fd, int timeout, int *is_set)
#else
void
-__gnat_kill (int pid, int sig)
+__gnat_kill (int pid, int sig, int close)
{
}
diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h
index 5e49ab9c6e7..4706d4c9ec1 100644
--- a/gcc/ada/fe.h
+++ b/gcc/ada/fe.h
@@ -6,7 +6,7 @@
* *
* C Header File *
* *
- * Copyright (C) 1992-2005 Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2005, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
diff --git a/gcc/ada/fmap.adb b/gcc/ada/fmap.adb
index 34a092db56f..e8284e78560 100644
--- a/gcc/ada/fmap.adb
+++ b/gcc/ada/fmap.adb
@@ -62,7 +62,7 @@ package body Fmap is
Table_Initial => 1_000,
Table_Increment => 1_000,
Table_Name => "Fmap.File_Mapping");
- -- Mapping table to map unit names to file names.
+ -- Mapping table to map unit names to file names
package Path_Mapping is new Table.Table (
Table_Component_Type => Mapping,
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 31f5bb1f34a..6252fe887f4 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -2257,6 +2257,9 @@ package body Freeze is
Error_Msg_N
("(Ada 2005): invalid use of unconstrained tagged"
& " incomplete type", E);
+
+ elsif Ekind (F_Type) = E_Subprogram_Type then
+ Freeze_And_Append (F_Type, Loc, Result);
end if;
end if;
@@ -3001,7 +3004,7 @@ package body Freeze is
end if;
-- For access to a protected subprogram, freeze the equivalent
- -- type (however this is not set if we are not generating code)
+ -- type (however this is not set if we are not generating code
-- or if this is an anonymous type used just for resolution).
elsif Ekind (E) = E_Access_Protected_Subprogram_Type then
@@ -3031,9 +3034,7 @@ package body Freeze is
end if;
end;
- if Operating_Mode = Generate_Code
- and then Present (Equivalent_Type (E))
- then
+ if Present (Equivalent_Type (E)) then
Freeze_And_Append (Equivalent_Type (E), Loc, Result);
end if;
end if;
diff --git a/gcc/ada/freeze.ads b/gcc/ada/freeze.ads
index 46baa6aeb78..491f866ecdc 100644
--- a/gcc/ada/freeze.ads
+++ b/gcc/ada/freeze.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2003, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -199,7 +199,7 @@ package Freeze is
-- frozen entities.
procedure Freeze_Before (N : Node_Id; T : Entity_Id);
- -- Freeze T then Insert the generated Freeze nodes before the node N.
+ -- Freeze T then Insert the generated Freeze nodes before the node N
procedure Freeze_Expression (N : Node_Id);
-- Freezes the required entities when the Expression N causes freezing.
diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb
index 51112c57834..49b8dd729ac 100644
--- a/gcc/ada/frontend.adb
+++ b/gcc/ada/frontend.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/frontend.ads b/gcc/ada/frontend.ads
index 7201bcf3373..69a0cdc68f0 100644
--- a/gcc/ada/frontend.ads
+++ b/gcc/ada/frontend.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-arrspl.adb b/gcc/ada/g-arrspl.adb
index 0d0366484f7..571388ac294 100644
--- a/gcc/ada/g-arrspl.adb
+++ b/gcc/ada/g-arrspl.adb
@@ -2,11 +2,11 @@
-- --
-- GNAT COMPILER COMPONENTS --
-- --
--- G N A T . A R R A Y _ S P I T --
+-- G N A T . A R R A Y _ S P L I T --
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-arrspl.ads b/gcc/ada/g-arrspl.ads
index 5c8051250a9..d35059c1b64 100644
--- a/gcc/ada/g-arrspl.ads
+++ b/gcc/ada/g-arrspl.ads
@@ -2,11 +2,11 @@
-- --
-- GNAT COMPILER COMPONENTS --
-- --
--- G N A T . A R R A Y _ S P L T --
+-- G N A T . A R R A Y _ S P L I T --
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-awk.adb b/gcc/ada/g-awk.adb
index 2aa712aef3f..d39ef846291 100644
--- a/gcc/ada/g-awk.adb
+++ b/gcc/ada/g-awk.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005 AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -266,7 +266,7 @@ package body GNAT.AWK is
NR : Natural := 0;
FNR : Natural := 0;
Matches : Regpat.Match_Array (0 .. 100);
- -- latest matches for the regexp pattern
+ -- Latest matches for the regexp pattern
end record;
procedure Free is
@@ -377,7 +377,6 @@ package body GNAT.AWK is
Session : Session_Type)
is
pragma Unreferenced (Session);
-
begin
A.Proc.all;
end Call;
@@ -423,7 +422,6 @@ package body GNAT.AWK is
Session : Session_Type) return Boolean
is
use type Regpat.Match_Location;
-
begin
Regpat.Match
(P.Regx.all, Field (P.Rank, Session), Session.Data.Matches);
@@ -439,7 +437,6 @@ package body GNAT.AWK is
Session : Session_Type) return Boolean
is
pragma Unreferenced (Session);
-
begin
return P.Pattern.all;
end Match;
@@ -450,7 +447,6 @@ package body GNAT.AWK is
procedure Release (P : in out Pattern) is
pragma Unreferenced (P);
-
begin
null;
end Release;
@@ -462,7 +458,6 @@ package body GNAT.AWK is
procedure Release (P : in out Regexp_Pattern) is
procedure Free is new Unchecked_Deallocation
(Regpat.Pattern_Matcher, Pattern_Matcher_Access);
-
begin
Free (P.Regx);
end Release;
@@ -950,7 +945,6 @@ package body GNAT.AWK is
(Session : Session_Type := Current_Session) return Natural
is
Files : File_Table.Instance renames Session.Data.Files;
-
begin
return File_Table.Last (Files);
end Number_Of_Files;
@@ -1258,8 +1252,8 @@ package body GNAT.AWK is
procedure Set_Field_Widths
(Field_Widths : Widths_Set;
- Session : Session_Type := Current_Session) is
-
+ Session : Session_Type := Current_Session)
+ is
begin
Free (Session.Data.Separators);
@@ -1280,10 +1274,8 @@ package body GNAT.AWK is
procedure Split_Line (Session : Session_Type) is
Fields : Field_Table.Instance renames Session.Data.Fields;
-
begin
Field_Table.Init (Fields);
-
Split.Current_Line (Session.Data.Separators.all, Session);
end Split_Line;
diff --git a/gcc/ada/g-awk.ads b/gcc/ada/g-awk.ads
index 4d7c65f8605..346da5e0dd6 100644
--- a/gcc/ada/g-awk.ads
+++ b/gcc/ada/g-awk.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-boumai.ads b/gcc/ada/g-boumai.ads
index c5c69794af8..c3a0db5c265 100644
--- a/gcc/ada/g-boumai.ads
+++ b/gcc/ada/g-boumai.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 2003-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-calend.adb b/gcc/ada/g-calend.adb
index e73b10364f5..ea8f28a3a68 100644
--- a/gcc/ada/g-calend.adb
+++ b/gcc/ada/g-calend.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-calend.ads b/gcc/ada/g-calend.ads
index 5cbff83ef3b..8288635da74 100644
--- a/gcc/ada/g-calend.ads
+++ b/gcc/ada/g-calend.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-catiio.adb b/gcc/ada/g-catiio.adb
index 147601dcb70..fe996be4328 100644
--- a/gcc/ada/g-catiio.adb
+++ b/gcc/ada/g-catiio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -124,7 +124,6 @@ package body GNAT.Calendar.Time_IO is
use Ada.Characters.Handling;
Local : constant String :=
To_Upper (Str (1)) & To_Lower (Str (2 .. Str'Last));
-
begin
if Length = 0 then
return Local;
@@ -174,7 +173,6 @@ package body GNAT.Calendar.Time_IO is
begin
if Length = 0 or else Padding = None then
return NI (2 .. NI'Last);
-
else
return NIP (NIP'Last - Length + 1 .. NIP'Last);
end if;
diff --git a/gcc/ada/g-comlin.adb b/gcc/ada/g-comlin.adb
index c6142bddbfa..e1ff2434c96 100644
--- a/gcc/ada/g-comlin.adb
+++ b/gcc/ada/g-comlin.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-comlin.ads b/gcc/ada/g-comlin.ads
index de3d45a14f1..447e617c28e 100644
--- a/gcc/ada/g-comlin.ads
+++ b/gcc/ada/g-comlin.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -72,7 +72,7 @@
-- A more complicated example would involve the use of sections for the
-- switches, as for instance in gnatmake. These sections are separated by
--- special switches, chosen by the programer. Each section act as a
+-- special switches chosen by the programer. Each section acts as a
-- command line of its own.
-- begin
@@ -104,24 +104,24 @@ package GNAT.Command_Line is
Stop_At_First_Non_Switch : Boolean := False;
Section_Delimiters : String := "");
-- This procedure resets the internal state of the package to prepare
- -- to rescan the parameters. It need not (but may be) called before the
- -- first use of Getopt, but it must be called if you want to start
- -- rescanning the command line parameters from the start. The optional
- -- parameter Switch_Char can be used to reset the switch character,
- -- e.g. to '/' for use in DOS-like systems. The optional parameter
- -- Stop_At_First_Non_Switch indicates if Getopt is to look for switches
- -- on the whole command line, or if it has to stop as soon as a
+ -- to rescan the parameters. It does not need to be called before the
+ -- first use of Getopt (but it could be), but it must be called if you want
+ -- to start rescanning the command line parameters from the start. The
+ -- optional parameter Switch_Char can be used to reset the switch
+ -- character, e.g. to '/' for use in DOS-like systems. The optional
+ -- parameter Stop_At_First_Non_Switch indicates if Getopt is to look for
+ -- switches on the whole command line, or if it has to stop as soon as a
-- non-switch argument is found.
--
-- Example:
--
-- Arguments: my_application file1 -c
--
- -- if Stop_At_First_Non_Switch is False, then -c will be considered
+ -- If Stop_At_First_Non_Switch is False, then -c will be considered
-- as a switch (returned by getopt), otherwise it will be considered
-- as a normal argument (returned by Get_Argument).
--
- -- if SECTION_DELIMITERS is set, then every following subprogram
+ -- If SECTION_DELIMITERS is set, then every following subprogram
-- (Getopt and Get_Argument) will only operate within a section, which
-- is delimited by any of these delimiters or the end of the command line.
--
@@ -134,11 +134,11 @@ package GNAT.Command_Line is
-- and -largs and includes '-d -e' and the last one includes '-f'
procedure Goto_Section (Name : String := "");
- -- Change the current section. The next Getopt of Get_Argument will
- -- start looking at the beginning of the section. An empty name ("")
- -- refers to the first section between the program name and the first
- -- section delimiter.
- -- If the section does not exist, then Invalid_Section is raised.
+ -- Change the current section. The next Getopt of Get_Argument will start
+ -- looking at the beginning of the section. An empty name ("") refers to
+ -- the first section between the program name and the first section
+ -- delimiter. If the section does not exist, then Invalid_Section is
+ -- raised.
function Full_Switch return String;
-- Returns the full name of the last switch found (Getopt only returns
@@ -147,34 +147,40 @@ package GNAT.Command_Line is
function Getopt
(Switches : String;
Concatenate : Boolean := True) return Character;
- -- This function moves to the next switch on the command line (defined
- -- as a switch character followed by a character within Switches,
- -- casing being significant). The result returned is the first
- -- character of the particular switch located. If there are no more
- -- switches in the current section, returns ASCII.NUL. If Concatenate is
- -- True (by default), the switches need not be separated by spaces (they
- -- can be concatenated if they do not require an argument, e.g. -ab is the
- -- same as two separate arguments -a -b).
+ -- This function moves to the next switch on the command line (defined as
+ -- switch character followed by a character within Switches, casing being
+ -- significant). The result returned is the first character of the switch
+ -- that is located. If there are no more switches in the current section,
+ -- returns ASCII.NUL. If Concatenate is True (by default), the switches
+ -- does not need to be separated by spaces (they can be concatenated if
+ -- they do not require an argument, e.g. -ab is the ame as two separate
+ -- arguments -a -b).
--
-- Switches is a string of all the possible switches, separated by a
- -- space. A switch can be followed by one of the following characters :
+ -- space. A switch can be followed by one of the following characters:
--
-- ':' The switch requires a parameter. There can optionally be a space
- -- on the command line between the switch and its parameter
+ -- on the command line between the switch and its parameter.
+ --
-- '=' The switch requires a parameter. There can either be a '=' or a
- -- space on the command line between the switch and its parameter
+ -- space on the command line between the switch and its parameter.
+ --
-- '!' The switch requires a parameter, but there can be no space on the
- -- command line between the switch and its parameter
+ -- command line between the switch and its parameter.
+ --
-- '?' The switch may have an optional parameter. There can be no space
- -- between the switch and its argument
- -- ex/ if Switches has the following value : "a? b"
- -- The command line can be :
+ -- between the switch and its argument.
+ --
+ -- e.g. if Switches has the following value : "a? b",
+ -- The command line can be:
+ --
-- -afoo : -a switch with 'foo' parameter
-- -a foo : -a switch and another element on the
-- command line 'foo', returned by Get_Argument
--
-- Example: if Switches is "-a: -aO:", you can have the following
- -- command lines :
+ -- command lines:
+ --
-- -aarg : 'a' switch with 'arg' parameter
-- -a arg : 'a' switch with 'arg' parameter
-- -aOarg : 'aO' switch with 'arg' parameter
@@ -194,14 +200,14 @@ package GNAT.Command_Line is
--
-- Example
-- Getopt ("* a b")
- -- If the command line is '-a -c toto.o -b', GetOpt will return
- -- successively 'a', '*', '*' and 'b'. When '*' is returnd,
+ -- If the command line is '-a -c toto.o -b', Getopt will return
+ -- successively 'a', '*', '*' and 'b'. When '*' is returned,
-- Full_Switch returns the corresponding item on the command line.
--
--
-- When Getopt encounters an invalid switch, it raises the exception
-- Invalid_Switch and sets Full_Switch to return the invalid switch.
- -- When Getopt can not find the parameter associated with a switch, it
+ -- When Getopt cannot find the parameter associated with a switch, it
-- raises Invalid_Parameter, and sets Full_Switch to return the invalid
-- switch character.
--
@@ -221,24 +227,24 @@ package GNAT.Command_Line is
-- raised and Full_Switch will return "ab".
function Get_Argument (Do_Expansion : Boolean := False) return String;
- -- Returns the next element in the command line which is not a switch.
+ -- Returns the next element on the command line which is not a switch.
-- This function should not be called before Getopt has returned
-- ASCII.NUL.
--
- -- If Expansion is True, then the parameter on the command
- -- line will considered as filename with wild cards, and will be
- -- expanded. The matching file names will be returned one at a time.
- -- When there are no more arguments on the command line, this function
- -- returns an empty string. This is useful in non-Unix systems for
- -- obtaining normal expansion of wild card references.
+ -- If Expansion is True, then the parameter on the command line will be
+ -- considered as a filename with wild cards, and will be expanded. The
+ -- matching file names will be returned one at a time. When there are no
+ -- more arguments on the command line, this function returns an empty
+ -- string. This is useful in non-Unix systems for obtaining normal
+ -- expansion of wild card references.
function Parameter return String;
- -- Returns parameter associated with the last switch returned by Getopt.
- -- If no parameter was associated with the last switch, or no previous
- -- call has been made to Get_Argument, raises Invalid_Parameter.
+ -- Returns the parameter associated with the last switch returned by
+ -- Getopt. If no parameter was associated with the last switch, or no
+ -- previous call has been made to Get_Argument, raises Invalid_Parameter.
-- If the last switch was associated with an optional argument and this
-- argument was not found on the command line, Parameter returns an empty
- -- string
+ -- string.
type Expansion_Iterator is limited private;
-- Type used during expansion of file names
@@ -254,19 +260,19 @@ package GNAT.Command_Line is
-- Basic_Regexp is True). When Directory is an empty string, the current
-- directory is searched.
--
- -- Pattern may contains directory separators (as in "src/*/*.ada").
+ -- Pattern may contain directory separators (as in "src/*/*.ada").
-- Subdirectories of Directory will also be searched, up to one
-- hundred levels deep.
--
-- When Start_Expansion has been called, function Expansion should be
- -- called repetitively until it returns an empty string, before
+ -- called repeatedly until it returns an empty string, before
-- Start_Expansion can be called again with the same Expansion_Iterator
-- variable.
function Expansion (Iterator : Expansion_Iterator) return String;
- -- Return the next file in the directory matching the parameters given
+ -- Returns the next file in the directory matching the parameters given
-- to Start_Expansion and updates Iterator to point to the next entry.
- -- Returns an empty string when there are no more files in the directory
+ -- Returns an empty string when there is no more file in the directory
-- and its subdirectories.
--
-- If Expansion is called again after an empty string has been returned,
@@ -279,8 +285,8 @@ package GNAT.Command_Line is
-- Raised when an invalid switch is detected in the command line
Invalid_Parameter : exception;
- -- Raised when a parameter is missing, or an attempt is made to obtain
- -- a parameter for a switch that does not allow a parameter
+ -- Raised when a parameter is missing, or an attempt is made to obtain a
+ -- parameter for a switch that does not allow a parameter
private
@@ -301,8 +307,8 @@ private
type Expansion_Iterator is limited record
Start : Positive := 1;
- -- Position of the first character of the relative path to check
- -- against the pattern.
+ -- Position of the first character of the relative path to check against
+ -- the pattern.
Dir_Name : String (1 .. Max_Path_Length);
@@ -314,8 +320,8 @@ private
-- Regular expression built with the pattern
Maximum_Depth : Depth := 1;
- -- The maximum depth of directories, reflecting the number of
- -- directory separators in the pattern.
+ -- The maximum depth of directories, reflecting the number of directory
+ -- separators in the pattern.
end record;
diff --git a/gcc/ada/g-comver.adb b/gcc/ada/g-comver.adb
index 0068e2af686..2a0d120d832 100644
--- a/gcc/ada/g-comver.adb
+++ b/gcc/ada/g-comver.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002 Ada Core Technologies --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-crc32.adb b/gcc/ada/g-crc32.adb
index 76b40e802dd..1015103b275 100644
--- a/gcc/ada/g-crc32.adb
+++ b/gcc/ada/g-crc32.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2002 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -49,9 +49,7 @@ package body GNAT.CRC32 is
procedure Update (C : in out CRC32; Value : Ada.Streams.Stream_Element) is
function To_Char is new Unchecked_Conversion
(Ada.Streams.Stream_Element, Character);
-
V : constant Character := To_Char (Value);
-
begin
Update (C, V);
end Update;
@@ -73,9 +71,7 @@ package body GNAT.CRC32 is
procedure Wide_Update (C : in out CRC32; Value : Wide_Character) is
subtype S2 is String (1 .. 2);
function To_S2 is new Unchecked_Conversion (Wide_Character, S2);
-
VS : constant S2 := To_S2 (Value);
-
begin
Update (C, VS (1));
Update (C, VS (2));
diff --git a/gcc/ada/g-crc32.ads b/gcc/ada/g-crc32.ads
index 867c07f4afd..dac4c427812 100644
--- a/gcc/ada/g-crc32.ads
+++ b/gcc/ada/g-crc32.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2004-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,7 @@
-- called CRC-32. This is a checksum based on treating the binary data
-- as a polynomial over a binary field, and the exact specifications of
-- the CRC-32 algorithm are as follows:
---
+
-- Name : "CRC-32"
-- Width : 32
-- Poly : 04C11DB7
@@ -44,15 +44,15 @@
-- RefOut : True
-- XorOut : FFFFFFFF
-- Check : CBF43926
---
--- Note that this is the algorithm used by PKZip, Ethernet and FDDI.
---
+
+-- Note that this is the algorithm used by PKZip, Ethernet and FDDI
+
-- For more information about this algorithm see:
---
--- ftp://ftp.rocksoft.com/papers/crc_v3.txt
+
+-- ftp://ftp.rocksoft.com/papers/crc_v3.txt
-- "A Painless Guide to CRC Error Detection Algorithms", Ross N. Williams
---
+
-- "Computation of Cyclic Redundancy Checks via Table Look-Up", Communications
-- of the ACM, Vol. 31 No. 8, pp.1008-1013 Aug. 1988. Sarwate, D.V.
diff --git a/gcc/ada/g-ctrl_c.ads b/gcc/ada/g-ctrl_c.ads
index af88ebfdb14..8a9c84058c9 100644
--- a/gcc/ada/g-ctrl_c.ads
+++ b/gcc/ada/g-ctrl_c.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -34,9 +34,9 @@
-- This package may be used to intercept the interruption of a running
-- program by the operator typing Control-C, without having to use an Ada
-- interrupt handler protected object.
---
--- This package is currently implemented under Windows and Unix platforms.
---
+
+-- This package is currently implemented under Windows and Unix platforms
+
-- Note concerning Unix systems:
-- The behavior of this package when using tasking depends on the interaction
@@ -55,7 +55,7 @@ package GNAT.Ctrl_C is
-- Handler_Type should not propagate exceptions.
procedure Install_Handler (Handler : Handler_Type);
- -- Set up Handler to be called if the operator hits Ctrl-C.
+ -- Set up Handler to be called if the operator hits Ctrl-C
procedure Uninstall_Handler;
-- Reinstall the standard Control-C handler.
diff --git a/gcc/ada/g-curexc.ads b/gcc/ada/g-curexc.ads
index 7fff4f303b1..783a6489096 100644
--- a/gcc/ada/g-curexc.ads
+++ b/gcc/ada/g-curexc.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1996-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -50,7 +50,7 @@ package GNAT.Current_Exception is
-- Subprograms --
-----------------
- -- Note: the lower bound of returnd String values is always one.
+ -- Note: the lower bound of returnd String values is always one
function Exception_Information return String;
-- Returns the result of calling Ada.Exceptions.Exception_Information
diff --git a/gcc/ada/g-debpoo.adb b/gcc/ada/g-debpoo.adb
index eeb36a2d5dd..1854623da34 100644
--- a/gcc/ada/g-debpoo.adb
+++ b/gcc/ada/g-debpoo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -47,7 +47,7 @@ with Ada.Unchecked_Conversion;
package body GNAT.Debug_Pools is
- Default_Alignment : constant Storage_Offset := Standard'Maximum_Alignment;
+ Default_Alignment : constant := Standard'Maximum_Alignment;
-- Alignment used for the memory chunks returned by Allocate. Using this
-- value garantees that this alignment will be compatible with all types
-- and at the same time makes it easy to find the location of the extra
@@ -63,14 +63,15 @@ package body GNAT.Debug_Pools is
-- Maximum number of levels that will be ignored in backtraces. This is so
-- that we still have enough significant levels in the tracebacks returned
-- to the user.
+ --
-- The value 10 is chosen as being greater than the maximum callgraph
-- in this package. Its actual value is not really relevant, as long as it
-- is high enough to make sure we still have enough frames to return to
-- the user after we have hidden the frames internal to this package.
- -----------------------
- -- Tracebacks_Htable --
- -----------------------
+ ---------------------------
+ -- Back Trace Hash Table --
+ ---------------------------
-- This package needs to store one set of tracebacks for each allocation
-- point (when was it allocated or deallocated). This would use too much
@@ -103,19 +104,28 @@ package body GNAT.Debug_Pools is
Next : Traceback_Htable_Elem_Ptr;
end record;
+ -- Subprograms used for the Backtrace_Htable instantiation
+
procedure Set_Next
(E : Traceback_Htable_Elem_Ptr;
Next : Traceback_Htable_Elem_Ptr);
+ pragma Inline (Set_Next);
+
function Next
- (E : Traceback_Htable_Elem_Ptr)
- return Traceback_Htable_Elem_Ptr;
+ (E : Traceback_Htable_Elem_Ptr) return Traceback_Htable_Elem_Ptr;
+ pragma Inline (Next);
+
function Get_Key
- (E : Traceback_Htable_Elem_Ptr)
- return Tracebacks_Array_Access;
+ (E : Traceback_Htable_Elem_Ptr) return Tracebacks_Array_Access;
+ pragma Inline (Get_Key);
+
function Hash (T : Tracebacks_Array_Access) return Header;
+ pragma Inline (Hash);
+
function Equal (K1, K2 : Tracebacks_Array_Access) return Boolean;
- pragma Inline (Set_Next, Next, Get_Key, Hash);
- -- Subprograms required for instantiation of the htable. See GNAT.HTable.
+ -- Why is this not inlined???
+
+ -- The hash table for back traces
package Backtrace_Htable is new GNAT.HTable.Static_HTable
(Header_Num => Header,
@@ -136,24 +146,26 @@ package body GNAT.Debug_Pools is
type Allocation_Header;
type Allocation_Header_Access is access Allocation_Header;
- -- The following record stores extra information that needs to be
- -- memorized for each block allocated with the special debug pool.
-
type Traceback_Ptr_Or_Address is new System.Address;
-- A type that acts as a C union, and is either a System.Address or a
-- Traceback_Htable_Elem_Ptr.
+ -- The following record stores extra information that needs to be
+ -- memorized for each block allocated with the special debug pool.
+
type Allocation_Header is record
Allocation_Address : System.Address;
- -- Address of the block returned by malloc, possibly unaligned.
+ -- Address of the block returned by malloc, possibly unaligned
- Block_Size : Storage_Offset;
+ Block_Size : Storage_Offset;
-- Needed only for advanced freeing algorithms (traverse all allocated
-- blocks for potential references). This value is negated when the
-- chunk of memory has been logically freed by the application. This
-- chunk has not been physically released yet.
- Alloc_Traceback : Traceback_Htable_Elem_Ptr;
+ Alloc_Traceback : Traceback_Htable_Elem_Ptr;
+ -- ??? comment required
+
Dealloc_Traceback : Traceback_Ptr_Or_Address;
-- Pointer to the traceback for the allocation (if the memory chunk is
-- still valid), or to the first deallocation otherwise. Make sure this
@@ -177,22 +189,24 @@ package body GNAT.Debug_Pools is
function To_Address is new Ada.Unchecked_Conversion
(Traceback_Ptr_Or_Address, System.Address);
+
function To_Address is new Ada.Unchecked_Conversion
(System.Address, Traceback_Ptr_Or_Address);
+
function To_Traceback is new Ada.Unchecked_Conversion
(Traceback_Ptr_Or_Address, Traceback_Htable_Elem_Ptr);
+
function To_Traceback is new Ada.Unchecked_Conversion
(Traceback_Htable_Elem_Ptr, Traceback_Ptr_Or_Address);
- Header_Offset : constant Storage_Count
- := Default_Alignment *
- ((Allocation_Header'Size / System.Storage_Unit + Default_Alignment - 1)
- / Default_Alignment);
- -- Offset of user data after allocation header.
+ Header_Offset : constant Storage_Count :=
+ Default_Alignment *
+ ((Allocation_Header'Size / System.Storage_Unit
+ + Default_Alignment - 1) / Default_Alignment);
+ -- Offset of user data after allocation header
Minimum_Allocation : constant Storage_Count :=
- Default_Alignment - 1
- + Header_Offset;
+ Default_Alignment - 1 + Header_Offset;
-- Minimal allocation: size of allocation_header rounded up to next
-- multiple of default alignment + worst-case padding.
@@ -200,14 +214,14 @@ package body GNAT.Debug_Pools is
-- Allocations table --
-----------------------
- -- This table is indexed on addresses modulo Default_Alignment, and
- -- for each index it indicates whether that memory block is valid.
- -- Its behavior is similar to GNAT.Table, except that we need to pack
- -- the table to save space, so we cannot reuse GNAT.Table as is.
+ -- This table is indexed on addresses modulo Default_Alignment, and for
+ -- each index it indicates whether that memory block is valid. Its behavior
+ -- is similar to GNAT.Table, except that we need to pack the table to save
+ -- space, so we cannot reuse GNAT.Table as is.
- -- This table is the reason why all alignments have to be forced to a
- -- common value (Default_Alignment), so that this table can be
- -- kept to a reasonnable size.
+ -- This table is the reason why all alignments have to be forced to common
+ -- value (Default_Alignment), so that this table can be kept to a
+ -- reasonnable size.
type Byte is mod 2 ** System.Storage_Unit;
@@ -242,18 +256,17 @@ package body GNAT.Debug_Pools is
-- These two variables represents a mapping of the currently allocated
-- memory. Every time the pool works on an address, we first check that the
-- index Address / Default_Alignment is True. If not, this means that this
- -- address is not under control of the debug pool, and thus this is
- -- probably an invalid memory access (it could also be a general access
- -- type).
+ -- address is not under control of the debug pool and thus this is probably
+ -- an invalid memory access (it could also be a general access type).
--
-- Note that in fact we never allocate the full size of Big_Table, only a
-- slice big enough to manage the currently allocated memory.
- Edata : System.Address := System.Null_Address;
+ Edata : System.Address := System.Null_Address;
-- Address in memory that matches the index 0 in Valid_Blocks. It is named
-- after the symbol _edata, which, on most systems, indicate the lowest
- -- possible address returned by malloc. Unfortunately, this symbol
- -- doesn't exist on windows, so we cannot use it instead of this variable.
+ -- possible address returned by malloc. Unfortunately, this symbol doesn't
+ -- exist on windows, so we cannot use it instead of this variable.
-----------------------
-- Local subprograms --
@@ -264,16 +277,15 @@ package body GNAT.Debug_Pools is
Kind : Traceback_Kind;
Size : Storage_Count;
Ignored_Frame_Start : System.Address;
- Ignored_Frame_End : System.Address)
- return Traceback_Htable_Elem_Ptr;
+ Ignored_Frame_End : System.Address) return Traceback_Htable_Elem_Ptr;
-- Return an element matching the current traceback (omitting the frames
-- that are in the current package). If this traceback already existed in
-- the htable, a pointer to this is returned to spare memory. Null is
-- returned if the pool is set not to store tracebacks. If the traceback
-- already existed in the table, the count is incremented so that
- -- Dump_Tracebacks returns useful results.
- -- All addresses up to, and including, an address between
- -- Ignored_Frame_Start .. Ignored_Frame_End are ignored.
+ -- Dump_Tracebacks returns useful results. All addresses up to, and
+ -- including, an address between Ignored_Frame_Start .. Ignored_Frame_End
+ -- are ignored.
procedure Put_Line
(Depth : Natural;
@@ -364,9 +376,7 @@ package body GNAT.Debug_Pools is
----------
function Next
- (E : Traceback_Htable_Elem_Ptr)
- return Traceback_Htable_Elem_Ptr
- is
+ (E : Traceback_Htable_Elem_Ptr) return Traceback_Htable_Elem_Ptr is
begin
return E.Next;
end Next;
@@ -386,8 +396,7 @@ package body GNAT.Debug_Pools is
-------------
function Get_Key
- (E : Traceback_Htable_Elem_Ptr)
- return Tracebacks_Array_Access
+ (E : Traceback_Htable_Elem_Ptr) return Tracebacks_Array_Access
is
begin
return E.Traceback;
@@ -399,10 +408,12 @@ package body GNAT.Debug_Pools is
function Hash (T : Tracebacks_Array_Access) return Header is
Result : Integer_Address := 0;
+
begin
for X in T'Range loop
Result := Result + To_Integer (PC_For (T (X)));
end loop;
+
return Header (1 + Result mod Integer_Address (Header'Last));
end Hash;
@@ -496,8 +507,7 @@ package body GNAT.Debug_Pools is
Kind : Traceback_Kind;
Size : Storage_Count;
Ignored_Frame_Start : System.Address;
- Ignored_Frame_End : System.Address)
- return Traceback_Htable_Elem_Ptr
+ Ignored_Frame_End : System.Address) return Traceback_Htable_Elem_Ptr
is
begin
if Pool.Stack_Trace_Depth = 0 then
@@ -515,7 +525,7 @@ package body GNAT.Debug_Pools is
Skip_Levels (Pool.Stack_Trace_Depth, Trace, Start, Len,
Ignored_Frame_Start, Ignored_Frame_End);
- -- Check if the traceback is already in the table.
+ -- Check if the traceback is already in the table
Elem :=
Backtrace_Htable.Get (Trace (Start .. Len)'Unrestricted_Access);
@@ -547,9 +557,7 @@ package body GNAT.Debug_Pools is
function Is_Valid (Storage : System.Address) return Boolean is
Offset : constant Storage_Offset :=
(Storage - Edata) / Default_Alignment;
-
Bit : constant Byte := 2 ** Natural (Offset mod System.Storage_Unit);
-
begin
return (Storage mod Default_Alignment) = 0
and then Offset >= 0
@@ -621,13 +629,27 @@ package body GNAT.Debug_Pools is
Valid_Blocks_Size := Valid_Blocks_Size + Bytes;
-- Take into the account the new start address
+
Edata := Storage - Edata_Align + (Edata - Storage) mod Edata_Align;
end if;
-- Second case : the new address is outside of the current scope of
- -- Valid_Blocks, so we have to grow the table as appropriate
+ -- Valid_Blocks, so we have to grow the table as appropriate.
- Offset := (Storage - Edata) / Default_Alignment;
+ -- Note: it might seem more natural for the following statement to
+ -- be written:
+
+ -- Offset := (Storage - Edata) / Default_Alignment;
+
+ -- but that won't work since Storage_Offset is signed, and it is
+ -- possible to subtract a small address from a large address and
+ -- get a negative value. This may seem strange, but it is quite
+ -- specifically allowed in the RM, and is what most implementations
+ -- including GNAT actually do. Hence the conversion to Integer_Address
+ -- which is a full range modular type, not subject to this glitch.
+
+ Offset := Storage_Offset ((To_Integer (Storage) - To_Integer (Edata)) /
+ Default_Alignment);
if Offset >= Valid_Blocks_Size * System.Storage_Unit then
Bytes := Valid_Blocks_Size;
@@ -717,10 +739,12 @@ package body GNAT.Debug_Pools is
P := new Local_Storage_Array;
end;
- Storage_Address := System.Null_Address + Default_Alignment
- * (((P.all'Address + Default_Alignment - 1) - System.Null_Address)
- / Default_Alignment)
+ Storage_Address :=
+ System.Null_Address + Default_Alignment
+ * (((P.all'Address + Default_Alignment - 1) - System.Null_Address)
+ / Default_Alignment)
+ Header_Offset;
+
pragma Assert ((Storage_Address - System.Null_Address)
mod Default_Alignment = 0);
pragma Assert (Storage_Address + Size_In_Storage_Elements
@@ -940,7 +964,7 @@ package body GNAT.Debug_Pools is
System.Memory.Free (Header.Allocation_Address);
Set_Valid (Tmp, False);
- -- Remove this block from the list.
+ -- Remove this block from the list
if Previous = System.Null_Address then
Pool.First_Free_Block := Next;
@@ -1038,7 +1062,6 @@ package body GNAT.Debug_Pools is
procedure Reset_Marks is
Current : System.Address := Pool.First_Free_Block;
Header : Allocation_Header_Access;
-
begin
while Current /= System.Null_Address loop
Header := Header_Of (Current);
@@ -1126,7 +1149,7 @@ package body GNAT.Debug_Pools is
end if;
else
- -- Remove this block from the list of used blocks.
+ -- Remove this block from the list of used blocks
Previous :=
To_Address (Header_Of (Storage_Address).Dealloc_Traceback);
@@ -1459,7 +1482,6 @@ package body GNAT.Debug_Pools is
function Storage_Size (Pool : Debug_Pool) return Storage_Count is
pragma Unreferenced (Pool);
-
begin
return Storage_Count'Last;
end Storage_Size;
@@ -1535,7 +1557,6 @@ package body GNAT.Debug_Pools is
procedure Internal is new Print_Info
(Put_Line => GNAT.IO.Put_Line,
Put => GNAT.IO.Put);
-
begin
Internal (Pool, Cumulate, Display_Slots, Display_Leaks);
end Print_Info_Stdout;
@@ -1594,9 +1615,10 @@ package body GNAT.Debug_Pools is
Tracebk := Header.Alloc_Traceback.Traceback;
Num_Calls := Tracebk'Length;
- -- Code taken from memtrack.adb in GNAT's sources
- -- Logs allocation call
- -- format is:
+ -- (Code taken from memtrack.adb in GNAT's sources)
+
+ -- Logs allocation call using the format:
+
-- 'A' <mem addr> <size chunk> <len backtrace> <addr1> ... <addrn>
fputc (Character'Pos ('A'), File);
diff --git a/gcc/ada/g-debpoo.ads b/gcc/ada/g-debpoo.ads
index 87d2ba781d8..3d558a8f269 100644
--- a/gcc/ada/g-debpoo.ads
+++ b/gcc/ada/g-debpoo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,7 +31,7 @@
-- --
------------------------------------------------------------------------------
--- This packages provides a special implementation of the Ada95 storage pools.
+-- This packages provides a special implementation of the Ada95 storage pools
-- The goal of this debug pool is to detect incorrect uses of memory
-- (multiple deallocations, access to invalid memory,...). Errors are reported
@@ -70,7 +70,7 @@
-- of memory that was allocated. The pool is also designed to work correctly
-- in conjunction with gnatmem.
--- Finally, a subprogram Print_Pool is provided for use from the debugger.
+-- Finally, a subprogram Print_Pool is provided for use from the debugger
-- Limitations
-- ===========
@@ -300,7 +300,7 @@ private
-- accesed to deallocated memory.
Physically_Deallocated : Byte_Count := 0;
- -- Total number of bytes that were free()-ed.
+ -- Total number of bytes that were free()-ed
Marked_Blocks_Deallocated : Boolean := False;
-- Set to true if some mark blocks had to be deallocated in the advanced
@@ -313,7 +313,7 @@ private
First_Free_Block : System.Address := System.Null_Address;
Last_Free_Block : System.Address := System.Null_Address;
- -- Pointers to the first and last logically freed blocks.
+ -- Pointers to the first and last logically freed blocks
First_Used_Block : System.Address := System.Null_Address;
-- Pointer to the list of currently allocated blocks. This list is
diff --git a/gcc/ada/g-debuti.adb b/gcc/ada/g-debuti.adb
index f059bf6d41c..560f79f96d8 100644
--- a/gcc/ada/g-debuti.adb
+++ b/gcc/ada/g-debuti.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 1997-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -47,13 +47,14 @@ package body GNAT.Debug_Utilities is
function Image (A : Address) return Image_String is
S : Image_String;
- P : Natural := Address_Image_Length - 1;
- N : Integer_Address := To_Integer (A);
+ P : Natural;
+ N : Integer_Address;
U : Natural := 0;
begin
S (S'Last) := '#';
-
+ P := Address_Image_Length - 1;
+ N := To_Integer (A);
while P > 3 loop
if U = 4 then
S (P) := '_';
diff --git a/gcc/ada/g-diopit.adb b/gcc/ada/g-diopit.adb
index c3a19e3a479..92c7be128be 100644
--- a/gcc/ada/g-diopit.adb
+++ b/gcc/ada/g-diopit.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Adacore, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -57,7 +57,7 @@ package body GNAT.Directory_Operations.Iteration is
-- recursively for each sub-directories.
function Make_Pathname (Dir, File : String) return String;
- -- Returns the pathname for File by adding Dir as prefix.
+ -- Returns the pathname for File by adding Dir as prefix
-------------------
-- Make_Pathname --
@@ -379,6 +379,8 @@ package body GNAT.Directory_Operations.Iteration is
end if;
end Read;
+ -- Start of processing for Wildcard_Iterator
+
begin
if Path = "" then
return;
diff --git a/gcc/ada/g-diopit.ads b/gcc/ada/g-diopit.ads
index 278aed05216..42afcd1ee7c 100644
--- a/gcc/ada/g-diopit.ads
+++ b/gcc/ada/g-diopit.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-dirope.adb b/gcc/ada/g-dirope.adb
index d9b2c0b0d04..dc6977596a5 100644
--- a/gcc/ada/g-dirope.adb
+++ b/gcc/ada/g-dirope.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1998-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-dirope.ads b/gcc/ada/g-dirope.ads
index 226c593cc74..11d90704846 100644
--- a/gcc/ada/g-dirope.ads
+++ b/gcc/ada/g-dirope.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1998-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-dyntab.adb b/gcc/ada/g-dyntab.adb
index 5f33eb0067f..19440979ab1 100644
--- a/gcc/ada/g-dyntab.adb
+++ b/gcc/ada/g-dyntab.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -328,9 +328,7 @@ package body GNAT.Dynamic_Tables is
-- Start of processing for Sort_Table
begin
-
Heap_Sort.Sort (Natural (Last (Table) - First) + 1);
-
end Sort_Table;
end GNAT.Dynamic_Tables;
diff --git a/gcc/ada/g-dyntab.ads b/gcc/ada/g-dyntab.ads
index 1a7f1efc6d5..3d82330dac1 100644
--- a/gcc/ada/g-dyntab.ads
+++ b/gcc/ada/g-dyntab.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -101,11 +101,10 @@ package GNAT.Dynamic_Tables is
-- safety is not compromised by this approach.
type Table_Ptr is access all Big_Table_Type;
- -- The table is actually represented as a pointer to allow
- -- reallocation.
+ -- The table is actually represented as a pointer to allow reallocation
type Table_Private is private;
- -- table private data that is not exported in Instance.
+ -- Table private data that is not exported in Instance
type Instance is record
Table : aliased Table_Ptr := null;
diff --git a/gcc/ada/g-eacodu-vms.adb b/gcc/ada/g-eacodu-vms.adb
index 7bab036648d..d2a8f3930ac 100644
--- a/gcc/ada/g-eacodu-vms.adb
+++ b/gcc/ada/g-eacodu-vms.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,7 +31,7 @@
-- --
------------------------------------------------------------------------------
--- This is the VMS version.
+-- This is the VMS version
with System;
with System.Aux_DEC;
diff --git a/gcc/ada/g-enblsp-vms-alpha.adb b/gcc/ada/g-enblsp-vms-alpha.adb
index 4410a114ea9..97af39864c7 100644
--- a/gcc/ada/g-enblsp-vms-alpha.adb
+++ b/gcc/ada/g-enblsp-vms-alpha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,7 @@
-- for use by the VMS GNAT.Expect package (g-expect-vms.adb). This package
-- should not be directly with'ed by an application program.
--- This version is for Alpha/VMS.
+-- This version is for Alpha/VMS
separate (GNAT.Expect)
procedure Non_Blocking_Spawn
@@ -75,7 +75,7 @@ begin
raise Invalid_Process;
end if;
- -- Fork a new process. It's not possible to do this in a subprogram.
+ -- Fork a new process (it is not possible to do this in a subprogram)
if Alloc_Vfork_Blocks >= 0 then
Descriptor.Pid := Get_Current_Invo_Context (Get_Vfork_Jmpbuf);
@@ -83,10 +83,10 @@ begin
Descriptor.Pid := -1;
end if;
- -- Are we now in the child (or, for Windows, still in the common
- -- process).
+ -- Are we now in the child
if Descriptor.Pid = Null_Pid then
+
-- Prepare an array of arguments to pass to C
Arg := new String (1 .. Command_With_Path'Length + 1);
diff --git a/gcc/ada/g-enblsp-vms-ia64.adb b/gcc/ada/g-enblsp-vms-ia64.adb
index 0224a3decbb..2a1fee8ffbd 100644
--- a/gcc/ada/g-enblsp-vms-ia64.adb
+++ b/gcc/ada/g-enblsp-vms-ia64.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,7 @@
-- for use by the VMS GNAT.Expect package (g-expect-vms.adb). This package
-- should not be directly with'ed by an application program.
--- This version is for IA64/VMS.
+-- This version is for IA64/VMS
separate (GNAT.Expect)
procedure Non_Blocking_Spawn
@@ -73,7 +73,7 @@ begin
raise Invalid_Process;
end if;
- -- Fork a new process. It's not possible to do this in a subprogram.
+ -- Fork a new process (it is not possible to do this in a subprogram)
if Alloc_Vfork_Blocks >= 0 then
Descriptor.Pid := Setjmp1 (Get_Vfork_Jmpbuf);
@@ -81,10 +81,10 @@ begin
Descriptor.Pid := -1;
end if;
- -- Are we now in the child (or, for Windows, still in the common
- -- process).
+ -- Are we now in the child
if Descriptor.Pid = Null_Pid then
+
-- Prepare an array of arguments to pass to C
Arg := new String (1 .. Command_With_Path'Length + 1);
diff --git a/gcc/ada/g-excact.adb b/gcc/ada/g-excact.adb
index c27ab088833..bd5e4c0cafd 100644
--- a/gcc/ada/g-excact.adb
+++ b/gcc/ada/g-excact.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-excact.ads b/gcc/ada/g-excact.ads
index f57a5210198..09b481ba4e3 100644
--- a/gcc/ada/g-excact.ads
+++ b/gcc/ada/g-excact.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,7 +31,7 @@
-- --
------------------------------------------------------------------------------
--- This package provides support for callbacks on exceptions.
+-- This package provides support for callbacks on exceptions
-- These callbacks are called immediately when either a specific exception,
-- or any exception, is raised, before any other actions taken by raise, in
diff --git a/gcc/ada/g-except.ads b/gcc/ada/g-except.ads
index 6ad0673306e..9daa08d5d56 100644
--- a/gcc/ada/g-except.ads
+++ b/gcc/ada/g-except.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -46,7 +46,7 @@ package GNAT.Exceptions is
pragma Pure;
type Exception_Type is limited null record;
- -- Type used to specify which exception to raise.
+ -- Type used to specify which exception to raise
-- Really Exception_Type is Exception_Id, but Exception_Id can't be
-- used directly since it is declared in the non-pure unit Ada.Exceptions,
diff --git a/gcc/ada/g-exctra.adb b/gcc/ada/g-exctra.adb
index c05f964bc0b..7d51ba4b79b 100644
--- a/gcc/ada/g-exctra.adb
+++ b/gcc/ada/g-exctra.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2002 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -48,8 +48,7 @@ package body GNAT.Exception_Traces is
function Decorator_Wrapper
(Traceback : System.Address;
- Len : Natural)
- return String;
+ Len : Natural) return String;
-- The wrapper to be called when a decorator is in place for exception
-- backtraces.
--
@@ -68,8 +67,7 @@ package body GNAT.Exception_Traces is
function Decorator_Wrapper
(Traceback : System.Address;
- Len : Natural)
- return String
+ Len : Natural) return String
is
Decorator_Traceback : Tracebacks_Array (1 .. Len);
for Decorator_Traceback'Address use Traceback;
diff --git a/gcc/ada/g-exctra.ads b/gcc/ada/g-exctra.ads
index df103151719..b11a23e2e91 100644
--- a/gcc/ada/g-exctra.ads
+++ b/gcc/ada/g-exctra.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -34,18 +34,18 @@
-- This package provides an interface allowing to control *automatic* output
-- to standard error upon exception occurrences (as opposed to explicit
-- generation of traceback information using GNAT.Traceback).
---
+
-- This output includes the basic information associated with the exception
-- (name, message) as well as a backtrace of the call chain at the point
-- where the exception occurred. This backtrace is only output if the call
-- chain information is available, depending if the binder switch dedicated
-- to that purpose has been used or not.
---
+
-- The default backtrace is in the form of absolute code locations which may
-- be converted to corresponding source locations using the addr2line utility
-- or from within GDB. Please refer to GNAT.Traceback for information about
-- what is necessary to be able to exploit thisg possibility.
---
+
-- The backtrace output can also be customized by way of a "decorator" which
-- may return any string output in association with a provided call chain.
@@ -72,7 +72,7 @@ package GNAT.Exception_Traces is
-- traces identified by the above trace kind values.
procedure Trace_On (Kind : Trace_Kind);
- -- Activate the traces denoted by Kind.
+ -- Activate the traces denoted by Kind
procedure Trace_Off;
-- Stop the tracing requested by the last call to Trace_On.
diff --git a/gcc/ada/g-expect-vms.adb b/gcc/ada/g-expect-vms.adb
index cbf8c724302..b37449f7e33 100644
--- a/gcc/ada/g-expect-vms.adb
+++ b/gcc/ada/g-expect-vms.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,7 +31,7 @@
-- --
------------------------------------------------------------------------------
--- This is the VMS version.
+-- This is the VMS version
with System; use System;
with Ada.Calendar; use Ada.Calendar;
@@ -113,7 +113,7 @@ package body GNAT.Expect is
function Waitpid (Pid : Process_Id) return Integer;
pragma Import (C, Waitpid, "__gnat_waitpid");
- -- Wait for a specific process id, and return its exit code.
+ -- Wait for a specific process id, and return its exit code
---------
-- "+" --
@@ -330,7 +330,7 @@ package body GNAT.Expect is
-- Calculate the timeout for the next turn.
-- Note that Timeout is, from the caller's perspective, the maximum
-- time until a match, not the maximum time until some output is
- -- read, and thus can not be reused as is for Expect_Internal.
+ -- read, and thus cannot be reused as is for Expect_Internal.
if Timeout /= -1 then
Timeout_Tmp := Integer (Try_Until - Clock) * 1000;
@@ -660,7 +660,7 @@ package body GNAT.Expect is
Descriptors (J).Buffer_Size - N;
end if;
- -- Keep what we read in the buffer.
+ -- Keep what we read in the buffer
Descriptors (J).Buffer
(Descriptors (J).Buffer_Index + 1 ..
@@ -1046,7 +1046,7 @@ package body GNAT.Expect is
is
begin
Kill (Descriptor.Pid, Signal);
- -- ??? Need to check process status here.
+ -- ??? Need to check process status here
end Send_Signal;
---------------------------------
diff --git a/gcc/ada/g-expect.adb b/gcc/ada/g-expect.adb
index e94d5b657a1..1cb07881f12 100644
--- a/gcc/ada/g-expect.adb
+++ b/gcc/ada/g-expect.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -89,8 +89,9 @@ package body GNAT.Expect is
procedure Dup2 (Old_Fd, New_Fd : File_Descriptor);
pragma Import (C, Dup2);
- procedure Kill (Pid : Process_Id; Sig_Num : Integer);
+ procedure Kill (Pid : Process_Id; Sig_Num : Integer; Close : Integer);
pragma Import (C, Kill, "__gnat_kill");
+ -- if Close is set to 1 all OS resources used by the Pid must be freed
function Create_Pipe (Pipe : access Pipe_Type) return Integer;
pragma Import (C, Create_Pipe, "__gnat_pipe");
@@ -221,7 +222,7 @@ package body GNAT.Expect is
-- ??? Should have timeouts for different signals
- Kill (Descriptor.Pid, 9);
+ Kill (Descriptor.Pid, 9, 0);
GNAT.OS_Lib.Free (Descriptor.Buffer);
Descriptor.Buffer_Size := 0;
@@ -339,10 +340,11 @@ package body GNAT.Expect is
return;
end if;
- -- Calculate the timeout for the next turn.
+ -- Calculate the timeout for the next turn
+
-- Note that Timeout is, from the caller's perspective, the maximum
-- time until a match, not the maximum time until some output is
- -- read, and thus can not be reused as is for Expect_Internal.
+ -- read, and thus cannot be reused as is for Expect_Internal.
if Timeout /= -1 then
Timeout_Tmp := Integer (Try_Until - Clock) * 1000;
@@ -1148,7 +1150,7 @@ package body GNAT.Expect is
Signal : Integer)
is
begin
- Kill (Descriptor.Pid, Signal);
+ Kill (Descriptor.Pid, Signal, 1);
-- ??? Need to check process status here
end Send_Signal;
diff --git a/gcc/ada/g-expect.ads b/gcc/ada/g-expect.ads
index 2a82e4dd2c5..b47a3a487d7 100644
--- a/gcc/ada/g-expect.ads
+++ b/gcc/ada/g-expect.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-flocon.ads b/gcc/ada/g-flocon.ads
index 20d2a9a5716..ea60768db1a 100644
--- a/gcc/ada/g-flocon.ads
+++ b/gcc/ada/g-flocon.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005 AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-heasor.ads b/gcc/ada/g-heasor.ads
index 67c3ebe6f30..e3b406728cb 100644
--- a/gcc/ada/g-heasor.ads
+++ b/gcc/ada/g-heasor.ads
@@ -37,16 +37,19 @@
-- subprogram parameters, so that it can be used with different types with
-- shared sorting code.
--- See also GNAT.Heap_Sort_G and GNAT.Heap_Sort_A. These are older versions
--- of this routine. In some cases GNAT.Heap_Sort_G may be a little faster
--- than GNAT.Heap_Sort, at the expense of generic code duplication and a
--- less convenient interface. The generic version also has the advantage
--- of being Pure, while this unit can only be Preelaborate.
-
-- This heapsort algorithm uses approximately N*log(N) compares in the
-- worst case and is in place with no additional storage required. See
-- the body for exact details of the algorithm used.
+-- See also GNAT.Heap_Sort_G which is a generic version that will be faster
+-- since the overhead of the indirect calls is avoided, at the expense of
+-- generic code duplication and less convenient interface. The generic version
+-- also has the advantage of being Pure, while this unit can only be
+-- Preelaborate, because of the access types.
+
+-- Note: GNAT.Heap_Sort replaces and obsoletes GNAT.Heap_Sort_A, which is
+-- retained in the GNAT library for backwards compatibility.
+
package GNAT.Heap_Sort is
pragma Preelaborate;
diff --git a/gcc/ada/g-hesorg.ads b/gcc/ada/g-hesorg.ads
index 3f4d2a0721b..04f2371d5b0 100644
--- a/gcc/ada/g-hesorg.ads
+++ b/gcc/ada/g-hesorg.ads
@@ -58,14 +58,16 @@ generic
with procedure Move (From : Natural; To : Natural);
-- A procedure that moves the data item with index value From to the data
-- item with index value To (the old value in To being lost). An index
- -- value of zero is used for moves from and to a single temporary location
+ -- value of zero is used for moves from and to a single temporary location.
+ -- For best efficiency, this routine should be marked as inlined.
with function Lt (Op1, Op2 : Natural) return Boolean;
-- A function that compares two items and returns True if the item with
-- index Op1 is less than the item with Index Op2, and False if the Op1
-- item is greater than the Op2 item. If the two items are equal, then
-- it does not matter whether True or False is returned (it is slightly
- -- more efficient to return False).
+ -- more efficient to return False). For best efficiency, this routine
+ -- should be marked as inlined.
-- Note on use of temporary location
diff --git a/gcc/ada/g-io.adb b/gcc/ada/g-io.adb
index 4d5f4ec1c8d..c5c762bc569 100644
--- a/gcc/ada/g-io.adb
+++ b/gcc/ada/g-io.adb
@@ -42,19 +42,15 @@ package body GNAT.IO is
---------
procedure Get (X : out Integer) is
-
function Get_Int return Integer;
pragma Import (C, Get_Int, "get_int");
-
begin
X := Get_Int;
end Get;
procedure Get (C : out Character) is
-
function Get_Char return Character;
pragma Import (C, Get_Char, "get_char");
-
begin
C := Get_Char;
end Get;
@@ -108,7 +104,6 @@ package body GNAT.IO is
end Put;
procedure Put (File : File_Type; X : Integer) is
-
procedure Put_Int (X : Integer);
pragma Import (C, Put_Int, "put_int");
@@ -128,7 +123,6 @@ package body GNAT.IO is
end Put;
procedure Put (File : in File_Type; C : Character) is
-
procedure Put_Char (C : Character);
pragma Import (C, Put_Char, "put_char");
diff --git a/gcc/ada/g-locfil.ads b/gcc/ada/g-locfil.ads
index 6bc5af04da0..8bdc2be635e 100644
--- a/gcc/ada/g-locfil.ads
+++ b/gcc/ada/g-locfil.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1995-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1995-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-md5.adb b/gcc/ada/g-md5.adb
index e072b716c5c..2146c19773e 100644
--- a/gcc/ada/g-md5.adb
+++ b/gcc/ada/g-md5.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -138,7 +138,7 @@ package body GNAT.MD5 is
procedure Transform
(C : in out Context;
Block : String);
- -- Process one block of 64 characters.
+ -- Process one block of 64 characters
------------
-- Decode --
@@ -148,7 +148,7 @@ package body GNAT.MD5 is
(Block : String;
X : out Sixteen_Words)
is
- Cur : Positive := Block'First;
+ Cur : Positive := Block'First;
begin
pragma Assert (Block'Length = 64);
@@ -171,7 +171,7 @@ package body GNAT.MD5 is
Result : Message_Digest;
Cur : Natural := 1;
- -- Index in Result where the next character will be placed.
+ -- Index in Result where the next character will be placed
Last_Block : String (1 .. 64);
@@ -519,7 +519,6 @@ package body GNAT.MD5 is
function Wide_Digest (W : Wide_String) return Message_Digest is
C : Context;
-
begin
Wide_Update (C, W);
return Digest (C);
@@ -533,7 +532,6 @@ package body GNAT.MD5 is
(C : in out Context;
Input : Wide_String)
is
-
String_Input : String (1 .. 2 * Input'Length);
Cur : Positive := 1;
diff --git a/gcc/ada/g-md5.ads b/gcc/ada/g-md5.ads
index f41e7b7219c..2fff917efba 100644
--- a/gcc/ada/g-md5.ads
+++ b/gcc/ada/g-md5.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -70,7 +70,7 @@ package GNAT.MD5 is
-- the same final context as a call with the concatenation of the inputs.
subtype Message_Digest is String (1 .. 32);
- -- The string type returned by function Digest.
+ -- The string type returned by function Digest
function Digest (C : Context) return Message_Digest;
-- Extracts the Message-Digest from a context. This function should be
@@ -88,6 +88,7 @@ package GNAT.MD5 is
private
-- Magic numbers
+
Initial_A : constant := 16#67452301#;
Initial_B : constant := 16#EFCDAB89#;
Initial_C : constant := 16#98BADCFE#;
diff --git a/gcc/ada/g-moreex.adb b/gcc/ada/g-moreex.adb
index 63dca44b804..46484d8406a 100644
--- a/gcc/ada/g-moreex.adb
+++ b/gcc/ada/g-moreex.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-os_lib.adb b/gcc/ada/g-os_lib.adb
index 825c05c5786..80db696b517 100644
--- a/gcc/ada/g-os_lib.adb
+++ b/gcc/ada/g-os_lib.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1995-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1995-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -98,13 +98,14 @@ package body GNAT.OS_Lib is
Blocking : Boolean);
-- Internal routine to implement the two Spawn (blocking/non blocking)
-- routines. If Blocking is set to True then the spawn is blocking
- -- otherwise it is non blocking. In this latter case the Pid contains
- -- the process id number. The first three parameters are as in Spawn.
- -- Note that Spawn_Internal normalizes the argument list before calling
- -- the low level system spawn routines (see Normalize_Arguments). Note
- -- that Normalize_Arguments is designed to do nothing if it is called
- -- more than once, so calling Normalize_Arguments before calling one
- -- of the spawn routines is fine.
+ -- otherwise it is non blocking. In this latter case the Pid contains the
+ -- process id number. The first three parameters are as in Spawn. Note that
+ -- Spawn_Internal normalizes the argument list before calling the low level
+ -- system spawn routines (see Normalize_Arguments).
+ --
+ -- Note: Normalize_Arguments is designed to do nothing if it is called more
+ -- than once, so calling Normalize_Arguments before calling one of the
+ -- spawn routines is fine.
function To_Path_String_Access
(Path_Addr : Address;
@@ -250,10 +251,8 @@ package body GNAT.OS_Lib is
---------------------
function C_String_Length (S : Address) return Integer is
-
function Strlen (S : Address) return Integer;
pragma Import (C, Strlen, "strlen");
-
begin
if S = Null_Address then
return 0;
@@ -333,6 +332,8 @@ package body GNAT.OS_Lib is
return C = Directory_Separator or else C = '/';
end Is_Dirsep;
+ -- Start of processing for Build_Path
+
begin
-- Find base file name
@@ -504,8 +505,7 @@ package body GNAT.OS_Lib is
Dest : constant String := Build_Path (Pathname, Name);
begin
- -- If the target file exists, we have an error
- -- otherwise do the copy.
+ -- If target file exists, we have an error, else do copy
if Is_Regular_File (Dest) then
raise Copy_Error;
@@ -520,7 +520,7 @@ package body GNAT.OS_Lib is
Copy_To (Pathname);
end if;
- -- Overwrite case, destination file may or may not exist
+ -- Overwrite case (destination file may or may not exist)
when Overwrite =>
if Is_Directory (Pathname) then
@@ -529,7 +529,7 @@ package body GNAT.OS_Lib is
Copy_To (Pathname);
end if;
- -- Appending case, destination file may or may not exist
+ -- Append case (destination file may or may not exist)
when Append =>
@@ -537,8 +537,8 @@ package body GNAT.OS_Lib is
if Is_Regular_File (Pathname) then
- -- Append mode and destination file exists, append data
- -- at the end of Pathname.
+ -- Append mode and destination file exists, append data at the
+ -- end of Pathname.
From := Open_Read (Name, Binary);
To := Open_Read_Write (Pathname, Binary);
@@ -857,7 +857,6 @@ package body GNAT.OS_Lib is
function File_Time_Stamp (FD : File_Descriptor) return OS_Time is
function File_Time (FD : File_Descriptor) return OS_Time;
pragma Import (C, File_Time, "__gnat_file_time_fd");
-
begin
return File_Time (FD);
end File_Time_Stamp;
@@ -865,14 +864,12 @@ package body GNAT.OS_Lib is
function File_Time_Stamp (Name : C_File_Name) return OS_Time is
function File_Time (Name : Address) return OS_Time;
pragma Import (C, File_Time, "__gnat_file_time_name");
-
begin
return File_Time (Name);
end File_Time_Stamp;
function File_Time_Stamp (Name : String) return OS_Time is
F_Name : String (1 .. Name'Length + 1);
-
begin
F_Name (1 .. Name'Length) := Name;
F_Name (F_Name'Last) := ASCII.NUL;
@@ -1152,7 +1149,6 @@ package body GNAT.OS_Lib is
(Name : Address;
Length : Integer) return Integer;
pragma Import (C, Is_Absolute_Path, "__gnat_is_absolute_path");
-
begin
return Is_Absolute_Path (Name'Address, Name'Length) /= 0;
end Is_Absolute_Path;
@@ -1164,14 +1160,12 @@ package body GNAT.OS_Lib is
function Is_Directory (Name : C_File_Name) return Boolean is
function Is_Directory (Name : Address) return Integer;
pragma Import (C, Is_Directory, "__gnat_is_directory");
-
begin
return Is_Directory (Name) /= 0;
end Is_Directory;
function Is_Directory (Name : String) return Boolean is
F_Name : String (1 .. Name'Length + 1);
-
begin
F_Name (1 .. Name'Length) := Name;
F_Name (F_Name'Last) := ASCII.NUL;
@@ -1185,14 +1179,12 @@ package body GNAT.OS_Lib is
function Is_Regular_File (Name : C_File_Name) return Boolean is
function Is_Regular_File (Name : Address) return Integer;
pragma Import (C, Is_Regular_File, "__gnat_is_regular_file");
-
begin
return Is_Regular_File (Name) /= 0;
end Is_Regular_File;
function Is_Regular_File (Name : String) return Boolean is
F_Name : String (1 .. Name'Length + 1);
-
begin
F_Name (1 .. Name'Length) := Name;
F_Name (F_Name'Last) := ASCII.NUL;
@@ -1206,14 +1198,12 @@ package body GNAT.OS_Lib is
function Is_Readable_File (Name : C_File_Name) return Boolean is
function Is_Readable_File (Name : Address) return Integer;
pragma Import (C, Is_Readable_File, "__gnat_is_readable_file");
-
begin
return Is_Readable_File (Name) /= 0;
end Is_Readable_File;
function Is_Readable_File (Name : String) return Boolean is
F_Name : String (1 .. Name'Length + 1);
-
begin
F_Name (1 .. Name'Length) := Name;
F_Name (F_Name'Last) := ASCII.NUL;
@@ -1227,14 +1217,12 @@ package body GNAT.OS_Lib is
function Is_Writable_File (Name : C_File_Name) return Boolean is
function Is_Writable_File (Name : Address) return Integer;
pragma Import (C, Is_Writable_File, "__gnat_is_writable_file");
-
begin
return Is_Writable_File (Name) /= 0;
end Is_Writable_File;
function Is_Writable_File (Name : String) return Boolean is
F_Name : String (1 .. Name'Length + 1);
-
begin
F_Name (1 .. Name'Length) := Name;
F_Name (F_Name'Last) := ASCII.NUL;
@@ -1248,14 +1236,12 @@ package body GNAT.OS_Lib is
function Is_Symbolic_Link (Name : C_File_Name) return Boolean is
function Is_Symbolic_Link (Name : Address) return Integer;
pragma Import (C, Is_Symbolic_Link, "__gnat_is_symbolic_link");
-
begin
return Is_Symbolic_Link (Name) /= 0;
end Is_Symbolic_Link;
function Is_Symbolic_Link (Name : String) return Boolean is
F_Name : String (1 .. Name'Length + 1);
-
begin
F_Name (1 .. Name'Length) := Name;
F_Name (F_Name'Last) := ASCII.NUL;
@@ -1370,18 +1356,15 @@ package body GNAT.OS_Lib is
return Process_Id
is
Saved_Output : File_Descriptor;
- Saved_Error : File_Descriptor := Invalid_FD;
- -- We need to initialize Saved_Error to Invalid_FD to avoid
- -- a compiler warning that this variable may be used before
- -- it is initialized (which can not happen, but the compiler
- -- is not smart enough to figure this out).
- Pid : Process_Id;
+ Saved_Error : File_Descriptor := Invalid_FD; -- prevent warning
+ Pid : Process_Id;
begin
if Output_File_Descriptor = Invalid_FD then
return Invalid_Pid;
end if;
-- Set standard output and, if specified, error to the temporary file
+
Saved_Output := Dup (Standout);
Dup2 (Output_File_Descriptor, Standout);
@@ -1417,11 +1400,10 @@ package body GNAT.OS_Lib is
(Program_Name : String;
Args : Argument_List;
Output_File : String;
- Err_To_Out : Boolean := True)
- return Process_Id
+ Err_To_Out : Boolean := True) return Process_Id
is
Output_File_Descriptor : constant File_Descriptor :=
- Create_Output_Text_File (Output_File);
+ Create_Output_Text_File (Output_File);
Result : Process_Id;
begin
@@ -1531,6 +1513,8 @@ package body GNAT.OS_Lib is
end if;
end Quote_Argument;
+ -- Start of processing for Normalize_Arguments
+
begin
if Argument_Needs_Quote then
for K in Args'Range loop
@@ -1857,6 +1841,7 @@ package body GNAT.OS_Lib is
end if;
-- Add the ASCII.NUL to be able to call the C function chdir
+
Path (Pos + 1) := ASCII.NUL;
Status := Change_Dir (Path (1 .. Pos + 1));
@@ -1890,13 +1875,13 @@ package body GNAT.OS_Lib is
-- Start the conversions
- -- If this is not finished after Max_Iterations, give up and
- -- return an empty string.
+ -- If this is not finished after Max_Iterations, give up and return an
+ -- empty string.
for J in 1 .. Max_Iterations loop
- -- If we don't have an absolute pathname, prepend
- -- the directory Reference_Dir.
+ -- If we don't have an absolute pathname, prepend the directory
+ -- Reference_Dir.
if Last = 1
and then not Is_Absolute_Path (Path_Buffer (1 .. End_Path))
@@ -1946,8 +1931,8 @@ package body GNAT.OS_Lib is
end if;
end loop;
- -- Find the end of the current field: last character
- -- or the one preceding the next directory separator.
+ -- Find the end of the current field: last character or the one
+ -- preceding the next directory separator.
while Finish < End_Path
and then Path_Buffer (Finish + 1) /= Directory_Separator
@@ -2058,11 +2043,10 @@ package body GNAT.OS_Lib is
-- Too many iterations: give up
- -- This can happen when there is a circularity in the symbolic links:
- -- A is a symbolic link for B, which itself is a symbolic link, and
- -- the target of B or of another symbolic link target of B is A.
- -- In this case, we return an empty string to indicate failure to
- -- resolve.
+ -- This can happen when there is a circularity in the symbolic links: A
+ -- is a symbolic link for B, which itself is a symbolic link, and the
+ -- target of B or of another symbolic link target of B is A. In this
+ -- case, we return an empty string to indicate failure to resolve.
return "";
end Normalize_Pathname;
@@ -2126,9 +2110,9 @@ package body GNAT.OS_Lib is
----------
function Read
- (FD : File_Descriptor;
- A : System.Address;
- N : Integer) return Integer
+ (FD : File_Descriptor;
+ A : System.Address;
+ N : Integer) return Integer
is
begin
return Integer (System.CRTL.read
@@ -2279,11 +2263,7 @@ package body GNAT.OS_Lib is
Err_To_Out : Boolean := True)
is
Saved_Output : File_Descriptor;
- Saved_Error : File_Descriptor := Invalid_FD;
- -- We need to initialize Saved_Error to Invalid_FD to avoid
- -- a compiler warning that this variable may be used before
- -- it is initialized (which can not happen, but the compiler
- -- is not smart enough to figure this out).
+ Saved_Error : File_Descriptor := Invalid_FD; -- prevent compiler warning
begin
-- Set standard output and error to the temporary file
@@ -2373,15 +2353,15 @@ package body GNAT.OS_Lib is
+ Args_Length (Args);
Command_Last : Natural := 0;
Command : aliased Chars (1 .. Command_Len);
- -- Command contains all characters of the Program_Name and Args,
- -- all terminated by ASCII.NUL characters
+ -- Command contains all characters of the Program_Name and Args, all
+ -- terminated by ASCII.NUL characters
Arg_List_Len : constant Positive := Args'Length + 2;
Arg_List_Last : Natural := 0;
Arg_List : aliased array (1 .. Arg_List_Len) of Char_Ptr;
- -- List with pointers to NUL-terminated strings of the
- -- Program_Name and the Args and terminated with a null pointer.
- -- We rely on the default initialization for the last null pointer.
+ -- List with pointers to NUL-terminated strings of the Program_Name
+ -- and the Args and terminated with a null pointer. We rely on the
+ -- default initialization for the last null pointer.
procedure Add_To_Command (S : String);
-- Add S and a NUL character to Command, updating Last
@@ -2403,8 +2383,10 @@ package body GNAT.OS_Lib is
begin
Command_Last := Command_Last + S'Length;
- -- Move characters one at a time, because Command has
- -- aliased components.
+ -- Move characters one at a time, because Command has aliased
+ -- components.
+
+ -- But not volatile, so why is this necessary ???
for J in S'Range loop
Command (First + J - S'First) := S (J);
@@ -2509,9 +2491,9 @@ package body GNAT.OS_Lib is
-----------
function Write
- (FD : File_Descriptor;
- A : System.Address;
- N : Integer) return Integer
+ (FD : File_Descriptor;
+ A : System.Address;
+ N : Integer) return Integer
is
begin
return Integer (System.CRTL.write
diff --git a/gcc/ada/g-os_lib.ads b/gcc/ada/g-os_lib.ads
index 17102ac22cb..6c09b607252 100644
--- a/gcc/ada/g-os_lib.ads
+++ b/gcc/ada/g-os_lib.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1995-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -349,16 +349,16 @@ package GNAT.OS_Lib is
-- platforms, Success is always set to False.
function Read
- (FD : File_Descriptor;
- A : System.Address;
- N : Integer) return Integer;
+ (FD : File_Descriptor;
+ A : System.Address;
+ N : Integer) return Integer;
-- Read N bytes to address A from file referenced by FD. Returned value is
-- count of bytes actually read, which can be less than N at EOF.
function Write
- (FD : File_Descriptor;
- A : System.Address;
- N : Integer) return Integer;
+ (FD : File_Descriptor;
+ A : System.Address;
+ N : Integer) return Integer;
-- Write N bytes from address A to file referenced by FD. The returned
-- value is the number of bytes written, which can be less than N if a
-- disk full condition was detected.
@@ -718,8 +718,7 @@ package GNAT.OS_Lib is
(Program_Name : String;
Args : Argument_List;
Output_File_Descriptor : File_Descriptor;
- Err_To_Out : Boolean := True)
- return Process_Id;
+ Err_To_Out : Boolean := True) return Process_Id;
-- Similar to the procedure above, but redirects the output to the file
-- designated by Output_File_Descriptor. If Err_To_Out is True, then the
-- Standard Error output is also redirected. Invalid_Id is returned
@@ -764,8 +763,7 @@ package GNAT.OS_Lib is
-- there is no notion of executables under this OS.
function Argument_String_To_List
- (Arg_String : String)
- return Argument_List_Access;
+ (Arg_String : String) return Argument_List_Access;
-- Take a string that is a program and its arguments and parse it into an
-- Argument_List. Note that the result is allocated on the heap, and must
-- be freed by the programmer (when it is no longer needed) to avoid
diff --git a/gcc/ada/g-pehage.adb b/gcc/ada/g-pehage.adb
index a7826484615..b2fb8fa544d 100644
--- a/gcc/ada/g-pehage.adb
+++ b/gcc/ada/g-pehage.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -309,7 +309,7 @@ package body GNAT.Perfect_Hash_Generators is
-- Internal Table Management --
-------------------------------
- function Allocate (N : Natural; S : Natural := 1) return Table_Id;
+ function Allocate (N : Natural; S : Natural := 1) return Table_Id;
-- Allocate N * S ints from IT table
procedure Free_Tmp_Tables;
diff --git a/gcc/ada/g-pehage.ads b/gcc/ada/g-pehage.ads
index 5cff8c53dcc..5ba3fc5d58c 100644
--- a/gcc/ada/g-pehage.ads
+++ b/gcc/ada/g-pehage.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-regexp.adb b/gcc/ada/g-regexp.adb
index 22275a5f4f5..b89129014c1 100644
--- a/gcc/ada/g-regexp.adb
+++ b/gcc/ada/g-regexp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -180,7 +180,7 @@ package body GNAT.Regexp is
(M : String;
Index : Integer);
pragma No_Return (Raise_Exception);
- -- Raise an exception, indicating an error at character Index in S.
+ -- Raise an exception, indicating an error at character Index in S
--------------------
-- Create_Mapping --
@@ -330,7 +330,7 @@ package body GNAT.Regexp is
if not Glob then
if J = S'First then
Raise_Exception
- ("'*', '+', '?' and '|' operators can not be in "
+ ("'*', '+', '?' and '|' operators cannot be in "
& "first position in regular expression", J);
end if;
end if;
@@ -343,7 +343,7 @@ package body GNAT.Regexp is
-- and cannot be found at the beginning of the line
Raise_Exception
- ("'*', '+', '?' and '|' operators can not be in "
+ ("'*', '+', '?' and '|' operators cannot be in "
& "first position in regular expression", J);
end if;
@@ -389,7 +389,7 @@ package body GNAT.Regexp is
procedure Add_Empty_Char
(State : State_Index;
To_State : State_Index);
- -- Add a empty-character transition from State to To_State.
+ -- Add a empty-character transition from State to To_State
procedure Create_Repetition
(Repetition : Character;
@@ -461,7 +461,7 @@ package body GNAT.Regexp is
End_Index : Integer)
return Integer;
-- Returns the index of the last character of the next sub-expression
- -- in Simple. Index can not be greater than End_Index
+ -- in Simple. Index cannot be greater than End_Index.
--------------------
-- Add_Empty_Char --
@@ -829,7 +829,7 @@ package body GNAT.Regexp is
procedure Add_Empty_Char
(State : State_Index;
To_State : State_Index);
- -- Add a empty-character transition from State to To_State.
+ -- Add a empty-character transition from State to To_State
procedure Create_Simple
(Start_Index : Integer;
@@ -1088,8 +1088,7 @@ package body GNAT.Regexp is
(First_Table : Regexp_Array_Access;
Num_States : State_Index;
Start_State : State_Index;
- End_State : State_Index)
- return Regexp
+ End_State : State_Index) return Regexp
is
pragma Warnings (Off, Num_States);
@@ -1301,8 +1300,7 @@ package body GNAT.Regexp is
function Get
(Table : Regexp_Array_Access;
State : State_Index;
- Column : Column_Index)
- return State_Index
+ Column : Column_Index) return State_Index
is
begin
if State <= Table'Last (1)
diff --git a/gcc/ada/g-regexp.ads b/gcc/ada/g-regexp.ads
index 188369e8532..7dada9c29cc 100644
--- a/gcc/ada/g-regexp.ads
+++ b/gcc/ada/g-regexp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 1998-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -131,8 +131,7 @@ package GNAT.Regexp is
function Compile
(Pattern : String;
Glob : Boolean := False;
- Case_Sensitive : Boolean := True)
- return Regexp;
+ Case_Sensitive : Boolean := True) return Regexp;
-- Compiles a regular expression S. If the syntax of the given
-- expression is invalid (does not match above grammar, Error_In_Regexp
-- is raised. If Glob is True, the pattern is considered as a 'globbing
diff --git a/gcc/ada/g-regist.adb b/gcc/ada/g-regist.adb
index c809b91d391..86d359853bd 100644
--- a/gcc/ada/g-regist.adb
+++ b/gcc/ada/g-regist.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -81,14 +81,12 @@ package body GNAT.Registry is
function RegDeleteKey
(Key : HKEY;
- lpSubKey : Address)
- return LONG;
+ lpSubKey : Address) return LONG;
pragma Import (Stdcall, RegDeleteKey, "RegDeleteKeyA");
function RegDeleteValue
(Key : HKEY;
- lpValueName : Address)
- return LONG;
+ lpValueName : Address) return LONG;
pragma Import (Stdcall, RegDeleteValue, "RegDeleteValueA");
function RegEnumValue
@@ -99,8 +97,7 @@ package body GNAT.Registry is
lpReserved : LPDWORD;
lpType : LPDWORD;
lpData : Address;
- lpcbData : LPDWORD)
- return LONG;
+ lpcbData : LPDWORD) return LONG;
pragma Import (Stdcall, RegEnumValue, "RegEnumValueA");
function RegOpenKeyEx
@@ -108,8 +105,7 @@ package body GNAT.Registry is
lpSubKey : Address;
ulOptions : DWORD;
samDesired : REGSAM;
- phkResult : PHKEY)
- return LONG;
+ phkResult : PHKEY) return LONG;
pragma Import (Stdcall, RegOpenKeyEx, "RegOpenKeyExA");
function RegQueryValueEx
@@ -118,8 +114,7 @@ package body GNAT.Registry is
lpReserved : LPDWORD;
lpType : LPDWORD;
lpData : Address;
- lpcbData : LPDWORD)
- return LONG;
+ lpcbData : LPDWORD) return LONG;
pragma Import (Stdcall, RegQueryValueEx, "RegQueryValueExA");
function RegSetValueEx
@@ -128,15 +123,14 @@ package body GNAT.Registry is
Reserved : DWORD;
dwType : DWORD;
lpData : Address;
- cbData : DWORD)
- return LONG;
+ cbData : DWORD) return LONG;
pragma Import (Stdcall, RegSetValueEx, "RegSetValueExA");
---------------------
-- Local Constants --
---------------------
- Max_Key_Size : constant := 1_024;
+ Max_Key_Size : constant := 1_024;
-- Maximum number of characters for a registry key
Max_Value_Size : constant := 2_048;
@@ -147,7 +141,7 @@ package body GNAT.Registry is
-----------------------
function To_C_Mode (Mode : Key_Mode) return REGSAM;
- -- Returns the Win32 mode value for the Key_Mode value.
+ -- Returns the Win32 mode value for the Key_Mode value
procedure Check_Result (Result : LONG; Message : String);
-- Checks value Result and raise the exception Registry_Error if it is not
@@ -188,8 +182,7 @@ package body GNAT.Registry is
function Create_Key
(From_Key : HKEY;
Sub_Key : String;
- Mode : Key_Mode := Read_Write)
- return HKEY
+ Mode : Key_Mode := Read_Write) return HKEY
is
use type REGSAM;
use type DWORD;
@@ -318,8 +311,7 @@ package body GNAT.Registry is
function Key_Exists
(From_Key : HKEY;
- Sub_Key : String)
- return Boolean
+ Sub_Key : String) return Boolean
is
New_Key : HKEY;
@@ -346,8 +338,7 @@ package body GNAT.Registry is
function Open_Key
(From_Key : HKEY;
Sub_Key : String;
- Mode : Key_Mode := Read_Only)
- return HKEY
+ Mode : Key_Mode := Read_Only) return HKEY
is
use type REGSAM;
@@ -376,8 +367,7 @@ package body GNAT.Registry is
function Query_Value
(From_Key : HKEY;
Sub_Key : String;
- Expand : Boolean := False)
- return String
+ Expand : Boolean := False) return String
is
use GNAT.Directory_Operations;
use type LONG;
diff --git a/gcc/ada/g-regist.ads b/gcc/ada/g-regist.ads
index 3b4e31d85b8..054ebb8a08b 100644
--- a/gcc/ada/g-regist.ads
+++ b/gcc/ada/g-regist.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -57,7 +57,7 @@ package GNAT.Registry is
HKEY_PERFORMANCE_DATA : constant HKEY;
type Key_Mode is (Read_Only, Read_Write);
- -- Access mode for the registry key.
+ -- Access mode for the registry key
Registry_Error : exception;
-- Registry_Error is raises by all routines below if a problem occurs
@@ -66,8 +66,7 @@ package GNAT.Registry is
function Create_Key
(From_Key : HKEY;
Sub_Key : String;
- Mode : Key_Mode := Read_Write)
- return HKEY;
+ Mode : Key_Mode := Read_Write) return HKEY;
-- Open or create a key (named Sub_Key) in the Windows registry database.
-- The key will be created under key From_Key. It returns the key handle.
-- From_Key must be a valid handle to an already opened key or one of
@@ -76,36 +75,34 @@ package GNAT.Registry is
function Open_Key
(From_Key : HKEY;
Sub_Key : String;
- Mode : Key_Mode := Read_Only)
- return HKEY;
+ Mode : Key_Mode := Read_Only) return HKEY;
-- Return a registry key handle for key named Sub_Key opened under key
-- From_Key. It is possible to open a key at any level in the registry
-- tree in a single call to Open_Key.
procedure Close_Key (Key : HKEY);
- -- Close registry key handle. All resources used by Key are released.
+ -- Close registry key handle. All resources used by Key are released
function Key_Exists (From_Key : HKEY; Sub_Key : String) return Boolean;
- -- Returns True if Sub_Key is defined under From_Key in the registry.
+ -- Returns True if Sub_Key is defined under From_Key in the registry
function Query_Value
(From_Key : HKEY;
Sub_Key : String;
- Expand : Boolean := False)
- return String;
+ Expand : Boolean := False) return String;
-- Returns the registry key's value associated with Sub_Key in From_Key
-- registry key. If Expand is set to True and the Sub_Key is a
-- REG_EXPAND_SZ the returned value will have the %name% variables
-- replaced by the corresponding environment variable value.
procedure Set_Value (From_Key : HKEY; Sub_Key : String; Value : String);
- -- Add the pair (Sub_Key, Value) into From_Key registry key.
+ -- Add the pair (Sub_Key, Value) into From_Key registry key
procedure Delete_Key (From_Key : HKEY; Sub_Key : String);
- -- Remove Sub_Key from the registry key From_Key.
+ -- Remove Sub_Key from the registry key From_Key
procedure Delete_Value (From_Key : HKEY; Sub_Key : String);
- -- Remove the named value Sub_Key from the registry key From_Key.
+ -- Remove the named value Sub_Key from the registry key From_Key
generic
with procedure Action
diff --git a/gcc/ada/g-regpat.adb b/gcc/ada/g-regpat.adb
index 33e22b48c8a..c52b5f2c894 100644
--- a/gcc/ada/g-regpat.adb
+++ b/gcc/ada/g-regpat.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- --
-- Copyright (C) 1986 by University of Toronto. --
--- Copyright (C) 1996-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -129,7 +129,7 @@ package body GNAT.Regpat is
-- Complex loops
CURLYX, -- 2num node Match this complex thing {n,m} times
- -- The nums are coded on two characters each.
+ -- The nums are coded on two characters each
WHILEM, -- no Do curly processing and see if rest matches
@@ -233,15 +233,15 @@ package body GNAT.Regpat is
procedure Set_In_Class
(Bitmap : in out Character_Class;
C : Character);
- -- Set the entry to True for C in the class Bitmap.
+ -- Set the entry to True for C in the class Bitmap
function Get_From_Class
(Bitmap : Character_Class;
C : Character) return Boolean;
- -- Return True if the entry is set for C in the class Bitmap.
+ -- Return True if the entry is set for C in the class Bitmap
procedure Reset_Class (Bitmap : out Character_Class);
- -- Clear all the entries in the class Bitmap.
+ -- Clear all the entries in the class Bitmap
pragma Inline (Set_In_Class);
pragma Inline (Get_From_Class);
@@ -282,7 +282,7 @@ package body GNAT.Regpat is
function Get_Next_Offset
(Program : Program_Data;
IP : Pointer) return Pointer;
- -- Get the offset field of a node. Used by Get_Next.
+ -- Get the offset field of a node. Used by Get_Next
function Get_Next
(Program : Program_Data;
@@ -295,7 +295,7 @@ package body GNAT.Regpat is
function Read_Natural
(Program : Program_Data;
IP : Pointer) return Natural;
- -- Return the 2-byte natural coded at position IP.
+ -- Return the 2-byte natural coded at position IP
-- All of the subprograms above are tiny and should be inlined
@@ -389,10 +389,10 @@ package body GNAT.Regpat is
-- Return value is the location of new opcode, ie old Emit_Ptr.
procedure Emit_Natural (IP : Pointer; N : Natural);
- -- Split N on two characters at position IP.
+ -- Split N on two characters at position IP
procedure Emit_Class (Bitmap : Character_Class);
- -- Emits a character class.
+ -- Emits a character class
procedure Case_Emit (C : Character);
-- Emit C, after converting is to lower-case if the regular
@@ -454,7 +454,7 @@ package body GNAT.Regpat is
function Next_Instruction (P : Pointer) return Pointer;
-- Dig the "next" pointer out of a node
- procedure Fail (M : in String);
+ procedure Fail (M : String);
pragma No_Return (Fail);
-- Fail with a diagnostic message, if possible
@@ -572,9 +572,9 @@ package body GNAT.Regpat is
-- Fail --
----------
- procedure Fail (M : in String) is
+ procedure Fail (M : String) is
begin
- raise Expression_Error;
+ raise Expression_Error with M;
end Fail;
-------------------------
@@ -845,7 +845,7 @@ package body GNAT.Regpat is
-- makes it hard to avoid.
procedure Parse
- (Parenthesized : in Boolean;
+ (Parenthesized : Boolean;
Flags : out Expression_Flags;
IP : out Pointer)
is
@@ -1206,7 +1206,7 @@ package body GNAT.Regpat is
Parse_Pos := Parse_Pos + 1;
end if;
- -- First character can be ] or -, without closing the class.
+ -- First character can be ] or - without closing the class
if Parse_Pos <= Parse_End
and then (Expression (Parse_Pos) = ']'
@@ -2389,7 +2389,7 @@ package body GNAT.Regpat is
type Natural_Array is array (Match_Count range <>) of Natural;
Matches_Tmp : Natural_Array (Matches_Full'Range);
- -- Save the opening position of parenthesis.
+ -- Save the opening position of parenthesis
Last_Paren : Natural := 0;
-- Last parenthesis seen
@@ -2414,7 +2414,7 @@ package body GNAT.Regpat is
-- operators for complex expressions.
Current_Curly : Current_Curly_Access := null;
- -- The curly currently being processed.
+ -- The curly currently being processed
-----------------------
-- Local Subprograms --
@@ -2430,7 +2430,7 @@ package body GNAT.Regpat is
-- It only matches on things of length 1.
-- Starting from Input_Pos, it matches at most Max CURLY.
- function Try (Pos : in Positive) return Boolean;
+ function Try (Pos : Positive) return Boolean;
-- Try to match at specific point
function Match (IP : Pointer) return Boolean;
@@ -2465,7 +2465,7 @@ package body GNAT.Regpat is
pragma Inline (Index);
pragma Inline (Repeat);
- -- These are two complex functions, but used only once.
+ -- These are two complex functions, but used only once
pragma Inline (Match_Whilem);
pragma Inline (Match_Simple_Operator);
@@ -3002,10 +3002,10 @@ package body GNAT.Regpat is
Ln : Natural := 0;
Lastloc : constant Natural := Cc.Lastloc;
- -- Detection of 0-len.
+ -- Detection of 0-len
begin
- -- If degenerate scan matches "", assume scan done.
+ -- If degenerate scan matches "", assume scan done
if Input_Pos = Cc.Lastloc
and then N >= Cc.Min
@@ -3031,7 +3031,7 @@ package body GNAT.Regpat is
return False;
end if;
- -- First, just match a string of min scans.
+ -- First, just match a string of min scans
if N < Cc.Min then
Cc.Cur := N;
@@ -3046,7 +3046,7 @@ package body GNAT.Regpat is
return False;
end if;
- -- Prefer next over scan for minimal matching.
+ -- Prefer next over scan for minimal matching
if not Cc.Greedy then
Current_Curly := Cc.Old_Cc;
@@ -3240,7 +3240,7 @@ package body GNAT.Regpat is
-- Try --
---------
- function Try (Pos : in Positive) return Boolean is
+ function Try (Pos : Positive) return Boolean is
begin
Input_Pos := Pos;
Last_Paren := 0;
diff --git a/gcc/ada/g-regpat.ads b/gcc/ada/g-regpat.ads
index 132d32f945c..42dc3f46ad1 100644
--- a/gcc/ada/g-regpat.ads
+++ b/gcc/ada/g-regpat.ads
@@ -206,7 +206,7 @@ package GNAT.Regpat is
-- first version the regular expression has in fact to be compiled twice
-- (first to compute the size, then to generate the byte code).
- -- Note also that you can not use the function version of Compile if you
+ -- Note also that you cannot use the function version of Compile if you
-- specify the size of the Pattern_Matcher, since the discriminants will
-- most probably be different and you will get a Constraint_Error
@@ -291,20 +291,20 @@ package GNAT.Regpat is
---------------
Expression_Error : exception;
- -- This exception is raised when trying to compile an invalid
- -- regular expression. All subprograms taking an expression
- -- as parameter may raise Expression_Error.
+ -- This exception is raised when trying to compile an invalid regular
+ -- expression. All subprograms taking an expression as parameter may raise
+ -- Expression_Error.
Max_Paren_Count : constant := 255;
- -- Maximum number of parenthesis in a regular expression.
- -- This is limited by the size of a Character, as found in the
- -- byte-compiled version of regular expressions.
+ -- Maximum number of parenthesis in a regular expression. This is limited
+ -- by the size of a Character, as found in the byte-compiled version of
+ -- regular expressions.
Max_Curly_Repeat : constant := 32767;
- -- Maximum number of repetition for the curly operator.
- -- The digits in the {n}, {n,} and {n,m } operators can not be higher
- -- than this constant, since they have to fit on two characters in the
- -- byte-compiled version of regular expressions.
+ -- Maximum number of repetition for the curly operator. The digits in the
+ -- {n}, {n,} and {n,m } operators cannot be higher than this constant,
+ -- since they have to fit on two characters in the byte-compiled version of
+ -- regular expressions.
Max_Program_Size : constant := 2**15 - 1;
-- Maximum size that can be allocated for a program
@@ -318,10 +318,10 @@ package GNAT.Regpat is
-- and the programmer need not be concerned about it. There are two
-- exceptions to this. First in the calls to Match, it is possible to
-- specify a non-zero size that is known to be large enough. This can
- -- slightly increase the efficiency by avoiding a copy. Second, in the
- -- case of calling compile, it is possible using the procedural form
- -- of Compile to use a single Pattern_Matcher variable for several
- -- different expressions by setting its size sufficiently large.
+ -- slightly increase the efficiency by avoiding a copy. Second, in the case
+ -- of calling compile, it is possible using the procedural form of Compile
+ -- to use a single Pattern_Matcher variable for several different
+ -- expressions by setting its size sufficiently large.
Auto_Size : constant := 0;
-- Used in calls to Match to indicate that the Size should be set to
@@ -362,33 +362,28 @@ package GNAT.Regpat is
end record;
type Match_Array is array (Match_Count range <>) of Match_Location;
- -- The substring matching a given pair of parenthesis.
- -- Index 0 is the whole substring that matched the full regular
- -- expression.
+ -- The substring matching a given pair of parenthesis. Index 0 is the whole
+ -- substring that matched the full regular expression.
--
- -- For instance, if your regular expression is something like:
- -- "a(b*)(c+)", then Match_Array(1) will be the indexes of the
- -- substring that matched "b*" and Match_Array(2) will be the substring
- -- that matched "c+".
+ -- For instance, if your regular expression is something like: "a(b*)(c+)",
+ -- then Match_Array(1) will be the indexes of the substring that matched
+ -- "b*" and Match_Array(2) will be the substring that matched "c+".
--
- -- The number of parenthesis groups that can be retrieved is unlimited,
- -- and all the Match subprograms below can use a Match_Array of any size.
- -- Indexes that do not have any matching parenthesis are set to
- -- No_Match.
+ -- The number of parenthesis groups that can be retrieved is unlimited, and
+ -- all the Match subprograms below can use a Match_Array of any size.
+ -- Indexes that do not have any matching parenthesis are set to No_Match.
No_Match : constant Match_Location := (First => 0, Last => 0);
- -- The No_Match constant is (0, 0) to differentiate between
- -- matching a null string at position 1, which uses (1, 0)
- -- and no match at all.
+ -- The No_Match constant is (0, 0) to differentiate between matching a null
+ -- string at position 1, which uses (1, 0) and no match at all.
---------------------------------
-- Pattern_Matcher Compilation --
---------------------------------
- -- The subprograms here are used to precompile regular expressions
- -- for use in subsequent Match calls. Precompilation improves
- -- efficiency if the same regular expression is to be used in
- -- more than one Match call.
+ -- The subprograms here are used to precompile regular expressions for use
+ -- in subsequent Match calls. Precompilation improves efficiency if the
+ -- same regular expression is to be used in more than one Match call.
type Pattern_Matcher (Size : Program_Size) is private;
-- Type used to represent a regular expression compiled into byte code
@@ -419,21 +414,21 @@ package GNAT.Regpat is
Flags : Regexp_Flags := No_Flags);
-- Compile a regular expression into into internal code
- -- This procedure is significantly faster than the Compile function
- -- since it avoids the extra step of precomputing the required size.
+ -- This procedure is significantly faster than the Compile function since
+ -- it avoids the extra step of precomputing the required size.
--
-- However, it requires the user to provide a Pattern_Matcher variable
-- whose size is preset to a large enough value. One advantage of this
-- approach, in addition to the improved efficiency, is that the same
-- Pattern_Matcher variable can be used to hold the compiled code for
- -- several different regular expressions by setting a size that is
- -- large enough to accomodate all possibilities.
+ -- several different regular expressions by setting a size that is large
+ -- enough to accomodate all possibilities.
--
- -- In this version of the procedure call, the actual required code
- -- size is returned. Also if Matcher.Size is zero on entry, then the
- -- resulting code is not stored. A call with Matcher.Size set to Auto_Size
- -- can thus be used to determine the space required for compiling the
- -- given regular expression.
+ -- In this version of the procedure call, the actual required code size is
+ -- returned. Also if Matcher.Size is zero on entry, then the resulting code
+ -- is not stored. A call with Matcher.Size set to Auto_Size can thus be
+ -- used to determine the space required for compiling the given regular
+ -- expression.
--
-- This function raises Storage_Error if Matcher is too small to hold
-- the resulting code (i.e. Matcher.Size has too small a value).
@@ -448,8 +443,8 @@ package GNAT.Regpat is
(Matcher : out Pattern_Matcher;
Expression : String;
Flags : Regexp_Flags := No_Flags);
- -- Same procedure as above, expect it does not return the final
- -- program size, and Matcher.Size cannot be Auto_Size.
+-- -- Same procedure as above, expect it does not return the final
+-- -- program size, and Matcher.Size cannot be Auto_Size.
function Paren_Count (Regexp : Pattern_Matcher) return Match_Count;
pragma Inline (Paren_Count);
diff --git a/gcc/ada/g-semaph.adb b/gcc/ada/g-semaph.adb
index 43727eb71a7..13793a8624f 100644
--- a/gcc/ada/g-semaph.adb
+++ b/gcc/ada/g-semaph.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 2003-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-signal.adb b/gcc/ada/g-signal.adb
index 209e287d2ba..1db9f082a3c 100644
--- a/gcc/ada/g-signal.adb
+++ b/gcc/ada/g-signal.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-signal.ads b/gcc/ada/g-signal.ads
index cd15ba48350..79d868f8de2 100644
--- a/gcc/ada/g-signal.ads
+++ b/gcc/ada/g-signal.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-soccon-aix.ads b/gcc/ada/g-soccon-aix.ads
index 3b361b51a14..06773f24c08 100644
--- a/gcc/ada/g-soccon-aix.ads
+++ b/gcc/ada/g-soccon-aix.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,7 @@
-- by the GNAT.Sockets package (g-socket.ads). This package should not be
-- directly with'ed by an applications program.
--- This is the version for powerpc-ibm-aix5.1.0.0
+-- This is the version for powerpc-ibm-aix5.3.0.0
-- This file is generated automatically, do not modify it by hand! Instead,
-- make changes to gen-soccon.c and re-run it on each target.
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 16; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-darwin.ads b/gcc/ada/g-soccon-darwin.ads
index 3927b789798..4ae827d3574 100644
--- a/gcc/ada/g-soccon-darwin.ads
+++ b/gcc/ada/g-soccon-darwin.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-freebsd.ads b/gcc/ada/g-soccon-freebsd.ads
index 29319a2bc0b..964e75bc83b 100644
--- a/gcc/ada/g-soccon-freebsd.ads
+++ b/gcc/ada/g-soccon-freebsd.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-hpux-ia64.ads b/gcc/ada/g-soccon-hpux-ia64.ads
new file mode 100644
index 00000000000..ea7a63d21fa
--- /dev/null
+++ b/gcc/ada/g-soccon-hpux-ia64.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for ia64-hp-hpux11.23
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 22; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 226; -- Address already in use
+ EADDRNOTAVAIL : constant := 227; -- Cannot assign address
+ EAFNOSUPPORT : constant := 225; -- Addr family not supported
+ EALREADY : constant := 244; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 231; -- Connection aborted
+ ECONNREFUSED : constant := 239; -- Connection refused
+ ECONNRESET : constant := 232; -- Connection reset by peer
+ EDESTADDRREQ : constant := 217; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 241; -- Host is down
+ EHOSTUNREACH : constant := 242; -- No route to host
+ EINPROGRESS : constant := 245; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 234; -- Socket already connected
+ ELOOP : constant := 249; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 218; -- Message too long
+ ENAMETOOLONG : constant := 248; -- Name too long
+ ENETDOWN : constant := 228; -- Network is down
+ ENETRESET : constant := 230; -- Disconn. on network reset
+ ENETUNREACH : constant := 229; -- Network is unreachable
+ ENOBUFS : constant := 233; -- No buffer space available
+ ENOPROTOOPT : constant := 220; -- Protocol not available
+ ENOTCONN : constant := 235; -- Socket not connected
+ ENOTSOCK : constant := 216; -- Operation on non socket
+ EOPNOTSUPP : constant := 223; -- Operation not supported
+ EPFNOSUPPORT : constant := 224; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 221; -- Unknown protocol
+ EPROTOTYPE : constant := 219; -- Unknown protocol type
+ ESHUTDOWN : constant := 236; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 222; -- Socket type not supported
+ ETIMEDOUT : constant := 238; -- Connection timed out
+ ETOOMANYREFS : constant := 237; -- Too many references
+ EWOULDBLOCK : constant := 246; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 65535; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 8; -- Send end of record
+ MSG_WAITALL : constant := 64; -- Wait for full reception
+ MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := 0;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 4; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
+ SO_LINGER : constant := 128; -- Defer close to flush data
+ SO_BROADCAST : constant := 32; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 4097; -- Set/get send buffer size
+ SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 4101; -- Emission timeout
+ SO_RCVTIMEO : constant := 4102; -- Reception timeout
+ SO_ERROR : constant := 4103; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 2; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 3; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 4; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 5; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 6; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 16; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 8; -- tv_sec
+ SIZEOF_tv_usec : constant := 8; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-hpux.ads b/gcc/ada/g-soccon-hpux.ads
index 9145146da38..0b6012e0ee6 100644
--- a/gcc/ada/g-soccon-hpux.ads
+++ b/gcc/ada/g-soccon-hpux.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 16; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-interix.ads b/gcc/ada/g-soccon-interix.ads
index 630e2bf16e3..31569d12da3 100644
--- a/gcc/ada/g-soccon-interix.ads
+++ b/gcc/ada/g-soccon-interix.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-soccon-irix.ads b/gcc/ada/g-soccon-irix.ads
index b07191f102c..3fd365c3470 100644
--- a/gcc/ada/g-soccon-irix.ads
+++ b/gcc/ada/g-soccon-irix.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-64.ads b/gcc/ada/g-soccon-linux-64.ads
new file mode 100644
index 00000000000..fc8c507b3a7
--- /dev/null
+++ b/gcc/ada/g-soccon-linux-64.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for ia64-hp-linux-gnu
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 10; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 98; -- Address already in use
+ EADDRNOTAVAIL : constant := 99; -- Cannot assign address
+ EAFNOSUPPORT : constant := 97; -- Addr family not supported
+ EALREADY : constant := 114; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 103; -- Connection aborted
+ ECONNREFUSED : constant := 111; -- Connection refused
+ ECONNRESET : constant := 104; -- Connection reset by peer
+ EDESTADDRREQ : constant := 89; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 112; -- Host is down
+ EHOSTUNREACH : constant := 113; -- No route to host
+ EINPROGRESS : constant := 115; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 106; -- Socket already connected
+ ELOOP : constant := 40; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 90; -- Message too long
+ ENAMETOOLONG : constant := 36; -- Name too long
+ ENETDOWN : constant := 100; -- Network is down
+ ENETRESET : constant := 102; -- Disconn. on network reset
+ ENETUNREACH : constant := 101; -- Network is unreachable
+ ENOBUFS : constant := 105; -- No buffer space available
+ ENOPROTOOPT : constant := 92; -- Protocol not available
+ ENOTCONN : constant := 107; -- Socket not connected
+ ENOTSOCK : constant := 88; -- Operation on non socket
+ EOPNOTSUPP : constant := 95; -- Operation not supported
+ EPFNOSUPPORT : constant := 96; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 93; -- Unknown protocol
+ EPROTOTYPE : constant := 91; -- Unknown protocol type
+ ESHUTDOWN : constant := 108; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
+ ETIMEDOUT : constant := 110; -- Connection timed out
+ ETOOMANYREFS : constant := 109; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := 21537; -- Set/clear non-blocking io
+ FIONREAD : constant := 21531; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 1; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 128; -- Send end of record
+ MSG_WAITALL : constant := 256; -- Wait for full reception
+ MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := MSG_NOSIGNAL;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 2; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
+ SO_LINGER : constant := 13; -- Defer close to flush data
+ SO_BROADCAST : constant := 6; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 7; -- Set/get send buffer size
+ SO_RCVBUF : constant := 8; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 21; -- Emission timeout
+ SO_RCVTIMEO : constant := 20; -- Reception timeout
+ SO_ERROR : constant := 4; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 8; -- tv_sec
+ SIZEOF_tv_usec : constant := 8; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-ppc.ads b/gcc/ada/g-soccon-linux-ppc.ads
new file mode 100644
index 00000000000..185a8da4d24
--- /dev/null
+++ b/gcc/ada/g-soccon-linux-ppc.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for powerpc-linux
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 10; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 98; -- Address already in use
+ EADDRNOTAVAIL : constant := 99; -- Cannot assign address
+ EAFNOSUPPORT : constant := 97; -- Addr family not supported
+ EALREADY : constant := 114; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 103; -- Connection aborted
+ ECONNREFUSED : constant := 111; -- Connection refused
+ ECONNRESET : constant := 104; -- Connection reset by peer
+ EDESTADDRREQ : constant := 89; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 112; -- Host is down
+ EHOSTUNREACH : constant := 113; -- No route to host
+ EINPROGRESS : constant := 115; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 106; -- Socket already connected
+ ELOOP : constant := 40; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 90; -- Message too long
+ ENAMETOOLONG : constant := 36; -- Name too long
+ ENETDOWN : constant := 100; -- Network is down
+ ENETRESET : constant := 102; -- Disconn. on network reset
+ ENETUNREACH : constant := 101; -- Network is unreachable
+ ENOBUFS : constant := 105; -- No buffer space available
+ ENOPROTOOPT : constant := 92; -- Protocol not available
+ ENOTCONN : constant := 107; -- Socket not connected
+ ENOTSOCK : constant := 88; -- Operation on non socket
+ EOPNOTSUPP : constant := 95; -- Operation not supported
+ EPFNOSUPPORT : constant := 96; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 93; -- Unknown protocol
+ EPROTOTYPE : constant := 91; -- Unknown protocol type
+ ESHUTDOWN : constant := 108; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
+ ETIMEDOUT : constant := 110; -- Connection timed out
+ ETOOMANYREFS : constant := 109; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 1; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 128; -- Send end of record
+ MSG_WAITALL : constant := 256; -- Wait for full reception
+ MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := MSG_NOSIGNAL;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 2; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
+ SO_LINGER : constant := 13; -- Defer close to flush data
+ SO_BROADCAST : constant := 6; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 7; -- Set/get send buffer size
+ SO_RCVBUF : constant := 8; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 19; -- Emission timeout
+ SO_RCVTIMEO : constant := 18; -- Reception timeout
+ SO_ERROR : constant := 4; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-linux-x86.ads b/gcc/ada/g-soccon-linux-x86.ads
new file mode 100644
index 00000000000..6b0521fcc04
--- /dev/null
+++ b/gcc/ada/g-soccon-linux-x86.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for i686-pc-linux-gnu
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 10; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 1; -- Stream socket
+ SOCK_DGRAM : constant := 2; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 98; -- Address already in use
+ EADDRNOTAVAIL : constant := 99; -- Cannot assign address
+ EAFNOSUPPORT : constant := 97; -- Addr family not supported
+ EALREADY : constant := 114; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 103; -- Connection aborted
+ ECONNREFUSED : constant := 111; -- Connection refused
+ ECONNRESET : constant := 104; -- Connection reset by peer
+ EDESTADDRREQ : constant := 89; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 112; -- Host is down
+ EHOSTUNREACH : constant := 113; -- No route to host
+ EINPROGRESS : constant := 115; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 106; -- Socket already connected
+ ELOOP : constant := 40; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 90; -- Message too long
+ ENAMETOOLONG : constant := 36; -- Name too long
+ ENETDOWN : constant := 100; -- Network is down
+ ENETRESET : constant := 102; -- Disconn. on network reset
+ ENETUNREACH : constant := 101; -- Network is unreachable
+ ENOBUFS : constant := 105; -- No buffer space available
+ ENOPROTOOPT : constant := 92; -- Protocol not available
+ ENOTCONN : constant := 107; -- Socket not connected
+ ENOTSOCK : constant := 88; -- Operation on non socket
+ EOPNOTSUPP : constant := 95; -- Operation not supported
+ EPFNOSUPPORT : constant := 96; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 93; -- Unknown protocol
+ EPROTOTYPE : constant := 91; -- Unknown protocol type
+ ESHUTDOWN : constant := 108; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 94; -- Socket type not supported
+ ETIMEDOUT : constant := 110; -- Connection timed out
+ ETOOMANYREFS : constant := 109; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := 21537; -- Set/clear non-blocking io
+ FIONREAD : constant := 21531; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 1; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 128; -- Send end of record
+ MSG_WAITALL : constant := 256; -- Wait for full reception
+ MSG_NOSIGNAL : constant := 16384; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := MSG_NOSIGNAL;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 2; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 9; -- Enable keep-alive msgs
+ SO_LINGER : constant := 13; -- Defer close to flush data
+ SO_BROADCAST : constant := 6; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 7; -- Set/get send buffer size
+ SO_RCVBUF : constant := 8; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 21; -- Emission timeout
+ SO_RCVTIMEO : constant := 20; -- Reception timeout
+ SO_ERROR : constant := 4; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 32; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 33; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 34; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 35; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 36; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-mingw.ads b/gcc/ada/g-soccon-mingw.ads
index 3577c17c596..f0c25c392b5 100644
--- a/gcc/ada/g-soccon-mingw.ads
+++ b/gcc/ada/g-soccon-mingw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-solaris-64.ads b/gcc/ada/g-soccon-solaris-64.ads
new file mode 100644
index 00000000000..be1fc4ffea3
--- /dev/null
+++ b/gcc/ada/g-soccon-solaris-64.ads
@@ -0,0 +1,181 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . S O C K E T S . C O N S T A N T S --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides target dependent definitions of constant for use
+-- by the GNAT.Sockets package (g-socket.ads). This package should not be
+-- directly with'ed by an applications program.
+
+-- This is the version for sparc-sun-solaris2.8/64
+-- This file is generated automatically, do not modify it by hand! Instead,
+-- make changes to gen-soccon.c and re-run it on each target.
+
+package GNAT.Sockets.Constants is
+
+ --------------
+ -- Families --
+ --------------
+
+ AF_INET : constant := 2; -- IPv4 address family
+ AF_INET6 : constant := 26; -- IPv6 address family
+
+ -----------
+ -- Modes --
+ -----------
+
+ SOCK_STREAM : constant := 2; -- Stream socket
+ SOCK_DGRAM : constant := 1; -- Datagram socket
+
+ -------------------
+ -- Socket errors --
+ -------------------
+
+ EACCES : constant := 13; -- Permission denied
+ EADDRINUSE : constant := 125; -- Address already in use
+ EADDRNOTAVAIL : constant := 126; -- Cannot assign address
+ EAFNOSUPPORT : constant := 124; -- Addr family not supported
+ EALREADY : constant := 149; -- Operation in progress
+ EBADF : constant := 9; -- Bad file descriptor
+ ECONNABORTED : constant := 130; -- Connection aborted
+ ECONNREFUSED : constant := 146; -- Connection refused
+ ECONNRESET : constant := 131; -- Connection reset by peer
+ EDESTADDRREQ : constant := 96; -- Destination addr required
+ EFAULT : constant := 14; -- Bad address
+ EHOSTDOWN : constant := 147; -- Host is down
+ EHOSTUNREACH : constant := 148; -- No route to host
+ EINPROGRESS : constant := 150; -- Operation now in progress
+ EINTR : constant := 4; -- Interrupted system call
+ EINVAL : constant := 22; -- Invalid argument
+ EIO : constant := 5; -- Input output error
+ EISCONN : constant := 133; -- Socket already connected
+ ELOOP : constant := 90; -- Too many symbolic lynks
+ EMFILE : constant := 24; -- Too many open files
+ EMSGSIZE : constant := 97; -- Message too long
+ ENAMETOOLONG : constant := 78; -- Name too long
+ ENETDOWN : constant := 127; -- Network is down
+ ENETRESET : constant := 129; -- Disconn. on network reset
+ ENETUNREACH : constant := 128; -- Network is unreachable
+ ENOBUFS : constant := 132; -- No buffer space available
+ ENOPROTOOPT : constant := 99; -- Protocol not available
+ ENOTCONN : constant := 134; -- Socket not connected
+ ENOTSOCK : constant := 95; -- Operation on non socket
+ EOPNOTSUPP : constant := 122; -- Operation not supported
+ EPFNOSUPPORT : constant := 123; -- Unknown protocol family
+ EPROTONOSUPPORT : constant := 120; -- Unknown protocol
+ EPROTOTYPE : constant := 98; -- Unknown protocol type
+ ESHUTDOWN : constant := 143; -- Cannot send once shutdown
+ ESOCKTNOSUPPORT : constant := 121; -- Socket type not supported
+ ETIMEDOUT : constant := 145; -- Connection timed out
+ ETOOMANYREFS : constant := 144; -- Too many references
+ EWOULDBLOCK : constant := 11; -- Operation would block
+
+ -----------------
+ -- Host errors --
+ -----------------
+
+ HOST_NOT_FOUND : constant := 1; -- Unknown host
+ TRY_AGAIN : constant := 2; -- Host name lookup failure
+ NO_DATA : constant := 4; -- No data record for name
+ NO_RECOVERY : constant := 3; -- Non recoverable errors
+
+ -------------------
+ -- Control flags --
+ -------------------
+
+ FIONBIO : constant := -2147195266; -- Set/clear non-blocking io
+ FIONREAD : constant := 1074030207; -- How many bytes to read
+
+ --------------------
+ -- Shutdown modes --
+ --------------------
+
+ SHUT_RD : constant := 0; -- No more recv
+ SHUT_WR : constant := 1; -- No more send
+ SHUT_RDWR : constant := 2; -- No more recv/send
+
+ ---------------------
+ -- Protocol levels --
+ ---------------------
+
+ SOL_SOCKET : constant := 65535; -- Options for socket level
+ IPPROTO_IP : constant := 0; -- Dummy protocol for IP
+ IPPROTO_UDP : constant := 17; -- UDP
+ IPPROTO_TCP : constant := 6; -- TCP
+
+ -------------------
+ -- Request flags --
+ -------------------
+
+ MSG_OOB : constant := 1; -- Process out-of-band data
+ MSG_PEEK : constant := 2; -- Peek at incoming data
+ MSG_EOR : constant := 8; -- Send end of record
+ MSG_WAITALL : constant := 64; -- Wait for full reception
+ MSG_NOSIGNAL : constant := -1; -- No SIGPIPE on send
+ MSG_Forced_Flags : constant := 0;
+ -- Flags set on all send(2) calls
+
+ --------------------
+ -- Socket options --
+ --------------------
+
+ TCP_NODELAY : constant := 1; -- Do not coalesce packets
+ SO_REUSEADDR : constant := 4; -- Bind reuse local address
+ SO_KEEPALIVE : constant := 8; -- Enable keep-alive msgs
+ SO_LINGER : constant := 128; -- Defer close to flush data
+ SO_BROADCAST : constant := 32; -- Can send broadcast msgs
+ SO_SNDBUF : constant := 4097; -- Set/get send buffer size
+ SO_RCVBUF : constant := 4098; -- Set/get recv buffer size
+ SO_SNDTIMEO : constant := 4101; -- Emission timeout
+ SO_RCVTIMEO : constant := 4102; -- Reception timeout
+ SO_ERROR : constant := 4103; -- Get/clear error status
+ IP_MULTICAST_IF : constant := 16; -- Set/get mcast interface
+ IP_MULTICAST_TTL : constant := 17; -- Set/get multicast TTL
+ IP_MULTICAST_LOOP : constant := 18; -- Set/get mcast loopback
+ IP_ADD_MEMBERSHIP : constant := 19; -- Join a multicast group
+ IP_DROP_MEMBERSHIP : constant := 20; -- Leave a multicast group
+
+ -------------------
+ -- System limits --
+ -------------------
+
+ IOV_MAX : constant := 16; -- Maximum writev iovcnt
+
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 8; -- tv_sec
+ SIZEOF_tv_usec : constant := 8; -- tv_usec
+
+end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-solaris.ads b/gcc/ada/g-soccon-solaris.ads
index 07de5cdbc29..7204e975c51 100644
--- a/gcc/ada/g-soccon-solaris.ads
+++ b/gcc/ada/g-soccon-solaris.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 16; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-tru64.ads b/gcc/ada/g-soccon-tru64.ads
index be7578f3521..b6d6836452d 100644
--- a/gcc/ada/g-soccon-tru64.ads
+++ b/gcc/ada/g-soccon-tru64.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-unixware.ads b/gcc/ada/g-soccon-unixware.ads
index 127cfce2a0c..148989e0325 100644
--- a/gcc/ada/g-soccon-unixware.ads
+++ b/gcc/ada/g-soccon-unixware.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-soccon-vms.ads b/gcc/ada/g-soccon-vms.ads
index 3b0f20fe61c..85996efa3cd 100644
--- a/gcc/ada/g-soccon-vms.ads
+++ b/gcc/ada/g-soccon-vms.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,4 +169,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 1024; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon-vxworks.ads b/gcc/ada/g-soccon-vxworks.ads
index d31337f675c..1accc7cc812 100644
--- a/gcc/ada/g-soccon-vxworks.ads
+++ b/gcc/ada/g-soccon-vxworks.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,4 +169,23 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
+ --------------------------------
+ -- VxWorks-specific constants --
+ --------------------------------
+
+ -- These constants may be used only within the VxWorks version of
+ -- GNAT.Sockets.Thin.
+
+ OK : constant := 0; -- VxWorks generic success
+ ERROR : constant := -1; -- VxWorks generic error
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-soccon.ads b/gcc/ada/g-soccon.ads
index 202f442ec30..f2f00554efd 100644
--- a/gcc/ada/g-soccon.ads
+++ b/gcc/ada/g-soccon.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,10 @@
-- by the GNAT.Sockets package (g-socket.ads). This package should not be
-- directly with'ed by an applications program.
--- This is the version for i686-pc-linux-gnu
+-- WARNING! This file is a default version that must be replaced for
+-- each platform.
+-- The values below were computed from a i686-pc-linux-gnu environment.
+
-- This file is generated automatically, do not modify it by hand! Instead,
-- make changes to gen-soccon.c and re-run it on each target.
@@ -169,4 +172,13 @@ package GNAT.Sockets.Constants is
IOV_MAX : constant := 2147483647; -- Maximum writev iovcnt
+ ----------------------
+ -- Type definitions --
+ ----------------------
+
+ -- Sizes (in bytes) of the components of struct timeval
+
+ SIZEOF_tv_sec : constant := 4; -- tv_sec
+ SIZEOF_tv_usec : constant := 4; -- tv_usec
+
end GNAT.Sockets.Constants;
diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb
index a7af20b87d2..163dd2d0710 100644
--- a/gcc/ada/g-socket.adb
+++ b/gcc/ada/g-socket.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,8 +92,11 @@ package body GNAT.Sockets is
No_Delay => Constants.TCP_NODELAY,
Add_Membership => Constants.IP_ADD_MEMBERSHIP,
Drop_Membership => Constants.IP_DROP_MEMBERSHIP,
+ Multicast_If => Constants.IP_MULTICAST_IF,
Multicast_TTL => Constants.IP_MULTICAST_TTL,
- Multicast_Loop => Constants.IP_MULTICAST_LOOP);
+ Multicast_Loop => Constants.IP_MULTICAST_LOOP,
+ Send_Timeout => Constants.SO_SNDTIMEO,
+ Receive_Timeout => Constants.SO_RCVTIMEO);
Flags : constant array (0 .. 3) of C.int :=
(0 => Constants.MSG_OOB, -- Process_Out_Of_Band_Data
@@ -110,6 +113,9 @@ package body GNAT.Sockets is
function To_In_Addr is new Ada.Unchecked_Conversion (C.int, In_Addr);
function To_Int is new Ada.Unchecked_Conversion (In_Addr, C.int);
+ function Err_Code_Image (E : Integer) return String;
+ -- Return the value of E surrounded with brackets
+
-----------------------
-- Local subprograms --
-----------------------
@@ -160,15 +166,20 @@ package body GNAT.Sockets is
function To_Service_Entry (E : Servent) return Service_Entry_Type;
-- Conversion function
- function To_Timeval (Val : Selector_Duration) return Timeval;
+ function To_Timeval (Val : Timeval_Duration) return Timeval;
-- Separate Val in seconds and microseconds
+ function To_Duration (Val : Timeval) return Timeval_Duration;
+ -- Reconstruct a Duration value from a Timeval record (seconds and
+ -- microseconds).
+
procedure Raise_Socket_Error (Error : Integer);
-- Raise Socket_Error with an exception message describing the error code
+ -- from errno.
- procedure Raise_Host_Error (Error : Integer);
+ procedure Raise_Host_Error (H_Error : Integer);
-- Raise Host_Error exception with message describing error code (note
- -- hstrerror seems to be obsolete).
+ -- hstrerror seems to be obsolete) from h_errno.
procedure Narrow (Item : in out Socket_Set_Type);
-- Update Last as it may be greater than the real last socket
@@ -384,6 +395,7 @@ package body GNAT.Sockets is
is
Res : C.int;
Last : C.int;
+ RSig : Socket_Type renames Selector.R_Sig_Socket;
RSet : Socket_Set_Type;
WSet : Socket_Set_Type;
ESet : Socket_Set_Type;
@@ -391,102 +403,116 @@ package body GNAT.Sockets is
TPtr : Timeval_Access;
begin
- Status := Completed;
+ begin
+ Status := Completed;
- -- No timeout or Forever is indicated by a null timeval pointer
+ -- No timeout or Forever is indicated by a null timeval pointer
- if Timeout = Forever then
- TPtr := null;
- else
- TVal := To_Timeval (Timeout);
- TPtr := TVal'Unchecked_Access;
- end if;
+ if Timeout = Forever then
+ TPtr := null;
+ else
+ TVal := To_Timeval (Timeout);
+ TPtr := TVal'Unchecked_Access;
+ end if;
- -- Copy R_Socket_Set in RSet and add read signalling socket
+ -- Copy R_Socket_Set in RSet and add read signalling socket
- RSet := (Set => New_Socket_Set (R_Socket_Set.Set),
- Last => R_Socket_Set.Last);
- Set (RSet, Selector.R_Sig_Socket);
+ RSet := (Set => New_Socket_Set (R_Socket_Set.Set),
+ Last => R_Socket_Set.Last);
+ Set (RSet, RSig);
- -- Copy W_Socket_Set in WSet
+ -- Copy W_Socket_Set in WSet
- WSet := (Set => New_Socket_Set (W_Socket_Set.Set),
- Last => W_Socket_Set.Last);
+ WSet := (Set => New_Socket_Set (W_Socket_Set.Set),
+ Last => W_Socket_Set.Last);
- -- Copy E_Socket_Set in ESet
+ -- Copy E_Socket_Set in ESet
- ESet := (Set => New_Socket_Set (E_Socket_Set.Set),
- Last => E_Socket_Set.Last);
+ ESet := (Set => New_Socket_Set (E_Socket_Set.Set),
+ Last => E_Socket_Set.Last);
- Last := C.int'Max (C.int'Max (C.int (RSet.Last),
- C.int (WSet.Last)),
- C.int (ESet.Last));
+ Last := C.int'Max (C.int'Max (C.int (RSet.Last),
+ C.int (WSet.Last)),
+ C.int (ESet.Last));
- Res :=
- C_Select
- (Last + 1,
- RSet.Set,
- WSet.Set,
- ESet.Set,
- TPtr);
+ Res :=
+ C_Select
+ (Last + 1,
+ RSet.Set,
+ WSet.Set,
+ ESet.Set,
+ TPtr);
- if Res = Failure then
- Raise_Socket_Error (Socket_Errno);
- end if;
+ if Res = Failure then
+ Raise_Socket_Error (Socket_Errno);
+ end if;
- -- If Select was resumed because of read signalling socket, read this
- -- data and remove socket from set.
+ -- If Select was resumed because of read signalling socket, read this
+ -- data and remove socket from set.
- if Is_Set (RSet, Selector.R_Sig_Socket) then
- Clear (RSet, Selector.R_Sig_Socket);
+ if Is_Set (RSet, RSig) then
+ Clear (RSet, RSig);
- declare
- Buf : Character;
+ declare
+ Buf : Character;
- begin
- Res := C_Recv (C.int (Selector.R_Sig_Socket), Buf'Address, 1, 0);
+ begin
+ Res := C_Recv (C.int (RSig), Buf'Address, 1, 0);
- if Res = Failure then
- Raise_Socket_Error (Socket_Errno);
- end if;
- end;
+ if Res = Failure then
+ Raise_Socket_Error (Socket_Errno);
+ end if;
+ end;
- Status := Aborted;
+ Status := Aborted;
- elsif Res = 0 then
- Status := Expired;
- end if;
+ elsif Res = 0 then
+ Status := Expired;
+ end if;
- -- Update RSet, WSet and ESet in regard to their new socket sets
+ -- Update RSet, WSet and ESet in regard to their new socket sets
- Narrow (RSet);
- Narrow (WSet);
- Narrow (ESet);
+ Narrow (RSet);
+ Narrow (WSet);
+ Narrow (ESet);
- -- Reset RSet as it should be if R_Sig_Socket was not added
+ -- Reset RSet as it should be if R_Sig_Socket was not added
- if Is_Empty (RSet) then
- Empty (RSet);
- end if;
+ if Is_Empty (RSet) then
+ Empty (RSet);
+ end if;
- if Is_Empty (WSet) then
- Empty (WSet);
- end if;
+ if Is_Empty (WSet) then
+ Empty (WSet);
+ end if;
- if Is_Empty (ESet) then
- Empty (ESet);
- end if;
+ if Is_Empty (ESet) then
+ Empty (ESet);
+ end if;
- -- Deliver RSet, WSet and ESet
+ -- Deliver RSet, WSet and ESet
- Empty (R_Socket_Set);
- R_Socket_Set := RSet;
+ Empty (R_Socket_Set);
+ R_Socket_Set := RSet;
- Empty (W_Socket_Set);
- W_Socket_Set := WSet;
+ Empty (W_Socket_Set);
+ W_Socket_Set := WSet;
- Empty (E_Socket_Set);
- E_Socket_Set := ESet;
+ Empty (E_Socket_Set);
+ E_Socket_Set := ESet;
+
+ exception
+
+ when Socket_Error =>
+
+ -- The local socket sets must be emptied before propagating
+ -- Socket_Error so the associated storage is freed.
+
+ Empty (RSet);
+ Empty (WSet);
+ Empty (ESet);
+ raise;
+ end;
end Check_Selector;
-----------
@@ -510,11 +536,16 @@ package body GNAT.Sockets is
-- Close_Selector --
--------------------
- -- Comments needed below ???
- -- Why are exceptions ignored ???
-
procedure Close_Selector (Selector : in out Selector_Type) is
begin
+
+ -- Close the signalling sockets used internally for the implementation
+ -- of Abort_Selector. Exceptions are ignored because these sockets
+ -- are implementation artefacts of no interest to the user, and
+ -- there is little that can be done if either Close_Socket call fails
+ -- (which theoretically should not happen anyway). We also want to try
+ -- to perform the second Close_Socket even if the first one failed.
+
begin
Close_Socket (Selector.R_Sig_Socket);
exception
@@ -772,6 +803,17 @@ package body GNAT.Sockets is
Item.Last := No_Socket;
end Empty;
+ --------------------
+ -- Err_Code_Image --
+ --------------------
+
+ function Err_Code_Image (E : Integer) return String is
+ Msg : String := E'Img & "] ";
+ begin
+ Msg (Msg'First) := '[';
+ return Msg;
+ end Err_Code_Image;
+
--------------
-- Finalize --
--------------
@@ -845,7 +887,7 @@ package body GNAT.Sockets is
Res := C_Gethostbyaddr (HA'Address, HA'Size / 8, Constants.AF_INET);
if Res = null then
- Err := Socket_Errno;
+ Err := Host_Errno;
Task_Lock.Unlock;
Raise_Host_Error (Err);
end if;
@@ -884,7 +926,7 @@ package body GNAT.Sockets is
Res := C_Gethostbyname (HN);
if Res = null then
- Err := Socket_Errno;
+ Err := Host_Errno;
Task_Lock.Unlock;
Raise_Host_Error (Err);
end if;
@@ -1027,6 +1069,7 @@ package body GNAT.Sockets is
V8 : aliased Two_Int;
V4 : aliased C.int;
V1 : aliased C.unsigned_char;
+ VT : aliased Timeval;
Len : aliased C.int;
Add : System.Address;
Res : C.int;
@@ -1045,10 +1088,16 @@ package body GNAT.Sockets is
No_Delay |
Send_Buffer |
Receive_Buffer |
+ Multicast_If |
Error =>
Len := V4'Size / 8;
Add := V4'Address;
+ when Send_Timeout |
+ Receive_Timeout =>
+ Len := VT'Size / 8;
+ Add := VT'Address;
+
when Linger |
Add_Membership |
Drop_Membership =>
@@ -1091,12 +1140,19 @@ package body GNAT.Sockets is
To_Inet_Addr (To_In_Addr (V8 (V8'First)), Opt.Multicast_Address);
To_Inet_Addr (To_In_Addr (V8 (V8'Last)), Opt.Local_Interface);
+ when Multicast_If =>
+ To_Inet_Addr (To_In_Addr (V4), Opt.Outgoing_If);
+
when Multicast_TTL =>
Opt.Time_To_Live := Integer (V1);
when Multicast_Loop =>
Opt.Enabled := (V1 /= 0);
+ when Send_Timeout |
+ Receive_Timeout =>
+ Opt.Timeout := To_Duration (VT);
+
end case;
return Opt;
@@ -1379,12 +1435,11 @@ package body GNAT.Sockets is
-- Raise_Host_Error --
----------------------
- procedure Raise_Host_Error (Error : Integer) is
+ procedure Raise_Host_Error (H_Error : Integer) is
function Host_Error_Message return String;
- -- We do not use a C function like strerror because hstrerror
- -- that would correspond seems to be obsolete. Return
- -- appropriate string for error value.
+ -- We do not use a C function like strerror because hstrerror that would
+ -- correspond is obsolete. Return appropriate string for error value.
------------------------
-- Host_Error_Message --
@@ -1392,7 +1447,7 @@ package body GNAT.Sockets is
function Host_Error_Message return String is
begin
- case Error is
+ case H_Error is
when Constants.HOST_NOT_FOUND => return "Host not found";
when Constants.TRY_AGAIN => return "Try again";
when Constants.NO_RECOVERY => return "No recovery";
@@ -1404,7 +1459,9 @@ package body GNAT.Sockets is
-- Start of processing for Raise_Host_Error
begin
- Ada.Exceptions.Raise_Exception (Host_Error'Identity, Host_Error_Message);
+ Ada.Exceptions.Raise_Exception (Host_Error'Identity,
+ Err_Code_Image (H_Error)
+ & Host_Error_Message);
end Raise_Host_Error;
------------------------
@@ -1413,26 +1470,10 @@ package body GNAT.Sockets is
procedure Raise_Socket_Error (Error : Integer) is
use type C.Strings.chars_ptr;
-
- function Image (E : Integer) return String;
-
- -----------
- -- Image --
- -----------
-
- function Image (E : Integer) return String is
- Msg : String := E'Img & "] ";
- begin
- Msg (Msg'First) := '[';
- return Msg;
- end Image;
-
- -- Start of processing for Raise_Socket_Error
-
begin
- Ada.Exceptions.Raise_Exception
- (Socket_Error'Identity,
- Image (Error) & C.Strings.Value (Socket_Error_Message (Error)));
+ Ada.Exceptions.Raise_Exception (Socket_Error'Identity,
+ Err_Code_Image (Error)
+ & C.Strings.Value (Socket_Error_Message (Error)));
end Raise_Socket_Error;
----------
@@ -1639,11 +1680,12 @@ package body GNAT.Sockets is
is
Id : constant Exception_Id := Exception_Identity (Occurrence);
Msg : constant String := Exception_Message (Occurrence);
- First : Natural := Msg'First;
+ First : Natural;
Last : Natural;
Val : Integer;
begin
+ First := Msg'First;
while First <= Msg'Last
and then Msg (First) not in '0' .. '9'
loop
@@ -1655,7 +1697,6 @@ package body GNAT.Sockets is
end if;
Last := First;
-
while Last < Msg'Last
and then Msg (Last + 1) in '0' .. '9'
loop
@@ -1854,7 +1895,8 @@ package body GNAT.Sockets is
V8 : aliased Two_Int;
V4 : aliased C.int;
V1 : aliased C.unsigned_char;
- Len : aliased C.int;
+ VT : aliased Timeval;
+ Len : C.int;
Add : System.Address := Null_Address;
Res : C.int;
@@ -1892,6 +1934,11 @@ package body GNAT.Sockets is
Len := V8'Size / 8;
Add := V8'Address;
+ when Multicast_If =>
+ V4 := To_Int (To_In_Addr (Option.Outgoing_If));
+ Len := V4'Size / 8;
+ Add := V4'Address;
+
when Multicast_TTL =>
V1 := C.unsigned_char (Option.Time_To_Live);
Len := V1'Size / 8;
@@ -1902,6 +1949,12 @@ package body GNAT.Sockets is
Len := V1'Size / 8;
Add := V1'Address;
+ when Send_Timeout |
+ Receive_Timeout =>
+ VT := To_Timeval (Option.Timeout);
+ Len := VT'Size / 8;
+ Add := VT'Address;
+
end case;
Res := C_Setsockopt
@@ -1999,6 +2052,15 @@ package body GNAT.Sockets is
return Integer (Socket);
end To_C;
+ -----------------
+ -- To_Duration --
+ -----------------
+
+ function To_Duration (Val : Timeval) return Timeval_Duration is
+ begin
+ return Natural (Val.Tv_Sec) * 1.0 + Natural (Val.Tv_Usec) * 1.0E-6;
+ end To_Duration;
+
-------------------
-- To_Host_Entry --
-------------------
@@ -2100,6 +2162,7 @@ package body GNAT.Sockets is
if Flags (J) = -1 then
Raise_Socket_Error (Constants.EOPNOTSUPP);
end if;
+
Result := Result + Flags (J);
end if;
@@ -2176,25 +2239,25 @@ package body GNAT.Sockets is
-- To_Timeval --
----------------
- function To_Timeval (Val : Selector_Duration) return Timeval is
- S : Timeval_Unit;
- MS : Timeval_Unit;
+ function To_Timeval (Val : Timeval_Duration) return Timeval is
+ S : time_t;
+ uS : suseconds_t;
begin
-- If zero, set result as zero (otherwise it gets rounded down to -1)
if Val = 0.0 then
S := 0;
- MS := 0;
+ uS := 0;
-- Normal case where we do round down
else
- S := Timeval_Unit (Val - 0.5);
- MS := Timeval_Unit (1_000_000 * (Val - Selector_Duration (S)));
+ S := time_t (Val - 0.5);
+ uS := suseconds_t (1_000_000 * (Val - Selector_Duration (S)));
end if;
- return (S, MS);
+ return (S, uS);
end To_Timeval;
-----------
diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads
index 7529c050892..6268545a5fa 100644
--- a/gcc/ada/g-socket.ads
+++ b/gcc/ada/g-socket.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -489,7 +489,7 @@ package GNAT.Sockets is
Host_Error : exception;
-- Exception raised by the two following procedures. Once raised, its
-- message contains a string describing the error code. This exception is
- -- raised when an host entry can not be retrieved.
+ -- raised when an host entry cannot be retrieved.
function Get_Host_By_Address
(Address : Inet_Addr_Type;
@@ -595,6 +595,16 @@ package GNAT.Sockets is
Unknown_Server_Error,
Cannot_Resolve_Error);
+ -- Timeval_Duration is a subtype of Standard.Duration because the full
+ -- range of Standard.Duration cannot be represented in the equivalent C
+ -- structure. Moreover, negative values are not allowed to avoid system
+ -- incompatibilities.
+
+ Immediate : constant := 0.0;
+ Forever : constant := Duration (Integer'Last) * 1.0;
+
+ subtype Timeval_Duration is Duration range Immediate .. Forever;
+
-- Get_Socket_Options and Set_Socket_Options manipulate options associated
-- with a socket. Options may exist at multiple protocol levels in the
-- communication stack. Socket_Level is the uppermost socket level.
@@ -610,18 +620,21 @@ package GNAT.Sockets is
-- a boolean to enable or disable this option.
type Option_Name is (
- Keep_Alive, -- Enable sending of keep-alive messages
- Reuse_Address, -- Allow bind to reuse local address
- Broadcast, -- Enable datagram sockets to recv/send broadcast packets
- Send_Buffer, -- Set/get the maximum socket send buffer in bytes
- Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
- Linger, -- Shutdown wait for msg to be sent or timeout occur
- Error, -- Get and clear the pending socket error
- No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY)
- Add_Membership, -- Join a multicast group
- Drop_Membership, -- Leave a multicast group
- Multicast_TTL, -- Indicate the time-to-live of sent multicast packets
- Multicast_Loop); -- Sent multicast packets are looped to the local socket
+ Keep_Alive, -- Enable sending of keep-alive messages
+ Reuse_Address, -- Allow bind to reuse local address
+ Broadcast, -- Enable datagram sockets to recv/send broadcasts
+ Send_Buffer, -- Set/get the maximum socket send buffer in bytes
+ Receive_Buffer, -- Set/get the maximum socket recv buffer in bytes
+ Linger, -- Shutdown wait for msg to be sent or timeout occur
+ Error, -- Get and clear the pending socket error
+ No_Delay, -- Do not delay send to coalesce packets (TCP_NODELAY)
+ Add_Membership, -- Join a multicast group
+ Drop_Membership, -- Leave a multicast group
+ Multicast_If, -- Set default outgoing interface for multicast packets
+ Multicast_TTL, -- Indicate the time-to-live of sent multicast packets
+ Multicast_Loop, -- Sent multicast packets are looped to local socket
+ Send_Timeout, -- Set timeout value for output
+ Receive_Timeout); -- Set timeout value for input
type Option_Type (Name : Option_Name := Keep_Alive) is record
case Name is
@@ -652,9 +665,16 @@ package GNAT.Sockets is
Multicast_Address : Inet_Addr_Type;
Local_Interface : Inet_Addr_Type;
+ when Multicast_If =>
+ Outgoing_If : Inet_Addr_Type;
+
when Multicast_TTL =>
Time_To_Live : Natural;
+ when Send_Timeout |
+ Receive_Timeout =>
+ Timeout : Timeval_Duration;
+
end case;
end record;
@@ -935,15 +955,7 @@ package GNAT.Sockets is
type Selector_Type is limited private;
type Selector_Access is access all Selector_Type;
- -- Selector_Duration is a subtype of Standard.Duration because the full
- -- range of Standard.Duration cannot be represented in the equivalent C
- -- structure. Moreover, negative values are not allowed to avoid system
- -- incompatibilities.
-
- Immediate : constant := 0.0;
- Forever : constant := Duration (Integer'Last) * 1.0;
-
- subtype Selector_Duration is Duration range Immediate .. Forever;
+ subtype Selector_Duration is Timeval_Duration;
procedure Create_Selector (Selector : out Selector_Type);
-- Create a new selector
diff --git a/gcc/ada/g-socthi-mingw.adb b/gcc/ada/g-socthi-mingw.adb
index e525cc839e3..862305dbd2e 100644
--- a/gcc/ada/g-socthi-mingw.adb
+++ b/gcc/ada/g-socthi-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 AdaCore --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -59,8 +59,7 @@ package body GNAT.Sockets.Thin is
function Standard_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
pragma Import (Stdcall, Standard_Connect, "connect");
function Standard_Select
@@ -68,8 +67,7 @@ package body GNAT.Sockets.Thin is
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int;
+ Timeout : Timeval_Access) return C.int;
pragma Import (Stdcall, Standard_Select, "select");
type Error_Type is
@@ -239,8 +237,7 @@ package body GNAT.Sockets.Thin is
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int
+ Namelen : C.int) return C.int
is
Res : C.int;
@@ -263,8 +260,7 @@ package body GNAT.Sockets.Thin is
function C_Readv
(Socket : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int
+ Iovcnt : C.int) return C.int
is
Res : C.int;
Count : C.int := 0;
@@ -299,8 +295,7 @@ package body GNAT.Sockets.Thin is
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int
+ Timeout : Timeval_Access) return C.int
is
pragma Warnings (Off, Exceptfds);
@@ -441,8 +436,7 @@ package body GNAT.Sockets.Thin is
function C_Writev
(Socket : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int
+ Iovcnt : C.int) return C.int
is
Res : C.int;
Count : C.int := 0;
@@ -553,11 +547,8 @@ package body GNAT.Sockets.Thin is
--------------------------
function Socket_Error_Message
- (Errno : Integer)
- return C.Strings.chars_ptr
+ (Errno : Integer) return C.Strings.chars_ptr
is
- use GNAT.Sockets.Constants;
-
begin
case Errno is
when EINTR => return Error_Messages (N_EINTR);
diff --git a/gcc/ada/g-socthi-mingw.ads b/gcc/ada/g-socthi-mingw.ads
index a73b0a7ce03..11509c095ea 100644
--- a/gcc/ada/g-socthi-mingw.ads
+++ b/gcc/ada/g-socthi-mingw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 AdaCore --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -61,20 +61,32 @@ package GNAT.Sockets.Thin is
-- Set last socket error number
function Socket_Error_Message
- (Errno : Integer)
- return C.Strings.chars_ptr;
+ (Errno : Integer) return C.Strings.chars_ptr;
-- Returns the error message string for the error number Errno. If
-- Errno is not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.long;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -(2 ** (8 * Constants.SIZEOF_tv_sec - 1))
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -(2 ** (8 * Constants.SIZEOF_tv_usec - 1))
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
diff --git a/gcc/ada/g-socthi-vms.adb b/gcc/ada/g-socthi-vms.adb
index b8dcc2dc915..d1545e050fe 100644
--- a/gcc/ada/g-socthi-vms.adb
+++ b/gcc/ada/g-socthi-vms.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -40,8 +40,8 @@ with Interfaces.C; use Interfaces.C;
package body GNAT.Sockets.Thin is
- Non_Blocking_Sockets : constant Fd_Set_Access
- := New_Socket_Set (No_Socket_Set);
+ Non_Blocking_Sockets : constant Fd_Set_Access :=
+ New_Socket_Set (No_Socket_Set);
-- When this package is initialized with Process_Blocking_IO set
-- to True, sockets are set in non-blocking mode to avoid blocking
-- the whole process when a thread wants to perform a blocking IO
@@ -59,7 +59,7 @@ package body GNAT.Sockets.Thin is
Thread_Blocking_IO : Boolean := True;
Unknown_System_Error : constant C.Strings.chars_ptr :=
- C.Strings.New_String ("Unknown system error");
+ C.Strings.New_String ("Unknown system error");
function Syscall_Accept
(S : C.int;
@@ -99,8 +99,7 @@ package body GNAT.Sockets.Thin is
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
pragma Import (C, Syscall_Send, "send");
function Syscall_Sendto
@@ -109,8 +108,7 @@ package body GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
- Tolen : C.int)
- return C.int;
+ Tolen : C.int) return C.int;
pragma Import (C, Syscall_Sendto, "sendto");
function Syscall_Socket
diff --git a/gcc/ada/g-socthi-vms.ads b/gcc/ada/g-socthi-vms.ads
index 6a19d2dc5f4..1b05e4719bc 100644
--- a/gcc/ada/g-socthi-vms.ads
+++ b/gcc/ada/g-socthi-vms.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -64,15 +64,28 @@ package GNAT.Sockets.Thin is
-- Returns the error message string for the error number Errno. If
-- Errno is not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.int;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
@@ -197,94 +210,78 @@ package GNAT.Sockets.Thin is
function C_Accept
(S : C.int;
Addr : System.Address;
- Addrlen : access C.int)
- return C.int;
+ Addrlen : access C.int) return C.int;
function C_Bind
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Close
- (Fd : C.int)
- return C.int;
+ (Fd : C.int) return C.int;
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Gethostbyaddr
(Addr : System.Address;
Len : C.int;
- Typ : C.int)
- return Hostent_Access;
+ Typ : C.int) return Hostent_Access;
function C_Gethostbyname
- (Name : C.char_array)
- return Hostent_Access;
+ (Name : C.char_array) return Hostent_Access;
function C_Gethostname
(Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Getpeername
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getservbyname
(Name : C.char_array;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getservbyport
(Port : C.int;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getsockname
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : access C.int)
- return C.int;
+ Optlen : access C.int) return C.int;
function C_Inet_Addr
- (Cp : C.Strings.chars_ptr)
- return C.int;
+ (Cp : C.Strings.chars_ptr) return C.int;
function C_Ioctl
(S : C.int;
Req : C.int;
- Arg : Int_Access)
- return C.int;
+ Arg : Int_Access) return C.int;
function C_Listen (S, Backlog : C.int) return C.int;
function C_Readv
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
function C_Recv
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Recvfrom
(S : C.int;
@@ -292,23 +289,20 @@ package GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
- Fromlen : access C.int)
- return C.int;
+ Fromlen : access C.int) return C.int;
function C_Select
(Nfds : C.int;
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int;
+ Timeout : Timeval_Access) return C.int;
function C_Send
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Sendto
(S : C.int;
@@ -316,44 +310,37 @@ package GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
- Tolen : C.int)
- return C.int;
+ Tolen : C.int) return C.int;
function C_Setsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : C.int)
- return C.int;
+ Optlen : C.int) return C.int;
function C_Shutdown
(S : C.int;
- How : C.int)
- return C.int;
+ How : C.int) return C.int;
function C_Socket
(Domain : C.int;
Typ : C.int;
- Protocol : C.int)
- return C.int;
+ Protocol : C.int) return C.int;
function C_Strerror
- (Errnum : C.int)
- return C.Strings.chars_ptr;
+ (Errnum : C.int) return C.Strings.chars_ptr;
function C_System
- (Command : System.Address)
- return C.int;
+ (Command : System.Address) return C.int;
function C_Writev
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
procedure Free_Socket_Set
- (Set : Fd_Set_Access);
+ (Set : Fd_Set_Access);
-- Free system-dependent socket set
procedure Get_Socket_From_Set
@@ -387,8 +374,7 @@ package GNAT.Sockets.Thin is
-- set back to the real largest socket in the socket set.
function New_Socket_Set
- (Set : Fd_Set_Access)
- return Fd_Set_Access;
+ (Set : Fd_Set_Access) return Fd_Set_Access;
-- Allocate a new socket set which is a system-dependent structure
-- and initialize by copying Set if it is non-null, by making it
-- empty otherwise.
diff --git a/gcc/ada/g-socthi-vxworks.adb b/gcc/ada/g-socthi-vxworks.adb
index 95de193ecf7..02a0df3fe33 100644
--- a/gcc/ada/g-socthi-vxworks.adb
+++ b/gcc/ada/g-socthi-vxworks.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -267,14 +267,19 @@ package body GNAT.Sockets.Thin is
function To_Pointer is
new Unchecked_Conversion (System.Address, int_Access);
- procedure VxWorks_Gethostbyaddr
- (Addr : C.int; Buf : out C.char_array);
- pragma Import (C, VxWorks_Gethostbyaddr, "hostGetByAddr");
+ function VxWorks_hostGetByAddr
+ (Addr : C.int; Buf : System.Address) return C.int;
+ pragma Import (C, VxWorks_hostGetByAddr, "hostGetByAddr");
- Host_Name : C.char_array (1 .. Max_Name_Length);
+ Host_Name : aliased C.char_array (1 .. Max_Name_Length);
begin
- VxWorks_Gethostbyaddr (To_Pointer (Addr).all, Host_Name);
+ if VxWorks_hostGetByAddr (To_Pointer (Addr).all,
+ Host_Name (Host_Name'First)'Address)
+ /= Constants.OK
+ then
+ return null;
+ end if;
In_Addr_Access_Ptr.all.all := To_In_Addr (To_Pointer (Addr).all);
Local_Hostent.all.H_Name := C.Strings.New_Char_Array (Host_Name);
@@ -289,14 +294,17 @@ package body GNAT.Sockets.Thin is
function C_Gethostbyname
(Name : C.char_array) return Hostent_Access
is
- function VxWorks_Gethostbyname
+ function VxWorks_hostGetByName
(Name : C.char_array) return C.int;
- pragma Import (C, VxWorks_Gethostbyname, "hostGetByName");
+ pragma Import (C, VxWorks_hostGetByName, "hostGetByName");
Addr : C.int;
begin
- Addr := VxWorks_Gethostbyname (Name);
+ Addr := VxWorks_hostGetByName (Name);
+ if Addr /= Constants.OK then
+ return null;
+ end if;
In_Addr_Access_Ptr.all.all := To_In_Addr (Addr);
Local_Hostent.all.H_Name := C.Strings.New_Char_Array (To_C (Host_Name));
@@ -515,7 +523,6 @@ package body GNAT.Sockets.Thin is
function Non_Blocking_Socket (S : C.int) return Boolean is
R : Boolean;
-
begin
Task_Lock.Lock;
R := (Is_Socket_In_Set (Non_Blocking_Sockets, S) /= 0);
diff --git a/gcc/ada/g-socthi-vxworks.ads b/gcc/ada/g-socthi-vxworks.ads
index 2d818272983..6aee25d4ef4 100644
--- a/gcc/ada/g-socthi-vxworks.ads
+++ b/gcc/ada/g-socthi-vxworks.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -63,15 +63,28 @@ package GNAT.Sockets.Thin is
-- Returns the error message string for the error number Errno. If Errno is
-- not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.int;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
@@ -199,94 +212,78 @@ package GNAT.Sockets.Thin is
function C_Accept
(S : C.int;
Addr : System.Address;
- Addrlen : access C.int)
- return C.int;
+ Addrlen : access C.int) return C.int;
function C_Bind
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Close
- (Fd : C.int)
- return C.int;
+ (Fd : C.int) return C.int;
function C_Connect
(S : C.int;
Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Gethostbyaddr
(Addr : System.Address;
Len : C.int;
- Typ : C.int)
- return Hostent_Access;
+ Typ : C.int) return Hostent_Access;
function C_Gethostbyname
- (Name : C.char_array)
- return Hostent_Access;
+ (Name : C.char_array) return Hostent_Access;
function C_Gethostname
(Name : System.Address;
- Namelen : C.int)
- return C.int;
+ Namelen : C.int) return C.int;
function C_Getpeername
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getservbyname
(Name : C.char_array;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getservbyport
(Port : C.int;
- Proto : C.char_array)
- return Servent_Access;
+ Proto : C.char_array) return Servent_Access;
function C_Getsockname
(S : C.int;
Name : System.Address;
- Namelen : access C.int)
- return C.int;
+ Namelen : access C.int) return C.int;
function C_Getsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : access C.int)
- return C.int;
+ Optlen : access C.int) return C.int;
function C_Inet_Addr
- (Cp : C.Strings.chars_ptr)
- return C.int;
+ (Cp : C.Strings.chars_ptr) return C.int;
function C_Ioctl
- (S : C.int;
- Req : C.int;
- Arg : Int_Access)
- return C.int;
+ (S : C.int;
+ Req : C.int;
+ Arg : Int_Access) return C.int;
function C_Listen (S, Backlog : C.int) return C.int;
function C_Readv
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
function C_Recv
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Recvfrom
(S : C.int;
@@ -294,23 +291,20 @@ package GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
From : Sockaddr_In_Access;
- Fromlen : access C.int)
- return C.int;
+ Fromlen : access C.int) return C.int;
function C_Select
(Nfds : C.int;
Readfds : Fd_Set_Access;
Writefds : Fd_Set_Access;
Exceptfds : Fd_Set_Access;
- Timeout : Timeval_Access)
- return C.int;
+ Timeout : Timeval_Access) return C.int;
function C_Send
(S : C.int;
Msg : System.Address;
Len : C.int;
- Flags : C.int)
- return C.int;
+ Flags : C.int) return C.int;
function C_Sendto
(S : C.int;
@@ -318,44 +312,37 @@ package GNAT.Sockets.Thin is
Len : C.int;
Flags : C.int;
To : Sockaddr_In_Access;
- Tolen : C.int)
- return C.int;
+ Tolen : C.int) return C.int;
function C_Setsockopt
(S : C.int;
Level : C.int;
Optname : C.int;
Optval : System.Address;
- Optlen : C.int)
- return C.int;
+ Optlen : C.int) return C.int;
function C_Shutdown
- (S : C.int;
- How : C.int)
- return C.int;
+ (S : C.int;
+ How : C.int) return C.int;
function C_Socket
(Domain : C.int;
Typ : C.int;
- Protocol : C.int)
- return C.int;
+ Protocol : C.int) return C.int;
function C_Strerror
- (Errnum : C.int)
- return C.Strings.chars_ptr;
+ (Errnum : C.int) return C.Strings.chars_ptr;
function C_System
- (Command : System.Address)
- return C.int;
+ (Command : System.Address) return C.int;
function C_Writev
(Fd : C.int;
Iov : System.Address;
- Iovcnt : C.int)
- return C.int;
+ Iovcnt : C.int) return C.int;
procedure Free_Socket_Set
- (Set : Fd_Set_Access);
+ (Set : Fd_Set_Access);
-- Free system-dependent socket set
procedure Get_Socket_From_Set
@@ -389,8 +376,7 @@ package GNAT.Sockets.Thin is
-- set back to the real largest socket in the socket set.
function New_Socket_Set
- (Set : Fd_Set_Access)
- return Fd_Set_Access;
+ (Set : Fd_Set_Access) return Fd_Set_Access;
-- Allocate a new socket set which is a system-dependent structure
-- and initialize by copying Set if it is non-null, by making it
-- empty otherwise.
diff --git a/gcc/ada/g-socthi.adb b/gcc/ada/g-socthi.adb
index 188912898a0..914b787a41c 100644
--- a/gcc/ada/g-socthi.adb
+++ b/gcc/ada/g-socthi.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -127,7 +127,7 @@ package body GNAT.Sockets.Thin is
procedure Disable_SIGPIPE (S : C.int);
pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe");
- function Non_Blocking_Socket (S : C.int) return Boolean;
+ function Non_Blocking_Socket (S : C.int) return Boolean;
procedure Set_Non_Blocking_Socket (S : C.int; V : Boolean);
--------------
@@ -503,7 +503,6 @@ package body GNAT.Sockets.Thin is
if C_Msg = C.Strings.Null_Ptr then
return Unknown_System_Error;
-
else
return C_Msg;
end if;
diff --git a/gcc/ada/g-socthi.ads b/gcc/ada/g-socthi.ads
index 10a9a2160e5..5d06d99bcae 100644
--- a/gcc/ada/g-socthi.ads
+++ b/gcc/ada/g-socthi.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -65,15 +65,28 @@ package GNAT.Sockets.Thin is
-- Returns the error message string for the error number Errno. If Errno is
-- not known it returns "Unknown system error".
+ function Host_Errno return Integer;
+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
+ -- Returns last host error number
+
subtype Fd_Set_Access is System.Address;
No_Fd_Set : constant Fd_Set_Access := System.Null_Address;
- type Timeval_Unit is new C.int;
- pragma Convention (C, Timeval_Unit);
+ type time_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_sec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_sec - 1) - 1;
+ for time_t'Size use 8 * Constants.SIZEOF_tv_sec;
+ pragma Convention (C, time_t);
+
+ type suseconds_t is
+ range -2 ** (8 * Constants.SIZEOF_tv_usec - 1)
+ .. 2 ** (8 * Constants.SIZEOF_tv_usec - 1) - 1;
+ for suseconds_t'Size use 8 * Constants.SIZEOF_tv_usec;
+ pragma Convention (C, suseconds_t);
type Timeval is record
- Tv_Sec : Timeval_Unit;
- Tv_Usec : Timeval_Unit;
+ Tv_Sec : time_t;
+ Tv_Usec : suseconds_t;
end record;
pragma Convention (C, Timeval);
diff --git a/gcc/ada/g-soliop-mingw.ads b/gcc/ada/g-soliop-mingw.ads
index 01874385123..2966df635e5 100644
--- a/gcc/ada/g-soliop-mingw.ads
+++ b/gcc/ada/g-soliop-mingw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-soliop-solaris.ads b/gcc/ada/g-soliop-solaris.ads
index f3b4b99c32d..9e012d61f73 100644
--- a/gcc/ada/g-soliop-solaris.ads
+++ b/gcc/ada/g-soliop-solaris.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-soliop-unixware.ads b/gcc/ada/g-soliop-unixware.ads
index 21727d4b762..4f42edc3be4 100644
--- a/gcc/ada/g-soliop-unixware.ads
+++ b/gcc/ada/g-soliop-unixware.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-soliop.ads b/gcc/ada/g-soliop.ads
index ca9aab16f24..daaa4743b4f 100644
--- a/gcc/ada/g-soliop.ads
+++ b/gcc/ada/g-soliop.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-spipat.adb b/gcc/ada/g-spipat.adb
index 43434738fae..ab6bdd55f33 100644
--- a/gcc/ada/g-spipat.adb
+++ b/gcc/ada/g-spipat.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 1998-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-spipat.ads b/gcc/ada/g-spipat.ads
index 4f66b0d726a..31cbef67d6b 100644
--- a/gcc/ada/g-spipat.ads
+++ b/gcc/ada/g-spipat.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1997-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-spitbo.adb b/gcc/ada/g-spitbo.adb
index 7bab3f4a638..3bceb9cce85 100644
--- a/gcc/ada/g-spitbo.adb
+++ b/gcc/ada/g-spitbo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1998-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -622,7 +622,7 @@ package body GNAT.Spitbol is
begin
for J in Str'Range loop
- Result := Rotate_Left (Result, 1) +
+ Result := Rotate_Left (Result, 3) +
Unsigned_32 (Character'Pos (Str (J)));
end loop;
diff --git a/gcc/ada/g-sptabo.ads b/gcc/ada/g-sptabo.ads
index 1a960268ae2..659a2a1ff56 100644
--- a/gcc/ada/g-sptabo.ads
+++ b/gcc/ada/g-sptabo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-1998 Ada Core Technologies, Inc. --
+-- Copyright (C) 1997-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-sptain.ads b/gcc/ada/g-sptain.ads
index 4bd204ca518..3ac15d1a2cd 100644
--- a/gcc/ada/g-sptain.ads
+++ b/gcc/ada/g-sptain.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-1998 Ada Core Technologies, Inc. --
+-- Copyright (C) 1997-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-sptavs.ads b/gcc/ada/g-sptavs.ads
index efb3aa41b06..afa1575a27e 100644
--- a/gcc/ada/g-sptavs.ads
+++ b/gcc/ada/g-sptavs.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-1998 Ada Core Technologies, Inc. --
+-- Copyright (C) 1997-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-string.ads b/gcc/ada/g-string.ads
index f4f2e696da9..d11298c5f8b 100644
--- a/gcc/ada/g-string.ads
+++ b/gcc/ada/g-string.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1995-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-tasloc.adb b/gcc/ada/g-tasloc.adb
index c2acad14b0b..7667e49e14b 100644
--- a/gcc/ada/g-tasloc.adb
+++ b/gcc/ada/g-tasloc.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-1999 Ada Core Technologies, Inc. --
+-- Copyright (C) 1997-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-tasloc.ads b/gcc/ada/g-tasloc.ads
index 29fb36e3178..757d3c2df93 100644
--- a/gcc/ada/g-tasloc.ads
+++ b/gcc/ada/g-tasloc.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1998-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-trasym-vms-alpha.adb b/gcc/ada/g-trasym-vms-alpha.adb
index d294362c131..bb161e027ea 100644
--- a/gcc/ada/g-trasym-vms-alpha.adb
+++ b/gcc/ada/g-trasym-vms-alpha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-trasym-vms-ia64.adb b/gcc/ada/g-trasym-vms-ia64.adb
index 2e1834bffa0..1d82b66f67a 100644
--- a/gcc/ada/g-trasym-vms-ia64.adb
+++ b/gcc/ada/g-trasym-vms-ia64.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/g-trasym.adb b/gcc/ada/g-trasym.adb
index d518d70fa46..e8f91221a31 100644
--- a/gcc/ada/g-trasym.adb
+++ b/gcc/ada/g-trasym.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2002 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -50,10 +50,10 @@ package body GNAT.Traceback.Symbolic is
function Symbolic_Traceback (Traceback : Tracebacks_Array) return String is
procedure convert_addresses
- (addrs : System.Address;
- n_addr : Integer;
- buf : System.Address;
- len : System.Address);
+ (addrs : System.Address;
+ n_addr : Integer;
+ buf : System.Address;
+ len : System.Address);
pragma Import (C, convert_addresses, "convert_addresses");
-- This is the procedure version of the Ada aware addr2line that will
-- use argv[0] as the executable containing the debug information.
diff --git a/gcc/ada/g-trasym.ads b/gcc/ada/g-trasym.ads
index 8409732c032..626d8567269 100644
--- a/gcc/ada/g-trasym.ads
+++ b/gcc/ada/g-trasym.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/gen-soccon.c b/gcc/ada/gen-soccon.c
index 363416a674f..e8284335bcf 100644
--- a/gcc/ada/gen-soccon.c
+++ b/gcc/ada/gen-soccon.c
@@ -4,7 +4,7 @@
* *
* G E N - S O C C O N *
* *
- * Copyright (C) 2004-2005 Free Software Foundation, Inc. *
+ * Copyright (C) 2004-2005, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -25,7 +25,7 @@
/* This program generates g-soccon.ads */
/* To build using DEC C:
- CC/DEFINE="TARGET=OpenVMS" gen-soccon
+ CC/DEFINE="TARGET=""OpenVMS""" gen-soccon
LINK gen-soccon
RUN gen-soccon
*/
@@ -37,6 +37,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
+
+#ifdef __MINGW32__
+#include <fcntl.h>
+#endif
#include "gsocket.h"
@@ -55,8 +60,8 @@ struct line *first = NULL, *last = NULL;
#define _NL TXT("")
/* Empty line */
-#define itoad(n) f_itoa ("%d", n)
-#define itoax(n) f_itoa ("16#%08x#", n)
+#define itoad(n) f_itoa ("%d", (n))
+#define itoax(n) f_itoa ("16#%08x#", (n))
#define CND(name,comment) add_line(#name, itoad (name), comment);
/* Constant (decimal) */
@@ -78,6 +83,10 @@ char *f_itoa (char *, int);
void add_line (char *, char*, char*);
+#ifdef __MINGW32__
+unsigned int _CRT_fmode = _O_BINARY;
+#endif
+
int
main (void) {
@@ -89,7 +98,7 @@ TXT("-- G N A T . S O C K E T S . C O N S T A N T S
TXT("-- --")
TXT("-- S p e c --")
TXT("-- --")
-TXT("-- Copyright (C) 2000-2005 Free Software Foundation, Inc. --")
+TXT("-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --")
TXT("-- --")
TXT("-- GNAT is free software; you can redistribute it and/or modify it under --")
TXT("-- terms of the GNU General Public License as published by the Free Soft- --")
@@ -118,7 +127,7 @@ TXT("-- This package provides target dependent definitions of constant for use"
TXT("-- by the GNAT.Sockets package (g-socket.ads). This package should not be")
TXT("-- directly with'ed by an applications program.")
_NL
-TXT("-- This is the version for " STR (TARGET))
+TXT("-- This is the version for " TARGET)
TXT("-- This file is generated automatically, do not modify it by hand! Instead,")
TXT("-- make changes to gen-soccon.c and re-run it on each target.")
_NL
@@ -565,6 +574,36 @@ _NL
CND(IOV_MAX, "Maximum writev iovcnt")
_NL
+TXT(" ----------------------")
+TXT(" -- Type definitions --")
+TXT(" ----------------------")
+_NL
+
+{
+ struct timeval tv;
+TXT(" -- Sizes (in bytes) of the components of struct timeval")
+_NL
+#define SIZEOF_tv_sec (sizeof tv.tv_sec)
+CND(SIZEOF_tv_sec, "tv_sec")
+#define SIZEOF_tv_usec (sizeof tv.tv_usec)
+CND(SIZEOF_tv_usec, "tv_usec")
+}
+
+#ifdef __vxworks
+_NL
+TXT(" --------------------------------")
+TXT(" -- VxWorks-specific constants --")
+TXT(" --------------------------------")
+_NL
+TXT(" -- These constants may be used only within the VxWorks version of")
+TXT(" -- GNAT.Sockets.Thin.")
+_NL
+
+CND(OK, "VxWorks generic success")
+CND(ERROR, "VxWorks generic error")
+#endif
+
+_NL
TXT("end GNAT.Sockets.Constants;")
output ();
@@ -614,6 +653,7 @@ f_itoa (char *fmt, int n) {
void
add_line (char *_text, char *_value, char *_comment) {
struct line *l = (struct line *) malloc (sizeof (struct line));
+
l->text = _text;
l->value = _value;
l->comment = _comment;
diff --git a/gcc/ada/gigi.h b/gcc/ada/gigi.h
index 9dba805530d..6dd10ff8210 100644
--- a/gcc/ada/gigi.h
+++ b/gcc/ada/gigi.h
@@ -248,9 +248,21 @@ extern void init_code_table (void);
called. */
extern Node_Id error_gnat_node;
-/* This is equivalent to stabilize_reference in GCC's tree.c, but we know
- how to handle our new nodes and we take an extra argument that says
- whether to force evaluation of everything. */
+/* This is equivalent to stabilize_reference in GCC's tree.c, but we know how
+ to handle our new nodes and we take extra arguments.
+
+ FORCE says whether to force evaluation of everything,
+
+ SUCCESS we set to true unless we walk through something we don't
+ know how to stabilize, or through something which is not an lvalue
+ and LVALUES_ONLY is true, in which cases we set to false. */
+extern tree maybe_stabilize_reference (tree ref, bool force, bool lvalues_only,
+ bool *success);
+
+/* Wrapper around maybe_stabilize_reference, for common uses without
+ lvalue restrictions and without need to examine the success
+ indication. */
+
extern tree gnat_stabilize_reference (tree ref, bool force);
/* Highest number in the front-end node table. */
@@ -612,6 +624,11 @@ extern tree build_vms_descriptor (tree type, Mechanism_Type mech,
extern tree build_unc_object_type (tree template_type, tree object_type,
tree name);
+/* Same as build_unc_object_type, but taking a thin or fat pointer type
+ instead of the template type. */
+extern tree build_unc_object_type_from_ptr (tree thin_fat_ptr_type,
+ tree object_type, tree name);
+
/* Update anything previously pointing to OLD_TYPE to point to NEW_TYPE. In
the normal case this is just two adjustments, but we have more to do
if NEW is an UNCONSTRAINED_ARRAY_TYPE. */
diff --git a/gcc/ada/gnat-style.texi b/gcc/ada/gnat-style.texi
index 6d7da446974..c681b5286a1 100644
--- a/gcc/ada/gnat-style.texi
+++ b/gcc/ada/gnat-style.texi
@@ -5,9 +5,9 @@
@c o
@c GNAT DOCUMENTATION o
@c o
-@c G N A T C O D I N G S T Y L E o
+@c G N A T C O D I N G S T Y L E o
@c o
-@c Copyright (C) 1992-2005 Ada Core Technologies, Inc. o
+@c Copyright (C) 1992-2005, AdaCore o
@c o
@c GNAT is free software; you can redistribute it and/or modify it under o
@c terms of the GNU General Public License as published by the Free Soft- o
@@ -262,7 +262,8 @@ the first letter of the comment).
When declarations are commented with ``hanging'' comments, i.e.@:
comments after the declaration, there is no blank line before the
comment, and if it is absolutely necessary to have blank lines within
-the comments these blank lines @emph{do} have a @code{--} (unlike the
+the comments, e.g. to make paragraph separations within a single comment,
+these blank lines @emph{do} have a @code{--} (unlike the
normal rule, which is to use entirely blank lines for separating
comment paragraphs). The comment starts at same level of indentation
as code it is commenting.
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 7e9713f0588..9baa081a703 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -399,6 +399,7 @@ Implementation of Specific Ada Features
* GNAT Implementation of Shared Passive Packages::
* Code Generation for Array Aggregates::
* The Size of Discriminated Records with Default Discriminants::
+* Strict Conformance to the Ada 95 Reference Manual::
Project File Reference
@@ -2036,7 +2037,7 @@ description of the @code{GNAT LIBRARY} command in the OpenVMS version
of the GNAT Users Guide for details on the use of this command.
The two argument form specifies the representation to be used for
-the specified floating-poin type. On all systems other than OpenVMS,
+the specified floating-point type. On all systems other than OpenVMS,
the argument must
be @code{IEEE_Float} and the pragma has no effect. On OpenVMS, the
argument may be @code{VAX_Float} to specify the use of the VAX float
@@ -2597,8 +2598,7 @@ therefore cannot be @code{with}'ed by a restricted unit.
This is used for a unit licensed under the GNAT modified GPL that includes
a special exception paragraph that specifically permits the inclusion of
the unit in programs without requiring the entire program to be released
-under the GPL@. This is the license used for the GNAT run-time which ensures
-that the run-time can be used freely in any program without GPL concerns.
+under the GPL@.
@item Restricted
This is used for a unit that is restricted in that it is not permitted to
@@ -2927,7 +2927,7 @@ statement sequence is a call to such a procedure.
Syntax:
@smallexample @c ada
-ppragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
+pragma No_Strict_Aliasing [([Entity =>] type_LOCAL_NAME)];
@end smallexample
@noindent
@@ -2937,8 +2937,8 @@ strict aliasing optimization for the given type. The form with no
arguments is a configuration pragma which applies to all access types
declared in units to which the pragma applies. For a detailed
description of the strict aliasing optimization, and the situations
-in which it must be suppressed, see section "Optimization and Strict Aliasing"
-in the @value{EDITION} User's Guide.
+in which it must be suppressed, see section
+``Optimization and Strict Aliasing'' in the @value{EDITION} User's Guide.
@node Pragma Normalize_Scalars
@unnumberedsec Pragma Normalize_Scalars
@@ -3028,28 +3028,34 @@ pragma Obsolescent [(static_string_EXPRESSION [,Ada_05])];
@end smallexample
@noindent
-This pragma must occur immediately following a subprogram
-declaration. It indicates that the associated function or procedure
+This pragma can occur immediately following a subprogram
+declaration and indicates that the associated function or procedure
is considered obsolescent and should not be used. Typically this is
used when an API must be modified by eventually removing or modifying
existing subprograms. The pragma can be used at an intermediate stage
when the subprogram is still present, but will be removed later.
-The effect of this pragma is to output a warning message that the
+The effect of this pragma is to output a warning message on
+a call to a program thus marked that the
subprogram is obsolescent if the appropriate warning option in the
compiler is activated. If a parameter is present, then a second
warning message is given containing this text.
-
In addition, a call to such a program is considered a violation of
pragma Restrictions (No_Obsolescent_Features).
+This pragma can also be used as a program unit pragma for a package,
+in which case it indicates that the entire package is considered
+obsolescent. In this case a client @code{with}'ing such a package
+violates the restriction, and the @code{with} statement is
+flagged with warnings if the warning option is set.
+
If the optional second parameter is present (which must be exactly
the identifier Ada_05, no other argument is allowed), then the
indication of obsolescence applies only when compiling in Ada 2005
mode. This is primarily intended for dealing with the situations
-in the predefined library where subprograms have become defined
-as obsolescent in Ada 2005 (e.g. in Ada.Characters.Handling), but
-may be used anywhere.
+in the predefined library where subprograms or packages
+have become defined as obsolescent in Ada 2005
+(e.g. in Ada.Characters.Handling), but may be used anywhere.
@node Pragma Passive
@unnumberedsec Pragma Passive
@@ -4273,6 +4279,7 @@ Syntax:
@smallexample @c ada
pragma Warnings (On | Off [, local_NAME]);
+pragma Warnings (static_string_EXPRESSION);
@end smallexample
@noindent
@@ -4290,6 +4297,66 @@ the specified entity. This suppression is effective from the point where
it occurs till the end of the extended scope of the variable (similar to
the scope of @code{Suppress}).
+The form with a static_string_EXPRESSION argument provides more precise
+control over which warnings are active. The string is a list of letters
+specifying which warnings are to be activated and which deactivated. The
+code for these letters is the same as the string used in the command
+line switch controlling warnings. The following is a brief summary. For
+full details see the GNAT Users Guide:
+
+@smallexample
+a turn on all optional warnings (except d,h,l)
+A turn off all optional warnings
+b turn on warnings for bad fixed value (not multiple of small)
+B turn off warnings for bad fixed value (not multiple of small)
+c turn on warnings for constant conditional
+C turn off warnings for constant conditional
+d turn on warnings for implicit dereference
+D turn off warnings for implicit dereference
+e treat all warnings as errors
+f turn on warnings for unreferenced formal
+F turn off warnings for unreferenced formal
+g turn on warnings for unrecognized pragma
+G turn off warnings for unrecognized pragma
+h turn on warnings for hiding variable
+H turn off warnings for hiding variable
+i turn on warnings for implementation unit
+I turn off warnings for implementation unit
+j turn on warnings for obsolescent (annex J) feature
+J turn off warnings for obsolescent (annex J) feature
+k turn on warnings on constant variable
+K turn off warnings on constant variable
+l turn on warnings for missing elaboration pragma
+L turn off warnings for missing elaboration pragma
+m turn on warnings for variable assigned but not read
+M turn off warnings for variable assigned but not read
+n normal warning mode (cancels s/e)
+o turn on warnings for address clause overlay
+O turn off warnings for address clause overlay
+p turn on warnings for ineffective pragma Inline
+P turn off warnings for ineffective pragma Inline
+r turn on warnings for redundant construct
+R turn off warnings for redundant construct
+s suppress all warnings
+u turn on warnings for unused entity
+U turn off warnings for unused entity
+v turn on warnings for unassigned variable
+V turn off warnings for unassigned variable
+x turn on warnings for export/import
+X turn off warnings for export/import
+y turn on warnings for Ada 2005 incompatibility
+Y turn off warnings for Ada 2005 incompatibility
+z turn on size/align warnings for unchecked conversion
+Z turn off size/align warnings for unchecked conversion
+@end smallexample
+
+@noindent
+The specified warnings will be in effect until the end of the program
+or another pragma Warnings is encountered. The effect of the pragma is
+cumulative. Initially the set of warnings is the standard default set
+as possibly modified by compiler switches. Then each pragma Warning
+modifies this set of warnings as specified.
+
@node Pragma Weak_External
@unnumberedsec Pragma Weak_External
@findex Weak_External
@@ -7475,10 +7542,28 @@ but for which no elaboration code is generated. Generally, it is
the case that preelaborable units will meet the restrictions, with
the exception of large aggregates initialized with an others_clause,
and exception declarations (which generate calls to a run-time
-registry procedure). Note that this restriction is enforced on
+registry procedure). This restriction is enforced on
a unit by unit basis, it need not be obeyed consistently
throughout a partition.
+It is not possible to precisely document
+the constructs which are compatible with this restriction, since,
+unlike most other restrictions, this is not a restriction on the
+source code, but a restriction on the generated object code. For
+example, if the source contains a declaration:
+
+@smallexample
+ Val : constant Integer := X;
+@end smallexample
+
+@noindent
+where X is not a static constant, it may be possible, depending
+on complex optimization circuitry, for the compiler to figure
+out the value of X at compile time, in which case this initialization
+can be done by the loader, and requires no initialization code. It
+is not possible to document the precise conditions under which the
+optimizer can figure this out.
+
@item No_Entry_Queue
@findex No_Entry_Queue
This restriction is a declaration that any protected entry compiled in
@@ -8271,9 +8356,15 @@ overflow situations, when the @code{Machine_Overflows} attribute of the
result type is @code{False}. See G.2.1(13).
@end cartouche
@noindent
-Infinite and Nan values are produced as dictated by the IEEE
+Infinite and NaN values are produced as dictated by the IEEE
floating-point standard.
+Note that on machines that are not fully compliant with the IEEE
+floating-point standard, such as Alpha, the @option{-mieee} compiler flag
+must be used for achieving IEEE confirming behavior (although at the cost
+of a significant performance penalty), so infinite and NaN values are
+properly generated.
+
@sp 1
@cartouche
@noindent
@@ -10399,8 +10490,9 @@ purposes the description in the Ada 95
reference manual, or appropriate Ada
text book, will be sufficient for making use of these facilities.
-In the case of the input-output facilities, @xref{The Implementation of
-Standard I/O}, gives details on exactly how GNAT interfaces to the
+In the case of the input-output facilities,
+@xref{The Implementation of Standard I/O},
+gives details on exactly how GNAT interfaces to the
file system. For the remaining packages, the Ada 95 reference manual
should be sufficient. The following is a list of the packages included,
together with a brief description of the functionality that is provided.
@@ -10979,10 +11071,16 @@ All input/output operations use @code{fread}/@code{fwrite}.
@end itemize
@noindent
-There is no internal buffering of any kind at the Ada library level. The
-only buffering is that provided at the system level in the
-implementation of the C library routines that support streams. This
-facilitates shared use of these streams by mixed language programs.
+There is no internal buffering of any kind at the Ada library level. The only
+buffering is that provided at the system level in the implementation of the
+library routines that support streams. This facilitates shared use of these
+streams by mixed language programs. Note though that system level buffering is
+explictly enabled at elaboration of the standard I/O packages and that can have
+an impact on mixed language programs, in particular those using I/O before
+calling the Ada elaboration routine (e.g. adainit). It is recommended to call
+the Ada elaboration routine before performing any I/O or when impractical, flush
+the common I/O streams and in particular Standard_Output before elaborating the
+Ada code.
@node FORM Strings
@section FORM Strings
@@ -13480,6 +13578,7 @@ facilities.
* GNAT Implementation of Shared Passive Packages::
* Code Generation for Array Aggregates::
* The Size of Discriminated Records with Default Discriminants::
+* Strict Conformance to the Ada 95 Reference Manual::
@end menu
@node Machine Code Insertions
@@ -14113,7 +14212,33 @@ aliasing all views of the object (which may be manipulated by different tasks,
say) must be consistent, so it is imperative that the object, once created,
remain invariant.
+@node Strict Conformance to the Ada 95 Reference Manual
+@section Strict Conformance to the Ada 95 Reference Manual
+
+@noindent
+The dynamic semantics defined by the Ada 95 Reference Manual impose a set of
+run-time checks to be generated. By default, the GNAT compiler will insert many
+run-time checks into the compiled code, including most of those required by the
+Ada 95 Reference Manual. However, there are three checks that are not enabled
+in the default mode for efficiency reasons: arithmetic overflow checking for
+integer operations (including division by zero), checks for access before
+elaboration on subprogram calls, and stack overflow checking (most operating
+systems do not perform this check by default).
+
+Strict conformance to the Ada 95 Reference Manual can be achieved by adding
+three compiler options for overflow checking for integer operations
+(@option{-gnato}), dynamic checks for access-before-elaboration on subprogram
+calls and generic instantiations (@option{-gnatE}), and stack overflow
+checking (@option{-fstack-check}).
+Note that the result of a floating point arithmetic operation in overflow and
+invalid situations, when the @code{Machine_Overflows} attribute of the result
+type is @code{False}, is to generate IEEE NaN and infinite values. This is the
+case for machines compliant with the IEEE floating-point standard, but on
+machines that are not fully compliant with this standard, such as Alpha, the
+@option{-mieee} compiler flag must be used for achieving IEEE confirming
+behavior (although at the cost of a significant performance penalty), so
+infinite and and NaN values are properly generated.
@node Project File Reference
@@ -14431,7 +14556,55 @@ for building shared libraries.
Expression must be a path name. The attribute defines the
directory in which the sources of the interfaces of a Stand-alone Library will
be copied. The directory must exist, must be distinct from the project's
-object directory and source directories, and must be writable.
+object directory and source directories of all project in the project tree,
+and must be writable.
+
+@item Library_Src_Dir
+Expression must be a path name. The attribute defines the
+directory in which the ALI files of a Library will
+be copied. The directory must exist, must be distinct from the project's
+object directory and source directoriesof all project in the project tree,
+and must be writable.
+
+@item Library_Symbol_File
+Expression must be a single string. Its value is the single file name of a
+symbol file to be created when building a stand-alone library when the
+symbol policy is either "compliant", "controlled" or "restricted",
+on platforms that support symbol control, such as VMS.
+
+@item Library_Reference_Symbol_File
+Expression must be a single string. Its value is the single file name of a
+reference symbol file that is read when the symbol policy is either
+"compliant" or "controlled", on platforms that support symbol control,
+such as VMS, when building a stand-alone library.
+
+@item Library_Symbol_Policy
+Expression must be a single string. Its case-insensitive value can only be
+"autonomous", "default", "compliant", "controlled" or "restricted".
+
+This attribute is not taken into account on all platforms. It controls the
+policy for exported symbols and, on some platforms (like VMS) that have the
+notions of major and minor IDs built in the library files, it controls
+the setting of these IDs.
+
+"autonomous" or "default": exported symbols are not controlled.
+
+"compliant": if attribute Library_Reference_Symbol_File is not defined, then
+it is equivalent to policy "autonomous". If there are exported symbols in
+the reference symbol file that are not in the object files of the interfaces,
+the major ID of the library is increased. If there are symbols in the
+object files of the interfaces that are not in the reference symbol file,
+these symbols are put at the end of the list in the newly created symbol file
+and the minor ID is increased.
+
+"controlled": the attribute Library_Reference_Symbol_File must be difined.
+The library will fail to build if the exported symbols in the object files of
+the interfaces do not match exactly the symbol in the symbol file.
+
+"restricted": The attribute Library_Symbol_File must be defined. The library
+will fail to build if there are symbols in the symbol file that are not in
+the exported symbols of the object files of the interfaces. Additional symbols
+in the object files are not added to the symbol file.
@item Main
Expression must be a list of strings that are legal file names.
@@ -14443,6 +14616,12 @@ command, one or several executables are built and placed in the Exec_Dir.
If the gnatmake command does not include explicit file names, the executables
that are built correspond to the files specified by this attribute.
+@item Externally_Built
+Expression must be a single string. Its value must be either "true" of "false",
+case-insensitive. The default is "false". When the value of this attribute is
+"true", no attempt is made to compile the sources or to build the library,
+when the project is a library project.
+
@item Main_Language
This is a simple attribute. Its value is a string that specifies the
language of the main program.
@@ -14700,27 +14879,20 @@ This is an associative array attribute. Its
domain is a set of language names. Its range is a string list that
specifies the compilation options to be used when compiling a component
written in that language, for which no file-specific switches have been
-specified..
+specified.
@item Switches
This is an associative array attribute. Its domain is
a set of file names. Its range is a string list that specifies the
compilation options to be used when compiling the named file. If a file
is not specified in the Switches attribute, it is compiled with the
-settings specified by Default_Switches.
+options specified by Default_Switches of its language, if defined.
@item Local_Configuration_Pragmas.
This is a simple attribute, whose
value is a path name that designates a file containing configuration pragmas
to be used for all invocations of the compiler for immediate sources of the
project.
-
-@item Executable
-This is an associative array attribute. Its domain is
-a set of main source file names. Its range is a simple string that specifies
-the executable file name to be used when linking the specified main source.
-If a main source is not specified in the Executable attribute, the executable
-file name is deducted from the main source file name.
@end table
@subsection package Builder
@@ -14732,10 +14904,18 @@ following attributes apply to package @code{Builder}:
@table @code
@item Default_Switches
-As above.
+This is an associative array attribute. Its
+domain is a set of language names. Its range is a string list that
+specifies options to be used when building a main
+written in that language, for which no file-specific switches have been
+specified.
@item Switches
-As above.
+This is an associative array attribute. Its domain is
+a set of file names. Its range is a string list that specifies
+options to be used when building the named main file. If a main file
+is not specified in the Switches attribute, it is built with the
+options specified by Default_Switches of its language, if defined.
@item Global_Configuration_Pragmas
This is a simple attribute, whose
@@ -14743,14 +14923,17 @@ value is a path name that designates a file that contains configuration pragmas
to be used in every build of an executable. If both local and global
configuration pragmas are specified, a compilation makes use of both sets.
+
@item Executable
-This is an associative array attribute, defined over
-compilation unit names. The image is a string that is the name of the
-executable file corresponding to the main source file index.
+This is an associative array attribute. Its domain is
+a set of main source file names. Its range is a simple string that specifies
+the executable file name to be used when linking the specified main source.
+If a main source is not specified in the Executable attribute, the executable
+file name is deducted from the main source file name.
This attribute has no effect if its value is the empty string.
@item Executable_Suffix
-This is a simple attribute whose value is a suffix to be added to
+This is a simple attribute whose value is the suffix to be added to
the executables that don't have an attribute Executable specified.
@end table
@@ -14763,7 +14946,8 @@ The following attributes apply to package @code{Gnatls}:
@table @code
@item Switches
-As above.
+This is a single attribute with a string list value. Each non empty string
+in the list is an option when invoking @code{gnatls}.
@end table
@subsection package Binder
@@ -14775,9 +14959,18 @@ The following attributes apply to package @code{Binder}:
@table @code
@item Default_Switches
-As above.
-@item Switches
-As above.
+This is an associative array attribute. Its
+domain is a set of language names. Its range is a string list that
+specifies options to be used when binding a main
+written in that language, for which no file-specific switches have been
+specified.
+
+@item Switches
+This is an associative array attribute. Its domain is
+a set of file names. Its range is a string list that specifies
+options to be used when binding the named main file. If a main file
+is not specified in the Switches attribute, it is boundt with the
+options specified by Default_Switches of its language, if defined.
@end table
@subsection package Linker
@@ -14789,9 +14982,24 @@ The following attributes apply to package @code{Linker}:
@table @code
@item Default_Switches
-As above
-@item Switches
-As above.
+This is an associative array attribute. Its
+domain is a set of language names. Its range is a string list that
+specifies options to be used when linking a main
+written in that language, for which no file-specific switches have been
+specified.
+
+@item Switches
+This is an associative array attribute. Its domain is
+a set of file names. Its range is a string list that specifies
+options to be used when linking the named main file. If a main file
+is not specified in the Switches attribute, it is linked with the
+options specified by Default_Switches of its language, if defined.
+
+@item Linker_Options
+This is a string list attribute. Its value specifies additional options that
+be givent to the linker when linking an executable. This attribute is not
+used in the main project, only in projects imported directly or indirectly.
+
@end table
@subsection package Cross_Reference
@@ -14804,9 +15012,19 @@ The following attributes apply to package @code{Cross_Reference}:
@table @code
@item Default_Switches
-As above.
-@item Switches
-As above.
+This is an associative array attribute. Its
+domain is a set of language names. Its range is a string list that
+specifies options to be used when calling @command{gnatxref} on a source
+written in that language, for which no file-specific switches have been
+specified.
+
+@item Switches
+This is an associative array attribute. Its domain is
+a set of file names. Its range is a string list that specifies
+options to be used when calling @command{gnatxref} on the named main source.
+If a source is not specified in the Switches attribute, @command{gnatxref} will
+be called with the options specified by Default_Switches of its language,
+if defined.
@end table
@subsection package Finder
@@ -14818,9 +15036,19 @@ The following attributes apply to package @code{Finder}:
@table @code
@item Default_Switches
-As above.
-@item Switches
-As above.
+This is an associative array attribute. Its
+domain is a set of language names. Its range is a string list that
+specifies options to be used when calling @command{gnatfind} on a source
+written in that language, for which no file-specific switches have been
+specified.
+
+@item Switches
+This is an associative array attribute. Its domain is
+a set of file names. Its range is a string list that specifies
+options to be used when calling @command{gnatfind} on the named main source.
+If a source is not specified in the Switches attribute, @command{gnatfind} will
+be called with the options specified by Default_Switches of its language,
+if defined.
@end table
@subsection package Pretty_Printer
@@ -14833,9 +15061,94 @@ The following attributes apply to package @code{Pretty_Printer}:
@table @code
@item Default_switches
-As above.
-@item Switches
-As above.
+This is an associative array attribute. Its
+domain is a set of language names. Its range is a string list that
+specifies options to be used when calling @command{gnatpp} on a source
+written in that language, for which no file-specific switches have been
+specified.
+
+@item Switches
+This is an associative array attribute. Its domain is
+a set of file names. Its range is a string list that specifies
+options to be used when calling @command{gnatpp} on the named main source.
+If a source is not specified in the Switches attribute, @command{gnatpp} will
+be called with the options specified by Default_Switches of its language,
+if defined.
+@end table
+
+@subsection package gnatstub
+
+@noindent
+The attributes of package @code{gnatstub}
+specify the tool options to be used
+when invoking the tool @command{gnatstub}.
+The following attributes apply to package @code{gnatstub}:
+
+@table @code
+@item Default_switches
+This is an associative array attribute. Its
+domain is a set of language names. Its range is a string list that
+specifies options to be used when calling @command{gnatstub} on a source
+written in that language, for which no file-specific switches have been
+specified.
+
+@item Switches
+This is an associative array attribute. Its domain is
+a set of file names. Its range is a string list that specifies
+options to be used when calling @command{gnatstub} on the named main source.
+If a source is not specified in the Switches attribute, @command{gnatpp} will
+be called with the options specified by Default_Switches of its language,
+if defined.
+@end table
+
+@subsection package Eliminate
+
+@noindent
+The attributes of package @code{Eliminate}
+specify the tool options to be used
+when invoking the tool @command{gnatelim}.
+The following attributes apply to package @code{Eliminate}:
+
+@table @code
+@item Default_switches
+This is an associative array attribute. Its
+domain is a set of language names. Its range is a string list that
+specifies options to be used when calling @command{gnatelim} on a source
+written in that language, for which no file-specific switches have been
+specified.
+
+@item Switches
+This is an associative array attribute. Its domain is
+a set of file names. Its range is a string list that specifies
+options to be used when calling @command{gnatelim} on the named main source.
+If a source is not specified in the Switches attribute, @command{gnatelim} will
+be called with the options specified by Default_Switches of its language,
+if defined.
+@end table
+
+@subsection package Metrics
+
+@noindent
+The attributes of package @code{Metrics}
+specify the tool options to be used
+when invoking the tool @command{gnatmetric}.
+The following attributes apply to package @code{Metrics}:
+
+@table @code
+@item Default_switches
+This is an associative array attribute. Its
+domain is a set of language names. Its range is a string list that
+specifies options to be used when calling @command{gnatmetric} on a source
+written in that language, for which no file-specific switches have been
+specified.
+
+@item Switches
+This is an associative array attribute. Its domain is
+a set of file names. Its range is a string list that specifies
+options to be used when calling @command{gnatmetric} on the named main source.
+If a source is not specified in the Switches attribute, @command{gnatmetric}
+will be called with the options specified by Default_Switches of its language,
+if defined.
@end table
@subsection package IDE
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 4361b013af3..4f4e5852b30 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -7,7 +7,7 @@
@c o
@c G N A T _ U G N o
@c o
-@c Copyright (C) 1992-2005 Ada Core Technologies, Inc. o
+@c Copyright (C) 1992-2005, AdaCore o
@c o
@c GNAT is free software; you can redistribute it and/or modify it under o
@c terms of the GNU General Public License as published by the Free Soft- o
@@ -195,7 +195,7 @@ AdaCore@*
* Other Utility Programs::
* Running and Debugging Ada Programs::
@ifset vms
-* Compatibility with DEC Ada::
+* Compatibility with HP Ada::
@end ifset
* Platform-Specific Information for the Run-Time Libraries::
* Example of Binder Output File::
@@ -508,7 +508,7 @@ Running and Debugging Ada Programs
@end ifset
@ifset vms
-Compatibility with DEC Ada
+Compatibility with HP Ada
* Ada 95 Compatibility::
* Differences in the Definition of Package System::
@@ -516,7 +516,7 @@ Compatibility with DEC Ada
* The Package STANDARD::
* The Package SYSTEM::
* Tasking and Task-Related Features::
-* Implementation of Tasks in DEC Ada for OpenVMS Alpha Systems::
+* Implementation of Tasks in HP Ada for OpenVMS Alpha Systems::
* Pragmas and Pragma-Related Features::
* Library of Predefined Units::
* Bindings::
@@ -526,7 +526,6 @@ Compatibility with DEC Ada
* Program Compilation and Library Management::
* Input-Output::
* Implementation Limits::
-* Tools::
Language-Related Features
@@ -538,7 +537,7 @@ Language-Related Features
* Address Clauses::
* Other Representation Clauses::
-Implementation of Tasks in DEC Ada for OpenVMS Alpha Systems
+Implementation of Tasks in HP Ada for OpenVMS Alpha Systems
* Assigning Task IDs::
* Task IDs and Delays::
@@ -604,7 +603,7 @@ Compatibility and Porting Guide
* Compatibility with Ada 83::
* Implementation-dependent characteristics::
-* Compatibility with DEC Ada 83::
+* Compatibility with HP Ada 83::
* Compatibility with Other Ada 95 Systems::
* Representation Clauses::
@ifset vms
@@ -798,10 +797,12 @@ Ada programs.
@ifset vms
@item
-@ref{Compatibility with DEC Ada}, details the compatibility of GNAT with
-DEC Ada 83 @footnote{``DEC Ada'' refers to the legacy product originally
+@ref{Compatibility with HP Ada}, details the compatibility of GNAT with
+HP Ada 83 @footnote{``HP Ada'' refers to the legacy product originally
developed by Digital Equipment Corporation and currently supported by HP.}
-for OpenVMS Alpha.
+for OpenVMS Alpha. This product was formerly known as DEC Ada, and for
+historical compatibility reasons, the relevant libraries still use the
+DEC prefix.
@end ifset
@item
@@ -2915,7 +2916,7 @@ involving variant records, access parameters, tasks, or protected types,
are unlikely to be able to be passed.
Note that in the case of GNAT running
-on a platform that supports DEC Ada 83, a higher degree of compatibility
+on a platform that supports HP Ada 83, a higher degree of compatibility
can be guaranteed, and in particular records are layed out in an identical
manner in the two compilers. Note also that if output from two different
compilers is mixed, the program is responsible for dealing with elaboration
@@ -2926,8 +2927,8 @@ elaboration of the GNAT components. Consult the documentation of the other
Ada compiler for further details on elaboration.
However, it is not possible to mix the tasking run time of GNAT and
-DEC Ada 83, All the tasking operations must either be entirely within
-GNAT compiled sections of the program, or entirely within DEC Ada 83
+HP Ada 83, All the tasking operations must either be entirely within
+GNAT compiled sections of the program, or entirely within HP Ada 83
compiled sections of the program.
@cindex Interfacing to Assembly
@@ -3048,21 +3049,21 @@ implemented as a single machine instruction.
@findex Stdcall
@cindex Convention Stdcall
@item Stdcall
-This is relevant only to NT/Win95 implementations of GNAT,
-and specifies that the Stdcall calling sequence will be used, as defined
-by the NT API. Nevertheless, to ease building cross-platform bindings this
-convention will be handled as a C calling convention on non Windows
-platforms.
+This is relevant only to Windows XP/2000/NT/95 implementations of GNAT,
+and specifies that the @code{Stdcall} calling sequence will be used,
+as defined by the NT API. Nevertheless, to ease building
+cross-platform bindings this convention will be handled as a @code{C} calling
+convention on non Windows platforms.
@findex DLL
@cindex Convention DLL
@item DLL
-This is equivalent to Stdcall.
+This is equivalent to @code{Stdcall}.
@findex Win32
@cindex Convention Win32
@item Win32
-This is equivalent to Stdcall.
+This is equivalent to @code{Stdcall}.
@end ifset
@findex Stubbed
@@ -3872,7 +3873,7 @@ Output full source listing with embedded error messages.
Limit number of detected error or warning messages to @var{n}
where @var{n} is in the range 1..999_999. The default setting if
no switch is given is 9999. Compilation is terminated if this
-limit is exceeded.
+limit is exceeded. The equal sign here is optional.
@item -gnatn
@cindex @option{-gnatn} (@command{gcc})
@@ -4130,6 +4131,13 @@ Execute @var{ver} version of the compiler. This is the @command{gcc}
version, not the GNAT version.
@end ifclear
+@item ^-w^NO_BACK_END_WARNINGS^
+@cindex @option{-w} (@command{gcc})
+Turn off warnings generated by the back end of the compiler. Use of
+this switch also causes the default for front end warnings to be set
+to suppress (as though @option{-gnatws} had appeared at the start of
+the options.
+
@end table
@ifclear vms
@@ -4295,7 +4303,7 @@ file) as well as the verbose
format message or full listing (which as usual is written to
@file{stdout} (the standard output file).
-@item -gnatm^^=^@var{n}
+@item -gnatm=@var{n}
@cindex @option{-gnatm} (@command{gcc})
@ifclear vms
The @code{m} stands for maximum.
@@ -4311,6 +4319,10 @@ fatal error: maximum errors reached
compilation abandoned
@end smallexample
+@noindent
+Note that the equal sign is optional, so the switches
+@option{-gnatm2} and @option{-gnatm=2} are equivalent.
+
@item -gnatf
@cindex @option{-gnatf} (@command{gcc})
@cindex Error messages, suppressing
@@ -4615,6 +4627,13 @@ not get issued for the use of boolean variables or constants whose
values are known at compile time, since this is a standard technique
for conditional compilation in Ada, and this would generate too many
``false positive'' warnings.
+
+This warning option also activates a special test for comparisons using
+the operators >= and <=. If the compiler can tell that only the equality
+condition is posible, then it will warn that the > or < part of the test
+is useless and that the operator could be replaced by =. An example would
+be comparing a Natural variable <= 0.
+
This warning can also be turned on using @option{-gnatwa}.
@item -gnatwC
@@ -4767,9 +4786,9 @@ This switch disables warnings on variables that could be declared constants.
@cindex @option{-gnatwl} (@command{gcc})
@cindex Elaboration, warnings
This switch activates warnings on missing
-@code{pragma Elaborate_All} statements.
+@code{Elaborate_All} and @code{Elaborate} pragmas.
See the section in this guide on elaboration checking for details on
-when such pragma should be used. Warnings are also generated if you
+when such pragmas should be used. Warnings are also generated if you
are using the static mode of elaboration, and a @code{pragma Elaborate}
is encountered. The default is that such warnings
are not generated.
@@ -4778,9 +4797,9 @@ This warning is not automatically turned on by the use of @option{-gnatwa}.
@item -gnatwL
@emph{Suppress warnings for missing elaboration pragmas.}
@cindex @option{-gnatwL} (@command{gcc})
-This switch suppresses warnings on missing pragma Elaborate_All statements.
+This switch suppresses warnings on missing Elaborate and Elaborate_All pragmas.
See the section in this guide on elaboration checking for details on
-when such pragma should be used.
+when such pragmas should be used.
@item -gnatwm
@emph{Activate warnings on modified but unreferenced variables.}
@@ -4994,9 +5013,11 @@ warnings about uninitialized variables.
@item ^-w^/NO_BACK_END_WARNINGS^
@cindex @option{-w}
-This switch suppresses warnings from the @option{^gcc^GCC^} back end. It may
-be used in conjunction with @option{-gnatws} to ensure that all warnings
-are suppressed during the entire compilation process.
+This switch suppresses warnings from the @option{^gcc^GCC^} back end. The
+code generator detects a number of warning situations that are missed
+by the @option{GNAT} front end, and this switch can be used to suppress them.
+The use of this switch also sets the default front end warning mode to
+@option{-gnatws}, that is, front end warnings suppressed as well.
@end table
@@ -5686,15 +5707,17 @@ clears any previously set style checks.
@cindex Access before elaboration
@cindex Checks, division by zero
@cindex Checks, access before elaboration
+@cindex Checks, stack overflow checking
@noindent
If you compile with the default options, GNAT will insert many run-time
checks into the compiled code, including code that performs range
checking against constraints, but not arithmetic overflow checking for
-integer operations (including division by zero) or checks for access
-before elaboration on subprogram calls. All other run-time checks, as
-required by the Ada 95 Reference Manual, are generated by default.
-The following @command{gcc} switches refine this default behavior:
+integer operations (including division by zero), checks for access
+before elaboration on subprogram calls, or stack overflow checking. All
+other run-time checks, as required by the Ada 95 Reference Manual, are
+generated by default. The following @command{gcc} switches refine this
+default behavior:
@table @option
@c !sort!
@@ -5802,6 +5825,13 @@ Enables dynamic checks for access-before-elaboration
on subprogram calls and generic instantiations.
For full details of the effect and use of this switch,
@xref{Compiling Using gcc}.
+
+@item -fstack-check
+@cindex @option{-fstack-check} (@command{gcc})
+@cindex Stack Overflow Checking
+@cindex Checks, stack overflow checking
+Activates stack overflow checking. For full details of the effect and use of
+this switch see @ref{Stack Overflow Checking}.
@end table
@findex Unsuppress
@@ -6406,6 +6436,9 @@ If _FILE is added at the end of an option
then the output is to a file with the name @file{file_REP} where
file is the name of the corresponding source file.
@end ifset
+Note that it is possible for record components to have zero size. In
+this case, the component clause uses an obvious extension of permitted
+Ada syntax, for example @code{at 0 range 0 .. -1}.
@item -gnatS
@cindex @option{-gnatS} (@command{gcc})
@@ -6783,7 +6816,7 @@ Normally, define this value as a logical name containing a comma separated
list of directory names.
This variable can also be defined by means of an environment string
-(an argument to the DEC C exec* set of functions).
+(an argument to the HP C exec* set of functions).
Logical Name:
@smallexample
@@ -6794,7 +6827,7 @@ DEFINE ADA_INCLUDE_PATH ANOTHER_PATH,FOO:[BAM],FOO:[BAR]
By default, the path includes GNU:[LIB.OPENVMS7_x.2_8_x.DECLIB]
first, followed by the standard Ada 95
libraries in GNU:[LIB.OPENVMS7_x.2_8_x.ADAINCLUDE].
-If this is not redefined, the user will obtain the DEC Ada 83 IO packages
+If this is not redefined, the user will obtain the HP Ada 83 IO packages
(Text_IO, Sequential_IO, etc)
instead of the Ada95 packages. Thus, in order to get the Ada 95
packages by default, ADA_INCLUDE_PATH must be redefined.
@@ -7448,7 +7481,7 @@ Normally it only makes sense to use the @option{^-p^/PESSIMISTIC_ELABORATION^}
switch if dynamic
elaboration checking is used (@option{-gnatE} switch used for compilation).
This is because in the default static elaboration mode, all necessary
-@code{Elaborate_All} pragmas are implicitly inserted.
+@code{Elaborate} and @code{Elaborate_All} pragmas are implicitly inserted.
These implicit pragmas are still respected by the binder in
@option{^-p^/PESSIMISTIC_ELABORATION^} mode, so a
safe elaboration order is assured.
@@ -7699,7 +7732,7 @@ Normally, define this value as a logical name containing a comma separated
list of directory names.
This variable can also be defined by means of an environment string
-(an argument to the DEC C exec* set of functions).
+(an argument to the HP C exec* set of functions).
Logical Name:
@smallexample
@@ -7710,7 +7743,7 @@ DEFINE ADA_OBJECTS_PATH ANOTHER_PATH,FOO:[BAM],FOO:[BAR]
By default, the path includes GNU:[LIB.OPENVMS7_x.2_8_x.DECLIB]
first, followed by the standard Ada 95
libraries in GNU:[LIB.OPENVMS7_x.2_8_x.ADALIB].
-If this is not redefined, the user will obtain the DEC Ada 83 IO packages
+If this is not redefined, the user will obtain the HP Ada 83 IO packages
(Text_IO, Sequential_IO, etc)
instead of the Ada95 packages. Thus, in order to get the Ada 95
packages by default, ADA_OBJECTS_PATH must be redefined.
@@ -8004,14 +8037,16 @@ when multiple versions of the GNAT compiler are available. See the
@cindex @option{--GCC=compiler_name} (@command{gnatlink})
Program used for compiling the binder file. The default is
@command{gcc}. You need to use quotes around @var{compiler_name} if
-@code{compiler_name} contains spaces or other separator characters. As
-an example @option{--GCC="foo -x -y"} will instruct @command{gnatlink} to use
-@code{foo -x -y} as your compiler. Note that switch @option{-c} is always
+@code{compiler_name} contains spaces or other separator characters.
+As an example @option{--GCC="foo -x -y"} will instruct @command{gnatlink} to
+use @code{foo -x -y} as your compiler. Note that switch @option{-c} is always
inserted after your command name. Thus in the above example the compiler
command that will be used by @command{gnatlink} will be @code{foo -c -x -y}.
-If several @option{--GCC=compiler_name} are used, only the last
-@var{compiler_name} is taken into account. However, all the additional
-switches are also taken into account. Thus,
+A limitation of this syntax is that the name and path name of the executable
+itself must not include any embedded spaces. If several
+@option{--GCC=compiler_name} are used, only the last @var{compiler_name}
+is taken into account. However, all the additional switches are also taken
+into account. Thus,
@option{--GCC="foo -x -y" --GCC="bar -z -t"} is equivalent to
@option{--GCC="bar -x -y -z -t"}.
@@ -8047,8 +8082,8 @@ Generate the executable file even if there are linker warnings.
@item /NOSTART_FILES
Don't link in the object file containing the ``main'' transfer address.
-Used when linking with a foreign language main program compiled with a
-Digital compiler.
+Used when linking with a foreign language main program compiled with an
+HP compiler.
@item /STATIC
Prefer linking with object libraries over sharable images, even without
@@ -8221,12 +8256,13 @@ Program used for compiling. The default is `@command{gcc}'. You need to use
quotes around @var{compiler_name} if @code{compiler_name} contains
spaces or other separator characters. As an example @option{--GCC="foo -x
-y"} will instruct @command{gnatmake} to use @code{foo -x -y} as your
-compiler. Note that switch @option{-c} is always inserted after your
-command name. Thus in the above example the compiler command that will
-be used by @command{gnatmake} will be @code{foo -c -x -y}.
-If several @option{--GCC=compiler_name} are used, only the last
-@var{compiler_name} is taken into account. However, all the additional
-switches are also taken into account. Thus,
+compiler. A limitation of this syntax is that the name and path name of
+the executable itself must not include any embedded spaces. Note that
+switch @option{-c} is always inserted after your command name. Thus in the
+above example the compiler command that will be used by @command{gnatmake}
+will be @code{foo -c -x -y}. If several @option{--GCC=compiler_name} are
+used, only the last @var{compiler_name} is taken into account. However,
+all the additional switches are also taken into account. Thus,
@option{--GCC="foo -x -y" --GCC="bar -z -t"} is equivalent to
@option{--GCC="bar -x -y -z -t"}.
@@ -8236,8 +8272,10 @@ Program used for binding. The default is `@code{gnatbind}'. You need to
use quotes around @var{binder_name} if @var{binder_name} contains spaces
or other separator characters. As an example @option{--GNATBIND="bar -x
-y"} will instruct @command{gnatmake} to use @code{bar -x -y} as your
-binder. Binder switches that are normally appended by @command{gnatmake} to
-`@code{gnatbind}' are now appended to the end of @code{bar -x -y}.
+binder. Binder switches that are normally appended by @command{gnatmake}
+to `@code{gnatbind}' are now appended to the end of @code{bar -x -y}.
+A limitation of this syntax is that the name and path name of the executable
+itself must not include any embedded spaces.
@item --GNATLINK=@var{linker_name}
@cindex @option{--GNATLINK=linker_name} (@command{gnatmake})
@@ -8247,6 +8285,8 @@ or other separator characters. As an example @option{--GNATLINK="lan -x
-y"} will instruct @command{gnatmake} to use @code{lan -x -y} as your
linker. Linker switches that are normally appended by @command{gnatmake} to
`@command{gnatlink}' are now appended to the end of @code{lan -x -y}.
+A limitation of this syntax is that the name and path name of the executable
+itself must not include any embedded spaces.
@end ifclear
@@ -8497,7 +8537,19 @@ if not up to date, and libraries are rebuilt, if necessary.
@item ^-v^/REASONS^
@cindex @option{^-v^/REASONS^} (@command{gnatmake})
Verbose. Display the reason for all recompilations @command{gnatmake}
-decides are necessary.
+decides are necessary, with the highest verbosity level.
+
+@item ^-vl^/LOW_VERBOSITY^
+@cindex @option{^-vl^/LOW_VERBOSITY^} (@command{gnatmake})
+Verbosity level Low. Display fewer lines than in verbosity Medium.
+
+@item ^-vm^/MEDIUM_VERBOSITY^
+@cindex @option{^-vm^/MEDIUM_VERBOSITY^} (@command{gnatmake})
+Verbosity level Medium. Potentially display fewer lines than in verbosity High.
+
+@item ^-vh^/HIGH_VERBOSITY^
+@cindex @option{^-vm^/HIGH_VERBOSITY^} (@command{gnatmake})
+Verbosity level High. Equivalent to ^-v^/REASONS^.
@item ^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}
Indicate the verbosity of the parsing of GNAT project files.
@@ -9315,7 +9367,7 @@ to work. Examples of switches in this category are
@option{-funroll-loops} and
the various target-specific @option{-m} options (in particular, it has been
observed that @option{-march=pentium4} can significantly improve performance
-on appropriate machines. For full details of these switches, see the
+on appropriate machines). For full details of these switches, see the
@code{gcc} manual.
@node Optimization and Strict Aliasing
@@ -9538,7 +9590,7 @@ unchecked conversion of access values.
@subsection Coverage Analysis
@noindent
-GNAT supports the Digital Performance Coverage Analyzer (PCA), which allows
+GNAT supports the HP Performance Coverage Analyzer (PCA), which allows
the user to determine the distribution of execution time across a program,
@pxref{Profiling} for details of usage.
@end ifset
@@ -10221,7 +10273,7 @@ pragma Extend_System (Aux_DEC);
@noindent
In the presence of this pragma, GNAT adds to the definition of the
predefined package SYSTEM all the additional types and subprograms that are
-defined in DEC Ada. See @ref{Compatibility with DEC Ada} for details.
+defined in HP Ada. See @ref{Compatibility with HP Ada} for details.
@end ifset
@node Handling Arbitrary File Naming Conventions Using gnatname
@@ -11608,12 +11660,10 @@ The following attributes are defined on projects (all are simple attributes):
@tab string
@item @code{Locally_Removed_Files}
@tab string list
-@item @code{Main}
-@tab string list
@item @code{Languages}
@tab string list
-@item @code{Main_Language}
-@tab string
+@item @code{Main}
+@tab string list
@item @code{Library_Dir}
@tab string
@item @code{Library_Name}
@@ -11628,8 +11678,20 @@ The following attributes are defined on projects (all are simple attributes):
@tab string
@item @code{Library_Options}
@tab string list
+@item @code{Library_Src_Dir}
+@tab string
+@item @code{Library_ALI_Dir}
+@tab string
@item @code{Library_GCC}
@tab string
+@item @code{Library_Symbol_File}
+@tab string
+@item @code{Library_Symbol_Policy}
+@tab string
+@item @code{Library_Reference_Symbol_File}
+@tab string
+@item @code{Externally_Built}
+@tab string
@end multitable
@noindent
@@ -12531,7 +12593,7 @@ package models the Apex file naming rules:
@end ifclear
@ifset vms
-For example, the following package models the DEC Ada file naming rules:
+For example, the following package models the HP Ada file naming rules:
@smallexample @c projectfile
@group
@@ -12651,7 +12713,7 @@ sensitive or insensitive depending on the operating system).
To create a library project, you need to define in its project file
two project-level attributes: @code{Library_Name} and @code{Library_Dir}.
-Additionally, you may define the library-related attributes
+Additionally, you may define other library-related attributes such as
@code{Library_Kind}, @code{Library_Version}, @code{Library_Interface},
@code{Library_Auto_Init}, @code{Library_Options} and @code{Library_GCC}.
@@ -12663,10 +12725,9 @@ to be acceptable on all platforms.
The @code{Library_Dir} attribute has a string value that designates the path
(absolute or relative) of the directory where the library will reside.
-It must designate an existing directory, and this directory must be
-different from the project's object directory. It also needs to be writable.
-The directory should only be used for one library; the reason is that all
-files contained in this directory may be deleted by the Project Manager.
+It must designate an existing directory, and this directory must be writable,
+different from the project's object directory and from any source directory
+in the project tree.
If both @code{Library_Name} and @code{Library_Dir} are specified and
are legal, then the project file defines a library project. The optional
@@ -12686,6 +12747,13 @@ be generated for the latter. For such cases, it is recommended to either use
two different project files, or a single one which uses external variables
to indicate what kind of library should be build.
+The @code{Library_ALI_Dir} attribute may be specified to indicate the
+directory where the ALI files of the libriry will be copied. When it is
+not specified, the ALI files are copied ti the directory specified in
+attribute @code{Library_Dir}. The directory specified by @code{Library_ALI_Dir}
+must be writable and different from the project's object directory and from
+any source directory in the project tree.
+
The @code{Library_Version} attribute has a string value whose interpretation
is platform dependent. It has no effect on VMS and Windows. On Unix, it is
used only for dynamic/relocatable libraries as the internal name of the
@@ -15086,7 +15154,7 @@ Options @option{^-pipe^/STANDARD_OUTPUT^},
contains only one file to reformat.
Option
@option{^--eol^/END_OF_LINE^}
-can not be used together
+cannot be used together
with @option{^-pipe^/STANDARD_OUTPUT^} option.
@node Other gnatpp Switches
@@ -15113,7 +15181,7 @@ a trace of the actions it takes to produce or obtain the ASIS tree.
@item ^-w^/WARNINGS^
@cindex @option{^-w^/WARNINGS^} (@code{gnatpp})
Warning mode;
-@command{gnatpp} generates a warning whenever it can not provide
+@command{gnatpp} generates a warning whenever it cannot provide
a required layout in the result source.
@end table
@@ -16402,6 +16470,16 @@ by preprocessing to be retained in the output source as comments marked
with the special string @code{"--! "}. This option will result in line numbers
being preserved in the output file.
+@item ^-C^/REPLACE_IN_COMMENTS^
+@cindex @option{^-C^/REPLACE_IN_COMMENTS^} (@command{gnatprep})
+Causes comments to be scanned. Normally comments are ignored by gnatprep.
+If this option is specified, then comments are scanned and any $symbol
+substitutions performed as in program text. This is particularly useful
+when structured comments are used (e.g. when writing programs in the
+SPARK dialect of Ada). Note that this switch is not available when
+doing integrated preprocessing (it would be useless in this context
+since comments are ignored by the compiler in any case).
+
@item ^-Dsymbol=value^/ASSOCIATE="symbol=value"^
@cindex @option{^-D^/ASSOCIATE^} (@command{gnatprep})
Defines a new symbol, associated with value. If no value is given on the
@@ -19080,7 +19158,7 @@ $ perl gnathtml.pl [switches] files
@findex LSE
@noindent
-The GNAT distribution provides an Ada 95 template for the Digital Language
+The GNAT distribution provides an Ada 95 template for the HP Language
Sensitive Editor (LSE), a component of DECset. In order to
access it, invoke LSE with the qualifier /ENVIRONMENT=GNU:[LIB]ADA95.ENV.
@@ -19089,7 +19167,7 @@ access it, invoke LSE with the qualifier /ENVIRONMENT=GNU:[LIB]ADA95.ENV.
@findex PCA
@noindent
-GNAT supports The Digital Performance Coverage Analyzer (PCA), a component
+GNAT supports The HP Performance Coverage Analyzer (PCA), a component
of DECset. To use it proceed as outlined under ``HELP PCA'', except for running
the collection phase with the /DEBUG qualifier.
@@ -20164,23 +20242,23 @@ end STB;
@end smallexample
@ifset vms
-@node Compatibility with DEC Ada
-@chapter Compatibility with DEC Ada
+@node Compatibility with HP Ada
+@chapter Compatibility with HP Ada
@cindex Compatibility
@noindent
-This section of the manual compares DEC Ada for OpenVMS Alpha and GNAT
+This section of the manual compares HP Ada for OpenVMS Alpha and GNAT
OpenVMS Alpha. GNAT achieves a high level of compatibility
-with DEC Ada, and it should generally be straightforward to port code
-from the DEC Ada environment to GNAT. However, there are a few language
+with HP Ada, and it should generally be straightforward to port code
+from the HP Ada environment to GNAT. However, there are a few language
and implementation differences of which the user must be aware. These
differences are discussed in this section. In
addition, the operating environment and command structure for the
compiler are different, and these differences are also discussed.
Note that this discussion addresses specifically the implementation
-of Ada 83 for DIGITAL OpenVMS Alpha Systems. In cases where the implementation
-of DEC Ada differs between OpenVMS Alpha Systems and OpenVMS VAX Systems,
+of Ada 83 for HP OpenVMS Alpha Systems. In cases where the implementation
+of HP Ada differs between OpenVMS Alpha Systems and OpenVMS VAX Systems,
GNAT always follows the Alpha implementation.
@menu
@@ -20190,7 +20268,7 @@ GNAT always follows the Alpha implementation.
* The Package STANDARD::
* The Package SYSTEM::
* Tasking and Task-Related Features::
-* Implementation of Tasks in DEC Ada for OpenVMS Alpha Systems::
+* Implementation of Tasks in HP Ada for OpenVMS Alpha Systems::
* Pragmas and Pragma-Related Features::
* Library of Predefined Units::
* Bindings::
@@ -20200,14 +20278,13 @@ GNAT always follows the Alpha implementation.
* Program Compilation and Library Management::
* Input-Output::
* Implementation Limits::
-* Tools::
@end menu
@node Ada 95 Compatibility
@section Ada 95 Compatibility
@noindent
-GNAT is an Ada 95 compiler, and DEC Ada is an Ada 83
+GNAT is an Ada 95 compiler, and HP Ada is an Ada 83
compiler. Ada 95 is almost completely upwards compatible
with Ada 83, and therefore Ada 83 programs will compile
and run under GNAT with
@@ -20235,8 +20312,8 @@ implementation-dependent declarations to package System. In normal mode,
GNAT does not take advantage of this permission, and the version of System
provided by GNAT exactly matches that in the Ada 95 Reference Manual.
-However, DEC Ada adds an extensive set of declarations to package System,
-as fully documented in the DEC Ada manuals. To minimize changes required
+However, HP Ada adds an extensive set of declarations to package System,
+as fully documented in the HP Ada manuals. To minimize changes required
for programs that make use of these extensions, GNAT provides the pragma
Extend_System for extending the definition of package System. By using:
@@ -20306,12 +20383,12 @@ related topics.
@subsection Integer Types and Representations
@noindent
-The set of predefined integer types is identical in DEC Ada and GNAT.
+The set of predefined integer types is identical in HP Ada and GNAT.
Furthermore the representation of these integer types is also identical,
including the capability of size clauses forcing biased representation.
In addition,
-DEC Ada for OpenVMS Alpha systems has defined the
+HP Ada for OpenVMS Alpha systems has defined the
following additional integer types in package System:
@itemize @bullet
@@ -20338,21 +20415,21 @@ standard Ada 95 package @code{Interfaces}.
Alternatively, by use of the pragma
@code{Extend_System}, identical
declarations can be referenced directly in package @code{System}.
-On both GNAT and DEC Ada, the maximum integer size is 64 bits.
+On both GNAT and HP Ada, the maximum integer size is 64 bits.
@node Floating-Point Types and Representations
@subsection Floating-Point Types and Representations
@cindex Floating-Point types
@noindent
-The set of predefined floating-point types is identical in DEC Ada and GNAT.
+The set of predefined floating-point types is identical in HP Ada and GNAT.
Furthermore the representation of these floating-point
types is also identical. One important difference is that the default
-representation for DEC Ada is VAX_Float, but the default representation
+representation for HP Ada is VAX_Float, but the default representation
for GNAT is IEEE.
Specific types may be declared to be VAX_Float or IEEE, using the pragma
-@code{Float_Representation} as described in the DEC Ada documentation.
+@code{Float_Representation} as described in the HP Ada documentation.
For example, the declarations:
@smallexample @c ada
@@ -20368,7 +20445,7 @@ pragma Float_Representation (VAX_Float, F_Float);
declare a type F_Float that will be represented in VAX_Float format.
This set of declarations actually appears in System.Aux_DEC, which provides
the full set of additional floating-point declarations provided in
-the DEC Ada version of package
+the HP Ada version of package
System. This and similar declarations may be accessed in a user program
by using pragma @code{Extend_System}. The use of this
pragma, and the related pragma @code{Long_Float} is described in further
@@ -20378,7 +20455,7 @@ detail in the following section.
@subsection Pragmas Float_Representation and Long_Float
@noindent
-DEC Ada provides the pragma @code{Float_Representation}, which
+HP Ada provides the pragma @code{Float_Representation}, which
acts as a program library switch to allow control over
the internal representation chosen for the predefined
floating-point types declared in the package @code{Standard}.
@@ -20399,10 +20476,10 @@ types as follows:
@itemize @bullet
@item
@code{VAX_Float} specifies that floating-point
-types are represented by default with the VAX hardware types
+types are represented by default with the VAX system hardware types
F-floating, D-floating, G-floating. Note that the H-floating
-type is available only on DIGITAL Vax systems, and is not available
-in either DEC Ada or GNAT for Alpha systems.
+type was available only on Vax systems, and is not available
+in either HP Ada or GNAT for Alpha systems.
@item
@code{IEEE_Float} specifies that floating-point
@@ -20415,10 +20492,10 @@ GNAT provides an identical implementation of the pragma
@code{Float_Representation}, except that it functions as a
configuration pragma, as defined by Ada 95. Note that the
notion of configuration pragma corresponds closely to the
-DEC Ada notion of a program library switch.
+HP Ada notion of a program library switch.
When no pragma is used in GNAT, the default is IEEE_Float, which is different
-from DEC Ada 83, where the default is VAX_Float. In addition, the
+from HP Ada 83, where the default is VAX_Float. In addition, the
predefined libraries in GNAT are built using IEEE_Float, so it is not
advisable to change the format of numbers passed to standard library
routines, and if necessary explicit type conversions may be needed.
@@ -20452,7 +20529,7 @@ and @i{directory} is the directory to be created to contain
the new library.
@noindent
-On OpenVMS systems, DEC Ada provides the pragma @code{Long_Float}
+On OpenVMS systems, HP Ada provides the pragma @code{Long_Float}
to allow control over the internal representation chosen
for the predefined type @code{Long_Float} and for floating-point
type declarations with digits specified in the range 7 .. 15.
@@ -20468,7 +20545,7 @@ pragma Long_Float (D_FLOAT | G_FLOAT);
@subsection Fixed-Point Types and Representations
@noindent
-On DEC Ada for OpenVMS Alpha systems, rounding is
+On HP Ada for OpenVMS Alpha systems, rounding is
away from zero for both positive and negative numbers.
Therefore, +0.5 rounds to 1 and -0.5 rounds to -1.
@@ -20481,7 +20558,7 @@ fixed-point types are truncated.
@subsection Record and Array Component Alignment
@noindent
-On DEC Ada for OpenVMS Alpha, all non composite components
+On HP Ada for OpenVMS Alpha, all non composite components
are aligned on natural boundaries. For example, 1-byte
components are aligned on byte boundaries, 2-byte
components on 2-byte boundaries, 4-byte components on 4-byte
@@ -20489,13 +20566,13 @@ byte boundaries, and so on. The OpenVMS Alpha hardware
runs more efficiently with naturally aligned data.
ON GNAT for OpenVMS Alpha, alignment rules are compatible
-with DEC Ada for OpenVMS Alpha.
+with HP Ada for OpenVMS Alpha.
@node Address Clauses
@subsection Address Clauses
@noindent
-In DEC Ada and GNAT, address clauses are supported for
+In HP Ada and GNAT, address clauses are supported for
objects and imported subprograms.
The predefined type @code{System.Address} is a private type
in both compilers, with the same representation (it is simply
@@ -20509,10 +20586,10 @@ Note that code that with's both this extended package @code{System}
and the package @code{System.Storage_Elements} should not @code{use}
both packages, or ambiguities will result. In general it is better
not to mix these two sets of facilities. The Ada 95 package was
-designed specifically to provide the kind of features that DEC Ada
+designed specifically to provide the kind of features that HP Ada
adds directly to package @code{System}.
-GNAT is compatible with DEC Ada in its handling of address
+GNAT is compatible with HP Ada in its handling of address
clauses, except for some limitations in
the form of address clauses for composite objects with
initialization. Such address clauses are easily replaced
@@ -20555,7 +20632,7 @@ on address specifications is found in the GNAT Reference Manual.
@noindent
GNAT supports in a compatible manner all the representation
-clauses supported by DEC Ada. In addition, it
+clauses supported by HP Ada. In addition, it
supports representation clause forms that are new in Ada 95
including COMPONENT_SIZE and SIZE clauses for objects.
@@ -20563,32 +20640,32 @@ including COMPONENT_SIZE and SIZE clauses for objects.
@section The Package STANDARD
@noindent
-The package STANDARD, as implemented by DEC Ada, is fully
+The package STANDARD, as implemented by HP Ada, is fully
described in the Reference Manual for the Ada Programming
-Language (ANSI/MIL-STD-1815A-1983) and in the DEC Ada
+Language (ANSI/MIL-STD-1815A-1983) and in the HP Ada
Language Reference Manual. As implemented by GNAT, the
package STANDARD is described in the Ada 95 Reference
Manual.
-In addition, DEC Ada supports the Latin-1 character set in
+In addition, HP Ada supports the Latin-1 character set in
the type CHARACTER. GNAT supports the Latin-1 character set
in the type CHARACTER and also Unicode (ISO 10646 BMP) in
the type WIDE_CHARACTER.
The floating-point types supported by GNAT are those
-supported by DEC Ada, but defaults are different, and are controlled by
+supported by HP Ada, but defaults are different, and are controlled by
pragmas. See @ref{Floating-Point Types and Representations} for details.
@node The Package SYSTEM
@section The Package SYSTEM
@noindent
-DEC Ada provides a system-specific version of the package
+HP Ada provides a system-specific version of the package
SYSTEM for each platform on which the language ships.
For the complete specification of the package SYSTEM, see
-Appendix F of the DEC Ada Language Reference Manual.
+Appendix F of the HP Ada Language Reference Manual.
-On DEC Ada, the package SYSTEM includes the following conversion functions:
+On HP Ada, the package SYSTEM includes the following conversion functions:
@itemize @bullet
@item TO_ADDRESS(INTEGER)
@@ -20608,7 +20685,7 @@ On DEC Ada, the package SYSTEM includes the following conversion functions:
By default, GNAT supplies a version of SYSTEM that matches
the definition given in the Ada 95 Reference Manual.
This
-is a subset of the DIGITAL system definitions, which is as
+is a subset of the HP system definitions, which is as
close as possible to the original definitions. The only difference
is that the definition of SYSTEM_NAME is different:
@@ -20627,7 +20704,7 @@ BIT_ORDER and DEFAULT_BIT_ORDER.
However, the use of the following pragma causes GNAT
to extend the definition of package SYSTEM so that it
-encompasses the full set of DIGITAL-specific extensions,
+encompasses the full set of HP-specific extensions,
including the functions listed above:
@smallexample @c ada
@@ -20641,8 +20718,8 @@ The pragma Extend_System is a configuration pragma that
is most conveniently placed in the @file{gnat.adc} file. See the
GNAT Reference Manual for further details.
-DEC Ada does not allow the recompilation of the package
-SYSTEM. Instead DEC Ada provides several pragmas (SYSTEM_
+HP Ada does not allow the recompilation of the package
+SYSTEM. Instead HP Ada provides several pragmas (SYSTEM_
NAME, STORAGE_UNIT, and MEMORY_SIZE) to modify values in
the package SYSTEM. On OpenVMS Alpha systems, the pragma
SYSTEM_NAME takes the enumeration literal OPENVMS_AXP as
@@ -20664,7 +20741,7 @@ pragma Extend_System (AUX_Dec);
@end smallexample
@noindent
-are virtually identical to those provided by the DEC Ada 83 package
+are virtually identical to those provided by the HP Ada 83 package
System. One important difference is that the name of the TO_ADDRESS
function for type UNSIGNED_LONGWORD is changed to TO_ADDRESS_LONG.
See the GNAT Reference manual for a discussion of why this change was
@@ -20674,7 +20751,7 @@ necessary.
The version of TO_ADDRESS taking a universal integer argument is in fact
an extension to Ada 83 not strictly compatible with the reference manual.
In GNAT, we are constrained to be exactly compatible with the standard,
-and this means we cannot provide this capability. In DEC Ada 83, the
+and this means we cannot provide this capability. In HP Ada 83, the
point of this definition is to deal with a call like:
@smallexample @c ada
@@ -20684,7 +20761,7 @@ TO_ADDRESS (16#12777#);
@noindent
Normally, according to the Ada 83 standard, one would expect this to be
ambiguous, since it matches both the INTEGER and UNSIGNED_LONGWORD forms
-of TO_ADDRESS. However, in DEC Ada 83, there is no ambiguity, since the
+of TO_ADDRESS. However, in HP Ada 83, there is no ambiguity, since the
definition using universal_integer takes precedence.
In GNAT, since the version with universal_integer cannot be supplied, it is
@@ -20710,35 +20787,28 @@ change the name to TO_ADDRESS_LONG.
@noindent
The concepts relevant to a comparison of tasking on GNAT
-and on DEC Ada for OpenVMS Alpha systems are discussed in
+and on HP Ada for OpenVMS Alpha systems are discussed in
the following sections.
For detailed information on concepts related to tasking in
-DEC Ada, see the DEC Ada Language Reference Manual and the
+HP Ada, see the HP Ada Language Reference Manual and the
relevant run-time reference manual.
-@node Implementation of Tasks in DEC Ada for OpenVMS Alpha Systems
-@section Implementation of Tasks in DEC Ada for OpenVMS Alpha Systems
+@node Implementation of Tasks in HP Ada for OpenVMS Alpha Systems
+@section Implementation of Tasks in HP Ada for OpenVMS Alpha Systems
@noindent
On OpenVMS Alpha systems, each Ada task (except a passive
task) is implemented as a single stream of execution
that is created and managed by the kernel. On these
-systems, DEC Ada tasking support is based on DECthreads,
+systems, HP Ada tasking support is based on DECthreads,
an implementation of the POSIX standard for threads.
-Although tasks are implemented as threads, all tasks in
-an Ada program are part of the same process. As a result,
-resources such as open files and virtual memory can be
-shared easily among tasks. Having all tasks in one process
-allows better integration with the programming environment
-(the shell and the debugger, for example).
-
-Also, on OpenVMS Alpha systems, DEC Ada tasks and foreign
+Also, on OpenVMS Alpha systems, HP Ada tasks and foreign
code that calls DECthreads routines can be used together.
The interaction between Ada tasks and DECthreads routines
can have some benefits. For example when on OpenVMS Alpha,
-DEC Ada can call C code that is already threaded.
+HP Ada can call C code that is already threaded.
GNAT on OpenVMS Alpha uses the facilities of DECthreads,
and Ada tasks are mapped to threads.
@@ -20755,7 +20825,7 @@ and Ada tasks are mapped to threads.
@subsection Assigning Task IDs
@noindent
-The DEC Ada Run-Time Library always assigns %TASK 1 to
+The HP Ada Run-Time Library always assigns %TASK 1 to
the environment task that executes the main program. On
OpenVMS Alpha systems, %TASK 0 is often used for tasks
that have been created but are not yet activated.
@@ -20763,7 +20833,7 @@ that have been created but are not yet activated.
On OpenVMS Alpha systems, task IDs are assigned at
activation. On GNAT systems, task IDs are also assigned at
task creation but do not have the same form or values as
-task ID values in DEC Ada. There is no null task, and the
+task ID values in HP Ada. There is no null task, and the
environment task does not have a specific task ID value.
@node Task IDs and Delays
@@ -20802,18 +20872,18 @@ GNAT supplies the following task-related pragmas:
@item TASK_STORAGE
GNAT implements pragma TASK_STORAGE in the same way as
- DEC Ada.
- Both DEC Ada and GNAT supply the pragmas PASSIVE,
+ HP Ada.
+ Both HP Ada and GNAT supply the pragmas PASSIVE,
SUPPRESS, and VOLATILE.
@end itemize
@node Scheduling and Task Priority
@subsection Scheduling and Task Priority
@noindent
-DEC Ada implements the Ada language requirement that
+HP Ada implements the Ada language requirement that
when two tasks are eligible for execution and they have
different priorities, the lower priority task does not
-execute while the higher priority task is waiting. The DEC
+execute while the higher priority task is waiting. The HP
Ada Run-Time Library keeps a task running until either the
task is suspended or a higher priority task becomes ready.
@@ -20823,30 +20893,30 @@ at the processor. A task is run for a certain period of
time and then placed at the rear of the ready queue for
its priority level.
-DEC Ada provides the implementation-defined pragma TIME_SLICE,
+HP Ada provides the implementation-defined pragma TIME_SLICE,
which can be used to enable or disable round-robin
scheduling of tasks with the same priority.
-See the relevant DEC Ada run-time reference manual for
-information on using the pragmas to control DEC Ada task
+See the relevant HP Ada run-time reference manual for
+information on using the pragmas to control HP Ada task
scheduling.
GNAT follows the scheduling rules of Annex D (real-time
Annex) of the Ada 95 Reference Manual. In general, this
-scheduling strategy is fully compatible with DEC Ada
+scheduling strategy is fully compatible with HP Ada
although it provides some additional constraints (as
fully documented in Annex D).
GNAT implements time slicing control in a manner compatible with
-DEC Ada 83, by means of the pragma Time_Slice, whose semantics are identical
-to the DEC Ada 83 pragma of the same name.
+HP Ada 83, by means of the pragma Time_Slice, whose semantics are identical
+to the HP Ada 83 pragma of the same name.
Note that it is not possible to mix GNAT tasking and
-DEC Ada 83 tasking in the same program, since the two run times are
+HP Ada 83 tasking in the same program, since the two run times are
not compatible.
@node The Task Stack
@subsection The Task Stack
@noindent
-In DEC Ada, a task stack is allocated each time a
+In HP Ada, a task stack is allocated each time a
non passive task is activated. As soon as the task is
terminated, the storage for the task stack is deallocated.
If you specify a size of zero (bytes) with T'STORAGE_SIZE,
@@ -20859,24 +20929,24 @@ GNAT handles task stacks in a similar manner. According to
the Ada 95 rules, it provides the pragma STORAGE_SIZE as
an alternative method for controlling the task stack size.
The specification of the attribute T'STORAGE_SIZE is also
-supported in a manner compatible with DEC Ada.
+supported in a manner compatible with HP Ada.
@node External Interrupts
@subsection External Interrupts
@noindent
-On DEC Ada, external interrupts can be associated with task entries.
-GNAT is compatible with DEC Ada in its handling of external interrupts.
+On HP Ada, external interrupts can be associated with task entries.
+GNAT is compatible with HP Ada in its handling of external interrupts.
@node Pragmas and Pragma-Related Features
@section Pragmas and Pragma-Related Features
@noindent
-Both DEC Ada and GNAT supply all language-defined pragmas
+Both HP Ada and GNAT supply all language-defined pragmas
as specified by the Ada 83 standard. GNAT also supplies all
language-defined pragmas specified in the Ada 95 Reference Manual.
In addition, GNAT implements the implementation-defined pragmas
-from DEC Ada 83.
+from HP Ada 83.
@itemize @bullet
@item AST_ENTRY
@@ -20939,7 +21009,7 @@ recognized, but which have no
effect in GNAT. The effect of @code{Passive} may be obtained by the
use of protected objects in Ada 95. In GNAT, all generics are inlined.
-Unlike DEC Ada, the GNAT 'EXPORT_@i{subprogram}' pragmas require
+Unlike HP Ada, the GNAT 'EXPORT_@i{subprogram}' pragmas require
a separate subprogram specification which must appear before the
subprogram body.
@@ -21016,7 +21086,7 @@ the GNAT Reference Manual.
@subsection Restrictions on the Pragma INLINE
@noindent
-DEC Ada applies the following restrictions to the pragma INLINE:
+HP Ada applies the following restrictions to the pragma INLINE:
@itemize @bullet
@item Parameters cannot be a task type.
@@ -21059,7 +21129,7 @@ be incapable of being inlined.
@noindent
The following lists and describes the restrictions on the
-pragma INTERFACE on DEC Ada and GNAT:
+pragma INTERFACE on HP Ada and GNAT:
@itemize @bullet
@item Languages accepted: Ada, Bliss, C, Fortran, Default.
Default is the default on OpenVMS Alpha systems.
@@ -21080,14 +21150,14 @@ be a string, an array, or a record.
@end itemize
@noindent
-GNAT is entirely upwards compatible with DEC Ada, and in addition allows
+GNAT is entirely upwards compatible with HP Ada, and in addition allows
record parameters for all languages.
@node Restrictions on the Pragma SYSTEM_NAME
@subsection Restrictions on the Pragma SYSTEM_NAME
@noindent
-For DEC Ada for OpenVMS Alpha, the enumeration literal
+For HP Ada for OpenVMS Alpha, the enumeration literal
for the type NAME is OPENVMS_AXP. In GNAT, the enumeration
literal for the type NAME is SYSTEM_NAME_GNAT.
@@ -21096,13 +21166,13 @@ literal for the type NAME is SYSTEM_NAME_GNAT.
@noindent
A library of predefined units is provided as part of the
-DEC Ada and GNAT implementations. DEC Ada does not provide
+HP Ada and GNAT implementations. HP Ada does not provide
the package MACHINE_CODE but instead recommends importing
assembler code.
-The GNAT versions of the DEC Ada Run-Time Library (ADA$PREDEFINED:)
+The GNAT versions of the HP Ada Run-Time Library (ADA$PREDEFINED:)
units are taken from the OpenVMS Alpha version, not the OpenVMS VAX
-version. During GNAT installation, the DEC Ada Predefined
+version. During GNAT installation, the HP Ada Predefined
Library units are copied into the GNU:[LIB.OPENVMS7_x.2_8_x.DECLIB]
(aka DECLIB) directory and patched to remove Ada 95 incompatibilities
and to make them interoperable with GNAT, @pxref{Changes to DECLIB}
@@ -21116,9 +21186,9 @@ for example).
However, it is possible to change the default so that the
reverse is true, or even to mix them using child package
-notation. The DEC Ada 83 units are available as DEC.xxx where xxx
+notation. The HP Ada 83 units are available as DEC.xxx where xxx
is the package name, and the Ada units are available in the
-standard manner defined for Ada 95, that is to say as Ada.xxx. To
+standard manner defined for Ada 95, that is to say as DEC.xxx. To
change the default, set ADA_INCLUDE_PATH and ADA_OBJECTS_PATH
appropriately. For example, to change the default to use the Ada95
versions do:
@@ -21138,7 +21208,7 @@ $ DEFINE ADA_OBJECTS_PATH GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB],-
@subsection Changes to DECLIB
@noindent
-The changes made to the DEC Ada predefined library for GNAT and Ada 95
+The changes made to the HP Ada predefined library for GNAT and Ada 95
compatibility are minor and include the following:
@itemize @bullet
@@ -21163,7 +21233,7 @@ None of the above changes is visible to users.
@section Bindings
@noindent
-On OpenVMS Alpha, DEC Ada provides the following strongly-typed bindings:
+On OpenVMS Alpha, HP Ada provides the following strongly-typed bindings:
@itemize @bullet
@item Command Language Interpreter (CLI interface)
@@ -21199,10 +21269,10 @@ On OpenVMS Alpha, DEC Ada provides the following strongly-typed bindings:
@end itemize
@noindent
-GNAT provides implementations of these DEC bindings in the DECLIB directory.
+GNAT provides implementations of these HP bindings in the DECLIB directory.
The X/Motif bindings used to build DECLIB are whatever versions are in the
-DEC Ada @file{ADA$PREDEFINED} directory with extension @file{.ADC}.
+HP Ada @file{ADA$PREDEFINED} directory with extension @file{.ADC}.
The build script will
automatically add a pragma Linker_Options to packages @code{Xm}, @code{Xt},
and @code{X_Lib}
@@ -21225,7 +21295,7 @@ default @file{ADA$PREDEFINED} versions.
@subsection Shared Libraries and Options Files
@noindent
-When using the DEC Ada
+When using the HP Ada
predefined X and Motif bindings, the linking with their sharable images is
done automatically by @command{GNAT LINK}.
When using other X and Motif bindings, you need
@@ -21241,7 +21311,7 @@ libraries under VMS. The VMS Link command can be used in standard fashion.
@subsection Interfaces to C
@noindent
-DEC Ada
+HP Ada
provides the following Ada types and operations:
@itemize @bullet
@@ -21254,7 +21324,7 @@ provides the following Ada types and operations:
@noindent
Interfacing to C with GNAT, one can use the above approach
-described for DEC Ada or the facilities of Annex B of
+described for HP Ada or the facilities of Annex B of
the Ada 95 Reference Manual (packages INTERFACES.C,
INTERFACES.C.STRINGS and INTERFACES.C.POINTERS). For more
information, see the section ``Interfacing to C'' in the
@@ -21270,8 +21340,8 @@ of Compaq C. The qualifier has no effect on @code{Link_Name} parameters.
@noindent
The following section discusses differences in the
-definition of main programs on DEC Ada and GNAT.
-On DEC Ada, main programs are defined to meet the
+definition of main programs on HP Ada and GNAT.
+On HP Ada, main programs are defined to meet the
following conditions:
@itemize @bullet
@item Procedure with no formal parameters (returns 0 upon
@@ -21307,14 +21377,14 @@ generic subprogram
@section Implementation-Defined Attributes
@noindent
-GNAT provides all DEC Ada implementation-defined
+GNAT provides all HP Ada implementation-defined
attributes.
@node Compiler and Run-Time Interfacing
@section Compiler and Run-Time Interfacing
@noindent
-DEC Ada provides the following ways to pass options to the linker
+HP Ada provides the following ways to pass options to the linker
(ACS LINK):
@itemize @bullet
@item /WAIT and /SUBMIT qualifiers
@@ -21343,8 +21413,8 @@ switches:
@noindent
For more information on these switches, see
@ref{Switches for gnatlink}.
-In DEC Ada, the command-line switch @option{/OPTIMIZE} is available
-to control optimization. DEC Ada also supplies the
+In HP Ada, the command-line switch @option{/OPTIMIZE} is available
+to control optimization. HP Ada also supplies the
following pragmas:
@itemize @bullet
@item @code{OPTIMIZE}
@@ -21361,24 +21431,24 @@ following pragmas:
@noindent
In GNAT, optimization is controlled strictly by command
line parameters, as described in the corresponding section of this guide.
-The DIGITAL pragmas for control of optimization are
+The HP pragmas for control of optimization are
recognized but ignored.
-Note that in GNAT, the default is optimization off, whereas in DEC Ada 83,
+Note that in GNAT, the default is optimization off, whereas in HP Ada 83,
the default is that optimization is turned on.
@node Program Compilation and Library Management
@section Program Compilation and Library Management
@noindent
-DEC Ada and GNAT provide a comparable set of commands to
-build programs. DEC Ada also provides a program library,
+HP Ada and GNAT provide a comparable set of commands to
+build programs. HP Ada also provides a program library,
which is a concept that does not exist on GNAT. Instead,
GNAT provides directories of sources that are compiled as
needed.
The following table summarizes
-the DEC Ada commands and provides
+the HP Ada commands and provides
equivalent GNAT commands. In this table, some GNAT
equivalents reflect the fact that GNAT does not use the
concept of a program library. Instead, it uses a model
@@ -21387,12 +21457,12 @@ in a manner consistent with other languages like C and
Fortran. Therefore, standard system file commands are used
to manipulate these elements. Those GNAT commands are marked with
an asterisk.
-Note that, unlike DEC Ada, none of the GNAT commands accepts wild cards.
+Note that, unlike HP Ada, none of the GNAT commands accepts wild cards.
@need 1500
@multitable @columnfractions .35 .65
-@item @emph{DEC Ada Command}
+@item @emph{HP Ada Command}
@tab @emph{GNAT Equivalent / Description}
@item @command{ADA}
@@ -21557,14 +21627,14 @@ valid form.
@section Input-Output
@noindent
-On OpenVMS Alpha systems, DEC Ada uses OpenVMS Record
+On OpenVMS Alpha systems, HP Ada uses OpenVMS Record
Management Services (RMS) to perform operations on
external files.
@noindent
-DEC Ada and GNAT predefine an identical set of input-
+HP Ada and GNAT predefine an identical set of input-
output packages. To make the use of the
-generic TEXT_IO operations more convenient, DEC Ada
+generic TEXT_IO operations more convenient, HP Ada
provides predefined library packages that instantiate the
integer and floating-point operations for the predefined
integer and floating-point types as shown in the following table.
@@ -21589,9 +21659,9 @@ integer and floating-point types as shown in the following table.
@end multitable
@noindent
-The DEC Ada predefined packages and their operations
+The HP Ada predefined packages and their operations
are implemented using OpenVMS Alpha files and input-
-output facilities. DEC Ada supports asynchronous input-
+output facilities. HP Ada supports asynchronous input-
output on OpenVMS Alpha. Familiarity with the following is
recommended:
@itemize @bullet
@@ -21604,10 +21674,10 @@ recommended:
@noindent
GNAT provides I/O facilities that are completely
-compatible with DEC Ada. The distribution includes the
-standard DEC Ada versions of all I/O packages, operating
-in a manner compatible with DEC Ada. In particular, the
-following packages are by default the DEC Ada (Ada 83)
+compatible with HP Ada. The distribution includes the
+standard HP Ada versions of all I/O packages, operating
+in a manner compatible with HP Ada. In particular, the
+following packages are by default the HP Ada (Ada 83)
versions of these packages rather than the renamings
suggested in annex J of the Ada 95 Reference Manual:
@itemize @bullet
@@ -21622,7 +21692,7 @@ suggested in annex J of the Ada 95 Reference Manual:
The use of the standard Ada 95 syntax for child packages (for
example, @code{ADA.TEXT_IO}) retrieves the Ada 95 versions of these
packages, as defined in the Ada 95 Reference Manual.
-GNAT provides DIGITAL-compatible predefined instantiations
+GNAT provides HP-compatible predefined instantiations
of the @code{TEXT_IO} packages, and also
provides the standard predefined instantiations required
by the Ada 95 Reference Manual.
@@ -21660,12 +21730,12 @@ This chapter covers the following:
@section Implementation Limits
@noindent
-The following table lists implementation limits for DEC Ada
+The following table lists implementation limits for HP Ada
and GNAT systems.
@multitable @columnfractions .60 .20 .20
@sp 1
@item @emph{Compilation Parameter}
-@tab @emph{DEC Ada}
+@tab @emph{HP Ada}
@tab @emph{GNAT}
@sp 1
@@ -21743,9 +21813,6 @@ and GNAT systems.
@tab 2**31-1
@end multitable
-@node Tools
-@section Tools
-
@end ifset
@c **************************************
@@ -23305,12 +23372,19 @@ later.
The rule is simple. If a unit has elaboration code that can directly or
indirectly make a call to a subprogram in a @code{with}'ed unit, or instantiate
-a generic unit in a @code{with}'ed unit,
+a generic package in a @code{with}'ed unit,
then if the @code{with}'ed unit does not have
pragma @code{Pure} or @code{Preelaborate}, then the client should have
a pragma @code{Elaborate_All}
for the @code{with}'ed unit. By following this rule a client is
assured that calls can be made without risk of an exception.
+
+For generic subprogram instantiations, the rule can be relaxed to
+require only a pragma @code{Elaborate} since elaborating the body
+of a subprogram cannot cause any transitive elaboration (we are
+not calling the subprogram in this case, just elaborating its
+declaration).
+
If this rule is not followed, then a program may be in one of four
states:
@@ -23345,10 +23419,11 @@ may be true even if the rule is not followed.
@end table
@noindent
-Note that one additional advantage of following our Elaborate_All rule
+Note that one additional advantage of following our rules on the use
+of @code{Elaborate} and @code{Elaborate_All}
is that the program continues to stay in the ideal (all orders OK) state
even if maintenance
-changes some bodies of some subprograms. Conversely, if a program that does
+changes some bodies of some units. Conversely, if a program that does
not follow this rule happens to be safe at some point, this state of affairs
may deteriorate silently as a result of maintenance changes.
@@ -23698,11 +23773,15 @@ rule we previously described as the right approach. Let's restate it:
@itemize
@item
@emph{If a unit has elaboration code that can directly or indirectly make a
-call to a subprogram in a @code{with}'ed unit, or instantiate a generic unit
-in a @code{with}'ed unit, then if the @code{with}'ed unit
+call to a subprogram in a @code{with}'ed unit, or instantiate a generic
+package in a @code{with}'ed unit, then if the @code{with}'ed unit
does not have pragma @code{Pure} or
@code{Preelaborate}, then the client should have an
-@code{Elaborate_All} for the @code{with}'ed unit.}
+@code{Elaborate_All} pragma for the @code{with}'ed unit.}
+
+@emph{In the case of instantiating a generic subprogram, it is always
+sufficient to have only an @code{Elaborate} pragma for the
+@code{with}'ed unit.}
@end itemize
@noindent
@@ -23710,24 +23789,26 @@ By following this rule a client is assured that calls and instantiations
can be made without risk of an exception.
In this mode GNAT traces all calls that are potentially made from
-elaboration code, and puts in any missing implicit @code{Elaborate_All}
-pragmas.
+elaboration code, and puts in any missing implicit @code{Elaborate}
+and @code{Elaborate_All} pragmas.
The advantage of this approach is that no elaboration problems
are possible if the binder can find an elaboration order that is
-consistent with these implicit @code{Elaborate_All} pragmas. The
+consistent with these implicit @code{Elaborate} and
+@code{Elaborate_All} pragmas. The
disadvantage of this approach is that no such order may exist.
-If the binder does not generate any diagnostics, then it means that it
-has found an elaboration order that is guaranteed to be safe. However,
-the binder may still be relying on implicitly generated
-@code{Elaborate_All} pragmas so portability to other compilers than
-GNAT is not guaranteed.
+If the binder does not generate any diagnostics, then it means that it has
+found an elaboration order that is guaranteed to be safe. However, the binder
+may still be relying on implicitly generated @code{Elaborate} and
+@code{Elaborate_All} pragmas so portability to other compilers than GNAT is not
+guaranteed.
If it is important to guarantee portability, then the compilations should
use the
@option{-gnatwl}
(warn on elaboration problems) switch. This will cause warning messages
-to be generated indicating the missing @code{Elaborate_All} pragmas.
+to be generated indicating the missing @code{Elaborate} and
+@code{Elaborate_All} pragmas.
Consider the following source program:
@smallexample @c ada
@@ -23772,7 +23853,7 @@ and these warnings can be used as a guide for supplying manually
the missing pragmas. It is usually a bad idea to use this warning
option during development. That's because it will warn you when
you need to put in a pragma, but cannot warn you when it is time
-to take it out. So the use of pragma Elaborate_All may lead to
+to take it out. So the use of pragma @code{Elaborate_All} may lead to
unnecessary dependencies and even false circularities.
This default mode is more restrictive than the Ada Reference
@@ -23980,7 +24061,7 @@ must be elaborated before itself, and that's a circularity.
@end enumerate
@noindent
-Indeed, if you add an explicit pragma Elaborate_All for @code{Utils} in
+Indeed, if you add an explicit pragma @code{Elaborate_All} for @code{Utils} in
the body of @code{Decls} you will get a true Ada Reference Manual
circularity that makes the program illegal.
@@ -24321,15 +24402,15 @@ the case of complex legacy code.
@item Perform dynamic checks
If the compilations are done using the
@option{-gnatE}
-(dynamic elaboration check) switch, then GNAT behaves in
-a quite different manner. Dynamic checks are generated for all calls
-that could possibly result in raising an exception. With this switch,
-the compiler does not generate implicit @code{Elaborate_All} pragmas.
-The behavior then is exactly as specified in the Ada 95 Reference Manual.
-The binder will generate an executable program that may or may not
-raise @code{Program_Error}, and then it is the programmer's job to ensure
-that it does not raise an exception. Note that it is important to
-compile all units with the switch, it cannot be used selectively.
+(dynamic elaboration check) switch, then GNAT behaves in a quite different
+manner. Dynamic checks are generated for all calls that could possibly result
+in raising an exception. With this switch, the compiler does not generate
+implicit @code{Elaborate} or @code{Elaborate_All} pragmas. The behavior then is
+exactly as specified in the Ada 95 Reference Manual. The binder will generate
+an executable program that may or may not raise @code{Program_Error}, and then
+it is the programmer's job to ensure that it does not raise an exception. Note
+that it is important to compile all units with the switch, it cannot be used
+selectively.
@item Suppress checks
The drawback of dynamic checks is that they generate a
@@ -24341,15 +24422,15 @@ then you can use the configuration pragma
example this pragma could be placed in the @file{gnat.adc} file.
@item Suppress checks selectively
-When you know that certain calls in elaboration code cannot possibly
-lead to an elaboration error, and the binder nevertheless generates warnings
-on those calls and inserts Elaborate_All pragmas that lead to elaboration
-circularities, it is possible to remove those warnings locally and obtain
-a program that will bind. Clearly this can be unsafe, and it is the
-responsibility of the programmer to make sure that the resulting program has
-no elaboration anomalies. The pragma @code{Suppress (Elaboration_Check)} can
-be used with different granularity to suppress warnings and break
-elaboration circularities:
+When you know that certain calls or instantiations in elaboration code cannot
+possibly lead to an elaboration error, and the binder nevertheless complains
+about implicit @code{Elaborate} and @code{Elaborate_All} pragmas that lead to
+elaboration circularities, it is possible to remove those warnings locally and
+obtain a program that will bind. Clearly this can be unsafe, and it is the
+responsibility of the programmer to make sure that the resulting program has no
+elaboration anomalies. The pragma @code{Suppress (Elaboration_Check)} can be
+used with different granularity to suppress warnings and break elaboration
+circularities:
@itemize @bullet
@item
@@ -24560,8 +24641,8 @@ raised by the use of access-to-subprogram types and dynamic dispatching,
the program is free of elaboration errors. If it is important that the
program be portable, then use the
@option{-gnatwl}
-switch to generate warnings about missing @code{Elaborate_All}
-pragmas, and supply the missing pragmas.
+switch to generate warnings about missing @code{Elaborate} or
+@code{Elaborate_All} pragmas, and supply the missing pragmas.
If the program fails to bind using the default static elaboration
handling, then you can fix the program to eliminate the binder
@@ -24710,7 +24791,7 @@ It is of course quite unlikely that both these results are correct, so
it is up to you in a case like this to investigate the source of the
difference, by looking at the two elaboration orders that are chosen,
and figuring out which is correct, and then adding the necessary
-@code{Elaborate_All} pragmas to ensure the desired order.
+@code{Elaborate} or @code{Elaborate_All} pragmas to ensure the desired order.
@node Inline Assembler
@appendix Inline Assembler
@@ -25443,7 +25524,7 @@ applications developed in other Ada environments.
* Implementation-dependent characteristics::
* Compatibility with Other Ada 95 Systems::
* Representation Clauses::
-* Compatibility with DEC Ada 83::
+* Compatibility with HP Ada 83::
@ifset vms
* Transitioning from Alpha to Integrity OpenVMS::
@end ifset
@@ -25510,7 +25591,7 @@ the item nearer to the declaration of the entity to which it refers.
A particular case is that representation pragmas
@ifset vms
(including the
-extended DEC Ada 83 compatibility pragmas such as @code{Export_Procedure})
+extended HP Ada 83 compatibility pragmas such as @code{Export_Procedure})
@end ifset
cannot be applied to a subprogram body. If necessary, a separate subprogram
declaration must be introduced to which the pragma can be applied.
@@ -25663,7 +25744,7 @@ are described in the GNAT Reference Manual, and these include several that
are specifically intended to correspond to other vendors' Ada 83 pragmas.
For migrating from VADS, the pragma @code{Use_VADS_Size} may be useful.
For
-compatibility with DEC Ada 83, GNAT supplies the pragmas
+compatibility with HP Ada 83, GNAT supplies the pragmas
@code{Extend_System}, @code{Ident}, @code{Inline_Generic},
@code{Interface_Name}, @code{Passive}, @code{Suppress_All},
and @code{Volatile}.
@@ -25682,7 +25763,7 @@ implementation. All GNAT-defined attributes are described in the
@cite{GNAT Reference Manual}, and these include several that are specifically
intended
to correspond to other vendors' Ada 83 attributes. For migrating from VADS,
-the attribute @code{VADS_Size} may be useful. For compatibility with DEC
+the attribute @code{VADS_Size} may be useful. For compatibility with HP
Ada 83, GNAT supplies the attributes @code{Bit}, @code{Machine_Size} and
@code{Type_Class}.
@@ -25717,7 +25798,8 @@ Program_Error being raised due to an ``Access Before Elaboration'': an attempt
to invoke a subprogram its body has been elaborated, or to instantiate a
generic before the generic body has been elaborated. By default GNAT
attempts to choose a safe order (one that will not encounter access before
-elaboration problems) by implicitly inserting Elaborate_All pragmas where
+elaboration problems) by implicitly inserting @code{Elaborate} or
+@code{Elaborate_All} pragmas where
needed. However, this can lead to the creation of elaboration circularities
and a resulting rejection of the program by gnatbind. This issue is
thoroughly described in @ref{Elaboration Order Handling in GNAT}.
@@ -25862,36 +25944,36 @@ is to use a component size clause for the element size in an array,
or a record representation clause for an access field in a record.
@end table
-@node Compatibility with DEC Ada 83
-@section Compatibility with DEC Ada 83
+@node Compatibility with HP Ada 83
+@section Compatibility with HP Ada 83
@noindent
The VMS version of GNAT fully implements all the pragmas and attributes
-provided by DEC Ada 83, as well as providing the standard DEC Ada 83
+provided by HP Ada 83, as well as providing the standard HP Ada 83
libraries, including Starlet. In addition, data layouts and parameter
passing conventions are highly compatible. This means that porting
-existing DEC Ada 83 code to GNAT in VMS systems should be easier than
+existing HP Ada 83 code to GNAT in VMS systems should be easier than
most other porting efforts. The following are some of the most
-significant differences between GNAT and DEC Ada 83.
+significant differences between GNAT and HP Ada 83.
@table @asis
@item Default floating-point representation
-In GNAT, the default floating-point format is IEEE, whereas in DEC Ada 83,
+In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83,
it is VMS format. GNAT does implement the necessary pragmas
(Long_Float, Float_Representation) for changing this default.
@item System
The package System in GNAT exactly corresponds to the definition in the
Ada 95 reference manual, which means that it excludes many of the
-DEC Ada 83 extensions. However, a separate package Aux_DEC is provided
+HP Ada 83 extensions. However, a separate package Aux_DEC is provided
that contains the additional definitions, and a special pragma,
Extend_System allows this package to be treated transparently as an
extension of package System.
@item To_Address
The definitions provided by Aux_DEC are exactly compatible with those
-in the DEC Ada 83 version of System, with one exception.
-DEC Ada provides the following declarations:
+in the HP Ada 83 version of System, with one exception.
+HP Ada provides the following declarations:
@smallexample @c ada
TO_ADDRESS (INTEGER)
@@ -25903,7 +25985,7 @@ TO_ADDRESS (universal_integer)
The version of TO_ADDRESS taking a universal integer argument is in fact
an extension to Ada 83 not strictly compatible with the reference manual.
In GNAT, we are constrained to be exactly compatible with the standard,
-and this means we cannot provide this capability. In DEC Ada 83, the
+and this means we cannot provide this capability. In HP Ada 83, the
point of this definition is to deal with a call like:
@smallexample @c ada
@@ -25913,7 +25995,7 @@ TO_ADDRESS (16#12777#);
@noindent
Normally, according to the Ada 83 standard, one would expect this to be
ambiguous, since it matches both the INTEGER and UNSIGNED_LONGWORD forms
-of TO_ADDRESS@. However, in DEC Ada 83, there is no ambiguity, since the
+of TO_ADDRESS@. However, in HP Ada 83, there is no ambiguity, since the
definition using universal_integer takes precedence.
In GNAT, since the version with universal_integer cannot be supplied, it is
@@ -25942,10 +26024,10 @@ which in GNAT is treated like any other declared task.
@end table
For full details on these and other less significant compatibility issues,
-see appendix E of the Digital publication entitled @cite{DEC Ada, Technical
-Overview and Comparison on DIGITAL Platforms}.
+see appendix E of the HP publication entitled @cite{HP Ada, Technical
+Overview and Comparison on HP Platforms}.
-For GNAT running on other than VMS systems, all the DEC Ada 83 pragmas and
+For GNAT running on other than VMS systems, all the HP Ada 83 pragmas and
attributes are recognized, although only a subset of them can sensibly
be implemented. The description of pragmas in this reference manual
indicates whether or not they are applicable to non-VMS systems.
@@ -26559,6 +26641,7 @@ environment to build your executable.
@menu
* C Calling Convention::
* Stdcall Calling Convention::
+* Win32 Calling Convention::
* DLL Calling Convention::
@end menu
@@ -26579,6 +26662,9 @@ are available for Windows:
@code{Stdcall} (Microsoft defined)
@item
+@code{Win32} (GNAT specific)
+
+@item
@code{DLL} (GNAT specific)
@end itemize
@@ -26621,8 +26707,8 @@ is missing, as in the above example, this parameter is set to be the
When importing a variable defined in C, you should always use the @code{C}
calling convention unless the object containing the variable is part of a
-DLL (in which case you should use the @code{DLL} calling convention,
-@pxref{DLL Calling Convention}).
+DLL (in which case you should use the @code{Stdcall} calling
+convention, @pxref{Stdcall Calling Convention}).
@node Stdcall Calling Convention
@subsection @code{Stdcall} Calling Convention
@@ -26697,14 +26783,10 @@ The @code{gnatdll} tool, which creates the import library for the DLL, is able
to handle those cases (@pxref{Using gnatdll} for the description of
the switches).
-@node DLL Calling Convention
-@subsection @code{DLL} Calling Convention
-
@noindent
-This convention, which is GNAT-specific, must be used when you want to
-import in Ada a variables defined in a DLL. For functions and procedures
-this convention is equivalent to the @code{Stdcall} convention. As an
-example, if a DLL contains a variable defined as:
+It is also possible to import variables defined in a DLL by using an
+import pragma for a variable. As an example, if a DLL contains a
+variable defined as:
@smallexample
int my_var;
@@ -26716,13 +26798,27 @@ then, to access this variable from Ada you should write:
@smallexample @c ada
@group
My_Var : Interfaces.C.int;
-pragma Import (DLL, My_Var);
+pragma Import (Stdcall, My_Var);
@end group
@end smallexample
-The remarks concerning the @code{External_Name} and @code{Link_Name}
-parameters given in the previous sections equally apply to the @code{DLL}
-calling convention.
+@noindent
+Note that to ease building cross-platform bindings this convention
+will be handled as a @code{C} calling convention on non Windows platforms.
+
+@node Win32 Calling Convention
+@subsection @code{Win32} Calling Convention
+
+@noindent
+This convention, which is GNAT-specific is fully equivalent to the
+@code{Stdcall} calling convention described above.
+
+@node DLL Calling Convention
+@subsection @code{DLL} Calling Convention
+
+@noindent
+This convention, which is GNAT-specific is fully equivalent to the
+@code{Stdcall} calling convention described above.
@node Introduction to Dynamic Link Libraries (DLLs)
@section Introduction to Dynamic Link Libraries (DLLs)
@@ -26907,9 +27003,9 @@ end API;
@end smallexample
@noindent
-Note that a variable is @strong{always imported with a DLL convention}. A
-function can have @code{C}, @code{Stdcall} or @code{DLL} convention. For
-subprograms, the @code{DLL} convention is a synonym of @code{Stdcall}
+Note that a variable is
+@strong{always imported with a Stdcall convention}. A function
+can have @code{C} or @code{Stdcall} convention.
(@pxref{Windows Calling Conventions}).
@node Creating an Import Library
@@ -27218,9 +27314,11 @@ library (@pxref{Using gnatdll}).
@end enumerate
@noindent
-Note that a relocatable DLL stripped using the @code{strip} binutils
-tool will not be relocatable anymore. To build a DLL without debug
-information pass @code{-largs -s} to @code{gnatdll}.
+Note that a relocatable DLL stripped using the @code{strip}
+binutils tool will not be relocatable anymore. To build a DLL without
+debug information pass @code{-largs -s} to @code{gnatdll}. This
+restriction does not apply to a DLL built using a Library Project.
+@pxref{Library Projects}.
@node Limitations When Using Ada DLLs from Ada
@subsection Limitations When Using Ada DLLs from Ada
@@ -27250,10 +27348,9 @@ Windows object handles, etc.
Building a DLL is a way to encapsulate a set of services usable from any
application. As a result, the Ada entities exported by a DLL should be
exported with the @code{C} or @code{Stdcall} calling conventions to avoid
-any Ada name mangling. Please note that the @code{Stdcall} convention
-should only be used for subprograms, not for variables. As an example here
-is an Ada package @code{API}, spec and body, exporting two procedures, a
-function, and a variable:
+any Ada name mangling. As an example here is an Ada package
+@code{API}, spec and body, exporting two procedures, a function, and a
+variable:
@smallexample @c ada
@group
@@ -27944,11 +28041,10 @@ switch). Here are the step-by-step instructions for debugging it:
$ gdb -nw ada_main
@end smallexample
-@item Break on the main procedure and run the program.
+@item Start the program and stop at the beginning of the main procedure
@smallexample
-(gdb) break ada_main
-(gdb) run
+(gdb) start
@end smallexample
@noindent
@@ -27961,7 +28057,7 @@ possible to set a breakpoint in the DLL.
@smallexample
(gdb) break ada_dll
-(gdb) run
+(gdb) cont
@end smallexample
@end enumerate
@@ -27971,6 +28067,10 @@ At this stage a breakpoint is set inside the DLL. From there on
you can use the standard approach to debug the whole program
(@pxref{Running and Debugging Ada Programs}).
+@ignore
+@c This used to work, probably because the DLLs were non-relocatable
+@c keep this section around until the problem is sorted out.
+
To break on the @code{DllMain} routine it is not possible to follow
the procedure above. At the time the program stop on @code{ada_main}
the @code{DllMain} routine as already been called. Either you can use
@@ -27980,7 +28080,7 @@ the procedure below @pxref{Debugging the DLL Directly} or this procedure:
@item Launch @code{GDB} on the main program.
@smallexample
-$ gdb -nw ada_main
+$ gdb ada_main
@end smallexample
@item Load DLL symbols
@@ -28006,6 +28106,7 @@ on the proper line (break in @file{ada_dll.adb} line 45).
@end smallexample
@end enumerate
+@end ignore
@node Program Built with Foreign Tools and DLL Built with GCC/GNAT
@subsection Program Built with Foreign Tools and DLL Built with GCC/GNAT
@@ -28039,34 +28140,58 @@ been built with debugging information (see GNAT -g option).
@enumerate 1
@item
-Launch the debugger on the DLL.
+Find out the executable starting address
@smallexample
-$ gdb -nw test.dll
+$ objdump --file-header main.exe
@end smallexample
-@item Set a breakpoint on a DLL subroutine.
+The starting address is reported on the last line. For example:
@smallexample
-(gdb) break ada_dll.adb:45
+main.exe: file format pei-i386
+architecture: i386, flags 0x0000010a:
+EXEC_P, HAS_DEBUG, D_PAGED
+start address 0x00401010
@end smallexample
-Note that at this point it is not possible to break using the routine symbol
-directly as the program is not yet running. The solution is to break
-on the proper line (break in @file{ada_dll.adb} line 45).
+@item
+Launch the debugger on the executable.
+
+@smallexample
+$ gdb main.exe
+@end smallexample
@item
-Specify the executable file to @code{GDB}.
+Set a breakpoint at the starting address, and launch the program.
@smallexample
-(gdb) exec-file main.exe
+$ (gdb) break *0x00401010
+$ (gdb) run
@end smallexample
+The program will stop at the given address.
+
@item
-Run the program.
+Set a breakpoint on a DLL subroutine.
@smallexample
-(gdb) run
+(gdb) break ada_dll.adb:45
+@end smallexample
+
+Or if you want to break using a symbol on the DLL, you need first to
+select the Ada language (language used by the DLL).
+
+@smallexample
+(gdb) set language ada
+(gdb) break ada_dll
+@end smallexample
+
+@item
+Continue the program.
+
+@smallexample
+(gdb) cont
@end smallexample
@noindent
@@ -28104,7 +28229,7 @@ that the process PID for @file{main.exe} is 208.
@item Launch gdb.
@smallexample
-$ gdb -nw
+$ gdb
@end smallexample
@item Attach to the running process to be debugged.
@@ -28128,7 +28253,7 @@ $ gdb -nw
@item Continue process execution.
@smallexample
-(gdb) continue
+(gdb) cont
@end smallexample
@end enumerate
diff --git a/gcc/ada/gnatbind.adb b/gcc/ada/gnatbind.adb
index 270d3342810..e9222c94595 100644
--- a/gcc/ada/gnatbind.adb
+++ b/gcc/ada/gnatbind.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -87,6 +87,9 @@ procedure Gnatbind is
-- All the one character arguments are still handled by Switch. This
-- routine handles -aO -aI and -I-.
+ function Is_Cross_Compiler return Boolean;
+ -- Returns True iff this is a cross-compiler
+
---------------------------------
-- Gnatbind_Supports_Auto_Init --
---------------------------------
@@ -99,6 +102,17 @@ procedure Gnatbind is
return gnat_binder_supports_auto_init /= 0;
end Gnatbind_Supports_Auto_Init;
+ -----------------------
+ -- Is_Cross_Compiler --
+ -----------------------
+
+ function Is_Cross_Compiler return Boolean is
+ Cross_Compiler : Integer;
+ pragma Import (C, Cross_Compiler, "__gnat_is_cross_compiler");
+ begin
+ return Cross_Compiler = 1;
+ end Is_Cross_Compiler;
+
----------------------------------
-- List_Applicable_Restrictions --
----------------------------------
@@ -350,8 +364,12 @@ procedure Gnatbind is
-- -Mname
elsif Argv'Length >= 3 and then Argv (2) = 'M' then
- Opt.Bind_Alternate_Main_Name := True;
- Opt.Alternate_Main_Name := new String'(Argv (3 .. Argv'Last));
+ if Is_Cross_Compiler then
+ Opt.Bind_Alternate_Main_Name := True;
+ Opt.Alternate_Main_Name := new String'(Argv (3 .. Argv'Last));
+ else
+ Fail ("-M option only valid for a cross-compiler");
+ end if;
-- All other options are single character and are handled by
-- Scan_Binder_Switches.
diff --git a/gcc/ada/gnatbind.ads b/gcc/ada/gnatbind.ads
index 359c513a25a..65f6f65d404 100644
--- a/gcc/ada/gnatbind.ads
+++ b/gcc/ada/gnatbind.ads
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/gnatchop.adb b/gcc/ada/gnatchop.adb
index 2a68776a5f8..eab7063253e 100644
--- a/gcc/ada/gnatchop.adb
+++ b/gcc/ada/gnatchop.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1998-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1163,8 +1163,7 @@ procedure Gnatchop is
Put (Standard_Error, "GNATCHOP ");
Put_Line (Standard_Error, Gnatvsn.Gnat_Version_String);
Put_Line
- (Standard_Error,
- "Copyright 1998-2005, Ada Core Technologies Inc.");
+ (Standard_Error, "Copyright 1998-2005, AdaCore");
when 'w' =>
Overwrite_Files := True;
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb
index c4137a95abd..3ef1ec700ad 100644
--- a/gcc/ada/gnatcmd.adb
+++ b/gcc/ada/gnatcmd.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -211,7 +211,7 @@ procedure GNATCmd is
-- Display usage for platforms other than VMS
procedure Process_Link;
- -- Process GNAT LINK, when there is a project file specified.
+ -- Process GNAT LINK, when there is a project file specified
procedure Set_Library_For
(Project : Project_Id;
diff --git a/gcc/ada/gnatdll.adb b/gcc/ada/gnatdll.adb
index c15154301cc..d133cf6e21e 100644
--- a/gcc/ada/gnatdll.adb
+++ b/gcc/ada/gnatdll.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2004, Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -63,7 +63,7 @@ procedure Gnatdll is
-- build the DLL.
Help : Boolean := False;
- -- Help will be set to True the usage information is to be displayed.
+ -- Help will be set to True the usage information is to be displayed
Version : constant String := Gnatvsn.Gnat_Version_String;
-- Why should it be necessary to make a copy of this
@@ -166,8 +166,6 @@ procedure Gnatdll is
procedure Parse_Command_Line is
- use GNAT.Command_Line;
-
procedure Add_File (Filename : in String);
-- Add one file to the list of file to handle
diff --git a/gcc/ada/gnatfind.adb b/gcc/ada/gnatfind.adb
index 677df83b43e..49b1e41419e 100644
--- a/gcc/ada/gnatfind.adb
+++ b/gcc/ada/gnatfind.adb
@@ -237,7 +237,7 @@ procedure Gnatfind is
procedure Write_Usage is
begin
Put_Line ("GNATFIND " & Gnatvsn.Gnat_Version_String);
- Put_Line ("Copyright 1998-2005, Ada Core Technologies Inc.");
+ Put_Line ("Copyright 1998-2005, AdaCore");
Put_Line ("Usage: gnatfind pattern[:sourcefile[:line[:column]]] "
& "[file1 file2 ...]");
New_Line;
diff --git a/gcc/ada/gnatlbr.adb b/gcc/ada/gnatlbr.adb
index 6652c5ff26b..7054d691ce9 100644
--- a/gcc/ada/gnatlbr.adb
+++ b/gcc/ada/gnatlbr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,7 +24,7 @@
-- --
------------------------------------------------------------------------------
--- Program to create, set, or delete an alternate runtime library.
+-- Program to create, set, or delete an alternate runtime library
-- Works by calling an appropriate target specific Makefile residing
-- in the default library object (e.g. adalib) directory from the context
@@ -222,7 +222,7 @@ begin
end;
end loop;
- -- "Make" an alternate sublibrary for each default sublibrary.
+ -- "Make" an alternate sublibrary for each default sublibrary
for Dirs in 1 .. Object_Dirs loop
Make_Args (1) :=
diff --git a/gcc/ada/gnatmake.ads b/gcc/ada/gnatmake.ads
index d69490d1507..15be53bd3f0 100644
--- a/gcc/ada/gnatmake.ads
+++ b/gcc/ada/gnatmake.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -25,8 +25,7 @@
------------------------------------------------------------------------------
procedure Gnatmake;
--- The driver for the gnatmake tool. This utility can be used to
--- automatically (re)compile a set of ada sources by giving the name
--- of the root compilation unit or the source file containing it.
--- For more information on gnatmake (its precise usage, flags and algorithm)
--- please refer to the body of gnatmake.
+-- The driver for the gnatmake tool. This utility can be used to automatically
+-- (re)compile a set of ada sources by giving the name of the root compilation
+-- unit or the source file containing it. For more information on gnatmake
+-- (its precise usage, flags and algorithm) please refer to the gnatmake body.
diff --git a/gcc/ada/gnatmem.adb b/gcc/ada/gnatmem.adb
index b6a4d7e58f2..d52fe005f34 100644
--- a/gcc/ada/gnatmem.adb
+++ b/gcc/ada/gnatmem.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 1997-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -233,7 +233,7 @@ procedure Gnatmem is
New_Line;
Put ("GNATMEM ");
Put_Line (Gnat_Version_String);
- Put_Line ("Copyright 1997-2005 Free Software Foundation, Inc.");
+ Put_Line ("Copyright 1997-2005, Free Software Foundation, Inc.");
New_Line;
Put_Line ("Usage: gnatmem switches [depth] exename");
diff --git a/gcc/ada/gnatprep.adb b/gcc/ada/gnatprep.adb
index 3e5d30b5054..47903e5954f 100644
--- a/gcc/ada/gnatprep.adb
+++ b/gcc/ada/gnatprep.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2003, Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -29,6 +29,7 @@ with GPrep;
procedure GNATprep is
pragma Ident (Gnatvsn.Gnat_Static_Version_String);
+
begin
-- Everything is done in GPrep
diff --git a/gcc/ada/gnatprep.ads b/gcc/ada/gnatprep.ads
index 06ca505bacf..d991ef5cea6 100644
--- a/gcc/ada/gnatprep.ads
+++ b/gcc/ada/gnatprep.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2002, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -142,9 +142,9 @@
-- may be used on a preprocessor line, but other than that, no other
-- tokens may appear on a preprocessor line.
--- Any number of #elsif clauses can be present, including none at all.
+-- Any number of #elsif clauses can be present, including none at all
--- The #else is optional, as in Ada.
+-- The #else is optional, as in Ada
-- The # marking the start of a preprocessor line must be the first
-- non-blank character on the line, i.e. it must be preceded only by
diff --git a/gcc/ada/gnatsym.adb b/gcc/ada/gnatsym.adb
index 63f46e1e7f6..f723d52a088 100644
--- a/gcc/ada/gnatsym.adb
+++ b/gcc/ada/gnatsym.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -78,7 +78,7 @@ procedure Gnatsym is
-- The name of the reference symbol file
Version_String : String_Access := Empty;
- -- The version of the library. Used on VMS.
+ -- The version of the library (used on VMS)
package Object_Files is new Table.Table
(Table_Component_Type => String_Access,
diff --git a/gcc/ada/gnatvsn.ads b/gcc/ada/gnatvsn.ads
index 80906a2642c..1013bd70d88 100644
--- a/gcc/ada/gnatvsn.ads
+++ b/gcc/ada/gnatvsn.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -74,7 +74,7 @@ package Gnatvsn is
-- value should never be decreased in the future, but it would be
-- OK to increase it if absolutely necessary.
- Library_Version : constant String := "4.0";
+ Library_Version : constant String := "4.1";
-- Library version. This value must be updated whenever any change to the
-- compiler affects the library formats in such a way as to obsolete
-- previously compiled library modules.
diff --git a/gcc/ada/gnatxref.adb b/gcc/ada/gnatxref.adb
index 12482681ad8..3d6ee75e8f6 100644
--- a/gcc/ada/gnatxref.adb
+++ b/gcc/ada/gnatxref.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -210,7 +210,7 @@ procedure Gnatxref is
procedure Write_Usage is
begin
Put_Line ("GNATXREF " & Gnatvsn.Gnat_Version_String);
- Put_Line ("Copyright 1998-2004, Ada Core Technologies Inc.");
+ Put_Line ("Copyright 1998-2005, AdaCore");
Put_Line ("Usage: gnatxref [switches] file1 file2 ...");
New_Line;
Put_Line (" file ... list of source files to xref, " &
diff --git a/gcc/ada/gprep.adb b/gcc/ada/gprep.adb
index 83cd12101f7..ebe5184204f 100644
--- a/gcc/ada/gprep.adb
+++ b/gcc/ada/gprep.adb
@@ -73,7 +73,7 @@ package body GPrep is
File_Name_Buffer_Initial_Size : constant := 50;
File_Name_Buffer : String_Access :=
new String (1 .. File_Name_Buffer_Initial_Size);
- -- A buffer to build output file names from input file names.
+ -- A buffer to build output file names from input file names
-----------------
-- Subprograms --
@@ -102,7 +102,7 @@ package body GPrep is
-- True if C is in 'a' .. 'z' or in 'A' .. 'Z'
procedure Double_File_Name_Buffer;
- -- Double the size of the file name buffer.
+ -- Double the size of the file name buffer
procedure Preprocess_Infile_Name;
-- When the specified output is a directory, preprocess the infile name
@@ -116,12 +116,12 @@ package body GPrep is
-- Process a -D switch on the command line
procedure Put_Char_To_Outfile (C : Character);
- -- Output one character to the output file.
- -- Used to initialize the preprocessor.
+ -- Output one character to the output file. Used to initialize the
+ -- preprocessor.
procedure New_EOL_To_Outfile;
- -- Output a new line to the output file.
- -- Used to initialize the preprocessor.
+ -- Output a new line to the output file. Used to initialize the
+ -- preprocessor.
procedure Scan_Command_Line;
-- Scan the switches and the file names
@@ -137,7 +137,7 @@ package body GPrep is
begin
if not Copyright_Displayed then
Write_Line ("GNAT Preprocessor " & Gnatvsn.Gnat_Version_String);
- Write_Line ("Copyright 1996-2004 Free Software Foundation, Inc.");
+ Write_Line ("Copyright 1996-2005, Free Software Foundation, Inc.");
Copyright_Displayed := True;
end if;
end Display_Copyright;
@@ -198,21 +198,23 @@ package body GPrep is
-- Test we had all the arguments needed
if Infile_Name = No_Name then
+
-- No input file specified, just output the usage and exit
Usage;
return;
elsif Outfile_Name = No_Name then
+
-- No output file specified, just output the usage and exit
Usage;
return;
end if;
- -- If a pragma Source_File_Name, we need to keep line numbers.
- -- So, if the deleted lines are not put as comment, we must output them
- -- as blank lines.
+ -- If a pragma Source_File_Name, we need to keep line numbers. So, if
+ -- the deleted lines are not put as comment, we must output them as
+ -- blank lines.
if Source_Ref_Pragma and (not Opt.Comment_Deleted_Lines) then
Opt.Blank_Deleted_Lines := True;
@@ -245,8 +247,7 @@ package body GPrep is
end;
end if;
- -- If there are errors in the definition file, output these errors
- -- and exit.
+ -- If there are errors in the definition file, output them and exit
if Total_Errors_Detected > 0 then
Errutil.Finalize (Source_Type => "definition");
@@ -281,7 +282,6 @@ package body GPrep is
-- rooted at the input directory.
Process_Files;
-
end Gnatprep;
---------------------
@@ -327,7 +327,7 @@ package body GPrep is
procedure Preprocess_Infile_Name is
Len : Natural;
- First : Positive := 1;
+ First : Positive;
Last : Natural;
Symbol : Name_Id;
Data : Symbol_Data;
@@ -346,6 +346,7 @@ package body GPrep is
-- Look for possible symbols in the file name
+ First := 1;
while First < Len loop
-- A symbol starts with a dollar sign followed by a letter
@@ -387,7 +388,7 @@ package body GPrep is
declare
Sym_Len : constant Positive := Last - First + 1;
- Offset : constant Integer := Name_Len - Sym_Len;
+ Offset : constant Integer := Name_Len - Sym_Len;
New_Len : constant Natural := Len + Offset;
begin
@@ -465,7 +466,7 @@ package body GPrep is
-- Outfile_Name.
procedure Recursive_Process (In_Dir : String; Out_Dir : String);
- -- Process recursively files in In_Dir. Results go to Out_Dir.
+ -- Process recursively files in In_Dir. Results go to Out_Dir
----------------------
-- Process_One_File --
@@ -475,7 +476,7 @@ package body GPrep is
Infile : Source_File_Index;
begin
- -- Create the output file; fails if this does not work.
+ -- Create the output file (fails if this does not work)
begin
Create (Text_Outfile, Out_File, Get_Name_String (Outfile_Name));
@@ -521,8 +522,7 @@ package body GPrep is
Errutil.Finalize (Source_Type => "input");
end if;
- -- If we had some errors, delete the output file, and report
- -- the errors.
+ -- If we had some errors, delete the output file, and report them
if Err_Vars.Total_Errors_Detected > 0 then
if Outfile /= Standard_Output then
@@ -533,7 +533,7 @@ package body GPrep is
OS_Exit (0);
- -- otherwise, close the output file, and we are done.
+ -- Otherwise, close the output file, and we are done
elsif Outfile /= Standard_Output then
Close (Text_Outfile);
@@ -564,6 +564,8 @@ package body GPrep is
Output_Directory := Out_Dir_Name;
end Set_Directory_Names;
+ -- Start of processing for Recursive_Process
+
begin
-- Open the current input directory
@@ -645,8 +647,11 @@ package body GPrep is
end loop;
end Recursive_Process;
+ -- Start of processing for Process_Files
+
begin
if Output_Directory = No_Name then
+
-- If the output is not a directory, fail if the input is
-- an existing directory, to avoid possible problems.
@@ -660,6 +665,7 @@ package body GPrep is
Process_One_File;
elsif Input_Directory = No_Name then
+
-- Get the output file name from the input file name, and process
-- the single input file.
@@ -697,7 +703,8 @@ package body GPrep is
loop
begin
- Switch := GNAT.Command_Line.Getopt ("D: b c r s u v");
+ Switch := GNAT.Command_Line.Getopt ("D: b c C r s u v");
+
case Switch is
when ASCII.NUL =>
@@ -713,6 +720,9 @@ package body GPrep is
when 'c' =>
Opt.Comment_Deleted_Lines := True;
+ when 'C' =>
+ Opt.Replace_In_Comments := True;
+
when 'r' =>
Source_Ref_Pragma := True;
@@ -780,6 +790,7 @@ package body GPrep is
Write_Line ("gnatprep switches:");
Write_Line (" -b Replace preprocessor lines by blank lines");
Write_Line (" -c Keep preprocessor lines as comments");
+ Write_Line (" -C Do symbol replacements within comments");
Write_Line (" -D Associate symbol with value");
Write_Line (" -r Generate Source_Reference pragma");
Write_Line (" -s Print a sorted list of symbol names and values");
diff --git a/gcc/ada/gprep.ads b/gcc/ada/gprep.ads
index 539d274b109..6a5a0d4153c 100644
--- a/gcc/ada/gprep.ads
+++ b/gcc/ada/gprep.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,7 +24,7 @@
-- --
------------------------------------------------------------------------------
--- This package is the implementation of GNATPREP.
+-- This package is the implementation of GNATPREP
package GPrep is
diff --git a/gcc/ada/gprmake.adb b/gcc/ada/gprmake.adb
index 3e5b30296b5..93c20a79542 100644
--- a/gcc/ada/gprmake.adb
+++ b/gcc/ada/gprmake.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,7 +24,7 @@
-- --
------------------------------------------------------------------------------
--- The driver for the gprmake tool.
+-- The driver for the gprmake tool
with Makegpr;
diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h
index f593acfaed4..a380788995a 100644
--- a/gcc/ada/gsocket.h
+++ b/gcc/ada/gsocket.h
@@ -55,6 +55,8 @@
#if defined(__vxworks)
#include <vxWorks.h>
#include <ioLib.h>
+#include <hostLib.h>
+#include <resolvLib.h>
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
@@ -131,7 +133,9 @@
#include <errno.h>
#endif
-#ifndef __vxworks
+#ifdef __vxworks
+#include <sys/times.h>
+#else
#include <sys/time.h>
#endif
diff --git a/gcc/ada/i-fortra.adb b/gcc/ada/i-fortra.adb
index 01f16ed3f80..5b37738fa5b 100644
--- a/gcc/ada/i-fortra.adb
+++ b/gcc/ada/i-fortra.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -39,14 +39,14 @@ package body Interfaces.Fortran is
-- Single character case
- function To_Ada (Item : in Character_Set) return Character is
+ function To_Ada (Item : Character_Set) return Character is
begin
return Character (Item);
end To_Ada;
-- String case (function returning converted result)
- function To_Ada (Item : in Fortran_Character) return String is
+ function To_Ada (Item : Fortran_Character) return String is
T : String (1 .. Item'Length);
begin
@@ -60,7 +60,7 @@ package body Interfaces.Fortran is
-- String case (procedure copying converted string to given buffer)
procedure To_Ada
- (Item : in Fortran_Character;
+ (Item : Fortran_Character;
Target : out String;
Last : out Natural)
is
@@ -93,14 +93,14 @@ package body Interfaces.Fortran is
-- Character case
- function To_Fortran (Item : in Character) return Character_Set is
+ function To_Fortran (Item : Character) return Character_Set is
begin
return Character_Set (Item);
end To_Fortran;
-- String case (function returning converted result)
- function To_Fortran (Item : in String) return Fortran_Character is
+ function To_Fortran (Item : String) return Fortran_Character is
T : Fortran_Character (1 .. Item'Length);
begin
@@ -114,7 +114,7 @@ package body Interfaces.Fortran is
-- String case (procedure copying converted string to given buffer)
procedure To_Fortran
- (Item : in String;
+ (Item : String;
Target : out Fortran_Character;
Last : out Natural)
is
diff --git a/gcc/ada/i-fortra.ads b/gcc/ada/i-fortra.ads
index 78f4f71256d..da330d2a4f7 100644
--- a/gcc/ada/i-fortra.ads
+++ b/gcc/ada/i-fortra.ads
@@ -45,19 +45,19 @@ package Interfaces.Fortran is
type Fortran_Character is array (Positive range <>) of Character_Set;
- function To_Fortran (Item : in Character) return Character_Set;
- function To_Ada (Item : in Character_Set) return Character;
+ function To_Fortran (Item : Character) return Character_Set;
+ function To_Ada (Item : Character_Set) return Character;
- function To_Fortran (Item : in String) return Fortran_Character;
- function To_Ada (Item : in Fortran_Character) return String;
+ function To_Fortran (Item : String) return Fortran_Character;
+ function To_Ada (Item : Fortran_Character) return String;
procedure To_Fortran
- (Item : in String;
+ (Item : String;
Target : out Fortran_Character;
Last : out Natural);
procedure To_Ada
- (Item : in Fortran_Character;
+ (Item : Fortran_Character;
Target : out String;
Last : out Natural);
diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb
index 1e859ef5fef..ff753ac0215 100644
--- a/gcc/ada/impunit.adb
+++ b/gcc/ada/impunit.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -334,29 +334,19 @@ package body Impunit is
"a-cgarso", -- Ada.Containers.Generic_Array_Sort
"a-cgcaso", -- Ada.Containers.Generic_Constrained_Array_Sort
"a-chacon", -- Ada.Characters.Conversions
- "a-chtgke", -- Ada.Containers.Hash_Tables.Generic_Keys
- "a-chtgop", -- Ada.Containers.Hash_Tables.Generic_Operations
"a-cidlli", -- Ada.Containers.Indefinite_Doubly_Linked_Lists
"a-cihama", -- Ada.Containers.Indefinite_Hashed_Maps
"a-cihase", -- Ada.Containers.Indefinite_Hashed_Sets
"a-ciorma", -- Ada.Containers.Indefinite_Ordered_Maps
- "a-ciormu", -- Ada.Containers.Indefinite_Ordered_Multisets
"a-ciorse", -- Ada.Containers.Indefinite_Ordered_Sets
"a-cohama", -- Ada.Containers.Hashed_Maps
"a-cohase", -- Ada.Containers.Hashed_Sets
- "a-cohata", -- Ada.Containers.Hash_Tables
"a-coinve", -- Ada.Containers.Indefinite_Vectors
"a-contai", -- Ada.Containers
"a-convec", -- Ada.Containers.Vectors
"a-coorma", -- Ada.Containers.Ordered_Maps
- "a-coormu", -- Ada.Containers.Ordered_Multisets
"a-coorse", -- Ada.Containers.Ordered_Sets
- "a-coprnu", -- Ada.Containers.Prime_Numbers
- "a-crbltr", -- Ada.Containers.Red_Black_Trees
- "a-crbtgk", -- Ada.Containers.Red_Black_Trees.Generic_Keys
- "a-crbtgo", -- Ada.Containers.Red_Black_Trees.Generic_Operations
"a-direct", -- Ada.Directories
- "a-rbtgso", -- Ada.Containers.Red_Black_Trees.Generic_Set_Operations
"a-secain", -- Ada.Strings.Equal_Case_Insensitive
"a-shcain", -- Ada.Strings.Hash_Case_Insensitive
"a-slcain", -- Ada.Strings.Less_Case_Insensitive
@@ -399,6 +389,8 @@ package body Impunit is
"a-chzla1", -- Ada.Characters.Wide_Wide_Latin_1
"a-chzla9", -- Ada.Characters.Wide_Wide_Latin_9
+ "a-ciormu", -- Ada.Containers.Indefinite_Ordered_Multisets
+ "a-coormu", -- Ada.Containers.Ordered_Multisets
"a-szuzti", -- Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Text_IO
"a-zchuni", -- Ada.Wide_Wide_Characters.Unicode
diff --git a/gcc/ada/indepsw.ads b/gcc/ada/indepsw.ads
index 4db3bcef90c..7296291b35d 100644
--- a/gcc/ada/indepsw.ads
+++ b/gcc/ada/indepsw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -56,7 +56,7 @@ package Indepsw is
-- for the platform; in this case, To is set to null.
function Is_Supported (Switch : Switch_Kind) return Boolean;
- -- Return True for each independent switch supported by the platform.
+ -- Return True for each independent switch supported by the platform
private
-- Default warning messages when the switches are not supported by the
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index a5018d4f4e0..7baa11bdaf3 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -1502,7 +1502,12 @@ __gnat_install_handler (void)
/* __gnat_error_prehandler is an assembly function. */
SYS$SETEXV (1, __gnat_error_prehandler, 3, &prvhnd);
#else
- SYS$SETEXV (1, __gnat_error_handler, 3, &prvhnd);
+#if defined (IN_RTS) && defined (__IA64)
+ if (getenv ("DBG$TDBG"))
+ printf ("DBG$TDBG defined, __gnat_error_handler not installed!\n");
+ else
+#endif
+ SYS$SETEXV (1, __gnat_error_handler, 3, &prvhnd);
#endif
__gnat_handler_installed = 1;
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index e5f0bf2086b..8b8004f5187 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -88,7 +88,7 @@ package body Inline is
type Subp_Index is new Nat;
No_Subp : constant Subp_Index := 0;
- -- The subprogram entities are hashed into the Inlined table.
+ -- The subprogram entities are hashed into the Inlined table
Num_Hash_Headers : constant := 512;
@@ -182,10 +182,10 @@ package body Inline is
To_Clean : Elist_Id;
procedure Add_Scope_To_Clean (Inst : Entity_Id);
- -- Build set of scopes on which cleanup actions must be performed.
+ -- Build set of scopes on which cleanup actions must be performed
procedure Cleanup_Scopes;
- -- Complete cleanup actions on scopes that need it.
+ -- Complete cleanup actions on scopes that need it
--------------
-- Add_Call --
@@ -215,7 +215,7 @@ package body Inline is
J := Successors.Table (J).Next;
end loop;
- -- On exit, make a successor entry for P2.
+ -- On exit, make a successor entry for P2
Successors.Increment_Last;
Successors.Table (Successors.Last).Subp := P2;
@@ -505,7 +505,7 @@ package body Inline is
J : Subp_Index;
procedure New_Entry;
- -- Initialize entry in Inlined table.
+ -- Initialize entry in Inlined table
procedure New_Entry is
begin
@@ -692,7 +692,8 @@ package body Inline is
then
Error_Msg_N
("& cannot be inlined?", Inlined.Table (Index).Name);
- -- A warning on the first one might be sufficient.
+
+ -- A warning on the first one might be sufficient ???
end if;
end loop;
diff --git a/gcc/ada/interfac.ads b/gcc/ada/interfac.ads
index 15cfd9c87bb..38e5cdab736 100644
--- a/gcc/ada/interfac.ads
+++ b/gcc/ada/interfac.ads
@@ -35,11 +35,6 @@
-- --
------------------------------------------------------------------------------
--- Assumes integer sizes of 8, 16, 32 and 64 are available, and that the
--- floating-point formats are IEEE compatible.
-
--- Note: There is a specialized version of this package for OpenVMS
-
package Interfaces is
pragma Pure;
@@ -153,17 +148,26 @@ package Interfaces is
pragma Import (Intrinsic, Rotate_Left);
pragma Import (Intrinsic, Rotate_Right);
- -- Floating point types. We assume that we are on an IEEE machine, and
- -- that the types Short_Float and Long_Float in Standard refer to the
- -- 32-bit short and 64-bit long IEEE forms. Furthermore, if there is
- -- an extended float, we assume that it is available as Long_Long_Float.
+ -- IEEE Floating point types. Note that the form of these definitions
+ -- ensures that the work on VMS, even if the standard library is compiled
+ -- using a Float_Representation pragma for Vax_Float.
+
+ pragma Warnings (Off);
+ -- Turn off warnings for targets not providing IEEE floating-point types
+
+ type IEEE_Float_32 is digits 6;
+ pragma Float_Representation (IEEE_Float, IEEE_Float_32);
+
+ type IEEE_Float_64 is digits 15;
+ pragma Float_Representation (IEEE_Float, IEEE_Float_64);
+
+ -- If there is an IEEE extended float available on the machine, we assume
+ -- that it is available as Long_Long_Float.
-- Note: it is harmless, and explicitly permitted, to include additional
-- types in interfaces, so it is not wrong to have IEEE_Extended_Float
-- defined even if the extended format is not available.
- type IEEE_Float_32 is new Short_Float;
- type IEEE_Float_64 is new Long_Float;
type IEEE_Extended_Float is new Long_Long_Float;
end Interfaces;
diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index 6f702c0f551..736dd0dc6b4 100644
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -950,7 +950,7 @@ package body Layout is
-- is the expression so far (which will be the body of the function).
Size : Val_Type;
- -- Value of size computed so far. See comments above.
+ -- Value of size computed so far. See comments above
Vtyp : Entity_Id := Empty;
-- Variant record type for the formal parameter of the
@@ -2356,7 +2356,7 @@ package body Layout is
if Is_Discrete_Type (E) then
- -- If the RM_Size is not set, then here is where we set it.
+ -- If the RM_Size is not set, then here is where we set it
-- Note: an RM_Size of zero looks like not set here, but this
-- is a rare case, and we can simply reset it without any harm.
diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb
index 76952b5ac72..e8065b46aad 100644
--- a/gcc/ada/lib-writ.adb
+++ b/gcc/ada/lib-writ.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -182,6 +182,9 @@ package body Lib.Writ is
-- Array of flags to show which units have pragma Elaborate All set
Elab_Des_Flags : array (Units.First .. Last_Unit) of Boolean;
+ -- Array of flags to show which units have Elaborate_Desirable set
+
+ Elab_All_Des_Flags : array (Units.First .. Last_Unit) of Boolean;
-- Array of flags to show which units have Elaborate_All_Desirable set
Sdep_Table : Unit_Ref_Table (1 .. Pos (Last_Unit - Units.First + 2));
@@ -229,11 +232,13 @@ package body Lib.Writ is
Item := First (Context_Items (Cunit));
while Present (Item) loop
+ -- Process with clause
+
-- Ada 2005 (AI-50217): limited with_clauses do not create
-- dependencies
if Nkind (Item) = N_With_Clause
- and then not (Limited_Present (Item))
+ and then not (Limited_Present (Item))
then
Unum := Get_Cunit_Unit_Number (Library_Unit (Item));
With_Flags (Unum) := True;
@@ -246,7 +251,11 @@ package body Lib.Writ is
Elab_All_Flags (Unum) := True;
end if;
- if Elaborate_All_Desirable (Cunit_Entity (Unum)) then
+ if Elaborate_All_Desirable (Item) then
+ Elab_All_Des_Flags (Unum) := True;
+ end if;
+
+ if Elaborate_Desirable (Item) then
Elab_Des_Flags (Unum) := True;
end if;
end if;
@@ -495,10 +504,11 @@ package body Lib.Writ is
-- Generate with lines, first those that are directly with'ed
for J in With_Flags'Range loop
- With_Flags (J) := False;
- Elab_Flags (J) := False;
- Elab_All_Flags (J) := False;
- Elab_Des_Flags (J) := False;
+ With_Flags (J) := False;
+ Elab_Flags (J) := False;
+ Elab_All_Flags (J) := False;
+ Elab_Des_Flags (J) := False;
+ Elab_All_Des_Flags (J) := False;
end loop;
Collect_Withs (Unode);
@@ -725,6 +735,10 @@ package body Lib.Writ is
if Elab_Des_Flags (Unum) then
Write_Info_Str (" ED");
end if;
+
+ if Elab_All_Des_Flags (Unum) then
+ Write_Info_Str (" AD");
+ end if;
end if;
Write_Info_EOL;
@@ -818,12 +832,10 @@ package body Lib.Writ is
begin
if Nkind (U) = N_Subprogram_Body
- or else (Nkind (U) = N_Package_Body
- and then
- (Nkind (Original_Node (U)) = N_Function_Instantiation
- or else
- Nkind (Original_Node (U)) =
- N_Procedure_Instantiation))
+ or else
+ (Nkind (U) = N_Package_Body
+ and then
+ Nkind (Original_Node (U)) in N_Subprogram_Instantiation)
then
-- If the unit is a subprogram instance, the entity for the
-- subprogram is the alias of the visible entity, which is the
diff --git a/gcc/ada/lib-writ.ads b/gcc/ada/lib-writ.ads
index 38124789187..90737ed1268 100644
--- a/gcc/ada/lib-writ.ads
+++ b/gcc/ada/lib-writ.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -462,7 +462,7 @@ package Lib.Writ is
-- Following each U line, is a series of lines of the form
- -- W unit-name [source-name lib-name] [E] [EA] [ED]
+ -- W unit-name [source-name lib-name] [E] [EA] [ED] [AD]
--
-- One of these lines is present for each unit that is mentioned in
-- an explicit with clause by the current unit. The first parameter
@@ -479,11 +479,17 @@ package Lib.Writ is
--
-- EA pragma Elaborate_All applies to this unit
--
- -- ED Elaborate_All_Desirable set for this unit, which means
+ -- ED Elaborate_Desirable set for this unit, which means
+ -- that there is no Elaborate, but the analysis suggests
+ -- that Program_Error may be raised if the Elaborate
+ -- conditions cannot be satisfied. The binder will attempt
+ -- to treat ED as E if it can.
+ --
+ -- AD Elaborate_All_Desirable set for this unit, which means
-- that there is no Elaborate_All, but the analysis suggests
-- that Program_Error may be raised if the Elaborate_All
-- conditions cannot be satisfied. The binder will attempt
- -- to treat ED as EA if it can.
+ -- to treat AD as EA if it can.
--
-- The parameter source-name and lib-name are omitted for the case
-- of a generic unit compiled with earlier versions of GNAT which
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index 7260b0cdcc4..1d0c8cbdc09 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -111,8 +111,13 @@ package body Lib.Xref is
if Opt.Xref_Active
-- Definition must come from source
+ -- We make an exception for subprogram child units that have no
+ -- spec. For these we generate a subprogram declaration for library
+ -- use, and the corresponding entity does not come from source.
+ -- Nevertheless, all references will be attached to it and we have
+ -- to treat is as coming from user code.
- and then Comes_From_Source (E)
+ and then (Comes_From_Source (E) or else Is_Child_Unit (E))
-- And must have a reasonable source location that is not
-- within an instance (all entities in instances are ignored)
@@ -518,6 +523,14 @@ package body Lib.Xref is
end if;
end loop;
+ -- The internally created defining entity for a child subprogram
+ -- that has no previous spec has valid references.
+
+ elsif Is_Overloadable (E)
+ and then Is_Child_Unit (E)
+ then
+ Ent := E;
+
-- Record components of discriminated subtypes or derived types
-- must be treated as references to the original component.
diff --git a/gcc/ada/live.adb b/gcc/ada/live.adb
index 1eb73fcca0a..df92d0d6e12 100644
--- a/gcc/ada/live.adb
+++ b/gcc/ada/live.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2002 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -58,7 +58,7 @@ package body Live is
-- The problem of finding live entities is solved in two steps:
procedure Mark (Root : Node_Id; Marks : out Name_Set);
- -- Mark all live entities in Root as Marked.
+ -- Mark all live entities in Root as Marked
procedure Sweep (Root : Node_Id; Marks : Name_Set);
-- For all unmarked entities in Root set Is_Eliminated to true
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index 7e4c80c65cd..3204154947d 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -250,10 +250,9 @@ package body Make is
Table_Increment => 100,
Table_Name => "Make.Library_Projs");
- -- Two variables to keep the last binder and linker switch index
- -- in tables Binder_Switches and Linker_Switches, before adding
- -- switches from the project file (if any) and switches from the
- -- command line (if any).
+ -- Two variables to keep the last binder and linker switch index in tables
+ -- Binder_Switches and Linker_Switches, before adding switches from the
+ -- project file (if any) and switches from the command line (if any).
Last_Binder_Switch : Integer := 0;
Last_Linker_Switch : Integer := 0;
@@ -281,9 +280,9 @@ package body Make is
-- The project id of the main project file, if any
Project_Object_Directory : Project_Id := No_Project;
- -- The object directory of the project for the last compilation.
- -- Avoid calling Change_Dir if the current working directory is already
- -- this directory
+ -- The object directory of the project for the last compilation. Avoid
+ -- calling Change_Dir if the current working directory is already this
+ -- directory
-- Packages of project files where unknown attributes are errors
@@ -303,16 +302,30 @@ package body Make is
Packages_To_Check_By_Gnatmake : constant String_List_Access :=
Gnatmake_Packages'Access;
+ procedure Add_Library_Search_Dir
+ (Path : String;
+ On_Command_Line : Boolean);
+ -- Call Add_Lib_Search_Dir with an absolute directory path. If Path is a
+ -- relative path, when On_Command_Line is True, it is relative to the
+ -- current working directory; when On_Command_Line is False, it is relative
+ -- to the project directory of the main project.
+
+ procedure Add_Source_Search_Dir
+ (Path : String;
+ On_Command_Line : Boolean);
+ -- Call Add_Src_Search_Dir with an absolute directory path. If Path is a
+ -- relative path, when On_Command_Line is True, it is relative to the
+ -- current working directory; when On_Command_Line is False, it is relative
+ -- to the project directory of the main project.
+
procedure Add_Source_Dir (N : String);
- -- Call Add_Src_Search_Dir.
- -- Output one line when in verbose mode.
+ -- Call Add_Src_Search_Dir (output one line when in verbose mode)
procedure Add_Source_Directories is
new Prj.Env.For_All_Source_Dirs (Action => Add_Source_Dir);
procedure Add_Object_Dir (N : String);
- -- Call Add_Lib_Search_Dir.
- -- Output one line when in verbose mode.
+ -- Call Add_Lib_Search_Dir (output one line when in verbose mode)
procedure Add_Object_Directories is
new Prj.Env.For_All_Object_Dirs (Action => Add_Object_Dir);
@@ -326,11 +339,10 @@ package body Make is
Unit : Unit_Name_Type;
Found : Boolean;
end record;
- -- File is the name of the file for which a compilation failed.
- -- Unit is for gnatdist use in order to easily get the unit name
- -- of a file when its name is krunched or declared in gnat.adc.
- -- Found is False if the compilation failed because the file could
- -- not be found.
+ -- File is the name of the file for which a compilation failed. Unit is for
+ -- gnatdist use in order to easily get the unit name of a file when its
+ -- name is krunched or declared in gnat.adc. Found is False if the
+ -- compilation failed because the file could not be found.
package Bad_Compilation is new Table.Table (
Table_Component_Type => Bad_Compilation_Info,
@@ -401,7 +413,7 @@ package body Make is
-- if an executable is up to date or not.
procedure Enter_Into_Obsoleted (F : Name_Id);
- -- Enter a file name, without directory information, into the has table
+ -- Enter a file name, without directory information, into the hash table
-- Obsoleted.
function Is_In_Obsoleted (F : Name_Id) return Boolean;
@@ -480,12 +492,14 @@ package body Make is
-- Prints out the list of all files for which the compilation failed
procedure Verbose_Msg
- (N1 : Name_Id;
- S1 : String;
- N2 : Name_Id := No_Name;
- S2 : String := "";
- Prefix : String := " -> ");
- -- If the verbose flag (Verbose_Mode) is set then print Prefix to standard
+ (N1 : Name_Id;
+ S1 : String;
+ N2 : Name_Id := No_Name;
+ S2 : String := "";
+ Prefix : String := " -> ";
+ Minimum_Verbosity : Verbosity_Level_Type := Opt.Low);
+ -- If the verbose flag (Verbose_Mode) is set and the verbosity level is
+ -- at least equal to Minimum_Verbosity, then print Prefix to standard
-- output followed by N1 and S1. If N2 /= No_Name then N2 is printed after
-- S1. S2 is printed last. Both N1 and N2 are printed in quotation marks.
@@ -504,6 +518,10 @@ package body Make is
Depth : Natural);
-- Compute depth of Project and of the projects it depends on
+ procedure Compute_All_Imported_Projects (Project : Project_Id);
+ -- Compute, the list of the projects imported directly or indirectly by
+ -- project Project.
+
-----------------------
-- Gnatmake Routines --
-----------------------
@@ -519,19 +537,18 @@ package body Make is
Ada_Lib_Dir : constant Lib_Mark_Type := 1;
-- Used to mark a directory as a GNAT lib dir
- -- Note that the notion of GNAT lib dir is no longer used. The code
- -- related to it has not been removed to give an idea on how to use
- -- the directory prefix marking mechanism.
+ -- Note that the notion of GNAT lib dir is no longer used. The code related
+ -- to it has not been removed to give an idea on how to use the directory
+ -- prefix marking mechanism.
- -- An Ada library directory is a directory containing ali and object
- -- files but no source files for the bodies (the specs can be in the
- -- same or some other directory). These directories are specified
- -- in the Gnatmake command line with the switch "-Adir" (to specify the
- -- spec location -Idir cab be used). Gnatmake skips the missing sources
- -- whose ali are in Ada library directories. For an explanation of why
- -- Gnatmake behaves that way, see the spec of Make.Compile_Sources.
- -- The directory lookup penalty is incurred every single time this
- -- routine is called.
+ -- An Ada library directory is a directory containing ali and object files
+ -- but no source files for the bodies (the specs can be in the same or some
+ -- other directory). These directories are specified in the Gnatmake
+ -- command line with the switch "-Adir" (to specify the spec location -Idir
+ -- cab be used). Gnatmake skips the missing sources whose ali are in Ada
+ -- library directories. For an explanation of why Gnatmake behaves that
+ -- way, see the spec of Make.Compile_Sources. The directory lookup penalty
+ -- is incurred every single time this routine is called.
procedure Check_Steps;
-- Check what steps (Compile, Bind, Link) must be executed.
@@ -542,10 +559,15 @@ package body Make is
-- table for this directory. Then check if an Ada lib mark has been set.
procedure Mark_Directory
- (Dir : String;
- Mark : Lib_Mark_Type);
- -- Store Dir in name table and set lib mark as name info to identify
- -- Ada libraries.
+ (Dir : String;
+ Mark : Lib_Mark_Type;
+ On_Command_Line : Boolean);
+ -- Store the absolute path from Dir in name table and set lib mark as name
+ -- info to identify Ada libraries.
+ --
+ -- If Dir is a relative path, when On_Command_Line is True, it is relative
+ -- to the current working directory; when On_Command_Line is False, it is
+ -- relative to the project directory of the main project.
Output_Is_Object : Boolean := True;
-- Set to False when using a switch -S for the compiler
@@ -561,12 +583,12 @@ package body Make is
Naming : Naming_Data;
In_Package : Package_Id;
Allow_ALI : Boolean) return Variable_Value;
- -- Return the switches for the source file in the specified package
- -- of a project file. If the Source_File ends with a standard GNAT
- -- extension (".ads" or ".adb"), try first the full name, then the
- -- name without the extension, then, if Allow_ALI is True, the name with
- -- the extension ".ali". If there is no switches for either names, try the
- -- default switches for Ada. If all failed, return No_Variable_Value.
+ -- Return the switches for the source file in the specified package of a
+ -- project file. If the Source_File ends with a standard GNAT extension
+ -- (".ads" or ".adb"), try first the full name, then the name without the
+ -- extension, then, if Allow_ALI is True, the name with the extension
+ -- ".ali". If there is no switches for either names, try the default
+ -- switches for Ada. If all failed, return No_Variable_Value.
function Is_In_Object_Directory
(Source_File : File_Name_Type;
@@ -785,6 +807,28 @@ package body Make is
Dependencies.Table (Dependencies.Last) := (S, On);
end Add_Dependency;
+ ----------------------------
+ -- Add_Library_Search_Dir --
+ ----------------------------
+
+ procedure Add_Library_Search_Dir
+ (Path : String;
+ On_Command_Line : Boolean)
+ is
+ begin
+ if On_Command_Line then
+ Add_Lib_Search_Dir
+ (Normalize_Pathname (Path));
+
+ else
+ Get_Name_String
+ (Project_Tree.Projects.Table (Main_Project).Directory);
+ Add_Lib_Search_Dir
+ (Normalize_Pathname
+ (Path, Name_Buffer (1 .. Name_Len)));
+ end if;
+ end Add_Library_Search_Dir;
+
--------------------
-- Add_Object_Dir --
--------------------
@@ -817,6 +861,28 @@ package body Make is
end if;
end Add_Source_Dir;
+ ---------------------------
+ -- Add_Source_Search_Dir --
+ ---------------------------
+
+ procedure Add_Source_Search_Dir
+ (Path : String;
+ On_Command_Line : Boolean)
+ is
+ begin
+ if On_Command_Line then
+ Add_Src_Search_Dir
+ (Normalize_Pathname (Path));
+
+ else
+ Get_Name_String
+ (Project_Tree.Projects.Table (Main_Project).Directory);
+ Add_Src_Search_Dir
+ (Normalize_Pathname
+ (Path, Name_Buffer (1 .. Name_Len)));
+ end if;
+ end Add_Source_Search_Dir;
+
----------------
-- Add_Switch --
----------------
@@ -838,7 +904,7 @@ package body Make is
-- Generic_Position --
----------------------
- procedure Generic_Position (New_Position : out Integer) is
+ procedure Generic_Position (New_Position : out Integer) is
begin
T.Increment_Last;
@@ -968,8 +1034,7 @@ package body Make is
if Name_Len > 0 then
declare
Argv : constant String := Name_Buffer (1 .. Name_Len);
- -- We need a copy, because Name_Buffer may be
- -- modified.
+ -- We need a copy, because Name_Buffer may be modified
begin
if Verbose_Mode then
@@ -1033,8 +1098,8 @@ package body Make is
Bind_Args (Args'Range) := Args;
end if;
- -- It is completely pointless to re-check source file time stamps.
- -- This has been done already by gnatmake
+ -- It is completely pointless to re-check source file time stamps. This
+ -- has been done already by gnatmake
Bind_Last := Bind_Last + 1;
Bind_Args (Bind_Last) := Do_Not_Check_Flag;
@@ -1142,9 +1207,9 @@ package body Make is
Spec_File_Name : File_Name_Type := No_File;
function New_Spec (Uname : Unit_Name_Type) return Boolean;
- -- Uname is the name of the spec or body of some ada unit.
- -- This function returns True if the Uname is the name of a body
- -- which has a spec not mentioned inali file A. If True is returned
+ -- Uname is the name of the spec or body of some ada unit. This
+ -- function returns True if the Uname is the name of a body which has
+ -- a spec not mentioned inali file A. If True is returned
-- Spec_File_Name above is set to the name of this spec file.
--------------
@@ -1262,9 +1327,9 @@ package body Make is
begin
pragma Assert (Lib_File /= No_File);
- -- If the ALI file is read-only, set temporarily
- -- Check_Object_Consistency to False: we don't care if the object file
- -- is not there; presumably, a library will be used for linking.
+ -- If ALI file is read-only, temporarily set Check_Object_Consistency to
+ -- False. We don't care if the object file is not there (presumably a
+ -- library will be used for linking.)
if Read_Only then
declare
@@ -1286,9 +1351,17 @@ package body Make is
Obj_Stamp := Current_Object_File_Stamp;
if Full_Lib_File = No_File then
- Verbose_Msg (Lib_File, "being checked ...", Prefix => " ");
+ Verbose_Msg
+ (Lib_File,
+ "being checked ...",
+ Prefix => " ",
+ Minimum_Verbosity => Opt.Medium);
else
- Verbose_Msg (Full_Lib_File, "being checked ...", Prefix => " ");
+ Verbose_Msg
+ (Full_Lib_File,
+ "being checked ...",
+ Prefix => " ",
+ Minimum_Verbosity => Opt.Medium);
end if;
ALI := No_ALI_Id;
@@ -1382,13 +1455,13 @@ package body Make is
for J in 1 .. Switches_To_Check.Last loop
- -- Comparing switches is delicate because gcc reorders
- -- a number of switches, according to lang-specs.h, but
- -- gnatmake doesn't have the sufficient knowledge to
- -- perform the same reordering. Instead, we ignore orders
- -- between different "first letter" switches, but keep
- -- orders between same switches, e.g -O -O2 is different
- -- than -O2 -O, but -g -O is equivalent to -O -g.
+ -- Comparing switches is delicate because gcc reorders a number
+ -- of switches, according to lang-specs.h, but gnatmake doesn't
+ -- have the sufficient knowledge to perform the same
+ -- reordering. Instead, we ignore orders between different
+ -- "first letter" switches, but keep orders between same
+ -- switches, e.g -O -O2 is different than -O2 -O, but -g -O is
+ -- equivalent to -O -g.
if Switches_To_Check.Table (J) (2) /= Prev_Switch (2) or else
(Prev_Switch'Length >= 6 and then
@@ -1561,7 +1634,7 @@ package body Make is
Name_Len := Name_Len - 1;
end loop;
- if Name_Len <= 0 then
+ if Name_Len = 0 then
return;
elsif Name_Buffer (1) = '-' then
@@ -2687,7 +2760,10 @@ package body Make is
and then In_Ada_Lib_Dir (Full_Lib_File)
then
Verbose_Msg
- (Lib_File, "is in an Ada library", Prefix => " ");
+ (Lib_File,
+ "is in an Ada library",
+ Prefix => " ",
+ Minimum_Verbosity => Opt.High);
-- If the library file is a read-only library skip it, but
-- only if, when using project files, this library file is
@@ -2701,7 +2777,10 @@ package body Make is
and then Is_In_Object_Directory (Source_File, Full_Lib_File)
then
Verbose_Msg
- (Lib_File, "is a read-only library", Prefix => " ");
+ (Lib_File,
+ "is a read-only library",
+ Prefix => " ",
+ Minimum_Verbosity => Opt.High);
-- The source file that we are checking cannot be located
@@ -2724,7 +2803,10 @@ package body Make is
end if;
Verbose_Msg
- (Lib_File, "is an internal library", Prefix => " ");
+ (Lib_File,
+ "is an internal library",
+ Prefix => " ",
+ Minimum_Verbosity => Opt.High);
-- The source file that we are checking can be located
@@ -2764,52 +2846,65 @@ package body Make is
end if;
else
- -- Is this the first file we have to compile?
+ -- Do nothing if project of source is externally built
- if First_Compiled_File = No_File then
- First_Compiled_File := Full_Source_File;
- Most_Recent_Obj_File := No_File;
+ if not Arguments_Collected then
+ Collect_Arguments (Source_File, Source_Index, Args);
+ end if;
- if Do_Not_Execute then
- exit Make_Loop;
+ if Arguments_Project = No_Project
+ or else not Project_Tree.Projects.Table
+ (Arguments_Project).Externally_Built
+ then
+ -- Is this the first file we have to compile?
+
+ if First_Compiled_File = No_File then
+ First_Compiled_File := Full_Source_File;
+ Most_Recent_Obj_File := No_File;
+
+ if Do_Not_Execute then
+ exit Make_Loop;
+ end if;
end if;
- end if;
- if In_Place_Mode then
+ if In_Place_Mode then
- -- If the library file was not found, then save the
- -- library file near the source file.
+ -- If the library file was not found, then save
+ -- the library file near the source file.
- if Full_Lib_File = No_File then
- Lib_File := Osint.Lib_File_Name
- (Full_Source_File, Source_Index);
+ if Full_Lib_File = No_File then
+ Lib_File := Osint.Lib_File_Name
+ (Full_Source_File, Source_Index);
- -- If the library file was found, then save the
- -- library file in the same place.
+ -- If the library file was found, then save the
+ -- library file in the same place.
- else
- Lib_File := Full_Lib_File;
- end if;
+ else
+ Lib_File := Full_Lib_File;
+ end if;
- end if;
+ end if;
- -- Start the compilation and record it. We can do this
- -- because there is at least one free process.
+ -- Start the compilation and record it. We can do
+ -- this because there is at least one free process.
- Collect_Arguments_And_Compile (Source_File, Source_Index);
+ Collect_Arguments_And_Compile
+ (Source_File, Source_Index);
- -- Make sure we could successfully start the compilation
+ -- Make sure we could successfully start
+ -- the Compilation.
- if Process_Created then
- if Pid = Invalid_Pid then
- Record_Failure (Full_Source_File, Source_Unit);
- else
- Add_Process
- (Pid,
- Full_Source_File,
- Lib_File,
- Source_Unit,
- Mfile);
+ if Process_Created then
+ if Pid = Invalid_Pid then
+ Record_Failure (Full_Source_File, Source_Unit);
+ else
+ Add_Process
+ (Pid,
+ Full_Source_File,
+ Lib_File,
+ Source_Unit,
+ Mfile);
+ end if;
end if;
end if;
end if;
@@ -3007,6 +3102,95 @@ package body Make is
end Compile_Sources;
+ -----------------------------------
+ -- Compute_All_Imported_Projects --
+ -----------------------------------
+
+ procedure Compute_All_Imported_Projects (Project : Project_Id) is
+ procedure Add_To_List (Prj : Project_Id);
+ -- Add a project to the list All_Imported_Projects of project Project
+
+ procedure Recursive_Add_Imported (Project : Project_Id);
+ -- Recursively add the projects imported by project Project, but not
+ -- those that are extended.
+
+ -----------------
+ -- Add_To_List --
+ -----------------
+
+ procedure Add_To_List (Prj : Project_Id) is
+ Element : constant Project_Element :=
+ (Prj, Project_Tree.Projects.Table (Project).All_Imported_Projects);
+ List : Project_List;
+ begin
+ Project_List_Table.Increment_Last (Project_Tree.Project_Lists);
+ List := Project_List_Table.Last (Project_Tree.Project_Lists);
+ Project_Tree.Project_Lists.Table (List) := Element;
+ Project_Tree.Projects.Table (Project).All_Imported_Projects := List;
+ end Add_To_List;
+
+ ----------------------------
+ -- Recursive_Add_Imported --
+ ----------------------------
+
+ procedure Recursive_Add_Imported (Project : Project_Id) is
+ List : Project_List;
+ Element : Project_Element;
+ Prj : Project_Id;
+
+ begin
+ if Project /= No_Project then
+
+ -- For all the imported projects
+
+ List := Project_Tree.Projects.Table (Project).Imported_Projects;
+ while List /= Empty_Project_List loop
+ Element := Project_Tree.Project_Lists.Table (List);
+ Prj := Element.Project;
+
+ -- Get the ultimate extending project
+
+ while
+ Project_Tree.Projects.Table (Prj).Extended_By /= No_Project
+ loop
+ Prj := Project_Tree.Projects.Table (Prj).Extended_By;
+ end loop;
+
+ -- If project has not yet been visited, add to list and recurse
+
+ if not Project_Tree.Projects.Table (Prj).Seen then
+ Project_Tree.Projects.Table (Prj).Seen := True;
+ Add_To_List (Prj);
+ Recursive_Add_Imported (Prj);
+ end if;
+
+ List := Element.Next;
+ end loop;
+
+ -- Recurse on projects being imported, if any
+
+ Recursive_Add_Imported
+ (Project_Tree.Projects.Table (Project).Extends);
+ end if;
+ end Recursive_Add_Imported;
+
+ begin
+ -- Reset the Seen flag for all projects
+
+ for Index in 1 .. Project_Table.Last (Project_Tree.Projects) loop
+ Project_Tree.Projects.Table (Index).Seen := False;
+ end loop;
+
+ -- Make sure the list is empty
+
+ Project_Tree.Projects.Table (Project).All_Imported_Projects :=
+ Empty_Project_List;
+
+ -- Add to the list all projects imported directly or indirectly
+
+ Recursive_Add_Imported (Project);
+ end Compute_All_Imported_Projects;
+
----------------------------------
-- Configuration_Pragmas_Switch --
----------------------------------
@@ -3757,17 +3941,25 @@ package body Make is
exit when not OK;
- -- Third line it the ALI path name,
- -- concatenation of the project
+ -- Third line it the ALI path name, concatenation
+ -- of either the library directory or the object
-- directory with the ALI file name.
declare
ALI : constant String :=
Get_Name_String (ALI_Name);
+ PD : Project_Data renames
+ Project_Tree.Projects.Table (ALI_Project);
+
begin
- Get_Name_String
- (Project_Tree.Projects.Table
- (ALI_Project).Object_Directory);
+ -- For library projects, use the library directory,
+ -- for other projects, use the object directory.
+
+ if PD.Library then
+ Get_Name_String (PD.Library_Dir);
+ else
+ Get_Name_String (PD.Object_Directory);
+ end if;
if Name_Buffer (Name_Len) /=
Directory_Separator
@@ -4797,17 +4989,51 @@ package body Make is
if Main_Project /= No_Project
and then MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None
- and then (Do_Bind_Step or Unique_Compile_All_Projects
- or not Compile_Only)
+ and then (Do_Bind_Step
+ or Unique_Compile_All_Projects
+ or not Compile_Only)
and then (Do_Link_Step or N_File = Osint.Number_Of_Files)
then
Library_Projs.Init;
declare
- Proj2 : Project_Id;
Depth : Natural;
Current : Natural;
+ procedure Add_To_Library_Projs (Proj : Project_Id);
+ -- Add project Project to table Library_Projs
+ -- in decreasing depth order.
+
+ --------------------------
+ -- Add_To_Library_Projs --
+ --------------------------
+
+ procedure Add_To_Library_Projs (Proj : Project_Id) is
+ Prj : Project_Id;
+
+ begin
+ Library_Projs.Increment_Last;
+ Depth := Project_Tree.Projects.Table (Proj).Depth;
+
+ -- Put the projects in decreasing depth order,
+ -- so that if libA depends on libB, libB is first
+ -- in order.
+
+ Current := Library_Projs.Last;
+ while Current > 1 loop
+ Prj := Library_Projs.Table (Current - 1);
+ exit when Project_Tree.Projects.Table
+ (Prj).Depth >= Depth;
+ Library_Projs.Table (Current) := Prj;
+ Current := Current - 1;
+ end loop;
+
+ Library_Projs.Table (Current) := Proj;
+ end Add_To_Library_Projs;
+
+ -- Start of processing for ??? (should name declare block
+ -- or probably better, break this out as a nested proc.
+
begin
-- Put in Library_Projs table all library project
-- file ids when the library need to be rebuilt.
@@ -4821,40 +5047,84 @@ package body Make is
There_Are_Stand_Alone_Libraries := True;
end if;
- if Project_Tree.Projects.Table (Proj1).Library
- and then not Project_Tree.Projects.Table
- (Proj1).Need_To_Build_Lib
- and then not Project_Tree.Projects.Table
- (Proj1).Externally_Built
- then
+ if Project_Tree.Projects.Table (Proj1).Library then
MLib.Prj.Check_Library (Proj1, Project_Tree);
end if;
if Project_Tree.Projects.Table
(Proj1).Need_To_Build_Lib
then
- Library_Projs.Increment_Last;
- Current := Library_Projs.Last;
- Depth := Project_Tree.Projects.Table
- (Proj1).Depth;
+ Add_To_Library_Projs (Proj1);
+ end if;
+ end loop;
- -- Put the projects in decreasing depth order,
- -- so that if libA depends on libB, libB is first
- -- in order.
+ -- Check if importing libraries should be regenerated
+ -- because at least an imported library will be
+ -- regenerated or is more recent.
- while Current > 1 loop
- Proj2 := Library_Projs.Table (Current - 1);
- exit when Project_Tree.Projects.Table
- (Proj2).Depth >= Depth;
- Library_Projs.Table (Current) := Proj2;
- Current := Current - 1;
- end loop;
-
- Library_Projs.Table (Current) := Proj1;
- Project_Tree.Projects.Table
- (Proj1).Need_To_Build_Lib := False;
+ for Proj1 in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
+ if Project_Tree.Projects.Table (Proj1).Library
+ and then not Project_Tree.Projects.Table
+ (Proj1).Need_To_Build_Lib
+ and then not Project_Tree.Projects.Table
+ (Proj1).Externally_Built
+ then
+ declare
+ List : Project_List;
+ Element : Project_Element;
+ Proj2 : Project_Id;
+ Rebuild : Boolean := False;
+
+ Lib_Timestamp1 : constant Time_Stamp_Type :=
+ Project_Tree.Projects.Table
+ (Proj1). Library_TS;
+
+ begin
+ List := Project_Tree.Projects.Table (Proj1).
+ All_Imported_Projects;
+ while List /= Empty_Project_List loop
+ Element :=
+ Project_Tree.Project_Lists.Table (List);
+ Proj2 := Element.Project;
+
+ if
+ Project_Tree.Projects.Table (Proj2).Library
+ then
+ if Project_Tree.Projects.Table (Proj2).
+ Need_To_Build_Lib
+ or else
+ (Lib_Timestamp1 <
+ Project_Tree.Projects.Table
+ (Proj2).Library_TS)
+ then
+ Rebuild := True;
+ exit;
+ end if;
+ end if;
+
+ List := Element.Next;
+ end loop;
+
+ if Rebuild then
+ Project_Tree.Projects.Table
+ (Proj1).Need_To_Build_Lib := True;
+ Add_To_Library_Projs (Proj1);
+ end if;
+ end;
end if;
end loop;
+
+ -- Reset the flags Need_To_Build_Lib for the next main,
+ -- to avoid rebuilding libraries uselessly.
+
+ for Proj1 in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
+ Project_Tree.Projects.Table
+ (Proj1).Need_To_Build_Lib := False;
+ end loop;
end;
-- Build the libraries, if any need to be built
@@ -5909,6 +6179,15 @@ package body Make is
Recursive_Compute_Depth
(Main_Project, Depth => 1);
+ -- For each project compute the list of the projects it imports
+ -- directly or indirectly.
+
+ for Proj in Project_Table.First ..
+ Project_Table.Last (Project_Tree.Projects)
+ loop
+ Compute_All_Imported_Projects (Proj);
+ end loop;
+
else
Osint.Add_Default_Search_Dirs;
@@ -6389,17 +6668,51 @@ package body Make is
--------------------
procedure Mark_Directory
- (Dir : String;
- Mark : Lib_Mark_Type)
+ (Dir : String;
+ Mark : Lib_Mark_Type;
+ On_Command_Line : Boolean)
is
N : Name_Id;
B : Byte;
begin
- -- Dir last character is supposed to be a directory separator
+ if On_Command_Line then
+ declare
+ Real_Path : constant String :=
+ Normalize_Pathname (Dir);
+
+ begin
+ if Real_Path'Length = 0 then
+ Name_Len := Dir'Length;
+ Name_Buffer (1 .. Name_Len) := Dir;
+
+ else
+ Name_Len := Real_Path'Length;
+ Name_Buffer (1 .. Name_Len) := Real_Path;
+ end if;
+ end;
+
+ else
+ declare
+ Real_Path : constant String :=
+ Normalize_Pathname
+ (Dir,
+ Get_Name_String
+ (Project_Tree.Projects.Table (Main_Project).Directory));
+
+ begin
+ if Real_Path'Length = 0 then
+ Name_Len := Dir'Length;
+ Name_Buffer (1 .. Name_Len) := Dir;
+
+ else
+ Name_Len := Real_Path'Length;
+ Name_Buffer (1 .. Name_Len) := Real_Path;
+ end if;
+ end;
+ end if;
- Name_Len := Dir'Length;
- Name_Buffer (1 .. Name_Len) := Dir;
+ -- Last character is supposed to be a directory separator
if not Is_Directory_Separator (Name_Buffer (Name_Len)) then
Name_Len := Name_Len + 1;
@@ -6623,11 +6936,11 @@ package body Make is
elsif Program_Args = Compiler then
if Argv (3 .. Argv'Last) /= "-" then
- Add_Src_Search_Dir (Argv (3 .. Argv'Last));
+ Add_Source_Search_Dir (Argv (3 .. Argv'Last), And_Save);
end if;
elsif Program_Args = Binder then
- Add_Lib_Search_Dir (Argv (3 .. Argv'Last));
+ Add_Library_Search_Dir (Argv (3 .. Argv'Last), And_Save);
end if;
end if;
@@ -6787,15 +7100,15 @@ package body Make is
-- -Idir
elsif Argv (2) = 'I' then
- Add_Src_Search_Dir (Argv (3 .. Argv'Last));
- Add_Lib_Search_Dir (Argv (3 .. Argv'Last));
+ Add_Source_Search_Dir (Argv (3 .. Argv'Last), And_Save);
+ Add_Library_Search_Dir (Argv (3 .. Argv'Last), And_Save);
Add_Switch (Argv, Compiler, And_Save => And_Save);
Add_Switch (Argv, Binder, And_Save => And_Save);
-- -aIdir (to gcc this is like a -I switch)
elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aI" then
- Add_Src_Search_Dir (Argv (4 .. Argv'Last));
+ Add_Source_Search_Dir (Argv (4 .. Argv'Last), And_Save);
Add_Switch ("-I" & Argv (4 .. Argv'Last),
Compiler,
And_Save => And_Save);
@@ -6804,14 +7117,14 @@ package body Make is
-- -aOdir
elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aO" then
- Add_Lib_Search_Dir (Argv (4 .. Argv'Last));
+ Add_Library_Search_Dir (Argv (4 .. Argv'Last), And_Save);
Add_Switch (Argv, Binder, And_Save => And_Save);
-- -aLdir (to gnatbind this is like a -aO switch)
elsif Argv'Length >= 3 and then Argv (2 .. 3) = "aL" then
- Mark_Directory (Argv (4 .. Argv'Last), Ada_Lib_Dir);
- Add_Lib_Search_Dir (Argv (4 .. Argv'Last));
+ Mark_Directory (Argv (4 .. Argv'Last), Ada_Lib_Dir, And_Save);
+ Add_Library_Search_Dir (Argv (4 .. Argv'Last), And_Save);
Add_Switch ("-aO" & Argv (4 .. Argv'Last),
Binder,
And_Save => And_Save);
@@ -6819,9 +7132,9 @@ package body Make is
-- -Adir (to gnatbind this is like a -aO switch, to gcc like a -I)
elsif Argv (2) = 'A' then
- Mark_Directory (Argv (3 .. Argv'Last), Ada_Lib_Dir);
- Add_Src_Search_Dir (Argv (3 .. Argv'Last));
- Add_Lib_Search_Dir (Argv (3 .. Argv'Last));
+ Mark_Directory (Argv (3 .. Argv'Last), Ada_Lib_Dir, And_Save);
+ Add_Source_Search_Dir (Argv (3 .. Argv'Last), And_Save);
+ Add_Library_Search_Dir (Argv (3 .. Argv'Last), And_Save);
Add_Switch ("-I" & Argv (3 .. Argv'Last),
Compiler,
And_Save => And_Save);
@@ -7041,6 +7354,9 @@ package body Make is
and then Argv (2 .. Argv'Last) /= "F"
and then Argv (2 .. Argv'Last) /= "M"
and then Argv (2 .. Argv'Last) /= "B"
+ and then Argv (2 .. Argv'Last) /= "vl"
+ and then Argv (2 .. Argv'Last) /= "vm"
+ and then Argv (2 .. Argv'Last) /= "vh"
and then (Argv'Length > 2 or else Argv (2) not in 'a' .. 'z')
then
Add_Switch (Argv, Compiler, And_Save => And_Save);
@@ -7189,14 +7505,15 @@ package body Make is
-----------------
procedure Verbose_Msg
- (N1 : Name_Id;
- S1 : String;
- N2 : Name_Id := No_Name;
- S2 : String := "";
- Prefix : String := " -> ")
+ (N1 : Name_Id;
+ S1 : String;
+ N2 : Name_Id := No_Name;
+ S2 : String := "";
+ Prefix : String := " -> ";
+ Minimum_Verbosity : Verbosity_Level_Type := Opt.Low)
is
begin
- if not Verbose_Mode then
+ if (not Verbose_Mode) or else (Minimum_Verbosity > Verbosity_Level) then
return;
end if;
diff --git a/gcc/ada/make.ads b/gcc/ada/make.ads
index 76b952af38e..f5c4d25d10c 100644
--- a/gcc/ada/make.ads
+++ b/gcc/ada/make.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -75,13 +75,13 @@ package Make is
-- is raised. These need to be handled by the calling routines.
Compilation_Failed : exception;
- -- Raised by Compile_Sources if a compilation failed.
+ -- Raised by Compile_Sources if a compilation failed
Bind_Failed : exception;
- -- Raised by Bind below if the bind failed.
+ -- Raised by Bind below if the bind failed
Link_Failed : exception;
- -- Raised by Link below if the link failed.
+ -- Raised by Link below if the link failed
procedure Bind (ALI_File : File_Name_Type; Args : Argument_List);
-- Binds ALI_File. Args are the arguments to pass to the binder.
@@ -96,13 +96,13 @@ package Make is
-- Compile_Sources can be called by an external unit.
procedure Scan_Make_Arg (Argv : String; And_Save : Boolean);
- -- Scan make arguments. Argv is a single argument to be processed.
+ -- Scan make arguments. Argv is a single argument to be processed
procedure Extract_Failure
(File : out File_Name_Type;
Unit : out Unit_Name_Type;
Found : out Boolean);
- -- Extracts the first failure report from Bad_Compilation table.
+ -- Extracts the first failure report from Bad_Compilation table
procedure Compile_Sources
(Main_Source : File_Name_Type;
diff --git a/gcc/ada/makegpr.adb b/gcc/ada/makegpr.adb
index 951e77815fd..2e8f5c22355 100644
--- a/gcc/ada/makegpr.adb
+++ b/gcc/ada/makegpr.adb
@@ -129,7 +129,7 @@ package body Makegpr is
-- ar commands.
Archive_Indexer_Path : String_Access := null;
- -- The path name of the archive indexer (ranlib), if it exists.
+ -- The path name of the archive indexer (ranlib), if it exists
Copyright_Output : Boolean := False;
Usage_Output : Boolean := False;
@@ -356,7 +356,7 @@ package body Makegpr is
procedure Add_Argument (Arg : String_Access; Display : Boolean);
procedure Add_Argument (Arg : String; Display : Boolean);
- -- Add an argument to Arguments. Reallocate if necessary.
+ -- Add an argument to Arguments. Reallocate if necessary
procedure Add_Arguments (Args : Argument_List; Display : Boolean);
-- Add a list of arguments to Arguments. Reallocate if necessary
@@ -2015,7 +2015,7 @@ package body Makegpr is
end if;
end;
- -- If the source path name ends the line, we are done.
+ -- If the source path name ends the line, we are done
exit Line_Loop when Finish = Last;
@@ -2609,7 +2609,7 @@ package body Makegpr is
-- Keep_Going is True, to inhibit the building of the archive.
Need_To_Compile : Boolean;
- -- Set to True when a source needs to be compiled/recompiled.
+ -- Set to True when a source needs to be compiled/recompiled
Need_To_Rebuild_Archive : Boolean := Force_Compilations;
-- True when the archive needs to be built/rebuilt unconditionally
@@ -3217,7 +3217,10 @@ package body Makegpr is
-- If -c was not specified, link the executables,
-- if there are any.
- if not Compile_Only and then not Data.Library then
+ if not Compile_Only
+ and then not Data.Library
+ and then Data.Object_Directory /= No_Name
+ then
Build_Global_Archive;
Link_Executables;
end if;
@@ -3677,7 +3680,7 @@ package body Makegpr is
-- project. Any main that is not a source of the other languages
-- will be deemed to be an Ada main.
- -- Find the mains of the other languages and the Ada mains.
+ -- Find the mains of the other languages and the Ada mains
Mains.Reset;
Ada_Mains.Set_Last (0);
diff --git a/gcc/ada/makegpr.ads b/gcc/ada/makegpr.ads
index 308a1928511..d9de44a5c2c 100644
--- a/gcc/ada/makegpr.ads
+++ b/gcc/ada/makegpr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -30,6 +30,6 @@
package Makegpr is
procedure Gprmake;
- -- The driver of gprmake.
+ -- The driver of gprmake
end Makegpr;
diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb
index d65dfea5cff..f64aae3d1e9 100644
--- a/gcc/ada/makeutl.adb
+++ b/gcc/ada/makeutl.adb
@@ -57,7 +57,7 @@ package body Makeutl is
Key => Mark_Key,
Hash => Hash,
Equal => "=");
- -- A hash table to keep tracks of the marked units.
+ -- A hash table to keep tracks of the marked units
type Linker_Options_Data is record
Project : Project_Id;
diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads
index a4c8135c89b..d69adb2f628 100644
--- a/gcc/ada/makeutl.ads
+++ b/gcc/ada/makeutl.ads
@@ -113,7 +113,7 @@ package Makeutl is
function Is_Marked
(Source_File : File_Name_Type;
Index : Int := 0) return Boolean;
- -- Returns True if the unit was previously marked.
+ -- Returns True if the unit was previously marked
procedure Delete_All_Marks;
-- Remove all file/index couples marked
diff --git a/gcc/ada/mdll-fil.adb b/gcc/ada/mdll-fil.adb
index 73de7e0981e..11f56f37653 100644
--- a/gcc/ada/mdll-fil.adb
+++ b/gcc/ada/mdll-fil.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,7 +24,7 @@
-- --
------------------------------------------------------------------------------
--- Simple services used by GNATDLL to deal with Filename extension.
+-- Simple services used by GNATDLL to deal with Filename extension
with Ada.Strings.Fixed;
diff --git a/gcc/ada/mdll-fil.ads b/gcc/ada/mdll-fil.ads
index ed8c106c4f2..15c0678399d 100644
--- a/gcc/ada/mdll-fil.ads
+++ b/gcc/ada/mdll-fil.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,7 @@ package MDLL.Fil is
-- Return extension of Filename
function Is_Ali (Filename : String) return Boolean;
- -- Test if Filename is an Ada library file (.ali).
+ -- Test if Filename is an Ada library file (.ali)
function Is_Obj (Filename : String) return Boolean;
-- Test if Filename is an object file (.o or .obj)
diff --git a/gcc/ada/mdll-utl.ads b/gcc/ada/mdll-utl.ads
index 9074a19141f..1d1f33a827f 100644
--- a/gcc/ada/mdll-utl.ads
+++ b/gcc/ada/mdll-utl.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -44,7 +44,7 @@ package MDLL.Utl is
Options : Argument_List;
Base_File : String := "";
Build_Lib : Boolean := False);
- -- Run gcc binary.
+ -- Run gcc binary
procedure Gnatbind
(Alis : Argument_List;
diff --git a/gcc/ada/mdll.adb b/gcc/ada/mdll.adb
index dde515cc6b6..a9cf026083b 100644
--- a/gcc/ada/mdll.adb
+++ b/gcc/ada/mdll.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -154,18 +154,20 @@ package body MDLL is
-- 5) Build the dynamic library
declare
- Params : OS_Lib.Argument_List :=
- Adr_Opt'Unchecked_Access & All_Options;
+ Params : constant OS_Lib.Argument_List :=
+ Map_Opt'Unchecked_Access &
+ Adr_Opt'Unchecked_Access & All_Options;
+ First_Param : Positive := Params'First + 1;
begin
if Map_File then
- Params := Map_Opt'Unchecked_Access & Params;
+ First_Param := Params'First;
end if;
Utl.Gcc
(Output_File => Dll_File,
Files => Objects_Exp_File,
- Options => Params,
+ Options => Params (First_Param .. Params'Last),
Build_Lib => True);
end;
@@ -252,20 +254,25 @@ package body MDLL is
Utl.Gnatbind (L_Afiles, Options & Bargs_Options);
declare
- Params : OS_Lib.Argument_List :=
- Out_Opt'Unchecked_Access &
- Dll_File'Unchecked_Access &
- Lib_Opt'Unchecked_Access &
- Exp_File'Unchecked_Access &
- Adr_Opt'Unchecked_Access &
- Ofiles &
- All_Options;
+ Params : constant OS_Lib.Argument_List :=
+ Map_Opt'Unchecked_Access &
+ Out_Opt'Unchecked_Access &
+ Dll_File'Unchecked_Access &
+ Lib_Opt'Unchecked_Access &
+ Exp_File'Unchecked_Access &
+ Adr_Opt'Unchecked_Access &
+ Ofiles &
+ All_Options;
+ First_Param : Positive := Params'First + 1;
+
begin
if Map_File then
- Params := Map_Opt'Unchecked_Access & Params;
+ First_Param := Params'First;
end if;
- Utl.Gnatlink (L_Afiles (L_Afiles'Last).all, Params);
+ Utl.Gnatlink
+ (L_Afiles (L_Afiles'Last).all,
+ Params (First_Param .. Params'Last));
end;
OS_Lib.Delete_File (Exp_File, Success);
diff --git a/gcc/ada/memroot.adb b/gcc/ada/memroot.adb
index fa4819cbe83..cdd4feb0009 100644
--- a/gcc/ada/memroot.adb
+++ b/gcc/ada/memroot.adb
@@ -27,7 +27,6 @@
with GNAT.Table;
with GNAT.HTable; use GNAT.HTable;
with Ada.Text_IO; use Ada.Text_IO;
-with System.Storage_Elements; use System.Storage_Elements;
package body Memroot is
diff --git a/gcc/ada/memroot.ads b/gcc/ada/memroot.ads
index 747ccac8e29..abddc135239 100644
--- a/gcc/ada/memroot.ads
+++ b/gcc/ada/memroot.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 1997-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -39,7 +39,7 @@ with System.Storage_Elements; use System.Storage_Elements;
package Memroot is
- -- Simple abstract type for names. A name is a sequence of letters.
+ -- Simple abstract type for names. A name is a sequence of letters
type Name_Id is new Natural;
No_Name_Id : constant Name_Id := 0;
diff --git a/gcc/ada/memtrack.adb b/gcc/ada/memtrack.adb
index 38649e6fc76..ce613950ba9 100644
--- a/gcc/ada/memtrack.adb
+++ b/gcc/ada/memtrack.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -53,7 +53,7 @@
-- gnatmem -i gmem.out program
--- See gnatmem section in the GNAT User's Guide for more details.
+-- See gnatmem section in the GNAT User's Guide for more details
-- NOTE: This capability is currently supported on the following targets:
@@ -120,13 +120,13 @@ package body System.Memory is
pragma Import (C, fclose);
procedure Finalize;
- -- Replace the default __gnat_finalize to properly close the log file.
pragma Export (C, Finalize, "__gnat_finalize");
+ -- Replace the default __gnat_finalize to properly close the log file
- Address_Size : constant := System.Address'Max_Size_In_Storage_Elements;
+ Address_Size : constant := System.Address'Max_Size_In_Storage_Elements;
-- Size in bytes of a pointer
- Max_Call_Stack : constant := 200;
+ Max_Call_Stack : constant := 200;
-- Maximum number of frames supported
Tracebk : aliased array (0 .. Max_Call_Stack) of Traceback_Entry;
@@ -137,7 +137,7 @@ package body System.Memory is
-- ??? What about Ada.Command_Line.Command_Name & ".out" instead of static
-- gmem.out
- Gmemfile : File_Ptr;
+ Gmemfile : File_Ptr;
-- Global C file pointer to the allocation log
procedure Gmem_Initialize;
diff --git a/gcc/ada/mlib-fil.adb b/gcc/ada/mlib-fil.adb
index e6359b3ba52..3144451a9de 100644
--- a/gcc/ada/mlib-fil.adb
+++ b/gcc/ada/mlib-fil.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001, Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/mlib-fil.ads b/gcc/ada/mlib-fil.ads
index f72587bf6e5..44460ca0d9c 100644
--- a/gcc/ada/mlib-fil.ads
+++ b/gcc/ada/mlib-fil.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001, Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,10 +32,10 @@ package MLib.Fil is
(Filename : String;
New_Ext : String := "")
return String;
- -- Return Filename with the extension change to New_Ext.
+ -- Return Filename with the extension change to New_Ext
function Get_Ext (Filename : String) return String;
- -- Return extension of filename.
+ -- Return extension of filename
function Is_Archive (Filename : String) return Boolean;
-- Test if filename is an archive
diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb
index 2a2d858e5d1..8169f6b0752 100644
--- a/gcc/ada/mlib-prj.adb
+++ b/gcc/ada/mlib-prj.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -139,7 +139,7 @@ package body MLib.Prj is
Table_Initial => 50,
Table_Increment => 100);
- -- List of options set in the command line.
+ -- List of options set in the command line
Options : Argument_List_Access;
@@ -182,7 +182,7 @@ package body MLib.Prj is
Hash => Hash,
Equal => "=");
- -- The projects imported directly or indirectly.
+ -- The projects imported directly or indirectly
package Processed_Projects is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num,
@@ -192,7 +192,7 @@ package body MLib.Prj is
Hash => Hash,
Equal => "=");
- -- The library projects imported directly or indirectly.
+ -- The library projects imported directly or indirectly
package Library_Projs is new Table.Table (
Table_Component_Type => Project_Id,
@@ -205,22 +205,18 @@ package body MLib.Prj is
type Build_Mode_State is (None, Static, Dynamic, Relocatable);
procedure Add_Argument (S : String);
- -- Add one argument to the array Arguments.
- -- If Arguments is full, double its size.
+ -- Add one argument to Arguments array, if array is full, double its size
function ALI_File_Name (Source : String) return String;
- -- Return the ALI file name corresponding to a source.
+ -- Return the ALI file name corresponding to a source
procedure Check (Filename : String);
- -- Check if filename is a regular file. Fail if it is not.
+ -- Check if filename is a regular file. Fail if it is not
procedure Check_Context;
-- Check each object files in table Object_Files
-- Fail if any of them is not a regular file
- procedure Clean (Directory : Name_Id);
- -- Attempt to delete all files in Directory, but not subdirectories
-
procedure Copy_Interface_Sources
(For_Project : Project_Id;
In_Tree : Project_Tree_Ref;
@@ -244,6 +240,12 @@ package body MLib.Prj is
-- Indicate if Stand-Alone Libraries are automatically initialized using
-- the constructor mechanism.
+ function Ultimate_Extension_Of
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Project_Id;
+ -- Returns the Project_Id of project Project. Returns No_Project
+ -- if Project is No_Project.
+
------------------
-- Add_Argument --
------------------
@@ -360,9 +362,6 @@ package body MLib.Prj is
-- If null, Path Option is not supported.
-- Not a constant so that it can be deallocated.
- Copy_Dir : Name_Id;
- -- Directory where to copy ALI files and possibly interface sources
-
First_ALI : Name_Id := No_Name;
-- Store the ALI file name of a source of the library (the first found)
@@ -1395,7 +1394,7 @@ package body MLib.Prj is
declare
DLL_Name : aliased String :=
- Lib_Dirpath.all & "/lib" &
+ Lib_Dirpath.all & '/' & DLL_Prefix &
Lib_Filename.all & "." & DLL_Ext;
Archive_Name : aliased String :=
@@ -1477,14 +1476,120 @@ package body MLib.Prj is
end;
end if;
- -- Clean the library directory, if it is also the directory where
- -- the ALI files are copied, either because there is no interface
- -- copy directory or because the interface copy directory is the
- -- same as the library directory.
+ declare
+ Current_Dir : constant String := Get_Current_Dir;
+ Dir : Dir_Type;
+
+ Name : String (1 .. 200);
+ Last : Natural;
+
+ Disregard : Boolean;
+
+ DLL_Name : aliased constant String :=
+ Lib_Filename.all & "." & DLL_Ext;
+
+ Archive_Name : aliased constant String :=
+ Lib_Filename.all & "." & Archive_Ext;
+
+ Delete : Boolean := False;
+
+ begin
+ -- Clean the library directory: remove any file with the name of
+ -- the library file and any ALI file of a source of the project.
+
+ begin
+ Get_Name_String
+ (In_Tree.Projects.Table (For_Project).Library_Dir);
+ Change_Dir (Name_Buffer (1 .. Name_Len));
+
+ exception
+ when others =>
+ Com.Fail
+ ("unable to access library directory """,
+ Name_Buffer (1 .. Name_Len),
+ """");
+ end;
+
+ Open (Dir, ".");
+
+ loop
+ Read (Dir, Name, Last);
+ exit when Last = 0;
+
+ if Is_Regular_File (Name (1 .. Last)) then
+ Canonical_Case_File_Name (Name (1 .. Last));
+ Delete := False;
+
+ if (The_Build_Mode = Static and then
+ Name (1 .. Last) = Archive_Name)
+ or else
+ ((The_Build_Mode = Dynamic or else
+ The_Build_Mode = Relocatable)
+ and then
+ Name (1 .. Last) = DLL_Name)
+ then
+ Delete := True;
+
+ elsif Last > 4 and then Name (Last - 3 .. Last) = ".ali" then
+ declare
+ Unit : Unit_Data;
+ begin
+ -- Compare with ALI file names of the project
+
+ for Index in 1 .. Unit_Table.Last (In_Tree.Units) loop
+ Unit := In_Tree.Units.Table (Index);
+
+ if Unit.File_Names (Body_Part).Project /=
+ No_Project
+ then
+ if Ultimate_Extension_Of
+ (Unit.File_Names (Body_Part).Project, In_Tree)
+ = For_Project
+ then
+ Get_Name_String
+ (Unit.File_Names (Body_Part).Name);
+ Name_Len := Name_Len -
+ File_Extension
+ (Name (1 .. Name_Len))'Length;
+ if Name_Buffer (1 .. Name_Len) =
+ Name (1 .. Last - 4)
+ then
+ Delete := True;
+ exit;
+ end if;
+ end if;
+
+ elsif Ultimate_Extension_Of
+ (Unit.File_Names (Specification).Project, In_Tree)
+ = For_Project
+ then
+ Get_Name_String
+ (Unit.File_Names (Specification).Name);
+ Name_Len := Name_Len -
+ File_Extension (Name (1 .. Name_Len))'Length;
+
+ if Name_Buffer (1 .. Name_Len) =
+ Name (1 .. Last - 4)
+ then
+ Delete := True;
+ exit;
+ end if;
+ end if;
+ end loop;
+ end;
+ end if;
+
+ if Delete then
+ Set_Writable (Name (1 .. Last));
+ Delete_File (Name (1 .. Last), Disregard);
+ end if;
+ end if;
+ end loop;
- Copy_Dir :=
- In_Tree.Projects.Table (For_Project).Library_Dir;
- Clean (Copy_Dir);
+ Close (Dir);
+
+ Change_Dir (Current_Dir);
+ end;
-- Call procedure to build the library, depending on the build mode
@@ -1516,7 +1621,7 @@ package body MLib.Prj is
end case;
-- We need to copy the ALI files from the object directory to
- -- the library directory, so that the linker find them there,
+ -- the library ALI directory, so that the linker find them there,
-- and does not need to look in the object directory where it
-- would also find the object files; and we don't want that:
-- we want the linker to use the library.
@@ -1526,7 +1631,7 @@ package body MLib.Prj is
Copy_ALI_Files
(Files => Ali_Files.all,
- To => Copy_Dir,
+ To => In_Tree.Projects.Table (For_Project).Library_ALI_Dir,
Interfaces => Arguments (1 .. Argument_Number));
-- Copy interface sources if Library_Src_Dir specified
@@ -1535,23 +1640,89 @@ package body MLib.Prj is
and then In_Tree.Projects.Table
(For_Project).Library_Src_Dir /= No_Name
then
- -- Clean the interface copy directory, if it is not also the
- -- library directory. If it is also the library directory, it
- -- has already been cleaned before generation of the library.
+ -- Clean the interface copy directory: remove any source that
+ -- could be a source of the project.
- if In_Tree.Projects.Table
- (For_Project).Library_Src_Dir /= Copy_Dir
- then
- Copy_Dir := In_Tree.Projects.Table
- (For_Project).Library_Src_Dir;
- Clean (Copy_Dir);
- end if;
+ begin
+ Get_Name_String
+ (In_Tree.Projects.Table (For_Project).Library_Src_Dir);
+ Change_Dir (Name_Buffer (1 .. Name_Len));
+
+ exception
+ when others =>
+ Com.Fail
+ ("unable to access library source copy directory """,
+ Name_Buffer (1 .. Name_Len),
+ """");
+ end;
+
+ declare
+ Dir : Dir_Type;
+ Delete : Boolean;
+ Unit : Unit_Data;
+
+ Name : String (1 .. 200);
+ Last : Natural;
+
+ Disregard : Boolean;
+
+ begin
+ Open (Dir, ".");
+
+ loop
+ Read (Dir, Name, Last);
+ exit when Last = 0;
+
+ if Is_Regular_File (Name (1 .. Last)) then
+ Canonical_Case_File_Name (Name (1 .. Last));
+ Delete := False;
+
+ -- Compare with source file names of the project
+
+ for Index in 1 .. Unit_Table.Last (In_Tree.Units) loop
+ Unit := In_Tree.Units.Table (Index);
+
+ if Ultimate_Extension_Of
+ (Unit.File_Names (Body_Part).Project, In_Tree) =
+ For_Project
+ and then
+ Get_Name_String
+ (Unit.File_Names (Body_Part).Name) =
+ Name (1 .. Last)
+ then
+ Delete := True;
+ exit;
+ end if;
+
+ if Ultimate_Extension_Of
+ (Unit.File_Names (Specification).Project, In_Tree) =
+ For_Project
+ and then
+ Get_Name_String
+ (Unit.File_Names (Specification).Name) =
+ Name (1 .. Last)
+ then
+ Delete := True;
+ exit;
+ end if;
+ end loop;
+ end if;
+
+ if Delete then
+ Set_Writable (Name (1 .. Last));
+ Delete_File (Name (1 .. Last), Disregard);
+ end if;
+ end loop;
+
+ Close (Dir);
+ end;
Copy_Interface_Sources
(For_Project => For_Project,
In_Tree => In_Tree,
Interfaces => Arguments (1 .. Argument_Number),
- To_Dir => Copy_Dir);
+ To_Dir => In_Tree.Projects.Table
+ (For_Project).Library_Src_Dir);
end if;
end if;
@@ -1591,130 +1762,84 @@ package body MLib.Prj is
procedure Check_Library
(For_Project : Project_Id; In_Tree : Project_Tree_Ref)
is
- Data : constant Project_Data :=
- In_Tree.Projects.Table (For_Project);
+ Data : constant Project_Data :=
+ In_Tree.Projects.Table (For_Project);
+ Lib_TS : Time_Stamp_Type;
+ Current : constant Dir_Name_Str := Get_Current_Dir;
begin
-- No need to build the library if there is no object directory,
-- hence no object files to build the library.
- if Data.Library
- and then not Data.Need_To_Build_Lib
- and then Data.Object_Directory /= No_Name
- then
+ if Data.Library then
declare
- Current : constant Dir_Name_Str := Get_Current_Dir;
Lib_Name : constant Name_Id :=
- Library_File_Name_For (For_Project, In_Tree);
- Lib_TS : Time_Stamp_Type;
- Obj_TS : Time_Stamp_Type;
-
- Object_Dir : Dir_Type;
-
+ Library_File_Name_For (For_Project, In_Tree);
begin
- if Hostparm.OpenVMS then
- B_Start (B_Start'Last) := '$';
- end if;
-
Change_Dir (Get_Name_String (Data.Library_Dir));
-
Lib_TS := File_Stamp (Lib_Name);
+ In_Tree.Projects.Table (For_Project).Library_TS := Lib_TS;
+ end;
- -- If the library file does not exist, then the time stamp will
- -- be Empty_Time_Stamp, earlier than any other time stamp.
-
- Change_Dir (Get_Name_String (Data.Object_Directory));
- Open (Dir => Object_Dir, Dir_Name => ".");
-
- -- For all entries in the object directory
-
- loop
- Read (Object_Dir, Name_Buffer, Name_Len);
- exit when Name_Len = 0;
-
- -- Check if it is an object file, but ignore any binder
- -- generated file.
-
- if Is_Obj (Name_Buffer (1 .. Name_Len))
- and then Name_Buffer (1 .. B_Start'Length) /= B_Start
- then
- -- Get the object file time stamp
-
- Obj_TS := File_Stamp (Name_Find);
-
- -- If library file time stamp is earlier, set
- -- Need_To_Build_Lib and return. String comparaison is used,
- -- otherwise time stamps may be too close and the
- -- comparaison would return True, which would trigger
- -- an unnecessary rebuild of the library.
-
- if String (Lib_TS) < String (Obj_TS) then
-
- -- Library must be rebuilt
+ if not Data.Externally_Built
+ and then not Data.Need_To_Build_Lib
+ and then Data.Object_Directory /= No_Name
+ then
+ declare
+ Obj_TS : Time_Stamp_Type;
+ Object_Dir : Dir_Type;
- In_Tree.Projects.Table
- (For_Project).Need_To_Build_Lib := True;
- exit;
- end if;
+ begin
+ if Hostparm.OpenVMS then
+ B_Start (B_Start'Last) := '$';
end if;
- end loop;
- Change_Dir (Current);
- end;
- end if;
- end Check_Library;
+ -- If the library file does not exist, then the time stamp will
+ -- be Empty_Time_Stamp, earlier than any other time stamp.
- -----------
- -- Clean --
- -----------
-
- procedure Clean (Directory : Name_Id) is
- Current : constant Dir_Name_Str := Get_Current_Dir;
-
- Dir : Dir_Type;
+ Change_Dir (Get_Name_String (Data.Object_Directory));
+ Open (Dir => Object_Dir, Dir_Name => ".");
- Name : String (1 .. 200);
- Last : Natural;
+ -- For all entries in the object directory
- Disregard : Boolean;
+ loop
+ Read (Object_Dir, Name_Buffer, Name_Len);
+ exit when Name_Len = 0;
- begin
- Get_Name_String (Directory);
+ -- Check if it is an object file, but ignore any binder
+ -- generated file.
- -- Change the working directory to the directory to clean
+ if Is_Obj (Name_Buffer (1 .. Name_Len))
+ and then Name_Buffer (1 .. B_Start'Length) /= B_Start
+ then
+ -- Get the object file time stamp
- begin
- Change_Dir (Name_Buffer (1 .. Name_Len));
+ Obj_TS := File_Stamp (Name_Find);
- exception
- when others =>
- Com.Fail
- ("unable to access directory """,
- Name_Buffer (1 .. Name_Len),
- """");
- end;
+ -- If library file time stamp is earlier, set
+ -- Need_To_Build_Lib and return. String comparaison is
+ -- used, otherwise time stamps may be too close and the
+ -- comparaison would return True, which would trigger
+ -- an unnecessary rebuild of the library.
- Open (Dir, ".");
+ if String (Lib_TS) < String (Obj_TS) then
- -- For each regular file in the directory, make it writable and
- -- delete the file.
+ -- Library must be rebuilt
- loop
- Read (Dir, Name, Last);
- exit when Last = 0;
+ In_Tree.Projects.Table
+ (For_Project).Need_To_Build_Lib := True;
+ exit;
+ end if;
+ end if;
+ end loop;
- if Is_Regular_File (Name (1 .. Last)) then
- Set_Writable (Name (1 .. Last));
- Delete_File (Name (1 .. Last), Disregard);
+ Close (Object_Dir);
+ end;
end if;
- end loop;
-
- Close (Dir);
- -- Restore the initial working directory
-
- Change_Dir (Current);
- end Clean;
+ Change_Dir (Current);
+ end if;
+ end Check_Library;
----------------------------
-- Copy_Interface_Sources --
@@ -1749,8 +1874,7 @@ package body MLib.Prj is
function Is_Same_Or_Extension
(Extending : Project_Id;
- Extended : Project_Id)
- return Boolean;
+ Extended : Project_Id) return Boolean;
-- Return True if project Extending is equal to or extends project
-- Extended.
@@ -1793,8 +1917,7 @@ package body MLib.Prj is
function Is_Same_Or_Extension
(Extending : Project_Id;
- Extended : Project_Id)
- return Boolean
+ Extended : Project_Id) return Boolean
is
Ext : Project_Id := Extending;
@@ -2075,4 +2198,27 @@ package body MLib.Prj is
return C_SALs_Init_Using_Constructors /= 0;
end SALs_Use_Constructors;
+ ---------------------------
+ -- Ultimate_Extension_Of --
+ ---------------------------
+
+ function Ultimate_Extension_Of
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Project_Id
+ is
+ Result : Project_Id := Project;
+ Data : Project_Data;
+
+ begin
+ if Project /= No_Project then
+ loop
+ Data := In_Tree.Projects.Table (Result);
+ exit when Data.Extended_By = No_Project;
+ Result := Data.Extended_By;
+ end loop;
+ end if;
+
+ return Result;
+ end Ultimate_Extension_Of;
+
end MLib.Prj;
diff --git a/gcc/ada/mlib-prj.ads b/gcc/ada/mlib-prj.ads
index 8d5383cdcea..d1c7d8cabc2 100644
--- a/gcc/ada/mlib-prj.ads
+++ b/gcc/ada/mlib-prj.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/mlib-tgt-aix.adb b/gcc/ada/mlib-tgt-aix.adb
index 80b3a4b7d64..86fd3934ffa 100644
--- a/gcc/ada/mlib-tgt-aix.adb
+++ b/gcc/ada/mlib-tgt-aix.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 2003-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -28,15 +28,13 @@
-- This package provides a set of target dependent routines to build
-- static, dynamic or relocatable libraries.
--- This is the AIX version of the body.
+-- This is the AIX version of the body
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
-with GNAT.OS_Lib; use GNAT.OS_Lib;
with MLib.Fil;
with MLib.Utl;
with Namet; use Namet;
-with Osint; use Osint;
with Opt;
with Output; use Output;
with Prj.Com;
@@ -152,7 +150,7 @@ package body MLib.Tgt is
Write_Line (Lib_File);
end if;
- -- Look for -lgnarl in Options. If found, set the thread options.
+ -- Look for -lgnarl in Options. If found, set the thread options
for J in Options'Range loop
if Options (J).all = "-lgnarl" then
@@ -219,6 +217,15 @@ package body MLib.Tgt is
return "a";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-darwin.adb b/gcc/ada/mlib-tgt-darwin.adb
index a152ed322a8..651f9838d39 100644
--- a/gcc/ada/mlib-tgt-darwin.adb
+++ b/gcc/ada/mlib-tgt-darwin.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -28,7 +28,7 @@
-- This package provides a set of target dependent routines to build
-- static, dynamic and shared libraries.
--- This is the Darwin version of the body.
+-- This is the Darwin version of the body
with MLib.Fil;
with MLib.Utl;
@@ -199,6 +199,15 @@ package body MLib.Tgt is
return "dylib";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-hpux.adb b/gcc/ada/mlib-tgt-hpux.adb
index 62172c79eae..85e756ce8df 100644
--- a/gcc/ada/mlib-tgt-hpux.adb
+++ b/gcc/ada/mlib-tgt-hpux.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 2003-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -28,7 +28,7 @@
-- This package provides a set of target dependent routines to build
-- libraries (static only on HP-UX).
--- This is the HP-UX version of the body.
+-- This is the HP-UX version of the body
with MLib.Fil;
with MLib.Utl;
@@ -197,6 +197,15 @@ package body MLib.Tgt is
return "sl";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-irix.adb b/gcc/ada/mlib-tgt-irix.adb
index 7a77bff7493..d7749a9cd97 100644
--- a/gcc/ada/mlib-tgt-irix.adb
+++ b/gcc/ada/mlib-tgt-irix.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 2003-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -28,7 +28,7 @@
-- This package provides a set of target dependent routines to build
-- static, dynamic and shared libraries.
--- This is the IRIX version of the body.
+-- This is the IRIX version of the body
with MLib.Fil;
with MLib.Utl;
@@ -235,6 +235,15 @@ package body MLib.Tgt is
return "so";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-linux.adb b/gcc/ada/mlib-tgt-linux.adb
index 70fde48500c..ca205b68f65 100644
--- a/gcc/ada/mlib-tgt-linux.adb
+++ b/gcc/ada/mlib-tgt-linux.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -28,7 +28,7 @@
-- This package provides a set of target dependent routines to build
-- static, dynamic and shared libraries.
--- This is the GNU/Linux version of the body.
+-- This is the GNU/Linux version of the body
with MLib.Fil;
with MLib.Utl;
@@ -194,6 +194,15 @@ package body MLib.Tgt is
return "so";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-lynxos.adb b/gcc/ada/mlib-tgt-lynxos.adb
index f1cab5f78ff..98fac4359bd 100644
--- a/gcc/ada/mlib-tgt-lynxos.adb
+++ b/gcc/ada/mlib-tgt-lynxos.adb
@@ -125,6 +125,15 @@ package body MLib.Tgt is
return "";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-mingw.adb b/gcc/ada/mlib-tgt-mingw.adb
index 98a5de88012..f350d2e0153 100644
--- a/gcc/ada/mlib-tgt-mingw.adb
+++ b/gcc/ada/mlib-tgt-mingw.adb
@@ -31,8 +31,6 @@
-- This is the Windows version of the body. Works only with GCC versions
-- supporting the "-shared" option.
-with GNAT.OS_Lib; use GNAT.OS_Lib;
-
with Namet; use Namet;
with Opt;
with Output; use Output;
@@ -148,6 +146,15 @@ package body MLib.Tgt is
return "dll";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-solaris.adb b/gcc/ada/mlib-tgt-solaris.adb
index 40d918edd13..c97d0b15f06 100644
--- a/gcc/ada/mlib-tgt-solaris.adb
+++ b/gcc/ada/mlib-tgt-solaris.adb
@@ -191,6 +191,15 @@ package body MLib.Tgt is
return "so";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-tru64.adb b/gcc/ada/mlib-tgt-tru64.adb
index b6d954902df..33ed98b56ae 100644
--- a/gcc/ada/mlib-tgt-tru64.adb
+++ b/gcc/ada/mlib-tgt-tru64.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -28,7 +28,7 @@
-- This package provides a set of target dependent routines to build
-- static, dynamic and shared libraries.
--- This is the True64 version of the body.
+-- This is the True64 version of the body
with MLib.Fil;
with MLib.Utl;
@@ -201,6 +201,15 @@ package body MLib.Tgt is
return "so";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-vms-alpha.adb b/gcc/ada/mlib-tgt-vms-alpha.adb
index 8c414b0a9e6..6dbc09e5e35 100644
--- a/gcc/ada/mlib-tgt-vms-alpha.adb
+++ b/gcc/ada/mlib-tgt-vms-alpha.adb
@@ -30,7 +30,6 @@
with Ada.Characters.Handling; use Ada.Characters.Handling;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
-with GNAT.OS_Lib; use GNAT.OS_Lib;
with MLib.Fil;
with MLib.Utl;
@@ -540,6 +539,15 @@ package body MLib.Tgt is
return "exe";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-vms-ia64.adb b/gcc/ada/mlib-tgt-vms-ia64.adb
index 35c6c155fb9..f72b4b93e04 100644
--- a/gcc/ada/mlib-tgt-vms-ia64.adb
+++ b/gcc/ada/mlib-tgt-vms-ia64.adb
@@ -30,7 +30,6 @@
with Ada.Characters.Handling; use Ada.Characters.Handling;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
-with GNAT.OS_Lib; use GNAT.OS_Lib;
with MLib.Fil;
with MLib.Utl;
@@ -573,6 +572,15 @@ package body MLib.Tgt is
return "exe";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt-vxworks.adb b/gcc/ada/mlib-tgt-vxworks.adb
index 659349a37a6..69ed03b372c 100644
--- a/gcc/ada/mlib-tgt-vxworks.adb
+++ b/gcc/ada/mlib-tgt-vxworks.adb
@@ -134,6 +134,15 @@ package body MLib.Tgt is
return "";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt.adb b/gcc/ada/mlib-tgt.adb
index adccc606840..c1bca97ef2b 100644
--- a/gcc/ada/mlib-tgt.adb
+++ b/gcc/ada/mlib-tgt.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -120,6 +120,15 @@ package body MLib.Tgt is
return "";
end DLL_Ext;
+ ----------------
+ -- DLL_Prefix --
+ ----------------
+
+ function DLL_Prefix return String is
+ begin
+ return "lib";
+ end DLL_Prefix;
+
--------------------
-- Dynamic_Option --
--------------------
diff --git a/gcc/ada/mlib-tgt.ads b/gcc/ada/mlib-tgt.ads
index 4ae46ce62d6..5bc175e94a7 100644
--- a/gcc/ada/mlib-tgt.ads
+++ b/gcc/ada/mlib-tgt.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -82,6 +82,10 @@ package MLib.Tgt is
-- System dependent object extension, without leadien dot.
-- On Unix, returns "o".
+ function DLL_Prefix return String;
+ -- System dependent dynamic library prefix.
+ -- On Windows, returns "". On other platforms, returns "lib".
+
function DLL_Ext return String;
-- System dependent dynamic library extension, without leading dot.
-- On Windows, returns "dll". On Unix, usually returns "so", but not
diff --git a/gcc/ada/mlib-utl.adb b/gcc/ada/mlib-utl.adb
index 794d2861d58..f6512b494bf 100644
--- a/gcc/ada/mlib-utl.adb
+++ b/gcc/ada/mlib-utl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2004, Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/mlib-utl.ads b/gcc/ada/mlib-utl.ads
index bbc895d7e69..bb38c8018b2 100644
--- a/gcc/ada/mlib-utl.ads
+++ b/gcc/ada/mlib-utl.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005, Ada Core Technologies, Inc --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/mlib.adb b/gcc/ada/mlib.adb
index 338a304ab12..549578a25b2 100644
--- a/gcc/ada/mlib.adb
+++ b/gcc/ada/mlib.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005, Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -34,6 +34,8 @@ with Namet; use Namet;
with MLib.Utl; use MLib.Utl;
+with Prj.Com;
+
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
package body MLib is
@@ -67,24 +69,24 @@ package body MLib is
procedure Check_Library_Name (Name : String) is
begin
if Name'Length = 0 then
- Fail ("library name cannot be empty");
+ Prj.Com.Fail ("library name cannot be empty");
end if;
if Name'Length > Max_Characters_In_Library_Name then
- Fail ("illegal library name """, Name, """: too long");
+ Prj.Com.Fail ("illegal library name """, Name, """: too long");
end if;
if not Is_Letter (Name (Name'First)) then
- Fail ("illegal library name """,
- Name,
- """: should start with a letter");
+ Prj.Com.Fail ("illegal library name """,
+ Name,
+ """: should start with a letter");
end if;
for Index in Name'Range loop
if not Is_Alphanumeric (Name (Index)) then
- Fail ("illegal library name """,
- Name,
- """: should include only letters and digits");
+ Prj.Com.Fail ("illegal library name """,
+ Name,
+ """: should include only letters and digits");
end if;
end loop;
end Check_Library_Name;
@@ -273,7 +275,7 @@ package body MLib is
end;
if not Success then
- Fail ("could not copy ALI files to library dir");
+ Prj.Com.Fail ("could not copy ALI files to library dir");
end if;
end loop;
end if;
diff --git a/gcc/ada/mlib.ads b/gcc/ada/mlib.ads
index d93a8140785..c993d8e9539 100644
--- a/gcc/ada/mlib.ads
+++ b/gcc/ada/mlib.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2004, Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/namet.h b/gcc/ada/namet.h
index 15bf1d6a564..59be47af6a7 100644
--- a/gcc/ada/namet.h
+++ b/gcc/ada/namet.h
@@ -6,7 +6,7 @@
* *
* C Header File *
* *
- * Copyright (C) 1992-2003 Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2005 Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -111,15 +111,20 @@ extern Boolean Is_Non_Ada_Error (Entity_Id);
/* Here are some functions in sinput.adb we call from a-trans.c. */
typedef Nat Source_File_Index;
typedef Int Logical_Line_Number;
+typedef Int Column_Number;
#define Debug_Source_Name sinput__debug_source_name
#define Full_Debug_Name sinput__full_debug_name
#define Reference_Name sinput__reference_name
#define Get_Source_File_Index sinput__get_source_file_index
#define Get_Logical_Line_Number sinput__get_logical_line_number
+#define Get_Column_Number sinput__get_column_number
+#define Instantiation sinput__instantiation
extern File_Name_Type Debug_Source_Name (Source_File_Index);
extern File_Name_Type Full_Debug_Name (Source_File_Index);
extern File_Name_Type Reference_Name (Source_File_Index);
extern Source_File_Index Get_Source_File_Index (Source_Ptr);
extern Logical_Line_Number Get_Logical_Line_Number (Source_Ptr);
+extern Column_Number Get_Column_Number (Source_Ptr);
+extern Source_Ptr Instantiation (Source_File_Index);
diff --git a/gcc/ada/nlists.adb b/gcc/ada/nlists.adb
index 577b668870d..5d4ef38e83f 100644
--- a/gcc/ada/nlists.adb
+++ b/gcc/ada/nlists.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/nlists.ads b/gcc/ada/nlists.ads
index 25fe4334f1b..533b5a8be8c 100644
--- a/gcc/ada/nlists.ads
+++ b/gcc/ada/nlists.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index d0b1d431bfa..69cd038e124 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -34,7 +34,7 @@
-- This package contains global flags set by the initialization routine from
-- the command line and referenced throughout the compiler, the binder, or
-- other GNAT tools. The comments indicate which options are used by which
--- programs (GNAT, GNATBIND, GNATMAKE, etc).
+-- programs (GNAT, GNATBIND, GNATLINK, GNATMAKE, GPRMAKE, etc).
with Gnatvsn; use Gnatvsn;
with Hostparm; use Hostparm;
@@ -61,8 +61,12 @@ package Opt is
-- Set True if binder file to be generated in Ada rather than C
type Ada_Version_Type is (Ada_83, Ada_95, Ada_05);
+ pragma Warnings (Off, Ada_Version_Type);
-- Versions of Ada for Ada_Version below. Note that these are ordered,
-- so that tests like Ada_Version >= Ada_95 are legitimate and useful.
+ -- The Warnings_Off pragma stops warnings for Ada_Version >= Ada_05,
+ -- which we want to allow, so that things work OK when Ada_15 is added!
+ -- This warning is now removed, so this pragma can be removed some time???
Ada_Version_Default : Ada_Version_Type := Ada_95;
-- GNAT
@@ -148,7 +152,7 @@ package Opt is
-- it ON. It is set ON when Tree_Output is set ON, it can also be set ON
-- from the code of GNSA-based tool (a client may need to set ON the
-- Back_Annotate_Rep_Info flag in this case. At the moment this does not
- -- make very much sense, because GNSA can not do back annotation).
+ -- make very much sense, because GNSA cannot do back annotation).
Back_Annotate_Rep_Info : Boolean := False;
-- GNAT
@@ -173,7 +177,7 @@ package Opt is
-- building a library. May be set to True by Gnatbind.Scan_Bind_Arg.
Bind_Only : Boolean := False;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE
-- Set to True to skip compile and link steps
-- (except when Compile_Only and/or Link_Only are True).
@@ -218,7 +222,7 @@ package Opt is
-- directly modified by gnatmake, to affect the shared binder routines.
Check_Switches : Boolean := False;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE
-- Set to True to check compiler options during the make process
Check_Unreferenced : Boolean := False;
@@ -242,9 +246,9 @@ package Opt is
-- in the output file.
Compile_Only : Boolean := False;
- -- GNATMAKE, GNATCLEAN
- -- GNATMAKE: set to True to skip bind and link steps (except when
- -- Bind_Only is True).
+ -- GNATMAKE, GNATCLEAN, GPRMAKE
+ -- GNATMAKE, GPRMAKE: set to True to skip bind and link steps (except when
+ -- Bind_Only is True).
-- GNATCLEAN: set to True to only the files produced by the compiler are to
-- be deleted, but not the library files or executable files.
@@ -268,9 +272,9 @@ package Opt is
-- Set to True to activate warnings on constant conditions
Create_Mapping_File : Boolean := False;
- -- GNATMAKE
- -- Set to True (-C switch) to indicate that gnatmake will invoke
- -- the compiler with a mapping file (-gnatem compiler switch).
+ -- GNATMAKE, GPRMAKE
+ -- Set to True (-C switch) to indicate that the compiler will be invoked
+ -- with a mapping file (-gnatem compiler switch).
Debug_Pragmas_Enabled : Boolean := False;
-- GNAT
@@ -309,7 +313,7 @@ package Opt is
-- potentially blocking operations are detected from protected actions.
Display_Compilation_Progress : Boolean := False;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE
-- Set True (-d switch) to display information on progress while compiling
-- files. Internal flag to be used in conjunction with an IDE (e.g GPS).
@@ -451,11 +455,11 @@ package Opt is
-- (-F switch set).
Force_Compilations : Boolean := False;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE
-- Set to force recompilations even when the objects are up-to-date.
Full_Path_Name_For_Brief_Errors : Boolean := False;
- -- GNAT, GNATMAKE, GNATCLEAN
+ -- GNAT, GNATMAKE, GNATCLEAN, GPRMAKE
-- When True, in Brief_Output mode, each error message line
-- will start with the full path name of the source.
-- When False, only the file name without directory information
@@ -566,8 +570,8 @@ package Opt is
-- if not.
Keep_Going : Boolean := False;
- -- GNATMAKE
- -- When True signals gnatmake to ignore compilation errors and keep
+ -- GNATMAKE, GPRMAKE
+ -- When True signals to ignore compilation errors and keep
-- processing sources until there is no more work.
Keep_Temporary_Files : Boolean := False;
@@ -576,7 +580,7 @@ package Opt is
-- deleted. Set by switch -dn or qualifier /KEEP_TEMPORARY_FILES.
Link_Only : Boolean := False;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE
-- Set to True to skip compile and bind steps
-- (except when Bind_Only is set to True).
@@ -693,7 +697,7 @@ package Opt is
-- Column_Number'Last during scanning of configuration pragma files.
Maximum_Processes : Positive := 1;
- -- GNATMAKE
+ -- GNATMAKE, GPRMAKE
-- Maximum number of processes that should be spawned to carry out
-- compilations.
@@ -762,11 +766,11 @@ package Opt is
-- This constant reflects the optimization level (0,1,2 for -O0,-O1,-O2)
Output_File_Name_Present : Boolean := False;
- -- GNATBIND, GNAT, GNATMAKE
+ -- GNATBIND, GNAT, GNATMAKE, GPRMAKE
-- Set to True when the output C file name is given with option -o
-- for GNATBIND, when the object file name is given with option
-- -gnatO for GNAT or when the executable is given with option -o
- -- for GNATMAKE.
+ -- for GNATMAKE or GPRMAKE.
Output_Linker_Option_List : Boolean := False;
-- GNATBIND
@@ -829,10 +833,14 @@ package Opt is
-- used if the policy is set in package System.
Quiet_Output : Boolean := False;
- -- GNATMAKE, GNATCLEAN, GPR2MAKE
+ -- GNATMAKE, GNATCLEAN, GPRMAKE
-- Set to True if the tool should not have any output if there are no
-- errors or warnings.
+ Replace_In_Comments : Boolean := False;
+ -- GNATPREP
+ -- Set to True if -C switch used
+
RTS_Lib_Path_Name : String_Ptr := null;
RTS_Src_Path_Name : String_Ptr := null;
-- GNAT
@@ -1017,17 +1025,33 @@ package Opt is
-- This flag determines if validity checking is on or off. The initial
-- state is on, and the required default validity checks are active. The
-- actual set of checks that is performed if Validity_Checks_On is set is
- -- defined by the switches in package Sem_Val. The Validity_Checks_On flag
+ -- defined by the switches in package Validsw. The Validity_Checks_On flag
-- is controlled by pragma Validity_Checks (On | Off), and also some
-- generated compiler code (typically code that has to do with validity
-- check generation) is compiled with this flag set to False. This flag is
-- set to False by the -gnatp switch.
Verbose_Mode : Boolean := False;
- -- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN
+ -- GNAT, GNATBIND, GNATMAKE, GNATLINK, GNATLS, GNATNAME, GNATCLEAN,
+ -- GPRMAKE
-- Set to True to get verbose mode (full error message text and location
-- information sent to standard output, also header, copyright and summary)
+ type Verbosity_Level_Type is (None, Low, Medium, High);
+ Verbosity_Level : Verbosity_Level_Type := High;
+ -- GNATMAKE, GPRMAKE
+ -- Modified by gnatmake or gprmake switches -v, -vl, -vm, -vh. Indicates
+ -- the level of verbosity of informational messages:
+ --
+ -- In Low Verbosity, the reasons why a source is recompiled, the name
+ -- of the executable and the reason it must be rebuilt is output.
+ --
+ -- In Medium Verbosity, additional lines are output for each ALI file
+ -- that is checked.
+ --
+ -- In High Verbosity, additional lines are output when the ALI file
+ -- is part of an Ada library, is read-only or is part of the runtime.
+
Warn_On_Ada_2005_Compatibility : Boolean := True;
-- GNAT
-- Set to True to active all warnings on Ada 2005 compatibility issues,
diff --git a/gcc/ada/osint-c.adb b/gcc/ada/osint-c.adb
index dfb439d965e..648a4b24e16 100644
--- a/gcc/ada/osint-c.adb
+++ b/gcc/ada/osint-c.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,14 +32,13 @@ with Tree_IO; use Tree_IO;
package body Osint.C is
Output_Object_File_Name : String_Ptr;
- -- Argument of -o compiler option, if given. This is needed to
- -- verify consistency with the ALI file name.
+ -- Argument of -o compiler option, if given. This is needed to verify
+ -- consistency with the ALI file name.
procedure Adjust_OS_Resource_Limits;
pragma Import (C, Adjust_OS_Resource_Limits,
"__gnat_adjust_os_resource_limits");
- -- Procedure to make system specific adjustments to make GNAT
- -- run better.
+ -- Procedure to make system specific adjustments to make GNAT run better
function Create_Auxiliary_File
(Src : File_Name_Type;
@@ -325,7 +324,7 @@ package body Osint.C is
EL : constant Natural := Ext'Length;
begin
- -- Make sure that the object file has the expected extension.
+ -- Make sure that the object file has the expected extension
if NL <= EL
or else
diff --git a/gcc/ada/osint-l.adb b/gcc/ada/osint-l.adb
index 95a29491410..144fde459f6 100644
--- a/gcc/ada/osint-l.adb
+++ b/gcc/ada/osint-l.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/osint-l.ads b/gcc/ada/osint-l.ads
index 51aebb19840..170e2763616 100644
--- a/gcc/ada/osint-l.ads
+++ b/gcc/ada/osint-l.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/osint-m.adb b/gcc/ada/osint-m.adb
index 3138d6f74da..964edf33227 100644
--- a/gcc/ada/osint-m.adb
+++ b/gcc/ada/osint-m.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,6 +24,17 @@
-- --
------------------------------------------------------------------------------
+with Osint;
+
+pragma Elaborate_All (Osint);
+-- This pragma is needed because of the call to Set_Program in the
+-- elaboration of the package. We cannot rely on the static model
+-- of elaboration since the compiler is routinely compiled with
+-- checks off (-gnatp), and with older versions of the compiler
+-- (up to and including most 5.04 wavefronts), -gnatp suppresses
+-- the static elaboration check mechanisms. It could be removed
+-- one day, but there really is no need to do so.
+
package body Osint.M is
-----------------------
diff --git a/gcc/ada/osint-m.ads b/gcc/ada/osint-m.ads
index 65ee1540a38..904385df257 100644
--- a/gcc/ada/osint-m.ads
+++ b/gcc/ada/osint-m.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index 8a9e81a2136..d14ad276fbe 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -76,7 +76,7 @@ package body Osint is
function Append_Suffix_To_File_Name
(Name : Name_Id;
Suffix : String) return Name_Id;
- -- Appends Suffix to Name and returns the new name.
+ -- Appends Suffix to Name and returns the new name
function OS_Time_To_GNAT_Time (T : OS_Time) return Time_Stamp_Type;
-- Convert OS format time to GNAT format time stamp
@@ -115,7 +115,7 @@ package body Osint is
-- full file name if file found, or No_File if not found.
function C_String_Length (S : Address) return Integer;
- -- Returns length of a C string. Returns zero for a null address.
+ -- Returns length of a C string. Returns zero for a null address
function To_Path_String_Access
(Path_Addr : Address;
@@ -200,7 +200,7 @@ package body Osint is
-- time stamp.
File_Cache_Enabled : Boolean := False;
- -- Set to true if you want the enable the file data caching mechanism.
+ -- Set to true if you want the enable the file data caching mechanism
type File_Hash_Num is range 0 .. 1020;
diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads
index 108cafaea9a..fab994e76dc 100644
--- a/gcc/ada/osint.ads
+++ b/gcc/ada/osint.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -90,29 +90,27 @@ package Osint is
-- so that two file names compare equal if they refer to the same file.
function Number_Of_Files return Int;
- -- gives the total number of filenames found on the command line.
+ -- Gives the total number of filenames found on the command line
No_Index : constant := -1;
- -- Value used in Add_File to indicate that no index is specified
- -- for a main.
+ -- Value used in Add_File to indicate no index is specified for main
procedure Add_File (File_Name : String; Index : Int := No_Index);
- -- Called by the subprogram processing the command line for each
- -- file name found. The index, when not defaulted to No_Index
- -- is the index of the subprogram in its source, zero indicating
- -- that the source is not multi-unit.
+ -- Called by the subprogram processing the command line for each file name
+ -- found. The index, when not defaulted to No_Index is the index of the
+ -- subprogram in its source, zero indicating that the source is not
+ -- multi-unit.
procedure Find_Program_Name;
-- Put simple name of current program being run (excluding the directory
-- path) in Name_Buffer, with the length in Name_Len.
function Program_Name (Nam : String) return String_Access;
- -- In the native compilation case, Create a string containing Nam. In
- -- the cross compilation case, looks at the prefix of the current
- -- program being run and prepend it to Nam. For instance if the program
- -- being run is <target>-gnatmake and Nam is "gcc", the returned value
- -- will be a pointer to "<target>-gcc". This function clobbers
- -- Name_Buffer and Name_Len.
+ -- In the native compilation case, Create a string containing Nam. In the
+ -- cross compilation case, looks at the prefix of the current program being
+ -- run and prepend it to Nam. For instance if the program being run is
+ -- <target>-gnatmake and Nam is "gcc", the returned value will be a pointer
+ -- to "<target>-gcc". This function clobbers Name_Buffer and Name_Len.
procedure Write_Program_Name;
-- Writes name of program as invoked to the current output
@@ -121,8 +119,8 @@ package Osint is
procedure Fail (S1 : String; S2 : String := ""; S3 : String := "");
pragma No_Return (Fail);
-- Outputs error messages S1 & S2 & S3 preceded by the name of the
- -- executing program and exits with E_Fatal. The output goes to
- -- standard error, except if special output is in effect (see Output).
+ -- executing program and exits with E_Fatal. The output goes to standard
+ -- error, except if special output is in effect (see Output).
function Is_Directory_Separator (C : Character) return Boolean;
-- Returns True if C is a directory separator
@@ -133,7 +131,7 @@ package Osint is
-- directory part in the name.
function Is_Readonly_Library (File : File_Name_Type) return Boolean;
- -- Check if this library file is a read-only file.
+ -- Check if this library file is a read-only file
function Strip_Directory (Name : File_Name_Type) return File_Name_Type;
-- Strips the prefix directory name (if any) from Name. Returns the
@@ -177,11 +175,11 @@ package Osint is
Prefix_Style : Boolean) return String_Access;
-- Convert a host syntax directory specification (e.g. on a VMS host:
-- "SYS$DEVICE:[DIR]") to canonical (Unix) syntax (e.g. "/sys$device/dir").
- -- If Prefix_Style then make it a valid file specification prefix.
- -- A file specification prefix is a directory specification that
- -- can be appended with a simple file specification to yield a valid
- -- absolute or relative path to a file. On a conversion to Unix syntax
- -- this simply means the spec has a trailing slash ("/").
+ -- If Prefix_Style then make it a valid file specification prefix. A file
+ -- specification prefix is a directory specification that can be appended
+ -- with a simple file specification to yield a valid absolute or relative
+ -- path to a file. On a conversion to Unix syntax this simply means the
+ -- spec has a trailing slash ("/").
function To_Canonical_File_Spec
(Host_File : String) return String_Access;
@@ -204,7 +202,7 @@ package Osint is
function To_Host_File_Spec
(Canonical_File : String) return String_Access;
- -- Convert a canonical syntax file specification to host syntax.
+ -- Convert a canonical syntax file specification to host syntax
function Relocate_Path
(Prefix : String;
@@ -552,7 +550,7 @@ package Osint is
private
ALI_Suffix : constant String_Ptr := new String'("ali");
- -- The suffix used for the library files (also known as ALI files).
+ -- The suffix used for the library files (also known as ALI files)
Current_Main : File_Name_Type := No_File;
-- Used to save a simple file name between calls to Next_Main_Source and
@@ -561,7 +559,7 @@ private
-- last call to Next_Main_Source (and stored here) is to be read.
Object_Suffix : constant String := Get_Object_Suffix.all;
- -- The suffix used for the object files.
+ -- The suffix used for the object files
Output_FD : File_Descriptor;
-- The file descriptor for the current library info, tree or binder output
@@ -609,10 +607,10 @@ private
-- A check is made that this procedure is not called several times.
function More_Files return Boolean;
- -- Implements More_Source_Files and More_Lib_Files.
+ -- Implements More_Source_Files and More_Lib_Files
function Next_Main_File return File_Name_Type;
- -- Implements Next_Main_Source and Next_Main_Lib_File.
+ -- Implements Next_Main_Source and Next_Main_Lib_File
function Object_File_Name (N : File_Name_Type) return File_Name_Type;
-- Constructs the name of the object file corresponding to library
diff --git a/gcc/ada/output.adb b/gcc/ada/output.adb
index f4cec924b7e..0985743c8e3 100644
--- a/gcc/ada/output.adb
+++ b/gcc/ada/output.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2003, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -63,7 +63,7 @@ package body Output is
-- will be silently ignored.
Next_Column : Pos range 1 .. Buffer'Length + 1 := 1;
- -- Column about to be written.
+ -- Column about to be written
-----------------------
-- Local_Subprograms --
diff --git a/gcc/ada/par-ch10.adb b/gcc/ada/par-ch10.adb
index 13d0fbd1f00..bedb679081a 100644
--- a/gcc/ada/par-ch10.adb
+++ b/gcc/ada/par-ch10.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -405,9 +405,7 @@ package body Ch10 is
elsif Private_Sloc /= No_Location
and then
- Nkind (Unit (Comp_Unit_Node)) /= N_Function_Instantiation
- and then
- Nkind (Unit (Comp_Unit_Node)) /= N_Procedure_Instantiation
+ Nkind (Unit (Comp_Unit_Node)) not in N_Subprogram_Instantiation
and then
Nkind (Unit (Comp_Unit_Node)) /= N_Subprogram_Renaming_Declaration
then
@@ -529,8 +527,25 @@ package body Ch10 is
or else Nkind (Unit_Node) = N_Single_Protected_Declaration
then
Name_Node := Defining_Identifier (Unit_Node);
- else
+
+ elsif Nkind (Unit_Node) = N_Function_Instantiation
+ or else Nkind (Unit_Node) = N_Function_Specification
+ or else Nkind (Unit_Node) = N_Generic_Function_Renaming_Declaration
+ or else Nkind (Unit_Node) = N_Generic_Package_Renaming_Declaration
+ or else Nkind (Unit_Node) = N_Generic_Procedure_Renaming_Declaration
+ or else Nkind (Unit_Node) = N_Package_Body
+ or else Nkind (Unit_Node) = N_Package_Instantiation
+ or else Nkind (Unit_Node) = N_Package_Renaming_Declaration
+ or else Nkind (Unit_Node) = N_Package_Specification
+ or else Nkind (Unit_Node) = N_Procedure_Instantiation
+ or else Nkind (Unit_Node) = N_Procedure_Specification
+ then
Name_Node := Defining_Unit_Name (Unit_Node);
+
+ -- Anything else is a serious error, abandon scan
+
+ else
+ raise Error_Resync;
end if;
Set_Sloc (Comp_Unit_Node, Sloc (Name_Node));
diff --git a/gcc/ada/par-ch11.adb b/gcc/ada/par-ch11.adb
index 418e9d9cdbb..1dfbfdb36f9 100644
--- a/gcc/ada/par-ch11.adb
+++ b/gcc/ada/par-ch11.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb
index 410ce9a1f0a..49e18de7e52 100644
--- a/gcc/ada/par-ch12.adb
+++ b/gcc/ada/par-ch12.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -903,7 +903,7 @@ package body Ch12 is
-- The caller has checked that the initial tokens are WITH FUNCTION or
-- WITH PROCEDURE, and the initial WITH has been scanned out.
- -- A null default is an Ada 2005 feature.
+ -- A null default is an Ada 2005 feature
-- Error recovery: cannot raise Error_Resync
diff --git a/gcc/ada/par-ch2.adb b/gcc/ada/par-ch2.adb
index b552f811900..e2863bf332a 100644
--- a/gcc/ada/par-ch2.adb
+++ b/gcc/ada/par-ch2.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index d4e84a5da31..037b4e6439d 100644
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -914,10 +914,13 @@ package body Ch3 is
return False;
else
+ -- Ada 2005 (AI-441): The qualifier has no semantic meaning in Ada 95
+ -- (all access Parameters Are "not null" in Ada 95).
+
if Ada_Version < Ada_05 then
Error_Msg_SP
- ("null-excluding access is an Ada 2005 extension");
- Error_Msg_SP ("\unit must be compiled with -gnat05 switch");
+ ("null-excluding access is an Ada 2005 extension?");
+ Error_Msg_SP ("\unit should be compiled with -gnat05 switch?");
end if;
Scan; -- past NOT
@@ -3813,11 +3816,6 @@ package body Ch3 is
-- Ada 95
else
- -- Ada 2005 (AI-254): The null-exclusion present is never present
- -- in Ada 83 and Ada 95
-
- pragma Assert (Null_Exclusion_Present = False);
-
Set_Null_Exclusion_Present (Def_Node, False);
Set_Subtype_Mark (Def_Node, P_Subtype_Mark);
No_Constraint;
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 5d1d4edcecf..d9cc0bf21e4 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -507,7 +507,7 @@ package body Ch4 is
-- (discrete_range)
- -- This is a slice. This case is handled in LP_State_Init.
+ -- This is a slice. This case is handled in LP_State_Init
-- (expression, expression, ..)
diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb
index d84e37735bc..17c546de144 100644
--- a/gcc/ada/par-ch5.adb
+++ b/gcc/ada/par-ch5.adb
@@ -1671,7 +1671,7 @@ package body Ch5 is
-- This function parses a block statement with DECLARE present
- -- The caller has checked that the initial token is DECLARE.
+ -- The caller has checked that the initial token is DECLARE
-- Error recovery: cannot raise Error_Resync
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index 69960071e85..72855f90e7a 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -171,7 +171,7 @@ package body Ch6 is
Scope.Table (Scope.Last).Ecol := Start_Column;
Scope.Table (Scope.Last).Lreq := False;
- -- Ada2005: scan leading overriding indicator.
+ -- Ada2005: scan leading overriding indicator
if Token = Tok_Not then
Scan; -- past NOT
diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb
index 57ba12402ba..0edc4449f26 100644
--- a/gcc/ada/par-ch9.adb
+++ b/gcc/ada/par-ch9.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -25,8 +25,8 @@
------------------------------------------------------------------------------
pragma Style_Checks (All_Checks);
--- Turn off subprogram body ordering check. Subprograms are in order
--- by RM section rather than alphabetical
+-- Turn off subprogram body ordering check. Subprograms are in order by RM
+-- section rather than alphabetical.
separate (Par)
package body Ch9 is
@@ -768,7 +768,7 @@ package body Ch9 is
Not_Overriding : Boolean := False;
begin
- -- Ada 2005 (AI-397): Scan leading overriding indicator.
+ -- Ada 2005 (AI-397): Scan leading overriding indicator
if Token = Tok_Not then
Scan; -- past NOT
@@ -1357,7 +1357,7 @@ package body Ch9 is
elsif Nkind (Ecall_Node) = N_Identifier
or else Nkind (Ecall_Node) = N_Selected_Component
then
- -- Case of a call to a parameterless entry.
+ -- Case of a call to a parameterless entry
declare
C_Node : constant Node_Id :=
diff --git a/gcc/ada/par-endh.adb b/gcc/ada/par-endh.adb
index be508c7fbe9..c58b0d2e0a7 100644
--- a/gcc/ada/par-endh.adb
+++ b/gcc/ada/par-endh.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2002, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -87,7 +87,7 @@ package body Endh is
-- child unit or a node with a Chars field identifying the actual label.
End_Labl_Present : Boolean;
- -- Indicates that the value in End_Labl was for an explicit label.
+ -- Indicates that the value in End_Labl was for an explicit label
Syntax_OK : Boolean;
-- Set True if the entry is syntactically correct
diff --git a/gcc/ada/par-labl.adb b/gcc/ada/par-labl.adb
index 80e6292b42b..a908c8116e3 100644
--- a/gcc/ada/par-labl.adb
+++ b/gcc/ada/par-labl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -42,10 +42,10 @@ procedure Labl is
-- Next label node to process
function Find_Enclosing_Body_Or_Block (N : Node_Id) return Node_Id;
- -- Find the innermost body or block that encloses N.
+ -- Find the innermost body or block that encloses N
function Find_Enclosing_Body (N : Node_Id) return Node_Id;
- -- Find the innermost body that encloses N.
+ -- Find the innermost body that encloses N
procedure Check_Distinct_Labels;
-- Checks the rule in RM-5.1(11), which requires distinct identifiers
@@ -134,7 +134,7 @@ procedure Labl is
Result : Node_Id := Parent (N);
begin
- -- Climb up the parent chain until we find a body or block.
+ -- Climb up the parent chain until we find a body or block
while Present (Result)
and then Nkind (Result) /= N_Accept_Statement
@@ -160,7 +160,7 @@ procedure Labl is
Succ : Elmt_Id;
function Goto_Id (Goto_Node : Node_Id) return Name_Id;
- -- Find Name_Id of goto statement, which may be an expanded name.
+ -- Find Name_Id of goto statement, which may be an expanded name
function Matches
(Label_Node : Node_Id;
diff --git a/gcc/ada/par-load.adb b/gcc/ada/par-load.adb
index 0f5674b70d9..13c66a78be6 100644
--- a/gcc/ada/par-load.adb
+++ b/gcc/ada/par-load.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index 097ddd0caf3..5c87fa92a3b 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -233,7 +233,7 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is
elsif Id = Name_No_Dependence then
Set_Restriction_No_Dependence
(Unit => Expr,
- Warn => Prag_Id = Pragma_Restriction_Warnings);
+ Warn => Prag_Id = Pragma_Restriction_Warnings);
end if;
Next (Arg);
@@ -963,22 +963,28 @@ begin
---------------------
-- pragma Warnings (On | Off, [LOCAL_NAME])
+ -- pragma Warnings (static_string_EXPRESSION);
- -- The one argument case is processed by the parser, since it may
- -- control parser warnings as well as semantic warnings, and in any
- -- case we want to be absolutely sure that the range in the warnings
- -- table is set well before any semantic analysis is performed.
+ -- The one argument ON/OFF case is processed by the parser, since it may
+ -- control parser warnings as well as semantic warnings, and in any case
+ -- we want to be absolutely sure that the range in the warnings table is
+ -- set well before any semantic analysis is performed.
when Pragma_Warnings =>
if Arg_Count = 1 then
Check_No_Identifier (Arg1);
- Check_Arg_Is_On_Or_Off (Arg1);
- if Chars (Expression (Arg1)) = Name_On then
- Set_Warnings_Mode_On (Pragma_Sloc);
- else
- Set_Warnings_Mode_Off (Pragma_Sloc);
- end if;
+ declare
+ Argx : constant Node_Id := Expression (Arg1);
+ begin
+ if Nkind (Argx) = N_Identifier then
+ if Chars (Argx) = Name_On then
+ Set_Warnings_Mode_On (Pragma_Sloc);
+ elsif Chars (Argx) = Name_Off then
+ Set_Warnings_Mode_Off (Pragma_Sloc);
+ end if;
+ end if;
+ end;
end if;
-----------------------
diff --git a/gcc/ada/par-tchk.adb b/gcc/ada/par-tchk.adb
index 94447fb078d..ab87e88f800 100644
--- a/gcc/ada/par-tchk.adb
+++ b/gcc/ada/par-tchk.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,7 +24,7 @@
-- --
------------------------------------------------------------------------------
--- Token scan routines.
+-- Token scan routines
-- Error recovery: none of the T_xxx or TF_xxx routines raise Error_Resync
@@ -801,7 +801,7 @@ package body Tchk is
M : String (1 .. Missing'Length + Tok_Name'Length);
begin
- -- Set M to Missing & Tok_Name.
+ -- Set M to Missing & Tok_Name
M (1 .. Missing'Length) := Missing;
M (Missing'Length + 1 .. M'Last) := Tok_Name;
diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb
index 86fa50fe8c1..ddaae254f83 100644
--- a/gcc/ada/par.adb
+++ b/gcc/ada/par.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -94,7 +94,7 @@ is
-- an entry in the scope stack, invalidating the contents of the stack.
Error_Resync : exception;
- -- Exception raised on error that is not handled locally, see above.
+ -- Exception raised on error that is not handled locally, see above
Last_Resync_Point : Source_Ptr;
-- The resynchronization routines in Par.Sync run a risk of getting
diff --git a/gcc/ada/par.ads b/gcc/ada/par.ads
index 36e265aa3f0..f610ef0caef 100644
--- a/gcc/ada/par.ads
+++ b/gcc/ada/par.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/prep.adb b/gcc/ada/prep.adb
index bbfb5b723e5..b2ec857b96d 100644
--- a/gcc/ada/prep.adb
+++ b/gcc/ada/prep.adb
@@ -128,7 +128,7 @@ package body Prep is
-- Behaviour --
---------------
- -- Accesses to procedure specified by procedure Initialize.
+ -- Accesses to procedure specified by procedure Initialize
Error_Msg : Error_Msg_Proc;
-- Report an error
@@ -159,7 +159,7 @@ package body Prep is
-- Used to detect multiple #else.
Deleting : Boolean;
- -- Set to True when the code should be deleted or commented out.
+ -- Set to True when the code should be deleted or commented out
Match_Seen : Boolean;
-- Set to True when a condition in an #if or an #elsif is True.
@@ -276,8 +276,7 @@ package body Prep is
then
for J in Index + 1 .. Definition'Last loop
case Definition (J) is
- when '_' | '.' | '0' .. '9' |
- 'a' .. 'z' | 'A' .. 'Z' =>
+ when '_' | '.' | '0' .. '9' | 'a' .. 'z' | 'A' .. 'Z' =>
null;
when others =>
@@ -336,8 +335,7 @@ package body Prep is
-- Put the symbol name in the result
declare
- Sym : constant String :=
- Name_Buffer (1 .. Name_Len);
+ Sym : constant String := Name_Buffer (1 .. Name_Len);
begin
for Index in 1 .. Name_Len loop
@@ -374,13 +372,13 @@ package body Prep is
----------------
function Expression (Evaluate_It : Boolean) return Boolean is
- Evaluation : Boolean := Evaluate_It;
+ Evaluation : Boolean := Evaluate_It;
-- Is set to False after an "or else" when left term is True and
-- after an "and then" when left term is False.
- Final_Result : Boolean := False;
+ Final_Result : Boolean := False;
- Current_Result : Boolean := False;
+ Current_Result : Boolean := False;
-- Value of a term
Current_Operator : Operator := None;
@@ -430,6 +428,7 @@ package body Prep is
Scan.all;
if Token = Tok_Apostrophe then
+
-- symbol'Defined
Scan.all;
@@ -690,9 +689,9 @@ package body Prep is
procedure Output_Line (From, To : Source_Ptr);
-- Output a line or the end of a line from the buffer to the output
- -- file, followed by an end of line terminator.
- -- Depending on the value of Deleting and the switches, the line
- -- may be commented out, blank or not output at all.
+ -- file, followed by an end of line terminator. Depending on the value
+ -- of Deleting and the switches, the line may be commented out, blank or
+ -- not output at all.
------------
-- Output --
@@ -739,13 +738,12 @@ package body Prep is
begin
Start_Of_Processing := Scan_Ptr;
- -- We need to call Scan for the first time, because Initialyze_Scanner
+ -- We need to call Scan for the first time, because Initialize_Scanner
-- is no longer doing it.
Scan.all;
- Input_Line_Loop :
- loop
+ Input_Line_Loop : loop
exit Input_Line_Loop when Token = Tok_EOF;
Preprocessor_Line := False;
@@ -760,9 +758,9 @@ package body Prep is
case Token is
- when Tok_If =>
- -- #if
+ -- #if
+ when Tok_If =>
declare
If_Ptr : constant Source_Ptr := Token_Ptr;
@@ -806,9 +804,9 @@ package body Prep is
end;
end;
- when Tok_Elsif =>
- -- #elsif
+ -- #elsif
+ when Tok_Elsif =>
Cond := False;
if Pp_States.Last = 0
@@ -860,9 +858,9 @@ package body Prep is
end if;
end if;
- when Tok_Else =>
- -- #else
+ -- #else
+ when Tok_Else =>
if Pp_States.Last = 0 then
Error_Msg ("no IF for this ELSE", Token_Ptr);
@@ -906,9 +904,9 @@ package body Prep is
Go_To_End_Of_Line;
end if;
- when Tok_End =>
- -- #end if;
+ -- #end if;
+ when Tok_End =>
if Pp_States.Last = 0 then
Error_Msg ("no IF for this END", Token_Ptr);
end if;
@@ -944,15 +942,15 @@ package body Prep is
Go_To_End_Of_Line;
- -- Decrement the depth of the #if stack.
+ -- Decrement the depth of the #if stack
if Pp_States.Last > 0 then
Pp_States.Decrement_Last;
end if;
- when others =>
- -- Illegal preprocessor line
+ -- Illegal preprocessor line
+ when others =>
if Pp_States.Last = 0 then
Error_Msg ("IF expected", Token_Ptr);
@@ -990,8 +988,8 @@ package body Prep is
and then Special_Character = '$'
then
declare
- Dollar_Ptr : constant Source_Ptr := Token_Ptr;
- Symbol : Symbol_Id;
+ Dollar_Ptr : constant Source_Ptr := Token_Ptr;
+ Symbol : Symbol_Id;
begin
Scan.all;
@@ -1004,8 +1002,7 @@ package body Prep is
Symbol := Index_Of (Token_Name);
- -- If there is such a symbol, replace it by its
- -- value.
+ -- If symbol exists, replace by its value
if Symbol /= No_Symbol then
Output (Start_Of_Processing, Dollar_Ptr - 1);
@@ -1070,15 +1067,13 @@ package body Prep is
and then Sinput.Source (Token_Ptr + 1) = ASCII.LF)
then
Start_Of_Processing := Token_Ptr + 2;
-
else
Start_Of_Processing := Token_Ptr + 1;
end if;
end if;
- -- Now, we scan the first token of the next line.
- -- If the token is EOF, the scan ponter will not move, and the token
- -- will still be EOF.
+ -- Now, scan the first token of the next line. If the token is EOF,
+ -- the scan ponter will not move, and the token will still be EOF.
Set_Ignore_Errors (To => True);
Scan.all;
diff --git a/gcc/ada/prepcomp.adb b/gcc/ada/prepcomp.adb
index 05773daa66c..e81c9763648 100644
--- a/gcc/ada/prepcomp.adb
+++ b/gcc/ada/prepcomp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -135,6 +135,7 @@ package body Prepcomp is
procedure Add_Command_Line_Symbols is
Symbol_Id : Prep.Symbol_Id;
+
begin
for J in 1 .. Symbol_Table.Last (Command_Line_Symbols) loop
Symbol_Id := Prep.Index_Of (Command_Line_Symbols.Table (J).Symbol);
@@ -225,11 +226,11 @@ package body Prepcomp is
------------------------------
procedure Parse_Preprocessing_Data_File (N : File_Name_Type) is
- OK : Boolean := False;
+ OK : Boolean := False;
Dash_Location : Source_Ptr;
- Symbol_Data : Prep.Symbol_Data;
- Symbol_Id : Prep.Symbol_Id;
- T : constant Nat := Total_Errors_Detected;
+ Symbol_Data : Prep.Symbol_Data;
+ Symbol_Id : Prep.Symbol_Id;
+ T : constant Nat := Total_Errors_Detected;
begin
-- Load the preprocessing data file
@@ -246,13 +247,13 @@ package body Prepcomp is
end if;
-- Initialize the sanner and set its behavior for a processing data file
+
Scn.Scanner.Initialize_Scanner
(No_Unit, Source_Index_Of_Preproc_Data_File);
Scn.Scanner.Set_End_Of_Line_As_Token (True);
Scn.Scanner.Reset_Special_Characters;
- For_Each_Line :
- loop
+ For_Each_Line : loop
<<Scan_Line>>
Scan;
@@ -340,7 +341,6 @@ package body Prepcomp is
-- Check the switches that may follow
while Token /= Tok_End_Of_Line and then Token /= Tok_EOF loop
-
if Token /= Tok_Minus then
Error_Msg ("`'-` expected", Token_Ptr);
Skip_To_End_Of_Line;
@@ -508,7 +508,7 @@ package body Prepcomp is
Symbol_Id := Prep.Index_Of (Symbol_Data.Symbol);
- -- Otherwise, add a new entry in the table.
+ -- Otherwise, add a new entry in the table
if Symbol_Id = No_Symbol then
Symbol_Table.Increment_Last (Prep.Mapping);
@@ -635,6 +635,7 @@ package body Prepcomp is
-- If not already done it, process the definition file
if Current_Data.Processed then
+
-- Set Prep.Mapping
Prep.Mapping := Current_Data.Mapping;
diff --git a/gcc/ada/prepcomp.ads b/gcc/ada/prepcomp.ads
index 3e53e0dee27..9c74df8c592 100644
--- a/gcc/ada/prepcomp.ads
+++ b/gcc/ada/prepcomp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2003, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -46,7 +46,7 @@ package Prepcomp is
-- Parse_Preprocessing_Data_File should be called instead.
procedure Parse_Preprocessing_Data_File (N : File_Name_Type);
- -- Parse a preprocessing data file, specified with a -gnatep= switch.
+ -- Parse a preprocessing data file, specified with a -gnatep= switch
procedure Prepare_To_Preprocess
(Source : File_Name_Type;
diff --git a/gcc/ada/prj-attr-pm.ads b/gcc/ada/prj-attr-pm.ads
index 695e17fed24..36ad40f7052 100644
--- a/gcc/ada/prj-attr-pm.ads
+++ b/gcc/ada/prj-attr-pm.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,9 +24,15 @@
-- --
------------------------------------------------------------------------------
+-- This package contains insecure procedures that are intended to be used
+-- only inside the Prj and MLib hierarchies. It should not be imported by
+-- other tools, such as GPS.
+
package Prj.Attr.PM is
+
-- The following procedures are not secure and should only be used by the
-- Project Manager, that is the packages of the Prj or MLib hierarchies.
+ -- What does "not secure" mean???
procedure Add_Unknown_Package (Name : Name_Id; Id : out Package_Node_Id);
-- Add a new unknown package. The Name cannot be the name of a predefined
diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb
index b49c51134d9..b43fe801bc3 100644
--- a/gcc/ada/prj-attr.adb
+++ b/gcc/ada/prj-attr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -55,7 +55,7 @@ package body Prj.Attr is
-- insensitive
-- 'c' same as 'b', with optional index
- -- End is indicated by two consecutive '#'.
+ -- End is indicated by two consecutive '#'
Initialization_Data : constant String :=
@@ -75,6 +75,7 @@ package body Prj.Attr is
"SVlibrary_auto_init#" &
"LVlibrary_options#" &
"SVlibrary_src_dir#" &
+ "SVlibrary_ali_dir#" &
"SVlibrary_gcc#" &
"SVlibrary_symbol_file#" &
"SVlibrary_symbol_policy#" &
diff --git a/gcc/ada/prj-attr.ads b/gcc/ada/prj-attr.ads
index 142be80fd97..df964044ea8 100644
--- a/gcc/ada/prj-attr.ads
+++ b/gcc/ada/prj-attr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -26,7 +26,8 @@
-- This package defines packages and attributes in GNAT project files.
-- There are predefined packages and attributes.
--- It is also possible to define new packages with their attributes.
+
+-- It is also possible to define new packages with their attributes
with Table;
diff --git a/gcc/ada/prj-com.ads b/gcc/ada/prj-com.ads
index 7cf50116d62..c7a96aa04c6 100644
--- a/gcc/ada/prj-com.ads
+++ b/gcc/ada/prj-com.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -27,6 +27,8 @@
-- The following package declares data types for GNAT project.
-- These data types are used in the bodies of the Prj hierarchy.
+-- Above comment seems *far* too general ???
+
with Osint;
package Prj.Com is
diff --git a/gcc/ada/prj-dect.adb b/gcc/ada/prj-dect.adb
index 00922b31b9f..162db134807 100644
--- a/gcc/ada/prj-dect.adb
+++ b/gcc/ada/prj-dect.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -49,7 +49,7 @@ package body Prj.Dect is
Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id;
Packages_To_Check : String_List_Access);
- -- Parse an attribute declaration.
+ -- Parse an attribute declaration
procedure Parse_Case_Construction
(In_Tree : Project_Node_Tree_Ref;
diff --git a/gcc/ada/prj-dect.ads b/gcc/ada/prj-dect.ads
index e8233e34ade..4cffb574939 100644
--- a/gcc/ada/prj-dect.ads
+++ b/gcc/ada/prj-dect.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb
index 26fd99b7c94..c20be6dd739 100644
--- a/gcc/ada/prj-env.adb
+++ b/gcc/ada/prj-env.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -48,7 +48,7 @@ package body Prj.Env is
-- and ADA_OBJECTS_PATH are stored.
Ada_Path_Length : Natural := 0;
- -- Index of the last valid character in Ada_Path_Buffer.
+ -- Index of the last valid character in Ada_Path_Buffer
Ada_Prj_Include_File_Set : Boolean := False;
Ada_Prj_Objects_File_Set : Boolean := False;
@@ -270,9 +270,9 @@ package body Prj.Env is
if Data.Library then
if Data.Object_Directory = No_Name
or else
- Contains_ALI_Files (Data.Library_Dir)
+ Contains_ALI_Files (Data.Library_ALI_Dir)
then
- Add_To_Path (Get_Name_String (Data.Library_Dir));
+ Add_To_Path (Get_Name_String (Data.Library_ALI_Dir));
else
Add_To_Path (Get_Name_String (Data.Object_Directory));
end if;
@@ -2121,16 +2121,17 @@ package body Prj.Env is
and then
(not Including_Libraries or else not Data.Library))
then
- -- For a library project, add the library directory
- -- if there is no object directory or if the library
- -- directory contains ALI files; otherwise add the
- -- object directory.
+ -- For a library project, add the library ALI
+ -- directory if there is no object directory or
+ -- if the library ALI directory contains ALI files;
+ -- otherwise add the object directory.
if Data.Library then
if Data.Object_Directory = No_Name
- or else Contains_ALI_Files (Data.Library_Dir)
+ or else Contains_ALI_Files (Data.Library_ALI_Dir)
then
- Add_To_Object_Path (Data.Library_Dir, In_Tree);
+ Add_To_Object_Path
+ (Data.Library_ALI_Dir, In_Tree);
else
Add_To_Object_Path
(Data.Object_Directory, In_Tree);
@@ -2138,13 +2139,18 @@ package body Prj.Env is
-- For a non-library project, add the object
-- directory, if it is not a virtual project, and
- -- if there are Ada sources. If there are no Ada
- -- sources, adding the object directory could
- -- disrupt the order of the object dirs in the path.
+ -- if there are Ada sources or if the project is an
+ -- extending project. if There Are No Ada sources,
+ -- adding the object directory could disrupt
+ -- the order of the object dirs in the path.
elsif not Data.Virtual
- and then In_Tree.Projects.Table
- (Project).Ada_Sources_Present
+ and then (In_Tree.Projects.Table
+ (Project).Ada_Sources_Present
+ or else
+ (Data.Extends /= No_Project
+ and then
+ Data.Object_Directory /= No_Name))
then
Add_To_Object_Path
(Data.Object_Directory, In_Tree);
@@ -2230,7 +2236,7 @@ package body Prj.Env is
Add (Project);
end if;
- -- Write and close any file that has been created.
+ -- Write and close any file that has been created
if Source_FD /= Invalid_FD then
for Index in Source_Path_Table.First ..
diff --git a/gcc/ada/prj-env.ads b/gcc/ada/prj-env.ads
index 76e85aeceea..59d2cfc0f67 100644
--- a/gcc/ada/prj-env.ads
+++ b/gcc/ada/prj-env.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/prj-err.ads b/gcc/ada/prj-err.ads
index 57d33f9be66..ba528f1f99a 100644
--- a/gcc/ada/prj-err.ads
+++ b/gcc/ada/prj-err.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,12 +24,11 @@
-- --
------------------------------------------------------------------------------
--- This package contains the routines to output error messages and the
--- scanner for the project files. It replaces Errout and Scn.
--- It is not dependent on the GNAT tree packages (Atree, Sinfo, ...).
--- It uses the same global variables as Errout, located in package
--- Err_Vars. Like Errout, it also uses the common variables and routines
--- in package Erroutc.
+-- This package contains the routines to output error messages and the scanner
+-- for the project files. It replaces Errout and Scn. It is not dependent on
+-- the GNAT tree packages (Atree, Sinfo, ...). It uses exactly the same global
+-- variables as Errout, located in package Err_Vars. Like Errout, it also uses
+-- the common variables and routines in package Erroutc.
with Scng;
with Errutil;
@@ -63,10 +62,10 @@ package Prj.Err is
procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr)
renames Errutil.Error_Msg;
- -- Output a message at specified location.
+ -- Output a message at specified location
procedure Error_Msg_S (Msg : String) renames Errutil.Error_Msg_S;
- -- Output a message at current scan pointer location.
+ -- Output a message at current scan pointer location
procedure Error_Msg_SC (Msg : String) renames Errutil.Error_Msg_SC;
-- Output a message at the start of the current token, unless we are at
@@ -74,7 +73,7 @@ package Prj.Err is
-- last real token in the file.
procedure Error_Msg_SP (Msg : String) renames Errutil.Error_Msg_SP;
- -- Output a message at the start of the previous token.
+ -- Output a message at the start of the previous token
-------------
-- Scanner --
diff --git a/gcc/ada/prj-ext.adb b/gcc/ada/prj-ext.adb
index 53d47cd3365..c92ca9ffa20 100644
--- a/gcc/ada/prj-ext.adb
+++ b/gcc/ada/prj-ext.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -25,25 +25,30 @@
------------------------------------------------------------------------------
with Namet; use Namet;
+with Output; use Output;
with Osint; use Osint;
with Sdefault;
+
with GNAT.HTable;
package body Prj.Ext is
+ Gpr_Project_Path : constant String := "GPR_PROJECT_PATH";
Ada_Project_Path : constant String := "ADA_PROJECT_PATH";
- -- Name of the env. variable that contains path name(s) of directories
- -- where project files may reside.
+ -- Name of the env. variables that contain path name(s) of directories
+ -- where project files may reside. GPR_PROJECT_PATH has precedence over
+ -- ADA_PROJECT_PATH.
- Prj_Path : constant String_Access := Getenv (Ada_Project_Path);
+ Gpr_Prj_Path : constant String_Access := Getenv (Gpr_Project_Path);
+ Ada_Prj_Path : constant String_Access := Getenv (Ada_Project_Path);
-- The path name(s) of directories where project files may reside.
-- May be empty.
No_Project_Default_Dir : constant String := "-";
Current_Project_Path : String_Access;
- -- The project path; initialized during elaboration of package
- -- Contains at least the current working directory.
+ -- The project path. Initialized during elaboration of package Contains at
+ -- least the current working directory.
package Htable is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num,
@@ -152,8 +157,7 @@ package body Prj.Ext is
return The_Value;
end if;
- -- Find if it is an environment.
- -- If it is, put the value in the hash table.
+ -- Find if it is an environment, if it is, put value in the hash table
declare
Env_Value : String_Access := Getenv (Name);
@@ -181,14 +185,30 @@ begin
Add_Default_Dir : Boolean := True;
First : Positive;
Last : Positive;
+ New_Len : Positive;
+ New_Last : Positive;
+ Prj_Path : String_Access := Gpr_Prj_Path;
begin
+ if Gpr_Prj_Path.all /= "" then
+
+ -- Warn if both environment variables are defined
+
+ if Ada_Prj_Path.all /= "" then
+ Write_Line ("Warning: ADA_PROJECT_PATH is not taken into account");
+ Write_Line (" when GPR_PROJECT_PATH is defined");
+ end if;
+
+ else
+ Prj_Path := Ada_Prj_Path;
+ end if;
+
-- The current directory is always first
Name_Len := 1;
Name_Buffer (Name_Len) := '.';
- -- If env. var. is defined and not empty, add its content
+ -- If environment variable is defined and not empty, add its content
if Prj_Path.all /= "" then
Name_Len := Name_Len + 1;
@@ -198,6 +218,7 @@ begin
-- Scan the directory path to see if "-" is one of the directories.
-- Remove each occurence of "-" and set Add_Default_Dir to False.
+ -- Also resolve relative paths and symbolic links.
First := 3;
loop
@@ -229,6 +250,27 @@ begin
end loop;
Name_Len := Name_Len - No_Project_Default_Dir'Length - 1;
+
+ else
+ declare
+ New_Dir : constant String :=
+ Normalize_Pathname (Name_Buffer (First .. Last));
+ begin
+ -- If the absolute path was resolved and is different from
+ -- the original, replace original with the resolved path.
+
+ if New_Dir /= Name_Buffer (First .. Last)
+ and then New_Dir'Length /= 0
+ then
+ New_Len := Name_Len + New_Dir'Length - (Last - First + 1);
+ New_Last := First + New_Dir'Length - 1;
+ Name_Buffer (New_Last + 1 .. New_Len) :=
+ Name_Buffer (Last + 1 .. Name_Len);
+ Name_Buffer (First .. New_Last) := New_Dir;
+ Name_Len := New_Len;
+ Last := New_Last;
+ end if;
+ end;
end if;
First := Last + 1;
diff --git a/gcc/ada/prj-ext.ads b/gcc/ada/prj-ext.ads
index e6e7188dfad..c0114ce2e08 100644
--- a/gcc/ada/prj-ext.ads
+++ b/gcc/ada/prj-ext.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -42,13 +42,13 @@ package Prj.Ext is
procedure Add
(External_Name : String;
Value : String);
- -- Add an external reference (or modify an existing one).
+ -- Add an external reference (or modify an existing one)
function Value_Of
(External_Name : Name_Id;
With_Default : Name_Id := No_Name)
return Name_Id;
- -- Get the value of an external reference, and cache it for future uses.
+ -- Get the value of an external reference, and cache it for future uses
function Check (Declaration : String) return Boolean;
-- Check that an external declaration <external>=<value> is correct.
diff --git a/gcc/ada/prj-makr.adb b/gcc/ada/prj-makr.adb
index 569c85dcceb..57334e40056 100644
--- a/gcc/ada/prj-makr.adb
+++ b/gcc/ada/prj-makr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/prj-makr.ads b/gcc/ada/prj-makr.ads
index 3947e891819..4bb0ead30c4 100644
--- a/gcc/ada/prj-makr.ads
+++ b/gcc/ada/prj-makr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,7 +24,7 @@
-- --
------------------------------------------------------------------------------
--- Support for procedure Gnatname.
+-- Support for procedure Gnatname
-- For arbitrary naming schemes, create or update a project file,
-- or create a configuration pragmas file.
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index bc7adfa375a..959294405d0 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1383,12 +1383,16 @@ package body Prj.Nmsc is
Lib_Name : constant Prj.Variable_Value :=
Prj.Util.Value_Of
- (Snames.Name_Library_Name, Attributes, In_Tree);
+ (Snames.Name_Library_Name, Attributes, In_Tree);
Lib_Version : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Version, Attributes, In_Tree);
+ Lib_ALI_Dir : constant Prj.Variable_Value :=
+ Prj.Util.Value_Of
+ (Snames.Name_Library_Ali_Dir, Attributes, In_Tree);
+
The_Lib_Kind : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Kind, Attributes, In_Tree);
@@ -1488,14 +1492,78 @@ package body Prj.Nmsc is
Data.Library_Dir := No_Name;
Data.Display_Library_Dir := No_Name;
- -- Display the Library directory in high verbosity
-
else
- if Current_Verbosity = High then
- Write_Str ("Library directory =""");
- Write_Str (Get_Name_String (Data.Display_Library_Dir));
- Write_Line ("""");
- end if;
+ declare
+ OK : Boolean := True;
+ Dirs_Id : String_List_Id;
+ Dir_Elem : String_Element;
+
+ begin
+ -- The library directory cannot be the same as a source
+ -- directory of the current project.
+
+ Dirs_Id := Data.Source_Dirs;
+ while Dirs_Id /= Nil_String loop
+ Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id);
+ Dirs_Id := Dir_Elem.Next;
+
+ if Data.Library_Dir = Dir_Elem.Value then
+ Err_Vars.Error_Msg_Name_1 := Dir_Elem.Value;
+ Error_Msg
+ (Project, In_Tree,
+ "library directory cannot be the same " &
+ "as source directory {",
+ Lib_Dir.Location);
+ OK := False;
+ exit;
+ end if;
+ end loop;
+
+ if OK then
+
+ -- The library directory cannot be the same as a source
+ -- directory of another project either.
+
+ Project_Loop :
+ for Pid in 1 .. Project_Table.Last (In_Tree.Projects) loop
+ if Pid /= Project then
+ Dirs_Id := In_Tree.Projects.Table (Pid).Source_Dirs;
+
+ Dir_Loop : while Dirs_Id /= Nil_String loop
+ Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id);
+ Dirs_Id := Dir_Elem.Next;
+
+ if Data.Library_Dir = Dir_Elem.Value then
+ Err_Vars.Error_Msg_Name_1 := Dir_Elem.Value;
+ Err_Vars.Error_Msg_Name_2 :=
+ In_Tree.Projects.Table (Pid).Name;
+
+ Error_Msg
+ (Project, In_Tree,
+ "library directory cannot be the same " &
+ "as source directory { of project {",
+ Lib_Dir.Location);
+ OK := False;
+ exit Project_Loop;
+ end if;
+ end loop Dir_Loop;
+ end if;
+ end loop Project_Loop;
+ end if;
+
+ if not OK then
+ Data.Library_Dir := No_Name;
+ Data.Display_Library_Dir := No_Name;
+
+ elsif Current_Verbosity = High then
+
+ -- Display the Library directory in high verbosity
+
+ Write_Str ("Library directory =""");
+ Write_Str (Get_Name_String (Data.Display_Library_Dir));
+ Write_Line ("""");
+ end if;
+ end;
end if;
end if;
@@ -1536,6 +1604,158 @@ package body Prj.Nmsc is
Data.Library := False;
else
+ if Lib_ALI_Dir.Value = Empty_String then
+ if Current_Verbosity = High then
+ Write_Line ("No library 'A'L'I directory specified");
+ end if;
+ Data.Library_ALI_Dir := Data.Library_Dir;
+ Data.Display_Library_ALI_Dir := Data.Display_Library_Dir;
+
+ else
+ -- Find path name, check that it is a directory
+
+ Locate_Directory
+ (Lib_ALI_Dir.Value, Data.Display_Directory,
+ Data.Library_ALI_Dir, Data.Display_Library_ALI_Dir);
+
+ if Data.Library_ALI_Dir = No_Name then
+
+ -- Get the absolute name of the library ALI directory that
+ -- does not exist, to report an error.
+
+ declare
+ Dir_Name : constant String :=
+ Get_Name_String (Lib_ALI_Dir.Value);
+
+ begin
+ if Is_Absolute_Path (Dir_Name) then
+ Err_Vars.Error_Msg_Name_1 := Lib_Dir.Value;
+
+ else
+ Get_Name_String (Data.Display_Directory);
+
+ if Name_Buffer (Name_Len) /= Directory_Separator then
+ Name_Len := Name_Len + 1;
+ Name_Buffer (Name_Len) := Directory_Separator;
+ end if;
+
+ Name_Buffer
+ (Name_Len + 1 .. Name_Len + Dir_Name'Length) :=
+ Dir_Name;
+ Name_Len := Name_Len + Dir_Name'Length;
+ Err_Vars.Error_Msg_Name_1 := Name_Find;
+ end if;
+
+ -- Report the error
+
+ Error_Msg
+ (Project, In_Tree,
+ "library 'A'L'I directory { does not exist",
+ Lib_ALI_Dir.Location);
+ end;
+ end if;
+
+ if Data.Library_ALI_Dir /= Data.Library_Dir then
+
+ -- The library ALI directory cannot be the same as the
+ -- Object directory.
+
+ if Data.Library_ALI_Dir = Data.Object_Directory then
+ Error_Msg
+ (Project, In_Tree,
+ "library 'A'L'I directory cannot be the same " &
+ "as object directory",
+ Lib_ALI_Dir.Location);
+ Data.Library_ALI_Dir := No_Name;
+ Data.Display_Library_ALI_Dir := No_Name;
+
+ else
+ declare
+ OK : Boolean := True;
+ Dirs_Id : String_List_Id;
+ Dir_Elem : String_Element;
+
+ begin
+ -- The library ALI directory cannot be the same as
+ -- a source directory of the current project.
+
+ Dirs_Id := Data.Source_Dirs;
+ while Dirs_Id /= Nil_String loop
+ Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id);
+ Dirs_Id := Dir_Elem.Next;
+
+ if Data.Library_ALI_Dir = Dir_Elem.Value then
+ Err_Vars.Error_Msg_Name_1 := Dir_Elem.Value;
+ Error_Msg
+ (Project, In_Tree,
+ "library 'A'L'I directory cannot be " &
+ "the same as source directory {",
+ Lib_ALI_Dir.Location);
+ OK := False;
+ exit;
+ end if;
+ end loop;
+
+ if OK then
+
+ -- The library ALI directory cannot be the same as
+ -- a source directory of another project either.
+
+ ALI_Project_Loop :
+ for
+ Pid in 1 .. Project_Table.Last (In_Tree.Projects)
+ loop
+ if Pid /= Project then
+ Dirs_Id :=
+ In_Tree.Projects.Table (Pid).Source_Dirs;
+
+ ALI_Dir_Loop :
+ while Dirs_Id /= Nil_String loop
+ Dir_Elem :=
+ In_Tree.String_Elements.Table (Dirs_Id);
+ Dirs_Id := Dir_Elem.Next;
+
+ if
+ Data.Library_ALI_Dir = Dir_Elem.Value
+ then
+ Err_Vars.Error_Msg_Name_1 :=
+ Dir_Elem.Value;
+ Err_Vars.Error_Msg_Name_2 :=
+ In_Tree.Projects.Table (Pid).Name;
+
+ Error_Msg
+ (Project, In_Tree,
+ "library 'A'L'I directory cannot " &
+ "be the same as source directory " &
+ "{ of project {",
+ Lib_ALI_Dir.Location);
+ OK := False;
+ exit ALI_Project_Loop;
+ end if;
+ end loop ALI_Dir_Loop;
+ end if;
+ end loop ALI_Project_Loop;
+ end if;
+
+ if not OK then
+ Data.Library_ALI_Dir := No_Name;
+ Data.Display_Library_ALI_Dir := No_Name;
+
+ elsif Current_Verbosity = High then
+
+ -- Display the Library ALI directory in high
+ -- verbosity.
+
+ Write_Str ("Library ALI directory =""");
+ Write_Str
+ (Get_Name_String (Data.Display_Library_ALI_Dir));
+ Write_Line ("""");
+ end if;
+ end;
+ end if;
+ end if;
+ end if;
+
pragma Assert (Lib_Version.Kind = Single);
if Lib_Version.Value = Empty_String then
@@ -2279,18 +2499,19 @@ package body Prj.Nmsc is
Lib_Src_Dir.Location);
Data.Library_Src_Dir := No_Name;
- -- Check if it is same as one of the source directories
-
else
declare
- Src_Dirs : String_List_Id := Data.Source_Dirs;
+ Src_Dirs : String_List_Id;
Src_Dir : String_Element;
begin
+ -- Interface copy directory cannot be one of the source
+ -- directory of the current project.
+
+ Src_Dirs := Data.Source_Dirs;
while Src_Dirs /= Nil_String loop
Src_Dir := In_Tree.String_Elements.Table
(Src_Dirs);
- Src_Dirs := Src_Dir.Next;
-- Report error if it is one of the source directories
@@ -2303,7 +2524,45 @@ package body Prj.Nmsc is
Data.Library_Src_Dir := No_Name;
exit;
end if;
+
+ Src_Dirs := Src_Dir.Next;
end loop;
+
+ if Data.Library_Src_Dir /= No_Name then
+
+ -- It cannot be a source directory of any other
+ -- project either.
+
+ Project_Loop : for Pid in 1 ..
+ Project_Table.Last (In_Tree.Projects)
+ loop
+ Src_Dirs :=
+ In_Tree.Projects.Table (Pid).Source_Dirs;
+ Dir_Loop : while Src_Dirs /= Nil_String loop
+ Src_Dir :=
+ In_Tree.String_Elements.Table (Src_Dirs);
+
+ -- Report error if it is one of the source
+ -- directories
+
+ if Data.Library_Src_Dir = Src_Dir.Value then
+ Error_Msg_Name_1 := Src_Dir.Value;
+ Error_Msg_Name_2 :=
+ In_Tree.Projects.Table (Pid).Name;
+ Error_Msg
+ (Project, In_Tree,
+ "directory to copy interfaces cannot " &
+ "be the same as source directory { of " &
+ "project {",
+ Lib_Src_Dir.Location);
+ Data.Library_Src_Dir := No_Name;
+ exit Project_Loop;
+ end if;
+
+ Src_Dirs := Src_Dir.Next;
+ end loop Dir_Loop;
+ end loop Project_Loop;
+ end if;
end;
-- In high verbosity, if there is a valid Library_Src_Dir,
diff --git a/gcc/ada/prj-nmsc.ads b/gcc/ada/prj-nmsc.ads
index 8298bb63545..ae05c5f0174 100644
--- a/gcc/ada/prj-nmsc.ads
+++ b/gcc/ada/prj-nmsc.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,7 +24,7 @@
-- --
------------------------------------------------------------------------------
--- Check the Naming Scheme of a project file, find the source files.
+-- Check the Naming Scheme of a project file, find the source files
private package Prj.Nmsc is
diff --git a/gcc/ada/prj-pars.adb b/gcc/ada/prj-pars.adb
index b0b52d65f34..4f4b9043c57 100644
--- a/gcc/ada/prj-pars.adb
+++ b/gcc/ada/prj-pars.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/prj-pars.ads b/gcc/ada/prj-pars.ads
index 15a17be3b45..d94b0720f24 100644
--- a/gcc/ada/prj-pars.ads
+++ b/gcc/ada/prj-pars.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb
index 1e711f813d7..f39bd486b77 100644
--- a/gcc/ada/prj-part.adb
+++ b/gcc/ada/prj-part.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -129,6 +129,10 @@ package body Prj.Part is
In_Tree : Project_Node_Tree_Ref);
-- Create a virtual extending project of For_Project. Main_Project is
-- the extending all project.
+ --
+ -- The String_Value_Of is not set for the automatically added with
+ -- clause and keeps the default value of No_Name. This enables Prj.PP
+ -- to skip these automatically added with clauses to be processed.
procedure Look_For_Virtual_Projects_For
(Proj : Project_Node_Id;
@@ -328,6 +332,15 @@ package body Prj.Part is
-- Source_Dirs empty list: nothing to do
+ -- Put virtual project into Projects_Htable
+
+ Prj.Tree.Tree_Private_Part.Projects_Htable.Set
+ (T => In_Tree.Projects_HT,
+ K => Virtual_Name_Id,
+ E => (Name => Virtual_Name_Id,
+ Node => Virtual_Project,
+ Canonical_Path => No_Name,
+ Extended => False));
end Create_Virtual_Extending_Project;
----------------------------
diff --git a/gcc/ada/prj-part.ads b/gcc/ada/prj-part.ads
index 861ec3ca37a..38f8d8130a2 100644
--- a/gcc/ada/prj-part.ads
+++ b/gcc/ada/prj-part.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,7 +24,7 @@
-- --
------------------------------------------------------------------------------
--- Implements the parsing of project files into a tree.
+-- Implements the parsing of project files into a tree
with Prj.Tree; use Prj.Tree;
diff --git a/gcc/ada/prj-pp.adb b/gcc/ada/prj-pp.adb
index 597c0dddcae..bf9305966d9 100644
--- a/gcc/ada/prj-pp.adb
+++ b/gcc/ada/prj-pp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -38,7 +38,7 @@ package body Prj.PP is
Not_Tested : array (Project_Node_Kind) of Boolean := (others => True);
Max_Line_Length : constant := Hostparm.Max_Line_Length - 5;
- -- Maximum length of a line.
+ -- Maximum length of a line
Column : Natural := 0;
-- Column number of the last character in the line. Used to avoid
@@ -91,7 +91,7 @@ package body Prj.PP is
-- Outputs a name
procedure Start_Line (Indent : Natural);
- -- Outputs the indentation at the beginning of the line.
+ -- Outputs the indentation at the beginning of the line
procedure Output_String (S : Name_Id);
-- Outputs a string using the default output procedures
@@ -114,10 +114,10 @@ package body Prj.PP is
Write_Char : Write_Char_Ap := Output.Write_Char'Access;
Write_Eol : Write_Eol_Ap := Output.Write_Eol'Access;
Write_Str : Write_Str_Ap := Output.Write_Str'Access;
- -- These three access to procedure values are used for the output.
+ -- These three access to procedure values are used for the output
Last_Line_Is_Empty : Boolean := False;
- -- Used to avoid two consecutive empty lines.
+ -- Used to avoid two consecutive empty lines
---------------------------
-- Output_Attribute_Name --
@@ -337,6 +337,11 @@ package body Prj.PP is
if Extended_Project_Path_Of (Node, In_Tree) /= No_Name then
Write_String (" extends ");
+
+ if Is_Extending_All (Node, In_Tree) then
+ Write_String ("all ");
+ end if;
+
Output_String (Extended_Project_Path_Of (Node, In_Tree));
end if;
@@ -361,7 +366,14 @@ package body Prj.PP is
when N_With_Clause =>
pragma Debug (Indicate_Tested (N_With_Clause));
- if Name_Of (Node, In_Tree) /= No_Name then
+ -- The with clause will sometimes contain an invalid name
+ -- when we are importing a virtual project from an
+ -- extending all project. Do not output anything in this
+ -- case
+
+ if Name_Of (Node, In_Tree) /= No_Name
+ and then String_Value_Of (Node, In_Tree) /= No_Name
+ then
if First_With_In_List then
Print (First_Comment_Before (Node, In_Tree), Indent);
Start_Line (Indent);
diff --git a/gcc/ada/prj-pp.ads b/gcc/ada/prj-pp.ads
index 7c4a4acafde..806eb9c6ea3 100644
--- a/gcc/ada/prj-pp.ads
+++ b/gcc/ada/prj-pp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,19 +24,19 @@
-- --
------------------------------------------------------------------------------
--- This package is the Project File Pretty Printer.
--- It is used to output a project file from a project file tree.
--- It is used by gnatname to update or create project files.
--- It is also used GPS to display project file trees.
--- It can also be used for debugging purposes for tools that create project
--- file trees.
+-- This package is the Project File Pretty Printer
+
+-- Used to output a project file from a project file tree.
+-- Used by gnatname to update or create project files.
+-- Also used GPS to display project file trees.
+-- Also be used for debugging tools that create project file trees.
with Prj.Tree;
package Prj.PP is
- -- The following access to procedure types are used
- -- to redirect output when calling Pretty_Print.
+ -- The following access to procedure types are used to redirect output when
+ -- calling Pretty_Print.
type Write_Char_Ap is access procedure (C : Character);
@@ -54,8 +54,8 @@ package Prj.PP is
W_Eol : Write_Eol_Ap := null;
W_Str : Write_Str_Ap := null;
Backward_Compatibility : Boolean);
- -- Output a project file, using either the default output
- -- routines, or the ones specified by W_Char, W_Eol and W_Str.
+ -- Output a project file, using either the default output routines, or the
+ -- ones specified by W_Char, W_Eol and W_Str.
--
-- Increment is the number of spaces for each indentation level.
--
@@ -65,10 +65,10 @@ package Prj.PP is
-- If Eliminate_Empty_Case_Constructions is True, then case constructions
-- and case items that do not include any declarations will not be output.
--
- -- If Minimize_Empty_Lines is True, empty lines will be output only
- -- after the last with clause, after the line declaring the project name,
- -- after the last declarative item of the project and before each
- -- package declaration. Otherwise, more empty lines are output.
+ -- If Minimize_Empty_Lines is True, empty lines will be output only after
+ -- the last with clause, after the line declaring the project name, after
+ -- the last declarative item of the project and before each package
+ -- declaration. Otherwise, more empty lines are output.
--
-- If Backward_Compatibility is True, then new attributes (Spec,
-- Spec_Suffix, Body, Body_Suffix) will be replaced by obsolete ones
@@ -78,8 +78,8 @@ package Prj.PP is
private
procedure Output_Statistics;
- -- This procedure can be used after one or more calls to Pretty_Print
- -- to display what Project_Node_Kinds have not been exercised by the
- -- call(s) to Pretty_Print. It is used only for testing purposes.
+ -- This procedure can be used after one or more calls to Pretty_Print to
+ -- display what Project_Node_Kinds have not been exercised by the call(s)
+ -- to Pretty_Print. It is used only for testing purposes.
end Prj.PP;
diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb
index da23ec7b10c..f9b5619c5bc 100644
--- a/gcc/ada/prj-proc.adb
+++ b/gcc/ada/prj-proc.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1129,7 +1129,7 @@ package body Prj.Proc is
end loop;
end if;
- Success := Total_Errors_Detected <= 0;
+ Success := Total_Errors_Detected = 0;
end Process;
-------------------------------
diff --git a/gcc/ada/prj-proc.ads b/gcc/ada/prj-proc.ads
index e0ab87dd4ad..a94137542e2 100644
--- a/gcc/ada/prj-proc.ads
+++ b/gcc/ada/prj-proc.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -25,8 +25,8 @@
------------------------------------------------------------------------------
-- This package is used to convert a project file tree (see prj-tree.ads) to
--- project file data structures (see prj.ads), taking into account
--- the environment (external references).
+-- project file data structures (see prj.ads), taking into account the
+-- environment (external references).
with Prj.Tree; use Prj.Tree;
@@ -40,9 +40,9 @@ package Prj.Proc is
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
Follow_Links : Boolean := True);
- -- Process a project file tree into project file data structures.
- -- If Report_Error is null, use the error reporting mechanism.
- -- Otherwise, report errors using Report_Error.
+ -- Process a project file tree into project file data structures. If
+ -- Report_Error is null, use the error reporting mechanism. Otherwise,
+ -- report errors using Report_Error.
--
-- If Follow_Links is False, it is assumed that the project doesn't contain
-- any file duplicated through symbolic links (although the latter are
diff --git a/gcc/ada/prj-strt.adb b/gcc/ada/prj-strt.adb
index d3615d14480..b1388079719 100644
--- a/gcc/ada/prj-strt.adb
+++ b/gcc/ada/prj-strt.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,13 +24,13 @@
-- --
------------------------------------------------------------------------------
-with Err_Vars; use Err_Vars;
-with Namet; use Namet;
-with Prj.Attr; use Prj.Attr;
-with Prj.Err; use Prj.Err;
+with Err_Vars; use Err_Vars;
+with Namet; use Namet;
+with Prj.Attr; use Prj.Attr;
+with Prj.Err; use Prj.Err;
with Snames;
with Table;
-with Uintp; use Uintp;
+with Uintp; use Uintp;
package body Prj.Strt is
@@ -64,7 +64,7 @@ package body Prj.Strt is
Table_Initial => Choices_Initial,
Table_Increment => Choices_Increment,
Table_Name => "Prj.Strt.Choices");
- -- Used to store the case labels and check that there is no duplicate.
+ -- Used to store the case labels and check that there is no duplicate
package Choice_Lasts is
new Table.Table (Table_Component_Type => Choice_Node_Id,
@@ -107,7 +107,7 @@ package body Prj.Strt is
Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id;
External_Value : out Project_Node_Id);
- -- Parse an external reference. Current token is "external".
+ -- Parse an external reference. Current token is "external"
procedure Attribute_Reference
(In_Tree : Project_Node_Tree_Ref;
@@ -115,7 +115,7 @@ package body Prj.Strt is
First_Attribute : Attribute_Node_Id;
Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id);
- -- Parse an attribute reference. Current token is an apostrophe.
+ -- Parse an attribute reference. Current token is an apostrophe
procedure Terms
(In_Tree : Project_Node_Tree_Ref;
diff --git a/gcc/ada/prj-strt.ads b/gcc/ada/prj-strt.ads
index a1575b807ce..74dc37457fe 100644
--- a/gcc/ada/prj-strt.ads
+++ b/gcc/ada/prj-strt.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,7 +24,7 @@
-- --
------------------------------------------------------------------------------
--- This package implements parsing of string expressions in project files.
+-- This package implements parsing of string expressions in project files
with Prj.Tree; use Prj.Tree;
diff --git a/gcc/ada/prj-tree.adb b/gcc/ada/prj-tree.adb
index 6077d95037d..016568c749d 100644
--- a/gcc/ada/prj-tree.adb
+++ b/gcc/ada/prj-tree.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/prj-tree.ads b/gcc/ada/prj-tree.ads
index 3a7decf49ec..d5784c09e2b 100644
--- a/gcc/ada/prj-tree.ads
+++ b/gcc/ada/prj-tree.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -85,9 +85,9 @@ package Prj.Tree is
N_Case_Item,
N_Comment_Zones,
N_Comment);
- -- Each node in the tree is of a Project_Node_Kind
- -- For the signification of the fields in each node of a
- -- Project_Node_Kind, look at package Tree_Private_Part.
+ -- Each node in the tree is of a Project_Node_Kind. For the signification
+ -- of the fields in each node of Project_Node_Kind, look at package
+ -- Tree_Private_Part.
procedure Initialize (Tree : Project_Node_Tree_Ref);
-- Initialize the Project File tree: empty the Project_Nodes table
@@ -97,8 +97,8 @@ package Prj.Tree is
(In_Tree : Project_Node_Tree_Ref;
Of_Kind : Project_Node_Kind;
And_Expr_Kind : Variable_Kind := Undefined) return Project_Node_Id;
- -- Returns a Project_Node_Record with the specified Kind and
- -- Expr_Kind; all the other components have default nil values.
+ -- Returns a Project_Node_Record with the specified Kind and Expr_Kind. All
+ -- the other components have default nil values.
function Hash (N : Project_Node_Id) return Header_Num;
-- Used for hash tables where the key is a Project_Node_Id
@@ -149,10 +149,9 @@ package Prj.Tree is
-- comment, then it should be associated with this node.
procedure Set_Next_End_Node (To : Project_Node_Id);
- -- Put node To on the top of the end node stack. When an "end" line
- -- is found with this node on the top of the end node stack, the comments,
- -- if any, immediately preceding this "end" line will be associated with
- -- this node.
+ -- Put node To on the top of the end node stack. When an END line is found
+ -- with this node on the top of the end node stack, the comments, if any,
+ -- immediately preceding this "end" line will be associated with this node.
procedure Remove_Next_End_Node;
-- Remove the top of the end node stack
@@ -166,6 +165,7 @@ package Prj.Tree is
Follows_Empty_Line : Boolean := False;
Is_Followed_By_Empty_Line : Boolean := False;
end record;
+ -- Component type for Comments Table below
package Comments is new Table.Table
(Table_Component_Type => Comment_Data,
@@ -181,6 +181,7 @@ package Prj.Tree is
type Comment_Location is
(Before, After, Before_End, After_End, End_Of_Line);
+ -- Used in call to Add_Comments below
procedure Add_Comments
(To : Project_Node_Id;
@@ -193,7 +194,10 @@ package Prj.Tree is
----------------------
-- The following query functions are part of the abstract interface
- -- of the Project File tree
+ -- of the Project File tree. They provide access to fields of a project.
+
+ -- In the following, there are "valid if" comments, but no indication
+ -- of what happens if they are called with invalid arguments ???
function Name_Of
(Node : Project_Node_Id;
@@ -314,7 +318,9 @@ package Prj.Tree is
(Node : Project_Node_Id;
In_Tree : Project_Node_Tree_Ref) return Name_Id;
pragma Inline (String_Value_Of);
- -- Only valid for N_With_Clause, N_Literal_String nodes or N_Comment
+ -- Only valid for N_With_Clause, N_Literal_String nodes or N_Comment.
+ -- For a N_With_Clause created automatically for a virtual extending
+ -- project, No_Name is returned.
function Source_Index_Of
(Node : Project_Node_Id;
diff --git a/gcc/ada/prj-util.adb b/gcc/ada/prj-util.adb
index 1de7acb4035..716817d4ef0 100644
--- a/gcc/ada/prj-util.adb
+++ b/gcc/ada/prj-util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/prj-util.ads b/gcc/ada/prj-util.ads
index 667fb993c8e..5d77678af89 100644
--- a/gcc/ada/prj-util.ads
+++ b/gcc/ada/prj-util.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -67,9 +67,9 @@ package Prj.Util is
-- or if In_Array is null.
--
-- Depending on the attribute (only attributes may be associative arrays)
- -- the index may or may not be case sensitive. If the index is not
- -- case sensitive, it is first set to lower case before the search
- -- in the associative array.
+ -- the index may or may not be case sensitive. If the index is not case
+ -- sensitive, it is first set to lower case before the search in the
+ -- associative array.
function Value_Of
(Name : Name_Id;
@@ -78,10 +78,9 @@ package Prj.Util is
In_Package : Package_Id;
In_Tree : Project_Tree_Ref) return Variable_Value;
-- In a specific package,
- -- - if there exists an array Attribute_Or_Array_Name with an index
- -- Name, returns the corresponding component (depending on the
- -- attribute, the index may or may not be case sensitive, see previous
- -- function),
+ -- - if there exists an array Attribute_Or_Array_Name with an index Name,
+ -- returns the corresponding component (depending on the attribute, the
+ -- index may or may not be case sensitive, see previous function),
-- - otherwise if there is a single attribute Attribute_Or_Array_Name,
-- returns this attribute,
-- - otherwise, returns Nil_Variable_Value.
@@ -92,8 +91,8 @@ package Prj.Util is
In_Array : Name_Id;
In_Arrays : Array_Id;
In_Tree : Project_Tree_Ref) return Name_Id;
- -- Get a string array component in an array of an array list.
- -- Returns No_Name if there is no component Index, if In_Arrays is null, if
+ -- Get a string array component in an array of an array list. Returns
+ -- No_Name if there is no component Index, if In_Arrays is null, if
-- In_Array is not found in In_Arrays or if the component is a String list.
function Value_Of
@@ -108,8 +107,8 @@ package Prj.Util is
(Name : Name_Id;
In_Packages : Package_Id;
In_Tree : Project_Tree_Ref) return Package_Id;
- -- Returns a specified package in a package list. Returns No_Package
- -- if In_Packages is null or if Name is not the name of a package in
+ -- Returns a specified package in a package list. Returns No_Package if
+ -- In_Packages is null or if Name is not the name of a package in
-- Package_List. The caller must ensure that Name is in lower case.
function Value_Of
@@ -129,28 +128,28 @@ package Prj.Util is
-- the last character of each line, if possible.
type Text_File is limited private;
- -- Represents a text file. Default is invalid text file.
+ -- Represents a text file. Default is invalid text file
function Is_Valid (File : Text_File) return Boolean;
-- Returns True if File designates an open text file that
-- has not yet been closed.
procedure Open (File : out Text_File; Name : String);
- -- Open a text file. If this procedure fails, File is invalid.
+ -- Open a text file. If this procedure fails, File is invalid
function End_Of_File (File : Text_File) return Boolean;
- -- Returns True if the end of the text file File has been
- -- reached. Fails if File is invalid.
+ -- Returns True if the end of the text file File has been reached. Fails if
+ -- File is invalid.
procedure Get_Line
(File : Text_File;
Line : out String;
Last : out Natural);
- -- Reads a line from an open text file. Fails if File is invalid.
+ -- Reads a line from an open text file. Fails if File is invalid
procedure Close (File : in out Text_File);
- -- Close an open text file. File becomes invalid.
- -- Fails if File is already invalid.
+ -- Close an open text file. File becomes invalid. Fails if File is already
+ -- invalid.
private
diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb
index 5a8c2996e83..4f689adc555 100644
--- a/gcc/ada/prj.adb
+++ b/gcc/ada/prj.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -102,6 +102,8 @@ package body Prj is
Display_Library_Dir => No_Name,
Library_Src_Dir => No_Name,
Display_Library_Src_Dir => No_Name,
+ Library_ALI_Dir => No_Name,
+ Display_Library_ALI_Dir => No_Name,
Library_Name => No_Name,
Library_Kind => Static,
Lib_Internal_Name => No_Name,
@@ -121,6 +123,7 @@ package body Prj is
Known_Order_Of_Source_Dirs => True,
Object_Directory => No_Name,
Display_Object_Dir => No_Name,
+ Library_TS => Empty_Time_Stamp,
Exec_Directory => No_Name,
Display_Exec_Dir => No_Name,
Extends => No_Project,
@@ -132,6 +135,7 @@ package body Prj is
Default_Linker_Path => No_Name,
Decl => No_Declarations,
Imported_Projects => Empty_Project_List,
+ All_Imported_Projects => Empty_Project_List,
Ada_Include_Path => null,
Ada_Objects_Path => null,
Include_Path_File => No_Name,
@@ -485,7 +489,7 @@ package body Prj is
end if;
end loop;
- -- If none can be found, create a new one.
+ -- If none can be found, create a new one
if not Found then
Element :=
@@ -526,7 +530,7 @@ package body Prj is
end if;
end loop;
- -- If none can be found, create a new one.
+ -- If none can be found, create a new one
if not Found then
Element :=
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index 0f3429c09ba..e360bddb410 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -73,9 +73,11 @@ package Prj is
-- Canonical_Case_File_Name is called on this variable in the body of Prj.
-----------------------------------------------------
- -- Multi-language stuff that will be modified soon --
+ -- Multi-language Stuff That Will be Modified Soon --
-----------------------------------------------------
+ -- Still should be properly commented ???
+
type Language_Index is new Nat;
No_Language_Index : constant Language_Index := 0;
@@ -232,6 +234,7 @@ package Prj is
type Other_Source_Id is new Nat;
No_Other_Source : constant Other_Source_Id := 0;
+
type Other_Source is record
Language : Language_Index; -- language of the source
File_Name : Name_Id; -- source file simple name
@@ -273,10 +276,10 @@ package Prj is
type Policy is (Autonomous, Compliant, Controlled, Restricted);
-- Type to specify the symbol policy, when symbol control is supported.
-- See full explanation about this type in package Symbols.
- -- Autonomous: Create a symbol file without considering any reference
- -- Compliant: Try to be as compatible as possible with an existing ref
- -- Controlled: Fail if symbols are not the same as those in the reference
- -- Restricted: Restrict the symbols to those in the symbol file
+ -- Autonomous: Create a symbol file without considering any reference
+ -- Compliant: Try to be as compatible as possible with an existing ref
+ -- Controlled: Fail if symbols are not the same as those in the reference
+ -- Restricted: Restrict the symbols to those in the symbol file
type Symbol_Record is record
Symbol_File : Name_Id := No_Name;
@@ -301,12 +304,12 @@ package Prj is
type String_List_Id is new Nat;
Nil_String : constant String_List_Id := 0;
type String_Element is record
- Value : Name_Id := No_Name;
- Index : Int := 0;
+ Value : Name_Id := No_Name;
+ Index : Int := 0;
Display_Value : Name_Id := No_Name;
- Location : Source_Ptr := No_Location;
- Flag : Boolean := False;
- Next : String_List_Id := Nil_String;
+ Location : Source_Ptr := No_Location;
+ Flag : Boolean := False;
+ Next : String_List_Id := Nil_String;
end record;
-- To hold values for string list variables and array elements.
-- Component Flag may be used for various purposes. For source
@@ -353,9 +356,9 @@ package Prj is
type Variable_Id is new Nat;
No_Variable : constant Variable_Id := 0;
type Variable is record
- Next : Variable_Id := No_Variable;
- Name : Name_Id;
- Value : Variable_Value;
+ Next : Variable_Id := No_Variable;
+ Name : Name_Id;
+ Value : Variable_Value;
end record;
-- To hold the list of variables in a project file and in packages
@@ -430,7 +433,7 @@ package Prj is
Parent : Package_Id := No_Package;
Next : Package_Id := No_Package;
end record;
- -- A package. Includes declarations that may include other packages
+ -- A package (includes declarations that may include other packages)
package Package_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Package_Element,
@@ -473,8 +476,8 @@ package Prj is
-- The position in the project file source where
-- Ada_Spec_Suffix is defined.
- Impl_Suffixes : Impl_Suffix_Array := No_Impl_Suffixes;
- Supp_Suffixes : Supp_Language_Index := No_Supp_Language_Index;
+ Impl_Suffixes : Impl_Suffix_Array := No_Impl_Suffixes;
+ Supp_Suffixes : Supp_Language_Index := No_Supp_Language_Index;
-- The source suffixes of the different languages
Body_Suffix : Array_Element_Id := No_Array_Element;
@@ -553,7 +556,7 @@ package Prj is
Supp_Languages : Supp_Language_Index := No_Supp_Language_Index;
-- Indicate the different languages of the source of this project
- First_Referred_By : Project_Id := No_Project;
+ First_Referred_By : Project_Id := No_Project;
-- The project, if any, that was the first to be known as importing or
-- extending this project. Set by Prj.Proc.Process.
@@ -585,6 +588,7 @@ package Prj is
-- Directory where the project file resides. Set by Prj.Proc.Process
Display_Directory : Name_Id := No_Name;
+ -- comment ???
Dir_Path : String_Access;
-- Same as Directory, but as an access to String. Set by
@@ -603,18 +607,31 @@ package Prj is
-- different from Library_Dir for platforms where the file names are
-- case-insensitive.
+ Library_TS : Time_Stamp_Type := Empty_Time_Stamp;
+ -- The timestamp of a library file in a library project.
+ -- Set by MLib.Prj.Check_Library.
+
Library_Src_Dir : Name_Id := No_Name;
- -- If a library project, directory where the sources and the ALI files
- -- of the library are copied. By default, if attribute Library_Src_Dir
- -- is not specified, sources are not copied anywhere and ALI files are
- -- copied in the Library Directory. Set by
- -- Prj.Nmsc.Language_Independent_Check.
+ -- If a Stand-Alone Library project, directory where the sources
+ -- of the interfaces of the library are copied. By default, if
+ -- attribute Library_Src_Dir is not specified, sources of the interfaces
+ -- are not copied anywhere. Set by Prj.Nmsc.Check_Stand_Alone_Library.
Display_Library_Src_Dir : Name_Id := No_Name;
-- The name of the library source directory, for display purposes.
-- May be different from Library_Src_Dir for platforms where the file
-- names are case-insensitive.
+ Library_ALI_Dir : Name_Id := No_Name;
+ -- In a library project, directory where the ALI files are copied.
+ -- If attribute Library_ALI_Dir is not specified, ALI files are
+ -- copied in the Library_Dir. Set by Prj.Nmsc.Check_Library_Attributes.
+
+ Display_Library_ALI_Dir : Name_Id := No_Name;
+ -- The name of the library ALI directory, for display purposes. May be
+ -- different from Library_ALI_Dir for platforms where the file names are
+ -- case-insensitive.
+
Library_Name : Name_Id := No_Name;
-- If a library project, name of the library
-- Set by Prj.Nmsc.Language_Independent_Check.
@@ -653,8 +670,8 @@ package Prj is
-- A flag that indicates that there are non-Ada sources in this project
Sources : String_List_Id := Nil_String;
- -- The list of all the source file names. Set by
- -- Prj.Nmsc.Check_Ada_Naming_Scheme.
+ -- The list of all the source file names.
+ -- Set by Prj.Nmsc.Check_Ada_Naming_Scheme.
First_Other_Source : Other_Source_Id := No_Other_Source;
Last_Other_Source : Other_Source_Id := No_Other_Source;
@@ -711,13 +728,14 @@ package Prj is
-- Set by Prj.Nmsc.Check_Naming_Scheme.
First_Language_Processing : First_Language_Processing_Data :=
- Default_First_Language_Processing_Data;
+ Default_First_Language_Processing_Data;
+ -- Comment needed ???
- Supp_Language_Processing : Supp_Language_Index :=
- No_Supp_Language_Index;
+ Supp_Language_Processing : Supp_Language_Index := No_Supp_Language_Index;
+ -- Comment needed
- Default_Linker : Name_Id := No_Name;
- Default_Linker_Path : Name_Id := No_Name;
+ Default_Linker : Name_Id := No_Name;
+ Default_Linker_Path : Name_Id := No_Name;
Decl : Declarations := No_Declarations;
-- The declarations (variables, attributes and packages) of this
@@ -727,6 +745,10 @@ package Prj is
-- The list of all directly imported projects, if any. Set by
-- Prj.Proc.Process.
+ All_Imported_Projects : Project_List := Empty_Project_List;
+ -- The list of all projects imported directly or indirectly, if any.
+ -- Set by Make.Initialize.
+
Ada_Include_Path : String_Access := null;
-- The cached value of ADA_INCLUDE_PATH for this project file. Do not
-- use this field directly outside of the compiler, use
@@ -771,7 +793,7 @@ package Prj is
-- A flag to avoid checking repetitively the naming scheme of
-- this project file. Set by Prj.Nmsc.Check_Ada_Naming_Scheme.
- Seen : Boolean := False;
+ Seen : Boolean := False;
-- A flag to mark a project as "visited" to avoid processing the same
-- project several time.
@@ -943,14 +965,14 @@ package Prj is
In_Project : Project_Data;
In_Tree : Project_Tree_Ref) return Boolean;
-- Return True when Language is one of the languages used in
- -- project Project.
+ -- project In_Project.
procedure Set
(Language : Language_Index;
Present : Boolean;
In_Project : in out Project_Data;
In_Tree : Project_Tree_Ref);
- -- Indicate if Language is or not a language used in project Project
+ -- Indicate if Language is or not a language used in project In_Project
function Language_Processing_Data_Of
(Language : Language_Index;
@@ -1018,6 +1040,7 @@ private
Table_Low_Bound => 1,
Table_Initial => 5,
Table_Increment => 100);
+ -- Comment ???
package Path_File_Table is new GNAT.Dynamic_Tables
(Table_Component_Type => Name_Id,
@@ -1045,10 +1068,11 @@ private
-- A table to store the object dirs, before creating the object path file
type Private_Project_Tree_Data is record
- Namings : Naming_Table.Instance;
- Path_Files : Path_File_Table.Instance;
- Source_Paths : Source_Path_Table.Instance;
- Object_Paths : Object_Path_Table.Instance;
- Default_Naming : Naming_Data;
+ Namings : Naming_Table.Instance;
+ Path_Files : Path_File_Table.Instance;
+ Source_Paths : Source_Path_Table.Instance;
+ Object_Paths : Object_Path_Table.Instance;
+ Default_Naming : Naming_Data;
end record;
+ -- Comment ???
end Prj;
diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c
new file mode 100644
index 00000000000..49b1791577c
--- /dev/null
+++ b/gcc/ada/raise-gcc.c
@@ -0,0 +1,1151 @@
+/****************************************************************************
+ * *
+ * GNAT COMPILER COMPONENTS *
+ * *
+ * R A I S E - G C C *
+ * *
+ * C Implementation File *
+ * *
+ * Copyright (C) 1992-2005, Free Software Foundation, Inc. *
+ * *
+ * GNAT is free software; you can redistribute it and/or modify it under *
+ * terms of the GNU General Public License as published by the Free Soft- *
+ * ware Foundation; either version 2, or (at your option) any later ver- *
+ * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
+ * OUT 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 distributed with GNAT; see file COPYING. If not, write *
+ * to the Free Software Foundation, 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301, USA. *
+ * *
+ * As a special exception, if you link this file with other files to *
+ * produce an executable, this file does not by itself cause the resulting *
+ * executable to be covered by the GNU General Public License. This except- *
+ * ion does not however invalidate any other reasons why the executable *
+ * file might be covered by the GNU Public License. *
+ * *
+ * GNAT was originally developed by the GNAT team at New York University. *
+ * Extensive contributions were provided by Ada Core Technologies Inc. *
+ * *
+ ****************************************************************************/
+
+/* Code related to the integration of the GCC mechanism for exception
+ handling. */
+
+#ifdef IN_RTS
+#include "tconfig.h"
+/* In the top-of-tree GCC, tconfig does not include tm.h, but in GCC 3.2
+ it does. To avoid branching raise.c just for that purpose, we kludge by
+ looking for a symbol always defined by tm.h and if it's not defined,
+ we include it. */
+#ifndef FIRST_PSEUDO_REGISTER
+#include "coretypes.h"
+#include "tm.h"
+#endif
+#include "tsystem.h"
+#include <sys/stat.h>
+#include <stdarg.h>
+typedef char bool;
+# define true 1
+# define false 0
+#else
+#include "config.h"
+#include "system.h"
+#endif
+
+#include "adaint.h"
+#include "raise.h"
+
+/* The names of a couple of "standard" routines for unwinding/propagation
+ actually vary depending on the underlying GCC scheme for exception handling
+ (SJLJ or DWARF). We need a consistently named interface to import from
+ a-except, so wrappers are defined here.
+
+ Besides, eventhough the compiler is never setup to use the GCC propagation
+ circuitry, it still relies on exceptions internally and part of the sources
+ to handle to exceptions are shared with the run-time library. We need
+ dummy definitions for the wrappers to satisfy the linker in this case.
+
+ The types to be used by those wrappers in the run-time library are target
+ types exported by unwind.h. We used to piggyback on them for the compiler
+ stubs, but there is no guarantee that unwind.h is always in sight so we
+ define our own set below. These are dummy types as the wrappers are never
+ called in the compiler case. */
+
+#ifdef IN_RTS
+
+#include "unwind.h"
+
+typedef struct _Unwind_Context _Unwind_Context;
+typedef struct _Unwind_Exception _Unwind_Exception;
+
+#else
+
+typedef void _Unwind_Context;
+typedef void _Unwind_Exception;
+typedef int _Unwind_Reason_Code;
+
+#endif
+
+_Unwind_Reason_Code
+__gnat_Unwind_RaiseException (_Unwind_Exception *);
+
+_Unwind_Reason_Code
+__gnat_Unwind_ForcedUnwind (_Unwind_Exception *, void *, void *);
+
+
+#ifdef IN_RTS /* For eh personality routine */
+
+#include "dwarf2.h"
+#include "unwind-dw2-fde.h"
+#include "unwind-pe.h"
+
+
+/* --------------------------------------------------------------
+ -- The DB stuff below is there for debugging purposes only. --
+ -------------------------------------------------------------- */
+
+#define DB_PHASES 0x1
+#define DB_CSITE 0x2
+#define DB_ACTIONS 0x4
+#define DB_REGIONS 0x8
+
+#define DB_ERR 0x1000
+
+/* The "action" stuff below is also there for debugging purposes only. */
+
+typedef struct
+{
+ _Unwind_Action phase;
+ char * description;
+} phase_descriptor;
+
+static phase_descriptor phase_descriptors[]
+ = {{ _UA_SEARCH_PHASE, "SEARCH_PHASE" },
+ { _UA_CLEANUP_PHASE, "CLEANUP_PHASE" },
+ { _UA_HANDLER_FRAME, "HANDLER_FRAME" },
+ { _UA_FORCE_UNWIND, "FORCE_UNWIND" },
+ { -1, 0}};
+
+static int
+db_accepted_codes (void)
+{
+ static int accepted_codes = -1;
+
+ if (accepted_codes == -1)
+ {
+ char * db_env = (char *) getenv ("EH_DEBUG");
+
+ accepted_codes = db_env ? (atoi (db_env) | DB_ERR) : 0;
+ /* Arranged for ERR stuff to always be visible when the variable
+ is defined. One may just set the variable to 0 to see the ERR
+ stuff only. */
+ }
+
+ return accepted_codes;
+}
+
+#define DB_INDENT_INCREASE 0x01
+#define DB_INDENT_DECREASE 0x02
+#define DB_INDENT_OUTPUT 0x04
+#define DB_INDENT_NEWLINE 0x08
+#define DB_INDENT_RESET 0x10
+
+#define DB_INDENT_UNIT 8
+
+static void
+db_indent (int requests)
+{
+ static int current_indentation_level = 0;
+
+ if (requests & DB_INDENT_RESET)
+ {
+ current_indentation_level = 0;
+ }
+
+ if (requests & DB_INDENT_INCREASE)
+ {
+ current_indentation_level ++;
+ }
+
+ if (requests & DB_INDENT_DECREASE)
+ {
+ current_indentation_level --;
+ }
+
+ if (requests & DB_INDENT_NEWLINE)
+ {
+ fprintf (stderr, "\n");
+ }
+
+ if (requests & DB_INDENT_OUTPUT)
+ {
+ fprintf (stderr, "%*s",
+ current_indentation_level * DB_INDENT_UNIT, " ");
+ }
+
+}
+
+static void ATTRIBUTE_PRINTF_2
+db (int db_code, char * msg_format, ...)
+{
+ if (db_accepted_codes () & db_code)
+ {
+ va_list msg_args;
+
+ db_indent (DB_INDENT_OUTPUT);
+
+ va_start (msg_args, msg_format);
+ vfprintf (stderr, msg_format, msg_args);
+ va_end (msg_args);
+ }
+}
+
+static void
+db_phases (int phases)
+{
+ phase_descriptor *a = phase_descriptors;
+
+ if (! (db_accepted_codes() & DB_PHASES))
+ return;
+
+ db (DB_PHASES, "\n");
+
+ for (; a->description != 0; a++)
+ if (phases & a->phase)
+ db (DB_PHASES, "%s ", a->description);
+
+ db (DB_PHASES, " :\n");
+}
+
+
+/* ---------------------------------------------------------------
+ -- Now come a set of useful structures and helper routines. --
+ --------------------------------------------------------------- */
+
+/* There are three major runtime tables involved, generated by the
+ GCC back-end. Contents slightly vary depending on the underlying
+ implementation scheme (dwarf zero cost / sjlj).
+
+ =======================================
+ * Tables for the dwarf zero cost case *
+ =======================================
+
+ call_site []
+ -------------------------------------------------------------------
+ * region-start | region-length | landing-pad | first-action-index *
+ -------------------------------------------------------------------
+
+ Identify possible actions to be taken and where to resume control
+ for that when an exception propagates through a pc inside the region
+ delimited by start and length.
+
+ A null landing-pad indicates that nothing is to be done.
+
+ Otherwise, first-action-index provides an entry into the action[]
+ table which heads a list of possible actions to be taken (see below).
+
+ If it is determined that indeed an action should be taken, that
+ is, if one action filter matches the exception being propagated,
+ then control should be transfered to landing-pad.
+
+ A null first-action-index indicates that there are only cleanups
+ to run there.
+
+ action []
+ -------------------------------
+ * action-filter | next-action *
+ -------------------------------
+
+ This table contains lists (called action chains) of possible actions
+ associated with call-site entries described in the call-site [] table.
+ There is at most one action list per call-site entry.
+
+ A null action-filter indicates a cleanup.
+
+ Non null action-filters provide an index into the ttypes [] table
+ (see below), from which information may be retrieved to check if it
+ matches the exception being propagated.
+
+ action-filter > 0 means there is a regular handler to be run,
+
+ action-filter < 0 means there is a some "exception_specification"
+ data to retrieve, which is only relevant for C++
+ and should never show up for Ada.
+
+ next-action indexes the next entry in the list. 0 indicates there is
+ no other entry.
+
+ ttypes []
+ ---------------
+ * ttype-value *
+ ---------------
+
+ A null value indicates a catch-all handler in C++, and an "others"
+ handler in Ada.
+
+ Non null values are used to match the exception being propagated:
+ In C++ this is a pointer to some rtti data, while in Ada this is an
+ exception id.
+
+ The special id value 1 indicates an "all_others" handler.
+
+ For C++, this table is actually also used to store "exception
+ specification" data. The differentiation between the two kinds
+ of entries is made by the sign of the associated action filter,
+ which translates into positive or negative offsets from the
+ so called base of the table:
+
+ Exception Specification data is stored at positive offsets from
+ the ttypes table base, which Exception Type data is stored at
+ negative offsets:
+
+ ---------------------------------------------------------------------------
+
+ Here is a quick summary of the tables organization:
+
+ +-- Unwind_Context (pc, ...)
+ |
+ |(pc)
+ |
+ | CALL-SITE[]
+ |
+ | +=============================================================+
+ | | region-start + length | landing-pad | first-action-index |
+ | +=============================================================+
+ +-> | pc range 0 => no-action 0 => cleanups only |
+ | !0 => jump @ N --+ |
+ +====================================================== | ====+
+ |
+ |
+ ACTION [] |
+ |
+ +==========================================================+ |
+ | action-filter | next-action | |
+ +==========================================================+ |
+ | 0 => cleanup | |
+ | >0 => ttype index for handler ------+ 0 => end of chain | <-+
+ | <0 => ttype index for spec data | |
+ +==================================== | ===================+
+ |
+ |
+ TTYPES [] |
+ | Offset negated from
+ +=====================+ | the actual base.
+ | ttype-value | |
+ +============+=====================+ |
+ | | 0 => "others" | |
+ | ... | 1 => "all others" | <---+
+ | | X => exception id |
+ | handlers +---------------------+
+ | | ... |
+ | ... | ... |
+ | | ... |
+ +============+=====================+ <<------ Table base
+ | ... | ... |
+ | specs | ... | (should not see negative filter
+ | ... | ... | values for Ada).
+ +============+=====================+
+
+
+ ============================
+ * Tables for the sjlj case *
+ ============================
+
+ So called "function contexts" are pushed on a context stack by calls to
+ _Unwind_SjLj_Register on function entry, and popped off at exit points by
+ calls to _Unwind_SjLj_Unregister. The current call_site for a function is
+ updated in the function context as the function's code runs along.
+
+ The generic unwinding engine in _Unwind_RaiseException walks the function
+ context stack and not the actual call chain.
+
+ The ACTION and TTYPES tables remain unchanged, which allows to search them
+ during the propagation phase to determine wether or not the propagated
+ exception is handled somewhere. When it is, we only "jump" up once directly
+ to the context where the handler will be found. Besides, this allows "break
+ exception unhandled" to work also
+
+ The CALL-SITE table is setup differently, though: the pc attached to the
+ unwind context is a direct index into the table, so the entries in this
+ table do not hold region bounds any more.
+
+ A special index (-1) is used to indicate that no action is possibly
+ connected with the context at hand, so null landing pads cannot appear
+ in the table.
+
+ Additionally, landing pad values in the table do not represent code address
+ to jump at, but so called "dispatch" indices used by a common landing pad
+ for the function to switch to the appropriate post-landing-pad.
+
+ +-- Unwind_Context (pc, ...)
+ |
+ | pc = call-site index
+ | 0 => terminate (should not see this for Ada)
+ | -1 => no-action
+ |
+ | CALL-SITE[]
+ |
+ | +=====================================+
+ | | landing-pad | first-action-index |
+ | +=====================================+
+ +-> | 0 => cleanups only |
+ | dispatch index N |
+ +=====================================+
+
+
+ ===================================
+ * Basic organization of this unit *
+ ===================================
+
+ The major point of this unit is to provide an exception propagation
+ personality routine for Ada. This is __gnat_eh_personality.
+
+ It is provided with a pointer to the propagated exception, an unwind
+ context describing a location the propagation is going through, and a
+ couple of other arguments including a description of the current
+ propagation phase.
+
+ It shall return to the generic propagation engine what is to be performed
+ next, after possible context adjustments, depending on what it finds in the
+ traversed context (a handler for the exception, a cleanup, nothing, ...),
+ and on the propagation phase.
+
+ A number of structures and subroutines are used for this purpose, as
+ sketched below:
+
+ o region_descriptor: General data associated with the context (base pc,
+ call-site table, action table, ttypes table, ...)
+
+ o action_descriptor: Data describing the action to be taken for the
+ propagated exception in the provided context (kind of action: nothing,
+ handler, cleanup; pointer to the action table entry, ...).
+
+ raise
+ |
+ ... (a-except.adb)
+ |
+ Propagate_Exception (a-exexpr.adb)
+ |
+ |
+ _Unwind_RaiseException (libgcc)
+ |
+ | (Ada frame)
+ |
+ +--> __gnat_eh_personality (context, exception)
+ |
+ +--> get_region_descriptor_for (context)
+ |
+ +--> get_action_descriptor_for (context, exception, region)
+ | |
+ | +--> get_call_site_action_for (context, region)
+ | (one version for each underlying scheme)
+ |
+ +--> setup_to_install (context)
+
+ This unit is inspired from the C++ version found in eh_personality.cc,
+ part of libstdc++-v3.
+
+*/
+
+
+/* This is an incomplete "proxy" of the structure of exception objects as
+ built by the GNAT runtime library. Accesses to other fields than the common
+ header are performed through subprogram calls to alleviate the need of an
+ exact counterpart here and potential alignment/size issues for the common
+ header. See a-exexpr.adb. */
+
+typedef struct
+{
+ _Unwind_Exception common;
+ /* ABI header, maximally aligned. */
+} _GNAT_Exception;
+
+/* The two constants below are specific ttype identifiers for special
+ exception ids. Their type should match what a-exexpr exports. */
+
+extern const int __gnat_others_value;
+#define GNAT_OTHERS ((_Unwind_Ptr) &__gnat_others_value)
+
+extern const int __gnat_all_others_value;
+#define GNAT_ALL_OTHERS ((_Unwind_Ptr) &__gnat_all_others_value)
+
+/* Describe the useful region data associated with an unwind context. */
+
+typedef struct
+{
+ /* The base pc of the region. */
+ _Unwind_Ptr base;
+
+ /* Pointer to the Language Specific Data for the region. */
+ _Unwind_Ptr lsda;
+
+ /* Call-Site data associated with this region. */
+ unsigned char call_site_encoding;
+ const unsigned char *call_site_table;
+
+ /* The base to which are relative landing pad offsets inside the call-site
+ entries . */
+ _Unwind_Ptr lp_base;
+
+ /* Action-Table associated with this region. */
+ const unsigned char *action_table;
+
+ /* Ttype data associated with this region. */
+ unsigned char ttype_encoding;
+ const unsigned char *ttype_table;
+ _Unwind_Ptr ttype_base;
+
+} region_descriptor;
+
+static void
+db_region_for (region_descriptor *region, _Unwind_Context *uw_context)
+{
+ _Unwind_Ptr ip = _Unwind_GetIP (uw_context) - 1;
+
+ if (! (db_accepted_codes () & DB_REGIONS))
+ return;
+
+ db (DB_REGIONS, "For ip @ 0x%08x => ", ip);
+
+ if (region->lsda)
+ db (DB_REGIONS, "lsda @ 0x%x", region->lsda);
+ else
+ db (DB_REGIONS, "no lsda");
+
+ db (DB_REGIONS, "\n");
+}
+
+/* Retrieve the ttype entry associated with FILTER in the REGION's
+ ttype table. */
+
+static const _Unwind_Ptr
+get_ttype_entry_for (region_descriptor *region, long filter)
+{
+ _Unwind_Ptr ttype_entry;
+
+ filter *= size_of_encoded_value (region->ttype_encoding);
+ read_encoded_value_with_base
+ (region->ttype_encoding, region->ttype_base,
+ region->ttype_table - filter, &ttype_entry);
+
+ return ttype_entry;
+}
+
+/* Fill out the REGION descriptor for the provided UW_CONTEXT. */
+
+static void
+get_region_description_for (_Unwind_Context *uw_context,
+ region_descriptor *region)
+{
+ const unsigned char * p;
+ _Unwind_Word tmp;
+ unsigned char lpbase_encoding;
+
+ /* Get the base address of the lsda information. If the provided context
+ is null or if there is no associated language specific data, there's
+ nothing we can/should do. */
+ region->lsda
+ = (_Unwind_Ptr) (uw_context
+ ? _Unwind_GetLanguageSpecificData (uw_context) : 0);
+
+ if (! region->lsda)
+ return;
+
+ /* Parse the lsda and fill the region descriptor. */
+ p = (char *)region->lsda;
+
+ region->base = _Unwind_GetRegionStart (uw_context);
+
+ /* Find @LPStart, the base to which landing pad offsets are relative. */
+ lpbase_encoding = *p++;
+ if (lpbase_encoding != DW_EH_PE_omit)
+ p = read_encoded_value
+ (uw_context, lpbase_encoding, p, &region->lp_base);
+ else
+ region->lp_base = region->base;
+
+ /* Find @TType, the base of the handler and exception spec type data. */
+ region->ttype_encoding = *p++;
+ if (region->ttype_encoding != DW_EH_PE_omit)
+ {
+ p = read_uleb128 (p, &tmp);
+ region->ttype_table = p + tmp;
+ }
+ else
+ region->ttype_table = 0;
+
+ region->ttype_base
+ = base_of_encoded_value (region->ttype_encoding, uw_context);
+
+ /* Get the encoding and length of the call-site table; the action table
+ immediately follows. */
+ region->call_site_encoding = *p++;
+ region->call_site_table = read_uleb128 (p, &tmp);
+
+ region->action_table = region->call_site_table + tmp;
+}
+
+
+/* Describe an action to be taken when propagating an exception up to
+ some context. */
+
+typedef enum
+{
+ /* Found some call site base data, but need to analyze further
+ before being able to decide. */
+ unknown,
+
+ /* There is nothing relevant in the context at hand. */
+ nothing,
+
+ /* There are only cleanups to run in this context. */
+ cleanup,
+
+ /* There is a handler for the exception in this context. */
+ handler
+} action_kind;
+
+/* filter value for cleanup actions. */
+const int cleanup_filter = 0;
+
+typedef struct
+{
+ /* The kind of action to be taken. */
+ action_kind kind;
+
+ /* A pointer to the action record entry. */
+ const unsigned char *table_entry;
+
+ /* Where we should jump to actually take an action (trigger a cleanup or an
+ exception handler). */
+ _Unwind_Ptr landing_pad;
+
+ /* If we have a handler matching our exception, these are the filter to
+ trigger it and the corresponding id. */
+ _Unwind_Sword ttype_filter;
+ _Unwind_Ptr ttype_entry;
+
+} action_descriptor;
+
+static void
+db_action_for (action_descriptor *action, _Unwind_Context *uw_context)
+{
+ _Unwind_Ptr ip = _Unwind_GetIP (uw_context) - 1;
+
+ db (DB_ACTIONS, "For ip @ 0x%08x => ", ip);
+
+ switch (action->kind)
+ {
+ case unknown:
+ db (DB_ACTIONS, "lpad @ 0x%x, record @ 0x%x\n",
+ action->landing_pad, action->table_entry);
+ break;
+
+ case nothing:
+ db (DB_ACTIONS, "Nothing\n");
+ break;
+
+ case cleanup:
+ db (DB_ACTIONS, "Cleanup\n");
+ break;
+
+ case handler:
+ db (DB_ACTIONS, "Handler, filter = %d\n", action->ttype_filter);
+ break;
+
+ default:
+ db (DB_ACTIONS, "Err? Unexpected action kind !\n");
+ break;
+ }
+
+ return;
+}
+
+
+/* Search the call_site_table of REGION for an entry appropriate for the
+ UW_CONTEXT's ip. If one is found, store the associated landing_pad and
+ action_table entry, and set the ACTION kind to unknown for further
+ analysis. Otherwise, set the ACTION kind to nothing.
+
+ There are two variants of this routine, depending on the underlying
+ mechanism (dwarf/sjlj), which account for differences in the tables
+ organization.
+*/
+
+#ifdef __USING_SJLJ_EXCEPTIONS__
+
+#define __builtin_eh_return_data_regno(x) x
+
+static void
+get_call_site_action_for (_Unwind_Context *uw_context,
+ region_descriptor *region,
+ action_descriptor *action)
+{
+ _Unwind_Ptr call_site
+ = _Unwind_GetIP (uw_context) - 1;
+ /* Subtract 1 because GetIP returns the actual call_site value + 1. */
+
+ /* call_site is a direct index into the call-site table, with two special
+ values : -1 for no-action and 0 for "terminate". The latter should never
+ show up for Ada. To test for the former, beware that _Unwind_Ptr might be
+ unsigned. */
+
+ if ((int)call_site < 0)
+ {
+ action->kind = nothing;
+ return;
+ }
+ else if (call_site == 0)
+ {
+ db (DB_ERR, "========> Err, null call_site for Ada/sjlj\n");
+ action->kind = nothing;
+ return;
+ }
+ else
+ {
+ _Unwind_Word cs_lp, cs_action;
+
+ /* Let the caller know there may be an action to take, but let it
+ determine the kind. */
+ action->kind = unknown;
+
+ /* We have a direct index into the call-site table, but this table is
+ made of leb128 values, the encoding length of which is variable. We
+ can't merely compute an offset from the index, then, but have to read
+ all the entries before the one of interest. */
+
+ const unsigned char * p = region->call_site_table;
+
+ do {
+ p = read_uleb128 (p, &cs_lp);
+ p = read_uleb128 (p, &cs_action);
+ } while (--call_site);
+
+
+ action->landing_pad = cs_lp + 1;
+
+ if (cs_action)
+ action->table_entry = region->action_table + cs_action - 1;
+ else
+ action->table_entry = 0;
+
+ return;
+ }
+}
+
+#else
+/* ! __USING_SJLJ_EXCEPTIONS__ */
+
+static void
+get_call_site_action_for (_Unwind_Context *uw_context,
+ region_descriptor *region,
+ action_descriptor *action)
+{
+ _Unwind_Ptr ip
+ = _Unwind_GetIP (uw_context) - 1;
+ /* Subtract 1 because GetIP yields a call return address while we are
+ interested in information for the call point. This does not always yield
+ the exact call instruction address but always brings the ip back within
+ the corresponding region.
+
+ ??? When unwinding up from a signal handler triggered by a trap on some
+ instruction, we usually have the faulting instruction address here and
+ subtracting 1 might get us into the wrong region. */
+
+ const unsigned char * p
+ = region->call_site_table;
+
+ /* Unless we are able to determine otherwise ... */
+ action->kind = nothing;
+
+ db (DB_CSITE, "\n");
+
+ while (p < region->action_table)
+ {
+ _Unwind_Ptr cs_start, cs_len, cs_lp;
+ _Unwind_Word cs_action;
+
+ /* Note that all call-site encodings are "absolute" displacements. */
+ p = read_encoded_value (0, region->call_site_encoding, p, &cs_start);
+ p = read_encoded_value (0, region->call_site_encoding, p, &cs_len);
+ p = read_encoded_value (0, region->call_site_encoding, p, &cs_lp);
+ p = read_uleb128 (p, &cs_action);
+
+ db (DB_CSITE,
+ "c_site @ 0x%08x (+0x%03x), len = %3d, lpad @ 0x%08x (+0x%03x)\n",
+ region->base+cs_start, cs_start, cs_len,
+ region->lp_base+cs_lp, cs_lp);
+
+ /* The table is sorted, so if we've passed the ip, stop. */
+ if (ip < region->base + cs_start)
+ break;
+
+ /* If we have a match, fill the ACTION fields accordingly. */
+ else if (ip < region->base + cs_start + cs_len)
+ {
+ /* Let the caller know there may be an action to take, but let it
+ determine the kind. */
+ action->kind = unknown;
+
+ if (cs_lp)
+ action->landing_pad = region->lp_base + cs_lp;
+ else
+ action->landing_pad = 0;
+
+ if (cs_action)
+ action->table_entry = region->action_table + cs_action - 1;
+ else
+ action->table_entry = 0;
+
+ db (DB_CSITE, "+++\n");
+ return;
+ }
+ }
+
+ db (DB_CSITE, "---\n");
+}
+
+#endif
+
+/* With CHOICE an exception choice representing an "exception - when"
+ argument, and PROPAGATED_EXCEPTION a pointer to the currently propagated
+ occurrence, return true iif the latter matches the former, that is, if
+ PROPAGATED_EXCEPTION is caught by the handling code controlled by CHOICE.
+ This takes care of the special Non_Ada_Error case on VMS. */
+
+#define Is_Handled_By_Others __gnat_is_handled_by_others
+#define Language_For __gnat_language_for
+#define Import_Code_For __gnat_import_code_for
+#define EID_For __gnat_eid_for
+#define Adjust_N_Cleanups_For __gnat_adjust_n_cleanups_for
+
+extern bool Is_Handled_By_Others (_Unwind_Ptr eid);
+extern char Language_For (_Unwind_Ptr eid);
+
+extern Exception_Code Import_Code_For (_Unwind_Ptr eid);
+
+extern Exception_Id EID_For (_GNAT_Exception * e);
+extern void Adjust_N_Cleanups_For (_GNAT_Exception * e, int n);
+
+static int
+is_handled_by (_Unwind_Ptr choice, _GNAT_Exception * propagated_exception)
+{
+ /* Pointer to the GNAT exception data corresponding to the propagated
+ occurrence. */
+ _Unwind_Ptr E = (_Unwind_Ptr) EID_For (propagated_exception);
+
+ /* Base matching rules: An exception data (id) matches itself, "when
+ all_others" matches anything and "when others" matches anything unless
+ explicitly stated otherwise in the propagated occurrence. */
+
+ bool is_handled =
+ choice == E
+ || choice == GNAT_ALL_OTHERS
+ || (choice == GNAT_OTHERS && Is_Handled_By_Others (E));
+
+ /* In addition, on OpenVMS, Non_Ada_Error matches VMS exceptions, and we
+ may have different exception data pointers that should match for the
+ same condition code, if both an export and an import have been
+ registered. The import code for both the choice and the propagated
+ occurrence are expected to have been masked off regarding severity
+ bits already (at registration time for the former and from within the
+ low level exception vector for the latter). */
+#ifdef VMS
+ #define Non_Ada_Error system__aux_dec__non_ada_error
+ extern struct Exception_Data Non_Ada_Error;
+
+ is_handled |=
+ (Language_For (E) == 'V'
+ && choice != GNAT_OTHERS && choice != GNAT_ALL_OTHERS
+ && ((Language_For (choice) == 'V' && Import_Code_For (choice) != 0
+ && Import_Code_For (choice) == Import_Code_For (E))
+ || choice == (_Unwind_Ptr)&Non_Ada_Error));
+#endif
+
+ return is_handled;
+}
+
+/* Fill out the ACTION to be taken from propagating UW_EXCEPTION up to
+ UW_CONTEXT in REGION. */
+
+static void
+get_action_description_for (_Unwind_Context *uw_context,
+ _Unwind_Exception *uw_exception,
+ region_descriptor *region,
+ action_descriptor *action)
+{
+ _GNAT_Exception * gnat_exception = (_GNAT_Exception *) uw_exception;
+
+ /* Search the call site table first, which may get us a landing pad as well
+ as the head of an action record list. */
+ get_call_site_action_for (uw_context, region, action);
+ db_action_for (action, uw_context);
+
+ /* If there is not even a call_site entry, we are done. */
+ if (action->kind == nothing)
+ return;
+
+ /* Otherwise, check what we have at the place of the call site. */
+
+ /* No landing pad => no cleanups or handlers. */
+ if (action->landing_pad == 0)
+ {
+ action->kind = nothing;
+ return;
+ }
+
+ /* Landing pad + null table entry => only cleanups. */
+ else if (action->table_entry == 0)
+ {
+ action->kind = cleanup;
+ action->ttype_filter = cleanup_filter;
+ /* The filter initialization is not strictly necessary, as cleanup-only
+ landing pads don't look at the filter value. It is there to ensure
+ we don't pass random values and so trigger potential confusion when
+ installing the context later on. */
+ return;
+ }
+
+ /* Landing pad + Table entry => handlers + possible cleanups. */
+ else
+ {
+ const unsigned char * p = action->table_entry;
+
+ _Unwind_Sword ar_filter, ar_disp;
+
+ action->kind = nothing;
+
+ while (1)
+ {
+ p = read_sleb128 (p, &ar_filter);
+ read_sleb128 (p, &ar_disp);
+ /* Don't assign p here, as it will be incremented by ar_disp
+ below. */
+
+ /* Null filters are for cleanups. */
+ if (ar_filter == cleanup_filter)
+ {
+ action->kind = cleanup;
+ action->ttype_filter = cleanup_filter;
+ /* The filter initialization is required here, to ensure
+ the target landing pad branches to the cleanup code if
+ we happen not to find a matching handler. */
+ }
+
+ /* Positive filters are for regular handlers. */
+ else if (ar_filter > 0)
+ {
+ /* See if the filter we have is for an exception which matches
+ the one we are propagating. */
+ _Unwind_Ptr choice = get_ttype_entry_for (region, ar_filter);
+
+ if (is_handled_by (choice, gnat_exception))
+ {
+ action->kind = handler;
+ action->ttype_filter = ar_filter;
+ action->ttype_entry = choice;
+ return;
+ }
+ }
+
+ /* Negative filter values are for C++ exception specifications.
+ Should not be there for Ada :/ */
+ else
+ db (DB_ERR, "========> Err, filter < 0 for Ada/dwarf\n");
+
+ if (ar_disp == 0)
+ return;
+
+ p += ar_disp;
+ }
+ }
+}
+
+/* Setup in UW_CONTEXT the eh return target IP and data registers, which will
+ be restored with the others and retrieved by the landing pad once the jump
+ occurred. */
+
+static void
+setup_to_install (_Unwind_Context *uw_context,
+ _Unwind_Exception *uw_exception,
+ _Unwind_Ptr uw_landing_pad,
+ int uw_filter)
+{
+#ifndef EH_RETURN_DATA_REGNO
+ /* We should not be called if the appropriate underlying support is not
+ there. */
+ abort ();
+#else
+ /* 1/ exception object pointer, which might be provided back to
+ _Unwind_Resume (and thus to this personality routine) if we are jumping
+ to a cleanup. */
+ _Unwind_SetGR (uw_context, __builtin_eh_return_data_regno (0),
+ (_Unwind_Word)uw_exception);
+
+ /* 2/ handler switch value register, which will also be used by the target
+ landing pad to decide what action it shall take. */
+ _Unwind_SetGR (uw_context, __builtin_eh_return_data_regno (1),
+ (_Unwind_Word)uw_filter);
+
+ /* Setup the address we should jump at to reach the code where there is the
+ "something" we found. */
+ _Unwind_SetIP (uw_context, uw_landing_pad);
+#endif
+}
+
+/* The following is defined from a-except.adb. Its purpose is to enable
+ automatic backtraces upon exception raise, as provided through the
+ GNAT.Traceback facilities. */
+extern void __gnat_notify_handled_exception (void);
+extern void __gnat_notify_unhandled_exception (void);
+
+/* Below is the eh personality routine per se. We currently assume that only
+ GNU-Ada exceptions are met. */
+
+_Unwind_Reason_Code
+__gnat_eh_personality (int uw_version,
+ _Unwind_Action uw_phases,
+ _Unwind_Exception_Class uw_exception_class,
+ _Unwind_Exception *uw_exception,
+ _Unwind_Context *uw_context)
+{
+ _GNAT_Exception * gnat_exception = (_GNAT_Exception *) uw_exception;
+
+ region_descriptor region;
+ action_descriptor action;
+
+ if (uw_version != 1)
+ return _URC_FATAL_PHASE1_ERROR;
+
+ db_indent (DB_INDENT_RESET);
+ db_phases (uw_phases);
+ db_indent (DB_INDENT_INCREASE);
+
+ /* Get the region description for the context we were provided with. This
+ will tell us if there is some lsda, call_site, action and/or ttype data
+ for the associated ip. */
+ get_region_description_for (uw_context, &region);
+ db_region_for (&region, uw_context);
+
+ /* No LSDA => no handlers or cleanups => we shall unwind further up. */
+ if (! region.lsda)
+ return _URC_CONTINUE_UNWIND;
+
+ /* Search the call-site and action-record tables for the action associated
+ with this IP. */
+ get_action_description_for (uw_context, uw_exception, &region, &action);
+ db_action_for (&action, uw_context);
+
+ /* Whatever the phase, if there is nothing relevant in this frame,
+ unwinding should just go on. */
+ if (action.kind == nothing)
+ return _URC_CONTINUE_UNWIND;
+
+ /* If we found something in search phase, we should return a code indicating
+ what to do next depending on what we found. If we only have cleanups
+ around, we shall try to unwind further up to find a handler, otherwise,
+ tell we have a handler, which will trigger the second phase. */
+ if (uw_phases & _UA_SEARCH_PHASE)
+ {
+ if (action.kind == cleanup)
+ {
+ Adjust_N_Cleanups_For (gnat_exception, 1);
+ return _URC_CONTINUE_UNWIND;
+ }
+ else
+ {
+ /* Trigger the appropriate notification routines before the second
+ phase starts, which ensures the stack is still intact. */
+ __gnat_notify_handled_exception ();
+
+ return _URC_HANDLER_FOUND;
+ }
+ }
+
+ /* We found something in cleanup/handler phase, which might be the handler
+ or a cleanup for a handled occurrence, or a cleanup for an unhandled
+ occurrence (we are in a FORCED_UNWIND phase in this case). Install the
+ context to get there. */
+
+ /* If we are going to install a cleanup context, decrement the cleanup
+ count. This is required in a FORCED_UNWINDing phase (for an unhandled
+ exception), as this is used from the forced unwinding handler in
+ Ada.Exceptions.Exception_Propagation to decide wether unwinding should
+ proceed further or Unhandled_Exception_Terminate should be called. */
+ if (action.kind == cleanup)
+ Adjust_N_Cleanups_For (gnat_exception, -1);
+
+ setup_to_install
+ (uw_context, uw_exception, action.landing_pad, action.ttype_filter);
+
+ return _URC_INSTALL_CONTEXT;
+}
+
+/* Define the consistently named wrappers imported by Propagate_Exception. */
+
+#ifdef __USING_SJLJ_EXCEPTIONS__
+
+#undef _Unwind_RaiseException
+
+_Unwind_Reason_Code
+__gnat_Unwind_RaiseException (_Unwind_Exception *e)
+{
+ return _Unwind_SjLj_RaiseException (e);
+}
+
+
+#undef _Unwind_ForcedUnwind
+
+_Unwind_Reason_Code
+__gnat_Unwind_ForcedUnwind (_Unwind_Exception *e,
+ void * handler,
+ void * argument)
+{
+ return _Unwind_SjLj_ForcedUnwind (e, handler, argument);
+}
+
+
+#else /* __USING_SJLJ_EXCEPTIONS__ */
+
+_Unwind_Reason_Code
+__gnat_Unwind_RaiseException (_Unwind_Exception *e)
+{
+ return _Unwind_RaiseException (e);
+}
+
+_Unwind_Reason_Code
+__gnat_Unwind_ForcedUnwind (_Unwind_Exception *e,
+ void * handler,
+ void * argument)
+{
+ return _Unwind_ForcedUnwind (e, handler, argument);
+}
+
+#endif /* __USING_SJLJ_EXCEPTIONS__ */
+
+#else
+/* ! IN_RTS */
+
+/* Define the corresponding stubs for the compiler. */
+
+/* We don't want fancy_abort here. */
+#undef abort
+
+_Unwind_Reason_Code
+__gnat_Unwind_RaiseException (_Unwind_Exception *e ATTRIBUTE_UNUSED)
+{
+ abort ();
+}
+
+
+_Unwind_Reason_Code
+__gnat_Unwind_ForcedUnwind (_Unwind_Exception *e ATTRIBUTE_UNUSED,
+ void * handler ATTRIBUTE_UNUSED,
+ void * argument ATTRIBUTE_UNUSED)
+{
+ abort ();
+}
+
+#endif /* IN_RTS */
diff --git a/gcc/ada/raise.c b/gcc/ada/raise.c
index 48d94232a23..490c6b2ee7d 100644
--- a/gcc/ada/raise.c
+++ b/gcc/ada/raise.c
@@ -30,23 +30,15 @@
* *
****************************************************************************/
-/* Routines to support runtime exception handling */
+/* Shared routines to support exception handling.
+ Note that _gnat_builtin_longjmp should disappear at some point, replaced
+ by direct call to __builtin_longjmp from Ada code.
+ __gnat_unhandled_terminate is code shared between all exception handling
+ mechanisms */
#ifdef IN_RTS
#include "tconfig.h"
-/* In the top-of-tree GCC, tconfig does not include tm.h, but in GCC 3.2
- it does. To avoid branching raise.c just for that purpose, we kludge by
- looking for a symbol always defined by tm.h and if it's not defined,
- we include it. */
-#ifndef FIRST_PSEUDO_REGISTER
-#include "coretypes.h"
-#include "tm.h"
-#endif
#include "tsystem.h"
-#include <sys/stat.h>
-typedef char bool;
-# define true 1
-# define false 0
#else
#include "config.h"
#include "system.h"
@@ -72,1106 +64,16 @@ _gnat_builtin_longjmp (void *ptr, int flag ATTRIBUTE_UNUSED)
void
__gnat_unhandled_terminate (void)
{
- /* Special termination handling for VMS */
-
#ifdef VMS
- {
- long prvhnd;
-
- /* Remove the exception vector so it won't intercept any errors
- in the call to exit, and go into and endless loop */
-
- SYS$SETEXV (1, 0, 3, &prvhnd);
- __gnat_os_exit (1);
- }
-
-/* Termination handling for all other systems. */
-
-#elif !defined (__RT__)
- __gnat_os_exit (1);
-#endif
-}
-
-/* Below is the code related to the integration of the GCC mechanism for
- exception handling. */
-
-/* The names of a couple of "standard" routines for unwinding/propagation
- actually vary depending on the underlying GCC scheme for exception handling
- (SJLJ or DWARF). We need a consistently named interface to import from
- a-except, so wrappers are defined here.
-
- Besides, eventhough the compiler is never setup to use the GCC propagation
- circuitry, it still relies on exceptions internally and part of the sources
- to handle to exceptions are shared with the run-time library. We need
- dummy definitions for the wrappers to satisfy the linker in this case.
-
- The types to be used by those wrappers in the run-time library are target
- types exported by unwind.h. We used to piggyback on them for the compiler
- stubs, but there is no guarantee that unwind.h is always in sight so we
- define our own set below. These are dummy types as the wrappers are never
- called in the compiler case. */
-
-#ifdef IN_RTS
-
-#include "unwind.h"
-
-typedef struct _Unwind_Context _Unwind_Context;
-typedef struct _Unwind_Exception _Unwind_Exception;
-
-#else
-
-typedef void _Unwind_Context;
-typedef void _Unwind_Exception;
-typedef int _Unwind_Reason_Code;
-
-#endif
-
-_Unwind_Reason_Code
-__gnat_Unwind_RaiseException (_Unwind_Exception *);
-
-_Unwind_Reason_Code
-__gnat_Unwind_ForcedUnwind (_Unwind_Exception *, void *, void *);
-
-
-#ifdef IN_RTS /* For eh personality routine */
-
-#include "dwarf2.h"
-#include "unwind-dw2-fde.h"
-#include "unwind-pe.h"
-
-
-/* --------------------------------------------------------------
- -- The DB stuff below is there for debugging purposes only. --
- -------------------------------------------------------------- */
-
-#define DB_PHASES 0x1
-#define DB_CSITE 0x2
-#define DB_ACTIONS 0x4
-#define DB_REGIONS 0x8
-
-#define DB_ERR 0x1000
-
-/* The "action" stuff below is also there for debugging purposes only. */
-
-typedef struct
-{
- _Unwind_Action phase;
- char * description;
-} phase_descriptor;
-
-static phase_descriptor phase_descriptors[]
- = {{ _UA_SEARCH_PHASE, "SEARCH_PHASE" },
- { _UA_CLEANUP_PHASE, "CLEANUP_PHASE" },
- { _UA_HANDLER_FRAME, "HANDLER_FRAME" },
- { _UA_FORCE_UNWIND, "FORCE_UNWIND" },
- { -1, 0}};
-
-static int
-db_accepted_codes (void)
-{
- static int accepted_codes = -1;
-
- if (accepted_codes == -1)
- {
- char * db_env = (char *) getenv ("EH_DEBUG");
-
- accepted_codes = db_env ? (atoi (db_env) | DB_ERR) : 0;
- /* Arranged for ERR stuff to always be visible when the variable
- is defined. One may just set the variable to 0 to see the ERR
- stuff only. */
- }
-
- return accepted_codes;
-}
-
-#define DB_INDENT_INCREASE 0x01
-#define DB_INDENT_DECREASE 0x02
-#define DB_INDENT_OUTPUT 0x04
-#define DB_INDENT_NEWLINE 0x08
-#define DB_INDENT_RESET 0x10
-
-#define DB_INDENT_UNIT 8
-
-static void
-db_indent (int requests)
-{
- static int current_indentation_level = 0;
-
- if (requests & DB_INDENT_RESET)
- {
- current_indentation_level = 0;
- }
-
- if (requests & DB_INDENT_INCREASE)
- {
- current_indentation_level ++;
- }
-
- if (requests & DB_INDENT_DECREASE)
- {
- current_indentation_level --;
- }
-
- if (requests & DB_INDENT_NEWLINE)
- {
- fprintf (stderr, "\n");
- }
-
- if (requests & DB_INDENT_OUTPUT)
- {
- fprintf (stderr, "%*s",
- current_indentation_level * DB_INDENT_UNIT, " ");
- }
-
-}
-
-static void ATTRIBUTE_PRINTF_2
-db (int db_code, char * msg_format, ...)
-{
- if (db_accepted_codes () & db_code)
- {
- va_list msg_args;
-
- db_indent (DB_INDENT_OUTPUT);
-
- va_start (msg_args, msg_format);
- vfprintf (stderr, msg_format, msg_args);
- va_end (msg_args);
- }
-}
-
-static void
-db_phases (int phases)
-{
- phase_descriptor *a = phase_descriptors;
-
- if (! (db_accepted_codes() & DB_PHASES))
- return;
-
- db (DB_PHASES, "\n");
-
- for (; a->description != 0; a++)
- if (phases & a->phase)
- db (DB_PHASES, "%s ", a->description);
-
- db (DB_PHASES, " :\n");
-}
-
-
-/* ---------------------------------------------------------------
- -- Now come a set of useful structures and helper routines. --
- --------------------------------------------------------------- */
-
-/* There are three major runtime tables involved, generated by the
- GCC back-end. Contents slightly vary depending on the underlying
- implementation scheme (dwarf zero cost / sjlj).
-
- =======================================
- * Tables for the dwarf zero cost case *
- =======================================
-
- call_site []
- -------------------------------------------------------------------
- * region-start | region-length | landing-pad | first-action-index *
- -------------------------------------------------------------------
-
- Identify possible actions to be taken and where to resume control
- for that when an exception propagates through a pc inside the region
- delimited by start and length.
-
- A null landing-pad indicates that nothing is to be done.
-
- Otherwise, first-action-index provides an entry into the action[]
- table which heads a list of possible actions to be taken (see below).
-
- If it is determined that indeed an action should be taken, that
- is, if one action filter matches the exception being propagated,
- then control should be transfered to landing-pad.
-
- A null first-action-index indicates that there are only cleanups
- to run there.
-
- action []
- -------------------------------
- * action-filter | next-action *
- -------------------------------
-
- This table contains lists (called action chains) of possible actions
- associated with call-site entries described in the call-site [] table.
- There is at most one action list per call-site entry.
-
- A null action-filter indicates a cleanup.
-
- Non null action-filters provide an index into the ttypes [] table
- (see below), from which information may be retrieved to check if it
- matches the exception being propagated.
-
- action-filter > 0 means there is a regular handler to be run,
-
- action-filter < 0 means there is a some "exception_specification"
- data to retrieve, which is only relevant for C++
- and should never show up for Ada.
-
- next-action indexes the next entry in the list. 0 indicates there is
- no other entry.
-
- ttypes []
- ---------------
- * ttype-value *
- ---------------
-
- A null value indicates a catch-all handler in C++, and an "others"
- handler in Ada.
-
- Non null values are used to match the exception being propagated:
- In C++ this is a pointer to some rtti data, while in Ada this is an
- exception id.
-
- The special id value 1 indicates an "all_others" handler.
-
- For C++, this table is actually also used to store "exception
- specification" data. The differentiation between the two kinds
- of entries is made by the sign of the associated action filter,
- which translates into positive or negative offsets from the
- so called base of the table:
-
- Exception Specification data is stored at positive offsets from
- the ttypes table base, which Exception Type data is stored at
- negative offsets:
-
- ---------------------------------------------------------------------------
-
- Here is a quick summary of the tables organization:
-
- +-- Unwind_Context (pc, ...)
- |
- |(pc)
- |
- | CALL-SITE[]
- |
- | +=============================================================+
- | | region-start + length | landing-pad | first-action-index |
- | +=============================================================+
- +-> | pc range 0 => no-action 0 => cleanups only |
- | !0 => jump @ N --+ |
- +====================================================== | ====+
- |
- |
- ACTION [] |
- |
- +==========================================================+ |
- | action-filter | next-action | |
- +==========================================================+ |
- | 0 => cleanup | |
- | >0 => ttype index for handler ------+ 0 => end of chain | <-+
- | <0 => ttype index for spec data | |
- +==================================== | ===================+
- |
- |
- TTYPES [] |
- | Offset negated from
- +=====================+ | the actual base.
- | ttype-value | |
- +============+=====================+ |
- | | 0 => "others" | |
- | ... | 1 => "all others" | <---+
- | | X => exception id |
- | handlers +---------------------+
- | | ... |
- | ... | ... |
- | | ... |
- +============+=====================+ <<------ Table base
- | ... | ... |
- | specs | ... | (should not see negative filter
- | ... | ... | values for Ada).
- +============+=====================+
-
-
- ============================
- * Tables for the sjlj case *
- ============================
-
- So called "function contexts" are pushed on a context stack by calls to
- _Unwind_SjLj_Register on function entry, and popped off at exit points by
- calls to _Unwind_SjLj_Unregister. The current call_site for a function is
- updated in the function context as the function's code runs along.
-
- The generic unwinding engine in _Unwind_RaiseException walks the function
- context stack and not the actual call chain.
-
- The ACTION and TTYPES tables remain unchanged, which allows to search them
- during the propagation phase to determine wether or not the propagated
- exception is handled somewhere. When it is, we only "jump" up once directly
- to the context where the handler will be found. Besides, this allows "break
- exception unhandled" to work also
-
- The CALL-SITE table is setup differently, though: the pc attached to the
- unwind context is a direct index into the table, so the entries in this
- table do not hold region bounds any more.
-
- A special index (-1) is used to indicate that no action is possibly
- connected with the context at hand, so null landing pads cannot appear
- in the table.
-
- Additionally, landing pad values in the table do not represent code address
- to jump at, but so called "dispatch" indices used by a common landing pad
- for the function to switch to the appropriate post-landing-pad.
-
- +-- Unwind_Context (pc, ...)
- |
- | pc = call-site index
- | 0 => terminate (should not see this for Ada)
- | -1 => no-action
- |
- | CALL-SITE[]
- |
- | +=====================================+
- | | landing-pad | first-action-index |
- | +=====================================+
- +-> | 0 => cleanups only |
- | dispatch index N |
- +=====================================+
-
-
- ===================================
- * Basic organization of this unit *
- ===================================
-
- The major point of this unit is to provide an exception propagation
- personality routine for Ada. This is __gnat_eh_personality.
-
- It is provided with a pointer to the propagated exception, an unwind
- context describing a location the propagation is going through, and a
- couple of other arguments including a description of the current
- propagation phase.
-
- It shall return to the generic propagation engine what is to be performed
- next, after possible context adjustments, depending on what it finds in the
- traversed context (a handler for the exception, a cleanup, nothing, ...),
- and on the propagation phase.
-
- A number of structures and subroutines are used for this purpose, as
- sketched below:
-
- o region_descriptor: General data associated with the context (base pc,
- call-site table, action table, ttypes table, ...)
-
- o action_descriptor: Data describing the action to be taken for the
- propagated exception in the provided context (kind of action: nothing,
- handler, cleanup; pointer to the action table entry, ...).
-
- raise
- |
- ... (a-except.adb)
- |
- Propagate_Exception (a-exexpr.adb)
- |
- |
- _Unwind_RaiseException (libgcc)
- |
- | (Ada frame)
- |
- +--> __gnat_eh_personality (context, exception)
- |
- +--> get_region_descriptor_for (context)
- |
- +--> get_action_descriptor_for (context, exception, region)
- | |
- | +--> get_call_site_action_for (context, region)
- | (one version for each underlying scheme)
- |
- +--> setup_to_install (context)
-
- This unit is inspired from the C++ version found in eh_personality.cc,
- part of libstdc++-v3.
-
-*/
-
-
-/* This is an incomplete "proxy" of the structure of exception objects as
- built by the GNAT runtime library. Accesses to other fields than the common
- header are performed through subprogram calls to alleviate the need of an
- exact counterpart here and potential alignment/size issues for the common
- header. See a-exexpr.adb. */
-
-typedef struct
-{
- _Unwind_Exception common;
- /* ABI header, maximally aligned. */
-} _GNAT_Exception;
-
-/* The two constants below are specific ttype identifiers for special
- exception ids. Their type should match what a-exexpr exports. */
-
-extern const int __gnat_others_value;
-#define GNAT_OTHERS ((_Unwind_Ptr) &__gnat_others_value)
-
-extern const int __gnat_all_others_value;
-#define GNAT_ALL_OTHERS ((_Unwind_Ptr) &__gnat_all_others_value)
-
-/* Describe the useful region data associated with an unwind context. */
-
-typedef struct
-{
- /* The base pc of the region. */
- _Unwind_Ptr base;
-
- /* Pointer to the Language Specific Data for the region. */
- _Unwind_Ptr lsda;
-
- /* Call-Site data associated with this region. */
- unsigned char call_site_encoding;
- const unsigned char *call_site_table;
-
- /* The base to which are relative landing pad offsets inside the call-site
- entries . */
- _Unwind_Ptr lp_base;
-
- /* Action-Table associated with this region. */
- const unsigned char *action_table;
-
- /* Ttype data associated with this region. */
- unsigned char ttype_encoding;
- const unsigned char *ttype_table;
- _Unwind_Ptr ttype_base;
-
-} region_descriptor;
-
-static void
-db_region_for (region_descriptor *region, _Unwind_Context *uw_context)
-{
- _Unwind_Ptr ip = _Unwind_GetIP (uw_context) - 1;
-
- if (! (db_accepted_codes () & DB_REGIONS))
- return;
-
- db (DB_REGIONS, "For ip @ 0x%08x => ", ip);
-
- if (region->lsda)
- db (DB_REGIONS, "lsda @ 0x%x", region->lsda);
- else
- db (DB_REGIONS, "no lsda");
-
- db (DB_REGIONS, "\n");
-}
-
-/* Retrieve the ttype entry associated with FILTER in the REGION's
- ttype table. */
-
-static const _Unwind_Ptr
-get_ttype_entry_for (region_descriptor *region, long filter)
-{
- _Unwind_Ptr ttype_entry;
-
- filter *= size_of_encoded_value (region->ttype_encoding);
- read_encoded_value_with_base
- (region->ttype_encoding, region->ttype_base,
- region->ttype_table - filter, &ttype_entry);
-
- return ttype_entry;
-}
-
-/* Fill out the REGION descriptor for the provided UW_CONTEXT. */
-
-static void
-get_region_description_for (_Unwind_Context *uw_context,
- region_descriptor *region)
-{
- const unsigned char * p;
- _Unwind_Word tmp;
- unsigned char lpbase_encoding;
-
- /* Get the base address of the lsda information. If the provided context
- is null or if there is no associated language specific data, there's
- nothing we can/should do. */
- region->lsda
- = (_Unwind_Ptr) (uw_context
- ? _Unwind_GetLanguageSpecificData (uw_context) : 0);
-
- if (! region->lsda)
- return;
-
- /* Parse the lsda and fill the region descriptor. */
- p = (char *)region->lsda;
-
- region->base = _Unwind_GetRegionStart (uw_context);
-
- /* Find @LPStart, the base to which landing pad offsets are relative. */
- lpbase_encoding = *p++;
- if (lpbase_encoding != DW_EH_PE_omit)
- p = read_encoded_value
- (uw_context, lpbase_encoding, p, &region->lp_base);
- else
- region->lp_base = region->base;
-
- /* Find @TType, the base of the handler and exception spec type data. */
- region->ttype_encoding = *p++;
- if (region->ttype_encoding != DW_EH_PE_omit)
- {
- p = read_uleb128 (p, &tmp);
- region->ttype_table = p + tmp;
- }
- else
- region->ttype_table = 0;
-
- region->ttype_base
- = base_of_encoded_value (region->ttype_encoding, uw_context);
-
- /* Get the encoding and length of the call-site table; the action table
- immediately follows. */
- region->call_site_encoding = *p++;
- region->call_site_table = read_uleb128 (p, &tmp);
-
- region->action_table = region->call_site_table + tmp;
-}
-
-
-/* Describe an action to be taken when propagating an exception up to
- some context. */
-
-typedef enum
-{
- /* Found some call site base data, but need to analyze further
- before being able to decide. */
- unknown,
-
- /* There is nothing relevant in the context at hand. */
- nothing,
-
- /* There are only cleanups to run in this context. */
- cleanup,
-
- /* There is a handler for the exception in this context. */
- handler
-} action_kind;
-
-
-typedef struct
-{
- /* The kind of action to be taken. */
- action_kind kind;
-
- /* A pointer to the action record entry. */
- const unsigned char *table_entry;
-
- /* Where we should jump to actually take an action (trigger a cleanup or an
- exception handler). */
- _Unwind_Ptr landing_pad;
-
- /* If we have a handler matching our exception, these are the filter to
- trigger it and the corresponding id. */
- _Unwind_Sword ttype_filter;
- _Unwind_Ptr ttype_entry;
-
-} action_descriptor;
-
-
-static void
-db_action_for (action_descriptor *action, _Unwind_Context *uw_context)
-{
- _Unwind_Ptr ip = _Unwind_GetIP (uw_context) - 1;
-
- db (DB_ACTIONS, "For ip @ 0x%08x => ", ip);
-
- switch (action->kind)
- {
- case unknown:
- db (DB_ACTIONS, "lpad @ 0x%x, record @ 0x%x\n",
- action->landing_pad, action->table_entry);
- break;
-
- case nothing:
- db (DB_ACTIONS, "Nothing\n");
- break;
-
- case cleanup:
- db (DB_ACTIONS, "Cleanup\n");
- break;
-
- case handler:
- db (DB_ACTIONS, "Handler, filter = %d\n", action->ttype_filter);
- break;
-
- default:
- db (DB_ACTIONS, "Err? Unexpected action kind !\n");
- break;
- }
-
- return;
-}
-
-
-/* Search the call_site_table of REGION for an entry appropriate for the
- UW_CONTEXT's ip. If one is found, store the associated landing_pad and
- action_table entry, and set the ACTION kind to unknown for further
- analysis. Otherwise, set the ACTION kind to nothing.
-
- There are two variants of this routine, depending on the underlying
- mechanism (dwarf/sjlj), which account for differences in the tables
- organization.
-*/
-
-#ifdef __USING_SJLJ_EXCEPTIONS__
-
-#define __builtin_eh_return_data_regno(x) x
-
-static void
-get_call_site_action_for (_Unwind_Context *uw_context,
- region_descriptor *region,
- action_descriptor *action)
-{
- _Unwind_Ptr call_site
- = _Unwind_GetIP (uw_context) - 1;
- /* Subtract 1 because GetIP returns the actual call_site value + 1. */
-
- /* call_site is a direct index into the call-site table, with two special
- values : -1 for no-action and 0 for "terminate". The latter should never
- show up for Ada. To test for the former, beware that _Unwind_Ptr might be
- unsigned. */
-
- if ((int)call_site < 0)
- {
- action->kind = nothing;
- return;
- }
- else if (call_site == 0)
- {
- db (DB_ERR, "========> Err, null call_site for Ada/sjlj\n");
- action->kind = nothing;
- return;
- }
- else
- {
- _Unwind_Word cs_lp, cs_action;
-
- /* Let the caller know there may be an action to take, but let it
- determine the kind. */
- action->kind = unknown;
-
- /* We have a direct index into the call-site table, but this table is
- made of leb128 values, the encoding length of which is variable. We
- can't merely compute an offset from the index, then, but have to read
- all the entries before the one of interest. */
-
- const unsigned char * p = region->call_site_table;
-
- do {
- p = read_uleb128 (p, &cs_lp);
- p = read_uleb128 (p, &cs_action);
- } while (--call_site);
-
-
- action->landing_pad = cs_lp + 1;
-
- if (cs_action)
- action->table_entry = region->action_table + cs_action - 1;
- else
- action->table_entry = 0;
-
- return;
- }
-}
-
-#else
-/* ! __USING_SJLJ_EXCEPTIONS__ */
-
-static void
-get_call_site_action_for (_Unwind_Context *uw_context,
- region_descriptor *region,
- action_descriptor *action)
-{
- _Unwind_Ptr ip
- = _Unwind_GetIP (uw_context) - 1;
- /* Subtract 1 because GetIP yields a call return address while we are
- interested in information for the call point. This does not always yield
- the exact call instruction address but always brings the ip back within
- the corresponding region.
-
- ??? When unwinding up from a signal handler triggered by a trap on some
- instruction, we usually have the faulting instruction address here and
- subtracting 1 might get us into the wrong region. */
-
- const unsigned char * p
- = region->call_site_table;
-
- /* Unless we are able to determine otherwise ... */
- action->kind = nothing;
-
- db (DB_CSITE, "\n");
-
- while (p < region->action_table)
- {
- _Unwind_Ptr cs_start, cs_len, cs_lp;
- _Unwind_Word cs_action;
-
- /* Note that all call-site encodings are "absolute" displacements. */
- p = read_encoded_value (0, region->call_site_encoding, p, &cs_start);
- p = read_encoded_value (0, region->call_site_encoding, p, &cs_len);
- p = read_encoded_value (0, region->call_site_encoding, p, &cs_lp);
- p = read_uleb128 (p, &cs_action);
-
- db (DB_CSITE,
- "c_site @ 0x%08x (+0x%03x), len = %3d, lpad @ 0x%08x (+0x%03x)\n",
- region->base+cs_start, cs_start, cs_len,
- region->lp_base+cs_lp, cs_lp);
-
- /* The table is sorted, so if we've passed the ip, stop. */
- if (ip < region->base + cs_start)
- break;
-
- /* If we have a match, fill the ACTION fields accordingly. */
- else if (ip < region->base + cs_start + cs_len)
- {
- /* Let the caller know there may be an action to take, but let it
- determine the kind. */
- action->kind = unknown;
-
- if (cs_lp)
- action->landing_pad = region->lp_base + cs_lp;
- else
- action->landing_pad = 0;
-
- if (cs_action)
- action->table_entry = region->action_table + cs_action - 1;
- else
- action->table_entry = 0;
-
- db (DB_CSITE, "+++\n");
- return;
- }
- }
-
- db (DB_CSITE, "---\n");
-}
-
-#endif
-
-/* With CHOICE an exception choice representing an "exception - when"
- argument, and PROPAGATED_EXCEPTION a pointer to the currently propagated
- occurrence, return true iif the latter matches the former, that is, if
- PROPAGATED_EXCEPTION is caught by the handling code controlled by CHOICE.
- This takes care of the special Non_Ada_Error case on VMS. */
-
-#define Is_Handled_By_Others __gnat_is_handled_by_others
-#define Language_For __gnat_language_for
-#define Import_Code_For __gnat_import_code_for
-#define EID_For __gnat_eid_for
-#define Adjust_N_Cleanups_For __gnat_adjust_n_cleanups_for
-
-extern bool Is_Handled_By_Others (_Unwind_Ptr eid);
-extern char Language_For (_Unwind_Ptr eid);
-
-extern Exception_Code Import_Code_For (_Unwind_Ptr eid);
-
-extern Exception_Id EID_For (_GNAT_Exception * e);
-extern void Adjust_N_Cleanups_For (_GNAT_Exception * e, int n);
-
-static int
-is_handled_by (_Unwind_Ptr choice, _GNAT_Exception * propagated_exception)
-{
- /* Pointer to the GNAT exception data corresponding to the propagated
- occurrence. */
- _Unwind_Ptr E = (_Unwind_Ptr) EID_For (propagated_exception);
-
- /* Base matching rules: An exception data (id) matches itself, "when
- all_others" matches anything and "when others" matches anything unless
- explicitly stated otherwise in the propagated occurrence. */
-
- bool is_handled =
- choice == E
- || choice == GNAT_ALL_OTHERS
- || (choice == GNAT_OTHERS && Is_Handled_By_Others (E));
-
- /* In addition, on OpenVMS, Non_Ada_Error matches VMS exceptions, and we
- may have different exception data pointers that should match for the
- same condition code, if both an export and an import have been
- registered. The import code for both the choice and the propagated
- occurrence are expected to have been masked off regarding severity
- bits already (at registration time for the former and from within the
- low level exception vector for the latter). */
-#ifdef VMS
- #define Non_Ada_Error system__aux_dec__non_ada_error
- extern struct Exception_Data Non_Ada_Error;
-
- is_handled |=
- (Language_For (E) == 'V'
- && choice != GNAT_OTHERS && choice != GNAT_ALL_OTHERS
- && ((Language_For (choice) == 'V' && Import_Code_For (choice) != 0
- && Import_Code_For (choice) == Import_Code_For (E))
- || choice == (_Unwind_Ptr)&Non_Ada_Error));
-#endif
-
- return is_handled;
-}
-
-/* Fill out the ACTION to be taken from propagating UW_EXCEPTION up to
- UW_CONTEXT in REGION. */
-
-static void
-get_action_description_for (_Unwind_Context *uw_context,
- _Unwind_Exception *uw_exception,
- region_descriptor *region,
- action_descriptor *action)
-{
- _GNAT_Exception * gnat_exception = (_GNAT_Exception *) uw_exception;
-
- /* Search the call site table first, which may get us a landing pad as well
- as the head of an action record list. */
- get_call_site_action_for (uw_context, region, action);
- db_action_for (action, uw_context);
-
- /* If there is not even a call_site entry, we are done. */
- if (action->kind == nothing)
- return;
-
- /* Otherwise, check what we have at the place of the call site */
-
- /* No landing pad => no cleanups or handlers. */
- if (action->landing_pad == 0)
- {
- action->kind = nothing;
- return;
- }
-
- /* Landing pad + null table entry => only cleanups. */
- else if (action->table_entry == 0)
- {
- action->kind = cleanup;
- return;
- }
-
- /* Landing pad + Table entry => handlers + possible cleanups. */
- else
- {
- const unsigned char * p = action->table_entry;
-
- _Unwind_Sword ar_filter, ar_disp;
-
- action->kind = nothing;
-
- while (1)
- {
- p = read_sleb128 (p, &ar_filter);
- read_sleb128 (p, &ar_disp);
- /* Don't assign p here, as it will be incremented by ar_disp
- below. */
-
- /* Null filters are for cleanups. */
- if (ar_filter == 0)
- action->kind = cleanup;
-
- /* Positive filters are for regular handlers. */
- else if (ar_filter > 0)
- {
- /* See if the filter we have is for an exception which matches
- the one we are propagating. */
- _Unwind_Ptr choice = get_ttype_entry_for (region, ar_filter);
-
- if (is_handled_by (choice, gnat_exception))
- {
- action->ttype_filter = ar_filter;
- action->ttype_entry = choice;
- action->kind = handler;
- return;
- }
- }
-
- /* Negative filter values are for C++ exception specifications.
- Should not be there for Ada :/ */
- else
- db (DB_ERR, "========> Err, filter < 0 for Ada/dwarf\n");
-
- if (ar_disp == 0)
- return;
-
- p += ar_disp;
- }
- }
-}
-
-/* Setup in UW_CONTEXT the eh return target IP and data registers, which will
- be restored with the others and retrieved by the landing pad once the jump
- occurred. */
-
-static void
-setup_to_install (_Unwind_Context *uw_context,
- _Unwind_Exception *uw_exception,
- _Unwind_Ptr uw_landing_pad,
- int uw_filter)
-{
-#ifndef EH_RETURN_DATA_REGNO
- /* We should not be called if the appropriate underlying support is not
- there. */
- abort ();
-#else
- /* 1/ exception object pointer, which might be provided back to
- _Unwind_Resume (and thus to this personality routine) if we are jumping
- to a cleanup. */
- _Unwind_SetGR (uw_context, __builtin_eh_return_data_regno (0),
- (_Unwind_Word)uw_exception);
+ /* Special termination handling for VMS */
+ long prvhnd;
- /* 2/ handler switch value register, which will also be used by the target
- landing pad to decide what action it shall take. */
- _Unwind_SetGR (uw_context, __builtin_eh_return_data_regno (1),
- (_Unwind_Word)uw_filter);
+ /* Remove the exception vector so it won't intercept any errors
+ in the call to exit, and go into and endless loop */
- /* Setup the address we should jump at to reach the code where there is the
- "something" we found. */
- _Unwind_SetIP (uw_context, uw_landing_pad);
+ SYS$SETEXV (1, 0, 3, &prvhnd);
#endif
-}
-
-/* The following is defined from a-except.adb. Its purpose is to enable
- automatic backtraces upon exception raise, as provided through the
- GNAT.Traceback facilities. */
-extern void __gnat_notify_handled_exception (void);
-extern void __gnat_notify_unhandled_exception (void);
-
-/* Below is the eh personality routine per se. We currently assume that only
- GNU-Ada exceptions are met. */
-
-_Unwind_Reason_Code
-__gnat_eh_personality (int uw_version,
- _Unwind_Action uw_phases,
- _Unwind_Exception_Class uw_exception_class,
- _Unwind_Exception *uw_exception,
- _Unwind_Context *uw_context)
-{
- _GNAT_Exception * gnat_exception = (_GNAT_Exception *) uw_exception;
-
- region_descriptor region;
- action_descriptor action;
-
- if (uw_version != 1)
- return _URC_FATAL_PHASE1_ERROR;
-
- db_indent (DB_INDENT_RESET);
- db_phases (uw_phases);
- db_indent (DB_INDENT_INCREASE);
-
- /* Get the region description for the context we were provided with. This
- will tell us if there is some lsda, call_site, action and/or ttype data
- for the associated ip. */
- get_region_description_for (uw_context, &region);
- db_region_for (&region, uw_context);
-
- /* No LSDA => no handlers or cleanups => we shall unwind further up. */
- if (! region.lsda)
- return _URC_CONTINUE_UNWIND;
-
- /* Search the call-site and action-record tables for the action associated
- with this IP. */
- get_action_description_for (uw_context, uw_exception, &region, &action);
- db_action_for (&action, uw_context);
-
- /* Whatever the phase, if there is nothing relevant in this frame,
- unwinding should just go on. */
- if (action.kind == nothing)
- return _URC_CONTINUE_UNWIND;
- /* If we found something in search phase, we should return a code indicating
- what to do next depending on what we found. If we only have cleanups
- around, we shall try to unwind further up to find a handler, otherwise,
- tell we have a handler, which will trigger the second phase. */
- if (uw_phases & _UA_SEARCH_PHASE)
- {
- if (action.kind == cleanup)
- {
- Adjust_N_Cleanups_For (gnat_exception, 1);
- return _URC_CONTINUE_UNWIND;
- }
- else
- {
- /* Trigger the appropriate notification routines before the second
- phase starts, which ensures the stack is still intact. */
- __gnat_notify_handled_exception ();
-
- return _URC_HANDLER_FOUND;
- }
- }
-
- /* We found something in cleanup/handler phase, which might be the handler
- or a cleanup for a handled occurrence, or a cleanup for an unhandled
- occurrence (we are in a FORCED_UNWIND phase in this case). Install the
- context to get there. */
-
- /* If we are going to install a cleanup context, decrement the cleanup
- count. This is required in a FORCED_UNWINDing phase (for an unhandled
- exception), as this is used from the forced unwinding handler in
- Ada.Exceptions.Exception_Propagation to decide wether unwinding should
- proceed further or Unhandled_Exception_Terminate should be called. */
- if (action.kind == cleanup)
- Adjust_N_Cleanups_For (gnat_exception, -1);
-
- setup_to_install
- (uw_context, uw_exception, action.landing_pad, action.ttype_filter);
-
- return _URC_INSTALL_CONTEXT;
+ /* Default termination handling */
+ __gnat_os_exit (1);
}
-
-/* Define the consistently named wrappers imported by Propagate_Exception. */
-
-#ifdef __USING_SJLJ_EXCEPTIONS__
-
-#undef _Unwind_RaiseException
-
-_Unwind_Reason_Code
-__gnat_Unwind_RaiseException (_Unwind_Exception *e)
-{
- return _Unwind_SjLj_RaiseException (e);
-}
-
-
-#undef _Unwind_ForcedUnwind
-
-_Unwind_Reason_Code
-__gnat_Unwind_ForcedUnwind (_Unwind_Exception *e,
- void * handler,
- void * argument)
-{
- return _Unwind_SjLj_ForcedUnwind (e, handler, argument);
-}
-
-
-#else /* __USING_SJLJ_EXCEPTIONS__ */
-
-_Unwind_Reason_Code
-__gnat_Unwind_RaiseException (_Unwind_Exception *e)
-{
- return _Unwind_RaiseException (e);
-}
-
-_Unwind_Reason_Code
-__gnat_Unwind_ForcedUnwind (_Unwind_Exception *e,
- void * handler,
- void * argument)
-{
- return _Unwind_ForcedUnwind (e, handler, argument);
-}
-
-#endif /* __USING_SJLJ_EXCEPTIONS__ */
-
-#else
-/* ! IN_RTS */
-
-/* Define the corresponding stubs for the compiler. */
-
-/* We don't want fancy_abort here. */
-#undef abort
-
-_Unwind_Reason_Code
-__gnat_Unwind_RaiseException (_Unwind_Exception *e ATTRIBUTE_UNUSED)
-{
- abort ();
-}
-
-
-_Unwind_Reason_Code
-__gnat_Unwind_ForcedUnwind (_Unwind_Exception *e ATTRIBUTE_UNUSED,
- void * handler ATTRIBUTE_UNUSED,
- void * argument ATTRIBUTE_UNUSED)
-{
- abort ();
-}
-
-#endif /* IN_RTS */
diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index a3e9e8ac350..ba1646bfad9 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -48,6 +48,8 @@ with Table; use Table;
with Uname; use Uname;
with Urealp; use Urealp;
+with Ada.Unchecked_Conversion;
+
package body Repinfo is
SSU : constant := 8;
@@ -61,17 +63,16 @@ package body Repinfo is
-- Representation of gcc Expressions --
---------------------------------------
- -- This table is used only if Frontend_Layout_On_Target is False,
- -- so that gigi lays out dynamic size/offset fields using encoded
- -- gcc expressions.
+ -- This table is used only if Frontend_Layout_On_Target is False, so that
+ -- gigi lays out dynamic size/offset fields using encoded gcc
+ -- expressions.
- -- A table internal to this unit is used to hold the values of
- -- back annotated expressions. This table is written out by -gnatt
- -- and read back in for ASIS processing.
+ -- A table internal to this unit is used to hold the values of back
+ -- annotated expressions. This table is written out by -gnatt and read
+ -- back in for ASIS processing.
- -- Node values are stored as Uint values which are the negative of
- -- the node index in this table. Constants appear as non-negative
- -- Uint values.
+ -- Node values are stored as Uint values using the negative of the node
+ -- index in this table. Constants appear as non-negative Uint values.
type Exp_Node is record
Expr : TCode;
@@ -104,28 +105,27 @@ package body Repinfo is
-- Identifier casing for current unit
Need_Blank_Line : Boolean;
- -- Set True if a blank line is needed before outputting any
- -- information for the current entity. Set True when a new
- -- entity is processed, and false when the blank line is output.
+ -- Set True if a blank line is needed before outputting any information for
+ -- the current entity. Set True when a new entity is processed, and false
+ -- when the blank line is output.
-----------------------
-- Local Subprograms --
-----------------------
function Back_End_Layout return Boolean;
- -- Test for layout mode, True = back end, False = front end. This
- -- function is used rather than checking the configuration parameter
- -- because we do not want Repinfo to depend on Targparm (for ASIS)
+ -- Test for layout mode, True = back end, False = front end. This function
+ -- is used rather than checking the configuration parameter because we do
+ -- not want Repinfo to depend on Targparm (for ASIS)
procedure Blank_Line;
-- Called before outputting anything for an entity. Ensures that
-- a blank line precedes the output for a particular entity.
procedure List_Entities (Ent : Entity_Id);
- -- This procedure lists the entities associated with the entity E,
- -- starting with the First_Entity and using the Next_Entity link.
- -- If a nested package is found, entities within the package are
- -- recursively processed.
+ -- This procedure lists the entities associated with the entity E, starting
+ -- with the First_Entity and using the Next_Entity link. If a nested
+ -- package is found, entities within the package are recursively processed.
procedure List_Name (Ent : Entity_Id);
-- List name of entity Ent in appropriate case. The name is listed with
@@ -135,8 +135,8 @@ package body Repinfo is
-- List representation info for array type Ent
procedure List_Mechanisms (Ent : Entity_Id);
- -- List mechanism information for parameters of Ent, which is a
- -- subprogram, subprogram type, or an entry or entry family.
+ -- List mechanism information for parameters of Ent, which is subprogram,
+ -- subprogram type, or an entry or entry family.
procedure List_Object_Info (Ent : Entity_Id);
-- List representation info for object Ent
@@ -155,12 +155,11 @@ package body Repinfo is
-- Output given number of spaces
procedure Write_Info_Line (S : String);
- -- Routine to write a line to Repinfo output file. This routine is
- -- passed as a special output procedure to Output.Set_Special_Output.
- -- Note that Write_Info_Line is called with an EOL character at the
- -- end of each line, as per the Output spec, but the internal call
- -- to the appropriate routine in Osint requires that the end of line
- -- sequence be stripped off.
+ -- Routine to write a line to Repinfo output file. This routine is passed
+ -- as a special output procedure to Output.Set_Special_Output. Note that
+ -- Write_Info_Line is called with an EOL character at the end of each line,
+ -- as per the Output spec, but the internal call to the appropriate routine
+ -- in Osint requires that the end of line sequence be stripped off.
procedure Write_Mechanism (M : Mechanism_Type);
-- Writes symbolic string for mechanism represented by M
@@ -168,8 +167,8 @@ package body Repinfo is
procedure Write_Val (Val : Node_Ref_Or_Val; Paren : Boolean := False);
-- Given a representation value, write it out. No_Uint values or values
-- dependent on discriminants are written as two question marks. If the
- -- flag Paren is set, then the output is surrounded in parentheses if
- -- it is other than a simple value.
+ -- flag Paren is set, then the output is surrounded in parentheses if it is
+ -- other than a simple value.
---------------------
-- Back_End_Layout --
@@ -177,8 +176,8 @@ package body Repinfo is
function Back_End_Layout return Boolean is
begin
- -- We have back end layout if the back end has made any entries in
- -- the table of GCC expressions, otherwise we have front end layout.
+ -- We have back end layout if the back end has made any entries in the
+ -- table of GCC expressions, otherwise we have front end layout.
return Rep_Table.Last > 0;
end Back_End_Layout;
@@ -350,10 +349,10 @@ package body Repinfo is
while Present (E) loop
Need_Blank_Line := True;
- -- We list entities that come from source (excluding private
- -- or incomplete types or deferred constants, where we will
- -- list the info for the full view). If debug flag A is set,
- -- then all entities are listed
+ -- We list entities that come from source (excluding private or
+ -- incomplete types or deferred constants, where we will list the
+ -- info for the full view). If debug flag A is set, then all
+ -- entities are listed
if (Comes_From_Source (E)
and then not Is_Incomplete_Or_Private_Type (E)
@@ -402,10 +401,9 @@ package body Repinfo is
end if;
- -- Recurse into nested package, but not if they are
- -- package renamings (in particular renamings of the
- -- enclosing package, as for some Java bindings and
- -- for generic instances).
+ -- Recurse into nested package, but not if they are package
+ -- renamings (in particular renamings of the enclosing package,
+ -- as for some Java bindings and for generic instances).
if Ekind (E) = E_Package then
if No (Renamed_Object (E)) then
@@ -438,10 +436,10 @@ package body Repinfo is
E := Next_Entity (E);
end loop;
- -- For a package body, the entities of the visible subprograms
- -- are declared in the corresponding spec. Iterate over its
- -- entities in order to handle properly the subprogram bodies.
- -- Skip bodies in subunits, which are listed independently.
+ -- For a package body, the entities of the visible subprograms are
+ -- declared in the corresponding spec. Iterate over its entities in
+ -- order to handle properly the subprogram bodies. Skip bodies in
+ -- subunits, which are listed independently.
if Ekind (Ent) = E_Package_Body
and then Present (Corresponding_Spec (Find_Declaration (Ent)))
@@ -583,6 +581,9 @@ package body Repinfo is
Write_Str ("not ");
Print_Expr (Node.Op1);
+ when Bit_And_Expr =>
+ Binop (" & ");
+
when Lt_Expr =>
Binop (" < ");
@@ -801,9 +802,9 @@ package body Repinfo is
UI_Image (Sunit);
end if;
- -- If the record is not packed, then we know that all
- -- fields whose position is not specified have a starting
- -- normalized bit position of zero
+ -- If the record is not packed, then we know that all fields whose
+ -- position is not specified have a starting normalized bit
+ -- position of zero
if Unknown_Normalized_First_Bit (Comp)
and then not Is_Packed (Ent)
@@ -885,11 +886,11 @@ package body Repinfo is
UI_Write (Fbit);
Write_Str (" .. ");
- -- Allowing Uint_0 here is a kludge, really this should be
- -- a fine Esize value but currently it means unknown, except
- -- that we know after gigi has back annotated that a size of
- -- zero is real, since otherwise gigi back annotates using
- -- No_Uint as the value to indicate unknown).
+ -- Allowing Uint_0 here is a kludge, really this should be a
+ -- fine Esize value but currently it means unknown, except that
+ -- we know after gigi has back annotated that a size of zero is
+ -- real, since otherwise gigi back annotates using No_Uint as
+ -- the value to indicate unknown).
if (Esize (Comp) = Uint_0 or else Known_Static_Esize (Comp))
and then Known_Static_Normalized_First_Bit (Comp)
@@ -916,8 +917,8 @@ package body Repinfo is
Write_Val (Esiz, Paren => True);
- -- If in front end layout mode, then dynamic size is
- -- stored in storage units, so renormalize for output
+ -- If in front end layout mode, then dynamic size is stored
+ -- in storage units, so renormalize for output
if not Back_End_Layout then
Write_Str (" * ");
@@ -1019,8 +1020,8 @@ package body Repinfo is
Write_Line (";");
-- For now, temporary case, to be removed when gigi properly back
- -- annotates RM_Size, if RM_Size is not set, then list Esize as
- -- Size. This avoids odd Object_Size output till we fix things???
+ -- annotates RM_Size, if RM_Size is not set, then list Esize as Size.
+ -- This avoids odd Object_Size output till we fix things???
elsif Unknown_RM_Size (Ent) then
Write_Str ("for ");
@@ -1086,6 +1087,14 @@ package body Repinfo is
function V (Val : Node_Ref_Or_Val) return Uint;
-- Internal recursive routine to evaluate tree
+ function W (Val : Uint) return Word;
+ -- Convert Val to Word, assuming Val is always in the Int range. This is
+ -- a helper function for the evaluation of bitwise expressions like
+ -- Bit_And_Expr, for which there is no direct support in uintp. Uint
+ -- values out of the Int range are expected to be seen in such
+ -- expressions only with overflowing byte sizes around, introducing
+ -- inherent unreliabilties in computations anyway.
+
-------
-- B --
-------
@@ -1113,6 +1122,23 @@ package body Repinfo is
end T;
-------
+ -- W --
+ -------
+
+ -- We use an unchecked conversion to map Int values to their Word
+ -- bitwise equivalent, which we could not achieve with a normal type
+ -- conversion for negative Ints. We want bitwise equivalents because W
+ -- is used as a helper for bit operators like Bit_And_Expr, and can be
+ -- called for negative Ints in the context of aligning expressions like
+ -- X+Align & -Align.
+
+ function W (Val : Uint) return Word is
+ function To_Word is new Ada.Unchecked_Conversion (Int, Word);
+ begin
+ return To_Word (UI_To_Int (Val));
+ end W;
+
+ -------
-- V --
-------
@@ -1203,6 +1229,11 @@ package body Repinfo is
when Truth_Not_Expr =>
return B (not T (Node.Op1));
+ when Bit_And_Expr =>
+ L := V (Node.Op1);
+ R := V (Node.Op2);
+ return UI_From_Int (Int (W (L) and W (R)));
+
when Lt_Expr =>
return B (V (Node.Op1) < V (Node.Op2));
diff --git a/gcc/ada/repinfo.ads b/gcc/ada/repinfo.ads
index 2af09cb0355..9fc16c2c581 100644
--- a/gcc/ada/repinfo.ads
+++ b/gcc/ada/repinfo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,7 @@
-- tree to fill in representation information, and also the routine used
-- by -gnatR to print this information. This unit is used both in the
-- compiler and in ASIS (it is used in ASIS as part of the implementation
--- of the data decomposition annex.
+-- of the data decomposition annex).
with Types; use Types;
with Uintp; use Uintp;
@@ -128,7 +128,7 @@ package Repinfo is
-- Subtype used for values that can either be a Node_Ref (negative)
-- or a value (non-negative)
- type TCode is range 0 .. 27;
+ type TCode is range 0 .. 28;
-- Type used on Ada side to represent DEFTREECODE values defined in
-- tree.def. Only a subset of these tree codes can actually appear.
-- The names are the names from tree.def in Ada casing.
@@ -162,6 +162,7 @@ package Repinfo is
Ge_Expr : constant TCode := 25; -- comparision >= 2
Eq_Expr : constant TCode := 26; -- comparision = 2
Ne_Expr : constant TCode := 27; -- comparision /= 2
+ Bit_And_Expr : constant TCode := 28; -- Binary and 2
-- The following entry is used to represent a discriminant value in
-- the tree. It has a special tree code that does not correspond
diff --git a/gcc/ada/repinfo.h b/gcc/ada/repinfo.h
index 672ff29e1c2..ec5452dafb6 100644
--- a/gcc/ada/repinfo.h
+++ b/gcc/ada/repinfo.h
@@ -6,7 +6,7 @@
* *
* C Header File *
* *
- * Copyright (C) 1999-2002 Free Software Foundation, Inc. *
+ * Copyright (C) 1999-2005 Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -67,6 +67,7 @@ typedef char TCode;
#define Ge_Expr 25
#define Eq_Expr 26
#define Ne_Expr 27
+#define Bit_And_Expr 28
/* Creates a node using the tree code defined by Expr and from 1-3
operands as required (unused operands set as shown to No_Uint) Note
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index 494adc8771c..f2dd0393b35 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -171,7 +171,7 @@ package body Rtsfind is
-- is only effective in All_Errors mode.
function RE_Chars (E : RE_Id) return Name_Id;
- -- Given a RE_Id value returns the Chars of the corresponding entity.
+ -- Given a RE_Id value returns the Chars of the corresponding entity
procedure RTE_Error_Msg (Msg : String);
-- Generates a message by calling Error_Msg_N specifying Current_Error_Node
@@ -518,7 +518,7 @@ package body Rtsfind is
-- Indicate those that must be restored.
procedure Restore_Private_Visibility;
- -- Restore the visibility of ancestors after compiling RTU.
+ -- Restore the visibility of ancestors after compiling RTU
--------------------------------
-- Restore_Private_Visibility --
diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads
index 07adc39757a..8b19055fef9 100644
--- a/gcc/ada/rtsfind.ads
+++ b/gcc/ada/rtsfind.ads
@@ -209,9 +209,14 @@ package Rtsfind is
System_Exp_Mod,
System_Exp_Uns,
System_Fat_Flt,
+ System_Fat_IEEE_Long_Float,
+ System_Fat_IEEE_Short_Float,
System_Fat_LFlt,
System_Fat_LLF,
System_Fat_SFlt,
+ System_Fat_VAX_D_Float,
+ System_Fat_VAX_F_Float,
+ System_Fat_VAX_G_Float,
System_Finalization_Implementation,
System_Finalization_Root,
System_Fore,
@@ -493,6 +498,7 @@ package Rtsfind is
RE_Get_Access_Level, -- Ada.Tags
RE_Get_Entry_Index, -- Ada.Tags
RE_Get_External_Tag, -- Ada.Tags
+ RE_Get_Offset_Index, -- Ada.Tags
RE_Get_Prim_Op_Address, -- Ada.Tags
RE_Get_Prim_Op_Kind, -- Ada.Tags
RE_Get_RC_Offset, -- Ada.Tags
@@ -501,25 +507,32 @@ package Rtsfind is
RE_Inherit_TSD, -- Ada.Tags
RE_Internal_Tag, -- Ada.Tags
RE_Is_Descendant_At_Same_Level, -- Ada.Tags
+ RE_Object_Specific_Data, -- Ada.Tags
RE_POK_Function, -- Ada.Tags
RE_POK_Procedure, -- Ada.Tags
RE_POK_Protected_Entry, -- Ada.Tags
RE_POK_Protected_Function, -- Ada.Tags
RE_POK_Protected_Procedure, -- Ada.Tags
RE_POK_Task_Entry, -- Ada.Tags
+ RE_POK_Task_Function, -- Ada.Tags
RE_POK_Task_Procedure, -- Ada.Tags
RE_Prim_Op_Kind, -- Ada.Tags
RE_Register_Interface_Tag, -- Ada.Tags
RE_Register_Tag, -- Ada.Tags
+ RE_Select_Specific_Data, -- Ada.Tags
RE_Set_Access_Level, -- Ada.Tags
RE_Set_Entry_Index, -- Ada.Tags
RE_Set_Expanded_Name, -- Ada.Tags
RE_Set_External_Tag, -- Ada.Tags
+ RE_Set_Num_Prim_Ops, -- Ada.Tags
+ RE_Set_Offset_Index, -- Ada.Tags
RE_Set_Offset_To_Top, -- Ada.Tags
+ RE_Set_OSD, -- Ada.Tags
RE_Set_Prim_Op_Address, -- Ada.Tags
RE_Set_Prim_Op_Kind, -- Ada.Tags
RE_Set_RC_Offset, -- Ada.Tags
RE_Set_Remotely_Callable, -- Ada.Tags
+ RE_Set_SSD, -- Ada.Tags
RE_Set_TSD, -- Ada.Tags
RE_Tag_Error, -- Ada.Tags
RE_TSD_Entry_Size, -- Ada.Tags
@@ -527,6 +540,10 @@ package Rtsfind is
RE_Interface_Tag, -- Ada.Tags
RE_Tag, -- Ada.Tags
RE_Address_Array, -- Ada.Tags
+ RE_Valid_Signature, -- Ada.Tags
+ RE_Primary_DT, -- Ada.Tags
+ RE_Secondary_DT, -- Ada.Tags
+ RE_Abstract_Interface, -- Ada.Tags
RE_Abort_Task, -- Ada.Task_Identification
RE_Current_Task, -- Ada.Task_Identification
@@ -666,13 +683,28 @@ package Rtsfind is
RE_Exp_Unsigned, -- System.Exp_Uns
- RE_Fat_Float, -- System.Fat_Flt
+ RE_Attr_Float, -- System.Fat_Flt
- RE_Fat_Long_Float, -- System.Fat_LFlt
+ RE_Attr_IEEE_Long, -- System.Fat_IEEE_Long_Float
+ RE_Fat_IEEE_Long, -- System.Fat_IEEE_Long_Float
- RE_Fat_Long_Long_Float, -- System.Fat_LLF
+ RE_Attr_IEEE_Short, -- System.Fat_IEEE_Short_Float
+ RE_Fat_IEEE_Short, -- System.Fat_IEEE_Short_Float
- RE_Fat_Short_Float, -- System.Fat_SFlt
+ RE_Attr_Long_Float, -- System.Fat_LFlt
+
+ RE_Attr_Long_Long_Float, -- System.Fat_LLF
+
+ RE_Attr_Short_Float, -- System.Fat_SFlt
+
+ RE_Attr_VAX_D_Float, -- System.Fat_VAX_D_Float
+ RE_Fat_VAX_D, -- System.Fat_VAX_D_Float
+
+ RE_Attr_VAX_F_Float, -- System.Fat_VAX_F_Float
+ RE_Fat_VAX_F, -- System.Fat_VAX_F_Float
+
+ RE_Attr_VAX_G_Float, -- System.Fat_VAX_G_Float
+ RE_Fat_VAX_G, -- System.Fat_VAX_G_Float
RE_Attach_To_Final_List, -- System.Finalization_Implementation
RE_Finalize_List, -- System.Finalization_Implementation
@@ -1151,6 +1183,7 @@ package Rtsfind is
RE_TC_Alias, -- System.PolyORB_Interface
RE_TC_Build, -- System.PolyORB_Interface
+ RE_Get_TC, -- System.PolyORB_Interface
RE_Set_TC, -- System.PolyORB_Interface
RE_TC_Any, -- System.PolyORB_Interface
RE_TC_AD, -- System.PolyORB_Interface
@@ -1219,6 +1252,7 @@ package Rtsfind is
RE_Integer_Address, -- System.Storage_Elements
RE_Storage_Offset, -- System.Storage_Elements
RE_Storage_Array, -- System.Storage_Elements
+ RE_Storage_Element, -- System.Storage_Elements
RE_To_Address, -- System.Storage_Elements
RE_Root_Storage_Pool, -- System.Storage_Pools
@@ -1291,6 +1325,7 @@ package Rtsfind is
RE_Task_Procedure_Access, -- System.Tasking
RO_ST_Task_Id, -- System.Tasking
+ RO_ST_Null_Task, -- System.Tasking
RE_Call_Modes, -- System.Tasking
RE_Simple_Call, -- System.Tasking
@@ -1417,6 +1452,8 @@ package Rtsfind is
RE_Le_G, -- System.Vax_Float_Operations
RE_Lt_F, -- System.Vax_Float_Operations
RE_Lt_G, -- System.Vax_Float_Operations
+ RE_Ne_F, -- System.Vax_Float_Operations
+ RE_Ne_G, -- System.Vax_Float_Operations
RE_Valid_D, -- System.Vax_Float_Operations
RE_Valid_F, -- System.Vax_Float_Operations
@@ -1602,6 +1639,7 @@ package Rtsfind is
RE_Get_Access_Level => Ada_Tags,
RE_Get_Entry_Index => Ada_Tags,
RE_Get_External_Tag => Ada_Tags,
+ RE_Get_Offset_Index => Ada_Tags,
RE_Get_Prim_Op_Address => Ada_Tags,
RE_Get_Prim_Op_Kind => Ada_Tags,
RE_Get_RC_Offset => Ada_Tags,
@@ -1610,25 +1648,32 @@ package Rtsfind is
RE_Inherit_TSD => Ada_Tags,
RE_Internal_Tag => Ada_Tags,
RE_Is_Descendant_At_Same_Level => Ada_Tags,
+ RE_Object_Specific_Data => Ada_Tags,
RE_POK_Function => Ada_Tags,
RE_POK_Procedure => Ada_Tags,
RE_POK_Protected_Entry => Ada_Tags,
RE_POK_Protected_Function => Ada_Tags,
RE_POK_Protected_Procedure => Ada_Tags,
RE_POK_Task_Entry => Ada_Tags,
+ RE_POK_Task_Function => Ada_Tags,
RE_POK_Task_Procedure => Ada_Tags,
RE_Prim_Op_Kind => Ada_Tags,
RE_Register_Interface_Tag => Ada_Tags,
RE_Register_Tag => Ada_Tags,
+ RE_Select_Specific_Data => Ada_Tags,
RE_Set_Access_Level => Ada_Tags,
RE_Set_Entry_Index => Ada_Tags,
RE_Set_Expanded_Name => Ada_Tags,
RE_Set_External_Tag => Ada_Tags,
+ RE_Set_Num_Prim_Ops => Ada_Tags,
+ RE_Set_Offset_Index => Ada_Tags,
RE_Set_Offset_To_Top => Ada_Tags,
+ RE_Set_OSD => Ada_Tags,
RE_Set_Prim_Op_Address => Ada_Tags,
RE_Set_Prim_Op_Kind => Ada_Tags,
RE_Set_RC_Offset => Ada_Tags,
RE_Set_Remotely_Callable => Ada_Tags,
+ RE_Set_SSD => Ada_Tags,
RE_Set_TSD => Ada_Tags,
RE_Tag_Error => Ada_Tags,
RE_TSD_Entry_Size => Ada_Tags,
@@ -1636,6 +1681,10 @@ package Rtsfind is
RE_Interface_Tag => Ada_Tags,
RE_Tag => Ada_Tags,
RE_Address_Array => Ada_Tags,
+ RE_Valid_Signature => Ada_Tags,
+ RE_Primary_DT => Ada_Tags,
+ RE_Secondary_DT => Ada_Tags,
+ RE_Abstract_Interface => Ada_Tags,
RE_Abort_Task => Ada_Task_Identification,
RE_Current_Task => Ada_Task_Identification,
@@ -1773,13 +1822,28 @@ package Rtsfind is
RE_Exp_Unsigned => System_Exp_Uns,
- RE_Fat_Float => System_Fat_Flt,
+ RE_Attr_Float => System_Fat_Flt,
+
+ RE_Attr_IEEE_Long => System_Fat_IEEE_Long_Float,
+ RE_Fat_IEEE_Long => System_Fat_IEEE_Long_Float,
+
+ RE_Attr_IEEE_Short => System_Fat_IEEE_Short_Float,
+ RE_Fat_IEEE_Short => System_Fat_IEEE_Short_Float,
+
+ RE_Attr_Long_Float => System_Fat_LFlt,
+
+ RE_Attr_Long_Long_Float => System_Fat_LLF,
+
+ RE_Attr_Short_Float => System_Fat_SFlt,
- RE_Fat_Long_Float => System_Fat_LFlt,
+ RE_Attr_VAX_D_Float => System_Fat_VAX_D_Float,
+ RE_Fat_VAX_D => System_Fat_VAX_D_Float,
- RE_Fat_Long_Long_Float => System_Fat_LLF,
+ RE_Attr_VAX_F_Float => System_Fat_VAX_F_Float,
+ RE_Fat_VAX_F => System_Fat_VAX_F_Float,
- RE_Fat_Short_Float => System_Fat_SFlt,
+ RE_Attr_VAX_G_Float => System_Fat_VAX_G_Float,
+ RE_Fat_VAX_G => System_Fat_VAX_G_Float,
RE_Attach_To_Final_List => System_Finalization_Implementation,
RE_Finalize_List => System_Finalization_Implementation,
@@ -2249,6 +2313,7 @@ package Rtsfind is
RE_TC_Alias => System_PolyORB_Interface,
RE_TC_Build => System_PolyORB_Interface,
+ RE_Get_TC => System_PolyORB_Interface,
RE_Set_TC => System_PolyORB_Interface,
RE_TC_Any => System_PolyORB_Interface,
RE_TC_AD => System_PolyORB_Interface,
@@ -2326,6 +2391,7 @@ package Rtsfind is
RE_Integer_Address => System_Storage_Elements,
RE_Storage_Offset => System_Storage_Elements,
RE_Storage_Array => System_Storage_Elements,
+ RE_Storage_Element => System_Storage_Elements,
RE_To_Address => System_Storage_Elements,
RE_Root_Storage_Pool => System_Storage_Pools,
@@ -2397,6 +2463,7 @@ package Rtsfind is
RE_Task_Procedure_Access => System_Tasking,
RO_ST_Task_Id => System_Tasking,
+ RO_ST_Null_Task => System_Tasking,
RE_Call_Modes => System_Tasking,
RE_Simple_Call => System_Tasking,
@@ -2523,6 +2590,8 @@ package Rtsfind is
RE_Le_G => System_Vax_Float_Operations,
RE_Lt_F => System_Vax_Float_Operations,
RE_Lt_G => System_Vax_Float_Operations,
+ RE_Ne_F => System_Vax_Float_Operations,
+ RE_Ne_G => System_Vax_Float_Operations,
RE_Valid_D => System_Vax_Float_Operations,
RE_Valid_F => System_Vax_Float_Operations,
diff --git a/gcc/ada/s-auxdec-empty.adb b/gcc/ada/s-auxdec-empty.adb
new file mode 100644
index 00000000000..57fa5812c1d
--- /dev/null
+++ b/gcc/ada/s-auxdec-empty.adb
@@ -0,0 +1,36 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . A U X _ D E C --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/Or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, Or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, Or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package body System.Aux_DEC is
+
+end System.Aux_DEC;
diff --git a/gcc/ada/s-auxdec-empty.ads b/gcc/ada/s-auxdec-empty.ads
new file mode 100644
index 00000000000..289009b6b2c
--- /dev/null
+++ b/gcc/ada/s-auxdec-empty.ads
@@ -0,0 +1,49 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . A U X _ D E C --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package is to be used when the extra definitions in package
+-- System for DEC Ada implementations are not supported by the target.
+
+package System.Aux_DEC is
+ pragma Pure;
+ pragma Elaborate_Body;
+
+ type AST_Handler is limited private;
+ No_AST_Handler : constant AST_Handler;
+
+private
+
+ type AST_Handler is new Integer;
+ No_AST_Handler : constant AST_Handler := 0;
+
+end System.Aux_DEC;
diff --git a/gcc/ada/s-bitops.adb b/gcc/ada/s-bitops.adb
index 0ac62c32781..2224ff0a650 100644
--- a/gcc/ada/s-bitops.adb
+++ b/gcc/ada/s-bitops.adb
@@ -40,7 +40,7 @@ with Unchecked_Conversion;
package body System.Bit_Ops is
subtype Bits_Array is System.Unsigned_Types.Packed_Bytes1 (Positive);
- -- Unconstrained array used to interprete the address values. We use the
+ -- Constrained array used to interpret the address values. We use the
-- unaligned version always, since this will handle both the aligned and
-- unaligned cases, and we always do these operations by bytes anyway.
-- Note: we use a ones origin array here so that the computations of the
diff --git a/gcc/ada/s-chepoo.ads b/gcc/ada/s-chepoo.ads
index 3c4143927c5..27d840fb7a8 100644
--- a/gcc/ada/s-chepoo.ads
+++ b/gcc/ada/s-chepoo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-1996, 2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -41,32 +41,18 @@ package System.Checked_Pools is
-- called on each implicit or explicit dereference of a pointer which
-- has such a storage pool
- procedure Allocate
- (Pool : in out Checked_Pool;
- Storage_Address : out Address;
- Size_In_Storage_Elements : in System.Storage_Elements.Storage_Count;
- Alignment : in System.Storage_Elements.Storage_Count)
- is abstract;
-
- procedure Deallocate
- (Pool : in out Checked_Pool;
- Storage_Address : in Address;
- Size_In_Storage_Elements : in System.Storage_Elements.Storage_Count;
- Alignment : in System.Storage_Elements.Storage_Count)
- is abstract;
-
- function Storage_Size
- (Pool : Checked_Pool)
- return System.Storage_Elements.Storage_Count
- is abstract;
-
procedure Dereference
(Pool : in out Checked_Pool;
Storage_Address : in Address;
Size_In_Storage_Elements : in System.Storage_Elements.Storage_Count;
Alignment : in System.Storage_Elements.Storage_Count)
is abstract;
- -- Called each time a pointer to a checked pool is dereferenced
+ -- Called implicitly each time a pointer to a checked pool is dereferenced
+ -- All parameters in the profile are compatible with the profile of
+ -- Allocate/Deallocate: the Storage_Address corresponds to the address of
+ -- the dereferenced object, Size_in_Storage_Elements is its dynamic size
+ -- (and thus may involve an implicit dispatching call to size) and
+ -- Alignment is the alignment of the object.
private
type Checked_Pool is abstract
diff --git a/gcc/ada/s-exnllf.adb b/gcc/ada/s-exnllf.adb
index 518370fd7a9..ae282c8110a 100644
--- a/gcc/ada/s-exnllf.adb
+++ b/gcc/ada/s-exnllf.adb
@@ -49,9 +49,9 @@ package body System.Exn_LLF is
begin
-- We use the standard logarithmic approach, Exp gets shifted right
-- testing successive low order bits and Factor is the value of the
- -- base raised to the next power of 2. For positive exponents we
- -- multiply the result by this factor, for negative exponents, we
- -- Division by this factor.
+ -- base raised to the next power of 2. If the low order bit or Exp is
+ -- set, multiply the result by this factor. For negative exponents,
+ -- invert result upon return.
if Exp >= 0 then
loop
diff --git a/gcc/ada/s-fatflt.ads b/gcc/ada/s-fatflt.ads
index 92ad4499923..2ba596bc4a5 100644
--- a/gcc/ada/s-fatflt.ads
+++ b/gcc/ada/s-fatflt.ads
@@ -44,6 +44,6 @@ package System.Fat_Flt is
-- (i.e. the individual floating-point attribute routines) are accessed
-- by name using selected notation.
- package Fat_Float is new System.Fat_Gen (Float);
+ package Attr_Float is new System.Fat_Gen (Float);
end System.Fat_Flt;
diff --git a/gcc/ada/s-fatgen.adb b/gcc/ada/s-fatgen.adb
index 2bdb9363bc3..9d4b5042d69 100644
--- a/gcc/ada/s-fatgen.adb
+++ b/gcc/ada/s-fatgen.adb
@@ -99,10 +99,8 @@ package body System.Fat_Gen is
begin
if Towards = X then
return X;
-
elsif Towards > X then
return Succ (X);
-
else
return Pred (X);
end if;
@@ -114,14 +112,11 @@ package body System.Fat_Gen is
function Ceiling (X : T) return T is
XT : constant T := Truncation (X);
-
begin
if X <= 0.0 then
return XT;
-
elsif X = XT then
return X;
-
else
return XT + 1.0;
end if;
@@ -175,7 +170,7 @@ package body System.Fat_Gen is
-- T'Machine_Emin - T'Machine_Mantissa, which would preserve
-- monotonicity of the exponent function ???
- -- Check for infinities, transfinites, whatnot.
+ -- Check for infinities, transfinites, whatnot
elsif X > T'Safe_Last then
Frac := Invrad;
@@ -193,7 +188,7 @@ package body System.Fat_Gen is
Ax : T := abs X;
Ex : UI := 0;
- -- Ax * Rad ** Ex is invariant.
+ -- Ax * Rad ** Ex is invariant
begin
if Ax >= 1.0 then
@@ -256,7 +251,6 @@ package body System.Fat_Gen is
function Exponent (X : T) return UI is
X_Frac : T;
X_Exp : UI;
-
begin
Decompose (X, X_Frac, X_Exp);
return X_Exp;
@@ -268,14 +262,11 @@ package body System.Fat_Gen is
function Floor (X : T) return T is
XT : constant T := Truncation (X);
-
begin
if X >= 0.0 then
return XT;
-
elsif XT = X then
return X;
-
else
return XT - 1.0;
end if;
@@ -288,7 +279,6 @@ package body System.Fat_Gen is
function Fraction (X : T) return T is
X_Frac : T;
X_Exp : UI;
-
begin
Decompose (X, X_Frac, X_Exp);
return X_Frac;
@@ -366,6 +356,38 @@ package body System.Fat_Gen is
return Temp;
end Machine;
+ ----------------------
+ -- Machine_Rounding --
+ ----------------------
+
+ -- For now, the implementation is identical to that of Rounding, which is
+ -- a permissible behavior, but is not the most efficient possible approach.
+
+ function Machine_Rounding (X : T) return T is
+ Result : T;
+ Tail : T;
+
+ begin
+ Result := Truncation (abs X);
+ Tail := abs X - Result;
+
+ if Tail >= 0.5 then
+ Result := Result + 1.0;
+ end if;
+
+ if X > 0.0 then
+ return Result;
+
+ elsif X < 0.0 then
+ return -Result;
+
+ -- For zero case, make sure sign of zero is preserved
+
+ else
+ return X;
+ end if;
+ end Machine_Rounding;
+
-----------
-- Model --
-----------
@@ -542,7 +564,7 @@ package body System.Fat_Gen is
return X;
end if;
- -- Nonzero x. essentially, just multiply repeatedly by Rad ** (+-2**n).
+ -- Nonzero x. essentially, just multiply repeatedly by Rad ** (+-2**n)
declare
Y : T := X;
@@ -587,6 +609,7 @@ package body System.Fat_Gen is
end if;
-- 0 <= Ex < Log_Power (N)
+
end loop;
-- Ex = 0
@@ -652,7 +675,7 @@ package body System.Fat_Gen is
-- The basic approach is to compute
- -- T'Machine (RM1 + N) - RM1.
+ -- T'Machine (RM1 + N) - RM1
-- where N >= 0.0 and RM1 = radix ** (mantissa - 1)
@@ -693,7 +716,6 @@ package body System.Fat_Gen is
return X;
end if;
end if;
-
end Truncation;
-----------------------
@@ -727,13 +749,16 @@ package body System.Fat_Gen is
else
return X;
end if;
-
end Unbiased_Rounding;
-----------
-- Valid --
-----------
+ -- Note: this routine does not work for VAX float. We compensate for this
+ -- in Exp_Attr by using the Valid functions in Vax_Float_Operations rather
+ -- than the corresponding instantiation of this function.
+
function Valid (X : access T) return Boolean is
IEEE_Emin : constant Integer := T'Machine_Emin - 1;
@@ -744,17 +769,17 @@ package body System.Fat_Gen is
subtype IEEE_Exponent_Range is
Integer range IEEE_Emin - 1 .. IEEE_Emax + 1;
- -- The implementation of this floating point attribute uses
- -- a representation type Float_Rep that allows direct access to
- -- the exponent and mantissa parts of a floating point number.
+ -- The implementation of this floating point attribute uses a
+ -- representation type Float_Rep that allows direct access to the
+ -- exponent and mantissa parts of a floating point number.
-- The Float_Rep type is an array of Float_Word elements. This
- -- representation is chosen to make it possible to size the
- -- type based on a generic parameter. Since the array size is
- -- known at compile-time, efficient code can still be generated.
- -- The size of Float_Word elements should be large enough to allow
- -- accessing the exponent in one read, but small enough so that all
- -- floating point object sizes are a multiple of the Float_Word'Size.
+ -- representation is chosen to make it possible to size the type based
+ -- on a generic parameter. Since the array size is known at compile
+ -- time, efficient code can still be generated. The size of Float_Word
+ -- elements should be large enough to allow accessing the exponent in
+ -- one read, but small enough so that all floating point object sizes
+ -- are a multiple of the Float_Word'Size.
-- The following conditions must be met for all possible
-- instantiations of the attributes package:
@@ -764,9 +789,9 @@ package body System.Fat_Gen is
-- - The exponent and sign are completely contained in a single
-- component of Float_Rep, named Most_Significant_Word (MSW).
- -- - The sign occupies the most significant bit of the MSW
- -- and the exponent is in the following bits.
- -- Unused bits (if any) are in the least significant part.
+ -- - The sign occupies the most significant bit of the MSW and the
+ -- exponent is in the following bits. Unused bits (if any) are in
+ -- the least significant part.
type Float_Word is mod 2**Positive'Min (System.Word_Size, 32);
type Rep_Index is range 0 .. 7;
@@ -775,12 +800,12 @@ package body System.Fat_Gen is
(T'Size + Float_Word'Size - 1) / Float_Word'Size;
Rep_Last : constant Rep_Index := Rep_Index'Min
(Rep_Index (Rep_Words - 1), (T'Mantissa + 16) / Float_Word'Size);
- -- Determine the number of Float_Words needed for representing
- -- the entire floating-poinit value. Do not take into account
- -- excessive padding, as occurs on IA-64 where 80 bits floats get
- -- padded to 128 bits. In general, the exponent field cannot
- -- be larger than 15 bits, even for 128-bit floating-poin t types,
- -- so the final format size won't be larger than T'Mantissa + 16.
+ -- Determine the number of Float_Words needed for representing the
+ -- entire floating-point value. Do not take into account excessive
+ -- padding, as occurs on IA-64 where 80 bits floats get padded to 128
+ -- bits. In general, the exponent field cannot be larger than 15 bits,
+ -- even for 128-bit floating-poin t types, so the final format size
+ -- won't be larger than T'Mantissa + 16.
type Float_Rep is
array (Rep_Index range 0 .. Rep_Index (Rep_Words - 1)) of Float_Word;
@@ -794,26 +819,26 @@ package body System.Fat_Gen is
Most_Significant_Word : constant Rep_Index :=
Rep_Last * Standard'Default_Bit_Order;
- -- Finding the location of the Exponent_Word is a bit tricky.
- -- In general we assume Word_Order = Bit_Order.
- -- This expression needs to be refined for VMS.
+ -- Finding the location of the Exponent_Word is a bit tricky. In general
+ -- we assume Word_Order = Bit_Order. This expression needs to be refined
+ -- for VMS.
Exponent_Factor : constant Float_Word :=
2**(Float_Word'Size - 1) /
Float_Word (IEEE_Emax - IEEE_Emin + 3) *
Boolean'Pos (Most_Significant_Word /= 2) +
Boolean'Pos (Most_Significant_Word = 2);
- -- Factor that the extracted exponent needs to be divided by
- -- to be in range 0 .. IEEE_Emax - IEEE_Emin + 2.
- -- Special kludge: Exponent_Factor is 1 for x86/IA64 double extended
- -- as GCC adds unused bits to the type.
+ -- Factor that the extracted exponent needs to be divided by to be in
+ -- range 0 .. IEEE_Emax - IEEE_Emin + 2. Special kludge: Exponent_Factor
+ -- is 1 for x86/IA64 double extended as GCC adds unused bits to the
+ -- type.
Exponent_Mask : constant Float_Word :=
Float_Word (IEEE_Emax - IEEE_Emin + 2) *
Exponent_Factor;
- -- Value needed to mask out the exponent field.
- -- This assumes that the range IEEE_Emin - 1 .. IEEE_Emax + 1
- -- contains 2**N values, for some N in Natural.
+ -- Value needed to mask out the exponent field. This assumes that the
+ -- range IEEE_Emin - 1 .. IEEE_Emax + contains 2**N values, for some N
+ -- in Natural.
function To_Float is new Ada.Unchecked_Conversion (Float_Rep, T);
@@ -834,8 +859,8 @@ package body System.Fat_Gen is
Integer ((R (Most_Significant_Word) and Exponent_Mask) /
Exponent_Factor)
- IEEE_Bias;
- -- Mask/Shift T to only get bits from the exponent
- -- Then convert biased value to integer value.
+ -- Mask/Shift T to only get bits from the exponent. Then convert biased
+ -- value to integer value.
SR : Float_Rep;
-- Float_Rep representation of significant of X.all
@@ -843,8 +868,8 @@ package body System.Fat_Gen is
begin
if T'Denorm then
- -- All denormalized numbers are valid, so only invalid numbers
- -- are overflows and NaN's, both with exponent = Emax + 1.
+ -- All denormalized numbers are valid, so only invalid numbers are
+ -- overflows and NaN's, both with exponent = Emax + 1.
return E /= IEEE_Emax + 1;
diff --git a/gcc/ada/s-fatgen.ads b/gcc/ada/s-fatgen.ads
index c1bc8204058..83b6f064461 100644
--- a/gcc/ada/s-fatgen.ads
+++ b/gcc/ada/s-fatgen.ads
@@ -71,6 +71,8 @@ package System.Fat_Gen is
function Machine (X : T) return T;
+ function Machine_Rounding (X : T) return T;
+
function Model (X : T) return T;
function Pred (X : T) return T;
@@ -95,6 +97,8 @@ package System.Fat_Gen is
-- register, and the whole point of 'Valid is to prevent exceptions.
-- Note that the object of type T must have the natural alignment
-- for type T. See Unaligned_Valid for further discussion.
+ --
+ -- Note: this routine does not work for Vax_Float ???
function Unaligned_Valid (A : System.Address) return Boolean;
-- This version of Valid is used if the floating-point value to
@@ -112,11 +116,16 @@ package System.Fat_Gen is
-- not require strict alignment (e.g. the ia32/x86), since on a
-- target not requiring strict alignment, it is fine to pass a
-- non-aligned value to the standard Valid routine.
+ --
+ -- Note: this routine does not work for Vax_Float ???
private
pragma Inline (Machine);
pragma Inline (Model);
- pragma Inline_Always (Valid);
- pragma Inline_Always (Unaligned_Valid);
+
+ -- Note: previously the validity checking subprograms (Unaligned_Valid and
+ -- Valid) were also inlined, but this was changed since there were some
+ -- problems with this inlining in optimized mode, and in any case it seems
+ -- better to avoid this inlining (space and robustness considerations).
end System.Fat_Gen;
diff --git a/gcc/ada/s-fatlfl.ads b/gcc/ada/s-fatlfl.ads
index bff94090190..844f1b4739a 100644
--- a/gcc/ada/s-fatlfl.ads
+++ b/gcc/ada/s-fatlfl.ads
@@ -44,6 +44,6 @@ package System.Fat_LFlt is
-- (i.e. the individual floating-point attribute routines) are accessed
-- by name using selected notation.
- package Fat_Long_Float is new System.Fat_Gen (Long_Float);
+ package Attr_Long_Float is new System.Fat_Gen (Long_Float);
end System.Fat_LFlt;
diff --git a/gcc/ada/s-fatllf.ads b/gcc/ada/s-fatllf.ads
index bb8abf4e015..f2d554c4dab 100644
--- a/gcc/ada/s-fatllf.ads
+++ b/gcc/ada/s-fatllf.ads
@@ -44,6 +44,6 @@ package System.Fat_LLF is
-- (i.e. the individual floating-point attribute routines) are accessed
-- by name using selected notation.
- package Fat_Long_Long_Float is new System.Fat_Gen (Long_Long_Float);
+ package Attr_Long_Long_Float is new System.Fat_Gen (Long_Long_Float);
end System.Fat_LLF;
diff --git a/gcc/ada/s-fatsfl.ads b/gcc/ada/s-fatsfl.ads
index 1d1f3509652..129efea64a2 100644
--- a/gcc/ada/s-fatsfl.ads
+++ b/gcc/ada/s-fatsfl.ads
@@ -44,6 +44,6 @@ package System.Fat_SFlt is
-- (i.e. the individual floating-point attribute routines) are accessed
-- by name using selected notation.
- package Fat_Short_Float is new System.Fat_Gen (Short_Float);
+ package Attr_Short_Float is new System.Fat_Gen (Short_Float);
end System.Fat_SFlt;
diff --git a/gcc/ada/s-fileio.ads b/gcc/ada/s-fileio.ads
index feb1efe78f0..75636ef5e45 100644
--- a/gcc/ada/s-fileio.ads
+++ b/gcc/ada/s-fileio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -139,7 +139,7 @@ package System.File_IO is
procedure Chain_File (File : FCB.AFCB_Ptr);
-- Used to chain the given file into the list of open files. Normally this
- -- is done implicitly by Open. Chain_File is used for the spcial cases of
+ -- is done implicitly by Open. Chain_File is used for the special cases of
-- the system files defined by Text_IO (stdin, stdout, stderr) which are
-- not opened in the normal manner. Note that the caller is responsible
-- for task lock out to protect the global data structures if this is
diff --git a/gcc/ada/s-filofl.ads b/gcc/ada/s-filofl.ads
new file mode 100644
index 00000000000..dded3cf5a94
--- /dev/null
+++ b/gcc/ada/s-filofl.ads
@@ -0,0 +1,54 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . F A T _ I E E E _ L O N G _ F L O A T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains an instantiation of the floating-point attribute
+-- runtime routines for IEEE long float. This is used on VMS targest where
+-- we can't just use Long_Float, since this may have been mapped to Vax_Float
+-- using a Float_Representation configuration pragma.
+
+with System.Fat_Gen;
+
+package System.Fat_IEEE_Long_Float is
+ pragma Pure;
+
+ type Fat_IEEE_Long is digits 15;
+ pragma Float_Representation (IEEE_Float, Fat_IEEE_Long);
+
+ -- Note the only entity from this package that is acccessed by Rtsfind
+ -- is the name of the package instantiation. Entities within this package
+ -- (i.e. the individual floating-point attribute routines) are accessed
+ -- by name using selected notation.
+
+ package Attr_IEEE_Long is new System.Fat_Gen (Fat_IEEE_Long);
+
+end System.Fat_IEEE_Long_Float;
diff --git a/gcc/ada/s-finroo.adb b/gcc/ada/s-finroo.adb
index 6fcc6081505..559c29cf0d7 100644
--- a/gcc/ada/s-finroo.adb
+++ b/gcc/ada/s-finroo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -73,8 +73,9 @@ package body System.Finalization_Root is
-- Suppress warning for out paramater Item which is not assigned
-- because it is pretty much empty.
- procedure Read (Stream : access Ada.Streams.Root_Stream_Type'Class;
- Item : out Root_Controlled)
+ procedure Read
+ (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
+ Item : out Root_Controlled)
is
begin
null;
@@ -87,8 +88,9 @@ package body System.Finalization_Root is
-- Read and Write must be empty in order to avoid copying the
-- finalization pointers.
- procedure Write (Stream : access Ada.Streams.Root_Stream_Type'Class;
- Item : in Root_Controlled)
+ procedure Write
+ (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
+ Item : in Root_Controlled)
is
begin
null;
diff --git a/gcc/ada/s-finroo.ads b/gcc/ada/s-finroo.ads
index ed1be45ab4a..f9847eb5818 100644
--- a/gcc/ada/s-finroo.ads
+++ b/gcc/ada/s-finroo.ads
@@ -61,10 +61,13 @@ package System.Finalization_Root is
procedure Finalize (Object : in out Root_Controlled);
procedure Adjust (Object : in out Root_Controlled);
- procedure Write (Stream : access Ada.Streams.Root_Stream_Type'Class;
- Item : in Root_Controlled);
- procedure Read (Stream : access Ada.Streams.Root_Stream_Type'Class;
- Item : out Root_Controlled);
+ procedure Write
+ (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
+ Item : in Root_Controlled);
+
+ procedure Read
+ (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
+ Item : out Root_Controlled);
for Root_Controlled'Read use Read;
for Root_Controlled'Write use Write;
diff --git a/gcc/ada/s-fishfl.ads b/gcc/ada/s-fishfl.ads
new file mode 100644
index 00000000000..7308618f1ad
--- /dev/null
+++ b/gcc/ada/s-fishfl.ads
@@ -0,0 +1,54 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . F A T _ I E E E _ S H O R T _ F L O A T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains an instantiation of the floating-point attribute
+-- runtime routines for IEEE short float. This is used on VMS targest where
+-- we can't just use Float, since this may have been mapped to Vax_Float
+-- using a Float_Representation configuration pragma.
+
+with System.Fat_Gen;
+
+package System.Fat_IEEE_Short_Float is
+ pragma Pure;
+
+ type Fat_IEEE_Short is digits 6;
+ pragma Float_Representation (IEEE_Float, Fat_IEEE_Short);
+
+ -- Note the only entity from this package that is acccessed by Rtsfind
+ -- is the name of the package instantiation. Entities within this package
+ -- (i.e. the individual floating-point attribute routines) are accessed
+ -- by name using selected notation.
+
+ package Attr_IEEE_Short is new System.Fat_Gen (Fat_IEEE_Short);
+
+end System.Fat_IEEE_Short_Float;
diff --git a/gcc/ada/s-fvadfl.ads b/gcc/ada/s-fvadfl.ads
new file mode 100644
index 00000000000..05a367ca42f
--- /dev/null
+++ b/gcc/ada/s-fvadfl.ads
@@ -0,0 +1,56 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . F A T _ V A X _ D _ F L O A T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains an instantiation of the floating-point attribute
+-- runtime routines for VAX D-float for use on VMS targets.
+
+with System.Fat_Gen;
+
+package System.Fat_VAX_D_Float is
+ pragma Pure;
+
+ pragma Warnings (Off);
+ -- This unit is normally used only for VMS, but we compile it for other
+ -- targest for the convenience of testing vms code using -gnatdm.
+
+ type Fat_VAX_D is digits 9;
+ pragma Float_Representation (VAX_Float, Fat_VAX_D);
+
+ -- Note the only entity from this package that is acccessed by Rtsfind
+ -- is the name of the package instantiation. Entities within this package
+ -- (i.e. the individual floating-point attribute routines) are accessed
+ -- by name using selected notation.
+
+ package Attr_VAX_D_Float is new System.Fat_Gen (Fat_VAX_D);
+
+end System.Fat_VAX_D_Float;
diff --git a/gcc/ada/s-fvaffl.ads b/gcc/ada/s-fvaffl.ads
new file mode 100644
index 00000000000..0c769bfd9d1
--- /dev/null
+++ b/gcc/ada/s-fvaffl.ads
@@ -0,0 +1,56 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . F A T _ V A X _ F _ F L O A T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains an instantiation of the floating-point attribute
+-- runtime routines for VAX F-float for use on VMS targets.
+
+with System.Fat_Gen;
+
+package System.Fat_VAX_F_Float is
+ pragma Pure;
+
+ pragma Warnings (Off);
+ -- This unit is normally used only for VMS, but we compile it for other
+ -- targest for the convenience of testing vms code using -gnatdm.
+
+ type Fat_VAX_F is digits 6;
+ pragma Float_Representation (VAX_Float, Fat_VAX_F);
+
+ -- Note the only entity from this package that is acccessed by Rtsfind
+ -- is the name of the package instantiation. Entities within this package
+ -- (i.e. the individual floating-point attribute routines) are accessed
+ -- by name using selected notation.
+
+ package Attr_VAX_F_Float is new System.Fat_Gen (Fat_VAX_F);
+
+end System.Fat_VAX_F_Float;
diff --git a/gcc/ada/s-fvagfl.ads b/gcc/ada/s-fvagfl.ads
new file mode 100644
index 00000000000..50a06b9e9e1
--- /dev/null
+++ b/gcc/ada/s-fvagfl.ads
@@ -0,0 +1,56 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- S Y S T E M . F A T _ V A X _ G _ F L O A T --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package contains an instantiation of the floating-point attribute
+-- runtime routines for VAX F-float for use on VMS targets.
+
+with System.Fat_Gen;
+
+package System.Fat_VAX_G_Float is
+ pragma Pure;
+
+ pragma Warnings (Off);
+ -- This unit is normally used only for VMS, but we compile it for other
+ -- targest for the convenience of testing vms code using -gnatdm.
+
+ type Fat_VAX_G is digits 15;
+ pragma Float_Representation (VAX_Float, Fat_VAX_G);
+
+ -- Note the only entity from this package that is acccessed by Rtsfind
+ -- is the name of the package instantiation. Entities within this package
+ -- (i.e. the individual floating-point attribute routines) are accessed
+ -- by name using selected notation.
+
+ package Attr_VAX_G_Float is new System.Fat_Gen (Fat_VAX_G);
+
+end System.Fat_VAX_G_Float;
diff --git a/gcc/ada/s-gloloc-mingw.adb b/gcc/ada/s-gloloc-mingw.adb
index a6abd441359..ce7e4f7857f 100644
--- a/gcc/ada/s-gloloc-mingw.adb
+++ b/gcc/ada/s-gloloc-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2001 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,7 +31,7 @@
-- --
------------------------------------------------------------------------------
--- This implementation is specific to NT.
+-- This implementation is specific to NT
with GNAT.Task_Lock;
diff --git a/gcc/ada/s-imgwch.ads b/gcc/ada/s-imgwch.ads
index dbcfb07cf2f..61f4441f53a 100644
--- a/gcc/ada/s-imgwch.ads
+++ b/gcc/ada/s-imgwch.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-imgwiu.adb b/gcc/ada/s-imgwiu.adb
index 8aee7fd9f3b..845cca51ad0 100644
--- a/gcc/ada/s-imgwiu.adb
+++ b/gcc/ada/s-imgwiu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-imgwiu.ads b/gcc/ada/s-imgwiu.ads
index 8b53da8e155..2b690aa2dff 100644
--- a/gcc/ada/s-imgwiu.ads
+++ b/gcc/ada/s-imgwiu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-inmaop-dummy.adb b/gcc/ada/s-inmaop-dummy.adb
index 72848ee0c21..edd636ed077 100644
--- a/gcc/ada/s-inmaop-dummy.adb
+++ b/gcc/ada/s-inmaop-dummy.adb
@@ -2,12 +2,11 @@
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
--- S Y S T E M . I N T E R R U P T _ M A N A G E M E N T . --
--- O P E R A T I O N S --
+-- SYSTEM.INTERRUPT_MANAGEMENT.OPERATIONS --
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-inmaop-vms.adb b/gcc/ada/s-inmaop-vms.adb
index ba421ec6a0a..11db041b5a8 100644
--- a/gcc/ada/s-inmaop-vms.adb
+++ b/gcc/ada/s-inmaop-vms.adb
@@ -2,12 +2,11 @@
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
--- S Y S T E M . I N T E R R U P T _ M A N A G E M E N T . --
--- O P E R A T I O N S --
+-- SYSTEM.INTERRUPT_MANAGEMENT.OPERATIONS --
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-inmaop.ads b/gcc/ada/s-inmaop.ads
index 87d82ab62ae..0fd1e00612d 100644
--- a/gcc/ada/s-inmaop.ads
+++ b/gcc/ada/s-inmaop.ads
@@ -63,11 +63,11 @@ package System.Interrupt_Management.Operations is
procedure Install_Default_Action (Interrupt : Interrupt_ID);
pragma Inline (Install_Default_Action);
- -- Set the sigaction of the Interrupt to default (SIG_DFL).
+ -- Set the sigaction of the Interrupt to default (SIG_DFL)
procedure Install_Ignore_Action (Interrupt : Interrupt_ID);
pragma Inline (Install_Ignore_Action);
- -- Set the sigaction of the Interrupt to ignore (SIG_IGN).
+ -- Set the sigaction of the Interrupt to ignore (SIG_IGN)
procedure Fill_Interrupt_Mask (Mask : access Interrupt_Mask);
pragma Inline (Fill_Interrupt_Mask);
@@ -97,7 +97,7 @@ package System.Interrupt_Management.Operations is
procedure Copy_Interrupt_Mask (X : out Interrupt_Mask; Y : Interrupt_Mask);
pragma Inline (Copy_Interrupt_Mask);
- -- Assigment needed for limited private type Interrupt_Mask.
+ -- Assigment needed for limited private type Interrupt_Mask
procedure Interrupt_Self_Process (Interrupt : Interrupt_ID);
pragma Inline (Interrupt_Self_Process);
@@ -108,18 +108,18 @@ package System.Interrupt_Management.Operations is
-- This function should be called by the elaboration of System.Interrupt
-- to set up proper signal masking in all tasks.
- -- The following objects serve as constants, but are initialized
- -- in the body to aid portability. These actually belong to the
- -- System.Interrupt_Management but since Interrupt_Mask is a
- -- private type we can not have them declared there.
+ -- The following objects serve as constants, but are initialized in the
+ -- body to aid portability. These should be in System.Interrupt_Management
+ -- but since Interrupt_Mask is private type we cannot have them declared
+ -- there.
-- Why not make these deferred constants that are initialized using
-- function calls in the private part???
Environment_Mask : aliased Interrupt_Mask;
- -- This mask represents the mask of Environment task when this package
- -- is being elaborated, except the signals being
- -- forced to be unmasked by RTS (items in Keep_Unmasked)
+ -- This mask represents the mask of Environment task when this package is
+ -- being elaborated, except the signals being forced to be unmasked by RTS
+ -- (items in Keep_Unmasked)
All_Tasks_Mask : aliased Interrupt_Mask;
-- This is the mask of all tasks created in RTS. Only one task in RTS
diff --git a/gcc/ada/s-interr-sigaction.adb b/gcc/ada/s-interr-sigaction.adb
index 6b94e958578..41937db1fac 100644
--- a/gcc/ada/s-interr-sigaction.adb
+++ b/gcc/ada/s-interr-sigaction.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005 Free Software Fundation --
+-- Copyright (C) 1998-2005, Free Software Fundation --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-mastop-tru64.adb b/gcc/ada/s-mastop-tru64.adb
index 1a7b9876924..ce379033a40 100644
--- a/gcc/ada/s-mastop-tru64.adb
+++ b/gcc/ada/s-mastop-tru64.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- (Version for Alpha/Dec Unix) --
-- --
--- Copyright (C) 1999-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -143,7 +143,7 @@ package body System.Machine_State_Operations is
Prf : constant System.Address := exc_lookup_function (Get_Code_Loc (M));
begin
- if (Prf = System.Null_Address) then
+ if Prf = System.Null_Address then
c_set_code_loc (M, 0);
else
exc_virtual_unwind (Prf, M);
diff --git a/gcc/ada/s-mastop-vms.adb b/gcc/ada/s-mastop-vms.adb
index 9e867285007..ce462cb9a60 100644
--- a/gcc/ada/s-mastop-vms.adb
+++ b/gcc/ada/s-mastop-vms.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- (Version for Alpha/VMS) --
-- --
--- Copyright (C) 2001-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2001-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -43,7 +43,7 @@ package body System.Machine_State_Operations is
subtype Cond_Value_Type is Unsigned_Longword;
- -- Record layouts copied from Starlet.
+ -- Record layouts copied from Starlet
type ICB_Fflags_Bits_Type is record
Exception_Frame : Boolean;
@@ -94,7 +94,7 @@ package body System.Machine_State_Operations is
Ireg : Unsigned_Quadword_Array (0 .. 30);
Freg : Unsigned_Quadword_Array (0 .. 30);
- -- The register contents areas. 31 for scalars, 31 for float.
+ -- The register contents areas. 31 for scalars, 31 for float
System_Defined : Unsigned_Quadword_Array (0 .. 1);
-- The following is an "internal" area that's reserved for use by
@@ -153,7 +153,7 @@ package body System.Machine_State_Operations is
function Fetch_Code (Loc : Code_Loc) return Code_Loc is
begin
- -- The starting address is in the second longword pointed to by Loc.
+ -- The starting address is in the second longword pointed to by Loc
return Fetch (System.Aux_DEC."+" (Loc, 8));
end Fetch_Code;
diff --git a/gcc/ada/s-osinte-fsu.adb b/gcc/ada/s-osinte-fsu.adb
index b7118750194..f5ebf934326 100644
--- a/gcc/ada/s-osinte-fsu.adb
+++ b/gcc/ada/s-osinte-fsu.adb
@@ -250,8 +250,8 @@ package body System.OS_Interface is
-- FSU_THREADS does not have pthread_setschedparam
- -- This routine returns a non-negative value upon failure
- -- but the error code can not be set conforming the POSIX standard.
+ -- This routine returns a non-negative value upon failure but the error
+ -- code cannot be set conforming the POSIX standard.
function pthread_setschedparam
(thread : pthread_t;
diff --git a/gcc/ada/s-pack03.adb b/gcc/ada/s-pack03.adb
index 907936f7fd1..bd517f60d43 100644
--- a/gcc/ada/s-pack03.adb
+++ b/gcc/ada/s-pack03.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_03 is
function Get_03 (Arr : System.Address; N : Natural) return Bits_03 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_03 is
procedure Set_03 (Arr : System.Address; N : Natural; E : Bits_03) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack03.ads b/gcc/ada/s-pack03.ads
index 3b03c6ef9c4..0d6f846a182 100644
--- a/gcc/ada/s-pack03.ads
+++ b/gcc/ada/s-pack03.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack05.adb b/gcc/ada/s-pack05.adb
index 0e38569c3cc..c3008886758 100644
--- a/gcc/ada/s-pack05.adb
+++ b/gcc/ada/s-pack05.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_05 is
function Get_05 (Arr : System.Address; N : Natural) return Bits_05 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_05 is
procedure Set_05 (Arr : System.Address; N : Natural; E : Bits_05) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack05.ads b/gcc/ada/s-pack05.ads
index 2f4fc26a262..b5267565c3b 100644
--- a/gcc/ada/s-pack05.ads
+++ b/gcc/ada/s-pack05.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack06.adb b/gcc/ada/s-pack06.adb
index 12e9003ac34..b8beacc4731 100644
--- a/gcc/ada/s-pack06.adb
+++ b/gcc/ada/s-pack06.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_06 is
function Get_06 (Arr : System.Address; N : Natural) return Bits_06 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_06 is
function GetU_06 (Arr : System.Address; N : Natural) return Bits_06 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
diff --git a/gcc/ada/s-pack06.ads b/gcc/ada/s-pack06.ads
index dcd53abca2a..5c3a4109217 100644
--- a/gcc/ada/s-pack06.ads
+++ b/gcc/ada/s-pack06.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack07.adb b/gcc/ada/s-pack07.adb
index 064d711c1e0..b8f54b0278d 100644
--- a/gcc/ada/s-pack07.adb
+++ b/gcc/ada/s-pack07.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_07 is
function Get_07 (Arr : System.Address; N : Natural) return Bits_07 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_07 is
procedure Set_07 (Arr : System.Address; N : Natural; E : Bits_07) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack07.ads b/gcc/ada/s-pack07.ads
index d994b681e98..308d3ceda33 100644
--- a/gcc/ada/s-pack07.ads
+++ b/gcc/ada/s-pack07.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack09.adb b/gcc/ada/s-pack09.adb
index c3d3de4dcd1..91d4c51e3c9 100644
--- a/gcc/ada/s-pack09.adb
+++ b/gcc/ada/s-pack09.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_09 is
function Get_09 (Arr : System.Address; N : Natural) return Bits_09 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_09 is
procedure Set_09 (Arr : System.Address; N : Natural; E : Bits_09) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack09.ads b/gcc/ada/s-pack09.ads
index 7b4e51ba255..c12df55f63e 100644
--- a/gcc/ada/s-pack09.ads
+++ b/gcc/ada/s-pack09.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack10.adb b/gcc/ada/s-pack10.adb
index d94a50aec44..c927e0c2b03 100644
--- a/gcc/ada/s-pack10.adb
+++ b/gcc/ada/s-pack10.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_10 is
function Get_10 (Arr : System.Address; N : Natural) return Bits_10 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_10 is
function GetU_10 (Arr : System.Address; N : Natural) return Bits_10 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
diff --git a/gcc/ada/s-pack10.ads b/gcc/ada/s-pack10.ads
index f079f7f65c1..6b6904eadc8 100644
--- a/gcc/ada/s-pack10.ads
+++ b/gcc/ada/s-pack10.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack11.adb b/gcc/ada/s-pack11.adb
index c8ea9563543..caa535aa21e 100644
--- a/gcc/ada/s-pack11.adb
+++ b/gcc/ada/s-pack11.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_11 is
function Get_11 (Arr : System.Address; N : Natural) return Bits_11 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_11 is
procedure Set_11 (Arr : System.Address; N : Natural; E : Bits_11) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack11.ads b/gcc/ada/s-pack11.ads
index b8017cfbf42..75dbfb4e9f0 100644
--- a/gcc/ada/s-pack11.ads
+++ b/gcc/ada/s-pack11.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack12.adb b/gcc/ada/s-pack12.adb
index 29faf62e0b8..c728be4bf39 100644
--- a/gcc/ada/s-pack12.adb
+++ b/gcc/ada/s-pack12.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_12 is
function Get_12 (Arr : System.Address; N : Natural) return Bits_12 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_12 is
function GetU_12 (Arr : System.Address; N : Natural) return Bits_12 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
diff --git a/gcc/ada/s-pack12.ads b/gcc/ada/s-pack12.ads
index 002bc518208..14ee979afc9 100644
--- a/gcc/ada/s-pack12.ads
+++ b/gcc/ada/s-pack12.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack13.adb b/gcc/ada/s-pack13.adb
index 38680363857..835c99785e1 100644
--- a/gcc/ada/s-pack13.adb
+++ b/gcc/ada/s-pack13.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_13 is
function Get_13 (Arr : System.Address; N : Natural) return Bits_13 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_13 is
procedure Set_13 (Arr : System.Address; N : Natural; E : Bits_13) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack13.ads b/gcc/ada/s-pack13.ads
index 8022a90b59d..1e918c8208a 100644
--- a/gcc/ada/s-pack13.ads
+++ b/gcc/ada/s-pack13.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack14.adb b/gcc/ada/s-pack14.adb
index 2fc3c404fb2..6c0fa3fe330 100644
--- a/gcc/ada/s-pack14.adb
+++ b/gcc/ada/s-pack14.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_14 is
function Get_14 (Arr : System.Address; N : Natural) return Bits_14 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_14 is
function GetU_14 (Arr : System.Address; N : Natural) return Bits_14 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_14 is
procedure Set_14 (Arr : System.Address; N : Natural; E : Bits_14) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_14 is
procedure SetU_14 (Arr : System.Address; N : Natural; E : Bits_14) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack14.ads b/gcc/ada/s-pack14.ads
index e3744b2f587..c8e592f88a7 100644
--- a/gcc/ada/s-pack14.ads
+++ b/gcc/ada/s-pack14.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack15.adb b/gcc/ada/s-pack15.adb
index 3212f2de8de..cb545fe1e08 100644
--- a/gcc/ada/s-pack15.adb
+++ b/gcc/ada/s-pack15.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_15 is
function Get_15 (Arr : System.Address; N : Natural) return Bits_15 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_15 is
procedure Set_15 (Arr : System.Address; N : Natural; E : Bits_15) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack15.ads b/gcc/ada/s-pack15.ads
index c166f8ab76c..86c13e8caaf 100644
--- a/gcc/ada/s-pack15.ads
+++ b/gcc/ada/s-pack15.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack17.adb b/gcc/ada/s-pack17.adb
index e180609df92..a5495607773 100644
--- a/gcc/ada/s-pack17.adb
+++ b/gcc/ada/s-pack17.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_17 is
function Get_17 (Arr : System.Address; N : Natural) return Bits_17 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_17 is
procedure Set_17 (Arr : System.Address; N : Natural; E : Bits_17) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack17.ads b/gcc/ada/s-pack17.ads
index fde3bd17d52..f739138ad4b 100644
--- a/gcc/ada/s-pack17.ads
+++ b/gcc/ada/s-pack17.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack18.adb b/gcc/ada/s-pack18.adb
index d0232f08dbd..2ddc5579345 100644
--- a/gcc/ada/s-pack18.adb
+++ b/gcc/ada/s-pack18.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_18 is
function Get_18 (Arr : System.Address; N : Natural) return Bits_18 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_18 is
function GetU_18 (Arr : System.Address; N : Natural) return Bits_18 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_18 is
procedure Set_18 (Arr : System.Address; N : Natural; E : Bits_18) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_18 is
procedure SetU_18 (Arr : System.Address; N : Natural; E : Bits_18) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack18.ads b/gcc/ada/s-pack18.ads
index c689d50d5f0..936b0c5ab81 100644
--- a/gcc/ada/s-pack18.ads
+++ b/gcc/ada/s-pack18.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack19.adb b/gcc/ada/s-pack19.adb
index 4fd154d368e..063b5f1e83b 100644
--- a/gcc/ada/s-pack19.adb
+++ b/gcc/ada/s-pack19.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_19 is
function Get_19 (Arr : System.Address; N : Natural) return Bits_19 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_19 is
procedure Set_19 (Arr : System.Address; N : Natural; E : Bits_19) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack19.ads b/gcc/ada/s-pack19.ads
index 4f3e12da9cc..1f21aba7dd5 100644
--- a/gcc/ada/s-pack19.ads
+++ b/gcc/ada/s-pack19.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack20.adb b/gcc/ada/s-pack20.adb
index 317ce4dc872..b05f9ffacf5 100644
--- a/gcc/ada/s-pack20.adb
+++ b/gcc/ada/s-pack20.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_20 is
function Get_20 (Arr : System.Address; N : Natural) return Bits_20 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_20 is
function GetU_20 (Arr : System.Address; N : Natural) return Bits_20 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_20 is
procedure Set_20 (Arr : System.Address; N : Natural; E : Bits_20) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_20 is
procedure SetU_20 (Arr : System.Address; N : Natural; E : Bits_20) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack20.ads b/gcc/ada/s-pack20.ads
index 39a9dc576d2..2df64d3b93e 100644
--- a/gcc/ada/s-pack20.ads
+++ b/gcc/ada/s-pack20.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack21.adb b/gcc/ada/s-pack21.adb
index e1267a53395..1683857c661 100644
--- a/gcc/ada/s-pack21.adb
+++ b/gcc/ada/s-pack21.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_21 is
function Get_21 (Arr : System.Address; N : Natural) return Bits_21 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_21 is
procedure Set_21 (Arr : System.Address; N : Natural; E : Bits_21) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack21.ads b/gcc/ada/s-pack21.ads
index 7de18f9827d..c8c0951cc55 100644
--- a/gcc/ada/s-pack21.ads
+++ b/gcc/ada/s-pack21.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack22.adb b/gcc/ada/s-pack22.adb
index ab63535d0ba..31f533a2aaa 100644
--- a/gcc/ada/s-pack22.adb
+++ b/gcc/ada/s-pack22.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_22 is
function Get_22 (Arr : System.Address; N : Natural) return Bits_22 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_22 is
function GetU_22 (Arr : System.Address; N : Natural) return Bits_22 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_22 is
procedure Set_22 (Arr : System.Address; N : Natural; E : Bits_22) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_22 is
procedure SetU_22 (Arr : System.Address; N : Natural; E : Bits_22) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack22.ads b/gcc/ada/s-pack22.ads
index 3968d23fc82..883504e6cd8 100644
--- a/gcc/ada/s-pack22.ads
+++ b/gcc/ada/s-pack22.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack23.adb b/gcc/ada/s-pack23.adb
index 20d59365fc8..840d63d625a 100644
--- a/gcc/ada/s-pack23.adb
+++ b/gcc/ada/s-pack23.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_23 is
function Get_23 (Arr : System.Address; N : Natural) return Bits_23 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_23 is
procedure Set_23 (Arr : System.Address; N : Natural; E : Bits_23) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack23.ads b/gcc/ada/s-pack23.ads
index f19a9e93ac3..1efe76b400a 100644
--- a/gcc/ada/s-pack23.ads
+++ b/gcc/ada/s-pack23.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack24.adb b/gcc/ada/s-pack24.adb
index b44b999db83..98ec9d556f9 100644
--- a/gcc/ada/s-pack24.adb
+++ b/gcc/ada/s-pack24.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_24 is
function Get_24 (Arr : System.Address; N : Natural) return Bits_24 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_24 is
function GetU_24 (Arr : System.Address; N : Natural) return Bits_24 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_24 is
procedure Set_24 (Arr : System.Address; N : Natural; E : Bits_24) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_24 is
procedure SetU_24 (Arr : System.Address; N : Natural; E : Bits_24) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack24.ads b/gcc/ada/s-pack24.ads
index 8c1834e5cc8..6581de89148 100644
--- a/gcc/ada/s-pack24.ads
+++ b/gcc/ada/s-pack24.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack25.adb b/gcc/ada/s-pack25.adb
index 8803c62558c..bab19229628 100644
--- a/gcc/ada/s-pack25.adb
+++ b/gcc/ada/s-pack25.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack25.ads b/gcc/ada/s-pack25.ads
index 7882d172f16..fd464106721 100644
--- a/gcc/ada/s-pack25.ads
+++ b/gcc/ada/s-pack25.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack26.adb b/gcc/ada/s-pack26.adb
index 48aaad6edb0..ecddf4d3a71 100644
--- a/gcc/ada/s-pack26.adb
+++ b/gcc/ada/s-pack26.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_26 is
function Get_26 (Arr : System.Address; N : Natural) return Bits_26 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_26 is
function GetU_26 (Arr : System.Address; N : Natural) return Bits_26 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_26 is
procedure Set_26 (Arr : System.Address; N : Natural; E : Bits_26) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_26 is
procedure SetU_26 (Arr : System.Address; N : Natural; E : Bits_26) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack26.ads b/gcc/ada/s-pack26.ads
index 793b038c386..a1c7a359a16 100644
--- a/gcc/ada/s-pack26.ads
+++ b/gcc/ada/s-pack26.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack27.adb b/gcc/ada/s-pack27.adb
index 3ad9e1a50a0..b2492b5c213 100644
--- a/gcc/ada/s-pack27.adb
+++ b/gcc/ada/s-pack27.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_27 is
function Get_27 (Arr : System.Address; N : Natural) return Bits_27 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_27 is
procedure Set_27 (Arr : System.Address; N : Natural; E : Bits_27) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack27.ads b/gcc/ada/s-pack27.ads
index edbda505eeb..8a77d48905a 100644
--- a/gcc/ada/s-pack27.ads
+++ b/gcc/ada/s-pack27.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack28.adb b/gcc/ada/s-pack28.adb
index 801e0bc8791..f2693ab5678 100644
--- a/gcc/ada/s-pack28.adb
+++ b/gcc/ada/s-pack28.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_28 is
function Get_28 (Arr : System.Address; N : Natural) return Bits_28 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_28 is
function GetU_28 (Arr : System.Address; N : Natural) return Bits_28 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_28 is
procedure Set_28 (Arr : System.Address; N : Natural; E : Bits_28) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_28 is
procedure SetU_28 (Arr : System.Address; N : Natural; E : Bits_28) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack28.ads b/gcc/ada/s-pack28.ads
index 5a303079a9e..d4df26ac627 100644
--- a/gcc/ada/s-pack28.ads
+++ b/gcc/ada/s-pack28.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack29.adb b/gcc/ada/s-pack29.adb
index 8c686e65fed..42eda275b19 100644
--- a/gcc/ada/s-pack29.adb
+++ b/gcc/ada/s-pack29.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_29 is
function Get_29 (Arr : System.Address; N : Natural) return Bits_29 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_29 is
procedure Set_29 (Arr : System.Address; N : Natural; E : Bits_29) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack29.ads b/gcc/ada/s-pack29.ads
index 6c1ad90503f..403af534c2b 100644
--- a/gcc/ada/s-pack29.ads
+++ b/gcc/ada/s-pack29.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack30.adb b/gcc/ada/s-pack30.adb
index 6206122e592..2ab521233a5 100644
--- a/gcc/ada/s-pack30.adb
+++ b/gcc/ada/s-pack30.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_30 is
function Get_30 (Arr : System.Address; N : Natural) return Bits_30 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_30 is
function GetU_30 (Arr : System.Address; N : Natural) return Bits_30 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_30 is
procedure Set_30 (Arr : System.Address; N : Natural; E : Bits_30) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_30 is
procedure SetU_30 (Arr : System.Address; N : Natural; E : Bits_30) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack30.ads b/gcc/ada/s-pack30.ads
index c85fe7c78fb..43b624fe9e2 100644
--- a/gcc/ada/s-pack30.ads
+++ b/gcc/ada/s-pack30.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack31.adb b/gcc/ada/s-pack31.adb
index 71f07724a59..076d96e5f1c 100644
--- a/gcc/ada/s-pack31.adb
+++ b/gcc/ada/s-pack31.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_31 is
function Get_31 (Arr : System.Address; N : Natural) return Bits_31 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_31 is
procedure Set_31 (Arr : System.Address; N : Natural; E : Bits_31) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack31.ads b/gcc/ada/s-pack31.ads
index d23157bbfed..06c8832dfe3 100644
--- a/gcc/ada/s-pack31.ads
+++ b/gcc/ada/s-pack31.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack33.adb b/gcc/ada/s-pack33.adb
index f05fe6b43d1..ce0c0f8ddee 100644
--- a/gcc/ada/s-pack33.adb
+++ b/gcc/ada/s-pack33.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_33 is
function Get_33 (Arr : System.Address; N : Natural) return Bits_33 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_33 is
procedure Set_33 (Arr : System.Address; N : Natural; E : Bits_33) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack33.ads b/gcc/ada/s-pack33.ads
index 8b8d5c199e2..995341c043b 100644
--- a/gcc/ada/s-pack33.ads
+++ b/gcc/ada/s-pack33.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack34.adb b/gcc/ada/s-pack34.adb
index 2d08dbda277..351cad33d20 100644
--- a/gcc/ada/s-pack34.adb
+++ b/gcc/ada/s-pack34.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_34 is
function Get_34 (Arr : System.Address; N : Natural) return Bits_34 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_34 is
function GetU_34 (Arr : System.Address; N : Natural) return Bits_34 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_34 is
procedure Set_34 (Arr : System.Address; N : Natural; E : Bits_34) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_34 is
procedure SetU_34 (Arr : System.Address; N : Natural; E : Bits_34) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack34.ads b/gcc/ada/s-pack34.ads
index db7ffbb6d61..5a4ee7c664b 100644
--- a/gcc/ada/s-pack34.ads
+++ b/gcc/ada/s-pack34.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack35.adb b/gcc/ada/s-pack35.adb
index 2975949fe1f..f5128f9006f 100644
--- a/gcc/ada/s-pack35.adb
+++ b/gcc/ada/s-pack35.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_35 is
function Get_35 (Arr : System.Address; N : Natural) return Bits_35 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_35 is
procedure Set_35 (Arr : System.Address; N : Natural; E : Bits_35) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack35.ads b/gcc/ada/s-pack35.ads
index 1f07dde87ef..729aa95de7f 100644
--- a/gcc/ada/s-pack35.ads
+++ b/gcc/ada/s-pack35.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack36.adb b/gcc/ada/s-pack36.adb
index 447a0e2b9d0..c49b7527710 100644
--- a/gcc/ada/s-pack36.adb
+++ b/gcc/ada/s-pack36.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_36 is
function Get_36 (Arr : System.Address; N : Natural) return Bits_36 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_36 is
function GetU_36 (Arr : System.Address; N : Natural) return Bits_36 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_36 is
procedure Set_36 (Arr : System.Address; N : Natural; E : Bits_36) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_36 is
procedure SetU_36 (Arr : System.Address; N : Natural; E : Bits_36) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack36.ads b/gcc/ada/s-pack36.ads
index 509e65b9c84..619516022b4 100644
--- a/gcc/ada/s-pack36.ads
+++ b/gcc/ada/s-pack36.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack37.adb b/gcc/ada/s-pack37.adb
index e48fb1db23d..6a07d716b1c 100644
--- a/gcc/ada/s-pack37.adb
+++ b/gcc/ada/s-pack37.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_37 is
function Get_37 (Arr : System.Address; N : Natural) return Bits_37 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_37 is
procedure Set_37 (Arr : System.Address; N : Natural; E : Bits_37) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack37.ads b/gcc/ada/s-pack37.ads
index df2156d8c8b..57afa3a2b9a 100644
--- a/gcc/ada/s-pack37.ads
+++ b/gcc/ada/s-pack37.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack38.adb b/gcc/ada/s-pack38.adb
index 422de48ed83..d99670be6cf 100644
--- a/gcc/ada/s-pack38.adb
+++ b/gcc/ada/s-pack38.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_38 is
function Get_38 (Arr : System.Address; N : Natural) return Bits_38 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_38 is
function GetU_38 (Arr : System.Address; N : Natural) return Bits_38 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_38 is
procedure Set_38 (Arr : System.Address; N : Natural; E : Bits_38) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_38 is
procedure SetU_38 (Arr : System.Address; N : Natural; E : Bits_38) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack38.ads b/gcc/ada/s-pack38.ads
index a9d9a4953f2..12aeea0caa2 100644
--- a/gcc/ada/s-pack38.ads
+++ b/gcc/ada/s-pack38.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack39.adb b/gcc/ada/s-pack39.adb
index d2b75f9b1ad..fc4daf4e10d 100644
--- a/gcc/ada/s-pack39.adb
+++ b/gcc/ada/s-pack39.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_39 is
function Get_39 (Arr : System.Address; N : Natural) return Bits_39 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_39 is
procedure Set_39 (Arr : System.Address; N : Natural; E : Bits_39) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack39.ads b/gcc/ada/s-pack39.ads
index 4a2ff511c4d..fda38ee14d6 100644
--- a/gcc/ada/s-pack39.ads
+++ b/gcc/ada/s-pack39.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack40.adb b/gcc/ada/s-pack40.adb
index 3068334c9ea..46824abd145 100644
--- a/gcc/ada/s-pack40.adb
+++ b/gcc/ada/s-pack40.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_40 is
function Get_40 (Arr : System.Address; N : Natural) return Bits_40 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_40 is
function GetU_40 (Arr : System.Address; N : Natural) return Bits_40 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_40 is
procedure Set_40 (Arr : System.Address; N : Natural; E : Bits_40) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_40 is
procedure SetU_40 (Arr : System.Address; N : Natural; E : Bits_40) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack40.ads b/gcc/ada/s-pack40.ads
index ee7981c7ec5..21a1313af89 100644
--- a/gcc/ada/s-pack40.ads
+++ b/gcc/ada/s-pack40.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack41.adb b/gcc/ada/s-pack41.adb
index 26052805a62..b245633cf09 100644
--- a/gcc/ada/s-pack41.adb
+++ b/gcc/ada/s-pack41.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_41 is
function Get_41 (Arr : System.Address; N : Natural) return Bits_41 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_41 is
procedure Set_41 (Arr : System.Address; N : Natural; E : Bits_41) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack41.ads b/gcc/ada/s-pack41.ads
index 9a956f3f1d6..d4a5dc7b165 100644
--- a/gcc/ada/s-pack41.ads
+++ b/gcc/ada/s-pack41.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack42.adb b/gcc/ada/s-pack42.adb
index 939662ab2a4..3444ab33fea 100644
--- a/gcc/ada/s-pack42.adb
+++ b/gcc/ada/s-pack42.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_42 is
function Get_42 (Arr : System.Address; N : Natural) return Bits_42 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_42 is
function GetU_42 (Arr : System.Address; N : Natural) return Bits_42 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_42 is
procedure Set_42 (Arr : System.Address; N : Natural; E : Bits_42) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_42 is
procedure SetU_42 (Arr : System.Address; N : Natural; E : Bits_42) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack42.ads b/gcc/ada/s-pack42.ads
index 82ce7105076..36ef28b18ed 100644
--- a/gcc/ada/s-pack42.ads
+++ b/gcc/ada/s-pack42.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack43.adb b/gcc/ada/s-pack43.adb
index 5df98b62626..b9e5ca0eaaf 100644
--- a/gcc/ada/s-pack43.adb
+++ b/gcc/ada/s-pack43.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_43 is
function Get_43 (Arr : System.Address; N : Natural) return Bits_43 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_43 is
procedure Set_43 (Arr : System.Address; N : Natural; E : Bits_43) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack43.ads b/gcc/ada/s-pack43.ads
index 74d4fada4ae..844c9d2bd7a 100644
--- a/gcc/ada/s-pack43.ads
+++ b/gcc/ada/s-pack43.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack44.adb b/gcc/ada/s-pack44.adb
index 8eb16d7802e..b3f2f7561a6 100644
--- a/gcc/ada/s-pack44.adb
+++ b/gcc/ada/s-pack44.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_44 is
function Get_44 (Arr : System.Address; N : Natural) return Bits_44 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_44 is
function GetU_44 (Arr : System.Address; N : Natural) return Bits_44 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_44 is
procedure Set_44 (Arr : System.Address; N : Natural; E : Bits_44) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_44 is
procedure SetU_44 (Arr : System.Address; N : Natural; E : Bits_44) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack44.ads b/gcc/ada/s-pack44.ads
index fa6863f82e4..a09c2d36453 100644
--- a/gcc/ada/s-pack44.ads
+++ b/gcc/ada/s-pack44.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack45.adb b/gcc/ada/s-pack45.adb
index 32079b3b933..7f3426f5673 100644
--- a/gcc/ada/s-pack45.adb
+++ b/gcc/ada/s-pack45.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_45 is
function Get_45 (Arr : System.Address; N : Natural) return Bits_45 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_45 is
procedure Set_45 (Arr : System.Address; N : Natural; E : Bits_45) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack45.ads b/gcc/ada/s-pack45.ads
index 78ebaa1924e..bdd8338b35e 100644
--- a/gcc/ada/s-pack45.ads
+++ b/gcc/ada/s-pack45.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack46.adb b/gcc/ada/s-pack46.adb
index a17c078d110..efb039472c3 100644
--- a/gcc/ada/s-pack46.adb
+++ b/gcc/ada/s-pack46.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_46 is
function Get_46 (Arr : System.Address; N : Natural) return Bits_46 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_46 is
function GetU_46 (Arr : System.Address; N : Natural) return Bits_46 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_46 is
procedure Set_46 (Arr : System.Address; N : Natural; E : Bits_46) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_46 is
procedure SetU_46 (Arr : System.Address; N : Natural; E : Bits_46) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack46.ads b/gcc/ada/s-pack46.ads
index 09256709dad..5ec4132c965 100644
--- a/gcc/ada/s-pack46.ads
+++ b/gcc/ada/s-pack46.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack47.adb b/gcc/ada/s-pack47.adb
index cd49c39023f..ef73a106638 100644
--- a/gcc/ada/s-pack47.adb
+++ b/gcc/ada/s-pack47.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_47 is
function Get_47 (Arr : System.Address; N : Natural) return Bits_47 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_47 is
procedure Set_47 (Arr : System.Address; N : Natural; E : Bits_47) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack47.ads b/gcc/ada/s-pack47.ads
index 4ca1ba3e96c..e444ee08c26 100644
--- a/gcc/ada/s-pack47.ads
+++ b/gcc/ada/s-pack47.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack48.adb b/gcc/ada/s-pack48.adb
index 91751617c8a..5839bc92c5c 100644
--- a/gcc/ada/s-pack48.adb
+++ b/gcc/ada/s-pack48.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_48 is
function Get_48 (Arr : System.Address; N : Natural) return Bits_48 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_48 is
function GetU_48 (Arr : System.Address; N : Natural) return Bits_48 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_48 is
procedure Set_48 (Arr : System.Address; N : Natural; E : Bits_48) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_48 is
procedure SetU_48 (Arr : System.Address; N : Natural; E : Bits_48) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack48.ads b/gcc/ada/s-pack48.ads
index 0004f9275c9..e832e3607cc 100644
--- a/gcc/ada/s-pack48.ads
+++ b/gcc/ada/s-pack48.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack49.adb b/gcc/ada/s-pack49.adb
index 7e39703ce8d..a34380dc70e 100644
--- a/gcc/ada/s-pack49.adb
+++ b/gcc/ada/s-pack49.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_49 is
function Get_49 (Arr : System.Address; N : Natural) return Bits_49 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_49 is
procedure Set_49 (Arr : System.Address; N : Natural; E : Bits_49) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack49.ads b/gcc/ada/s-pack49.ads
index f60042b28ab..9b448129a90 100644
--- a/gcc/ada/s-pack49.ads
+++ b/gcc/ada/s-pack49.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack50.adb b/gcc/ada/s-pack50.adb
index 4ff69b20bc9..cb70a01dbe1 100644
--- a/gcc/ada/s-pack50.adb
+++ b/gcc/ada/s-pack50.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_50 is
function Get_50 (Arr : System.Address; N : Natural) return Bits_50 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_50 is
function GetU_50 (Arr : System.Address; N : Natural) return Bits_50 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_50 is
procedure Set_50 (Arr : System.Address; N : Natural; E : Bits_50) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_50 is
procedure SetU_50 (Arr : System.Address; N : Natural; E : Bits_50) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack50.ads b/gcc/ada/s-pack50.ads
index 0ac3532406c..cb639f9eb28 100644
--- a/gcc/ada/s-pack50.ads
+++ b/gcc/ada/s-pack50.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack51.adb b/gcc/ada/s-pack51.adb
index 5c5f926169b..9d71ba01539 100644
--- a/gcc/ada/s-pack51.adb
+++ b/gcc/ada/s-pack51.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_51 is
function Get_51 (Arr : System.Address; N : Natural) return Bits_51 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_51 is
procedure Set_51 (Arr : System.Address; N : Natural; E : Bits_51) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack51.ads b/gcc/ada/s-pack51.ads
index b5a479eb013..11e107f4fc0 100644
--- a/gcc/ada/s-pack51.ads
+++ b/gcc/ada/s-pack51.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack52.adb b/gcc/ada/s-pack52.adb
index 86765bd1bc5..88c21ff8feb 100644
--- a/gcc/ada/s-pack52.adb
+++ b/gcc/ada/s-pack52.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_52 is
function Get_52 (Arr : System.Address; N : Natural) return Bits_52 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_52 is
function GetU_52 (Arr : System.Address; N : Natural) return Bits_52 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_52 is
procedure Set_52 (Arr : System.Address; N : Natural; E : Bits_52) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_52 is
procedure SetU_52 (Arr : System.Address; N : Natural; E : Bits_52) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack52.ads b/gcc/ada/s-pack52.ads
index 0bb2dfc5a3b..5b19da30d77 100644
--- a/gcc/ada/s-pack52.ads
+++ b/gcc/ada/s-pack52.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack53.adb b/gcc/ada/s-pack53.adb
index 76a63ce752c..72cf0ea414a 100644
--- a/gcc/ada/s-pack53.adb
+++ b/gcc/ada/s-pack53.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_53 is
function Get_53 (Arr : System.Address; N : Natural) return Bits_53 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_53 is
procedure Set_53 (Arr : System.Address; N : Natural; E : Bits_53) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack53.ads b/gcc/ada/s-pack53.ads
index eaf4fcc6551..cc46a810893 100644
--- a/gcc/ada/s-pack53.ads
+++ b/gcc/ada/s-pack53.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack54.adb b/gcc/ada/s-pack54.adb
index 53a56a4595f..64be7270f7f 100644
--- a/gcc/ada/s-pack54.adb
+++ b/gcc/ada/s-pack54.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_54 is
function Get_54 (Arr : System.Address; N : Natural) return Bits_54 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_54 is
function GetU_54 (Arr : System.Address; N : Natural) return Bits_54 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_54 is
procedure Set_54 (Arr : System.Address; N : Natural; E : Bits_54) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_54 is
procedure SetU_54 (Arr : System.Address; N : Natural; E : Bits_54) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack54.ads b/gcc/ada/s-pack54.ads
index efecf497138..1bddbd596c9 100644
--- a/gcc/ada/s-pack54.ads
+++ b/gcc/ada/s-pack54.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack55.adb b/gcc/ada/s-pack55.adb
index e5b712b6058..c36bbc82490 100644
--- a/gcc/ada/s-pack55.adb
+++ b/gcc/ada/s-pack55.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_55 is
function Get_55 (Arr : System.Address; N : Natural) return Bits_55 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_55 is
procedure Set_55 (Arr : System.Address; N : Natural; E : Bits_55) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack55.ads b/gcc/ada/s-pack55.ads
index 61c8709f981..5727ef9b112 100644
--- a/gcc/ada/s-pack55.ads
+++ b/gcc/ada/s-pack55.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack56.adb b/gcc/ada/s-pack56.adb
index 4998fad86c4..dbeb6cf5a8e 100644
--- a/gcc/ada/s-pack56.adb
+++ b/gcc/ada/s-pack56.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_56 is
function Get_56 (Arr : System.Address; N : Natural) return Bits_56 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_56 is
function GetU_56 (Arr : System.Address; N : Natural) return Bits_56 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_56 is
procedure Set_56 (Arr : System.Address; N : Natural; E : Bits_56) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_56 is
procedure SetU_56 (Arr : System.Address; N : Natural; E : Bits_56) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack56.ads b/gcc/ada/s-pack56.ads
index d0d3c792aa3..1db23e854fb 100644
--- a/gcc/ada/s-pack56.ads
+++ b/gcc/ada/s-pack56.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack57.adb b/gcc/ada/s-pack57.adb
index 2da80cdadaf..190c6092eda 100644
--- a/gcc/ada/s-pack57.adb
+++ b/gcc/ada/s-pack57.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_57 is
function Get_57 (Arr : System.Address; N : Natural) return Bits_57 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_57 is
procedure Set_57 (Arr : System.Address; N : Natural; E : Bits_57) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack57.ads b/gcc/ada/s-pack57.ads
index 2781b4aa439..be6f9d2a2b4 100644
--- a/gcc/ada/s-pack57.ads
+++ b/gcc/ada/s-pack57.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack58.adb b/gcc/ada/s-pack58.adb
index 387dcfca04a..710f1bc6cc4 100644
--- a/gcc/ada/s-pack58.adb
+++ b/gcc/ada/s-pack58.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_58 is
function Get_58 (Arr : System.Address; N : Natural) return Bits_58 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_58 is
function GetU_58 (Arr : System.Address; N : Natural) return Bits_58 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_58 is
procedure Set_58 (Arr : System.Address; N : Natural; E : Bits_58) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_58 is
procedure SetU_58 (Arr : System.Address; N : Natural; E : Bits_58) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack58.ads b/gcc/ada/s-pack58.ads
index a88434556a6..5a18c5a462e 100644
--- a/gcc/ada/s-pack58.ads
+++ b/gcc/ada/s-pack58.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack59.adb b/gcc/ada/s-pack59.adb
index 7f79d19fd1c..fed0bb2e8db 100644
--- a/gcc/ada/s-pack59.adb
+++ b/gcc/ada/s-pack59.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_59 is
function Get_59 (Arr : System.Address; N : Natural) return Bits_59 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_59 is
procedure Set_59 (Arr : System.Address; N : Natural; E : Bits_59) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack59.ads b/gcc/ada/s-pack59.ads
index 492b9ce6395..e527306109b 100644
--- a/gcc/ada/s-pack59.ads
+++ b/gcc/ada/s-pack59.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack60.adb b/gcc/ada/s-pack60.adb
index 630e84b1121..8c91ec16ffc 100644
--- a/gcc/ada/s-pack60.adb
+++ b/gcc/ada/s-pack60.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_60 is
function Get_60 (Arr : System.Address; N : Natural) return Bits_60 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_60 is
function GetU_60 (Arr : System.Address; N : Natural) return Bits_60 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_60 is
procedure Set_60 (Arr : System.Address; N : Natural; E : Bits_60) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_60 is
procedure SetU_60 (Arr : System.Address; N : Natural; E : Bits_60) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack60.ads b/gcc/ada/s-pack60.ads
index fd6f7d05591..121c29acd58 100644
--- a/gcc/ada/s-pack60.ads
+++ b/gcc/ada/s-pack60.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack61.adb b/gcc/ada/s-pack61.adb
index 58f33284af2..cdc4b7114c6 100644
--- a/gcc/ada/s-pack61.adb
+++ b/gcc/ada/s-pack61.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_61 is
function Get_61 (Arr : System.Address; N : Natural) return Bits_61 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_61 is
procedure Set_61 (Arr : System.Address; N : Natural; E : Bits_61) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack61.ads b/gcc/ada/s-pack61.ads
index e745c5e6fe4..0209e75b227 100644
--- a/gcc/ada/s-pack61.ads
+++ b/gcc/ada/s-pack61.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack62.adb b/gcc/ada/s-pack62.adb
index da4ebad84f6..da442169ab2 100644
--- a/gcc/ada/s-pack62.adb
+++ b/gcc/ada/s-pack62.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -92,7 +92,6 @@ package body System.Pack_62 is
function Get_62 (Arr : System.Address; N : Natural) return Bits_62 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -112,7 +111,6 @@ package body System.Pack_62 is
function GetU_62 (Arr : System.Address; N : Natural) return Bits_62 is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -132,7 +130,6 @@ package body System.Pack_62 is
procedure Set_62 (Arr : System.Address; N : Natural; E : Bits_62) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
@@ -152,7 +149,6 @@ package body System.Pack_62 is
procedure SetU_62 (Arr : System.Address; N : Natural; E : Bits_62) is
C : constant ClusterU_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack62.ads b/gcc/ada/s-pack62.ads
index a7642b5ca27..969880d0d0d 100644
--- a/gcc/ada/s-pack62.ads
+++ b/gcc/ada/s-pack62.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-pack63.adb b/gcc/ada/s-pack63.adb
index 8ebf4f564aa..d36c30e2d5a 100644
--- a/gcc/ada/s-pack63.adb
+++ b/gcc/ada/s-pack63.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,6 @@ package body System.Pack_63 is
function Get_63 (Arr : System.Address; N : Natural) return Bits_63 is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => return C.E0;
@@ -99,7 +98,6 @@ package body System.Pack_63 is
procedure Set_63 (Arr : System.Address; N : Natural; E : Bits_63) is
C : constant Cluster_Ref := To_Ref (Arr + Bits * Ofs (Uns (N) / 8));
-
begin
case N07 (Uns (N) mod 8) is
when 0 => C.E0 := E;
diff --git a/gcc/ada/s-pack63.ads b/gcc/ada/s-pack63.ads
index 08f84f542fd..cb4038242e5 100644
--- a/gcc/ada/s-pack63.ads
+++ b/gcc/ada/s-pack63.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-parame-mingw.adb b/gcc/ada/s-parame-mingw.adb
index e73911cf8b1..d6bc023afbf 100644
--- a/gcc/ada/s-parame-mingw.adb
+++ b/gcc/ada/s-parame-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-parint.adb b/gcc/ada/s-parint.adb
index b7a676e8dde..6091f3d1db6 100644
--- a/gcc/ada/s-parint.adb
+++ b/gcc/ada/s-parint.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- (Dummy body for non-distributed case) --
-- --
--- Copyright (C) 1995-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -40,7 +40,7 @@ package body System.Partition_Interface is
type String_Access is access String;
- -- To have a minimal implementation of U'Partition_ID.
+ -- To have a minimal implementation of U'Partition_ID
type Pkg_Node;
type Pkg_List is access Pkg_Node;
diff --git a/gcc/ada/s-parint.ads b/gcc/ada/s-parint.ads
index 40396d22112..4eeb67109a2 100644
--- a/gcc/ada/s-parint.ads
+++ b/gcc/ada/s-parint.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1995-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2005, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-purexc.ads b/gcc/ada/s-purexc.ads
index c9edb603353..4600f4a07db 100644
--- a/gcc/ada/s-purexc.ads
+++ b/gcc/ada/s-purexc.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2000-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-restri.adb b/gcc/ada/s-restri.adb
index 81d16d07c15..d7b95256873 100644
--- a/gcc/ada/s-restri.adb
+++ b/gcc/ada/s-restri.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-restri.ads b/gcc/ada/s-restri.ads
index 1d2734ce340..0c9a4e79fee 100644
--- a/gcc/ada/s-restri.ads
+++ b/gcc/ada/s-restri.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-scaval.adb b/gcc/ada/s-scaval.adb
index 61f2fca6c2f..71b5c6017a5 100644
--- a/gcc/ada/s-scaval.adb
+++ b/gcc/ada/s-scaval.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-scaval.ads b/gcc/ada/s-scaval.ads
index 9e7962c433a..b39bd82a1ea 100644
--- a/gcc/ada/s-scaval.ads
+++ b/gcc/ada/s-scaval.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-secsta.adb b/gcc/ada/s-secsta.adb
index 97dd744f3c1..3c6485cbf6f 100644
--- a/gcc/ada/s-secsta.adb
+++ b/gcc/ada/s-secsta.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-secsta.ads b/gcc/ada/s-secsta.ads
index 22e0b4831d0..ad4a98decf2 100644
--- a/gcc/ada/s-secsta.ads
+++ b/gcc/ada/s-secsta.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-sequio.adb b/gcc/ada/s-sequio.adb
index 2e5a29b24f2..4ab259f6fbe 100644
--- a/gcc/ada/s-sequio.adb
+++ b/gcc/ada/s-sequio.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-sequio.ads b/gcc/ada/s-sequio.ads
index fcd8233b527..3ad99820ca9 100644
--- a/gcc/ada/s-sequio.ads
+++ b/gcc/ada/s-sequio.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-stoele.adb b/gcc/ada/s-stoele.adb
index 59eaf0b8215..4d4f9594e76 100644
--- a/gcc/ada/s-stoele.adb
+++ b/gcc/ada/s-stoele.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -61,15 +61,17 @@ package body System.Storage_Elements is
return To_Offset (To_Address (To_Integer (Left) - To_Integer (Right)));
end "-";
- function "mod" (Left : Address; Right : Storage_Offset)
- return Storage_Offset is
+ function "mod"
+ (Left : Address;
+ Right : Storage_Offset) return Storage_Offset
+ is
begin
if Right >= 0 then
return Storage_Offset
(To_Integer (Left) mod Integer_Address (Right));
else
return -Storage_Offset
- (To_Integer (Left) mod Integer_Address (-Right));
+ ((-To_Integer (Left)) mod Integer_Address (-Right));
end if;
end "mod";
diff --git a/gcc/ada/s-stratt.adb b/gcc/ada/s-stratt.adb
index 5cf84c4a3ac..810a1046ffa 100644
--- a/gcc/ada/s-stratt.adb
+++ b/gcc/ada/s-stratt.adb
@@ -119,7 +119,7 @@ package body System.Stream_Attributes is
-- I_AD --
----------
- function I_AD (Stream : access RST) return Fat_Pointer is
+ function I_AD (Stream : not null access RST) return Fat_Pointer is
T : S_AD;
L : SEO;
@@ -137,7 +137,7 @@ package body System.Stream_Attributes is
-- I_AS --
----------
- function I_AS (Stream : access RST) return Thin_Pointer is
+ function I_AS (Stream : not null access RST) return Thin_Pointer is
T : S_AS;
L : SEO;
@@ -155,7 +155,7 @@ package body System.Stream_Attributes is
-- I_B --
---------
- function I_B (Stream : access RST) return Boolean is
+ function I_B (Stream : not null access RST) return Boolean is
T : S_B;
L : SEO;
@@ -173,7 +173,7 @@ package body System.Stream_Attributes is
-- I_C --
---------
- function I_C (Stream : access RST) return Character is
+ function I_C (Stream : not null access RST) return Character is
T : S_C;
L : SEO;
@@ -191,7 +191,7 @@ package body System.Stream_Attributes is
-- I_F --
---------
- function I_F (Stream : access RST) return Float is
+ function I_F (Stream : not null access RST) return Float is
T : S_F;
L : SEO;
@@ -209,7 +209,7 @@ package body System.Stream_Attributes is
-- I_I --
---------
- function I_I (Stream : access RST) return Integer is
+ function I_I (Stream : not null access RST) return Integer is
T : S_I;
L : SEO;
@@ -227,7 +227,7 @@ package body System.Stream_Attributes is
-- I_LF --
----------
- function I_LF (Stream : access RST) return Long_Float is
+ function I_LF (Stream : not null access RST) return Long_Float is
T : S_LF;
L : SEO;
@@ -245,7 +245,7 @@ package body System.Stream_Attributes is
-- I_LI --
----------
- function I_LI (Stream : access RST) return Long_Integer is
+ function I_LI (Stream : not null access RST) return Long_Integer is
T : S_LI;
L : SEO;
@@ -263,7 +263,7 @@ package body System.Stream_Attributes is
-- I_LLF --
-----------
- function I_LLF (Stream : access RST) return Long_Long_Float is
+ function I_LLF (Stream : not null access RST) return Long_Long_Float is
T : S_LLF;
L : SEO;
@@ -281,7 +281,7 @@ package body System.Stream_Attributes is
-- I_LLI --
-----------
- function I_LLI (Stream : access RST) return Long_Long_Integer is
+ function I_LLI (Stream : not null access RST) return Long_Long_Integer is
T : S_LLI;
L : SEO;
@@ -299,7 +299,9 @@ package body System.Stream_Attributes is
-- I_LLU --
-----------
- function I_LLU (Stream : access RST) return UST.Long_Long_Unsigned is
+ function I_LLU
+ (Stream : not null access RST) return UST.Long_Long_Unsigned
+ is
T : S_LLU;
L : SEO;
@@ -317,7 +319,7 @@ package body System.Stream_Attributes is
-- I_LU --
----------
- function I_LU (Stream : access RST) return UST.Long_Unsigned is
+ function I_LU (Stream : not null access RST) return UST.Long_Unsigned is
T : S_LU;
L : SEO;
@@ -335,7 +337,7 @@ package body System.Stream_Attributes is
-- I_SF --
----------
- function I_SF (Stream : access RST) return Short_Float is
+ function I_SF (Stream : not null access RST) return Short_Float is
T : S_SF;
L : SEO;
@@ -353,7 +355,7 @@ package body System.Stream_Attributes is
-- I_SI --
----------
- function I_SI (Stream : access RST) return Short_Integer is
+ function I_SI (Stream : not null access RST) return Short_Integer is
T : S_SI;
L : SEO;
@@ -371,7 +373,7 @@ package body System.Stream_Attributes is
-- I_SSI --
-----------
- function I_SSI (Stream : access RST) return Short_Short_Integer is
+ function I_SSI (Stream : not null access RST) return Short_Short_Integer is
T : S_SSI;
L : SEO;
@@ -389,7 +391,9 @@ package body System.Stream_Attributes is
-- I_SSU --
-----------
- function I_SSU (Stream : access RST) return UST.Short_Short_Unsigned is
+ function I_SSU
+ (Stream : not null access RST) return UST.Short_Short_Unsigned
+ is
T : S_SSU;
L : SEO;
@@ -407,7 +411,7 @@ package body System.Stream_Attributes is
-- I_SU --
----------
- function I_SU (Stream : access RST) return UST.Short_Unsigned is
+ function I_SU (Stream : not null access RST) return UST.Short_Unsigned is
T : S_SU;
L : SEO;
@@ -425,7 +429,7 @@ package body System.Stream_Attributes is
-- I_U --
---------
- function I_U (Stream : access RST) return UST.Unsigned is
+ function I_U (Stream : not null access RST) return UST.Unsigned is
T : S_U;
L : SEO;
@@ -443,7 +447,7 @@ package body System.Stream_Attributes is
-- I_WC --
----------
- function I_WC (Stream : access RST) return Wide_Character is
+ function I_WC (Stream : not null access RST) return Wide_Character is
T : S_WC;
L : SEO;
@@ -461,7 +465,7 @@ package body System.Stream_Attributes is
-- W_AD --
----------
- procedure W_AD (Stream : access RST; Item : in Fat_Pointer) is
+ procedure W_AD (Stream : not null access RST; Item : in Fat_Pointer) is
T : constant S_AD := From_AD (Item);
begin
@@ -472,7 +476,7 @@ package body System.Stream_Attributes is
-- W_AS --
----------
- procedure W_AS (Stream : access RST; Item : in Thin_Pointer) is
+ procedure W_AS (Stream : not null access RST; Item : in Thin_Pointer) is
T : constant S_AS := From_AS (Item);
begin
@@ -483,7 +487,7 @@ package body System.Stream_Attributes is
-- W_B --
---------
- procedure W_B (Stream : access RST; Item : in Boolean) is
+ procedure W_B (Stream : not null access RST; Item : in Boolean) is
T : S_B;
begin
@@ -495,7 +499,7 @@ package body System.Stream_Attributes is
-- W_C --
---------
- procedure W_C (Stream : access RST; Item : in Character) is
+ procedure W_C (Stream : not null access RST; Item : in Character) is
T : S_C;
begin
@@ -507,7 +511,7 @@ package body System.Stream_Attributes is
-- W_F --
---------
- procedure W_F (Stream : access RST; Item : in Float) is
+ procedure W_F (Stream : not null access RST; Item : in Float) is
T : constant S_F := From_F (Item);
begin
@@ -518,7 +522,7 @@ package body System.Stream_Attributes is
-- W_I --
---------
- procedure W_I (Stream : access RST; Item : in Integer) is
+ procedure W_I (Stream : not null access RST; Item : in Integer) is
T : constant S_I := From_I (Item);
begin
@@ -529,7 +533,7 @@ package body System.Stream_Attributes is
-- W_LF --
----------
- procedure W_LF (Stream : access RST; Item : in Long_Float) is
+ procedure W_LF (Stream : not null access RST; Item : in Long_Float) is
T : constant S_LF := From_LF (Item);
begin
@@ -540,7 +544,7 @@ package body System.Stream_Attributes is
-- W_LI --
----------
- procedure W_LI (Stream : access RST; Item : in Long_Integer) is
+ procedure W_LI (Stream : not null access RST; Item : in Long_Integer) is
T : constant S_LI := From_LI (Item);
begin
@@ -551,7 +555,7 @@ package body System.Stream_Attributes is
-- W_LLF --
-----------
- procedure W_LLF (Stream : access RST; Item : in Long_Long_Float) is
+ procedure W_LLF (Stream : not null access RST; Item : in Long_Long_Float) is
T : constant S_LLF := From_LLF (Item);
begin
@@ -562,7 +566,9 @@ package body System.Stream_Attributes is
-- W_LLI --
-----------
- procedure W_LLI (Stream : access RST; Item : in Long_Long_Integer) is
+ procedure W_LLI
+ (Stream : not null access RST; Item : in Long_Long_Integer)
+ is
T : constant S_LLI := From_LLI (Item);
begin
@@ -573,7 +579,9 @@ package body System.Stream_Attributes is
-- W_LLU --
-----------
- procedure W_LLU (Stream : access RST; Item : in UST.Long_Long_Unsigned) is
+ procedure W_LLU
+ (Stream : not null access RST; Item : in UST.Long_Long_Unsigned)
+ is
T : constant S_LLU := From_LLU (Item);
begin
@@ -584,7 +592,9 @@ package body System.Stream_Attributes is
-- W_LU --
----------
- procedure W_LU (Stream : access RST; Item : in UST.Long_Unsigned) is
+ procedure W_LU
+ (Stream : not null access RST; Item : in UST.Long_Unsigned)
+ is
T : constant S_LU := From_LU (Item);
begin
@@ -595,7 +605,7 @@ package body System.Stream_Attributes is
-- W_SF --
----------
- procedure W_SF (Stream : access RST; Item : in Short_Float) is
+ procedure W_SF (Stream : not null access RST; Item : in Short_Float) is
T : constant S_SF := From_SF (Item);
begin
@@ -606,7 +616,7 @@ package body System.Stream_Attributes is
-- W_SI --
----------
- procedure W_SI (Stream : access RST; Item : in Short_Integer) is
+ procedure W_SI (Stream : not null access RST; Item : in Short_Integer) is
T : constant S_SI := From_SI (Item);
begin
@@ -617,7 +627,9 @@ package body System.Stream_Attributes is
-- W_SSI --
-----------
- procedure W_SSI (Stream : access RST; Item : in Short_Short_Integer) is
+ procedure W_SSI
+ (Stream : not null access RST; Item : in Short_Short_Integer)
+ is
T : constant S_SSI := From_SSI (Item);
begin
@@ -628,7 +640,9 @@ package body System.Stream_Attributes is
-- W_SSU --
-----------
- procedure W_SSU (Stream : access RST; Item : in UST.Short_Short_Unsigned) is
+ procedure W_SSU
+ (Stream : not null access RST; Item : in UST.Short_Short_Unsigned)
+ is
T : constant S_SSU := From_SSU (Item);
begin
@@ -639,7 +653,9 @@ package body System.Stream_Attributes is
-- W_SU --
----------
- procedure W_SU (Stream : access RST; Item : in UST.Short_Unsigned) is
+ procedure W_SU
+ (Stream : not null access RST; Item : in UST.Short_Unsigned)
+ is
T : constant S_SU := From_SU (Item);
begin
@@ -650,7 +666,7 @@ package body System.Stream_Attributes is
-- W_U --
---------
- procedure W_U (Stream : access RST; Item : in UST.Unsigned) is
+ procedure W_U (Stream : not null access RST; Item : in UST.Unsigned) is
T : constant S_U := From_U (Item);
begin
@@ -661,7 +677,7 @@ package body System.Stream_Attributes is
-- W_WC --
----------
- procedure W_WC (Stream : access RST; Item : in Wide_Character) is
+ procedure W_WC (Stream : not null access RST; Item : in Wide_Character) is
T : constant S_WC := From_WC (Item);
begin
diff --git a/gcc/ada/s-stratt.ads b/gcc/ada/s-stratt.ads
index c4d0a32d062..eefebd4f243 100644
--- a/gcc/ada/s-stratt.ads
+++ b/gcc/ada/s-stratt.ads
@@ -101,25 +101,26 @@ package System.Stream_Attributes is
-- is the same for all elementary types (no bounds or discriminants
-- are involved).
- function I_AD (Stream : access RST) return Fat_Pointer;
- function I_AS (Stream : access RST) return Thin_Pointer;
- function I_B (Stream : access RST) return Boolean;
- function I_C (Stream : access RST) return Character;
- function I_F (Stream : access RST) return Float;
- function I_I (Stream : access RST) return Integer;
- function I_LF (Stream : access RST) return Long_Float;
- function I_LI (Stream : access RST) return Long_Integer;
- function I_LLF (Stream : access RST) return Long_Long_Float;
- function I_LLI (Stream : access RST) return Long_Long_Integer;
- function I_LLU (Stream : access RST) return UST.Long_Long_Unsigned;
- function I_LU (Stream : access RST) return UST.Long_Unsigned;
- function I_SF (Stream : access RST) return Short_Float;
- function I_SI (Stream : access RST) return Short_Integer;
- function I_SSI (Stream : access RST) return Short_Short_Integer;
- function I_SSU (Stream : access RST) return UST.Short_Short_Unsigned;
- function I_SU (Stream : access RST) return UST.Short_Unsigned;
- function I_U (Stream : access RST) return UST.Unsigned;
- function I_WC (Stream : access RST) return Wide_Character;
+ function I_AD (Stream : not null access RST) return Fat_Pointer;
+ function I_AS (Stream : not null access RST) return Thin_Pointer;
+ function I_B (Stream : not null access RST) return Boolean;
+ function I_C (Stream : not null access RST) return Character;
+ function I_F (Stream : not null access RST) return Float;
+ function I_I (Stream : not null access RST) return Integer;
+ function I_LF (Stream : not null access RST) return Long_Float;
+ function I_LI (Stream : not null access RST) return Long_Integer;
+ function I_LLF (Stream : not null access RST) return Long_Long_Float;
+ function I_LLI (Stream : not null access RST) return Long_Long_Integer;
+ function I_LLU (Stream : not null access RST) return UST.Long_Long_Unsigned;
+ function I_LU (Stream : not null access RST) return UST.Long_Unsigned;
+ function I_SF (Stream : not null access RST) return Short_Float;
+ function I_SI (Stream : not null access RST) return Short_Integer;
+ function I_SSI (Stream : not null access RST) return Short_Short_Integer;
+ function I_SSU (Stream : not null access RST)
+ return UST.Short_Short_Unsigned;
+ function I_SU (Stream : not null access RST) return UST.Short_Unsigned;
+ function I_U (Stream : not null access RST) return UST.Unsigned;
+ function I_WC (Stream : not null access RST) return Wide_Character;
-----------------------
-- Output Procedures --
@@ -130,25 +131,29 @@ package System.Stream_Attributes is
-- between 'Write and 'Output because there are no discriminants
-- or bounds to be written.
- procedure W_AD (Stream : access RST; Item : in Fat_Pointer);
- procedure W_AS (Stream : access RST; Item : in Thin_Pointer);
- procedure W_B (Stream : access RST; Item : in Boolean);
- procedure W_C (Stream : access RST; Item : in Character);
- procedure W_F (Stream : access RST; Item : in Float);
- procedure W_I (Stream : access RST; Item : in Integer);
- procedure W_LF (Stream : access RST; Item : in Long_Float);
- procedure W_LI (Stream : access RST; Item : in Long_Integer);
- procedure W_LLF (Stream : access RST; Item : in Long_Long_Float);
- procedure W_LLI (Stream : access RST; Item : in Long_Long_Integer);
- procedure W_LLU (Stream : access RST; Item : in UST.Long_Long_Unsigned);
- procedure W_LU (Stream : access RST; Item : in UST.Long_Unsigned);
- procedure W_SF (Stream : access RST; Item : in Short_Float);
- procedure W_SI (Stream : access RST; Item : in Short_Integer);
- procedure W_SSI (Stream : access RST; Item : in Short_Short_Integer);
- procedure W_SSU (Stream : access RST; Item : in UST.Short_Short_Unsigned);
- procedure W_SU (Stream : access RST; Item : in UST.Short_Unsigned);
- procedure W_U (Stream : access RST; Item : in UST.Unsigned);
- procedure W_WC (Stream : access RST; Item : in Wide_Character);
+ procedure W_AD (Stream : not null access RST; Item : in Fat_Pointer);
+ procedure W_AS (Stream : not null access RST; Item : in Thin_Pointer);
+ procedure W_B (Stream : not null access RST; Item : in Boolean);
+ procedure W_C (Stream : not null access RST; Item : in Character);
+ procedure W_F (Stream : not null access RST; Item : in Float);
+ procedure W_I (Stream : not null access RST; Item : in Integer);
+ procedure W_LF (Stream : not null access RST; Item : in Long_Float);
+ procedure W_LI (Stream : not null access RST; Item : in Long_Integer);
+ procedure W_LLF (Stream : not null access RST; Item : in Long_Long_Float);
+ procedure W_LLI (Stream : not null access RST; Item : in Long_Long_Integer);
+ procedure W_LLU (Stream : not null access RST;
+ Item : in UST.Long_Long_Unsigned);
+ procedure W_LU (Stream : not null access RST; Item : in UST.Long_Unsigned);
+ procedure W_SF (Stream : not null access RST; Item : in Short_Float);
+ procedure W_SI (Stream : not null access RST; Item : in Short_Integer);
+ procedure W_SSI (Stream : not null access RST;
+ Item : in Short_Short_Integer);
+ procedure W_SSU (Stream : not null access RST;
+ Item : in UST.Short_Short_Unsigned);
+ procedure W_SU (Stream : not null access RST;
+ Item : in UST.Short_Unsigned);
+ procedure W_U (Stream : not null access RST; Item : in UST.Unsigned);
+ procedure W_WC (Stream : not null access RST; Item : in Wide_Character);
----------------------------
-- Composite Input/Output --
diff --git a/gcc/ada/s-strxdr.adb b/gcc/ada/s-strxdr.adb
index af8c4c66b57..63aa286e8a3 100644
--- a/gcc/ada/s-strxdr.adb
+++ b/gcc/ada/s-strxdr.adb
@@ -279,7 +279,7 @@ package body System.Stream_Attributes is
-- I_AD --
----------
- function I_AD (Stream : access RST) return Fat_Pointer is
+ function I_AD (Stream : not null access RST) return Fat_Pointer is
FP : Fat_Pointer;
begin
@@ -293,7 +293,7 @@ package body System.Stream_Attributes is
-- I_AS --
----------
- function I_AS (Stream : access RST) return Thin_Pointer is
+ function I_AS (Stream : not null access RST) return Thin_Pointer is
S : XDR_S_TM;
L : SEO;
U : XDR_TM := 0;
@@ -316,7 +316,7 @@ package body System.Stream_Attributes is
-- I_B --
---------
- function I_B (Stream : access RST) return Boolean is
+ function I_B (Stream : not null access RST) return Boolean is
begin
case I_SSU (Stream) is
when 0 => return False;
@@ -329,7 +329,7 @@ package body System.Stream_Attributes is
-- I_C --
---------
- function I_C (Stream : access RST) return Character is
+ function I_C (Stream : not null access RST) return Character is
S : XDR_S_C;
L : SEO;
@@ -350,7 +350,7 @@ package body System.Stream_Attributes is
-- I_F --
---------
- function I_F (Stream : access RST) return Float is
+ function I_F (Stream : not null access RST) return Float is
I : constant Precision := Single;
E_Size : Integer renames Fields (I).E_Size;
E_Bias : Integer renames Fields (I).E_Bias;
@@ -431,7 +431,7 @@ package body System.Stream_Attributes is
-- I_I --
---------
- function I_I (Stream : access RST) return Integer is
+ function I_I (Stream : not null access RST) return Integer is
S : XDR_S_I;
L : SEO;
U : XDR_U := 0;
@@ -465,7 +465,7 @@ package body System.Stream_Attributes is
-- I_LF --
----------
- function I_LF (Stream : access RST) return Long_Float is
+ function I_LF (Stream : not null access RST) return Long_Float is
I : constant Precision := Double;
E_Size : Integer renames Fields (I).E_Size;
E_Bias : Integer renames Fields (I).E_Bias;
@@ -548,7 +548,7 @@ package body System.Stream_Attributes is
-- I_LI --
----------
- function I_LI (Stream : access RST) return Long_Integer is
+ function I_LI (Stream : not null access RST) return Long_Integer is
S : XDR_S_LI;
L : SEO;
U : Unsigned := 0;
@@ -594,7 +594,7 @@ package body System.Stream_Attributes is
-- I_LLF --
-----------
- function I_LLF (Stream : access RST) return Long_Long_Float is
+ function I_LLF (Stream : not null access RST) return Long_Long_Float is
I : constant Precision := Quadruple;
E_Size : Integer renames Fields (I).E_Size;
E_Bias : Integer renames Fields (I).E_Bias;
@@ -683,7 +683,7 @@ package body System.Stream_Attributes is
-- I_LLI --
-----------
- function I_LLI (Stream : access RST) return Long_Long_Integer is
+ function I_LLI (Stream : not null access RST) return Long_Long_Integer is
S : XDR_S_LLI;
L : SEO;
U : Unsigned := 0;
@@ -726,7 +726,7 @@ package body System.Stream_Attributes is
-- I_LLU --
-----------
- function I_LLU (Stream : access RST) return Long_Long_Unsigned is
+ function I_LLU (Stream : not null access RST) return Long_Long_Unsigned is
S : XDR_S_LLU;
L : SEO;
U : Unsigned := 0;
@@ -763,7 +763,7 @@ package body System.Stream_Attributes is
-- I_LU --
----------
- function I_LU (Stream : access RST) return Long_Unsigned is
+ function I_LU (Stream : not null access RST) return Long_Unsigned is
S : XDR_S_LU;
L : SEO;
U : Unsigned := 0;
@@ -800,7 +800,7 @@ package body System.Stream_Attributes is
-- I_SF --
----------
- function I_SF (Stream : access RST) return Short_Float is
+ function I_SF (Stream : not null access RST) return Short_Float is
I : constant Precision := Single;
E_Size : Integer renames Fields (I).E_Size;
E_Bias : Integer renames Fields (I).E_Bias;
@@ -881,7 +881,7 @@ package body System.Stream_Attributes is
-- I_SI --
----------
- function I_SI (Stream : access RST) return Short_Integer is
+ function I_SI (Stream : not null access RST) return Short_Integer is
S : XDR_S_SI;
L : SEO;
U : XDR_SU := 0;
@@ -914,7 +914,7 @@ package body System.Stream_Attributes is
-- I_SSI --
-----------
- function I_SSI (Stream : access RST) return Short_Short_Integer is
+ function I_SSI (Stream : not null access RST) return Short_Short_Integer is
S : XDR_S_SSI;
L : SEO;
U : XDR_SSU;
@@ -943,7 +943,7 @@ package body System.Stream_Attributes is
-- I_SSU --
-----------
- function I_SSU (Stream : access RST) return Short_Short_Unsigned is
+ function I_SSU (Stream : not null access RST) return Short_Short_Unsigned is
S : XDR_S_SSU;
L : SEO;
U : XDR_SSU := 0;
@@ -964,7 +964,7 @@ package body System.Stream_Attributes is
-- I_SU --
----------
- function I_SU (Stream : access RST) return Short_Unsigned is
+ function I_SU (Stream : not null access RST) return Short_Unsigned is
S : XDR_S_SU;
L : SEO;
U : XDR_SU := 0;
@@ -989,7 +989,7 @@ package body System.Stream_Attributes is
-- I_U --
---------
- function I_U (Stream : access RST) return Unsigned is
+ function I_U (Stream : not null access RST) return Unsigned is
S : XDR_S_U;
L : SEO;
U : XDR_U := 0;
@@ -1016,7 +1016,7 @@ package body System.Stream_Attributes is
-- I_WC --
----------
- function I_WC (Stream : access RST) return Wide_Character is
+ function I_WC (Stream : not null access RST) return Wide_Character is
S : XDR_S_WC;
L : SEO;
U : XDR_WC := 0;
@@ -1041,7 +1041,7 @@ package body System.Stream_Attributes is
-- W_AD --
----------
- procedure W_AD (Stream : access RST; Item : in Fat_Pointer) is
+ procedure W_AD (Stream : not null access RST; Item : in Fat_Pointer) is
S : XDR_S_TM;
U : XDR_TM;
@@ -1071,7 +1071,7 @@ package body System.Stream_Attributes is
-- W_AS --
----------
- procedure W_AS (Stream : access RST; Item : in Thin_Pointer) is
+ procedure W_AS (Stream : not null access RST; Item : in Thin_Pointer) is
S : XDR_S_TM;
U : XDR_TM := XDR_TM (To_XDR_SA (Item.P1));
@@ -1092,7 +1092,7 @@ package body System.Stream_Attributes is
-- W_B --
---------
- procedure W_B (Stream : access RST; Item : in Boolean) is
+ procedure W_B (Stream : not null access RST; Item : in Boolean) is
begin
if Item then
W_SSU (Stream, 1);
@@ -1105,7 +1105,7 @@ package body System.Stream_Attributes is
-- W_C --
---------
- procedure W_C (Stream : access RST; Item : in Character) is
+ procedure W_C (Stream : not null access RST; Item : in Character) is
S : XDR_S_C;
pragma Assert (C_L = 1);
@@ -1123,7 +1123,7 @@ package body System.Stream_Attributes is
-- W_F --
---------
- procedure W_F (Stream : access RST; Item : in Float) is
+ procedure W_F (Stream : not null access RST; Item : in Float) is
I : constant Precision := Single;
E_Size : Integer renames Fields (I).E_Size;
E_Bias : Integer renames Fields (I).E_Bias;
@@ -1205,7 +1205,7 @@ package body System.Stream_Attributes is
-- W_I --
---------
- procedure W_I (Stream : access RST; Item : in Integer) is
+ procedure W_I (Stream : not null access RST; Item : in Integer) is
S : XDR_S_I;
U : XDR_U;
@@ -1239,7 +1239,7 @@ package body System.Stream_Attributes is
-- W_LF --
----------
- procedure W_LF (Stream : access RST; Item : in Long_Float) is
+ procedure W_LF (Stream : not null access RST; Item : in Long_Float) is
I : constant Precision := Double;
E_Size : Integer renames Fields (I).E_Size;
E_Bias : Integer renames Fields (I).E_Bias;
@@ -1321,7 +1321,7 @@ package body System.Stream_Attributes is
-- W_LI --
----------
- procedure W_LI (Stream : access RST; Item : in Long_Integer) is
+ procedure W_LI (Stream : not null access RST; Item : in Long_Integer) is
S : XDR_S_LI;
U : Unsigned;
X : Long_Unsigned;
@@ -1367,7 +1367,7 @@ package body System.Stream_Attributes is
-- W_LLF --
-----------
- procedure W_LLF (Stream : access RST; Item : in Long_Long_Float) is
+ procedure W_LLF (Stream : not null access RST; Item : in Long_Long_Float) is
I : constant Precision := Quadruple;
E_Size : Integer renames Fields (I).E_Size;
E_Bias : Integer renames Fields (I).E_Bias;
@@ -1462,7 +1462,9 @@ package body System.Stream_Attributes is
-- W_LLI --
-----------
- procedure W_LLI (Stream : access RST; Item : in Long_Long_Integer) is
+ procedure W_LLI (Stream : not null access RST;
+ Item : in Long_Long_Integer)
+ is
S : XDR_S_LLI;
U : Unsigned;
X : Long_Long_Unsigned;
@@ -1508,7 +1510,8 @@ package body System.Stream_Attributes is
-- W_LLU --
-----------
- procedure W_LLU (Stream : access RST; Item : in Long_Long_Unsigned) is
+ procedure W_LLU (Stream : not null access RST;
+ Item : in Long_Long_Unsigned) is
S : XDR_S_LLU;
U : Unsigned;
X : Long_Long_Unsigned := Item;
@@ -1545,7 +1548,7 @@ package body System.Stream_Attributes is
-- W_LU --
----------
- procedure W_LU (Stream : access RST; Item : in Long_Unsigned) is
+ procedure W_LU (Stream : not null access RST; Item : in Long_Unsigned) is
S : XDR_S_LU;
U : Unsigned;
X : Long_Unsigned := Item;
@@ -1581,7 +1584,7 @@ package body System.Stream_Attributes is
-- W_SF --
----------
- procedure W_SF (Stream : access RST; Item : in Short_Float) is
+ procedure W_SF (Stream : not null access RST; Item : in Short_Float) is
I : constant Precision := Single;
E_Size : Integer renames Fields (I).E_Size;
E_Bias : Integer renames Fields (I).E_Bias;
@@ -1663,7 +1666,7 @@ package body System.Stream_Attributes is
-- W_SI --
----------
- procedure W_SI (Stream : access RST; Item : in Short_Integer) is
+ procedure W_SI (Stream : not null access RST; Item : in Short_Integer) is
S : XDR_S_SI;
U : XDR_SU;
@@ -1697,7 +1700,10 @@ package body System.Stream_Attributes is
-- W_SSI --
-----------
- procedure W_SSI (Stream : access RST; Item : in Short_Short_Integer) is
+ procedure W_SSI
+ (Stream : not null access RST;
+ Item : in Short_Short_Integer)
+ is
S : XDR_S_SSI;
U : XDR_SSU;
@@ -1724,9 +1730,12 @@ package body System.Stream_Attributes is
-- W_SSU --
-----------
- procedure W_SSU (Stream : access RST; Item : in Short_Short_Unsigned) is
+ procedure W_SSU
+ (Stream : not null access RST;
+ Item : in Short_Short_Unsigned)
+ is
+ U : constant XDR_SSU := XDR_SSU (Item);
S : XDR_S_SSU;
- U : XDR_SSU := XDR_SSU (Item);
begin
S (1) := SE (U);
@@ -1738,7 +1747,7 @@ package body System.Stream_Attributes is
-- W_SU --
----------
- procedure W_SU (Stream : access RST; Item : in Short_Unsigned) is
+ procedure W_SU (Stream : not null access RST; Item : in Short_Unsigned) is
S : XDR_S_SU;
U : XDR_SU := XDR_SU (Item);
@@ -1763,7 +1772,7 @@ package body System.Stream_Attributes is
-- W_U --
---------
- procedure W_U (Stream : access RST; Item : in Unsigned) is
+ procedure W_U (Stream : not null access RST; Item : in Unsigned) is
S : XDR_S_U;
U : XDR_U := XDR_U (Item);
@@ -1788,7 +1797,7 @@ package body System.Stream_Attributes is
-- W_WC --
----------
- procedure W_WC (Stream : access RST; Item : in Wide_Character) is
+ procedure W_WC (Stream : not null access RST; Item : in Wide_Character) is
S : XDR_S_WC;
U : XDR_WC;
diff --git a/gcc/ada/s-taprop-posix.adb b/gcc/ada/s-taprop-posix.adb
index 3ad2659f7a7..492c070ddcf 100644
--- a/gcc/ada/s-taprop-posix.adb
+++ b/gcc/ada/s-taprop-posix.adb
@@ -312,6 +312,7 @@ package body System.Task_Primitives.Operations is
pragma Assert (Result = 0 or else Result = ENOMEM);
if Result = ENOMEM then
+ Result := pthread_mutexattr_destroy (Attributes'Access);
raise Storage_Error;
end if;
diff --git a/gcc/ada/s-taprop-solaris.adb b/gcc/ada/s-taprop-solaris.adb
index 371f7411826..c9e1504779a 100644
--- a/gcc/ada/s-taprop-solaris.adb
+++ b/gcc/ada/s-taprop-solaris.adb
@@ -1382,7 +1382,7 @@ package body System.Task_Primitives.Operations is
begin
-- Check that caller is abort-deferred
- if Self_ID.Deferral_Level <= 0 then
+ if Self_ID.Deferral_Level = 0 then
return False;
end if;
@@ -1419,7 +1419,7 @@ package body System.Task_Primitives.Operations is
-- Check that caller is abort-deferred
- if Self_ID.Deferral_Level <= 0 then
+ if Self_ID.Deferral_Level = 0 then
return False;
end if;
@@ -1498,7 +1498,7 @@ package body System.Task_Primitives.Operations is
begin
-- Check that caller is abort-deferred
- if Self_ID.Deferral_Level <= 0 then
+ if Self_ID.Deferral_Level = 0 then
return False;
end if;
@@ -1617,7 +1617,7 @@ package body System.Task_Primitives.Operations is
-- Check that caller is abort-deferred
- if Self_ID.Deferral_Level <= 0 then
+ if Self_ID.Deferral_Level = 0 then
return False;
end if;
@@ -1646,7 +1646,7 @@ package body System.Task_Primitives.Operations is
begin
-- Check that caller is abort-deferred
- if Self_ID.Deferral_Level <= 0 then
+ if Self_ID.Deferral_Level = 0 then
return False;
end if;
@@ -1833,7 +1833,7 @@ package body System.Task_Primitives.Operations is
-- Check that caller is abort-deferred
- if Self_ID.Deferral_Level <= 0 then
+ if Self_ID.Deferral_Level = 0 then
return False;
end if;
diff --git a/gcc/ada/s-tasini.adb b/gcc/ada/s-tasini.adb
index 3aff42725cc..63b47e7b9e7 100644
--- a/gcc/ada/s-tasini.adb
+++ b/gcc/ada/s-tasini.adb
@@ -127,13 +127,6 @@ package body System.Tasking.Initialization is
-- Tasking Initialization --
----------------------------
- procedure Gnat_Install_Locks (Lock, Unlock : SSL.No_Param_Proc);
- pragma Import (C, Gnat_Install_Locks, "__gnatlib_install_locks");
- -- Used by Init_RTS to install procedure Lock and Unlock for the
- -- thread locking. This has no effect on GCC 2. For GCC 3,
- -- it has an effect only if gcc is configured with
- -- --enable_threads=gnat.
-
procedure Init_RTS;
-- This procedure completes the initialization of the GNARL. The first
-- part of the initialization is done in the body of System.Tasking.
@@ -392,10 +385,6 @@ package body System.Tasking.Initialization is
SSL.Tasking.Init_Tasking_Soft_Links;
- -- Install tasking locks in the GCC runtime
-
- Gnat_Install_Locks (Task_Lock'Access, Task_Unlock'Access);
-
-- Abort is deferred in a new ATCB, so we need to undefer abort
-- at this stage to make the environment task abortable.
diff --git a/gcc/ada/s-tassta.adb b/gcc/ada/s-tassta.adb
index 1ac7edb2dd0..54f92ebcde8 100644
--- a/gcc/ada/s-tassta.adb
+++ b/gcc/ada/s-tassta.adb
@@ -617,16 +617,6 @@ package body System.Tasking.Stages is
(Storage_Error'Identity, "Failed to initialize task");
end if;
- if not System.Restrictions.Abort_Allowed then
-
- -- If Abort is not allowed, reset the deferral level since it will
- -- not get changed by the generated code. Keeping a default value
- -- of one would prevent some operations (e.g. select or delay) to
- -- proceed successfully.
-
- T.Deferral_Level := 0;
- end if;
-
T.Master_of_Task := Master;
T.Master_Within := T.Master_of_Task + 1;
@@ -950,6 +940,16 @@ package body System.Tasking.Stages is
Lock_RTS;
Unlock_RTS;
+ if not System.Restrictions.Abort_Allowed then
+
+ -- If Abort is not allowed, reset the deferral level since it will
+ -- not get changed by the generated code. Keeping a default value
+ -- of one would prevent some operations (e.g. select or delay) to
+ -- proceed successfully.
+
+ Self_ID.Deferral_Level := 0;
+ end if;
+
begin
-- We are separating the following portion of the code in order to
-- place the exception handlers in a different block. In this way,
diff --git a/gcc/ada/s-tasuti.adb b/gcc/ada/s-tasuti.adb
index 8877c784e53..6721681827e 100644
--- a/gcc/ada/s-tasuti.adb
+++ b/gcc/ada/s-tasuti.adb
@@ -294,7 +294,7 @@ package body System.Tasking.Utilities is
if Parent /= Environment_Task then
- -- We can not lock three tasks at the same time, so defer the
+ -- We cannot lock three tasks at the same time, so defer the
-- operations on the parent.
Parent_Needs_Updating := True;
@@ -382,7 +382,7 @@ package body System.Tasking.Utilities is
pragma Assert (Self_ID.Awake_Count = 1);
end if;
- -- We are accepting with a terminate alternative.
+ -- We are accepting with a terminate alternative
else
if Self_ID.Open_Accepts = null then
@@ -494,7 +494,7 @@ package body System.Tasking.Utilities is
-- C has a parent, P.
loop
- -- Notify P that C has gone passive.
+ -- Notify P that C has gone passive
P.Awake_Count := P.Awake_Count - 1;
@@ -516,7 +516,7 @@ package body System.Tasking.Utilities is
Write_Lock (C);
end loop;
- -- P has non-passive dependents.
+ -- P has non-passive dependents
if P.Common.State = Master_Completion_Sleep
and then C.Master_of_Task = P.Master_Within
diff --git a/gcc/ada/s-traceb-hpux.adb b/gcc/ada/s-traceb-hpux.adb
index 013435bd100..5457cb1d0ee 100644
--- a/gcc/ada/s-traceb-hpux.adb
+++ b/gcc/ada/s-traceb-hpux.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2003 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -359,7 +359,7 @@ package body System.Traceback is
return False;
end if;
- -- Now, safely call the unwinder and use the results.
+ -- Now, safely call the unwinder and use the results
if U_get_previous_frame_x (Frame,
Up_Frame'Access,
@@ -510,7 +510,7 @@ package body System.Traceback is
Frame_Info_Offset : constant := 8;
begin
- -- First try to locate the descriptor in the program's unwind table.
+ -- First try to locate the descriptor in the program's unwind table
UWD_Address := U_get_unwind_entry (Frame.cur_rlo,
Frame.cur_rls,
@@ -562,7 +562,7 @@ package body System.Traceback is
Pop_Success := Pop_Frame (Frame'Access);
- -- Skip the requested number of frames.
+ -- Skip the requested number of frames
for I in 1 .. Skip_Frames loop
Pop_Success := Pop_Frame (Frame'Access);
diff --git a/gcc/ada/s-traceb-mastop.adb b/gcc/ada/s-traceb-mastop.adb
index fc337fbef4b..9591b2d2ad6 100644
--- a/gcc/ada/s-traceb-mastop.adb
+++ b/gcc/ada/s-traceb-mastop.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -100,8 +100,8 @@ package body System.Traceback is
------------------
function C_Call_Chain
- (Traceback : System.Address;
- Max_Len : Natural) return Natural
+ (Traceback : System.Address;
+ Max_Len : Natural) return Natural
is
Val : Natural;
begin
diff --git a/gcc/ada/s-traceb.adb b/gcc/ada/s-traceb.adb
index 5bfc830772f..e1c52080dd2 100644
--- a/gcc/ada/s-traceb.adb
+++ b/gcc/ada/s-traceb.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-traceb.ads b/gcc/ada/s-traceb.ads
index dbab25cbb03..23e64ff498b 100644
--- a/gcc/ada/s-traceb.ads
+++ b/gcc/ada/s-traceb.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -84,6 +84,6 @@ package System.Traceback is
Max_Len : Natural)
return Natural;
pragma Export (C, C_Call_Chain, "system__traceback__c_call_chain");
- -- Version that can be used directly from C.
+ -- Version that can be used directly from C
end System.Traceback;
diff --git a/gcc/ada/s-traces-default.adb b/gcc/ada/s-traces-default.adb
index b4523315eeb..2790c33e24c 100644
--- a/gcc/ada/s-traces-default.adb
+++ b/gcc/ada/s-traces-default.adb
@@ -45,7 +45,7 @@ package body System.Traces is
----------------------
procedure Send_Trace_Info (Id : Trace_T) is
- Task_S : String := SSL.Task_Name.all;
+ Task_S : constant String := SSL.Task_Name.all;
Trace_S : String (1 .. 3 + Task_S'Length);
begin
@@ -57,8 +57,8 @@ package body System.Traces is
end Send_Trace_Info;
procedure Send_Trace_Info (Id : Trace_T; Timeout : Duration) is
- Task_S : String := SSL.Task_Name.all;
- Timeout_S : String := Duration'Image (Timeout);
+ Task_S : constant String := SSL.Task_Name.all;
+ Timeout_S : constant String := Duration'Image (Timeout);
Trace_S : String (1 .. 6 + Task_S'Length + Timeout_S'Length);
begin
diff --git a/gcc/ada/s-trafor-default.ads b/gcc/ada/s-trafor-default.ads
index 281b690221f..01d957f37bb 100644
--- a/gcc/ada/s-trafor-default.ads
+++ b/gcc/ada/s-trafor-default.ads
@@ -34,6 +34,7 @@
-- This package implements functions to format run-time traces
package System.Traces.Format is
+ pragma Preelaborate;
Max_Size : constant Integer := 128;
-- Event messages' maximum size.
diff --git a/gcc/ada/s-tratas-default.adb b/gcc/ada/s-tratas-default.adb
index 8823ad0687f..5ea120dbc30 100644
--- a/gcc/ada/s-tratas-default.adb
+++ b/gcc/ada/s-tratas-default.adb
@@ -39,9 +39,7 @@ with System.Traces; use System.Traces;
package body System.Traces.Tasking is
- use System.Tasking;
use System.Traces;
- use System.Traces.Format;
package SSL renames System.Soft_Links;
@@ -60,8 +58,8 @@ package body System.Traces.Tasking is
(1 .. Task_Name2.Common.Task_Image_Len);
Trace_S : String (1 .. 6 + Task_S'Length + Task2_S'Length);
- L0 : Integer := Task_S'Length;
- L1 : Integer := Task2_S'Length;
+ L0 : constant Integer := Task_S'Length;
+ L1 : constant Integer := Task2_S'Length;
begin
if Parameters.Runtime_Traces then
@@ -108,13 +106,13 @@ package body System.Traces.Tasking is
Task2_S : constant String :=
Task_Name2.Common.Task_Image
(1 .. Task_Name2.Common.Task_Image_Len);
- Entry_S : String := Integer'Image (Integer (Entry_Number));
+ Entry_S : constant String := Integer'Image (Integer (Entry_Number));
Trace_S : String (1 .. 9 + Task_S'Length
+ Task2_S'Length + Entry_S'Length);
- L0 : Integer := Task_S'Length;
- L1 : Integer := Task_S'Length + Entry_S'Length;
- L2 : Integer := Task_S'Length + Task2_S'Length;
+ L0 : constant Integer := Task_S'Length;
+ L1 : constant Integer := Task_S'Length + Entry_S'Length;
+ L2 : constant Integer := Task_S'Length + Task2_S'Length;
begin
if Parameters.Runtime_Traces then
@@ -156,12 +154,12 @@ package body System.Traces.Tasking is
Task2_S : constant String :=
Task_Name2.Common.Task_Image
(1 .. Task_Name2.Common.Task_Image_Len);
- Entry_S : String := Integer'Image (Integer (Entry_Number));
+ Entry_S : constant String := Integer'Image (Integer (Entry_Number));
Trace_S : String (1 .. 9 + Task_S'Length
+ Task2_S'Length + Entry_S'Length);
- L0 : Integer := Task_S'Length;
- L1 : Integer := Task_S'Length + Entry_S'Length;
+ L0 : constant Integer := Task_S'Length;
+ L1 : constant Integer := Task_S'Length + Entry_S'Length;
begin
if Parameters.Runtime_Traces then
@@ -183,11 +181,11 @@ package body System.Traces.Tasking is
end Send_Trace_Info;
procedure Send_Trace_Info (Id : Trace_T; Entry_Number : Entry_Index) is
- Task_S : String := SSL.Task_Name.all;
- Entry_S : String := Integer'Image (Integer (Entry_Number));
+ Task_S : constant String := SSL.Task_Name.all;
+ Entry_S : constant String := Integer'Image (Integer (Entry_Number));
Trace_S : String (1 .. 6 + Task_S'Length + Entry_S'Length);
- L0 : Integer := Task_S'Length;
+ L0 : constant Integer := Task_S'Length;
begin
if Parameters.Runtime_Traces then
@@ -212,7 +210,7 @@ package body System.Traces.Tasking is
(1 .. Task_Name2.Common.Task_Image_Len);
Trace_S : String (1 .. 6 + Task_S'Length + Task2_S'Length);
- L0 : Integer := Task2_S'Length;
+ L0 : constant Integer := Task2_S'Length;
begin
if Parameters.Runtime_Traces then
@@ -234,14 +232,15 @@ package body System.Traces.Tasking is
Acceptor_S : constant String :=
Acceptor.Common.Task_Image
(1 .. Acceptor.Common.Task_Image_Len);
- Entry_S : String := Integer'Image (Integer (Entry_Number));
- Timeout_S : String := Duration'Image (Timeout);
+ Entry_S : constant String := Integer'Image (Integer (Entry_Number));
+ Timeout_S : constant String := Duration'Image (Timeout);
Trace_S : String (1 .. 12 + Task_S'Length + Acceptor_S'Length
+ Entry_S'Length + Timeout_S'Length);
- L0 : Integer := Task_S'Length;
- L1 : Integer := Task_S'Length + Acceptor_S'Length;
- L2 : Integer := Task_S'Length + Acceptor_S'Length + Entry_S'Length;
+ L0 : constant Integer := Task_S'Length;
+ L1 : constant Integer := Task_S'Length + Acceptor_S'Length;
+ L2 : constant Integer :=
+ Task_S'Length + Acceptor_S'Length + Entry_S'Length;
begin
if Parameters.Runtime_Traces then
@@ -262,14 +261,14 @@ package body System.Traces.Tasking is
Entry_Number : Entry_Index;
Timeout : Duration)
is
- Task_S : String := SSL.Task_Name.all;
- Entry_S : String := Integer'Image (Integer (Entry_Number));
- Timeout_S : String := Duration'Image (Timeout);
+ Task_S : constant String := SSL.Task_Name.all;
+ Entry_S : constant String := Integer'Image (Integer (Entry_Number));
+ Timeout_S : constant String := Duration'Image (Timeout);
Trace_S : String (1 .. 9 + Task_S'Length
+ Entry_S'Length + Timeout_S'Length);
- L0 : Integer := Task_S'Length;
- L1 : Integer := Task_S'Length + Entry_S'Length;
+ L0 : constant Integer := Task_S'Length;
+ L1 : constant Integer := Task_S'Length + Entry_S'Length;
begin
if Parameters.Runtime_Traces then
@@ -288,14 +287,14 @@ package body System.Traces.Tasking is
Task_Name : Task_Id;
Number : Integer)
is
- Task_S : String := SSL.Task_Name.all;
- Number_S : String := Integer'Image (Number);
- Accepts_S : String := Extract_Accepts (Task_Name);
+ Task_S : constant String := SSL.Task_Name.all;
+ Number_S : constant String := Integer'Image (Number);
+ Accepts_S : constant String := Extract_Accepts (Task_Name);
Trace_S : String (1 .. 9 + Task_S'Length
+ Number_S'Length + Accepts_S'Length);
- L0 : Integer := Task_S'Length;
- L1 : Integer := Task_S'Length + Number_S'Length;
+ L0 : constant Integer := Task_S'Length;
+ L1 : constant Integer := Task_S'Length + Number_S'Length;
begin
if Parameters.Runtime_Traces then
@@ -315,16 +314,17 @@ package body System.Traces.Tasking is
Number : Integer;
Timeout : Duration)
is
- Task_S : String := SSL.Task_Name.all;
- Timeout_S : String := Duration'Image (Timeout);
- Number_S : String := Integer'Image (Number);
- Accepts_S : String := Extract_Accepts (Task_Name);
+ Task_S : constant String := SSL.Task_Name.all;
+ Timeout_S : constant String := Duration'Image (Timeout);
+ Number_S : constant String := Integer'Image (Number);
+ Accepts_S : constant String := Extract_Accepts (Task_Name);
Trace_S : String (1 .. 12 + Task_S'Length + Timeout_S'Length
+ Number_S'Length + Accepts_S'Length);
- L0 : Integer := Task_S'Length;
- L1 : Integer := Task_S'Length + Timeout_S'Length;
- L2 : Integer := Task_S'Length + Timeout_S'Length + Number_S'Length;
+ L0 : constant Integer := Task_S'Length;
+ L1 : constant Integer := Task_S'Length + Timeout_S'Length;
+ L2 : constant Integer :=
+ Task_S'Length + Timeout_S'Length + Number_S'Length;
begin
if Parameters.Runtime_Traces then
diff --git a/gcc/ada/s-vaflop-vms-alpha.adb b/gcc/ada/s-vaflop-vms-alpha.adb
index 45a39bba08b..5ab772d4477 100644
--- a/gcc/ada/s-vaflop-vms-alpha.adb
+++ b/gcc/ada/s-vaflop-vms-alpha.adb
@@ -626,7 +626,7 @@ package body System.Vax_Float_Operations is
-- accurate, but is good enough in practice.
function Valid_D (Arg : D) return Boolean is
- Val : T := G_To_T (D_To_G (Arg));
+ Val : constant T := G_To_T (D_To_G (Arg));
begin
return Val'Valid;
end Valid_D;
@@ -639,7 +639,7 @@ package body System.Vax_Float_Operations is
-- accurate, but is good enough in practice.
function Valid_F (Arg : F) return Boolean is
- Val : S := F_To_S (Arg);
+ Val : constant S := F_To_S (Arg);
begin
return Val'Valid;
end Valid_F;
@@ -652,7 +652,7 @@ package body System.Vax_Float_Operations is
-- accurate, but is good enough in practice.
function Valid_G (Arg : G) return Boolean is
- Val : T := G_To_T (Arg);
+ Val : constant T := G_To_T (Arg);
begin
return Val'Valid;
end Valid_G;
diff --git a/gcc/ada/s-vaflop.adb b/gcc/ada/s-vaflop.adb
index ae721cfa33d..3cf96e26e93 100644
--- a/gcc/ada/s-vaflop.adb
+++ b/gcc/ada/s-vaflop.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -310,6 +310,24 @@ package body System.Vax_Float_Operations is
return X * Y;
end Mul_G;
+ ----------
+ -- Ne_F --
+ ----------
+
+ function Ne_F (X, Y : F) return Boolean is
+ begin
+ return X /= Y;
+ end Ne_F;
+
+ ----------
+ -- Ne_G --
+ ----------
+
+ function Ne_G (X, Y : G) return Boolean is
+ begin
+ return X /= Y;
+ end Ne_G;
+
-----------
-- Neg_F --
-----------
@@ -426,7 +444,7 @@ package body System.Vax_Float_Operations is
-- accurate, but is good enough in practice.
function Valid_D (Arg : D) return Boolean is
- Val : T := G_To_T (D_To_G (Arg));
+ Val : constant T := G_To_T (D_To_G (Arg));
begin
return Val'Valid;
end Valid_D;
@@ -439,7 +457,7 @@ package body System.Vax_Float_Operations is
-- accurate, but is good enough in practice.
function Valid_F (Arg : F) return Boolean is
- Val : S := F_To_S (Arg);
+ Val : constant S := F_To_S (Arg);
begin
return Val'Valid;
end Valid_F;
@@ -452,7 +470,7 @@ package body System.Vax_Float_Operations is
-- accurate, but is good enough in practice.
function Valid_G (Arg : G) return Boolean is
- Val : T := G_To_T (Arg);
+ Val : constant T := G_To_T (Arg);
begin
return Val'Valid;
end Valid_G;
diff --git a/gcc/ada/s-vaflop.ads b/gcc/ada/s-vaflop.ads
index a7bfc9319ae..9f205d48338 100644
--- a/gcc/ada/s-vaflop.ads
+++ b/gcc/ada/s-vaflop.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -139,6 +139,10 @@ package System.Vax_Float_Operations is
function Lt_G (X, Y : G) return Boolean;
-- Compares for X < Y
+ function Ne_F (X, Y : F) return Boolean;
+ function Ne_G (X, Y : G) return Boolean;
+ -- Compares for X /= Y
+
----------------------------------
-- Routines for Valid Attribute --
----------------------------------
@@ -218,6 +222,8 @@ private
pragma Inline (Le_G);
pragma Inline (Lt_F);
pragma Inline (Lt_G);
+ pragma Inline (Ne_F);
+ pragma Inline (Ne_G);
pragma Inline (Valid_D);
pragma Inline (Valid_F);
diff --git a/gcc/ada/s-valboo.adb b/gcc/ada/s-valboo.adb
index c569b2c3b34..5d23037e57e 100644
--- a/gcc/ada/s-valboo.adb
+++ b/gcc/ada/s-valboo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -49,16 +49,13 @@ package body System.Val_Bool is
if S (F .. L) = "TRUE" then
return True;
- end if;
- if S (F .. L) = "FALSE" then
+ elsif S (F .. L) = "FALSE" then
return False;
- end if;
-
- raise Constraint_Error;
-
- -- Above should use elsif, but this doesn't work in GNAT version 1.81???
+ else
+ raise Constraint_Error;
+ end if;
end Value_Boolean;
end System.Val_Bool;
diff --git a/gcc/ada/s-valboo.ads b/gcc/ada/s-valboo.ads
index e08d337f58f..c2bfca3c701 100644
--- a/gcc/ada/s-valboo.ads
+++ b/gcc/ada/s-valboo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,6 +35,6 @@ package System.Val_Bool is
pragma Pure;
function Value_Boolean (Str : String) return Boolean;
- -- Computes Boolean'Value (Str).
+ -- Computes Boolean'Value (Str)
end System.Val_Bool;
diff --git a/gcc/ada/s-valcha.adb b/gcc/ada/s-valcha.adb
index 561d170c819..734b2af39f5 100644
--- a/gcc/ada/s-valcha.adb
+++ b/gcc/ada/s-valcha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -69,7 +69,6 @@ package body System.Val_Char is
raise Constraint_Error;
end if;
-
end Value_Character;
end System.Val_Char;
diff --git a/gcc/ada/s-valcha.ads b/gcc/ada/s-valcha.ads
index 903ba53e063..fa31f13fd5f 100644
--- a/gcc/ada/s-valcha.ads
+++ b/gcc/ada/s-valcha.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,6 +35,6 @@ package System.Val_Char is
pragma Pure;
function Value_Character (Str : String) return Character;
- -- Computes Character'Value (Str).
+ -- Computes Character'Value (Str)
end System.Val_Char;
diff --git a/gcc/ada/s-valdec.adb b/gcc/ada/s-valdec.adb
index 6bfcfb65ec0..dbac049edef 100644
--- a/gcc/ada/s-valdec.adb
+++ b/gcc/ada/s-valdec.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -48,11 +48,9 @@ package body System.Val_Dec is
(Str : String;
Ptr : access Integer;
Max : Integer;
- Scale : Integer)
- return Integer
+ Scale : Integer) return Integer
is
Val : Long_Long_Float;
-
begin
Val := Scan_Real (Str, Ptr, Max);
return Integer (Val * 10.0 ** Scale);
diff --git a/gcc/ada/s-valdec.ads b/gcc/ada/s-valdec.ads
index eb563dedf6b..df36ebd9007 100644
--- a/gcc/ada/s-valdec.ads
+++ b/gcc/ada/s-valdec.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -42,8 +42,7 @@ package System.Val_Dec is
(Str : String;
Ptr : access Integer;
Max : Integer;
- Scale : Integer)
- return Integer;
+ Scale : Integer) return Integer;
-- This function scans the string starting at Str (Ptr.all) for a valid
-- real literal according to the syntax described in (RM 3.5(43)). The
-- substring scanned extends no further than Str (Max). There are three
diff --git a/gcc/ada/s-valint.adb b/gcc/ada/s-valint.adb
index 7598efdea9c..8bfb3733d4b 100644
--- a/gcc/ada/s-valint.adb
+++ b/gcc/ada/s-valint.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -42,9 +42,9 @@ package body System.Val_Int is
------------------
function Scan_Integer
- (Str : String;
- Ptr : access Integer;
- Max : Integer) return Integer
+ (Str : String;
+ Ptr : access Integer;
+ Max : Integer) return Integer
is
Uval : Unsigned;
-- Unsigned result
diff --git a/gcc/ada/s-valint.ads b/gcc/ada/s-valint.ads
index 32c6be32cc5..6413a349272 100644
--- a/gcc/ada/s-valint.ads
+++ b/gcc/ada/s-valint.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -38,9 +38,9 @@ package System.Val_Int is
pragma Pure;
function Scan_Integer
- (Str : String;
- Ptr : access Integer;
- Max : Integer) return Integer;
+ (Str : String;
+ Ptr : access Integer;
+ Max : Integer) return Integer;
-- This function scans the string starting at Str (Ptr.all) for a valid
-- integer according to the syntax described in (RM 3.5(43)). The substring
-- scanned extends no further than Str (Max). There are three cases for the
diff --git a/gcc/ada/s-vallld.adb b/gcc/ada/s-vallld.adb
index 5f7f5c3f6e1..958fb96aa6d 100644
--- a/gcc/ada/s-vallld.adb
+++ b/gcc/ada/s-vallld.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992,1993,1994,1995,1996 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -47,11 +47,9 @@ package body System.Val_LLD is
(Str : String;
Ptr : access Integer;
Max : Integer;
- Scale : Integer)
- return Long_Long_Integer
+ Scale : Integer) return Long_Long_Integer
is
Val : Long_Long_Float;
-
begin
Val := Scan_Real (Str, Ptr, Max);
return Long_Long_Integer (Val * 10.0 ** Scale);
@@ -65,8 +63,7 @@ package body System.Val_LLD is
function Value_Long_Long_Decimal
(Str : String;
- Scale : Integer)
- return Long_Long_Integer
+ Scale : Integer) return Long_Long_Integer
is
begin
return Long_Long_Integer (Value_Real (Str) * 10.0 ** Scale);
diff --git a/gcc/ada/s-vallld.ads b/gcc/ada/s-vallld.ads
index 7d3b14101fc..7022669dfcd 100644
--- a/gcc/ada/s-vallld.ads
+++ b/gcc/ada/s-vallld.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -42,8 +42,7 @@ package System.Val_LLD is
(Str : String;
Ptr : access Integer;
Max : Integer;
- Scale : Integer)
- return Long_Long_Integer;
+ Scale : Integer) return Long_Long_Integer;
-- This function scans the string starting at Str (Ptr.all) for a valid
-- real literal according to the syntax described in (RM 3.5(43)). The
-- substring scanned extends no further than Str (Max). There are three
@@ -73,8 +72,7 @@ package System.Val_LLD is
function Value_Long_Long_Decimal
(Str : String;
- Scale : Integer)
- return Long_Long_Integer;
+ Scale : Integer) return Long_Long_Integer;
-- Used in computing X'Value (Str) where X is a decimal types whose size
-- exceeds Standard.Integer'Size. Str is the string argument of the
-- attribute. Constraint_Error is raised if the string is malformed
diff --git a/gcc/ada/s-vallli.adb b/gcc/ada/s-vallli.adb
index 101e6aaf628..ad54db94607 100644
--- a/gcc/ada/s-vallli.adb
+++ b/gcc/ada/s-vallli.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -88,7 +88,6 @@ package body System.Val_LLI is
function Value_Long_Long_Integer (Str : String) return Long_Long_Integer is
V : Long_Long_Integer;
P : aliased Integer := Str'First;
-
begin
V := Scan_Long_Long_Integer (Str, P'Access, Str'Last);
Scan_Trailing_Blanks (Str, P);
diff --git a/gcc/ada/s-vallli.ads b/gcc/ada/s-vallli.ads
index 57c7f2da9d7..e83fd8f710b 100644
--- a/gcc/ada/s-vallli.ads
+++ b/gcc/ada/s-vallli.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-valllu.adb b/gcc/ada/s-valllu.adb
index 9407cbdf009..ca4cbb2a38c 100644
--- a/gcc/ada/s-valllu.adb
+++ b/gcc/ada/s-valllu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -41,9 +41,9 @@ package body System.Val_LLU is
-----------------------------
function Scan_Long_Long_Unsigned
- (Str : String;
- Ptr : access Integer;
- Max : Integer) return Long_Long_Unsigned
+ (Str : String;
+ Ptr : access Integer;
+ Max : Integer) return Long_Long_Unsigned
is
P : Integer;
-- Local copy of the pointer
@@ -289,7 +289,6 @@ package body System.Val_LLU is
is
V : Long_Long_Unsigned;
P : aliased Integer := Str'First;
-
begin
V := Scan_Long_Long_Unsigned (Str, P'Access, Str'Last);
Scan_Trailing_Blanks (Str, P);
diff --git a/gcc/ada/s-valllu.ads b/gcc/ada/s-valllu.ads
index 6fee777c8ef..603e4b6bc80 100644
--- a/gcc/ada/s-valllu.ads
+++ b/gcc/ada/s-valllu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -40,9 +40,9 @@ package System.Val_LLU is
pragma Pure;
function Scan_Long_Long_Unsigned
- (Str : String;
- Ptr : access Integer;
- Max : Integer) return System.Unsigned_Types.Long_Long_Unsigned;
+ (Str : String;
+ Ptr : access Integer;
+ Max : Integer) return System.Unsigned_Types.Long_Long_Unsigned;
-- This function scans the string starting at Str (Ptr.all) for a valid
-- integer according to the syntax described in (RM 3.5(43)). The substring
-- scanned extends no further than Str (Max). There are three cases for the
diff --git a/gcc/ada/s-valrea.adb b/gcc/ada/s-valrea.adb
index 3a6ca8c0ba2..e277e380991 100644
--- a/gcc/ada/s-valrea.adb
+++ b/gcc/ada/s-valrea.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -41,9 +41,9 @@ package body System.Val_Real is
---------------
function Scan_Real
- (Str : String;
- Ptr : access Integer;
- Max : Integer) return Long_Long_Float
+ (Str : String;
+ Ptr : access Integer;
+ Max : Integer) return Long_Long_Float
is
procedure Reset;
pragma Import (C, Reset, "__gnat_init_float");
@@ -100,6 +100,10 @@ package body System.Val_Real is
-- return P points past the last character. On entry, the current
-- character is known to be a digit, so a numeral is definitely present.
+ -----------
+ -- Scanf --
+ -----------
+
procedure Scanf is
Digit : Natural;
@@ -330,7 +334,7 @@ package body System.Val_Real is
if Base /= 10.0 then
Uval := Uval * Base ** Scale;
- -- For base 10, use power of ten table, repeatedly if necessary.
+ -- For base 10, use power of ten table, repeatedly if necessary
elsif Scale > 0 then
while Scale > Maxpow loop
@@ -377,7 +381,6 @@ package body System.Val_Real is
function Value_Real (Str : String) return Long_Long_Float is
V : Long_Long_Float;
P : aliased Integer := Str'First;
-
begin
V := Scan_Real (Str, P'Access, Str'Last);
Scan_Trailing_Blanks (Str, P);
diff --git a/gcc/ada/s-valrea.ads b/gcc/ada/s-valrea.ads
index 821072d7d4e..d3b0e33d90b 100644
--- a/gcc/ada/s-valrea.ads
+++ b/gcc/ada/s-valrea.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,9 +35,9 @@ package System.Val_Real is
pragma Pure;
function Scan_Real
- (Str : String;
- Ptr : access Integer;
- Max : Integer) return Long_Long_Float;
+ (Str : String;
+ Ptr : access Integer;
+ Max : Integer) return Long_Long_Float;
-- This function scans the string starting at Str (Ptr.all) for a valid
-- real literal according to the syntax described in (RM 3.5(43)). The
-- substring scanned extends no further than Str (Max). There are three
diff --git a/gcc/ada/s-valuns.adb b/gcc/ada/s-valuns.adb
index 77fba797a65..885db28f3c7 100644
--- a/gcc/ada/s-valuns.adb
+++ b/gcc/ada/s-valuns.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-1997 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -41,10 +41,9 @@ package body System.Val_Uns is
-------------------
function Scan_Unsigned
- (Str : String;
- Ptr : access Integer;
- Max : Integer)
- return Unsigned
+ (Str : String;
+ Ptr : access Integer;
+ Max : Integer) return Unsigned
is
P : Integer;
-- Local copy of the pointer
@@ -285,12 +284,10 @@ package body System.Val_Uns is
function Value_Unsigned (Str : String) return Unsigned is
V : Unsigned;
P : aliased Integer := Str'First;
-
begin
V := Scan_Unsigned (Str, P'Access, Str'Last);
Scan_Trailing_Blanks (Str, P);
return V;
-
end Value_Unsigned;
end System.Val_Uns;
diff --git a/gcc/ada/s-valuns.ads b/gcc/ada/s-valuns.ads
index 88f609e7b5b..bd41849e98f 100644
--- a/gcc/ada/s-valuns.ads
+++ b/gcc/ada/s-valuns.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -40,10 +40,9 @@ package System.Val_Uns is
pragma Pure;
function Scan_Unsigned
- (Str : String;
- Ptr : access Integer;
- Max : Integer)
- return System.Unsigned_Types.Unsigned;
+ (Str : String;
+ Ptr : access Integer;
+ Max : Integer) return System.Unsigned_Types.Unsigned;
-- This function scans the string starting at Str (Ptr.all) for a valid
-- integer according to the syntax described in (RM 3.5(43)). The substring
-- scanned extends no further than Str (Max). There are three cases for the
@@ -71,8 +70,7 @@ package System.Val_Uns is
-- is greater than Max as required in this case.
function Value_Unsigned
- (Str : String)
- return System.Unsigned_Types.Unsigned;
+ (Str : String) return System.Unsigned_Types.Unsigned;
-- Used in computing X'Value (Str) where X is a modular integer type whose
-- modulus does not exceed the range of System.Unsigned_Types.Unsigned. Str
-- is the string argument of the attribute. Constraint_Error is raised if
diff --git a/gcc/ada/s-valuti.adb b/gcc/ada/s-valuti.adb
index 470f8a9c684..07f067b79cc 100644
--- a/gcc/ada/s-valuti.adb
+++ b/gcc/ada/s-valuti.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2002, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -83,8 +83,7 @@ package body System.Val_Util is
(Str : String;
Ptr : access Integer;
Max : Integer;
- Real : Boolean := False)
- return Integer
+ Real : Boolean := False) return Integer
is
P : Natural := Ptr.all;
M : Boolean;
diff --git a/gcc/ada/s-valuti.ads b/gcc/ada/s-valuti.ads
index f7073ae97d1..ac905096862 100644
--- a/gcc/ada/s-valuti.ads
+++ b/gcc/ada/s-valuti.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -74,8 +74,7 @@ package System.Val_Util is
(Str : String;
Ptr : access Integer;
Max : Integer;
- Real : Boolean := False)
- return Integer;
+ Real : Boolean := False) return Integer;
-- Called to scan a possible exponent. Str, Ptr, Max are as described above
-- for Scan_Sign. If Ptr.all < Max and Str (Ptr.all) = 'E' or 'e', then an
-- exponent is scanned out, with the exponent value returned in Exp, and
diff --git a/gcc/ada/s-valwch.ads b/gcc/ada/s-valwch.ads
index 05064c9cfad..32a4b508f27 100644
--- a/gcc/ada/s-valwch.ads
+++ b/gcc/ada/s-valwch.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-veboop.adb b/gcc/ada/s-veboop.adb
index 20d9d0ed44c..177a9448068 100644
--- a/gcc/ada/s-veboop.adb
+++ b/gcc/ada/s-veboop.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-veboop.ads b/gcc/ada/s-veboop.ads
index f7e135907cd..2708b22287f 100644
--- a/gcc/ada/s-veboop.ads
+++ b/gcc/ada/s-veboop.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-vercon.adb b/gcc/ada/s-vercon.adb
index 186b9b714c4..b9b8fe8b416 100644
--- a/gcc/ada/s-vercon.adb
+++ b/gcc/ada/s-vercon.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with System.Unsigned_Types; use System.Unsigned_Types;
+
package body System.Version_Control is
------------------------
diff --git a/gcc/ada/s-vercon.ads b/gcc/ada/s-vercon.ads
index c8d26a916d3..49c31532891 100644
--- a/gcc/ada/s-vercon.ads
+++ b/gcc/ada/s-vercon.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wchcnv.adb b/gcc/ada/s-wchcnv.adb
index e31ac7be6f1..e3afa9c05e7 100644
--- a/gcc/ada/s-wchcnv.adb
+++ b/gcc/ada/s-wchcnv.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wchcnv.ads b/gcc/ada/s-wchcnv.ads
index d90ae5b3869..bebf56240ab 100644
--- a/gcc/ada/s-wchcnv.ads
+++ b/gcc/ada/s-wchcnv.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wchcon.ads b/gcc/ada/s-wchcon.ads
index 40394db1901..f2666458525 100644
--- a/gcc/ada/s-wchcon.ads
+++ b/gcc/ada/s-wchcon.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wchjis.adb b/gcc/ada/s-wchjis.adb
index 6767c44b200..5ac43a67bfc 100644
--- a/gcc/ada/s-wchjis.adb
+++ b/gcc/ada/s-wchjis.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wchjis.ads b/gcc/ada/s-wchjis.ads
index 0f103170ec7..ebfcbedfb71 100644
--- a/gcc/ada/s-wchjis.ads
+++ b/gcc/ada/s-wchjis.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wchstw.adb b/gcc/ada/s-wchstw.adb
index a736d99e789..476a2e84abe 100644
--- a/gcc/ada/s-wchstw.adb
+++ b/gcc/ada/s-wchstw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -65,7 +65,7 @@ package body System.WCh_StW is
-- if P > S'Last on entry.
function Get_UTF_32 is new Char_Sequence_To_UTF_32 (In_Char);
- -- Function to get next UFT_32 value.
+ -- Function to get next UFT_32 value
-------------
-- In_Char --
@@ -81,6 +81,8 @@ package body System.WCh_StW is
end if;
end In_Char;
+ -- Start of processing for Get_Next_Code
+
begin
-- Check for wide character encoding
diff --git a/gcc/ada/s-wchstw.ads b/gcc/ada/s-wchstw.ads
index ba154b901ba..b965e2fce52 100644
--- a/gcc/ada/s-wchstw.ads
+++ b/gcc/ada/s-wchstw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wchwts.adb b/gcc/ada/s-wchwts.adb
index de9b6ceaabe..995f5acda0f 100644
--- a/gcc/ada/s-wchwts.adb
+++ b/gcc/ada/s-wchwts.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wchwts.ads b/gcc/ada/s-wchwts.ads
index ac34cf2dccd..2359701462c 100644
--- a/gcc/ada/s-wchwts.ads
+++ b/gcc/ada/s-wchwts.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widboo.adb b/gcc/ada/s-widboo.adb
index fa245f4b5de..395f7a1dd42 100644
--- a/gcc/ada/s-widboo.adb
+++ b/gcc/ada/s-widboo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widboo.ads b/gcc/ada/s-widboo.ads
index 9e5e1bd0945..16192a63258 100644
--- a/gcc/ada/s-widboo.ads
+++ b/gcc/ada/s-widboo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widcha.adb b/gcc/ada/s-widcha.adb
index ec898c3a19f..23130ddad36 100644
--- a/gcc/ada/s-widcha.adb
+++ b/gcc/ada/s-widcha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widcha.ads b/gcc/ada/s-widcha.ads
index 021a5a325f0..3dac0c4763e 100644
--- a/gcc/ada/s-widcha.ads
+++ b/gcc/ada/s-widcha.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widenu.adb b/gcc/ada/s-widenu.adb
index c794af92c9f..9110c107cb5 100644
--- a/gcc/ada/s-widenu.adb
+++ b/gcc/ada/s-widenu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widenu.ads b/gcc/ada/s-widenu.ads
index cef6e287aee..ef6af7e517a 100644
--- a/gcc/ada/s-widenu.ads
+++ b/gcc/ada/s-widenu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widlli.adb b/gcc/ada/s-widlli.adb
index ee9cd5b3375..3251f2d51e5 100644
--- a/gcc/ada/s-widlli.adb
+++ b/gcc/ada/s-widlli.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widlli.ads b/gcc/ada/s-widlli.ads
index f2aede66aae..6013a8deaf8 100644
--- a/gcc/ada/s-widlli.ads
+++ b/gcc/ada/s-widlli.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widllu.adb b/gcc/ada/s-widllu.adb
index c282c93a6f9..75b6667717c 100644
--- a/gcc/ada/s-widllu.adb
+++ b/gcc/ada/s-widllu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widllu.ads b/gcc/ada/s-widllu.ads
index dff5bb3019b..58ac484c40f 100644
--- a/gcc/ada/s-widllu.ads
+++ b/gcc/ada/s-widllu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widwch.adb b/gcc/ada/s-widwch.adb
index 8cca640f8dc..e4e3dcc8706 100644
--- a/gcc/ada/s-widwch.adb
+++ b/gcc/ada/s-widwch.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-widwch.ads b/gcc/ada/s-widwch.ads
index ca5e2fab89c..5ff4aaf7e59 100644
--- a/gcc/ada/s-widwch.ads
+++ b/gcc/ada/s-widwch.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wwdcha.adb b/gcc/ada/s-wwdcha.adb
index 7f657ad7bd8..3580a0142f5 100644
--- a/gcc/ada/s-wwdcha.adb
+++ b/gcc/ada/s-wwdcha.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wwdcha.ads b/gcc/ada/s-wwdcha.ads
index 3ba15e473eb..566dc1f8c7d 100644
--- a/gcc/ada/s-wwdcha.ads
+++ b/gcc/ada/s-wwdcha.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wwdenu.adb b/gcc/ada/s-wwdenu.adb
index 090522f39aa..9a2fac7c3e4 100644
--- a/gcc/ada/s-wwdenu.adb
+++ b/gcc/ada/s-wwdenu.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/s-wwdenu.ads b/gcc/ada/s-wwdenu.ads
index 67bac34a859..d8cbf528e0e 100644
--- a/gcc/ada/s-wwdenu.ads
+++ b/gcc/ada/s-wwdenu.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/scans.ads b/gcc/ada/scans.ads
index 955637acb76..7e2a58078a1 100644
--- a/gcc/ada/scans.ads
+++ b/gcc/ada/scans.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -190,22 +190,27 @@ package Scans is
Tok_Dot_Dot, -- .. Sterm, Chtok
- -- The following three entries are used only when scanning project
- -- files.
-
Tok_Project,
Tok_Extends,
Tok_External,
- Tok_Comment,
+ -- These three entries represent keywords for the project file language
+ -- and can be returned only in the case of scanning project files.
- -- The following entry is used by the preprocessor and when scanning
- -- project files.
+ Tok_Comment,
+ -- This entry is used when scanning project files (where it represents
+ -- an entire comment), and in preprocessing with the -C switch set
+ -- (where it represents just the "--" of a comment). For the project
+ -- file case, the text of the comment is stored in
Tok_End_Of_Line,
-
- -- The following entry is used by the preprocessor
+ -- Represents an end of line. Not used during normal compilation scans
+ -- where end of line is ignored. Active for preprocessor scanning and
+ -- also when scanning project files (where it is neede because of ???)
Tok_Special,
+ -- Used only in preprocessor scanning (to represent one of the
+ -- characters '#', '$', '?', '@', '`', '\', '^', '~', or '_'. The
+ -- character value itself is stored in Scans.Special_Character.
No_Token);
-- No_Token is used for initializing Token values to indicate that
@@ -394,7 +399,7 @@ package Scans is
-- We do things this way to minimize the impact on comment scanning.
Character_Code : Char_Code;
- -- Valid only when Token is Tok_Char_Literal.
+ -- Valid only when Token is Tok_Char_Literal
Real_Literal_Value : Ureal;
-- Valid only when Token is Tok_Real_Literal
@@ -411,11 +416,17 @@ package Scans is
-- Valid only when Token = Tok_String_Literal.
Special_Character : Character;
- -- Valid only when Token = Tok_Special
+ -- Valid only when Token = Tok_Special. Returns one of the characters
+ -- '#', '$', '?', '@', '`', '\', '^', '~', or '_'.
+ --
+ -- Why only this set? What about wide characters???
Comment_Id : Name_Id := No_Name;
-- Valid only when Token = Tok_Comment. Store the string that follows
- -- the two '-' of a comment.
+ -- the "--" of a comment when scanning project files.
+ --
+ -- Is it really right for this to be a Name rather than a String, what
+ -- about the case of Wide_Wide_Characters???
--------------------------------------------------------
-- Procedures for Saving and Restoring the Scan State --
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index 9d3483e8251..687c32b11d5 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -1465,6 +1465,17 @@ package body Scng is
else -- Source (Scan_Ptr + 1) = '-' then
if Style_Check then Style.Check_Comment; end if;
Scan_Ptr := Scan_Ptr + 2;
+
+ -- If we are in preprocessor mode with Replace_In_Comments set,
+ -- then we return the "--" as a token on its own.
+
+ if Replace_In_Comments then
+ Token := Tok_Comment;
+ return;
+ end if;
+
+ -- Otherwise scan out the comment
+
Start_Of_Comment := Scan_Ptr;
-- Loop to scan comment (this loop runs more than once only if
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index 36afe180caa..8c73ae95242 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -646,7 +646,6 @@ package body Sem is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Analyze (N);
@@ -656,7 +655,6 @@ package body Sem is
else
declare
Svg : constant Boolean := Scope_Suppress (Suppress);
-
begin
Scope_Suppress (Suppress) := True;
Analyze (N);
@@ -687,7 +685,6 @@ package body Sem is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Analyze_List (L);
@@ -697,7 +694,6 @@ package body Sem is
else
declare
Svg : constant Boolean := Scope_Suppress (Suppress);
-
begin
Scope_Suppress (Suppress) := True;
Analyze_List (L);
@@ -928,7 +924,6 @@ package body Sem is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Insert_After_And_Analyze (N, M);
@@ -938,7 +933,6 @@ package body Sem is
else
declare
Svg : constant Boolean := Scope_Suppress (Suppress);
-
begin
Scope_Suppress (Suppress) := True;
Insert_After_And_Analyze (N, M);
@@ -990,7 +984,6 @@ package body Sem is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Insert_Before_And_Analyze (N, M);
@@ -1000,7 +993,6 @@ package body Sem is
else
declare
Svg : constant Boolean := Scope_Suppress (Suppress);
-
begin
Scope_Suppress (Suppress) := True;
Insert_Before_And_Analyze (N, M);
@@ -1051,7 +1043,6 @@ package body Sem is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Insert_List_After_And_Analyze (N, L);
@@ -1061,7 +1052,6 @@ package body Sem is
else
declare
Svg : constant Boolean := Scope_Suppress (Suppress);
-
begin
Scope_Suppress (Suppress) := True;
Insert_List_After_And_Analyze (N, L);
@@ -1111,7 +1101,6 @@ package body Sem is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Insert_List_Before_And_Analyze (N, L);
@@ -1121,7 +1110,6 @@ package body Sem is
else
declare
Svg : constant Boolean := Scope_Suppress (Suppress);
-
begin
Scope_Suppress (Suppress) := True;
Insert_List_Before_And_Analyze (N, L);
diff --git a/gcc/ada/sem.ads b/gcc/ada/sem.ads
index 13b2a95900e..d7fb9a649b8 100644
--- a/gcc/ada/sem.ads
+++ b/gcc/ada/sem.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -79,7 +79,7 @@
-- terminates, the expression can be expanded since all the semantic
-- information is available at that point.
--- If we are not generating code then the expansion phase is a no-op.
+-- If we are not generating code then the expansion phase is a no-op
-- When generating code there are a number of exceptions to the basic
-- Analysis-Resolution-Expansion model for expressions. The most prominent
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index b8fc284b501..b67a6a85fcb 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -979,7 +979,14 @@ package body Sem_Aggr is
-- in which the array aggregate occurs. If the context does not
-- permit it, or the aggregate type is unconstrained, an others
-- choice is not allowed.
- --
+
+ -- If expansion is disabled (generic context, or semantics-only
+ -- mode) actual subtypes cannot be constructed, and the type of
+ -- an object may be its unconstrained nominal type. However, if
+ -- the context is an assignment, we assume that "others" is
+ -- allowed, because the target of the assignment will have a
+ -- constrained subtype when fully compiled.
+
-- Note that there is no node for Explicit_Actual_Parameter.
-- To test for this context we therefore have to test for node
-- N_Parameter_Association which itself appears only if there is a
@@ -1012,6 +1019,16 @@ package body Sem_Aggr is
Component_Typ => Component_Type (Typ),
Others_Allowed => True);
+ elsif not Expander_Active
+ and then Pkind = N_Assignment_Statement
+ then
+ Aggr_Resolved :=
+ Resolve_Array_Aggregate
+ (N,
+ Index => First_Index (Aggr_Typ),
+ Index_Constr => First_Index (Typ),
+ Component_Typ => Component_Type (Typ),
+ Others_Allowed => True);
else
Aggr_Resolved :=
Resolve_Array_Aggregate
@@ -1031,9 +1048,15 @@ package body Sem_Aggr is
Set_Etype (N, Aggr_Subtyp);
end Array_Aggregate;
+ elsif Is_Private_Type (Typ)
+ and then Present (Full_View (Typ))
+ and then In_Inlined_Body
+ and then Is_Composite_Type (Full_View (Typ))
+ then
+ Resolve (N, Full_View (Typ));
+
else
Error_Msg_N ("illegal context for aggregate", N);
-
end if;
-- If we can determine statically that the evaluation of the
@@ -1889,7 +1912,6 @@ package body Sem_Aggr is
Check_Length (Aggr_Low, Aggr_High, Nb_Elements);
Check_Length (Index_Typ_Low, Index_Typ_High, Nb_Elements);
Check_Length (Index_Base_Low, Index_Base_High, Nb_Elements);
-
end if;
if Raises_Constraint_Error (Aggr_Low)
@@ -2312,7 +2334,6 @@ package body Sem_Aggr is
("initialization not allowed for limited types", N);
Explain_Limited_Type (Etype (Compon), Compon);
end if;
-
end if;
end Check_Non_Limited_Type;
diff --git a/gcc/ada/sem_aggr.ads b/gcc/ada/sem_aggr.ads
index ab1fff58a2e..808747abc64 100644
--- a/gcc/ada/sem_aggr.ads
+++ b/gcc/ada/sem_aggr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 1306779d12a..e0c05fd62ae 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -492,9 +492,16 @@ package body Sem_Attr is
-- accesses are allowed (references to the current type instance).
if Is_Entity_Name (P) then
- Scop := Current_Scope;
Typ := Entity (P);
+ -- The reference may appear in an aggregate that has been expanded
+ -- into a loop. Locate scope of type definition, if any.
+
+ Scop := Current_Scope;
+ while Ekind (Scop) = E_Loop loop
+ Scop := Scope (Scop);
+ end loop;
+
if Is_Type (Typ) then
-- OK if we are within the scope of a limited type
@@ -516,6 +523,7 @@ package body Sem_Attr is
loop
Q := Parent (Q);
end loop;
+
if Present (Q) then
Set_Has_Per_Object_Constraint (
Defining_Identifier (Q), True);
@@ -585,11 +593,9 @@ package body Sem_Attr is
declare
Index : Interp_Index;
It : Interp;
-
begin
Set_Etype (N, Any_Type);
Get_First_Interp (P, Index, It);
-
while Present (It.Typ) loop
Acc_Type := Build_Access_Object_Type (It.Typ);
Add_One_Interp (N, Acc_Type, Acc_Type);
@@ -1373,13 +1379,27 @@ package body Sem_Attr is
begin
Analyze (P);
+ -- Ada 2005 (AI-345): Attribute 'Terminated can be applied to
+ -- task interface class-wide types.
+
if Is_Task_Type (Etype (P))
or else (Is_Access_Type (Etype (P))
- and then Is_Task_Type (Designated_Type (Etype (P))))
+ and then Is_Task_Type (Designated_Type (Etype (P))))
+ or else (Ada_Version >= Ada_05
+ and then Ekind (Etype (P)) = E_Class_Wide_Type
+ and then Is_Interface (Etype (P))
+ and then Is_Task_Interface (Etype (P)))
then
Resolve (P);
+
else
- Error_Attr ("prefix of % attribute must be a task", P);
+ if Ada_Version >= Ada_05 then
+ Error_Attr ("prefix of % attribute must be a task or a task "
+ & "interface class-wide object", P);
+
+ else
+ Error_Attr ("prefix of % attribute must be a task", P);
+ end if;
end if;
end Check_Task_Prefix;
@@ -2793,16 +2813,28 @@ package body Sem_Attr is
if Etype (P) = Standard_Exception_Type then
Set_Etype (N, RTE (RE_Exception_Id));
+ -- Ada 2005 (AI-345): Attribute 'Identity may be applied to
+ -- task interface class-wide types.
+
elsif Is_Task_Type (Etype (P))
or else (Is_Access_Type (Etype (P))
- and then Is_Task_Type (Designated_Type (Etype (P))))
+ and then Is_Task_Type (Designated_Type (Etype (P))))
+ or else (Ada_Version >= Ada_05
+ and then Ekind (Etype (P)) = E_Class_Wide_Type
+ and then Is_Interface (Etype (P))
+ and then Is_Task_Interface (Etype (P)))
then
Resolve (P);
Set_Etype (N, RTE (RO_AT_Task_Id));
else
- Error_Attr ("prefix of % attribute must be a task or an "
- & "exception", P);
+ if Ada_Version >= Ada_05 then
+ Error_Attr ("prefix of % attribute must be an exception, a "
+ & "task or a task interface class-wide object", P);
+ else
+ Error_Attr ("prefix of % attribute must be a task or an "
+ & "exception", P);
+ end if;
end if;
-----------
@@ -2962,6 +2994,15 @@ package body Sem_Attr is
Check_E0;
Set_Etype (N, Universal_Integer);
+ ----------------------
+ -- Machine_Rounding --
+ ----------------------
+
+ when Attribute_Machine_Rounding =>
+ Check_Floating_Point_Type_1;
+ Set_Etype (N, P_Base_Type);
+ Resolve (E1, P_Base_Type);
+
--------------------
-- Machine_Rounds --
--------------------
@@ -5481,6 +5522,20 @@ package body Sem_Attr is
Fold_Uint (N, Uint_2, True);
end if;
+ ----------------------
+ -- Machine_Rounding --
+ ----------------------
+
+ -- Note: for the folding case, it is fine to treat Machine_Rounding
+ -- exactly the same way as Rounding, since this is one of the allowed
+ -- behaviors, and performance is not an issue here. It might be a bit
+ -- better to give the same result as it would give at run-time, even
+ -- though the non-determinism is certainly permitted.
+
+ when Attribute_Machine_Rounding =>
+ Fold_Ureal (N,
+ Eval_Fat.Rounding (P_Root_Type, Expr_Value_R (E1)), Static);
+
--------------------
-- Machine_Rounds --
--------------------
@@ -6243,7 +6298,6 @@ package body Sem_Attr is
end if;
Rewrite (N, New_Occurrence_Of (RTE (Id), Loc));
-
end Type_Class;
-----------------------
@@ -7685,12 +7739,19 @@ package body Sem_Attr is
return True;
end if;
- if Nam = TSS_Stream_Input then
- return Ada_Version >= Ada_05
- and then Stream_Attribute_Available (Etyp, TSS_Stream_Read);
- elsif Nam = TSS_Stream_Output then
- return Ada_Version >= Ada_05
- and then Stream_Attribute_Available (Etyp, TSS_Stream_Write);
+ -- In Ada 2005, Input can invoke Read, and Output can invoke Write
+
+ if Nam = TSS_Stream_Input
+ and then Ada_Version >= Ada_05
+ and then Stream_Attribute_Available (Etyp, TSS_Stream_Read)
+ then
+ return True;
+
+ elsif Nam = TSS_Stream_Output
+ and then Ada_Version >= Ada_05
+ and then Stream_Attribute_Available (Etyp, TSS_Stream_Write)
+ then
+ return True;
end if;
-- Case of Read and Write: check for attribute definition clause that
diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb
index a7df779f324..25a2f704a15 100644
--- a/gcc/ada/sem_case.adb
+++ b/gcc/ada/sem_case.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_case.ads b/gcc/ada/sem_case.ads
index d7c359a7215..e07e229c8f1 100644
--- a/gcc/ada/sem_case.ads
+++ b/gcc/ada/sem_case.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2002 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,8 +24,6 @@
-- --
------------------------------------------------------------------------------
-with Types; use Types;
-
-- Package containing the routines to process a list of discrete choices.
-- Such lists can occur in two different constructs: case statements and
-- record variants. We have factorized what used to be two very similar
@@ -33,6 +31,8 @@ with Types; use Types;
-- aggregate case, since issues with nested aggregates make that case
-- substantially different.
+with Types; use Types;
+
package Sem_Case is
type Choice_Bounds is record
@@ -63,10 +63,10 @@ package Sem_Case is
-- to get to the actual list of discrete choices.
with procedure Process_Empty_Choice (Choice : Node_Id);
- -- Processing to carry out for an empty Choice.
+ -- Processing to carry out for an empty Choice
with procedure Process_Non_Static_Choice (Choice : Node_Id);
- -- Processing to carry out for a non static Choice.
+ -- Processing to carry out for a non static Choice
with procedure Process_Associated_Node (A : Node_Id);
-- Associated to each case alternative, aggregate component
@@ -96,11 +96,11 @@ package Sem_Case is
-- On entry Choice_Table must be big enough to contain all the
-- discrete choices encountered.
--
- -- On exit Choice_Table contains all the static and non empty
- -- discrete choices in sorted order. Last_Choice gives the position
- -- of the last valid choice in Choice_Table, Choice_Table'First
- -- contains the first. We can have Last_Choice < Choice_Table'Last
- -- for one (or several) of the following reasons:
+ -- On exit Choice_Table contains all the static and non empty discrete
+ -- choices in sorted order. Last_Choice gives the position of the last
+ -- valid choice in Choice_Table, Choice_Table'First contains the first.
+ -- We can have Last_Choice < Choice_Table'Last for one (or several) of
+ -- the following reasons:
--
-- (a) The list of choices contained a non static choice
--
@@ -113,9 +113,9 @@ package Sem_Case is
-- In one of the bounds of a discrete choice raises a constraint
-- error the flag Raise_CE is set.
--
- -- Finally Others_Present is set to True if an Others choice is
- -- present in the list of choices, and in this case the call also
- -- sets Others_Discrete_Choices in the N_Others_Choice node.
+ -- Finally Others_Present is set to True if an Others choice is present
+ -- in the list of choices, and in this case the call also sets
+ -- Others_Discrete_Choices in the N_Others_Choice node.
end Generic_Choices_Processing;
diff --git a/gcc/ada/sem_cat.ads b/gcc/ada/sem_cat.ads
index 0792ff00fc4..7296bbe565f 100644
--- a/gcc/ada/sem_cat.ads
+++ b/gcc/ada/sem_cat.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -96,7 +96,7 @@ package Sem_Cat is
-- the checks cannot be made before knowing if the object is imported.
procedure Validate_RCI_Declarations (P : Entity_Id);
- -- Apply semantic checks given in E2.3(10-14).
+ -- Apply semantic checks given in E2.3(10-14)
procedure Validate_RCI_Subprogram_Declaration (N : Node_Id);
-- Check for RCI unit subprogram declarations with respect to
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index b752eb495aa..838e82256e7 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -95,7 +95,7 @@ package body Sem_Ch10 is
-- Verify that a stub is declared immediately within a compilation unit,
-- and not in an inner frame.
- procedure Expand_With_Clause (Nam : Node_Id; N : Node_Id);
+ procedure Expand_With_Clause (Item : Node_Id; Nam : Node_Id; N : Node_Id);
-- When a child unit appears in a context clause, the implicit withs on
-- parents are made explicit, and with clauses are inserted in the context
-- clause before the one for the child. If a parent in the with_clause
@@ -998,7 +998,7 @@ package body Sem_Ch10 is
Check_Stub_Level (N);
Nam := Current_Entity_In_Scope (Id);
- if No (Nam) or else not Is_Package (Nam) then
+ if No (Nam) or else not Is_Package_Or_Generic_Package (Nam) then
Error_Msg_N ("missing specification for package stub", N);
elsif Has_Completion (Nam)
@@ -1843,9 +1843,8 @@ package body Sem_Ch10 is
E_Name := Defining_Entity (Specification (Instance_Spec (U)));
- elsif Unit_Kind = N_Procedure_Instantiation
- or else Unit_Kind = N_Function_Instantiation
- then
+ elsif Unit_Kind in N_Subprogram_Instantiation then
+
-- Instantiation node is replaced with a package that contains
-- renaming declarations and instance itself. The subprogram
-- Instance is declared in the visible part of the wrapper package.
@@ -1953,6 +1952,13 @@ package body Sem_Ch10 is
if Private_Present (N) then
Set_Is_Immediately_Visible (E_Name, False);
end if;
+
+ -- Check for with'ing obsolescent package. Exclude subprograms here
+ -- since we will catch those on the call rather than the WITH.
+
+ if Is_Package_Or_Generic_Package (E_Name) then
+ Check_Obsolescent (E_Name, N);
+ end if;
end Analyze_With_Clause;
------------------------------
@@ -2480,13 +2486,14 @@ package body Sem_Ch10 is
-- Expand_With_Clause --
------------------------
- procedure Expand_With_Clause (Nam : Node_Id; N : Node_Id) is
+ procedure Expand_With_Clause (Item : Node_Id; Nam : Node_Id; N : Node_Id) is
Loc : constant Source_Ptr := Sloc (Nam);
Ent : constant Entity_Id := Entity (Nam);
Withn : Node_Id;
P : Node_Id;
function Build_Unit_Name (Nam : Node_Id) return Node_Id;
+ -- Comment requireed here ???
---------------------
-- Build_Unit_Name --
@@ -2523,12 +2530,20 @@ package body Sem_Ch10 is
Set_First_Name (Withn, True);
Set_Implicit_With (Withn, True);
+ -- If the unit is a package declaration, a private_with_clause on a
+ -- child unit implies that the implicit with on the parent is also
+ -- private.
+
+ if Nkind (Unit (N)) = N_Package_Declaration then
+ Set_Private_Present (Withn, Private_Present (Item));
+ end if;
+
Prepend (Withn, Context_Items (N));
Mark_Rewrite_Insertion (Withn);
Install_Withed_Unit (Withn);
if Nkind (Nam) = N_Expanded_Name then
- Expand_With_Clause (Prefix (Nam), N);
+ Expand_With_Clause (Item, Prefix (Nam), N);
end if;
New_Nodes_OK := New_Nodes_OK - 1;
@@ -2640,6 +2655,16 @@ package body Sem_Ch10 is
P_Unit := Original_Node (P_Unit);
end if;
+ -- We add the implicit with if the child unit is the current unit
+ -- being compiled. If the current unit is a body, we do not want
+ -- to add an implicit_with a second time to the corresponding spec.
+
+ if Nkind (Child_Unit) = N_Package_Declaration
+ and then Child_Unit /= Unit (Cunit (Current_Sem_Unit))
+ then
+ return;
+ end if;
+
New_Nodes_OK := New_Nodes_OK + 1;
Withn := Make_With_Clause (Loc, Name => Build_Unit_Name);
@@ -2764,7 +2789,7 @@ package body Sem_Ch10 is
if Is_Child_Spec (Decl_Node) then
if Nkind (Name (Item)) = N_Expanded_Name then
- Expand_With_Clause (Prefix (Name (Item)), N);
+ Expand_With_Clause (Item, Prefix (Name (Item)), N);
else
-- if not an expanded name, the child unit must be a
-- renaming, nothing to do.
@@ -2784,10 +2809,12 @@ package body Sem_Ch10 is
if Sloc (Library_Unit (Item)) /= No_Location then
License_Check : declare
+
+ Withu : constant Unit_Number_Type :=
+ Get_Source_Unit (Library_Unit (Item));
+
Withl : constant License_Type :=
- License (Source_Index
- (Get_Source_Unit
- (Library_Unit (Item))));
+ License (Source_Index (Withu));
Unitl : constant License_Type :=
License (Source_Index (Current_Sem_Unit));
@@ -2802,35 +2829,44 @@ package body Sem_Ch10 is
procedure License_Error is
begin
Error_Msg_N
- ("?license of with'ed unit & is incompatible",
+ ("?license of with'ed unit & may be inconsistent",
Name (Item));
end License_Error;
-- Start of processing for License_Check
begin
- case Unitl is
- when Unknown =>
- null;
+ -- Exclude license check if withed unit is an internal unit.
+ -- This situation arises e.g. with the GPL version of GNAT.
- when Restricted =>
- if Withl = GPL then
- License_Error;
- end if;
+ if Is_Internal_File_Name (Unit_File_Name (Withu)) then
+ null;
- when GPL =>
- if Withl = Restricted then
- License_Error;
- end if;
+ -- Otherwise check various cases
+ else
+ case Unitl is
+ when Unknown =>
+ null;
- when Modified_GPL =>
- if Withl = Restricted or else Withl = GPL then
- License_Error;
- end if;
+ when Restricted =>
+ if Withl = GPL then
+ License_Error;
+ end if;
- when Unrestricted =>
- null;
- end case;
+ when GPL =>
+ if Withl = Restricted then
+ License_Error;
+ end if;
+
+ when Modified_GPL =>
+ if Withl = Restricted or else Withl = GPL then
+ License_Error;
+ end if;
+
+ when Unrestricted =>
+ null;
+ end case;
+ end if;
end License_Check;
end if;
@@ -2901,10 +2937,12 @@ package body Sem_Ch10 is
begin
Lib_Spec := Unit (Library_Unit (N));
while Is_Child_Spec (Lib_Spec) loop
- P := Unit (Parent_Spec (Lib_Spec));
+ P := Unit (Parent_Spec (Lib_Spec));
+ P_Name := Defining_Entity (P);
- if not (Private_Present (Parent (Lib_Spec))) then
- P_Name := Defining_Entity (P);
+ if not (Private_Present (Parent (Lib_Spec)))
+ and then not In_Private_Part (P_Name)
+ then
Install_Private_Declarations (P_Name);
Install_Private_With_Clauses (P_Name);
Set_Use (Private_Declarations (Specification (P)));
@@ -3125,7 +3163,7 @@ package body Sem_Ch10 is
Item : Node_Id;
begin
- -- A limited with_clause can not appear in the same context_clause
+ -- A limited with_clause cannot appear in the same context_clause
-- as a nonlimited with_clause which mentions the same library.
Item := First (Context_Items (Comp_Unit));
@@ -3270,7 +3308,7 @@ package body Sem_Ch10 is
Error_Msg_N
("child of a generic package must be a generic unit", Lib_Unit);
- elsif not Is_Package (P_Name) then
+ elsif not Is_Package_Or_Generic_Package (P_Name) then
Error_Msg_N
("parent unit must be package or generic package", Lib_Unit);
raise Unrecoverable_Error;
@@ -4378,16 +4416,12 @@ package body Sem_Ch10 is
& "limited with_clauses", N);
return;
- when N_Package_Instantiation |
- N_Function_Instantiation |
- N_Procedure_Instantiation =>
+ when N_Generic_Instantiation =>
Error_Msg_N ("generic instantiations not allowed in "
& "limited with_clauses", N);
return;
- when N_Generic_Package_Renaming_Declaration |
- N_Generic_Procedure_Renaming_Declaration |
- N_Generic_Function_Renaming_Declaration =>
+ when N_Generic_Renaming_Declaration =>
Error_Msg_N ("generic renamings not allowed in "
& "limited with_clauses", N);
return;
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb
index fb73f605bbb..978c7e38e96 100644
--- a/gcc/ada/sem_ch11.adb
+++ b/gcc/ada/sem_ch11.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 05f89f65e20..470f5ed237c 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -37,6 +37,7 @@ with Lib; use Lib;
with Lib.Load; use Lib.Load;
with Lib.Xref; use Lib.Xref;
with Nlists; use Nlists;
+with Namet; use Namet;
with Nmake; use Nmake;
with Opt; use Opt;
with Rident; use Rident;
@@ -256,6 +257,10 @@ package body Sem_Ch12 is
-- The following procedures treat other kinds of formal parameters
+ procedure Analyze_Formal_Derived_Interface_Type
+ (T : Entity_Id;
+ Def : Node_Id);
+
procedure Analyze_Formal_Derived_Type
(N : Node_Id;
T : Entity_Id;
@@ -271,6 +276,7 @@ package body Sem_Ch12 is
(T : Entity_Id; Def : Node_Id);
procedure Analyze_Formal_Discrete_Type (T : Entity_Id; Def : Node_Id);
procedure Analyze_Formal_Floating_Type (T : Entity_Id; Def : Node_Id);
+ procedure Analyze_Formal_Interface_Type (T : Entity_Id; Def : Node_Id);
procedure Analyze_Formal_Signed_Integer_Type (T : Entity_Id; Def : Node_Id);
procedure Analyze_Formal_Modular_Type (T : Entity_Id; Def : Node_Id);
procedure Analyze_Formal_Ordinary_Fixed_Point_Type
@@ -390,11 +396,6 @@ package body Sem_Ch12 is
-- (component or index type of an array type) and Gen_Scope is the scope of
-- the analyzed formal array type.
- function Get_Package_Instantiation_Node (A : Entity_Id) return Node_Id;
- -- Given the entity of a unit that is an instantiation, retrieve the
- -- original instance node. This is used when loading the instantiations
- -- of the ancestors of a child generic that is being instantiated.
-
function In_Same_Declarative_Part
(F_Node : Node_Id;
Inst : Node_Id) return Boolean;
@@ -685,9 +686,14 @@ package body Sem_Ch12 is
Parent_Unit_Visible : Boolean := False;
-- Parent_Unit_Visible is used when the generic is a child unit, and
-- indicates whether the ultimate parent of the generic is visible in the
- -- instantiation environment. It is used to reset the visiblity of the
+ -- instantiation environment. It is used to reset the visibility of the
-- parent at the end of the instantiation (see Remove_Parent).
+ Instance_Parent_Unit : Entity_Id := Empty;
+ -- This records the ultimate parent unit of an instance of a generic
+ -- child unit and is used in conjunction with Parent_Unit_Visible to
+ -- indicate the unit to which the Parent_Unit_Visible flag corresponds.
+
type Instance_Env is record
Ada_Version : Ada_Version_Type;
Ada_Version_Explicit : Ada_Version_Type;
@@ -695,7 +701,8 @@ package body Sem_Ch12 is
Exchanged_Views : Elist_Id;
Hidden_Entities : Elist_Id;
Current_Sem_Unit : Unit_Number_Type;
- Parent_Unit_Visible : Boolean := False;
+ Parent_Unit_Visible : Boolean := False;
+ Instance_Parent_Unit : Entity_Id := Empty;
end record;
package Instance_Envs is new Table.Table (
@@ -1015,7 +1022,7 @@ package body Sem_Ch12 is
Instantiate_Type
(Formal, Match, Analyzed_Formal, Assoc));
- -- an instantiation is a freeze point for the actuals,
+ -- An instantiation is a freeze point for the actuals,
-- unless this is a rewritten formal package.
if Nkind (I_Node) /= N_Formal_Package_Declaration then
@@ -1299,6 +1306,26 @@ package body Sem_Ch12 is
Check_Restriction (No_Fixed_Point, Def);
end Analyze_Formal_Decimal_Fixed_Point_Type;
+ -------------------------------------------
+ -- Analyze_Formal_Derived_Interface_Type --
+ -------------------------------------------
+
+ procedure Analyze_Formal_Derived_Interface_Type
+ (T : Entity_Id;
+ Def : Node_Id)
+ is
+ begin
+ Enter_Name (T);
+ Set_Ekind (T, E_Record_Type);
+ Set_Etype (T, T);
+ Analyze (Subtype_Indication (Def));
+ Analyze_Interface_Declaration (T, Def);
+ Make_Class_Wide_Type (T);
+ Set_Primitive_Operations (T, New_Elmt_List);
+ Analyze_List (Interface_List (Def));
+ Collect_Interfaces (Def, T);
+ end Analyze_Formal_Derived_Interface_Type;
+
---------------------------------
-- Analyze_Formal_Derived_Type --
---------------------------------
@@ -1452,6 +1479,20 @@ package body Sem_Ch12 is
Check_Restriction (No_Floating_Point, Def);
end Analyze_Formal_Floating_Type;
+ -----------------------------------
+ -- Analyze_Formal_Interface_Type;--
+ -----------------------------------
+
+ procedure Analyze_Formal_Interface_Type (T : Entity_Id; Def : Node_Id) is
+ begin
+ Enter_Name (T);
+ Set_Ekind (T, E_Record_Type);
+ Set_Etype (T, T);
+ Analyze_Interface_Declaration (T, Def);
+ Make_Class_Wide_Type (T);
+ Set_Primitive_Operations (T, New_Elmt_List);
+ end Analyze_Formal_Interface_Type;
+
---------------------------------
-- Analyze_Formal_Modular_Type --
---------------------------------
@@ -1630,6 +1671,12 @@ package body Sem_Ch12 is
Check_Generic_Child_Unit (Gen_Id, Parent_Installed);
Gen_Unit := Entity (Gen_Id);
+ -- Check for a formal package that is a package renaming
+
+ if Present (Renamed_Object (Gen_Unit)) then
+ Gen_Unit := Renamed_Object (Gen_Unit);
+ end if;
+
if Ekind (Gen_Unit) /= E_Generic_Package then
Error_Msg_N ("expect generic package name", Gen_Id);
Restore_Env;
@@ -1664,12 +1711,6 @@ package body Sem_Ch12 is
end if;
end if;
- -- Check for a formal package that is a package renaming
-
- if Present (Renamed_Object (Gen_Unit)) then
- Gen_Unit := Renamed_Object (Gen_Unit);
- end if;
-
-- The formal package is treated like a regular instance, but only
-- the specification needs to be instantiated, to make entities visible.
@@ -1703,6 +1744,7 @@ package body Sem_Ch12 is
(Original_Node (Gen_Decl), Empty, Instantiating => True);
Rewrite (N, New_N);
Set_Defining_Unit_Name (Specification (New_N), Formal);
+ Set_Generic_Parent (Specification (N), Gen_Unit);
Set_Instance_Env (Gen_Unit, Formal);
Enter_Name (Formal);
@@ -1760,10 +1802,9 @@ package body Sem_Ch12 is
-- instantiation, the defining_unit_name we need is in the
-- new tree and not in the original. (see Package_Instantiation).
-- A generic formal package is an instance, and can be used as
- -- an actual for an inner instance. Mark its generic parent.
+ -- an actual for an inner instance.
Set_Ekind (Formal, E_Package);
- Set_Generic_Parent (Specification (N), Gen_Unit);
Set_Has_Completion (Formal, True);
Set_Ekind (Pack_Id, E_Package);
@@ -2043,6 +2084,15 @@ package body Sem_Ch12 is
N_Access_Procedure_Definition =>
Analyze_Generic_Access_Type (T, Def);
+ -- Ada 2005: a interface declaration is encoded as an abstract
+ -- record declaration or a abstract type derivation.
+
+ when N_Record_Definition =>
+ Analyze_Formal_Interface_Type (T, Def);
+
+ when N_Derived_Type_Definition =>
+ Analyze_Formal_Derived_Interface_Type (T, Def);
+
when N_Error =>
null;
@@ -2655,6 +2705,19 @@ package body Sem_Ch12 is
then
Inline_Now := True;
end if;
+
+ -- If the current scope is itself an instance within a child
+ -- unit, and that unit itself is not an instance, it is
+ -- duplicated in the scope stack, and the unstacking mechanism
+ -- in Inline_Instance_Body will fail. This loses some rare
+ -- cases of optimization, and might be improved some day ????
+
+ if Is_Generic_Instance (Current_Scope)
+ and then Is_Child_Unit (Scope (Current_Scope))
+ and then not Is_Generic_Instance (Scope (Current_Scope))
+ then
+ Inline_Now := False;
+ end if;
end if;
Needs_Body :=
@@ -2856,6 +2919,7 @@ package body Sem_Ch12 is
Set_Unit (Parent (N), Act_Decl);
Set_Parent_Spec (Act_Decl, Parent_Spec (N));
+ Set_Package_Instantiation (Act_Decl_Id, N);
Analyze (Act_Decl);
Set_Unit (Parent (N), N);
Set_Body_Required (Parent (N), False);
@@ -2974,23 +3038,29 @@ package body Sem_Ch12 is
S : Entity_Id;
begin
- -- Case of generic unit defined in another unit. We must remove
- -- the complete context of the current unit to install that of
- -- the generic.
+ -- Case of generic unit defined in another unit. We must remove the
+ -- complete context of the current unit to install that of the generic.
if Gen_Comp /= Cunit_Entity (Current_Sem_Unit) then
- S := Current_Scope;
- while Present (S)
- and then S /= Standard_Standard
- loop
- Num_Scopes := Num_Scopes + 1;
+ -- Add some comments for the following two loops ???
- Use_Clauses (Num_Scopes) :=
- (Scope_Stack.Table
- (Scope_Stack.Last - Num_Scopes + 1).
- First_Use_Clause);
- End_Use_Clauses (Use_Clauses (Num_Scopes));
+ S := Current_Scope;
+ while Present (S) and then S /= Standard_Standard loop
+ loop
+ Num_Scopes := Num_Scopes + 1;
+
+ Use_Clauses (Num_Scopes) :=
+ (Scope_Stack.Table
+ (Scope_Stack.Last - Num_Scopes + 1).
+ First_Use_Clause);
+ End_Use_Clauses (Use_Clauses (Num_Scopes));
+
+ exit when Scope_Stack.Last - Num_Scopes + 1 = Scope_Stack.First
+ or else Scope_Stack.Table
+ (Scope_Stack.Last - Num_Scopes).Entity
+ = Scope (S);
+ end loop;
exit when Is_Generic_Instance (S)
and then (In_Package_Body (S)
@@ -3018,12 +3088,12 @@ package body Sem_Ch12 is
S := Scope (S);
end loop;
- -- Remove context of current compilation unit, unless we
- -- are within a nested package instantiation, in which case
- -- the context has been removed previously.
+ -- Remove context of current compilation unit, unless we are within a
+ -- nested package instantiation, in which case the context has been
+ -- removed previously.
- -- If current scope is the body of a child unit, remove context
- -- of spec as well.
+ -- If current scope is the body of a child unit, remove context of
+ -- spec as well.
S := Current_Scope;
@@ -3046,7 +3116,7 @@ package body Sem_Ch12 is
Removed := True;
-- Remove entities in current scopes from visibility, so
- -- than instance body is compiled in a clean environment.
+ -- that instance body is compiled in a clean environment.
Save_Scope_Stack (Handle_Use => False);
@@ -3077,6 +3147,7 @@ package body Sem_Ch12 is
S := Scope (S);
end loop;
+ pragma Assert (Num_Inner < Num_Scopes);
New_Scope (Standard_Standard);
Scope_Stack.Table (Scope_Stack.Last).Is_Active_Stack_Base := True;
@@ -4301,8 +4372,18 @@ package body Sem_Ch12 is
Instance_Decl : Node_Id;
begin
- Enclosing_Instance := Current_Scope;
+ -- We do not inline any call that contains instantiations, except
+ -- for instantiations of Unchecked_Conversion, so if we are within
+ -- an inlined body the current instance does not require parents.
+
+ if In_Inlined_Body then
+ pragma Assert (Chars (Gen_Id) = Name_Unchecked_Conversion);
+ return False;
+ end if;
+
+ -- Loop to check enclosing scopes
+ Enclosing_Instance := Current_Scope;
while Present (Enclosing_Instance) loop
Instance_Decl := Unit_Declaration_Node (Enclosing_Instance);
@@ -5755,6 +5836,24 @@ package body Sem_Ch12 is
Inst : Node_Id;
begin
+ -- If the Package_Instantiation attribute has been set on the package
+ -- entity, then use it directly when it (or its Original_Node) refers
+ -- to an N_Package_Instantiation node. In principle it should be
+ -- possible to have this field set in all cases, which should be
+ -- investigated, and would allow this function to be significantly
+ -- simplified. ???
+
+ if Present (Package_Instantiation (A)) then
+ if Nkind (Package_Instantiation (A)) = N_Package_Instantiation then
+ return Package_Instantiation (A);
+
+ elsif Nkind (Original_Node (Package_Instantiation (A)))
+ = N_Package_Instantiation
+ then
+ return Original_Node (Package_Instantiation (A));
+ end if;
+ end if;
+
-- If the instantiation is a compilation unit that does not need a
-- body then the instantiation node has been rewritten as a package
-- declaration for the instance, and we return the original node.
@@ -5880,6 +5979,7 @@ package body Sem_Ch12 is
Saved.Hidden_Entities := Hidden_Entities;
Saved.Current_Sem_Unit := Current_Sem_Unit;
Saved.Parent_Unit_Visible := Parent_Unit_Visible;
+ Saved.Instance_Parent_Unit := Instance_Parent_Unit;
Instance_Envs.Increment_Last;
Instance_Envs.Table (Instance_Envs.Last) := Saved;
@@ -6308,16 +6408,43 @@ package body Sem_Ch12 is
Specification (Unit_Declaration_Node (Par));
begin
- if not Is_Child_Unit (Par) then
+ -- If this parent of the child instance is a top-level unit,
+ -- then record the unit and its visibility for later resetting
+ -- in Remove_Parent. We exclude units that are generic instances,
+ -- as we only want to record this information for the ultimate
+ -- top-level noninstance parent (is that always correct???).
+
+ if Scope (Par) = Standard_Standard
+ and then not Is_Generic_Instance (Par)
+ then
Parent_Unit_Visible := Is_Immediately_Visible (Par);
- end if;
+ Instance_Parent_Unit := Par;
+ end if;
+
+ -- Open the parent scope and make it and its declarations visible.
+ -- If this point is not within a body, then only the visible
+ -- declarations should be made visible, and installation of the
+ -- private declarations is deferred until the appropriate point
+ -- within analysis of the spec being instantiated (see the handling
+ -- of parent visibility in Analyze_Package_Specification). This is
+ -- relaxed in the case where the parent unit is Ada.Tags, to avoid
+ -- private view problems that occur when compiling instantiations of
+ -- a generic child of that package (Generic_Dispatching_Constructor).
+ -- If the instance freezes a tagged type, inlinings of operations
+ -- from Ada.Tags may need the full view of type Tag. If inlining
+ -- took proper account of establishing visibility of inlined
+ -- subprograms' parents then it should be possible to remove this
+ -- special check. ???
New_Scope (Par);
Set_Is_Immediately_Visible (Par);
Install_Visible_Declarations (Par);
- Install_Private_Declarations (Par);
Set_Use (Visible_Declarations (Spec));
- Set_Use (Private_Declarations (Spec));
+
+ if In_Body or else Is_RTU (Par, Ada_Tags) then
+ Install_Private_Declarations (Par);
+ Set_Use (Private_Declarations (Spec));
+ end if;
end Install_Spec;
-- Start of processing for Install_Parent
@@ -6682,9 +6809,13 @@ package body Sem_Ch12 is
while Present (E1)
and then E1 /= First_Private_Entity (Form)
loop
+ -- Could this test be a single condition???
+ -- Seems like it could, and isn't FPE (Form) a constant anyway???
+
if not Is_Internal (E1)
- and then not Is_Class_Wide_Type (E1)
and then Present (Parent (E1))
+ and then not Is_Class_Wide_Type (E1)
+ and then not Is_Internal_Name (Chars (E1))
then
while Present (E2)
and then Chars (E2) /= Chars (E1)
@@ -7941,6 +8072,8 @@ package body Sem_Ch12 is
procedure Validate_Access_Subprogram_Instance;
procedure Validate_Access_Type_Instance;
procedure Validate_Derived_Type_Instance;
+ procedure Validate_Derived_Interface_Type_Instance;
+ procedure Validate_Interface_Type_Instance;
procedure Validate_Private_Type_Instance;
-- These procedures perform validation tests for the named case
@@ -8177,6 +8310,44 @@ package body Sem_Ch12 is
end Validate_Array_Type_Instance;
+ -----------------------------------------------
+ -- Validate_Derived_Interface_Type_Instance --
+ -----------------------------------------------
+
+ procedure Validate_Derived_Interface_Type_Instance is
+ Par : constant Entity_Id := Entity (Subtype_Indication (Def));
+ Elmt : Elmt_Id;
+
+ begin
+ -- First apply interface instance checks
+
+ Validate_Interface_Type_Instance;
+
+ -- Verify that immediate parent interface is an ancestor of
+ -- the actual.
+
+ if Present (Par)
+ and then not Interface_Present_In_Ancestor (Act_T, Par)
+ then
+ Error_Msg_NE
+ ("interface actual must include progenitor&", Actual, Par);
+ end if;
+
+ -- Now verify that the actual includes all other ancestors of
+ -- the formal.
+
+ Elmt := First_Elmt (Abstract_Interfaces (A_Gen_T));
+ while Present (Elmt) loop
+ if not Interface_Present_In_Ancestor (Act_T, Node (Elmt)) then
+ Error_Msg_NE
+ ("interface actual must include progenitor&",
+ Actual, Node (Elmt));
+ end if;
+
+ Next_Elmt (Elmt);
+ end loop;
+ end Validate_Derived_Interface_Type_Instance;
+
------------------------------------
-- Validate_Derived_Type_Instance --
------------------------------------
@@ -8186,18 +8357,18 @@ package body Sem_Ch12 is
Ancestor_Discr : Entity_Id;
begin
- -- If the parent type in the generic declaration is itself
- -- a previous formal type, then it is local to the generic
- -- and absent from the analyzed generic definition. In that
- -- case the ancestor is the instance of the formal (which must
- -- have been instantiated previously), unless the ancestor is
- -- itself a formal derived type. In this latter case (which is the
- -- subject of Corrigendum 8652/0038 (AI-202) the ancestor of the
- -- formals is the ancestor of its parent. Otherwise, the analyzed
- -- generic carries the parent type. If the parent type is defined
- -- in a previous formal package, then the scope of that formal
- -- package is that of the generic type itself, and it has already
- -- been mapped into the corresponding type in the actual package.
+ -- If the parent type in the generic declaration is itself a previous
+ -- formal type, then it is local to the generic and absent from the
+ -- analyzed generic definition. In that case the ancestor is the
+ -- instance of the formal (which must have been instantiated
+ -- previously), unless the ancestor is itself a formal derived type.
+ -- In this latter case (which is the subject of Corrigendum 8652/0038
+ -- (AI-202) the ancestor of the formals is the ancestor of its
+ -- parent. Otherwise, the analyzed generic carries the parent type.
+ -- If the parent type is defined in a previous formal package, then
+ -- the scope of that formal package is that of the generic type
+ -- itself, and it has already been mapped into the corresponding type
+ -- in the actual package.
-- Common case: parent type defined outside of the generic
@@ -8396,6 +8567,33 @@ package body Sem_Ch12 is
end if;
end Validate_Derived_Type_Instance;
+ --------------------------------------
+ -- Validate_Interface_Type_Instance --
+ --------------------------------------
+
+ procedure Validate_Interface_Type_Instance is
+ begin
+ if not Is_Interface (Act_T) then
+ Error_Msg_NE
+ ("actual for formal interface type must be an interface",
+ Actual, Gen_T);
+
+ elsif Is_Limited_Type (Act_T) /= Is_Limited_Type (A_Gen_T)
+ or else
+ Is_Task_Interface (A_Gen_T) /= Is_Task_Interface (Act_T)
+ or else
+ Is_Protected_Interface (A_Gen_T) /=
+ Is_Protected_Interface (Act_T)
+ or else
+ Is_Synchronized_Interface (A_Gen_T) /=
+ Is_Synchronized_Interface (Act_T)
+ then
+ Error_Msg_NE
+ ("actual for interface& does not match ('R'M 12.5.5(5))",
+ Actual, Gen_T);
+ end if;
+ end Validate_Interface_Type_Instance;
+
------------------------------------
-- Validate_Private_Type_Instance --
------------------------------------
@@ -8661,6 +8859,12 @@ package body Sem_Ch12 is
N_Access_Procedure_Definition =>
Validate_Access_Subprogram_Instance;
+ when N_Record_Definition =>
+ Validate_Interface_Type_Instance;
+
+ when N_Derived_Type_Definition =>
+ Validate_Derived_Interface_Type_Instance;
+
when others =>
raise Program_Error;
@@ -9116,12 +9320,16 @@ package body Sem_Ch12 is
Install_Private_Declarations (P);
end if;
- -- If the ultimate parent is a compilation unit, reset its
- -- visibility to what it was before instantiation.
+ -- If the ultimate parent is a top-level unit recorded in
+ -- Instance_Parent_Unit, then reset its visibility to what
+ -- it was before instantiation. (It's not clear what the
+ -- purpose is of testing whether Scope (P) is In_Open_Scopes,
+ -- but that test was present before the ultimate parent test
+ -- was added.???)
elsif not In_Open_Scopes (Scope (P))
- or else
- (not Is_Child_Unit (P) and then not Parent_Unit_Visible)
+ or else (P = Instance_Parent_Unit
+ and then not Parent_Unit_Visible)
then
Set_Is_Immediately_Visible (P, False);
end if;
@@ -9175,6 +9383,7 @@ package body Sem_Ch12 is
Hidden_Entities := Saved.Hidden_Entities;
Current_Sem_Unit := Saved.Current_Sem_Unit;
Parent_Unit_Visible := Saved.Parent_Unit_Visible;
+ Instance_Parent_Unit := Saved.Instance_Parent_Unit;
Instance_Envs.Decrement_Last;
end Restore_Env;
@@ -9584,9 +9793,7 @@ package body Sem_Ch12 is
Set_Etype (N, Empty);
end if;
- if (Nkind (Parent (N)) = N_Package_Instantiation
- or else Nkind (Parent (N)) = N_Function_Instantiation
- or else Nkind (Parent (N)) = N_Procedure_Instantiation)
+ if Nkind (Parent (N)) in N_Generic_Instantiation
and then N = Name (Parent (N))
then
Save_Global_Defaults (Parent (N), Parent (N2));
@@ -9595,7 +9802,6 @@ package body Sem_Ch12 is
elsif Nkind (Parent (N)) = N_Selected_Component
and then Nkind (Parent (N2)) = N_Expanded_Name
then
-
if Is_Global (Entity (Parent (N2))) then
Change_Selected_Component_To_Expanded_Name (Parent (N));
Set_Associated_Node (Parent (N), Parent (N2));
@@ -9626,11 +9832,7 @@ package body Sem_Ch12 is
end if;
end if;
- if (Nkind (Parent (Parent (N))) = N_Package_Instantiation
- or else Nkind (Parent (Parent (N)))
- = N_Function_Instantiation
- or else Nkind (Parent (Parent (N)))
- = N_Procedure_Instantiation)
+ if Nkind (Parent (Parent (N))) in N_Generic_Instantiation
and then Parent (N) = Name (Parent (Parent (N)))
then
Save_Global_Defaults
@@ -10054,6 +10256,11 @@ package body Sem_Ch12 is
else
declare
+ Loc : constant Source_Ptr := Sloc (N);
+ Qual : Node_Id := Empty;
+ Typ : Entity_Id := Empty;
+ Nam : Node_Id;
+
use Atree.Unchecked_Access;
-- This code section is part of implementing an untyped tree
-- traversal, so it needs direct access to node fields.
@@ -10065,11 +10272,66 @@ package body Sem_Ch12 is
then
N2 := Get_Associated_Node (N);
+ if No (N2) then
+ Typ := Empty;
+ else
+ Typ := Etype (N2);
+
+ -- In an instance within a generic, use the name of
+ -- the actual and not the original generic parameter.
+ -- If the actual is global in the current generic it
+ -- must be preserved for its instantiation.
+
+ if Nkind (Parent (Typ)) = N_Subtype_Declaration
+ and then
+ Present (Generic_Parent_Type (Parent (Typ)))
+ then
+ Typ := Base_Type (Typ);
+ Set_Etype (N2, Typ);
+ end if;
+ end if;
+
if No (N2)
- or else No (Etype (N2))
- or else not Is_Global (Etype (N2))
+ or else No (Typ)
+ or else not Is_Global (Typ)
then
Set_Associated_Node (N, Empty);
+
+ -- If the aggregate is an actual in a call, it has been
+ -- resolved in the current context, to some local type.
+ -- The enclosing call may have been disambiguated by
+ -- the aggregate, and this disambiguation might fail at
+ -- instantiation time because the type to which the
+ -- aggregate did resolve is not preserved. In order to
+ -- preserve some of this information, we wrap the
+ -- aggregate in a qualified expression, using the id of
+ -- its type. For further disambiguation we qualify the
+ -- type name with its scope (if visible) because both
+ -- id's will have corresponding entities in an instance.
+ -- This resolves most of the problems with missing type
+ -- information on aggregates in instances.
+
+ if Nkind (N2) = Nkind (N)
+ and then
+ (Nkind (Parent (N2)) = N_Procedure_Call_Statement
+ or else Nkind (Parent (N2)) = N_Function_Call)
+ and then Comes_From_Source (Typ)
+ then
+ if Is_Immediately_Visible (Scope (Typ)) then
+ Nam := Make_Selected_Component (Loc,
+ Prefix =>
+ Make_Identifier (Loc, Chars (Scope (Typ))),
+ Selector_Name =>
+ Make_Identifier (Loc, Chars (Typ)));
+ else
+ Nam := Make_Identifier (Loc, Chars (Typ));
+ end if;
+
+ Qual :=
+ Make_Qualified_Expression (Loc,
+ Subtype_Mark => Nam,
+ Expression => Relocate_Node (N));
+ end if;
end if;
Save_Global_Descendant (Field1 (N));
@@ -10077,6 +10339,10 @@ package body Sem_Ch12 is
Save_Global_Descendant (Field3 (N));
Save_Global_Descendant (Field5 (N));
+ if Present (Qual) then
+ Rewrite (N, Qual);
+ end if;
+
-- All other cases than aggregates
else
diff --git a/gcc/ada/sem_ch12.ads b/gcc/ada/sem_ch12.ads
index f1ea2f73b9a..f9634bdff65 100644
--- a/gcc/ada/sem_ch12.ads
+++ b/gcc/ada/sem_ch12.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -39,7 +39,7 @@ package Sem_Ch12 is
procedure Analyze_Formal_Package (N : Node_Id);
procedure Start_Generic;
- -- Must be invoked before starting to process a generic spec or body.
+ -- Must be invoked before starting to process a generic spec or body
procedure End_Generic;
-- Must be invoked just at the end of the end of the processing of a
@@ -70,6 +70,11 @@ package Sem_Ch12 is
-- Retrieve actual associated with given generic parameter.
-- If A is uninstantiated or not a generic parameter, return A.
+ function Get_Package_Instantiation_Node (A : Entity_Id) return Node_Id;
+ -- Given the entity of a unit that is an instantiation, retrieve the
+ -- original instance node. This is used when loading the instantiations
+ -- of the ancestors of a child generic that is being instantiated.
+
procedure Instantiate_Package_Body
(Body_Info : Pending_Body_Info;
Inlined_Body : Boolean := False);
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index adefc6a4b59..a799427e013 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -171,14 +171,6 @@ package body Sem_Ch3 is
-- False is for an implicit derived full type for a type derived from a
-- private type (see Build_Derived_Type).
- procedure Collect_Interfaces
- (N : Node_Id;
- Derived_Type : Entity_Id);
- -- Ada 2005 (AI-251): Subsidiary procedure to Build_Derived_Record_Type.
- -- Collect the list of interfaces that are not already implemented by the
- -- ancestors. This is the list of interfaces for which we must provide
- -- additional tag components.
-
procedure Complete_Subprograms_Derivation
(Partial_View : Entity_Id;
Derived_Type : Entity_Id);
@@ -799,6 +791,20 @@ package body Sem_Ch3 is
Set_Has_Delayed_Freeze (Current_Scope);
end if;
+ -- Ada 2005: if the designated type is an interface that may contain
+ -- tasks, create a Master entity for the declaration. This must be done
+ -- before expansion of the full declaration, because the declaration
+ -- may include an expression that is an allocator, whose expansion needs
+ -- the proper Master for the created tasks.
+
+ if Nkind (Related_Nod) = N_Object_Declaration
+ and then Expander_Active
+ and then Is_Interface (Desig_Type)
+ and then Is_Limited_Record (Desig_Type)
+ then
+ Build_Class_Wide_Master (Anon_Type);
+ end if;
+
return Anon_Type;
end Access_Definition;
@@ -985,6 +991,10 @@ package body Sem_Ch3 is
then
Error_Msg_N
("access type cannot designate its own classwide type", S);
+
+ -- Clean up indication of tagged status to prevent cascaded errors
+
+ Set_Is_Tagged_Type (T, False);
end if;
Set_Etype (T, T);
@@ -1584,6 +1594,33 @@ package body Sem_Ch3 is
Set_Is_Pure (T, F);
end Analyze_Incomplete_Type_Decl;
+ -----------------------------------
+ -- Analyze_Interface_Declaration --
+ -----------------------------------
+
+ procedure Analyze_Interface_Declaration (T : Entity_Id; Def : Node_Id) is
+ begin
+ Set_Is_Tagged_Type (T);
+
+ Set_Is_Limited_Record (T, Limited_Present (Def)
+ or else Task_Present (Def)
+ or else Protected_Present (Def)
+ or else Synchronized_Present (Def));
+
+ -- Type is abstract if full declaration carries keyword, or if
+ -- previous partial view did.
+
+ Set_Is_Abstract (T);
+ Set_Is_Interface (T);
+
+ Set_Is_Limited_Interface (T, Limited_Present (Def));
+ Set_Is_Protected_Interface (T, Protected_Present (Def));
+ Set_Is_Synchronized_Interface (T, Synchronized_Present (Def));
+ Set_Is_Task_Interface (T, Task_Present (Def));
+ Set_Abstract_Interfaces (T, New_Elmt_List);
+ Set_Primitive_Operations (T, New_Elmt_List);
+ end Analyze_Interface_Declaration;
+
-----------------------------
-- Analyze_Itype_Reference --
-----------------------------
@@ -1958,7 +1995,7 @@ package body Sem_Ch3 is
if Constant_Present (N)
and then No (E)
then
- if not Is_Package (Current_Scope) then
+ if not Is_Package_Or_Generic_Package (Current_Scope) then
Error_Msg_N
("invalid context for deferred constant declaration ('R'M 7.4)",
N);
@@ -2589,7 +2626,7 @@ package body Sem_Ch3 is
return;
end if;
- if (not Is_Package (Current_Scope)
+ if (not Is_Package_Or_Generic_Package (Current_Scope)
and then Nkind (Parent (N)) /= N_Generic_Subprogram_Declaration)
or else In_Private_Part (Current_Scope)
@@ -3011,6 +3048,51 @@ package body Sem_Ch3 is
or else
In_Package_Body (Current_Scope));
+ procedure Check_Ops_From_Incomplete_Type;
+ -- If there is a tagged incomplete partial view of the type, transfer
+ -- its operations to the full view, and indicate that the type of the
+ -- controlling parameter (s) is this full view.
+
+ ------------------------------------
+ -- Check_Ops_From_Incomplete_Type --
+ ------------------------------------
+
+ procedure Check_Ops_From_Incomplete_Type is
+ Elmt : Elmt_Id;
+ Formal : Entity_Id;
+ Op : Entity_Id;
+
+ begin
+ if Prev /= T
+ and then Ekind (Prev) = E_Incomplete_Type
+ and then Is_Tagged_Type (Prev)
+ and then Is_Tagged_Type (T)
+ then
+ Elmt := First_Elmt (Primitive_Operations (Prev));
+ while Present (Elmt) loop
+ Op := Node (Elmt);
+ Prepend_Elmt (Op, Primitive_Operations (T));
+
+ Formal := First_Formal (Op);
+ while Present (Formal) loop
+ if Etype (Formal) = Prev then
+ Set_Etype (Formal, T);
+ end if;
+
+ Next_Formal (Formal);
+ end loop;
+
+ if Etype (Op) = Prev then
+ Set_Etype (Op, T);
+ end if;
+
+ Next_Elmt (Elmt);
+ end loop;
+ end if;
+ end Check_Ops_From_Incomplete_Type;
+
+ -- Start of processing for Analyze_Type_Declaration
+
begin
Prev := Find_Type_Name (N);
@@ -3149,6 +3231,7 @@ package body Sem_Ch3 is
-- Some common processing for all types
Set_Depends_On_Private (T, Has_Private_Component (T));
+ Check_Ops_From_Incomplete_Type;
-- Both the declared entity, and its anonymous base type if one
-- was created, need freeze nodes allocated.
@@ -3787,7 +3870,8 @@ package body Sem_Ch3 is
if Number_Dimensions (Parent_Type) = 1
and then not Is_Limited_Type (Parent_Type)
and then not Is_Derived_Type (Parent_Type)
- and then not Is_Package (Scope (Base_Type (Parent_Type)))
+ and then not Is_Package_Or_Generic_Package
+ (Scope (Base_Type (Parent_Type)))
then
if not Is_Constrained (Parent_Type)
and then Is_Constrained (Derived_Type)
@@ -4438,6 +4522,7 @@ package body Sem_Ch3 is
Full_Decl := New_Copy_Tree (N);
Full_Der := New_Copy (Derived_Type);
Set_Comes_From_Source (Full_Decl, False);
+ Set_Comes_From_Source (Full_Der, False);
Insert_After (N, Full_Decl);
@@ -4493,8 +4578,18 @@ package body Sem_Ch3 is
-- view, the completion does not derive them anew.
if not Is_Tagged_Type (Parent_Type) then
- Build_Derived_Record_Type
- (Full_Decl, Parent_Type, Full_Der, False);
+
+ -- If the parent is itself derived from another private type,
+ -- installing the private declarations has not affected its
+ -- privacy status, so use its own full view explicitly.
+
+ if Is_Private_Type (Parent_Type) then
+ Build_Derived_Record_Type
+ (Full_Decl, Full_View (Parent_Type), Full_Der, False);
+ else
+ Build_Derived_Record_Type
+ (Full_Decl, Parent_Type, Full_Der, False);
+ end if;
else
-- If full view of parent is tagged, the completion
@@ -5895,113 +5990,37 @@ package body Sem_Ch3 is
Collect_Interfaces (Type_Definition (N), Derived_Type);
end if;
- -- Check that the full view and the partial view agree
- -- in the set of implemented interfaces
+ -- Ada 2005 (AI-251): The progenitor types specified in a private
+ -- extension declaration and the progenitor types specified in the
+ -- corresponding declaration of a record extension given in the
+ -- private part need not be the same; the only requirement is that
+ -- the private extension must be descended from each interface
+ -- from which the record extension is descended (AARM 7.3, 20.1/2)
- if Has_Private_Declaration (Derived_Type)
- and then Present (Abstract_Interfaces (Derived_Type))
- and then not Is_Empty_Elmt_List
- (Abstract_Interfaces (Derived_Type))
- then
+ if Has_Private_Declaration (Derived_Type) then
declare
N_Partial : constant Node_Id := Parent (Tagged_Partial_View);
- N_Full : constant Node_Id := Parent (Derived_Type);
-
- Iface_Partial : Entity_Id;
- Iface_Full : Entity_Id;
- Num_Ifaces_Partial : Natural := 0;
- Num_Ifaces_Full : Natural := 0;
- Same_Interfaces : Boolean := True;
+ Iface_Partial : Entity_Id;
begin
- if Nkind (N_Partial) /= N_Private_Extension_Declaration then
- Error_Msg_N
- ("(Ada 2005) interfaces only allowed in private"
- & " extension declarations", N_Partial);
- end if;
-
- -- Count the interfaces implemented by the partial view
-
if Nkind (N_Partial) = N_Private_Extension_Declaration
and then not Is_Empty_List (Interface_List (N_Partial))
then
Iface_Partial := First (Interface_List (N_Partial));
- while Present (Iface_Partial) loop
- Num_Ifaces_Partial := Num_Ifaces_Partial + 1;
- Next (Iface_Partial);
- end loop;
- end if;
-
- -- Take into account the case in which the partial
- -- view is a directly derived from an interface
-
- if Is_Interface (Etype
- (Defining_Identifier (N_Partial)))
- then
- Num_Ifaces_Partial := Num_Ifaces_Partial + 1;
- end if;
-
- -- Count the interfaces implemented by the full view
-
- if not Is_Empty_List (Interface_List
- (Type_Definition (N_Full)))
- then
- Iface_Full := First (Interface_List
- (Type_Definition (N_Full)));
- while Present (Iface_Full) loop
- Num_Ifaces_Full := Num_Ifaces_Full + 1;
- Next (Iface_Full);
- end loop;
- end if;
-
- -- Take into account the case in which the full
- -- view is a directly derived from an interface
-
- if Is_Interface (Etype
- (Defining_Identifier (N_Full)))
- then
- Num_Ifaces_Full := Num_Ifaces_Full + 1;
- end if;
-
- if Num_Ifaces_Full > 0
- and then Num_Ifaces_Full = Num_Ifaces_Partial
- then
- -- Check that the full-view and the private-view have
- -- the same list of interfaces.
-
- Iface_Full := First (Interface_List
- (Type_Definition (N_Full)));
- while Present (Iface_Full) loop
- Iface_Partial := First (Interface_List (N_Partial));
- while Present (Iface_Partial)
- and then Etype (Iface_Partial) /= Etype (Iface_Full)
- loop
- Next (Iface_Partial);
- end loop;
- -- If not found we check if the partial view is a
- -- direct derivation of the interface.
-
- if not Present (Iface_Partial)
- and then
- Etype (Tagged_Partial_View) /= Etype (Iface_Full)
+ while Present (Iface_Partial) loop
+ if not Interface_Present_In_Ancestor
+ (Derived_Type, Etype (Iface_Partial))
then
- Same_Interfaces := False;
+ Error_Msg_N
+ ("(Ada 2005) full type and private extension must"
+ & " have the same progenitors", Derived_Type);
exit;
end if;
- Next (Iface_Full);
+ Next (Iface_Partial);
end loop;
end if;
-
- if Num_Ifaces_Partial /= Num_Ifaces_Full
- or else not Same_Interfaces
- then
- Error_Msg_N
- ("(Ada 2005) full declaration and private declaration"
- & " must have the same list of interfaces",
- Derived_Type);
- end if;
end;
end if;
end if;
@@ -6132,7 +6151,14 @@ package body Sem_Ch3 is
E : Entity_Id;
begin
- E := Derived_Type;
+ -- Handle private types
+
+ if Present (Full_View (Derived_Type)) then
+ E := Full_View (Derived_Type);
+ else
+ E := Derived_Type;
+ end if;
+
loop
if Is_Interface (E)
or else (Present (Abstract_Interfaces (E))
@@ -6145,11 +6171,22 @@ package body Sem_Ch3 is
exit when Etype (E) = E
+ -- Handle private types
+
+ or else (Present (Full_View (Etype (E)))
+ and then Full_View (Etype (E)) = E)
+
-- Protect the frontend against wrong source
or else Etype (E) = Derived_Type;
- E := Etype (E);
+ -- Climb to the ancestor type handling private types
+
+ if Present (Full_View (Etype (E))) then
+ E := Full_View (Etype (E));
+ else
+ E := Etype (E);
+ end if;
end loop;
end;
end if;
@@ -6168,7 +6205,7 @@ package body Sem_Ch3 is
if Present (Tagged_Partial_View) then
Derive_Subprograms
- (Parent_Type, Derived_Type, Predefined_Prims_Only => True);
+ (Parent_Type, Derived_Type);
Complete_Subprograms_Derivation
(Partial_View => Tagged_Partial_View,
@@ -6452,10 +6489,11 @@ package body Sem_Ch3 is
then
CR_Disc := Make_Defining_Identifier (Sloc (Discrim), Chars (Discrim));
- Set_Ekind (CR_Disc, E_In_Parameter);
- Set_Mechanism (CR_Disc, Default_Mechanism);
- Set_Etype (CR_Disc, Etype (Discrim));
- Set_CR_Discriminant (Discrim, CR_Disc);
+ Set_Ekind (CR_Disc, E_In_Parameter);
+ Set_Mechanism (CR_Disc, Default_Mechanism);
+ Set_Etype (CR_Disc, Etype (Discrim));
+ Set_Discriminal_Link (CR_Disc, Discrim);
+ Set_CR_Discriminant (Discrim, CR_Disc);
end if;
end Build_Discriminal;
@@ -7179,7 +7217,7 @@ package body Sem_Ch3 is
if Is_Aliased (C)
and then Has_Discriminants (Etype (C))
and then not Is_Constrained (Etype (C))
- and then not In_Instance
+ and then not In_Instance_Body
and then Ada_Version < Ada_05
then
Error_Msg_N
@@ -7194,7 +7232,8 @@ package body Sem_Ch3 is
if Has_Aliased_Components (T)
and then Has_Discriminants (Component_Type (T))
and then not Is_Constrained (Component_Type (T))
- and then not In_Instance
+ and then not In_Instance_Body
+ and then Ada_Version < Ada_05
then
Error_Msg_N
("aliased component type must be constrained ('R'M 3.6(11))",
@@ -7363,7 +7402,7 @@ package body Sem_Ch3 is
Post_Error;
end if;
- elsif Is_Package (E) then
+ elsif Is_Package_Or_Generic_Package (E) then
if Unit_Requires_Body (E) then
if not Has_Completion (E)
and then Nkind (Parent (Unit_Declaration_Node (E))) /=
@@ -7643,6 +7682,29 @@ package body Sem_Ch3 is
Next (Intf);
end loop;
+
+ -- A type extension may be written as a derivation from an interface.
+ -- The completion will have to implement the same, or derive from a
+ -- type that implements it as well.
+
+ elsif Nkind (N) = N_Private_Extension_Declaration
+ and then Is_Interface (Etype (Derived_Type))
+ then
+ Add_Interface (Etype (Derived_Type));
+ end if;
+
+ -- Same for task and protected types, that can derive directly from
+ -- an interface (and implement additional interfaces that will be
+ -- present in the interface list of the declaration).
+
+ if Nkind (N) = N_Task_Type_Declaration
+ or else Nkind (N) = N_Protected_Type_Declaration
+ or else Nkind (N) = N_Single_Protected_Declaration
+ or else Nkind (N) = N_Single_Task_Declaration
+ then
+ if Is_Interface (Etype (Derived_Type)) then
+ Add_Interface (Etype (Derived_Type));
+ end if;
end if;
end Collect_Interfaces;
@@ -7873,6 +7935,25 @@ package body Sem_Ch3 is
E : Entity_Id;
begin
+ -- Handle the case in which the full-view is a transitive
+ -- derivation of the ancestor of the partial view.
+
+ -- type I is interface;
+ -- type T is new I with ...
+
+ -- package H is
+ -- type DT is new I with private;
+ -- private
+ -- type DT is new T with ...
+ -- end;
+
+ if Etype (Partial_View) /= Etype (Derived_Type)
+ and then Is_Interface (Etype (Partial_View))
+ and then Is_Ancestor (Etype (Partial_View), Etype (Derived_Type))
+ then
+ return;
+ end if;
+
if Is_Tagged_Type (Partial_View) then
Elmt_P := First_Elmt (Primitive_Operations (Partial_View));
else
@@ -8795,7 +8876,7 @@ package body Sem_Ch3 is
-- For concurrent types, the associated record value type carries the same
-- discriminants, so when we constrain a concurrent type, we must constrain
- -- the value type as well.
+ -- the corresponding record type as well.
procedure Constrain_Concurrent
(Def_Id : in out Entity_Id;
@@ -9970,10 +10051,12 @@ package body Sem_Ch3 is
then
AI := First_Elmt (Abstract_Interfaces (T));
while Present (AI) loop
- Derive_Subprograms
- (Parent_Type => Node (AI),
- Derived_Type => Derived_Type,
- No_Predefined_Prims => True);
+ if not Is_Ancestor (Node (AI), Derived_Type) then
+ Derive_Subprograms
+ (Parent_Type => Node (AI),
+ Derived_Type => Derived_Type,
+ No_Predefined_Prims => True);
+ end if;
Next_Elmt (AI);
end loop;
@@ -10391,8 +10474,7 @@ package body Sem_Ch3 is
(Parent_Type : Entity_Id;
Derived_Type : Entity_Id;
Generic_Actual : Entity_Id := Empty;
- No_Predefined_Prims : Boolean := False;
- Predefined_Prims_Only : Boolean := False)
+ No_Predefined_Prims : Boolean := False)
is
Op_List : constant Elist_Id :=
Collect_Primitive_Operations (Parent_Type);
@@ -10436,7 +10518,13 @@ package body Sem_Ch3 is
if No_Predefined_Prims and then Is_Predef then
null;
- elsif Predefined_Prims_Only and then not Is_Predef then
+ -- We don't need to derive alias entities associated with
+ -- abstract interfaces
+
+ elsif Is_Dispatching_Operation (Subp)
+ and then Present (Alias (Subp))
+ and then Present (Abstract_Interface_Alias (Subp))
+ then
null;
elsif No (Generic_Actual) then
@@ -13098,15 +13186,15 @@ package body Sem_Ch3 is
Full_Parent : Entity_Id;
Full_Indic : Node_Id;
- function Find_Interface_In_Descendant
+ function Find_Ancestor_Interface
(Typ : Entity_Id) return Entity_Id;
-- Find an implemented interface in the derivation chain of Typ
- ----------------------------------
- -- Find_Interface_In_Descendant --
- ----------------------------------
+ -----------------------------
+ -- Find_Ancestor_Interface --
+ -----------------------------
- function Find_Interface_In_Descendant
+ function Find_Ancestor_Interface
(Typ : Entity_Id) return Entity_Id
is
T : Entity_Id;
@@ -13127,7 +13215,7 @@ package body Sem_Ch3 is
end loop;
return Empty;
- end Find_Interface_In_Descendant;
+ end Find_Ancestor_Interface;
-- Start of processing for Process_Full_View
@@ -13180,37 +13268,36 @@ package body Sem_Ch3 is
Iface_Def : Node_Id;
begin
- Iface := Find_Interface_In_Descendant (Full_T);
+ Iface := Find_Ancestor_Interface (Full_T);
if Present (Iface) then
Iface_Def := Type_Definition (Parent (Iface));
- end if;
- -- The full view derives from an interface descendant, but the
- -- partial view does not share the same tagged type.
+ -- The full view derives from an interface descendant, but the
+ -- partial view does not share the same tagged type.
- if Present (Iface)
- and then Is_Tagged_Type (Priv_T)
- and then Etype (Full_T) /= Etype (Priv_T)
- then
- Error_Msg_N ("(Ada 2005) tagged partial view cannot be " &
- "completed by a type that implements an " &
- "interface", Priv_T);
- end if;
+ if Is_Tagged_Type (Priv_T)
+ and then Etype (Priv_T) /= Etype (Full_T)
+ and then Etype (Priv_T) /= Iface
+ then
+ Error_Msg_N ("(Ada 2005) tagged partial view cannot be " &
+ "completed by a type that implements an " &
+ "interface", Priv_T);
+ end if;
- -- The full view derives from a limited, protected,
- -- synchronized or task interface descendant, but the
- -- partial view is not labeled as limited.
+ -- The full view derives from a limited, protected,
+ -- synchronized or task interface descendant, but the
+ -- partial view is not labeled as limited.
- if Present (Iface)
- and then (Limited_Present (Iface_Def)
- or Protected_Present (Iface_Def)
- or Synchronized_Present (Iface_Def)
- or Task_Present (Iface_Def))
- and then not Limited_Present (Parent (Priv_T))
- then
- Error_Msg_N ("(Ada 2005) non-limited private type cannot be " &
- "completed by a limited type", Priv_T);
+ if (Limited_Present (Iface_Def)
+ or else Protected_Present (Iface_Def)
+ or else Synchronized_Present (Iface_Def)
+ or else Task_Present (Iface_Def))
+ and then not Limited_Present (Parent (Priv_T))
+ then
+ Error_Msg_N ("(Ada 2005) non-limited private type cannot be "
+ & "completed by a limited type", Priv_T);
+ end if;
end if;
end;
end if;
@@ -13242,24 +13329,9 @@ package body Sem_Ch3 is
return;
elsif not Is_Ancestor (Base_Type (Priv_Parent), Full_Parent) then
-
- -- Ada 2005 (AI-251): No error needed if the immediate
- -- ancestor of the partial view is an interface
- --
- -- Example:
- --
- -- type PT1 is new I1 with private;
- -- private
- -- type PT1 is new T and I1 with null record;
-
- if Is_Interface (Base_Type (Priv_Parent)) then
- null;
-
- else
- Error_Msg_N
- ("parent of full type must descend from parent"
- & " of private extension", Full_Indic);
- end if;
+ Error_Msg_N
+ ("parent of full type must descend from parent"
+ & " of private extension", Full_Indic);
-- Check the rules of 7.3(10): if the private extension inherits
-- known discriminants, then the full type must also inherit those
@@ -14409,17 +14481,7 @@ package body Sem_Ch3 is
else
Is_Tagged := True;
- Set_Is_Tagged_Type (T);
-
- Set_Is_Limited_Record (T, Limited_Present (Def)
- or else Task_Present (Def)
- or else Protected_Present (Def));
-
- -- Type is abstract if full declaration carries keyword, or if
- -- previous partial view did.
-
- Set_Is_Abstract (T);
- Set_Is_Interface (T);
+ Analyze_Interface_Declaration (T, Def);
end if;
-- First pass: if there are self-referential access components,
@@ -14428,10 +14490,6 @@ package body Sem_Ch3 is
Check_Anonymous_Access_Types (Component_List (Def));
- -- Ada 2005 (AI-251): Complete the initialization of attributes
- -- associated with abstract interfaces and decorate the names in the
- -- list of ancestor interfaces (if any).
-
if Ada_Version >= Ada_05
and then Present (Interface_List (Def))
then
@@ -14439,6 +14497,7 @@ package body Sem_Ch3 is
Iface : Node_Id;
Iface_Def : Node_Id;
Iface_Typ : Entity_Id;
+
begin
Iface := First (Interface_List (Def));
while Present (Iface) loop
@@ -14521,9 +14580,8 @@ package body Sem_Ch3 is
Next (Iface);
end loop;
-
Set_Abstract_Interfaces (T, New_Elmt_List);
- Collect_Interfaces (Type_Definition (N), T);
+ Collect_Interfaces (Def, T);
end;
end if;
diff --git a/gcc/ada/sem_ch3.ads b/gcc/ada/sem_ch3.ads
index 608666d18e6..95354d60b27 100644
--- a/gcc/ada/sem_ch3.ads
+++ b/gcc/ada/sem_ch3.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -62,6 +62,9 @@ package Sem_Ch3 is
-- Called to analyze a list of declarations (in what context ???). Also
-- performs necessary freezing actions (more description needed ???)
+ procedure Analyze_Interface_Declaration (T : Entity_Id; Def : Node_Id);
+ -- Analyze an interface declaration or a formal interface declaration
+
procedure Analyze_Per_Use_Expression (N : Node_Id; T : Entity_Id);
-- Default and per object expressions do not freeze their components,
-- and must be analyzed and resolved accordingly. The analysis is
@@ -97,6 +100,15 @@ package Sem_Ch3 is
-- rather than on the declarations that require completion in the package
-- declaration.
+ procedure Collect_Interfaces
+ (N : Node_Id;
+ Derived_Type : Entity_Id);
+ -- Ada 2005 (AI-251): Subsidiary procedure to Build_Derived_Record_Type
+ -- and Analyze_Formal_Interface_Type.
+ -- Collect the list of interfaces that are not already implemented by the
+ -- ancestors. This is the list of interfaces for which we must provide
+ -- additional tag components.
+
procedure Derive_Subprogram
(New_Subp : in out Entity_Id;
Parent_Subp : Entity_Id;
@@ -114,8 +126,7 @@ package Sem_Ch3 is
(Parent_Type : Entity_Id;
Derived_Type : Entity_Id;
Generic_Actual : Entity_Id := Empty;
- No_Predefined_Prims : Boolean := False;
- Predefined_Prims_Only : Boolean := False);
+ No_Predefined_Prims : Boolean := False);
-- To complete type derivation, collect/retrieve the primitive operations
-- of the parent type, and replace the subsidiary subtypes with the derived
-- type, to build the specs of the inherited ops. For generic actuals, the
@@ -124,9 +135,7 @@ package Sem_Ch3 is
-- the derived subprograms are aliased to those of the actual, not those of
-- the ancestor. The last two params are used in case of derivation from
-- abstract interface types: No_Predefined_Prims is used to avoid the
- -- derivation of predefined primitives from the interface, and Predefined
- -- Prims_Only is used to complete the derivation predefined primitives
- -- in case of private tagged types implementing interfaces.
+ -- derivation of predefined primitives from an abstract interface.
--
-- Note: one might expect this to be private to the package body, but
-- there is one rather unusual usage in package Exp_Dist.
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 1f8eb2155c3..e1aa6b863b2 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1156,9 +1156,7 @@ package body Sem_Ch4 is
and then Nkind (N) = N_Op_Ne
then
Op_Id := Get_Name_Entity_Id (Name_Op_Eq);
-
while Present (Op_Id) loop
-
if Ekind (Op_Id) = E_Operator then
Find_Equality_Types (L, R, Op_Id, N);
else
@@ -1216,7 +1214,6 @@ package body Sem_Ch4 is
else
Get_First_Interp (N, I, It);
-
while Present (It.Nam) loop
if Ekind (Base_Type (It.Typ)) /= E_Subprogram_Type
or else Etype (Base_Type (It.Typ)) = Standard_Void_Type
@@ -1274,7 +1271,6 @@ package body Sem_Ch4 is
else
Get_First_Interp (P, I, It);
-
while Present (It.Nam) loop
T := It.Typ;
@@ -1522,7 +1518,6 @@ package body Sem_Ch4 is
end if;
Index := First_Index (Array_Type);
-
while Present (Index) and then Present (Exp) loop
if not Has_Compatible_Type (Exp, Etype (Index)) then
Wrong_Type (Exp, Etype (Index));
@@ -1771,7 +1766,6 @@ package body Sem_Ch4 is
else
Op_Id := Get_Name_Entity_Id (Chars (N));
-
while Present (Op_Id) loop
if Ekind (Op_Id) = E_Operator then
Find_Boolean_Types (L, R, Op_Id, N);
@@ -1854,7 +1848,6 @@ package body Sem_Ch4 is
else
Get_First_Interp (L, Index, It);
-
while Present (It.Typ) loop
Try_One_Interp (It.Typ);
Get_Next_Interp (Index, It);
@@ -2168,9 +2161,7 @@ package body Sem_Ch4 is
and then Nkind (Left_Opnd (Actual)) = N_Identifier
then
Formal := First_Formal (Nam);
-
while Present (Formal) loop
-
if Chars (Left_Opnd (Actual)) = Chars (Formal) then
Error_Msg_N
("possible misspelling of `='>`!", Actual);
@@ -3037,7 +3028,6 @@ package body Sem_Ch4 is
else
Get_First_Interp (L, Ind, It);
-
while Present (It.Typ) loop
if Root_Type (It.Typ) = Standard_Boolean
and then Has_Compatible_Type (R, It.Typ)
@@ -3788,7 +3778,6 @@ package body Sem_Ch4 is
else
Get_First_Interp (L, Index1, It1);
-
while Present (It1.Typ) loop
Check_Right_Argument (It1.Typ);
Get_Next_Interp (Index1, It1);
@@ -4281,7 +4270,7 @@ package body Sem_Ch4 is
return False;
end if;
- -- Now test the entity we got to see if it a bad case
+ -- Now test the entity we got to see if it is a bad case
case Ekind (Entity (Enode)) is
@@ -4346,7 +4335,7 @@ package body Sem_Ch4 is
end if;
-- If either operand has no type, then don't complain further,
- -- since this simply means that we have a propragated error.
+ -- since this simply means that we have a propagated error.
if R = Error
or else Etype (R) = Any_Type
@@ -4669,7 +4658,6 @@ package body Sem_Ch4 is
-- select the predefined operator and discard others.
Get_First_Interp (N, I, It);
-
while Present (It.Nam) loop
if Scope (It.Nam) = Standard_Standard then
Set_Etype (N, Univ_Type);
@@ -4758,12 +4746,10 @@ package body Sem_Ch4 is
begin
Normalize_Actuals (N, Designated_Type (Typ), False, Call_OK);
+
Actual := First_Actual (N);
Formal := First_Formal (Designated_Type (Typ));
-
- while Present (Actual)
- and then Present (Formal)
- loop
+ while Present (Actual) and then Present (Formal) loop
if not Has_Compatible_Type (Actual, Etype (Formal)) then
return False;
end if;
@@ -4806,9 +4792,8 @@ package body Sem_Ch4 is
begin
Actual := First (Actuals);
Index := First_Index (Typ);
- while Present (Actual)
- and then Present (Index)
- loop
+ while Present (Actual) and then Present (Index) loop
+
-- If the parameter list has a named association, the expression
-- is definitely a call and not an indexed component.
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 2c5e0642bf0..896a8fb7a9e 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -71,15 +71,6 @@ package body Sem_Ch5 is
procedure Analyze_Iteration_Scheme (N : Node_Id);
- procedure Check_Possible_Current_Value_Condition (Cnode : Node_Id);
- -- Cnode is N_If_Statement, N_Elsif_Part, or N_Iteration_Scheme
- -- (the latter when a WHILE condition is present). This call checks
- -- if Condition (Cnode) is of the form ([NOT] var op val), where var
- -- is a simple object, val is known at compile time, and op is one
- -- of the six relational operators. If this is the case, and the
- -- Current_Value field of "var" is not set, then it is set to Cnode.
- -- See Exp_Util.Set_Current_Value_Condition for further details.
-
------------------------
-- Analyze_Assignment --
------------------------
@@ -1526,13 +1517,15 @@ package body Sem_Ch5 is
-- of reversing the bounds incorrectly in the range.
elsif Reverse_Present (LP)
- and then Nkind (H) = N_Integer_Literal
+ and then Nkind (Original_Node (H)) =
+ N_Integer_Literal
and then (Intval (H) = Uint_0
or else
Intval (H) = Uint_1)
and then Lhi > Hhi
then
Error_Msg_N ("?loop range may be null", DS);
+ Error_Msg_N ("\?bounds may be wrong way round", DS);
end if;
end;
end if;
diff --git a/gcc/ada/sem_ch5.ads b/gcc/ada/sem_ch5.ads
index 1c945335e5e..0ea538eb118 100644
--- a/gcc/ada/sem_ch5.ads
+++ b/gcc/ada/sem_ch5.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -47,6 +47,15 @@ package Sem_Ch5 is
-- care of setting Reachable, since labels defined by the expander can
-- be assumed to be reachable.
+ procedure Check_Possible_Current_Value_Condition (Cnode : Node_Id);
+ -- Cnode is N_If_Statement, N_Elsif_Part, or N_Iteration_Scheme
+ -- (the latter when a WHILE condition is present). This call checks
+ -- if Condition (Cnode) is of the form ([NOT] var op val), where var
+ -- is a simple object, val is known at compile time, and op is one
+ -- of the six relational operators. If this is the case, and the
+ -- Current_Value field of "var" is not set, then it is set to Cnode.
+ -- See Exp_Util.Set_Current_Value_Condition for further details.
+
procedure Check_Unreachable_Code (N : Node_Id);
-- This procedure is called with N being the node for a statement that
-- is an unconditional transfer of control. It checks to see if the
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 47056d5e46b..dae06218468 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@ with Elists; use Elists;
with Errout; use Errout;
with Expander; use Expander;
with Exp_Ch7; use Exp_Ch7;
+with Exp_Tss; use Exp_Tss;
with Fname; use Fname;
with Freeze; use Freeze;
with Itypes; use Itypes;
@@ -236,7 +237,7 @@ package body Sem_Ch6 is
Analyze (P);
-- A call of the form A.B (X) may be an Ada05 call, which is rewritten
- -- as B(A, X). If the rewriting is successful, the call has been
+ -- as B (A, X). If the rewriting is successful, the call has been
-- analyzed and we just return.
if Nkind (P) = N_Selected_Component
@@ -890,9 +891,16 @@ package body Sem_Ch6 is
Missing_Ret : Boolean;
P_Ent : Entity_Id;
- procedure Check_Following_Pragma;
- -- If front-end inlining is enabled, look ahead to recognize a pragma
- -- that may appear after the body.
+ procedure Check_Inline_Pragma (Spec : in out Node_Id);
+ -- Look ahead to recognize a pragma that may appear after the body.
+ -- If there is a previous spec, check that it appears in the same
+ -- declarative part. If the pragma is Inline_Always, perform inlining
+ -- unconditionally, otherwise only if Front_End_Inlining is requested.
+ -- If the body acts as a spec, and inlining is required, we create a
+ -- subprogram declaration for it, in order to attach the body to inline.
+
+ procedure Copy_Parameter_List (Plist : List_Id);
+ -- Comment required ???
procedure Verify_Overriding_Indicator;
-- If there was a previous spec, the entity has been entered in the
@@ -900,33 +908,115 @@ package body Sem_Ch6 is
-- indicator, check that it is consistent with the known status of the
-- entity.
- ----------------------------
- -- Check_Following_Pragma --
- ----------------------------
+ -------------------------
+ -- Check_Inline_Pragma --
+ -------------------------
- procedure Check_Following_Pragma is
- Prag : Node_Id;
+ procedure Check_Inline_Pragma (Spec : in out Node_Id) is
+ Prag : Node_Id;
+ Plist : List_Id;
begin
- if Front_End_Inlining
- and then Is_List_Member (N)
- and then Present (Spec_Decl)
- and then List_Containing (N) = List_Containing (Spec_Decl)
+ if not Expander_Active then
+ return;
+ end if;
+
+ if Is_List_Member (N)
+ and then Present (Next (N))
+ and then Nkind (Next (N)) = N_Pragma
then
Prag := Next (N);
- if Present (Prag)
- and then Nkind (Prag) = N_Pragma
- and then Get_Pragma_Id (Chars (Prag)) = Pragma_Inline
+ if Nkind (Prag) = N_Pragma
+ and then
+ (Get_Pragma_Id (Chars (Prag)) = Pragma_Inline_Always
+ or else
+ (Front_End_Inlining
+ and then Get_Pragma_Id (Chars (Prag)) = Pragma_Inline))
and then
- Chars
- (Expression (First (Pragma_Argument_Associations (Prag))))
- = Chars (Body_Id)
+ Chars
+ (Expression (First (Pragma_Argument_Associations (Prag))))
+ = Chars (Body_Id)
then
- Analyze (Prag);
+ Prag := Next (N);
+ else
+ Prag := Empty;
end if;
+ else
+ Prag := Empty;
end if;
- end Check_Following_Pragma;
+
+ if Present (Prag) then
+ if Present (Spec_Id) then
+ if List_Containing (N) =
+ List_Containing (Unit_Declaration_Node (Spec_Id))
+ then
+ Analyze (Prag);
+ end if;
+
+ else
+ -- Create a subprogram declaration, to make treatment uniform.
+
+ declare
+ Subp : constant Entity_Id :=
+ Make_Defining_Identifier (Loc, Chars (Body_Id));
+ Decl : constant Node_Id :=
+ Make_Subprogram_Declaration (Loc,
+ Specification => New_Copy_Tree (Specification (N)));
+ begin
+ Set_Defining_Unit_Name (Specification (Decl), Subp);
+
+ if Present (First_Formal (Body_Id)) then
+ Plist := New_List;
+ Copy_Parameter_List (Plist);
+ Set_Parameter_Specifications
+ (Specification (Decl), Plist);
+ end if;
+
+ Insert_Before (N, Decl);
+ Analyze (Decl);
+ Analyze (Prag);
+ Set_Has_Pragma_Inline (Subp);
+
+ if Get_Pragma_Id (Chars (Prag)) = Pragma_Inline_Always then
+ Set_Is_Inlined (Subp);
+ Set_Next_Rep_Item (Prag, First_Rep_Item (Subp));
+ Set_First_Rep_Item (Subp, Prag);
+ end if;
+
+ Spec := Subp;
+ end;
+ end if;
+ end if;
+ end Check_Inline_Pragma;
+
+ -------------------------
+ -- Copy_Parameter_List --
+ -------------------------
+
+ procedure Copy_Parameter_List (Plist : List_Id) is
+ Formal : Entity_Id;
+
+ begin
+ Formal := First_Formal (Body_Id);
+
+ while Present (Formal) loop
+ Append
+ (Make_Parameter_Specification (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Sloc (Formal),
+ Chars => Chars (Formal)),
+ In_Present => In_Present (Parent (Formal)),
+ Out_Present => Out_Present (Parent (Formal)),
+ Parameter_Type =>
+ New_Reference_To (Etype (Formal), Loc),
+ Expression =>
+ New_Copy_Tree (Expression (Parent (Formal)))),
+ Plist);
+
+ Next_Formal (Formal);
+ end loop;
+ end Copy_Parameter_List;
---------------------------------
-- Verify_Overriding_Indicator --
@@ -1071,6 +1161,8 @@ package body Sem_Ch6 is
end loop;
end if;
+ Check_Inline_Pragma (Spec_Id);
+
-- Case of fully private operation in the body of the protected type.
-- We must create a declaration for the subprogram, in order to attach
-- the protected subprogram that will be used in internal calls.
@@ -1101,22 +1193,7 @@ package body Sem_Ch6 is
Plist := No_List;
end if;
- while Present (Formal) loop
- Append
- (Make_Parameter_Specification (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Sloc (Formal),
- Chars => Chars (Formal)),
- In_Present => In_Present (Parent (Formal)),
- Out_Present => Out_Present (Parent (Formal)),
- Parameter_Type =>
- New_Reference_To (Etype (Formal), Loc),
- Expression =>
- New_Copy_Tree (Expression (Parent (Formal)))),
- Plist);
-
- Next_Formal (Formal);
- end loop;
+ Copy_Parameter_List (Plist);
if Nkind (Body_Spec) = N_Procedure_Specification then
New_Spec :=
@@ -1337,14 +1414,11 @@ package body Sem_Ch6 is
elsif Present (Spec_Id)
and then Expander_Active
+ and then
+ (Is_Always_Inlined (Spec_Id)
+ or else (Has_Pragma_Inline (Spec_Id) and Front_End_Inlining))
then
- Check_Following_Pragma;
-
- if Is_Always_Inlined (Spec_Id)
- or else (Has_Pragma_Inline (Spec_Id) and then Front_End_Inlining)
- then
- Build_Body_To_Inline (N, Spec_Id);
- end if;
+ Build_Body_To_Inline (N, Spec_Id);
end if;
-- Ada 2005 (AI-262): In library subprogram bodies, after the analysis
@@ -2451,9 +2525,29 @@ package body Sem_Ch6 is
or else Is_Access_Constant (Etype (Old_Formal))
/= Is_Access_Constant (Etype (New_Formal)))
then
- Conformance_Error
- ("type of & does not match!", New_Formal);
- return;
+ -- It is allowed to omit the null-exclusion in case of
+ -- stream attribute subprograms
+
+ declare
+ TSS_Name : TSS_Name_Type;
+
+ begin
+ Get_Name_String (Chars (New_Id));
+ TSS_Name :=
+ TSS_Name_Type
+ (Name_Buffer
+ (Name_Len - TSS_Name'Length + 1 .. Name_Len));
+
+ if TSS_Name /= TSS_Stream_Read
+ and then TSS_Name /= TSS_Stream_Write
+ and then TSS_Name /= TSS_Stream_Input
+ and then TSS_Name /= TSS_Stream_Output
+ then
+ Conformance_Error
+ ("type of & does not match!", New_Formal);
+ return;
+ end if;
+ end;
end if;
-- Check default expressions for in parameters
@@ -4696,7 +4790,7 @@ package body Sem_Ch6 is
Decl : constant Node_Id := Unit_Declaration_Node (E);
begin
- if Is_Package (Current_Scope)
+ if Is_Package_Or_Generic_Package (Current_Scope)
and then In_Private_Part (Current_Scope)
then
Priv_Decls :=
@@ -5014,7 +5108,7 @@ package body Sem_Ch6 is
-- the fact that the full view of a private extension
-- re-inherits. It has to be dealt with.
- if Is_Package (Current_Scope)
+ if Is_Package_Or_Generic_Package (Current_Scope)
and then In_Private_Part (Current_Scope)
then
Check_Operation_From_Private_View (S, E);
@@ -5423,9 +5517,12 @@ package body Sem_Ch6 is
and then Is_Access_Type (Formal_Type)
and then Null_Exclusion_Present (Param_Spec)
then
- if Can_Never_Be_Null (Formal_Type) then
+ if Can_Never_Be_Null (Formal_Type)
+ and then Comes_From_Source (Related_Nod)
+ then
Error_Msg_N
- ("(Ada 2005) already a null-excluding type", Related_Nod);
+ ("null exclusion must apply to a type that does not "
+ & "exclude null ('R'M 3.10 (14)", Related_Nod);
end if;
Formal_Type :=
diff --git a/gcc/ada/sem_ch6.ads b/gcc/ada/sem_ch6.ads
index 79d785e10c5..da8e8790ce4 100644
--- a/gcc/ada/sem_ch6.ads
+++ b/gcc/ada/sem_ch6.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 178cfd3dd60..e538970b5a4 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -195,7 +195,7 @@ package body Sem_Ch7 is
Spec_Id := Current_Entity_In_Scope (Defining_Entity (N));
if Present (Spec_Id)
- and then Is_Package (Spec_Id)
+ and then Is_Package_Or_Generic_Package (Spec_Id)
then
Pack_Decl := Unit_Declaration_Node (Spec_Id);
@@ -213,7 +213,7 @@ package body Sem_Ch7 is
return;
end if;
- if Is_Package (Spec_Id)
+ if Is_Package_Or_Generic_Package (Spec_Id)
and then
(Scope (Spec_Id) = Standard_Standard
or else Is_Child_Unit (Spec_Id))
@@ -713,6 +713,14 @@ package body Sem_Ch7 is
-- the error message "Unchecked_Union may not complete discriminated
-- partial view".
+ procedure Install_Parent_Private_Declarations (Inst_Id : Entity_Id);
+ -- Given the package entity of a generic package instantiation or
+ -- formal package whose corresponding generic is a child unit, installs
+ -- the private declarations of each of the child unit's parents.
+ -- This has to be done at the point of entering the instance package's
+ -- private part rather than being done in Sem_Ch12.Install_Parent
+ -- (which is where the parents' visible declarations are installed).
+
---------------------
-- Clear_Constants --
---------------------
@@ -881,6 +889,70 @@ package body Sem_Ch7 is
end loop;
end Inspect_Unchecked_Union_Completion;
+ -----------------------------------------
+ -- Install_Parent_Private_Declarations --
+ -----------------------------------------
+
+ procedure Install_Parent_Private_Declarations (Inst_Id : Entity_Id) is
+ Inst_Par : Entity_Id := Inst_Id;
+ Gen_Par : Entity_Id;
+ Inst_Node : Node_Id;
+
+ begin
+ Gen_Par :=
+ Generic_Parent (Specification (Unit_Declaration_Node (Inst_Par)));
+ while Present (Gen_Par) and then Is_Child_Unit (Gen_Par) loop
+ Inst_Node := Get_Package_Instantiation_Node (Inst_Par);
+
+ if (Nkind (Inst_Node) = N_Package_Instantiation
+ or else Nkind (Inst_Node) = N_Formal_Package_Declaration)
+ and then Nkind (Name (Inst_Node)) = N_Expanded_Name
+ then
+ Inst_Par := Entity (Prefix (Name (Inst_Node)));
+
+ if Present (Renamed_Entity (Inst_Par)) then
+ Inst_Par := Renamed_Entity (Inst_Par);
+ end if;
+
+ Gen_Par :=
+ Generic_Parent
+ (Specification (Unit_Declaration_Node (Inst_Par)));
+
+ -- Install the private declarations and private use clauses
+ -- of a parent instance of the child instance.
+
+ if Present (Gen_Par) then
+ Install_Private_Declarations (Inst_Par);
+ Set_Use (Private_Declarations
+ (Specification
+ (Unit_Declaration_Node (Inst_Par))));
+
+ -- If we've reached the end of the generic instance parents,
+ -- then finish off by looping through the nongeneric parents
+ -- and installing their private declarations.
+
+ else
+ while Present (Inst_Par)
+ and then Inst_Par /= Standard_Standard
+ and then (not In_Open_Scopes (Inst_Par)
+ or else not In_Private_Part (Inst_Par))
+ loop
+ Install_Private_Declarations (Inst_Par);
+ Set_Use (Private_Declarations
+ (Specification
+ (Unit_Declaration_Node (Inst_Par))));
+ Inst_Par := Scope (Inst_Par);
+ end loop;
+
+ exit;
+ end if;
+
+ else
+ exit;
+ end if;
+ end loop;
+ end Install_Parent_Private_Declarations;
+
-- Start of processing for Analyze_Package_Specification
begin
@@ -974,6 +1046,20 @@ package body Sem_Ch7 is
Install_Private_With_Clauses (Id);
end if;
+ -- If this is a package associated with a generic instance or formal
+ -- package, then the private declarations of each of the generic's
+ -- parents must be installed at this point.
+
+ if Is_Generic_Instance (Id)
+ or else
+ (Nkind (Unit_Declaration_Node (Id)) = N_Generic_Package_Declaration
+ and then
+ Nkind (Original_Node (Unit_Declaration_Node (Id)))
+ = N_Formal_Package_Declaration)
+ then
+ Install_Parent_Private_Declarations (Id);
+ end if;
+
-- Analyze private part if present. The flag In_Private_Part is
-- reset in End_Package_Scope.
@@ -1472,9 +1558,10 @@ package body Sem_Ch7 is
Last_Entity : Entity_Id;
begin
- pragma Assert (Is_Package (P) or else Is_Record_Type (P));
+ pragma Assert
+ (Is_Package_Or_Generic_Package (P) or else Is_Record_Type (P));
- if Is_Package (P) then
+ if Is_Package_Or_Generic_Package (P) then
Last_Entity := First_Private_Entity (P);
else
Last_Entity := Empty;
@@ -1702,8 +1789,10 @@ package body Sem_Ch7 is
Set_Access_Disp_Table
(Priv, Access_Disp_Table
(Corresponding_Record_Type (Base_Type (Full))));
+
+ -- Generic context, or previous errors
+
else
- pragma Assert (Serious_Errors_Detected > 0);
null;
end if;
diff --git a/gcc/ada/sem_ch7.ads b/gcc/ada/sem_ch7.ads
index 7cb526494c2..44cca2769b4 100644
--- a/gcc/ada/sem_ch7.ads
+++ b/gcc/ada/sem_ch7.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -25,7 +25,8 @@
------------------------------------------------------------------------------
with Types; use Types;
-package Sem_Ch7 is
+
+package Sem_Ch7 is
procedure Analyze_Package_Body (N : Node_Id);
procedure Analyze_Package_Declaration (N : Node_Id);
@@ -33,7 +34,7 @@ package Sem_Ch7 is
procedure Analyze_Private_Type_Declaration (N : Node_Id);
procedure End_Package_Scope (P : Entity_Id);
- -- Calls Uninstall_Declarations, and then pops the scope stack.
+ -- Calls Uninstall_Declarations, and then pops the scope stack
procedure Exchange_Declarations (Id : Entity_Id);
-- Exchange private and full declaration on entry/exit from a package
@@ -74,4 +75,5 @@ package Sem_Ch7 is
-- visible entities at the end of their homonym chains. For compilation
-- units, make all entities invisible. In both cases, exchange private
-- and visible declarations to restore order of elaboration.
+
end Sem_Ch7;
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index bba2ece8cc0..a0b0f38e603 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -424,8 +424,13 @@ package body Sem_Ch8 is
-- an instance of the parent.
procedure Chain_Use_Clause (N : Node_Id);
- -- Chain use clause onto list of uses clauses headed by First_Use_Clause
- -- in the top scope table entry.
+ -- Chain use clause onto list of uses clauses headed by First_Use_Clause in
+ -- the proper scope table entry. This is usually the current scope, but it
+ -- will be an inner scope when installing the use clauses of the private
+ -- declarations of a parent unit prior to compiling the private part of a
+ -- child unit. This chain is traversed when installing/removing use clauses
+ -- when compiling a subunit or instantiating a generic body on the fly,
+ -- when it is necessary to save and restore full environments.
function Has_Implicit_Character_Literal (N : Node_Id) return Boolean;
-- Find a type derived from Character or Wide_Character in the prefix of N.
@@ -473,6 +478,11 @@ package body Sem_Ch8 is
-- True if it is of a task type, a protected type, or else an access
-- to one of these types.
+ procedure Note_Redundant_Use (Clause : Node_Id);
+ -- Mark the name in a use clause as redundant if the corresponding
+ -- entity is already use-visible. Emit a warning if the use clause
+ -- comes from source and the proper warnings are enabled.
+
procedure Premature_Usage (N : Node_Id);
-- Diagnose usage of an entity before it is visible
@@ -768,9 +778,13 @@ package body Sem_Ch8 is
(Attribute_Name (Original_Node (Nam))))
-- Weird but legal, equivalent to renaming a function call
+ -- Illegal if the literal is the result of constant-folding
+ -- an attribute reference that is not a function.
or else (Is_Entity_Name (Nam)
- and then Ekind (Entity (Nam)) = E_Enumeration_Literal)
+ and then Ekind (Entity (Nam)) = E_Enumeration_Literal
+ and then
+ Nkind (Original_Node (Nam)) /= N_Attribute_Reference)
or else (Nkind (Nam) = N_Type_Conversion
and then Is_Tagged_Type (Entity (Subtype_Mark (Nam))))
@@ -833,7 +847,7 @@ package body Sem_Ch8 is
Error_Msg_N
("expect package name in renaming", Name (N));
- -- Ada 2005 (AI-50217): Limited withed packages can not be renamed
+ -- Ada 2005 (AI-50217): Limited withed packages cannot be renamed
elsif Ekind (Old_P) = E_Package
and then From_With_Type (Old_P)
@@ -1049,7 +1063,7 @@ package body Sem_Ch8 is
Style.Check_Identifier (Defining_Entity (N), New_S);
else
- -- Only mode conformance required for a renaming_as_declaration.
+ -- Only mode conformance required for a renaming_as_declaration
Check_Mode_Conformant (New_S, Old_S, N);
end if;
@@ -1190,7 +1204,13 @@ package body Sem_Ch8 is
-- rewrite an actual given by a stream attribute as the name
-- of the corresponding stream primitive of the type.
- if Is_Actual and then Is_Abstract (Formal_Spec) then
+ -- In a generic context the stream operations are not generated,
+ -- and this must be treated as a normal attribute reference, to
+ -- be expanded in subsequent instantiations.
+
+ if Is_Actual and then Is_Abstract (Formal_Spec)
+ and then Expander_Active
+ then
declare
Stream_Prim : Entity_Id;
Prefix_Type : constant Entity_Id := Entity (Prefix (Nam));
@@ -1354,6 +1374,37 @@ package body Sem_Ch8 is
-- for it at the freezing point.
Set_Corresponding_Spec (N, Rename_Spec);
+ if Nkind (Unit_Declaration_Node (Rename_Spec)) =
+ N_Abstract_Subprogram_Declaration
+ then
+ -- Input and Output stream functions are abstract if the object
+ -- type is abstract. However, these functions may receive explicit
+ -- declarations in representation clauses, making the attribute
+ -- subprograms usable as defaults in subsequent type extensions.
+ -- In this case we rewrite the declaration to make the subprogram
+ -- non-abstract. We remove the previous declaration, and insert
+ -- the new one at the point of the renaming, to prevent premature
+ -- access to unfrozen types. The new declaration reuses the
+ -- specification of the previous one, and must not be analyzed.
+
+ pragma Assert (Is_TSS (Rename_Spec, TSS_Stream_Output)
+ or else Is_TSS (Rename_Spec, TSS_Stream_Input));
+
+ declare
+ Old_Decl : constant Node_Id :=
+ Unit_Declaration_Node (Rename_Spec);
+ New_Decl : constant Node_Id :=
+ Make_Subprogram_Declaration (Sloc (N),
+ Specification =>
+ Relocate_Node (Specification (Old_Decl)));
+ begin
+ Remove (Old_Decl);
+ Insert_After (N, New_Decl);
+ Set_Is_Abstract (Rename_Spec, False);
+ Set_Analyzed (New_Decl);
+ end;
+ end if;
+
Set_Corresponding_Body (Unit_Declaration_Node (Rename_Spec), New_S);
if Ada_Version = Ada_83 and then Comes_From_Source (N) then
@@ -1914,13 +1965,13 @@ package body Sem_Ch8 is
return False;
elsif In_Use (Pack) then
- Set_Redundant_Use (Pack_Name, True);
+ Note_Redundant_Use (Pack_Name);
return False;
elsif Present (Renamed_Object (Pack))
and then In_Use (Renamed_Object (Pack))
then
- Set_Redundant_Use (Pack_Name, True);
+ Note_Redundant_Use (Pack_Name);
return False;
else
@@ -2142,10 +2193,38 @@ package body Sem_Ch8 is
----------------------
procedure Chain_Use_Clause (N : Node_Id) is
+ Pack : Entity_Id;
+ Level : Int := Scope_Stack.Last;
+
begin
+ if not Is_Compilation_Unit (Current_Scope)
+ or else not Is_Child_Unit (Current_Scope)
+ then
+ null; -- Common case
+
+ elsif Defining_Entity (Parent (N)) = Current_Scope then
+ null; -- Common case for compilation unit
+
+ else
+ -- If declaration appears in some other scope, it must be in some
+ -- parent unit when compiling a child.
+
+ Pack := Defining_Entity (Parent (N));
+ if not In_Open_Scopes (Pack) then
+ null; -- default as well
+
+ else
+ -- Find entry for parent unit in scope stack
+
+ while Scope_Stack.Table (Level).Entity /= Pack loop
+ Level := Level - 1;
+ end loop;
+ end if;
+ end if;
+
Set_Next_Use_Clause (N,
- Scope_Stack.Table (Scope_Stack.Last).First_Use_Clause);
- Scope_Stack.Table (Scope_Stack.Last).First_Use_Clause := N;
+ Scope_Stack.Table (Level).First_Use_Clause);
+ Scope_Stack.Table (Level).First_Use_Clause := N;
end Chain_Use_Clause;
---------------------------
@@ -2476,6 +2555,7 @@ package body Sem_Ch8 is
elsif not Redundant_Use (Pack_Name) then
Set_In_Use (Pack, False);
+ Set_Current_Use_Clause (Pack, Empty);
Id := First_Entity (Pack);
while Present (Id) loop
@@ -2510,6 +2590,7 @@ package body Sem_Ch8 is
if Present (Renamed_Object (Pack)) then
Set_In_Use (Renamed_Object (Pack), False);
+ Set_Current_Use_Clause (Renamed_Object (Pack), Empty);
end if;
if Chars (Pack) = Name_System
@@ -4552,7 +4633,9 @@ package body Sem_Ch8 is
T := Base_Type (Entity (Prefix (N)));
- -- Case of non-tagged type
+ -- Case type is not known to be tagged. Its appearance in
+ -- the prefix of the 'Class attribute indicates that the full
+ -- view will be tagged.
if not Is_Tagged_Type (T) then
if Ekind (T) = E_Incomplete_Type then
@@ -4561,6 +4644,7 @@ package body Sem_Ch8 is
-- type. The full type will have to be tagged, of course.
Set_Is_Tagged_Type (T);
+ Set_Primitive_Operations (T, New_Elmt_List);
Make_Class_Wide_Type (T);
Set_Entity (N, Class_Wide_Type (T));
Set_Etype (N, Class_Wide_Type (T));
@@ -5118,12 +5202,12 @@ package body Sem_Ch8 is
if Ekind (Id) = E_Package then
if In_Use (Id) then
- Set_Redundant_Use (P, True);
+ Note_Redundant_Use (P);
elsif Present (Renamed_Object (Id))
and then In_Use (Renamed_Object (Id))
then
- Set_Redundant_Use (P, True);
+ Note_Redundant_Use (P);
elsif Force_Installation or else Applicable_Use (P) then
Use_One_Package (Id, U);
@@ -5294,6 +5378,174 @@ package body Sem_Ch8 is
end if;
end New_Scope;
+ ------------------------
+ -- Note_Redundant_Use --
+ ------------------------
+
+ procedure Note_Redundant_Use (Clause : Node_Id) is
+ Pack_Name : constant Entity_Id := Entity (Clause);
+ Cur_Use : constant Node_Id := Current_Use_Clause (Pack_Name);
+ Decl : constant Node_Id := Parent (Clause);
+
+ Prev_Use : Node_Id := Empty;
+ Redundant : Node_Id := Empty;
+ -- The Use_Clause which is actually redundant. In the simplest case
+ -- it is Pack itself, but when we compile a body we install its
+ -- context before that of its spec, in which case it is the use_clause
+ -- in the spec that will appear to be redundant, and we want the
+ -- warning to be placed on the body. Similar complications appear when
+ -- the redundancy is between a child unit and one of its ancestors.
+
+ begin
+ Set_Redundant_Use (Clause, True);
+
+ if not Comes_From_Source (Clause)
+ or else In_Instance
+ or else not Warn_On_Redundant_Constructs
+ then
+ return;
+ end if;
+
+ if not Is_Compilation_Unit (Current_Scope) then
+
+ -- If the use_clause is in an inner scope, it is made redundant
+ -- by some clause in the current context.
+
+ Redundant := Clause;
+ Prev_Use := Cur_Use;
+
+ elsif Nkind (Unit (Cunit (Current_Sem_Unit))) = N_Package_Body then
+ declare
+ Cur_Unit : constant Unit_Number_Type := Get_Source_Unit (Cur_Use);
+ New_Unit : constant Unit_Number_Type := Get_Source_Unit (Clause);
+ Scop : Entity_Id;
+
+ begin
+ if Cur_Unit = New_Unit then
+
+ -- Redundant clause in same body
+
+ Redundant := Clause;
+ Prev_Use := Cur_Use;
+
+ elsif Cur_Unit = Current_Sem_Unit then
+
+ -- If the new clause is not in the current unit it has been
+ -- analyzed first, and it makes the other one redundant.
+ -- However, if the new clause appears in a subunit, Cur_Unit
+ -- is still the parent, and in that case the redundant one
+ -- is the one appearing in the subunit.
+
+ if Nkind (Unit (Cunit (New_Unit))) = N_Subunit then
+ Redundant := Clause;
+ Prev_Use := Cur_Use;
+
+ -- Most common case: redundant clause in body,
+ -- original clause in spec. Current scope is spec entity.
+
+ elsif
+ Current_Scope =
+ Defining_Entity (
+ Unit (Library_Unit (Cunit (Current_Sem_Unit))))
+ then
+ Redundant := Cur_Use;
+ Prev_Use := Clause;
+
+ else
+ -- The new clause may appear in an unrelated unit, when
+ -- the parents of a generic are being installed prior to
+ -- instantiation. In this case there must be no warning.
+ -- We detect this case by checking whether the current top
+ -- of the stack is related to the current compilation.
+
+ Scop := Current_Scope;
+ while Present (Scop)
+ and then Scop /= Standard_Standard
+ loop
+ if Is_Compilation_Unit (Scop)
+ and then not Is_Child_Unit (Scop)
+ then
+ return;
+
+ elsif Scop = Cunit_Entity (Current_Sem_Unit) then
+ exit;
+ end if;
+
+ Scop := Scope (Scop);
+ end loop;
+
+ Redundant := Cur_Use;
+ Prev_Use := Clause;
+ end if;
+
+ elsif New_Unit = Current_Sem_Unit then
+ Redundant := Clause;
+ Prev_Use := Cur_Use;
+
+ else
+ -- Neither is the current unit, so they appear in parent or
+ -- sibling units. Warning will be emitted elsewhere.
+
+ return;
+ end if;
+ end;
+
+ elsif Nkind (Unit (Cunit (Current_Sem_Unit))) = N_Package_Declaration
+ and then Present (Parent_Spec (Unit (Cunit (Current_Sem_Unit))))
+ then
+ -- Use_clause is in child unit of current unit, and the child
+ -- unit appears in the context of the body of the parent, so it
+ -- has been installed first, even though it is the redundant one.
+ -- Depending on their placement in the context, the visible or the
+ -- private parts of the two units, either might appear as redundant,
+ -- but the message has to be on the current unit.
+
+ if Get_Source_Unit (Cur_Use) = Current_Sem_Unit then
+ Redundant := Cur_Use;
+ Prev_Use := Clause;
+ else
+ Redundant := Clause;
+ Prev_Use := Cur_Use;
+ end if;
+
+ -- If the new use clause appears in the private part of a parent unit
+ -- it may appear to be redudant w.r.t. a use clause in a child unit,
+ -- but the previous use clause was needed in the visible part of the
+ -- child, and no warning should be emitted.
+
+ if Nkind (Parent (Decl)) = N_Package_Specification
+ and then
+ List_Containing (Decl) = Private_Declarations (Parent (Decl))
+ then
+ declare
+ Par : constant Entity_Id := Defining_Entity (Parent (Decl));
+ Spec : constant Node_Id :=
+ Specification (Unit (Cunit (Current_Sem_Unit)));
+
+ begin
+ if Is_Compilation_Unit (Par)
+ and then Par /= Cunit_Entity (Current_Sem_Unit)
+ and then Parent (Cur_Use) = Spec
+ and then
+ List_Containing (Cur_Use) = Visible_Declarations (Spec)
+ then
+ return;
+ end if;
+ end;
+ end if;
+
+ else
+ null;
+ end if;
+
+ if Present (Redundant) then
+ Error_Msg_Sloc := Sloc (Prev_Use);
+ Error_Msg_NE (
+ "& is already use_visible through declaration #?",
+ Redundant, Pack_Name);
+ end if;
+ end Note_Redundant_Use;
+
---------------
-- Pop_Scope --
---------------
@@ -5760,6 +6012,7 @@ package body Sem_Ch8 is
end if;
Set_In_Use (P);
+ Set_Current_Use_Clause (P, N);
-- Ada 2005 (AI-50217): Check restriction
@@ -5788,6 +6041,7 @@ package body Sem_Ch8 is
if Present (Renamed_Object (P)) then
Set_In_Use (Renamed_Object (P));
+ Set_Current_Use_Clause (Renamed_Object (P), N);
Real_P := Renamed_Object (P);
else
Real_P := P;
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 190706c4e11..c49bed34cbf 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -28,7 +28,7 @@ with Atree; use Atree;
with Checks; use Checks;
with Einfo; use Einfo;
with Errout; use Errout;
-with Exp_Ch9;
+with Exp_Ch9; use Exp_Ch9;
with Elists; use Elists;
with Freeze; use Freeze;
with Itypes; use Itypes;
@@ -94,11 +94,22 @@ package body Sem_Ch9 is
while Present (T_Name) loop
Analyze (T_Name);
- if not Is_Task_Type (Etype (T_Name)) then
- Error_Msg_N ("expect task name for ABORT", T_Name);
- return;
- else
+ if Is_Task_Type (Etype (T_Name))
+ or else (Ada_Version >= Ada_05
+ and then Ekind (Etype (T_Name)) = E_Class_Wide_Type
+ and then Is_Interface (Etype (T_Name))
+ and then Is_Task_Interface (Etype (T_Name)))
+ then
Resolve (T_Name);
+ else
+ if Ada_Version >= Ada_05 then
+ Error_Msg_N ("expect task name or task interface class-wide "
+ & "object for ABORT", T_Name);
+ else
+ Error_Msg_N ("expect task name for ABORT", T_Name);
+ end if;
+
+ return;
end if;
Next (T_Name);
@@ -298,9 +309,7 @@ package body Sem_Ch9 is
begin
E1 := First_Entity (Current_Scope);
-
while Present (E1) loop
-
if Ekind (E1) = E_Procedure
and then Chars (E1) = Chars (Entry_Nam)
and then Type_Conformant (E1, Entry_Nam)
@@ -368,7 +377,6 @@ package body Sem_Ch9 is
begin
Decl := First (Declarations (N));
-
while Present (Decl) loop
Analyze (Decl);
@@ -390,6 +398,7 @@ package body Sem_Ch9 is
-- In the case of a select alternative of a selective accept,
-- the expander references the address declaration even if there
-- is no statement list.
+
-- We also need to create the renaming declarations for the local
-- variables that will replace references to the formals within
-- the accept.
@@ -440,14 +449,49 @@ package body Sem_Ch9 is
---------------------------------
procedure Analyze_Asynchronous_Select (N : Node_Id) is
+ Param : Node_Id;
+ Trigger : Node_Id;
+
begin
Tasking_Used := True;
Check_Restriction (Max_Asynchronous_Select_Nesting, N);
Check_Restriction (No_Select_Statements, N);
- -- Analyze the statements. We analyze statements in the abortable part
- -- first, because this is the section that is executed first, and that
- -- way our remembering of saved values and checks is accurate.
+ if Ada_Version >= Ada_05 then
+ Trigger := Triggering_Statement (Triggering_Alternative (N));
+
+ Analyze (Trigger);
+
+ -- The trigger is a dispatching procedure. Postpone the analysis
+ -- of the triggering and abortable statements until the expansion
+ -- of this asynchronous select in Expand_N_Asynchronous_Select.
+ -- This action is required since the code replication in Expand-
+ -- _N_Asynchronous_Select of an already analyzed statement list
+ -- causes Gigi aborts.
+
+ if Expander_Active
+ and then Nkind (Trigger) = N_Procedure_Call_Statement
+ and then Present (Parameter_Associations (Trigger))
+ then
+ Param := First (Parameter_Associations (Trigger));
+
+ if Is_Controlling_Actual (Param)
+ and then Is_Interface (Etype (Param))
+ then
+ if Is_Limited_Record (Etype (Param)) then
+ return;
+ else
+ Error_Msg_N
+ ("dispatching operation of limited or synchronized " &
+ "interface required ('R'M 9.7.2(3))!", N);
+ end if;
+ end if;
+ end if;
+ end if;
+
+ -- Analyze the statements. We analyze statements in the abortable part,
+ -- because this is the section that is executed first, and that way our
+ -- remembering of saved values and checks is accurate.
Analyze_Statements (Statements (Abortable_Part (N)));
Analyze (Triggering_Alternative (N));
@@ -462,6 +506,16 @@ package body Sem_Ch9 is
Check_Restriction (No_Select_Statements, N);
Tasking_Used := True;
Analyze (Entry_Call_Alternative (N));
+
+ if List_Length (Else_Statements (N)) = 1
+ and then Nkind (First (Else_Statements (N))) in N_Delay_Statement
+ then
+ Error_Msg_N
+ ("suspicious form of conditional entry call?", N);
+ Error_Msg_N
+ ("\`SELECT OR` may be intended rather than `SELECT ELSE`", N);
+ end if;
+
Analyze_Statements (Else_Statements (N));
end Analyze_Conditional_Entry_Call;
@@ -491,19 +545,19 @@ package body Sem_Ch9 is
if Nkind (Delay_Statement (N)) = N_Delay_Relative_Statement then
Pre_Analyze_And_Resolve (Expr, Standard_Duration);
-
else
Pre_Analyze_And_Resolve (Expr);
end if;
- if Nkind (Delay_Statement (N)) = N_Delay_Until_Statement and then
- not Is_RTE (Base_Type (Etype (Expr)), RO_CA_Time) and then
- not Is_RTE (Base_Type (Etype (Expr)), RO_RT_Time)
+ if Nkind (Delay_Statement (N)) = N_Delay_Until_Statement
+ and then not Is_RTE (Base_Type (Etype (Expr)), RO_CA_Time)
+ and then not Is_RTE (Base_Type (Etype (Expr)), RO_RT_Time)
then
Error_Msg_N ("expect Time types for `DELAY UNTIL`", Expr);
end if;
Check_Restriction (No_Fixed_Point, Expr);
+
else
Analyze (Delay_Statement (N));
end if;
@@ -632,7 +686,13 @@ package body Sem_Ch9 is
then
Set_Etype (Def, Empty);
Set_Analyzed (Def, False);
- Set_Discrete_Subtype_Definition (Index_Spec, Def);
+
+ -- Keep the original subtree to ensure tree is
+ -- properly formed (e.g. for ASIS use)
+
+ Rewrite
+ (Discrete_Subtype_Definition (Index_Spec), Def);
+
Set_Analyzed (Low_Bound (Def), False);
Set_Analyzed (High_Bound (Def), False);
@@ -683,12 +743,16 @@ package body Sem_Ch9 is
-- The entity for the protected subprogram corresponding to the entry
-- has been created. We retain the name of this entity in the entry
-- body, for use when the corresponding subprogram body is created.
- -- Note that entry bodies have to corresponding_spec, and there is no
+ -- Note that entry bodies have no corresponding_spec, and there is no
-- easy link back in the tree between the entry body and the entity for
- -- the entry itself.
+ -- the entry itself, which is why we must propagate some attributes
+ -- explicitly from spec to body.
- Set_Protected_Body_Subprogram (Id,
- Protected_Body_Subprogram (Entry_Name));
+ Set_Protected_Body_Subprogram
+ (Id, Protected_Body_Subprogram (Entry_Name));
+
+ Set_Entry_Parameters_Type
+ (Id, Entry_Parameters_Type (Entry_Name));
if Present (Decls) then
Analyze_Declarations (Decls);
@@ -707,6 +771,9 @@ package body Sem_Ch9 is
-- At the same time, we set the flags on the spec entities to suppress
-- any warnings on the spec formals, since we also scan the spec.
+ -- Finally, we propagate the Entry_Component attribute to the body
+ -- formals, for use in the renaming declarations created later for the
+ -- formals (see exp_ch9.Add_Formal_Renamings).
declare
E1 : Entity_Id;
@@ -736,6 +803,7 @@ package body Sem_Ch9 is
Set_Referenced (E2, Referenced (E1));
Set_Referenced (E1);
+ Set_Entry_Component (E2, Entry_Component (E1));
<<Continue>>
Next_Entity (E1);
@@ -1011,9 +1079,7 @@ package body Sem_Ch9 is
end if;
E := First_Entity (Current_Scope);
-
while Present (E) loop
-
if Ekind (E) = E_Function
or else Ekind (E) = E_Procedure
then
@@ -1072,8 +1138,9 @@ package body Sem_Ch9 is
-- Ada 2005 (AI-345)
if Present (Interface_List (N)) then
- Iface := First (Interface_List (N));
+ Set_Is_Tagged_Type (T);
+ Iface := First (Interface_List (N));
while Present (Iface) loop
Iface_Typ := Find_Type_Of_Subtype_Indic (Iface);
Iface_Def := Type_Definition (Parent (Iface_Typ));
@@ -1147,7 +1214,6 @@ package body Sem_Ch9 is
-- illegal uses. Now it can be set correctly.
E := First_Entity (Current_Scope);
-
while Present (E) loop
if Ekind (E) = E_Void then
Set_Ekind (E, E_Component);
@@ -1254,14 +1320,13 @@ package body Sem_Ch9 is
-- Overloaded case, find right interpretation
if Is_Overloaded (Entry_Name) then
- Get_First_Interp (Entry_Name, I, It);
Entry_Id := Empty;
+ Get_First_Interp (Entry_Name, I, It);
while Present (It.Nam) loop
if No (First_Formal (It.Nam))
or else Subtype_Conformant (Enclosing, It.Nam)
then
-
-- Ada 2005 (AI-345): Since protected and task types have
-- primitive entry wrappers, we only consider source entries.
@@ -1348,9 +1413,10 @@ package body Sem_Ch9 is
-- Processing for parameters accessed by the requeue
declare
- Ent : Entity_Id := First_Formal (Enclosing);
+ Ent : Entity_Id;
begin
+ Ent := First_Formal (Enclosing);
while Present (Ent) loop
-- For OUT or IN OUT parameter, the effect of the requeue
@@ -1399,6 +1465,8 @@ package body Sem_Ch9 is
Check_Restriction (No_Select_Statements, N);
Tasking_Used := True;
+ -- Loop to analyze alternatives
+
Alt := First (Alts);
while Present (Alt) loop
Alt_Count := Alt_Count + 1;
@@ -1716,7 +1784,6 @@ package body Sem_Ch9 is
begin
Ent := First_Entity (Spec_Id);
-
while Present (Ent) loop
if Is_Entry (Ent)
and then not Entry_Accepted (Ent)
@@ -1799,6 +1866,8 @@ package body Sem_Ch9 is
-- Ada 2005 (AI-345)
if Present (Interface_List (N)) then
+ Set_Is_Tagged_Type (T);
+
Iface := First (Interface_List (N));
while Present (Iface) loop
Iface_Typ := Find_Type_Of_Subtype_Indic (Iface);
@@ -1919,21 +1988,20 @@ package body Sem_Ch9 is
end if;
Analyze (Trigger);
+
if Comes_From_Source (Trigger)
- and then Nkind (Trigger) /= N_Delay_Until_Statement
- and then Nkind (Trigger) /= N_Delay_Relative_Statement
+ and then Nkind (Trigger) not in N_Delay_Statement
and then Nkind (Trigger) /= N_Entry_Call_Statement
then
if Ada_Version < Ada_05 then
Error_Msg_N
("triggering statement must be delay or entry call", Trigger);
- -- Ada 2005 (AI-345): If a procedure_call_statement is used
- -- for a procedure_or_entry_call, the procedure_name or pro-
- -- cedure_prefix of the procedure_call_statement shall denote
- -- an entry renamed by a procedure, or (a view of) a primitive
- -- subprogram of a limited interface whose first parameter is
- -- a controlling parameter.
+ -- Ada 2005 (AI-345): If a procedure_call_statement is used for a
+ -- procedure_or_entry_call, the procedure_name or pro- cedure_prefix
+ -- of the procedure_call_statement shall denote an entry renamed by a
+ -- procedure, or (a view of) a primitive subprogram of a limited
+ -- interface whose first parameter is a controlling parameter.
elsif Nkind (Trigger) = N_Procedure_Call_Statement
and then not Is_Renamed_Entry (Entity (Name (Trigger)))
@@ -2089,7 +2157,6 @@ package body Sem_Ch9 is
begin
Ent := First (Ifaces);
-
while Present (Ent) loop
if Etype (Ent) = Iface then
return True;
@@ -2119,14 +2186,13 @@ package body Sem_Ch9 is
Entry_Param := First (Entry_Params);
Proc_Param := Next (Proc_Param);
- while Present (Entry_Param)
- and then Present (Proc_Param)
- loop
+ while Present (Entry_Param) and then Present (Proc_Param) loop
+
-- The two parameters must be mode conformant and have the exact
-- same types.
- if In_Present (Entry_Param) /= In_Present (Proc_Param)
- or else Out_Present (Entry_Param) /= Out_Present (Proc_Param)
+ if Ekind (Defining_Identifier (Entry_Param)) /=
+ Ekind (Defining_Identifier (Proc_Param))
or else Etype (Parameter_Type (Entry_Param)) /=
Etype (Parameter_Type (Proc_Param))
then
@@ -2177,7 +2243,6 @@ package body Sem_Ch9 is
Null_Present (Parent (Hom)))
then
Aliased_Hom := Hom;
-
while Present (Alias (Aliased_Hom)) loop
Aliased_Hom := Alias (Aliased_Hom);
end loop;
@@ -2274,7 +2339,6 @@ package body Sem_Ch9 is
else
Decl := First (Vis_Decls);
-
while Present (Decl) loop
if Nkind (Decl) = N_Entry_Declaration
and then Must_Override (Decl)
@@ -2322,7 +2386,6 @@ package body Sem_Ch9 is
begin
E := First_Entity (Spec);
-
while Present (E) loop
Prev := Current_Entity (E);
Set_Current_Entity (E);
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 96836a75915..a187b153848 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -550,10 +550,13 @@ package body Sem_Disp is
if Ada_Version = Ada_05
and then Present (Tagged_Type)
and then Is_Concurrent_Type (Tagged_Type)
- and then not Is_Empty_Elmt_List
- (Abstract_Interfaces
- (Corresponding_Record_Type (Tagged_Type)))
then
+ -- Protect the frontend against previously detected errors
+
+ if not Present (Corresponding_Record_Type (Tagged_Type)) then
+ return;
+ end if;
+
Tagged_Type := Corresponding_Record_Type (Tagged_Type);
end if;
@@ -589,8 +592,8 @@ package body Sem_Disp is
-- where it can be a dispatching op is when it overrides an operation
-- before the freezing point of the type.
- elsif ((not Is_Package (Scope (Subp)))
- or else In_Package_Body (Scope (Subp)))
+ elsif ((not Is_Package_Or_Generic_Package (Scope (Subp)))
+ or else In_Package_Body (Scope (Subp)))
and then not Has_Dispatching_Parent
then
if not Comes_From_Source (Subp)
@@ -1261,7 +1264,7 @@ package body Sem_Disp is
Replace_Elmt (Op_Elmt, New_Op);
end if;
- if (not Is_Package (Current_Scope))
+ if (not Is_Package_Or_Generic_Package (Current_Scope))
or else not In_Private_Part (Current_Scope)
then
-- Not a private primitive
diff --git a/gcc/ada/sem_dist.ads b/gcc/ada/sem_dist.ads
index 610c785f162..24745890b53 100644
--- a/gcc/ada/sem_dist.ads
+++ b/gcc/ada/sem_dist.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index 25b5fd36624..1eae58685b4 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -117,7 +117,6 @@ package body Sem_Elab is
Outer_Scope : Entity_Id;
-- Save scope of outer level call
-
end record;
package Delay_Check is new Table.Table (
@@ -166,6 +165,13 @@ package body Sem_Elab is
-- then the original call was an inner call, and we are not interested
-- in calls that go outside this scope.
+ procedure Activate_Elaborate_All_Desirable (N : Node_Id; U : Entity_Id);
+ -- Analysis of construct N shows that we should set Elaborate_All_Desirable
+ -- for the WITH clause for unit U (which will always be present). A special
+ -- case is when N is a function or procedure instantiation, in which case
+ -- it is sufficient to set Elaborate_Desirable, since in this case there is
+ -- no possibility of transitive elaboration issues.
+
procedure Check_A_Call
(N : Node_Id;
E : Entity_Id;
@@ -308,6 +314,113 @@ package body Sem_Elab is
-- which the pragma applies. This prevents spurious warnings when the
-- called entity is renamed within U.
+ --------------------------------------
+ -- Activate_Elaborate_All_Desirable --
+ --------------------------------------
+
+ procedure Activate_Elaborate_All_Desirable (N : Node_Id; U : Entity_Id) is
+ UN : constant Unit_Number_Type := Get_Code_Unit (N);
+ CU : constant Node_Id := Cunit (UN);
+ UE : constant Entity_Id := Cunit_Entity (UN);
+ Unm : constant Unit_Name_Type := Unit_Name (UN);
+ CI : constant List_Id := Context_Items (CU);
+ Itm : Node_Id;
+ Ent : Entity_Id;
+
+ procedure Set_Elab_Flag (Itm : Node_Id);
+ -- Sets Elaborate_[All_]Desirable as appropriate on Itm
+
+ -------------------
+ -- Set_Elab_Flag --
+ -------------------
+
+ procedure Set_Elab_Flag (Itm : Node_Id) is
+ begin
+ if Nkind (N) in N_Subprogram_Instantiation then
+ Set_Elaborate_Desirable (Itm);
+ else
+ Set_Elaborate_All_Desirable (Itm);
+ end if;
+ end Set_Elab_Flag;
+
+ -- Start of processing for Activate_Elaborate_All_Desirable
+
+ begin
+ Itm := First (CI);
+ while Present (Itm) loop
+ if Nkind (Itm) = N_With_Clause then
+ Ent := Cunit_Entity (Get_Cunit_Unit_Number (Library_Unit (Itm)));
+
+ -- If we find it, then mark elaborate all desirable and return
+
+ if U = Ent then
+ Set_Elab_Flag (Itm);
+ return;
+ end if;
+ end if;
+
+ Next (Itm);
+ end loop;
+
+ -- If we fall through then the with clause is not present in the
+ -- current unit. One legitimate possibility is that the with clause
+ -- is present in the spec when we are a body.
+
+ if Is_Body_Name (Unm) then
+ declare
+ UEs : constant Entity_Id := Spec_Entity (UE);
+ UNs : constant Unit_Number_Type := Get_Source_Unit (UEs);
+ CUs : constant Node_Id := Cunit (UNs);
+ CIs : constant List_Id := Context_Items (CUs);
+
+ begin
+ Itm := First (CIs);
+ while Present (Itm) loop
+ if Nkind (Itm) = N_With_Clause then
+ Ent :=
+ Cunit_Entity (Get_Cunit_Unit_Number (Library_Unit (Itm)));
+
+ if U = Ent then
+
+ -- If we find it, we have to create an implicit copy
+ -- of the with clause for the body, just so that it
+ -- can be marked as elaborate desirable (it would be
+ -- wrong to put it on the spec item, since it is the
+ -- body that has possible elaboration problems, not
+ -- the spec.
+
+ declare
+ CW : constant Node_Id :=
+ Make_With_Clause (Sloc (Itm),
+ Name => Name (Itm));
+
+ begin
+ Set_Library_Unit (CW, Library_Unit (Itm));
+ Set_Implicit_With (CW, True);
+
+ -- Set elaborate all desirable on copy and then
+ -- append the copy to the list of body with's
+ -- and we are done.
+
+ Set_Elab_Flag (CW);
+ Append_To (CI, CW);
+ return;
+ end;
+ end if;
+ end if;
+
+ Next (Itm);
+ end loop;
+ end;
+ end if;
+
+ -- Here if we do not find with clause on spec or body. We just ignore
+ -- this case, it means that the elaboration involves some other unit
+ -- than the unit being compiled, and will be caught elsewhere.
+
+ null;
+ end Activate_Elaborate_All_Desirable;
+
------------------
-- Check_A_Call --
------------------
@@ -370,7 +483,7 @@ package body Sem_Elab is
if (Nkind (N) = N_Function_Call
or else Nkind (N) = N_Procedure_Call_Statement)
- and then No_Elaboration_Check (N)
+ and then No_Elaboration_Check (N)
then
return;
end if;
@@ -710,8 +823,15 @@ package body Sem_Elab is
end if;
Error_Msg_Qual_Level := Nat'Last;
- Error_Msg_NE
- ("\missing pragma Elaborate_All for&?", N, W_Scope);
+
+ if Nkind (N) in N_Subprogram_Instantiation then
+ Error_Msg_NE
+ ("\missing pragma Elaborate for&?", N, W_Scope);
+ else
+ Error_Msg_NE
+ ("\missing pragma Elaborate_All for&?", N, W_Scope);
+ end if;
+
Error_Msg_Qual_Level := 0;
Output_Calls (N);
@@ -893,7 +1013,6 @@ package body Sem_Elab is
("\?Program_Error will be raised at run time", N);
Insert_Elab_Check (N);
Set_ABE_Is_Certain (N);
-
end Check_Bad_Instantiation;
---------------------
@@ -1110,13 +1229,19 @@ package body Sem_Elab is
return;
end if;
- if Nkind (P) = N_Subprogram_Body
- or else
- Nkind (P) = N_Protected_Body
+ -- A protected body has no elaboration code and contains
+ -- only other bodies.
+
+ if Nkind (P) = N_Protected_Body then
+ return;
+
+ elsif Nkind (P) = N_Subprogram_Body
or else
Nkind (P) = N_Task_Body
or else
Nkind (P) = N_Block_Statement
+ or else
+ Nkind (P) = N_Entry_Body
then
if L = Declarations (P) then
exit;
@@ -1510,7 +1635,6 @@ package body Sem_Elab is
else
Check_Internal_Call_Continue (N, E, Outer_Scope, Orig_Ent);
end if;
-
end Check_Internal_Call;
----------------------------------
@@ -1661,9 +1785,9 @@ package body Sem_Elab is
-- does not normally visit subprogram bodies.
declare
- Decl : Node_Id := First (Declarations (Sbody));
-
+ Decl : Node_Id;
begin
+ Decl := First (Declarations (Sbody));
while Present (Decl) loop
Traverse (Decl);
Next (Decl);
@@ -1830,7 +1954,6 @@ package body Sem_Elab is
and then Has_Task (Base_Type (Typ))
then
Comp := First_Component (Typ);
-
while Present (Comp) loop
Add_Task_Proc (Etype (Comp));
Comp := Next_Component (Comp);
@@ -1874,10 +1997,9 @@ package body Sem_Elab is
end if;
else
- Elmt := First_Elmt (Inter_Procs);
-
-- No need for multiple entries of the same type
+ Elmt := First_Elmt (Inter_Procs);
while Present (Elmt) loop
if Node (Elmt) = Proc then
return;
@@ -1899,9 +2021,7 @@ package body Sem_Elab is
begin
if Present (Decls) then
Decl := First (Decls);
-
while Present (Decl) loop
-
if Nkind (Decl) = N_Object_Declaration
and then Has_Task (Etype (Defining_Identifier (Decl)))
then
@@ -1918,9 +2038,10 @@ package body Sem_Elab is
----------------
function Outer_Unit (E : Entity_Id) return Entity_Id is
- Outer : Entity_Id := E;
+ Outer : Entity_Id;
begin
+ Outer := E;
while Present (Outer) loop
if Elaboration_Checks_Suppressed (Outer) then
Cunit_SC := True;
@@ -1970,7 +2091,6 @@ package body Sem_Elab is
-- the task body to be elaborated before the current one.
Elmt := First_Elmt (Inter_Procs);
-
while Present (Elmt) loop
Ent := Node (Elmt);
Task_Scope := Outer_Unit (Scope (Ent));
@@ -2014,7 +2134,7 @@ package body Sem_Elab is
" requires pragma Elaborate_All on &?", N, Ent);
end if;
- Set_Elaborate_All_Desirable (Task_Scope);
+ Activate_Elaborate_All_Desirable (N, Task_Scope);
Set_Suppress_Elaboration_Warnings (Task_Scope);
end if;
@@ -2025,8 +2145,8 @@ package body Sem_Elab is
-- the task procedure bodies, which are available.
In_Task_Activation := True;
- Elmt := First_Elmt (Intra_Procs);
+ Elmt := First_Elmt (Intra_Procs);
while Present (Elmt) loop
Ent := Node (Elmt);
Check_Internal_Call_Continue (N, Ent, Enclosing, Ent);
@@ -2060,7 +2180,7 @@ package body Sem_Elab is
or else
(Is_Child_Unit (Scop) and then Is_Visible_Child_Unit (Scop))
then
- Set_Elaborate_All_Desirable (Scop);
+ Activate_Elaborate_All_Desirable (Call, Scop);
Set_Suppress_Elaboration_Warnings (Scop, True);
return;
end if;
@@ -2077,13 +2197,14 @@ package body Sem_Elab is
null; -- detailed processing follows.
else
- Set_Elaborate_All_Desirable (Scop);
+ Activate_Elaborate_All_Desirable (Call, Scop);
Set_Suppress_Elaboration_Warnings (Scop, True);
return;
end if;
-- If the unit is not in the context, there must be an intermediate
- -- unit that is, on which we need to place to elaboration flag.
+ -- unit that is, on which we need to place to elaboration flag. This
+ -- happens with init proc calls.
if Is_Init_Proc (Subp)
or else Init_Call
@@ -2098,22 +2219,22 @@ package body Sem_Elab is
Etype (First (Parameter_Associations (Call)));
begin
Elab_Unit := Scope (Typ);
-
while (Present (Elab_Unit))
and then not Is_Compilation_Unit (Elab_Unit)
loop
Elab_Unit := Scope (Elab_Unit);
end loop;
end;
- elsif Nkind (Original_Node (Call)) = N_Selected_Component then
- -- If original node uses selected component notation, the
- -- prefix is visible and determines the scope that must be
- -- elaborated. After rewriting, the prefix is the first actual
- -- in the call.
+ -- If original node uses selected component notation, the prefix is
+ -- visible and determines the scope that must be elaborated. After
+ -- rewriting, the prefix is the first actual in the call.
+ elsif Nkind (Original_Node (Call)) = N_Selected_Component then
Elab_Unit := Scope (Etype (First (Parameter_Associations (Call))));
+ -- Not one of special cases above
+
else
-- Using previously computed scope. If the elaboration check is
-- done after analysis, the scope is not visible any longer, but
@@ -2122,7 +2243,7 @@ package body Sem_Elab is
Elab_Unit := Scop;
end if;
- Set_Elaborate_All_Desirable (Elab_Unit);
+ Activate_Elaborate_All_Desirable (Call, Elab_Unit);
Set_Suppress_Elaboration_Warnings (Elab_Unit, True);
end Set_Elaboration_Constraint;
@@ -2268,7 +2389,7 @@ package body Sem_Elab is
-- Otherwise look and see if we are embedded in a further package
- elsif Is_Package (Scop) then
+ elsif Is_Package_Or_Generic_Package (Scop) then
-- If so, get the body of the enclosing package, and look in
-- its package body for the package body we are looking for.
@@ -2311,16 +2432,15 @@ package body Sem_Elab is
-- Case of entity is in other than a package spec, in this case
-- the body, if present, must be in the same declarative part.
- if not Is_Package (Scop) then
+ if not Is_Package_Or_Generic_Package (Scop) then
declare
P : Node_Id;
begin
- P := Declaration_Node (Ent);
-
-- Declaration node may get us a spec, so if so, go to
-- the parent declaration.
+ P := Declaration_Node (Ent);
while not Is_List_Member (P) loop
P := Parent (P);
end loop;
@@ -2532,18 +2652,26 @@ package body Sem_Elab is
----------------------------
function Same_Elaboration_Scope (Scop1, Scop2 : Entity_Id) return Boolean is
- S1 : Entity_Id := Scop1;
- S2 : Entity_Id := Scop2;
+ S1 : Entity_Id;
+ S2 : Entity_Id;
begin
+ -- Find elaboration scope for Scop1
+
+ S1 := Scop1;
while S1 /= Standard_Standard
and then (Ekind (S1) = E_Package
or else
+ Ekind (S1) = E_Protected_Type
+ or else
Ekind (S1) = E_Block)
loop
S1 := Scope (S1);
end loop;
+ -- Find elaboration scope for Scop2
+
+ S2 := Scop2;
while S2 /= Standard_Standard
and then (Ekind (S2) = E_Package
or else
@@ -2606,7 +2734,6 @@ package body Sem_Elab is
if Nkind (N) = N_Subprogram_Declaration then
declare
Ent : constant Entity_Id := Defining_Unit_Name (Specification (N));
-
begin
Set_Is_Imported (Ent);
Set_Convention (Ent, Convention_Stubbed);
@@ -2615,7 +2742,6 @@ package body Sem_Elab is
elsif Nkind (N) = N_Package_Declaration then
declare
Spec : constant Node_Id := Specification (N);
-
begin
New_Scope (Defining_Unit_Name (Spec));
Supply_Bodies (Visible_Declarations (Spec));
@@ -2627,7 +2753,6 @@ package body Sem_Elab is
procedure Supply_Bodies (L : List_Id) is
Elmt : Node_Id;
-
begin
if Present (L) then
Elmt := First (L);
@@ -2647,7 +2772,6 @@ package body Sem_Elab is
begin
Scop := E1;
-
loop
if Scop = E2 then
return True;
@@ -2675,25 +2799,23 @@ package body Sem_Elab is
begin
Item := First (Context_Items (Cunit (Current_Sem_Unit)));
-
while Present (Item) loop
if Nkind (Item) = N_Pragma
and then Get_Pragma_Id (Chars (Item)) = Pragma_Elaborate_All
then
- if Error_Posted (Item) then
-
- -- Some previous error on the pragma itself
+ -- Return if some previous error on the pragma itself
+ if Error_Posted (Item) then
return False;
end if;
Elab_Id :=
- Entity (
- Expression (First (Pragma_Argument_Associations (Item))));
+ Entity
+ (Expression (First (Pragma_Argument_Associations (Item))));
- Par := Parent (Unit_Declaration_Node (Elab_Id));
- Item2 := First (Context_Items (Par));
+ Par := Parent (Unit_Declaration_Node (Elab_Id));
+ Item2 := First (Context_Items (Par));
while Present (Item2) loop
if Nkind (Item2) = N_With_Clause
and then Entity (Name (Item2)) = E
diff --git a/gcc/ada/sem_elab.ads b/gcc/ada/sem_elab.ads
index 106cb72c6b1..e42a4ab20f4 100644
--- a/gcc/ada/sem_elab.ads
+++ b/gcc/ada/sem_elab.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_elim.ads b/gcc/ada/sem_elim.ads
index e3a3b153240..c87f4f0cb48 100644
--- a/gcc/ada/sem_elim.ads
+++ b/gcc/ada/sem_elim.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1997-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index 396027d39b4..d99e042dd5c 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@ with Elists; use Elists;
with Errout; use Errout;
with Eval_Fat; use Eval_Fat;
with Exp_Util; use Exp_Util;
+with Lib; use Lib;
with Nmake; use Nmake;
with Nlists; use Nlists;
with Opt; use Opt;
@@ -4004,11 +4005,21 @@ package body Sem_Eval is
return True;
-- A definite type does not match an indefinite or classwide type
+ -- However, a generic type with unknown discriminants may be
+ -- instantiated with a type with no discriminants, and conformance
+ -- checking on an inherited operation may compare the actual with
+ -- the subtype that renames it in the instance.
elsif
Has_Unknown_Discriminants (T1) /= Has_Unknown_Discriminants (T2)
then
- return False;
+ if Is_Generic_Actual_Type (T1)
+ and then Etype (T1) = T2
+ then
+ return True;
+ else
+ return False;
+ end if;
-- Array type
@@ -4083,13 +4094,17 @@ package body Sem_Eval is
is
begin
Stat := False;
+ Fold := False;
+
+ if Debug_Flag_Dot_F and then In_Extended_Main_Source_Unit (N) then
+ return;
+ end if;
-- If operand is Any_Type, just propagate to result and do not
-- try to fold, this prevents cascaded errors.
if Etype (Op1) = Any_Type then
Set_Etype (N, Any_Type);
- Fold := False;
return;
-- If operand raises constraint error, then replace node N with the
@@ -4099,7 +4114,6 @@ package body Sem_Eval is
elsif Raises_Constraint_Error (Op1) then
Rewrite_In_Raise_CE (N, Op1);
- Fold := False;
return;
-- If the operand is not static, then the result is not static, and
@@ -4118,7 +4132,6 @@ package body Sem_Eval is
and then Is_Generic_Type (Etype (Op1))
then
Check_Non_Static_Context (Op1);
- Fold := False;
return;
-- Here we have the case of an operand whose type is OK, which is
@@ -4145,13 +4158,17 @@ package body Sem_Eval is
begin
Stat := False;
+ Fold := False;
+
+ if Debug_Flag_Dot_F and then In_Extended_Main_Source_Unit (N) then
+ return;
+ end if;
-- If either operand is Any_Type, just propagate to result and
-- do not try to fold, this prevents cascaded errors.
if Etype (Op1) = Any_Type or else Etype (Op2) = Any_Type then
Set_Etype (N, Any_Type);
- Fold := False;
return;
-- If left operand raises constraint error, then replace node N with
@@ -4166,7 +4183,6 @@ package body Sem_Eval is
Rewrite_In_Raise_CE (N, Op1);
Set_Is_Static_Expression (N, Rstat);
- Fold := False;
return;
-- Similar processing for the case of the right operand. Note that
@@ -4180,7 +4196,6 @@ package body Sem_Eval is
Rewrite_In_Raise_CE (N, Op2);
Set_Is_Static_Expression (N, Rstat);
- Fold := False;
return;
-- Exclude expressions of a generic modular type, as above
@@ -4189,7 +4204,6 @@ package body Sem_Eval is
and then Is_Generic_Type (Etype (Op1))
then
Check_Non_Static_Context (Op1);
- Fold := False;
return;
-- If result is not static, then check non-static contexts on operands
diff --git a/gcc/ada/sem_eval.ads b/gcc/ada/sem_eval.ads
index bf9d712f986..5509185db31 100644
--- a/gcc/ada/sem_eval.ads
+++ b/gcc/ada/sem_eval.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb
index c7643b3dacd..4362a0ea4bb 100644
--- a/gcc/ada/sem_intr.adb
+++ b/gcc/ada/sem_intr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -132,6 +132,15 @@ package body Sem_Intr is
("argument in call to & must be 31 characters or less", N, Nam);
end if;
+ -- Check for the case of freeing a non-null object which will raise
+ -- Constaint_Error. Issue warning here, do the expansion in Exp_Intr.
+
+ elsif Cnam = Name_Free
+ and then Can_Never_Be_Null (Etype (Arg1))
+ then
+ Error_Msg_N
+ ("freeing `NOT NULL` object will raise Constraint_Error?", N);
+
-- For now, no other special checks are required
else
diff --git a/gcc/ada/sem_intr.ads b/gcc/ada/sem_intr.ads
index 3629786993e..851686af0a9 100644
--- a/gcc/ada/sem_intr.ads
+++ b/gcc/ada/sem_intr.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_maps.adb b/gcc/ada/sem_maps.adb
index 90c1c4a3ac1..0a66a91f0b3 100644
--- a/gcc/ada/sem_maps.adb
+++ b/gcc/ada/sem_maps.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_maps.ads b/gcc/ada/sem_maps.ads
index 5d8e6af4ffd..eb126790665 100644
--- a/gcc/ada/sem_maps.ads
+++ b/gcc/ada/sem_maps.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -36,7 +36,7 @@
-- Map composition of renaming maps takes place for nested instantiations,
-- for generic child units, and for formal packages.
--- For additional details, see the documentation in sem_ch12.
+-- For additional details, see the documentation in sem_ch12
with Table;
with Types; use Types;
@@ -58,24 +58,24 @@ package Sem_Maps is
-- and New_Map (e2) = e3, then the image of e1 under the result is e3.
function Copy (M : Map) return Map;
- -- Full copy of contents and headers.
+ -- Full copy of contents and headers
function Lookup (M : Map; E : Entity_Id) return Entity_Id;
- -- Retrieve image of E under M, Empty if undefined.
+ -- Retrieve image of E under M, Empty if undefined
procedure Add_Association
(M : in out Map;
O_Id : Entity_Id;
N_Id : Entity_Id;
Kind : Scope_Kind := S_Local);
- -- Update M in place. On entry M (O_Id) must not be defined.
+ -- Update M in place. On entry M (O_Id) must not be defined
procedure Update_Association
(M : in out Map;
O_Id : Entity_Id;
N_Id : Entity_Id;
Kind : Scope_Kind := S_Local);
- -- Update the entry in M for O_Id.
+ -- Update the entry in M for O_Id
function Build_Instance_Map (M : Map) return Map;
-- Copy renaming map of generic, and create new entities for all the
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 29233a4f7ca..b06f117e158 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -64,6 +64,7 @@ with Sem_Res; use Sem_Res;
with Sem_Type; use Sem_Type;
with Sem_Util; use Sem_Util;
with Sem_VFpt; use Sem_VFpt;
+with Sem_Warn; use Sem_Warn;
with Stand; use Stand;
with Sinfo; use Sinfo;
with Sinfo.CN; use Sinfo.CN;
@@ -236,8 +237,9 @@ package body Sem_Prag is
Pragma_Exit : exception;
-- This exception is used to exit pragma processing completely. It
- -- is used when an error is detected, and in other situations where
- -- it is known that no further processing is required.
+ -- is used when an error is detected, and no further processing is
+ -- required. It is also used if an earlier error has left the tree
+ -- in a state where the pragma should not be processed.
Arg_Count : Nat;
-- Number of pragma argument associations
@@ -1331,15 +1333,12 @@ package body Sem_Prag is
Analyze (Expression (Arg1));
- if Unit_Kind = N_Generic_Subprogram_Declaration
+ if Unit_Kind = N_Generic_Subprogram_Declaration
or else Unit_Kind = N_Subprogram_Declaration
then
Unit_Name := Defining_Entity (Unit_Node);
- elsif Unit_Kind = N_Function_Instantiation
- or else Unit_Kind = N_Package_Instantiation
- or else Unit_Kind = N_Procedure_Instantiation
- then
+ elsif Unit_Kind in N_Generic_Instantiation then
Unit_Name := Defining_Entity (Unit_Node);
else
@@ -2141,7 +2140,7 @@ package body Sem_Prag is
and then Ekind (E) /= E_Variable
and then not
(Is_Access_Type (E)
- and then Ekind (Designated_Type (E)) = E_Subprogram_Type)
+ and then Ekind (Designated_Type (E)) = E_Subprogram_Type)
then
Error_Pragma_Arg
("second argument of pragma% must be subprogram (type)",
@@ -3784,9 +3783,21 @@ package body Sem_Prag is
-- suppress check for any check id value.
if C = All_Checks then
+
+ -- For All_Checks, we set all specific checks with the
+ -- exception of Elaboration_Check, which is handled specially
+ -- because of not wanting All_Checks to have the effect of
+ -- deactivating static elaboration order processing.
+
for J in Scope_Suppress'Range loop
- Scope_Suppress (J) := Suppress_Case;
+ if J /= Elaboration_Check then
+ Scope_Suppress (J) := Suppress_Case;
+ end if;
end loop;
+
+ -- If not All_Checks, just set appropriate entry. Note that we
+ -- will set Elaboration_Check if this is explicitly specified.
+
else
Scope_Suppress (C) := Suppress_Case;
end if;
@@ -4259,7 +4270,7 @@ package body Sem_Prag is
if Warn_On_Unrecognized_Pragma then
Error_Pragma ("unrecognized pragma%!?");
else
- raise Pragma_Exit;
+ return;
end if;
else
Prag_Id := Get_Pragma_Id (Chars (N));
@@ -5885,7 +5896,7 @@ package body Sem_Prag is
Error_Pragma ("pragma% must refer to a spec, not a body");
else
Set_Body_Required (Cunit_Node, True);
- Set_Has_Pragma_Elaborate_Body (Cunit_Ent);
+ Set_Has_Pragma_Elaborate_Body (Cunit_Ent);
-- If we are in dynamic elaboration mode, then we suppress
-- elaboration warnings for the unit, since it is definitely
@@ -5991,7 +6002,7 @@ package body Sem_Prag is
Present (Source_Location)
then
Error_Pragma
- ("parameter profile and source location can not " &
+ ("parameter profile and source location cannot " &
"be used together in pragma%");
end if;
@@ -8141,6 +8152,28 @@ package body Sem_Prag is
S : String_Id;
Active : Boolean := True;
+ procedure Check_Obsolete_Subprogram;
+ -- Checks if Subp is a subprogram declaration node, and if so
+ -- replaces Subp by the defining entity of the subprogram. If not,
+ -- issues an error message
+
+ ------------------------------
+ -- Check_Obsolete_Subprogram--
+ ------------------------------
+
+ procedure Check_Obsolete_Subprogram is
+ begin
+ if Nkind (Subp) /= N_Subprogram_Declaration then
+ Error_Pragma
+ ("pragma% misplaced, must immediately " &
+ "follow subprogram/package declaration");
+ else
+ Subp := Defining_Entity (Subp);
+ end if;
+ end Check_Obsolete_Subprogram;
+
+ -- Start of processing for pragma Obsolescent
+
begin
GNAT_Pragma;
Check_At_Most_N_Arguments (2);
@@ -8153,6 +8186,7 @@ package body Sem_Prag is
if Present (Prev (N)) then
Subp := Prev (N);
+ Check_Obsolete_Subprogram;
-- Second possibility, stand alone subprogram declaration with the
-- pragma immediately following the declaration.
@@ -8161,25 +8195,22 @@ package body Sem_Prag is
and then Nkind (Parent (N)) = N_Compilation_Unit_Aux
then
Subp := Unit (Parent (Parent (N)));
+ Check_Obsolete_Subprogram;
- -- Any other possibility is a misplacement
+ -- Only other possibility is library unit placement for package
else
- Subp := Empty;
- end if;
-
- -- Check correct placement
+ Subp := Find_Lib_Unit_Name;
- if Nkind (Subp) /= N_Subprogram_Declaration then
- Error_Pragma
- ("pragma% misplaced, must immediately " &
- "follow subprogram spec");
+ if Ekind (Subp) /= E_Package
+ and then Ekind (Subp) /= E_Generic_Package
+ then
+ Check_Obsolete_Subprogram;
+ end if;
end if;
-- If OK placement, acquire arguments
- Subp := Defining_Entity (Subp);
-
if Arg_Count >= 1 then
-- Deal with static string argument
@@ -9907,8 +9938,7 @@ package body Sem_Prag is
("pragma% requires separate spec and must come before body");
elsif Rep_Item_Too_Early (E, N)
- or else
- Rep_Item_Too_Late (E, N)
+ or else Rep_Item_Too_Late (E, N)
then
raise Pragma_Exit;
@@ -10346,16 +10376,58 @@ package body Sem_Prag is
--------------
-- pragma Warnings (On | Off, [LOCAL_NAME])
+ -- pragma Warnings (static_string_EXPRESSION);
when Pragma_Warnings => Warnings : begin
GNAT_Pragma;
Check_At_Least_N_Arguments (1);
- Check_At_Most_N_Arguments (2);
Check_No_Identifiers;
- -- One argument case was processed by parser in Par.Prag
+ -- One argument case
- if Arg_Count /= 1 then
+ if Arg_Count = 1 then
+ declare
+ Argx : constant Node_Id := Get_Pragma_Arg (Arg1);
+
+ begin
+ -- On/Off one argument case was processed by parser
+
+ if Nkind (Argx) = N_Identifier
+ and then
+ (Chars (Argx) = Name_On
+ or else
+ Chars (Argx) = Name_Off)
+ then
+ null;
+
+ else
+ Check_Arg_Is_Static_Expression (Arg1, Standard_String);
+
+ declare
+ Lit : constant Node_Id := Expr_Value_S (Argx);
+ Str : constant String_Id := Strval (Lit);
+ C : Char_Code;
+
+ begin
+ for J in 1 .. String_Length (Str) loop
+ C := Get_String_Char (Str, J);
+
+ if In_Character_Range (C)
+ and then Set_Warning_Switch (Get_Character (C))
+ then
+ null;
+ else
+ Error_Pragma_Arg
+ ("invalid warning switch character", Arg1);
+ end if;
+ end loop;
+ end;
+ end if;
+ end;
+
+ -- Two argument case
+
+ elsif Arg_Count /= 1 then
Check_Arg_Is_One_Of (Arg1, Name_On, Name_Off);
Check_Arg_Count (2);
@@ -10372,7 +10444,7 @@ package body Sem_Prag is
-- is a conversion. Retrieve the real entity name.
if (In_Instance_Body
- or else In_Inlined_Body)
+ or else In_Inlined_Body)
and then Nkind (E_Id) = N_Unchecked_Type_Conversion
then
E_Id := Expression (E_Id);
@@ -10390,8 +10462,8 @@ package body Sem_Prag is
return;
else
loop
- Set_Warnings_Off (E,
- (Chars (Expression (Arg1)) = Name_Off));
+ Set_Warnings_Off
+ (E, (Chars (Expression (Arg1)) = Name_Off));
if Is_Enumeration_Type (E) then
declare
@@ -10410,6 +10482,10 @@ package body Sem_Prag is
end loop;
end if;
end;
+
+ -- More than two arguments
+ else
+ Check_At_Most_N_Arguments (2);
end if;
end Warnings;
diff --git a/gcc/ada/sem_prag.ads b/gcc/ada/sem_prag.ads
index b598fdf2ec2..ed2a9a06f7d 100644
--- a/gcc/ada/sem_prag.ads
+++ b/gcc/ada/sem_prag.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -28,62 +28,62 @@
-- (logically this processing belongs in chapter 4)
with Types; use Types;
+
package Sem_Prag is
procedure Analyze_Pragma (N : Node_Id);
-- Analyze procedure for pragma reference node N
function Delay_Config_Pragma_Analyze (N : Node_Id) return Boolean;
- -- N is a pragma appearing in a configuration pragma file. Most
- -- such pragmas are analyzed when the file is read, before parsing
- -- and analyzing the main unit. However, the analysis of certain
- -- pragmas results in adding information to the compiled main unit,
- -- and this cannot be done till the main unit is processed. Such
- -- pragmas return True from this function and in Frontend pragmas
- -- where Delay_Config_Pragma_Analyze is True have their analysis
- -- delayed until after the main program is parsed and analyzed.
+ -- N is a pragma appearing in a configuration pragma file. Most such
+ -- pragmas are analyzed when the file is read, before parsing and analyzing
+ -- the main unit. However, the analysis of certain pragmas results in
+ -- adding information to the compiled main unit, and this cannot be done
+ -- till the main unit is processed. Such pragmas return True from this
+ -- function and in Frontend pragmas where Delay_Config_Pragma_Analyze is
+ -- True have their analysis delayed until after the main program is parsed
+ -- and analyzed.
function Is_Non_Significant_Pragma_Reference (N : Node_Id) return Boolean;
-- The node N is a node for an entity and the issue is whether the
- -- occurrence is a reference for the purposes of giving warnings
- -- about unreferenced variables. This function returns True if the
- -- reference is not a reference from this point of view (e.g. the
- -- occurrence in a pragma Pack) and False if it is a real reference
- -- (e.g. the occcurrence in a pragma Export);
+ -- occurrence is a reference for the purposes of giving warnings about
+ -- unreferenced variables. This function returns True if the reference is
+ -- not a reference from this point of view (e.g. the occurrence in a pragma
+ -- Pack) and False if it is a real reference (e.g. the occcurrence in a
+ -- pragma Export);
function Is_Pragma_String_Literal (Par : Node_Id) return Boolean;
- -- Given an N_Pragma_Argument_Association node, Par, which has the form
- -- of an operator symbol, determines whether or not it should be treated
- -- as an string literal. This is called by Sem_Ch6.Analyze_Operator_Symbol.
- -- If True is returned, the argument is converted to a string literal. If
+ -- Given an N_Pragma_Argument_Association node, Par, which has the form of
+ -- an operator symbol, determines whether or not it should be treated as an
+ -- string literal. This is called by Sem_Ch6.Analyze_Operator_Symbol. If
+ -- True is returned, the argument is converted to a string literal. If
-- False is returned, then the argument is treated as an entity reference
-- to the operator.
function Is_Config_Static_String (Arg : Node_Id) return Boolean;
- -- This is called for a configuration pragma that requires either a
- -- string literal or a concatenation of string literals. We cannot
- -- use normal static string processing because it is too early in
- -- the case of the pragma appearing in a configuration pragmas file.
- -- If Arg is of an appropriate form, then this call obtains the string
- -- (doing any necessary concatenations) and places it in Name_Buffer,
- -- setting Name_Len to its length, and then returns True. If it is
- -- not of the correct form, then an appropriate error message is
- -- posted, and False is returned.
+ -- This is called for a configuration pragma that requires either string
+ -- literal or a concatenation of string literals. We cannot use normal
+ -- static string processing because it is too early in the case of the
+ -- pragma appearing in a configuration pragmas file. If Arg is of an
+ -- appropriate form, then this call obtains the string (doing any necessary
+ -- concatenations) and places it in Name_Buffer, setting Name_Len to its
+ -- length, and then returns True. If it is not of the correct form, then an
+ -- appropriate error message is posted, and False is returned.
procedure Process_Compilation_Unit_Pragmas (N : Node_Id);
- -- Called at the start of processing compilation unit N to deal with
- -- any special issues regarding pragmas. In particular, we have to
- -- deal with Suppress_All at this stage, since it appears after the
- -- unit instead of before.
+ -- Called at the start of processing compilation unit N to deal with any
+ -- special issues regarding pragmas. In particular, we have to deal with
+ -- Suppress_All at this stage, since it appears after the unit instead of
+ -- before.
procedure Set_Encoded_Interface_Name (E : Entity_Id; S : Node_Id);
- -- This routine is used to set an encoded interface name. The node
- -- S is an N_String_Literal node for the external name to be set, and
- -- E is an entity whose Interface_Name field is to be set. In the
- -- normal case where S contains a name that is a valid C identifier,
- -- then S is simply set as the value of the Interface_Name. Otherwise
- -- it is encoded. See the body for details of the encoding. This
- -- encoding is only done on VMS systems, since it seems pretty silly,
- -- but is needed to pass some dubious tests in the test suite.
+ -- This routine is used to set an encoded interface name. The node S is an
+ -- N_String_Literal node for the external name to be set, and E is an
+ -- entity whose Interface_Name field is to be set. In the normal case where
+ -- S contains a name that is a valid C identifier, then S is simply set as
+ -- the value of the Interface_Name. Otherwise it is encoded. See the body
+ -- for details of the encoding. This encoding is only done on VMS systems,
+ -- since it seems pretty silly, but is needed to pass some dubious tests in
+ -- the test suite.
end Sem_Prag;
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index e1e9b7b4ec3..f9093455fbb 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -280,7 +280,6 @@ package body Sem_Res is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Analyze_And_Resolve (N, Typ);
@@ -322,7 +321,6 @@ package body Sem_Res is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Analyze_And_Resolve (N);
@@ -685,12 +683,30 @@ package body Sem_Res is
if Nkind (Parent (N)) = N_Return_Statement
and then Same_Argument_List
then
- exit when not Is_List_Member (Parent (N))
- or else (Nkind (Prev (Parent (N))) /= N_Raise_Statement
- and then
- (Nkind (Prev (Parent (N))) not in N_Raise_xxx_Error
- or else
- Present (Condition (Prev (Parent (N))))));
+ exit when not Is_List_Member (Parent (N));
+
+ -- OK, return statement is in a statement list, look for raise
+
+ declare
+ Nod : Node_Id;
+
+ begin
+ -- Skip past N_Freeze_Entity nodes generated by expansion
+
+ Nod := Prev (Parent (N));
+ while Present (Nod)
+ and then Nkind (Nod) = N_Freeze_Entity
+ loop
+ Prev (Nod);
+ end loop;
+
+ -- If no raise statement, give warning
+
+ exit when Nkind (Nod) /= N_Raise_Statement
+ and then
+ (Nkind (Nod) not in N_Raise_xxx_Error
+ or else Present (Condition (Nod)));
+ end;
end if;
return False;
@@ -1124,6 +1140,13 @@ package body Sem_Res is
then
null;
+ -- Visibility does not need to be checked in an instance: if the
+ -- operator was not visible in the generic it has been diagnosed
+ -- already, else there is an implicit copy of it in the instance.
+
+ elsif In_Instance then
+ null;
+
elsif (Op_Name = Name_Op_Multiply
or else Op_Name = Name_Op_Divide)
and then Is_Fixed_Point_Type (Etype (Left_Opnd (Op_Node)))
@@ -2316,7 +2339,6 @@ package body Sem_Res is
if Suppress = All_Checks then
declare
Svg : constant Suppress_Array := Scope_Suppress;
-
begin
Scope_Suppress := (others => True);
Resolve (N, Typ);
@@ -2326,7 +2348,6 @@ package body Sem_Res is
else
declare
Svg : constant Boolean := Scope_Suppress (Suppress);
-
begin
Scope_Suppress (Suppress) := True;
Resolve (N, Typ);
@@ -3519,7 +3540,6 @@ package body Sem_Res is
It : Interp;
Norm_OK : Boolean;
Scop : Entity_Id;
- W : Node_Id;
begin
-- The context imposes a unique interpretation with type Typ on a
@@ -3659,39 +3679,9 @@ package body Sem_Res is
Kill_Current_Values;
end if;
- -- Deal with call to obsolescent subprogram. Note that we always allow
- -- such calls in the compiler itself and the run-time, since we assume
- -- that we know what we are doing in such cases. For example, the calls
- -- in Ada.Characters.Handling to its own obsolescent subprograms are
- -- just fine.
-
- if Is_Obsolescent (Nam) and then not GNAT_Mode then
- Check_Restriction (No_Obsolescent_Features, N);
-
- if Warn_On_Obsolescent_Feature then
- Error_Msg_NE ("call to obsolescent subprogram&?", N, Nam);
-
- -- Output additional warning if present
-
- W := Obsolescent_Warning (Nam);
+ -- Check for call to subprogram marked Is_Obsolescent
- if Present (W) then
- Name_Buffer (1) := '|';
- Name_Buffer (2) := '?';
- Name_Len := 2;
-
- -- Add characters to message, and output message
-
- for J in 1 .. String_Length (Strval (W)) loop
- Add_Char_To_Name_Buffer (''');
- Add_Char_To_Name_Buffer
- (Get_Character (Get_String_Char (Strval (W), J)));
- end loop;
-
- Error_Msg_N (Name_Buffer (1 .. Name_Len), N);
- end if;
- end if;
- end if;
+ Check_Obsolescent (Nam, N);
-- Check that a procedure call does not occur in the context of the
-- entry call statement of a conditional or timed entry call. Note that
@@ -3720,7 +3710,8 @@ package body Sem_Res is
and then not Is_Controlling_Limited_Procedure (Nam)
then
Error_Msg_N
- ("procedure or entry call required in select statement", N);
+ ("entry call, entry renaming or dispatching primitive " &
+ "of limited or synchronized interface required", N);
end if;
end if;
@@ -5469,25 +5460,47 @@ package body Sem_Res is
and then Has_Compatible_Type (Arg, Typ)
and then Etype (Arg) /= Any_Type
then
- Error_Msg_N ("ambiguous operand for concatenation!", Arg);
declare
- I : Interp_Index;
- It : Interp;
+ I : Interp_Index;
+ It : Interp;
+ Func : Entity_Id;
begin
Get_First_Interp (Arg, I, It);
- while Present (It.Nam) loop
- if Base_Type (Etype (It.Nam)) = Base_Type (Typ)
- or else Base_Type (Etype (It.Nam)) =
- Base_Type (Component_Type (Typ))
- then
+ Func := It.Nam;
+ Get_Next_Interp (I, It);
+
+ -- Special-case the error message when the overloading
+ -- is caused by a function that yields and array and
+ -- can be called without parameters.
+
+ if It.Nam = Func then
+ Error_Msg_Sloc := Sloc (Func);
+ Error_Msg_N ("\ambiguous call to function#", Arg);
+ Error_Msg_NE
+ ("\interpretation as call yields&", Arg, Typ);
+ Error_Msg_NE
+ ("\interpretation as indexing of call yields&",
+ Arg, Component_Type (Typ));
+
+ else
+ Error_Msg_N ("ambiguous operand for concatenation!",
+ Arg);
+ Get_First_Interp (Arg, I, It);
+ while Present (It.Nam) loop
Error_Msg_Sloc := Sloc (It.Nam);
- Error_Msg_N ("\possible interpretation#", Arg);
- end if;
- Get_Next_Interp (I, It);
- end loop;
+ if Base_Type (It.Typ) = Base_Type (Typ)
+ or else Base_Type (It.Typ) =
+ Base_Type (Component_Type (Typ))
+ then
+ Error_Msg_N ("\possible interpretation#", Arg);
+ end if;
+
+ Get_Next_Interp (I, It);
+ end loop;
+ end if;
end;
end if;
@@ -6536,13 +6549,14 @@ package body Sem_Res is
end if;
-- Resolve the real operand with largest available precision
+
if Etype (Right_Opnd (Operand)) = Universal_Real then
Rop := New_Copy_Tree (Right_Opnd (Operand));
else
Rop := New_Copy_Tree (Left_Opnd (Operand));
end if;
- Resolve (Rop, Standard_Long_Long_Float);
+ Resolve (Rop, Universal_Real);
-- If the operand is a literal (it could be a non-static and
-- illegal exponentiation) check whether the use of Duration
@@ -6690,23 +6704,11 @@ package body Sem_Res is
Hi : Uint;
begin
- -- Generate warning for expressions like abs (x mod 2)
-
- if Warn_On_Redundant_Constructs
- and then Nkind (N) = N_Op_Abs
- then
- Determine_Range (Right_Opnd (N), OK, Lo, Hi);
-
- if OK and then Hi >= Lo and then Lo >= 0 then
- Error_Msg_N
- ("?abs applied to known non-negative value has no effect", N);
- end if;
- end if;
-
-- Generate warning for expressions like -5 mod 3
if Paren_Count (N) = 0
and then Nkind (N) = N_Op_Minus
+ and then Paren_Count (Right_Opnd (N)) = 0
and then Nkind (Right_Opnd (N)) = N_Op_Mod
and then Comes_From_Source (N)
then
@@ -6732,6 +6734,19 @@ package body Sem_Res is
Set_Etype (N, B_Typ);
Resolve (R, B_Typ);
+ -- Generate warning for expressions like abs (x mod 2)
+
+ if Warn_On_Redundant_Constructs
+ and then Nkind (N) = N_Op_Abs
+ then
+ Determine_Range (Right_Opnd (N), OK, Lo, Hi);
+
+ if OK and then Hi >= Lo and then Lo >= 0 then
+ Error_Msg_N
+ ("?abs applied to known non-negative value has no effect", N);
+ end if;
+ end if;
+
Check_Unset_Reference (R);
Generate_Operator_Reference (N, B_Typ);
Eval_Unary_Op (N);
@@ -7187,21 +7202,35 @@ package body Sem_Res is
-- is no context type and the removal of the spurious operations
-- must be done explicitly here.
+ -- The node may be labelled overloaded, but still contain only
+ -- one interpretation because others were discarded in previous
+ -- filters. If this is the case, retain the single interpretation
+ -- if legal.
+
Get_First_Interp (Operand, I, It);
+ Opnd_Type := It.Typ;
+ Get_Next_Interp (I, It);
- while Present (It.Typ) loop
- if It.Typ = Standard_Void_Type then
- Remove_Interp (I);
- end if;
+ if Present (It.Typ)
+ and then Opnd_Type /= Standard_Void_Type
+ then
+ -- More than one candidate interpretation is available
- if Present (System_Aux_Id)
- and then Is_Descendent_Of_Address (It.Typ)
- then
- Remove_Interp (I);
- end if;
+ Get_First_Interp (Operand, I, It);
+ while Present (It.Typ) loop
+ if It.Typ = Standard_Void_Type then
+ Remove_Interp (I);
+ end if;
- Get_Next_Interp (I, It);
- end loop;
+ if Present (System_Aux_Id)
+ and then Is_Descendent_Of_Address (It.Typ)
+ then
+ Remove_Interp (I);
+ end if;
+
+ Get_Next_Interp (I, It);
+ end loop;
+ end if;
Get_First_Interp (Operand, I, It);
I1 := I;
diff --git a/gcc/ada/sem_res.ads b/gcc/ada/sem_res.ads
index 2ff4d06e241..f1a098f2c7a 100644
--- a/gcc/ada/sem_res.ads
+++ b/gcc/ada/sem_res.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb
index eca91e59820..94c4c5c060e 100644
--- a/gcc/ada/sem_type.adb
+++ b/gcc/ada/sem_type.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -913,7 +913,10 @@ package body Sem_Type is
and then
Designated_Type (T1) = Designated_Type (T2))
or else (T1 = Any_Access
- and then Is_Access_Type (Underlying_Type (T2))))
+ and then Is_Access_Type (Underlying_Type (T2)))
+ or else (T2 = Any_Composite
+ and then
+ Is_Composite_Type (Underlying_Type (T1))))
then
return True;
@@ -979,6 +982,13 @@ package body Sem_Type is
-- Determine whether one of the candidates is an operation inherited by
-- a type that is derived from an actual in an instantiation.
+ function In_Generic_Actual (Exp : Node_Id) return Boolean;
+ -- Determine whether the expression is part of a generic actual. At
+ -- the time the actual is resolved the scope is already that of the
+ -- instance, but conceptually the resolution of the actual takes place
+ -- in the enclosing context, and no special disambiguation rules should
+ -- be applied.
+
function Is_Actual_Subprogram (S : Entity_Id) return Boolean;
-- Determine whether a subprogram is an actual in an enclosing instance.
-- An overloading between such a subprogram and one declared outside the
@@ -1009,6 +1019,34 @@ package body Sem_Type is
-- pathology in the other direction with calls whose multiple overloaded
-- actuals make them truly unresolvable.
+ ------------------------
+ -- In_Generic_Actual --
+ ------------------------
+
+ function In_Generic_Actual (Exp : Node_Id) return Boolean is
+ Par : constant Node_Id := Parent (Exp);
+
+ begin
+ if No (Par) then
+ return False;
+
+ elsif Nkind (Par) in N_Declaration then
+ if Nkind (Par) = N_Object_Declaration
+ or else Nkind (Par) = N_Object_Renaming_Declaration
+ then
+ return Present (Corresponding_Generic_Association (Par));
+ else
+ return False;
+ end if;
+
+ elsif Nkind (Par) in N_Statement_Other_Than_Procedure_Call then
+ return False;
+
+ else
+ return In_Generic_Actual (Parent (Par));
+ end if;
+ end In_Generic_Actual;
+
---------------------------
-- Inherited_From_Actual --
---------------------------
@@ -1372,7 +1410,9 @@ package body Sem_Type is
-- case the resolution was to the explicit declaration in the
-- generic, and remains so in the instance.
- elsif In_Instance then
+ elsif In_Instance
+ and then not In_Generic_Actual (N)
+ then
if Nkind (N) = N_Function_Call
or else Nkind (N) = N_Procedure_Call_Statement
then
@@ -1801,7 +1841,16 @@ package body Sem_Type is
return True;
end if;
- E := Typ;
+ -- Handle private types
+
+ if Present (Full_View (Typ))
+ and then not Is_Concurrent_Type (Full_View (Typ))
+ then
+ E := Full_View (Typ);
+ else
+ E := Typ;
+ end if;
+
loop
if Present (Abstract_Interfaces (E))
and then Present (Abstract_Interfaces (E))
@@ -1819,7 +1868,12 @@ package body Sem_Type is
end loop;
end if;
- exit when Etype (E) = E;
+ exit when Etype (E) = E
+
+ -- Handle private types
+
+ or else (Present (Full_View (Etype (E)))
+ and then Full_View (Etype (E)) = E);
-- Check if the current type is a direct derivation of the
-- interface
@@ -1828,14 +1882,20 @@ package body Sem_Type is
return True;
end if;
- -- Climb to the immediate ancestor
+ -- Climb to the immediate ancestor handling private types
- E := Etype (E);
+ if Present (Full_View (Etype (E))) then
+ E := Full_View (Etype (E));
+ else
+ E := Etype (E);
+ end if;
end loop;
return False;
end Iface_Present_In_Ancestor;
+ -- Start of processing for Interface_Present_In_Ancestor
+
begin
if Is_Access_Type (Typ) then
Target_Typ := Etype (Directly_Designated_Type (Typ));
@@ -1879,6 +1939,12 @@ package body Sem_Type is
if Ekind (Target_Typ) = E_Incomplete_Type then
pragma Assert (Present (Non_Limited_View (Target_Typ)));
Target_Typ := Non_Limited_View (Target_Typ);
+
+ -- Protect the frontend against previously detected errors
+
+ if Ekind (Target_Typ) = E_Incomplete_Type then
+ return False;
+ end if;
end if;
return Iface_Present_In_Ancestor (Target_Typ);
diff --git a/gcc/ada/sem_type.ads b/gcc/ada/sem_type.ads
index 7f11512f8b1..63c65ec7bc3 100644
--- a/gcc/ada/sem_type.ads
+++ b/gcc/ada/sem_type.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -91,7 +91,7 @@ package Sem_Type is
-----------------
procedure Init_Interp_Tables;
- -- Invoked by gnatf when processing multiple files.
+ -- Invoked by gnatf when processing multiple files
procedure Collect_Interps (N : Node_Id);
-- Invoked when the name N has more than one visible interpretation.
@@ -131,7 +131,7 @@ package Sem_Type is
-- of the operands of N, to check visibility.
procedure End_Interp_List;
- -- End the list of interpretations of current node.
+ -- End the list of interpretations of current node
procedure Get_First_Interp
(N : Node_Id;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index f2835f67461..25f33b15a6b 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -41,6 +41,8 @@ with Nlists; use Nlists;
with Nmake; use Nmake;
with Output; use Output;
with Opt; use Opt;
+with Restrict; use Restrict;
+with Rident; use Rident;
with Rtsfind; use Rtsfind;
with Scans; use Scans;
with Scn; use Scn;
@@ -863,6 +865,52 @@ package body Sem_Util is
end if;
end Check_Fully_Declared;
+ -----------------------
+ -- Check_Obsolescent --
+ -----------------------
+
+ procedure Check_Obsolescent (Nam : Entity_Id; N : Node_Id) is
+ W : Node_Id;
+
+ begin
+ -- Note that we always allow obsolescent references in the compiler
+ -- itself and the run time, since we assume that we know what we are
+ -- doing in such cases. For example the calls in Ada.Characters.Handling
+ -- to its own obsolescent subprograms are just fine.
+
+ if Is_Obsolescent (Nam) and then not GNAT_Mode then
+ Check_Restriction (No_Obsolescent_Features, N);
+
+ if Warn_On_Obsolescent_Feature then
+ if Is_Package_Or_Generic_Package (Nam) then
+ Error_Msg_NE ("with of obsolescent package&?", N, Nam);
+ else
+ Error_Msg_NE ("call to obsolescent subprogram&?", N, Nam);
+ end if;
+
+ -- Output additional warning if present
+
+ W := Obsolescent_Warning (Nam);
+
+ if Present (W) then
+ Name_Buffer (1) := '|';
+ Name_Buffer (2) := '?';
+ Name_Len := 2;
+
+ -- Add characters to message, and output message
+
+ for J in 1 .. String_Length (Strval (W)) loop
+ Add_Char_To_Name_Buffer (''');
+ Add_Char_To_Name_Buffer
+ (Get_Character (Get_String_Char (Strval (W), J)));
+ end loop;
+
+ Error_Msg_N (Name_Buffer (1 .. Name_Len), N);
+ end if;
+ end if;
+ end if;
+ end Check_Obsolescent;
+
------------------------------------------
-- Check_Potentially_Blocking_Operation --
------------------------------------------
@@ -955,11 +1003,10 @@ package body Sem_Util is
null;
end if;
- elsif (Is_Package (B_Scope)
- and then Nkind (
- Parent (Declaration_Node (First_Subtype (T))))
- /= N_Package_Body)
-
+ elsif (Is_Package_Or_Generic_Package (B_Scope)
+ and then
+ Nkind (Parent (Declaration_Node (First_Subtype (T)))) /=
+ N_Package_Body)
or else Is_Derived_Type (B_Type)
then
-- The primitive operations appear after the base type, except
@@ -1618,6 +1665,26 @@ package body Sem_Util is
E : constant Entity_Id := Current_Entity_In_Scope (Def_Id);
S : constant Entity_Id := Current_Scope;
+ function Is_Private_Component_Renaming (N : Node_Id) return Boolean;
+ -- Recognize a renaming declaration that is introduced for private
+ -- components of a protected type. We treat these as weak declarations
+ -- so that they are overridden by entities with the same name that
+ -- come from source, such as formals or local variables of a given
+ -- protected declaration.
+
+ -----------------------------------
+ -- Is_Private_Component_Renaming --
+ -----------------------------------
+
+ function Is_Private_Component_Renaming (N : Node_Id) return Boolean is
+ begin
+ return not Comes_From_Source (N)
+ and then not Comes_From_Source (Current_Scope)
+ and then Nkind (N) = N_Object_Renaming_Declaration;
+ end Is_Private_Component_Renaming;
+
+ -- Start of processing for Enter_Name
+
begin
Generate_Definition (Def_Id);
@@ -1742,6 +1809,9 @@ package body Sem_Util is
then
return;
+ elsif Is_Private_Component_Renaming (Parent (Def_Id)) then
+ return;
+
-- In the body or private part of an instance, a type extension
-- may introduce a component with the same name as that of an
-- actual. The legality rule is not enforced, but the semantics
@@ -3181,7 +3251,7 @@ package body Sem_Util is
function In_Visible_Part (Scope_Id : Entity_Id) return Boolean is
begin
return
- Is_Package (Scope_Id)
+ Is_Package_Or_Generic_Package (Scope_Id)
and then In_Open_Scopes (Scope_Id)
and then not In_Package_Body (Scope_Id)
and then not In_Private_Part (Scope_Id);
@@ -3450,26 +3520,30 @@ package body Sem_Util is
function Is_Controlling_Limited_Procedure
(Proc_Nam : Entity_Id) return Boolean
is
- Param_Typ : Entity_Id;
+ Param_Typ : Entity_Id := Empty;
begin
- -- Proc_Nam was found to be a primitive operation of a limited interface
-
- if Ekind (Proc_Nam) = E_Procedure then
- Param_Typ := Etype (Parameter_Type (First (Parameter_Specifications (
- Parent (Proc_Nam)))));
- return
- Is_Interface (Param_Typ)
- and then Is_Limited_Record (Param_Typ);
+ if Ekind (Proc_Nam) = E_Procedure
+ and then Present (Parameter_Specifications (Parent (Proc_Nam)))
+ then
+ Param_Typ := Etype (Parameter_Type (First (
+ Parameter_Specifications (Parent (Proc_Nam)))));
-- In this case where an Itype was created, the procedure call has been
-- rewritten.
elsif Present (Associated_Node_For_Itype (Proc_Nam))
and then Present (Original_Node (Associated_Node_For_Itype (Proc_Nam)))
+ and then
+ Present (Parameter_Associations
+ (Associated_Node_For_Itype (Proc_Nam)))
then
- Param_Typ := Etype (First (Parameter_Associations (
- Associated_Node_For_Itype (Proc_Nam))));
+ Param_Typ :=
+ Etype (First (Parameter_Associations
+ (Associated_Node_For_Itype (Proc_Nam))));
+ end if;
+
+ if Present (Param_Typ) then
return
Is_Interface (Param_Typ)
and then Is_Limited_Record (Param_Typ);
@@ -3500,7 +3574,6 @@ package body Sem_Util is
function Is_Declared_Within_Variant (Comp : Entity_Id) return Boolean is
Comp_Decl : constant Node_Id := Parent (Comp);
Comp_List : constant Node_Id := Parent (Comp_Decl);
-
begin
return Nkind (Parent (Comp_List)) = N_Variant;
end Is_Declared_Within_Variant;
@@ -3717,7 +3790,6 @@ package body Sem_Util is
S : constant Ureal := Small_Value (T);
M : Urealp.Save_Mark;
R : Boolean;
-
begin
M := Urealp.Mark;
R := (U = UR_Trunc (U / S) * S);
@@ -4033,14 +4105,12 @@ package body Sem_Util is
declare
Ent : constant Entity_Id := Entity (Expr);
Sub : constant Entity_Id := Enclosing_Subprogram (Ent);
-
begin
if Ekind (Ent) /= E_Variable
and then
Ekind (Ent) /= E_In_Out_Parameter
then
return False;
-
else
return Present (Sub) and then Sub = Current_Subprogram;
end if;
@@ -4181,10 +4251,10 @@ package body Sem_Util is
return True;
-- Unchecked conversions are allowed only if they come from the
- -- generated code, which sometimes uses unchecked conversions for
- -- out parameters in cases where code generation is unaffected.
- -- We tell source unchecked conversions by seeing if they are
- -- rewrites of an original UC function call, or of an explicit
+ -- generated code, which sometimes uses unchecked conversions for out
+ -- parameters in cases where code generation is unaffected. We tell
+ -- source unchecked conversions by seeing if they are rewrites of an
+ -- original Unchecked_Conversion function call, or of an explicit
-- conversion of a function call.
elsif Nkind (AV) = N_Unchecked_Type_Conversion then
@@ -4346,7 +4416,6 @@ package body Sem_Util is
elsif Is_Private_Type (Typ) then
declare
U : constant Entity_Id := Underlying_Type (Typ);
-
begin
if No (U) then
return True;
@@ -4446,6 +4515,7 @@ package body Sem_Util is
if Nkind (The_Unit) /= N_Package_Declaration then
return False;
end if;
+
return Is_Remote_Call_Interface (Defining_Entity (The_Unit));
end Is_RCI_Pkg_Decl_Cunit;
@@ -6451,20 +6521,37 @@ package body Sem_Util is
S : constant Entity_Id := Current_Scope;
begin
- if S = Standard_Standard
- or else (Is_Public (S)
- and then (Ekind (S) = E_Package
- or else Is_Record_Type (S)
- or else Ekind (S) = E_Void))
+ -- Everything in the scope of Standard is public
+
+ if S = Standard_Standard then
+ Set_Is_Public (Id);
+
+ -- Entity is definitely not public if enclosing scope is not public
+
+ elsif not Is_Public (S) then
+ return;
+
+ -- An object declaration that occurs in a handled sequence of statements
+ -- is the declaration for a temporary object generated by the expander.
+ -- It never needs to be made public and furthermore, making it public
+ -- can cause back end problems if it is of variable size.
+
+ elsif Nkind (Parent (Id)) = N_Object_Declaration
+ and then
+ Nkind (Parent (Parent (Id))) = N_Handled_Sequence_Of_Statements
then
+ return;
+
+ -- Entities in public packages or records are public
+
+ elsif Ekind (S) = E_Package or Is_Record_Type (S) then
Set_Is_Public (Id);
-- The bounds of an entry family declaration can generate object
-- declarations that are visible to the back-end, e.g. in the
-- the declaration of a composite type that contains tasks.
- elsif Is_Public (S)
- and then Is_Concurrent_Type (S)
+ elsif Is_Concurrent_Type (S)
and then not Has_Completion (S)
and then Nkind (Parent (Id)) = N_Object_Declaration
then
@@ -6959,7 +7046,7 @@ package body Sem_Util is
end if;
if Is_Entity_Name (Expr)
- and then Is_Package (Entity (Expr))
+ and then Is_Package_Or_Generic_Package (Entity (Expr))
then
Error_Msg_N ("found package name!", Expr);
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index 27f2abd9708..64dd828a050 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -108,6 +108,12 @@ package Sem_Util is
-- place error message on node N. Used in object declarations, type
-- conversions, qualified expressions.
+ procedure Check_Obsolescent (Nam : Entity_Id; N : Node_Id);
+ -- Nam is either a subprogram or a (generic) package entity. This procedure
+ -- checks if the Is_Obsolescent flag is set and if so, outputs appropriate
+ -- diagnostics (it also checks the appropriate restriction). N is the node
+ -- to which error messages are attached.
+
procedure Check_Potentially_Blocking_Operation (N : Node_Id);
-- N is one of the statement forms that is a potentially blocking
-- operation. If it appears within a protected action, emit warning.
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index d3003df5400..3f3d938a848 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -294,7 +294,20 @@ package body Sem_Warn is
or else List_Containing (Prev)
/= Generic_Formal_Declarations (P);
- -- if we reach a subprogram body, entity is not referenceable
+ -- Similarly, the generic formals of a generic subprogram
+ -- are not accessible.
+
+ when N_Generic_Subprogram_Declaration =>
+ if Is_List_Member (Prev)
+ and then List_Containing (Prev) =
+ Generic_Formal_Declarations (P)
+ then
+ return False;
+ else
+ P := Parent (P);
+ end if;
+
+ -- If we reach a subprogram body, entity is not referenceable
-- unless it is the defining entity of the body. This will
-- happen, e.g. when a function is an attribute renaming that
-- is rewritten as a body.
@@ -451,8 +464,20 @@ package body Sem_Warn is
and then Is_True_Constant (E1)
and then not Generic_Package_Spec_Entity (E1)
then
- Error_Msg_N
- ("& is not modified, could be declared constant?", E1);
+ -- A special case, if this variable is volatile and not
+ -- imported, it is not helpful to tell the programmer
+ -- to mark the variable as constant, since this would be
+ -- illegal by virtue of RM C.6(13).
+
+ if (Is_Volatile (E1) or else Has_Volatile_Components (E1))
+ and then not Is_Imported (E1)
+ then
+ Error_Msg_N
+ ("& is not modified, volatile has no effect?", E1);
+ else
+ Error_Msg_N
+ ("& is not modified, could be declared constant?", E1);
+ end if;
end if;
-- Check for unset reference, note that we exclude access
@@ -1565,6 +1590,192 @@ package body Sem_Warn is
end loop;
end Output_Unreferenced_Messages;
+ ------------------------
+ -- Set_Warning_Switch --
+ ------------------------
+
+ function Set_Warning_Switch (C : Character) return Boolean is
+ begin
+ case C is
+ when 'a' =>
+ Check_Unreferenced := True;
+ Check_Unreferenced_Formals := True;
+ Check_Withs := True;
+ Constant_Condition_Warnings := True;
+ Implementation_Unit_Warnings := True;
+ Ineffective_Inline_Warnings := True;
+ Warn_On_Ada_2005_Compatibility := True;
+ Warn_On_Bad_Fixed_Value := True;
+ Warn_On_Constant := True;
+ Warn_On_Export_Import := True;
+ Warn_On_Modified_Unread := True;
+ Warn_On_No_Value_Assigned := True;
+ Warn_On_Obsolescent_Feature := True;
+ Warn_On_Redundant_Constructs := True;
+ Warn_On_Unchecked_Conversion := True;
+ Warn_On_Unrecognized_Pragma := True;
+
+ when 'A' =>
+ Check_Unreferenced := False;
+ Check_Unreferenced_Formals := False;
+ Check_Withs := False;
+ Constant_Condition_Warnings := False;
+ Elab_Warnings := False;
+ Implementation_Unit_Warnings := False;
+ Ineffective_Inline_Warnings := False;
+ Warn_On_Ada_2005_Compatibility := False;
+ Warn_On_Bad_Fixed_Value := False;
+ Warn_On_Constant := False;
+ Warn_On_Dereference := False;
+ Warn_On_Export_Import := False;
+ Warn_On_Hiding := False;
+ Warn_On_Modified_Unread := False;
+ Warn_On_No_Value_Assigned := False;
+ Warn_On_Obsolescent_Feature := False;
+ Warn_On_Redundant_Constructs := False;
+ Warn_On_Unchecked_Conversion := False;
+ Warn_On_Unrecognized_Pragma := False;
+
+ when 'b' =>
+ Warn_On_Bad_Fixed_Value := True;
+
+ when 'B' =>
+ Warn_On_Bad_Fixed_Value := False;
+
+ when 'c' =>
+ Constant_Condition_Warnings := True;
+
+ when 'C' =>
+ Constant_Condition_Warnings := False;
+
+ when 'd' =>
+ Warn_On_Dereference := True;
+
+ when 'D' =>
+ Warn_On_Dereference := False;
+
+ when 'e' =>
+ Warning_Mode := Treat_As_Error;
+
+ when 'f' =>
+ Check_Unreferenced_Formals := True;
+
+ when 'F' =>
+ Check_Unreferenced_Formals := False;
+
+ when 'g' =>
+ Warn_On_Unrecognized_Pragma := True;
+
+ when 'G' =>
+ Warn_On_Unrecognized_Pragma := False;
+
+ when 'h' =>
+ Warn_On_Hiding := True;
+
+ when 'H' =>
+ Warn_On_Hiding := False;
+
+ when 'i' =>
+ Implementation_Unit_Warnings := True;
+
+ when 'I' =>
+ Implementation_Unit_Warnings := False;
+
+ when 'j' =>
+ Warn_On_Obsolescent_Feature := True;
+
+ when 'J' =>
+ Warn_On_Obsolescent_Feature := False;
+
+ when 'k' =>
+ Warn_On_Constant := True;
+
+ when 'K' =>
+ Warn_On_Constant := False;
+
+ when 'l' =>
+ Elab_Warnings := True;
+
+ when 'L' =>
+ Elab_Warnings := False;
+
+ when 'm' =>
+ Warn_On_Modified_Unread := True;
+
+ when 'M' =>
+ Warn_On_Modified_Unread := False;
+
+ when 'n' =>
+ Warning_Mode := Normal;
+
+ when 'o' =>
+ Address_Clause_Overlay_Warnings := True;
+
+ when 'O' =>
+ Address_Clause_Overlay_Warnings := False;
+
+ when 'p' =>
+ Ineffective_Inline_Warnings := True;
+
+ when 'P' =>
+ Ineffective_Inline_Warnings := False;
+
+ when 'r' =>
+ Warn_On_Redundant_Constructs := True;
+
+ when 'R' =>
+ Warn_On_Redundant_Constructs := False;
+
+ when 's' =>
+ Warning_Mode := Suppress;
+
+ when 'u' =>
+ Check_Unreferenced := True;
+ Check_Withs := True;
+ Check_Unreferenced_Formals := True;
+
+ when 'U' =>
+ Check_Unreferenced := False;
+ Check_Withs := False;
+ Check_Unreferenced_Formals := False;
+
+ when 'v' =>
+ Warn_On_No_Value_Assigned := True;
+
+ when 'V' =>
+ Warn_On_No_Value_Assigned := False;
+
+ when 'x' =>
+ Warn_On_Export_Import := True;
+
+ when 'X' =>
+ Warn_On_Export_Import := False;
+
+ when 'y' =>
+ Warn_On_Ada_2005_Compatibility := True;
+
+ when 'Y' =>
+ Warn_On_Ada_2005_Compatibility := False;
+
+ when 'z' =>
+ Warn_On_Unchecked_Conversion := True;
+
+ when 'Z' =>
+ Warn_On_Unchecked_Conversion := False;
+
+ -- Allow and ignore 'w' so that the old
+ -- format (e.g. -gnatwuwl) will work.
+
+ when 'w' =>
+ null;
+
+ when others =>
+ return False;
+ end case;
+
+ return True;
+ end Set_Warning_Switch;
+
-----------------------------
-- Warn_On_Known_Condition --
-----------------------------
diff --git a/gcc/ada/sem_warn.ads b/gcc/ada/sem_warn.ads
index cec942733ba..be2fd6f11af 100644
--- a/gcc/ada/sem_warn.ads
+++ b/gcc/ada/sem_warn.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,15 @@ with Types; use Types;
package Sem_Warn is
+ --------------------
+ -- Initialization --
+ --------------------
+
+ function Set_Warning_Switch (C : Character) return Boolean;
+ -- This function sets the warning switch or switches corresponding to
+ -- the given character. It is used for processing a -gnatw switch on the
+ -- command line, or a string literal in pragma Warnings.
+
------------------------------------------
-- Routines to Handle Unused References --
------------------------------------------
diff --git a/gcc/ada/sfn_scan.adb b/gcc/ada/sfn_scan.adb
index 2deaf26fef4..d3d3dd4904f 100644
--- a/gcc/ada/sfn_scan.adb
+++ b/gcc/ada/sfn_scan.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sfn_scan.ads b/gcc/ada/sfn_scan.ads
index 8ad6d840a3f..8ce848f2866 100644
--- a/gcc/ada/sfn_scan.ads
+++ b/gcc/ada/sfn_scan.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index 83e094caae3..673d4541782 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -175,6 +175,15 @@ package body Sinfo is
return Flag4 (N);
end Acts_As_Spec;
+ function Actual_Designated_Subtype
+ (N : Node_Id) return Node_Id is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Explicit_Dereference
+ or else NT (N).Nkind = N_Free_Statement);
+ return Node2 (N);
+ end Actual_Designated_Subtype;
+
function Aggregate_Bounds
(N : Node_Id) return Node_Id is
begin
@@ -876,6 +885,14 @@ package body Sinfo is
return Flag13 (N);
end Do_Tag_Check;
+ function Elaborate_All_Desirable
+ (N : Node_Id) return Boolean is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_With_Clause);
+ return Flag9 (N);
+ end Elaborate_All_Desirable;
+
function Elaborate_All_Present
(N : Node_Id) return Boolean is
begin
@@ -884,6 +901,14 @@ package body Sinfo is
return Flag14 (N);
end Elaborate_All_Present;
+ function Elaborate_Desirable
+ (N : Node_Id) return Boolean is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_With_Clause);
+ return Flag11 (N);
+ end Elaborate_Desirable;
+
function Elaborate_Present
(N : Node_Id) return Boolean is
begin
@@ -2745,6 +2770,15 @@ package body Sinfo is
Set_Flag4 (N, Val);
end Set_Acts_As_Spec;
+ procedure Set_Actual_Designated_Subtype
+ (N : Node_Id; Val : Node_Id) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Explicit_Dereference
+ or else NT (N).Nkind = N_Free_Statement);
+ Set_Node2 (N, Val);
+ end Set_Actual_Designated_Subtype;
+
procedure Set_Aggregate_Bounds
(N : Node_Id; Val : Node_Id) is
begin
@@ -3446,6 +3480,14 @@ package body Sinfo is
Set_Flag13 (N, Val);
end Set_Do_Tag_Check;
+ procedure Set_Elaborate_All_Desirable
+ (N : Node_Id; Val : Boolean := True) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_With_Clause);
+ Set_Flag9 (N, Val);
+ end Set_Elaborate_All_Desirable;
+
procedure Set_Elaborate_All_Present
(N : Node_Id; Val : Boolean := True) is
begin
@@ -3454,6 +3496,14 @@ package body Sinfo is
Set_Flag14 (N, Val);
end Set_Elaborate_All_Present;
+ procedure Set_Elaborate_Desirable
+ (N : Node_Id; Val : Boolean := True) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_With_Clause);
+ Set_Flag11 (N, Val);
+ end Set_Elaborate_Desirable;
+
procedure Set_Elaborate_Present
(N : Node_Id; Val : Boolean := True) is
begin
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 6bc6926bba1..60f8be32224 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -90,11 +90,11 @@ package Sinfo is
-- node in the checks.
-- Add an appropriate section to the case statement in sprint.adb
-- Add an appropriate section to the case statement in sem.adb
- -- Add an appropraite section to the case statement in exp_util.adb
+ -- Add an appropriate section to the case statement in exp_util.adb
-- (Insert_Actions procedure)
- -- For a subexpression, add an appropriate sections to the case
+ -- For a subexpression, add an appropriate section to the case
-- statement in sem_eval.adb
- -- For a subexpression, add an appropriate sections to the case
+ -- For a subexpression, add an appropriate section to the case
-- statement in sem_res.adb
-- Finally, four utility programs must be run:
@@ -457,27 +457,36 @@ package Sinfo is
-- The following flag fields appear in all nodes
- -- Analyzed
+ -- Analyzed (Flag1)
-- This flag is used to indicate that a node (and all its children
-- have been analyzed. It is used to avoid reanalysis of a node that
-- has already been analyzed, both for efficiency and functional
-- correctness reasons.
- -- Error_Posted
+ -- Comes_From_Source (Flag2)
+ -- This flag is on for any nodes built by the scanner or parser from
+ -- the source program, and off for any nodes built by the analyzer or
+ -- expander. It indicates that a node comes from the original source.
+ -- This flag is defined in Atree.
+
+ -- Error_Posted (Flag3)
-- This flag is used to avoid multiple error messages being posted
-- on or referring to the same node. This flag is set if an error
-- message refers to a node or is posted on its source location,
-- and has the effect of inhibiting further messages involving
-- this same node.
- -- Comes_From_Source
- -- This flag is on for any nodes built by the scanner or parser from
- -- the source program, and off for any nodes built by the analyzer or
- -- expander. It indicates that a node comes from the original source.
- -- This flag is defined in Atree.
+ -- Has_Dynamic_Length_Check (Flag10-Sem)
+ -- This flag is present on all nodes. It is set to indicate that one
+ -- of the routines in unit Checks has generated a length check action
+ -- which has been inserted at the flagged node. This is used to avoid
+ -- the generation of duplicate checks.
- -- Has_Dynamic_Length_Check and Has_Dynamic_Range_Check also appear on
- -- all nodes. They are fully described in the next section.
+ -- Has_Dynamic_Range_Check (Flag12-Sem)
+ -- This flag is present on all nodes. It is set to indicate that one
+ -- of the routines in unit Checks has generated a range check action
+ -- which has been inserted at the flagged node. This is used to avoid
+ -- the generation of duplicate checks.
------------------------------------
-- Description of Semantic Fields --
@@ -535,6 +544,15 @@ package Sinfo is
-- compilation unit node at the library level for such a subprogram
-- (see further description in spec of Lib package).
+ -- Actual_Designated_Subtype (Node2-Sem)
+ -- Present in N_Free_Statement and N_Explicit_Dereference nodes. If
+ -- GIGI needs to known the dynamic constrained subtype of the designated
+ -- object, this attribute is set to that type. This is done for
+ -- N_Free_Statements for access-to-classwide types and access to
+ -- unconstrained packed array types, and for N_Explicit_Dereference
+ -- when the designated type is an unconstrained packed array and the
+ -- dereference is the prefix of a 'Size attribute reference.
+
-- Aggregate_Bounds (Node3-Sem)
-- Present in array N_Aggregate nodes. If the aggregate contains
-- component associations this field points to an N_Range node whose
@@ -831,13 +849,23 @@ package Sinfo is
-- yet decided how this flag is used (TBD ???).
-- Elaborate_Present (Flag4-Sem)
- -- This flag is set in the N_With_Clause node to indicate that a
- -- pragma Elaborate pragma appears for the with'ed units.
+ -- This flag is set in the N_With_Clause node to indicate that pragma
+ -- Elaborate pragma appears for the with'ed units.
+
+ -- Elaborate_All_Desirable (Flag9-Sem)
+ -- This flag is set in the N_With_Clause mode to indicate that the static
+ -- elaboration processing has determined that an Elaborate_All pragma is
+ -- desirable for correct elaboration for this unit.
-- Elaborate_All_Present (Flag14-Sem)
-- This flag is set in the N_With_Clause node to indicate that a
-- pragma Elaborate_All pragma appears for the with'ed units.
+ -- Elaborate_Desirable (Flag11-Sem)
+ -- This flag is set in the N_With_Clause mode to indicate that the static
+ -- elaboration processing has determined that an Elaborate pragma is
+ -- desirable for correct elaboration for this unit.
+
-- Elaboration_Boolean (Node2-Sem)
-- This field is present in function and procedure specification
-- nodes. If set, it points to the entity for a Boolean flag that
@@ -1008,18 +1036,6 @@ package Sinfo is
-- handler is deleted during optimization. For further details on why
-- this is required, see Exp_Ch11.Remove_Handler_Entries.
- -- Has_Dynamic_Length_Check (Flag10-Sem)
- -- This flag is present on all nodes. It is set to indicate that one
- -- of the routines in unit Checks has generated a length check action
- -- which has been inserted at the flagged node. This is used to avoid
- -- the generation of duplicate checks.
-
- -- Has_Dynamic_Range_Check (Flag12-Sem)
- -- This flag is present on all nodes. It is set to indicate that one
- -- of the routines in unit Checks has generated a range check action
- -- which has been inserted at the flagged node. This is used to avoid
- -- the generation of duplicate checks.
-
-- Has_No_Elaboration_Code (Flag17-Sem)
-- A flag that appears in the N_Compilation_Unit node to indicate
-- whether or not elaboration code is present for this unit. It is
@@ -2847,6 +2863,7 @@ package Sinfo is
-- N_Explicit_Dereference
-- Sloc points to ALL
-- Prefix (Node3)
+ -- Actual_Designated_Subtype (Node2-Sem)
-- plus fields for expression
-------------------------------
@@ -5217,6 +5234,8 @@ package Sinfo is
-- Context_Installed (Flag13-Sem)
-- Elaborate_Present (Flag4-Sem)
-- Elaborate_All_Present (Flag14-Sem)
+ -- Elaborate_All_Desirable (Flag9-Sem)
+ -- Elaborate_Desirable (Flag11-Sem)
-- Private_Present (Flag15) set if with_clause has private keyword
-- Implicit_With (Flag16-Sem)
-- Limited_Present (Flag17) set if LIMITED is present
@@ -6233,6 +6252,7 @@ package Sinfo is
-- Expression (Node3) argument to unchecked deallocation call
-- Storage_Pool (Node1-Sem)
-- Procedure_To_Call (Node4-Sem)
+ -- Actual_Designated_Subtype (Node2-Sem)
-- Note: in the case where a debug source file is generated, the Sloc
-- for this node points to the FREE keyword in the Sprint file output.
@@ -6757,11 +6777,15 @@ package Sinfo is
N_Task_Body_Stub,
-- N_Generic_Instantiation, N_Later_Decl_Item
+ -- N_Subprogram_Instantiation
N_Function_Instantiation,
- N_Package_Instantiation,
N_Procedure_Instantiation,
+ -- N_Generic_Instantiation, N_Later_Decl_Item
+
+ N_Package_Instantiation,
+
-- N_Unit_Body, N_Later_Decl_Item, N_Proper_Body
N_Package_Body,
@@ -6797,7 +6821,7 @@ package Sinfo is
N_Package_Renaming_Declaration,
N_Subprogram_Renaming_Declaration,
- -- N_Generic_Renaming_Declarations, N_Renaming_Declaration
+ -- N_Generic_Renaming_Declaration, N_Renaming_Declaration
N_Generic_Function_Renaming_Declaration,
N_Generic_Package_Renaming_Declaration,
@@ -6813,8 +6837,14 @@ package Sinfo is
N_Case_Statement,
N_Code_Statement,
N_Conditional_Entry_Call,
+
+ -- N_Statement_Other_Than_Procedure_Call. N_Delay_Statement
+
N_Delay_Relative_Statement,
N_Delay_Until_Statement,
+
+ -- N_Statement_Other_Than_Procedure_Call
+
N_Entry_Call_Statement,
N_Free_Statement,
N_Goto_Statement,
@@ -6940,6 +6970,10 @@ package Sinfo is
-- Note: this includes all constructs normally thought of as declarations
-- except those which are separately grouped as later declarations.
+ subtype N_Delay_Statement is Node_Kind range
+ N_Delay_Relative_Statement ..
+ N_Delay_Until_Statement;
+
subtype N_Direct_Name is Node_Kind range
N_Identifier ..
N_Character_Literal;
@@ -6958,7 +6992,7 @@ package Sinfo is
subtype N_Generic_Instantiation is Node_Kind range
N_Function_Instantiation ..
- N_Procedure_Instantiation;
+ N_Package_Instantiation;
subtype N_Generic_Renaming_Declaration is Node_Kind range
N_Generic_Function_Renaming_Declaration ..
@@ -7036,6 +7070,10 @@ package Sinfo is
-- (since overloading is possible, so it needs to go through the normal
-- overloading resolution for expressions).
+ subtype N_Subprogram_Instantiation is Node_Kind range
+ N_Function_Instantiation ..
+ N_Procedure_Instantiation;
+
subtype N_Has_Condition is Node_Kind range
N_Exit_Statement ..
N_Terminate_Alternative;
@@ -7106,6 +7144,9 @@ package Sinfo is
function Acts_As_Spec
(N : Node_Id) return Boolean; -- Flag4
+ function Actual_Designated_Subtype
+ (N : Node_Id) return Node_Id; -- Node2
+
function Aggregate_Bounds
(N : Node_Id) return Node_Id; -- Node3
@@ -7325,9 +7366,15 @@ package Sinfo is
function Do_Tag_Check
(N : Node_Id) return Boolean; -- Flag13
+ function Elaborate_All_Desirable
+ (N : Node_Id) return Boolean; -- Flag9
+
function Elaborate_All_Present
(N : Node_Id) return Boolean; -- Flag14
+ function Elaborate_Desirable
+ (N : Node_Id) return Boolean; -- Flag11
+
function Elaborate_Present
(N : Node_Id) return Boolean; -- Flag4
@@ -7919,6 +7966,9 @@ package Sinfo is
procedure Set_Acts_As_Spec
(N : Node_Id; Val : Boolean := True); -- Flag4
+ procedure Set_Actual_Designated_Subtype
+ (N : Node_Id; Val : Node_Id); -- Node2
+
procedure Set_Aggregate_Bounds
(N : Node_Id; Val : Node_Id); -- Node3
@@ -8138,9 +8188,15 @@ package Sinfo is
procedure Set_Do_Tag_Check
(N : Node_Id; Val : Boolean := True); -- Flag13
+ procedure Set_Elaborate_All_Desirable
+ (N : Node_Id; Val : Boolean := True); -- Flag9
+
procedure Set_Elaborate_All_Present
(N : Node_Id; Val : Boolean := True); -- Flag14
+ procedure Set_Elaborate_Desirable
+ (N : Node_Id; Val : Boolean := True); -- Flag11
+
procedure Set_Elaborate_Present
(N : Node_Id; Val : Boolean := True); -- Flag4
@@ -8723,6 +8779,7 @@ package Sinfo is
pragma Inline (Actions);
pragma Inline (Activation_Chain_Entity);
pragma Inline (Acts_As_Spec);
+ pragma Inline (Actual_Designated_Subtype);
pragma Inline (Aggregate_Bounds);
pragma Inline (Aliased_Present);
pragma Inline (All_Others);
@@ -8797,7 +8854,9 @@ package Sinfo is
pragma Inline (Do_Storage_Check);
pragma Inline (Do_Tag_Check);
pragma Inline (Elaborate_Present);
+ pragma Inline (Elaborate_All_Desirable);
pragma Inline (Elaborate_All_Present);
+ pragma Inline (Elaborate_Desirable);
pragma Inline (Elaboration_Boolean);
pragma Inline (Else_Actions);
pragma Inline (Else_Statements);
@@ -8991,6 +9050,7 @@ package Sinfo is
pragma Inline (Set_Actions);
pragma Inline (Set_Activation_Chain_Entity);
pragma Inline (Set_Acts_As_Spec);
+ pragma Inline (Set_Actual_Designated_Subtype);
pragma Inline (Set_Aggregate_Bounds);
pragma Inline (Set_Aliased_Present);
pragma Inline (Set_All_Others);
@@ -9065,7 +9125,9 @@ package Sinfo is
pragma Inline (Set_Do_Storage_Check);
pragma Inline (Set_Do_Tag_Check);
pragma Inline (Set_Elaborate_Present);
+ pragma Inline (Set_Elaborate_All_Desirable);
pragma Inline (Set_Elaborate_All_Present);
+ pragma Inline (Set_Elaborate_Desirable);
pragma Inline (Set_Elaboration_Boolean);
pragma Inline (Set_Else_Actions);
pragma Inline (Set_Else_Statements);
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index c838dbb8506..d20adf5aed2 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -86,7 +86,7 @@ package body Sinput is
LL : Physical_Line_Number;
begin
- -- Reallocate the lines tables if necessary.
+ -- Reallocate the lines tables if necessary
-- Note: the reason we do not use the normal Table package
-- mechanism is that we have several of these tables. We could
diff --git a/gcc/ada/sinput.ads b/gcc/ada/sinput.ads
index aaaf0b82782..092707c1c2e 100644
--- a/gcc/ada/sinput.ads
+++ b/gcc/ada/sinput.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -655,7 +655,7 @@ private
-- we avoid the use of fat pointers.
type Logical_Lines_Table_Ptr is access all Logical_Lines_Table_Type;
- -- Type used for pointers to logical line tables.
+ -- Type used for pointers to logical line tables
-----------------------
-- Source_File Table --
diff --git a/gcc/ada/snames.adb b/gcc/ada/snames.adb
index 4993c64c83d..c1ca4dde733 100644
--- a/gcc/ada/snames.adb
+++ b/gcc/ada/snames.adb
@@ -93,6 +93,7 @@ package body Snames is
"_disp_conditional_select#" &
"_disp_get_prim_op_kind#" &
"_disp_timed_select#" &
+ "_disp_get_task_id#" &
"initialize#" &
"adjust#" &
"finalize#" &
@@ -458,6 +459,7 @@ package body Snames is
"machine_mantissa#" &
"machine_overflows#" &
"machine_radix#" &
+ "machine_rounding#" &
"machine_rounds#" &
"machine_size#" &
"mantissa#" &
@@ -639,6 +641,7 @@ package body Snames is
"unchecked_conversion#" &
"unchecked_deallocation#" &
"to_pointer#" &
+ "free#" &
"abstract#" &
"aliased#" &
"protected#" &
@@ -674,6 +677,7 @@ package body Snames is
"include_option#" &
"language_processing#" &
"languages#" &
+ "library_ali_dir#" &
"library_dir#" &
"library_auto_init#" &
"library_gcc#" &
diff --git a/gcc/ada/snames.ads b/gcc/ada/snames.ads
index 6cdb34433ea..caa31e35750 100644
--- a/gcc/ada/snames.ads
+++ b/gcc/ada/snames.ads
@@ -67,63 +67,63 @@ package Snames is
-- The lower case letter entries are used for one character identifiers
-- appearing in the source, for example in pragma Interface (C).
- Name_A : constant Name_Id := First_Name_Id + Character'Pos ('a');
- Name_B : constant Name_Id := First_Name_Id + Character'Pos ('b');
- Name_C : constant Name_Id := First_Name_Id + Character'Pos ('c');
- Name_D : constant Name_Id := First_Name_Id + Character'Pos ('d');
- Name_E : constant Name_Id := First_Name_Id + Character'Pos ('e');
- Name_F : constant Name_Id := First_Name_Id + Character'Pos ('f');
- Name_G : constant Name_Id := First_Name_Id + Character'Pos ('g');
- Name_H : constant Name_Id := First_Name_Id + Character'Pos ('h');
- Name_I : constant Name_Id := First_Name_Id + Character'Pos ('i');
- Name_J : constant Name_Id := First_Name_Id + Character'Pos ('j');
- Name_K : constant Name_Id := First_Name_Id + Character'Pos ('k');
- Name_L : constant Name_Id := First_Name_Id + Character'Pos ('l');
- Name_M : constant Name_Id := First_Name_Id + Character'Pos ('m');
- Name_N : constant Name_Id := First_Name_Id + Character'Pos ('n');
- Name_O : constant Name_Id := First_Name_Id + Character'Pos ('o');
- Name_P : constant Name_Id := First_Name_Id + Character'Pos ('p');
- Name_Q : constant Name_Id := First_Name_Id + Character'Pos ('q');
- Name_R : constant Name_Id := First_Name_Id + Character'Pos ('r');
- Name_S : constant Name_Id := First_Name_Id + Character'Pos ('s');
- Name_T : constant Name_Id := First_Name_Id + Character'Pos ('t');
- Name_U : constant Name_Id := First_Name_Id + Character'Pos ('u');
- Name_V : constant Name_Id := First_Name_Id + Character'Pos ('v');
- Name_W : constant Name_Id := First_Name_Id + Character'Pos ('w');
- Name_X : constant Name_Id := First_Name_Id + Character'Pos ('x');
- Name_Y : constant Name_Id := First_Name_Id + Character'Pos ('y');
- Name_Z : constant Name_Id := First_Name_Id + Character'Pos ('z');
+ Name_A : constant Name_Id := First_Name_Id + Character'Pos ('a');
+ Name_B : constant Name_Id := First_Name_Id + Character'Pos ('b');
+ Name_C : constant Name_Id := First_Name_Id + Character'Pos ('c');
+ Name_D : constant Name_Id := First_Name_Id + Character'Pos ('d');
+ Name_E : constant Name_Id := First_Name_Id + Character'Pos ('e');
+ Name_F : constant Name_Id := First_Name_Id + Character'Pos ('f');
+ Name_G : constant Name_Id := First_Name_Id + Character'Pos ('g');
+ Name_H : constant Name_Id := First_Name_Id + Character'Pos ('h');
+ Name_I : constant Name_Id := First_Name_Id + Character'Pos ('i');
+ Name_J : constant Name_Id := First_Name_Id + Character'Pos ('j');
+ Name_K : constant Name_Id := First_Name_Id + Character'Pos ('k');
+ Name_L : constant Name_Id := First_Name_Id + Character'Pos ('l');
+ Name_M : constant Name_Id := First_Name_Id + Character'Pos ('m');
+ Name_N : constant Name_Id := First_Name_Id + Character'Pos ('n');
+ Name_O : constant Name_Id := First_Name_Id + Character'Pos ('o');
+ Name_P : constant Name_Id := First_Name_Id + Character'Pos ('p');
+ Name_Q : constant Name_Id := First_Name_Id + Character'Pos ('q');
+ Name_R : constant Name_Id := First_Name_Id + Character'Pos ('r');
+ Name_S : constant Name_Id := First_Name_Id + Character'Pos ('s');
+ Name_T : constant Name_Id := First_Name_Id + Character'Pos ('t');
+ Name_U : constant Name_Id := First_Name_Id + Character'Pos ('u');
+ Name_V : constant Name_Id := First_Name_Id + Character'Pos ('v');
+ Name_W : constant Name_Id := First_Name_Id + Character'Pos ('w');
+ Name_X : constant Name_Id := First_Name_Id + Character'Pos ('x');
+ Name_Y : constant Name_Id := First_Name_Id + Character'Pos ('y');
+ Name_Z : constant Name_Id := First_Name_Id + Character'Pos ('z');
-- The upper case letter entries are used by expander code for local
-- variables that do not require unique names (e.g. formal parameter
-- names in constructed procedures)
- Name_uA : constant Name_Id := First_Name_Id + Character'Pos ('A');
- Name_uB : constant Name_Id := First_Name_Id + Character'Pos ('B');
- Name_uC : constant Name_Id := First_Name_Id + Character'Pos ('C');
- Name_uD : constant Name_Id := First_Name_Id + Character'Pos ('D');
- Name_uE : constant Name_Id := First_Name_Id + Character'Pos ('E');
- Name_uF : constant Name_Id := First_Name_Id + Character'Pos ('F');
- Name_uG : constant Name_Id := First_Name_Id + Character'Pos ('G');
- Name_uH : constant Name_Id := First_Name_Id + Character'Pos ('H');
- Name_uI : constant Name_Id := First_Name_Id + Character'Pos ('I');
- Name_uJ : constant Name_Id := First_Name_Id + Character'Pos ('J');
- Name_uK : constant Name_Id := First_Name_Id + Character'Pos ('K');
- Name_uL : constant Name_Id := First_Name_Id + Character'Pos ('L');
- Name_uM : constant Name_Id := First_Name_Id + Character'Pos ('M');
- Name_uN : constant Name_Id := First_Name_Id + Character'Pos ('N');
- Name_uO : constant Name_Id := First_Name_Id + Character'Pos ('O');
- Name_uP : constant Name_Id := First_Name_Id + Character'Pos ('P');
- Name_uQ : constant Name_Id := First_Name_Id + Character'Pos ('Q');
- Name_uR : constant Name_Id := First_Name_Id + Character'Pos ('R');
- Name_uS : constant Name_Id := First_Name_Id + Character'Pos ('S');
- Name_uT : constant Name_Id := First_Name_Id + Character'Pos ('T');
- Name_uU : constant Name_Id := First_Name_Id + Character'Pos ('U');
- Name_uV : constant Name_Id := First_Name_Id + Character'Pos ('V');
- Name_uW : constant Name_Id := First_Name_Id + Character'Pos ('W');
- Name_uX : constant Name_Id := First_Name_Id + Character'Pos ('X');
- Name_uY : constant Name_Id := First_Name_Id + Character'Pos ('Y');
- Name_uZ : constant Name_Id := First_Name_Id + Character'Pos ('Z');
+ Name_uA : constant Name_Id := First_Name_Id + Character'Pos ('A');
+ Name_uB : constant Name_Id := First_Name_Id + Character'Pos ('B');
+ Name_uC : constant Name_Id := First_Name_Id + Character'Pos ('C');
+ Name_uD : constant Name_Id := First_Name_Id + Character'Pos ('D');
+ Name_uE : constant Name_Id := First_Name_Id + Character'Pos ('E');
+ Name_uF : constant Name_Id := First_Name_Id + Character'Pos ('F');
+ Name_uG : constant Name_Id := First_Name_Id + Character'Pos ('G');
+ Name_uH : constant Name_Id := First_Name_Id + Character'Pos ('H');
+ Name_uI : constant Name_Id := First_Name_Id + Character'Pos ('I');
+ Name_uJ : constant Name_Id := First_Name_Id + Character'Pos ('J');
+ Name_uK : constant Name_Id := First_Name_Id + Character'Pos ('K');
+ Name_uL : constant Name_Id := First_Name_Id + Character'Pos ('L');
+ Name_uM : constant Name_Id := First_Name_Id + Character'Pos ('M');
+ Name_uN : constant Name_Id := First_Name_Id + Character'Pos ('N');
+ Name_uO : constant Name_Id := First_Name_Id + Character'Pos ('O');
+ Name_uP : constant Name_Id := First_Name_Id + Character'Pos ('P');
+ Name_uQ : constant Name_Id := First_Name_Id + Character'Pos ('Q');
+ Name_uR : constant Name_Id := First_Name_Id + Character'Pos ('R');
+ Name_uS : constant Name_Id := First_Name_Id + Character'Pos ('S');
+ Name_uT : constant Name_Id := First_Name_Id + Character'Pos ('T');
+ Name_uU : constant Name_Id := First_Name_Id + Character'Pos ('U');
+ Name_uV : constant Name_Id := First_Name_Id + Character'Pos ('V');
+ Name_uW : constant Name_Id := First_Name_Id + Character'Pos ('W');
+ Name_uX : constant Name_Id := First_Name_Id + Character'Pos ('X');
+ Name_uY : constant Name_Id := First_Name_Id + Character'Pos ('Y');
+ Name_uZ : constant Name_Id := First_Name_Id + Character'Pos ('Z');
-- Note: the following table is read by the utility program XSNAMES and
-- its format should not be changed without coordinating with this program.
@@ -181,127 +181,132 @@ package Snames is
Name_uDisp_Get_Prim_Op_Kind : constant Name_Id := N + 034;
Name_uDisp_Timed_Select : constant Name_Id := N + 035;
+ -- Names of routines used in the expansion of Abort, attributes 'Callable
+ -- and 'Terminated for task interface class-wide types.
+
+ Name_uDisp_Get_Task_Id : constant Name_Id := N + 036;
+
-- Names of routines in Ada.Finalization, needed by expander
- Name_Initialize : constant Name_Id := N + 036;
- Name_Adjust : constant Name_Id := N + 037;
- Name_Finalize : constant Name_Id := N + 038;
+ Name_Initialize : constant Name_Id := N + 037;
+ Name_Adjust : constant Name_Id := N + 038;
+ Name_Finalize : constant Name_Id := N + 039;
-- Names of fields declared in System.Finalization_Implementation,
-- needed by the expander when generating code for finalization.
- Name_Next : constant Name_Id := N + 039;
- Name_Prev : constant Name_Id := N + 040;
+ Name_Next : constant Name_Id := N + 040;
+ Name_Prev : constant Name_Id := N + 041;
-- Names of TSS routines for implementation of DSA over PolyORB
- Name_uTypeCode : constant Name_Id := N + 041;
- Name_uFrom_Any : constant Name_Id := N + 042;
- Name_uTo_Any : constant Name_Id := N + 043;
+ Name_uTypeCode : constant Name_Id := N + 042;
+ Name_uFrom_Any : constant Name_Id := N + 043;
+ Name_uTo_Any : constant Name_Id := N + 044;
-- Names of allocation routines, also needed by expander
- Name_Allocate : constant Name_Id := N + 044;
- Name_Deallocate : constant Name_Id := N + 045;
- Name_Dereference : constant Name_Id := N + 046;
+ Name_Allocate : constant Name_Id := N + 045;
+ Name_Deallocate : constant Name_Id := N + 046;
+ Name_Dereference : constant Name_Id := N + 047;
-- Names of Text_IO generic subpackages (see Rtsfind.Text_IO_Kludge)
- First_Text_IO_Package : constant Name_Id := N + 047;
- Name_Decimal_IO : constant Name_Id := N + 047;
- Name_Enumeration_IO : constant Name_Id := N + 048;
- Name_Fixed_IO : constant Name_Id := N + 049;
- Name_Float_IO : constant Name_Id := N + 050;
- Name_Integer_IO : constant Name_Id := N + 051;
- Name_Modular_IO : constant Name_Id := N + 052;
- Last_Text_IO_Package : constant Name_Id := N + 052;
+ First_Text_IO_Package : constant Name_Id := N + 048;
+ Name_Decimal_IO : constant Name_Id := N + 048;
+ Name_Enumeration_IO : constant Name_Id := N + 049;
+ Name_Fixed_IO : constant Name_Id := N + 050;
+ Name_Float_IO : constant Name_Id := N + 051;
+ Name_Integer_IO : constant Name_Id := N + 052;
+ Name_Modular_IO : constant Name_Id := N + 053;
+ Last_Text_IO_Package : constant Name_Id := N + 053;
subtype Text_IO_Package_Name is Name_Id
range First_Text_IO_Package .. Last_Text_IO_Package;
-- Some miscellaneous names used for error detection/recovery
- Name_Const : constant Name_Id := N + 053;
- Name_Error : constant Name_Id := N + 054;
- Name_Go : constant Name_Id := N + 055;
- Name_Put : constant Name_Id := N + 056;
- Name_Put_Line : constant Name_Id := N + 057;
- Name_To : constant Name_Id := N + 058;
+ Name_Const : constant Name_Id := N + 054;
+ Name_Error : constant Name_Id := N + 055;
+ Name_Go : constant Name_Id := N + 056;
+ Name_Put : constant Name_Id := N + 057;
+ Name_Put_Line : constant Name_Id := N + 058;
+ Name_To : constant Name_Id := N + 059;
-- Names for packages that are treated specially by the compiler
- Name_Finalization : constant Name_Id := N + 059;
- Name_Finalization_Root : constant Name_Id := N + 060;
- Name_Interfaces : constant Name_Id := N + 061;
- Name_Standard : constant Name_Id := N + 062;
- Name_System : constant Name_Id := N + 063;
- Name_Text_IO : constant Name_Id := N + 064;
- Name_Wide_Text_IO : constant Name_Id := N + 065;
- Name_Wide_Wide_Text_IO : constant Name_Id := N + 066;
+ Name_Finalization : constant Name_Id := N + 060;
+ Name_Finalization_Root : constant Name_Id := N + 061;
+ Name_Interfaces : constant Name_Id := N + 062;
+ Name_Standard : constant Name_Id := N + 063;
+ Name_System : constant Name_Id := N + 064;
+ Name_Text_IO : constant Name_Id := N + 065;
+ Name_Wide_Text_IO : constant Name_Id := N + 066;
+ Name_Wide_Wide_Text_IO : constant Name_Id := N + 067;
-- Names of implementations of the distributed systems annex
- First_PCS_Name : constant Name_Id := N + 067;
- Name_No_DSA : constant Name_Id := N + 067;
- Name_GARLIC_DSA : constant Name_Id := N + 068;
- Name_PolyORB_DSA : constant Name_Id := N + 069;
- Last_PCS_Name : constant Name_Id := N + 069;
+ First_PCS_Name : constant Name_Id := N + 068;
+ Name_No_DSA : constant Name_Id := N + 068;
+ Name_GARLIC_DSA : constant Name_Id := N + 069;
+ Name_PolyORB_DSA : constant Name_Id := N + 070;
+ Last_PCS_Name : constant Name_Id := N + 070;
subtype PCS_Names is Name_Id
range First_PCS_Name .. Last_PCS_Name;
-- Names of identifiers used in expanding distribution stubs
- Name_Addr : constant Name_Id := N + 070;
- Name_Async : constant Name_Id := N + 071;
- Name_Get_Active_Partition_ID : constant Name_Id := N + 072;
- Name_Get_RCI_Package_Receiver : constant Name_Id := N + 073;
- Name_Get_RCI_Package_Ref : constant Name_Id := N + 074;
- Name_Origin : constant Name_Id := N + 075;
- Name_Params : constant Name_Id := N + 076;
- Name_Partition : constant Name_Id := N + 077;
- Name_Partition_Interface : constant Name_Id := N + 078;
- Name_Ras : constant Name_Id := N + 079;
- Name_Call : constant Name_Id := N + 080;
- Name_RCI_Name : constant Name_Id := N + 081;
- Name_Receiver : constant Name_Id := N + 082;
- Name_Result : constant Name_Id := N + 083;
- Name_Rpc : constant Name_Id := N + 084;
- Name_Subp_Id : constant Name_Id := N + 085;
- Name_Operation : constant Name_Id := N + 086;
- Name_Argument : constant Name_Id := N + 087;
- Name_Arg_Modes : constant Name_Id := N + 088;
- Name_Handler : constant Name_Id := N + 089;
- Name_Target : constant Name_Id := N + 090;
- Name_Req : constant Name_Id := N + 091;
- Name_Obj_TypeCode : constant Name_Id := N + 092;
- Name_Stub : constant Name_Id := N + 093;
+ Name_Addr : constant Name_Id := N + 071;
+ Name_Async : constant Name_Id := N + 072;
+ Name_Get_Active_Partition_ID : constant Name_Id := N + 073;
+ Name_Get_RCI_Package_Receiver : constant Name_Id := N + 074;
+ Name_Get_RCI_Package_Ref : constant Name_Id := N + 075;
+ Name_Origin : constant Name_Id := N + 076;
+ Name_Params : constant Name_Id := N + 077;
+ Name_Partition : constant Name_Id := N + 078;
+ Name_Partition_Interface : constant Name_Id := N + 079;
+ Name_Ras : constant Name_Id := N + 080;
+ Name_Call : constant Name_Id := N + 081;
+ Name_RCI_Name : constant Name_Id := N + 082;
+ Name_Receiver : constant Name_Id := N + 083;
+ Name_Result : constant Name_Id := N + 084;
+ Name_Rpc : constant Name_Id := N + 085;
+ Name_Subp_Id : constant Name_Id := N + 086;
+ Name_Operation : constant Name_Id := N + 087;
+ Name_Argument : constant Name_Id := N + 088;
+ Name_Arg_Modes : constant Name_Id := N + 089;
+ Name_Handler : constant Name_Id := N + 090;
+ Name_Target : constant Name_Id := N + 091;
+ Name_Req : constant Name_Id := N + 092;
+ Name_Obj_TypeCode : constant Name_Id := N + 093;
+ Name_Stub : constant Name_Id := N + 094;
-- Operator Symbol entries. The actual names have an upper case O at
-- the start in place of the Op_ prefix (e.g. the actual name that
-- corresponds to Name_Op_Abs is "Oabs".
- First_Operator_Name : constant Name_Id := N + 094;
- Name_Op_Abs : constant Name_Id := N + 094; -- "abs"
- Name_Op_And : constant Name_Id := N + 095; -- "and"
- Name_Op_Mod : constant Name_Id := N + 096; -- "mod"
- Name_Op_Not : constant Name_Id := N + 097; -- "not"
- Name_Op_Or : constant Name_Id := N + 098; -- "or"
- Name_Op_Rem : constant Name_Id := N + 099; -- "rem"
- Name_Op_Xor : constant Name_Id := N + 100; -- "xor"
- Name_Op_Eq : constant Name_Id := N + 101; -- "="
- Name_Op_Ne : constant Name_Id := N + 102; -- "/="
- Name_Op_Lt : constant Name_Id := N + 103; -- "<"
- Name_Op_Le : constant Name_Id := N + 104; -- "<="
- Name_Op_Gt : constant Name_Id := N + 105; -- ">"
- Name_Op_Ge : constant Name_Id := N + 106; -- ">="
- Name_Op_Add : constant Name_Id := N + 107; -- "+"
- Name_Op_Subtract : constant Name_Id := N + 108; -- "-"
- Name_Op_Concat : constant Name_Id := N + 109; -- "&"
- Name_Op_Multiply : constant Name_Id := N + 110; -- "*"
- Name_Op_Divide : constant Name_Id := N + 111; -- "/"
- Name_Op_Expon : constant Name_Id := N + 112; -- "**"
- Last_Operator_Name : constant Name_Id := N + 112;
+ First_Operator_Name : constant Name_Id := N + 095;
+ Name_Op_Abs : constant Name_Id := N + 095; -- "abs"
+ Name_Op_And : constant Name_Id := N + 096; -- "and"
+ Name_Op_Mod : constant Name_Id := N + 097; -- "mod"
+ Name_Op_Not : constant Name_Id := N + 098; -- "not"
+ Name_Op_Or : constant Name_Id := N + 099; -- "or"
+ Name_Op_Rem : constant Name_Id := N + 100; -- "rem"
+ Name_Op_Xor : constant Name_Id := N + 101; -- "xor"
+ Name_Op_Eq : constant Name_Id := N + 102; -- "="
+ Name_Op_Ne : constant Name_Id := N + 103; -- "/="
+ Name_Op_Lt : constant Name_Id := N + 104; -- "<"
+ Name_Op_Le : constant Name_Id := N + 105; -- "<="
+ Name_Op_Gt : constant Name_Id := N + 106; -- ">"
+ Name_Op_Ge : constant Name_Id := N + 107; -- ">="
+ Name_Op_Add : constant Name_Id := N + 108; -- "+"
+ Name_Op_Subtract : constant Name_Id := N + 109; -- "-"
+ Name_Op_Concat : constant Name_Id := N + 110; -- "&"
+ Name_Op_Multiply : constant Name_Id := N + 111; -- "*"
+ Name_Op_Divide : constant Name_Id := N + 112; -- "/"
+ Name_Op_Expon : constant Name_Id := N + 113; -- "**"
+ Last_Operator_Name : constant Name_Id := N + 113;
-- Names for all pragmas recognized by GNAT. The entries with the comment
-- "Ada 83" are pragmas that are defined in Ada 83, but not in Ada 95.
@@ -324,65 +329,65 @@ package Snames is
-- only in GNAT for the AAMP. They are ignored in other versions with
-- appropriate warnings.
- First_Pragma_Name : constant Name_Id := N + 113;
+ First_Pragma_Name : constant Name_Id := N + 114;
-- Configuration pragmas are grouped at start
- Name_Ada_83 : constant Name_Id := N + 113; -- GNAT
- Name_Ada_95 : constant Name_Id := N + 114; -- GNAT
- Name_Ada_05 : constant Name_Id := N + 115; -- GNAT
- Name_Assertion_Policy : constant Name_Id := N + 116; -- Ada 05
- Name_C_Pass_By_Copy : constant Name_Id := N + 117; -- GNAT
- Name_Compile_Time_Warning : constant Name_Id := N + 118; -- GNAT
- Name_Component_Alignment : constant Name_Id := N + 119; -- GNAT
- Name_Convention_Identifier : constant Name_Id := N + 120; -- GNAT
- Name_Debug_Policy : constant Name_Id := N + 121; -- GNAT
- Name_Detect_Blocking : constant Name_Id := N + 122; -- Ada 05
- Name_Discard_Names : constant Name_Id := N + 123;
- Name_Elaboration_Checks : constant Name_Id := N + 124; -- GNAT
- Name_Eliminate : constant Name_Id := N + 125; -- GNAT
- Name_Explicit_Overriding : constant Name_Id := N + 126; -- Ada 05
- Name_Extend_System : constant Name_Id := N + 127; -- GNAT
- Name_Extensions_Allowed : constant Name_Id := N + 128; -- GNAT
- Name_External_Name_Casing : constant Name_Id := N + 129; -- GNAT
- Name_Float_Representation : constant Name_Id := N + 130; -- GNAT
- Name_Initialize_Scalars : constant Name_Id := N + 131; -- GNAT
- Name_Interrupt_State : constant Name_Id := N + 132; -- GNAT
- Name_License : constant Name_Id := N + 133; -- GNAT
- Name_Locking_Policy : constant Name_Id := N + 134;
- Name_Long_Float : constant Name_Id := N + 135; -- VMS
- Name_No_Run_Time : constant Name_Id := N + 136; -- GNAT
- Name_No_Strict_Aliasing : constant Name_Id := N + 137; -- GNAT
- Name_Normalize_Scalars : constant Name_Id := N + 138;
- Name_Polling : constant Name_Id := N + 139; -- GNAT
- Name_Persistent_BSS : constant Name_Id := N + 140; -- GNAT
- Name_Profile : constant Name_Id := N + 141; -- Ada 05
- Name_Profile_Warnings : constant Name_Id := N + 142; -- GNAT
- Name_Propagate_Exceptions : constant Name_Id := N + 143; -- GNAT
- Name_Queuing_Policy : constant Name_Id := N + 144;
- Name_Ravenscar : constant Name_Id := N + 145; -- Ada 05
- Name_Restricted_Run_Time : constant Name_Id := N + 146; -- GNAT
- Name_Restrictions : constant Name_Id := N + 147;
- Name_Restriction_Warnings : constant Name_Id := N + 148; -- GNAT
- Name_Reviewable : constant Name_Id := N + 149;
- Name_Source_File_Name : constant Name_Id := N + 150; -- GNAT
- Name_Source_File_Name_Project : constant Name_Id := N + 151; -- GNAT
- Name_Style_Checks : constant Name_Id := N + 152; -- GNAT
- Name_Suppress : constant Name_Id := N + 153;
- Name_Suppress_Exception_Locations : constant Name_Id := N + 154; -- GNAT
- Name_Task_Dispatching_Policy : constant Name_Id := N + 155;
- Name_Universal_Data : constant Name_Id := N + 156; -- AAMP
- Name_Unsuppress : constant Name_Id := N + 157; -- GNAT
- Name_Use_VADS_Size : constant Name_Id := N + 158; -- GNAT
- Name_Validity_Checks : constant Name_Id := N + 159; -- GNAT
- Name_Warnings : constant Name_Id := N + 160; -- GNAT
- Last_Configuration_Pragma_Name : constant Name_Id := N + 160;
+ Name_Ada_83 : constant Name_Id := N + 114; -- GNAT
+ Name_Ada_95 : constant Name_Id := N + 115; -- GNAT
+ Name_Ada_05 : constant Name_Id := N + 116; -- GNAT
+ Name_Assertion_Policy : constant Name_Id := N + 117; -- Ada 05
+ Name_C_Pass_By_Copy : constant Name_Id := N + 118; -- GNAT
+ Name_Compile_Time_Warning : constant Name_Id := N + 119; -- GNAT
+ Name_Component_Alignment : constant Name_Id := N + 120; -- GNAT
+ Name_Convention_Identifier : constant Name_Id := N + 121; -- GNAT
+ Name_Debug_Policy : constant Name_Id := N + 122; -- GNAT
+ Name_Detect_Blocking : constant Name_Id := N + 123; -- Ada 05
+ Name_Discard_Names : constant Name_Id := N + 124;
+ Name_Elaboration_Checks : constant Name_Id := N + 125; -- GNAT
+ Name_Eliminate : constant Name_Id := N + 126; -- GNAT
+ Name_Explicit_Overriding : constant Name_Id := N + 127; -- Ada 05
+ Name_Extend_System : constant Name_Id := N + 128; -- GNAT
+ Name_Extensions_Allowed : constant Name_Id := N + 129; -- GNAT
+ Name_External_Name_Casing : constant Name_Id := N + 130; -- GNAT
+ Name_Float_Representation : constant Name_Id := N + 131; -- GNAT
+ Name_Initialize_Scalars : constant Name_Id := N + 132; -- GNAT
+ Name_Interrupt_State : constant Name_Id := N + 133; -- GNAT
+ Name_License : constant Name_Id := N + 134; -- GNAT
+ Name_Locking_Policy : constant Name_Id := N + 135;
+ Name_Long_Float : constant Name_Id := N + 136; -- VMS
+ Name_No_Run_Time : constant Name_Id := N + 137; -- GNAT
+ Name_No_Strict_Aliasing : constant Name_Id := N + 138; -- GNAT
+ Name_Normalize_Scalars : constant Name_Id := N + 139;
+ Name_Polling : constant Name_Id := N + 140; -- GNAT
+ Name_Persistent_BSS : constant Name_Id := N + 141; -- GNAT
+ Name_Profile : constant Name_Id := N + 142; -- Ada 05
+ Name_Profile_Warnings : constant Name_Id := N + 143; -- GNAT
+ Name_Propagate_Exceptions : constant Name_Id := N + 144; -- GNAT
+ Name_Queuing_Policy : constant Name_Id := N + 145;
+ Name_Ravenscar : constant Name_Id := N + 146; -- Ada 05
+ Name_Restricted_Run_Time : constant Name_Id := N + 147; -- GNAT
+ Name_Restrictions : constant Name_Id := N + 148;
+ Name_Restriction_Warnings : constant Name_Id := N + 149; -- GNAT
+ Name_Reviewable : constant Name_Id := N + 150;
+ Name_Source_File_Name : constant Name_Id := N + 151; -- GNAT
+ Name_Source_File_Name_Project : constant Name_Id := N + 152; -- GNAT
+ Name_Style_Checks : constant Name_Id := N + 153; -- GNAT
+ Name_Suppress : constant Name_Id := N + 154;
+ Name_Suppress_Exception_Locations : constant Name_Id := N + 155; -- GNAT
+ Name_Task_Dispatching_Policy : constant Name_Id := N + 156;
+ Name_Universal_Data : constant Name_Id := N + 157; -- AAMP
+ Name_Unsuppress : constant Name_Id := N + 158; -- GNAT
+ Name_Use_VADS_Size : constant Name_Id := N + 159; -- GNAT
+ Name_Validity_Checks : constant Name_Id := N + 160; -- GNAT
+ Name_Warnings : constant Name_Id := N + 161; -- GNAT
+ Last_Configuration_Pragma_Name : constant Name_Id := N + 161;
-- Remaining pragma names
- Name_Abort_Defer : constant Name_Id := N + 161; -- GNAT
- Name_All_Calls_Remote : constant Name_Id := N + 162;
- Name_Annotate : constant Name_Id := N + 163; -- GNAT
+ Name_Abort_Defer : constant Name_Id := N + 162; -- GNAT
+ Name_All_Calls_Remote : constant Name_Id := N + 163;
+ Name_Annotate : constant Name_Id := N + 164; -- GNAT
-- Note: AST_Entry is not in this list because its name matches the
-- name of the corresponding attribute. However, it is included in the
@@ -390,80 +395,80 @@ package Snames is
-- and Check_Pragma_Id correctly recognize and process Name_AST_Entry.
-- AST_Entry is a VMS specific pragma.
- Name_Assert : constant Name_Id := N + 164; -- Ada 05
- Name_Asynchronous : constant Name_Id := N + 165;
- Name_Atomic : constant Name_Id := N + 166;
- Name_Atomic_Components : constant Name_Id := N + 167;
- Name_Attach_Handler : constant Name_Id := N + 168;
- Name_Comment : constant Name_Id := N + 169; -- GNAT
- Name_Common_Object : constant Name_Id := N + 170; -- GNAT
- Name_Complex_Representation : constant Name_Id := N + 171; -- GNAT
- Name_Controlled : constant Name_Id := N + 172;
- Name_Convention : constant Name_Id := N + 173;
- Name_CPP_Class : constant Name_Id := N + 174; -- GNAT
- Name_CPP_Constructor : constant Name_Id := N + 175; -- GNAT
- Name_CPP_Virtual : constant Name_Id := N + 176; -- GNAT
- Name_CPP_Vtable : constant Name_Id := N + 177; -- GNAT
- Name_Debug : constant Name_Id := N + 178; -- GNAT
- Name_Elaborate : constant Name_Id := N + 179; -- Ada 83
- Name_Elaborate_All : constant Name_Id := N + 180;
- Name_Elaborate_Body : constant Name_Id := N + 181;
- Name_Export : constant Name_Id := N + 182;
- Name_Export_Exception : constant Name_Id := N + 183; -- VMS
- Name_Export_Function : constant Name_Id := N + 184; -- GNAT
- Name_Export_Object : constant Name_Id := N + 185; -- GNAT
- Name_Export_Procedure : constant Name_Id := N + 186; -- GNAT
- Name_Export_Value : constant Name_Id := N + 187; -- GNAT
- Name_Export_Valued_Procedure : constant Name_Id := N + 188; -- GNAT
- Name_External : constant Name_Id := N + 189; -- GNAT
- Name_Finalize_Storage_Only : constant Name_Id := N + 190; -- GNAT
- Name_Ident : constant Name_Id := N + 191; -- VMS
- Name_Import : constant Name_Id := N + 192;
- Name_Import_Exception : constant Name_Id := N + 193; -- VMS
- Name_Import_Function : constant Name_Id := N + 194; -- GNAT
- Name_Import_Object : constant Name_Id := N + 195; -- GNAT
- Name_Import_Procedure : constant Name_Id := N + 196; -- GNAT
- Name_Import_Valued_Procedure : constant Name_Id := N + 197; -- GNAT
- Name_Inline : constant Name_Id := N + 198;
- Name_Inline_Always : constant Name_Id := N + 199; -- GNAT
- Name_Inline_Generic : constant Name_Id := N + 200; -- GNAT
- Name_Inspection_Point : constant Name_Id := N + 201;
- Name_Interface_Name : constant Name_Id := N + 202; -- GNAT
- Name_Interrupt_Handler : constant Name_Id := N + 203;
- Name_Interrupt_Priority : constant Name_Id := N + 204;
- Name_Java_Constructor : constant Name_Id := N + 205; -- GNAT
- Name_Java_Interface : constant Name_Id := N + 206; -- GNAT
- Name_Keep_Names : constant Name_Id := N + 207; -- GNAT
- Name_Link_With : constant Name_Id := N + 208; -- GNAT
- Name_Linker_Alias : constant Name_Id := N + 209; -- GNAT
- Name_Linker_Constructor : constant Name_Id := N + 210; -- GNAT
- Name_Linker_Destructor : constant Name_Id := N + 211; -- GNAT
- Name_Linker_Options : constant Name_Id := N + 212;
- Name_Linker_Section : constant Name_Id := N + 213; -- GNAT
- Name_List : constant Name_Id := N + 214;
- Name_Machine_Attribute : constant Name_Id := N + 215; -- GNAT
- Name_Main : constant Name_Id := N + 216; -- GNAT
- Name_Main_Storage : constant Name_Id := N + 217; -- GNAT
- Name_Memory_Size : constant Name_Id := N + 218; -- Ada 83
- Name_No_Return : constant Name_Id := N + 219; -- GNAT
- Name_Obsolescent : constant Name_Id := N + 220; -- GNAT
- Name_Optimize : constant Name_Id := N + 221;
- Name_Optional_Overriding : constant Name_Id := N + 222; -- Ada 05
- Name_Pack : constant Name_Id := N + 223;
- Name_Page : constant Name_Id := N + 224;
- Name_Passive : constant Name_Id := N + 225; -- GNAT
- Name_Preelaborate : constant Name_Id := N + 226;
- Name_Preelaborate_05 : constant Name_Id := N + 227; -- GNAT
- Name_Priority : constant Name_Id := N + 228;
- Name_Psect_Object : constant Name_Id := N + 229; -- VMS
- Name_Pure : constant Name_Id := N + 230;
- Name_Pure_05 : constant Name_Id := N + 231; -- GNAT
- Name_Pure_Function : constant Name_Id := N + 232; -- GNAT
- Name_Remote_Call_Interface : constant Name_Id := N + 233;
- Name_Remote_Types : constant Name_Id := N + 234;
- Name_Share_Generic : constant Name_Id := N + 235; -- GNAT
- Name_Shared : constant Name_Id := N + 236; -- Ada 83
- Name_Shared_Passive : constant Name_Id := N + 237;
+ Name_Assert : constant Name_Id := N + 165; -- Ada 05
+ Name_Asynchronous : constant Name_Id := N + 166;
+ Name_Atomic : constant Name_Id := N + 167;
+ Name_Atomic_Components : constant Name_Id := N + 168;
+ Name_Attach_Handler : constant Name_Id := N + 169;
+ Name_Comment : constant Name_Id := N + 170; -- GNAT
+ Name_Common_Object : constant Name_Id := N + 171; -- GNAT
+ Name_Complex_Representation : constant Name_Id := N + 172; -- GNAT
+ Name_Controlled : constant Name_Id := N + 173;
+ Name_Convention : constant Name_Id := N + 174;
+ Name_CPP_Class : constant Name_Id := N + 175; -- GNAT
+ Name_CPP_Constructor : constant Name_Id := N + 176; -- GNAT
+ Name_CPP_Virtual : constant Name_Id := N + 177; -- GNAT
+ Name_CPP_Vtable : constant Name_Id := N + 178; -- GNAT
+ Name_Debug : constant Name_Id := N + 179; -- GNAT
+ Name_Elaborate : constant Name_Id := N + 180; -- Ada 83
+ Name_Elaborate_All : constant Name_Id := N + 181;
+ Name_Elaborate_Body : constant Name_Id := N + 182;
+ Name_Export : constant Name_Id := N + 183;
+ Name_Export_Exception : constant Name_Id := N + 184; -- VMS
+ Name_Export_Function : constant Name_Id := N + 185; -- GNAT
+ Name_Export_Object : constant Name_Id := N + 186; -- GNAT
+ Name_Export_Procedure : constant Name_Id := N + 187; -- GNAT
+ Name_Export_Value : constant Name_Id := N + 188; -- GNAT
+ Name_Export_Valued_Procedure : constant Name_Id := N + 189; -- GNAT
+ Name_External : constant Name_Id := N + 190; -- GNAT
+ Name_Finalize_Storage_Only : constant Name_Id := N + 191; -- GNAT
+ Name_Ident : constant Name_Id := N + 192; -- VMS
+ Name_Import : constant Name_Id := N + 193;
+ Name_Import_Exception : constant Name_Id := N + 194; -- VMS
+ Name_Import_Function : constant Name_Id := N + 195; -- GNAT
+ Name_Import_Object : constant Name_Id := N + 196; -- GNAT
+ Name_Import_Procedure : constant Name_Id := N + 197; -- GNAT
+ Name_Import_Valued_Procedure : constant Name_Id := N + 198; -- GNAT
+ Name_Inline : constant Name_Id := N + 199;
+ Name_Inline_Always : constant Name_Id := N + 200; -- GNAT
+ Name_Inline_Generic : constant Name_Id := N + 201; -- GNAT
+ Name_Inspection_Point : constant Name_Id := N + 202;
+ Name_Interface_Name : constant Name_Id := N + 203; -- GNAT
+ Name_Interrupt_Handler : constant Name_Id := N + 204;
+ Name_Interrupt_Priority : constant Name_Id := N + 205;
+ Name_Java_Constructor : constant Name_Id := N + 206; -- GNAT
+ Name_Java_Interface : constant Name_Id := N + 207; -- GNAT
+ Name_Keep_Names : constant Name_Id := N + 208; -- GNAT
+ Name_Link_With : constant Name_Id := N + 209; -- GNAT
+ Name_Linker_Alias : constant Name_Id := N + 210; -- GNAT
+ Name_Linker_Constructor : constant Name_Id := N + 211; -- GNAT
+ Name_Linker_Destructor : constant Name_Id := N + 212; -- GNAT
+ Name_Linker_Options : constant Name_Id := N + 213;
+ Name_Linker_Section : constant Name_Id := N + 214; -- GNAT
+ Name_List : constant Name_Id := N + 215;
+ Name_Machine_Attribute : constant Name_Id := N + 216; -- GNAT
+ Name_Main : constant Name_Id := N + 217; -- GNAT
+ Name_Main_Storage : constant Name_Id := N + 218; -- GNAT
+ Name_Memory_Size : constant Name_Id := N + 219; -- Ada 83
+ Name_No_Return : constant Name_Id := N + 220; -- GNAT
+ Name_Obsolescent : constant Name_Id := N + 221; -- GNAT
+ Name_Optimize : constant Name_Id := N + 222;
+ Name_Optional_Overriding : constant Name_Id := N + 223; -- Ada 05
+ Name_Pack : constant Name_Id := N + 224;
+ Name_Page : constant Name_Id := N + 225;
+ Name_Passive : constant Name_Id := N + 226; -- GNAT
+ Name_Preelaborate : constant Name_Id := N + 227;
+ Name_Preelaborate_05 : constant Name_Id := N + 228; -- GNAT
+ Name_Priority : constant Name_Id := N + 229;
+ Name_Psect_Object : constant Name_Id := N + 230; -- VMS
+ Name_Pure : constant Name_Id := N + 231;
+ Name_Pure_05 : constant Name_Id := N + 232; -- GNAT
+ Name_Pure_Function : constant Name_Id := N + 233; -- GNAT
+ Name_Remote_Call_Interface : constant Name_Id := N + 234;
+ Name_Remote_Types : constant Name_Id := N + 235;
+ Name_Share_Generic : constant Name_Id := N + 236; -- GNAT
+ Name_Shared : constant Name_Id := N + 237; -- Ada 83
+ Name_Shared_Passive : constant Name_Id := N + 238;
-- Note: Storage_Size is not in this list because its name matches the
-- name of the corresponding attribute. However, it is included in the
@@ -473,27 +478,27 @@ package Snames is
-- Note: Storage_Unit is also omitted from the list because of a clash
-- with an attribute name, and is treated similarly.
- Name_Source_Reference : constant Name_Id := N + 238; -- GNAT
- Name_Stream_Convert : constant Name_Id := N + 239; -- GNAT
- Name_Subtitle : constant Name_Id := N + 240; -- GNAT
- Name_Suppress_All : constant Name_Id := N + 241; -- GNAT
- Name_Suppress_Debug_Info : constant Name_Id := N + 242; -- GNAT
- Name_Suppress_Initialization : constant Name_Id := N + 243; -- GNAT
- Name_System_Name : constant Name_Id := N + 244; -- Ada 83
- Name_Task_Info : constant Name_Id := N + 245; -- GNAT
- Name_Task_Name : constant Name_Id := N + 246; -- GNAT
- Name_Task_Storage : constant Name_Id := N + 247; -- VMS
- Name_Thread_Body : constant Name_Id := N + 248; -- GNAT
- Name_Time_Slice : constant Name_Id := N + 249; -- GNAT
- Name_Title : constant Name_Id := N + 250; -- GNAT
- Name_Unchecked_Union : constant Name_Id := N + 251; -- GNAT
- Name_Unimplemented_Unit : constant Name_Id := N + 252; -- GNAT
- Name_Unreferenced : constant Name_Id := N + 253; -- GNAT
- Name_Unreserve_All_Interrupts : constant Name_Id := N + 254; -- GNAT
- Name_Volatile : constant Name_Id := N + 255;
- Name_Volatile_Components : constant Name_Id := N + 256;
- Name_Weak_External : constant Name_Id := N + 257; -- GNAT
- Last_Pragma_Name : constant Name_Id := N + 257;
+ Name_Source_Reference : constant Name_Id := N + 239; -- GNAT
+ Name_Stream_Convert : constant Name_Id := N + 240; -- GNAT
+ Name_Subtitle : constant Name_Id := N + 241; -- GNAT
+ Name_Suppress_All : constant Name_Id := N + 242; -- GNAT
+ Name_Suppress_Debug_Info : constant Name_Id := N + 243; -- GNAT
+ Name_Suppress_Initialization : constant Name_Id := N + 244; -- GNAT
+ Name_System_Name : constant Name_Id := N + 245; -- Ada 83
+ Name_Task_Info : constant Name_Id := N + 246; -- GNAT
+ Name_Task_Name : constant Name_Id := N + 247; -- GNAT
+ Name_Task_Storage : constant Name_Id := N + 248; -- VMS
+ Name_Thread_Body : constant Name_Id := N + 249; -- GNAT
+ Name_Time_Slice : constant Name_Id := N + 250; -- GNAT
+ Name_Title : constant Name_Id := N + 251; -- GNAT
+ Name_Unchecked_Union : constant Name_Id := N + 252; -- GNAT
+ Name_Unimplemented_Unit : constant Name_Id := N + 253; -- GNAT
+ Name_Unreferenced : constant Name_Id := N + 254; -- GNAT
+ Name_Unreserve_All_Interrupts : constant Name_Id := N + 255; -- GNAT
+ Name_Volatile : constant Name_Id := N + 256;
+ Name_Volatile_Components : constant Name_Id := N + 257;
+ Name_Weak_External : constant Name_Id := N + 258; -- GNAT
+ Last_Pragma_Name : constant Name_Id := N + 258;
-- Language convention names for pragma Convention/Export/Import/Interface
-- Note that Name_C is not included in this list, since it was already
@@ -504,114 +509,114 @@ package Snames is
-- Entry and Protected, this is because these conventions cannot be
-- specified by a pragma.
- First_Convention_Name : constant Name_Id := N + 258;
- Name_Ada : constant Name_Id := N + 258;
- Name_Assembler : constant Name_Id := N + 259;
- Name_COBOL : constant Name_Id := N + 260;
- Name_CPP : constant Name_Id := N + 261;
- Name_Fortran : constant Name_Id := N + 262;
- Name_Intrinsic : constant Name_Id := N + 263;
- Name_Java : constant Name_Id := N + 264;
- Name_Stdcall : constant Name_Id := N + 265;
- Name_Stubbed : constant Name_Id := N + 266;
- Last_Convention_Name : constant Name_Id := N + 266;
+ First_Convention_Name : constant Name_Id := N + 259;
+ Name_Ada : constant Name_Id := N + 259;
+ Name_Assembler : constant Name_Id := N + 260;
+ Name_COBOL : constant Name_Id := N + 261;
+ Name_CPP : constant Name_Id := N + 262;
+ Name_Fortran : constant Name_Id := N + 263;
+ Name_Intrinsic : constant Name_Id := N + 264;
+ Name_Java : constant Name_Id := N + 265;
+ Name_Stdcall : constant Name_Id := N + 266;
+ Name_Stubbed : constant Name_Id := N + 267;
+ Last_Convention_Name : constant Name_Id := N + 267;
-- The following names are preset as synonyms for Assembler
- Name_Asm : constant Name_Id := N + 267;
- Name_Assembly : constant Name_Id := N + 268;
+ Name_Asm : constant Name_Id := N + 268;
+ Name_Assembly : constant Name_Id := N + 269;
-- The following names are preset as synonyms for C
- Name_Default : constant Name_Id := N + 269;
+ Name_Default : constant Name_Id := N + 270;
-- Name_Exernal (previously defined as pragma)
-- The following names are present as synonyms for Stdcall
- Name_DLL : constant Name_Id := N + 270;
- Name_Win32 : constant Name_Id := N + 271;
+ Name_DLL : constant Name_Id := N + 271;
+ Name_Win32 : constant Name_Id := N + 272;
-- Other special names used in processing pragmas
- Name_As_Is : constant Name_Id := N + 272;
- Name_Attribute_Name : constant Name_Id := N + 273;
- Name_Body_File_Name : constant Name_Id := N + 274;
- Name_Boolean_Entry_Barriers : constant Name_Id := N + 275;
- Name_Check : constant Name_Id := N + 276;
- Name_Casing : constant Name_Id := N + 277;
- Name_Code : constant Name_Id := N + 278;
- Name_Component : constant Name_Id := N + 279;
- Name_Component_Size_4 : constant Name_Id := N + 280;
- Name_Copy : constant Name_Id := N + 281;
- Name_D_Float : constant Name_Id := N + 282;
- Name_Descriptor : constant Name_Id := N + 283;
- Name_Dot_Replacement : constant Name_Id := N + 284;
- Name_Dynamic : constant Name_Id := N + 285;
- Name_Entity : constant Name_Id := N + 286;
- Name_Entry_Count : constant Name_Id := N + 287;
- Name_External_Name : constant Name_Id := N + 288;
- Name_First_Optional_Parameter : constant Name_Id := N + 289;
- Name_Form : constant Name_Id := N + 290;
- Name_G_Float : constant Name_Id := N + 291;
- Name_Gcc : constant Name_Id := N + 292;
- Name_Gnat : constant Name_Id := N + 293;
- Name_GPL : constant Name_Id := N + 294;
- Name_IEEE_Float : constant Name_Id := N + 295;
- Name_Ignore : constant Name_Id := N + 296;
- Name_Info : constant Name_Id := N + 297;
- Name_Internal : constant Name_Id := N + 298;
- Name_Link_Name : constant Name_Id := N + 299;
- Name_Lowercase : constant Name_Id := N + 300;
- Name_Max_Entry_Queue_Depth : constant Name_Id := N + 301;
- Name_Max_Entry_Queue_Length : constant Name_Id := N + 302;
- Name_Max_Size : constant Name_Id := N + 303;
- Name_Mechanism : constant Name_Id := N + 304;
- Name_Message : constant Name_Id := N + 305;
- Name_Mixedcase : constant Name_Id := N + 306;
- Name_Modified_GPL : constant Name_Id := N + 307;
- Name_Name : constant Name_Id := N + 308;
- Name_NCA : constant Name_Id := N + 309;
- Name_No : constant Name_Id := N + 310;
- Name_No_Dependence : constant Name_Id := N + 311;
- Name_No_Dynamic_Attachment : constant Name_Id := N + 312;
- Name_No_Dynamic_Interrupts : constant Name_Id := N + 313;
- Name_No_Requeue : constant Name_Id := N + 314;
- Name_No_Requeue_Statements : constant Name_Id := N + 315;
- Name_No_Task_Attributes : constant Name_Id := N + 316;
- Name_No_Task_Attributes_Package : constant Name_Id := N + 317;
- Name_On : constant Name_Id := N + 318;
- Name_Parameter_Types : constant Name_Id := N + 319;
- Name_Reference : constant Name_Id := N + 320;
- Name_Restricted : constant Name_Id := N + 321;
- Name_Result_Mechanism : constant Name_Id := N + 322;
- Name_Result_Type : constant Name_Id := N + 323;
- Name_Runtime : constant Name_Id := N + 324;
- Name_SB : constant Name_Id := N + 325;
- Name_Secondary_Stack_Size : constant Name_Id := N + 326;
- Name_Section : constant Name_Id := N + 327;
- Name_Semaphore : constant Name_Id := N + 328;
- Name_Simple_Barriers : constant Name_Id := N + 329;
- Name_Spec_File_Name : constant Name_Id := N + 330;
- Name_State : constant Name_Id := N + 331;
- Name_Static : constant Name_Id := N + 332;
- Name_Stack_Size : constant Name_Id := N + 333;
- Name_Subunit_File_Name : constant Name_Id := N + 334;
- Name_Task_Stack_Size_Default : constant Name_Id := N + 335;
- Name_Task_Type : constant Name_Id := N + 336;
- Name_Time_Slicing_Enabled : constant Name_Id := N + 337;
- Name_Top_Guard : constant Name_Id := N + 338;
- Name_UBA : constant Name_Id := N + 339;
- Name_UBS : constant Name_Id := N + 340;
- Name_UBSB : constant Name_Id := N + 341;
- Name_Unit_Name : constant Name_Id := N + 342;
- Name_Unknown : constant Name_Id := N + 343;
- Name_Unrestricted : constant Name_Id := N + 344;
- Name_Uppercase : constant Name_Id := N + 345;
- Name_User : constant Name_Id := N + 346;
- Name_VAX_Float : constant Name_Id := N + 347;
- Name_VMS : constant Name_Id := N + 348;
- Name_Vtable_Ptr : constant Name_Id := N + 349;
- Name_Working_Storage : constant Name_Id := N + 350;
+ Name_As_Is : constant Name_Id := N + 273;
+ Name_Attribute_Name : constant Name_Id := N + 274;
+ Name_Body_File_Name : constant Name_Id := N + 275;
+ Name_Boolean_Entry_Barriers : constant Name_Id := N + 276;
+ Name_Check : constant Name_Id := N + 277;
+ Name_Casing : constant Name_Id := N + 278;
+ Name_Code : constant Name_Id := N + 279;
+ Name_Component : constant Name_Id := N + 280;
+ Name_Component_Size_4 : constant Name_Id := N + 281;
+ Name_Copy : constant Name_Id := N + 282;
+ Name_D_Float : constant Name_Id := N + 283;
+ Name_Descriptor : constant Name_Id := N + 284;
+ Name_Dot_Replacement : constant Name_Id := N + 285;
+ Name_Dynamic : constant Name_Id := N + 286;
+ Name_Entity : constant Name_Id := N + 287;
+ Name_Entry_Count : constant Name_Id := N + 288;
+ Name_External_Name : constant Name_Id := N + 289;
+ Name_First_Optional_Parameter : constant Name_Id := N + 290;
+ Name_Form : constant Name_Id := N + 291;
+ Name_G_Float : constant Name_Id := N + 292;
+ Name_Gcc : constant Name_Id := N + 293;
+ Name_Gnat : constant Name_Id := N + 294;
+ Name_GPL : constant Name_Id := N + 295;
+ Name_IEEE_Float : constant Name_Id := N + 296;
+ Name_Ignore : constant Name_Id := N + 297;
+ Name_Info : constant Name_Id := N + 298;
+ Name_Internal : constant Name_Id := N + 299;
+ Name_Link_Name : constant Name_Id := N + 300;
+ Name_Lowercase : constant Name_Id := N + 301;
+ Name_Max_Entry_Queue_Depth : constant Name_Id := N + 302;
+ Name_Max_Entry_Queue_Length : constant Name_Id := N + 303;
+ Name_Max_Size : constant Name_Id := N + 304;
+ Name_Mechanism : constant Name_Id := N + 305;
+ Name_Message : constant Name_Id := N + 306;
+ Name_Mixedcase : constant Name_Id := N + 307;
+ Name_Modified_GPL : constant Name_Id := N + 308;
+ Name_Name : constant Name_Id := N + 309;
+ Name_NCA : constant Name_Id := N + 310;
+ Name_No : constant Name_Id := N + 311;
+ Name_No_Dependence : constant Name_Id := N + 312;
+ Name_No_Dynamic_Attachment : constant Name_Id := N + 313;
+ Name_No_Dynamic_Interrupts : constant Name_Id := N + 314;
+ Name_No_Requeue : constant Name_Id := N + 315;
+ Name_No_Requeue_Statements : constant Name_Id := N + 316;
+ Name_No_Task_Attributes : constant Name_Id := N + 317;
+ Name_No_Task_Attributes_Package : constant Name_Id := N + 318;
+ Name_On : constant Name_Id := N + 319;
+ Name_Parameter_Types : constant Name_Id := N + 320;
+ Name_Reference : constant Name_Id := N + 321;
+ Name_Restricted : constant Name_Id := N + 322;
+ Name_Result_Mechanism : constant Name_Id := N + 323;
+ Name_Result_Type : constant Name_Id := N + 324;
+ Name_Runtime : constant Name_Id := N + 325;
+ Name_SB : constant Name_Id := N + 326;
+ Name_Secondary_Stack_Size : constant Name_Id := N + 327;
+ Name_Section : constant Name_Id := N + 328;
+ Name_Semaphore : constant Name_Id := N + 329;
+ Name_Simple_Barriers : constant Name_Id := N + 330;
+ Name_Spec_File_Name : constant Name_Id := N + 331;
+ Name_State : constant Name_Id := N + 332;
+ Name_Static : constant Name_Id := N + 333;
+ Name_Stack_Size : constant Name_Id := N + 334;
+ Name_Subunit_File_Name : constant Name_Id := N + 335;
+ Name_Task_Stack_Size_Default : constant Name_Id := N + 336;
+ Name_Task_Type : constant Name_Id := N + 337;
+ Name_Time_Slicing_Enabled : constant Name_Id := N + 338;
+ Name_Top_Guard : constant Name_Id := N + 339;
+ Name_UBA : constant Name_Id := N + 340;
+ Name_UBS : constant Name_Id := N + 341;
+ Name_UBSB : constant Name_Id := N + 342;
+ Name_Unit_Name : constant Name_Id := N + 343;
+ Name_Unknown : constant Name_Id := N + 344;
+ Name_Unrestricted : constant Name_Id := N + 345;
+ Name_Uppercase : constant Name_Id := N + 346;
+ Name_User : constant Name_Id := N + 347;
+ Name_VAX_Float : constant Name_Id := N + 348;
+ Name_VMS : constant Name_Id := N + 349;
+ Name_Vtable_Ptr : constant Name_Id := N + 350;
+ Name_Working_Storage : constant Name_Id := N + 351;
-- Names of recognized attributes. The entries with the comment "Ada 83"
-- are attributes that are defined in Ada 83, but not in Ada 95. These
@@ -625,165 +630,166 @@ package Snames is
-- The entries marked VMS are recognized only in OpenVMS implementations
-- of GNAT, and are treated as illegal in all other contexts.
- First_Attribute_Name : constant Name_Id := N + 351;
- Name_Abort_Signal : constant Name_Id := N + 351; -- GNAT
- Name_Access : constant Name_Id := N + 352;
- Name_Address : constant Name_Id := N + 353;
- Name_Address_Size : constant Name_Id := N + 354; -- GNAT
- Name_Aft : constant Name_Id := N + 355;
- Name_Alignment : constant Name_Id := N + 356;
- Name_Asm_Input : constant Name_Id := N + 357; -- GNAT
- Name_Asm_Output : constant Name_Id := N + 358; -- GNAT
- Name_AST_Entry : constant Name_Id := N + 359; -- VMS
- Name_Bit : constant Name_Id := N + 360; -- GNAT
- Name_Bit_Order : constant Name_Id := N + 361;
- Name_Bit_Position : constant Name_Id := N + 362; -- GNAT
- Name_Body_Version : constant Name_Id := N + 363;
- Name_Callable : constant Name_Id := N + 364;
- Name_Caller : constant Name_Id := N + 365;
- Name_Code_Address : constant Name_Id := N + 366; -- GNAT
- Name_Component_Size : constant Name_Id := N + 367;
- Name_Compose : constant Name_Id := N + 368;
- Name_Constrained : constant Name_Id := N + 369;
- Name_Count : constant Name_Id := N + 370;
- Name_Default_Bit_Order : constant Name_Id := N + 371; -- GNAT
- Name_Definite : constant Name_Id := N + 372;
- Name_Delta : constant Name_Id := N + 373;
- Name_Denorm : constant Name_Id := N + 374;
- Name_Digits : constant Name_Id := N + 375;
- Name_Elaborated : constant Name_Id := N + 376; -- GNAT
- Name_Emax : constant Name_Id := N + 377; -- Ada 83
- Name_Enum_Rep : constant Name_Id := N + 378; -- GNAT
- Name_Epsilon : constant Name_Id := N + 379; -- Ada 83
- Name_Exponent : constant Name_Id := N + 380;
- Name_External_Tag : constant Name_Id := N + 381;
- Name_First : constant Name_Id := N + 382;
- Name_First_Bit : constant Name_Id := N + 383;
- Name_Fixed_Value : constant Name_Id := N + 384; -- GNAT
- Name_Fore : constant Name_Id := N + 385;
- Name_Has_Access_Values : constant Name_Id := N + 386; -- GNAT
- Name_Has_Discriminants : constant Name_Id := N + 387; -- GNAT
- Name_Identity : constant Name_Id := N + 388;
- Name_Img : constant Name_Id := N + 389; -- GNAT
- Name_Integer_Value : constant Name_Id := N + 390; -- GNAT
- Name_Large : constant Name_Id := N + 391; -- Ada 83
- Name_Last : constant Name_Id := N + 392;
- Name_Last_Bit : constant Name_Id := N + 393;
- Name_Leading_Part : constant Name_Id := N + 394;
- Name_Length : constant Name_Id := N + 395;
- Name_Machine_Emax : constant Name_Id := N + 396;
- Name_Machine_Emin : constant Name_Id := N + 397;
- Name_Machine_Mantissa : constant Name_Id := N + 398;
- Name_Machine_Overflows : constant Name_Id := N + 399;
- Name_Machine_Radix : constant Name_Id := N + 400;
- Name_Machine_Rounds : constant Name_Id := N + 401;
- Name_Machine_Size : constant Name_Id := N + 402; -- GNAT
- Name_Mantissa : constant Name_Id := N + 403; -- Ada 83
- Name_Max_Size_In_Storage_Elements : constant Name_Id := N + 404;
- Name_Maximum_Alignment : constant Name_Id := N + 405; -- GNAT
- Name_Mechanism_Code : constant Name_Id := N + 406; -- GNAT
- Name_Mod : constant Name_Id := N + 407;
- Name_Model_Emin : constant Name_Id := N + 408;
- Name_Model_Epsilon : constant Name_Id := N + 409;
- Name_Model_Mantissa : constant Name_Id := N + 410;
- Name_Model_Small : constant Name_Id := N + 411;
- Name_Modulus : constant Name_Id := N + 412;
- Name_Null_Parameter : constant Name_Id := N + 413; -- GNAT
- Name_Object_Size : constant Name_Id := N + 414; -- GNAT
- Name_Partition_ID : constant Name_Id := N + 415;
- Name_Passed_By_Reference : constant Name_Id := N + 416; -- GNAT
- Name_Pool_Address : constant Name_Id := N + 417;
- Name_Pos : constant Name_Id := N + 418;
- Name_Position : constant Name_Id := N + 419;
- Name_Range : constant Name_Id := N + 420;
- Name_Range_Length : constant Name_Id := N + 421; -- GNAT
- Name_Round : constant Name_Id := N + 422;
- Name_Safe_Emax : constant Name_Id := N + 423; -- Ada 83
- Name_Safe_First : constant Name_Id := N + 424;
- Name_Safe_Large : constant Name_Id := N + 425; -- Ada 83
- Name_Safe_Last : constant Name_Id := N + 426;
- Name_Safe_Small : constant Name_Id := N + 427; -- Ada 83
- Name_Scale : constant Name_Id := N + 428;
- Name_Scaling : constant Name_Id := N + 429;
- Name_Signed_Zeros : constant Name_Id := N + 430;
- Name_Size : constant Name_Id := N + 431;
- Name_Small : constant Name_Id := N + 432;
- Name_Storage_Size : constant Name_Id := N + 433;
- Name_Storage_Unit : constant Name_Id := N + 434; -- GNAT
- Name_Stream_Size : constant Name_Id := N + 435; -- Ada 05
- Name_Tag : constant Name_Id := N + 436;
- Name_Target_Name : constant Name_Id := N + 437; -- GNAT
- Name_Terminated : constant Name_Id := N + 438;
- Name_To_Address : constant Name_Id := N + 439; -- GNAT
- Name_Type_Class : constant Name_Id := N + 440; -- GNAT
- Name_UET_Address : constant Name_Id := N + 441; -- GNAT
- Name_Unbiased_Rounding : constant Name_Id := N + 442;
- Name_Unchecked_Access : constant Name_Id := N + 443;
- Name_Unconstrained_Array : constant Name_Id := N + 444;
- Name_Universal_Literal_String : constant Name_Id := N + 445; -- GNAT
- Name_Unrestricted_Access : constant Name_Id := N + 446; -- GNAT
- Name_VADS_Size : constant Name_Id := N + 447; -- GNAT
- Name_Val : constant Name_Id := N + 448;
- Name_Valid : constant Name_Id := N + 449;
- Name_Value_Size : constant Name_Id := N + 450; -- GNAT
- Name_Version : constant Name_Id := N + 451;
- Name_Wchar_T_Size : constant Name_Id := N + 452; -- GNAT
- Name_Wide_Wide_Width : constant Name_Id := N + 453; -- Ada 05
- Name_Wide_Width : constant Name_Id := N + 454;
- Name_Width : constant Name_Id := N + 455;
- Name_Word_Size : constant Name_Id := N + 456; -- GNAT
+ First_Attribute_Name : constant Name_Id := N + 352;
+ Name_Abort_Signal : constant Name_Id := N + 352; -- GNAT
+ Name_Access : constant Name_Id := N + 353;
+ Name_Address : constant Name_Id := N + 354;
+ Name_Address_Size : constant Name_Id := N + 355; -- GNAT
+ Name_Aft : constant Name_Id := N + 356;
+ Name_Alignment : constant Name_Id := N + 357;
+ Name_Asm_Input : constant Name_Id := N + 358; -- GNAT
+ Name_Asm_Output : constant Name_Id := N + 359; -- GNAT
+ Name_AST_Entry : constant Name_Id := N + 360; -- VMS
+ Name_Bit : constant Name_Id := N + 361; -- GNAT
+ Name_Bit_Order : constant Name_Id := N + 362;
+ Name_Bit_Position : constant Name_Id := N + 363; -- GNAT
+ Name_Body_Version : constant Name_Id := N + 364;
+ Name_Callable : constant Name_Id := N + 365;
+ Name_Caller : constant Name_Id := N + 366;
+ Name_Code_Address : constant Name_Id := N + 367; -- GNAT
+ Name_Component_Size : constant Name_Id := N + 368;
+ Name_Compose : constant Name_Id := N + 369;
+ Name_Constrained : constant Name_Id := N + 370;
+ Name_Count : constant Name_Id := N + 371;
+ Name_Default_Bit_Order : constant Name_Id := N + 372; -- GNAT
+ Name_Definite : constant Name_Id := N + 373;
+ Name_Delta : constant Name_Id := N + 374;
+ Name_Denorm : constant Name_Id := N + 375;
+ Name_Digits : constant Name_Id := N + 376;
+ Name_Elaborated : constant Name_Id := N + 377; -- GNAT
+ Name_Emax : constant Name_Id := N + 378; -- Ada 83
+ Name_Enum_Rep : constant Name_Id := N + 379; -- GNAT
+ Name_Epsilon : constant Name_Id := N + 380; -- Ada 83
+ Name_Exponent : constant Name_Id := N + 381;
+ Name_External_Tag : constant Name_Id := N + 382;
+ Name_First : constant Name_Id := N + 383;
+ Name_First_Bit : constant Name_Id := N + 384;
+ Name_Fixed_Value : constant Name_Id := N + 385; -- GNAT
+ Name_Fore : constant Name_Id := N + 386;
+ Name_Has_Access_Values : constant Name_Id := N + 387; -- GNAT
+ Name_Has_Discriminants : constant Name_Id := N + 388; -- GNAT
+ Name_Identity : constant Name_Id := N + 389;
+ Name_Img : constant Name_Id := N + 390; -- GNAT
+ Name_Integer_Value : constant Name_Id := N + 391; -- GNAT
+ Name_Large : constant Name_Id := N + 392; -- Ada 83
+ Name_Last : constant Name_Id := N + 393;
+ Name_Last_Bit : constant Name_Id := N + 394;
+ Name_Leading_Part : constant Name_Id := N + 395;
+ Name_Length : constant Name_Id := N + 396;
+ Name_Machine_Emax : constant Name_Id := N + 397;
+ Name_Machine_Emin : constant Name_Id := N + 398;
+ Name_Machine_Mantissa : constant Name_Id := N + 399;
+ Name_Machine_Overflows : constant Name_Id := N + 400;
+ Name_Machine_Radix : constant Name_Id := N + 401;
+ Name_Machine_Rounding : constant Name_Id := N + 402; -- Ada 05
+ Name_Machine_Rounds : constant Name_Id := N + 403;
+ Name_Machine_Size : constant Name_Id := N + 404; -- GNAT
+ Name_Mantissa : constant Name_Id := N + 405; -- Ada 83
+ Name_Max_Size_In_Storage_Elements : constant Name_Id := N + 406;
+ Name_Maximum_Alignment : constant Name_Id := N + 407; -- GNAT
+ Name_Mechanism_Code : constant Name_Id := N + 408; -- GNAT
+ Name_Mod : constant Name_Id := N + 409;
+ Name_Model_Emin : constant Name_Id := N + 410;
+ Name_Model_Epsilon : constant Name_Id := N + 411;
+ Name_Model_Mantissa : constant Name_Id := N + 412;
+ Name_Model_Small : constant Name_Id := N + 413;
+ Name_Modulus : constant Name_Id := N + 414;
+ Name_Null_Parameter : constant Name_Id := N + 415; -- GNAT
+ Name_Object_Size : constant Name_Id := N + 416; -- GNAT
+ Name_Partition_ID : constant Name_Id := N + 417;
+ Name_Passed_By_Reference : constant Name_Id := N + 418; -- GNAT
+ Name_Pool_Address : constant Name_Id := N + 419;
+ Name_Pos : constant Name_Id := N + 420;
+ Name_Position : constant Name_Id := N + 421;
+ Name_Range : constant Name_Id := N + 422;
+ Name_Range_Length : constant Name_Id := N + 423; -- GNAT
+ Name_Round : constant Name_Id := N + 424;
+ Name_Safe_Emax : constant Name_Id := N + 425; -- Ada 83
+ Name_Safe_First : constant Name_Id := N + 426;
+ Name_Safe_Large : constant Name_Id := N + 427; -- Ada 83
+ Name_Safe_Last : constant Name_Id := N + 428;
+ Name_Safe_Small : constant Name_Id := N + 429; -- Ada 83
+ Name_Scale : constant Name_Id := N + 430;
+ Name_Scaling : constant Name_Id := N + 431;
+ Name_Signed_Zeros : constant Name_Id := N + 432;
+ Name_Size : constant Name_Id := N + 433;
+ Name_Small : constant Name_Id := N + 434;
+ Name_Storage_Size : constant Name_Id := N + 435;
+ Name_Storage_Unit : constant Name_Id := N + 436; -- GNAT
+ Name_Stream_Size : constant Name_Id := N + 437; -- Ada 05
+ Name_Tag : constant Name_Id := N + 438;
+ Name_Target_Name : constant Name_Id := N + 439; -- GNAT
+ Name_Terminated : constant Name_Id := N + 440;
+ Name_To_Address : constant Name_Id := N + 441; -- GNAT
+ Name_Type_Class : constant Name_Id := N + 442; -- GNAT
+ Name_UET_Address : constant Name_Id := N + 443; -- GNAT
+ Name_Unbiased_Rounding : constant Name_Id := N + 444;
+ Name_Unchecked_Access : constant Name_Id := N + 445;
+ Name_Unconstrained_Array : constant Name_Id := N + 446;
+ Name_Universal_Literal_String : constant Name_Id := N + 447; -- GNAT
+ Name_Unrestricted_Access : constant Name_Id := N + 448; -- GNAT
+ Name_VADS_Size : constant Name_Id := N + 449; -- GNAT
+ Name_Val : constant Name_Id := N + 450;
+ Name_Valid : constant Name_Id := N + 451;
+ Name_Value_Size : constant Name_Id := N + 452; -- GNAT
+ Name_Version : constant Name_Id := N + 453;
+ Name_Wchar_T_Size : constant Name_Id := N + 454; -- GNAT
+ Name_Wide_Wide_Width : constant Name_Id := N + 455; -- Ada 05
+ Name_Wide_Width : constant Name_Id := N + 456;
+ Name_Width : constant Name_Id := N + 457;
+ Name_Word_Size : constant Name_Id := N + 458; -- GNAT
-- Attributes that designate attributes returning renamable functions,
-- i.e. functions that return other than a universal value and that
-- have non-universal arguments.
- First_Renamable_Function_Attribute : constant Name_Id := N + 457;
- Name_Adjacent : constant Name_Id := N + 457;
- Name_Ceiling : constant Name_Id := N + 458;
- Name_Copy_Sign : constant Name_Id := N + 459;
- Name_Floor : constant Name_Id := N + 460;
- Name_Fraction : constant Name_Id := N + 461;
- Name_Image : constant Name_Id := N + 462;
- Name_Input : constant Name_Id := N + 463;
- Name_Machine : constant Name_Id := N + 464;
- Name_Max : constant Name_Id := N + 465;
- Name_Min : constant Name_Id := N + 466;
- Name_Model : constant Name_Id := N + 467;
- Name_Pred : constant Name_Id := N + 468;
- Name_Remainder : constant Name_Id := N + 469;
- Name_Rounding : constant Name_Id := N + 470;
- Name_Succ : constant Name_Id := N + 471;
- Name_Truncation : constant Name_Id := N + 472;
- Name_Value : constant Name_Id := N + 473;
- Name_Wide_Image : constant Name_Id := N + 474;
- Name_Wide_Wide_Image : constant Name_Id := N + 475;
- Name_Wide_Value : constant Name_Id := N + 476;
- Name_Wide_Wide_Value : constant Name_Id := N + 477;
- Last_Renamable_Function_Attribute : constant Name_Id := N + 477;
+ First_Renamable_Function_Attribute : constant Name_Id := N + 459;
+ Name_Adjacent : constant Name_Id := N + 459;
+ Name_Ceiling : constant Name_Id := N + 460;
+ Name_Copy_Sign : constant Name_Id := N + 461;
+ Name_Floor : constant Name_Id := N + 462;
+ Name_Fraction : constant Name_Id := N + 463;
+ Name_Image : constant Name_Id := N + 464;
+ Name_Input : constant Name_Id := N + 465;
+ Name_Machine : constant Name_Id := N + 466;
+ Name_Max : constant Name_Id := N + 467;
+ Name_Min : constant Name_Id := N + 468;
+ Name_Model : constant Name_Id := N + 469;
+ Name_Pred : constant Name_Id := N + 470;
+ Name_Remainder : constant Name_Id := N + 471;
+ Name_Rounding : constant Name_Id := N + 472;
+ Name_Succ : constant Name_Id := N + 473;
+ Name_Truncation : constant Name_Id := N + 474;
+ Name_Value : constant Name_Id := N + 475;
+ Name_Wide_Image : constant Name_Id := N + 476;
+ Name_Wide_Wide_Image : constant Name_Id := N + 477;
+ Name_Wide_Value : constant Name_Id := N + 478;
+ Name_Wide_Wide_Value : constant Name_Id := N + 479;
+ Last_Renamable_Function_Attribute : constant Name_Id := N + 479;
-- Attributes that designate procedures
- First_Procedure_Attribute : constant Name_Id := N + 478;
- Name_Output : constant Name_Id := N + 478;
- Name_Read : constant Name_Id := N + 479;
- Name_Write : constant Name_Id := N + 480;
- Last_Procedure_Attribute : constant Name_Id := N + 480;
+ First_Procedure_Attribute : constant Name_Id := N + 480;
+ Name_Output : constant Name_Id := N + 480;
+ Name_Read : constant Name_Id := N + 481;
+ Name_Write : constant Name_Id := N + 482;
+ Last_Procedure_Attribute : constant Name_Id := N + 482;
-- Remaining attributes are ones that return entities
- First_Entity_Attribute_Name : constant Name_Id := N + 481;
- Name_Elab_Body : constant Name_Id := N + 481; -- GNAT
- Name_Elab_Spec : constant Name_Id := N + 482; -- GNAT
- Name_Storage_Pool : constant Name_Id := N + 483;
+ First_Entity_Attribute_Name : constant Name_Id := N + 483;
+ Name_Elab_Body : constant Name_Id := N + 483; -- GNAT
+ Name_Elab_Spec : constant Name_Id := N + 484; -- GNAT
+ Name_Storage_Pool : constant Name_Id := N + 485;
-- These attributes are the ones that return types
- First_Type_Attribute_Name : constant Name_Id := N + 484;
- Name_Base : constant Name_Id := N + 484;
- Name_Class : constant Name_Id := N + 485;
- Last_Type_Attribute_Name : constant Name_Id := N + 485;
- Last_Entity_Attribute_Name : constant Name_Id := N + 485;
- Last_Attribute_Name : constant Name_Id := N + 485;
+ First_Type_Attribute_Name : constant Name_Id := N + 486;
+ Name_Base : constant Name_Id := N + 486;
+ Name_Class : constant Name_Id := N + 487;
+ Last_Type_Attribute_Name : constant Name_Id := N + 487;
+ Last_Entity_Attribute_Name : constant Name_Id := N + 487;
+ Last_Attribute_Name : constant Name_Id := N + 487;
-- Names of recognized locking policy identifiers
@@ -791,10 +797,10 @@ package Snames is
-- name (e.g. C for Ceiling_Locking). If new policy names are added,
-- the first character must be distinct.
- First_Locking_Policy_Name : constant Name_Id := N + 486;
- Name_Ceiling_Locking : constant Name_Id := N + 486;
- Name_Inheritance_Locking : constant Name_Id := N + 487;
- Last_Locking_Policy_Name : constant Name_Id := N + 487;
+ First_Locking_Policy_Name : constant Name_Id := N + 488;
+ Name_Ceiling_Locking : constant Name_Id := N + 488;
+ Name_Inheritance_Locking : constant Name_Id := N + 489;
+ Last_Locking_Policy_Name : constant Name_Id := N + 489;
-- Names of recognized queuing policy identifiers
@@ -802,10 +808,10 @@ package Snames is
-- name (e.g. F for FIFO_Queuing). If new policy names are added,
-- the first character must be distinct.
- First_Queuing_Policy_Name : constant Name_Id := N + 488;
- Name_FIFO_Queuing : constant Name_Id := N + 488;
- Name_Priority_Queuing : constant Name_Id := N + 489;
- Last_Queuing_Policy_Name : constant Name_Id := N + 489;
+ First_Queuing_Policy_Name : constant Name_Id := N + 490;
+ Name_FIFO_Queuing : constant Name_Id := N + 490;
+ Name_Priority_Queuing : constant Name_Id := N + 491;
+ Last_Queuing_Policy_Name : constant Name_Id := N + 491;
-- Names of recognized task dispatching policy identifiers
@@ -813,215 +819,220 @@ package Snames is
-- name (e.g. F for FIFO_WIthinn_Priorities). If new policy names
-- are added, the first character must be distinct.
- First_Task_Dispatching_Policy_Name : constant Name_Id := N + 490;
- Name_FIFO_Within_Priorities : constant Name_Id := N + 490;
- Last_Task_Dispatching_Policy_Name : constant Name_Id := N + 490;
+ First_Task_Dispatching_Policy_Name : constant Name_Id := N + 492;
+ Name_FIFO_Within_Priorities : constant Name_Id := N + 492;
+ Last_Task_Dispatching_Policy_Name : constant Name_Id := N + 492;
-- Names of recognized checks for pragma Suppress
- First_Check_Name : constant Name_Id := N + 491;
- Name_Access_Check : constant Name_Id := N + 491;
- Name_Accessibility_Check : constant Name_Id := N + 492;
- Name_Discriminant_Check : constant Name_Id := N + 493;
- Name_Division_Check : constant Name_Id := N + 494;
- Name_Elaboration_Check : constant Name_Id := N + 495;
- Name_Index_Check : constant Name_Id := N + 496;
- Name_Length_Check : constant Name_Id := N + 497;
- Name_Overflow_Check : constant Name_Id := N + 498;
- Name_Range_Check : constant Name_Id := N + 499;
- Name_Storage_Check : constant Name_Id := N + 500;
- Name_Tag_Check : constant Name_Id := N + 501;
- Name_All_Checks : constant Name_Id := N + 502;
- Last_Check_Name : constant Name_Id := N + 502;
+ First_Check_Name : constant Name_Id := N + 493;
+ Name_Access_Check : constant Name_Id := N + 493;
+ Name_Accessibility_Check : constant Name_Id := N + 494;
+ Name_Discriminant_Check : constant Name_Id := N + 495;
+ Name_Division_Check : constant Name_Id := N + 496;
+ Name_Elaboration_Check : constant Name_Id := N + 497;
+ Name_Index_Check : constant Name_Id := N + 498;
+ Name_Length_Check : constant Name_Id := N + 499;
+ Name_Overflow_Check : constant Name_Id := N + 500;
+ Name_Range_Check : constant Name_Id := N + 501;
+ Name_Storage_Check : constant Name_Id := N + 502;
+ Name_Tag_Check : constant Name_Id := N + 503;
+ Name_All_Checks : constant Name_Id := N + 504;
+ Last_Check_Name : constant Name_Id := N + 504;
-- Names corresponding to reserved keywords, excluding those already
-- declared in the attribute list (Access, Delta, Digits, Mod, Range).
- Name_Abort : constant Name_Id := N + 503;
- Name_Abs : constant Name_Id := N + 504;
- Name_Accept : constant Name_Id := N + 505;
- Name_And : constant Name_Id := N + 506;
- Name_All : constant Name_Id := N + 507;
- Name_Array : constant Name_Id := N + 508;
- Name_At : constant Name_Id := N + 509;
- Name_Begin : constant Name_Id := N + 510;
- Name_Body : constant Name_Id := N + 511;
- Name_Case : constant Name_Id := N + 512;
- Name_Constant : constant Name_Id := N + 513;
- Name_Declare : constant Name_Id := N + 514;
- Name_Delay : constant Name_Id := N + 515;
- Name_Do : constant Name_Id := N + 516;
- Name_Else : constant Name_Id := N + 517;
- Name_Elsif : constant Name_Id := N + 518;
- Name_End : constant Name_Id := N + 519;
- Name_Entry : constant Name_Id := N + 520;
- Name_Exception : constant Name_Id := N + 521;
- Name_Exit : constant Name_Id := N + 522;
- Name_For : constant Name_Id := N + 523;
- Name_Function : constant Name_Id := N + 524;
- Name_Generic : constant Name_Id := N + 525;
- Name_Goto : constant Name_Id := N + 526;
- Name_If : constant Name_Id := N + 527;
- Name_In : constant Name_Id := N + 528;
- Name_Is : constant Name_Id := N + 529;
- Name_Limited : constant Name_Id := N + 530;
- Name_Loop : constant Name_Id := N + 531;
- Name_New : constant Name_Id := N + 532;
- Name_Not : constant Name_Id := N + 533;
- Name_Null : constant Name_Id := N + 534;
- Name_Of : constant Name_Id := N + 535;
- Name_Or : constant Name_Id := N + 536;
- Name_Others : constant Name_Id := N + 537;
- Name_Out : constant Name_Id := N + 538;
- Name_Package : constant Name_Id := N + 539;
- Name_Pragma : constant Name_Id := N + 540;
- Name_Private : constant Name_Id := N + 541;
- Name_Procedure : constant Name_Id := N + 542;
- Name_Raise : constant Name_Id := N + 543;
- Name_Record : constant Name_Id := N + 544;
- Name_Rem : constant Name_Id := N + 545;
- Name_Renames : constant Name_Id := N + 546;
- Name_Return : constant Name_Id := N + 547;
- Name_Reverse : constant Name_Id := N + 548;
- Name_Select : constant Name_Id := N + 549;
- Name_Separate : constant Name_Id := N + 550;
- Name_Subtype : constant Name_Id := N + 551;
- Name_Task : constant Name_Id := N + 552;
- Name_Terminate : constant Name_Id := N + 553;
- Name_Then : constant Name_Id := N + 554;
- Name_Type : constant Name_Id := N + 555;
- Name_Use : constant Name_Id := N + 556;
- Name_When : constant Name_Id := N + 557;
- Name_While : constant Name_Id := N + 558;
- Name_With : constant Name_Id := N + 559;
- Name_Xor : constant Name_Id := N + 560;
+ Name_Abort : constant Name_Id := N + 505;
+ Name_Abs : constant Name_Id := N + 506;
+ Name_Accept : constant Name_Id := N + 507;
+ Name_And : constant Name_Id := N + 508;
+ Name_All : constant Name_Id := N + 509;
+ Name_Array : constant Name_Id := N + 510;
+ Name_At : constant Name_Id := N + 511;
+ Name_Begin : constant Name_Id := N + 512;
+ Name_Body : constant Name_Id := N + 513;
+ Name_Case : constant Name_Id := N + 514;
+ Name_Constant : constant Name_Id := N + 515;
+ Name_Declare : constant Name_Id := N + 516;
+ Name_Delay : constant Name_Id := N + 517;
+ Name_Do : constant Name_Id := N + 518;
+ Name_Else : constant Name_Id := N + 519;
+ Name_Elsif : constant Name_Id := N + 520;
+ Name_End : constant Name_Id := N + 521;
+ Name_Entry : constant Name_Id := N + 522;
+ Name_Exception : constant Name_Id := N + 523;
+ Name_Exit : constant Name_Id := N + 524;
+ Name_For : constant Name_Id := N + 525;
+ Name_Function : constant Name_Id := N + 526;
+ Name_Generic : constant Name_Id := N + 527;
+ Name_Goto : constant Name_Id := N + 528;
+ Name_If : constant Name_Id := N + 529;
+ Name_In : constant Name_Id := N + 530;
+ Name_Is : constant Name_Id := N + 531;
+ Name_Limited : constant Name_Id := N + 532;
+ Name_Loop : constant Name_Id := N + 533;
+ Name_New : constant Name_Id := N + 534;
+ Name_Not : constant Name_Id := N + 535;
+ Name_Null : constant Name_Id := N + 536;
+ Name_Of : constant Name_Id := N + 537;
+ Name_Or : constant Name_Id := N + 538;
+ Name_Others : constant Name_Id := N + 539;
+ Name_Out : constant Name_Id := N + 540;
+ Name_Package : constant Name_Id := N + 541;
+ Name_Pragma : constant Name_Id := N + 542;
+ Name_Private : constant Name_Id := N + 543;
+ Name_Procedure : constant Name_Id := N + 544;
+ Name_Raise : constant Name_Id := N + 545;
+ Name_Record : constant Name_Id := N + 546;
+ Name_Rem : constant Name_Id := N + 547;
+ Name_Renames : constant Name_Id := N + 548;
+ Name_Return : constant Name_Id := N + 549;
+ Name_Reverse : constant Name_Id := N + 550;
+ Name_Select : constant Name_Id := N + 551;
+ Name_Separate : constant Name_Id := N + 552;
+ Name_Subtype : constant Name_Id := N + 553;
+ Name_Task : constant Name_Id := N + 554;
+ Name_Terminate : constant Name_Id := N + 555;
+ Name_Then : constant Name_Id := N + 556;
+ Name_Type : constant Name_Id := N + 557;
+ Name_Use : constant Name_Id := N + 558;
+ Name_When : constant Name_Id := N + 559;
+ Name_While : constant Name_Id := N + 560;
+ Name_With : constant Name_Id := N + 561;
+ Name_Xor : constant Name_Id := N + 562;
-- Names of intrinsic subprograms
-- Note: Asm is missing from this list, since Asm is a legitimate
-- convention name. So is To_Adress, which is a GNAT attribute.
- First_Intrinsic_Name : constant Name_Id := N + 561;
- Name_Divide : constant Name_Id := N + 561;
- Name_Enclosing_Entity : constant Name_Id := N + 562;
- Name_Exception_Information : constant Name_Id := N + 563;
- Name_Exception_Message : constant Name_Id := N + 564;
- Name_Exception_Name : constant Name_Id := N + 565;
- Name_File : constant Name_Id := N + 566;
- Name_Generic_Dispatching_Constructor : constant Name_Id := N + 567;
- Name_Import_Address : constant Name_Id := N + 568;
- Name_Import_Largest_Value : constant Name_Id := N + 569;
- Name_Import_Value : constant Name_Id := N + 570;
- Name_Is_Negative : constant Name_Id := N + 571;
- Name_Line : constant Name_Id := N + 572;
- Name_Rotate_Left : constant Name_Id := N + 573;
- Name_Rotate_Right : constant Name_Id := N + 574;
- Name_Shift_Left : constant Name_Id := N + 575;
- Name_Shift_Right : constant Name_Id := N + 576;
- Name_Shift_Right_Arithmetic : constant Name_Id := N + 577;
- Name_Source_Location : constant Name_Id := N + 578;
- Name_Unchecked_Conversion : constant Name_Id := N + 579;
- Name_Unchecked_Deallocation : constant Name_Id := N + 580;
- Name_To_Pointer : constant Name_Id := N + 581;
- Last_Intrinsic_Name : constant Name_Id := N + 581;
+ First_Intrinsic_Name : constant Name_Id := N + 563;
+ Name_Divide : constant Name_Id := N + 563;
+ Name_Enclosing_Entity : constant Name_Id := N + 564;
+ Name_Exception_Information : constant Name_Id := N + 565;
+ Name_Exception_Message : constant Name_Id := N + 566;
+ Name_Exception_Name : constant Name_Id := N + 567;
+ Name_File : constant Name_Id := N + 568;
+ Name_Generic_Dispatching_Constructor : constant Name_Id := N + 569;
+ Name_Import_Address : constant Name_Id := N + 570;
+ Name_Import_Largest_Value : constant Name_Id := N + 571;
+ Name_Import_Value : constant Name_Id := N + 572;
+ Name_Is_Negative : constant Name_Id := N + 573;
+ Name_Line : constant Name_Id := N + 574;
+ Name_Rotate_Left : constant Name_Id := N + 575;
+ Name_Rotate_Right : constant Name_Id := N + 576;
+ Name_Shift_Left : constant Name_Id := N + 577;
+ Name_Shift_Right : constant Name_Id := N + 578;
+ Name_Shift_Right_Arithmetic : constant Name_Id := N + 579;
+ Name_Source_Location : constant Name_Id := N + 580;
+ Name_Unchecked_Conversion : constant Name_Id := N + 581;
+ Name_Unchecked_Deallocation : constant Name_Id := N + 582;
+ Name_To_Pointer : constant Name_Id := N + 583;
+ Last_Intrinsic_Name : constant Name_Id := N + 583;
+
+ -- Names used in processing intrinsic calls
+
+ Name_Free : constant Name_Id := N + 584;
-- Reserved words used only in Ada 95
- First_95_Reserved_Word : constant Name_Id := N + 582;
- Name_Abstract : constant Name_Id := N + 582;
- Name_Aliased : constant Name_Id := N + 583;
- Name_Protected : constant Name_Id := N + 584;
- Name_Until : constant Name_Id := N + 585;
- Name_Requeue : constant Name_Id := N + 586;
- Name_Tagged : constant Name_Id := N + 587;
- Last_95_Reserved_Word : constant Name_Id := N + 587;
+ First_95_Reserved_Word : constant Name_Id := N + 585;
+ Name_Abstract : constant Name_Id := N + 585;
+ Name_Aliased : constant Name_Id := N + 586;
+ Name_Protected : constant Name_Id := N + 587;
+ Name_Until : constant Name_Id := N + 588;
+ Name_Requeue : constant Name_Id := N + 589;
+ Name_Tagged : constant Name_Id := N + 590;
+ Last_95_Reserved_Word : constant Name_Id := N + 590;
subtype Ada_95_Reserved_Words is
Name_Id range First_95_Reserved_Word .. Last_95_Reserved_Word;
-- Miscellaneous names used in semantic checking
- Name_Raise_Exception : constant Name_Id := N + 588;
+ Name_Raise_Exception : constant Name_Id := N + 591;
-- Additional reserved words and identifiers used in GNAT Project Files
-- Note that Name_External is already previously declared
- Name_Ada_Roots : constant Name_Id := N + 589;
- Name_Binder : constant Name_Id := N + 590;
- Name_Binder_Driver : constant Name_Id := N + 591;
- Name_Body_Suffix : constant Name_Id := N + 592;
- Name_Builder : constant Name_Id := N + 593;
- Name_Compiler : constant Name_Id := N + 594;
- Name_Compiler_Driver : constant Name_Id := N + 595;
- Name_Compiler_Kind : constant Name_Id := N + 596;
- Name_Compute_Dependency : constant Name_Id := N + 597;
- Name_Cross_Reference : constant Name_Id := N + 598;
- Name_Default_Linker : constant Name_Id := N + 599;
- Name_Default_Switches : constant Name_Id := N + 600;
- Name_Dependency_Option : constant Name_Id := N + 601;
- Name_Exec_Dir : constant Name_Id := N + 602;
- Name_Executable : constant Name_Id := N + 603;
- Name_Executable_Suffix : constant Name_Id := N + 604;
- Name_Extends : constant Name_Id := N + 605;
- Name_Externally_Built : constant Name_Id := N + 606;
- Name_Finder : constant Name_Id := N + 607;
- Name_Global_Configuration_Pragmas : constant Name_Id := N + 608;
- Name_Gnatls : constant Name_Id := N + 609;
- Name_Gnatstub : constant Name_Id := N + 610;
- Name_Implementation : constant Name_Id := N + 611;
- Name_Implementation_Exceptions : constant Name_Id := N + 612;
- Name_Implementation_Suffix : constant Name_Id := N + 613;
- Name_Include_Option : constant Name_Id := N + 614;
- Name_Language_Processing : constant Name_Id := N + 615;
- Name_Languages : constant Name_Id := N + 616;
- Name_Library_Dir : constant Name_Id := N + 617;
- Name_Library_Auto_Init : constant Name_Id := N + 618;
- Name_Library_GCC : constant Name_Id := N + 619;
- Name_Library_Interface : constant Name_Id := N + 620;
- Name_Library_Kind : constant Name_Id := N + 621;
- Name_Library_Name : constant Name_Id := N + 622;
- Name_Library_Options : constant Name_Id := N + 623;
- Name_Library_Reference_Symbol_File : constant Name_Id := N + 624;
- Name_Library_Src_Dir : constant Name_Id := N + 625;
- Name_Library_Symbol_File : constant Name_Id := N + 626;
- Name_Library_Symbol_Policy : constant Name_Id := N + 627;
- Name_Library_Version : constant Name_Id := N + 628;
- Name_Linker : constant Name_Id := N + 629;
- Name_Local_Configuration_Pragmas : constant Name_Id := N + 630;
- Name_Locally_Removed_Files : constant Name_Id := N + 631;
- Name_Metrics : constant Name_Id := N + 632;
- Name_Naming : constant Name_Id := N + 633;
- Name_Object_Dir : constant Name_Id := N + 634;
- Name_Pretty_Printer : constant Name_Id := N + 635;
- Name_Project : constant Name_Id := N + 636;
- Name_Separate_Suffix : constant Name_Id := N + 637;
- Name_Source_Dirs : constant Name_Id := N + 638;
- Name_Source_Files : constant Name_Id := N + 639;
- Name_Source_List_File : constant Name_Id := N + 640;
- Name_Spec : constant Name_Id := N + 641;
- Name_Spec_Suffix : constant Name_Id := N + 642;
- Name_Specification : constant Name_Id := N + 643;
- Name_Specification_Exceptions : constant Name_Id := N + 644;
- Name_Specification_Suffix : constant Name_Id := N + 645;
- Name_Switches : constant Name_Id := N + 646;
+ Name_Ada_Roots : constant Name_Id := N + 592;
+ Name_Binder : constant Name_Id := N + 593;
+ Name_Binder_Driver : constant Name_Id := N + 594;
+ Name_Body_Suffix : constant Name_Id := N + 595;
+ Name_Builder : constant Name_Id := N + 596;
+ Name_Compiler : constant Name_Id := N + 597;
+ Name_Compiler_Driver : constant Name_Id := N + 598;
+ Name_Compiler_Kind : constant Name_Id := N + 599;
+ Name_Compute_Dependency : constant Name_Id := N + 600;
+ Name_Cross_Reference : constant Name_Id := N + 601;
+ Name_Default_Linker : constant Name_Id := N + 602;
+ Name_Default_Switches : constant Name_Id := N + 603;
+ Name_Dependency_Option : constant Name_Id := N + 604;
+ Name_Exec_Dir : constant Name_Id := N + 605;
+ Name_Executable : constant Name_Id := N + 606;
+ Name_Executable_Suffix : constant Name_Id := N + 607;
+ Name_Extends : constant Name_Id := N + 608;
+ Name_Externally_Built : constant Name_Id := N + 609;
+ Name_Finder : constant Name_Id := N + 610;
+ Name_Global_Configuration_Pragmas : constant Name_Id := N + 611;
+ Name_Gnatls : constant Name_Id := N + 612;
+ Name_Gnatstub : constant Name_Id := N + 613;
+ Name_Implementation : constant Name_Id := N + 614;
+ Name_Implementation_Exceptions : constant Name_Id := N + 615;
+ Name_Implementation_Suffix : constant Name_Id := N + 616;
+ Name_Include_Option : constant Name_Id := N + 617;
+ Name_Language_Processing : constant Name_Id := N + 618;
+ Name_Languages : constant Name_Id := N + 619;
+ Name_Library_Ali_Dir : constant Name_Id := N + 620;
+ Name_Library_Dir : constant Name_Id := N + 621;
+ Name_Library_Auto_Init : constant Name_Id := N + 622;
+ Name_Library_GCC : constant Name_Id := N + 623;
+ Name_Library_Interface : constant Name_Id := N + 624;
+ Name_Library_Kind : constant Name_Id := N + 625;
+ Name_Library_Name : constant Name_Id := N + 626;
+ Name_Library_Options : constant Name_Id := N + 627;
+ Name_Library_Reference_Symbol_File : constant Name_Id := N + 628;
+ Name_Library_Src_Dir : constant Name_Id := N + 629;
+ Name_Library_Symbol_File : constant Name_Id := N + 630;
+ Name_Library_Symbol_Policy : constant Name_Id := N + 631;
+ Name_Library_Version : constant Name_Id := N + 632;
+ Name_Linker : constant Name_Id := N + 633;
+ Name_Local_Configuration_Pragmas : constant Name_Id := N + 634;
+ Name_Locally_Removed_Files : constant Name_Id := N + 635;
+ Name_Metrics : constant Name_Id := N + 636;
+ Name_Naming : constant Name_Id := N + 637;
+ Name_Object_Dir : constant Name_Id := N + 638;
+ Name_Pretty_Printer : constant Name_Id := N + 639;
+ Name_Project : constant Name_Id := N + 640;
+ Name_Separate_Suffix : constant Name_Id := N + 641;
+ Name_Source_Dirs : constant Name_Id := N + 642;
+ Name_Source_Files : constant Name_Id := N + 643;
+ Name_Source_List_File : constant Name_Id := N + 644;
+ Name_Spec : constant Name_Id := N + 645;
+ Name_Spec_Suffix : constant Name_Id := N + 646;
+ Name_Specification : constant Name_Id := N + 647;
+ Name_Specification_Exceptions : constant Name_Id := N + 648;
+ Name_Specification_Suffix : constant Name_Id := N + 649;
+ Name_Switches : constant Name_Id := N + 650;
-- Other miscellaneous names used in front end
- Name_Unaligned_Valid : constant Name_Id := N + 647;
+ Name_Unaligned_Valid : constant Name_Id := N + 651;
-- ----------------------------------------------------------------
- First_2005_Reserved_Word : constant Name_Id := N + 648;
- Name_Interface : constant Name_Id := N + 648;
- Name_Overriding : constant Name_Id := N + 649;
- Name_Synchronized : constant Name_Id := N + 650;
- Last_2005_Reserved_Word : constant Name_Id := N + 650;
+ First_2005_Reserved_Word : constant Name_Id := N + 652;
+ Name_Interface : constant Name_Id := N + 652;
+ Name_Overriding : constant Name_Id := N + 653;
+ Name_Synchronized : constant Name_Id := N + 654;
+ Last_2005_Reserved_Word : constant Name_Id := N + 654;
subtype Ada_2005_Reserved_Words is
Name_Id range First_2005_Reserved_Word .. Last_2005_Reserved_Word;
-- Mark last defined name for consistency check in Snames body
- Last_Predefined_Name : constant Name_Id := N + 650;
+ Last_Predefined_Name : constant Name_Id := N + 654;
subtype Any_Operator_Name is Name_Id range
First_Operator_Name .. Last_Operator_Name;
@@ -1081,6 +1092,7 @@ package Snames is
Attribute_Machine_Mantissa,
Attribute_Machine_Overflows,
Attribute_Machine_Radix,
+ Attribute_Machine_Rounding,
Attribute_Machine_Rounds,
Attribute_Machine_Size,
Attribute_Mantissa,
diff --git a/gcc/ada/snames.h b/gcc/ada/snames.h
index 0ff742e816d..7b0c2ee5d0a 100644
--- a/gcc/ada/snames.h
+++ b/gcc/ada/snames.h
@@ -95,91 +95,92 @@ extern unsigned char Get_Attribute_Id (int);
#define Attr_Machine_Mantissa 47
#define Attr_Machine_Overflows 48
#define Attr_Machine_Radix 49
-#define Attr_Machine_Rounds 50
-#define Attr_Machine_Size 51
-#define Attr_Mantissa 52
-#define Attr_Max_Size_In_Storage_Elements 53
-#define Attr_Maximum_Alignment 54
-#define Attr_Mechanism_Code 55
-#define Attr_Mod 56
-#define Attr_Model_Emin 57
-#define Attr_Model_Epsilon 58
-#define Attr_Model_Mantissa 59
-#define Attr_Model_Small 60
-#define Attr_Modulus 61
-#define Attr_Null_Parameter 62
-#define Attr_Object_Size 63
-#define Attr_Partition_ID 64
-#define Attr_Passed_By_Reference 65
-#define Attr_Pool_Address 66
-#define Attr_Pos 67
-#define Attr_Position 68
-#define Attr_Range 69
-#define Attr_Range_Length 70
-#define Attr_Round 71
-#define Attr_Safe_Emax 72
-#define Attr_Safe_First 73
-#define Attr_Safe_Large 74
-#define Attr_Safe_Last 75
-#define Attr_Safe_Small 76
-#define Attr_Scale 77
-#define Attr_Scaling 78
-#define Attr_Signed_Zeros 79
-#define Attr_Size 80
-#define Attr_Small 81
-#define Attr_Storage_Size 82
-#define Attr_Storage_Unit 83
-#define Attr_Stream_Size 84
-#define Attr_Tag 85
-#define Attr_Target_Name 86
-#define Attr_Terminated 87
-#define Attr_To_Address 88
-#define Attr_Type_Class 89
-#define Attr_UET_Address 90
-#define Attr_Unbiased_Rounding 91
-#define Attr_Unchecked_Access 92
-#define Attr_Unconstrained_Array 93
-#define Attr_Universal_Literal_String 94
-#define Attr_Unrestricted_Access 95
-#define Attr_VADS_Size 96
-#define Attr_Val 97
-#define Attr_Valid 98
-#define Attr_Value_Size 99
-#define Attr_Version 100
-#define Attr_Wchar_T_Size 101
-#define Attr_Wide_Wide_Width 102
-#define Attr_Wide_Width 103
-#define Attr_Width 104
-#define Attr_Word_Size 105
-#define Attr_Adjacent 106
-#define Attr_Ceiling 107
-#define Attr_Copy_Sign 108
-#define Attr_Floor 109
-#define Attr_Fraction 110
-#define Attr_Image 111
-#define Attr_Input 112
-#define Attr_Machine 113
-#define Attr_Max 114
-#define Attr_Min 115
-#define Attr_Model 116
-#define Attr_Pred 117
-#define Attr_Remainder 118
-#define Attr_Rounding 119
-#define Attr_Succ 120
-#define Attr_Truncation 121
-#define Attr_Value 122
-#define Attr_Wide_Image 123
-#define Attr_Wide_Wide_Image 124
-#define Attr_Wide_Value 125
-#define Attr_Wide_Wide_Value 126
-#define Attr_Output 127
-#define Attr_Read 128
-#define Attr_Write 129
-#define Attr_Elab_Body 130
-#define Attr_Elab_Spec 131
-#define Attr_Storage_Pool 132
-#define Attr_Base 133
-#define Attr_Class 134
+#define Attr_Machine_Rounding 50
+#define Attr_Machine_Rounds 51
+#define Attr_Machine_Size 52
+#define Attr_Mantissa 53
+#define Attr_Max_Size_In_Storage_Elements 54
+#define Attr_Maximum_Alignment 55
+#define Attr_Mechanism_Code 56
+#define Attr_Mod 57
+#define Attr_Model_Emin 58
+#define Attr_Model_Epsilon 59
+#define Attr_Model_Mantissa 60
+#define Attr_Model_Small 61
+#define Attr_Modulus 62
+#define Attr_Null_Parameter 63
+#define Attr_Object_Size 64
+#define Attr_Partition_ID 65
+#define Attr_Passed_By_Reference 66
+#define Attr_Pool_Address 67
+#define Attr_Pos 68
+#define Attr_Position 69
+#define Attr_Range 70
+#define Attr_Range_Length 71
+#define Attr_Round 72
+#define Attr_Safe_Emax 73
+#define Attr_Safe_First 74
+#define Attr_Safe_Large 75
+#define Attr_Safe_Last 76
+#define Attr_Safe_Small 77
+#define Attr_Scale 78
+#define Attr_Scaling 79
+#define Attr_Signed_Zeros 80
+#define Attr_Size 81
+#define Attr_Small 82
+#define Attr_Storage_Size 83
+#define Attr_Storage_Unit 84
+#define Attr_Stream_Size 85
+#define Attr_Tag 86
+#define Attr_Target_Name 87
+#define Attr_Terminated 88
+#define Attr_To_Address 89
+#define Attr_Type_Class 90
+#define Attr_UET_Address 91
+#define Attr_Unbiased_Rounding 92
+#define Attr_Unchecked_Access 93
+#define Attr_Unconstrained_Array 94
+#define Attr_Universal_Literal_String 95
+#define Attr_Unrestricted_Access 96
+#define Attr_VADS_Size 97
+#define Attr_Val 98
+#define Attr_Valid 99
+#define Attr_Value_Size 100
+#define Attr_Version 101
+#define Attr_Wchar_T_Size 102
+#define Attr_Wide_Wide_Width 103
+#define Attr_Wide_Width 104
+#define Attr_Width 105
+#define Attr_Word_Size 106
+#define Attr_Adjacent 107
+#define Attr_Ceiling 108
+#define Attr_Copy_Sign 109
+#define Attr_Floor 110
+#define Attr_Fraction 111
+#define Attr_Image 112
+#define Attr_Input 113
+#define Attr_Machine 114
+#define Attr_Max 115
+#define Attr_Min 116
+#define Attr_Model 117
+#define Attr_Pred 118
+#define Attr_Remainder 119
+#define Attr_Rounding 120
+#define Attr_Succ 121
+#define Attr_Truncation 122
+#define Attr_Value 123
+#define Attr_Wide_Image 124
+#define Attr_Wide_Wide_Image 125
+#define Attr_Wide_Value 126
+#define Attr_Wide_Wide_Value 127
+#define Attr_Output 128
+#define Attr_Read 129
+#define Attr_Write 130
+#define Attr_Elab_Body 131
+#define Attr_Elab_Spec 132
+#define Attr_Storage_Pool 133
+#define Attr_Base 134
+#define Attr_Class 135
/* Define the numeric values for the conventions. */
diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c
index 32135237b5a..d02763a9548 100644
--- a/gcc/ada/socket.c
+++ b/gcc/ada/socket.c
@@ -40,6 +40,7 @@
/* Required for __gnat_malloc() */
#include <string.h>
+/* Required for memcpy() */
extern void __gnat_disable_sigpipe (int fd);
extern void __gnat_free_socket_set (fd_set *);
@@ -49,8 +50,10 @@ extern void __gnat_insert_socket_in_set (fd_set *, int);
extern int __gnat_is_socket_in_set (fd_set *, int);
extern fd_set *__gnat_new_socket_set (fd_set *);
extern void __gnat_remove_socket_from_set (fd_set *, int);
+extern int __gnat_get_h_errno (void);
/* Disable the sending of SIGPIPE for writes on a broken stream */
+
void
__gnat_disable_sigpipe (int fd)
{
@@ -152,3 +155,41 @@ __gnat_remove_socket_from_set (fd_set *set, int socket)
{
FD_CLR (socket, set);
}
+
+/* Get the value of the last host error */
+
+int
+__gnat_get_h_errno (void) {
+#ifdef __vxworks
+ int vxw_errno = errno;
+
+ switch (vxw_errno) {
+ case 0:
+ return 0;
+
+ case S_resolvLib_HOST_NOT_FOUND:
+ case S_hostLib_UNKNOWN_HOST:
+ return HOST_NOT_FOUND;
+
+ case S_resolvLib_TRY_AGAIN:
+ return TRY_AGAIN;
+
+ case S_resolvLib_NO_RECOVERY:
+ case S_resolvLib_BUFFER_2_SMALL:
+ case S_resolvLib_INVALID_PARAMETER:
+ case S_resolvLib_INVALID_ADDRESS:
+ case S_hostLib_INVALID_PARAMETER:
+ return NO_RECOVERY;
+
+ case S_resolvLib_NO_DATA:
+ return NO_DATA;
+
+ default:
+ return -1;
+ }
+#elif defined(VMS)
+ return errno;
+#else
+ return h_errno;
+#endif
+}
diff --git a/gcc/ada/sprint.ads b/gcc/ada/sprint.ads
index a51a52a74a1..d10a009ea47 100644
--- a/gcc/ada/sprint.ads
+++ b/gcc/ada/sprint.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2002, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -115,7 +115,7 @@ package Sprint is
-- does not generate any New_Line calls.
procedure Sprint_Opt_Node_List (List : List_Id);
- -- Like Sprint_Node_List, but prints nothing if List = No_List.
+ -- Like Sprint_Node_List, but prints nothing if List = No_List
procedure Sprint_Indented_List (List : List_Id);
-- Like Sprint_Line_List, except that the indentation level is
diff --git a/gcc/ada/stand.ads b/gcc/ada/stand.ads
index a9a1df2ae25..8e3b7ecee2b 100644
--- a/gcc/ada/stand.ads
+++ b/gcc/ada/stand.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -335,7 +335,7 @@ package Stand is
-- This is a type used to represent the return type of procedures
Standard_Exception_Type : Entity_Id;
- -- This is a type used to represent the Etype of exceptions.
+ -- This is a type used to represent the Etype of exceptions
Standard_A_String : Entity_Id;
-- An access to String type used for building elements of tables
@@ -362,13 +362,13 @@ package Stand is
-- is propagated to avoid cascaded errors from a single type error.
Any_Access : Entity_Id;
- -- Used to resolve the overloaded literal NULL.
+ -- Used to resolve the overloaded literal NULL
Any_Array : Entity_Id;
-- Used to represent some unknown array type
Any_Boolean : Entity_Id;
- -- The context type of conditions in IF and WHILE statements.
+ -- The context type of conditions in IF and WHILE statements
Any_Character : Entity_Id;
-- Any_Character is used to label character literals, which in general
@@ -386,7 +386,7 @@ package Stand is
-- Used to represent some unknown fixed-point type
Any_Integer : Entity_Id;
- -- Used to represent some unknown integer type.
+ -- Used to represent some unknown integer type
Any_Modular : Entity_Id;
-- Used to represent the result type of a boolean operation on an
@@ -394,10 +394,10 @@ package Stand is
-- only legal in a modular context.
Any_Numeric : Entity_Id;
- -- Used to represent some unknown numeric type.
+ -- Used to represent some unknown numeric type
Any_Real : Entity_Id;
- -- Used to represent some unknown real type.
+ -- Used to represent some unknown real type
Any_Scalar : Entity_Id;
-- Used to represent some unknown scalar type
@@ -416,7 +416,9 @@ package Stand is
Universal_Real : Entity_Id;
-- Entity for universal real type. The bounds of this type correspond to
-- to the largest supported real type (i.e. Long_Long_Real). It is the
- -- type used for runtime calculations in type universal real.
+ -- type used for runtime calculations in type universal real. Note that
+ -- this type is always IEEE format, even if Long_Long_Real is Vax_Float
+ -- (and in that case the bounds don't correspond exactly).
Universal_Fixed : Entity_Id;
-- Entity for universal fixed type. This is a type with arbitrary
diff --git a/gcc/ada/stringt.adb b/gcc/ada/stringt.adb
index 2865305dbe7..0a5fbb2f012 100644
--- a/gcc/ada/stringt.adb
+++ b/gcc/ada/stringt.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/stringt.ads b/gcc/ada/stringt.ads
index a1919694652..fb974e4e9d2 100644
--- a/gcc/ada/stringt.ads
+++ b/gcc/ada/stringt.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/styleg.ads b/gcc/ada/styleg.ads
index 0a1441b33c5..58c834ae1be 100644
--- a/gcc/ada/styleg.ads
+++ b/gcc/ada/styleg.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -105,7 +105,7 @@ package Styleg is
-- Token_Ptr is the first token on the line.
procedure Check_Left_Paren;
- -- Called after scanning out a left parenthesis to check spacing.
+ -- Called after scanning out a left parenthesis to check spacing
procedure Check_Line_Max_Length (Len : Int);
-- Called with Scan_Ptr pointing to the first line terminator character
@@ -122,7 +122,7 @@ package Styleg is
-- properly (i.e. with an appropriate casing convention).
procedure Check_Right_Paren;
- -- Called after scanning out a right parenthesis to check spacing.
+ -- Called after scanning out a right parenthesis to check spacing
procedure Check_Semicolon;
-- Called after scanning out a semicolon to check spacing
diff --git a/gcc/ada/switch-b.adb b/gcc/ada/switch-b.adb
index de69081a104..f5beb05c470 100644
--- a/gcc/ada/switch-b.adb
+++ b/gcc/ada/switch-b.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -45,7 +45,7 @@ package body Switch.B is
-- Skip past the initial character (must be the switch character)
if Ptr = Max then
- raise Bad_Switch;
+ Bad_Switch (C);
else
Ptr := Ptr + 1;
end if;
@@ -122,7 +122,7 @@ package body Switch.B is
then
Set_Debug_Flag (C);
else
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
end loop;
@@ -132,7 +132,8 @@ package body Switch.B is
when 'D' =>
Ptr := Ptr + 1;
- Scan_Pos (Switch_Chars, Max, Ptr, Default_Sec_Stack_Size);
+ Scan_Pos
+ (Switch_Chars, Max, Ptr, Default_Sec_Stack_Size, C);
-- Processing for e switch
@@ -181,7 +182,7 @@ package body Switch.B is
when 'i' =>
if Ptr = Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Ptr := Ptr + 1;
@@ -197,7 +198,7 @@ package body Switch.B is
Identifier_Character_Set := C;
Ptr := Ptr + 1;
else
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
-- Processing for K switch
@@ -216,7 +217,7 @@ package body Switch.B is
when 'm' =>
Ptr := Ptr + 1;
- Scan_Pos (Switch_Chars, Max, Ptr, Maximum_Errors);
+ Scan_Pos (Switch_Chars, Max, Ptr, Maximum_Errors, C);
-- Processing for n switch
@@ -234,7 +235,7 @@ package body Switch.B is
Ptr := Ptr + 1;
if Output_File_Name_Present then
- raise Too_Many_Output_Files;
+ Osint.Fail ("duplicate -o switch");
else
Output_File_Name_Present := True;
@@ -282,7 +283,7 @@ package body Switch.B is
when 'T' =>
Ptr := Ptr + 1;
Time_Slice_Set := True;
- Scan_Nat (Switch_Chars, Max, Ptr, Time_Slice_Value);
+ Scan_Nat (Switch_Chars, Max, Ptr, Time_Slice_Value, C);
Time_Slice_Value := Time_Slice_Value * 1_000;
-- Processing for v switch
@@ -308,7 +309,7 @@ package body Switch.B is
Warning_Mode := Suppress;
when others =>
- raise Bad_Switch;
+ Bad_Switch (C);
end case;
Ptr := Ptr + 1;
@@ -324,7 +325,7 @@ package body Switch.B is
exit;
elsif J = WC_Encoding_Method'Last then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
end loop;
@@ -345,7 +346,7 @@ package body Switch.B is
when 'X' =>
Ptr := Ptr + 1;
- Scan_Pos (Switch_Chars, Max, Ptr, Default_Exit_Status);
+ Scan_Pos (Switch_Chars, Max, Ptr, Default_Exit_Status, C);
-- Processing for z switch
@@ -402,7 +403,7 @@ package body Switch.B is
RTS_Src_Path_Name := Src_Path_Name;
RTS_Lib_Path_Name := Lib_Path_Name;
- -- We can exit as there can not be another switch
+ -- We can exit as there cannot be another switch
-- after --RTS
exit;
@@ -429,22 +430,9 @@ package body Switch.B is
-- Anything else is an error (illegal switch character)
when others =>
- raise Bad_Switch;
+ Bad_Switch (C);
end case;
end loop;
-
- exception
- when Bad_Switch =>
- Osint.Fail ("invalid switch: ", (1 => C));
-
- when Bad_Switch_Value =>
- Osint.Fail ("numeric value out of range for switch: ", (1 => C));
-
- when Missing_Switch_Value =>
- Osint.Fail ("missing numeric value for switch: ", (1 => C));
-
- when Too_Many_Output_Files =>
- Osint.Fail ("duplicate -o switch");
end Scan_Binder_Switches;
end Switch.B;
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index c89eb1bc0fb..fe7545edadf 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,6 +32,7 @@ with Osint; use Osint;
with Opt; use Opt;
with Prepcomp; use Prepcomp;
with Validsw; use Validsw;
+with Sem_Warn; use Sem_Warn;
with Stylesw; use Stylesw;
with System.WCh_Con; use System.WCh_Con;
@@ -67,7 +68,7 @@ package body Switch.C is
-- Skip past the initial character (must be the switch character)
if Ptr = Max then
- raise Bad_Switch;
+ Bad_Switch (C);
else
Ptr := Ptr + 1;
end if;
@@ -104,7 +105,7 @@ package body Switch.C is
Ptr := Ptr + 1;
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
-- Find out whether this is a -I- or regular -Ixxx switch
@@ -179,7 +180,7 @@ package body Switch.C is
end if;
end if;
else
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
when True =>
@@ -261,7 +262,7 @@ package body Switch.C is
Dot := True;
else
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
end loop;
@@ -289,7 +290,7 @@ package body Switch.C is
-- so we must always have a character after the e.
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
case Switch_Chars (Ptr) is
@@ -308,7 +309,7 @@ package body Switch.C is
end if;
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
declare
@@ -351,7 +352,7 @@ package body Switch.C is
Ptr := Ptr + 1;
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Add_Symbol_Definition (Switch_Chars (Ptr .. Max));
@@ -378,7 +379,8 @@ package body Switch.C is
when 'I' =>
Ptr := Ptr + 1;
- Scan_Pos (Switch_Chars, Max, Ptr, Multiple_Unit_Index);
+ Scan_Pos
+ (Switch_Chars, Max, Ptr, Multiple_Unit_Index, C);
-- -gnatem (mapping file)
@@ -394,7 +396,7 @@ package body Switch.C is
end if;
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Mapping_File_Name :=
@@ -415,7 +417,7 @@ package body Switch.C is
end if;
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Preprocessing_Data_File :=
@@ -446,7 +448,7 @@ package body Switch.C is
-- All other -gnate? switches are unassigned
when others =>
- raise Bad_Switch;
+ Bad_Switch (C);
end case;
-- -gnatE (dynamic elaboration checks)
@@ -502,7 +504,7 @@ package body Switch.C is
Warn_On_Unchecked_Conversion := True;
Warn_On_Unrecognized_Pragma := True;
- Set_Style_Check_Options ("3abcdefhiklmnprstu");
+ Set_Style_Check_Options ("3abcdefhiklmnprstux");
-- Processing for G switch
@@ -526,7 +528,7 @@ package body Switch.C is
when 'i' =>
if Ptr = Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Ptr := Ptr + 1;
@@ -544,14 +546,15 @@ package body Switch.C is
Ptr := Ptr + 1;
else
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
-- Processing for k switch
when 'k' =>
Ptr := Ptr + 1;
- Scan_Pos (Switch_Chars, Max, Ptr, Maximum_File_Name_Length);
+ Scan_Pos
+ (Switch_Chars, Max, Ptr, Maximum_File_Name_Length, C);
-- Processing for l switch
@@ -570,7 +573,14 @@ package body Switch.C is
when 'm' =>
Ptr := Ptr + 1;
- Scan_Pos (Switch_Chars, Max, Ptr, Maximum_Errors);
+
+ -- There may be an equal sign between -gnatm and the value
+
+ if Ptr <= Max and then Switch_Chars (Ptr) = '=' then
+ Ptr := Ptr + 1;
+ end if;
+
+ Scan_Pos (Switch_Chars, Max, Ptr, Maximum_Errors, C);
-- Processing for n switch
@@ -603,7 +613,18 @@ package body Switch.C is
when 'p' =>
Ptr := Ptr + 1;
- Suppress_Options := (others => True);
+
+ -- Set all specific options as well as All_Checks in the
+ -- Suppress_Options array, excluding Elaboration_Check, since
+ -- this is treated specially because we do not want -gnatp to
+ -- disable static elaboration processing.
+
+ for J in Suppress_Options'Range loop
+ if J /= Elaboration_Check then
+ Suppress_Options (J) := True;
+ end if;
+ end loop;
+
Validity_Checks_On := False;
Opt.Suppress_Checks := True;
Opt.Enable_Overflow_Checks := False;
@@ -648,7 +669,7 @@ package body Switch.C is
List_Representation_Info_Mechanisms := True;
else
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Ptr := Ptr + 1;
@@ -687,7 +708,7 @@ package body Switch.C is
when 'T' =>
Ptr := Ptr + 1;
- Scan_Pos (Switch_Chars, Max, Ptr, Table_Factor);
+ Scan_Pos (Switch_Chars, Max, Ptr, Table_Factor, C);
-- Processing for u switch
@@ -715,7 +736,7 @@ package body Switch.C is
Ptr := Ptr + 1;
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
else
declare
@@ -726,7 +747,7 @@ package body Switch.C is
(Switch_Chars (Ptr .. Max), OK, Ptr);
if not OK then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
for Index in First_Char + 1 .. Max loop
@@ -748,188 +769,17 @@ package body Switch.C is
Ptr := Ptr + 1;
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
while Ptr <= Max loop
C := Switch_Chars (Ptr);
- case C is
- when 'a' =>
- Check_Unreferenced := True;
- Check_Unreferenced_Formals := True;
- Check_Withs := True;
- Constant_Condition_Warnings := True;
- Implementation_Unit_Warnings := True;
- Ineffective_Inline_Warnings := True;
- Warn_On_Ada_2005_Compatibility := True;
- Warn_On_Bad_Fixed_Value := True;
- Warn_On_Constant := True;
- Warn_On_Export_Import := True;
- Warn_On_Modified_Unread := True;
- Warn_On_No_Value_Assigned := True;
- Warn_On_Obsolescent_Feature := True;
- Warn_On_Redundant_Constructs := True;
- Warn_On_Unchecked_Conversion := True;
- Warn_On_Unrecognized_Pragma := True;
-
- when 'A' =>
- Check_Unreferenced := False;
- Check_Unreferenced_Formals := False;
- Check_Withs := False;
- Constant_Condition_Warnings := False;
- Elab_Warnings := False;
- Implementation_Unit_Warnings := False;
- Ineffective_Inline_Warnings := False;
- Warn_On_Ada_2005_Compatibility := False;
- Warn_On_Bad_Fixed_Value := False;
- Warn_On_Constant := False;
- Warn_On_Dereference := False;
- Warn_On_Export_Import := False;
- Warn_On_Hiding := False;
- Warn_On_Modified_Unread := False;
- Warn_On_No_Value_Assigned := False;
- Warn_On_Obsolescent_Feature := False;
- Warn_On_Redundant_Constructs := False;
- Warn_On_Unchecked_Conversion := False;
- Warn_On_Unrecognized_Pragma := False;
-
- when 'b' =>
- Warn_On_Bad_Fixed_Value := True;
-
- when 'B' =>
- Warn_On_Bad_Fixed_Value := False;
-
- when 'c' =>
- Constant_Condition_Warnings := True;
-
- when 'C' =>
- Constant_Condition_Warnings := False;
-
- when 'd' =>
- Warn_On_Dereference := True;
-
- when 'D' =>
- Warn_On_Dereference := False;
-
- when 'e' =>
- Warning_Mode := Treat_As_Error;
-
- when 'f' =>
- Check_Unreferenced_Formals := True;
-
- when 'F' =>
- Check_Unreferenced_Formals := False;
-
- when 'g' =>
- Warn_On_Unrecognized_Pragma := True;
-
- when 'G' =>
- Warn_On_Unrecognized_Pragma := False;
-
- when 'h' =>
- Warn_On_Hiding := True;
-
- when 'H' =>
- Warn_On_Hiding := False;
-
- when 'i' =>
- Implementation_Unit_Warnings := True;
-
- when 'I' =>
- Implementation_Unit_Warnings := False;
-
- when 'j' =>
- Warn_On_Obsolescent_Feature := True;
-
- when 'J' =>
- Warn_On_Obsolescent_Feature := False;
-
- when 'k' =>
- Warn_On_Constant := True;
-
- when 'K' =>
- Warn_On_Constant := False;
-
- when 'l' =>
- Elab_Warnings := True;
-
- when 'L' =>
- Elab_Warnings := False;
-
- when 'm' =>
- Warn_On_Modified_Unread := True;
-
- when 'M' =>
- Warn_On_Modified_Unread := False;
-
- when 'n' =>
- Warning_Mode := Normal;
-
- when 'o' =>
- Address_Clause_Overlay_Warnings := True;
-
- when 'O' =>
- Address_Clause_Overlay_Warnings := False;
-
- when 'p' =>
- Ineffective_Inline_Warnings := True;
-
- when 'P' =>
- Ineffective_Inline_Warnings := False;
-
- when 'r' =>
- Warn_On_Redundant_Constructs := True;
-
- when 'R' =>
- Warn_On_Redundant_Constructs := False;
-
- when 's' =>
- Warning_Mode := Suppress;
-
- when 'u' =>
- Check_Unreferenced := True;
- Check_Withs := True;
- Check_Unreferenced_Formals := True;
-
- when 'U' =>
- Check_Unreferenced := False;
- Check_Withs := False;
- Check_Unreferenced_Formals := False;
-
- when 'v' =>
- Warn_On_No_Value_Assigned := True;
-
- when 'V' =>
- Warn_On_No_Value_Assigned := False;
-
- when 'x' =>
- Warn_On_Export_Import := True;
-
- when 'X' =>
- Warn_On_Export_Import := False;
-
- when 'y' =>
- Warn_On_Ada_2005_Compatibility := True;
-
- when 'Y' =>
- Warn_On_Ada_2005_Compatibility := False;
-
- when 'z' =>
- Warn_On_Unchecked_Conversion := True;
-
- when 'Z' =>
- Warn_On_Unchecked_Conversion := False;
-
- -- Allow and ignore 'w' so that the old
- -- format (e.g. -gnatwuwl) will work.
-
- when 'w' =>
- null;
-
- when others =>
- raise Bad_Switch;
- end case;
+ if Set_Warning_Switch (C) then
+ null;
+ else
+ Bad_Switch (C);
+ end if;
if C /= 'w' then
Storing (First_Stored + 1) := C;
@@ -948,7 +798,7 @@ package body Switch.C is
Ptr := Ptr + 1;
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
for J in WC_Encoding_Method loop
@@ -957,7 +807,7 @@ package body Switch.C is
exit;
elsif J = WC_Encoding_Method'Last then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
end loop;
@@ -1002,7 +852,7 @@ package body Switch.C is
(Switch_Chars (Ptr .. Max), OK, Ptr);
if not OK then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Ptr := First_Char + 1;
@@ -1047,7 +897,7 @@ package body Switch.C is
Distribution_Stub_Mode := Generate_Caller_Stub_Body;
when others =>
- raise Bad_Switch;
+ Bad_Switch (C);
end case;
Ptr := Ptr + 1;
@@ -1065,13 +915,13 @@ package body Switch.C is
when '8' =>
if Ptr = Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Ptr := Ptr + 1;
if Switch_Chars (Ptr) /= '3' then
- raise Bad_Switch;
+ Bad_Switch (C);
else
Ptr := Ptr + 1;
Ada_Version := Ada_83;
@@ -1082,13 +932,13 @@ package body Switch.C is
when '9' =>
if Ptr = Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Ptr := Ptr + 1;
if Switch_Chars (Ptr) /= '5' then
- raise Bad_Switch;
+ Bad_Switch (C);
else
Ptr := Ptr + 1;
Ada_Version := Ada_95;
@@ -1099,13 +949,13 @@ package body Switch.C is
when '0' =>
if Ptr = Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
Ptr := Ptr + 1;
if Switch_Chars (Ptr) /= '5' then
- raise Bad_Switch;
+ Bad_Switch (C);
else
Ptr := Ptr + 1;
Ada_Version := Ada_05;
@@ -1120,7 +970,7 @@ package body Switch.C is
-- Anything else is an error (illegal switch character)
when others =>
- raise Bad_Switch;
+ Bad_Switch (C);
end case;
end case;
@@ -1133,17 +983,6 @@ package body Switch.C is
First_Switch := False;
end loop;
-
- exception
- when Bad_Switch =>
- Osint.Fail ("invalid switch: ", (1 => C));
-
- when Bad_Switch_Value =>
- Osint.Fail ("numeric value out of range for switch: ", (1 => C));
-
- when Missing_Switch_Value =>
- Osint.Fail ("missing numeric value for switch: ", (1 => C));
-
end Scan_Front_End_Switches;
end Switch.C;
diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb
index 6c5ed1ff453..bad932a01a6 100644
--- a/gcc/ada/switch-m.adb
+++ b/gcc/ada/switch-m.adb
@@ -491,7 +491,7 @@ package body Switch.M is
-- Skip past the initial character (must be the switch character)
if Ptr = Max then
- raise Bad_Switch;
+ Bad_Switch (C);
else
Ptr := Ptr + 1;
@@ -581,7 +581,7 @@ package body Switch.M is
then
Set_Debug_Flag (C);
else
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
end loop;
@@ -593,7 +593,7 @@ package body Switch.M is
Ptr := Ptr + 1;
if Ptr > Max then
- raise Bad_Switch;
+ Bad_Switch (C);
end if;
case Switch_Chars (Ptr) is
@@ -602,7 +602,7 @@ package body Switch.M is
when 'I' =>
Ptr := Ptr + 1;
- Scan_Pos (Switch_Chars, Max, Ptr, Main_Index);
+ Scan_Pos (Switch_Chars, Max, Ptr, Main_Index, C);
-- processing for eL switch
@@ -611,7 +611,7 @@ package body Switch.M is
Follow_Links := True;
when others =>
- raise Bad_Switch;
+ Bad_Switch (C);
end case;
-- Processing for f switch
@@ -646,7 +646,7 @@ package body Switch.M is
declare
Max_Proc : Pos;
begin
- Scan_Pos (Switch_Chars, Max, Ptr, Max_Proc);
+ Scan_Pos (Switch_Chars, Max, Ptr, Max_Proc, C);
Maximum_Processes := Positive (Max_Proc);
end;
@@ -679,7 +679,7 @@ package body Switch.M is
Ptr := Ptr + 1;
if Output_File_Name_Present then
- raise Too_Many_Output_Files;
+ Osint.Fail ("duplicate -o switch");
else
Output_File_Name_Present := True;
end if;
@@ -707,6 +707,25 @@ package body Switch.M is
when 'v' =>
Ptr := Ptr + 1;
Verbose_Mode := True;
+ Verbosity_Level := Opt.High;
+
+ if Ptr <= Max then
+ case Switch_Chars (Ptr) is
+ when 'l' =>
+ Verbosity_Level := Opt.Low;
+
+ when 'm' =>
+ Verbosity_Level := Opt.Medium;
+
+ when 'h' =>
+ Verbosity_Level := Opt.High;
+
+ when others =>
+ Osint.Fail ("invalid switch: ", Switch_Chars);
+ end case;
+
+ Ptr := Ptr + 1;
+ end if;
-- Processing for x switch
@@ -728,7 +747,7 @@ package body Switch.M is
-- Anything else is an error (illegal switch character)
when others =>
- raise Bad_Switch;
+ Bad_Switch (C);
end case;
@@ -738,19 +757,6 @@ package body Switch.M is
end Check_Switch;
- exception
- when Bad_Switch =>
- Osint.Fail ("invalid switch: ", (1 => C));
-
- when Bad_Switch_Value =>
- Osint.Fail ("numeric value out of range for switch: ", (1 => C));
-
- when Missing_Switch_Value =>
- Osint.Fail ("missing numeric value for switch: ", (1 => C));
-
- when Too_Many_Output_Files =>
- Osint.Fail ("duplicate -o switch");
-
end Scan_Make_Switches;
end Switch.M;
diff --git a/gcc/ada/switch.adb b/gcc/ada/switch.adb
index c960b57883f..048678bd19f 100644
--- a/gcc/ada/switch.adb
+++ b/gcc/ada/switch.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,8 +24,19 @@
-- --
------------------------------------------------------------------------------
+with Osint;
+
package body Switch is
+ ----------------
+ -- Bad_Switch --
+ ----------------
+
+ procedure Bad_Switch (Switch : Character) is
+ begin
+ Osint.Fail ("invalid switch: ", (1 => Switch));
+ end Bad_Switch;
+
-------------------------
-- Is_Front_End_Switch --
-------------------------
@@ -61,24 +72,27 @@ package body Switch is
(Switch_Chars : String;
Max : Integer;
Ptr : in out Integer;
- Result : out Nat)
+ Result : out Nat;
+ Switch : Character)
is
begin
Result := 0;
if Ptr > Max or else Switch_Chars (Ptr) not in '0' .. '9' then
- raise Missing_Switch_Value;
+ Osint.Fail ("missing numeric value for switch: ", (1 => Switch));
+
+ else
+ while Ptr <= Max and then Switch_Chars (Ptr) in '0' .. '9' loop
+ Result := Result * 10 +
+ Character'Pos (Switch_Chars (Ptr)) - Character'Pos ('0');
+ Ptr := Ptr + 1;
+
+ if Result > Switch_Max_Value then
+ Osint.Fail
+ ("numeric value out of range for switch: ", (1 => Switch));
+ end if;
+ end loop;
end if;
-
- while Ptr <= Max and then Switch_Chars (Ptr) in '0' .. '9' loop
- Result := Result * 10 +
- Character'Pos (Switch_Chars (Ptr)) - Character'Pos ('0');
- Ptr := Ptr + 1;
-
- if Result > Switch_Max_Value then
- raise Bad_Switch_Value;
- end if;
- end loop;
end Scan_Nat;
--------------
@@ -89,15 +103,16 @@ package body Switch is
(Switch_Chars : String;
Max : Integer;
Ptr : in out Integer;
- Result : out Pos)
+ Result : out Pos;
+ Switch : Character)
is
Temp : Nat;
begin
- Scan_Nat (Switch_Chars, Max, Ptr, Temp);
+ Scan_Nat (Switch_Chars, Max, Ptr, Temp, Switch);
if Temp = 0 then
- raise Bad_Switch_Value;
+ Osint.Fail ("numeric value out of range for switch: ", (1 => Switch));
end if;
Result := Temp;
diff --git a/gcc/ada/switch.ads b/gcc/ada/switch.ads
index 2be39a3f9e5..15c273f829c 100644
--- a/gcc/ada/switch.ads
+++ b/gcc/ada/switch.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -62,18 +62,6 @@ private
-- child packages (there is one such child package for each tool that
-- uses Switches to scan switches - Compiler/gnatbind/gnatmake/.
- Bad_Switch : exception;
- -- Exception raised if bad switch encountered
-
- Bad_Switch_Value : exception;
- -- Exception raised if bad switch value encountered
-
- Missing_Switch_Value : exception;
- -- Exception raised if no switch value encountered
-
- Too_Many_Output_Files : exception;
- -- Exception raised if the -o switch is encountered more than once
-
Switch_Max_Value : constant := 999_999;
-- Maximum value permitted in switches that take a value
@@ -81,7 +69,8 @@ private
(Switch_Chars : String;
Max : Integer;
Ptr : in out Integer;
- Result : out Nat);
+ Result : out Nat;
+ Switch : Character);
-- Scan natural integer parameter for switch. On entry, Ptr points
-- just past the switch character, on exit it points past the last
-- digit of the integer value.
@@ -90,9 +79,13 @@ private
(Switch_Chars : String;
Max : Integer;
Ptr : in out Integer;
- Result : out Pos);
+ Result : out Pos;
+ Switch : Character);
-- Scan positive integer parameter for switch. On entry, Ptr points
-- just past the switch character, on exit it points past the last
-- digit of the integer value.
+ procedure Bad_Switch (Switch : Character);
+ -- Fail with an appropriate message when a switch is not recognized
+
end Switch;
diff --git a/gcc/ada/symbols.adb b/gcc/ada/symbols.adb
index af4a73cce0a..631ccb1f5ce 100644
--- a/gcc/ada/symbols.adb
+++ b/gcc/ada/symbols.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/symbols.ads b/gcc/ada/symbols.ads
index 8672a0ec9e0..b9a5e5f2a40 100644
--- a/gcc/ada/symbols.ads
+++ b/gcc/ada/symbols.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -34,7 +34,7 @@ with GNAT.OS_Lib; use GNAT.OS_Lib;
package Symbols is
type Policy is
- -- Symbol policy:
+ -- Symbol policy
(Autonomous,
-- Create a symbol file without considering any reference
diff --git a/gcc/ada/system-aix.ads b/gcc/ada/system-aix.ads
index 246207c18c8..8db13afacd7 100644
--- a/gcc/ada/system-aix.ads
+++ b/gcc/ada/system-aix.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (AIX/PPC Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-darwin-ppc.ads b/gcc/ada/system-darwin-ppc.ads
index 3d8f99b522d..19478e96d28 100644
--- a/gcc/ada/system-darwin-ppc.ads
+++ b/gcc/ada/system-darwin-ppc.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (Darwin/PPC Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-freebsd-x86.ads b/gcc/ada/system-freebsd-x86.ads
index 3eab5aef7e3..45216d111ec 100644
--- a/gcc/ada/system-freebsd-x86.ads
+++ b/gcc/ada/system-freebsd-x86.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (FreeBSD/x86 Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-hpux-ia64.ads b/gcc/ada/system-hpux-ia64.ads
index cb5af090af5..c3d2ee925b8 100644
--- a/gcc/ada/system-hpux-ia64.ads
+++ b/gcc/ada/system-hpux-ia64.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (HP-UX/ia64 Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-hpux.ads b/gcc/ada/system-hpux.ads
index 4a72615f49c..4dbc6ae1d04 100644
--- a/gcc/ada/system-hpux.ads
+++ b/gcc/ada/system-hpux.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (HP-UX Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-interix.ads b/gcc/ada/system-interix.ads
index 9e25857b2ec..c816faefb29 100644
--- a/gcc/ada/system-interix.ads
+++ b/gcc/ada/system-interix.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (OpenNT/Interix Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-irix-n32.ads b/gcc/ada/system-irix-n32.ads
index 794f494848b..958bd8ca407 100644
--- a/gcc/ada/system-irix-n32.ads
+++ b/gcc/ada/system-irix-n32.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (SGI Irix, n32 ABI) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-irix-o32.ads b/gcc/ada/system-irix-o32.ads
index 1a69ff08189..73b1ad520e3 100644
--- a/gcc/ada/system-irix-o32.ads
+++ b/gcc/ada/system-irix-o32.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (SGI Irix, o32 ABI) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-linux-hppa.ads b/gcc/ada/system-linux-hppa.ads
index 67c395c0d18..7b0259c9b74 100644
--- a/gcc/ada/system-linux-hppa.ads
+++ b/gcc/ada/system-linux-hppa.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (GNU/Linux-HPPA Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-linux-ia64.ads b/gcc/ada/system-linux-ia64.ads
index 892a1be8dee..95f70a3f9f1 100644
--- a/gcc/ada/system-linux-ia64.ads
+++ b/gcc/ada/system-linux-ia64.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (GNU-Linux/ia64 Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-linux-ppc.ads b/gcc/ada/system-linux-ppc.ads
index 99ed4e32b6f..d2b414da6c4 100644
--- a/gcc/ada/system-linux-ppc.ads
+++ b/gcc/ada/system-linux-ppc.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (GNU-Linux/PPC Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-linux-x86.ads b/gcc/ada/system-linux-x86.ads
index 6f43799ab28..fa79b5e4c92 100644
--- a/gcc/ada/system-linux-x86.ads
+++ b/gcc/ada/system-linux-x86.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (GNU-Linux/x86 Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-linux-x86_64.ads b/gcc/ada/system-linux-x86_64.ads
index e850d740384..2867602ad74 100644
--- a/gcc/ada/system-linux-x86_64.ads
+++ b/gcc/ada/system-linux-x86_64.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (GNU-Linux/x86-64 Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-lynxos-ppc.ads b/gcc/ada/system-lynxos-ppc.ads
index 3aec6f23bb8..3329bc13a63 100644
--- a/gcc/ada/system-lynxos-ppc.ads
+++ b/gcc/ada/system-lynxos-ppc.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (LynxOS PPC Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -91,14 +91,28 @@ package System is
-- Priority-related Declarations (RM D.1)
- Max_Priority : constant Positive := 254;
+ -- 17 is the system determined default priority for user applications
+ -- running on LynxOS.
+
+ -- The standard (Rm 13.7) requires that Default_Priority has the value:
+
+ -- (Priority'First + Priority'Last) / 2.
+
+ -- To allow an appropriate value for Default_Priority and expose a useful
+ -- range of priorities to the user, we use a range of 0 .. 34 for subtype
+ -- Priority.
+
+ -- The rest of the range allowed by the system from 35 to 255 is made
+ -- available here in Interrupt_Priority.
+
+ Max_Priority : constant Positive := 34;
Max_Interrupt_Priority : constant Positive := 255;
subtype Any_Priority is Integer range 0 .. 255;
- subtype Priority is Any_Priority range 0 .. 254;
- subtype Interrupt_Priority is Any_Priority range 255 .. 255;
+ subtype Priority is Any_Priority range 0 .. 34;
+ subtype Interrupt_Priority is Any_Priority range 35 .. 255;
- Default_Priority : constant Priority := 15;
+ Default_Priority : constant Priority := 17;
private
diff --git a/gcc/ada/system-lynxos-x86.ads b/gcc/ada/system-lynxos-x86.ads
index 8213dbe7360..00938c3ce94 100644
--- a/gcc/ada/system-lynxos-x86.ads
+++ b/gcc/ada/system-lynxos-x86.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (LynxOS x86 Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -91,14 +91,28 @@ package System is
-- Priority-related Declarations (RM D.1)
- Max_Priority : constant Positive := 254;
+ -- 17 is the system determined default priority for user applications
+ -- running on LynxOS.
+
+ -- The standard (Rm 13.7) requires that Default_Priority has the value:
+
+ -- (Priority'First + Priority'Last) / 2.
+
+ -- To allow an appropriate value for Default_Priority and expose a useful
+ -- range of priorities to the user, we use a range of 0 .. 34 for subtype
+ -- Priority.
+
+ -- The rest of the range allowed by the system from 35 to 255 is made
+ -- available here in Interrupt_Priority.
+
+ Max_Priority : constant Positive := 34;
Max_Interrupt_Priority : constant Positive := 255;
subtype Any_Priority is Integer range 0 .. 255;
- subtype Priority is Any_Priority range 0 .. 254;
- subtype Interrupt_Priority is Any_Priority range 255 .. 255;
+ subtype Priority is Any_Priority range 0 .. 34;
+ subtype Interrupt_Priority is Any_Priority range 35 .. 255;
- Default_Priority : constant Priority := 15;
+ Default_Priority : constant Priority := 17;
private
diff --git a/gcc/ada/system-mingw.ads b/gcc/ada/system-mingw.ads
index b5967998da0..5924fc8f9c2 100644
--- a/gcc/ada/system-mingw.ads
+++ b/gcc/ada/system-mingw.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (NT Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-os2.ads b/gcc/ada/system-os2.ads
index 9dc5bf8b686..65c9461c050 100644
--- a/gcc/ada/system-os2.ads
+++ b/gcc/ada/system-os2.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (OS/2 Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-solaris-sparc.ads b/gcc/ada/system-solaris-sparc.ads
index 1ec0af3872d..2c36f6482f4 100644
--- a/gcc/ada/system-solaris-sparc.ads
+++ b/gcc/ada/system-solaris-sparc.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (SUN Solaris Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-solaris-sparcv9.ads b/gcc/ada/system-solaris-sparcv9.ads
index 672cd97e5dd..1e1e5342501 100644
--- a/gcc/ada/system-solaris-sparcv9.ads
+++ b/gcc/ada/system-solaris-sparcv9.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (Solaris Sparcv9 Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-solaris-x86.ads b/gcc/ada/system-solaris-x86.ads
index 0ebf08bef5c..3f3ed23b295 100644
--- a/gcc/ada/system-solaris-x86.ads
+++ b/gcc/ada/system-solaris-x86.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (x86 Solaris Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-tru64.ads b/gcc/ada/system-tru64.ads
index ef3d7de8a0b..da79c82bab2 100644
--- a/gcc/ada/system-tru64.ads
+++ b/gcc/ada/system-tru64.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (DEC Unix Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-unixware.ads b/gcc/ada/system-unixware.ads
index 63fb6038cde..801968d5141 100644
--- a/gcc/ada/system-unixware.ads
+++ b/gcc/ada/system-unixware.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (SCO UnixWare Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-vms-zcx.ads b/gcc/ada/system-vms-zcx.ads
index 5f9f59423c5..39af22044e5 100644
--- a/gcc/ada/system-vms-zcx.ads
+++ b/gcc/ada/system-vms-zcx.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (OpenVMS GCC_ZCX DEC Threads Version) --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
diff --git a/gcc/ada/system-vms.ads b/gcc/ada/system-vms.ads
index d958ded7663..22d49f5d979 100644
--- a/gcc/ada/system-vms.ads
+++ b/gcc/ada/system-vms.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (OpenVMS DEC Threads Version) --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -236,4 +236,9 @@ private
-- {Import,Export}_Exception. Put here because this is the only
-- VMS specific package that doesn't drag in tasking.
+ ADA_GNAT : constant Boolean := True;
+ pragma Export_Object (ADA_GNAT, "ADA$GNAT");
+ -- Uniquitous global symbol identifing a GNAT compiled image to VMS Debug.
+ -- Do not remove!
+
end System;
diff --git a/gcc/ada/system-vms_64.ads b/gcc/ada/system-vms_64.ads
index 3d7b8e8f615..555692c6d90 100644
--- a/gcc/ada/system-vms_64.ads
+++ b/gcc/ada/system-vms_64.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- (OpenVMS 64bit GCC_ZCX DEC Threads Version) --
-- --
--- Copyright (C) 2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
@@ -255,4 +255,9 @@ private
-- {Import,Export}_Exception. Put here because this is the only
-- VMS specific package that doesn't drag in tasking.
+ ADA_GNAT : constant Boolean := True;
+ pragma Export_Object (ADA_GNAT, "ADA$GNAT");
+ -- Uniquitous global symbol identifing a GNAT compiled image to VMS Debug.
+ -- Do not remove!
+
end System;
diff --git a/gcc/ada/table.ads b/gcc/ada/table.ads
index 853948ab8c7..983f7fd0e35 100644
--- a/gcc/ada/table.ads
+++ b/gcc/ada/table.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -174,11 +174,11 @@ package Table is
procedure Increment_Last;
pragma Inline (Increment_Last);
- -- Adds 1 to Last (same as Set_Last (Last + 1).
+ -- Adds 1 to Last (same as Set_Last (Last + 1)
procedure Decrement_Last;
pragma Inline (Decrement_Last);
- -- Subtracts 1 from Last (same as Set_Last (Last - 1).
+ -- Subtracts 1 from Last (same as Set_Last (Last - 1)
procedure Append (New_Val : Table_Component_Type);
pragma Inline (Append);
diff --git a/gcc/ada/targparm.adb b/gcc/ada/targparm.adb
index 0fd9c7fc596..65ba29f977e 100644
--- a/gcc/ada/targparm.adb
+++ b/gcc/ada/targparm.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/targparm.ads b/gcc/ada/targparm.ads
index b29f506be75..38dd2266840 100644
--- a/gcc/ada/targparm.ads
+++ b/gcc/ada/targparm.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -295,7 +295,7 @@ package Targparm is
-- this variable is True, then GCC ZCX is used.
GCC_ZCX_Support_On_Target : Boolean := False;
- -- Indicates that the target supports GCC Exceptions.
+ -- Indicates that the target supports GCC Exceptions
------------------------------------
-- Run-Time Library Configuration --
@@ -523,7 +523,7 @@ package Targparm is
-- Set to True for targets where S'Machine_Overflows is True
Signed_Zeros_On_Target : Boolean := True;
- -- Set to False on targets that do not reliably support signed zeros.
+ -- Set to False on targets that do not reliably support signed zeros
-------------------------------------------
-- Boolean-Valued Fixed-Point Attributes --
diff --git a/gcc/ada/tb-alvms.c b/gcc/ada/tb-alvms.c
index 5f1fc3f0caa..22fc540855d 100644
--- a/gcc/ada/tb-alvms.c
+++ b/gcc/ada/tb-alvms.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 2003,2005 Ada Core Technologies, Inc *
+ * Copyright (C) 2003-2005, AdaCore *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
diff --git a/gcc/ada/tb-alvxw.c b/gcc/ada/tb-alvxw.c
index 0f9d5e2d002..64e4a3ced0b 100644
--- a/gcc/ada/tb-alvxw.c
+++ b/gcc/ada/tb-alvxw.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 2000-2003 Ada Core Technologies, Inc *
+ * Copyright (C) 2000-2005, AdaCore *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
diff --git a/gcc/ada/tb-gcc.c b/gcc/ada/tb-gcc.c
index 0fe923e53f8..1a3566ec379 100644
--- a/gcc/ada/tb-gcc.c
+++ b/gcc/ada/tb-gcc.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 2004 Ada Core Technologies, Inc *
+ * Copyright (C) 2004-2005, AdaCore *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -54,10 +54,21 @@ typedef struct {
* trace_callback *
******************/
+#if defined (__ia64__) && defined (__hpux__)
+#include <uwx.h>
+#endif
+
static _Unwind_Reason_Code
trace_callback (struct _Unwind_Context * uw_context, uw_data_t * uw_data)
{
- void * pc = (void *) _Unwind_GetIP (uw_context);
+ void * pc;
+
+#if defined (__ia64__) && defined (__hpux__)
+ /* Work around problem with _Unwind_GetIP on ia64 HP-UX. */
+ uwx_get_reg ((struct uwx_env *) uw_context, UWX_REG_IP, (uint64_t *) &pc);
+#else
+ pc = (void *) _Unwind_GetIP (uw_context);
+#endif
if (uw_data->n_frames_skipped < uw_data->n_frames_to_skip)
{
diff --git a/gcc/ada/tbuild.adb b/gcc/ada/tbuild.adb
index fba9c3c3c9e..f7966b156a4 100644
--- a/gcc/ada/tbuild.adb
+++ b/gcc/ada/tbuild.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/tempdir.adb b/gcc/ada/tempdir.adb
index 7daea87e5c6..a0b8adacac7 100644
--- a/gcc/ada/tempdir.adb
+++ b/gcc/ada/tempdir.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -114,7 +114,10 @@ begin
Dir : String_Access := Getenv (Tmpdir);
begin
- if Dir'Length > 0 and then Is_Absolute_Path (Dir.all) then
+ if Dir'Length > 0 and then
+ Is_Absolute_Path (Dir.all) and then
+ Is_Directory (Dir.all)
+ then
Temp_Dir := new String'(Normalize_Pathname (Dir.all));
end if;
diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c
index f7c431b77b9..db825d155ee 100644
--- a/gcc/ada/tracebak.c
+++ b/gcc/ada/tracebak.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 2000-2005 Ada Core Technologies, Inc. *
+ * Copyright (C) 2000-2005, AdaCore *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -300,7 +300,11 @@ struct layout
};
#define LOWEST_ADDR 0
-#define FRAME_LEVEL 0
+#define FRAME_LEVEL 1
+/* builtin_frame_address (1) is expected to work on this target, and (0) might
+ return the soft stack pointer, which does not designate a location where a
+ backchain and a return address might be found. */
+
#define FRAME_OFFSET 0
#define PC_ADJUST -2
#define STOP_FRAME(CURRENT, TOP_STACK) \
@@ -309,7 +313,7 @@ struct layout
|| (CURRENT)->return_address == 0|| (CURRENT)->next == 0 \
|| (void *) (CURRENT) < (TOP_STACK))
-#define BASE_SKIP 1
+#define BASE_SKIP (1+FRAME_LEVEL)
/* On i386 architecture we check that at the call point we really have a call
insn. Possible call instructions are:
@@ -349,9 +353,13 @@ struct layout
/*----------------------------- ia64 ---------------------------------*/
-#elif defined (__ia64__) && !defined (USE_LIBUNWIND_EXCEPTIONS)
+#elif defined (__ia64__) && (defined (linux) || defined (__hpux__))
#define USE_GCC_UNWINDER
+/* Use _Unwind_Backtrace driven exceptions on ia64 HP-UX and ia64
+ GNU/Linux, where _Unwind_Backtrace is provided by the system unwind
+ library. On HP-UX 11.23 this requires patch PHSS_33352, which adds
+ _Unwind_Backtrace to the system unwind library. */
#define PC_ADJUST -16
/* Every call on ia64 is part of a 128 bit bundle, so an adjustment of
diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c
index d685fb34db0..c7126720003 100644
--- a/gcc/ada/trans.c
+++ b/gcc/ada/trans.c
@@ -408,13 +408,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
else if (TREE_CODE (gnu_result) == VAR_DECL
&& (renamed_obj = DECL_RENAMED_OBJECT (gnu_result)) != 0
&& (! DECL_RENAMING_GLOBAL_P (gnu_result)
- || global_bindings_p ())
- /* Make sure it's an lvalue like INDIRECT_REF. */
- && (DECL_P (renamed_obj)
- || REFERENCE_CLASS_P (renamed_obj)
- || (TREE_CODE (renamed_obj) == VIEW_CONVERT_EXPR
- && (DECL_P (TREE_OPERAND (renamed_obj, 0))
- || REFERENCE_CLASS_P (TREE_OPERAND (renamed_obj,0))))))
+ || global_bindings_p ()))
gnu_result = renamed_obj;
else
gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE,
@@ -719,6 +713,21 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
= size_binop (MAX_EXPR, gnu_result,
DECL_SIZE (TREE_OPERAND (gnu_expr, 1)));
}
+ else if (Nkind (Prefix (gnat_node)) == N_Explicit_Dereference)
+ {
+ Node_Id gnat_deref = Prefix (gnat_node);
+ Node_Id gnat_actual_subtype = Actual_Designated_Subtype (gnat_deref);
+ tree gnu_ptr_type = TREE_TYPE (gnat_to_gnu (Prefix (gnat_deref)));
+ if (TYPE_FAT_OR_THIN_POINTER_P (gnu_ptr_type)
+ && Present (gnat_actual_subtype))
+ {
+ tree gnu_actual_obj_type = gnat_to_gnu_type (gnat_actual_subtype);
+ gnu_type = build_unc_object_type_from_ptr (gnu_ptr_type,
+ gnu_actual_obj_type, get_identifier ("SIZE"));
+ }
+
+ gnu_result = TYPE_SIZE (gnu_type);
+ }
else
gnu_result = TYPE_SIZE (gnu_type);
}
@@ -1564,8 +1573,15 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
0, Etype (Name (gnat_node)), "PAD", false,
false, false);
- gnu_target = create_tmp_var_raw (gnu_obj_type, "LR");
- gnat_pushdecl (gnu_target, gnat_node);
+ /* ??? We may be about to create a static temporary if we happen to
+ be at the global binding level. That's a regression from what
+ the 3.x back-end would generate in the same situation, but we
+ don't have a mechanism in Gigi for creating automatic variables
+ in the elaboration routines. */
+ gnu_target
+ = create_var_decl (create_tmp_var_name ("LR"), NULL, gnu_obj_type,
+ NULL, false, false, false, false, NULL,
+ gnat_node);
}
gnu_actual_list
@@ -1602,6 +1618,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
tree gnu_formal
= (present_gnu_tree (gnat_formal)
? get_gnu_tree (gnat_formal) : NULL_TREE);
+ tree gnu_formal_type = gnat_to_gnu_type (Etype (gnat_formal));
/* We treat a conversion between aggregate types as if it is an
unchecked conversion. */
bool unchecked_convert_p
@@ -1613,7 +1630,6 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
tree gnu_name = gnat_to_gnu (gnat_name);
tree gnu_name_type = gnat_to_gnu_type (Etype (gnat_name));
tree gnu_actual;
- tree gnu_formal_type;
/* If it's possible we may need to use this expression twice, make sure
than any side-effects are handled via SAVE_EXPRs. Likewise if we need
@@ -1626,6 +1642,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
if (Ekind (gnat_formal) != E_In_Parameter)
{
gnu_name = gnat_stabilize_reference (gnu_name, true);
+
if (!addressable_p (gnu_name)
&& gnu_formal
&& (DECL_BY_REF_P (gnu_formal)
@@ -1741,6 +1758,9 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
gnu_actual = convert (gnat_to_gnu_type (Etype (gnat_actual)),
gnu_actual);
+ if (TREE_CODE (gnu_actual) != SAVE_EXPR)
+ gnu_actual = convert (gnu_formal_type, gnu_actual);
+
/* If we have not saved a GCC object for the formal, it means it is an
OUT parameter not passed by reference and that does not need to be
copied in. Otherwise, look at the PARM_DECL to see if it is passed by
@@ -1989,7 +2009,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
&& TREE_CONSTANT (TYPE_SIZE (TREE_TYPE (gnu_result)))))
gnu_result = convert (TREE_TYPE (gnu_actual), gnu_result);
}
-
+
gnu_result = build_binary_op (MODIFY_EXPR, NULL_TREE,
gnu_actual, gnu_result);
annotate_with_node (gnu_result, gnat_actual);
@@ -2497,25 +2517,40 @@ gnat_to_gnu (Node_Id gnat_node)
return build1 (NULL_EXPR, get_unpadded_type (Etype (gnat_node)),
build_call_raise (CE_Range_Check_Failed));
- /* If this is a Statement and we are at top level, it must be part of
- the elaboration procedure, so mark us as being in that procedure
- and push our context. */
- if (!current_function_decl
- && ((IN (Nkind (gnat_node), N_Statement_Other_Than_Procedure_Call)
- && Nkind (gnat_node) != N_Null_Statement)
- || Nkind (gnat_node) == N_Procedure_Call_Statement
- || Nkind (gnat_node) == N_Label
- || Nkind (gnat_node) == N_Implicit_Label_Declaration
- || Nkind (gnat_node) == N_Handled_Sequence_Of_Statements
- || ((Nkind (gnat_node) == N_Raise_Constraint_Error
- || Nkind (gnat_node) == N_Raise_Storage_Error
- || Nkind (gnat_node) == N_Raise_Program_Error)
- && (Ekind (Etype (gnat_node)) == E_Void))))
+ /* If this is a Statement and we are at top level, it must be part of the
+ elaboration procedure, so mark us as being in that procedure and push our
+ context.
+
+ If we are in the elaboration procedure, check if we are violating a a
+ No_Elaboration_Code restriction by having a statement there. */
+ if ((IN (Nkind (gnat_node), N_Statement_Other_Than_Procedure_Call)
+ && Nkind (gnat_node) != N_Null_Statement)
+ || Nkind (gnat_node) == N_Procedure_Call_Statement
+ || Nkind (gnat_node) == N_Label
+ || Nkind (gnat_node) == N_Implicit_Label_Declaration
+ || Nkind (gnat_node) == N_Handled_Sequence_Of_Statements
+ || ((Nkind (gnat_node) == N_Raise_Constraint_Error
+ || Nkind (gnat_node) == N_Raise_Storage_Error
+ || Nkind (gnat_node) == N_Raise_Program_Error)
+ && (Ekind (Etype (gnat_node)) == E_Void)))
{
- current_function_decl = TREE_VALUE (gnu_elab_proc_stack);
- start_stmt_group ();
- gnat_pushlevel ();
- went_into_elab_proc = true;
+ if (!current_function_decl)
+ {
+ current_function_decl = TREE_VALUE (gnu_elab_proc_stack);
+ start_stmt_group ();
+ gnat_pushlevel ();
+ went_into_elab_proc = true;
+ }
+
+ /* Don't check for a possible No_Elaboration_Code restriction violation
+ on N_Handled_Sequence_Of_Statements, as we want to signal an error on
+ every nested real statement instead. This also avoids triggering
+ spurious errors on dummy (empty) sequences created by the front-end
+ for package bodies in some cases. */
+
+ if (current_function_decl == TREE_VALUE (gnu_elab_proc_stack)
+ && Nkind (gnat_node) != N_Handled_Sequence_Of_Statements)
+ Check_Elaboration_Code_Allowed (gnat_node);
}
switch (Nkind (gnat_node))
@@ -2982,7 +3017,7 @@ gnat_to_gnu (Node_Id gnat_node)
? Designated_Type (Etype
(Prefix (gnat_node)))
: Etype (Prefix (gnat_node))))
- gnu_prefix = gnat_stabilize_reference (gnu_prefix, 0);
+ gnu_prefix = gnat_stabilize_reference (gnu_prefix, false);
gnu_result
= build_component_ref (gnu_prefix, NULL_TREE, gnu_field,
@@ -3427,7 +3462,7 @@ gnat_to_gnu (Node_Id gnat_node)
/* If the type has a size that overflows, convert this into raise of
Storage_Error: execution shouldn't have gotten here anyway. */
if (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (gnu_lhs))) == INTEGER_CST
- && TREE_OVERFLOW (TYPE_SIZE_UNIT (TREE_TYPE (gnu_lhs))))
+ && TREE_OVERFLOW (TYPE_SIZE_UNIT (TREE_TYPE (gnu_lhs))))
gnu_result = build_call_raise (SE_Object_Too_Large);
else if (Nkind (Expression (gnat_node)) == N_Function_Call
&& !Do_Range_Check (Expression (gnat_node)))
@@ -3927,7 +3962,9 @@ gnat_to_gnu (Node_Id gnat_node)
if (!type_annotate_only)
{
tree gnu_ptr = gnat_to_gnu (Expression (gnat_node));
+ tree gnu_ptr_type = TREE_TYPE (gnu_ptr);
tree gnu_obj_type;
+ tree gnu_actual_obj_type = 0;
tree gnu_obj_size;
int align;
@@ -3952,7 +3989,21 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_ptr);
gnu_obj_type = TREE_TYPE (TREE_TYPE (gnu_ptr));
- gnu_obj_size = TYPE_SIZE_UNIT (gnu_obj_type);
+
+ if (Present (Actual_Designated_Subtype (gnat_node)))
+ {
+ gnu_actual_obj_type = gnat_to_gnu_type (Actual_Designated_Subtype (gnat_node));
+
+ if (TYPE_FAT_OR_THIN_POINTER_P (gnu_ptr_type))
+ gnu_actual_obj_type
+ = build_unc_object_type_from_ptr (gnu_ptr_type,
+ gnu_actual_obj_type,
+ get_identifier ("DEALLOC"));
+ }
+ else
+ gnu_actual_obj_type = gnu_obj_type;
+
+ gnu_obj_size = TYPE_SIZE_UNIT (gnu_actual_obj_type);
align = TYPE_ALIGN (gnu_obj_type);
if (TREE_CODE (gnu_obj_type) == RECORD_TYPE
@@ -4106,7 +4157,7 @@ gnat_to_gnu (Node_Id gnat_node)
if (TREE_SIDE_EFFECTS (gnu_result)
&& (TREE_CODE (gnu_result_type) == UNCONSTRAINED_ARRAY_TYPE
|| CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_result_type))))
- gnu_result = gnat_stabilize_reference (gnu_result, 0);
+ gnu_result = gnat_stabilize_reference (gnu_result, false);
/* Now convert the result to the proper type. If the type is void or if
we have no result, return error_mark_node to show we have no result.
@@ -4519,6 +4570,7 @@ int
gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
{
tree expr = *expr_p;
+ tree op;
if (IS_ADA_STMT (expr))
return gnat_gimplify_stmt (expr_p);
@@ -4549,25 +4601,50 @@ gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
return GS_OK;
case ADDR_EXPR:
+ op = TREE_OPERAND (expr, 0);
+
/* If we're taking the address of a constant CONSTRUCTOR, force it to
be put into static memory. We know it's going to be readonly given
the semantics we have and it's required to be static memory in
- the case when the reference is in an elaboration procedure. */
- if (TREE_CODE (TREE_OPERAND (expr, 0)) == CONSTRUCTOR
- && TREE_CONSTANT (TREE_OPERAND (expr, 0)))
+ the case when the reference is in an elaboration procedure. */
+ if (TREE_CODE (op) == CONSTRUCTOR && TREE_CONSTANT (op))
{
- tree new_var
- = create_tmp_var (TREE_TYPE (TREE_OPERAND (expr, 0)), "C");
+ tree new_var = create_tmp_var (TREE_TYPE (op), "C");
TREE_READONLY (new_var) = 1;
TREE_STATIC (new_var) = 1;
TREE_ADDRESSABLE (new_var) = 1;
- DECL_INITIAL (new_var) = TREE_OPERAND (expr, 0);
+ DECL_INITIAL (new_var) = op;
+
+ TREE_OPERAND (expr, 0) = new_var;
+ recompute_tree_invarant_for_addr_expr (expr);
+ return GS_ALL_DONE;
+ }
+
+ /* Otherwise, if we are taking the address of something that is neither
+ reference, declaration, or constant, make a variable for the operand
+ here and then take its address. If we don't do it this way, we may
+ confuse the gimplifier because it needs to know the variable is
+ addressable at this point. This duplicates code in
+ internal_get_tmp_var, which is unfortunate. */
+ else if (TREE_CODE_CLASS (TREE_CODE (op)) != tcc_reference
+ && TREE_CODE_CLASS (TREE_CODE (op)) != tcc_declaration
+ && TREE_CODE_CLASS (TREE_CODE (op)) != tcc_constant)
+ {
+ tree new_var = create_tmp_var (TREE_TYPE (op), "A");
+ tree mod = build (MODIFY_EXPR, TREE_TYPE (op), new_var, op);
+
+ TREE_ADDRESSABLE (new_var) = 1;
+ if (EXPR_HAS_LOCATION (op))
+ SET_EXPR_LOCUS (mod, EXPR_LOCUS (op));
+
+ gimplify_and_add (mod, pre_p);
TREE_OPERAND (expr, 0) = new_var;
recompute_tree_invarant_for_addr_expr (expr);
return GS_ALL_DONE;
}
+
return GS_UNHANDLED;
case COMPONENT_REF:
@@ -5709,17 +5786,26 @@ protect_multiple_eval (tree exp)
exp)));
}
-/* This is equivalent to stabilize_reference in GCC's tree.c, but we know
- how to handle our new nodes and we take an extra argument that says
- whether to force evaluation of everything. */
+/* This is equivalent to stabilize_reference in GCC's tree.c, but we know how
+ to handle our new nodes and we take extra arguments:
+
+ FORCE says whether to force evaluation of everything,
+
+ SUCCESS we set to true unless we walk through something we don't know how
+ to stabilize, or through something which is not an lvalue and LVALUES_ONLY
+ is true, in which cases we set to false. */
tree
-gnat_stabilize_reference (tree ref, bool force)
+maybe_stabilize_reference (tree ref, bool force, bool lvalues_only,
+ bool *success)
{
tree type = TREE_TYPE (ref);
enum tree_code code = TREE_CODE (ref);
tree result;
+ /* Assume we'll success unless proven otherwise. */
+ *success = true;
+
switch (code)
{
case VAR_DECL:
@@ -5728,6 +5814,15 @@ gnat_stabilize_reference (tree ref, bool force)
/* No action is needed in this case. */
return ref;
+ case ADDR_EXPR:
+ /* A standalone ADDR_EXPR is never an lvalue, and this one can't
+ be nested inside an outer INDIRECT_REF, since INDIREC_REF goes
+ straight to stabilize_1. */
+ if (lvalues_only)
+ goto failure;
+
+ /* ... Fallthru ... */
+
case NOP_EXPR:
case CONVERT_EXPR:
case FLOAT_EXPR:
@@ -5736,10 +5831,10 @@ gnat_stabilize_reference (tree ref, bool force)
case FIX_ROUND_EXPR:
case FIX_CEIL_EXPR:
case VIEW_CONVERT_EXPR:
- case ADDR_EXPR:
result
= build1 (code, type,
- gnat_stabilize_reference (TREE_OPERAND (ref, 0), force));
+ maybe_stabilize_reference (TREE_OPERAND (ref, 0), force,
+ lvalues_only, success));
break;
case INDIRECT_REF:
@@ -5750,15 +5845,16 @@ gnat_stabilize_reference (tree ref, bool force)
break;
case COMPONENT_REF:
- result = build3 (COMPONENT_REF, type,
- gnat_stabilize_reference (TREE_OPERAND (ref, 0),
- force),
- TREE_OPERAND (ref, 1), NULL_TREE);
+ result = build3 (COMPONENT_REF, type,
+ maybe_stabilize_reference (TREE_OPERAND (ref, 0), force,
+ lvalues_only, success),
+ TREE_OPERAND (ref, 1), NULL_TREE);
break;
case BIT_FIELD_REF:
result = build3 (BIT_FIELD_REF, type,
- gnat_stabilize_reference (TREE_OPERAND (ref, 0), force),
+ maybe_stabilize_reference (TREE_OPERAND (ref, 0), force,
+ lvalues_only, success),
gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1),
force),
gnat_stabilize_reference_1 (TREE_OPERAND (ref, 2),
@@ -5768,7 +5864,8 @@ gnat_stabilize_reference (tree ref, bool force)
case ARRAY_REF:
case ARRAY_RANGE_REF:
result = build4 (code, type,
- gnat_stabilize_reference (TREE_OPERAND (ref, 0), force),
+ maybe_stabilize_reference (TREE_OPERAND (ref, 0), force,
+ lvalues_only, success),
gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1),
force),
NULL_TREE, NULL_TREE);
@@ -5778,17 +5875,21 @@ gnat_stabilize_reference (tree ref, bool force)
result = build2 (COMPOUND_EXPR, type,
gnat_stabilize_reference_1 (TREE_OPERAND (ref, 0),
force),
- gnat_stabilize_reference (TREE_OPERAND (ref, 1),
- force));
+ maybe_stabilize_reference (TREE_OPERAND (ref, 1), force,
+ lvalues_only, success));
break;
+ case ERROR_MARK:
+ ref = error_mark_node;
+
+ /* ... Fallthru to failure ... */
+
/* If arg isn't a kind of lvalue we recognize, make no change.
Caller should recognize the error for an invalid lvalue. */
default:
+ failure:
+ *success = false;
return ref;
-
- case ERROR_MARK:
- return error_mark_node;
}
TREE_READONLY (result) = TREE_READONLY (ref);
@@ -5808,6 +5909,17 @@ gnat_stabilize_reference (tree ref, bool force)
return result;
}
+/* Wrapper around maybe_stabilize_reference, for common uses without
+ lvalue restrictions and without need to examine the success
+ indication. */
+
+tree
+gnat_stabilize_reference (tree ref, bool force)
+{
+ bool stabilized;
+ return maybe_stabilize_reference (ref, force, false, &stabilized);
+}
+
/* Similar to stabilize_reference_1 in tree.c, but supports an extra
arg to force a SAVE_EXPR for everything. */
diff --git a/gcc/ada/tree_io.ads b/gcc/ada/tree_io.ads
index 98bdc89d580..2cd203717e3 100644
--- a/gcc/ada/tree_io.ads
+++ b/gcc/ada/tree_io.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-1999 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -96,7 +96,7 @@ package Tree_IO is
-- Writes a single integer value to the current tree file
procedure Tree_Write_Str (S : String_Ptr);
- -- Write out string value referenced by S. Low bound must be 1.
+ -- Write out string value referenced by S (low bound of S must be 1)
procedure Tree_Write_Terminate;
-- Terminates writing of the file (flushing the buffer), but does not
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb
index 5066bbaf36c..aff72a9b95e 100644
--- a/gcc/ada/treepr.adb
+++ b/gcc/ada/treepr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/treeprs.adt b/gcc/ada/treeprs.adt
index 86dd72a7b72..fbffd5830e2 100644
--- a/gcc/ada/treeprs.adt
+++ b/gcc/ada/treeprs.adt
@@ -6,7 +6,7 @@
-- --
-- T e m p l a t e --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/ttypef.ads b/gcc/ada/ttypef.ads
index 18c5e323629..93f7ec8a4ff 100644
--- a/gcc/ada/ttypef.ads
+++ b/gcc/ada/ttypef.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/ttypes.ads b/gcc/ada/ttypes.ads
index 7e0dd547522..4eb8c82ba6f 100644
--- a/gcc/ada/ttypes.ads
+++ b/gcc/ada/ttypes.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -143,7 +143,7 @@ package Ttypes is
Standard_Wide_Character_Size : constant Pos := 16;
Standard_Wide_Wide_Character_Size : constant Pos := 32;
- -- Standard wide character sizes.
+ -- Standard wide character sizes
-- Note: there is no specific control over the representation of
-- enumeration types. The convention used is that if an enumeration
diff --git a/gcc/ada/types.adb b/gcc/ada/types.adb
index e6d5f3e3cf0..978b4121fa0 100644
--- a/gcc/ada/types.adb
+++ b/gcc/ada/types.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
index ea8a949afb2..2367a91c2ff 100644
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -311,14 +311,14 @@ package Types is
-- is in practice infinite and there is no need to check the range.
Ureal_Low_Bound : constant := 500_000_000;
- -- Low bound for Ureal values.
+ -- Low bound for Ureal values
Ureal_High_Bound : constant := 599_999_999;
-- Maximum number of Ureal values stored is 100_000_000 which is in
-- practice infinite so that no check is required.
Uint_Low_Bound : constant := 600_000_000;
- -- Low bound for Uint values.
+ -- Low bound for Uint values
Uint_Table_Start : constant := 2_000_000_000;
-- Location where table entries for universal integers start (see
@@ -479,7 +479,7 @@ package Types is
-- are not valid.
First_Elist_Id : constant Elist_Id := No_Elist + 1;
- -- Subscript of first allocated Elist header.
+ -- Subscript of first allocated Elist header
-- Element Id values are used to identify individual elements of an
-- element list (see package Elists for further details).
@@ -696,12 +696,19 @@ package Types is
Tag_Check,
All_Checks);
- -- The following record contains an entry for each recognized check name
+ -- The following array contains an entry for each recognized check name
-- for pragma Suppress. It is used to represent current settings of scope
-- based suppress actions from pragma Suppress or command line settings.
- type Suppress_Array is
- array (Check_Id range Access_Check .. Tag_Check) of Boolean;
+ -- Note: when Suppress_Array (All_Checks) is True, then generally all other
+ -- specific check entries are set True, except for the Elaboration_Check
+ -- entry which is set only if an explicit Suppress for this check is given.
+ -- The reason for this non-uniformity is that we do not want All_Checks to
+ -- suppress elaboration checking when using the static elaboration model.
+ -- We recognize only an explicit suppress of Elaboration_Check as a signal
+ -- that the static elaboration checking should skip a compile time check.
+
+ type Suppress_Array is array (Check_Id) of Boolean;
pragma Pack (Suppress_Array);
-- To add a new check type to GNAT, the following steps are required:
diff --git a/gcc/ada/ug_words b/gcc/ada/ug_words
index 8203ee546c1..18fa05f1f0b 100644
--- a/gcc/ada/ug_words
+++ b/gcc/ada/ug_words
@@ -153,6 +153,8 @@ gcc -c ^ GNAT COMPILE
-gnatzc ^ /DISTRIBUTION_STUBS=CALLER
-gnatzr ^ /DISTRIBUTION_STUBS=RECEIVER
-gnat83 ^ /83
+-gnat95 ^ /95
+-gnat05 ^ /05
-gnatx ^ /XREF=SUPPRESS
-gnatX ^ /EXTENSIONS_ALLOWED
--RTS ^ /RUNTIME_SYSTEM
diff --git a/gcc/ada/uintp.adb b/gcc/ada/uintp.adb
index 6eda7ad512b..c9fbb03e675 100644
--- a/gcc/ada/uintp.adb
+++ b/gcc/ada/uintp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -50,7 +50,7 @@ package body Uintp is
-- value, since the issue is host representation of integer values.
Uint_Int_Last : Uint;
- -- Uint value containing Int'Last value set by Initialize.
+ -- Uint value containing Int'Last value set by Initialize
UI_Power_2 : array (Int range 0 .. 64) of Uint;
-- This table is used to memoize exponentiations by powers of 2. The Nth
@@ -727,9 +727,9 @@ package body Uintp is
-- Mathematically: assume base congruent to 1 and compute an equivelent
-- integer to Left.
- -- If Sign = -1 return the alternating sum of the "digits".
+ -- If Sign = -1 return the alternating sum of the "digits"
- -- D1 - D2 + D3 - D4 + D5 . . .
+ -- D1 - D2 + D3 - D4 + D5 ...
-- (where D1 is Least Significant Digit)
@@ -761,7 +761,7 @@ package body Uintp is
if Tmp_Int >= Base then
- -- Sign must be 1.
+ -- Sign must be 1
Tmp_Int := (Tmp_Int / Base) + 1;
@@ -1328,7 +1328,7 @@ package body Uintp is
Carry := Tmp_Int / Base;
end loop;
- -- Multiply Divisor by d.
+ -- Multiply Divisor by d
Carry := 0;
for J in reverse Divisor'Range loop
@@ -1338,14 +1338,14 @@ package body Uintp is
end loop;
end if;
- -- Main loop of long division algorithm.
+ -- Main loop of long division algorithm
Divisor_Dig1 := Divisor (1);
Divisor_Dig2 := Divisor (2);
for J in Quotient'Range loop
- -- [ CALCULATE Q (hat) ] (step D3 in the algorithm).
+ -- [ CALCULATE Q (hat) ] (step D3 in the algorithm)
Tmp_Int := Dividend (J) * Base + Dividend (J + 1);
@@ -1474,7 +1474,7 @@ package body Uintp is
if Right = Uint_0 then
return Uint_1;
- -- 0 to any positive power is 0.
+ -- 0 to any positive power is 0
elsif Left = Uint_0 then
return Uint_0;
@@ -1664,7 +1664,7 @@ package body Uintp is
-- UI_GCD --
------------
- -- Lehmer's algorithm for GCD.
+ -- Lehmer's algorithm for GCD
-- The idea is to avoid using multiple precision arithmetic wherever
-- possible, substituting Int arithmetic instead. See Knuth volume II,
@@ -1712,7 +1712,7 @@ package body Uintp is
loop
-- We might overflow and get division by zero here. This just
- -- means we can not take the single precision step
+ -- means we cannot take the single precision step
Den1 := V_Hat + C;
Den2 := V_Hat + D;
@@ -1745,14 +1745,14 @@ package body Uintp is
if B = Int_0 then
- -- No single precision steps take a regular Euclid step.
+ -- No single precision steps take a regular Euclid step
Tmp_UI := U rem V;
U := V;
V := Tmp_UI;
else
- -- Use prior single precision steps to compute this Euclid step.
+ -- Use prior single precision steps to compute this Euclid step
-- Fixed bug 1415-008 spends 80% of its time working on this
-- step. Perhaps we need a special case Int / Uint dot
@@ -2257,7 +2257,7 @@ package body Uintp is
-- and replace the rem with simpler operations where
-- possible.
- -- Least_Sig_Digit might return Negative numbers.
+ -- Least_Sig_Digit might return Negative numbers
when 2 =>
return UI_From_Int (
@@ -2357,7 +2357,7 @@ package body Uintp is
end if;
- -- Else fall through to general case.
+ -- Else fall through to general case
-- ???This needs to be improved. We have the Rem when we do the
-- Div. Div throws it away!
diff --git a/gcc/ada/uintp.ads b/gcc/ada/uintp.ads
index 5a340b39968..46286611e78 100644
--- a/gcc/ada/uintp.ads
+++ b/gcc/ada/uintp.ads
@@ -113,12 +113,12 @@ package Uintp is
function UI_Abs (Right : Uint) return Uint;
pragma Inline (UI_Abs);
- -- Returns abs function of universal integer.
+ -- Returns abs function of universal integer
function UI_Add (Left : Uint; Right : Uint) return Uint;
function UI_Add (Left : Int; Right : Uint) return Uint;
function UI_Add (Left : Uint; Right : Int) return Uint;
- -- Returns sum of two integer values.
+ -- Returns sum of two integer values
function UI_Decimal_Digits_Hi (U : Uint) return Nat;
-- Returns an estimate of the number of decimal digits required to
@@ -143,44 +143,44 @@ package Uintp is
function UI_Eq (Left : Int; Right : Uint) return Boolean;
function UI_Eq (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Eq);
- -- Compares integer values for equality.
+ -- Compares integer values for equality
function UI_Expon (Left : Uint; Right : Uint) return Uint;
function UI_Expon (Left : Int; Right : Uint) return Uint;
function UI_Expon (Left : Uint; Right : Int) return Uint;
function UI_Expon (Left : Int; Right : Int) return Uint;
- -- Returns result of exponentiating two integer values
+ -- Returns result of exponentiating two integer values.
-- Fatal error if Right is negative.
function UI_GCD (Uin, Vin : Uint) return Uint;
- -- Computes GCD of input values. Assumes Uin >= Vin >= 0.
+ -- Computes GCD of input values. Assumes Uin >= Vin >= 0
function UI_Ge (Left : Uint; Right : Uint) return Boolean;
function UI_Ge (Left : Int; Right : Uint) return Boolean;
function UI_Ge (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Ge);
- -- Compares integer values for greater than or equal.
+ -- Compares integer values for greater than or equal
function UI_Gt (Left : Uint; Right : Uint) return Boolean;
function UI_Gt (Left : Int; Right : Uint) return Boolean;
function UI_Gt (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Gt);
- -- Compares integer values for greater than.
+ -- Compares integer values for greater than
function UI_Is_In_Int_Range (Input : Uint) return Boolean;
pragma Inline (UI_Is_In_Int_Range);
- -- Determines if universal integer is in Int range.
+ -- Determines if universal integer is in Int range
function UI_Le (Left : Uint; Right : Uint) return Boolean;
function UI_Le (Left : Int; Right : Uint) return Boolean;
function UI_Le (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Le);
- -- Compares integer values for less than or equal.
+ -- Compares integer values for less than or equal
function UI_Lt (Left : Uint; Right : Uint) return Boolean;
function UI_Lt (Left : Int; Right : Uint) return Boolean;
function UI_Lt (Left : Uint; Right : Int) return Boolean;
- -- Compares integer values for less than.
+ -- Compares integer values for less than
function UI_Max (Left : Uint; Right : Uint) return Uint;
function UI_Max (Left : Int; Right : Uint) return Uint;
@@ -190,13 +190,13 @@ package Uintp is
function UI_Min (Left : Uint; Right : Uint) return Uint;
function UI_Min (Left : Int; Right : Uint) return Uint;
function UI_Min (Left : Uint; Right : Int) return Uint;
- -- Returns minimum of two integer values.
+ -- Returns minimum of two integer values
function UI_Mod (Left : Uint; Right : Uint) return Uint;
function UI_Mod (Left : Int; Right : Uint) return Uint;
function UI_Mod (Left : Uint; Right : Int) return Uint;
pragma Inline (UI_Mod);
- -- Returns mod function of two integer values.
+ -- Returns mod function of two integer values
function UI_Mul (Left : Uint; Right : Uint) return Uint;
function UI_Mul (Left : Int; Right : Uint) return Uint;
@@ -207,16 +207,16 @@ package Uintp is
function UI_Ne (Left : Int; Right : Uint) return Boolean;
function UI_Ne (Left : Uint; Right : Int) return Boolean;
pragma Inline (UI_Ne);
- -- Compares integer values for inequality.
+ -- Compares integer values for inequality
function UI_Negate (Right : Uint) return Uint;
pragma Inline (UI_Negate);
- -- Returns negative of universal integer.
+ -- Returns negative of universal integer
function UI_Rem (Left : Uint; Right : Uint) return Uint;
function UI_Rem (Left : Int; Right : Uint) return Uint;
function UI_Rem (Left : Uint; Right : Int) return Uint;
- -- Returns rem of two integer values.
+ -- Returns rem of two integer values
function UI_Sub (Left : Uint; Right : Uint) return Uint;
function UI_Sub (Left : Int; Right : Uint) return Uint;
diff --git a/gcc/ada/uname.ads b/gcc/ada/uname.ads
index 0b988618f08..bf2ed3ab99a 100644
--- a/gcc/ada/uname.ads
+++ b/gcc/ada/uname.ads
@@ -74,7 +74,7 @@ package Uname is
-- corresponding body, i.e. characters %s replaced by %b
function Get_Parent_Body_Name (N : Unit_Name_Type) return Unit_Name_Type;
- -- Given the name of a subunit, returns the name of the parent body.
+ -- Given the name of a subunit, returns the name of the parent body
function Get_Parent_Spec_Name (N : Unit_Name_Type) return Unit_Name_Type;
-- Given the name of a child unit spec or body, returns the unit name
diff --git a/gcc/ada/urealp.ads b/gcc/ada/urealp.ads
index a9cbccd23b5..24902393829 100644
--- a/gcc/ada/urealp.ads
+++ b/gcc/ada/urealp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -148,19 +148,19 @@ package Urealp is
-- Table.Tree_Write routines.
function Rbase (Real : Ureal) return Nat;
- -- Return the base of the universal real.
+ -- Return the base of the universal real
function Denominator (Real : Ureal) return Uint;
- -- Return the denominator of the universal real.
+ -- Return the denominator of the universal real
function Numerator (Real : Ureal) return Uint;
- -- Return the numerator of the universal real.
+ -- Return the numerator of the universal real
function Norm_Den (Real : Ureal) return Uint;
- -- Return the denominator of the universal real after a normalization.
+ -- Return the denominator of the universal real after a normalization
function Norm_Num (Real : Ureal) return Uint;
- -- Return the numerator of the universal real after a normalization.
+ -- Return the numerator of the universal real after a normalization
function UR_From_Uint (UI : Uint) return Ureal;
-- Returns real corresponding to universal integer value
@@ -234,7 +234,7 @@ package Urealp is
-- Returns negative of real
function UR_Eq (Left, Right : Ureal) return Boolean;
- -- Compares reals for equality.
+ -- Compares reals for equality
function UR_Max (Left, Right : Ureal) return Ureal;
-- Returns the maximum of two reals
@@ -243,19 +243,19 @@ package Urealp is
-- Returns the minimum of two reals
function UR_Ne (Left, Right : Ureal) return Boolean;
- -- Compares reals for inequality.
+ -- Compares reals for inequality
function UR_Lt (Left, Right : Ureal) return Boolean;
- -- Compares reals for less than.
+ -- Compares reals for less than
function UR_Le (Left, Right : Ureal) return Boolean;
- -- Compares reals for less than or equal.
+ -- Compares reals for less than or equal
function UR_Gt (Left, Right : Ureal) return Boolean;
- -- Compares reals for greater than.
+ -- Compares reals for greater than
function UR_Ge (Left, Right : Ureal) return Boolean;
- -- Compares reals for greater than or equal.
+ -- Compares reals for greater than or equal
function UR_Is_Zero (Real : Ureal) return Boolean;
-- Tests if real value is zero
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index 39f3b71f5e0..1a2d902c272 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -162,7 +162,7 @@ begin
-- Line for -gnateI switch
- Write_Switch_Char ("eInnn");
+ Write_Switch_Char ("eInn");
Write_Line ("Index in multi-unit source, e.g. -gnateI2");
-- Line for -gnatem switch
@@ -213,7 +213,7 @@ begin
-- Line for -gnatk switch
Write_Switch_Char ("k");
- Write_Line ("Limit file names to nnn characters (k = krunch)");
+ Write_Line ("Limit file names to nn characters (k = krunch)");
-- Line for -gnatl switch
@@ -222,8 +222,8 @@ begin
-- Line for -gnatm switch
- Write_Switch_Char ("mnnn");
- Write_Line ("Limit number of detected errors to nnn (1-999999)");
+ Write_Switch_Char ("mnn");
+ Write_Line ("Limit number of detected errors to nn (1-999999)");
-- Line for -gnatn switch
@@ -289,8 +289,8 @@ begin
-- Line for -gnatT switch
- Write_Switch_Char ("Tnnn");
- Write_Line ("All compiler tables start at nnn times usual starting size");
+ Write_Switch_Char ("Tnn");
+ Write_Line ("All compiler tables start at nn times usual starting size");
-- Line for -gnatu switch
@@ -438,10 +438,10 @@ begin
Write_Line (" i check if-then layout");
Write_Line (" k check casing rules for keywords");
Write_Line (" l check reference manual layout");
- Write_Line (" Lnnn check max nest level < nnn");
+ Write_Line (" Lnn check max nest level < nn ");
Write_Line (" m check line length <= 79 characters");
Write_Line (" n check casing of package Standard identifiers");
- Write_Line (" Mnnn check line length <= nnn characters");
+ Write_Line (" Mnn check line length <= nn characters");
Write_Line (" o check subprogram bodies in alphabetical order");
Write_Line (" p check pragma casing");
Write_Line (" r check casing for identifier references");
diff --git a/gcc/ada/usage.ads b/gcc/ada/usage.ads
index 4aba2132bcd..d60fdffb0be 100644
--- a/gcc/ada/usage.ads
+++ b/gcc/ada/usage.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index 1bf00075e54..2bfafce9b51 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -324,7 +324,13 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
if (global_bindings_p () && TREE_CODE (decl) != PARM_DECL)
DECL_CONTEXT (decl) = 0;
else
- DECL_CONTEXT (decl) = current_function_decl;
+ {
+ DECL_CONTEXT (decl) = current_function_decl;
+
+ /* Functions imported in another function are not really nested. */
+ if (TREE_CODE (decl) == FUNCTION_DECL && TREE_PUBLIC (decl))
+ DECL_NO_STATIC_CHAIN (decl) = 1;
+ }
TREE_NO_WARNING (decl) = (gnat_node == Empty || Warnings_Off (gnat_node));
@@ -1277,6 +1283,12 @@ create_var_decl (tree var_name, tree asm_name, tree type, tree var_init,
|| (type_annotate_only && var_init && !TREE_CONSTANT (var_init)))
var_init = NULL_TREE;
+ /* At the global level, an initializer requiring code to be generated
+ produces elaboration statements. Check that such statements are allowed,
+ that is, not violating a No_Elaboration_Code restriction. */
+ if (global_bindings_p () && var_init != 0 && ! init_const)
+ Check_Elaboration_Code_Allowed (gnat_node);
+
/* Ada doesn't feature Fortran-like COMMON variables so we shouldn't
try to fiddle with DECL_COMMON. However, on platforms that don't
support global BSS sections, uninitialized global variables would
@@ -1313,6 +1325,10 @@ create_var_decl (tree var_name, tree asm_name, tree type, tree var_init,
if (TREE_CODE (var_decl) != CONST_DECL)
rest_of_decl_compilation (var_decl, global_bindings_p (), 0);
+ else
+ /* expand CONST_DECLs to set their MODE, ALIGN, SIZE and SIZE_UNIT,
+ which we need for later back-annotations. */
+ expand_decl (var_decl);
return var_decl;
}
@@ -1607,7 +1623,7 @@ potential_alignment_gap (tree prev_field, tree curr_field, tree offset)
% DECL_ALIGN (curr_field) != 0);
/* If both the position and size of the previous field are multiples
- of the current field alignment, there can not be any gap. */
+ of the current field alignment, there cannot be any gap. */
if (value_factor_p (bit_position (prev_field), DECL_ALIGN (curr_field))
&& value_factor_p (DECL_SIZE (prev_field), DECL_ALIGN (curr_field)))
return false;
@@ -2444,6 +2460,22 @@ build_unc_object_type (tree template_type, tree object_type, tree name)
return type;
}
+
+/* Same, taking a thin or fat pointer type instead of a template type. */
+
+tree
+build_unc_object_type_from_ptr (tree thin_fat_ptr_type, tree object_type, tree name)
+{
+ tree template_type;
+
+ gcc_assert (TYPE_FAT_OR_THIN_POINTER_P (thin_fat_ptr_type));
+
+ template_type
+ = (TYPE_FAT_POINTER_P (thin_fat_ptr_type)
+ ? TREE_TYPE (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (thin_fat_ptr_type))))
+ : TREE_TYPE (TYPE_FIELDS (TREE_TYPE (thin_fat_ptr_type))));
+ return build_unc_object_type (template_type, object_type, name);
+}
/* Update anything previously pointing to OLD_TYPE to point to NEW_TYPE. In
the normal case this is just two adjustments, but we have more to do
@@ -2755,11 +2787,15 @@ convert (tree type, tree expr)
expr)),
TYPE_MIN_VALUE (etype))));
- /* If the input is a justified modular type, we need to extract
- the actual object before converting it to any other type with the
- exception of an unconstrained array. */
+ /* If the input is a justified modular type, we need to extract the actual
+ object before converting it to any other type with the exceptions of an
+ unconstrained array or of a mere type variant. It is useful to avoid the
+ extraction and conversion in the type variant case because it could end
+ up replacing a VAR_DECL expr by a constructor and we might be about the
+ take the address of the result. */
if (ecode == RECORD_TYPE && TYPE_JUSTIFIED_MODULAR_P (etype)
- && code != UNCONSTRAINED_ARRAY_TYPE)
+ && code != UNCONSTRAINED_ARRAY_TYPE
+ && TYPE_MAIN_VARIANT (type) != TYPE_MAIN_VARIANT (etype))
return convert (type, build_component_ref (expr, NULL_TREE,
TYPE_FIELDS (etype), false));
@@ -2804,9 +2840,7 @@ convert (tree type, tree expr)
just make a new one in the proper type. */
if (code == ecode && AGGREGATE_TYPE_P (etype)
&& !(TREE_CODE (TYPE_SIZE (etype)) == INTEGER_CST
- && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
- && (TREE_CODE (expr) == STRING_CST
- || get_alias_set (etype) == get_alias_set (type)))
+ && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST))
{
expr = copy_node (expr);
TREE_TYPE (expr) = type;
@@ -2826,9 +2860,40 @@ convert (tree type, tree expr)
break;
case VIEW_CONVERT_EXPR:
- if (AGGREGATE_TYPE_P (type) && AGGREGATE_TYPE_P (etype)
- && !TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype))
- return convert (type, TREE_OPERAND (expr, 0));
+ {
+ /* GCC 4.x is very sensitive to type consistency overall, and view
+ conversions thus are very frequent. Eventhough just "convert"ing
+ the inner operand to the output type is fine in most cases, it
+ might expose unexpected input/output type mismatches in special
+ circumstances so we avoid such recursive calls when we can. */
+
+ tree op0 = TREE_OPERAND (expr, 0);
+
+ /* If we are converting back to the original type, we can just
+ lift the input conversion. This is a common occurence with
+ switches back-and-forth amongst type variants. */
+ if (type == TREE_TYPE (op0))
+ return op0;
+
+ /* Otherwise, if we're converting between two aggregate types, we
+ might be allowed to substitute the VIEW_CONVERT target type in
+ place or to just convert the inner expression. */
+ if (AGGREGATE_TYPE_P (type) && AGGREGATE_TYPE_P (etype))
+ {
+ /* If we are converting between type variants, we can just
+ substitute the VIEW_CONVERT in place. */
+ if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (etype))
+ return build1 (VIEW_CONVERT_EXPR, type, op0);
+
+ /* Otherwise, we may just bypass the input view conversion unless
+ one of the types is a fat pointer, or we're converting to an
+ unchecked union type. Both are handled by specialized code
+ below and the latter relies on exact type matching. */
+ else if (!TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)
+ && !(code == UNION_TYPE && TYPE_UNCHECKED_UNION_P (type)))
+ return convert (type, op0);
+ }
+ }
break;
case INDIRECT_REF:
@@ -2957,13 +3022,10 @@ convert (tree type, tree expr)
{
if (TREE_TYPE (tem) == etype)
return build1 (CONVERT_EXPR, type, expr);
-
- /* Accept slight type variations. */
- if (TREE_TYPE (tem) == TYPE_MAIN_VARIANT (etype)
- || (TREE_CODE (TREE_TYPE (tem)) == RECORD_TYPE
- && (TYPE_JUSTIFIED_MODULAR_P (TREE_TYPE (tem))
- || TYPE_IS_PADDING_P (TREE_TYPE (tem)))
- && TREE_TYPE (TYPE_FIELDS (TREE_TYPE (tem))) == etype))
+ else if (TREE_CODE (TREE_TYPE (tem)) == RECORD_TYPE
+ && (TYPE_JUSTIFIED_MODULAR_P (TREE_TYPE (tem))
+ || TYPE_IS_PADDING_P (TREE_TYPE (tem)))
+ && TREE_TYPE (TYPE_FIELDS (TREE_TYPE (tem))) == etype)
return build1 (CONVERT_EXPR, type,
convert (TREE_TYPE (tem), expr));
}
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index 21a3f61f761..24937449cc1 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -170,7 +170,7 @@ known_alignment (tree exp)
case NON_LVALUE_EXPR:
/* Conversions between pointers and integers don't change the alignment
of the underlying object. */
- this_alignment = known_alignment (TREE_OPERAND (exp, 0));
+ this_alignment = known_alignment (TREE_OPERAND (exp, 0));
break;
case PLUS_EXPR:
@@ -656,40 +656,6 @@ build_binary_op (enum tree_code op_code, tree result_type,
if (!operation_type)
operation_type = left_type;
- /* If the RHS has a conversion between record and array types and
- an inner type is no worse, use it. Note we cannot do this for
- modular types or types with TYPE_ALIGN_OK, since the latter
- might indicate a conversion between a root type and a class-wide
- type, which we must not remove. */
- while (TREE_CODE (right_operand) == VIEW_CONVERT_EXPR
- && (((TREE_CODE (right_type) == RECORD_TYPE
- || TREE_CODE (right_type) == UNION_TYPE)
- && !TYPE_JUSTIFIED_MODULAR_P (right_type)
- && !TYPE_ALIGN_OK (right_type)
- && !TYPE_IS_FAT_POINTER_P (right_type))
- || TREE_CODE (right_type) == ARRAY_TYPE)
- && ((((TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0)))
- == RECORD_TYPE)
- || (TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0)))
- == UNION_TYPE))
- && !(TYPE_JUSTIFIED_MODULAR_P
- (TREE_TYPE (TREE_OPERAND (right_operand, 0))))
- && !(TYPE_ALIGN_OK
- (TREE_TYPE (TREE_OPERAND (right_operand, 0))))
- && !(TYPE_IS_FAT_POINTER_P
- (TREE_TYPE (TREE_OPERAND (right_operand, 0)))))
- || (TREE_CODE (TREE_TYPE (TREE_OPERAND (right_operand, 0)))
- == ARRAY_TYPE))
- && (0 == (best_type
- = find_common_type (right_type,
- TREE_TYPE (TREE_OPERAND
- (right_operand, 0))))
- || right_type != best_type))
- {
- right_operand = TREE_OPERAND (right_operand, 0);
- right_type = TREE_TYPE (right_operand);
- }
-
/* If we are copying one array or record to another, find the best type
to use. */
if (((TREE_CODE (left_type) == ARRAY_TYPE
@@ -1159,12 +1125,18 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
return build_unary_op (ADDR_EXPR, result_type,
TREE_OPERAND (operand, 0));
- /* If this NOP_EXPR doesn't change the mode, get the result type
- from this type and go down. We need to do this in case
- this is a conversion of a CONST_DECL. */
- if (TYPE_MODE (type) != BLKmode
- && (TYPE_MODE (type)
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (operand, 0)))))
+ /* ... fallthru ... */
+
+ case VIEW_CONVERT_EXPR:
+ /* If this just a variant conversion or if the conversion doesn't
+ change the mode, get the result type from this type and go down.
+ This is needed for conversions of CONST_DECLs, to eventually get
+ to the address of their CORRESPONDING_VARs. */
+ if ((TYPE_MAIN_VARIANT (type)
+ == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (operand, 0))))
+ || (TYPE_MODE (type) != BLKmode
+ && (TYPE_MODE (type)
+ == TYPE_MODE (TREE_TYPE (TREE_OPERAND (operand, 0))))))
return build_unary_op (ADDR_EXPR,
(result_type ? result_type
: build_pointer_type (type)),
@@ -1409,7 +1381,7 @@ build_return_expr (tree result_decl, tree ret_val)
build_binary_op with the additional guarantee that the type
cannot involve a placeholder, since otherwise the function
would use the "target pointer" return mechanism. */
-
+
if (operation_type != TREE_TYPE (ret_val))
ret_val = convert (operation_type, ret_val);
@@ -1493,17 +1465,41 @@ build_call_raise (int msg)
build_int_cst (NULL_TREE, input_line));
}
+/* qsort comparer for the bit positions of two constructor elements
+ for record components. */
+
+static int
+compare_elmt_bitpos (const PTR rt1, const PTR rt2)
+{
+ tree elmt1 = * (tree *) rt1;
+ tree elmt2 = * (tree *) rt2;
+
+ tree pos_field1 = bit_position (TREE_PURPOSE (elmt1));
+ tree pos_field2 = bit_position (TREE_PURPOSE (elmt2));
+
+ if (tree_int_cst_equal (pos_field1, pos_field2))
+ return 0;
+ else if (tree_int_cst_lt (pos_field1, pos_field2))
+ return -1;
+ else
+ return 1;
+}
+
/* Return a CONSTRUCTOR of TYPE whose list is LIST. */
tree
gnat_build_constructor (tree type, tree list)
{
tree elmt;
+ int n_elmts;
bool allconstant = (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST);
bool side_effects = false;
tree result;
- for (elmt = list; elmt; elmt = TREE_CHAIN (elmt))
+ /* Scan the elements to see if they are all constant or if any has side
+ effects, to let us set global flags on the resulting constructor. Count
+ the elements along the way for possible sorting purposes below. */
+ for (n_elmts = 0, elmt = list; elmt; elmt = TREE_CHAIN (elmt), n_elmts ++)
{
if (!TREE_CONSTANT (TREE_VALUE (elmt))
|| (TREE_CODE (type) == RECORD_TYPE
@@ -1525,26 +1521,30 @@ gnat_build_constructor (tree type, tree list)
return build1 (NULL_EXPR, type, TREE_OPERAND (result, 0));
}
- /* If TYPE is a RECORD_TYPE and the fields are not in the
- same order as their bit position, don't treat this as constant
- since varasm.c can't handle it. */
- if (allconstant && TREE_CODE (type) == RECORD_TYPE)
+ /* For record types with constant components only, sort field list
+ by increasing bit position. This is necessary to ensure the
+ constructor can be output as static data, which the gimplifier
+ might force in various circumstances. */
+ if (allconstant && TREE_CODE (type) == RECORD_TYPE && n_elmts > 1)
{
- tree last_pos = bitsize_zero_node;
- tree field;
+ /* Fill an array with an element tree per index, and ask qsort to order
+ them according to what a bitpos comparison function says. */
- for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
- {
- tree this_pos = bit_position (field);
+ tree *gnu_arr = (tree *) alloca (sizeof (tree) * n_elmts);
+ int i;
- if (TREE_CODE (this_pos) != INTEGER_CST
- || tree_int_cst_lt (this_pos, last_pos))
- {
- allconstant = false;
- break;
- }
+ for (i = 0, elmt = list; elmt; elmt = TREE_CHAIN (elmt), i++)
+ gnu_arr[i] = elmt;
+
+ qsort (gnu_arr, n_elmts, sizeof (tree), compare_elmt_bitpos);
- last_pos = this_pos;
+ /* Then reconstruct the list from the sorted array contents. */
+
+ list = NULL_TREE;
+ for (i = n_elmts - 1; i >= 0; i--)
+ {
+ TREE_CHAIN (gnu_arr[i]) = list;
+ list = gnu_arr[i];
}
}
@@ -1821,13 +1821,10 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
fill in the parts that are known. */
else if (TYPE_FAT_OR_THIN_POINTER_P (result_type))
{
- tree template_type
- = (TYPE_FAT_POINTER_P (result_type)
- ? TREE_TYPE (TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (result_type))))
- : TREE_TYPE (TYPE_FIELDS (TREE_TYPE (result_type))));
tree storage_type
- = build_unc_object_type (template_type, type,
- get_identifier ("ALLOC"));
+ = build_unc_object_type_from_ptr (result_type, type,
+ get_identifier ("ALLOC"));
+ tree template_type = TREE_TYPE (TYPE_FIELDS (storage_type));
tree storage_ptr_type = build_pointer_type (storage_type);
tree storage;
tree template_cons = NULL_TREE;
diff --git a/gcc/ada/validsw.ads b/gcc/ada/validsw.ads
index 38214fa8b03..a2d0a189b38 100644
--- a/gcc/ada/validsw.ads
+++ b/gcc/ada/validsw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2003 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -48,11 +48,12 @@ package Validsw is
-- expressions in object declarations are checked for validity.
Validity_Check_Default : Boolean := True;
- -- Controls default (reference manual) validity checking. If this switch
- -- is set to True using -gnatVd or a 'd' in the argument of a Validity_
- -- Checks pragma then left side subscripts and case statement arguments
- -- are checked for validity. This switch is also set by default if no
- -- -gnatV switch is used and no Validity_Checks pragma is processed.
+ -- Controls default (reference manual) validity checking. If this switch is
+ -- set to True using -gnatVd or a 'd' in the argument of a Validity_ Checks
+ -- pragma (or the initial default value is used, set True), then left side
+ -- subscripts and case statement arguments are checked for validity. This
+ -- switch is also set by default if no -gnatV switch is used and no
+ -- Validity_Checks pragma is processed.
Validity_Check_Floating_Point : Boolean := False;
-- Normally validity checking applies only to discrete values (integer
diff --git a/gcc/ada/vms_conv.adb b/gcc/ada/vms_conv.adb
index 250e00e9d16..2157731bdf4 100644
--- a/gcc/ada/vms_conv.adb
+++ b/gcc/ada/vms_conv.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -651,7 +651,7 @@ package body VMS_Conv is
begin
Put ("GNAT ");
Put_Line (Gnatvsn.Gnat_Version_String);
- Put_Line ("Copyright 1996-2005 Free Software Foundation, Inc.");
+ Put_Line ("Copyright 1996-2005, Free Software Foundation, Inc.");
end Output_Version;
-----------
diff --git a/gcc/ada/vms_conv.ads b/gcc/ada/vms_conv.ads
index cb59ff9bb7c..1989381f5a2 100644
--- a/gcc/ada/vms_conv.ads
+++ b/gcc/ada/vms_conv.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads
index c3678f46c00..9f37b20683c 100644
--- a/gcc/ada/vms_data.ads
+++ b/gcc/ada/vms_data.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1996-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1996-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -3760,6 +3760,14 @@ package VMS_Data is
-- /VERBOSE), then error lines start with the full path name of the
-- project file, rather than its simple file name.
+ S_Make_Hi_Verb : aliased constant S := "/HIGH_VERBOSITY " &
+ "-vh";
+ -- /NOHIGH_VERBOSITY (D)
+ -- /HIGH_VERBOSITY
+ --
+ -- Displays the reason for all recompilations GNAT MAKE decides are
+ -- necessary, in high verbosity. Equivalent to /VERBOSE.
+
S_Make_Inplace : aliased constant S := "/IN_PLACE " &
"-i";
-- /NOIN_PLACE (D)
@@ -3798,6 +3806,15 @@ package VMS_Data is
-- /COMPILER_QUALIFIERS, /BINDER_QUALIFIERS and /MAKE_QUALIFIERS will be
-- passed to any GNAT LINK commands generated by GNAT LINK.
+ S_Make_Low_Verb : aliased constant S := "/LOW_VERBOSITY " &
+ "-vl";
+ -- /NOLOW_VERBOSITY (D)
+ -- /LOW_VERBOSITY
+ --
+ -- Displays the reason for all recompilations GNAT MAKE decides are
+ -- necessary, in low verbosity, that is with less output than
+ -- /MEDIUM_VERBOSITY, /HIGH_VERBOSITY or /VERBOSE.
+
S_Make_Make : aliased constant S := "/MAKE_QUALIFIERS=?" &
"-margs MAKE";
-- /MAKE_QUALIFIERS
@@ -3822,6 +3839,15 @@ package VMS_Data is
-- the mapping file. This will improve the source search during the next
-- invocations of the compiler
+ S_Make_Med_Verb : aliased constant S := "/MEDIUM_VERBOSITY " &
+ "-vm";
+ -- /NOMEDIUM_VERBOSITY (D)
+ -- /MEDIUM_VERBOSITY
+ --
+ -- Displays the reason for all recompilations GNAT MAKE decides are
+ -- necessary, in medium verbosity, that is with potentially less output
+ -- than /HIGH_VERBOSITY or /VERBOSE.
+
S_Make_Mess : aliased constant S := "/MESSAGES_PROJECT_FILE=" &
"DEFAULT " &
"-vP0 " &
@@ -4017,12 +4043,15 @@ package VMS_Data is
S_Make_Ext 'Access,
S_Make_Force 'Access,
S_Make_Full 'Access,
+ S_Make_Hi_Verb 'Access,
S_Make_Inplace 'Access,
S_Make_Index 'Access,
S_Make_Library 'Access,
S_Make_Link 'Access,
+ S_Make_Low_Verb'Access,
S_Make_Make 'Access,
S_Make_Mapping 'Access,
+ S_Make_Med_Verb'Access,
S_Make_Mess 'Access,
S_Make_Minimal 'Access,
S_Make_Nolink 'Access,
@@ -4452,6 +4481,14 @@ package VMS_Data is
-- Preprocessor lines and deleted lines are completely removed from the
-- output.
+ S_Prep_Replace : aliased constant S := "/REPLACE_IN_COMMENTS " &
+ "-C";
+ -- /NOREPLACE_IN_COMMENTS (D)
+ -- /REPLACE_IN_COMMENTS
+ --
+ -- Causes preprocessor to scan comments and perform replacements on
+ -- any $symbol occurrences within the comment text.
+
S_Prep_Symbols : aliased constant S := "/SYMBOLS " &
"-s";
-- /NOSYMBOLS (D)
@@ -4471,6 +4508,7 @@ package VMS_Data is
S_Prep_Com 'Access,
S_Prep_Ref 'Access,
S_Prep_Remove 'Access,
+ S_Prep_Replace 'Access,
S_Prep_Symbols 'Access,
S_Prep_Undef 'Access);
diff --git a/gcc/ada/vxaddr2line.adb b/gcc/ada/vxaddr2line.adb
index ad53b1024ad..ba87c9938a3 100644
--- a/gcc/ada/vxaddr2line.adb
+++ b/gcc/ada/vxaddr2line.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005 Ada Core Technologies, Inc. --
+-- Copyright (C) 2002-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -90,7 +90,7 @@ procedure VxAddr2Line is
type Arch_Record is record
Addr2line_Binary : String_Access;
- -- Name of the addr2line utility to use.
+ -- Name of the addr2line utility to use
Nm_Binary : String_Access;
-- Name of the host nm utility, which will be used to find out the
@@ -294,7 +294,7 @@ procedure VxAddr2Line is
return Value;
end;
- -- We can not get here
+ -- We cannot get here
raise Program_Error;
@@ -408,7 +408,7 @@ begin
Error ("Couldn't find " & Arch_List (Cur_Arch).Addr2line_Binary.all);
end if;
- -- The first argument specifies the image file. Check if it exists.
+ -- The first argument specifies the image file. Check if it exists
if not Is_Regular_File (Argument (1)) then
Error ("Couldn't find the executable " & Argument (1));
diff --git a/gcc/ada/widechar.adb b/gcc/ada/widechar.adb
index e1999286e49..31fedc48d11 100644
--- a/gcc/ada/widechar.adb
+++ b/gcc/ada/widechar.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/widechar.ads b/gcc/ada/widechar.ads
index cc0ab34a022..8686f81890b 100644
--- a/gcc/ada/widechar.ads
+++ b/gcc/ada/widechar.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/xeinfo.adb b/gcc/ada/xeinfo.adb
index d057e04a551..a24dff436c9 100644
--- a/gcc/ada/xeinfo.adb
+++ b/gcc/ada/xeinfo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/xgnatugn.adb b/gcc/ada/xgnatugn.adb
index 3a55df4296a..a7e90ffde98 100644
--- a/gcc/ada/xgnatugn.adb
+++ b/gcc/ada/xgnatugn.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -180,8 +180,8 @@ procedure Xgnatugn is
Target : Target_Type;
-- The Target variable is initialized using the command line
- Valid_Characters : constant Character_Set
- := To_Set (Span => (' ', '~'));
+ Valid_Characters : constant Character_Set :=
+ To_Set (Span => (' ', '~'));
-- This array controls which characters are permitted in the input
-- file (after line breaks have been removed). Valid characters
-- are all printable ASCII characters and the space character.
@@ -748,7 +748,7 @@ procedure Xgnatugn is
else
- -- Extend Seq to cover the current (known) word.
+ -- Extend Seq to cover the current (known) word
Seq.Last := Token.Span.Last;
Next_Token;
@@ -1045,7 +1045,7 @@ procedure Xgnatugn is
if (not Have_Conditional) or (Flag in Edition_Type) then
- -- The ordinary case.
+ -- The ordinary case
if not Currently_Excluding then
Put_Line (Output_File, Rewritten);
@@ -1068,7 +1068,7 @@ procedure Xgnatugn is
-- case).
procedure Add (Extension, Replacement : String);
- -- Adds an extension with a custom replacement.
+ -- Adds an extension with a custom replacement
---------
-- Add --
@@ -1294,7 +1294,7 @@ begin
begin
Target := Flag_Type'Value (Argument (1));
- if Target not in Target_Type then
+ if not Target'Valid then
Valid_Command_Line := False;
end if;
diff --git a/gcc/ada/xnmake.adb b/gcc/ada/xnmake.adb
index d221d94b22c..ec08692e275 100644
--- a/gcc/ada/xnmake.adb
+++ b/gcc/ada/xnmake.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/xr_tabls.adb b/gcc/ada/xr_tabls.adb
index 5e8cbe34a0a..b3aa017dd95 100644
--- a/gcc/ada/xr_tabls.adb
+++ b/gcc/ada/xr_tabls.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -131,7 +131,7 @@ package body Xr_Tabls is
-- Column. This key should be used for lookup in Entity_HTable
function Is_Less_Than (Decl1, Decl2 : Declaration_Reference) return Boolean;
- -- Compare two declarations. The comparison is case-insensitive.
+ -- Compare two declarations (the comparison is case-insensitive)
function Is_Less_Than (Ref1, Ref2 : Reference) return Boolean;
-- Compare two references
@@ -144,14 +144,12 @@ package body Xr_Tabls is
Get_Declaration : Boolean := False;
Arr : in out Reference_Array;
Index : in out Natural);
- -- Store in Arr, starting at Index, all the references to Decl.
- -- The Get_* parameters can be used to indicate which references should be
- -- stored.
+ -- Store in Arr, starting at Index, all the references to Decl. The Get_*
+ -- parameters can be used to indicate which references should be stored.
-- Constraint_Error will be raised if Arr is not big enough.
procedure Sort (Arr : in out Reference_Array);
- -- Sort an array of references.
- -- Arr'First must be 1.
+ -- Sort an array of references (Arr'First must be 1)
--------------
-- Set_Next --
diff --git a/gcc/ada/xr_tabls.ads b/gcc/ada/xr_tabls.ads
index be1d8d00418..d2b83353e6c 100644
--- a/gcc/ada/xr_tabls.ads
+++ b/gcc/ada/xr_tabls.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,7 @@ package Xr_Tabls is
-------------------
function ALI_File_Name (Ada_File_Name : String) return String;
- -- Returns the ali file name corresponding to Ada_File_Name.
+ -- Returns the ali file name corresponding to Ada_File_Name
procedure Create_Project_File (Name : String);
-- Open and parse a new project file. If the file Name could not be
@@ -82,14 +82,14 @@ package Xr_Tabls is
Remove_Only : Boolean := False;
Symbol_Match : Boolean := True)
return Declaration_Reference;
- -- Add a new declaration in the table and return the index to it.
- -- Decl_Type is the type of the entity Any previous instance of this
- -- entity in the htable is removed. If Remove_Only is True, then any
- -- previous instance is removed, but the new entity is never inserted.
- -- Symbol_Match should be set to False if the name of the symbol doesn't
- -- match the pattern from the command line. In that case, the entity will
- -- not be output by gnatfind. If Symbol_Match is True, the entity will only
- -- be output if the file name itself matches.
+ -- Add a new declaration in the table and return the index to it. Decl_Type
+ -- is the type of the entity Any previous instance of this entity in the
+ -- htable is removed. If Remove_Only is True, then any previous instance is
+ -- removed, but the new entity is never inserted. Symbol_Match should be
+ -- set to False if the name of the symbol doesn't match the pattern from
+ -- the command line. In that case, the entity will not be output by
+ -- gnatfind. If Symbol_Match is True, the entity will only be output if the
+ -- file name itself matches.
procedure Add_Parent
(Declaration : in out Declaration_Reference;
@@ -160,10 +160,9 @@ package Xr_Tabls is
Get_Writes : Boolean := False;
Get_Bodies : Boolean := False)
return Reference_Array_Access;
- -- Return a sorted list of all references to the entity in decl.
- -- The parameters Get_* are used to specify what kind of references
- -- should be merged and returned (read-only accesses, write accesses
- -- and bodies).
+ -- Return a sorted list of all references to the entity in decl. The
+ -- parameters Get_* are used to specify what kind of references should be
+ -- merged and returned (read-only accesses, write accesses and bodies).
function Get_Column (Decl : Declaration_Reference) return String;
function Get_Column (Ref : Reference) return String;
@@ -216,14 +215,13 @@ package Xr_Tabls is
(File : File_Reference;
With_Dir : Boolean := False;
Strip : Natural := 0) return String;
- -- Returns the file name (and its directory if With_Dir is True or the
- -- user has used the -f switch on the command line. If Strip is not 0,
- -- then the last Strip-th "-..." substrings are removed first. For
- -- instance, with Strip=2, a file name "parent-child1-child2-child3.ali"
- -- would be returned as "parent-child1.ali". This is used when looking
- -- for the ALI file to use for a package, since for separates with have
- -- to use the parent's ALI. The null string is returned if there is no
- -- such parent unit.
+ -- Returns the file name (and its directory if With_Dir is True or the user
+ -- has used the -f switch on the command line. If Strip is not 0, then the
+ -- last Strip-th "-..." substrings are removed first. For instance, with
+ -- Strip=2, a file name "parent-child1-child2-child3.ali" would be returned
+ -- as "parent-child1.ali". This is used when looking for the ALI file to
+ -- use for a package, since for separates with have to use the parent's
+ -- ALI. The null string is returned if there is no such parent unit.
--
-- Note that this version of Get_File is not inlined
@@ -240,16 +238,16 @@ package Xr_Tabls is
-- Return the source line associated with the reference
procedure Grep_Source_Files;
- -- Parse all the source files which have at least one reference,
- -- and grep the appropriate source lines so that we'll be able to
- -- display them. This function should be called once all the .ali
- -- files have been parsed, and only if the appropriate user switch
+ -- Parse all the source files which have at least one reference, and grep
+ -- the appropriate source lines so that we'll be able to display them. This
+ -- function should be called once all the .ali files have been parsed, and
+ -- only if the appropriate user switch
-- has been used (gnatfind -s).
--
- -- Note: To save memory, the strings for the source lines are shared.
- -- Thus it is no longer possible to free the references, or we would
- -- free the same chunk multiple times. It doesn't matter, though, since
- -- this is only called once, prior to exiting gnatfind.
+ -- Note: To save memory, the strings for the source lines are shared. Thus
+ -- it is no longer possible to free the references, or we would free the
+ -- same chunk multiple times. It doesn't matter, though, since this is only
+ -- called once, prior to exiting gnatfind.
function Longest_File_Name return Natural;
-- Returns the longest file name found
@@ -266,9 +264,9 @@ package Xr_Tabls is
-- by the user
function Next_Unvisited_File return File_Reference;
- -- Returns the next unvisited library file in the list
- -- If there is no more unvisited file, return Empty_File.
- -- Two calls to this subprogram will return different files.
+ -- Returns the next unvisited library file in the list If there is no more
+ -- unvisited file, return Empty_File. Two calls to this subprogram will
+ -- return different files.
procedure Set_Default_Match (Value : Boolean);
-- Set the default value for match in declarations.
@@ -276,23 +274,22 @@ package Xr_Tabls is
-- command line, then every file match
procedure Reset_Directory (File : File_Reference);
- -- Reset the cached directory for file. Next time Get_File is
- -- called, the directory willl be recomputed.
+ -- Reset the cached directory for file. Next time Get_File is called, the
+ -- directory willl be recomputed.
procedure Set_Unvisited (File_Ref : File_Reference);
- -- Set File_Ref as unvisited. So Next_Unvisited_File will return it.
+ -- Set File_Ref as unvisited. So Next_Unvisited_File will return it
procedure Read_File
(File_Name : String;
Contents : out GNAT.OS_Lib.String_Access);
- -- Reads File_Name into the newly allocated strig Contents. A
- -- Types.EOF character will be added to the returned Contents to
- -- simplify parsing. Name_Error is raised if the file was not found.
- -- End_Error is raised if the file could not be read correctly. For
- -- most systems correct reading means that the number of bytes read
- -- is equal to the file size. The exception is OpenVMS where correct
- -- reading means that the number of bytes read is less than or equal
- -- to the file size.
+ -- Reads File_Name into the newly allocated strig Contents. Types.EOF
+ -- character will be added to the returned Contents to simplify parsing.
+ -- Name_Error is raised if the file was not found. End_Error is raised if
+ -- the file could not be read correctly. For most systems correct reading
+ -- means that the number of bytes read is equal to the file size. The
+ -- exception is OpenVMS where correct reading means that the number of
+ -- bytes read is less than or equal to the file size.
private
type Project_File (Src_Dir_Length, Obj_Dir_Length : Natural) is record
diff --git a/gcc/ada/xref_lib.adb b/gcc/ada/xref_lib.adb
index 454acccd9c2..3650851d916 100644
--- a/gcc/ada/xref_lib.adb
+++ b/gcc/ada/xref_lib.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -372,7 +372,7 @@ package body Xref_Lib is
if Tail (Dir_Ent (1 .. Last), 4) = ".adp" then
- -- The first project file found is the good one.
+ -- The first project file found is the good one
Close (My_Dir);
return Dir_Ent (1 .. Last);
@@ -889,8 +889,9 @@ package body Xref_Lib is
if Ali (Ptr) = '[' then
Skip_To_Matching_Closing_Bracket;
+ end if;
- elsif Ali (Ptr) = '<'
+ if Ali (Ptr) = '<'
or else Ali (Ptr) = '('
or else Ali (Ptr) = '{'
then
@@ -1475,7 +1476,7 @@ package body Xref_Lib is
-- Go to start of new line
procedure Print80 (S : in String);
- -- Print the text, respecting the 80 columns rule.
+ -- Print the text, respecting the 80 columns rule
procedure Print_Ref (Line, Column : String);
-- The beginning of the output is aligned on a column multiple of 9
diff --git a/gcc/ada/xref_lib.ads b/gcc/ada/xref_lib.ads
index bc4c4fa1f00..2c9f944e594 100644
--- a/gcc/ada/xref_lib.ads
+++ b/gcc/ada/xref_lib.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2002 Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -95,7 +95,7 @@ package Xref_Lib is
------------------------
function Default_Project_File (Dir_Name : in String) return String;
- -- Returns the default Project file name for the directory Dir_Name.
+ -- Returns the default Project file name for the directory Dir_Name
procedure Search
(Pattern : Search_Pattern;
@@ -144,16 +144,16 @@ private
type Dependencies is new Dependencies_Tables.Instance;
type ALI_File is limited record
- Buffer : String_Access := null;
+ Buffer : String_Access := null;
-- Buffer used to read the whole file at once
- Current_Line : Positive;
+ Current_Line : Positive;
-- Start of the current line in Buffer
- Xref_Line : Positive;
+ Xref_Line : Positive;
-- Start of the xref lines in Buffer
- X_File : Xr_Tabls.File_Reference;
+ X_File : Xr_Tabls.File_Reference;
-- Stores the cross-referencing file-name ("X..." lines), as an
-- index into the dependencies table
@@ -171,10 +171,10 @@ private
-- line, it is stored as "Entity_Name Declaration_File:line:column"
File_Ref : Xr_Tabls.File_Reference;
- -- A reference to the source file, if any.
+ -- A reference to the source file, if any
Initialized : Boolean := False;
- -- Set to True when Entity has been initialized.
+ -- Set to True when Entity has been initialized
end record;
- -- Stores all the pattern that are search for.
+
end Xref_Lib;
diff --git a/gcc/ada/xsinfo.adb b/gcc/ada/xsinfo.adb
index 7ff76c605bc..035109b7c30 100644
--- a/gcc/ada/xsinfo.adb
+++ b/gcc/ada/xsinfo.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/xsnames.adb b/gcc/ada/xsnames.adb
index 47fe13ec88a..6781edbc921 100644
--- a/gcc/ada/xsnames.adb
+++ b/gcc/ada/xsnames.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/ada/xtreeprs.adb b/gcc/ada/xtreeprs.adb
index eb46f3d96fa..59116e76475 100644
--- a/gcc/ada/xtreeprs.adb
+++ b/gcc/ada/xtreeprs.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
diff --git a/gcc/c-common.c b/gcc/c-common.c
index a4f043b68c6..70e6e39d309 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5401,7 +5401,7 @@ handle_cleanup_attribute (tree *node, tree name, tree args,
*no_add_attrs = true;
return NULL_TREE;
}
- cleanup_decl = lookup_name (cleanup_id);
+ cleanup_decl = lookup_name_two (cleanup_id, 0);
if (!cleanup_decl || TREE_CODE (cleanup_decl) != FUNCTION_DECL)
{
error ("cleanup argument not a function");
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index df869818454..5c69e127d47 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -2685,6 +2685,15 @@ lookup_name (tree name)
return 0;
}
+/* Similar to `lookup_name' for the benefit of common code and the C++
+ front end. */
+
+tree
+lookup_name_two (tree name, int ARG_UNUSED (prefer_type))
+{
+ return lookup_name (name);
+}
+
/* Similar to `lookup_name' but look only at the indicated scope. */
static tree
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index fbc1afaec73..a2532dcd773 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -457,6 +457,7 @@ extern tree groktypename (struct c_type_name *);
extern tree grokparm (const struct c_parm *);
extern tree implicitly_declare (tree);
extern void keep_next_level (void);
+extern tree lookup_name_two (tree, int);
extern void pending_xref_error (void);
extern void c_push_function_context (struct function *);
extern void c_pop_function_context (struct function *);
diff --git a/gcc/c.opt b/gcc/c.opt
index 479f93f86ff..9d11ca6f052 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -510,6 +510,9 @@ C++ ObjC++
ffixed-form
C ObjC
+ffixed-line-length-none
+C ObjC
+
ffixed-line-length-
C ObjC Joined
diff --git a/gcc/combine.c b/gcc/combine.c
index 82d260dafbc..9f910a7b336 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -12232,6 +12232,10 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
{
basic_block bb = this_basic_block;
+ /* You might think you could search back from FROM_INSN
+ rather than from I3, but combine tries to split invalid
+ combined instructions. This can result in the old I2
+ or I1 moving later in the insn sequence. */
for (tem = PREV_INSN (i3); place == 0; tem = PREV_INSN (tem))
{
if (! INSN_P (tem))
@@ -12332,6 +12336,22 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
|| (CALL_P (tem)
&& find_reg_fusage (tem, USE, XEXP (note, 0))))
{
+ /* This may not be the correct place for the death
+ note if FROM_INSN is before TEM, and the reg is
+ set between FROM_INSN and TEM. The reg might
+ die two or more times. An existing death note
+ means we are looking at the wrong live range. */
+ if (from_insn
+ && INSN_CUID (from_insn) < INSN_CUID (tem)
+ && find_regno_note (tem, REG_DEAD,
+ REGNO (XEXP (note, 0))))
+ {
+ tem = from_insn;
+ if (tem == BB_HEAD (bb))
+ break;
+ continue;
+ }
+
place = tem;
/* If we are doing a 3->2 combination, and we have a
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 21c6dab8cd9..c0867e1e91c 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -900,6 +900,9 @@ hppa[12]*-*-hpux10*)
tmake_file="${tmake_file} pa/t-dce-thr"
;;
esac
+ if test x$sjlj != x1; then
+ tmake_file="$tmake_file pa/t-slibgcc-elf-ver"
+ fi
use_collect2=yes
use_fixproto=yes
;;
@@ -932,6 +935,9 @@ hppa*64*-*-hpux11*)
pa/pa-hpux1010.opt pa/pa64-hpux.opt"
need_64bit_hwint=yes
tmake_file="pa/t-pa64 pa/t-pa-hpux pa/t-hpux-shlib"
+ if test x$sjlj != x1; then
+ tmake_file="$tmake_file pa/t-slibgcc-elf-ver"
+ fi
extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o"
case x${enable_threads} in
xyes | xposix )
@@ -955,6 +961,9 @@ hppa[12]*-*-hpux11*)
;;
esac
tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib"
+ if test x$sjlj != x1; then
+ tmake_file="$tmake_file pa/t-slibgcc-elf-ver"
+ fi
case x${enable_threads} in
xyes | xposix )
thread_file=posix
diff --git a/gcc/config.in b/gcc/config.in
index 3577c8c1d22..d91891f0709 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -161,6 +161,12 @@
#endif
+/* Define if your assembler supports fprnd. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_FPRND
+#endif
+
+
/* Define if your assembler supports the --gdwarf2 option. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_GDWARF2_DEBUG_FLAG
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index ec53778ce18..4afdb81f8a1 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -6473,13 +6473,16 @@ static void
alpha_init_builtins (void)
{
const struct alpha_builtin_def *p;
+ tree dimode_integer_type_node;
tree ftype, attrs[2];
size_t i;
+ dimode_integer_type_node = lang_hooks.types.type_for_mode (DImode, 0);
+
attrs[0] = tree_cons (get_identifier ("nothrow"), NULL, NULL);
attrs[1] = tree_cons (get_identifier ("const"), NULL, attrs[0]);
- ftype = build_function_type (long_integer_type_node, void_list_node);
+ ftype = build_function_type (dimode_integer_type_node, void_list_node);
p = zero_arg_builtins;
for (i = 0; i < ARRAY_SIZE (zero_arg_builtins); ++i, ++p)
@@ -6487,8 +6490,8 @@ alpha_init_builtins (void)
lang_hooks.builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
NULL, attrs[p->is_const]);
- ftype = build_function_type_list (long_integer_type_node,
- long_integer_type_node, NULL_TREE);
+ ftype = build_function_type_list (dimode_integer_type_node,
+ dimode_integer_type_node, NULL_TREE);
p = one_arg_builtins;
for (i = 0; i < ARRAY_SIZE (one_arg_builtins); ++i, ++p)
@@ -6496,9 +6499,9 @@ alpha_init_builtins (void)
lang_hooks.builtin_function (p->name, ftype, p->code, BUILT_IN_MD,
NULL, attrs[p->is_const]);
- ftype = build_function_type_list (long_integer_type_node,
- long_integer_type_node,
- long_integer_type_node, NULL_TREE);
+ ftype = build_function_type_list (dimode_integer_type_node,
+ dimode_integer_type_node,
+ dimode_integer_type_node, NULL_TREE);
p = two_arg_builtins;
for (i = 0; i < ARRAY_SIZE (two_arg_builtins); ++i, ++p)
@@ -7546,16 +7549,15 @@ alpha_expand_prologue (void)
{
if (frame_size > 4096)
{
- int probed = 4096;
+ int probed;
- do
+ for (probed = 4096; probed < frame_size; probed += 8192)
emit_insn (gen_probe_stack (GEN_INT (TARGET_ABI_UNICOSMK
? -probed + 64
: -probed)));
- while ((probed += 8192) < frame_size);
/* We only have to do this probe if we aren't saving registers. */
- if (sa_size == 0 && probed + 4096 < frame_size)
+ if (sa_size == 0 && frame_size > probed - 4096)
emit_insn (gen_probe_stack (GEN_INT (-frame_size)));
}
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 958d8800c21..6165545ae4f 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3340,6 +3340,7 @@ thumb_find_work_register (unsigned long pushed_regs_mask)
gcc_unreachable ();
}
+static GTY(()) int pic_labelno;
/* Generate code to load the PIC register. In thumb mode SCRATCH is a
low register. */
@@ -3348,7 +3349,7 @@ void
arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED)
{
#ifndef AOF_ASSEMBLER
- rtx l1, pic_tmp, pic_tmp2, pic_rtx;
+ rtx l1, labelno, pic_tmp, pic_tmp2, pic_rtx;
rtx global_offset_table;
if (current_function_uses_pic_offset_table == 0 || TARGET_SINGLE_PIC_BASE)
@@ -3356,12 +3357,17 @@ arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED)
gcc_assert (flag_pic);
- l1 = gen_label_rtx ();
+ /* We use an UNSPEC rather than a LABEL_REF because this label never appears
+ in the code stream. */
+
+ labelno = GEN_INT (pic_labelno++);
+ l1 = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, labelno), UNSPEC_PIC_LABEL);
+ l1 = gen_rtx_CONST (VOIDmode, l1);
global_offset_table = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");
/* On the ARM the PC register contains 'dot + 8' at the time of the
addition, on the Thumb it is 'dot + 4'. */
- pic_tmp = plus_constant (gen_rtx_LABEL_REF (Pmode, l1), TARGET_ARM ? 8 : 4);
+ pic_tmp = plus_constant (l1, TARGET_ARM ? 8 : 4);
if (GOT_PCREL)
pic_tmp2 = gen_rtx_CONST (VOIDmode,
gen_rtx_PLUS (Pmode, global_offset_table, pc_rtx));
@@ -3374,7 +3380,7 @@ arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED)
{
emit_insn (gen_pic_load_addr_arm (pic_offset_table_rtx, pic_rtx));
emit_insn (gen_pic_add_dot_plus_eight (pic_offset_table_rtx,
- pic_offset_table_rtx, l1));
+ pic_offset_table_rtx, labelno));
}
else
{
@@ -3390,7 +3396,7 @@ arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED)
else
emit_insn (gen_pic_load_addr_thumb (pic_offset_table_rtx, pic_rtx));
emit_insn (gen_pic_add_dot_plus_four (pic_offset_table_rtx,
- pic_offset_table_rtx, l1));
+ pic_offset_table_rtx, labelno));
}
/* Need to emit this whether or not we obey regdecls,
@@ -3822,22 +3828,24 @@ load_tls_operand (rtx x, rtx reg)
static rtx
arm_call_tls_get_addr (rtx x, rtx reg, rtx *valuep, int reloc)
{
- rtx insns, label, sum;
+ rtx insns, label, labelno, sum;
start_sequence ();
- label = gen_label_rtx ();
+ labelno = GEN_INT (pic_labelno++);
+ label = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, labelno), UNSPEC_PIC_LABEL);
+ label = gen_rtx_CONST (VOIDmode, label);
+
sum = gen_rtx_UNSPEC (Pmode,
- gen_rtvec (4, x, GEN_INT (reloc),
- gen_rtx_LABEL_REF (Pmode, label),
+ gen_rtvec (4, x, GEN_INT (reloc), label,
GEN_INT (TARGET_ARM ? 8 : 4)),
UNSPEC_TLS);
reg = load_tls_operand (sum, reg);
if (TARGET_ARM)
- emit_insn (gen_pic_add_dot_plus_eight (reg, reg, label));
+ emit_insn (gen_pic_add_dot_plus_eight (reg, reg, labelno));
else
- emit_insn (gen_pic_add_dot_plus_four (reg, reg, label));
+ emit_insn (gen_pic_add_dot_plus_four (reg, reg, labelno));
*valuep = emit_library_call_value (get_tls_get_addr (), NULL_RTX, LCT_PURE, /* LCT_CONST? */
Pmode, 1, reg, Pmode);
@@ -3851,7 +3859,7 @@ arm_call_tls_get_addr (rtx x, rtx reg, rtx *valuep, int reloc)
rtx
legitimize_tls_address (rtx x, rtx reg)
{
- rtx dest, tp, label, sum, insns, ret, eqv, addend;
+ rtx dest, tp, label, labelno, sum, insns, ret, eqv, addend;
unsigned int model = SYMBOL_REF_TLS_MODEL (x);
switch (model)
@@ -3870,7 +3878,7 @@ legitimize_tls_address (rtx x, rtx reg)
eqv = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const1_rtx),
UNSPEC_TLS);
dest = gen_reg_rtx (Pmode);
- emit_libcall_block (insns, dest, ret, x);
+ emit_libcall_block (insns, dest, ret, eqv);
/* Load the addend. */
addend = gen_rtx_UNSPEC (Pmode, gen_rtvec (2, x, GEN_INT (TLS_LDO32)),
@@ -3879,19 +3887,20 @@ legitimize_tls_address (rtx x, rtx reg)
return gen_rtx_PLUS (Pmode, dest, addend);
case TLS_MODEL_INITIAL_EXEC:
- label = gen_label_rtx ();
+ labelno = GEN_INT (pic_labelno++);
+ label = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, labelno), UNSPEC_PIC_LABEL);
+ label = gen_rtx_CONST (VOIDmode, label);
sum = gen_rtx_UNSPEC (Pmode,
- gen_rtvec (4, x, GEN_INT (TLS_IE32),
- gen_rtx_LABEL_REF (Pmode, label),
+ gen_rtvec (4, x, GEN_INT (TLS_IE32), label,
GEN_INT (TARGET_ARM ? 8 : 4)),
UNSPEC_TLS);
reg = load_tls_operand (sum, reg);
if (TARGET_ARM)
- emit_insn (gen_tls_load_dot_plus_eight (reg, reg, label));
+ emit_insn (gen_tls_load_dot_plus_eight (reg, reg, labelno));
else
{
- emit_insn (gen_pic_add_dot_plus_four (reg, reg, label));
+ emit_insn (gen_pic_add_dot_plus_four (reg, reg, labelno));
emit_move_insn (reg, gen_const_mem (SImode, reg));
}
@@ -10841,8 +10850,11 @@ arm_expand_prologue (void)
/* If we are profiling, make sure no instructions are scheduled before
the call to mcount. Similarly if the user has requested no
- scheduling in the prolog. */
- if (current_function_profile || !TARGET_SCHED_PROLOG)
+ scheduling in the prolog. Similarly if we want non-call exceptions
+ using the EABI unwinder, to prevent faulting instructions from being
+ swapped with a stack adjustment. */
+ if (current_function_profile || !TARGET_SCHED_PROLOG
+ || (ARM_EABI_UNWIND_TABLES && flag_non_call_exceptions))
emit_insn (gen_blockage ());
/* If the link register is being kept alive, with the return address in it,
@@ -11806,7 +11818,9 @@ int
arm_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
{
if (GET_MODE_CLASS (mode) == MODE_CC)
- return regno == CC_REGNUM || regno == VFPCC_REGNUM;
+ return (regno == CC_REGNUM
+ || (TARGET_HARD_FLOAT && TARGET_VFP
+ && regno == VFPCC_REGNUM));
if (TARGET_THUMB)
/* For the Thumb we only allow values bigger than SImode in
@@ -11816,7 +11830,8 @@ arm_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
start of an even numbered register pair. */
return (ARM_NUM_REGS (mode) < 2) || (regno < LAST_LO_REGNUM);
- if (IS_CIRRUS_REGNUM (regno))
+ if (TARGET_HARD_FLOAT && TARGET_MAVERICK
+ && IS_CIRRUS_REGNUM (regno))
/* We have outlawed SI values in Cirrus registers because they
reside in the lower 32 bits, but SF values reside in the
upper 32 bits. This causes gcc all sorts of grief. We can't
@@ -11824,7 +11839,8 @@ arm_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
get sign extended to 64bits-- aldyh. */
return (GET_MODE_CLASS (mode) == MODE_FLOAT) || (mode == DImode);
- if (IS_VFP_REGNUM (regno))
+ if (TARGET_HARD_FLOAT && TARGET_VFP
+ && IS_VFP_REGNUM (regno))
{
if (mode == SFmode || mode == SImode)
return TRUE;
@@ -11835,28 +11851,32 @@ arm_hard_regno_mode_ok (unsigned int regno, enum machine_mode mode)
return FALSE;
}
- if (IS_IWMMXT_GR_REGNUM (regno))
- return mode == SImode;
-
- if (IS_IWMMXT_REGNUM (regno))
- return VALID_IWMMXT_REG_MODE (mode);
+ if (TARGET_REALLY_IWMMXT)
+ {
+ if (IS_IWMMXT_GR_REGNUM (regno))
+ return mode == SImode;
+ if (IS_IWMMXT_REGNUM (regno))
+ return VALID_IWMMXT_REG_MODE (mode);
+ }
+
/* We allow any value to be stored in the general registers.
Restrict doubleword quantities to even register pairs so that we can
use ldrd. */
if (regno <= LAST_ARM_REGNUM)
return !(TARGET_LDRD && GET_MODE_SIZE (mode) > 4 && (regno & 1) != 0);
- if ( regno == FRAME_POINTER_REGNUM
+ if (regno == FRAME_POINTER_REGNUM
|| regno == ARG_POINTER_REGNUM)
/* We only allow integers in the fake hard registers. */
return GET_MODE_CLASS (mode) == MODE_INT;
/* The only registers left are the FPA registers
which we only allow to hold FP values. */
- return GET_MODE_CLASS (mode) == MODE_FLOAT
- && regno >= FIRST_FPA_REGNUM
- && regno <= LAST_FPA_REGNUM;
+ return (TARGET_HARD_FLOAT && TARGET_FPA
+ && GET_MODE_CLASS (mode) == MODE_FLOAT
+ && regno >= FIRST_FPA_REGNUM
+ && regno <= LAST_FPA_REGNUM);
}
int
@@ -13705,7 +13725,13 @@ thumb_expand_prologue (void)
RTX_FRAME_RELATED_P (insn) = 1;
}
- if (current_function_profile || !TARGET_SCHED_PROLOG)
+ /* If we are profiling, make sure no instructions are scheduled before
+ the call to mcount. Similarly if the user has requested no
+ scheduling in the prolog. Similarly if we want non-call exceptions
+ using the EABI unwinder, to prevent faulting instructions from being
+ swapped with a stack adjustment. */
+ if (current_function_profile || !TARGET_SCHED_PROLOG
+ || (ARM_EABI_UNWIND_TABLES && flag_non_call_exceptions))
emit_insn (gen_blockage ());
cfun->machine->lr_save_eliminated = !thumb_force_lr_save ();
@@ -15431,6 +15457,16 @@ arm_output_addr_const_extra (FILE *fp, rtx x)
{
if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_TLS)
return arm_emit_tls_decoration (fp, x);
+ else if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_PIC_LABEL)
+ {
+ char label[256];
+ int labelno = INTVAL (XVECEXP (x, 0, 0));
+
+ ASM_GENERATE_INTERNAL_LABEL (label, "LPIC", labelno);
+ assemble_name_raw (fp, label);
+
+ return TRUE;
+ }
else if (GET_CODE (x) == CONST_VECTOR)
return arm_emit_vector_const (fp, x);
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 5ad2266de80..aa28c3fae77 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -91,6 +91,8 @@
(UNSPEC_WMADDS 18) ; Used by the intrinsic form of the iWMMXt WMADDS instruction.
(UNSPEC_WMADDU 19) ; Used by the intrinsic form of the iWMMXt WMADDU instruction.
(UNSPEC_TLS 20) ; A symbol that has been treated properly for TLS usage.
+ (UNSPEC_PIC_LABEL 21) ; A label used for PIC access that does not appear in the
+ ; instruction stream.
]
)
@@ -4468,11 +4470,11 @@
(unspec:SI [(plus:SI (match_operand:SI 1 "register_operand" "0")
(const (plus:SI (pc) (const_int 4))))]
UNSPEC_PIC_BASE))
- (use (label_ref (match_operand 2 "" "")))]
+ (use (match_operand 2 "" ""))]
"TARGET_THUMB"
"*
- (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (operands[2]));
+ (*targetm.asm_out.internal_label) (asm_out_file, \"LPIC\",
+ INTVAL (operands[2]));
return \"add\\t%0, %|pc\";
"
[(set_attr "length" "2")]
@@ -4483,11 +4485,11 @@
(unspec:SI [(plus:SI (match_operand:SI 1 "register_operand" "r")
(const (plus:SI (pc) (const_int 8))))]
UNSPEC_PIC_BASE))
- (use (label_ref (match_operand 2 "" "")))]
+ (use (match_operand 2 "" ""))]
"TARGET_ARM"
"*
- (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (operands[2]));
+ (*targetm.asm_out.internal_label) (asm_out_file, \"LPIC\",
+ INTVAL (operands[2]));
return \"add%?\\t%0, %|pc, %1\";
"
[(set_attr "predicable" "yes")]
@@ -4498,11 +4500,11 @@
(mem:SI (unspec:SI [(plus:SI (match_operand:SI 1 "register_operand" "r")
(const (plus:SI (pc) (const_int 8))))]
UNSPEC_PIC_BASE)))
- (use (label_ref (match_operand 2 "" "")))]
+ (use (match_operand 2 "" ""))]
"TARGET_ARM"
"*
- (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (operands[2]));
+ (*targetm.asm_out.internal_label) (asm_out_file, \"LPIC\",
+ INTVAL (operands[2]));
return \"ldr%?\\t%0, [%|pc, %1]\t\t@ tls_load_dot_plus_eight\";
"
[(set_attr "predicable" "yes")]
@@ -5135,11 +5137,12 @@
"
)
+;; Transform a floating-point move of a constant into a core register into
+;; an SImode operation.
(define_split
- [(set (match_operand:SF 0 "nonimmediate_operand" "")
+ [(set (match_operand:SF 0 "arm_general_register_operand" "")
(match_operand:SF 1 "immediate_operand" ""))]
"TARGET_ARM
- && !(TARGET_HARD_FLOAT && TARGET_FPA)
&& reload_completed
&& GET_CODE (operands[1]) == CONST_DOUBLE"
[(set (match_dup 2) (match_dup 3))]
diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm
index 364d9fea804..8494a973bfa 100644
--- a/gcc/config/arm/lib1funcs.asm
+++ b/gcc/config/arm/lib1funcs.asm
@@ -989,29 +989,15 @@ LSYM(Lover12):
#ifdef L_dvmd_lnx
@ GNU/Linux division-by zero handler. Used in place of L_dvmd_tls
-/* Constants taken from <asm/unistd.h> and <asm/signal.h> */
+/* Constant taken from <asm/signal.h>. */
#define SIGFPE 8
-#define __NR_SYSCALL_BASE 0x900000
-#define __NR_getpid (__NR_SYSCALL_BASE+ 20)
-#define __NR_kill (__NR_SYSCALL_BASE+ 37)
-#define __NR_gettid (__NR_SYSCALL_BASE+ 224)
-#define __NR_tkill (__NR_SYSCALL_BASE+ 238)
.code 32
FUNC_START div0
stmfd sp!, {r1, lr}
- swi __NR_gettid
- cmn r0, #1000
- swihs __NR_getpid
- cmnhs r0, #1000
- RETLDM r1 hs
- mov ip, r0
- mov r1, #SIGFPE
- swi __NR_tkill
- movs r0, r0
- movne r0, ip
- swine __NR_kill
+ mov r0, #SIGFPE
+ bl SYM(raise) __PLT__
RETLDM r1
FUNC_END div0
diff --git a/gcc/config/arm/libunwind.S b/gcc/config/arm/libunwind.S
index 8d226df3fd2..06e13107d2a 100644
--- a/gcc/config/arm/libunwind.S
+++ b/gcc/config/arm/libunwind.S
@@ -78,7 +78,7 @@ ARM_FUNC_START gnu_Unwind_Save_VFP
/* Wrappers to save core registers, then call the real routine. */
-.macro UNWIND_WRAPPER name
+.macro UNWIND_WRAPPER name nargs
ARM_FUNC_START \name
/* Create a phase2_vrs structure. */
/* Split reg push in two to ensure the correct value for sp. */
@@ -89,8 +89,8 @@ ARM_FUNC_START gnu_Unwind_Save_VFP
mov r3, #0
stmfd sp!, {r2, r3}
- /* Point r1 at the block. Pass r0 unchanged. */
- add r1, sp, #4
+ /* Point r1 at the block. Pass r[0..nargs) unchanged. */
+ add r\nargs, sp, #4
#if defined(__thumb__)
/* Switch back to thumb mode to avoid interworking hassle. */
adr ip, .L1_\name
@@ -112,7 +112,9 @@ ARM_FUNC_START gnu_Unwind_Save_VFP
UNPREFIX \name
.endm
-UNWIND_WRAPPER _Unwind_RaiseException
-UNWIND_WRAPPER _Unwind_Resume
+UNWIND_WRAPPER _Unwind_RaiseException 1
+UNWIND_WRAPPER _Unwind_Resume 1
+UNWIND_WRAPPER _Unwind_Resume_or_Rethrow 1
+UNWIND_WRAPPER _Unwind_ForcedUnwind 3
#endif /* __symbian__ */
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index 62aa6dd10a1..6cd0989c8c5 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -1,5 +1,5 @@
/* Configuration file for ARM GNU/Linux EABI targets.
- Copyright (C) 2004
+ Copyright (C) 2004, 2005
Free Software Foundation, Inc.
Contributed by CodeSourcery, LLC
@@ -68,3 +68,18 @@
non-AAPCS. */
#undef WCHAR_TYPE
#define WCHAR_TYPE (TARGET_AAPCS_BASED ? "unsigned int" : "long int")
+
+/* Clear the instruction cache from `beg' to `end'. This makes an
+ inline system call to SYS_cacheflush. It is modified to work with
+ both the original and EABI-only syscall interfaces. */
+#undef CLEAR_INSN_CACHE
+#define CLEAR_INSN_CACHE(BEG, END) \
+{ \
+ register unsigned long _beg __asm ("a1") = (unsigned long) (BEG); \
+ register unsigned long _end __asm ("a2") = (unsigned long) (END); \
+ register unsigned long _flg __asm ("a3") = 0; \
+ register unsigned long _scno __asm ("r7") = 0xf0002; \
+ __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" \
+ : "=r" (_beg) \
+ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_scno)); \
+}
diff --git a/gcc/config/arm/pr-support.c b/gcc/config/arm/pr-support.c
index 8ea1e608921..072b4a98d5c 100644
--- a/gcc/config/arm/pr-support.c
+++ b/gcc/config/arm/pr-support.c
@@ -27,6 +27,10 @@
Boston, MA 02110-1301, USA. */
#include "unwind.h"
+/* We add a prototype for abort here to avoid creating a dependency on
+ target headers. */
+extern void abort (void);
+
typedef struct _ZSt9type_info type_info; /* This names C++ type_info type */
/* Misc constants. */
diff --git a/gcc/config/arm/unwind-arm.c b/gcc/config/arm/unwind-arm.c
index e436f7c2659..b3f8a00dcb5 100644
--- a/gcc/config/arm/unwind-arm.c
+++ b/gcc/config/arm/unwind-arm.c
@@ -27,6 +27,10 @@
Boston, MA 02110-1301, USA. */
#include "unwind.h"
+/* We add a prototype for abort here to avoid creating a dependency on
+ target headers. */
+extern void abort (void);
+
/* Definitions for C++ runtime support routines. We make these weak
declarations to avoid pulling in libsupc++ unnecessarily. */
typedef unsigned char bool;
@@ -51,8 +55,10 @@ __gnu_Unwind_Find_exidx (_Unwind_Ptr, int *);
#define EXIDX_CANTUNWIND 1
#define uint32_highbit (((_uw) 1) << 31)
+#define UCB_FORCED_STOP_FN(ucbp) ((ucbp)->unwinder_cache.reserved1)
#define UCB_PR_ADDR(ucbp) ((ucbp)->unwinder_cache.reserved2)
#define UCB_SAVED_CALLSITE_ADDR(ucbp) ((ucbp)->unwinder_cache.reserved3)
+#define UCB_FORCED_STOP_ARG(ucbp) ((ucbp)->unwinder_cache.reserved4)
struct core_regs
{
@@ -105,6 +111,7 @@ typedef struct
/* The first fields must be the same as a phase2_vrs. */
_uw demand_save_flags;
struct core_regs core;
+ _uw prev_sp; /* Only valid during forced unwinding. */
struct vfp_regs vfp;
struct fpa_regs fpa;
} phase1_vrs;
@@ -356,9 +363,9 @@ search_EIT_table (const __EIT_entry * table, int nrec, _uw return_address)
n = (left + right) / 2;
this_fn = selfrel_offset31 (&table[n].fnoffset);
if (n != nrec - 1)
- next_fn = selfrel_offset31 (&table[n + 1].fnoffset);
+ next_fn = selfrel_offset31 (&table[n + 1].fnoffset) - 1;
else
- next_fn = ~(_uw) 0;
+ next_fn = (_uw)0 - 1;
if (return_address < this_fn)
{
@@ -366,7 +373,7 @@ search_EIT_table (const __EIT_entry * table, int nrec, _uw return_address)
return (__EIT_entry *) 0;
right = n - 1;
}
- else if (return_address < next_fn)
+ else if (return_address <= next_fn)
return &table[n];
else
left = n + 1;
@@ -419,7 +426,7 @@ get_eit_entry (_Unwind_Control_Block *ucbp, _uw return_address)
if (eitp->content == EXIDX_CANTUNWIND)
{
UCB_PR_ADDR (ucbp) = 0;
- return _URC_FAILURE;
+ return _URC_END_OF_STACK;
}
/* Obtain the address of the "real" __EHT_Header word. */
@@ -472,21 +479,19 @@ unwind_phase2 (_Unwind_Control_Block * ucbp, phase2_vrs * vrs)
{
_Unwind_Reason_Code pr_result;
- for(;;)
+ do
{
/* Find the entry for this routine. */
if (get_eit_entry (ucbp, vrs->core.r[R_PC]) != _URC_OK)
abort ();
UCB_SAVED_CALLSITE_ADDR (ucbp) = vrs->core.r[R_PC];
-
+
/* Call the pr to decide what to do. */
pr_result = ((personality_routine) UCB_PR_ADDR (ucbp))
(_US_UNWIND_FRAME_STARTING, ucbp, (_Unwind_Context *) vrs);
-
- if (pr_result != _URC_CONTINUE_UNWIND)
- break;
}
+ while (pr_result == _URC_CONTINUE_UNWIND);
if (pr_result != _URC_INSTALL_CONTEXT)
abort();
@@ -494,6 +499,104 @@ unwind_phase2 (_Unwind_Control_Block * ucbp, phase2_vrs * vrs)
restore_core_regs (&vrs->core);
}
+/* Perform phase2 forced unwinding. */
+
+static _Unwind_Reason_Code
+unwind_phase2_forced (_Unwind_Control_Block *ucbp, phase2_vrs *entry_vrs,
+ int resuming)
+{
+ _Unwind_Stop_Fn stop_fn = (_Unwind_Stop_Fn) UCB_FORCED_STOP_FN (ucbp);
+ void *stop_arg = (void *)UCB_FORCED_STOP_ARG (ucbp);
+ _Unwind_Reason_Code pr_result = 0;
+ /* We use phase1_vrs here even though we do not demand save, for the
+ prev_sp field. */
+ phase1_vrs saved_vrs, next_vrs;
+
+ /* Save the core registers. */
+ saved_vrs.core = entry_vrs->core;
+ /* We don't need to demand-save the non-core registers, because we
+ unwind in a single pass. */
+ saved_vrs.demand_save_flags = 0;
+
+ /* Unwind until we reach a propagation barrier. */
+ do
+ {
+ _Unwind_State action;
+ _Unwind_Reason_Code entry_code;
+ _Unwind_Reason_Code stop_code;
+
+ /* Find the entry for this routine. */
+ entry_code = get_eit_entry (ucbp, saved_vrs.core.r[R_PC]);
+
+ if (resuming)
+ {
+ action = _US_UNWIND_FRAME_RESUME | _US_FORCE_UNWIND;
+ resuming = 0;
+ }
+ else
+ action = _US_UNWIND_FRAME_STARTING | _US_FORCE_UNWIND;
+
+ if (entry_code == _URC_OK)
+ {
+ UCB_SAVED_CALLSITE_ADDR (ucbp) = saved_vrs.core.r[R_PC];
+
+ next_vrs = saved_vrs;
+
+ /* Call the pr to decide what to do. */
+ pr_result = ((personality_routine) UCB_PR_ADDR (ucbp))
+ (action, ucbp, (void *) &next_vrs);
+
+ saved_vrs.prev_sp = next_vrs.core.r[R_SP];
+ }
+ else
+ {
+ /* Treat any failure as the end of unwinding, to cope more
+ gracefully with missing EH information. Mixed EH and
+ non-EH within one object will usually result in failure,
+ because the .ARM.exidx tables do not indicate the end
+ of the code to which they apply; but mixed EH and non-EH
+ shared objects should return an unwind failure at the
+ entry of a non-EH shared object. */
+ action |= _US_END_OF_STACK;
+
+ saved_vrs.prev_sp = saved_vrs.core.r[R_SP];
+ }
+
+ stop_code = stop_fn (1, action, ucbp->exception_class, ucbp,
+ (void *)&saved_vrs, stop_arg);
+ if (stop_code != _URC_NO_REASON)
+ return _URC_FAILURE;
+
+ if (entry_code != _URC_OK)
+ return entry_code;
+
+ saved_vrs = next_vrs;
+ }
+ while (pr_result == _URC_CONTINUE_UNWIND);
+
+ if (pr_result != _URC_INSTALL_CONTEXT)
+ {
+ /* Some sort of failure has occurred in the pr and probably the
+ pr returned _URC_FAILURE. */
+ return _URC_FAILURE;
+ }
+
+ restore_core_regs (&saved_vrs.core);
+}
+
+/* This is a very limited implementation of _Unwind_GetCFA. It returns
+ the stack pointer as it is about to be unwound, and is only valid
+ while calling the stop function during forced unwinding. If the
+ current personality routine result is going to run a cleanup, this
+ will not be the CFA; but when the frame is really unwound, it will
+ be. */
+
+_Unwind_Word
+_Unwind_GetCFA (_Unwind_Context *context)
+{
+ return ((phase1_vrs *) context)->prev_sp;
+}
+
/* Perform phase1 unwinding. UCBP is the exception being thrown, and
entry_VRS is the register state on entry to _Unwind_RaiseException. */
@@ -516,7 +619,7 @@ __gnu_Unwind_RaiseException (_Unwind_Control_Block * ucbp,
saved_vrs.demand_save_flags = ~(_uw) 0;
/* Unwind until we reach a propagation barrier. */
- for (;;)
+ do
{
/* Find the entry for this routine. */
if (get_eit_entry (ucbp, saved_vrs.core.r[R_PC]) != _URC_OK)
@@ -525,10 +628,8 @@ __gnu_Unwind_RaiseException (_Unwind_Control_Block * ucbp,
/* Call the pr to decide what to do. */
pr_result = ((personality_routine) UCB_PR_ADDR (ucbp))
(_US_VIRTUAL_UNWIND_FRAME, ucbp, (void *) &saved_vrs);
-
- if (pr_result != _URC_CONTINUE_UNWIND)
- break;
}
+ while (pr_result == _URC_CONTINUE_UNWIND);
/* We've unwound as far as we want to go, so restore the original
register state. */
@@ -547,6 +648,24 @@ __gnu_Unwind_RaiseException (_Unwind_Control_Block * ucbp,
being thrown and ENTRY_VRS is the register state on entry to
_Unwind_Resume. */
_Unwind_Reason_Code
+__gnu_Unwind_ForcedUnwind (_Unwind_Control_Block *,
+ _Unwind_Stop_Fn, void *, phase2_vrs *);
+
+_Unwind_Reason_Code
+__gnu_Unwind_ForcedUnwind (_Unwind_Control_Block *ucbp,
+ _Unwind_Stop_Fn stop_fn, void *stop_arg,
+ phase2_vrs *entry_vrs)
+{
+ UCB_FORCED_STOP_FN (ucbp) = (_uw) stop_fn;
+ UCB_FORCED_STOP_ARG (ucbp) = (_uw) stop_arg;
+
+ /* Set the pc to the call site. */
+ entry_vrs->core.r[R_PC] = entry_vrs->core.r[R_LR];
+
+ return unwind_phase2_forced (ucbp, entry_vrs, 0);
+}
+
+_Unwind_Reason_Code
__gnu_Unwind_Resume (_Unwind_Control_Block *, phase2_vrs *);
_Unwind_Reason_Code
@@ -556,7 +675,15 @@ __gnu_Unwind_Resume (_Unwind_Control_Block * ucbp, phase2_vrs * entry_vrs)
/* Recover the saved address. */
entry_vrs->core.r[R_PC] = UCB_SAVED_CALLSITE_ADDR (ucbp);
-
+
+ if (UCB_FORCED_STOP_FN (ucbp))
+ {
+ unwind_phase2_forced (ucbp, entry_vrs, 1);
+
+ /* We can't return failure at this point. */
+ abort ();
+ }
+
/* Call the cached PR. */
pr_result = ((personality_routine) UCB_PR_ADDR (ucbp))
(_US_UNWIND_FRAME_RESUME, ucbp, (_Unwind_Context *) entry_vrs);
@@ -576,6 +703,22 @@ __gnu_Unwind_Resume (_Unwind_Control_Block * ucbp, phase2_vrs * entry_vrs)
}
}
+_Unwind_Reason_Code
+__gnu_Unwind_Resume_or_Rethrow (_Unwind_Control_Block *, phase2_vrs *);
+
+_Unwind_Reason_Code
+__gnu_Unwind_Resume_or_Rethrow (_Unwind_Control_Block * ucbp,
+ phase2_vrs * entry_vrs)
+{
+ if (!UCB_FORCED_STOP_FN (ucbp))
+ return __gnu_Unwind_RaiseException (ucbp, entry_vrs);
+
+ /* Set the pc to the call site. */
+ entry_vrs->core.r[R_PC] = entry_vrs->core.r[R_LR];
+ /* Continue unwinding the next frame. */
+ return unwind_phase2_forced (ucbp, entry_vrs, 0);
+}
+
/* Clean up an exception object when unwinding is complete. */
void
_Unwind_Complete (_Unwind_Control_Block * ucbp __attribute__((unused)))
@@ -619,6 +762,9 @@ __gnu_unwind_pr_common (_Unwind_State state,
_uw rtti_count;
int phase2_call_unexpected_after_unwind = 0;
int in_range = 0;
+ int forced_unwind = state & _US_FORCE_UNWIND;
+
+ state &= _US_ACTION_MASK;
data = (_uw *) ucbp->pr_cache.ehtp;
uws.data = *(data++);
@@ -748,9 +894,9 @@ __gnu_unwind_pr_common (_Unwind_State state,
/* Exception specification. */
if (state == _US_VIRTUAL_UNWIND_FRAME)
{
- if (in_range)
+ if (in_range && (!forced_unwind || !rtti_count))
{
- /* Match against teh exception specification. */
+ /* Match against the exception specification. */
_uw i;
_uw rtti;
void *matched;
@@ -853,3 +999,16 @@ __aeabi_unwind_cpp_pr2 (_Unwind_State state,
{
return __gnu_unwind_pr_common (state, ucbp, context, 2);
}
+
+/* These two should never be used. */
+_Unwind_Ptr
+_Unwind_GetDataRelBase (_Unwind_Context *context __attribute__ ((unused)))
+{
+ abort ();
+}
+
+_Unwind_Ptr
+_Unwind_GetTextRelBase (_Unwind_Context *context __attribute__ ((unused)))
+{
+ abort ();
+}
diff --git a/gcc/config/arm/unwind-arm.h b/gcc/config/arm/unwind-arm.h
index 4d86407c73e..dd8d2affe39 100644
--- a/gcc/config/arm/unwind-arm.h
+++ b/gcc/config/arm/unwind-arm.h
@@ -1,5 +1,5 @@
/* Header file for the ARM EABI unwinder
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Paul Brook
This file is free software; you can redistribute it and/or modify it
@@ -37,10 +37,6 @@
#ifdef __cplusplus
extern "C" {
#endif
- /* We add a prototype for abort here to avoid creating a dependency on
- target headers. */
- extern void abort();
-
typedef unsigned _Unwind_Word __attribute__((__mode__(__word__)));
typedef signed _Unwind_Sword __attribute__((__mode__(__word__)));
typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
@@ -54,28 +50,41 @@ extern "C" {
{
_URC_OK = 0, /* operation completed successfully */
_URC_FOREIGN_EXCEPTION_CAUGHT = 1,
+ _URC_END_OF_STACK = 5,
_URC_HANDLER_FOUND = 6,
_URC_INSTALL_CONTEXT = 7,
_URC_CONTINUE_UNWIND = 8,
_URC_FAILURE = 9 /* unspecified failure of some kind */
}
_Unwind_Reason_Code;
-
+
typedef enum
{
_US_VIRTUAL_UNWIND_FRAME = 0,
_US_UNWIND_FRAME_STARTING = 1,
- _US_UNWIND_FRAME_RESUME = 2
+ _US_UNWIND_FRAME_RESUME = 2,
+ _US_ACTION_MASK = 3,
+ _US_FORCE_UNWIND = 8,
+ _US_END_OF_STACK = 16
}
_Unwind_State;
-
+
+ /* Provided only for for compatibility with existing code. */
+ typedef int _Unwind_Action;
+#define _UA_SEARCH_PHASE 1
+#define _UA_CLEANUP_PHASE 2
+#define _UA_HANDLER_FRAME 4
+#define _UA_FORCE_UNWIND 8
+#define _UA_END_OF_STACK 16
+#define _URC_NO_REASON _URC_OK
+
typedef struct _Unwind_Control_Block _Unwind_Control_Block;
typedef struct _Unwind_Context _Unwind_Context;
typedef _uw _Unwind_EHT_Header;
-
-
+
+
/* UCB: */
-
+
struct _Unwind_Control_Block
{
char exception_class[8];
@@ -83,10 +92,10 @@ extern "C" {
/* Unwinder cache, private fields for the unwinder's use */
struct
{
- _uw reserved1; /* init reserved1 to 0, then don't touch */
- _uw reserved2;
- _uw reserved3;
- _uw reserved4;
+ _uw reserved1; /* Forced unwind stop fn, 0 if not forced */
+ _uw reserved2; /* Personality routine address */
+ _uw reserved3; /* Saved callsite address */
+ _uw reserved4; /* Forced unwind stop arg */
_uw reserved5;
}
unwinder_cache;
@@ -114,14 +123,9 @@ extern "C" {
pr_cache;
long long int :0; /* Force alignment to 8-byte boundary */
};
-
- /* Interface functions: */
- _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp);
- void __attribute__((noreturn)) _Unwind_Resume(_Unwind_Control_Block *ucbp);
- void _Unwind_Complete(_Unwind_Control_Block *ucbp);
/* Virtual Register Set*/
-
+
typedef enum
{
_UVRSC_CORE = 0, /* integer register */
@@ -131,7 +135,7 @@ extern "C" {
_UVRSC_WMMXC = 4 /* Intel WMMX control register */
}
_Unwind_VRS_RegClass;
-
+
typedef enum
{
_UVRSD_UINT32 = 0,
@@ -142,13 +146,13 @@ extern "C" {
_UVRSD_DOUBLE = 5
}
_Unwind_VRS_DataRepresentation;
-
+
typedef enum
{
_UVRSR_OK = 0,
_UVRSR_NOT_IMPLEMENTED = 1,
_UVRSR_FAILED = 2
- }
+ }
_Unwind_VRS_Result;
/* Frame unwinding state. */
@@ -171,11 +175,11 @@ extern "C" {
_Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass,
_uw, _Unwind_VRS_DataRepresentation,
void *);
-
+
_Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass,
_uw, _Unwind_VRS_DataRepresentation,
void *);
-
+
_Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass,
_uw, _Unwind_VRS_DataRepresentation);
@@ -187,19 +191,22 @@ extern "C" {
void * _Unwind_GetLanguageSpecificData (_Unwind_Context *);
_Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *);
- /* These two should never be used */
- static inline _Unwind_Ptr
- _Unwind_GetDataRelBase (_Unwind_Context * context __attribute__ ((unused)))
- {
- abort ();
- }
-
- static inline _Unwind_Ptr
- _Unwind_GetTextRelBase (_Unwind_Context * context __attribute__ ((unused)))
- {
- abort ();
- }
+ /* These two should never be used. */
+ _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *);
+ _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *);
+ /* Interface functions: */
+ _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp);
+ void __attribute__((noreturn)) _Unwind_Resume(_Unwind_Control_Block *ucbp);
+ _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Control_Block *ucbp);
+
+ typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)
+ (int, _Unwind_Action, _Unwind_Exception_Class,
+ _Unwind_Control_Block *, struct _Unwind_Context *, void *);
+ _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *,
+ _Unwind_Stop_Fn, void *);
+ _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *);
+ void _Unwind_Complete(_Unwind_Control_Block *ucbp);
void _Unwind_DeleteException (_Unwind_Exception *);
_Unwind_Reason_Code __gnu_unwind_frame (_Unwind_Control_Block *,
@@ -254,16 +261,6 @@ extern "C" {
#define _Unwind_SetIP(context, val) \
_Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1))
- /* Provided only for for compatibility with existing code. */
- typedef int _Unwind_Action;
-#define _UA_SEARCH_PHASE 1
-#define _UA_CLEANUP_PHASE 2
-#define _UA_HANDLER_FRAME 4
-#define _UA_FORCE_UNWIND 8
-#define _UA_END_OF_STACK 16
-
-#define _URC_NO_REASON _URC_OK
-
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index 0e6da5c08a8..be4e565c37e 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -41,6 +41,11 @@ extern int target_flags;
{ \
builtin_define ("bfin"); \
builtin_define ("BFIN"); \
+ if (flag_pic) \
+ { \
+ builtin_define ("__PIC__"); \
+ builtin_define ("__pic__"); \
+ } \
} \
while (0)
#endif
diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md
index 4eae433cf31..494b27e3730 100644
--- a/gcc/config/bfin/bfin.md
+++ b/gcc/config/bfin/bfin.md
@@ -2001,6 +2001,13 @@
"ssync;"
[(set_attr "type" "sync")])
+(define_insn "trap"
+ [(trap_if (const_int 1) (const_int 3))]
+ ""
+ "excpt 3;"
+ [(set_attr "type" "misc")
+ (set_attr "length" "2")])
+
(define_insn "trapifcc"
[(trap_if (reg:BI REG_CC) (const_int 3))]
""
diff --git a/gcc/config/bfin/crti.s b/gcc/config/bfin/crti.s
index 7324e27ff88..84a98597c23 100644
--- a/gcc/config/bfin/crti.s
+++ b/gcc/config/bfin/crti.s
@@ -38,10 +38,21 @@ Boston, MA 02110-1301, USA. */
.globl __init
.type __init,@function
__init:
- LINK 0;
-
+#if defined __PIC__
+ [--SP] = P5;
+#endif
+ LINK 12;
+#if defined __PIC__
+ P5 = [P5 + _current_shared_library_p5_offset_]
+#endif
.section .fini
.globl __fini
.type __fini,@function
__fini:
- LINK 0;
+#if defined __PIC__
+ [--SP] = P5;
+#endif
+ LINK 12;
+#if defined __PIC__
+ P5 = [P5 + _current_shared_library_p5_offset_]
+#endif
diff --git a/gcc/config/bfin/crtlibid.s b/gcc/config/bfin/crtlibid.s
new file mode 100644
index 00000000000..f80adfe7ec9
--- /dev/null
+++ b/gcc/config/bfin/crtlibid.s
@@ -0,0 +1,32 @@
+/* Provide a weak definition of the library ID, for the benefit of certain
+ configure scripts.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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, or (at your option)
+any later version.
+
+GCC 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 GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+/* As a special exception, if you link this library with files
+ compiled with GCC to produce an executable, this does not cause
+ the resulting executable to be covered by the GNU General Public License.
+ This exception does not however invalidate any other reasons why
+ the executable file might be covered by the GNU General Public License. */
+
+ .file "crtlibid.o"
+ .ident "GNU C crtlibid.o"
+
+.weak _current_shared_library_p5_offset_
+.set _current_shared_library_p5_offset_, 0
diff --git a/gcc/config/bfin/crtn.s b/gcc/config/bfin/crtn.s
index 78ad7bb1221..69421fcfa58 100644
--- a/gcc/config/bfin/crtn.s
+++ b/gcc/config/bfin/crtn.s
@@ -36,8 +36,14 @@ Boston, MA 02110-1301, USA. */
.section .init
unlink;
+#if defined __PIC__
+ P5 = [SP++];
+#endif
rts;
.section .fini
unlink;
+#if defined __PIC__
+ P5 = [SP++];
+#endif
rts;
diff --git a/gcc/config/bfin/elf.h b/gcc/config/bfin/elf.h
index 5b0eb20ddf6..621b786c94d 100644
--- a/gcc/config/bfin/elf.h
+++ b/gcc/config/bfin/elf.h
@@ -7,7 +7,7 @@
sprintf (LABEL, "*%s%s$%d", LOCAL_LABEL_PREFIX, PREFIX, (int) NUM)
#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "crt0%O%s crti%O%s crtbegin%O%s"
+#define STARTFILE_SPEC "crt0%O%s crti%O%s crtbegin%O%s crtlibid%O%s"
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend%O%s crtn%O%s"
diff --git a/gcc/config/bfin/t-bfin-elf b/gcc/config/bfin/t-bfin-elf
index 928129c4331..64e71b0d3cf 100644
--- a/gcc/config/bfin/t-bfin-elf
+++ b/gcc/config/bfin/t-bfin-elf
@@ -3,7 +3,7 @@
LIB1ASMSRC = bfin/lib1funcs.asm
LIB1ASMFUNCS = _divsi3 _udivsi3 _umodsi3 _modsi3
-EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o
+EXTRA_PARTS = crtbegin.o crtend.o crti.o crtn.o crtlibid.o
FPBIT = fp-bit.c
DPBIT = dp-bit.c
@@ -32,3 +32,10 @@ $(T)crti.o: $(srcdir)/config/bfin/crti.s $(GCC_PASSES)
$(T)crtn.o: $(srcdir)/config/bfin/crtn.s $(GCC_PASSES)
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
-c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/bfin/crtn.s
+
+$(T)crtlibid.o: $(srcdir)/config/bfin/crtlibid.s $(GCC_PASSES)
+ $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
+ -c -o $(T)crtlibid.o -x assembler-with-cpp \
+ $(srcdir)/config/bfin/crtlibid.s
+
+EXTRA_MULTILIB_PARTS= crtbegin.o crtend.o crti.o crtn.o crtlibid.o
diff --git a/gcc/config/bfin/uclinux.h b/gcc/config/bfin/uclinux.h
index 361a923326c..4372af24257 100644
--- a/gcc/config/bfin/uclinux.h
+++ b/gcc/config/bfin/uclinux.h
@@ -1,6 +1,6 @@
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
- "crt1%O%s crti%O%s crtbegin%O%s"
+ "crt1%O%s crti%O%s crtbegin%O%s crtlibid%O%s"
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md
index 2f35b06aef4..37bd4ab1306 100644
--- a/gcc/config/cris/cris.md
+++ b/gcc/config/cris/cris.md
@@ -678,11 +678,15 @@
[(set (mem
(plus:SI
(match_operand:SI
- 0 "cris_bdap_operand" "%r,r,r,r,r,r,r,r,R,R,R,R,R,R")
+ 0 "cris_bdap_operand"
+ "%r, r, r,r, r, r,r, R,R, R,R, R")
(match_operand:SI
- 1 "cris_bdap_operand" "r>Rn,r>Rn,r,>Rn,r>Rn,r>Rn,r,>Rn,r,r,r,r,r,r")))
- (match_operand 2 "register_operand" "r,r,r,r,x,x,x,x,r,r,r,x,x,x"))
- (set (match_operand:SI 3 "register_operand" "=*0,!2,r,r,*0,!2,r,r,*1,!*2,r,*1,!*2,r")
+ 1 "cris_bdap_operand"
+ "r>Rn,r>Rn,r,>Rn,r>Rn,r,>Rn,r,r, r,r, r")))
+ (match_operand 2 "register_operand"
+ "r, r, r,r, x, x,x, r,r, r,x, x"))
+ (set (match_operand:SI 3 "register_operand"
+ "=*0,!2, r,r, *0, r,r, *1,!*2,r,*1,r")
(plus:SI (match_dup 0)
(match_dup 1)))]
"GET_MODE_SIZE (GET_MODE (operands[2])) == UNITS_PER_WORD
@@ -696,17 +700,15 @@
|| CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'J')))
return "#";
if (which_alternative == 1
- || which_alternative == 5
+ || which_alternative == 7
|| which_alternative == 8
- || which_alternative == 9
- || which_alternative == 11
- || which_alternative == 12)
+ || which_alternative == 10)
return "#";
if (which_alternative < 4)
return "move.%s2 %2,[%3=%0%S1]";
- if (which_alternative == 10)
+ if (which_alternative == 9)
return "move.%s2 %2,[%3=%1%S0]";
- if (which_alternative == 13)
+ if (which_alternative == 11)
return "move %2,[%3=%1%S0]";
return "move %2,[%3=%0%S1]";
})
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 0f2acc0030c..0cb12ca957a 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -141,7 +141,7 @@ darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED)
tok = pragma_lex (&decl);
if (tok == CPP_NAME && decl)
{
- tree local = lookup_name (decl);
+ tree local = lookup_name_two (decl, 0);
if (local && (TREE_CODE (local) == PARM_DECL
|| TREE_CODE (local) == VAR_DECL))
TREE_USED (local) = 1;
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index a4b79c613e5..5b17c34859b 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -302,23 +302,31 @@ Boston, MA 02110-1301, USA. */
#define LIB_SPEC "%{!static:-lSystem}"
-/* -dynamiclib implies -shared-libgcc just like -shared would on linux.
- Support -mmacosx-version-min by supplying different (stub) libgcc_s.dylib
- libraries to link against. */
+/* Support -mmacosx-version-min by supplying different (stub) libgcc_s.dylib
+ libraries to link against, and by not linking against libgcc_s on
+ earlier-than-10.3.9.
+
+ Note that by default, -lgcc_eh is not linked against! This is
+ because in a future version of Darwin the EH frame information may
+ be in a new format, or the fallback routine might be changed; if
+ you want to explicitly link against the static version of those
+ routines, because you know you don't need to unwind through system
+ libraries, you need to explicitly say -static-libgcc.
+
+ If it is linked against, it has to be before -lgcc, because it may
+ need symbols from -lgcc. */
#undef REAL_LIBGCC_SPEC
-#define REAL_LIBGCC_SPEC \
- "%{static|static-libgcc:-lgcc -lgcc_eh; \
- :%{shared-libgcc|Zdynamiclib \
- :%:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \
- %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5) \
- -lgcc; \
- :-lgcc -lgcc_eh}}"
-
+#define REAL_LIBGCC_SPEC \
+ "%{static-libgcc|static: -lgcc_eh -lgcc; \
+ shared-libgcc|fexceptions: \
+ %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \
+ %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5) \
+ -lgcc; \
+ :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \
+ %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5) \
+ -lgcc}"
+
/* We specify crt0.o as -lcrt0.o so that ld will search the library path. */
-/* We don't want anything to do with crt2.o in the 64-bit case;
- testing the PowerPC-specific -m64 flag here is a little irregular,
- but it's overkill to make copies of this spec for each target
- arch. */
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
@@ -326,11 +334,11 @@ Boston, MA 02110-1301, USA. */
%{!Zbundle:%{pg:%{static:-lgcrt0.o} \
%{!static:%{object:-lgcrt0.o} \
%{!object:%{preload:-lgcrt0.o} \
- %{!preload:-lgcrt1.o %{!m64: crt2.o%s}}}}} \
+ %{!preload:-lgcrt1.o %(darwin_crt2)}}}} \
%{!pg:%{static:-lcrt0.o} \
%{!static:%{object:-lcrt0.o} \
%{!object:%{preload:-lcrt0.o} \
- %{!preload:-lcrt1.o %{!m64: crt2.o%s}}}}}}}"
+ %{!preload:-lcrt1.o %(darwin_crt2)}}}}}}"
/* The native Darwin linker doesn't necessarily place files in the order
that they're specified on the link line. Thus, it is pointless
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 7e8b2dcc0d2..89972339855 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -50,6 +50,7 @@ Boston, MA 02110-1301, USA. */
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
{ "darwin_arch", "i386" }, \
+ { "darwin_crt2", "" }, \
{ "darwin_subarch", "i386" },
/* Use the following macro for any Darwin/x86-specific command-line option
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index eb8944f23d9..cd76aa753aa 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1341,7 +1341,8 @@ override_options (void)
}
if (ix86_asm_string != 0)
{
- if (!strcmp (ix86_asm_string, "intel"))
+ if (! TARGET_MACHO
+ && !strcmp (ix86_asm_string, "intel"))
ix86_asm_dialect = ASM_INTEL;
else if (!strcmp (ix86_asm_string, "att"))
ix86_asm_dialect = ASM_ATT;
diff --git a/gcc/config/ia64/unwind-ia64.c b/gcc/config/ia64/unwind-ia64.c
index 7608507e9e2..c1be3133fbe 100644
--- a/gcc/config/ia64/unwind-ia64.c
+++ b/gcc/config/ia64/unwind-ia64.c
@@ -2060,6 +2060,12 @@ uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
}
}
+static void
+uw_advance_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+ uw_update_context (context, fs);
+}
+
/* Fill in CONTEXT for top-of-stack. The only valid registers at this
level will be the return address and the CFA. Note that CFA = SP+16. */
diff --git a/gcc/config/pa/hpux-unwind.h b/gcc/config/pa/hpux-unwind.h
new file mode 100644
index 00000000000..aa443bfba0b
--- /dev/null
+++ b/gcc/config/pa/hpux-unwind.h
@@ -0,0 +1,316 @@
+/* DWARF2 EH unwinding support for PA HP-UX.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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, or (at your option)
+any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file with other programs, and to distribute
+those programs without any restriction coming from the use of this
+file. (The General Public License restrictions do apply in other
+respects; for example, they cover modification of the file, and
+distribution when not linked into another program.)
+
+GCC 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 GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+/* Do code reading to identify a signal frame, and set the frame
+ state data appropriately. See unwind-dw2.c for the structs. */
+
+#include <signal.h>
+#include <sys/ucontext.h>
+#include <unistd.h>
+
+/* FIXME: We currently ignore the high halves of general, space and
+ control registers on PA 2.0 machines for applications using the
+ 32-bit runtime. We don't restore space registers or the floating
+ point status registers. */
+
+#define MD_FALLBACK_FRAME_STATE_FOR pa_fallback_frame_state
+
+/* HP-UX 10.X doesn't define GetSSReg. */
+#ifndef GetSSReg
+#define GetSSReg(ssp, ss_reg) \
+ ((UseWideRegs (ssp)) \
+ ? (ssp)->ss_wide.ss_32.ss_reg ## _lo \
+ : (ssp)->ss_narrow.ss_reg)
+#endif
+
+#if TARGET_64BIT
+#define GetSSRegAddr(ssp, ss_reg) ((long) &((ssp)->ss_wide.ss_64.ss_reg))
+#else
+#define GetSSRegAddr(ssp, ss_reg) \
+ ((UseWideRegs (ssp)) \
+ ? (long) &((ssp)->ss_wide.ss_32.ss_reg ## _lo) \
+ : (long) &((ssp)->ss_narrow.ss_reg))
+#endif
+
+#define UPDATE_FS_FOR_SAR(FS, N) \
+ (FS)->regs.reg[N].how = REG_SAVED_OFFSET; \
+ (FS)->regs.reg[N].loc.offset = GetSSRegAddr (mc, ss_cr11) - new_cfa
+
+#define UPDATE_FS_FOR_GR(FS, GRN, N) \
+ (FS)->regs.reg[N].how = REG_SAVED_OFFSET; \
+ (FS)->regs.reg[N].loc.offset = GetSSRegAddr (mc, ss_gr##GRN) - new_cfa
+
+#define UPDATE_FS_FOR_FR(FS, FRN, N) \
+ (FS)->regs.reg[N].how = REG_SAVED_OFFSET; \
+ (FS)->regs.reg[N].loc.offset = (long) &(mc->ss_fr##FRN) - new_cfa;
+
+#define UPDATE_FS_FOR_PC(FS, N) \
+ (FS)->regs.reg[N].how = REG_SAVED_OFFSET; \
+ (FS)->regs.reg[N].loc.offset = GetSSRegAddr (mc, ss_pcoq_head) - new_cfa
+
+/* Extract bit field from word using HP's numbering (MSB = 0). */
+#define GET_FIELD(X, FROM, TO) \
+ ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
+
+static inline int
+sign_extend (int x, int len)
+{
+ int signbit = (1 << (len - 1));
+ int mask = (signbit << 1) - 1;
+ return ((x & mask) ^ signbit) - signbit;
+}
+
+/* Extract a 17-bit signed constant from branch instructions. */
+static inline int
+extract_17 (unsigned word)
+{
+ return sign_extend (GET_FIELD (word, 19, 28)
+ | GET_FIELD (word, 29, 29) << 10
+ | GET_FIELD (word, 11, 15) << 11
+ | (word & 0x1) << 16, 17);
+}
+
+/* Extract a 22-bit signed constant from branch instructions. */
+static inline int
+extract_22 (unsigned word)
+{
+ return sign_extend (GET_FIELD (word, 19, 28)
+ | GET_FIELD (word, 29, 29) << 10
+ | GET_FIELD (word, 11, 15) << 11
+ | GET_FIELD (word, 6, 10) << 16
+ | (word & 0x1) << 21, 22);
+}
+
+static _Unwind_Reason_Code
+pa_fallback_frame_state (struct _Unwind_Context *context,
+ _Unwind_FrameState *fs)
+{
+ static long cpu;
+ unsigned int *pc = (unsigned int *) context->ra;
+
+ if (pc == 0)
+ return _URC_END_OF_STACK;
+
+ /* Check if the return address points to an export stub (PA 1.1 or 2.0). */
+ if ((!TARGET_64BIT
+ && *(pc + 0) == 0x4bc23fd1 /* ldw -18(sp),rp */
+ && *(pc + 1) == 0x004010a1 /* ldsid (rp),r1 */
+ && *(pc + 2) == 0x00011820 /* mtsp r1,sr0 */
+ && *(pc + 3) == 0xe0400002) /* be,n 0(sr0,rp) */
+ ||
+ (!TARGET_64BIT
+ && *(pc + 0) == 0x4bc23fd1 /* ldw -18(sp),rp */
+ && *(pc + 1) == 0xe840d002)) /* bve,n (rp) */
+ {
+ fs->cfa_how = CFA_REG_OFFSET;
+ fs->cfa_reg = 30;
+ fs->cfa_offset = 0;
+
+ fs->retaddr_column = 0;
+ fs->regs.reg[0].how = REG_SAVED_OFFSET;
+ fs->regs.reg[0].loc.offset = -24;
+
+ return _URC_NO_REASON;
+ }
+
+ /* Check if the return address is an export stub as signal handlers
+ may return via an export stub. */
+ if (!TARGET_64BIT
+ && (*pc & 0xffe0e002) == 0xe8400000 /* bl x,r2 */
+ && *(pc + 1) == 0x08000240 /* nop */
+ && *(pc + 2) == 0x4bc23fd1 /* ldw -18(sp),rp */
+ && *(pc + 3) == 0x004010a1 /* ldsid (rp),r1 */
+ && *(pc + 4) == 0x00011820 /* mtsp r1,sr0 */
+ && *(pc + 5) == 0xe0400002) /* be,n 0(sr0,rp) */
+ /* Extract target address from PA 1.x 17-bit branch. */
+ pc += extract_17 (*pc) + 2;
+ else if (!TARGET_64BIT
+ && (*pc & 0xfc00e002) == 0xe800a000 /* b,l x,r2 */
+ && *(pc + 1) == 0x08000240 /* nop */
+ && *(pc + 2) == 0x4bc23fd1 /* ldw -18(sp),rp */
+ && *(pc + 3) == 0xe840d002) /* bve,n (rp) */
+ /* Extract target address from PA 2.0 22-bit branch. */
+ pc += extract_22 (*pc) + 2;
+
+ /* Now check if the return address is one of the signal handler
+ returns, _sigreturn or _sigsetreturn. */
+ if ((TARGET_64BIT
+ && *(pc + 0) == 0x53db3f51 /* ldd -58(sp),dp */
+ && *(pc + 8) == 0x34160116 /* ldi 8b,r22 */
+ && *(pc + 9) == 0x08360ac1 /* shladd,l r22,3,r1,r1 */
+ && *(pc + 10) == 0x0c2010c1 /* ldd 0(r1),r1 */
+ && *(pc + 11) == 0xe4202000) /* be,l 0(sr4,r1) */
+ ||
+ (TARGET_64BIT
+ && *(pc + 0) == 0x36dc0000 /* ldo 0(r22),ret0 */
+ && *(pc + 6) == 0x341601c0 /* ldi e0,r22 */
+ && *(pc + 7) == 0x08360ac1 /* shladd,l r22,3,r1,r1 */
+ && *(pc + 8) == 0x0c2010c1 /* ldd 0(r1),r1 */
+ && *(pc + 9) == 0xe4202000) /* be,l 0(sr4,r1) */
+ ||
+ (!TARGET_64BIT
+ && *(pc + 0) == 0x379a0000 /* ldo 0(ret0),r26 */
+ && *(pc + 1) == 0x6bd33fc9 /* stw r19,-1c(sp) */
+ && *(pc + 2) == 0x20200801 /* ldil L%-40000000,r1 */
+ && *(pc + 3) == 0xe420e008 /* be,l 4(sr7,r1) */
+ && *(pc + 4) == 0x34160116) /* ldi 8b,r22 */
+ ||
+ (!TARGET_64BIT
+ && *(pc + 0) == 0x6bd33fc9 /* stw r19,-1c(sp) */
+ && *(pc + 1) == 0x20200801 /* ldil L%-40000000,r1 */
+ && *(pc + 2) == 0xe420e008 /* be,l 4(sr7,r1) */
+ && *(pc + 3) == 0x341601c0)) /* ldi e0,r22 */
+ {
+ /* The previous stack pointer is saved at (long *)SP - 1. The
+ ucontext structure is offset from the start of the previous
+ frame by the siglocal_misc structure. */
+ struct siglocalx *sl = (struct siglocalx *)
+ (*((long *) context->cfa - 1));
+ mcontext_t *mc = &(sl->sl_uc.uc_mcontext);
+
+ long new_cfa = GetSSReg (mc, ss_sp);
+
+ fs->cfa_how = CFA_REG_OFFSET;
+ fs->cfa_reg = 30;
+ fs->cfa_offset = new_cfa - (long) context->cfa;
+
+ UPDATE_FS_FOR_GR (fs, 1, 1);
+ UPDATE_FS_FOR_GR (fs, 2, 2);
+ UPDATE_FS_FOR_GR (fs, 3, 3);
+ UPDATE_FS_FOR_GR (fs, 4, 4);
+ UPDATE_FS_FOR_GR (fs, 5, 5);
+ UPDATE_FS_FOR_GR (fs, 6, 6);
+ UPDATE_FS_FOR_GR (fs, 7, 7);
+ UPDATE_FS_FOR_GR (fs, 8, 8);
+ UPDATE_FS_FOR_GR (fs, 9, 9);
+ UPDATE_FS_FOR_GR (fs, 10, 10);
+ UPDATE_FS_FOR_GR (fs, 11, 11);
+ UPDATE_FS_FOR_GR (fs, 12, 12);
+ UPDATE_FS_FOR_GR (fs, 13, 13);
+ UPDATE_FS_FOR_GR (fs, 14, 14);
+ UPDATE_FS_FOR_GR (fs, 15, 15);
+ UPDATE_FS_FOR_GR (fs, 16, 16);
+ UPDATE_FS_FOR_GR (fs, 17, 17);
+ UPDATE_FS_FOR_GR (fs, 18, 18);
+ UPDATE_FS_FOR_GR (fs, 19, 19);
+ UPDATE_FS_FOR_GR (fs, 20, 20);
+ UPDATE_FS_FOR_GR (fs, 21, 21);
+ UPDATE_FS_FOR_GR (fs, 22, 22);
+ UPDATE_FS_FOR_GR (fs, 23, 23);
+ UPDATE_FS_FOR_GR (fs, 24, 24);
+ UPDATE_FS_FOR_GR (fs, 25, 25);
+ UPDATE_FS_FOR_GR (fs, 26, 26);
+ UPDATE_FS_FOR_GR (fs, 27, 27);
+ UPDATE_FS_FOR_GR (fs, 28, 28);
+ UPDATE_FS_FOR_GR (fs, 29, 29);
+ UPDATE_FS_FOR_GR (fs, 30, 30);
+ UPDATE_FS_FOR_GR (fs, 31, 31);
+
+ if (TARGET_64BIT)
+ {
+ UPDATE_FS_FOR_FR (fs, 4, 32);
+ UPDATE_FS_FOR_FR (fs, 5, 33);
+ UPDATE_FS_FOR_FR (fs, 6, 34);
+ UPDATE_FS_FOR_FR (fs, 7, 35);
+ UPDATE_FS_FOR_FR (fs, 8, 36);
+ UPDATE_FS_FOR_FR (fs, 9, 37);
+ UPDATE_FS_FOR_FR (fs, 10, 38);
+ UPDATE_FS_FOR_FR (fs, 11, 39);
+ UPDATE_FS_FOR_FR (fs, 12, 40);
+ UPDATE_FS_FOR_FR (fs, 13, 41);
+ UPDATE_FS_FOR_FR (fs, 14, 42);
+ UPDATE_FS_FOR_FR (fs, 15, 43);
+ UPDATE_FS_FOR_FR (fs, 16, 44);
+ UPDATE_FS_FOR_FR (fs, 17, 45);
+ UPDATE_FS_FOR_FR (fs, 18, 46);
+ UPDATE_FS_FOR_FR (fs, 19, 47);
+ UPDATE_FS_FOR_FR (fs, 20, 48);
+ UPDATE_FS_FOR_FR (fs, 21, 49);
+ UPDATE_FS_FOR_FR (fs, 22, 50);
+ UPDATE_FS_FOR_FR (fs, 23, 51);
+ UPDATE_FS_FOR_FR (fs, 24, 52);
+ UPDATE_FS_FOR_FR (fs, 25, 53);
+ UPDATE_FS_FOR_FR (fs, 26, 54);
+ UPDATE_FS_FOR_FR (fs, 27, 55);
+ UPDATE_FS_FOR_FR (fs, 28, 56);
+ UPDATE_FS_FOR_FR (fs, 29, 57);
+ UPDATE_FS_FOR_FR (fs, 30, 58);
+ UPDATE_FS_FOR_FR (fs, 31, 59);
+
+ UPDATE_FS_FOR_SAR (fs, 60);
+ }
+ else
+ {
+ UPDATE_FS_FOR_FR (fs, 4, 32);
+ UPDATE_FS_FOR_FR (fs, 5, 34);
+ UPDATE_FS_FOR_FR (fs, 6, 36);
+ UPDATE_FS_FOR_FR (fs, 7, 38);
+ UPDATE_FS_FOR_FR (fs, 8, 40);
+ UPDATE_FS_FOR_FR (fs, 9, 44);
+ UPDATE_FS_FOR_FR (fs, 10, 44);
+ UPDATE_FS_FOR_FR (fs, 11, 46);
+ UPDATE_FS_FOR_FR (fs, 12, 48);
+ UPDATE_FS_FOR_FR (fs, 13, 50);
+ UPDATE_FS_FOR_FR (fs, 14, 52);
+ UPDATE_FS_FOR_FR (fs, 15, 54);
+
+ if (!cpu)
+ cpu = sysconf (_SC_CPU_VERSION);
+
+ /* PA-RISC 1.0 only has 16 floating point registers. */
+ if (cpu != CPU_PA_RISC1_0)
+ {
+ UPDATE_FS_FOR_FR (fs, 16, 56);
+ UPDATE_FS_FOR_FR (fs, 17, 58);
+ UPDATE_FS_FOR_FR (fs, 18, 60);
+ UPDATE_FS_FOR_FR (fs, 19, 62);
+ UPDATE_FS_FOR_FR (fs, 20, 64);
+ UPDATE_FS_FOR_FR (fs, 21, 66);
+ UPDATE_FS_FOR_FR (fs, 22, 68);
+ UPDATE_FS_FOR_FR (fs, 23, 70);
+ UPDATE_FS_FOR_FR (fs, 24, 72);
+ UPDATE_FS_FOR_FR (fs, 25, 74);
+ UPDATE_FS_FOR_FR (fs, 26, 76);
+ UPDATE_FS_FOR_FR (fs, 27, 78);
+ UPDATE_FS_FOR_FR (fs, 28, 80);
+ UPDATE_FS_FOR_FR (fs, 29, 82);
+ UPDATE_FS_FOR_FR (fs, 30, 84);
+ UPDATE_FS_FOR_FR (fs, 31, 86);
+ }
+
+ UPDATE_FS_FOR_SAR (fs, 88);
+ }
+
+ fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN;
+ UPDATE_FS_FOR_PC (fs, DWARF_ALT_FRAME_RETURN_COLUMN);
+
+ return _URC_NO_REASON;
+ }
+
+ return _URC_END_OF_STACK;
+}
diff --git a/gcc/config/pa/linux-unwind.h b/gcc/config/pa/linux-unwind.h
index 62fa065cf0e..36b9b382708 100644
--- a/gcc/config/pa/linux-unwind.h
+++ b/gcc/config/pa/linux-unwind.h
@@ -131,8 +131,9 @@ pa32_fallback_frame_state (struct _Unwind_Context *context,
}
fs->regs.reg[88].how = REG_SAVED_OFFSET;
fs->regs.reg[88].loc.offset = (long) &sc->sc_sar - new_cfa;
- fs->regs.reg[0].how = REG_SAVED_OFFSET;
- fs->regs.reg[0].loc.offset = (long) &sc->sc_iaoq[0] - new_cfa;
- fs->retaddr_column = 0;
+ fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].how = REG_SAVED_OFFSET;
+ fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].loc.offset
+ = (long) &sc->sc_iaoq[0] - new_cfa;
+ fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN;
return _URC_NO_REASON;
}
diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h
index 0aa3361459e..4b6c91092f3 100644
--- a/gcc/config/pa/pa-hpux.h
+++ b/gcc/config/pa/pa-hpux.h
@@ -124,3 +124,5 @@ Boston, MA 02110-1301, USA. */
/* Define this so we can compile MS code for use with WINE. */
#undef HANDLE_PRAGMA_PACK_PUSH_POP
#define HANDLE_PRAGMA_PACK_PUSH_POP
+
+#define MD_UNWIND_SUPPORT "config/pa/hpux-unwind.h"
diff --git a/gcc/config/pa/pa-hpux11.h b/gcc/config/pa/pa-hpux11.h
index 7b34fe1ad47..ad16bb41e3f 100644
--- a/gcc/config/pa/pa-hpux11.h
+++ b/gcc/config/pa/pa-hpux11.h
@@ -134,7 +134,7 @@ Boston, MA 02110-1301, USA. */
#define LIB_SPEC \
"%{!shared:\
%{mt|pthread:-lpthread} -lc \
- %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}"
+ %{static:%{!nolibdld:-a shared -ldld -a archive -lpthread -lc}}}"
#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
diff --git a/gcc/config/pa/pa-linux.h b/gcc/config/pa/pa-linux.h
index 4115577dc62..fcbcebdb949 100644
--- a/gcc/config/pa/pa-linux.h
+++ b/gcc/config/pa/pa-linux.h
@@ -19,39 +19,6 @@ the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-/* A C expression whose value is RTL representing the location of the
- incoming return address at the beginning of any function, before the
- prologue. You only need to define this macro if you want to support
- call frame debugging information like that provided by DWARF 2. */
-#define INCOMING_RETURN_ADDR_RTX (gen_rtx_REG (word_mode, 2))
-#define DWARF_FRAME_RETURN_COLUMN (DWARF_FRAME_REGNUM (2))
-
-/* This macro chooses the encoding of pointers embedded in the exception
- handling sections. If at all possible, this should be defined such
- that the exception handling section will not require dynamic relocations,
- and so may be read-only.
-
- FIXME: We use DW_EH_PE_aligned to output a PLABEL constructor for
- global function pointers. */
-#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
- (CODE == 2 && GLOBAL ? DW_EH_PE_aligned : DW_EH_PE_absptr)
-
-/* Handle special EH pointer encodings. Absolute, pc-relative, and
- indirect are handled automatically. Since pc-relative encoding is
- not possible on the PA and we don't have the infrastructure for
- data relative encoding, we use aligned plabels for global function
- pointers. */
-#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
- do { \
- if (((ENCODING) & 0x0F) == DW_EH_PE_aligned) \
- { \
- fputs (integer_asm_op (SIZE, FALSE), FILE); \
- fputs ("P%", FILE); \
- assemble_name (FILE, XSTR (ADDR, 0)); \
- goto DONE; \
- } \
- } while (0)
-
#undef TARGET_OS_CPP_BUILTINS
#define TARGET_OS_CPP_BUILTINS() \
do \
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index fa43828225e..b83630fba32 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -404,12 +404,72 @@ extern struct rtx_def *hppa_pic_save_rtx (void);
gen_rtx_MEM (word_mode, \
gen_rtx_PLUS (word_mode, frame_pointer_rtx, \
TARGET_64BIT ? GEN_INT (-16) : GEN_INT (-20)))
-
-/* Offset from the argument pointer register value to the top of
- stack. This is different from FIRST_PARM_OFFSET because of the
- frame marker. */
-#define ARG_POINTER_CFA_OFFSET(FNDECL) 0
+/* Offset from the frame pointer register value to the top of stack. */
+#define FRAME_POINTER_CFA_OFFSET(FNDECL) 0
+
+/* A C expression whose value is RTL representing the location of the
+ incoming return address at the beginning of any function, before the
+ prologue. You only need to define this macro if you want to support
+ call frame debugging information like that provided by DWARF 2. */
+#define INCOMING_RETURN_ADDR_RTX (gen_rtx_REG (word_mode, 2))
+#define DWARF_FRAME_RETURN_COLUMN (DWARF_FRAME_REGNUM (2))
+
+/* A C expression whose value is an integer giving a DWARF 2 column
+ number that may be used as an alternate return column. This should
+ be defined only if DWARF_FRAME_RETURN_COLUMN is set to a general
+ register, but an alternate column needs to be used for signal frames.
+
+ Column 0 is not used but unfortunately its register size is set to
+ 4 bytes (sizeof CCmode) so it can't be used on 64-bit targets. */
+#define DWARF_ALT_FRAME_RETURN_COLUMN FIRST_PSEUDO_REGISTER
+
+/* This macro chooses the encoding of pointers embedded in the exception
+ handling sections. If at all possible, this should be defined such
+ that the exception handling section will not require dynamic relocations,
+ and so may be read-only.
+
+ Because the HP assembler auto aligns, it is necessary to use
+ DW_EH_PE_aligned. It's not possible to make the data read-only
+ on the HP-UX SOM port since the linker requires fixups for label
+ differences in different sections to be word aligned. However,
+ the SOM linker can do unaligned fixups for absolute pointers.
+ We also need aligned pointers for global and function pointers.
+
+ Although the HP-UX 64-bit ELF linker can handle unaligned pc-relative
+ fixups, the runtime doesn't have a consistent relationship between
+ text and data for dynamically loaded objects. Thus, it's not possible
+ to use pc-relative encoding for pointers on this target. It may be
+ possible to use segment relative encodings but GAS doesn't currently
+ have a mechanism to generate these encodings. For other targets, we
+ use pc-relative encoding for pointers. If the pointer might require
+ dynamic relocation, we make it indirect. */
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
+ (TARGET_GAS && !TARGET_HPUX \
+ ? (DW_EH_PE_pcrel \
+ | ((GLOBAL) || (CODE) == 2 ? DW_EH_PE_indirect : 0) \
+ | (TARGET_64BIT ? DW_EH_PE_sdata8 : DW_EH_PE_sdata4)) \
+ : (!TARGET_GAS || (GLOBAL) || (CODE) == 2 \
+ ? DW_EH_PE_aligned : DW_EH_PE_absptr))
+
+/* Handle special EH pointer encodings. Absolute, pc-relative, and
+ indirect are handled automatically. We output pc-relative, and
+ indirect pc-relative ourself since we need some special magic to
+ generate pc-relative relocations, and to handle indirect function
+ pointers. */
+#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
+ do { \
+ if (((ENCODING) & 0x70) == DW_EH_PE_pcrel) \
+ { \
+ fputs (integer_asm_op (SIZE, FALSE), FILE); \
+ if ((ENCODING) & DW_EH_PE_indirect) \
+ output_addr_const (FILE, get_deferred_plabel (ADDR)); \
+ else \
+ assemble_name (FILE, XSTR ((ADDR), 0)); \
+ fputs ("+8-$PIC_pcrel$0", FILE); \
+ goto DONE; \
+ } \
+ } while (0)
/* The letters I, J, K, L and M in a register constraint string
can be used to stand for particular ranges of immediate operands.
diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h
index 056f3d83d8b..9f51f66ae31 100644
--- a/gcc/config/pa/pa64-hpux.h
+++ b/gcc/config/pa/pa64-hpux.h
@@ -56,23 +56,25 @@ Boston, MA 02110-1301, USA. */
#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
#define LIB_SPEC \
"%{!shared:\
- %{!p:%{!pg: -lc %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
+ %{!p:%{!pg: %{static:-lpthread} -lc\
+ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
%{p:%{!pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
- -lprof %{static:-a archive} -lc\
+ -lprof %{static:-a archive -lpthread} -lc\
%{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
%{pg:%{static:%{!mhp-ld:-a shared}%{mhp-ld:-a archive_shared}}\
- -lgprof %{static:-a archive} -lc\
+ -lgprof %{static:-a archive -lpthread} -lc\
%{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
/usr/lib/pa20_64/milli.a"
#else
#define LIB_SPEC \
"%{!shared:\
- %{!p:%{!pg: -lc %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
+ %{!p:%{!pg: %{static:-lpthread} -lc\
+ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
%{p:%{!pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
- -lprof %{static:-a archive} -lc\
+ -lprof %{static:-a archive -lpthread} -lc\
%{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
%{pg:%{static:%{mgnu-ld:-a shared}%{!mgnu-ld:-a archive_shared}}\
- -lgprof %{static:-a archive} -lc\
+ -lgprof %{static:-a archive -lpthread} -lc\
%{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}}\
/usr/lib/pa20_64/milli.a"
#endif
diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h
index 109e2a16476..e397b9dfd8e 100644
--- a/gcc/config/pa/som.h
+++ b/gcc/config/pa/som.h
@@ -34,15 +34,6 @@ Boston, MA 02110-1301, USA. */
#define DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
-/* Select a format to encode pointers in exception handling data. CODE
- is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
- true if the symbol may be affected by dynamic relocations. Because
- the HP assembler does auto alignment, it is necessary to use
- DW_EH_PE_aligned instead of the default DW_EH_PE_absptr. */
-
-#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
- (TARGET_GAS ? DW_EH_PE_absptr : DW_EH_PE_aligned)
-
/* HPUX has a program 'chatr' to list the dependencies of dynamically
linked executables and shared libraries. */
#define LDD_SUFFIX "chatr"
diff --git a/gcc/config/rs6000/aix52.h b/gcc/config/rs6000/aix52.h
index d793d643141..21f38f4e0f1 100644
--- a/gcc/config/rs6000/aix52.h
+++ b/gcc/config/rs6000/aix52.h
@@ -61,6 +61,7 @@ do { \
%{mcpu=power3: -m620} \
%{mcpu=power4: -m620} \
%{mcpu=power5: -m620} \
+%{mcpu=power5+: -m620} \
%{mcpu=powerpc: -mppc} \
%{mcpu=rs64a: -mppc} \
%{mcpu=603: -m603} \
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 0d633efed41..d1635ff38f0 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -124,9 +124,14 @@ do { \
mcpu=G5:ppc970; \
:ppc}}"
+/* crt2.o is at least partially required for 10.3.x and earlier. */
+#define DARWIN_CRT2_SPEC \
+ "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}"
+
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
{ "darwin_arch", "%{m64:ppc64;:ppc}" }, \
+ { "darwin_crt2", DARWIN_CRT2_SPEC }, \
{ "darwin_subarch", DARWIN_SUBARCH_SPEC },
/* Output a .machine directive. */
diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md
index 4ce00b0674d..0ede69dcd1f 100644
--- a/gcc/config/rs6000/predicates.md
+++ b/gcc/config/rs6000/predicates.md
@@ -1038,10 +1038,9 @@
return 0;
dest_regno = REGNO (SET_DEST (XVECEXP (op, 0, 0)));
- src_regno = REGNO (SET_SRC (XVECEXP (op, 0, 0)));
+ src_regno = REGNO (XVECEXP (SET_SRC (XVECEXP (op, 0, 0)), 0, 1));
- if (dest_regno != VRSAVE_REGNO
- && src_regno != VRSAVE_REGNO)
+ if (dest_regno != VRSAVE_REGNO || src_regno != VRSAVE_REGNO)
return 0;
for (i = 1; i < count; i++)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 51244ae2b00..67416c20e62 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -94,8 +94,18 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
builtin_define ("_ARCH_PWR");
if (TARGET_POWERPC)
builtin_define ("_ARCH_PPC");
+ if (TARGET_PPC_GPOPT)
+ builtin_define ("_ARCH_PPCSQ");
+ if (TARGET_PPC_GFXOPT)
+ builtin_define ("_ARCH_PPCGR");
if (TARGET_POWERPC64)
builtin_define ("_ARCH_PPC64");
+ if (TARGET_MFCRF)
+ builtin_define ("_ARCH_PWR4");
+ if (TARGET_POPCNTB)
+ builtin_define ("_ARCH_PWR5");
+ if (TARGET_FPRND)
+ builtin_define ("_ARCH_PWR5X");
if (! TARGET_POWER && ! TARGET_POWER2 && ! TARGET_POWERPC)
builtin_define ("_ARCH_COM");
if (TARGET_ALTIVEC)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 2c89cf54938..fb3c3a10383 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1152,6 +1152,9 @@ rs6000_override_options (const char *default_cpu)
{"power5", PROCESSOR_POWER5,
POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT
| MASK_MFCRF | MASK_POPCNTB},
+ {"power5+", PROCESSOR_POWER5,
+ POWERPC_BASE_MASK | MASK_POWERPC64 | MASK_PPC_GFXOPT
+ | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND},
{"powerpc", PROCESSOR_POWERPC, POWERPC_BASE_MASK},
{"powerpc64", PROCESSOR_POWERPC64,
POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
@@ -1177,7 +1180,7 @@ rs6000_override_options (const char *default_cpu)
POWER_MASKS = MASK_POWER | MASK_POWER2 | MASK_MULTIPLE | MASK_STRING,
POWERPC_MASKS = (POWERPC_BASE_MASK | MASK_PPC_GPOPT
| MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_ALTIVEC
- | MASK_MFCRF)
+ | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND)
};
rs6000_init_hard_regno_mode_ok ();
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 35843029da8..d2b54916003 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -72,6 +72,7 @@
%{mcpu=power3: -mppc64} \
%{mcpu=power4: -mpower4} \
%{mcpu=power5: -mpower4} \
+%{mcpu=power5+: -mpower4} \
%{mcpu=powerpc: -mppc} \
%{mcpu=rios: -mpwr} \
%{mcpu=rios1: -mpwr} \
@@ -151,6 +152,14 @@
#define TARGET_POPCNTB 0
#endif
+/* Define TARGET_FPRND if the target assembler does not support the
+ fp rounding instructions. */
+
+#ifndef HAVE_AS_FPRND
+#undef TARGET_FPRND
+#define TARGET_FPRND 0
+#endif
+
#ifndef TARGET_SECURE_PLT
#define TARGET_SECURE_PLT 0
#endif
@@ -2024,6 +2033,26 @@ extern int toc_initialized;
while (0)
#endif
+#if HAVE_GAS_WEAKREF
+#define ASM_OUTPUT_WEAKREF(FILE, DECL, NAME, VALUE) \
+ do \
+ { \
+ fputs ("\t.weakref\t", (FILE)); \
+ RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
+ fputs (", ", (FILE)); \
+ RS6000_OUTPUT_BASENAME ((FILE), (VALUE)); \
+ if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL \
+ && DEFAULT_ABI == ABI_AIX && DOT_SYMBOLS) \
+ { \
+ fputs ("\n\t.weakref\t.", (FILE)); \
+ RS6000_OUTPUT_BASENAME ((FILE), (NAME)); \
+ fputs (", .", (FILE)); \
+ RS6000_OUTPUT_BASENAME ((FILE), (VALUE)); \
+ } \
+ fputc ('\n', (FILE)); \
+ } while (0)
+#endif
+
/* This implements the `alias' attribute. */
#undef ASM_OUTPUT_DEF_FROM_DECLS
#define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 1776b9a86e0..935775aef3f 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -34,6 +34,10 @@
(UNSPEC_MOVSI_GOT 8)
(UNSPEC_MV_CR_OV 9) ; move_from_CR_ov_bit
(UNSPEC_FCTIWZ 10)
+ (UNSPEC_FRIM 11)
+ (UNSPEC_FRIN 12)
+ (UNSPEC_FRIP 13)
+ (UNSPEC_FRIZ 14)
(UNSPEC_LD_MPIC 15) ; load_macho_picbase
(UNSPEC_MPIC_CORRECT 16) ; macho_correct_pic
(UNSPEC_TLSGD 17)
@@ -5317,6 +5321,62 @@
"{fcirz|fctiwz} %0,%1"
[(set_attr "type" "fp")])
+(define_insn "btruncdf2"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
+ "friz %0,%1"
+ [(set_attr "type" "fp")])
+
+(define_insn "btruncsf2"
+ [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
+ (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
+ "friz %0,%1"
+ [(set_attr "type" "fp")])
+
+(define_insn "ceildf2"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
+ "frip %0,%1"
+ [(set_attr "type" "fp")])
+
+(define_insn "ceilsf2"
+ [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
+ (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
+ "frip %0,%1"
+ [(set_attr "type" "fp")])
+
+(define_insn "floordf2"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
+ "frim %0,%1"
+ [(set_attr "type" "fp")])
+
+(define_insn "floorsf2"
+ [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
+ (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
+ "frim %0,%1"
+ [(set_attr "type" "fp")])
+
+(define_insn "rounddf2"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
+ "frin %0,%1"
+ [(set_attr "type" "fp")])
+
+(define_insn "roundsf2"
+ [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
+ (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS"
+ "frin %0,%1"
+ [(set_attr "type" "fp")])
+
; An UNSPEC is used so we don't have to support SImode in FP registers.
(define_insn "stfiwx"
[(set (match_operand:SI 0 "memory_operand" "=Z")
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 43392ddd8ea..05c6ce570f0 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -54,11 +54,15 @@ Use PowerPC Graphics group optional instructions
mmfcrf
Target Report Mask(MFCRF)
-Generate single field mfcr instruction
+Use PowerPC V2.01 single field mfcr instruction
mpopcntb
Target Report Mask(POPCNTB)
-Use PowerPC/AS popcntb instruction
+Use PowerPC V2.02 popcntb instruction
+
+mfprnd
+Target Report Mask(FPRND)
+Use PowerPC V2.02 floating point rounding instructions
maltivec
Target Report Mask(ALTIVEC)
diff --git a/gcc/configure b/gcc/configure
index ba43b58a4c9..f9bb1e9015f 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -15577,6 +15577,52 @@ _ACEOF
fi
case $target in
+ *-*-aix*) conftest_s=' .machine "pwr5x"
+ .csect .text[PR]
+ frin 1,1';;
+ *) conftest_s=' .machine power5
+ .text
+ frin 1,1';;
+ esac
+
+ echo "$as_me:$LINENO: checking assembler for fp round support" >&5
+echo $ECHO_N "checking assembler for fp round support... $ECHO_C" >&6
+if test "${gcc_cv_as_powerpc_fprnd+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_as_powerpc_fprnd=no
+ if test $in_tree_gas = yes; then
+ if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 17 \) \* 1000 + 0`
+ then gcc_cv_as_powerpc_fprnd=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ echo "$conftest_s" > conftest.s
+ if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
+ then
+ gcc_cv_as_powerpc_fprnd=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_powerpc_fprnd" >&5
+echo "${ECHO_T}$gcc_cv_as_powerpc_fprnd" >&6
+if test $gcc_cv_as_powerpc_fprnd = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AS_FPRND 1
+_ACEOF
+
+fi
+
+ case $target in
*-*-aix*) conftest_s=' .csect .text[PR]
LCF..0:
addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 5cee180e021..169a7cb9c4e 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2763,6 +2763,21 @@ foo: nop
[Define if your assembler supports popcntb field.])])
case $target in
+ *-*-aix*) conftest_s=' .machine "pwr5x"
+ .csect .text[[PR]]
+ frin 1,1';;
+ *) conftest_s=' .machine power5
+ .text
+ frin 1,1';;
+ esac
+
+ gcc_GAS_CHECK_FEATURE([fp round support],
+ gcc_cv_as_powerpc_fprnd, [2,17,0],,
+ [$conftest_s],,
+ [AC_DEFINE(HAVE_AS_FPRND, 1,
+ [Define if your assembler supports fprnd.])])
+
+ case $target in
*-*-aix*) conftest_s=' .csect .text[[PR]]
LCF..0:
addis 11,30,_GLOBAL_OFFSET_TABLE_-LCF..0@ha';;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6edab04fe2b..378c324909b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,75 @@
+2005-11-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/24580
+ * method.c (locate_copy): Also use skip_artificial_parms here.
+ (synthesize_exception_spec): Use CLASS_TYPE_P rather than checking
+ for RECORD_TYPE.
+ (locate_ctor): Abort if we fail to find a default constructor.
+
+2005-11-15 Mike Stump <mrs@apple.com>
+
+ * name-lookup.c (lookup_name_two): Add.
+ * name-lookup.h: Likewise.
+
+2005-11-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/24667
+ * typeck.c (check_for_casting_away_constness): Use the diag_fn.
+ (build_const_cast_1): Call it, for C-style casts.
+
+2005-11-14 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/24687
+ * pt.c (check_explicit_specialization): Don't check for C linkage.
+ (push_template_decl_real): Likewise.
+ * parser.c (cp_parser_explicit_specialization): Check here.
+ (cp_parser_template_declaration_after_export): And here.
+
+ * parser.c (cp_lexer_get_preprocessor_token): Initialize keyword
+ field.
+
+2005-11-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/24580
+ * method.c (locate_ctor): Skip all artificial parms, not just
+ 'this'.
+
+2005-11-14 Mark Mitchell <mark@codesourcery.com>
+
+ * parser.c (eof_token): Add initializer for ambiguous_p.
+
+2005-11-13 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/24817
+ * decl.c (check_redeclaration_exception_specification): New
+ function.
+ (duplicate_decls): Use it.
+ * error.c (fndecl_to_string): Print the template parameter list.
+
+ PR c++/20293
+ * cxx-pretty-print.c (pp_cxx_statement): Print qualifying scopes
+ for namespaces.
+ (pp_cxx_original_namespace_definition): Likewise.
+ * name-lookup.c (ambiguous_decl): Don't issue error messages;
+ instead return lists of ambiguous candidates.
+ (select_decl): Handle ambiguous namespace lookups.
+ * parser.c (cp_token): Add ambiguous_p.
+ (cp_lexer_get_preprocessor_token): Set it.
+ (cp_parser_diagnose_invalid_type_name): Avoid duplicate messages
+ when a qualified name uses an invalid scope.
+ (cp_parser_primary_expression): Print ambiguous candidates.
+ (cp_parser_type_parameter): Adjust comment to reflect new
+ parameter name for cp_parser_lookup_name.
+ (cp_parser_template_argument): Likewise.
+ (cp_parser_elaborated_type_specifier): Likewise.
+ (cp_parser_namespace_name): Likewise.
+ (cp_parser_class_name): Print ambiguous candidates.
+ (cp_parser_lookup_name): Rename ambiguous_p parameter to
+ ambiguous_decls. Use it to return a list of ambiguous candiates
+ when a lookup is ambiguous.
+ (cp_parser_lookup_name_simple): Adjust comment to reflect new
+ parameter name for cp_parser_lookup_name.
+
2005-11-12 Jakub Jelinek <jakub@redhat.com>
PR c++/24780
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index f4f8819d1ed..cdaf470ce26 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1514,6 +1514,8 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
case USING_STMT:
pp_cxx_identifier (pp, "using");
pp_cxx_identifier (pp, "namespace");
+ if (DECL_CONTEXT (t))
+ pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_qualified_id (pp, USING_STMT_NAMESPACE (t));
break;
@@ -1701,6 +1703,8 @@ static void
pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t)
{
pp_cxx_identifier (pp, "namespace");
+ if (DECL_CONTEXT (t))
+ pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
if (DECL_NAME (t))
pp_cxx_unqualified_id (pp, t);
pp_cxx_whitespace (pp);
@@ -1723,10 +1727,15 @@ static void
pp_cxx_namespace_alias_definition (cxx_pretty_printer *pp, tree t)
{
pp_cxx_identifier (pp, "namespace");
+ if (DECL_CONTEXT (t))
+ pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_unqualified_id (pp, t);
pp_cxx_whitespace (pp);
pp_equal (pp);
pp_cxx_whitespace (pp);
+ if (DECL_CONTEXT (DECL_NAMESPACE_ALIAS (t)))
+ pp_cxx_nested_name_specifier (pp,
+ DECL_CONTEXT (DECL_NAMESPACE_ALIAS (t)));
pp_cxx_qualified_id (pp, DECL_NAMESPACE_ALIAS (t));
pp_cxx_semicolon (pp);
}
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c6ee7cb3b92..6e0c5dca02d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1064,6 +1064,41 @@ warn_extern_redeclared_static (tree newdecl, tree olddecl)
pedwarn ("previous declaration of %q+D", olddecl);
}
+/* NEW_DECL is a redeclaration of OLD_DECL; both are functions or
+ function templates. If their exception specifications do not
+ match, issue an a diagnostic. */
+
+static void
+check_redeclaration_exception_specification (tree new_decl,
+ tree old_decl)
+{
+ tree new_type;
+ tree old_type;
+ tree new_exceptions;
+ tree old_exceptions;
+
+ new_type = TREE_TYPE (new_decl);
+ new_exceptions = TYPE_RAISES_EXCEPTIONS (new_type);
+ old_type = TREE_TYPE (old_decl);
+ old_exceptions = TYPE_RAISES_EXCEPTIONS (old_type);
+
+ /* [except.spec]
+
+ If any declaration of a function has an exception-specification,
+ all declarations, including the definition and an explicit
+ specialization, of that function shall have an
+ exception-specification with the same set of type-ids. */
+ if ((pedantic || ! DECL_IN_SYSTEM_HEADER (old_decl))
+ && ! DECL_IS_BUILTIN (old_decl)
+ && flag_exceptions
+ && !comp_except_specs (new_exceptions, old_exceptions,
+ /*exact=*/true))
+ {
+ error ("declaration of %qF throws different exceptions", new_decl);
+ error ("from previous declaration %q+F", old_decl);
+ }
+}
+
/* If NEWDECL is a redeclaration of OLDDECL, merge the declarations.
If the redeclaration is invalid, a diagnostic is issued, and the
error_mark_node is returned. Otherwise, OLDDECL is returned.
@@ -1555,30 +1590,35 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (TREE_CODE (newdecl) == TEMPLATE_DECL)
{
- TREE_TYPE (olddecl) = TREE_TYPE (DECL_TEMPLATE_RESULT (olddecl));
+ tree old_result;
+ tree new_result;
+ old_result = DECL_TEMPLATE_RESULT (olddecl);
+ new_result = DECL_TEMPLATE_RESULT (newdecl);
+ TREE_TYPE (olddecl) = TREE_TYPE (old_result);
DECL_TEMPLATE_SPECIALIZATIONS (olddecl)
= chainon (DECL_TEMPLATE_SPECIALIZATIONS (olddecl),
DECL_TEMPLATE_SPECIALIZATIONS (newdecl));
+ if (DECL_FUNCTION_TEMPLATE_P (newdecl))
+ {
+ DECL_INLINE (old_result)
+ |= DECL_INLINE (new_result);
+ DECL_DECLARED_INLINE_P (old_result)
+ |= DECL_DECLARED_INLINE_P (new_result);
+ check_redeclaration_exception_specification (newdecl, olddecl);
+ }
+
/* If the new declaration is a definition, update the file and
line information on the declaration. */
- if (DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)) == NULL_TREE
- && DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl)) != NULL_TREE)
+ if (DECL_INITIAL (old_result) == NULL_TREE
+ && DECL_INITIAL (new_result) != NULL_TREE)
{
DECL_SOURCE_LOCATION (olddecl)
- = DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (olddecl))
+ = DECL_SOURCE_LOCATION (old_result)
= DECL_SOURCE_LOCATION (newdecl);
if (DECL_FUNCTION_TEMPLATE_P (newdecl))
- DECL_ARGUMENTS (DECL_TEMPLATE_RESULT (olddecl))
- = DECL_ARGUMENTS (DECL_TEMPLATE_RESULT (newdecl));
- }
-
- if (DECL_FUNCTION_TEMPLATE_P (newdecl))
- {
- DECL_INLINE (DECL_TEMPLATE_RESULT (olddecl))
- |= DECL_INLINE (DECL_TEMPLATE_RESULT (newdecl));
- DECL_DECLARED_INLINE_P (DECL_TEMPLATE_RESULT (olddecl))
- |= DECL_DECLARED_INLINE_P (DECL_TEMPLATE_RESULT (newdecl));
+ DECL_ARGUMENTS (old_result)
+ = DECL_ARGUMENTS (new_result);
}
return olddecl;
@@ -1622,26 +1662,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* Do this after calling `merge_types' so that default
parameters don't confuse us. */
- else if (TREE_CODE (newdecl) == FUNCTION_DECL
- && (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl))
- != TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl))))
- {
- TREE_TYPE (newdecl) = build_exception_variant (newtype,
- TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)));
- TREE_TYPE (olddecl) = build_exception_variant (newtype,
- TYPE_RAISES_EXCEPTIONS (oldtype));
-
- if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl))
- && ! DECL_IS_BUILTIN (olddecl)
- && flag_exceptions
- && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)),
- TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1))
- {
- error ("declaration of %qF throws different exceptions",
- newdecl);
- error ("than previous declaration %q+F", olddecl);
- }
- }
+ else if (TREE_CODE (newdecl) == FUNCTION_DECL)
+ check_redeclaration_exception_specification (newdecl, olddecl);
TREE_TYPE (newdecl) = TREE_TYPE (olddecl) = newtype;
/* Lay the type out, unless already done. */
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 22c2d304d88..674e407055f 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2008,7 +2008,8 @@ fndecl_to_string (tree fndecl, int verbose)
{
int flags;
- flags = TFF_EXCEPTION_SPECIFICATION | TFF_DECL_SPECIFIERS;
+ flags = TFF_EXCEPTION_SPECIFICATION | TFF_DECL_SPECIFIERS
+ | TFF_TEMPLATE_HEADER;
if (verbose)
flags |= TFF_FUNCTION_DEFAULT_ARGUMENTS;
reinit_cxx_pp ();
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 67e42ea1e0e..f3c86d3178d 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -847,7 +847,7 @@ synthesize_exception_spec (tree type, tree (*extractor) (tree, void*),
continue;
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
- if (TREE_CODE (type) != RECORD_TYPE)
+ if (!CLASS_TYPE_P (type))
continue;
fn = (*extractor) (type, client);
@@ -889,10 +889,12 @@ locate_ctor (tree type, void *client ATTRIBUTE_UNUSED)
tree fn = OVL_CURRENT (fns);
tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn));
- if (sufficient_parms_p (TREE_CHAIN (parms)))
+ parms = skip_artificial_parms_for (fn, parms);
+
+ if (sufficient_parms_p (parms))
return fn;
}
- return NULL_TREE;
+ gcc_unreachable ();
}
struct copy_data
@@ -939,7 +941,7 @@ locate_copy (tree type, void *client_)
int excess;
int quals;
- parms = TREE_CHAIN (parms);
+ parms = skip_artificial_parms_for (fn, parms);
if (!parms)
continue;
src_type = non_reference (TREE_VALUE (parms));
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 70c764956be..f61f521a401 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -3401,20 +3401,9 @@ ambiguous_decl (tree name, struct scope_binding *old, cxx_binding *new,
old->value = merge_functions (old->value, val);
else
{
- /* Some declarations are functions, some are not. */
- if (flags & LOOKUP_COMPLAIN)
- {
- /* If we've already given this error for this lookup,
- old->value is error_mark_node, so let's not
- repeat ourselves. */
- if (old->value != error_mark_node)
- {
- error ("use of %qD is ambiguous", name);
- error (" first declared as %q+#D here", old->value);
- }
- error (" also declared as %q+#D here", val);
- }
- old->value = error_mark_node;
+ old->value = tree_cons (NULL_TREE, old->value,
+ build_tree_list (NULL_TREE, new->value));
+ TREE_TYPE (old->value) = error_mark_node;
}
}
/* ... and copy the type. */
@@ -3610,7 +3599,8 @@ select_decl (const struct scope_binding *binding, int flags)
if (LOOKUP_NAMESPACES_ONLY (flags))
{
/* We are not interested in types. */
- if (val && TREE_CODE (val) == NAMESPACE_DECL)
+ if (val && (TREE_CODE (val) == NAMESPACE_DECL
+ || TREE_CODE (val) == TREE_LIST))
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
}
@@ -4017,6 +4007,14 @@ lookup_name_prefer_type (tree name, int prefer_type)
0, LOOKUP_COMPLAIN);
}
+/* Similar to `lookup_name' for the benefit of common code. */
+
+tree
+lookup_name_two (tree name, int prefer_type)
+{
+ return lookup_name_prefer_type (name, prefer_type);
+}
+
/* Look up NAME for type used in elaborated name specifier in
the scopes given by SCOPE. SCOPE can be either TS_CURRENT or
TS_WITHIN_ENCLOSING_NON_CLASS. Although not implied by the
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index b3b8289a2f2..7bb8cffcab7 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -314,6 +314,7 @@ extern void pushlevel_class (void);
extern void poplevel_class (void);
extern tree pushdecl_with_scope (tree, cxx_scope *, bool);
extern tree lookup_name_prefer_type (tree, int);
+extern tree lookup_name_two (tree, int);
extern tree lookup_name_real (tree, int, int, bool, int, int);
extern tree lookup_type_scope (tree, tag_scope);
extern tree namespace_binding (tree, tree);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index cecbcb356a6..9cad919e700 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -61,6 +61,10 @@ typedef struct cp_token GTY (())
BOOL_BITFIELD in_system_header : 1;
/* True if this token is from a context where it is implicitly extern "C" */
BOOL_BITFIELD implicit_extern_c : 1;
+ /* True for a CPP_NAME token that is not a keyword (i.e., for which
+ KEYWORD is RID_MAX) iff this name was looked up and found to be
+ ambiguous. An error has already been reported. */
+ BOOL_BITFIELD ambiguous_p : 1;
/* The value associated with this token, if any. */
tree value;
/* The location at which this token was found. */
@@ -74,7 +78,7 @@ DEF_VEC_ALLOC_P (cp_token_position,heap);
static const cp_token eof_token =
{
- CPP_EOF, RID_MAX, 0, PRAGMA_NONE, 0, 0, NULL_TREE,
+ CPP_EOF, RID_MAX, 0, PRAGMA_NONE, 0, 0, false, NULL_TREE,
#if USE_MAPPED_LOCATION
0
#else
@@ -399,10 +403,9 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer ATTRIBUTE_UNUSED ,
pending_lang_change = 0;
token->implicit_extern_c = is_extern_c > 0;
- switch (token->type)
+ /* Check to see if this token is a keyword. */
+ if (token->type == CPP_NAME)
{
- case CPP_NAME:
- /* Check to see if this token is a keyword. */
if (C_IS_RESERVED_WORD (token->value))
{
/* Mark this token as a keyword. */
@@ -415,10 +418,15 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer ATTRIBUTE_UNUSED ,
mapped to `const'. */
token->value = ridpointers[token->keyword];
}
- break;
-
- case CPP_AT_NAME:
- /* Handle Objective-C++ keywords. */
+ else
+ {
+ token->ambiguous_p = false;
+ token->keyword = RID_MAX;
+ }
+ }
+ /* Handle Objective-C++ keywords. */
+ else if (token->type == CPP_AT_NAME)
+ {
token->type = CPP_KEYWORD;
switch (C_RID_CODE (token->value))
{
@@ -432,16 +440,12 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer ATTRIBUTE_UNUSED ,
case RID_CATCH: token->keyword = RID_AT_CATCH; break;
default: token->keyword = C_RID_CODE (token->value);
}
- break;
-
- case CPP_PRAGMA:
+ }
+ else if (token->type == CPP_PRAGMA)
+ {
/* We smuggled the cpp_token->u.pragma value in an INTEGER_CST. */
token->pragma_kind = TREE_INT_CST_LOW (token->value);
token->value = NULL;
- break;
-
- default:
- break;
}
}
@@ -1700,7 +1704,7 @@ static tree cp_parser_objc_statement
/* Utility Routines */
static tree cp_parser_lookup_name
- (cp_parser *, tree, enum tag_types, bool, bool, bool, bool *);
+ (cp_parser *, tree, enum tag_types, bool, bool, bool, tree *);
static tree cp_parser_lookup_name_simple
(cp_parser *, tree);
static tree cp_parser_maybe_treat_template_as_class
@@ -2057,7 +2061,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
if (TREE_CODE (decl) == TEMPLATE_DECL)
error ("invalid use of template-name %qE without an argument list",
decl);
- else if (!parser->scope || parser->scope == error_mark_node)
+ else if (!parser->scope)
{
/* Issue an error message. */
error ("%qE does not name a type", id);
@@ -2104,7 +2108,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
}
/* Here we diagnose qualified-ids where the scope is actually correct,
but the identifier does not resolve to a valid type name. */
- else
+ else if (parser->scope != error_mark_node)
{
if (TREE_CODE (parser->scope) == NAMESPACE_DECL)
error ("%qE in namespace %qE does not name a type",
@@ -3032,17 +3036,17 @@ cp_parser_primary_expression (cp_parser *parser,
/* Look up the name. */
else
{
- bool ambiguous_p;
+ tree ambiguous_decls;
decl = cp_parser_lookup_name (parser, id_expression,
none_type,
template_p,
/*is_namespace=*/false,
/*check_dependency=*/true,
- &ambiguous_p);
+ &ambiguous_decls);
/* If the lookup was ambiguous, an error will already have
been issued. */
- if (ambiguous_p)
+ if (ambiguous_decls)
return error_mark_node;
/* In Objective-C++, an instance variable (ivar) may be preferred
@@ -3648,16 +3652,32 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser,
token = cp_lexer_consume_token (parser->lexer);
if (!error_p)
{
- tree decl;
-
- decl = cp_parser_lookup_name_simple (parser, token->value);
- if (TREE_CODE (decl) == TEMPLATE_DECL)
- error ("%qD used without template parameters", decl);
- else
- cp_parser_name_lookup_error
- (parser, token->value, decl,
- "is not a class or namespace");
- parser->scope = NULL_TREE;
+ if (!token->ambiguous_p)
+ {
+ tree decl;
+ tree ambiguous_decls;
+
+ decl = cp_parser_lookup_name (parser, token->value,
+ none_type,
+ /*is_template=*/false,
+ /*is_namespace=*/false,
+ /*check_dependency=*/true,
+ &ambiguous_decls);
+ if (TREE_CODE (decl) == TEMPLATE_DECL)
+ error ("%qD used without template parameters", decl);
+ else if (ambiguous_decls)
+ {
+ error ("reference to %qD is ambiguous",
+ token->value);
+ print_candidates (ambiguous_decls);
+ decl = error_mark_node;
+ }
+ else
+ cp_parser_name_lookup_error
+ (parser, token->value, decl,
+ "is not a class or namespace");
+ }
+ parser->scope = error_mark_node;
error_p = true;
/* Treat this as a successful nested-name-specifier
due to:
@@ -8532,7 +8552,7 @@ cp_parser_type_parameter (cp_parser* parser)
/*is_template=*/is_template,
/*is_namespace=*/false,
/*check_dependency=*/true,
- /*ambiguous_p=*/NULL);
+ /*ambiguous_decls=*/NULL);
/* See if the default argument is valid. */
default_argument
= check_template_template_default_arg (default_argument);
@@ -8888,7 +8908,7 @@ cp_parser_template_name (cp_parser* parser,
/*is_template=*/false,
/*is_namespace=*/false,
check_dependency_p,
- /*ambiguous_p=*/NULL);
+ /*ambiguous_decls=*/NULL);
decl = maybe_get_template_decl_from_type_decl (decl);
/* If DECL is a template, then the name was a template-name. */
@@ -9089,7 +9109,7 @@ cp_parser_template_argument (cp_parser* parser)
/*is_template=*/template_p,
/*is_namespace=*/false,
/*check_dependency=*/true,
- /*ambiguous_p=*/NULL);
+ /*ambiguous_decls=*/NULL);
if (TREE_CODE (argument) != TEMPLATE_DECL
&& TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
cp_parser_error (parser, "expected template-name");
@@ -9343,6 +9363,7 @@ cp_parser_explicit_instantiation (cp_parser* parser)
static void
cp_parser_explicit_specialization (cp_parser* parser)
{
+ bool need_lang_pop;
/* Look for the `template' keyword. */
cp_parser_require_keyword (parser, RID_TEMPLATE, "`template'");
/* Look for the `<'. */
@@ -9351,9 +9372,22 @@ cp_parser_explicit_specialization (cp_parser* parser)
cp_parser_require (parser, CPP_GREATER, "`>'");
/* We have processed another parameter list. */
++parser->num_template_parameter_lists;
+ /* [temp]
+
+ A template ... explicit specialization ... shall not have C
+ linkage. */
+ if (current_lang_name == lang_name_c)
+ {
+ error ("template specialization with C linkage");
+ /* Give it C++ linkage to avoid confusing other parts of the
+ front end. */
+ push_lang_context (lang_name_cplusplus);
+ need_lang_pop = true;
+ }
+ else
+ need_lang_pop = false;
/* Let the front end know that we are beginning a specialization. */
begin_specialization ();
-
/* If the next keyword is `template', we need to figure out whether
or not we're looking a template-declaration. */
if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TEMPLATE))
@@ -9370,9 +9404,12 @@ cp_parser_explicit_specialization (cp_parser* parser)
cp_parser_single_declaration (parser,
/*member_p=*/false,
/*friend_p=*/NULL);
-
/* We're done with the specialization. */
end_specialization ();
+ /* For the erroneous case of a template with C linkage, we pushed an
+ implicit C++ linkage scope; exit that scope now. */
+ if (need_lang_pop)
+ pop_lang_context ();
/* We're done with this parameter list. */
--parser->num_template_parameter_lists;
}
@@ -10012,7 +10049,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
/*is_template=*/false,
/*is_namespace=*/false,
/*check_dependency=*/true,
- /*ambiguous_p=*/NULL);
+ /*ambiguous_decls=*/NULL);
/* If we are parsing friend declaration, DECL may be a
TEMPLATE_DECL tree node here. However, we need to check
@@ -10308,7 +10345,7 @@ cp_parser_namespace_name (cp_parser* parser)
/*is_template=*/false,
/*is_namespace=*/true,
/*check_dependency=*/true,
- /*ambiguous_p=*/NULL);
+ /*ambiguous_decls=*/NULL);
/* If it's not a namespace, issue an error. */
if (namespace_decl == error_mark_node
|| TREE_CODE (namespace_decl) != NAMESPACE_DECL)
@@ -12545,9 +12582,13 @@ cp_parser_class_name (cp_parser *parser,
if (token->type == CPP_NAME
&& !cp_parser_nth_token_starts_template_argument_list_p (parser, 2))
{
+ cp_token *identifier_token;
tree identifier;
+ bool ambiguous_p;
/* Look for the identifier. */
+ identifier_token = cp_lexer_peek_token (parser->lexer);
+ ambiguous_p = identifier_token->ambiguous_p;
identifier = cp_parser_identifier (parser);
/* If the next token isn't an identifier, we are certainly not
looking at a class-name. */
@@ -12559,6 +12600,15 @@ cp_parser_class_name (cp_parser *parser,
decl = identifier;
else
{
+ tree ambiguous_decls;
+ /* If we already know that this lookup is ambiguous, then
+ we've already issued an error message; there's no reason
+ to check again. */
+ if (ambiguous_p)
+ {
+ cp_parser_simulate_error (parser);
+ return error_mark_node;
+ }
/* If the next token is a `::', then the name must be a type
name.
@@ -12575,7 +12625,18 @@ cp_parser_class_name (cp_parser *parser,
/*is_template=*/false,
/*is_namespace=*/false,
check_dependency_p,
- /*ambiguous_p=*/NULL);
+ &ambiguous_decls);
+ if (ambiguous_decls)
+ {
+ error ("reference to %qD is ambiguous", identifier);
+ print_candidates (ambiguous_decls);
+ if (cp_parser_parsing_tentatively (parser))
+ {
+ identifier_token->ambiguous_p = true;
+ cp_parser_simulate_error (parser);
+ }
+ return error_mark_node;
+ }
}
}
else
@@ -14516,8 +14577,9 @@ cp_parser_label_declaration (cp_parser* parser)
If CHECK_DEPENDENCY is TRUE, names are not looked up in dependent
types.
- If AMBIGUOUS_P is non-NULL, it is set to true if name-lookup
- results in an ambiguity, and false otherwise. */
+ If AMBIGUOUS_DECLS is non-NULL, *AMBIGUOUS_DECLS is set to a
+ TREE_LIST of candiates if name-lookup results in an ambiguity, and
+ NULL_TREE otherwise. */
static tree
cp_parser_lookup_name (cp_parser *parser, tree name,
@@ -14525,7 +14587,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
bool is_template,
bool is_namespace,
bool check_dependency,
- bool *ambiguous_p)
+ tree *ambiguous_decls)
{
int flags = 0;
tree decl;
@@ -14535,8 +14597,8 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
flags |= LOOKUP_COMPLAIN;
/* Assume that the lookup will be unambiguous. */
- if (ambiguous_p)
- *ambiguous_p = false;
+ if (ambiguous_decls)
+ *ambiguous_decls = NULL_TREE;
/* Now that we have looked up the name, the OBJECT_TYPE (if any) is
no longer valid. Note that if we are parsing tentatively, and
@@ -14693,8 +14755,8 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
/* If it's a TREE_LIST, the result of the lookup was ambiguous. */
if (TREE_CODE (decl) == TREE_LIST)
{
- if (ambiguous_p)
- *ambiguous_p = true;
+ if (ambiguous_decls)
+ *ambiguous_decls = decl;
/* The error message we have to print is too complicated for
cp_parser_error, so we incorporate its actions directly. */
if (!cp_parser_simulate_error (parser))
@@ -14736,7 +14798,7 @@ cp_parser_lookup_name_simple (cp_parser* parser, tree name)
/*is_template=*/false,
/*is_namespace=*/false,
/*check_dependency=*/true,
- /*ambiguous_p=*/NULL);
+ /*ambiguous_decls=*/NULL);
}
/* If DECL is a TEMPLATE_DECL that can be treated like a TYPE_DECL in
@@ -15200,6 +15262,7 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
tree decl = NULL_TREE;
tree parameter_list;
bool friend_p = false;
+ bool need_lang_pop;
/* Look for the `template' keyword. */
if (!cp_parser_require_keyword (parser, RID_TEMPLATE, "`template'"))
@@ -15208,7 +15271,19 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
/* And the `<'. */
if (!cp_parser_require (parser, CPP_LESS, "`<'"))
return;
-
+ /* [temp]
+
+ A template ... shall not have C linkage. */
+ if (current_lang_name == lang_name_c)
+ {
+ error ("template with C linkage");
+ /* Give it C++ linkage to avoid confusing other parts of the
+ front end. */
+ push_lang_context (lang_name_cplusplus);
+ need_lang_pop = true;
+ }
+ else
+ need_lang_pop = false;
/* If the next token is `>', then we have an invalid
specialization. Rather than complain about an invalid template
parameter, issue an error message here. */
@@ -15269,7 +15344,10 @@ cp_parser_template_declaration_after_export (cp_parser* parser, bool member_p)
/* Register member declarations. */
if (member_p && !friend_p && decl && !DECL_CLASS_TEMPLATE_P (decl))
finish_member_declaration (decl);
-
+ /* For the erroneous case of a template with C linkage, we pushed an
+ implicit C++ linkage scope; exit that scope now. */
+ if (need_lang_pop)
+ pop_lang_context ();
/* If DECL is a function template, we must return to parse it later.
(Even though there is no definition, there might be default
arguments that need handling.) */
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 9fac8c90fd1..a741fa855a1 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1895,8 +1895,6 @@ check_explicit_specialization (tree declarator,
("default argument specified in explicit specialization");
break;
}
- if (current_lang_name == lang_name_c)
- error ("template specialization with C linkage");
}
if (specialization || member_specialization || explicit_instantiation)
@@ -2985,10 +2983,8 @@ push_template_decl_real (tree decl, bool is_friend)
{
if (DECL_CLASS_SCOPE_P (decl))
member_template_p = true;
- if (current_lang_name == lang_name_c)
- error ("template with C linkage");
- else if (TREE_CODE (decl) == TYPE_DECL
- && ANON_AGGRNAME_P (DECL_NAME (decl)))
+ if (TREE_CODE (decl) == TYPE_DECL
+ && ANON_AGGRNAME_P (DECL_NAME (decl)))
error ("template class without a name");
else if (TREE_CODE (decl) == FUNCTION_DECL)
{
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 31e2d6f58fc..a86ee6a516e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4559,8 +4559,8 @@ check_for_casting_away_constness (tree src_type, tree dest_type,
const char *description)
{
if (diag_fn && casts_away_constness (src_type, dest_type))
- error ("%s from type %qT to type %qT casts away constness",
- description, src_type, dest_type);
+ diag_fn ("%s from type %qT to type %qT casts away constness",
+ description, src_type, dest_type);
}
/* Convert EXPR (an expression with pointer-to-member type) to TYPE
@@ -5085,9 +5085,9 @@ build_reinterpret_cast (tree type, tree expr)
/* Perform a const_cast from EXPR to TYPE. If the cast is valid,
return an appropriate expression. Otherwise, return
error_mark_node. If the cast is not valid, and COMPLAIN is true,
- then a diagnostic will be issued. If VALID_P is non-NULL, its
- value upon return will indicate whether or not the conversion
- succeeded. */
+ then a diagnostic will be issued. If VALID_P is non-NULL, we are
+ performing a C-style cast, its value upon return will indicate
+ whether or not the conversion succeeded. */
static tree
build_const_cast_1 (tree dst_type, tree expr, bool complain,
@@ -5163,7 +5163,15 @@ build_const_cast_1 (tree dst_type, tree expr, bool complain,
&& comp_ptr_ttypes_const (dst_type, src_type))
{
if (valid_p)
- *valid_p = true;
+ {
+ *valid_p = true;
+ /* This cast is actually a C-style cast. Issue a warning if
+ the user is making a potentially unsafe cast. */
+ if (warn_cast_qual)
+ check_for_casting_away_constness (src_type, dst_type,
+ warning0,
+ "cast");
+ }
if (reference_type)
{
expr = build_unary_op (ADDR_EXPR, expr, 0);
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c
index d969ee9160e..cde75573132 100644
--- a/gcc/crtstuff.c
+++ b/gcc/crtstuff.c
@@ -58,6 +58,12 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
identified the set of defines that need to go into auto-target.h,
this will have to do. */
#include "auto-host.h"
+#undef gid_t
+#undef pid_t
+#undef rlim_t
+#undef ssize_t
+#undef uid_t
+#undef vfork
#include "tconfig.h"
#include "tsystem.h"
#include "coretypes.h"
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 3e8d31e5065..f790a0fe3e9 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -186,7 +186,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
the latter is referenced directly, a strong reference prevails. */
#ifndef ASM_OUTPUT_WEAKREF
#if defined HAVE_GAS_WEAKREF
-#define ASM_OUTPUT_WEAKREF(FILE, NAME, VALUE) \
+#define ASM_OUTPUT_WEAKREF(FILE, DECL, NAME, VALUE) \
do \
{ \
fprintf ((FILE), "\t.weakref\t"); \
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 199b566ba01..0dd9bb1bf59 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -636,6 +636,7 @@ See RS/6000 and PowerPC Options.
-maltivec -mno-altivec @gol
-mpowerpc-gpopt -mno-powerpc-gpopt @gol
-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
+-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol
-mnew-mnemonics -mold-mnemonics @gol
-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
@@ -853,25 +854,21 @@ C++ header file to be turned into a precompiled header.
@item @var{file}.f
@itemx @var{file}.for
@itemx @var{file}.FOR
-Fortran source code which should not be preprocessed.
+Fixed form Fortran source code which should not be preprocessed.
@item @var{file}.F
@itemx @var{file}.fpp
@itemx @var{file}.FPP
-Fortran source code which must be preprocessed (with the traditional
+Fixed form Fortran source code which must be preprocessed (with the traditional
preprocessor).
-@item @var{file}.r
-Fortran source code which must be preprocessed with a RATFOR
-preprocessor (not included with GCC)@.
-
@item @var{file}.f90
@itemx @var{file}.f95
-Fortran 90/95 source code which should not be preprocessed.
+Free form Fortran source code which should not be preprocessed.
@item @var{file}.F90
@itemx @var{file}.F95
-Fortran 90/95 source code which must be preprocessed (with the
+Free form Fortran source code which must be preprocessed (with the
traditional preprocessor).
@c FIXME: Descriptions of Java file types.
@@ -895,6 +892,8 @@ package body). Such files are also called @dfn{bodies}.
@c Pascal:
@c @var{file}.p
@c @var{file}.pas
+@c Ratfor:
+@c @var{file}.r
@item @var{file}.s
Assembler code.
@@ -923,7 +922,7 @@ objective-c objective-c-header objective-c-cpp-output
objective-c++ objective-c++-header objective-c++-cpp-output
assembler assembler-with-cpp
ada
-f77 f77-cpp-input ratfor
+f77 f77-cpp-input
f95 f95-cpp-input
java
treelang
@@ -5830,6 +5829,17 @@ This parameter is ignored when @option{-funit-at-a-time} is not used.
The default value is 100 which limits large function growth to 2.0 times
the original size.
+@item large-unit-insns
+The limit specifying large translation unit. Growth caused by inlining of
+units larger than this limit is limited by @option{--param inline-unit-growth}.
+For small units this might be too tight (consider unit consisting of function A
+that is inline and B that just calls A three time. If B is small relative to
+A, the growth of unit is 300\% and yet such inlining is very sane. For very
+large units consisting of small inlininable functions however the overall unit
+growth limit is needed to avoid exponential explosion of code size. Thus for
+smaller units, the size is increased to @option{--param large-unit-insns}
+before aplying @option{--param inline-unit-growth}. The default is 10000
+
@item inline-unit-growth
Specifies maximal overall growth of the compilation unit caused by inlining.
This parameter is ignored when @option{-funit-at-a-time} is not used.
@@ -9112,8 +9122,9 @@ functional units well resulting in instable performance.
@item -masm=@var{dialect}
@opindex masm=@var{dialect}
-Output asm instructions using selected @var{dialect}. Supported choices are
-@samp{intel} or @samp{att} (the default one).
+Output asm instructions using selected @var{dialect}. Supported
+choices are @samp{intel} or @samp{att} (the default one). Darwin does
+not support @samp{intel}.
@item -mieee-fp
@itemx -mno-ieee-fp
@@ -10838,6 +10849,12 @@ These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
@itemx -mno-powerpc-gfxopt
@itemx -mpowerpc64
@itemx -mno-powerpc64
+@itemx -mmfcrf
+@itemx -mno-mfcrf
+@itemx -mpopcntb
+@itemx -mno-popcntb
+@itemx -mfprnd
+@itemx -mno-fprnd
@opindex mpower
@opindex mno-power
@opindex mpower2
@@ -10850,12 +10867,18 @@ These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
@opindex mno-powerpc-gfxopt
@opindex mpowerpc64
@opindex mno-powerpc64
+@opindex mmfcrf
+@opindex mno-mfcrf
+@opindex mpopcntb
+@opindex mno-popcntb
+@opindex mfprnd
+@opindex mno-fprnd
GCC supports two related instruction set architectures for the
RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
instructions supported by the @samp{rios} chip set used in the original
RS/6000 systems and the @dfn{PowerPC} instruction set is the
-architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
-the IBM 4xx microprocessors.
+architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
+the IBM 4xx, 6xx, and follow-on microprocessors.
Neither architecture is a subset of the other. However there is a
large common subset of instructions supported by both. An MQ
@@ -10883,6 +10906,18 @@ General Purpose group, including floating-point square root. Specifying
use the optional PowerPC architecture instructions in the Graphics
group, including floating-point select.
+The @option{-mmfcrf} option allows GCC to generate the move from
+condition register field instruction implemented on the POWER4
+processor and other processors that support the PowerPC V2.01
+architecture.
+The @option{-mpopcntb} option allows GCC to generate the popcount and
+double precision FP reciprocal estimate instruction implemented on the
+POWER5 processor and other processors that support the PowerPC V2.02
+architecture.
+The @option{-mfprnd} option allows GCC to generate the FP round to
+integer instructions implemented on the POWER5+ processor and other
+processors that support the PowerPC V2.03 architecture.
+
The @option{-mpowerpc64} option allows GCC to generate the additional
64-bit instructions that are found in the full PowerPC64 architecture
and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
@@ -10921,9 +10956,10 @@ Supported values for @var{cpu_type} are @samp{401}, @samp{403},
@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
-@samp{860}, @samp{970}, @samp{8540}, @samp{common}, @samp{ec603e}, @samp{G3},
+@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3},
@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
-@samp{power4}, @samp{power5}, @samp{powerpc}, @samp{powerpc64},
+@samp{power4}, @samp{power5}, @samp{power5+},
+@samp{common}, @samp{powerpc}, @samp{powerpc64},
@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
@option{-mcpu=common} selects a completely generic processor. Code
@@ -10943,19 +10979,20 @@ those options will run best on that processor, and may not run at all on
others.
The @option{-mcpu} options automatically enable or disable the
-following options: @option{-maltivec}, @option{-mhard-float},
-@option{-mmfcrf}, @option{-mmultiple}, @option{-mnew-mnemonics},
-@option{-mpower}, @option{-mpower2}, @option{-mpowerpc64},
-@option{-mpowerpc-gpopt}, @option{-mpowerpc-gfxopt},
-@option{-mstring}. The particular options set for any particular CPU
-will vary between compiler versions, depending on what setting seems
-to produce optimal code for that CPU; it doesn't necessarily reflect
-the actual hardware's capabilities. If you wish to set an individual
-option to a particular value, you may specify it after the
-@option{-mcpu} option, like @samp{-mcpu=970 -mno-altivec}.
+following options: @option{-maltivec}, @option{-mfprnd},
+@option{-mhard-float}, @option{-mmfcrf}, @option{-mmultiple},
+@option{-mnew-mnemonics}, @option{-mpopcntb}, @option{-mpower},
+@option{-mpower2}, @option{-mpowerpc64}, @option{-mpowerpc-gpopt},
+@option{-mpowerpc-gfxopt}, @option{-mstring}. The particular options
+set for any particular CPU will vary between compiler versions,
+depending on what setting seems to produce optimal code for that CPU;
+it doesn't necessarily reflect the actual hardware's capabilities. If
+you wish to set an individual option to a particular value, you may
+specify it after the @option{-mcpu} option, like @samp{-mcpu=970
+-mno-altivec}.
On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
-not enabled or disabled by the @option{-mcpu} option at present, since
+not enabled or disabled by the @option{-mcpu} option at present because
AIX does not have full support for these options. You may still
enable or disable them individually if you're sure it'll work in your
environment.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index b339c4ccdc0..09279ec7af5 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -2926,6 +2926,21 @@ want to support call frame debugging information like that provided by
DWARF 2.
@end defmac
+@defmac FRAME_POINTER_CFA_OFFSET (@var{fundecl})
+If defined, a C expression whose value is an integer giving the offset
+in bytes from the frame pointer to the canonical frame address (cfa).
+The final value should conincide with that calculated by
+@code{INCOMING_FRAME_SP_OFFSET}.
+
+Normally the CFA is calculated as an offset from the argument pointer,
+via @code{ARG_POINTER_CFA_OFFSET}, but if the argument pointer is
+variable due to the ABI, this may not be possible. If this macro is
+defined, it imples that the virtual register instantiation should be
+based on the frame pointer instead of the argument pointer. Only one
+of @code{FRAME_POINTER_CFA_OFFSET} and @code{ARG_POINTER_CFA_OFFSET}
+should be defined.
+@end defmac
+
@node Exception Handling
@subsection Exception Handling Support
@cindex exception handling
@@ -6751,6 +6766,12 @@ defines (equates) the weak symbol @var{name} to have the value
to make @var{name} weak.
@end defmac
+@defmac ASM_OUTPUT_WEAKREF (@var{stream}, @var{decl}, @var{name}, @var{value})
+Outputs a directive that enables @var{name} to be used to refer to
+symbol @var{value} with weak-symbol semantics. @code{decl} is the
+declaration of @code{name}.
+@end defmac
+
@defmac SUPPORTS_WEAK
A C expression which evaluates to true if the target supports weak symbols.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7bac01bdb67..56b52e069c7 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -214,7 +214,7 @@ enum dw_cfi_oprnd_type {
typedef union dw_cfi_oprnd_struct GTY(())
{
- unsigned long GTY ((tag ("dw_cfi_oprnd_reg_num"))) dw_cfi_reg_num;
+ unsigned int GTY ((tag ("dw_cfi_oprnd_reg_num"))) dw_cfi_reg_num;
HOST_WIDE_INT GTY ((tag ("dw_cfi_oprnd_offset"))) dw_cfi_offset;
const char * GTY ((tag ("dw_cfi_oprnd_addr"))) dw_cfi_addr;
struct dw_loc_descr_struct * GTY ((tag ("dw_cfi_oprnd_loc"))) dw_cfi_loc;
@@ -671,6 +671,10 @@ lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc)
case DW_CFA_def_cfa_offset:
loc->offset = cfi->dw_cfi_oprnd1.dw_cfi_offset;
break;
+ case DW_CFA_def_cfa_offset_sf:
+ loc->offset
+ = cfi->dw_cfi_oprnd1.dw_cfi_offset * DWARF_CIE_DATA_ALIGNMENT;
+ break;
case DW_CFA_def_cfa_register:
loc->reg = cfi->dw_cfi_oprnd1.dw_cfi_reg_num;
break;
@@ -678,6 +682,11 @@ lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc)
loc->reg = cfi->dw_cfi_oprnd1.dw_cfi_reg_num;
loc->offset = cfi->dw_cfi_oprnd2.dw_cfi_offset;
break;
+ case DW_CFA_def_cfa_sf:
+ loc->reg = cfi->dw_cfi_oprnd1.dw_cfi_reg_num;
+ loc->offset
+ = cfi->dw_cfi_oprnd2.dw_cfi_offset * DWARF_CIE_DATA_ALIGNMENT;
+ break;
case DW_CFA_def_cfa_expression:
get_cfa_from_loc_descr (loc, cfi->dw_cfi_oprnd1.dw_cfi_loc);
break;
@@ -775,11 +784,21 @@ def_cfa_1 (const char *label, dw_cfa_location *loc_p)
if (loc.reg == old_cfa.reg && !loc.indirect)
{
- /* Construct a "DW_CFA_def_cfa_offset <offset>" instruction,
- indicating the CFA register did not change but the offset
- did. */
- cfi->dw_cfi_opc = DW_CFA_def_cfa_offset;
- cfi->dw_cfi_oprnd1.dw_cfi_offset = loc.offset;
+ /* Construct a "DW_CFA_def_cfa_offset <offset>" instruction, indicating
+ the CFA register did not change but the offset did. */
+ if (loc.offset < 0)
+ {
+ HOST_WIDE_INT f_offset = loc.offset / DWARF_CIE_DATA_ALIGNMENT;
+ gcc_assert (f_offset * DWARF_CIE_DATA_ALIGNMENT == loc.offset);
+
+ cfi->dw_cfi_opc = DW_CFA_def_cfa_offset_sf;
+ cfi->dw_cfi_oprnd1.dw_cfi_offset = f_offset;
+ }
+ else
+ {
+ cfi->dw_cfi_opc = DW_CFA_def_cfa_offset;
+ cfi->dw_cfi_oprnd1.dw_cfi_offset = loc.offset;
+ }
}
#ifndef MIPS_DEBUGGING_INFO /* SGI dbx thinks this means no offset. */
@@ -800,9 +819,21 @@ def_cfa_1 (const char *label, dw_cfa_location *loc_p)
/* Construct a "DW_CFA_def_cfa <register> <offset>" instruction,
indicating the CFA register has changed to <register> with
the specified offset. */
- cfi->dw_cfi_opc = DW_CFA_def_cfa;
- cfi->dw_cfi_oprnd1.dw_cfi_reg_num = loc.reg;
- cfi->dw_cfi_oprnd2.dw_cfi_offset = loc.offset;
+ if (loc.offset < 0)
+ {
+ HOST_WIDE_INT f_offset = loc.offset / DWARF_CIE_DATA_ALIGNMENT;
+ gcc_assert (f_offset * DWARF_CIE_DATA_ALIGNMENT == loc.offset);
+
+ cfi->dw_cfi_opc = DW_CFA_def_cfa_sf;
+ cfi->dw_cfi_oprnd1.dw_cfi_reg_num = loc.reg;
+ cfi->dw_cfi_oprnd2.dw_cfi_offset = f_offset;
+ }
+ else
+ {
+ cfi->dw_cfi_opc = DW_CFA_def_cfa;
+ cfi->dw_cfi_oprnd1.dw_cfi_reg_num = loc.reg;
+ cfi->dw_cfi_oprnd2.dw_cfi_offset = loc.offset;
+ }
}
else
{
@@ -8460,12 +8491,6 @@ dbx_reg_number (rtx rtl)
{
unsigned regno = REGNO (rtl);
- /* We do not want to see registers that should have been eliminated. */
- gcc_assert (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM
- || rtl != arg_pointer_rtx);
- gcc_assert (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM
- || rtl != frame_pointer_rtx);
-
gcc_assert (regno < FIRST_PSEUDO_REGISTER);
#ifdef LEAF_REG_REMAP
@@ -8619,32 +8644,12 @@ int_loc_descriptor (HOST_WIDE_INT i)
return new_loc_descr (op, i, 0);
}
-/* Return an offset from an eliminable register to the post-prologue
- frame pointer. */
-
-static HOST_WIDE_INT
-eliminate_reg_to_offset (rtx reg)
-{
- HOST_WIDE_INT offset = 0;
-
- reg = eliminate_regs (reg, VOIDmode, NULL_RTX);
- if (GET_CODE (reg) == PLUS)
- {
- offset = INTVAL (XEXP (reg, 1));
- reg = XEXP (reg, 0);
- }
- gcc_assert (reg == (frame_pointer_needed ? hard_frame_pointer_rtx
- : stack_pointer_rtx));
-
- return offset;
-}
-
/* Return a location descriptor that designates a base+offset location. */
static dw_loc_descr_ref
based_loc_descr (rtx reg, HOST_WIDE_INT offset)
{
- dw_loc_descr_ref loc_result;
+ unsigned int regno;
/* We only use "frame base" when we're sure we're talking about the
post-prologue local stack frame. We do this by *not* running
@@ -8652,22 +8657,28 @@ based_loc_descr (rtx reg, HOST_WIDE_INT offset)
argument pointer and soft frame pointer rtx's. */
if (reg == arg_pointer_rtx || reg == frame_pointer_rtx)
{
- offset += eliminate_reg_to_offset (reg);
- offset += frame_pointer_cfa_offset;
+ rtx elim = eliminate_regs (reg, VOIDmode, NULL_RTX);
- loc_result = new_loc_descr (DW_OP_fbreg, offset, 0);
- }
- else
- {
- unsigned int regno = dbx_reg_number (reg);
+ if (elim != reg)
+ {
+ if (GET_CODE (elim) == PLUS)
+ {
+ offset += INTVAL (XEXP (elim, 1));
+ elim = XEXP (elim, 0);
+ }
+ gcc_assert (elim == (frame_pointer_needed ? hard_frame_pointer_rtx
+ : stack_pointer_rtx));
+ offset += frame_pointer_cfa_offset;
- if (regno <= 31)
- loc_result = new_loc_descr (DW_OP_breg0 + regno, offset, 0);
- else
- loc_result = new_loc_descr (DW_OP_bregx, regno, offset);
+ return new_loc_descr (DW_OP_fbreg, offset, 0);
+ }
}
- return loc_result;
+ regno = dbx_reg_number (reg);
+ if (regno <= 31)
+ return new_loc_descr (DW_OP_breg0 + regno, offset, 0);
+ else
+ return new_loc_descr (DW_OP_bregx, regno, offset);
}
/* Return true if this RTL expression describes a base+offset calculation. */
@@ -10406,9 +10417,24 @@ static void
compute_frame_pointer_to_cfa_displacement (void)
{
HOST_WIDE_INT offset;
+ rtx reg, elim;
+
+#ifdef FRAME_POINTER_CFA_OFFSET
+ reg = frame_pointer_rtx;
+ offset = FRAME_POINTER_CFA_OFFSET (current_function_decl);
+#else
+ reg = arg_pointer_rtx;
+ offset = ARG_POINTER_CFA_OFFSET (current_function_decl);
+#endif
- offset = eliminate_reg_to_offset (arg_pointer_rtx);
- offset += ARG_POINTER_CFA_OFFSET (current_function_decl);
+ elim = eliminate_regs (reg, VOIDmode, NULL_RTX);
+ if (GET_CODE (elim) == PLUS)
+ {
+ offset += INTVAL (XEXP (elim, 1));
+ elim = XEXP (elim, 0);
+ }
+ gcc_assert (elim == (frame_pointer_needed ? hard_frame_pointer_rtx
+ : stack_pointer_rtx));
frame_pointer_cfa_offset = -offset;
}
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 00172a355d6..632f24ff53b 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -430,14 +430,11 @@ store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
|| (offset * BITS_PER_UNIT % bitsize == 0
&& MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0))))
{
- if (GET_MODE (op0) != fieldmode)
- {
- if (MEM_P (op0))
- op0 = adjust_address (op0, fieldmode, offset);
- else
- op0 = simplify_gen_subreg (fieldmode, op0, GET_MODE (op0),
- byte_offset);
- }
+ if (MEM_P (op0))
+ op0 = adjust_address (op0, fieldmode, offset);
+ else if (GET_MODE (op0) != fieldmode)
+ op0 = simplify_gen_subreg (fieldmode, op0, GET_MODE (op0),
+ byte_offset);
emit_move_insn (op0, value);
return value;
}
@@ -1410,6 +1407,11 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
xbitpos = bitnum % unit;
xop0 = adjust_address (xop0, bestmode, xoffset);
+ /* Make sure register is big enough for the whole field. */
+ if (xoffset * BITS_PER_UNIT + unit
+ < offset * BITS_PER_UNIT + bitsize)
+ goto extzv_loses;
+
/* Fetch it to a register in that size. */
xop0 = force_reg (bestmode, xop0);
@@ -1539,6 +1541,11 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
xbitpos = bitnum % unit;
xop0 = adjust_address (xop0, bestmode, xoffset);
+ /* Make sure register is big enough for the whole field. */
+ if (xoffset * BITS_PER_UNIT + unit
+ < offset * BITS_PER_UNIT + bitsize)
+ goto extv_loses;
+
/* Fetch it to a register in that size. */
xop0 = force_reg (bestmode, xop0);
diff --git a/gcc/expr.c b/gcc/expr.c
index 125e37071d9..13dd782588e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6488,7 +6488,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode,
information. It would be better of the diagnostic routines
used the file/line information embedded in the tree nodes rather
than globals. */
- if (cfun && EXPR_HAS_LOCATION (exp))
+ if (cfun && cfun->ib_boundaries_block && EXPR_HAS_LOCATION (exp))
{
location_t saved_location = input_location;
input_location = EXPR_LOCATION (exp);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 6f829adfa77..abaac755e3b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1537,6 +1537,16 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
inexact = real_arithmetic (&value, code, &d1, &d2);
real_convert (&result, mode, &value);
+ /* Don't constant fold this floating point operation if
+ the result has overflowed and flag_trapping_math. */
+
+ if (flag_trapping_math
+ && MODE_HAS_INFINITIES (mode)
+ && REAL_VALUE_ISINF (result)
+ && !REAL_VALUE_ISINF (d1)
+ && !REAL_VALUE_ISINF (d2))
+ return NULL_TREE;
+
/* Don't constant fold this floating point operation if the
result may dependent upon the run-time rounding mode and
flag_rounding_math is set, or if GCC's software emulation
@@ -4052,10 +4062,22 @@ build_range_check (tree type, tree exp, int in_p, tree low, tree high)
}
if (value != 0 && ! TREE_OVERFLOW (value))
- return build_range_check (type,
- fold_build2 (MINUS_EXPR, etype, exp, low),
- 1, fold_convert (etype, integer_zero_node),
- value);
+ {
+ /* There is no requirement that LOW be within the range of ETYPE
+ if the latter is a subtype. It must, however, be within the base
+ type of ETYPE. So be sure we do the subtraction in that type. */
+ if (INTEGRAL_TYPE_P (etype) && TREE_TYPE (etype))
+ {
+ etype = TREE_TYPE (etype);
+ exp = fold_convert (etype, exp);
+ low = fold_convert (etype, low);
+ value = fold_convert (etype, value);
+ }
+
+ return build_range_check (type,
+ fold_build2 (MINUS_EXPR, etype, exp, low),
+ 1, build_int_cst (etype, 0), value);
+ }
return 0;
}
@@ -5527,7 +5549,8 @@ constant_boolean_node (int value, tree type)
offset to the appropriate trees. If there is no offset,
offset is set to NULL_TREE. Base will be canonicalized to
something you can get the element type from using
- TREE_TYPE (TREE_TYPE (base)). */
+ TREE_TYPE (TREE_TYPE (base)). Offset will be the offset
+ in bytes to the base. */
static bool
extract_array_ref (tree expr, tree *base, tree *offset)
@@ -5563,8 +5586,10 @@ extract_array_ref (tree expr, tree *base, tree *offset)
tree op0 = TREE_OPERAND (expr, 0);
if (TREE_CODE (op0) == ARRAY_REF)
{
+ tree idx = TREE_OPERAND (op0, 1);
*base = TREE_OPERAND (op0, 0);
- *offset = TREE_OPERAND (op0, 1);
+ *offset = fold_build2 (MULT_EXPR, TREE_TYPE (idx), idx,
+ array_ref_element_size (op0));
}
else
{
@@ -8878,25 +8903,21 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
&& extract_array_ref (arg1, &base1, &offset1)
&& operand_equal_p (base0, base1, 0))
{
- if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (base0)))
- && integer_zerop (TYPE_SIZE (TREE_TYPE (TREE_TYPE (base0)))))
- offset0 = NULL_TREE;
- if (TYPE_SIZE (TREE_TYPE (TREE_TYPE (base1)))
- && integer_zerop (TYPE_SIZE (TREE_TYPE (TREE_TYPE (base1)))))
- offset1 = NULL_TREE;
+ /* Handle no offsets on both sides specially. */
if (offset0 == NULL_TREE
&& offset1 == NULL_TREE)
+ return fold_build2 (code, type, integer_zero_node,
+ integer_zero_node);
+
+ if (!offset0 || !offset1
+ || TREE_TYPE (offset0) == TREE_TYPE (offset1))
{
- offset0 = integer_zero_node;
- offset1 = integer_zero_node;
+ if (offset0 == NULL_TREE)
+ offset0 = build_int_cst (TREE_TYPE (offset1), 0);
+ if (offset1 == NULL_TREE)
+ offset1 = build_int_cst (TREE_TYPE (offset0), 0);
+ return fold_build2 (code, type, offset0, offset1);
}
- else if (offset0 == NULL_TREE)
- offset0 = build_int_cst (TREE_TYPE (offset1), 0);
- else if (offset1 == NULL_TREE)
- offset1 = build_int_cst (TREE_TYPE (offset0), 0);
-
- if (TREE_TYPE (offset0) == TREE_TYPE (offset1))
- return fold_build2 (code, type, offset0, offset1);
}
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 0a24084f4cc..6ed025bddd8 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,23 @@
+2005-11-17 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR fortran/20811
+ * scanner.c (gfc_open_included_file): Add an extra include_cwd
+ argument. Only include files in the current working directory if
+ its value is true.
+ * gfortran.h: Change prototype for gfc_open_included_file.
+ (load_file): Don't search for include files in the current working
+ directory.
+ * options.c (gfc_post_options): Add the directory of the source file
+ to the list of paths for included files.
+ * module.c (gfc_use_module): Look for module files in the current
+ directory.
+
+2005-11-16 Alan Modra <amodra@bigpond.net.au>
+
+ PR fortran/24096
+ * trans-types.c (gfc_init_kinds): Use one less for max_exponent
+ of IBM extended double format.
+
2005-11-13 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* intrinsic.c (add_functions): Add COMPLEX, FTELL, FGETC, FGET,
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index fc62807740d..b16e0dab28f 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1622,7 +1622,7 @@ void gfc_scanner_init_1 (void);
void gfc_add_include_path (const char *);
void gfc_release_include_path (void);
-FILE *gfc_open_included_file (const char *);
+FILE *gfc_open_included_file (const char *, bool);
int gfc_at_end (void);
int gfc_at_eof (void);
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 71a5b982c40..2b28d3a9605 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3757,7 +3757,7 @@ gfc_use_module (void)
strcpy (filename, module_name);
strcat (filename, MODULE_EXTENSION);
- module_fp = gfc_open_included_file (filename);
+ module_fp = gfc_open_included_file (filename, true);
if (module_fp == NULL)
gfc_fatal_error ("Can't open module file '%s' for reading at %C: %s",
filename, strerror (errno));
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index a38d80ccd82..29105ec4c3e 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -173,6 +173,8 @@ bool
gfc_post_options (const char **pfilename)
{
const char *filename = *pfilename;
+ char *source_path;
+ int i;
/* Verify the input file name. */
if (!filename || strcmp (filename, "-") == 0)
@@ -182,6 +184,21 @@ gfc_post_options (const char **pfilename)
gfc_source_file = filename;
+ /* Adds the path where the source file is to the list of include files. */
+
+ i = strlen(gfc_source_file);
+ while (i > 0 && !IS_DIR_SEPARATOR(gfc_source_file[i]))
+ i--;
+ if (i != 0)
+ {
+ source_path = alloca (i + 1);
+ memcpy (source_path, gfc_source_file, i);
+ source_path[i] = 0;
+ gfc_add_include_path (source_path);
+ }
+ else
+ gfc_add_include_path (".");
+
/* Decide which form the file will be read in as. */
if (gfc_option.source_form != FORM_UNKNOWN)
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 423d398e40f..d739b33f0a2 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -160,18 +160,22 @@ gfc_release_include_path (void)
}
/* Opens file for reading, searching through the include directories
- given if necessary. */
+ given if necessary. If the include_cwd argument is true, we try
+ to open the file in the current directory first. */
FILE *
-gfc_open_included_file (const char *name)
+gfc_open_included_file (const char *name, const bool include_cwd)
{
char *fullname;
gfc_directorylist *p;
FILE *f;
- f = gfc_open_file (name);
- if (f != NULL)
- return f;
+ if (include_cwd)
+ {
+ f = gfc_open_file (name);
+ if (f != NULL)
+ return f;
+ }
for (p = include_dirs; p; p = p->next)
{
@@ -1197,7 +1201,7 @@ load_file (const char *filename, bool initial)
}
else
{
- input = gfc_open_included_file (filename);
+ input = gfc_open_included_file (filename, false);
if (input == NULL)
{
gfc_error_now ("Can't open included file '%s'", filename);
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 81a90f1d373..6aaf81a5b4c 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -192,6 +192,15 @@ gfc_init_kinds (void)
gfc_real_kinds[r_index].digits = fmt->p;
gfc_real_kinds[r_index].min_exponent = fmt->emin;
gfc_real_kinds[r_index].max_exponent = fmt->emax;
+ if (fmt->pnan < fmt->p)
+ /* This is an IBM extended double format (or the MIPS variant)
+ made up of two IEEE doubles. The value of the long double is
+ the sum of the values of the two parts. The most significant
+ part is required to be the value of the long double rounded
+ to the nearest double. If we use emax of 1024 then we can't
+ represent huge(x) = (1 - b**(-p)) * b**(emax-1) * b, because
+ rounding will make the most significant part overflow. */
+ gfc_real_kinds[r_index].max_exponent = fmt->emax - 1;
gfc_real_kinds[r_index].mode_precision = GET_MODE_PRECISION (mode);
r_index += 1;
}
diff --git a/gcc/function.c b/gcc/function.c
index dbf9df74ade..c0339b8950e 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1246,7 +1246,14 @@ instantiate_new_reg (rtx x, HOST_WIDE_INT *poffset)
else if (x == virtual_outgoing_args_rtx)
new = stack_pointer_rtx, offset = out_arg_offset;
else if (x == virtual_cfa_rtx)
- new = arg_pointer_rtx, offset = cfa_offset;
+ {
+#ifdef FRAME_POINTER_CFA_OFFSET
+ new = frame_pointer_rtx;
+#else
+ new = arg_pointer_rtx;
+#endif
+ offset = cfa_offset;
+ }
else
return NULL_RTX;
@@ -1632,7 +1639,11 @@ instantiate_virtual_regs (void)
var_offset = STARTING_FRAME_OFFSET;
dynamic_offset = STACK_DYNAMIC_OFFSET (current_function_decl);
out_arg_offset = STACK_POINTER_OFFSET;
+#ifdef FRAME_POINTER_CFA_OFFSET
+ cfa_offset = FRAME_POINTER_CFA_OFFSET (current_function_decl);
+#else
cfa_offset = ARG_POINTER_CFA_OFFSET (current_function_decl);
+#endif
/* Initialize recognition, indicating that volatile is OK. */
init_recog ();
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 63ad3a7fb6f..8b8bdb4ce26 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -935,11 +935,10 @@ static const struct compiler default_compilers[] =
{".CPP", "#C++", 0, 0, 0}, {".ii", "#C++", 0, 0, 0},
{".ads", "#Ada", 0, 0, 0}, {".adb", "#Ada", 0, 0, 0},
{".f", "#Fortran", 0, 0, 0}, {".for", "#Fortran", 0, 0, 0},
- {".F", "#Fortran", 0, 0, 0}, {".FOR", "#Fortran", 0, 0, 0},
- {".FPP", "#Fortran", 0, 0, 0},
- {".f90", "#Fortran 95", 0, 0, 0}, {".f95", "#Fortran 95", 0, 0, 0},
{".fpp", "#Fortran", 0, 0, 0}, {".F", "#Fortran", 0, 0, 0},
{".FOR", "#Fortran", 0, 0, 0}, {".FPP", "#Fortran", 0, 0, 0},
+ {".f90", "#Fortran", 0, 0, 0}, {".f95", "#Fortran", 0, 0, 0},
+ {".F90", "#Fortran", 0, 0, 0}, {".F95", "#Fortran", 0, 0, 0},
{".r", "#Ratfor", 0, 0, 0},
{".p", "#Pascal", 0, 0, 0}, {".pas", "#Pascal", 0, 0, 0},
{".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0},
@@ -7710,13 +7709,13 @@ version_compare_spec_function (int argc, const char **argv)
bool result;
if (argc < 3)
- abort ();
+ fatal ("too few arguments to %%:version-compare");
if (argv[0][0] == '\0')
abort ();
if ((argv[0][1] == '<' || argv[0][1] == '>') && argv[0][0] != '!')
nargs = 2;
if (argc != nargs + 3)
- abort ();
+ fatal ("too many arguments to %%:version-compare");
switch_len = strlen (argv[nargs + 1]);
for (i = 0; i < n_switches; i++)
@@ -7757,7 +7756,7 @@ version_compare_spec_function (int argc, const char **argv)
break;
default:
- abort ();
+ fatal ("unknown operator %qs in %%:version-compare", argv[0]);
}
if (! result)
return NULL;
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 9e42dcf701a..c16e9475a02 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -877,7 +877,11 @@ cgraph_decide_inlining (void)
overall_insns = initial_insns;
gcc_assert (!max_count || (profile_info && flag_branch_probabilities));
- max_insns = ((HOST_WIDEST_INT) overall_insns
+ max_insns = overall_insns;
+ if (max_insns < PARAM_VALUE (PARAM_LARGE_UNIT_INSNS))
+ max_insns = PARAM_VALUE (PARAM_LARGE_UNIT_INSNS);
+
+ max_insns = ((HOST_WIDEST_INT) max_insns
* (100 + PARAM_VALUE (PARAM_INLINE_UNIT_GROWTH)) / 100);
nnodes = cgraph_postorder (order);
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index a909e64989d..8fe549b6b04 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -40,6 +40,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
+#include "tm_p.h"
#include "hard-reg-set.h"
#include "obstack.h"
#include "basic-block.h"
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 4cabfd58504..69b1eb675c0 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -2118,9 +2118,8 @@ apply_opt_in_copies (struct opt_info *opt_info,
if (ivts)
{
-#ifdef ENABLE_CHECKING
- gcc_assert (rtx_equal_p (PATTERN (insn), PATTERN (orig_insn)));
-#endif
+ gcc_assert (GET_CODE (PATTERN (insn))
+ == GET_CODE (PATTERN (orig_insn)));
if (!delta)
insert_base_initialization (ivts, insn);
@@ -2133,9 +2132,8 @@ apply_opt_in_copies (struct opt_info *opt_info,
ves = htab_find (opt_info->insns_with_var_to_expand, &ve_templ);
if (ves)
{
-#ifdef ENABLE_CHECKING
- gcc_assert (rtx_equal_p (PATTERN (insn), PATTERN (orig_insn)));
-#endif
+ gcc_assert (GET_CODE (PATTERN (insn))
+ == GET_CODE (PATTERN (orig_insn)));
expand_var_during_unrolling (ves, insn);
}
}
diff --git a/gcc/loop.c b/gcc/loop.c
index 6df63026ab8..9efc84eff93 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -1238,13 +1238,15 @@ scan_loop (struct loop *loop, int flags)
- with -Os (this certainly increases size),
- if the mode doesn't support copy operations (obviously),
- if the source is already a reg (the motion will gain nothing),
- - if the source is a legitimate constant (likewise). */
+ - if the source is a legitimate constant (likewise),
+ - if the dest is a hard register (may be unrecognizable). */
else if (insert_temp
&& (optimize_size
|| ! can_copy_p (GET_MODE (SET_SRC (set)))
|| REG_P (SET_SRC (set))
|| (CONSTANT_P (SET_SRC (set))
- && LEGITIMATE_CONSTANT_P (SET_SRC (set)))))
+ && LEGITIMATE_CONSTANT_P (SET_SRC (set)))
+ || REGNO (SET_DEST (set)) < FIRST_PSEUDO_REGISTER))
;
else if ((tem = loop_invariant_p (loop, src))
&& (dependencies == 0
diff --git a/gcc/mklibgcc.in b/gcc/mklibgcc.in
index b36d31ef511..6517b1d6fce 100644
--- a/gcc/mklibgcc.in
+++ b/gcc/mklibgcc.in
@@ -806,7 +806,7 @@ echo " if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi"
if [ "$need_eh_dummy" ]; then
echo "eh_dummy.c:"
- echo " echo 'struct eh_dummy;' > \$@"
+ echo " echo 'int __libgcc_eh_dummy;' > \$@"
fi
echo ""
diff --git a/gcc/params.def b/gcc/params.def
index af0fbdcb3c1..f585c39dd98 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -179,6 +179,10 @@ DEFPARAM(PARAM_LARGE_FUNCTION_GROWTH,
"large-function-growth",
"Maximal growth due to inlining of large function (in percent)",
100, 0, 0)
+DEFPARAM(PARAM_LARGE_UNIT_INSNS,
+ "large-unit-insns",
+ "The size of translation unit to be considered large",
+ 10000, 0, 0)
DEFPARAM(PARAM_INLINE_UNIT_GROWTH,
"inline-unit-growth",
"how much can given compilation unit grow because of the inlining (in percent)",
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 76d54fa0fa4..43a9fd407bb 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1268,7 +1268,7 @@ reload_cse_move2add (rtx first)
rtx tem = gen_rtx_PLUS (GET_MODE (reg), reg, new_src);
validate_change (insn, &SET_SRC (pat), tem, 0);
}
- else
+ else if (GET_MODE (reg) != BImode)
{
enum machine_mode narrow_mode;
for (narrow_mode = GET_CLASS_NARROWEST_MODE (MODE_INT);
diff --git a/gcc/regrename.c b/gcc/regrename.c
index cd448c44654..06b1c5b7480 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -58,7 +58,11 @@ enum scan_actions
terminate_write,
terminate_dead,
mark_read,
- mark_write
+ mark_write,
+ /* mark_access is for marking the destination regs in
+ REG_FRAME_RELATED_EXPR notes (as if they were read) so that the
+ note is updated properly. */
+ mark_access
};
static const char * const scan_actions_name[] =
@@ -68,7 +72,8 @@ static const char * const scan_actions_name[] =
"terminate_write",
"terminate_dead",
"mark_read",
- "mark_write"
+ "mark_write",
+ "mark_access"
};
static struct obstack rename_obstack;
@@ -408,8 +413,7 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl,
return;
}
- if ((type == OP_OUT && action != terminate_write)
- || (type != OP_OUT && action == terminate_write))
+ if ((type == OP_OUT) != (action == terminate_write || action == mark_access))
return;
for (p = &open_chains; *p;)
@@ -438,7 +442,7 @@ scan_rtx_reg (rtx insn, rtx *loc, enum reg_class cl,
continue;
}
- if (action == mark_read)
+ if (action == mark_read || action == mark_access)
{
gcc_assert (exact_match);
@@ -509,7 +513,7 @@ scan_rtx_address (rtx insn, rtx *loc, enum reg_class cl,
const char *fmt;
int i, j;
- if (action == mark_write)
+ if (action == mark_write || action == mark_access)
return;
switch (code)
@@ -866,17 +870,19 @@ build_def_use (basic_block bb)
scan_rtx (insn, loc, cl, mark_read, type, 0);
}
- /* Step 4: Close chains for registers that die here.
- Also record updates for REG_INC notes. */
+ /* Step 3B: Record updates for regs in REG_INC notes, and
+ source regs in REG_FRAME_RELATED_EXPR notes. */
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
- {
- if (REG_NOTE_KIND (note) == REG_DEAD)
- scan_rtx (insn, &XEXP (note, 0), NO_REGS, terminate_dead,
- OP_IN, 0);
- else if (REG_NOTE_KIND (note) == REG_INC)
- scan_rtx (insn, &XEXP (note, 0), ALL_REGS, mark_read,
- OP_INOUT, 0);
- }
+ if (REG_NOTE_KIND (note) == REG_INC
+ || REG_NOTE_KIND (note) == REG_FRAME_RELATED_EXPR)
+ scan_rtx (insn, &XEXP (note, 0), ALL_REGS, mark_read,
+ OP_INOUT, 0);
+
+ /* Step 4: Close chains for registers that die here. */
+ for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
+ if (REG_NOTE_KIND (note) == REG_DEAD)
+ scan_rtx (insn, &XEXP (note, 0), NO_REGS, terminate_dead,
+ OP_IN, 0);
/* Step 4B: If this is a call, any chain live at this point
requires a caller-saved reg. */
@@ -949,6 +955,13 @@ build_def_use (basic_block bb)
recog_op_alt[opn][alt].earlyclobber);
}
+ /* Step 6B: Record destination regs in REG_FRAME_RELATED_EXPR
+ notes for update. */
+ for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
+ if (REG_NOTE_KIND (note) == REG_FRAME_RELATED_EXPR)
+ scan_rtx (insn, &XEXP (note, 0), ALL_REGS, mark_access,
+ OP_INOUT, 0);
+
/* Step 7: Close chains for registers that were never
really used here. */
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
diff --git a/gcc/reload1.c b/gcc/reload1.c
index d8eeb2a5e71..ba395da22a3 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -96,6 +96,11 @@ static HARD_REG_SET reg_is_output_reload;
with the constant it stands for. */
rtx *reg_equiv_constant;
+/* Element N is an invariant value to which pseudo reg N is equivalent.
+ eliminate_regs_in_insn uses this to replace pseudos in particular
+ contexts. */
+rtx *reg_equiv_invariant;
+
/* Element N is a memory location to which pseudo reg N is equivalent,
prior to any register elimination (such as frame pointer to stack
pointer). Depending on whether or not it is a valid address, this value
@@ -693,6 +698,7 @@ reload (rtx first, int global)
be substituted eventually by altering the REG-rtx's. */
reg_equiv_constant = xcalloc (max_regno, sizeof (rtx));
+ reg_equiv_invariant = xcalloc (max_regno, sizeof (rtx));
reg_equiv_mem = xcalloc (max_regno, sizeof (rtx));
reg_equiv_address = xcalloc (max_regno, sizeof (rtx));
reg_max_ref_width = xcalloc (max_regno, sizeof (int));
@@ -762,13 +768,12 @@ reload (rtx first, int global)
{
/* This is PLUS of frame pointer and a constant,
and might be shared. Unshare it. */
- reg_equiv_constant[i] = copy_rtx (x);
+ reg_equiv_invariant[i] = copy_rtx (x);
num_eliminable_invariants++;
}
- else if (x == frame_pointer_rtx
- || x == arg_pointer_rtx)
+ else if (x == frame_pointer_rtx || x == arg_pointer_rtx)
{
- reg_equiv_constant[i] = x;
+ reg_equiv_invariant[i] = x;
num_eliminable_invariants++;
}
else if (LEGITIMATE_CONSTANT_P (x))
@@ -1238,7 +1243,10 @@ reload (rtx first, int global)
/* Indicate that we no longer have known memory locations or constants. */
if (reg_equiv_constant)
free (reg_equiv_constant);
+ if (reg_equiv_invariant)
+ free (reg_equiv_invariant);
reg_equiv_constant = 0;
+ reg_equiv_invariant = 0;
VARRAY_GROW (reg_equiv_memory_loc_varray, 0);
reg_equiv_memory_loc = 0;
@@ -1454,7 +1462,9 @@ calculate_needs_all_insns (int global)
/* Skip insns that only set an equivalence. */
if (set && REG_P (SET_DEST (set))
&& reg_renumber[REGNO (SET_DEST (set))] < 0
- && reg_equiv_constant[REGNO (SET_DEST (set))])
+ && (reg_equiv_constant[REGNO (SET_DEST (set))]
+ || (reg_equiv_invariant[REGNO (SET_DEST (set))]))
+ && reg_equiv_init[REGNO (SET_DEST (set))])
continue;
/* If needed, eliminate any eliminable registers. */
@@ -1944,6 +1954,7 @@ alter_reg (int i, int from_reg)
if (reg_renumber[i] < 0
&& REG_N_REFS (i) > 0
&& reg_equiv_constant[i] == 0
+ && (reg_equiv_invariant[i] == 0 || reg_equiv_init[i] == 0)
&& reg_equiv_memory_loc[i] == 0)
{
rtx x;
@@ -2252,8 +2263,9 @@ set_label_offsets (rtx x, rtx insn, int initial_p)
encounter, return the actual location so that find_reloads will do
the proper thing. */
-rtx
-eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
+static rtx
+eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
+ bool may_use_invariant)
{
enum rtx_code code = GET_CODE (x);
struct elim_table *ep;
@@ -2296,10 +2308,16 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
}
else if (reg_renumber && reg_renumber[regno] < 0
- && reg_equiv_constant && reg_equiv_constant[regno]
- && ! CONSTANT_P (reg_equiv_constant[regno]))
- return eliminate_regs (copy_rtx (reg_equiv_constant[regno]),
- mem_mode, insn);
+ && reg_equiv_invariant && reg_equiv_invariant[regno])
+ {
+ if (may_use_invariant)
+ return eliminate_regs_1 (copy_rtx (reg_equiv_invariant[regno]),
+ mem_mode, insn, true);
+ /* There exists at least one use of REGNO that cannot be
+ eliminated. Prevent the defining insn from being deleted. */
+ reg_equiv_init[regno] = NULL_RTX;
+ alter_reg (regno, -1);
+ }
return x;
/* You might think handling MINUS in a manner similar to PLUS is a
@@ -2359,8 +2377,8 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
operand of a load-address insn. */
{
- rtx new0 = eliminate_regs (XEXP (x, 0), mem_mode, insn);
- rtx new1 = eliminate_regs (XEXP (x, 1), mem_mode, insn);
+ rtx new0 = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, true);
+ rtx new1 = eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true);
if (reg_renumber && (new0 != XEXP (x, 0) || new1 != XEXP (x, 1)))
{
@@ -2432,9 +2450,9 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
case GE: case GT: case GEU: case GTU:
case LE: case LT: case LEU: case LTU:
{
- rtx new0 = eliminate_regs (XEXP (x, 0), mem_mode, insn);
- rtx new1
- = XEXP (x, 1) ? eliminate_regs (XEXP (x, 1), mem_mode, insn) : 0;
+ rtx new0 = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, false);
+ rtx new1 = XEXP (x, 1)
+ ? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, false) : 0;
if (new0 != XEXP (x, 0) || new1 != XEXP (x, 1))
return gen_rtx_fmt_ee (code, GET_MODE (x), new0, new1);
@@ -2445,7 +2463,7 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
/* If we have something in XEXP (x, 0), the usual case, eliminate it. */
if (XEXP (x, 0))
{
- new = eliminate_regs (XEXP (x, 0), mem_mode, insn);
+ new = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, true);
if (new != XEXP (x, 0))
{
/* If this is a REG_DEAD note, it is not valid anymore.
@@ -2453,7 +2471,7 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
REG_DEAD note for the stack or frame pointer. */
if (GET_MODE (x) == REG_DEAD)
return (XEXP (x, 1)
- ? eliminate_regs (XEXP (x, 1), mem_mode, insn)
+ ? eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true)
: NULL_RTX);
x = gen_rtx_EXPR_LIST (REG_NOTE_KIND (x), new, XEXP (x, 1));
@@ -2468,7 +2486,7 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
strictly needed, but it simplifies the code. */
if (XEXP (x, 1))
{
- new = eliminate_regs (XEXP (x, 1), mem_mode, insn);
+ new = eliminate_regs_1 (XEXP (x, 1), mem_mode, insn, true);
if (new != XEXP (x, 1))
return
gen_rtx_fmt_ee (GET_CODE (x), GET_MODE (x), XEXP (x, 0), new);
@@ -2492,7 +2510,7 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
case CTZ:
case POPCOUNT:
case PARITY:
- new = eliminate_regs (XEXP (x, 0), mem_mode, insn);
+ new = eliminate_regs_1 (XEXP (x, 0), mem_mode, insn, false);
if (new != XEXP (x, 0))
return gen_rtx_fmt_e (code, GET_MODE (x), new);
return x;
@@ -2513,7 +2531,7 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
new = SUBREG_REG (x);
}
else
- new = eliminate_regs (SUBREG_REG (x), mem_mode, insn);
+ new = eliminate_regs_1 (SUBREG_REG (x), mem_mode, insn, false);
if (new != SUBREG_REG (x))
{
@@ -2549,12 +2567,12 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
case more efficiently. */
return
replace_equiv_address_nv (x,
- eliminate_regs (XEXP (x, 0),
- GET_MODE (x), insn));
+ eliminate_regs_1 (XEXP (x, 0), GET_MODE (x),
+ insn, true));
case USE:
/* Handle insn_list USE that a call to a pure function may generate. */
- new = eliminate_regs (XEXP (x, 0), 0, insn);
+ new = eliminate_regs_1 (XEXP (x, 0), 0, insn, false);
if (new != XEXP (x, 0))
return gen_rtx_USE (GET_MODE (x), new);
return x;
@@ -2575,7 +2593,7 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
{
if (*fmt == 'e')
{
- new = eliminate_regs (XEXP (x, i), mem_mode, insn);
+ new = eliminate_regs_1 (XEXP (x, i), mem_mode, insn, false);
if (new != XEXP (x, i) && ! copied)
{
rtx new_x = rtx_alloc (code);
@@ -2590,7 +2608,7 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
int copied_vec = 0;
for (j = 0; j < XVECLEN (x, i); j++)
{
- new = eliminate_regs (XVECEXP (x, i, j), mem_mode, insn);
+ new = eliminate_regs_1 (XVECEXP (x, i, j), mem_mode, insn, false);
if (new != XVECEXP (x, i, j) && ! copied_vec)
{
rtvec new_v = gen_rtvec_v (XVECLEN (x, i),
@@ -2613,6 +2631,12 @@ eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
return x;
}
+rtx
+eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
+{
+ return eliminate_regs_1 (x, mem_mode, insn, false);
+}
+
/* Scan rtx X for modifications of elimination target registers. Update
the table of eliminables to reflect the changed state. MEM_MODE is
the mode of an enclosing MEM rtx, or VOIDmode if not within a MEM. */
@@ -2870,7 +2894,7 @@ eliminate_regs_in_insn (rtx insn, int replace)
rtx substed_operand[MAX_RECOG_OPERANDS];
rtx orig_operand[MAX_RECOG_OPERANDS];
struct elim_table *ep;
- rtx plus_src;
+ rtx plus_src, plus_cst_src;
if (! insn_is_asm && icode < 0)
{
@@ -2975,16 +2999,19 @@ eliminate_regs_in_insn (rtx insn, int replace)
/* We allow one special case which happens to work on all machines we
currently support: a single set with the source or a REG_EQUAL
note being a PLUS of an eliminable register and a constant. */
- plus_src = 0;
+ plus_src = plus_cst_src = 0;
if (old_set && REG_P (SET_DEST (old_set)))
{
- /* First see if the source is of the form (plus (reg) CST). */
- if (GET_CODE (SET_SRC (old_set)) == PLUS
- && REG_P (XEXP (SET_SRC (old_set), 0))
- && GET_CODE (XEXP (SET_SRC (old_set), 1)) == CONST_INT
- && REGNO (XEXP (SET_SRC (old_set), 0)) < FIRST_PSEUDO_REGISTER)
+ if (GET_CODE (SET_SRC (old_set)) == PLUS)
plus_src = SET_SRC (old_set);
- else if (REG_P (SET_SRC (old_set)))
+ /* First see if the source is of the form (plus (reg) CST). */
+ if (plus_src
+ && REG_P (XEXP (plus_src, 0))
+ && GET_CODE (XEXP (plus_src, 1)) == CONST_INT
+ && REGNO (XEXP (plus_src, 0)) < FIRST_PSEUDO_REGISTER)
+ plus_cst_src = plus_src;
+ else if (REG_P (SET_SRC (old_set))
+ || plus_src)
{
/* Otherwise, see if we have a REG_EQUAL note of the form
(plus (reg) CST). */
@@ -2997,16 +3024,16 @@ eliminate_regs_in_insn (rtx insn, int replace)
&& GET_CODE (XEXP (XEXP (links, 0), 1)) == CONST_INT
&& REGNO (XEXP (XEXP (links, 0), 0)) < FIRST_PSEUDO_REGISTER)
{
- plus_src = XEXP (links, 0);
+ plus_cst_src = XEXP (links, 0);
break;
}
}
}
}
- if (plus_src)
+ if (plus_cst_src)
{
- rtx reg = XEXP (plus_src, 0);
- HOST_WIDE_INT offset = INTVAL (XEXP (plus_src, 1));
+ rtx reg = XEXP (plus_cst_src, 0);
+ HOST_WIDE_INT offset = INTVAL (XEXP (plus_cst_src, 1));
for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
if (ep->from_rtx == reg && ep->can_eliminate)
@@ -3038,9 +3065,9 @@ eliminate_regs_in_insn (rtx insn, int replace)
/* If we have a nonzero offset, and the source is already
a simple REG, the following transformation would
increase the cost of the insn by replacing a simple REG
- with (plus (reg sp) CST). So try only when plus_src
- comes from old_set proper, not REG_NOTES. */
- else if (SET_SRC (old_set) == plus_src)
+ with (plus (reg sp) CST). So try only when we already
+ had a PLUS before. */
+ else if (plus_src)
{
new_body = old_body;
if (! replace)
@@ -3079,6 +3106,8 @@ eliminate_regs_in_insn (rtx insn, int replace)
/* For an asm statement, every operand is eliminable. */
if (insn_is_asm || insn_data[icode].operand[i].eliminable)
{
+ bool is_set_src, in_plus;
+
/* Check for setting a register that we know about. */
if (recog_data.operand_type[i] != OP_IN
&& REG_P (orig_operand[i]))
@@ -3093,8 +3122,21 @@ eliminate_regs_in_insn (rtx insn, int replace)
ep->can_eliminate = 0;
}
- substed_operand[i] = eliminate_regs (recog_data.operand[i], 0,
- replace ? insn : NULL_RTX);
+ /* Companion to the above plus substitution, we can allow
+ invariants as the source of a plain move. */
+ is_set_src = false;
+ if (old_set && recog_data.operand_loc[i] == &SET_SRC (old_set))
+ is_set_src = true;
+ in_plus = false;
+ if (plus_src
+ && (recog_data.operand_loc[i] == &XEXP (plus_src, 0)
+ || recog_data.operand_loc[i] == &XEXP (plus_src, 1)))
+ in_plus = true;
+
+ substed_operand[i]
+ = eliminate_regs_1 (recog_data.operand[i], 0,
+ replace ? insn : NULL_RTX,
+ is_set_src || in_plus);
if (substed_operand[i] != orig_operand[i])
val = 1;
/* Terminate the search in check_eliminable_occurrences at
@@ -3222,7 +3264,8 @@ eliminate_regs_in_insn (rtx insn, int replace)
of spill registers to be needed in the final reload pass than in
the pre-passes. */
if (val && REG_NOTES (insn) != 0)
- REG_NOTES (insn) = eliminate_regs (REG_NOTES (insn), 0, REG_NOTES (insn));
+ REG_NOTES (insn)
+ = eliminate_regs_1 (REG_NOTES (insn), 0, REG_NOTES (insn), true);
return val;
}
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 44a1660e688..657b2b59c23 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2242,6 +2242,17 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
&f0, &f1);
real_convert (&result, mode, &value);
+ /* Don't constant fold this floating point operation if
+ the result has overflowed and flag_trapping_math. */
+
+ if (flag_trapping_math
+ && MODE_HAS_INFINITIES (mode)
+ && REAL_VALUE_ISINF (result)
+ && !REAL_VALUE_ISINF (f0)
+ && !REAL_VALUE_ISINF (f1))
+ /* Overflow plus exception. */
+ return 0;
+
/* Don't constant fold this floating point operation if the
result may dependent upon the run-time rounding mode and
flag_rounding_math is set, or if GCC's software emulation
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e6f9757c0ea..96230fc5207 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,114 @@
+2005-11-18 Joseph S. Myers <joseph@codesourcery.com>
+
+ * g++.dg/cpp/string-2.C: New test.
+
+2005-11-18 Zdenek Dvorak <dvorakz@suse.cz>
+
+ * gcc.dg/tree-ssa/loop-14.c: New test.
+
+2005-11-17 James A. Morrison <phython@gcc.gnu.org>
+ Michael Chamberlain <michael@chamberlain.net.au>
+
+ * ada/acats/run_all.sh (target_run): Kill long running tests.
+
+2005-11-17 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * gcc.dg/cleanup-8.c: Enable test on hppa*-*-hpux*.
+ * gcc.dg/cleanup-9.c: Likewise.
+ * gcc.dg/cleanup-10.c: Likewise.
+ * gcc.dg/cleanup-11.c: Likewise.
+
+2005-11-17 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR fortran/24892
+ * gfortran.dg/open_access_append_1.f90: New test.
+ * gfortran.dg/open_access_append_2.f90: New test.
+
+2005-11-16 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/24851
+ * gcc.c-torture/execute/pr24851.c: New testcase.
+
+2005-11-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/fold-overflow-1.c: New test.
+
+2005-11-16 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gcc.dg/cleanup-5.c, gcc.dg/cleanup-8.c, gcc.dg/cleanup-9.c,
+ gcc.dg/cleanup-10.c, gcc.dg/cleanup-11.c: Update for ARM EABI.
+
+2005-11-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.dg/eh/forced1.C: Adjust to cope with ARM EABI
+ structures.
+ * g++.dg/eh/forced2.C: Likewise.
+ * g++.dg/eh/forced3.C: Likewise.
+ * g++.dg/eh/forced4.C: Likewise.
+
+2005-11-11 Mike Stump <mrs@apple.com>
+
+ * g++.old-deja/g++.mike/unused.C: Add.
+
+2005-11-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/24667
+ * g++.dg/warn/Wcast-qual1.C: New test.
+
+2005-11-15 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/winline-5.c: Add large-unit-insns limit.
+
+2005-11-14 David Edelsohn <edelsohn@gnu.org>
+
+ * g++.dg/eh/simd-2.C: XFAIL on AIX and SPE.
+
+2005-11-14 Diego Novillo <dnovillo@redhat.com>
+
+ PR 24840
+ * gcc.dg/tree-ssa/pr24840.c: New test.
+
+2005-11-14 Janis Johnson <janis187@us.ibm.com>
+
+ PR testsuite/24841
+ * gcc.dg/attr-weakref-1.c: Rearrange test directives.
+
+2005-11-14 Dale Johannesen <dalej@apple.com>
+
+ * gcc.c-torture/execute/20051113-1.c: New.
+
+2005-11-14 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/24687
+ * g++.dg/template/crash43.C: New test.
+
+2005-11-14 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gcc.c-torture/unsorted/unsorted.exp: Sort tests before running them.
+
+2005-11-13 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/24817
+ * g++.dg/eh/spec8.C: New test.
+
+2005-11-14 Hans-Peter Nilsson <hp@axis.com>
+
+ * gcc.dg/pack-test-1.c: Gate on ! default_packed.
+
+2005-11-13 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/20293
+ * g++.dg/parse/ambig4.C: New test.
+ * g++.dg/tc1/dr101.C: Adjust error markers.
+ * g++.dg/lookup/strong-using-2.C: Likewise.
+ * g++.dg/lookup/ambig5.C: Likewise.
+ * g++.dg/lookup/ambig4.C: Likewise.
+ * g++.dg/parse/crash22.C: Likewise.
+
+2005-11-14 Hans-Peter Nilsson <hp@axis.com>
+
+ * gcc.dg/pr19340.c: Skip for mmix-*-* and cris-*-*.
+
2005-11-13 Eric Botcazou <ebotcazou@adacore.com>
* gcc.dg/nested-calls-1.c: New test.
diff --git a/gcc/testsuite/ada/acats/run_all.sh b/gcc/testsuite/ada/acats/run_all.sh
index 402ff69cb30..caaf56bb550 100755
--- a/gcc/testsuite/ada/acats/run_all.sh
+++ b/gcc/testsuite/ada/acats/run_all.sh
@@ -12,8 +12,25 @@
gccflags="-O2"
gnatflags="-gnatws"
+if [ "x$DEJAGNU_TIMEOUT" != "x" ]; then
+ timeout=$DEJAGNU_TIMEOUT
+else
+ timeout=300
+fi
+
target_run () {
-$*
+ sh -c "
+ (sleep $timeout && kill 2>/dev/null \$\$) &
+ watchdog=\$!
+ ($*) &
+ child=\$!
+ trap \"kill 2>/dev/null \$child\" 0 1
+ wait \$child
+ status=\$?
+ trap \"\" 0 1
+ kill 2>/dev/null \$watchdog
+ exit \$status
+ "
}
# End of customization section.
diff --git a/gcc/testsuite/g++.dg/cpp/string-2.C b/gcc/testsuite/g++.dg/cpp/string-2.C
new file mode 100644
index 00000000000..b947c73eea4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/string-2.C
@@ -0,0 +1,7 @@
+// Test diagnostics for interpreting strings: should be an error by
+// default.
+// Origin: Joseph Myers <joseph@codesourcery.com>
+// { dg-do compile }
+// { dg-options "" }
+
+const char *s = "\q"; // { dg-error "error: unknown escape sequence" }
diff --git a/gcc/testsuite/g++.dg/eh/forced1.C b/gcc/testsuite/g++.dg/eh/forced1.C
index 0068dae5b99..b0200813ece 100644
--- a/gcc/testsuite/g++.dg/eh/forced1.C
+++ b/gcc/testsuite/g++.dg/eh/forced1.C
@@ -6,6 +6,7 @@
#include <unwind.h>
#include <stdlib.h>
+#include <string.h>
static int test = 0;
@@ -35,7 +36,8 @@ force_unwind_cleanup (_Unwind_Reason_Code, struct _Unwind_Exception *)
static void force_unwind ()
{
_Unwind_Exception *exc = new _Unwind_Exception;
- exc->exception_class = 0;
+ // exception_class might not be a scalar.
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = force_unwind_cleanup;
#ifndef __USING_SJLJ_EXCEPTIONS__
@@ -54,7 +56,7 @@ struct S
~S() { test |= bit; }
};
-static void doit ()
+static __attribute__ ((noinline)) void doit ()
{
try {
S four(4);
@@ -62,7 +64,6 @@ static void doit ()
try {
S one(1);
force_unwind ();
-
} catch(...) {
test |= 2;
throw;
diff --git a/gcc/testsuite/g++.dg/eh/forced2.C b/gcc/testsuite/g++.dg/eh/forced2.C
index 3c6719da0f9..54586a00617 100644
--- a/gcc/testsuite/g++.dg/eh/forced2.C
+++ b/gcc/testsuite/g++.dg/eh/forced2.C
@@ -6,6 +6,7 @@
#include <unwind.h>
#include <stdlib.h>
+#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
@@ -29,7 +30,8 @@ static void
force_unwind ()
{
_Unwind_Exception *exc = new _Unwind_Exception;
- exc->exception_class = 0;
+ // exception_class might not be a scalar.
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = force_unwind_cleanup;
#ifndef __USING_SJLJ_EXCEPTIONS__
diff --git a/gcc/testsuite/g++.dg/eh/forced3.C b/gcc/testsuite/g++.dg/eh/forced3.C
index 34d27641eeb..96319d44ecd 100644
--- a/gcc/testsuite/g++.dg/eh/forced3.C
+++ b/gcc/testsuite/g++.dg/eh/forced3.C
@@ -7,6 +7,7 @@
#include <unwind.h>
#include <stdlib.h>
#include <exception>
+#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
@@ -24,7 +25,8 @@ static void __attribute__((noreturn))
force_unwind ()
{
_Unwind_Exception *exc = new _Unwind_Exception;
- exc->exception_class = 0;
+ // exception_class might not be a scalar.
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = 0;
#ifndef __USING_SJLJ_EXCEPTIONS__
diff --git a/gcc/testsuite/g++.dg/eh/forced4.C b/gcc/testsuite/g++.dg/eh/forced4.C
index df691caa161..17fd94a4064 100644
--- a/gcc/testsuite/g++.dg/eh/forced4.C
+++ b/gcc/testsuite/g++.dg/eh/forced4.C
@@ -6,6 +6,7 @@
#include <unwind.h>
#include <stdlib.h>
+#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
@@ -23,7 +24,8 @@ static void __attribute__((noreturn))
force_unwind ()
{
_Unwind_Exception *exc = new _Unwind_Exception;
- exc->exception_class = 0;
+ // exception_class might not be a scalar.
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = 0;
#ifndef __USING_SJLJ_EXCEPTIONS__
diff --git a/gcc/testsuite/g++.dg/eh/simd-2.C b/gcc/testsuite/g++.dg/eh/simd-2.C
index c012670190c..bac1d765732 100644
--- a/gcc/testsuite/g++.dg/eh/simd-2.C
+++ b/gcc/testsuite/g++.dg/eh/simd-2.C
@@ -4,6 +4,7 @@
// { dg-options "-O -w" { target i?86-*-* } }
// { dg-options "-O -w" { target { x86_64-*-* && ilp32 } } }
// { dg-options "-O -w -maltivec" { target powerpc*-*-linux* } }
+// { dg-xfail-if "" { "powerpc-*-eabispe*" "powerpc-ibm-aix*" } { "*" } { "" } }
// { dg-do run }
#include "check-vect.h"
diff --git a/gcc/testsuite/g++.dg/eh/spec8.C b/gcc/testsuite/g++.dg/eh/spec8.C
new file mode 100644
index 00000000000..7a35e6e8072
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/spec8.C
@@ -0,0 +1,11 @@
+// PR c++/24817
+
+struct exception {};
+
+template <typename T> void foo() throw(exception); // { dg-error "declaration" }
+template <typename T> void foo(); // { dg-error "exceptions" }
+
+struct bar
+{
+ template <typename T> friend void foo(); // { dg-error "exceptions" }
+};
diff --git a/gcc/testsuite/g++.dg/eh/synth2.C b/gcc/testsuite/g++.dg/eh/synth2.C
new file mode 100644
index 00000000000..2da814db9d6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/eh/synth2.C
@@ -0,0 +1,24 @@
+// PR c++/24580
+// { dg-do run }
+
+struct vbase {};
+
+struct foo : virtual vbase
+{
+ foo()
+ {
+ throw "exception in foo ctor";
+ }
+};
+
+struct bar : public foo {};
+
+int main()
+{
+ try
+ {
+ bar a;
+ }
+ catch ( ... ) { }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lookup/ambig4.C b/gcc/testsuite/g++.dg/lookup/ambig4.C
index ab1a14518d5..3a74f7d1c76 100644
--- a/gcc/testsuite/g++.dg/lookup/ambig4.C
+++ b/gcc/testsuite/g++.dg/lookup/ambig4.C
@@ -4,11 +4,11 @@
namespace N
{
- int i; // { dg-error "declared" }
+ int i; // { dg-error "i" }
}
-int i; // { dg-error "declared" }
+int i; // { dg-error "i" }
using namespace N;
-void foo() { i; } // { dg-error "in this scope|ambiguous" }
+void foo() { i; } // { dg-error "ambiguous" }
diff --git a/gcc/testsuite/g++.dg/lookup/ambig5.C b/gcc/testsuite/g++.dg/lookup/ambig5.C
index 8f74efc7518..cebec277910 100644
--- a/gcc/testsuite/g++.dg/lookup/ambig5.C
+++ b/gcc/testsuite/g++.dg/lookup/ambig5.C
@@ -4,10 +4,10 @@
namespace N
{
- namespace M {} // { dg-error "declared" }
+ namespace M {} // { dg-error "M" }
}
-namespace M {} // { dg-error "declared" }
+namespace M {} // { dg-error "M" }
using namespace N;
using namespace M; // { dg-error "namespace-name|ambiguous" }
diff --git a/gcc/testsuite/g++.dg/lookup/strong-using-2.C b/gcc/testsuite/g++.dg/lookup/strong-using-2.C
index 8d45e00e0e1..f8b5f64fbd2 100644
--- a/gcc/testsuite/g++.dg/lookup/strong-using-2.C
+++ b/gcc/testsuite/g++.dg/lookup/strong-using-2.C
@@ -3,10 +3,10 @@
// { dg-do compile }
namespace foo_impl {
- class T; // { dg-error "first declared" "" }
+ class T; // { dg-error "T" "" }
}
namespace bar_impl {
- class T; // { dg-error "also declared" "" }
+ class T; // { dg-error "T" "" }
}
namespace foo {
using namespace foo_impl __attribute__((strong));
diff --git a/gcc/testsuite/g++.dg/parse/ambig4.C b/gcc/testsuite/g++.dg/parse/ambig4.C
new file mode 100644
index 00000000000..868f07cf783
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/ambig4.C
@@ -0,0 +1,18 @@
+// PR c++/20293
+
+namespace hide { // { dg-error "hide" }
+ int k;
+}
+
+namespace {
+ int i;
+ namespace hide { // { dg-error "hide" }
+ int j;
+ }
+}
+
+void F(int) {}
+
+int main() {
+ F(hide::j); // { dg-error "ambiguous" }
+}
diff --git a/gcc/testsuite/g++.dg/parse/crash22.C b/gcc/testsuite/g++.dg/parse/crash22.C
index d4fe6d15a8e..eaf4d1a5c08 100644
--- a/gcc/testsuite/g++.dg/parse/crash22.C
+++ b/gcc/testsuite/g++.dg/parse/crash22.C
@@ -4,17 +4,17 @@
// PR 19030: ICE
// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
-struct A;
+struct A; // { dg-error "A" }
namespace N
{
- struct A;
+ struct A; // { dg-error "A" }
}
using namespace N;
-int A::i; // { dg-error "not been declared|declared here" "" }
-int A::i; // { dg-error "not been declared|redefinition of" "" }
+int A::i; // { dg-error "ambiguous|declared here" "" }
+int A::i; // { dg-error "ambiguous|redefinition of" "" }
namespace N
{
diff --git a/gcc/testsuite/g++.dg/tc1/dr101.C b/gcc/testsuite/g++.dg/tc1/dr101.C
index 8d9cab518b9..c5b34a472a9 100644
--- a/gcc/testsuite/g++.dg/tc1/dr101.C
+++ b/gcc/testsuite/g++.dg/tc1/dr101.C
@@ -17,10 +17,10 @@ namespace Test1 {
namespace Test2 {
- typedef unsigned int X; // { dg-bogus "declared" "" { xfail *-*-* } }
+ typedef unsigned int X; // { dg-bogus "X" "" { xfail *-*-* } }
extern "C" int f2();
namespace N {
- typedef unsigned int X; // { dg-bogus "declared" "" { xfail *-*-* } }
+ typedef unsigned int X; // { dg-bogus "X" "" { xfail *-*-* } }
extern "C" int f2();
}
using namespace N;
diff --git a/gcc/testsuite/g++.dg/template/crash43.C b/gcc/testsuite/g++.dg/template/crash43.C
new file mode 100644
index 00000000000..1261c365058
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash43.C
@@ -0,0 +1,8 @@
+// PR c++/24687
+
+extern "C" {
+ template<typename _Tp> // { dg-error "C" }
+ struct __is_pod {
+ enum {
+ __value = (sizeof(__gnu_internal::__test_type<_Tp>(0)))}; // { dg-error "declared|expected" }
+
diff --git a/gcc/testsuite/g++.dg/warn/Wcast-qual1.C b/gcc/testsuite/g++.dg/warn/Wcast-qual1.C
new file mode 100644
index 00000000000..e6ad4f6a06d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wcast-qual1.C
@@ -0,0 +1,7 @@
+// PR c++/24667
+// { dg-options "-Wcast-qual" }
+
+int main(int, char**) {
+ const int foo[2] = {1,1};
+ ((int*)foo)[0] = 0; // { dg-warning "cast" }
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/unused.C b/gcc/testsuite/g++.old-deja/g++.mike/unused.C
new file mode 100644
index 00000000000..b441a77f55e
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.mike/unused.C
@@ -0,0 +1,7 @@
+// { dg-do compile { target *-*-darwin* } }
+// { dg-options { -Wunused-parameter } }
+// Radar 4125055
+
+void foo(int x) {
+#pragma unused ( x )
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20051113-1.c b/gcc/testsuite/gcc.c-torture/execute/20051113-1.c
new file mode 100644
index 00000000000..6dbd1f0c63f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20051113-1.c
@@ -0,0 +1,71 @@
+extern void *malloc(__SIZE_TYPE__);
+extern void *memset(void *, int, __SIZE_TYPE__);
+typedef struct
+{
+ short a;
+ unsigned short b;
+ unsigned short c;
+ unsigned long long Count;
+ long long Count2;
+} __attribute__((packed)) Struct1;
+
+typedef struct
+{
+ short a;
+ unsigned short b;
+ unsigned short c;
+ unsigned long long d;
+ long long e;
+ long long f;
+} __attribute__((packed)) Struct2;
+
+typedef union
+{
+ Struct1 a;
+ Struct2 b;
+} Union;
+
+typedef struct
+{
+ int Count;
+ Union List[0];
+} __attribute__((packed)) Struct3;
+
+unsigned long long Sum (Struct3 *instrs) __attribute__((noinline));
+unsigned long long Sum (Struct3 *instrs)
+{
+ unsigned long long count = 0;
+ int i;
+
+ for (i = 0; i < instrs->Count; i++) {
+ count += instrs->List[i].a.Count;
+ }
+ return count;
+}
+long long Sum2 (Struct3 *instrs) __attribute__((noinline));
+long long Sum2 (Struct3 *instrs)
+{
+ long long count = 0;
+ int i;
+
+ for (i = 0; i < instrs->Count; i++) {
+ count += instrs->List[i].a.Count2;
+ }
+ return count;
+}
+main() {
+ Struct3 *p = malloc (sizeof (int) + 3 * sizeof(Struct1));
+ memset(p, 0, sizeof(int) + 3*sizeof(Struct1));
+ p->Count = 3;
+ p->List[0].a.Count = 555;
+ p->List[1].a.Count = 999;
+ p->List[2].a.Count = 0x101010101ULL;
+ p->List[0].a.Count2 = 555;
+ p->List[1].a.Count2 = 999;
+ p->List[2].a.Count2 = 0x101010101LL;
+ if (Sum(p) != 555 + 999 + 0x101010101ULL)
+ abort();
+ if (Sum2(p) != 555 + 999 + 0x101010101LL)
+ abort();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr24851.c b/gcc/testsuite/gcc.c-torture/execute/pr24851.c
new file mode 100644
index 00000000000..55a87e0019e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr24851.c
@@ -0,0 +1,17 @@
+/* We used to handle pointer addition wrongly
+ at the time of recombining to an ARRAY_REF
+ in the case of
+ p + -4B
+ where -4B is represented as unsigned. */
+
+void abort(void);
+int main()
+{
+ int a[10], *p, *q;
+ q = &a[1];
+ p = &q[-1];
+ if (p >= &a[9])
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp
index 5f91f864d79..d716a76431e 100644
--- a/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp
+++ b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp
@@ -39,7 +39,7 @@ load_lib c-torture.exp
# require unique options need their own .exp file.
#
-foreach testcase [glob -nocomplain $srcdir/$subdir/*.c] {
+foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
if [file exists [file rootname $testcase].exp] then {
verbose "INFO:\"[file rootname $testcase].exp\" exists, skipping test" 3
continue
diff --git a/gcc/testsuite/gcc.dg/attr-weakref-1.c b/gcc/testsuite/gcc.dg/attr-weakref-1.c
index 317f519f224..c47ce1e569b 100644
--- a/gcc/testsuite/gcc.dg/attr-weakref-1.c
+++ b/gcc/testsuite/gcc.dg/attr-weakref-1.c
@@ -1,7 +1,7 @@
// { dg-do run }
-// { dg-additional-sources " attr-weakref-1a.c" }
// { dg-require-weak "" }
// { dg-options "-O2" }
+// { dg-additional-sources "attr-weakref-1a.c" }
// Copyright 2005 Free Software Foundation, Inc.
// Contributed by Alexandre Oliva <aoliva@redhat.com>
diff --git a/gcc/testsuite/gcc.dg/cleanup-10.c b/gcc/testsuite/gcc.dg/cleanup-10.c
index 35936eabb53..beac2ecd56f 100644
--- a/gcc/testsuite/gcc.dg/cleanup-10.c
+++ b/gcc/testsuite/gcc.dg/cleanup-10.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target *-*-linux* powerpc*-*-darwin* } } */
+/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* Verify that cleanups work with exception handling through signal frames
on alternate stack. */
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
+#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
@@ -23,7 +24,7 @@ force_unwind_stop (int version, _Unwind_Action actions,
static void force_unwind ()
{
struct _Unwind_Exception *exc = malloc (sizeof (*exc));
- exc->exception_class = 0;
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = 0;
#ifndef __USING_SJLJ_EXCEPTIONS__
diff --git a/gcc/testsuite/gcc.dg/cleanup-11.c b/gcc/testsuite/gcc.dg/cleanup-11.c
index 447b3986222..8330c2b4bbe 100644
--- a/gcc/testsuite/gcc.dg/cleanup-11.c
+++ b/gcc/testsuite/gcc.dg/cleanup-11.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target *-*-linux* powerpc*-*-darwin* } } */
+/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* Verify that cleanups work with exception handling through realtime signal
frames on alternate stack. */
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
+#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
@@ -23,7 +24,7 @@ force_unwind_stop (int version, _Unwind_Action actions,
static void force_unwind ()
{
struct _Unwind_Exception *exc = malloc (sizeof (*exc));
- exc->exception_class = 0;
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = 0;
#ifndef __USING_SJLJ_EXCEPTIONS__
diff --git a/gcc/testsuite/gcc.dg/cleanup-5.c b/gcc/testsuite/gcc.dg/cleanup-5.c
index 497ab0be90f..c335c1e4492 100644
--- a/gcc/testsuite/gcc.dg/cleanup-5.c
+++ b/gcc/testsuite/gcc.dg/cleanup-5.c
@@ -6,6 +6,7 @@
#include <unwind.h>
#include <stdlib.h>
+#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
@@ -22,7 +23,7 @@ force_unwind_stop (int version, _Unwind_Action actions,
static void force_unwind ()
{
struct _Unwind_Exception *exc = malloc (sizeof (*exc));
- exc->exception_class = 0;
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = 0;
#ifndef __USING_SJLJ_EXCEPTIONS__
diff --git a/gcc/testsuite/gcc.dg/cleanup-8.c b/gcc/testsuite/gcc.dg/cleanup-8.c
index 25bc305adc1..3aca7223bd7 100644
--- a/gcc/testsuite/gcc.dg/cleanup-8.c
+++ b/gcc/testsuite/gcc.dg/cleanup-8.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target *-*-linux* powerpc*-*-darwin* } } */
+/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* Verify that cleanups work with exception handling through signal
frames. */
@@ -6,6 +6,7 @@
#include <unwind.h>
#include <stdlib.h>
#include <signal.h>
+#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
@@ -22,7 +23,7 @@ force_unwind_stop (int version, _Unwind_Action actions,
static void force_unwind ()
{
struct _Unwind_Exception *exc = malloc (sizeof (*exc));
- exc->exception_class = 0;
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = 0;
#ifndef __USING_SJLJ_EXCEPTIONS__
diff --git a/gcc/testsuite/gcc.dg/cleanup-9.c b/gcc/testsuite/gcc.dg/cleanup-9.c
index 4cf4a413fa4..62a7e800179 100644
--- a/gcc/testsuite/gcc.dg/cleanup-9.c
+++ b/gcc/testsuite/gcc.dg/cleanup-9.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target *-*-linux* powerpc*-*-darwin* } } */
+/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* Verify that cleanups work with exception handling through realtime
signal frames. */
@@ -6,6 +6,7 @@
#include <unwind.h>
#include <stdlib.h>
#include <signal.h>
+#include <string.h>
static _Unwind_Reason_Code
force_unwind_stop (int version, _Unwind_Action actions,
@@ -22,7 +23,7 @@ force_unwind_stop (int version, _Unwind_Action actions,
static void force_unwind ()
{
struct _Unwind_Exception *exc = malloc (sizeof (*exc));
- exc->exception_class = 0;
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
exc->exception_cleanup = 0;
#ifndef __USING_SJLJ_EXCEPTIONS__
diff --git a/gcc/testsuite/gcc.dg/fold-overflow-1.c b/gcc/testsuite/gcc.dg/fold-overflow-1.c
new file mode 100644
index 00000000000..2dd2188f870
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fold-overflow-1.c
@@ -0,0 +1,18 @@
+/* { dg-compile } */
+/* { dg-options "-O -ftrapping-math" } */
+
+float f1 = __FLT_MAX__ + __FLT_MAX__;
+
+float foo1(void)
+{
+ return __FLT_MAX__ + __FLT_MAX__;
+}
+
+float f2 = 1.0f/0.0f;
+
+float foo2(void)
+{
+ return 1.0f/0.0f;
+}
+
+/* { dg-final { scan-assembler-times "2139095040" 2 } } */
diff --git a/gcc/testsuite/gcc.dg/pack-test-1.c b/gcc/testsuite/gcc.dg/pack-test-1.c
index 4d54647918e..08fc2a739f6 100644
--- a/gcc/testsuite/gcc.dg/pack-test-1.c
+++ b/gcc/testsuite/gcc.dg/pack-test-1.c
@@ -1,7 +1,7 @@
/* Test semantics of #pragma pack.
Contributed by Mike Coleman <mcoleman2@kc.rr.com> */
-/* { dg-do compile { target *-*-linux* *-*-cygwin* powerpc*-*-eabi* } } */
+/* { dg-do compile { target { { *-*-linux* *-*-cygwin* powerpc*-*-eabi* } && { ! default_packed } } } } */
/* We only test the alignment of char, short, and int, because these
are the only ones that are pretty certain to be the same across
diff --git a/gcc/testsuite/gcc.dg/pr19340.c b/gcc/testsuite/gcc.dg/pr19340.c
index cac4b0933ee..09580217f16 100644
--- a/gcc/testsuite/gcc.dg/pr19340.c
+++ b/gcc/testsuite/gcc.dg/pr19340.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fschedule-insns2 -fsched2-use-traces" } */
+/* { dg-skip-if "No scheduling" { mmix-*-* cris-*-* } { "*" } { "" } } */
extern double f (double x);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-14.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-14.c
new file mode 100644
index 00000000000..ff96e128beb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-14.c
@@ -0,0 +1,19 @@
+/* A test for final value replacement. */
+
+/* { dg-options "-O2 -fdump-tree-vars" } */
+
+int foo(void);
+
+int bla(void)
+{
+ int i, j = foo ();
+
+ for (i = 0; i < 100; i++, j++)
+ foo ();
+
+ /* Should be replaced with return j0 + 100; */
+ return j;
+}
+
+/* { dg-final { scan-tree-dump-times "\\+ 100" 1 "vars" } } */
+/* { dg-final { cleanup-tree-dump "vars" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr24840.c b/gcc/testsuite/gcc.dg/tree-ssa/pr24840.c
new file mode 100644
index 00000000000..736dafdec59
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr24840.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef struct
+{
+ int tag, y;
+} Object;
+
+void Err_Handler () __attribute__ ((__noreturn__));
+
+int
+P_Error (int argc, Object * argv)
+{
+ if (((argv[1]).tag >> 1) != 11)
+ Wrong_Type (argv[1], 11);
+ Err_Handler (argv[0], argv[1], argc - 2, argv + 2);
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-12.c b/gcc/testsuite/gcc.dg/uninit-12.c
new file mode 100644
index 00000000000..7889e5370e5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-12.c
@@ -0,0 +1,12 @@
+/* PR 23497 */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+typedef _Complex float C;
+C foo()
+{
+ C f;
+ __real__ f = 0;
+ __imag__ f = 0;
+ return f;
+}
diff --git a/gcc/testsuite/gcc.dg/uninit-13.c b/gcc/testsuite/gcc.dg/uninit-13.c
new file mode 100644
index 00000000000..168939ab857
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-13.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+typedef _Complex float C;
+C foo()
+{
+ C f;
+ __imag__ f = 0;
+ return f; /* { dg-warning "" "uninit" { xfail *-*-* } } */
+}
diff --git a/gcc/testsuite/gcc.dg/winline-5.c b/gcc/testsuite/gcc.dg/winline-5.c
index 20df786a757..57fa3937e0a 100644
--- a/gcc/testsuite/gcc.dg/winline-5.c
+++ b/gcc/testsuite/gcc.dg/winline-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-Winline -O2 --param inline-unit-growth=0" } */
+/* { dg-options "-Winline -O2 --param inline-unit-growth=0 --param large-unit-insns=0" } */
void big (void);
inline int q(void)
diff --git a/gcc/testsuite/gfortran.dg/open_access_append_1.f90 b/gcc/testsuite/gfortran.dg/open_access_append_1.f90
new file mode 100644
index 00000000000..7aa7991a75a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/open_access_append_1.f90
@@ -0,0 +1,20 @@
+! { dg-do run }
+! Testcase for the GNU extension OPEN(...,ACCESS="APPEND")
+ open (10,file="foo")
+ close (10,status="delete")
+
+ open (10,file="foo",access="append") ! { dg-output ".*Extension.*" }
+ write (10,*) 42
+ close (10,status="keep")
+ open (10,file="foo",access="append") ! { dg-output ".*Extension.*" }
+ write (10,*) -42
+ close (10,status="keep")
+
+ open (10,file="foo")
+ read (10,*) i
+ if (i /= 42) call abort
+ read (10,*) i
+ if (i /= -42) call abort
+ close (10,status="delete")
+
+ end
diff --git a/gcc/testsuite/gfortran.dg/open_access_append_2.f90 b/gcc/testsuite/gfortran.dg/open_access_append_2.f90
new file mode 100644
index 00000000000..3661bb0b2f8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/open_access_append_2.f90
@@ -0,0 +1,5 @@
+! { dg-do run }
+! Testcase for the GNU extension OPEN(...,ACCESS="APPEND")
+ open (10,err=900,access="append",position="asis") ! { dg-output ".*Extension.*" }
+ call abort
+ 900 end
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 8b01f8b4cc9..4271d99009f 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -571,12 +571,6 @@ extern void dump_generic_bb (FILE *, basic_block, int, int);
extern var_ann_t create_var_ann (tree);
extern stmt_ann_t create_stmt_ann (tree);
extern tree_ann_t create_tree_ann (tree);
-extern void reserve_phi_args_for_new_edge (basic_block);
-extern tree create_phi_node (tree, basic_block);
-extern void add_phi_arg (tree, tree, edge);
-extern void remove_phi_args (edge);
-extern void remove_phi_node (tree, tree);
-extern tree phi_reverse (tree);
extern void dump_dfa_stats (FILE *);
extern void debug_dfa_stats (void);
extern void debug_referenced_vars (void);
@@ -592,6 +586,14 @@ extern void find_new_referenced_vars (tree *);
extern tree make_rename_temp (tree, const char *);
+/* In tree-phinodes.c */
+extern void reserve_phi_args_for_new_edge (basic_block);
+extern tree create_phi_node (tree, basic_block);
+extern void add_phi_arg (tree, tree, edge);
+extern void remove_phi_args (edge);
+extern void remove_phi_node (tree, tree);
+extern tree phi_reverse (tree);
+
/* In gimple-low.c */
extern void record_vars (tree);
extern bool block_may_fallthru (tree block);
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index c2fa2ef995d..c35298e9d09 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -2700,6 +2700,14 @@ scev_finalize (void)
BITMAP_FREE (already_instantiated);
}
+/* Returns true if EXPR looks expensive. */
+
+static bool
+expression_expensive_p (tree expr)
+{
+ return force_expr_to_var_cost (expr) >= target_spill_cost;
+}
+
/* Replace ssa names for that scev can prove they are constant by the
appropriate constants. Also perform final value replacement in loops,
in case the replacement expressions are cheap.
@@ -2775,7 +2783,8 @@ scev_const_prop (void)
for (i = current_loops->num - 1; i > 0; i--)
{
edge exit;
- tree def, stmts;
+ tree def, rslt, ass;
+ block_stmt_iterator bsi;
loop = current_loops->parray[i];
if (!loop)
@@ -2787,46 +2796,50 @@ scev_const_prop (void)
if (!exit
|| number_of_iterations_in_loop (loop) == chrec_dont_know)
continue;
- ex_loop = exit->dest->loop_father;
+
+ /* Ensure that it is possible to insert new statements somewhere. */
+ if (!single_pred_p (exit->dest))
+ split_loop_exit_edge (exit);
+ tree_block_label (exit->dest);
+ bsi = bsi_after_labels (exit->dest);
+
+ ex_loop = superloop_at_depth (loop, exit->dest->loop_father->depth + 1);
for (phi = phi_nodes (exit->dest); phi; phi = next_phi)
{
next_phi = PHI_CHAIN (phi);
+ rslt = PHI_RESULT (phi);
def = PHI_ARG_DEF_FROM_EDGE (phi, exit);
- if (!is_gimple_reg (def)
- || expr_invariant_in_loop_p (loop, def))
+ if (!is_gimple_reg (def))
continue;
if (!POINTER_TYPE_P (TREE_TYPE (def))
&& !INTEGRAL_TYPE_P (TREE_TYPE (def)))
continue;
- def = analyze_scalar_evolution_in_loop (ex_loop, ex_loop, def);
+ def = analyze_scalar_evolution_in_loop (ex_loop, loop, def);
+ def = compute_overall_effect_of_inner_loop (ex_loop, def);
if (!tree_does_not_contain_chrecs (def)
- || chrec_contains_symbols_defined_in_loop (def, loop->num)
- || def == PHI_RESULT (phi)
- || (TREE_CODE (def) == SSA_NAME
- && loop_containing_stmt (SSA_NAME_DEF_STMT (def))
- && loop_containing_stmt (phi)
- && loop_containing_stmt (SSA_NAME_DEF_STMT (def))
- == loop_containing_stmt (phi)))
+ || chrec_contains_symbols_defined_in_loop (def, ex_loop->num))
continue;
- /* If computing the expression is expensive, let it remain in
- loop. TODO -- we should take the cost of computing the expression
- in loop into account. */
- if (force_expr_to_var_cost (def) >= target_spill_cost)
+ /* If computing the expression is expensive, let it remain in the
+ loop. */
+ if (expression_expensive_p (def))
continue;
- def = unshare_expr (def);
- if (is_gimple_val (def))
- stmts = NULL_TREE;
- else
- def = force_gimple_operand (def, &stmts, true,
- SSA_NAME_VAR (PHI_RESULT (phi)));
- SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, exit), def);
- if (stmts)
- compute_phi_arg_on_exit (exit, stmts, def);
+ /* Eliminate the phi node and replace it by a computation outside
+ the loop. */
+ def = unshare_expr (def);
+ SET_PHI_RESULT (phi, NULL_TREE);
+ remove_phi_node (phi, NULL_TREE);
+
+ ass = build2 (MODIFY_EXPR, void_type_node, rslt, NULL_TREE);
+ SSA_NAME_DEF_STMT (rslt) = ass;
+ bsi_insert_after (&bsi, ass, BSI_NEW_STMT);
+ def = force_gimple_operand_bsi (&bsi, def, false, NULL_TREE);
+ TREE_OPERAND (ass, 1) = def;
+ update_stmt (ass);
}
}
}
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 1e0ebbce9a5..a0d2f282907 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -3203,10 +3203,7 @@ extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p)
record ranges for enumerations. Presumably this is due to
the fact that they're rarely used directly. They are typically
cast into an integer type and used that way. */
- if (TREE_CODE (type) != INTEGER_TYPE
- /* We don't know how to deal with types with variable bounds. */
- || TREE_CODE (TYPE_MIN_VALUE (type)) != INTEGER_CST
- || TREE_CODE (TYPE_MAX_VALUE (type)) != INTEGER_CST)
+ if (TREE_CODE (type) != INTEGER_TYPE)
return 0;
switch (TREE_CODE (cond))
@@ -3223,12 +3220,19 @@ extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p)
case GE_EXPR:
low = op1;
+
+ /* Get the highest value of the type. If not a constant, use that
+ of its base type, if it has one. */
high = TYPE_MAX_VALUE (type);
+ if (TREE_CODE (high) != INTEGER_CST && TREE_TYPE (type))
+ high = TYPE_MAX_VALUE (TREE_TYPE (type));
inverted = 0;
break;
case GT_EXPR:
high = TYPE_MAX_VALUE (type);
+ if (TREE_CODE (high) != INTEGER_CST && TREE_TYPE (type))
+ high = TYPE_MAX_VALUE (TREE_TYPE (type));
if (!tree_int_cst_lt (op1, high))
return 0;
low = int_const_binop (PLUS_EXPR, op1, integer_one_node, 1);
@@ -3238,11 +3242,15 @@ extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p)
case LE_EXPR:
high = op1;
low = TYPE_MIN_VALUE (type);
+ if (TREE_CODE (low) != INTEGER_CST && TREE_TYPE (type))
+ low = TYPE_MIN_VALUE (TREE_TYPE (type));
inverted = 0;
break;
case LT_EXPR:
low = TYPE_MIN_VALUE (type);
+ if (TREE_CODE (low) != INTEGER_CST && TREE_TYPE (type))
+ low = TYPE_MIN_VALUE (TREE_TYPE (type));
if (!tree_int_cst_lt (low, op1))
return 0;
high = int_const_binop (MINUS_EXPR, op1, integer_one_node, 1);
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 081d21a7b97..7b24c594a5c 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1155,14 +1155,29 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data)
{
tree t = *tp;
- /* We only do data flow with SSA_NAMEs, so that's all we can warn about. */
- if (TREE_CODE (t) == SSA_NAME)
+ switch (TREE_CODE (t))
{
+ case SSA_NAME:
+ /* We only do data flow with SSA_NAMEs, so that's all we
+ can warn about. */
warn_uninit (t, "%H%qD is used uninitialized in this function", data);
*walk_subtrees = 0;
+ break;
+
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ /* The total store transformation performed during gimplification
+ creates uninitialized variable uses. If all is well, these will
+ be optimized away, so don't warn now. */
+ if (TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME)
+ *walk_subtrees = 0;
+ break;
+
+ default:
+ if (IS_TYPE_OR_DECL_P (t))
+ *walk_subtrees = 0;
+ break;
}
- else if (IS_TYPE_OR_DECL_P (t))
- *walk_subtrees = 0;
return NULL_TREE;
}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index d49c4d40d32..f88b23e1aeb 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -2221,6 +2221,13 @@ infer_value_range (tree stmt, tree op, enum tree_code *comp_code_p, tree *val_p)
if (tree_could_throw_p (stmt))
return false;
+ /* If STMT is the last statement of a basic block with no
+ successors, there is no point inferring anything about any of its
+ operands. We would not be able to find a proper insertion point
+ for the assertion, anyway. */
+ if (stmt_ends_bb_p (stmt) && EDGE_COUNT (bb_for_stmt (stmt)->succs) == 0)
+ return false;
+
if (POINTER_TYPE_P (TREE_TYPE (op)))
{
bool is_store;
diff --git a/gcc/tree.def b/gcc/tree.def
index b7bdc0924e4..296eb229f23 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -326,8 +326,8 @@ DEFTREECODE (STRING_CST, "string_cst", tcc_constant, 0)
FUNCTION_DECLs use four special fields:
DECL_ARGUMENTS holds a chain of PARM_DECL nodes for the arguments.
- DECL_RESULT holds a RESULT_DECL node for the value of a function,
- or it is 0 for a function that returns no value.
+ DECL_RESULT holds a RESULT_DECL node for the value of a function.
+ The DECL_RTL field is 0 for a function that returns no value.
(C functions returning void have zero here.)
The TREE_TYPE field is the type in which the result is actually
returned. This is usually the same as the return type of the
diff --git a/gcc/unwind-c.c b/gcc/unwind-c.c
index 6fb66e0b738..e3e2eca1804 100644
--- a/gcc/unwind-c.c
+++ b/gcc/unwind-c.c
@@ -129,7 +129,7 @@ PERSONALITY_FUNCTION (int version,
_Unwind_Ptr landing_pad, ip;
#ifdef __ARM_EABI_UNWINDER__
- if (state != _US_UNWIND_FRAME_STARTING)
+ if ((state & _US_ACTION_MASK) != _US_UNWIND_FRAME_STARTING)
CONTINUE_UNWINDING;
/* The dwarf unwinder assumes the context structure holds things like the
diff --git a/gcc/unwind-dw2.c b/gcc/unwind-dw2.c
index 5a4375fa927..930f02f3799 100644
--- a/gcc/unwind-dw2.c
+++ b/gcc/unwind-dw2.c
@@ -902,7 +902,7 @@ execute_cfa_program (const unsigned char *insn_ptr,
insn_ptr += utmp;
break;
- /* From the 2.1 draft. */
+ /* From the dwarf3 draft. */
case DW_CFA_offset_extended_sf:
insn_ptr = read_uleb128 (insn_ptr, &reg);
insn_ptr = read_sleb128 (insn_ptr, &stmp);
@@ -916,10 +916,12 @@ execute_cfa_program (const unsigned char *insn_ptr,
insn_ptr = read_uleb128 (insn_ptr, &fs->cfa_reg);
insn_ptr = read_sleb128 (insn_ptr, &fs->cfa_offset);
fs->cfa_how = CFA_REG_OFFSET;
+ fs->cfa_offset *= fs->data_align;
break;
case DW_CFA_def_cfa_offset_sf:
insn_ptr = read_sleb128 (insn_ptr, &fs->cfa_offset);
+ fs->cfa_offset *= fs->data_align;
/* cfa_how deliberately not set. */
break;
@@ -1210,6 +1212,12 @@ uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
context->ra = __builtin_extract_return_addr
(_Unwind_GetPtr (context, fs->retaddr_column));
}
+
+static void
+uw_advance_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+ uw_update_context (context, fs);
+}
/* Fill in CONTEXT for top-of-stack. The only valid registers at this
level will be the return address and the CFA. */
diff --git a/gcc/unwind-sjlj.c b/gcc/unwind-sjlj.c
index d08602da9fc..4c06aa1f894 100644
--- a/gcc/unwind-sjlj.c
+++ b/gcc/unwind-sjlj.c
@@ -185,6 +185,18 @@ _Unwind_Word
_Unwind_GetCFA (struct _Unwind_Context *context __attribute__((unused)))
{
/* ??? Ideally __builtin_setjmp places the CFA in the jmpbuf. */
+
+#ifndef DONT_USE_BUILTIN_SETJMP
+ /* This is a crude imitation of the CFA: the saved stack pointer.
+ This is roughly the CFA of the frame before CONTEXT. When using the
+ DWARF-2 unwinder _Unwind_GetCFA returns the CFA of the frame described
+ by CONTEXT instead; but for DWARF-2 the cleanups associated with
+ CONTEXT have already been run, and for SJLJ they have not yet been. */
+ if (context->fc != NULL)
+ return (_Unwind_Word) context->fc->jbuf[2];
+#endif
+
+ /* Otherwise we're out of luck for now. */
return (_Unwind_Word) 0;
}
@@ -264,6 +276,13 @@ uw_update_context (struct _Unwind_Context *context,
context->fc = context->fc->prev;
}
+static void
+uw_advance_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+ _Unwind_SjLj_Unregister (context->fc);
+ uw_update_context (context, fs);
+}
+
static inline void
uw_init_context (struct _Unwind_Context *context)
{
diff --git a/gcc/unwind.inc b/gcc/unwind.inc
index 63fba968fa1..b533eb58873 100644
--- a/gcc/unwind.inc
+++ b/gcc/unwind.inc
@@ -184,8 +184,9 @@ _Unwind_ForcedUnwind_Phase2 (struct _Unwind_Exception *exc,
return _URC_FATAL_PHASE2_ERROR;
}
- /* Update cur_context to describe the same frame as fs. */
- uw_update_context (context, &fs);
+ /* Update cur_context to describe the same frame as fs, and discard
+ the previous context if necessary. */
+ uw_advance_context (context, &fs);
}
return code;
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index d69ca139c42..fb4a1813218 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -557,8 +557,13 @@ adjust_stack_reference (rtx mem, HOST_WIDE_INT adjustment)
{
rtx addr, cfa, tmp;
+#ifdef FRAME_POINTER_CFA_OFFSET
+ adjustment -= FRAME_POINTER_CFA_OFFSET (current_function_decl);
+ cfa = plus_constant (frame_pointer_rtx, adjustment);
+#else
adjustment -= ARG_POINTER_CFA_OFFSET (current_function_decl);
cfa = plus_constant (arg_pointer_rtx, adjustment);
+#endif
addr = replace_rtx (copy_rtx (XEXP (mem, 0)), stack_pointer_rtx, cfa);
tmp = simplify_rtx (addr);
diff --git a/gcc/varasm.c b/gcc/varasm.c
index e5884b5be0d..12986ed6460 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -4560,7 +4560,10 @@ weak_finish (void)
#ifndef ASM_OUTPUT_WEAKREF
else if (! TREE_SYMBOL_REFERENCED (target))
{
-# ifdef ASM_WEAKEN_LABEL
+ /* Use ASM_WEAKEN_LABEL only if ASM_WEAKEN_DECL is not
+ defined, otherwise we and weak_finish_1 would use a
+ different macros. */
+# if defined ASM_WEAKEN_LABEL && ! defined ASM_WEAKEN_DECL
ASM_WEAKEN_LABEL (asm_out_file, IDENTIFIER_POINTER (target));
# else
tree decl = find_decl_and_mark_needed (alias_decl, target);
@@ -4745,7 +4748,7 @@ do_assemble_alias (tree decl, tree target)
weakref_targets = tree_cons (decl, target, weakref_targets);
#ifdef ASM_OUTPUT_WEAKREF
- ASM_OUTPUT_WEAKREF (asm_out_file,
+ ASM_OUTPUT_WEAKREF (asm_out_file, decl,
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
IDENTIFIER_POINTER (target));
#else
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 747e45adc72..312cb9899ef 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-14 Gerald Pfeifer <gerald@pfeifer.com>
+ Ian Lance Taylor <ian@airs.com>
+
+ * include/cpplib.h (struct cpp_callbacks): Annotate error with
+ ATTRIBUTE_FPTR_PRINTF(3,0) instead of ATTRIBUTE_PRINTF(3,0).
+
2005-11-09 Per Bothner <per@bothner.com>
Uros Bizjak <uros@kss-loka.si>
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 97d857ea675..cecf83dfd12 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -475,7 +475,7 @@ struct cpp_callbacks
/* Called to emit a diagnostic if client_diagnostic option is true.
This callback receives the translated message. */
void (*error) (cpp_reader *, int, const char *, va_list *)
- ATTRIBUTE_PRINTF(3,0);
+ ATTRIBUTE_FPTR_PRINTF(3,0);
};
/* Chain of directories to look for include files in. */
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 022ae4fb14b..c1169ee0099 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,30 @@
+2005-11-18 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ * configure.ac: Add "-I ." to the AM_FCFLAGS.
+ * configure: Regenerate.
+
+2005-11-18 Hans-Peter Nilsson <hp@axis.com>
+
+ * config/fpu-glibc.h (set_fpu): Only call fedisableexcept for
+ nonzero FE_ALL_EXCEPT.
+
+2005-11-17 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR fortran/24892
+ * io/io.h (unit_access): Add ACCESS_APPEND.
+ * io/open.c (access_opt): Add APPEND value for ACCESS keyword.
+ (st_open): Use that new value to set the POSITION accordingly.
+
+2005-11-14 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR fortran/21468
+ * Makefile.am: Add -ftree-vectorize for compiling matmul.
+ * m4/matmul.m4: Add const and restrict to type declarations as
+ appropriate.
+ * m4/matmull.m4: Likewise.
+ * Makefile.in: Regenerated.
+ * generated/matmul_*.c: Likewise.
+
2005-11-13 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* intrinsics/fget.c: New file.
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index ff8ef5406a8..e2cb0faeb4f 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -435,7 +435,7 @@ m4_files= m4/iparm.m4 m4/ifunction.m4 m4/iforeach.m4 m4/all.m4 \
gfor_built_src= $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
$(i_maxloc1_c) $(i_maxval_c) $(i_minloc0_c) $(i_minloc1_c) $(i_minval_c) \
$(i_product_c) $(i_sum_c) $(i_dotprod_c) $(i_dotprodl_c) $(i_dotprodc_c) \
- $(i_matmul_c) $(i_matmull_c) $(i_transpose_c) $(i_shape_c) $(i_eoshift1_c) \
+ $(i_matmull_c) $(i_transpose_c) $(i_shape_c) $(i_eoshift1_c) \
$(i_eoshift3_c) $(i_cshift1_c) $(i_reshape_c) $(in_pack_c) $(in_unpack_c) \
$(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \
$(i_pow_c) \
@@ -575,11 +575,17 @@ $(gfor_built_specific2_src) \
intrinsics/dprod_r8.f90 \
intrinsics/f2c_specifics.F90
+EXTRA_LTLIBRARIES = libmatmul.la
+libmatmul_la_SOURCES = $(i_matmul_c)
+libmatmul_la_CFLAGS = -ftree-vectorize $(AM_CFLAGS)
+
BUILT_SOURCES=$(gfor_built_src) $(gfor_built_specific_src) \
- $(gfor_built_specific2_src)
+ $(gfor_built_specific2_src) $(libmatmul_la_SOURCES)
libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
$(gfor_helper_src) $(gfor_io_headers) $(gfor_specific_src)
+libgfortran_la_LIBADD = libmatmul.la
+
I_M4_DEPS=m4/iparm.m4
I_M4_DEPS0=$(I_M4_DEPS) m4/iforeach.m4
I_M4_DEPS1=$(I_M4_DEPS) m4/ifunction.m4
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 7b1ed6976f3..79ec992f340 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -39,12 +39,12 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-DIST_COMMON = $(am__configure_deps) $(srcdir)/../config.guess \
- $(srcdir)/../config.sub $(srcdir)/../install-sh \
- $(srcdir)/../ltmain.sh $(srcdir)/../missing \
- $(srcdir)/../mkinstalldirs $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(top_srcdir)/configure ChangeLog
+DIST_COMMON = $(am__configure_deps) $(srcdir)/../compile \
+ $(srcdir)/../config.guess $(srcdir)/../config.sub \
+ $(srcdir)/../install-sh $(srcdir)/../ltmain.sh \
+ $(srcdir)/../missing $(srcdir)/../mkinstalldirs \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(top_srcdir)/configure ChangeLog
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
@@ -65,7 +65,7 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
-libgfortran_la_LIBADD =
+libgfortran_la_DEPENDENCIES = libmatmul.la
am__objects_1 = compile_options.lo environ.lo error.lo fpu.lo main.lo \
memory.lo pause.lo stop.lo string.lo select.lo
am__objects_2 = all_l4.lo all_l8.lo all_l16.lo
@@ -116,33 +116,30 @@ am__objects_13 = dotprod_i4.lo dotprod_i8.lo dotprod_i16.lo \
am__objects_14 = dotprod_l4.lo dotprod_l8.lo dotprod_l16.lo
am__objects_15 = dotprod_c4.lo dotprod_c8.lo dotprod_c10.lo \
dotprod_c16.lo
-am__objects_16 = matmul_i4.lo matmul_i8.lo matmul_i16.lo matmul_r4.lo \
- matmul_r8.lo matmul_r10.lo matmul_r16.lo matmul_c4.lo \
- matmul_c8.lo matmul_c10.lo matmul_c16.lo
-am__objects_17 = matmul_l4.lo matmul_l8.lo matmul_l16.lo
-am__objects_18 = transpose_i4.lo transpose_i8.lo transpose_i16.lo \
+am__objects_16 = matmul_l4.lo matmul_l8.lo matmul_l16.lo
+am__objects_17 = transpose_i4.lo transpose_i8.lo transpose_i16.lo \
transpose_c4.lo transpose_c8.lo transpose_c10.lo \
transpose_c16.lo
-am__objects_19 = shape_i4.lo shape_i8.lo shape_i16.lo
-am__objects_20 = eoshift1_4.lo eoshift1_8.lo eoshift1_16.lo
-am__objects_21 = eoshift3_4.lo eoshift3_8.lo eoshift3_16.lo
-am__objects_22 = cshift1_4.lo cshift1_8.lo cshift1_16.lo
-am__objects_23 = reshape_i4.lo reshape_i8.lo reshape_i16.lo \
+am__objects_18 = shape_i4.lo shape_i8.lo shape_i16.lo
+am__objects_19 = eoshift1_4.lo eoshift1_8.lo eoshift1_16.lo
+am__objects_20 = eoshift3_4.lo eoshift3_8.lo eoshift3_16.lo
+am__objects_21 = cshift1_4.lo cshift1_8.lo cshift1_16.lo
+am__objects_22 = reshape_i4.lo reshape_i8.lo reshape_i16.lo \
reshape_c4.lo reshape_c8.lo reshape_c10.lo reshape_c16.lo
-am__objects_24 = in_pack_i4.lo in_pack_i8.lo in_pack_i16.lo \
+am__objects_23 = in_pack_i4.lo in_pack_i8.lo in_pack_i16.lo \
in_pack_c4.lo in_pack_c8.lo in_pack_c10.lo in_pack_c16.lo
-am__objects_25 = in_unpack_i4.lo in_unpack_i8.lo in_unpack_i16.lo \
+am__objects_24 = in_unpack_i4.lo in_unpack_i8.lo in_unpack_i16.lo \
in_unpack_c4.lo in_unpack_c8.lo in_unpack_c10.lo \
in_unpack_c16.lo
-am__objects_26 = exponent_r4.lo exponent_r8.lo exponent_r10.lo \
+am__objects_25 = exponent_r4.lo exponent_r8.lo exponent_r10.lo \
exponent_r16.lo
-am__objects_27 = fraction_r4.lo fraction_r8.lo fraction_r10.lo \
+am__objects_26 = fraction_r4.lo fraction_r8.lo fraction_r10.lo \
fraction_r16.lo
-am__objects_28 = nearest_r4.lo nearest_r8.lo nearest_r10.lo \
+am__objects_27 = nearest_r4.lo nearest_r8.lo nearest_r10.lo \
nearest_r16.lo
-am__objects_29 = set_exponent_r4.lo set_exponent_r8.lo \
+am__objects_28 = set_exponent_r4.lo set_exponent_r8.lo \
set_exponent_r10.lo set_exponent_r16.lo
-am__objects_30 = pow_i4_i4.lo pow_i8_i4.lo pow_i16_i4.lo pow_r4_i4.lo \
+am__objects_29 = pow_i4_i4.lo pow_i8_i4.lo pow_i16_i4.lo pow_r4_i4.lo \
pow_r8_i4.lo pow_r10_i4.lo pow_r16_i4.lo pow_c4_i4.lo \
pow_c8_i4.lo pow_c10_i4.lo pow_c16_i4.lo pow_i4_i8.lo \
pow_i8_i8.lo pow_i16_i8.lo pow_r4_i8.lo pow_r8_i8.lo \
@@ -151,7 +148,7 @@ am__objects_30 = pow_i4_i4.lo pow_i8_i4.lo pow_i16_i4.lo pow_r4_i4.lo \
pow_i16_i16.lo pow_r4_i16.lo pow_r8_i16.lo pow_r10_i16.lo \
pow_r16_i16.lo pow_c4_i16.lo pow_c8_i16.lo pow_c10_i16.lo \
pow_c16_i16.lo
-am__objects_31 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \
+am__objects_30 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \
$(am__objects_5) $(am__objects_6) $(am__objects_7) \
$(am__objects_8) $(am__objects_9) $(am__objects_10) \
$(am__objects_11) $(am__objects_12) $(am__objects_13) \
@@ -160,11 +157,11 @@ am__objects_31 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \
$(am__objects_20) $(am__objects_21) $(am__objects_22) \
$(am__objects_23) $(am__objects_24) $(am__objects_25) \
$(am__objects_26) $(am__objects_27) $(am__objects_28) \
- $(am__objects_29) $(am__objects_30)
-am__objects_32 = close.lo file_pos.lo format.lo inquire.lo \
+ $(am__objects_29)
+am__objects_31 = close.lo file_pos.lo format.lo inquire.lo \
list_read.lo lock.lo open.lo read.lo size_from_kind.lo \
transfer.lo unit.lo unix.lo write.lo
-am__objects_33 = associated.lo abort.lo args.lo bessel.lo \
+am__objects_32 = associated.lo abort.lo args.lo bessel.lo \
c99_functions.lo chdir.lo cpu_time.lo cshift0.lo ctime.lo \
date_and_time.lo env.lo erf.lo eoshift0.lo eoshift2.lo \
etime.lo exit.lo fget.lo flush.lo fnum.lo ftell.lo gerror.lo \
@@ -177,8 +174,8 @@ am__objects_33 = associated.lo abort.lo args.lo bessel.lo \
system_clock.lo time.lo transpose_generic.lo tty.lo umask.lo \
unlink.lo unpack_generic.lo in_pack_generic.lo \
in_unpack_generic.lo normalize.lo
-am__objects_34 =
-am__objects_35 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \
+am__objects_33 =
+am__objects_34 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \
_abs_i4.lo _abs_i8.lo _abs_i16.lo _abs_r4.lo _abs_r8.lo \
_abs_r10.lo _abs_r16.lo _exp_r4.lo _exp_r8.lo _exp_r10.lo \
_exp_r16.lo _exp_c4.lo _exp_c8.lo _exp_c10.lo _exp_c16.lo \
@@ -198,20 +195,29 @@ am__objects_35 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \
_conjg_c4.lo _conjg_c8.lo _conjg_c10.lo _conjg_c16.lo \
_aint_r4.lo _aint_r8.lo _aint_r10.lo _aint_r16.lo _anint_r4.lo \
_anint_r8.lo _anint_r10.lo _anint_r16.lo
-am__objects_36 = _sign_i4.lo _sign_i8.lo _sign_i16.lo _sign_r4.lo \
+am__objects_35 = _sign_i4.lo _sign_i8.lo _sign_i16.lo _sign_r4.lo \
_sign_r8.lo _sign_r10.lo _sign_r16.lo _dim_i4.lo _dim_i8.lo \
_dim_i16.lo _dim_r4.lo _dim_r8.lo _dim_r10.lo _dim_r16.lo \
_atan2_r4.lo _atan2_r8.lo _atan2_r10.lo _atan2_r16.lo \
_mod_i4.lo _mod_i8.lo _mod_i16.lo _mod_r4.lo _mod_r8.lo
-am__objects_37 = $(am__objects_35) $(am__objects_36) dprod_r8.lo \
+am__objects_36 = $(am__objects_34) $(am__objects_35) dprod_r8.lo \
f2c_specifics.lo
-am_libgfortran_la_OBJECTS = $(am__objects_1) $(am__objects_31) \
- $(am__objects_32) $(am__objects_33) $(am__objects_34) \
- $(am__objects_37)
+am_libgfortran_la_OBJECTS = $(am__objects_1) $(am__objects_30) \
+ $(am__objects_31) $(am__objects_32) $(am__objects_33) \
+ $(am__objects_36)
libgfortran_la_OBJECTS = $(am_libgfortran_la_OBJECTS)
libgfortranbegin_la_LIBADD =
am_libgfortranbegin_la_OBJECTS = fmain.lo
libgfortranbegin_la_OBJECTS = $(am_libgfortranbegin_la_OBJECTS)
+libmatmul_la_LIBADD =
+am__objects_37 = libmatmul_la-matmul_i4.lo libmatmul_la-matmul_i8.lo \
+ libmatmul_la-matmul_i16.lo libmatmul_la-matmul_r4.lo \
+ libmatmul_la-matmul_r8.lo libmatmul_la-matmul_r10.lo \
+ libmatmul_la-matmul_r16.lo libmatmul_la-matmul_c4.lo \
+ libmatmul_la-matmul_c8.lo libmatmul_la-matmul_c10.lo \
+ libmatmul_la-matmul_c16.lo
+am_libmatmul_la_OBJECTS = $(am__objects_37)
+libmatmul_la_OBJECTS = $(am_libmatmul_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp =
am__depfiles_maybe =
@@ -233,9 +239,10 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
LTFCCOMPILE = $(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS)
-SOURCES = $(libgfortran_la_SOURCES) $(libgfortranbegin_la_SOURCES)
+SOURCES = $(libgfortran_la_SOURCES) $(libgfortranbegin_la_SOURCES) \
+ $(libmatmul_la_SOURCES)
DIST_SOURCES = $(libgfortran_la_SOURCES) \
- $(libgfortranbegin_la_SOURCES)
+ $(libgfortranbegin_la_SOURCES) $(libmatmul_la_SOURCES)
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
@@ -777,7 +784,7 @@ m4_files = m4/iparm.m4 m4/ifunction.m4 m4/iforeach.m4 m4/all.m4 \
gfor_built_src = $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
$(i_maxloc1_c) $(i_maxval_c) $(i_minloc0_c) $(i_minloc1_c) $(i_minval_c) \
$(i_product_c) $(i_sum_c) $(i_dotprod_c) $(i_dotprodl_c) $(i_dotprodc_c) \
- $(i_matmul_c) $(i_matmull_c) $(i_transpose_c) $(i_shape_c) $(i_eoshift1_c) \
+ $(i_matmull_c) $(i_transpose_c) $(i_shape_c) $(i_eoshift1_c) \
$(i_eoshift3_c) $(i_cshift1_c) $(i_reshape_c) $(in_pack_c) $(in_unpack_c) \
$(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \
$(i_pow_c) \
@@ -918,12 +925,16 @@ $(gfor_built_specific2_src) \
intrinsics/dprod_r8.f90 \
intrinsics/f2c_specifics.F90
+EXTRA_LTLIBRARIES = libmatmul.la
+libmatmul_la_SOURCES = $(i_matmul_c)
+libmatmul_la_CFLAGS = -ftree-vectorize $(AM_CFLAGS)
BUILT_SOURCES = $(gfor_built_src) $(gfor_built_specific_src) \
- $(gfor_built_specific2_src)
+ $(gfor_built_specific2_src) $(libmatmul_la_SOURCES)
libgfortran_la_SOURCES = $(gfor_src) $(gfor_built_src) $(gfor_io_src) \
$(gfor_helper_src) $(gfor_io_headers) $(gfor_specific_src)
+libgfortran_la_LIBADD = libmatmul.la
I_M4_DEPS = m4/iparm.m4
I_M4_DEPS0 = $(I_M4_DEPS) m4/iforeach.m4
I_M4_DEPS1 = $(I_M4_DEPS) m4/ifunction.m4
@@ -1014,6 +1025,8 @@ libgfortran.la: $(libgfortran_la_OBJECTS) $(libgfortran_la_DEPENDENCIES)
$(FCLINK) -rpath $(toolexeclibdir) $(libgfortran_la_LDFLAGS) $(libgfortran_la_OBJECTS) $(libgfortran_la_LIBADD) $(LIBS)
libgfortranbegin.la: $(libgfortranbegin_la_OBJECTS) $(libgfortranbegin_la_DEPENDENCIES)
$(LINK) -rpath $(toolexeclibdir) $(libgfortranbegin_la_LDFLAGS) $(libgfortranbegin_la_OBJECTS) $(libgfortranbegin_la_LIBADD) $(LIBS)
+libmatmul.la: $(libmatmul_la_OBJECTS) $(libmatmul_la_DEPENDENCIES)
+ $(LINK) $(libmatmul_la_LDFLAGS) $(libmatmul_la_OBJECTS) $(libmatmul_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -1873,39 +1886,6 @@ dotprod_c10.lo: generated/dotprod_c10.c
dotprod_c16.lo: generated/dotprod_c16.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_c16.lo `test -f 'generated/dotprod_c16.c' || echo '$(srcdir)/'`generated/dotprod_c16.c
-matmul_i4.lo: generated/matmul_i4.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_i4.lo `test -f 'generated/matmul_i4.c' || echo '$(srcdir)/'`generated/matmul_i4.c
-
-matmul_i8.lo: generated/matmul_i8.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_i8.lo `test -f 'generated/matmul_i8.c' || echo '$(srcdir)/'`generated/matmul_i8.c
-
-matmul_i16.lo: generated/matmul_i16.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_i16.lo `test -f 'generated/matmul_i16.c' || echo '$(srcdir)/'`generated/matmul_i16.c
-
-matmul_r4.lo: generated/matmul_r4.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_r4.lo `test -f 'generated/matmul_r4.c' || echo '$(srcdir)/'`generated/matmul_r4.c
-
-matmul_r8.lo: generated/matmul_r8.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_r8.lo `test -f 'generated/matmul_r8.c' || echo '$(srcdir)/'`generated/matmul_r8.c
-
-matmul_r10.lo: generated/matmul_r10.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_r10.lo `test -f 'generated/matmul_r10.c' || echo '$(srcdir)/'`generated/matmul_r10.c
-
-matmul_r16.lo: generated/matmul_r16.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_r16.lo `test -f 'generated/matmul_r16.c' || echo '$(srcdir)/'`generated/matmul_r16.c
-
-matmul_c4.lo: generated/matmul_c4.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_c4.lo `test -f 'generated/matmul_c4.c' || echo '$(srcdir)/'`generated/matmul_c4.c
-
-matmul_c8.lo: generated/matmul_c8.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_c8.lo `test -f 'generated/matmul_c8.c' || echo '$(srcdir)/'`generated/matmul_c8.c
-
-matmul_c10.lo: generated/matmul_c10.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_c10.lo `test -f 'generated/matmul_c10.c' || echo '$(srcdir)/'`generated/matmul_c10.c
-
-matmul_c16.lo: generated/matmul_c16.c
- $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_c16.lo `test -f 'generated/matmul_c16.c' || echo '$(srcdir)/'`generated/matmul_c16.c
-
matmul_l4.lo: generated/matmul_l4.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_l4.lo `test -f 'generated/matmul_l4.c' || echo '$(srcdir)/'`generated/matmul_l4.c
@@ -2392,6 +2372,39 @@ in_unpack_generic.lo: runtime/in_unpack_generic.c
normalize.lo: runtime/normalize.c
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o normalize.lo `test -f 'runtime/normalize.c' || echo '$(srcdir)/'`runtime/normalize.c
+libmatmul_la-matmul_i4.lo: generated/matmul_i4.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_i4.lo `test -f 'generated/matmul_i4.c' || echo '$(srcdir)/'`generated/matmul_i4.c
+
+libmatmul_la-matmul_i8.lo: generated/matmul_i8.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_i8.lo `test -f 'generated/matmul_i8.c' || echo '$(srcdir)/'`generated/matmul_i8.c
+
+libmatmul_la-matmul_i16.lo: generated/matmul_i16.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_i16.lo `test -f 'generated/matmul_i16.c' || echo '$(srcdir)/'`generated/matmul_i16.c
+
+libmatmul_la-matmul_r4.lo: generated/matmul_r4.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_r4.lo `test -f 'generated/matmul_r4.c' || echo '$(srcdir)/'`generated/matmul_r4.c
+
+libmatmul_la-matmul_r8.lo: generated/matmul_r8.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_r8.lo `test -f 'generated/matmul_r8.c' || echo '$(srcdir)/'`generated/matmul_r8.c
+
+libmatmul_la-matmul_r10.lo: generated/matmul_r10.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_r10.lo `test -f 'generated/matmul_r10.c' || echo '$(srcdir)/'`generated/matmul_r10.c
+
+libmatmul_la-matmul_r16.lo: generated/matmul_r16.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_r16.lo `test -f 'generated/matmul_r16.c' || echo '$(srcdir)/'`generated/matmul_r16.c
+
+libmatmul_la-matmul_c4.lo: generated/matmul_c4.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_c4.lo `test -f 'generated/matmul_c4.c' || echo '$(srcdir)/'`generated/matmul_c4.c
+
+libmatmul_la-matmul_c8.lo: generated/matmul_c8.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_c8.lo `test -f 'generated/matmul_c8.c' || echo '$(srcdir)/'`generated/matmul_c8.c
+
+libmatmul_la-matmul_c10.lo: generated/matmul_c10.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_c10.lo `test -f 'generated/matmul_c10.c' || echo '$(srcdir)/'`generated/matmul_c10.c
+
+libmatmul_la-matmul_c16.lo: generated/matmul_c16.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmatmul_la_CFLAGS) $(CFLAGS) -c -o libmatmul_la-matmul_c16.lo `test -f 'generated/matmul_c16.c' || echo '$(srcdir)/'`generated/matmul_c16.c
+
.f90.o:
$(FCCOMPILE) -c -o $@ $<
diff --git a/libgfortran/config/fpu-glibc.h b/libgfortran/config/fpu-glibc.h
index 389f9054a56..8b0801a96b6 100644
--- a/libgfortran/config/fpu-glibc.h
+++ b/libgfortran/config/fpu-glibc.h
@@ -39,7 +39,8 @@ Boston, MA 02110-1301, USA. */
void set_fpu (void)
{
- fedisableexcept (FE_ALL_EXCEPT);
+ if (FE_ALL_EXCEPT != 0)
+ fedisableexcept (FE_ALL_EXCEPT);
if (options.fpe & GFC_FPE_INVALID)
#ifdef FE_INVALID
diff --git a/libgfortran/configure b/libgfortran/configure
index d1978a81601..6799fa52772 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -969,7 +969,7 @@ esac
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
- cd "$ac_popdir"
+ cd $ac_popdir
done
fi
@@ -2601,7 +2601,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2659,7 +2660,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2775,7 +2777,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2829,7 +2832,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2874,7 +2878,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2918,7 +2923,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2961,7 +2967,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
if test "x$GCC" = "xyes"; then
- AM_FCFLAGS="-Wall -fno-repack-arrays -fno-underscoring"
+ AM_FCFLAGS="-I . -Wall -fno-repack-arrays -fno-underscoring"
## We like to use C99 routines when available. This makes sure that
## __STDC_VERSION__ is set such that libc includes make them available.
AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
@@ -4116,7 +4122,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4119 "configure"' > conftest.$ac_ext
+ echo '#line 4125 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -4263,7 +4269,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4505,7 +4512,7 @@ fi
# Provide some information about the compiler.
-echo "$as_me:4508:" \
+echo "$as_me:4515:" \
"checking for Fortran compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -4551,7 +4558,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_fc_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_fc_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4600,7 +4608,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_fc_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_fc_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4706,7 +4715,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4735,7 +4745,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4805,7 +4816,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4857,7 +4869,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4928,7 +4941,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4980,7 +4994,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5303,7 +5318,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5473,7 +5489,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5541,7 +5558,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5730,7 +5748,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5970,7 +5989,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6038,7 +6058,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6210,7 +6231,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6363,7 +6385,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6516,7 +6539,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6667,7 +6691,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6812,7 +6837,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6959,7 +6985,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7002,7 +7029,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7067,7 +7095,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7110,7 +7139,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7175,7 +7205,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7218,7 +7249,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7335,7 +7367,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7448,7 +7481,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7559,7 +7593,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7636,7 +7671,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7712,7 +7748,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7788,7 +7825,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7867,7 +7905,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7943,7 +7982,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8019,7 +8059,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8095,7 +8136,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8171,7 +8213,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8247,7 +8290,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8323,7 +8367,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8399,7 +8444,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8475,7 +8521,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8551,7 +8598,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8627,7 +8675,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8703,7 +8752,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8779,7 +8829,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8855,7 +8906,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8931,7 +8983,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9007,7 +9060,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9083,7 +9137,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9159,7 +9214,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9235,7 +9291,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9311,7 +9368,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9387,7 +9445,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9463,7 +9522,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9539,7 +9599,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9615,7 +9676,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9691,7 +9753,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9767,7 +9830,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9843,7 +9907,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9919,7 +9984,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9995,7 +10061,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10071,7 +10138,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10147,7 +10215,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10223,7 +10292,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10299,7 +10369,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10375,7 +10446,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10451,7 +10523,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10527,7 +10600,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10603,7 +10677,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10679,7 +10754,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10755,7 +10831,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10831,7 +10908,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10907,7 +10985,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10983,7 +11062,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11059,7 +11139,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11135,7 +11216,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11211,7 +11293,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11287,7 +11370,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11363,7 +11447,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11439,7 +11524,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11515,7 +11601,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11591,7 +11678,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11667,7 +11755,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11743,7 +11832,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11819,7 +11909,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11895,7 +11986,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -11971,7 +12063,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12047,7 +12140,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12123,7 +12217,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12199,7 +12294,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12275,7 +12371,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12351,7 +12448,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12427,7 +12525,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12503,7 +12602,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12579,7 +12679,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12655,7 +12756,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12731,7 +12833,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12807,7 +12910,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12883,7 +12987,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -12959,7 +13064,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13035,7 +13141,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13111,7 +13218,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13187,7 +13295,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13263,7 +13372,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13339,7 +13449,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13415,7 +13526,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13491,7 +13603,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13567,7 +13680,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13643,7 +13757,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13719,7 +13834,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13795,7 +13911,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13871,7 +13988,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -13947,7 +14065,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14023,7 +14142,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14099,7 +14219,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14175,7 +14296,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14251,7 +14373,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14327,7 +14450,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14403,7 +14527,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14479,7 +14604,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14555,7 +14681,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14631,7 +14758,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14707,7 +14835,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14783,7 +14912,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14859,7 +14989,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -14935,7 +15066,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15011,7 +15143,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15087,7 +15220,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15163,7 +15297,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15239,7 +15374,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15315,7 +15451,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15391,7 +15528,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15467,7 +15605,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15543,7 +15682,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15619,7 +15759,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15695,7 +15836,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15771,7 +15913,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15847,7 +15990,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15923,7 +16067,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -15999,7 +16144,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16075,7 +16221,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16151,7 +16298,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16227,7 +16375,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16303,7 +16452,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16379,7 +16529,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16455,7 +16606,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16531,7 +16683,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16607,7 +16760,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16683,7 +16837,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16759,7 +16914,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16835,7 +16991,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16911,7 +17068,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -16987,7 +17145,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17063,7 +17222,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17139,7 +17299,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17215,7 +17376,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17291,7 +17453,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17367,7 +17530,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17443,7 +17607,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17519,7 +17684,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17595,7 +17761,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17671,7 +17838,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17747,7 +17915,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17823,7 +17992,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17899,7 +18069,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -17975,7 +18146,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18051,7 +18223,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18127,7 +18300,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18203,7 +18377,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18279,7 +18454,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18355,7 +18531,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18431,7 +18608,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18507,7 +18685,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18583,7 +18762,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18659,7 +18839,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18735,7 +18916,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18811,7 +18993,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18887,7 +19070,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -18963,7 +19147,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -19041,7 +19226,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -19440,7 +19626,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -19518,7 +19705,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -19595,7 +19783,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -19700,7 +19889,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -19802,7 +19992,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -19880,7 +20071,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -19986,7 +20178,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -20048,7 +20241,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -20186,7 +20380,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -20264,7 +20459,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -20332,7 +20528,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -20396,7 +20593,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -20468,7 +20666,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -21765,6 +21964,11 @@ esac
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
@@ -21803,12 +22007,6 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
fi;;
esac
done` || { (exit 1); exit 1; }
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index ed64b0cfca9..7dc9298cfe6 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -111,7 +111,7 @@ m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
if test "x$GCC" = "xyes"; then
- AM_FCFLAGS="-Wall -fno-repack-arrays -fno-underscoring"
+ AM_FCFLAGS="-I . -Wall -fno-repack-arrays -fno-underscoring"
## We like to use C99 routines when available. This makes sure that
## __STDC_VERSION__ is set such that libc includes make them available.
AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c
index 801649aa29d..44e734f0863 100644
--- a/libgfortran/generated/matmul_c10.c
+++ b/libgfortran/generated/matmul_c10.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_c10 (gfc_array_c10 * retarray, gfc_array_c10 * a, gfc_array_c10 * b);
+extern void matmul_c10 (gfc_array_c10 * const restrict retarray,
+ gfc_array_c10 * const restrict a, gfc_array_c10 * const restrict b);
export_proto(matmul_c10);
void
-matmul_c10 (gfc_array_c10 * retarray, gfc_array_c10 * a, gfc_array_c10 * b)
+matmul_c10 (gfc_array_c10 * const restrict retarray,
+ gfc_array_c10 * const restrict a, gfc_array_c10 * const restrict b)
{
- GFC_COMPLEX_10 *abase;
- GFC_COMPLEX_10 *bbase;
- GFC_COMPLEX_10 *dest;
+ const GFC_COMPLEX_10 * restrict abase;
+ const GFC_COMPLEX_10 * restrict bbase;
+ GFC_COMPLEX_10 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_c10 (gfc_array_c10 * retarray, gfc_array_c10 * a, gfc_array_c10 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_c10 (gfc_array_c10 * retarray, gfc_array_c10 * a, gfc_array_c10 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_COMPLEX_10 *bbase_y;
- GFC_COMPLEX_10 *dest_y;
- GFC_COMPLEX_10 *abase_n;
+ const GFC_COMPLEX_10 * restrict bbase_y;
+ GFC_COMPLEX_10 * restrict dest_y;
+ const GFC_COMPLEX_10 * restrict abase_n;
GFC_COMPLEX_10 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c
index fb4870cba39..451ea82f6e8 100644
--- a/libgfortran/generated/matmul_c16.c
+++ b/libgfortran/generated/matmul_c16.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_c16 (gfc_array_c16 * retarray, gfc_array_c16 * a, gfc_array_c16 * b);
+extern void matmul_c16 (gfc_array_c16 * const restrict retarray,
+ gfc_array_c16 * const restrict a, gfc_array_c16 * const restrict b);
export_proto(matmul_c16);
void
-matmul_c16 (gfc_array_c16 * retarray, gfc_array_c16 * a, gfc_array_c16 * b)
+matmul_c16 (gfc_array_c16 * const restrict retarray,
+ gfc_array_c16 * const restrict a, gfc_array_c16 * const restrict b)
{
- GFC_COMPLEX_16 *abase;
- GFC_COMPLEX_16 *bbase;
- GFC_COMPLEX_16 *dest;
+ const GFC_COMPLEX_16 * restrict abase;
+ const GFC_COMPLEX_16 * restrict bbase;
+ GFC_COMPLEX_16 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_c16 (gfc_array_c16 * retarray, gfc_array_c16 * a, gfc_array_c16 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_c16 (gfc_array_c16 * retarray, gfc_array_c16 * a, gfc_array_c16 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_COMPLEX_16 *bbase_y;
- GFC_COMPLEX_16 *dest_y;
- GFC_COMPLEX_16 *abase_n;
+ const GFC_COMPLEX_16 * restrict bbase_y;
+ GFC_COMPLEX_16 * restrict dest_y;
+ const GFC_COMPLEX_16 * restrict abase_n;
GFC_COMPLEX_16 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c
index 8c9a7104ca8..5e59f1dafdc 100644
--- a/libgfortran/generated/matmul_c4.c
+++ b/libgfortran/generated/matmul_c4.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_c4 (gfc_array_c4 * retarray, gfc_array_c4 * a, gfc_array_c4 * b);
+extern void matmul_c4 (gfc_array_c4 * const restrict retarray,
+ gfc_array_c4 * const restrict a, gfc_array_c4 * const restrict b);
export_proto(matmul_c4);
void
-matmul_c4 (gfc_array_c4 * retarray, gfc_array_c4 * a, gfc_array_c4 * b)
+matmul_c4 (gfc_array_c4 * const restrict retarray,
+ gfc_array_c4 * const restrict a, gfc_array_c4 * const restrict b)
{
- GFC_COMPLEX_4 *abase;
- GFC_COMPLEX_4 *bbase;
- GFC_COMPLEX_4 *dest;
+ const GFC_COMPLEX_4 * restrict abase;
+ const GFC_COMPLEX_4 * restrict bbase;
+ GFC_COMPLEX_4 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_c4 (gfc_array_c4 * retarray, gfc_array_c4 * a, gfc_array_c4 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_c4 (gfc_array_c4 * retarray, gfc_array_c4 * a, gfc_array_c4 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_COMPLEX_4 *bbase_y;
- GFC_COMPLEX_4 *dest_y;
- GFC_COMPLEX_4 *abase_n;
+ const GFC_COMPLEX_4 * restrict bbase_y;
+ GFC_COMPLEX_4 * restrict dest_y;
+ const GFC_COMPLEX_4 * restrict abase_n;
GFC_COMPLEX_4 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c
index 7b713f1343a..cdf10e20461 100644
--- a/libgfortran/generated/matmul_c8.c
+++ b/libgfortran/generated/matmul_c8.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_c8 (gfc_array_c8 * retarray, gfc_array_c8 * a, gfc_array_c8 * b);
+extern void matmul_c8 (gfc_array_c8 * const restrict retarray,
+ gfc_array_c8 * const restrict a, gfc_array_c8 * const restrict b);
export_proto(matmul_c8);
void
-matmul_c8 (gfc_array_c8 * retarray, gfc_array_c8 * a, gfc_array_c8 * b)
+matmul_c8 (gfc_array_c8 * const restrict retarray,
+ gfc_array_c8 * const restrict a, gfc_array_c8 * const restrict b)
{
- GFC_COMPLEX_8 *abase;
- GFC_COMPLEX_8 *bbase;
- GFC_COMPLEX_8 *dest;
+ const GFC_COMPLEX_8 * restrict abase;
+ const GFC_COMPLEX_8 * restrict bbase;
+ GFC_COMPLEX_8 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_c8 (gfc_array_c8 * retarray, gfc_array_c8 * a, gfc_array_c8 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_c8 (gfc_array_c8 * retarray, gfc_array_c8 * a, gfc_array_c8 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_COMPLEX_8 *bbase_y;
- GFC_COMPLEX_8 *dest_y;
- GFC_COMPLEX_8 *abase_n;
+ const GFC_COMPLEX_8 * restrict bbase_y;
+ GFC_COMPLEX_8 * restrict dest_y;
+ const GFC_COMPLEX_8 * restrict abase_n;
GFC_COMPLEX_8 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c
index adbfbedaeb2..a5a40b487f9 100644
--- a/libgfortran/generated/matmul_i16.c
+++ b/libgfortran/generated/matmul_i16.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_i16 (gfc_array_i16 * retarray, gfc_array_i16 * a, gfc_array_i16 * b);
+extern void matmul_i16 (gfc_array_i16 * const restrict retarray,
+ gfc_array_i16 * const restrict a, gfc_array_i16 * const restrict b);
export_proto(matmul_i16);
void
-matmul_i16 (gfc_array_i16 * retarray, gfc_array_i16 * a, gfc_array_i16 * b)
+matmul_i16 (gfc_array_i16 * const restrict retarray,
+ gfc_array_i16 * const restrict a, gfc_array_i16 * const restrict b)
{
- GFC_INTEGER_16 *abase;
- GFC_INTEGER_16 *bbase;
- GFC_INTEGER_16 *dest;
+ const GFC_INTEGER_16 * restrict abase;
+ const GFC_INTEGER_16 * restrict bbase;
+ GFC_INTEGER_16 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_i16 (gfc_array_i16 * retarray, gfc_array_i16 * a, gfc_array_i16 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_i16 (gfc_array_i16 * retarray, gfc_array_i16 * a, gfc_array_i16 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_INTEGER_16 *bbase_y;
- GFC_INTEGER_16 *dest_y;
- GFC_INTEGER_16 *abase_n;
+ const GFC_INTEGER_16 * restrict bbase_y;
+ GFC_INTEGER_16 * restrict dest_y;
+ const GFC_INTEGER_16 * restrict abase_n;
GFC_INTEGER_16 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c
index abace324d95..dca23987e71 100644
--- a/libgfortran/generated/matmul_i4.c
+++ b/libgfortran/generated/matmul_i4.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_i4 (gfc_array_i4 * retarray, gfc_array_i4 * a, gfc_array_i4 * b);
+extern void matmul_i4 (gfc_array_i4 * const restrict retarray,
+ gfc_array_i4 * const restrict a, gfc_array_i4 * const restrict b);
export_proto(matmul_i4);
void
-matmul_i4 (gfc_array_i4 * retarray, gfc_array_i4 * a, gfc_array_i4 * b)
+matmul_i4 (gfc_array_i4 * const restrict retarray,
+ gfc_array_i4 * const restrict a, gfc_array_i4 * const restrict b)
{
- GFC_INTEGER_4 *abase;
- GFC_INTEGER_4 *bbase;
- GFC_INTEGER_4 *dest;
+ const GFC_INTEGER_4 * restrict abase;
+ const GFC_INTEGER_4 * restrict bbase;
+ GFC_INTEGER_4 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_i4 (gfc_array_i4 * retarray, gfc_array_i4 * a, gfc_array_i4 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_i4 (gfc_array_i4 * retarray, gfc_array_i4 * a, gfc_array_i4 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_INTEGER_4 *bbase_y;
- GFC_INTEGER_4 *dest_y;
- GFC_INTEGER_4 *abase_n;
+ const GFC_INTEGER_4 * restrict bbase_y;
+ GFC_INTEGER_4 * restrict dest_y;
+ const GFC_INTEGER_4 * restrict abase_n;
GFC_INTEGER_4 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c
index 9820e405cd0..ceadbe3c801 100644
--- a/libgfortran/generated/matmul_i8.c
+++ b/libgfortran/generated/matmul_i8.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_i8 (gfc_array_i8 * retarray, gfc_array_i8 * a, gfc_array_i8 * b);
+extern void matmul_i8 (gfc_array_i8 * const restrict retarray,
+ gfc_array_i8 * const restrict a, gfc_array_i8 * const restrict b);
export_proto(matmul_i8);
void
-matmul_i8 (gfc_array_i8 * retarray, gfc_array_i8 * a, gfc_array_i8 * b)
+matmul_i8 (gfc_array_i8 * const restrict retarray,
+ gfc_array_i8 * const restrict a, gfc_array_i8 * const restrict b)
{
- GFC_INTEGER_8 *abase;
- GFC_INTEGER_8 *bbase;
- GFC_INTEGER_8 *dest;
+ const GFC_INTEGER_8 * restrict abase;
+ const GFC_INTEGER_8 * restrict bbase;
+ GFC_INTEGER_8 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_i8 (gfc_array_i8 * retarray, gfc_array_i8 * a, gfc_array_i8 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_i8 (gfc_array_i8 * retarray, gfc_array_i8 * a, gfc_array_i8 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_INTEGER_8 *bbase_y;
- GFC_INTEGER_8 *dest_y;
- GFC_INTEGER_8 *abase_n;
+ const GFC_INTEGER_8 * restrict bbase_y;
+ GFC_INTEGER_8 * restrict dest_y;
+ const GFC_INTEGER_8 * restrict abase_n;
GFC_INTEGER_8 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_l16.c b/libgfortran/generated/matmul_l16.c
index 28dce3a2422..caa1b11910e 100644
--- a/libgfortran/generated/matmul_l16.c
+++ b/libgfortran/generated/matmul_l16.c
@@ -38,15 +38,17 @@ Boston, MA 02110-1301, USA. */
/* Dimensions: retarray(x,y) a(x, count) b(count,y).
Either a or b can be rank 1. In this case x or y is 1. */
-extern void matmul_l16 (gfc_array_l16 *, gfc_array_l4 *, gfc_array_l4 *);
+extern void matmul_l16 (gfc_array_l16 * const restrict,
+ gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
export_proto(matmul_l16);
void
-matmul_l16 (gfc_array_l16 * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
+matmul_l16 (gfc_array_l16 * const restrict retarray,
+ gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
{
- GFC_INTEGER_4 *abase;
- GFC_INTEGER_4 *bbase;
- GFC_LOGICAL_16 *dest;
+ const GFC_INTEGER_4 * restrict abase;
+ const GFC_INTEGER_4 * restrict bbase;
+ GFC_LOGICAL_16 * restrict dest;
index_type rxstride;
index_type rystride;
index_type xcount;
@@ -56,8 +58,8 @@ matmul_l16 (gfc_array_l16 * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
index_type x;
index_type y;
- GFC_INTEGER_4 *pa;
- GFC_INTEGER_4 *pb;
+ const GFC_INTEGER_4 * restrict pa;
+ const GFC_INTEGER_4 * restrict pb;
index_type astride;
index_type bstride;
index_type count;
diff --git a/libgfortran/generated/matmul_l4.c b/libgfortran/generated/matmul_l4.c
index da6681479a5..9a89113bbc6 100644
--- a/libgfortran/generated/matmul_l4.c
+++ b/libgfortran/generated/matmul_l4.c
@@ -38,15 +38,17 @@ Boston, MA 02110-1301, USA. */
/* Dimensions: retarray(x,y) a(x, count) b(count,y).
Either a or b can be rank 1. In this case x or y is 1. */
-extern void matmul_l4 (gfc_array_l4 *, gfc_array_l4 *, gfc_array_l4 *);
+extern void matmul_l4 (gfc_array_l4 * const restrict,
+ gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
export_proto(matmul_l4);
void
-matmul_l4 (gfc_array_l4 * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
+matmul_l4 (gfc_array_l4 * const restrict retarray,
+ gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
{
- GFC_INTEGER_4 *abase;
- GFC_INTEGER_4 *bbase;
- GFC_LOGICAL_4 *dest;
+ const GFC_INTEGER_4 * restrict abase;
+ const GFC_INTEGER_4 * restrict bbase;
+ GFC_LOGICAL_4 * restrict dest;
index_type rxstride;
index_type rystride;
index_type xcount;
@@ -56,8 +58,8 @@ matmul_l4 (gfc_array_l4 * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
index_type x;
index_type y;
- GFC_INTEGER_4 *pa;
- GFC_INTEGER_4 *pb;
+ const GFC_INTEGER_4 * restrict pa;
+ const GFC_INTEGER_4 * restrict pb;
index_type astride;
index_type bstride;
index_type count;
diff --git a/libgfortran/generated/matmul_l8.c b/libgfortran/generated/matmul_l8.c
index 22c1a660941..bd01f1642d3 100644
--- a/libgfortran/generated/matmul_l8.c
+++ b/libgfortran/generated/matmul_l8.c
@@ -38,15 +38,17 @@ Boston, MA 02110-1301, USA. */
/* Dimensions: retarray(x,y) a(x, count) b(count,y).
Either a or b can be rank 1. In this case x or y is 1. */
-extern void matmul_l8 (gfc_array_l8 *, gfc_array_l4 *, gfc_array_l4 *);
+extern void matmul_l8 (gfc_array_l8 * const restrict,
+ gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
export_proto(matmul_l8);
void
-matmul_l8 (gfc_array_l8 * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
+matmul_l8 (gfc_array_l8 * const restrict retarray,
+ gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
{
- GFC_INTEGER_4 *abase;
- GFC_INTEGER_4 *bbase;
- GFC_LOGICAL_8 *dest;
+ const GFC_INTEGER_4 * restrict abase;
+ const GFC_INTEGER_4 * restrict bbase;
+ GFC_LOGICAL_8 * restrict dest;
index_type rxstride;
index_type rystride;
index_type xcount;
@@ -56,8 +58,8 @@ matmul_l8 (gfc_array_l8 * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
index_type x;
index_type y;
- GFC_INTEGER_4 *pa;
- GFC_INTEGER_4 *pb;
+ const GFC_INTEGER_4 * restrict pa;
+ const GFC_INTEGER_4 * restrict pb;
index_type astride;
index_type bstride;
index_type count;
diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c
index 8aa342da2f4..b0ebbeda6c4 100644
--- a/libgfortran/generated/matmul_r10.c
+++ b/libgfortran/generated/matmul_r10.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_r10 (gfc_array_r10 * retarray, gfc_array_r10 * a, gfc_array_r10 * b);
+extern void matmul_r10 (gfc_array_r10 * const restrict retarray,
+ gfc_array_r10 * const restrict a, gfc_array_r10 * const restrict b);
export_proto(matmul_r10);
void
-matmul_r10 (gfc_array_r10 * retarray, gfc_array_r10 * a, gfc_array_r10 * b)
+matmul_r10 (gfc_array_r10 * const restrict retarray,
+ gfc_array_r10 * const restrict a, gfc_array_r10 * const restrict b)
{
- GFC_REAL_10 *abase;
- GFC_REAL_10 *bbase;
- GFC_REAL_10 *dest;
+ const GFC_REAL_10 * restrict abase;
+ const GFC_REAL_10 * restrict bbase;
+ GFC_REAL_10 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_r10 (gfc_array_r10 * retarray, gfc_array_r10 * a, gfc_array_r10 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_r10 (gfc_array_r10 * retarray, gfc_array_r10 * a, gfc_array_r10 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_REAL_10 *bbase_y;
- GFC_REAL_10 *dest_y;
- GFC_REAL_10 *abase_n;
+ const GFC_REAL_10 * restrict bbase_y;
+ GFC_REAL_10 * restrict dest_y;
+ const GFC_REAL_10 * restrict abase_n;
GFC_REAL_10 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c
index 549f39ea6ca..313f8d2d6d8 100644
--- a/libgfortran/generated/matmul_r16.c
+++ b/libgfortran/generated/matmul_r16.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_r16 (gfc_array_r16 * retarray, gfc_array_r16 * a, gfc_array_r16 * b);
+extern void matmul_r16 (gfc_array_r16 * const restrict retarray,
+ gfc_array_r16 * const restrict a, gfc_array_r16 * const restrict b);
export_proto(matmul_r16);
void
-matmul_r16 (gfc_array_r16 * retarray, gfc_array_r16 * a, gfc_array_r16 * b)
+matmul_r16 (gfc_array_r16 * const restrict retarray,
+ gfc_array_r16 * const restrict a, gfc_array_r16 * const restrict b)
{
- GFC_REAL_16 *abase;
- GFC_REAL_16 *bbase;
- GFC_REAL_16 *dest;
+ const GFC_REAL_16 * restrict abase;
+ const GFC_REAL_16 * restrict bbase;
+ GFC_REAL_16 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_r16 (gfc_array_r16 * retarray, gfc_array_r16 * a, gfc_array_r16 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_r16 (gfc_array_r16 * retarray, gfc_array_r16 * a, gfc_array_r16 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_REAL_16 *bbase_y;
- GFC_REAL_16 *dest_y;
- GFC_REAL_16 *abase_n;
+ const GFC_REAL_16 * restrict bbase_y;
+ GFC_REAL_16 * restrict dest_y;
+ const GFC_REAL_16 * restrict abase_n;
GFC_REAL_16 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c
index b1d3eb77c9d..74a4e1c23b9 100644
--- a/libgfortran/generated/matmul_r4.c
+++ b/libgfortran/generated/matmul_r4.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_r4 (gfc_array_r4 * retarray, gfc_array_r4 * a, gfc_array_r4 * b);
+extern void matmul_r4 (gfc_array_r4 * const restrict retarray,
+ gfc_array_r4 * const restrict a, gfc_array_r4 * const restrict b);
export_proto(matmul_r4);
void
-matmul_r4 (gfc_array_r4 * retarray, gfc_array_r4 * a, gfc_array_r4 * b)
+matmul_r4 (gfc_array_r4 * const restrict retarray,
+ gfc_array_r4 * const restrict a, gfc_array_r4 * const restrict b)
{
- GFC_REAL_4 *abase;
- GFC_REAL_4 *bbase;
- GFC_REAL_4 *dest;
+ const GFC_REAL_4 * restrict abase;
+ const GFC_REAL_4 * restrict bbase;
+ GFC_REAL_4 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_r4 (gfc_array_r4 * retarray, gfc_array_r4 * a, gfc_array_r4 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_r4 (gfc_array_r4 * retarray, gfc_array_r4 * a, gfc_array_r4 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_REAL_4 *bbase_y;
- GFC_REAL_4 *dest_y;
- GFC_REAL_4 *abase_n;
+ const GFC_REAL_4 * restrict bbase_y;
+ GFC_REAL_4 * restrict dest_y;
+ const GFC_REAL_4 * restrict abase_n;
GFC_REAL_4 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c
index df9fc3e6a0e..72560f111d4 100644
--- a/libgfortran/generated/matmul_r8.c
+++ b/libgfortran/generated/matmul_r8.c
@@ -48,15 +48,17 @@ Boston, MA 02110-1301, USA. */
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_r8 (gfc_array_r8 * retarray, gfc_array_r8 * a, gfc_array_r8 * b);
+extern void matmul_r8 (gfc_array_r8 * const restrict retarray,
+ gfc_array_r8 * const restrict a, gfc_array_r8 * const restrict b);
export_proto(matmul_r8);
void
-matmul_r8 (gfc_array_r8 * retarray, gfc_array_r8 * a, gfc_array_r8 * b)
+matmul_r8 (gfc_array_r8 * const restrict retarray,
+ gfc_array_r8 * const restrict a, gfc_array_r8 * const restrict b)
{
- GFC_REAL_8 *abase;
- GFC_REAL_8 *bbase;
- GFC_REAL_8 *dest;
+ const GFC_REAL_8 * restrict abase;
+ const GFC_REAL_8 * restrict bbase;
+ GFC_REAL_8 * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -105,12 +107,10 @@ matmul_r8 (gfc_array_r8 * retarray, gfc_array_r8 * a, gfc_array_r8 * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -175,9 +175,9 @@ matmul_r8 (gfc_array_r8 * retarray, gfc_array_r8 * a, gfc_array_r8 * b)
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- GFC_REAL_8 *bbase_y;
- GFC_REAL_8 *dest_y;
- GFC_REAL_8 *abase_n;
+ const GFC_REAL_8 * restrict bbase_y;
+ GFC_REAL_8 * restrict dest_y;
+ const GFC_REAL_8 * restrict abase_n;
GFC_REAL_8 bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index 1800986a4a1..f080c4607ad 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -160,7 +160,7 @@ namelist_info;
/* Options for the OPEN statement. */
typedef enum
-{ ACCESS_SEQUENTIAL, ACCESS_DIRECT,
+{ ACCESS_SEQUENTIAL, ACCESS_DIRECT, ACCESS_APPEND,
ACCESS_UNSPECIFIED
}
unit_access;
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index 9d817a98305..228c0d2772a 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -39,6 +39,7 @@ Boston, MA 02110-1301, USA. */
static const st_option access_opt[] = {
{"sequential", ACCESS_SEQUENTIAL},
{"direct", ACCESS_DIRECT},
+ {"append", ACCESS_APPEND},
{NULL, 0}
};
@@ -538,6 +539,20 @@ st_open (st_parameter_open *opp)
generate_error (&opp->common, ERROR_BAD_OPTION,
"Cannot use POSITION with direct access files");
+ if (flags.access == ACCESS_APPEND)
+ {
+ if (flags.position != POSITION_UNSPECIFIED
+ && flags.position != POSITION_APPEND)
+ generate_error (&opp->common, ERROR_BAD_OPTION,
+ "Conflicting ACCESS and POSITION "
+ "flags in OPEN statement");
+
+ notify_std (GFC_STD_GNU,
+ "Extension: APPEND as a value for ACCESS in OPEN statement");
+ flags.access = ACCESS_SEQUENTIAL;
+ flags.position = POSITION_APPEND;
+ }
+
if (flags.position == POSITION_UNSPECIFIED)
flags.position = POSITION_ASIS;
diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4
index aca2da06bab..730e4d78fd3 100644
--- a/libgfortran/m4/matmul.m4
+++ b/libgfortran/m4/matmul.m4
@@ -49,15 +49,17 @@ include(iparm.m4)dnl
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_`'rtype_code (rtype * retarray, rtype * a, rtype * b);
+extern void matmul_`'rtype_code (rtype * const restrict retarray,
+ rtype * const restrict a, rtype * const restrict b);
export_proto(matmul_`'rtype_code);
void
-matmul_`'rtype_code (rtype * retarray, rtype * a, rtype * b)
+matmul_`'rtype_code (rtype * const restrict retarray,
+ rtype * const restrict a, rtype * const restrict b)
{
- rtype_name *abase;
- rtype_name *bbase;
- rtype_name *dest;
+ const rtype_name * restrict abase;
+ const rtype_name * restrict bbase;
+ rtype_name * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -106,12 +108,10 @@ matmul_`'rtype_code (rtype * retarray, rtype * a, rtype * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -177,9 +177,9 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- rtype_name *bbase_y;
- rtype_name *dest_y;
- rtype_name *abase_n;
+ const rtype_name * restrict bbase_y;
+ rtype_name * restrict dest_y;
+ const rtype_name * restrict abase_n;
rtype_name bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4
index 9632a6ab76d..5acb4cb06cd 100644
--- a/libgfortran/m4/matmull.m4
+++ b/libgfortran/m4/matmull.m4
@@ -39,15 +39,17 @@ include(iparm.m4)dnl
/* Dimensions: retarray(x,y) a(x, count) b(count,y).
Either a or b can be rank 1. In this case x or y is 1. */
-extern void matmul_`'rtype_code (rtype *, gfc_array_l4 *, gfc_array_l4 *);
+extern void matmul_`'rtype_code (rtype * const restrict,
+ gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
export_proto(matmul_`'rtype_code);
void
-matmul_`'rtype_code (rtype * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
+matmul_`'rtype_code (rtype * const restrict retarray,
+ gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
{
- GFC_INTEGER_4 *abase;
- GFC_INTEGER_4 *bbase;
- rtype_name *dest;
+ const GFC_INTEGER_4 * restrict abase;
+ const GFC_INTEGER_4 * restrict bbase;
+ rtype_name * restrict dest;
index_type rxstride;
index_type rystride;
index_type xcount;
@@ -57,8 +59,8 @@ matmul_`'rtype_code (rtype * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
index_type x;
index_type y;
- GFC_INTEGER_4 *pa;
- GFC_INTEGER_4 *pb;
+ const GFC_INTEGER_4 * restrict pa;
+ const GFC_INTEGER_4 * restrict pb;
index_type astride;
index_type bstride;
index_type count;
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index ff104084c23..9219f19c734 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,259 @@
+2005-11-17 Mark Wielaard <mark@klomp.org>
+
+ Imported GNU Classpath gcj-import-20051117.
+ * gnu/java/net/protocol/file/Connection.java: Removed, fully merged.
+ * sources.am: Regenerated.
+ * Makefile.in: Likewise.
+
+2005-11-17 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/net/protocol/file/Handler.java: Removed, fully merged now.
+ * java/net/ServerSocket.java: Likewise.
+ * sources.am: Regenerated.
+ * Makefile.in: Regenerated.
+
+2005-11-17 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #24006
+ * java/net/ServerSocket.java (implAccept): Set Socket.bound to true.
+
+2005-11-17 Tom Tromey <tromey@redhat.com>
+
+ * java/net/ServerSocket.java (accept): Use correct security manager
+ call.
+
+2005-11-17 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/net/ServerSocket.java
+ (bound): Removed.
+ (local): New field.
+ (bind): Cache local socket address.
+ (getInetAddress, getLocalPort, getLocalSocketAddress, isBound):
+ Use cached local socket address.
+ (close): bound field was removed.
+
+2005-11-17 Tom Tromey <tromey@redhat.com>
+
+ * java/net/URLConnection.java (setDoInput): Javadoc fix.
+ (setDoOutput): Likewise.
+ (setContentHandlerFactory): Likewise.
+ (setFileNameMap): Likewise.
+
+2005-11-17 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URLClassloader.java (addURLs): Add comment about jboss.
+
+2005-11-17 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URLClassLoader.java (addURLs): Don't call addURL(), but
+ call urls.add() and addURLImpl() directly on each URL.
+
+2005-11-17 Tom Tromey <tromey@redhat.com>
+
+ * java/net/URLClassLoader.java (definePackage): Javadoc fixes.
+
+2005-11-17 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/net/URLClassLoader.java
+ (Resource.name): Removed field.
+ (JarURLResource.name): Added field.
+ (FileResource.getURL): Use File.toURL() instead of doing it in
+ a way that breaks on Windows.
+
+2005-11-17 Roman Kennke <roman@kennke.org>
+
+ Reported by: Ingo Proetel <proetel@aicas.com>
+ * java/net/URLClassLoader.java
+ (findClass): Added null check to avoid NullPointerException.
+
+2005-11-17 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/net/URLClassLoader.java: reordered some API doc comments to
+ suppress Eclipse warnings, and fixed API doc link.
+
+2005-11-17 Tom Tromey <tromey@redhat.com>
+
+ * java/net/URLClassLoader.java (URLClassLoader): Removed
+ unused constructor.
+
+2005-11-17 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/net/URLClassLoader (findClass): Close InputStream after we're
+ done with it.
+
+2005-11-17 Bryce McKinlay <mckinlay@redhat.com>
+
+ Implement -Xss.
+ * include/jvm.h (gcj::stack_size): Declare.
+ (_Jv_StackSize): Declare.
+ * posix-threads.cc (_Jv_InitThreads): Validate gcj::stack_size.
+ (_Jv_ThreadStart): Set stack size if specified.
+ * prims.cc (gcj::stack_size): Define.
+ (parse_memory_size): Renamed from parse_heap_size.
+ (_Jv_SetStackSize): Parse stack size argument and set
+ gcj::stack_size.
+
+2005-11-17 Mark Wielaard <mark@klomp.org>
+
+ * java/text/SimpleDateFormat.java: Removed, fully merged now.
+ * sources.am: Regenerated.
+ * Makefile.in: Regenerated.
+
+2005-11-17 Sven de Marothy <sven@physto.se>
+
+ * java/text/SimpleDateFormat.java
+ (computeOffset): Allow timezone to be first in the parsed String.
+
+2005-11-17 Mark Wielaard <mark@klomp.org>
+
+ * java/text/SimpleDateFormat.java (field, size): Make package private.
+
+2005-11-17 Tom Tromey <tromey@redhat.com>
+
+ * java/text/SimpleDateFormat.java (compileFormat): Correctly
+ handle quoted single quotes. PR classspath/23183.
+
+2005-11-17 Tom Tromey <tromey@redhat.com>
+
+ * java/text/SimpleDateFormat.java (compileFormat): Reformatted.
+
+2005-11-17 Tom Tromey <tromey@redhat.com>
+
+ * java/text/DateFormat.java (serialVersionUID): New field.
+
+2005-11-17 Mark Wielaard <mark@klomp.org>
+
+ * java/text/DateFormat.java (equals): Reimplement.
+
+2005-11-17 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/Collator.java: API doc fixes,
+ * java/text/DateFormat.java: likewise,
+ * java/text/DecimalFormatSymbols.java: likewise,
+ * java/text/DateFormatSymbols.java: likewise,
+ * java/text/SimpleDateFormat.java: likewise.
+
+2005-11-17 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/text/Collator.java (getInstance(Locale)):
+ Added default collation pattern to handle case when resource
+ is missing and throw InternalError instead of returning null
+ should parsing fail.
+
+2005-11-15 Mark Wielaard <mark@klomp.org>
+
+ * java/util/zip/ZipEntry.java: Removed, fully merged now.
+ * java/util/zip/ZipFile.java: Likewise.
+ * sources.am: Regenerated.
+ * Makefile.in: Regenerated.
+
+2005-11-15 Tom Tromey <tromey@redhat.com>
+
+ classpath/23890:
+ * java/util/Calendar.java (equals): Include other calendar
+ attributes.
+ (hashCode): Updated.
+ * java/util/GregorianCalendar.java (hashCode): New method.
+ (equals): Use super.equals().
+
+2005-11-15 Sven de Marothy <sven@physto.se>
+
+ * java/util/Calendar (setTimeInMillis): Recompute time fields.
+
+2005-11-15 Mark Wielaard <mark@klomp.org>
+
+ * java/util/SimpleTimeZone.java: Removed, fully merged now.
+ * java/util/Date.java: Likewise.
+ * sources.am: Regenerated.
+ * Makefile.in: Regenerated.
+
+2005-11-15 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/util/Calendar.java: fixed minor problems in API docs,
+ * java/util/Date.java: likewise,
+ * java/util/ResourceBundle.java: likewise,
+ * java/util/SimpleTimeZone.java: likewise,
+
+2005-11-15 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java
+ (parseContent): Removed bogus println and fixed bug #24422.
+
+2005-11-15 Mark Wielaard <mark@klomp.org>
+
+ * java/io/ObjectStreamClass.java: Removed, fully merged now.
+ * sources.am: Regenerated.
+ * Makefile.in: Regenerated.
+
+2005-11-15 Wolfgang Baer <WBaer@gmx.de>
+
+ * java/io/ObjectInputStream.java
+ (processResolution): Pass Error, RuntimeException and
+ ObjectStreamException through to the caller.
+ (readObject): Documentation update.
+
+2005-11-15 Mark Wielaard <mark@klomp.org>
+
+ Imported GNU Classpath 0.19 + gcj-import-20051115.
+ * sources.am: Regenerated.
+ * Makefile.in: Likewise.
+ * scripts/makemake.tcl: Use glob -nocomplain.
+
+2005-11-15 Scott Gilbertson <scottg@mantatest.com>
+
+ * Makefile.in: Re-generated.
+ * gnu/awt/xlib/XGraphicsDevice.java: New file.
+ * gnu/awt/xlib/XToolkit.java
+ (getLocalGraphicsEnvironment): Implemented.
+ * gnu/awt/xlib/XGraphicsEnvironment.java: New file.
+ * sources.am: Re-generated.
+
+2005-15-09 David Daney <ddaney@avtrex.com>
+
+ PR libgcj/15430
+ * gnu/java/net/natPlainSocketImplPosix.cc (throw_on_sock_closed): New
+ function.
+ (accept): Call it.
+ (close): Call shutdown before closing.
+ (read()): Call read_helper with proper parameters.
+ (read(buffer, int, int)): Likewise.
+ (read_helper): Pass pointer to the PlainSocketImpl, remove native_fd
+ and timeout parameters. Make prototype to match. Use
+ pointer to PlainSocketImpl to access members. Call throw_on_sock_closed
+ in two places.
+
+2005-11-15 Andrew Haley <aph@redhat.com>
+
+ * Merge from Classpath head:
+
+ 2005-09-16 Andrew Haley <aph@redhat.com>
+
+ * java/io/ObjectStreamClass.java (findAccessibleMethod): Allow
+ protected readResolve(). Rewrite accessibility check.
+
+ 2005-07-07 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectStreamClass.java
+ (findAccessibleMethod): Added code to make method accessible.
+
+ 2005-07-03 Daniel Bonniot <bonniot@users.sf.net>
+
+ * java/io/ObjectStreamClass.java (inSamePackage): New private method.
+ (findAccessibleMethod): Likewise.
+ (cacheMethods): Lookup readResolve and writeReplace using the new
+ findAccessibleMethod().
+
+2005-11-14 Mohan Embar <gnustuff@thisiscool.com>
+
+ * java/net/natVMNetworkInterfaceWin32.cc: Include
+ java/net/VMNetworkInterface.h.
+
+2005-11-14 Mohan Embar <gnustuff@thisiscool.com>
+ David Daney <ddaney@avtrex.com>
+
+ * gnu/java/net/natPlainSocketImplWin32.cc: Updated copyright.
+ (read): Handle count == 0 case.
+
2005-11-09 Tom Tromey <tromey@redhat.com>
* testsuite/libjava.jacks/jacks.xfail (non-jls-zip-2): Now
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index e0b665d704d..e1bff42c7cf 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -150,14 +150,18 @@ lib_gnu_java_awt_peer_qt_la_OBJECTS = \
@QT_AWT_TRUE@am_lib_gnu_java_awt_peer_qt_la_rpath = -rpath \
@QT_AWT_TRUE@ $(toolexeclibdir)
am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
- gnu/classpath/debug.lo gnu/gcj.lo gnu/gcj/convert.lo \
- gnu/gcj/io.lo gnu/gcj/runtime.lo gnu/gcj/util.lo \
- gnu/java/awt.lo gnu/java/awt/color.lo gnu/java/awt/image.lo \
- gnu/java/awt/peer.lo gnu/java/io.lo gnu/java/lang.lo \
- gnu/java/lang/reflect.lo gnu/java/locale.lo gnu/java/math.lo \
- gnu/java/net.lo gnu/java/net/protocol/file.lo \
+ gnu/classpath/debug.lo gnu/classpath/jdwp.lo \
+ gnu/classpath/jdwp/event.lo \
+ gnu/classpath/jdwp/event/filters.lo \
+ gnu/classpath/jdwp/exception.lo gnu/classpath/jdwp/id.lo \
+ gnu/classpath/jdwp/processor.lo \
+ gnu/classpath/jdwp/transport.lo gnu/classpath/jdwp/util.lo \
+ gnu/gcj.lo gnu/gcj/convert.lo gnu/gcj/io.lo gnu/gcj/runtime.lo \
+ gnu/gcj/util.lo gnu/java/awt.lo gnu/java/awt/color.lo \
+ gnu/java/awt/image.lo gnu/java/awt/peer.lo gnu/java/io.lo \
+ gnu/java/lang.lo gnu/java/lang/reflect.lo gnu/java/locale.lo \
+ gnu/java/math.lo gnu/java/net.lo gnu/java/net/protocol/file.lo \
gnu/java/net/protocol/ftp.lo gnu/java/net/protocol/http.lo \
- gnu/java/net/protocol/http/event.lo \
gnu/java/net/protocol/https.lo gnu/java/net/protocol/jar.lo \
gnu/java/nio.lo gnu/java/nio/channels.lo \
gnu/java/nio/charset.lo gnu/java/rmi.lo gnu/java/rmi/dgc.lo \
@@ -167,8 +171,8 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
gnu/java/security/pkcs.lo gnu/java/security/provider.lo \
gnu/java/security/util.lo gnu/java/security/x509.lo \
gnu/java/security/x509/ext.lo gnu/java/text.lo \
- gnu/java/util.lo gnu/java/util/prefs.lo \
- gnu/javax/swing/text/html/parser.lo \
+ gnu/java/util.lo gnu/java/util/prefs.lo gnu/javax/crypto.lo \
+ gnu/javax/imageio/bmp.lo gnu/javax/swing/text/html/parser.lo \
gnu/javax/swing/text/html/parser/models.lo \
gnu/javax/swing/text/html/parser/support.lo \
gnu/javax/swing/text/html/parser/support/low.lo gnu/regexp.lo \
@@ -196,7 +200,9 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
javax/print/event.lo javax/security/auth.lo \
javax/security/auth/callback.lo javax/security/auth/login.lo \
javax/security/auth/spi.lo javax/security/auth/x500.lo \
- javax/security/cert.lo javax/security/sasl.lo javax/sql.lo \
+ javax/security/cert.lo javax/security/sasl.lo \
+ javax/sound/midi.lo javax/sound/midi/spi.lo \
+ javax/sound/sampled.lo javax/sound/sampled/spi.lo javax/sql.lo \
javax/swing.lo javax/swing/border.lo \
javax/swing/colorchooser.lo javax/swing/event.lo \
javax/swing/filechooser.lo javax/swing/plaf.lo \
@@ -206,8 +212,8 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
javax/swing/text/html/parser.lo javax/swing/text/rtf.lo \
javax/swing/tree.lo javax/swing/undo.lo javax/transaction.lo \
javax/transaction/xa.lo org/ietf/jgss.lo
-am__DEPENDENCIES_3 = gnu-java-beans.lo gnu-xml.lo javax-imageio.lo \
- javax-xml.lo org-w3c.lo org-xml.lo
+am__DEPENDENCIES_3 = gnu-java-beans.lo gnu-javax-sound-midi.lo \
+ gnu-xml.lo javax-imageio.lo javax-xml.lo org-w3c.lo org-xml.lo
am__DEPENDENCIES_4 = $(patsubst classpath/resource/%,%,$(addsuffix \
.lo,$(property_files)))
am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
@@ -829,12 +835,15 @@ gnu/awt/xlib/XFontPeer.java \
gnu/awt/xlib/XFramePeer.java \
gnu/awt/xlib/XGraphics.java \
gnu/awt/xlib/XGraphicsConfiguration.java \
+gnu/awt/xlib/XGraphicsDevice.java \
+gnu/awt/xlib/XGraphicsEnvironment.java \
gnu/awt/xlib/XOffScreenImage.java \
gnu/awt/xlib/XPanelPeer.java \
gnu/awt/xlib/XToolkit.java
gnu_awt_xlib_header_files = $(patsubst %.java,%.h,$(gnu_awt_xlib_source_files))
gnu_classpath_source_files = \
+classpath/gnu/classpath/ByteArray.java \
classpath/gnu/classpath/Configuration.java \
classpath/gnu/classpath/Pointer.java \
classpath/gnu/classpath/Pointer32.java \
@@ -850,6 +859,116 @@ classpath/gnu/classpath/debug/PreciseFilter.java \
classpath/gnu/classpath/debug/SystemLogger.java
gnu_classpath_debug_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_debug_source_files)))
+gnu_classpath_jdwp_source_files = \
+classpath/gnu/classpath/jdwp/Jdwp.java \
+classpath/gnu/classpath/jdwp/JdwpConstants.java \
+gnu/classpath/jdwp/VMFrame.java \
+gnu/classpath/jdwp/VMIdManager.java \
+gnu/classpath/jdwp/VMVirtualMachine.java
+
+gnu_classpath_jdwp_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_source_files)))
+gnu_classpath_jdwp_event_source_files = \
+classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java \
+classpath/gnu/classpath/jdwp/event/Event.java \
+classpath/gnu/classpath/jdwp/event/EventManager.java \
+classpath/gnu/classpath/jdwp/event/EventRequest.java \
+classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java \
+classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java \
+classpath/gnu/classpath/jdwp/event/VmDeathEvent.java \
+classpath/gnu/classpath/jdwp/event/VmInitEvent.java
+
+gnu_classpath_jdwp_event_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_event_source_files)))
+gnu_classpath_jdwp_event_filters_source_files = \
+classpath/gnu/classpath/jdwp/event/filters/ClassExcludeFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ConditionalFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/CountFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/IEventFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/StepFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
+
+gnu_classpath_jdwp_event_filters_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_event_filters_source_files)))
+gnu_classpath_jdwp_exception_source_files = \
+classpath/gnu/classpath/jdwp/exception/InvalidClassException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidClassLoaderException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidCountException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidEventTypeException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidFieldException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidLocationException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidMethodException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidObjectException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidStringException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidThreadException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidThreadGroupException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpIllegalArgumentException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java \
+classpath/gnu/classpath/jdwp/exception/NotImplementedException.java \
+classpath/gnu/classpath/jdwp/exception/VmDeadException.java
+
+gnu_classpath_jdwp_exception_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_exception_source_files)))
+gnu_classpath_jdwp_id_source_files = \
+classpath/gnu/classpath/jdwp/id/ArrayId.java \
+classpath/gnu/classpath/jdwp/id/ArrayReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/ClassLoaderId.java \
+classpath/gnu/classpath/jdwp/id/ClassObjectId.java \
+classpath/gnu/classpath/jdwp/id/ClassReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/InterfaceReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/JdwpId.java \
+classpath/gnu/classpath/jdwp/id/ObjectId.java \
+classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/StringId.java \
+classpath/gnu/classpath/jdwp/id/ThreadGroupId.java \
+classpath/gnu/classpath/jdwp/id/ThreadId.java
+
+gnu_classpath_jdwp_id_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_id_source_files)))
+gnu_classpath_jdwp_processor_source_files = \
+classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/CommandSet.java \
+classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/FieldCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/PacketProcessor.java \
+classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+
+gnu_classpath_jdwp_processor_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_processor_source_files)))
+gnu_classpath_jdwp_transport_source_files = \
+classpath/gnu/classpath/jdwp/transport/ITransport.java \
+classpath/gnu/classpath/jdwp/transport/JdwpCommandPacket.java \
+classpath/gnu/classpath/jdwp/transport/JdwpConnection.java \
+classpath/gnu/classpath/jdwp/transport/JdwpPacket.java \
+classpath/gnu/classpath/jdwp/transport/JdwpReplyPacket.java \
+classpath/gnu/classpath/jdwp/transport/SocketTransport.java \
+classpath/gnu/classpath/jdwp/transport/TransportException.java \
+classpath/gnu/classpath/jdwp/transport/TransportFactory.java
+
+gnu_classpath_jdwp_transport_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_transport_source_files)))
+gnu_classpath_jdwp_util_source_files = \
+classpath/gnu/classpath/jdwp/util/JdwpString.java \
+classpath/gnu/classpath/jdwp/util/LineTable.java \
+classpath/gnu/classpath/jdwp/util/Location.java \
+classpath/gnu/classpath/jdwp/util/MethodResult.java \
+classpath/gnu/classpath/jdwp/util/Signature.java \
+classpath/gnu/classpath/jdwp/util/Value.java \
+classpath/gnu/classpath/jdwp/util/VariableTable.java
+
+gnu_classpath_jdwp_util_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_util_source_files)))
gnu_gcj_source_files = \
gnu/gcj/Core.java \
gnu/gcj/RawData.java \
@@ -940,7 +1059,6 @@ classpath/gnu/java/awt/ClasspathToolkit.java \
classpath/gnu/java/awt/ComponentDataBlitOp.java \
classpath/gnu/java/awt/EmbeddedWindow.java \
classpath/gnu/java/awt/EventModifier.java \
-classpath/gnu/java/awt/FocusManager.java \
classpath/gnu/java/awt/GradientPaintContext.java
gnu_java_awt_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_awt_source_files)))
@@ -1307,10 +1425,10 @@ gnu/java/net/protocol/gcjlib/Handler.java
gnu_java_net_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_net_source_files)))
gnu_java_net_protocol_file_source_files = \
-gnu/java/net/protocol/file/Connection.java \
-gnu/java/net/protocol/file/Handler.java
+classpath/gnu/java/net/protocol/file/Connection.java \
+classpath/gnu/java/net/protocol/file/Handler.java
-gnu_java_net_protocol_file_header_files = $(patsubst %.java,%.h,$(gnu_java_net_protocol_file_source_files))
+gnu_java_net_protocol_file_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_net_protocol_file_source_files)))
gnu_java_net_protocol_ftp_source_files = \
classpath/gnu/java/net/protocol/ftp/ActiveModeDTP.java \
classpath/gnu/java/net/protocol/ftp/BlockInputStream.java \
@@ -1333,7 +1451,6 @@ gnu_java_net_protocol_ftp_header_files = $(patsubst classpath/%,%,$(patsubst %.j
gnu_java_net_protocol_http_source_files = \
classpath/gnu/java/net/protocol/http/Authenticator.java \
classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java \
-classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java \
classpath/gnu/java/net/protocol/http/ChunkedInputStream.java \
classpath/gnu/java/net/protocol/http/Cookie.java \
classpath/gnu/java/net/protocol/http/CookieManager.java \
@@ -1343,21 +1460,14 @@ classpath/gnu/java/net/protocol/http/HTTPDateFormat.java \
classpath/gnu/java/net/protocol/http/HTTPURLConnection.java \
classpath/gnu/java/net/protocol/http/Handler.java \
classpath/gnu/java/net/protocol/http/Headers.java \
+classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java \
classpath/gnu/java/net/protocol/http/Request.java \
classpath/gnu/java/net/protocol/http/RequestBodyWriter.java \
classpath/gnu/java/net/protocol/http/Response.java \
-classpath/gnu/java/net/protocol/http/ResponseBodyReader.java \
classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java \
classpath/gnu/java/net/protocol/http/SimpleCookieManager.java
gnu_java_net_protocol_http_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_net_protocol_http_source_files)))
-gnu_java_net_protocol_http_event_source_files = \
-classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java \
-classpath/gnu/java/net/protocol/http/event/ConnectionListener.java \
-classpath/gnu/java/net/protocol/http/event/RequestEvent.java \
-classpath/gnu/java/net/protocol/http/event/RequestListener.java
-
-gnu_java_net_protocol_http_event_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_net_protocol_http_event_source_files)))
gnu_java_net_protocol_https_source_files = \
classpath/gnu/java/net/protocol/https/Handler.java
@@ -1488,6 +1598,7 @@ gnu_java_rmi_registry_header_files = $(patsubst classpath/%,%,$(patsubst %.java,
gnu_java_rmi_server_source_files = \
classpath/gnu/java/rmi/server/ConnectionRunnerPool.java \
classpath/gnu/java/rmi/server/ProtocolConstants.java \
+classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java \
classpath/gnu/java/rmi/server/RMIDefaultSocketFactory.java \
classpath/gnu/java/rmi/server/RMIHashes.java \
classpath/gnu/java/rmi/server/RMIIncomingThread.java \
@@ -1544,6 +1655,8 @@ classpath/gnu/java/security/provider/DSAParameterGenerator.java \
classpath/gnu/java/security/provider/DSAParameters.java \
classpath/gnu/java/security/provider/DSASignature.java \
classpath/gnu/java/security/provider/DefaultPolicy.java \
+classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java \
+classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java \
classpath/gnu/java/security/provider/EncodedKeyFactory.java \
classpath/gnu/java/security/provider/Gnu.java \
classpath/gnu/java/security/provider/GnuDHPublicKey.java \
@@ -1624,6 +1737,38 @@ classpath/gnu/java/util/prefs/NodeReader.java \
classpath/gnu/java/util/prefs/NodeWriter.java
gnu_java_util_prefs_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_util_prefs_source_files)))
+gnu_javax_crypto_source_files = \
+classpath/gnu/javax/crypto/DiffieHellmanImpl.java \
+classpath/gnu/javax/crypto/GnuDHPrivateKey.java \
+classpath/gnu/javax/crypto/RSACipherImpl.java
+
+gnu_javax_crypto_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_crypto_source_files)))
+gnu_javax_imageio_bmp_source_files = \
+classpath/gnu/javax/imageio/bmp/BMPDecoder.java \
+classpath/gnu/javax/imageio/bmp/BMPException.java \
+classpath/gnu/javax/imageio/bmp/BMPFileHeader.java \
+classpath/gnu/javax/imageio/bmp/BMPImageReader.java \
+classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java \
+classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java \
+classpath/gnu/javax/imageio/bmp/DecodeBF16.java \
+classpath/gnu/javax/imageio/bmp/DecodeBF32.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB1.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB24.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB4.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB8.java \
+classpath/gnu/javax/imageio/bmp/DecodeRLE4.java \
+classpath/gnu/javax/imageio/bmp/DecodeRLE8.java
+
+gnu_javax_imageio_bmp_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_imageio_bmp_source_files)))
+gnu_javax_sound_midi_source_files = \
+classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java \
+classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java \
+classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+
gnu_javax_swing_text_html_parser_source_files = \
classpath/gnu/javax/swing/text/html/parser/HTML_401F.java \
classpath/gnu/javax/swing/text/html/parser/gnuDTD.java \
@@ -1848,6 +1993,33 @@ classpath/gnu/xml/pipeline/ValidationConsumer.java \
classpath/gnu/xml/pipeline/WellFormednessFilter.java \
classpath/gnu/xml/pipeline/XIncludeFilter.java \
classpath/gnu/xml/pipeline/XsltFilter.java \
+classpath/gnu/xml/stream/AttributeImpl.java \
+classpath/gnu/xml/stream/CharactersImpl.java \
+classpath/gnu/xml/stream/CommentImpl.java \
+classpath/gnu/xml/stream/DTDImpl.java \
+classpath/gnu/xml/stream/EndDocumentImpl.java \
+classpath/gnu/xml/stream/EndElementImpl.java \
+classpath/gnu/xml/stream/EndEntityImpl.java \
+classpath/gnu/xml/stream/EntityDeclarationImpl.java \
+classpath/gnu/xml/stream/EntityReferenceImpl.java \
+classpath/gnu/xml/stream/FilteredEventReader.java \
+classpath/gnu/xml/stream/FilteredStreamReader.java \
+classpath/gnu/xml/stream/LocationImpl.java \
+classpath/gnu/xml/stream/NamespaceImpl.java \
+classpath/gnu/xml/stream/NotationDeclarationImpl.java \
+classpath/gnu/xml/stream/ProcessingInstructionImpl.java \
+classpath/gnu/xml/stream/StartDocumentImpl.java \
+classpath/gnu/xml/stream/StartElementImpl.java \
+classpath/gnu/xml/stream/StartEntityImpl.java \
+classpath/gnu/xml/stream/XMLEventAllocatorImpl.java \
+classpath/gnu/xml/stream/XMLEventFactoryImpl.java \
+classpath/gnu/xml/stream/XMLEventImpl.java \
+classpath/gnu/xml/stream/XMLEventReaderImpl.java \
+classpath/gnu/xml/stream/XMLEventWriterImpl.java \
+classpath/gnu/xml/stream/XMLInputFactoryImpl.java \
+classpath/gnu/xml/stream/XMLOutputFactoryImpl.java \
+classpath/gnu/xml/stream/XMLStreamReaderImpl.java \
+classpath/gnu/xml/stream/XMLStreamWriterImpl.java \
classpath/gnu/xml/transform/AbstractNumberNode.java \
classpath/gnu/xml/transform/ApplyImportsNode.java \
classpath/gnu/xml/transform/ApplyTemplatesNode.java \
@@ -2440,7 +2612,7 @@ java/io/ObjectInputStream.java \
classpath/java/io/ObjectInputValidation.java \
classpath/java/io/ObjectOutput.java \
classpath/java/io/ObjectOutputStream.java \
-java/io/ObjectStreamClass.java \
+classpath/java/io/ObjectStreamClass.java \
classpath/java/io/ObjectStreamConstants.java \
classpath/java/io/ObjectStreamException.java \
classpath/java/io/ObjectStreamField.java \
@@ -2495,6 +2667,7 @@ classpath/java/lang/Comparable.java \
classpath/java/lang/Compiler.java \
java/lang/ConcreteProcess.java \
java/lang/Double.java \
+classpath/java/lang/EnumConstantNotPresentException.java \
classpath/java/lang/Error.java \
classpath/java/lang/Exception.java \
classpath/java/lang/ExceptionInInitializerError.java \
@@ -2628,7 +2801,7 @@ classpath/java/net/NoRouteToHostException.java \
classpath/java/net/PasswordAuthentication.java \
classpath/java/net/PortUnreachableException.java \
classpath/java/net/ProtocolException.java \
-java/net/ServerSocket.java \
+classpath/java/net/ServerSocket.java \
classpath/java/net/Socket.java \
classpath/java/net/SocketAddress.java \
classpath/java/net/SocketException.java \
@@ -2780,6 +2953,7 @@ classpath/java/rmi/activation/ActivationException.java \
classpath/java/rmi/activation/ActivationGroup.java \
classpath/java/rmi/activation/ActivationGroupDesc.java \
classpath/java/rmi/activation/ActivationGroupID.java \
+classpath/java/rmi/activation/ActivationGroup_Stub.java \
classpath/java/rmi/activation/ActivationID.java \
classpath/java/rmi/activation/ActivationInstantiator.java \
classpath/java/rmi/activation/ActivationMonitor.java \
@@ -3043,7 +3217,7 @@ classpath/java/text/NumberFormat.java \
classpath/java/text/ParseException.java \
classpath/java/text/ParsePosition.java \
classpath/java/text/RuleBasedCollator.java \
-java/text/SimpleDateFormat.java \
+classpath/java/text/SimpleDateFormat.java \
classpath/java/text/StringCharacterIterator.java
java_text_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_text_source_files)))
@@ -3062,7 +3236,7 @@ classpath/java/util/Collections.java \
classpath/java/util/Comparator.java \
classpath/java/util/ConcurrentModificationException.java \
java/util/Currency.java \
-java/util/Date.java \
+classpath/java/util/Date.java \
classpath/java/util/Dictionary.java \
classpath/java/util/EmptyStackException.java \
classpath/java/util/Enumeration.java \
@@ -3074,6 +3248,7 @@ classpath/java/util/HashMap.java \
classpath/java/util/HashSet.java \
classpath/java/util/Hashtable.java \
classpath/java/util/IdentityHashMap.java \
+classpath/java/util/InvalidPropertiesFormatException.java \
classpath/java/util/Iterator.java \
classpath/java/util/LinkedHashMap.java \
classpath/java/util/LinkedHashSet.java \
@@ -3096,7 +3271,7 @@ classpath/java/util/Random.java \
classpath/java/util/RandomAccess.java \
java/util/ResourceBundle.java \
classpath/java/util/Set.java \
-java/util/SimpleTimeZone.java \
+classpath/java/util/SimpleTimeZone.java \
classpath/java/util/SortedMap.java \
classpath/java/util/SortedSet.java \
classpath/java/util/Stack.java \
@@ -3173,9 +3348,9 @@ java/util/zip/GZIPOutputStream.java \
java/util/zip/Inflater.java \
java/util/zip/InflaterInputStream.java \
classpath/java/util/zip/ZipConstants.java \
-java/util/zip/ZipEntry.java \
+classpath/java/util/zip/ZipEntry.java \
classpath/java/util/zip/ZipException.java \
-java/util/zip/ZipFile.java \
+classpath/java/util/zip/ZipFile.java \
classpath/java/util/zip/ZipInputStream.java \
classpath/java/util/zip/ZipOutputStream.java
@@ -3272,15 +3447,12 @@ classpath/javax/imageio/event/IIOReadUpdateListener.java \
classpath/javax/imageio/event/IIOReadWarningListener.java \
classpath/javax/imageio/event/IIOWriteProgressListener.java \
classpath/javax/imageio/event/IIOWriteWarningListener.java \
-classpath/javax/imageio/metadata/IIOAttr.java \
classpath/javax/imageio/metadata/IIOInvalidTreeException.java \
classpath/javax/imageio/metadata/IIOMetadata.java \
classpath/javax/imageio/metadata/IIOMetadataController.java \
classpath/javax/imageio/metadata/IIOMetadataFormat.java \
classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java \
classpath/javax/imageio/metadata/IIOMetadataNode.java \
-classpath/javax/imageio/metadata/IIONamedNodeMap.java \
-classpath/javax/imageio/metadata/IIONodeList.java \
classpath/javax/imageio/spi/IIORegistry.java \
classpath/javax/imageio/spi/IIOServiceProvider.java \
classpath/javax/imageio/spi/ImageInputStreamSpi.java \
@@ -3643,6 +3815,72 @@ classpath/javax/security/sasl/SaslServer.java \
classpath/javax/security/sasl/SaslServerFactory.java
javax_security_sasl_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_security_sasl_source_files)))
+javax_sound_midi_source_files = \
+classpath/javax/sound/midi/ControllerEventListener.java \
+classpath/javax/sound/midi/Instrument.java \
+classpath/javax/sound/midi/InvalidMidiDataException.java \
+classpath/javax/sound/midi/MetaEventListener.java \
+classpath/javax/sound/midi/MetaMessage.java \
+classpath/javax/sound/midi/MidiChannel.java \
+classpath/javax/sound/midi/MidiDevice.java \
+classpath/javax/sound/midi/MidiEvent.java \
+classpath/javax/sound/midi/MidiFileFormat.java \
+classpath/javax/sound/midi/MidiMessage.java \
+classpath/javax/sound/midi/MidiSystem.java \
+classpath/javax/sound/midi/MidiUnavailableException.java \
+classpath/javax/sound/midi/Patch.java \
+classpath/javax/sound/midi/Receiver.java \
+classpath/javax/sound/midi/Sequence.java \
+classpath/javax/sound/midi/Sequencer.java \
+classpath/javax/sound/midi/ShortMessage.java \
+classpath/javax/sound/midi/Soundbank.java \
+classpath/javax/sound/midi/SoundbankResource.java \
+classpath/javax/sound/midi/Synthesizer.java \
+classpath/javax/sound/midi/SysexMessage.java \
+classpath/javax/sound/midi/Track.java \
+classpath/javax/sound/midi/Transmitter.java \
+classpath/javax/sound/midi/VoiceStatus.java
+
+javax_sound_midi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_midi_source_files)))
+javax_sound_midi_spi_source_files = \
+classpath/javax/sound/midi/spi/MidiDeviceProvider.java \
+classpath/javax/sound/midi/spi/MidiFileReader.java \
+classpath/javax/sound/midi/spi/MidiFileWriter.java \
+classpath/javax/sound/midi/spi/SoundbankReader.java
+
+javax_sound_midi_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_midi_spi_source_files)))
+javax_sound_sampled_source_files = \
+classpath/javax/sound/sampled/AudioFileFormat.java \
+classpath/javax/sound/sampled/AudioFormat.java \
+classpath/javax/sound/sampled/AudioInputStream.java \
+classpath/javax/sound/sampled/AudioPermission.java \
+classpath/javax/sound/sampled/AudioSystem.java \
+classpath/javax/sound/sampled/BooleanControl.java \
+classpath/javax/sound/sampled/Clip.java \
+classpath/javax/sound/sampled/CompoundControl.java \
+classpath/javax/sound/sampled/Control.java \
+classpath/javax/sound/sampled/DataLine.java \
+classpath/javax/sound/sampled/EnumControl.java \
+classpath/javax/sound/sampled/FloatControl.java \
+classpath/javax/sound/sampled/Line.java \
+classpath/javax/sound/sampled/LineEvent.java \
+classpath/javax/sound/sampled/LineListener.java \
+classpath/javax/sound/sampled/LineUnavailableException.java \
+classpath/javax/sound/sampled/Mixer.java \
+classpath/javax/sound/sampled/Port.java \
+classpath/javax/sound/sampled/ReverbType.java \
+classpath/javax/sound/sampled/SourceDataLine.java \
+classpath/javax/sound/sampled/TargetDataLine.java \
+classpath/javax/sound/sampled/UnsupportedAudioFileException.java
+
+javax_sound_sampled_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_sampled_source_files)))
+javax_sound_sampled_spi_source_files = \
+classpath/javax/sound/sampled/spi/AudioFileReader.java \
+classpath/javax/sound/sampled/spi/AudioFileWriter.java \
+classpath/javax/sound/sampled/spi/FormatConversionProvider.java \
+classpath/javax/sound/sampled/spi/MixerProvider.java
+
+javax_sound_sampled_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_sampled_spi_source_files)))
javax_sql_source_files = \
classpath/javax/sql/ConnectionEvent.java \
classpath/javax/sql/ConnectionEventListener.java \
@@ -3744,6 +3982,7 @@ classpath/javax/swing/JTree.java \
classpath/javax/swing/JViewport.java \
classpath/javax/swing/JWindow.java \
classpath/javax/swing/KeyStroke.java \
+classpath/javax/swing/KeyboardManager.java \
classpath/javax/swing/LayoutFocusTraversalPolicy.java \
classpath/javax/swing/ListCellRenderer.java \
classpath/javax/swing/ListModel.java \
@@ -3970,22 +4209,28 @@ javax_swing_plaf_basic_header_files = $(patsubst classpath/%,%,$(patsubst %.java
javax_swing_plaf_metal_source_files = \
classpath/javax/swing/plaf/metal/DefaultMetalTheme.java \
classpath/javax/swing/plaf/metal/MetalBorders.java \
+classpath/javax/swing/plaf/metal/MetalButtonListener.java \
classpath/javax/swing/plaf/metal/MetalButtonUI.java \
classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java \
classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java \
+classpath/javax/swing/plaf/metal/MetalComboBoxButton.java \
+classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java \
classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java \
classpath/javax/swing/plaf/metal/MetalComboBoxUI.java \
classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java \
+classpath/javax/swing/plaf/metal/MetalFileChooserUI.java \
classpath/javax/swing/plaf/metal/MetalIconFactory.java \
classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java \
classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java \
classpath/javax/swing/plaf/metal/MetalLabelUI.java \
classpath/javax/swing/plaf/metal/MetalLookAndFeel.java \
+classpath/javax/swing/plaf/metal/MetalMenuBarUI.java \
classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java \
classpath/javax/swing/plaf/metal/MetalProgressBarUI.java \
classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java \
classpath/javax/swing/plaf/metal/MetalRootPaneUI.java \
classpath/javax/swing/plaf/metal/MetalScrollBarUI.java \
+classpath/javax/swing/plaf/metal/MetalScrollButton.java \
classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java \
classpath/javax/swing/plaf/metal/MetalSeparatorUI.java \
classpath/javax/swing/plaf/metal/MetalSliderUI.java \
@@ -3998,7 +4243,8 @@ classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java \
classpath/javax/swing/plaf/metal/MetalToolBarUI.java \
classpath/javax/swing/plaf/metal/MetalToolTipUI.java \
classpath/javax/swing/plaf/metal/MetalTreeUI.java \
-classpath/javax/swing/plaf/metal/MetalUtils.java
+classpath/javax/swing/plaf/metal/MetalUtils.java \
+classpath/javax/swing/plaf/metal/OceanTheme.java
javax_swing_plaf_metal_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_swing_plaf_metal_source_files)))
javax_swing_plaf_multi_source_files = \
@@ -4064,6 +4310,7 @@ classpath/javax/swing/text/DefaultEditorKit.java \
classpath/javax/swing/text/DefaultFormatter.java \
classpath/javax/swing/text/DefaultHighlighter.java \
classpath/javax/swing/text/DefaultStyledDocument.java \
+classpath/javax/swing/text/DefaultTextUI.java \
classpath/javax/swing/text/Document.java \
classpath/javax/swing/text/DocumentFilter.java \
classpath/javax/swing/text/EditorKit.java \
@@ -4103,10 +4350,12 @@ classpath/javax/swing/text/TabableView.java \
classpath/javax/swing/text/TextAction.java \
classpath/javax/swing/text/Utilities.java \
classpath/javax/swing/text/View.java \
-classpath/javax/swing/text/ViewFactory.java
+classpath/javax/swing/text/ViewFactory.java \
+classpath/javax/swing/text/WrappedPlainView.java
javax_swing_text_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_swing_text_source_files)))
javax_swing_text_html_source_files = \
+classpath/javax/swing/text/html/CSS.java \
classpath/javax/swing/text/html/HTML.java \
classpath/javax/swing/text/html/HTMLDocument.java \
classpath/javax/swing/text/html/HTMLEditorKit.java \
@@ -4206,6 +4455,43 @@ classpath/javax/xml/parsers/FactoryConfigurationError.java \
classpath/javax/xml/parsers/ParserConfigurationException.java \
classpath/javax/xml/parsers/SAXParser.java \
classpath/javax/xml/parsers/SAXParserFactory.java \
+classpath/javax/xml/stream/EventFilter.java \
+classpath/javax/xml/stream/FactoryConfigurationError.java \
+classpath/javax/xml/stream/Location.java \
+classpath/javax/xml/stream/StreamFilter.java \
+classpath/javax/xml/stream/XMLEventFactory.java \
+classpath/javax/xml/stream/XMLEventReader.java \
+classpath/javax/xml/stream/XMLEventWriter.java \
+classpath/javax/xml/stream/XMLFilter.java \
+classpath/javax/xml/stream/XMLInputFactory.java \
+classpath/javax/xml/stream/XMLIterator.java \
+classpath/javax/xml/stream/XMLOutputFactory.java \
+classpath/javax/xml/stream/XMLReporter.java \
+classpath/javax/xml/stream/XMLResolver.java \
+classpath/javax/xml/stream/XMLStreamConstants.java \
+classpath/javax/xml/stream/XMLStreamException.java \
+classpath/javax/xml/stream/XMLStreamReader.java \
+classpath/javax/xml/stream/XMLStreamWriter.java \
+classpath/javax/xml/stream/events/Attribute.java \
+classpath/javax/xml/stream/events/Characters.java \
+classpath/javax/xml/stream/events/Comment.java \
+classpath/javax/xml/stream/events/DTD.java \
+classpath/javax/xml/stream/events/EndDocument.java \
+classpath/javax/xml/stream/events/EndElement.java \
+classpath/javax/xml/stream/events/EndEntity.java \
+classpath/javax/xml/stream/events/EntityDeclaration.java \
+classpath/javax/xml/stream/events/EntityReference.java \
+classpath/javax/xml/stream/events/Namespace.java \
+classpath/javax/xml/stream/events/NotationDeclaration.java \
+classpath/javax/xml/stream/events/ProcessingInstruction.java \
+classpath/javax/xml/stream/events/StartDocument.java \
+classpath/javax/xml/stream/events/StartElement.java \
+classpath/javax/xml/stream/events/StartEntity.java \
+classpath/javax/xml/stream/events/XMLEvent.java \
+classpath/javax/xml/stream/util/EventReaderDelegate.java \
+classpath/javax/xml/stream/util/ReaderDelegate.java \
+classpath/javax/xml/stream/util/XMLEventAllocator.java \
+classpath/javax/xml/stream/util/XMLEventConsumer.java \
classpath/javax/xml/transform/ErrorListener.java \
classpath/javax/xml/transform/OutputKeys.java \
classpath/javax/xml/transform/Result.java \
@@ -4447,6 +4733,14 @@ all_packages_source_files = \
gnu/awt/j2d.list \
gnu/classpath.list \
gnu/classpath/debug.list \
+ gnu/classpath/jdwp.list \
+ gnu/classpath/jdwp/event.list \
+ gnu/classpath/jdwp/event/filters.list \
+ gnu/classpath/jdwp/exception.list \
+ gnu/classpath/jdwp/id.list \
+ gnu/classpath/jdwp/processor.list \
+ gnu/classpath/jdwp/transport.list \
+ gnu/classpath/jdwp/util.list \
gnu/gcj.list \
gnu/gcj/convert.list \
gnu/gcj/io.list \
@@ -4465,7 +4759,6 @@ all_packages_source_files = \
gnu/java/net/protocol/file.list \
gnu/java/net/protocol/ftp.list \
gnu/java/net/protocol/http.list \
- gnu/java/net/protocol/http/event.list \
gnu/java/net/protocol/https.list \
gnu/java/net/protocol/jar.list \
gnu/java/nio.list \
@@ -4487,6 +4780,8 @@ all_packages_source_files = \
gnu/java/text.list \
gnu/java/util.list \
gnu/java/util/prefs.list \
+ gnu/javax/crypto.list \
+ gnu/javax/imageio/bmp.list \
gnu/javax/swing/text/html/parser.list \
gnu/javax/swing/text/html/parser/models.list \
gnu/javax/swing/text/html/parser/support.list \
@@ -4561,6 +4856,10 @@ all_packages_source_files = \
javax/security/auth/x500.list \
javax/security/cert.list \
javax/security/sasl.list \
+ javax/sound/midi.list \
+ javax/sound/midi/spi.list \
+ javax/sound/sampled.list \
+ javax/sound/sampled/spi.list \
javax/sql.list \
javax/swing.list \
javax/swing/border.list \
@@ -4587,6 +4886,14 @@ ordinary_header_files = \
$(gnu_awt_j2d_header_files) \
$(gnu_classpath_header_files) \
$(gnu_classpath_debug_header_files) \
+ $(gnu_classpath_jdwp_header_files) \
+ $(gnu_classpath_jdwp_event_header_files) \
+ $(gnu_classpath_jdwp_event_filters_header_files) \
+ $(gnu_classpath_jdwp_exception_header_files) \
+ $(gnu_classpath_jdwp_id_header_files) \
+ $(gnu_classpath_jdwp_processor_header_files) \
+ $(gnu_classpath_jdwp_transport_header_files) \
+ $(gnu_classpath_jdwp_util_header_files) \
$(gnu_gcj_header_files) \
$(gnu_gcj_convert_header_files) \
$(gnu_gcj_io_header_files) \
@@ -4605,7 +4912,6 @@ ordinary_header_files = \
$(gnu_java_net_protocol_file_header_files) \
$(gnu_java_net_protocol_ftp_header_files) \
$(gnu_java_net_protocol_http_header_files) \
- $(gnu_java_net_protocol_http_event_header_files) \
$(gnu_java_net_protocol_https_header_files) \
$(gnu_java_net_protocol_jar_header_files) \
$(gnu_java_nio_header_files) \
@@ -4627,6 +4933,8 @@ ordinary_header_files = \
$(gnu_java_text_header_files) \
$(gnu_java_util_header_files) \
$(gnu_java_util_prefs_header_files) \
+ $(gnu_javax_crypto_header_files) \
+ $(gnu_javax_imageio_bmp_header_files) \
$(gnu_javax_swing_text_html_parser_header_files) \
$(gnu_javax_swing_text_html_parser_models_header_files) \
$(gnu_javax_swing_text_html_parser_support_header_files) \
@@ -4701,6 +5009,10 @@ ordinary_header_files = \
$(javax_security_auth_x500_header_files) \
$(javax_security_cert_header_files) \
$(javax_security_sasl_header_files) \
+ $(javax_sound_midi_header_files) \
+ $(javax_sound_midi_spi_header_files) \
+ $(javax_sound_sampled_header_files) \
+ $(javax_sound_sampled_spi_header_files) \
$(javax_sql_header_files) \
$(javax_swing_header_files) \
$(javax_swing_border_header_files) \
@@ -4724,6 +5036,7 @@ ordinary_header_files = \
bc_objects = \
gnu-java-beans.lo \
+ gnu-javax-sound-midi.lo \
gnu-xml.lo \
javax-imageio.lo \
javax-xml.lo \
@@ -6582,6 +6895,86 @@ gnu/classpath/debug.list: $(gnu_classpath_debug_source_files)
-include gnu/classpath/debug.deps
+gnu/classpath/jdwp.list: $(gnu_classpath_jdwp_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp.list
+
+-include gnu/classpath/jdwp.deps
+
+gnu/classpath/jdwp/event.list: $(gnu_classpath_jdwp_event_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_event_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/event.list
+
+-include gnu/classpath/jdwp/event.deps
+
+gnu/classpath/jdwp/event/filters.list: $(gnu_classpath_jdwp_event_filters_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_event_filters_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/event/filters.list
+
+-include gnu/classpath/jdwp/event/filters.deps
+
+gnu/classpath/jdwp/exception.list: $(gnu_classpath_jdwp_exception_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_exception_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/exception.list
+
+-include gnu/classpath/jdwp/exception.deps
+
+gnu/classpath/jdwp/id.list: $(gnu_classpath_jdwp_id_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_id_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/id.list
+
+-include gnu/classpath/jdwp/id.deps
+
+gnu/classpath/jdwp/processor.list: $(gnu_classpath_jdwp_processor_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_processor_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/processor.list
+
+-include gnu/classpath/jdwp/processor.deps
+
+gnu/classpath/jdwp/transport.list: $(gnu_classpath_jdwp_transport_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_transport_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/transport.list
+
+-include gnu/classpath/jdwp/transport.deps
+
+gnu/classpath/jdwp/util.list: $(gnu_classpath_jdwp_util_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_util_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/util.list
+
+-include gnu/classpath/jdwp/util.deps
+
gnu/gcj.list: $(gnu_gcj_source_files)
@$(mkinstalldirs) $(dir $@)
@for file in $(gnu_gcj_source_files); do \
@@ -6787,16 +7180,6 @@ gnu/java/net/protocol/http.list: $(gnu_java_net_protocol_http_source_files)
-include gnu/java/net/protocol/http.deps
-gnu/java/net/protocol/http/event.list: $(gnu_java_net_protocol_http_event_source_files)
- @$(mkinstalldirs) $(dir $@)
- @for file in $(gnu_java_net_protocol_http_event_source_files); do \
- if test -f $(srcdir)/$$file; then \
- echo $(srcdir)/$$file; \
- else echo $$file; fi; \
- done > gnu/java/net/protocol/http/event.list
-
--include gnu/java/net/protocol/http/event.deps
-
gnu/java/net/protocol/https.list: $(gnu_java_net_protocol_https_source_files)
@$(mkinstalldirs) $(dir $@)
@for file in $(gnu_java_net_protocol_https_source_files); do \
@@ -7007,6 +7390,31 @@ gnu/java/util/prefs.list: $(gnu_java_util_prefs_source_files)
-include gnu/java/util/prefs.deps
+gnu/javax/crypto.list: $(gnu_javax_crypto_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_javax_crypto_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/javax/crypto.list
+
+-include gnu/javax/crypto.deps
+
+gnu/javax/imageio/bmp.list: $(gnu_javax_imageio_bmp_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_javax_imageio_bmp_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/javax/imageio/bmp.list
+
+-include gnu/javax/imageio/bmp.deps
+
+gnu-javax-sound-midi.lo: $(gnu_javax_sound_midi_source_files)
+ @find classpath/lib/gnu/javax/sound/midi -name '*.class' > gnu-javax-sound-midi.list
+ $(LTGCJCOMPILE) -fjni -findirect-dispatch -c -o gnu-javax-sound-midi.lo @gnu-javax-sound-midi.list
+ @rm -f gnu-javax-sound-midi.list
+
gnu/javax/swing/text/html/parser.list: $(gnu_javax_swing_text_html_parser_source_files)
@$(mkinstalldirs) $(dir $@)
@for file in $(gnu_javax_swing_text_html_parser_source_files); do \
@@ -7757,6 +8165,46 @@ javax/security/sasl.list: $(javax_security_sasl_source_files)
-include javax/security/sasl.deps
+javax/sound/midi.list: $(javax_sound_midi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_midi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/midi.list
+
+-include javax/sound/midi.deps
+
+javax/sound/midi/spi.list: $(javax_sound_midi_spi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_midi_spi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/midi/spi.list
+
+-include javax/sound/midi/spi.deps
+
+javax/sound/sampled.list: $(javax_sound_sampled_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_sampled_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/sampled.list
+
+-include javax/sound/sampled.deps
+
+javax/sound/sampled/spi.list: $(javax_sound_sampled_spi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_sampled_spi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/sampled/spi.list
+
+-include javax/sound/sampled/spi.deps
+
javax/sql.list: $(javax_sql_source_files)
@$(mkinstalldirs) $(dir $@)
@for file in $(javax_sql_source_files); do \
diff --git a/libjava/classpath/.classpath b/libjava/classpath/.classpath
index 51315366e6c..f170038598e 100644
--- a/libjava/classpath/.classpath
+++ b/libjava/classpath/.classpath
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry excluding="compat/|examples/|external/|gnu/classpath/jdwp/|gnu/javax/swing/plaf/|test/|testsuite/|vm/reference/|resource/" kind="src" path=""/>
+ <classpathentry excluding=".externalToolBuilders/|.settings/|ChangeLog*|Makefile*|autom4te.cache/|compat/|config*|doc/|examples/|external/|gnu/javax/swing/plaf/|include/|install/|lib/|m4/|native/|resource/|scripts/|test/|testsuite/|vm/reference/" kind="src" path=""/>
<classpathentry kind="src" path="resource"/>
- <classpathentry excluding="gnu/classpath/jdwp/" kind="src" path="vm/reference"/>
+ <classpathentry kind="src" path="vm/reference"/>
<classpathentry kind="src" path="external/sax"/>
<classpathentry kind="src" path="external/w3c_dom"/>
<classpathentry kind="src" path="examples"/>
diff --git a/libjava/classpath/.settings/org.eclipse.jdt.core.prefs b/libjava/classpath/.settings/org.eclipse.jdt.core.prefs
index 6977f23851e..0c544bd829e 100644
--- a/libjava/classpath/.settings/org.eclipse.jdt.core.prefs
+++ b/libjava/classpath/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,13 @@
-#Mon Apr 25 22:37:20 MDT 2005
+#Tue Sep 13 16:15:04 MDT 2005
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -22,9 +23,20 @@ org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
@@ -50,7 +62,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.4
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/libjava/classpath/.settings/org.eclipse.jdt.ui.prefs b/libjava/classpath/.settings/org.eclipse.jdt.ui.prefs
index 7fc356fd571..05d8922d3c0 100644
--- a/libjava/classpath/.settings/org.eclipse.jdt.ui.prefs
+++ b/libjava/classpath/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,5 @@
-#Mon Apr 25 21:37:39 MDT 2005
+#Sat Sep 17 22:04:29 MDT 2005
eclipse.preferences.version=1
formatter_settings_version=8
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates/>
+internal.default.compliance=user
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?>\n<templates><template id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment" description\="Comment for getter method" context\="gettercomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * @return Returns the ${bare_field_name}.\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment" description\="Comment for setter method" context\="settercomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * @param ${param} The ${bare_field_name} to set.\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment" description\="Comment for created constructors" context\="constructorcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * ${tags}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment" description\="Comment for created Java files" context\="filecomment_context" enabled\="true" deleted\="false" autoinsert\="false">/* ${file_name} -- FIXME describe the file briefly\n Copyright (C) ${year} Free Software Foundation, Inc.\n\nThis file is part of GNU Classpath.\n\nGNU Classpath is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2, or (at your option)\nany later version.\n\nGNU Classpath is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GNU Classpath; see the file COPYING. If not, write to the\nFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301 USA.\n\nLinking this library statically or dynamically with other modules is\nmaking a combined work based on this library. Thus, the terms and\nconditions of the GNU General Public License cover the whole\ncombination.\n\nAs a special exception, the copyright holders of this library give you\npermission to link this library with independent modules to produce an\nexecutable, regardless of the license terms of these independent\nmodules, and to copy and distribute the resulting executable under\nterms of your choice, provided that you also meet, for each linked\nindependent module, the terms and conditions of the license of that\nmodule. An independent module is a module which is not derived from\nor based on this library. If you modify this library, you may extend\nthis exception to your version of the library, but you are not\nobligated to do so. If you do not wish to do so, delete this\nexception statement from your version. */\n\n\n</template><template id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment" description\="Comment for created types" context\="typecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment" description\="Comment for fields" context\="fieldcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * \n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment" description\="Comment for non-overriding methods" context\="methodcomment_context" enabled\="true" deleted\="false" autoinsert\="true">/**\n * ${tags}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment" description\="Comment for overriding methods" context\="overridecomment_context" enabled\="true" deleted\="false" autoinsert\="true">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype" description\="Newly created files" context\="newtype_context" enabled\="true" deleted\="false" autoinsert\="false">/* ${file_name} -- FIXME\: briefly describe file purpose\n Copyright (C) ${year} Free Software Foundation, Inc.\n\nThis file is part of GNU Classpath.\n\nGNU Classpath is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2, or (at your option)\nany later version.\n\nGNU Classpath is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nGeneral Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GNU Classpath; see the file COPYING. If not, write to the\nFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301 USA.\n\nLinking this library statically or dynamically with other modules is\nmaking a combined work based on this library. Thus, the terms and\nconditions of the GNU General Public License cover the whole\ncombination.\n\nAs a special exception, the copyright holders of this library give you\npermission to link this library with independent modules to produce an\nexecutable, regardless of the license terms of these independent\nmodules, and to copy and distribute the resulting executable under\nterms of your choice, provided that you also meet, for each linked\nindependent module, the terms and conditions of the license of that\nmodule. An independent module is a module which is not derived from\nor based on this library. If you modify this library, you may extend\nthis exception to your version of the library, but you are not\nobligated to do so. If you do not wish to do so, delete this\nexception statement from your version. */\n\n\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock" description\="Code in new catch blocks" context\="catchblock_context" enabled\="true" deleted\="false" autoinsert\="true">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody" description\="Code in created method stubs" context\="methodbody_context" enabled\="true" deleted\="false" autoinsert\="true">// ${todo} Auto-generated method stub\n${body_statement}</template><template id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody" description\="Code in created constructor stubs" context\="constructorbody_context" enabled\="true" deleted\="false" autoinsert\="true">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody" description\="Code in created getters" context\="getterbody_context" enabled\="true" deleted\="false" autoinsert\="true">return ${field};</template><template id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody" description\="Code in created setters" context\="setterbody_context" enabled\="true" deleted\="false" autoinsert\="true">${field} \= ${param};</template></templates>
diff --git a/libjava/classpath/AUTHORS b/libjava/classpath/AUTHORS
index 2f021ea0441..2ef1cb7a679 100644
--- a/libjava/classpath/AUTHORS
+++ b/libjava/classpath/AUTHORS
@@ -4,7 +4,9 @@ caught bugs or submitted minor patches. If your name does not appear
on either list, but should, let us know. Please keep this list in
alphabetic order.
-Stuart Ballard (stuart.ballard@mcmail.com)
+Lillian Angel (langel@redhat.com)
+Anthony Balkissoon (abalkiss@redhat.com)
+Stuart Ballard (stuart.a.ballard@gmail.com)
Mark Benvenuto (mcb54@columbia.edu)
Geoff Berry (gcb@gnu.org)
James E. Blair (corvus@gnu.org)
@@ -12,8 +14,10 @@ Eric Blake (ebb9@email.byu.edu)
Sascha Brawer (brawer@acm.org)
Nic Ferrier (nferrier@tapsellferrier.co.uk)
Paul Fisher (rao@gnu.org)
+David Gilbert (david.gilbert@object-refinery.com)
Anthony Green (green@redhat.com)
Jochen Hoenicke (Jochen.Hoenicke@Informatik.Uni-Oldenburg.de)
+Andrew John Hughes (gnu_andrew@member.fsf.org)
Brian Jones (cbj@gnu.org)
Roman Kennke (roman@kennke.org)
Michael Koch (konqueror@gmx.de)
@@ -25,6 +29,7 @@ Bryce McKinlay (bryce@waitaki.otago.ac.nz)
Audrius Meskauskas (audriusa@Bioinformatics.org)
Aaron M. Renn (arenn@urbanophile.com)
Andrew Selkirk (aselkirk@sympatico.ca)
+Christian Thalinger (twisti@complang.tuwien.ac.at)
Tom Tromey (tromey@cygnus.com)
Ronald Veldema (rveldema@cs.vu.nl)
Mark Wielaard (mark@klomp.org)
diff --git a/libjava/classpath/BUGS b/libjava/classpath/BUGS
index abdb4e4d5e0..aa75439582c 100644
--- a/libjava/classpath/BUGS
+++ b/libjava/classpath/BUGS
@@ -2,4 +2,4 @@ This package is still in the early development phase. That means too
early to start listing bugs in a file like this one!
Report bugs to classpath@gnu.org or much better via Savannah at this
-URL: http://savannah.gnu.org/bugs/?group=classpath
+URL: http://www.gnu.org/software/classpath/bugs.html
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog
index 6463f49c28d..125388f5d6f 100644
--- a/libjava/classpath/ChangeLog
+++ b/libjava/classpath/ChangeLog
@@ -1,3 +1,10236 @@
+2005-11-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JEditorPane.java
+ (PlainEditorKit): New inner class.
+ (createDefaultEditorKit): Return an instance of PlainEditorKit.
+ * javax/swing/JTextPane.java
+ (insertComponent): Implemented previously stubbed method.
+ (insertIcon): Implemented previously stubbed method.
+
+2005-11-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicEditorPaneUI.java
+ (create): Removed unneeded method.
+ * javax/swing/plaf/basic/BasicTextPaneUI.java
+ (create): Removed unneeded method.
+
+2005-11-17 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Container.java
+ (Container): Added comment.
+ (remove): Only call removeNotify if removed component is still
+ showing.
+ (paintComponents): Call paint() instead of super.paint().
+ (AccessibleContainerHandler.AccessibleContainerHandler): Added
+ comment.
+ (LightweightDispatcher.acquireComponentForMouseEvent):
+ Don't special case MOUSE_RELEASED events. They should be
+ dispatched unmodified just as MOUSE_PRESSED.
+ (LightweightDispatcher.handleEvent): Also clean up the pressCount
+ after a MOUSE_RELEASE.
+
+2005-11-17 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/BoxView.java:
+ (modelToView): New API method.
+
+2005-11-17 Lillian Angel <langel@redhat.com>
+
+ Fixes PR classpath/PR24721
+ * javax/swing/text/BoxView.java
+ (getViewAtPoint): Added check in to return the last view, if one exists and
+ the point was not contained in the rectangle. This is what the JDK does.
+ * javax/swing/text/CompositeView.java
+ (viewToModel): Fixed API documentation. Added check to make sure
+ x and y are greater than 0. Otherwise, 0 is returned.
+ * javax/swing/text/DefaultCaret.java
+ (moveDot): Added check to match API specs.
+ (setDot): Likewise.
+ * javax/swing/text/GlyphView.java
+ (viewToModel): Removed assert. This is not needed here. The point does not
+ need to be in the rectangle.
+
+2005-11-17 Roman Kennke <kennke@aicas.com>
+
+ Reported by Roman Schnider <schnider@aicas.com>:
+ * java/awt/Component.java
+ (reshape): Removed unused statement.
+ (repaint()): Don't forward to parent when not showing.
+ (repaint(int)): Don't forward to parent when not showing.
+ (repaint(int,int,int,int)): Don't forward to parent when not showing.
+ (repaint(float,int,int,int,int)): Don't forward to parent when not
+ showing.
+
+2005-11-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/AbstractDocument.java
+ (LeafElement.getName): If super.getName() returns something
+ non-null, then return that instead of ContentElementName.
+ * javax/swing/text/ComponentView.java
+ (comp): New field.
+ (getAlignment): Implemented previously stubbed method.
+ (getComponent): Implemented previously stubbed method.
+ (getMaximumSpan): Implemented previously stubbed method.
+ (getMinimumSpan): Implemented previously stubbed method.
+ (getPreferredSpan): Implemented previously stubbed method.
+ (modelToView): Implemented previously stubbed method.
+ (paint): Implemented previously stubbed method.
+ (setParent): Implemented previously stubbed method.
+ (setSize): Removed unneeded method.
+ (viewToModel): Implemented previously stubbed method.
+ * javax/swing/text/FlowView.java
+ (insertUpdate): Forward this event to the logical view.
+ * javax/swing/text/IconView.java
+ (paint): Implemented previously stubbed method.
+ (getPreferredSpan): Implemented previously stubbed method.
+ (modelToView): Implemented previously stubbed method.
+ (viewToModel): Implemented previously stubbed method.
+ * javax/swing/text/ParagraphView.java
+ (firstLineIndent): New field.
+ (justification): New field.
+ (lineSpacing): New field.
+ (tabSet): New field.
+ (changedUpdate): New method.
+ (setPropertiesFromAttributes): New method.
+ (setFirstLineIndent): New method.
+ (setJustification): New method.
+ (setLineSpacing): New method.
+ (getLayoutView): New method.
+ (getLayoutViewCount): New method.
+ (getTabSet): New method.
+
+2005-11-17 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicEditorPaneUI.java:
+ (create): Create new WrappedPlainView instance instead of PlainView.
+
+2005-11-17 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR 24911
+ * classpath/examples/Makefile.am
+ (EXAMPLE_JAVA_FILES): Extended by /*/*/*.java and /*/*/*/*.java.
+ (READMES): New category.
+ (ALL_EXAMPLE_FILES): Extended by READMES category.
+
+2004-11-17 Bryce McKinlay <mckinlay@redhat.com>
+
+ * gnu/java/net/protocol/jar/Connection.java (getHeaderField):
+ Implemented.
+ (getLastModified): Implemented.
+
+2005-11-17 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URLClassLoader.java: Reindented.
+
+2005-11-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JApplet.java
+ (paramString): Returns super.paramString() instead of a meaningless
+ 'JFrame'.
+ * javax/swing/JPanel.java
+ (paramString): Returns super.paramString() instead of a meaningless
+ 'JPanel'.
+
+2005-11-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): Don't handle the Button.rollover property here,
+ this is Metal specific and is handled in MetalButtonUI.
+
+2005-11-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JList.java
+ (locationToIndex): Clarified API comment.
+
+2005-11-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (DefaultTreeCellEditor): Replaced
+ UIManager.getLookAndFeelDefaults().getXXX() with UIManager.getXXX().
+ (createTreeCellEditor): Replaced
+ UIManager.getLookAndFeelDefaults().getXXX() with UIManager.getXXX().
+ * javax/swing/tree/DefaultTreeCellRenderer.java
+ (DefaultTreeCellRenderer): Replaced
+ UIManager.getLookAndFeelDefaults().getXXX() with UIManager.getXXX().
+ (getDefaultOpenIcon): Replaced
+ UIManager.getLookAndFeelDefaults().getXXX() with UIManager.getXXX().
+ (getDefaultClosedIcon): Replaced
+ UIManager.getLookAndFeelDefaults().getXXX() with UIManager.getXXX().
+ (getDefaultLeafIcon): Replaced
+ UIManager.getLookAndFeelDefaults().getXXX() with UIManager.getXXX().
+ (getTreeCellRendererComponent): Replaced
+ UIManager.getLookAndFeelDefaults().getXXX() with UIManager.getXXX().w
+ (paint): Replaced UIManager.getLookAndFeelDefaults().getXXX()
+ with UIManager.getXXX().
+
+2005-11-17 Andrew Haley <aph@redhat.com>
+
+ * gnu/java/net/protocol/file/Connection.java (unquote): New
+ method.
+ (connect): Unquote filename.
+ * gnu/java/net/protocol/jar/Connection.java (get): Likewise.
+
+ * java/net/URL.java (URL): If the file part of a spec is absolute,
+ ignore the file part of its context.
+
+2005-11-17 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * examples/gnu/classpath/examples/CORBA/swing/README.html:
+ Added note about the build.
+
+2005-11-16 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JSplitPane.java: Reformatted file.
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java: Reformatted file.
+
+2005-11-16 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (mouseEntered): No need to start the insideTimer here,
+ already called showTip.
+
+2005-11-16 Lillian Angel <langel@redhat.com>
+
+ Fixes PR classpath/PR24763
+ * javax/swing/ToolTipManager.java
+ (mouseEntered): showTip should be called if exitTimer is running.
+ This means that the mouse has exited and re-entered a component
+ in less than 500ms.
+ (mouseExited): If enterTimer is not running, the exitTimer should
+ be started no matter what.
+ (showTip): Should not show tool tip if the currentComponent is
+ not showing.
+
+2005-11-16 Lillian Angel <langel@redhat.com>
+
+ Fixes PR classpath/PR23557 and PR classpath/PR24099
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable):
+ Added check to determine if dst->drawable or src->drawable
+ are actually drawable. If not, return.
+
+2005-11-16 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (ButtonBorder.paintBorder): Special case the OceanTheme.
+ (ButtonBorder.paintOceanThemeBorder): New method.
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (installDefaults): Set the rollover flag here. Don't set a special
+ border for rollover buttons.
+ (uninstallDefaults): Reset the rollover flag.
+ (update): Only paint gradient when button is enabled and not pressed.
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (getCurrentTheme): New method.
+
+2005-11-16 Gary Benson <gbenson@redhat.com>
+
+ * java/io/FilePermission.java (implies): Correct the sense
+ in which action checks are applied.
+
+2005-11-16 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * AUTHORS: Added myself.
+ * javax/swing/KeyboardManager.java: Changed @author tag to match the
+ other ones I have.
+ * javax/swing/text/WrappedPlainView.java: Likewise.
+
+2005-11-16 Gary Benson <gbenson@redhat.com>
+
+ * java/security/ProtectionDomain.java (toString): Use
+ gnu.classpath.SystemProperties to read line.separator
+ without security manager check.
+
+2005-11-16 Lillian Angel <langel@redhat.com>
+
+ * java/awt/image/MemoryImageSource.java
+ (startProduction): If animated, imageComplete should
+ be called with the SINGLEFRAMEDONE flag, meaning the
+ single frame is complete, but there are more frames
+ to follow.
+
+2005-11-16 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainDocument.java:
+ (insertString): Null check fixes PR 24890.
+
+2005-11-16 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paintVerticalPartOfLeg): Added a check to prevent
+ ArrayOutOfBoundsException.
+
+2005-11-16 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (paintTitleBackground): Only paint background if component is
+ opaque.
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+ (paintPalette): Added gradient painting.
+ (paintComponent): Added gradient painting.
+ * javax/swing/plaf/metal/OceanTheme.java
+ (addCustomEntriesToTable): Added gradient for
+ InternalFrama.activeTitleGradient.
+
+2005-11-16 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java:
+ Removed unneeded fields.
+ (showTip): Re-implemented to use PopupFactory.
+ (hideTip): Likewise.
+ (adjustLocation): Fixed location.
+
+2005-11-16 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainDocument.java:
+ (insertUpdate): The very first new element added doesn't start at the
+ start of the event, it starts at the start offset of the Element that
+ contains the start of the event.
+
+2005-11-16 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paintMenuItem): Always call paintBackground().
+
+2005-11-16 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkDialogPeer.java
+ (create): Since popups were changed to be JWindowPopups,
+ this code should be done in GtkWindowPeer. Code is not
+ needed.
+ * gnu/java/awt/peer/gtk/GtkWindowPeer.java
+ (create): If window is not focusable, it should not take
+ the focus away from any other window. Therefore, its
+ type should be set to GDK_WINDOW_TYPE_HINT_MENU.
+
+2005-11-16 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (update): New method. Paints the gradient.
+ * javax/swing/plaf/metal/MetalCheckBoxIcon.java
+ (paintIcon): Paint gradient.
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (RadioButtonIcon.paintIcon): Paint gradient.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initClassDefaults): Added MetalMenuBarUI.
+ * javax/swing/plaf/metal/MetalMenuBarUI.java: New file.
+ * javax/swing/plaf/metal/MetalToggleButtonUI.java
+ (update): New method. Paints the gradient.
+ * javax/swing/plaf/metal/OceanTheme.java
+ (addCustomEntriesToTable): Added all the gradients.
+
+2005-11-16 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JMenu.java
+ (JMenu()): Set opaque flag to false.
+ (JMenu(String)): Likewise.
+ (JMenu(Action)): Likewise.
+
+2005-11-16 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java
+ (getRowHeight): Adjusted to deal correctly with fixed cell heights.
+ (convertYRoRow): Likewise.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (installDefaults): Don't make the menu item opaque here.
+ (paintBackground): Moved background painting code from
+ paintMenuItem() to this method.
+ (paintMenuItem): Moved background painting to paintBackground().
+ (installDefaults): Don't set opaque flag here.
+
+2005-11-16 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalUtils.java
+ (paintGradient): New utility method(s).
+ (paintHorizontalGradient): New utility method.
+ (paintVerticalGradient): New utility method.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintDoubleBuffered): Put paint() call inside a try-finally
+ block to correctly recover the double-buffering flag when
+ an exception is thrown inside the paint() call.
+
+2005-11-15 Lillian Angel <langel@redhat.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResizable):
+ Needed to set allow_shrink to the same value as resizable. Other-
+ wise, it is always set to false.
+
+2005-11-15 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paint): Added check to prevent NPE.
+
+2005-11-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (removeNotify): Unregister WHEN_IN_FOCUSED_WINDOW bindings from the
+ KeyboardManager.
+
+2005-11-15 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Default rowHeight for tree's should
+ be 0. This is Sun and IBM's default.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Default rowHeight for tree's should
+ e 0. This is Sun and IBM's default.
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Added a default rowHeight field.
+ (setRowHeight): Set the rowHeight to the class default if parameter
+ is 0. Tree row height should never be set to 0. 20 is the minimum.
+ (installDefaults): fixed call to tree.setRowHeight
+ (shouldPaintExpandControl): Added to check to prevent NPE.
+
+2005-11-15 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * examples/gnu/classpath/examples/CORBA/swing/README.html,
+ examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/Player.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/State.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java,
+ examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java:
+ New files.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/UIManager.java
+ (userUIDefaults): New field.
+ (get(Object)): Respect the user UI settings.
+ (get(Object,Locale)): Respect the user UI settings.
+ (getBoolean(Object)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getBoolean(Object,Locale)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getBorder(Object)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getBorder(Object,Locale)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getColor(Object)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getColor(Object,Locale)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getDimension(Object)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getDimension(Object,Locale)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getFont(Object)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getFont(Object,Locale)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getIcon(Object)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getIcon(Object,Locale)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getInsets(Object)): Call get() instead of
+ getLookAndFeelDefaults().getInsets() in order to respect the user UI
+ settings.
+ (getInsets(Object,Locale)): Call get() instead of
+ getLookAndFeelDefaults().getInsets() in order to respect the user UI
+ settings.
+ (getInt(Object)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getInt(Object,Locale)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getString(Object)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getString(Object,Locale)): Call get() instead of
+ getLookAndFeelDefaults().get() in order to respect the user UI
+ settings.
+ (getUI(JComponent)): Respect the user UI settings.
+ (put): Put key/value into user UI settings.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (OptionDialogBorder.paintBorder): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (MetalButtonUI): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+ (installDefaults): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/metal/MetalLabelUI.java
+ (paintDisabledText): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/metal/MetalRadioButtonUI.java
+ (installDefaults): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ (createDecreaseButton): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (createIncreaseButton): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (paintThumbHorizontal): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (paintThumbVertical): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ * javax/swing/plaf/metal/MetalSplitPaneUI.java
+ (createDefaultDivider): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ * javax/swing/plaf/metal/MetalToggleButtonUI.java
+ (installDefaults): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/metal/MetalToolTipUI.java
+ (MetalToolTipUI): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ Removed all listener fields.
+ (installUI): Removed initialization and call super.installUI()
+ instead.
+ (uninstallUI): Removed initialization and call super.uninstallUI()
+ instead.
+
+2005-11-15 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/OrbFunctional.java (serveStep):
+ Returning ensure that the socket is closed.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicBorders.java
+ (getButtonBorder): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ (getRadioButtonBorder): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (getToggleButtonBorder): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (getMenuBarBorder): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (getSplitPaneBorder): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (getSplitPaneDividerBorder): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (getTextFieldBorder): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (getInternalFrameBorder): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (paintText): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/basic/BasicCheckBoxUI.java
+ (getDefaultIcon): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (paintCurrentValue): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/basic/BasicFileChooserUI.java
+ (installStrings): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (installDefaults): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/basic/BasicListUI.java
+ (installKeyboardActions): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ * javax/swing/plaf/basic/BasicProgressBarUI.java
+ (boxRect): Added @since tag to the API comment.
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (getDefaultIcon): Replaced UIManager.getLookAndFeelDefaults().get()
+ with UIManager.get().
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (configureScrollBarColors): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (calculatePreferredSize): Fetch preferred width or height from
+ UI defaults.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (installKeyboardActions): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (createKeymap): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (getInputMap): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (getActionMap): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (dragTo): Don't use cached* fields.
+ (installComponents): Don't use cached* fields.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getHashColor): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ (setHashColor): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+ Added FIXME comment.
+ (installKeyboardActions): Replaced
+ UIManager.getLookAndFeelDefaults().get() with UIManager.get().
+
+2005-11-15 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * native/jni/java-lang/java_lang_VMDouble.c (initIDs): Register
+ clsDouble as global ref.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+ (gtkInit): Register gtkgenericpeer as global ref.
+
+2005-11-15 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Removed unneeded field.
+ (getPathBounds): Reimplemented to use getNodeDimensions.
+ (getRowCount): Removed call to updateCurrentVisiblePath.
+ (uninstallKeyboardActions): Implemented.
+ (paint): Reimplemented to only paint rows contained in clip.
+ No longer uses recursion.
+ (mousePressed): If control icon is clicked, should scroll to that
+ path.
+ (getNodeDimensions): Implemented.
+ (getRowX): Implemented.
+ (getCellBounds): Removed.
+ (getCellLocation): Removed.
+ (paintRecursive): Removed.
+ (paintControlIcons): Removed.
+ (getPreviousVisibleNode): Removed call to updateCurrentVisiblePath.
+ (getLevel): Added check for invisible root.
+ (paintVerticalLine): Set graphics color.
+ (paintHorizontalLine): Likewise.
+ (drawCentered): Added negative check.
+ (drawDashedHorizontalLine): Set graphics color.
+ (drawDashedVerticalLine): Likewise.
+ (paintExpandControl): Implemented.
+ (paintHorizontalPartOfLeg): Likewise.
+ (paintVerticalPartOfLeg): Likewise.
+ (paintRow): Added call to paint the control icons.
+ (updateCurrentVisiblePath): Cleaned up function.
+
+2005-11-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (remove): Do not set up an ElementEdit here, this is done in the
+ Document implementation's removeUpdate method.
+ * javax/swing/text/PlainDocument.java:
+ (insertUpdate): Do not call reindex, instead, reindex the lines here
+ directly but only starting from the offset of the newly inserted text.
+ Also, if entire lines have been added or removed, set up an ElementEdit
+ and add it to the DocumentEvent. Chain BadLocationException to an
+ AssertionError and throw it in the unexpected case.
+ (removeUpdate): If entire lines have been added or removed, set up an
+ ElementEdit and add it to the DocumentEvent. Chain
+ BadLocationException to an AssertionError and throw it in the
+ unexpected case.
+ (reindex): Removed unnecessary method.
+
+2005-11-15 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/DateTimeSyntax.java,
+ * javax/print/attribute/EnumSyntax.java,
+ * javax/print/attribute/IntegerSyntax.java,
+ * javax/print/attribute/URISyntax.java:
+ Added and enhances some api docs.
+
+2005-11-15 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java:
+ Code written by Sven de Marothy.
+ (gtkWindowGetLocationOnScreen): Added declaration
+ for native function.
+ (getLocationOnScreen): Changed to handle 2 different cases.
+ If the component is a window, gtkWindowGetLocationOnScreen is
+ called; otherwise, gtkWidetGetLocationOnScreen.
+ * include/gnu_java_awt_peer_gtk_GtkComponentPeer.h:
+ Added signature for new function Java_gnu_java_awt_peer_
+ gtk_GtkComponentPeer_gtkWindowGetLocationOnScreen.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen):
+ Implemented.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (JViewport): Recognize setting of a system property
+ gnu.javax.swing.JViewport for the scrollMode.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalUtils.java
+ (fillMetalPattern2D): Fixed the texture width.
+ (initializePattern): Made texture transparent.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTextField.java
+ (createDefaultModel): Set the filterNewlines property on the created
+ model.
+
+2005-11-15 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java
+ Fixed API docs all over to better explain the changed (but correct)
+ behaviour.
+ (convertYToRow): Added some short-circuits for special cases. Update
+ the layout state if necessary. Fixed to match the JDK behaviour.
+ Added API docs to better explain the behaviour.
+ (updateLayoutState): When a fixedCellHeight is set, then use the
+ cellHeight field, otherwise use the cellHeights array.
+ (uninstallDefaults): Removed unnecessary statement.
+ (paintBackground): Removed unnecessary method.
+ (paintCell): Removed some commented-out code.
+ (paint): Removed call to paintBackground().
+ (locationToIndex): Removed unused statement.
+
+2005-11-14 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/AttributeSetUtilities.java:
+ Added api docs and enhanced api docs all over the place.
+ (verifyCategoryForValue): Throw exception when arguments
+ are _not_ equal and throw NPE also if attribute is null.
+
+2005-11-14 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java
+ (getLocationOnScreen): The insets should be taken into account
+ when returning the location of an object on the screen.
+
+2005-11-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JMenuBar.java:
+ (removeNotify): Unregister this JMenuBar from the KeyboardManager.
+ * javax/swing/KeyboardManager.java:
+ (unregisterJMenuBar): New implementation method.
+
+2005-11-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (removeNotify): Removed unncessary InputMap and ActionMap inheritance
+ code. Added FIXME to remove the WHEN_IN_FOCUSED_WINDOW bindings from
+ the KeyboardManager.
+ * javax/swing/JMenuBar.java:
+ (removeNotify): Added FIXME to unregister this JMenuBar from the
+ KeyboardManager.
+
+2005-11-14 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/HashAttributeSet.java:
+ Added api docs to class and clarified method documentation.
+ (toArray): Get iterator from values instead of entries.
+ (hashCode): Compute hashcode according to specification.
+ (get): Throw NullPointerException if category is null.
+ (HashAttributeSet(Attribute[],Class)): Changed to allow
+ Attribute[] to be null.
+
+2005-11-14 Mark Wielaard <mark@klomp.org>
+
+ As suggested by Joao Victor <jvital@gmail.com>:
+ * javax/swing/Timer.java (Waker): Removed class.
+ (Task): New class.
+ (timer): New field.
+ (running): Removed field.
+ (waker): Likewise.
+ (task): New field.
+ (isRunning): Check whether task is null.
+ (start): Create task and schedule it with timer.
+ (stop): Cancel task and clear field.
+ (queueEvent): Synchronized on queueLock.
+
+2005-11-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (expandPath): No need to get the parent path.
+ * javax/swing/event/TreeModelEvent.java:
+ Variables should be initialized to null.
+ (toString): Implemented.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (treeStructureChanged): Implemented.
+ (getParent): Added check to avoid infinite loop.
+ (findNode): Fixed check to use getChild, instead of
+ getIndexOfChild.
+ (updateCurrentVisiblePath): Added a loop to check
+ the parent's sibling, if the current node has no
+ other siblings.
+
+2005-11-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/ActionMap.java:
+ (keys): Return null if the map is empty.
+ (allKeys): Likewise.
+ * javax/swing/InputMap.java:
+ (keys): Return null if the map is empty.
+ (allKeys): Likewise.
+ * javax/swing/JMenuBar:
+ (addNotify): Register the menu with the KeyboardManager.
+ (processKeyBinding): New API method.
+ (processKeyBindingHelper): New implementation method.
+ * javax/swing/JMenuItem.java:
+ (setAccelerator): Fire a PropertyChangeEvent after changing the
+ accelerator.
+ * javax/swing/KeyboardManager.java:
+ (menuBarLookup): New field, Hashtable mapping between top-level
+ containers and a Vector of the JMenuBars contained in them.
+ (getHashtableForTopLevel): Changed this public method to package
+ private.
+ (registerEntireMap): Avoid NPE by returning early if the parameter
+ is null or contains no mappings.
+ (processKeyStroke): If the mapped component doesn't consume the event,
+ let all JMenuBars in the top-level container have a chance at it.
+ (getVectorForTopLevel): New implementation method.
+ (registerJMenuBar): Likewise.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ (propertyChangeListener): New field.
+ (PropertyChangeHandler): New class to handle PropertyChangeEvents on
+ the JMenuItem.
+ (ClickAction): New class to implement accelerator key handling.
+ (BasicMenuItemUI<init>): Instantiate the propertyChangeListener field.
+ (installKeyboardActions): Implemented.
+ (installListeners): Install the propertyChangeListener.
+ (installUI): Call installKeyboardAcions after installing the listeners.
+ (uninstallKeyboardActions): Implemented.
+ (uninstallListeners): Remove the propertyChangeListener.
+
+2005-11-14 Tom Tromey <tromey@redhat.com>
+
+ * java/applet/Applet.java (URLAudioClip): New class.
+ (newAudioClip): Implemented.
+ * gnu/java/beans/DummyAppletContext.java (getAudioClip): Use
+ Applet.newAudioClip.
+ (DUMMY_CLIP): Removed.
+ (DummyAudioClip): Removed.
+
+2005-11-14 Tom Tromey <tromey@redhat.com>
+
+ * javax/sound/sampled/Line.java (open): Throws
+ LineUnavailableException.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ Reported by Ingo Proetel <proetel@aicas.com>
+ * gnu/java/io/PlatformHelper.java
+ (toCanonicalForm): Remove lowercasing of paths in Windows. This
+ breaks working with URLs, like when accessing files withing JAR
+ files.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLayeredPane.java
+ (paint): Only clear the background if the layeredPane is opaque.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/RepaintManager.java
+ (globalManager): Removed obsolete field.
+ (currentRepaintManagers): New field.
+ (RepaintWorker.run): Fetch current RepaintManager for the current
+ thread group.
+ (currentManager): Return the current manager for the current thread
+ group.
+ (setCurrentManager): Set the repaint manager for the current thread
+ group.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ (show): Instead of fiddling with the list size, set the preferredSize
+ of the scroller.
+ (configureScroller): Set border to null.
+ (configurePopup): Set border correctly.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (setButtonIcons): Only set icons if buttons are != null.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Fixed some UI defaults used by ProgressBar.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextFieldUI.java
+ (propertyChange): Get new value from the PropertyChangeEvent and
+ not from the component itself (since when it receives the event,
+ the component still has the old state).
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (uninstallListeners): Uninstall the document listener here.
+ (getVisibleEditorRect): Fetch the textComponent via getComponent().
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/BoxView.java
+ (paint): Only paint child if it is inside the current clip.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ (setEnabled): Also set focusable flag on the button when the enabled
+ property changes.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicProgressBarUI.java
+ (boxRect): New protected field.
+ (PropertyChangeHandler.propertyChange): Fixed typo in 'indeterminate'.
+ Only start animation when progressBar is actually showing. Removed
+ repaint call.
+ (AncestorHandler): New inner class. Helps starting/stopping the
+ animation when progressBar becomes showing/hidden.
+ (ComponentHandler): New inner class. Recalculates box sizes for
+ indeterminate progress bars when the size of the progress bar
+ changes.
+ (boxRect): New protected field.
+ (boxDependent): New transient field.
+ (boxIndependent): New transient field.
+ (incr): New transient field.
+ (ancestorListener): New private field.
+ (componentListener): New private field.
+ (getBox): Fixed calculation of the indeterminate progress bar box
+ to match the JDK behaviour.
+ (getMaximumSize): Implemented the maximumSize for progressBars.
+ (getMinimumSize): Implemented the minimumSize for progressBars.
+ (getPreferredInnerHorizontal): Implemented correctly.
+ (getPreferredInnerVertical): Implemented correctly.
+ (getPreferredSize): Implemented correctly using the getPreferredXXX()
+ helper methods.
+ (paintDeterminate): Fixed painting to better match the JDK behaviour.
+ (paintIndeterminate): Fixed painting to better match the JDK behaviour.
+ (paintString): Implemented 'half-dark-half-light' painted text.
+ (installListeners): Install new listeners.
+ (uninstallListeners): Uninstall new listeners.
+ * javax/swing/plaf/basic/MetalProgressBarUI.java
+ (paintDeterminate): New method.
+ (paintIndeterminate): New method.
+
+2005-11-14 Roman Kennke <kennke@aicas.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (static_initializer): Set the L&F and theme explicitly for the
+ default option, because JDK1.4 and JDK1.5 have different defaults.
+ (mkMenuBar): For the slider demo, trigger the new SliderDemo
+ class. Added ProgressBarDemo to menu.
+ (mkSliders): Removed obsolete slider demo.
+ (mkButtonBar): Added ProgressBar demo.
+ * examples/gnu/classpath/examples/swing/ProgressBarDemo.java:
+ New file. Demonstrates the JProgressBar.
+
+2005-11-13 Archie Cobbs <archie@dellroad.org>
+
+ * vm/reference/gnu/classpath/VMStackWalker.java (getClassLoader()):
+ added to fix an infinite loop bug.
+ * NEWS: note VM interface change.
+
+2005-11-13 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ Fixes bug #23008
+ * gnu/java/nio/charset/UTF_16Decoder.java
+ MAYBE_BIG_ENDIAN, MAYBE_LITTLE_ENDIAN: New constants representing
+ such endianness which is similar to UNKNOWN_ENDIAN but defaults
+ to big/little endian without a byte order mark.
+ (decodeLoop): Handle MAYBE_BIG_ENDIAN and MAYBE_LITTLE_ENDIAN.
+ * gnu/java/nio/charset/UnicodeLittle.java
+ (newDecoder): Set the endianness to MAYBE_LITTLE_ENDIAN.
+
+2005-11-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR 24733
+ * javax/swing/TransferHandler.java (getClipboard): Rewritten.
+
+2005-11-13 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/HashDocAttributeSet.java,
+ * javax/print/attribute/HashPrintJobAttributeSet.java,
+ * javax/print/attribute/HashPrintRequestAttributeSet.java,
+ * javax/print/attribute/HashPrintServiceAttributeSet.java,
+ Added class api docs and enhanced method api docs.
+
+2005-11-13 Tom Tromey <tromey@redhat.com>
+
+ * native/jni/midi-dssi/.cvsignore: Updated.
+ * native/jni/midi-alsa/.cvsignore: New file.
+ * lib/.cvsignore: Updated.
+
+2005-11-13 Tom Tromey <tromey@redhat.com>
+
+ * javax/sound/sampled/AudioFileFormat.java: New file.
+ * javax/sound/sampled/AudioFormat.java: New file.
+ * javax/sound/sampled/AudioInputStream.java: New file.
+ * javax/sound/sampled/AudioPermission.java: New file.
+ * javax/sound/sampled/AudioSystem.java: New file.
+ * javax/sound/sampled/BooleanControl.java: New file.
+ * javax/sound/sampled/Clip.java: New file.
+ * javax/sound/sampled/CompoundControl.java: New file.
+ * javax/sound/sampled/Control.java: New file.
+ * javax/sound/sampled/DataLine.java: New file.
+ * javax/sound/sampled/EnumControl.java: New file.
+ * javax/sound/sampled/FloatControl.java: New file.
+ * javax/sound/sampled/LineEvent.java: New file.
+ * javax/sound/sampled/Line.java: New file.
+ * javax/sound/sampled/LineListener.java: New file.
+ * javax/sound/sampled/LineUnavailableException.java: New file.
+ * javax/sound/sampled/Mixer.java: New file.
+ * javax/sound/sampled/Port.java: New file.
+ * javax/sound/sampled/ReverbType.java: New file.
+ * javax/sound/sampled/SourceDataLine.java: New file.
+ * javax/sound/sampled/spi/AudioFileReader.java: New file.
+ * javax/sound/sampled/spi/AudioFileWriter.java: New file.
+ * javax/sound/sampled/spi/FormatConversionProvider.java: New file.
+ * javax/sound/sampled/spi/MixerProvider.java: New file.
+ * javax/sound/sampled/TargetDataLine.java: New file.
+ * javax/sound/sampled/UnsupportedAudioFileException.java: New file.
+
+2005-11-13 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/EnumSyntax.java:
+ API docs added and enhanced for class and methods.
+ (readResolve): New method.
+
+2005-11-13 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/attribute/Attribute.java,
+ javax/print/attribute/AttributeSet.java,
+ javax/print/attribute/DocAttribute.java,
+ javax/print/attribute/DocAttributeSet.java,
+ javax/print/attribute/PrintJobAttribute.java,
+ javax/print/attribute/PrintJobAttributeSet.java,
+ javax/print/attribute/PrintRequestAttribute.java,
+ javax/print/attribute/PrintRequestAttributeSet.java,
+ javax/print/attribute/PrintServiceAttribute.java,
+ javax/print/attribute/PrintServiceAttributeSet.java,
+ javax/print/attribute/SupportedValuesAttribute.java,
+ javax/print/attribute/UnmodifiableSetException.java:
+ Added api documentation to class and method definitions.
+ * javax/print/attribute/package.html: Included a package description.
+
+2005-11-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Interceptor/gnuIorInfo.java (state): Made public.
+ * gnu/CORBA/Interceptor/gnuServerRequestInfo.java
+ (adapter_name, orb_id, server_id): New methods.
+ * org/omg/PortableInterceptor/IORInfoOperations.java
+ (state): New method.
+ * org/omg/PortableInterceptor/ServerRequestInfoOperations.java
+ (adapter_name, orb_id, server_id): New methods.
+
+2005-11-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR 24749
+ * javax/swing/plaf/basic/BasicTextUI.java (installDefaults):
+ Call setSelectionColor.
+
+2005-11-12 Wolfgang Baer <WBaer@gmx.de>
+
+ * java/io/ObjectInputStream.java
+ (processResolution): Pass Error, RuntimeException and
+ ObjectStreamException through to the caller.
+ (readObject): Documentation update.
+
+2005-11-11 Mark Wielaard <mark@klomp.org>
+ Anthony Green <green@redhat.com>
+
+ * java/util/Properties.java (load): Short-circuit parsing when key or
+ value doesn't contain escape character. Use StringBuilder instead of
+ StringBuffer.
+ (store): Use StringBuilder instead of StringBuffer.
+ (formatForOutput): Likewise.
+
+2005-11-11 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (getMinimumDividerLocation): Fixed to use the minimum size
+ of the correct component. Also, removed call to getAvailableSize,
+ this is not needed for the minimum location.
+
+2005-11-11 Archie Cobbs <archie@dellroad.org>
+
+ * autogen.sh: Fix broken libtool version detection on FreeBSD.
+
+2005-11-11 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Container.java
+ (LightweightDispatcher.acquireComponentForMouseEvent): If the
+ event is not being dispatched, the pressCount should be reset.
+
+2005-11-11 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/text/FieldView.java (getPreferredSpan): Chain
+ BadLocationException when throwing assertion.
+
+2005-11-11 Mark Wielaard <mark@klomp.org>
+
+ Reported by john.zigman@anu.edu.au as bug #24608.
+ * gnu/java/nio/SocketChannelImpl.java (read): Put readBytes in
+ destination ByteBuffer when it doesn't have an array instead of len
+ bytes.
+
+2005-11-11 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/IORInterceptor_3_0.java,
+ org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java,
+ org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java,
+ org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java,
+ org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java: New files.
+ * gnu/CORBA/Interceptor/IORInterceptors.java,
+ gnu/CORBA/Interceptor/gnuIorInfo.java,
+ gnu/CORBA/OrbRestricted.java,
+ gnu/CORBA/Poa/AOM.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Poa/gnuPOA.java,
+ gnu/CORBA/Poa/gnuPOAManager.java,
+ org/omg/PortableInterceptor/IORInfoOperations.java,
+ org/omg/PortableInterceptor/IORInterceptorOperations.java,
+ org/omg/PortableInterceptor/ORBInitInfoOperations.java,
+ org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java:
+ Rewritten to support the IORInterceptor_3_0.
+
+2005-11-10 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/metal/MetalRadioButtonUI.java
+ (paintFocus): Centered border around rectangle. It seemed
+ a bit offset and too small at times.
+
+2005-11-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java
+ (valueChanged): Repaint list when selection changed.
+ (updateLayoutState): Reworked to correctly respect fixed cell sizes.
+ (installListeners): Create component listener before adding it.
+ (paint): Optimized to only draw the cells in the clip.
+
+2005-11-10 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (processKeyEvent): Reworked this method to improve performance. Return
+ early if the event has already been handled. Don't stop climbing when
+ we hit a JInternalFrame, only stop at Applets or Windows (this fixes
+ PR 24781). Don't check WHEN_IN_FOCUSED_WINDOW bindings if there is no
+ top-level container present. If there is a top-level container, pass
+ it to KeyboardManager.processKeyStroke rather than the JComponent that
+ actually received the event, to save time in finding the top-level
+ container within KeyboardManager.
+ * javax/swing/KeyboardManager.java:
+ (findTopLevel): Changed parameter from JComponent to Component to allow
+ generality and to allow passing in of already-determined top-level
+ containers to save time.
+ (processKeyStroke): Likewise.
+
+2005-11-10 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #24731 reported by freebeans@xqb.biglobe.ne.jp.
+ * java/awt/ScrollPane.java (addNotify): Return immediately when peer
+ already set.
+
+2005-11-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installListeners): Also install focusListener on the listBox.
+ (uninstallListeners): Also uninstall focusListener from the listBox.
+ (setPopupVisible): Request focus on the listbox when making the
+ popup visible.
+
+2005-11-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintingTile): New field.
+ (isPaintingTile): Implemented.
+ (paintChildren): Optimized painting of overlapping children.
+
+2005-11-10 Mark Wielaard <mark@klomp.org>
+
+ Reported by Petteri <betelgeuse@gentoo.org> bug #24768 and bug #24769.
+ * configure.ac (dssi): Change accidental alsa reference to dssi.
+ * native/jni/midi-dssi/Makefile.am (libgjsmdssi_la_SOURCES): Add
+ dssi_data.h.
+
+2005-11-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/OrbFunctional.java (use_properties, set_parameters):
+ Rewritten to support orb and server ids.
+ * org/omg/CORBA/ORB.java,
+ org/omg/PortableInterceptor/ObjectReferenceTemplate.java:
+ Documentation update.
+
+2005-11-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (addNotify): Unregister all WHEN_IN_FOCUSED_WINDOW bindings for this
+ JComponent and then register them with its (potentially) new top level
+ ancestor. Removed unncessary code that copied regular (WHEN_FOCUSED)
+ key bindings up the parent hierarchy.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ Reported by Friedjof Siebert <siebert@aicas.com>
+ * java/util/WeakHashMap.java
+ (WeakEntrySet.Iterator.checkMod): Improved exception message.
+ (internalRemove): Removed redundant reads of buckets[slot] and
+ prev.next and added checks to ensure that no null pointer
+ exception may occur and that this can be proved automatically.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ Reported by Friedjof Siebert <siebert@aicas.com>
+ * java/io/PrintWriter.java
+ (line_separator): Added default value for property to ensure
+ absence of null pointer exception even if property is not set.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ * java/io/InputStreamReader.java
+ (InputStreamReader(InputStream, CharsetDecoder)): Catch the case
+ when the CharsetDecoder returns a null charset and handle it like
+ US-ASCII.
+
+2005-11-09 Mark Wielaard <mark@klomp.org>
+
+ Reported by Petteri Räty <betelgeuse@gentoo.org>
+ * INSTALL: Remove double --enable-xmlj entry.
+
+2005-11-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JComponent.java:
+ (processKeyEvent): Use local variables for boolean pressed and for
+ the KeyStroke. Implemented the code for WHEN_IN_FOCUSED_WINDOW
+ bindings.
+ (updateComponentInputMap): Implemented and fixed typo in docs.
+ * javax/swing/KeyboardManager.java: New class.
+
+2005-11-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTabbedPane.java
+ (setComponent): Tab should be inserted with a title, and removed from
+ the vector once set.
+ (removeTabAt): Tab should only be removed from vector.
+ remove(Component) is called to remove the tab from the JTabbedPane.
+ (remove): Added call to the component. This function should remove
+ the component as well as the tab.
+
+2005-11-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTabbedPane.java
+ (setComponent): No need to remove and add tab.
+ (remove): Fixed API documentation.
+ (remove): Fixed API documentation. Re-implemented according to API.
+
+2005-11-09 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/cp-tools/cp-tools.wml: Add gjdoc download link.
+
+2005-11-09 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/aelfred2/SAXDriver.java: Ensure that absolutize does not
+ throw exception when custom entity resolver is set.
+
+2005-11-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/event/InvocationEvent.java:
+ (exception): Replaced this field (removed yesterday) because it is
+ needed for serialization.
+ (dispatch): Save thrown exception.
+ (getException): Directly return exception, no need to cast throwable.
+
+2005-11-09 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/ComponentInputMap.java:
+ (put): Notify the component.
+ (clear): Likewise.
+ (remove): Likewise.
+ (setParent): Notify the parent. Improved the exception messages.
+ * javax/swing/JComponent.java:
+ (inputMap_whenInFocusedWindow): Changed type from InputMap to
+ ComponentInputMap.
+ (setInputMap): If we're setting the WHEN_IN_FOCUSED_WINDOW map and
+ the parameter is not a ComponentInputMap or is not associated with
+ the same Component, throw an IllegalArgumentException.
+ (getInputMap): Create a new ComponentInputMap instead of a new
+ InputMap when the WHEN_IN_FOCUSED_WINDOW map doesn't yet exist.
+ (udpateComponentInputMap): New method. This is the method that
+ ComponentInputMap calls when it is updated. Not yet completely
+ implemented.
+
+2005-11-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java,
+ org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java:
+ New files.
+
+2005-11-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectReferenceTemplate.java,
+ org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java,
+ org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java:
+ New files.
+
+2005-11-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTabbedPane.java
+ (setComponent): Added check to prevent infinite loops.
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java
+ (createLayoutManager): Should call super here, so the layout
+ is set properly depending on the layout mode.
+
+2005-11-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkMenuBar): added file chooser item,
+ (mkButtonBar): split buttons into two rows, added 'FileChooser' button,
+ * examples/gnu/classpath/examples/swing/FileChooserDemo.java: New file.
+
+2005-11-09 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectReferenceFactory.java: Do not
+ inherit from org.omg.CORBA.Object.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/ComponentUI.java
+ (update): Restore the foreground color after filling the background.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Fetch a new componentGraphics here instead of
+ paintComponent.
+ (paintComponent): Don't fetch the componentGraphics here. This
+ must be done in paint.
+
+2005-11-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JList.java
+ (setModel): throw IllegalArgumentException for null model.
+
+2005-11-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (getVisibleEditorRect): Correctly calculate the inner rectangle.
+
+2005-11-09 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+ (initStaticState): Register global variable glyphVector_class
+ as global reference.
+
+2005-11-08 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/text/DefaultCaret.java (BlinkTimerListener):
+ Added ignoreNextEvent flag and its handling.
+ (blinkListener): New field. (initBlinkTimer):
+ Initialise blinkListener field.
+ (setDot, moveDot): Call appear() instead of repaint().
+ (appear): new method.
+
+2005-11-08 Lillian Angel <langel@redhat.com>
+
+ * examples/gnu/classpath/examples/swing/GNULookAndFeel.java
+ (getDefaults): Added icons for checkboxes and radiobutton.
+ (CheckBoxIcon): New class, implemented.
+ (RadioButtonIcon): New class, implemented.
+
+2005-11-08 Tom Tromey <tromey@redhat.com>
+
+ * gnu/classpath/SystemProperties.java: Don't mention
+ gnu.java.awt.FocusManager.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/CompositeView.java
+ (modelToView): Adjust the allocation to the child allocation before
+ forwarding to the child's modelToView. Replaced AssertionError by
+ BadLocationException, because that is the right thing to do here.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (GlassPaneDispatcher.acquireComponentForMouseEvent): Use the
+ frame's layeredPane as parent instead of the content pane
+ when searching for the event target. This way a possibly set menubar
+ is also included in the search.
+
+2005-11-08 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Window.java
+ (setLocationRelativeTo): Changed x and y to use getLocationOnScreen
+ and moved setLocation call outside of check.
+ * javax/swing/JOptionPane.java
+ (createDialog): Moved pack call and setLocationRelativeTo call here
+ and removed these calls from all other functions that call
+ createDialog. Also, removed FIXME, since call to setLocationRelativeTo
+ fixes this.
+ (showConfirmDialog): Removed pack and setLocationRelativeTo calls.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showOptionDialog): Likewise.
+ * javax/swing/JTree.java
+ (JTree): Should not use a shared instance of the selection model. It
+ is a problem when one application has two different trees.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paintRow): Changed parameter to be the focus of the tree.
+ (updateCurrentVisiblePath): Adjusted root path incase the root is hidden.
+
+2005-11-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/event/InvocationEvent.java:
+ (exception): Removed unnecessary field.
+ (dispatch): Removed reference to field exception.
+ (getException): If throwable is an Exception, return a casted version,
+ otherwise return null.
+ (getThrowable): Improved docs.
+
+2005-11-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/SwingUtilities.java:
+ (replaceUIActionMap): Stop climbing hierarchy once we've found an
+ ActionMapUIResource, don't keep looking until parent is null. No need
+ to check if child is null.
+ (replaceUIInputMap): Use a local variable for the parent rather than
+ 3 calls to get parent. No need to check if child is null.
+ * javax/swing/plaf/basic/BasicListUI.java:
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ (installKeyboardActions): UI ActionMap should be of type
+ ActionMapUIResource, not just ActionMap.
+
+2005-11-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/DefaultStyledDocument.java:
+ (ElementBuffer.clone): New API method.
+
+2005-11-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/lang/String.java:
+ (replace): Use a StringBuilder instead of a StringBuffer because this
+ is faster and we don't need thread-safety.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installDefaults): Initialize background field correctly.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/BorderLayout.java
+ (getAlignmentX): Return 0.5F here.
+ (getAlignmentY): Return 0.5F here.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JRootPane.java
+ (RootLayout.glassPaneBounds): New field.
+ (RootLayout.layeredPaneBounds): New field.
+ (RootLayout.contentPaneBounds): New field.
+ (RootLayout.menuBarBounds): New field.
+ (RootLayout.prefSize): New field.
+ (getLayoutAlignmentX): Return 0.0F here.
+ (getLayoutAlignmentY): Return 0.0F here.
+ (invalidateLayout): Throw away cached layout information.
+ (layoutContainer): Simplified and fixed the layout. Use cache if
+ possible.
+ (preferredLayoutSize): Simplified and fixed the layout. Use cache if
+ possible.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (alignmentX): Changed default value to -1.0.
+ (alignmentY): Changed default value to -1.0.
+ (getAlignmentX): If no value has been set, refer to the superclass
+ behaviour.
+ (getAlignmentY): If no value has been set, refer to the superclass
+ behaviour.
+ (setAlignmentX): Catch invalid values and adjust them to the nearest
+ valid value.
+ (setAlignmentY): Catch invalid values and adjust them to the nearest
+ valid value.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Container.java
+ (getAlignmentX): Refer to the layout managers layoutAlignmentX
+ property if layout manager is a LayoutManager2.
+ (getAlignmentY): Refer to the layout managers layoutAlignmentY
+ property if layout manager is a LayoutManager2.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLayeredPane.java
+ (layerToRange): Return empty array for unknown layer instead of
+ throwing an exception.
+
+2005-11-08 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (invalidate): Don't invalidate invalid parents.
+
+2005-11-08 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/JComponent.java (setMaximumSize,
+ setMinimumSize, setPreferredSize): Clone the passed parameter.
+
+2005-11-07 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (invalidate): Invalidate up the whole tree, regardless if some
+ parent is already marked invalid. This is needed in some situations
+ for layout managers to throw away their cache.
+
+2005-11-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTable.java
+ (tableChanged): Cleared selection if there are no more rows. Prevents a
+ NPE.
+ * javax/swing/JTree.java
+ (scrollRectToVisible): No need to set the selection path here.
+ (expandPath): Sometimes it is required to set the state of a leaf,
+ especially if the leaf is the root node.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getRowCount): Added call to updateCurrentVisiblePath, so the
+ correct value is always returned.
+ (paint): No need to paint if the visible path is null.
+ (propertyChange): Implemented.
+ (paintRecursive): Added check for visibility of child. If it is
+ not visible because it was explicitly set to be hidden, no lines
+ should be drawn.
+ (paintControlIcons): Likewise.
+ (getPreviousNode): Fixed check to include root.
+ (paintRow): Set focus to be true (this will change in the future).
+ (updateCurrentVisiblePath): Fixed check to call getNextNode if
+ the current node is a leaf (more efficent than calling getNextSibling).
+ * javax/swing/tree/DefaultTreeCellRenderer.java
+ (getTreeCellRendererComponent): Changed to draw border if node has focus.
+
+2005-11-07 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ Fixes bug #24467
+ * native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
+ (Java_gnu_java_nio_charset_iconv_IconvDecoder_decode):
+ Do not check errno == EINVAL, which is a normal case.
+
+2005-11-07 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ Fixes bug #22968
+ * gnu/java/nio/charset/iconv/IconvProvider.java
+ (IconvProvider): Declare the constructor public.
+
+2005-11-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JApplet.java
+ (initStageDone): Removed unnecessary field.
+ (JApplet): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ * javax/swing/JDialog.java
+ (initStageDone): Removed unnecessary field.
+ (dialogInit): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ * javax/swing/JFrame.java
+ (initStageDone): Removed unnecessary field.
+ (frameInit): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ * javax/swing/JWindow.java
+ (initStageDone): Removed unnecessary field.
+ (windowInit): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ * javax/swing/JInternalFrame.java
+ (initStageDone): Removed unnecessary field.
+ (JInternalFrame): Use rootPaneCheckingEnabled property instead of
+ initStageDone field.
+ (setLayout): Likewise.
+ (addImpl): Likewise.
+ (paramString): Return superclass paramstring.
+ (reshape): Call revalidate() instead of invalidate() and doLayout().
+ (setUI): Temporarily go into init mode, so that the UI can
+ manipulate the frame directly.
+ (updateUI): Likewise.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/lang/String.java:
+ (replace): Use a StringBuffer instead of String. Only search for new
+ occurrences of the target that occur AFTER the text just inserted, so
+ if the replacement string contains the target string we won't go into
+ an infinite loop. Use local variables instead of repeated calls to
+ length() and toString().
+
+2005-11-07 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c:
+ Use long for 64-bit architectures.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/util/Arrays.java:
+ (toString(long[])): New API method.
+ (toString(int[])): Likewise.
+ (toString(short[])): Likewise.
+ (toString(char[])): Likewise.
+ (toString(byte[])): Likewise.
+ (toString(boolean[])): Likewise.
+ (toString(float[])): Likewise.
+ (toString(double[])): Likewise.
+ (toString(Object[])): Likewise.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/event/InvocationEvent.java:
+ (throwable): New field.
+ (getThrowable): New API method.
+ (dispatch()): Catch Throwable, not Exception. Save the Throwable. If
+ it is an Exception, save the Exception.
+
+2005-11-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/Popup.java
+ (show): Set layout for panel. Otherwise, contents are
+ displayed at an arbitrary location.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (getPreferredMenuItemSize): Took into account insets.
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (paintFocus): Don't paint focus if not enabled.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/lang/String.java:
+ (contains): New API method.
+ (replace): New API method.
+
+2005-11-07 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/lang/Boolean.java:
+ (compareTo(Boolean)): New API method.
+
+2005-11-07 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): update local reference to editor component always,
+ (getDisplaySize): implement new calculation for editable combo boxes,
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java
+ (editorBorderInsets): initialise with correct value,
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ (getMinimumSize): implemented different calculation for editable combo
+ boxes.
+
+2005-11-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JOptionPane.java
+ (showConfirmDialog): Added call to set the location of the
+ dialog relative to its parent.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showInputDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showMessageDialog): Likewise.
+ (showOptionDialog): Likewise.
+
+2005-11-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (getPreferredMenuItemSize): Adjusted width of menu item with
+ arrow icon. If the menu item can fit in the current width of
+ the top level menu, then the width of the menu item is set to
+ the width of the popup menu. Otherwise, the width of the
+ menu item is adjusted so that the width of the popup menu
+ is increased.
+
+2005-11-07 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Don't check or replace FREETYPE2.
+ * native/jni/gtk-peer/Makefile.am: Remove FREETYPE2_LIBS and
+ FREETYPE2_CFLAGS.
+
+2005-11-07 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java
+ (MetalComboBoxEditor): don't create new editor.
+
+2005-11-07 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxEditor.java: API docs plus
+ (BasicComboBoxEditor): set border to null and columns to 9,
+ (addActionListener): implemented,
+ (removeActionListener): implemented.
+
+2005-11-07 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/IOR.java (equals, hasCode): Compare port number as well
+ and do not crash on IOR.Internet==null.
+
+2005-11-06 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/Timer.java (Waker.run): Test and set running while
+ holding queueLock.
+ (start): Set running to true.
+ (stop): Unconditionally notify queueLock.
+ (queueEvent): Only called when queueLock already held.
+
+2005-11-06 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked): Update
+ debug output to reflect actual situation.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked):
+ Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels): Adjust
+ formatting.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked):
+ Update debug output to reflect actual situation.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked):
+ Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo): Adjust
+ formatting.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo): Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle): Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked):
+ Update debug output to reflect actual situation.
+
+2005-11-06 Mark Wielaard <mark@klomp.org>
+
+ * java/awt/image/AreaAveragingScaleFilter.java: Add FIXME
+ * java/awt/Image.java (getScaledInstance): In case of
+ SCALE_AREA_AVERAGING use AreaAveragingScaleFilter.
+
+2005-11-06 Wolfgang Baer <WBaer@gmx.de>
+
+ * javax/print/event/PrintEvent.java,
+ * javax/print/event/PrintJobAdapter.java,
+ * javax/print/event/PrintJobAttributeEvent.java,
+ * javax/print/event/PrintJobAttributeListener.java,
+ * javax/print/event/PrintJobEvent.java,
+ * javax/print/event/PrintJobListener.java,
+ * javax/print/event/PrintServiceAttributeEvent.java,
+ * javax/print/event/PrintServiceAttributeListener.java,
+ * javax/print/event/package.html: Added API docs all over.
+
+2005-11-06 Wolfgang Baer <WBaer@gmx.de>
+
+ * java/io/File.java
+ (getParent): If pathname is "" return null.
+ (toURI): Also append separatorChar if path equals "".
+ (getAbsolutePath): If path equals "" only return the value
+ of the user.dir system property.
+
+2005-11-06 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/stream/XMLStreamWriterImpl.java: Ensure that generated
+ prefixes do not accidentally clash, and provide documentation for
+ new virtual methods. createPrefix (new method) signature changed to
+ provide namespace URI for the benefit of subclasses.
+
+2005-11-06 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/transform/StreamSerializer.java: Avoid undeclared apos
+ entity when output mode is HTML.
+
+2005-11-06 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/IOR.java (equals, hashCode): New metods.
+ * gnu/CORBA/SimpleDelegate.java (is_equivalent): Compare IORs when applicable.
+
+2005-11-06 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Minor.java (IOR_missing): New minor code.
+ * gnu/CORBA/NamingService/NameParser.java (corbaloc): Implemented
+ file//, ftp:// and http:// support.
+ * gnu/javax/rmi/CORBA/UtilDelegateImpl.java (mapSystemException):
+ Set the cause directly.
+ * org/omg/CORBA/DATA_CONVERSION.java,
+ org/omg/CORBA/ORB.java (string_to_object): Documentation update.
+
+2005-11-06 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/stream/XMLStreamWriterImpl.java: Fixed handling of
+ namespaces when isPrefixDefaulting is set.
+
+2005-11-04 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/DefaultStyledDocument.java: Reformatted.
+
+2005-11-04 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Window.java
+ (setLocationRelativeTo): Implemented case when
+ component is not null.
+
+2005-11-04 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/image/BufferedImage.java (BufferedImage): Implement
+ Transparency.
+ (getTransparency): New method.
+
+2005-11-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/SocketRepository.java (sockets): Changed type to
+ HashMap. (put_socket, get_socket, gc):
+ Always synchronize on 'sockets'.
+
+2005-11-04 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Set version to 0.20-pre.
+
+2005-11-04 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/StyleConstants.java:
+ (Family): New API field.
+ (Size): New API field.
+
+2005-11-04 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paintMenuItem): Changed to use isTopLevelMenu rather than checking
+ instance of parent.
+ * javax/swing/plaf/basic/BasicPopupMenuUI.java
+ (popupMenuWillBecomeInvisible): Added check to prevent NPE.
+ * javax/swing/Popup.java:
+ Added new private field.
+ (LightweightPopup): Initialized layeredPane.
+ (show): Removed unneeded code.
+ (hide): Likewise.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (updateUI): Set the background and foreground color fields to null
+ here so that installing the LabelUI does not interfere with our
+ custom set colors.
+ (getTableCellRendererComponent): Only set UI focus colors when
+ cell is actually editable. Added optimization for the case
+ when background is equal to table background.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Call super.setBackground() or
+ super.setForeground() to avoid overriding custom set background or
+ foreground colors. Set the UI focus colors when focused.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * examples/gnu/classpath/examples/swing/TextFieldDemo.java: New file.
+ Demonstrates the JTextFields in various states.
+ * examples/gnu/classpath/examples/swing/Demo.java: Replaced the
+ old textfield demo with the new one.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (getMinimumSize): New method.
+ * javax/swing/text/FieldView.java
+ (getPreferredSpan): Added assert that replaces a 'should never happen'
+ comment.
+
+2005-11-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (getTiledSizeRequirements): Added check for overflows.
+ (adjustGreater): Fixed overflow handling through usage of long
+ instead of int.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultCaret.java
+ (positionCaret): Call setDot instead of moveDot.
+ * javax/swing/text/PlainView.java
+ (viewToModel): Exclude the final newline character from calculation.
+
+2005-11-03 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/announce/20051102.wml: New file.
+ * doc/www.gnu.org/newsitems.txt: Add 0.19 release announcement.
+ * doc/www.gnu.org/downloads/downloads.wml: Add 0.19.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (background): New field.
+ (foreground): New field.
+ (setBackground): Store the color that is set here.
+ (setForeground): Store the color that is set here.
+ (getTableCellRendererComponent): For the unselected color, set the
+ value of the foreground or background fields if not null, otherwise
+ the value of the according table properties. Don't change
+ the color in the focused clause.
+
+2005-11-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (mousePressed): If the control icon is clicked, the
+ path selected should not be changed.
+ (paintRecursively): Moved call to getChildCount before
+ loop.
+ (paintRow): Added a check to prevent NPE.
+ (updateCurrentVisiblePath): Made this slightly more efficent.
+ Instead of checking each path, we can check the siblings if the
+ current node is not expanded.
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Fixed indentation, and changed
+ to set the background color if it is not an instance of
+ ColorUIResource. Prevents overriding a user-set color.
+
+2005-11-03 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/WrappedPlainView.java: Fixed some > 80 chars lines.
+ (drawSelectedText): Fixed startOffset for call to
+ Utilities.drawTabbedText to make sure tabs are properly expanded.
+ (drawUnselectedText): Likewise.
+ (getMinimumSpan): New API method.
+ (getMaximumSpan): New API method.
+ (setSize): Call preferenceChanged if the width has changed.
+ (WrappedLine.determineNumLines): Move numLines=0 to the top in case
+ the early return happens, numLines will still be correct.
+ (WrappedLine.updateDamage): New implementation method called by
+ insertUpdate and removeUpdate to repaint the appropriate part of the
+ JTextArea.
+ (WrappedLine.insertUpdate): New method.
+ (WrappedLine.removeUpdate): New method.
+
+2005-11-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Fixed so that the label is
+ painted with the correct background color. Does not depend on
+ type of border. Removed this code.
+
+2005-11-03 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/JTextComponent.java:
+ (select): The end index cannot be smaller than the start index, changed
+ Math.max(end, 0) to Math.max(end, start).
+ * javax/swing/text/WrappedPlainView.java:
+ (selectionStart): New package private field.
+ (selectionEnd): Likewise.
+ (drawLine): Implemented to call drawUnselectedText and drawSelectedText
+ on the appropriate parts of the line. Before it just drew the whole
+ line with drawUnselectedText.
+ (paint): Store the start and end of the selection.
+ (WrappedLine.paint): Set the selected color to Color.WHITE.
+
+2005-11-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Should only draw focus if the border
+ is not an empty border.
+
+2005-11-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR swing/24650
+ * javax/swing/text/PlainView.java (viewToModel)):
+ The end of line symbol (0xA), if being the last member in the
+ obtained text, should not be counted.
+
+2005-11-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Changed field to be the gap between the different
+ menu's instead. defaultTextArrowGap is not needed.
+ (getPreferredMenuItemSize): Adjusted preferred size of
+ Menu Item with an arrowIcon to be the size of the
+ popupMenu. If its parent is not a popupMenu, then
+ it is a new Menu on a MenuBar.
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (paintFocus): Height of focus border should not be
+ adjusted. It was being cutoff.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (RootView.getNextVisualPositionFrom): New method.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (AttributeUndoableEdit): New inner class.
+ (StyleChangeListener): New inner class.
+ (styleChangeListener): New field.
+ (addStyle): Add styleChangeListener to new style.
+ (getStyleNames): New method.
+ (styleChanged): New method.
+ (insert): New method.
+ (create): New method.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultTextUI.java: New file.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultCaret.java
+ (mouseDragged): Call moveCaret.
+ (mouseClicked): Made TODO comment more precise.
+ (mouseExited): Replaced TODO comment with Nothing to do comment.
+ (mousePressed): Call positionCaret.
+ (moveCaret): Implemented.
+ (positionCaret): Implemented.
+ (moveDot): Call adjustVisibility.
+ (setDot): Call adjustVisibility.
+ (adjustVisibility): New method.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/Utilities.java
+ (getPositionAbove): New utility method.
+ (getPositionBelow): New utility method.
+ (getParagraphElement): Special case for StyledDocuments.
+ * javax/swing/text/View.java
+ (getNextVisualPositionFrom): New abstract method.
+ * javax/swing/text/ComponentView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/CompositeView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/FlowView.java
+ (LogicalView.getNextVisualPositionFrom): New method.
+ * javax/swing/text/GlyphView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/IconView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/PlainView.java
+ (getNextVisualPositionFrom): New method.
+ * javax/swing/text/WrappedPlainView.java
+ (WrappedLine.getNextVisualPositionFrom): New method.
+
+2005-11-03 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultCaret.java
+ (BlinkTimerListener): New inner class. Listens for when the
+ blink timer fires and updates the visible flag accordingly.
+ (visible): Default value for visible should be false.
+ (blinkTimer): New field.
+ (Caret): New constructor.
+ (focusGained): Make the caret visible.
+ (focusLost): Make caret invisible if the focus lost is permanent.
+ (deinstall): Deinstall the blink timer.
+ (repaint): Call getComponent() instead of directly accessing the
+ textComponent field.
+ (paint): Call getComponent() instead of directly accessing the
+ textComponent field. Added an assert for the 'this should never
+ happen' comment. Update the caret rectangle if damage hasn't been
+ called before.
+ (setBlinkRate): Set the blink rate in the timer if there is already
+ a timer present.
+ (setVisible): Call damage on the caret's location. Start/Stop blink
+ timer.
+ (damage): New method. Updates the caret's bounds.
+ * javax/swing/text/JTextComponent.java
+ (CaretBlinkTimer): Removed unneeded inner class.
+ (caretBlinkTimer): Removed unneeded field.
+ (JTextComponent): Removed initialization of blink timer.
+ (setEditable): Removed starting of blink timer.
+ (setCaret): Likewise.
+ * javax/swing/text/Utilities.java
+ (getParagraphElement): New utility method.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java (initComponentGraphics): Set
+ color to BLACK when getForeground() returns null.
+ (initComponentGraphicsUnlocked): Likewise.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/Timer.java (Waker.run): Synchronize on queueLock and use
+ queueLock.wait(), not Thread.sleep().
+ (start): Synchronize on queueLock and check whether waker is null.
+ (stop): Synchronize on queueLock and notifyAll().
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Set version to 0.19.
+ * NEWS: Add date of release.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Dialog.java
+ (show): Do not call pack() here.
+
+2005-11-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * AUTHORS: Added myself.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/Timer.java (Waker.run): Only break out when !running.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/UIManager.java (static): Print complete exception.
+
+2005-11-02 Mark Wielaard <mark@klomp.org>
+
+ * lib/Makefile.am: Add typeHiding, unchecked, unused and varargsCast
+ to ECJ compile warning rule.
+
+2005-11-02 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * lib/copy-vmresources.sh.in: Added definition for top_srcdir.
+
+2005-11-02 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * NEWS: Mention Qt4 configury for OS-X.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * NEWS: Added some news items regarding my Swing work.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (findOverlapFreeParent): Don't search beyond the components
+ containing window (important when in a Dialog).
+
+2005-11-02 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * AUTHORS: Added myself to the cool gang.
+
+2005-11-02 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/WrappedPlainView.java:
+ (calculateBreakPosition): If the component is not valid use it's
+ preferredSize instead of getBounds().
+
+2005-11-02 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Dialog.java
+ (show): pack should always be called before show, so Dialog is
+ set to the correct size and validated.
+
+2005-11-02 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * configure.ac: Check for cairo, pangoft2 and freetype2 only
+ when gtk peers are enabled.
+
+2005-11-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * AUTHORS (Stuart Ballard): Address update.
+
+2005-11-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * AUTHORS: Added Lillian Angel.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JToolBar.java
+ (addImpl): Don't call updateUI here. This is really not necessary.
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (installDefaults): Call setRolloverBorders() here in order to
+ initialize the button borders.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (PropertyChangeHandler.propertyChange): Re-setup listeners on
+ the scrollbars if the scrollbars change.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Container.java
+ (addImpl): Notify registered ContainerListeners even when the
+ Container is not showing. Notify the listeners directly, not
+ via the event queue.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Fixed the defaults for EditorPane.border,
+ TextArea.font and TextPane.border.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (getForeground): Return null as default color, instead of some
+ system color.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (BoxLayout): Throw AWTError when the axis is invalid.
+ (minimumLayoutSize): Respect the insets of the container.
+ (maximumLayoutSize): Likewise.
+ (invalidateLayout): Throw AWTError if the managed container is
+ not the same as the parent parameter.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (getMaximumSize): Return (Short.MAX_VALUE, Short.MAX_VALUE) instead
+ of (Integer.MAX_VALUE, Integer.MAX_VALUE) as shown by the
+ Mauve test.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (AccessibleJTable.AccessibleJTableCell): New inner class.
+
+2005-11-02 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/filechooser/FileSystemView.java: Added API docs all over,
+ * javax/swing/filechooser/UnixFileSystemView.java: Likewise.
+
+2005-11-02 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * java/lang/String.java (String): Added
+ StringIndexOutOfBoundsException check (overflow) and a message
+ to the exceptions.
+
+2005-11-02 David Gilbert <david.gilbert@object-refinery.com>
+
+ * NEWS: added entries for javax.swing.plaf.metal.* package and updates
+ to the gnu.classpath.examples.swing.Demo application,
+ * AUTHORS: Added my name to bring honour and glory to myself and all
+ my descendants.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (AccessibleJComponent.changeSupport): New field.
+ (AccessibleJComponent.AccessibleJComponent): Initialize changeSupport.
+ (AccessibleJComponent.addPropertyChangeListener): Implemented this
+ method.
+ (AccessibleJComponent.removePropertyChangeListener): Implemented this
+ method.
+ (AccessibleJComponent.getAccessibleChildrenCount): Implemented this
+ method.
+ (AccessibleJComponent.getAccessibleChild): Implemented this
+ method.
+ (AccessibleJComponent.getAccessibleName): Added API comment and
+ TODO tag.
+ (AccessibleJComponent.getAccessibleDescription): Added API comment
+ and TODO tag.
+ (AccessibleJComponent.getAccessibleRole): Implemented this method.
+ (AccessibleJComponent.getBorderTitle): Implemented this method.
+ (AccessibleJComponent.getToolTipText): Implemented this method.
+ (AccessibleJComponent.getTitledBorderText): Implemented this method.
+ (AccessibleJComponent.getAccessibleKeyBinding): Added API comment
+ and TODO tag.
+
+2005-11-01 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/swing/Demo.java (init): Use
+ JOptionPane to select the laf if not explicitly set.
+
+2005-11-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/io/ObjectInputStream.java:
+ (parseContent(byte)): Remove weird exception
+ throwing.
+
+2005-11-01 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Window.java
+ (show): Don't set size of the window here.
+
+2005-11-01 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalScrollPaneUI.java
+ (instance): Removed unnecessary field.
+ (createUI): Always return a new instance instead of returning a
+ shared instance.
+
+2005-11-01 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Window.java
+ (show): If pack is not called before show, the size of the
+ window is often set to 0. This is now fixed.
+
+2005-11-01 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): Pack the JPopupMenu before fetching the Popup
+ instance. Otherwise the PopupFactory has the wrong size for
+ its size check.
+
+2005-11-01 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java:
+ (JTable(TableModel, TableColumnModel, ListSelectionModel)): Call
+ updateUI after initializeLocalVars. Manually set the lead selection
+ indices.
+
+2005-11-01 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicFileChooserUI.java:
+ (getApproveButtonText): First use the JFileChooser's approve button
+ text, but if it is null, then try otherwise.
+
+2005-11-01 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * vm/reference/java/lang/VMThread.java (sleep): Don't round
+ ms and pass ns to Object.wait, fixes mauve test.
+
+2005-11-01 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JFileChooser.java:
+ (getDialogTitle): Allow return of null.
+ (getApproveButtonText): Likewise.
+ (getFileView): Likewise.
+ (getName): First try using the JFileChooser's FileView, if null, then
+ pass call to UI.
+ (getDescription): Likewise.
+ (getTypeDescription): Likewise.
+ (getIcon): Likewise.
+
+2005-11-01 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java:
+ (JTable(TableModel, TableColumnModel, ListSelectionModel)): Set the
+ model before calling initializeLocalVars.
+
+2005-11-01 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+ (BasicCheckBoxMenuItem): Moved code to BasicMenuItemUI.installDefaults
+ (processMouseEvent): Added TODO comment. Not sure about the
+ correct implementation yet.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Removed MenuItem.checkIcon default. Only
+ RadioButtonMenuItem's and CheckBoxMenuItem's have checkIcons.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (installDefaults): Fixed to initialized checkIcon. If the menuItem is
+ not a RadioButtonMenuItem or CheckBoxMenuItem, then checkIcon is null.
+ Also, fixed defaults to use prefix.
+
+2005-11-01 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectOutputStream.java
+ (writeObject): Fixed NPE.
+
+2005-10-31 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTextAreaUI.java:
+ (create): Added docs. Create WrappedPlainView instead of PlainView if
+ the text area has line wrapping turned on.
+ (propertyChange): New API method. If line wrapping is turned on or off
+ or if the style of wrapping (character or word) is changed, call
+ modelChanged().
+ * javax/swing/plaf/basic/BasicTextUI.java:
+ (setView): Call revalidate and repaint after setting the View.
+ * javax/swing/text/WrappedPlainView.java:
+ (insertUpdate): Repaint the container.
+ (removeUpdate): Likewise.
+ (changedUpdate): Likewise.
+
+2005-10-31 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/WrappedPlainView.java:
+ (viewFactory): New field.
+ (drawLine): New API method.
+ (calculateBreakPosition): Update the metrics before calling Utilities
+ methods. Fixed error in offset argument passed to the Utilities
+ methods.
+ (updateMetrics): New implementation method.
+ (getPreferredSpan): New API method.
+ (insertUpdate): Likewise.
+ (removeUpdate): Likewise.
+ (changedUpdate): Likewise.
+ (WrappedLineCreator): New class.
+ (paint): New API method.
+ (setSize): New API method.
+ (WrappedLine.paint): Implemented.
+ (WrappedLine.getPreferredSpan): Don't update the metrics, this is now
+ done in WrappedPlainView.paint.
+ (WrappedLine.modelToView): Likewise.
+ (WrappedLine.viewToModel): Likewise.
+
+2005-10-31 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getTabbedTextOffset): Adjusted for loop bound down by s.offset and
+ adjusted array index up by s.offset. This fixes the second part of
+ PR 24316. Expand tabs, not newlines. Allow the x-position to reach
+ the end specified position (use < instead of <=).
+
+2005-10-31 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTextField.java
+ (horizontalVisibility): New field.
+ (JTextField): Initialize horizontalVisibility field.
+ (getHorizontalVisibility): New method.
+
+2005-10-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/SocketRepository.java (not_reusable, gc): New methods.
+ (sockets): Use hashtable. (get_socket): Rewritten.
+
+2005-10-31 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (AccessibleJTable.tableChanged): Implemented.
+ (AccessibleJTable.tableRowsInserted): Implemented.
+ (AccessibleJTable.tableRowsDeleted): Implemented.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (updateCurrentVisiblePath): Check whether treeModel is null.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/swing/Demo.java (static): Set look
+ and feel before showing dialog. Clean up message text.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/text/PlainView.java (determineMaxLineLength): Get
+ correct lenght of text.
+ (drawLine): Throw AssertionError on unexpected bad location.
+ (viewToModel): Likewise.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/text/AbstractDocument.java (dump): Actually throw
+ AssertionError when constructed.
+ * javax/swing/text/DefaultFormatter.java (checkValidInput): Add cause
+ to AssertionError.
+ * javax/swing/text/DefaultStyledDocument.java (insertUpdate):
+ Likewise.
+ * javax/swing/text/GlyphView.java (getPartialSpan): Likewise.
+ (getText): Likewise.
+ * javax/swing/text/PlainView.java (determineMaxLineLength): Likewise.
+ (updateDamage): Likewise.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/rmi/server/UnicastServer.java (refcache): Make it a
+ synchronized IdentityHashMap.
+
+2005-10-30 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (GdkGraphics2D(GdkGraphics2D,int, int, int,int)): New constructor.
+ (create(int,int,int,int)): Use new constructor.
+ (copyArea): Implement through create() and gdkDrawDrawable().
+
+2005-10-29 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java/nio/channels/spi/AbstractSelectableChannel.java
+ (register): Throw IllegalBlockingModeException if the channel is
+ not in blocking mode.
+
+2005-10-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ButtonDemo.java
+ (ButtonDemo): add closePanel after content is created,
+ (createContent): don't add closePanel here,
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java
+ (ButtonDemo): add closePanel after content is created,
+ (createContent): don't add closePanel here,
+ * examples/gnu/classpath/examples/swing/ScrollBarDemo.java
+ (ButtonDemo): add closePanel after content is created,
+ (createContent): don't add closePanel here,
+ * examples/gnu/classpath/examples/swing/SliderDemo.java
+ (ButtonDemo): add closePanel after content is created,
+ (createContent): add separate checkBoxPanel but don't add closePanel
+ here.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/KeyboardFocusManager.java
+ (setCurrentKeyboardFocusManager): Create a DefaultKeyboardFocusManager
+ directly.
+ (createFocusManager): Removed.
+ * gnu/java/awt/FocusManager.java: Removed.
+ * javax/swing/FocusManager.java
+ (DisabledFocusManager): Removed inner class.
+ (WrappingFocusManager): New inner class.
+ (getCurrentManager): Return WrappingKeyboardFocusManager instance.
+
+2005-10-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Component.java:
+ (requestFocus): If this component is a Container, start here, not at
+ its parent when looking for the top-level ancestor. If no top-level
+ ancestor is found (parent == null), return.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaulTableCellRenderer.java
+ (getTableCellRenderer): Correctly configure the cell renderer for
+ selected and / or focused cells.
+ * javax/swing/table/JTableHeader.java
+ (getHeaderRect): Don't include the intercellSpacing in the
+ header rectangle.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (MouseInputHandler.mouseDragged): Only react if table is enabled.
+ (MouseInputHandler.mousePressed): Only react if table is enabled.
+ (MouseInputHandler.mouseReleased): Only react if table is enabled.
+ (PropertyChangeHandler): New inner class. Updates the state of
+ the table if the model property changes.
+ (installDefaults): Don't load the highlightCellBorder here. This
+ is done in the cell renderer now.
+ (installListeners): Install the new PropertyChangeListener.
+ (uninstallListeners): Uninstall the new PropertyChangeListener.
+ (paintCell): Fixed determination of the selected and focused state
+ of the cell. Removed handling of the border (this is moved into
+ the cell renderer).
+ (paint): Fixed the rectangle calculation of the cell. Fixed painting
+ of the grid.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/DefaultListSelectionModel.java
+ (setLeadSelectionIndex): Forbit some changes to leadSelectionIndex
+ when the anchorSelectionIndex is not set properly.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Poa/AOM.java,
+ gnu/CORBA/Poa/AccessiblePolicy.java,
+ gnu/CORBA/Poa/DynamicImpHandler.java,
+ gnu/CORBA/Poa/StandardPolicies.java,
+ gnu/CORBA/Poa/ServantDelegateImpl.java,
+ gnu/CORBA/Poa/NamingService/NameComponentComparator.java
+ gnu/CORBA/Poa/NamingService/NameTransformer.java
+ gnu/CORBA/GIOP/ContextHandler.java,
+ gnu/CORBA/GIOP/CodeSetServiceContext.java: New files.
+ * gnu/CORBA/GIOP/contextSupportingHeader.java,
+ gnu/CORBA/GIOP/cxCodeSet.java,
+ gnu/CORBA/NamingService/cmpNameComponent.java,
+ gnu/CORBA/NamingService/snConverter.java,
+ gnu/CORBA/Poa/activeObjectMap.java,
+ gnu/CORBA/Poa/dynImpHandler.java,
+ gnu/CORBA/Poa/policySets.java,
+ gnu/CORBA/Poa/servantDelegate.java,
+ gnu/CORBA/Poa/vPolicy.java: Removed.
+ * gnu/CORBA/GIOP/CharSets_OSF:
+ Explaining the reason of setting "_OSF" apart.
+ * gnu/CORBA/CDR/AbstractCdrInput.java,
+ gnu/CORBA/CDR/AbstractCdrOutput.java,
+ gnu/CORBA/GIOP/CharSets_OSF.java,
+ gnu/CORBA/GIOP/ReplyHeader.java,
+ gnu/CORBA/GIOP/RequestHeader.java,
+ gnu/CORBA/GIOP/ServiceContext.java,
+ gnu/CORBA/GIOP/v1_0/ReplyHeader.java,
+ gnu/CORBA/GIOP/v1_0/RequestHeader.java,
+ gnu/CORBA/GIOP/v1_2/ReplyHeader.java,
+ gnu/CORBA/GIOP/v1_2/RequestHeader.java,
+ gnu/CORBA/IOR.java,
+ gnu/CORBA/NamingService/Ext.java,
+ gnu/CORBA/NamingService/NameParser.java,
+ gnu/CORBA/NamingService/NamingMap.java,
+ gnu/CORBA/Poa/ForwardedServant.java,
+ gnu/CORBA/Poa/LocalDelegate.java,
+ gnu/CORBA/Poa/LocalRequest.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Poa/gnuAdapterActivator.java,
+ gnu/CORBA/Poa/gnuIdAssignmentPolicy.java,
+ gnu/CORBA/Poa/gnuIdUniquenessPolicy.java,
+ gnu/CORBA/Poa/gnuImplicitActivationPolicy.java,
+ gnu/CORBA/Poa/gnuLifespanPolicy.java,
+ gnu/CORBA/Poa/gnuPOA.java,
+ gnu/CORBA/Poa/gnuRequestProcessingPolicy.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/Poa/gnuServantRetentionPolicy.java,
+ gnu/CORBA/Poa/gnuThreadPolicy.java,
+ gnu/CORBA/ResponseHandlerImpl.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ org/omg/CosNaming/_NamingContextExtStub.java:
+ References updated.
+
+2005-10-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (JTable): Changed order of initialization (UI first, then the model
+ etc), so that the UI gets notified of the initial model change.
+ (rowAtPoint): Don't add the intercellSpacing in the calculation
+ of the row-at-Point.
+ (setModel): Throw a PropertyChangeEvent here if the model changes.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/DynAn/ValueChangeListener.java
+ gnu/CORBA/DynAn/AbstractAny.java
+ gnu/CORBA/DynAn/RecordAny.java
+ gnu/CORBA/DynAn/DivideableAny.java
+ gnu/CORBA/DynAn/UndivideableAny.java: New files.
+ * gnu/CORBA/DynAn/abstractDynAny.java,
+ gnu/CORBA/DynAn/recordAny.java,
+ gnu/CORBA/DynAn/anyDivideable.java,
+ gnu/CORBA/DynAn/anyUndivideable.java,
+ gnu/CORBA/DynAn/valueChangedListener.java: Removed.
+ * gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/DynAn/gnuDynArray.java,
+ gnu/CORBA/DynAn/gnuDynEnum.java,
+ gnu/CORBA/DynAn/gnuDynFixed.java,
+ gnu/CORBA/DynAn/gnuDynStruct.java,
+ gnu/CORBA/DynAn/gnuDynUnion.java,
+ gnu/CORBA/DynAn/gnuDynValue.java,
+ gnu/CORBA/DynAn/gnuDynValueBox.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/abstractDataInputStream.java,
+ gnu/CORBA/CDR/abstractDataOutputStream.java,
+ gnu/CORBA/CDR/aligningInputStream.java,
+ gnu/CORBA/CDR/aligningOutputStream.java,
+ gnu/CORBA/CDR/cdrBufInput.java.java,
+ gnu/CORBA/CDR/cdrBufOutput.java
+ gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/CDR/encapsulatedOutput.java,
+ gnu/CORBA/CDR/noHeaderInput.java: Removed.
+ * gnu/CORBA/CDR/HeadlessInput.java
+ gnu/CORBA/CDR/AbstractCdrInput.java
+ gnu/CORBA/CDR/AbstractCdrOutput.java
+ gnu/CORBA/CDR/AbstractDataInput.java
+ gnu/CORBA/CDR/AbstractDataOutput.java
+ gnu/CORBA/CDR/AligningInput.java
+ gnu/CORBA/CDR/AligningOutput.java
+ gnu/CORBA/CDR/BufferedCdrOutput.java
+ gnu/CORBA/CDR/BufferredCdrInput.java
+ gnu/CORBA/CDR/EncapsulationStream.java: New files.
+ * gnu/CORBA/CDR/ArrayValueHelper.java,
+ gnu/CORBA/CDR/BigEndianInputStream.java,
+ gnu/CORBA/CDR/BigEndianOutputStream.java,
+ gnu/CORBA/CDR/LittleEndianInputStream.java,
+ gnu/CORBA/CDR/LittleEndianOutputStream.java,
+ gnu/CORBA/CDR/UnknownExceptionCtxHandler.java,
+ gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CdrEncapsCodecImpl.java,
+ gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/GIOP/MessageHeader.java,
+ gnu/CORBA/GIOP/ReplyHeader.java,
+ gnu/CORBA/GIOP/RequestHeader.java,
+ gnu/CORBA/GIOP/ServiceContext.java,
+ gnu/CORBA/GIOP/cxCodeSet.java,
+ gnu/CORBA/GIOP/v1_0/ReplyHeader.java,
+ gnu/CORBA/GIOP/v1_0/RequestHeader.java,
+ gnu/CORBA/GIOP/v1_2/ReplyHeader.java,
+ gnu/CORBA/GIOP/v1_2/RequestHeader.java,
+ gnu/CORBA/GeneralHolder.java,
+ gnu/CORBA/IOR.java,
+ gnu/CORBA/Interceptor/gnuIcCurrent.java,
+ gnu/CORBA/IorDelegate.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/OrbFunctional.java,
+ gnu/CORBA/OrbRestricted.java,
+ gnu/CORBA/Poa/LocalDelegate.java,
+ gnu/CORBA/Poa/LocalRequest.java,
+ gnu/CORBA/Poa/gnuPOA.java,
+ gnu/CORBA/RawReply.java,
+ gnu/CORBA/ResponseHandlerImpl.java,
+ gnu/CORBA/ServiceRequestAdapter.java,
+ gnu/CORBA/StreamBasedRequest.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/CORBA/typecodes/GeneralTypeCode.java,
+ gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java,
+ gnu/javax/rmi/CORBA/RmiUtilities.java,
+ gnu/javax/rmi/CORBA/StubDelegateImpl.java,
+ org/omg/IOP/TaggedProfileHelper.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/javax/rmi/CORBA/corbaObjectInput.java,
+ gnu/javax/rmi/CORBA/corbaObjectOutput.java,
+ gnu/javax/rmi/CORBA/dwoTester.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil: Deleted.
+ * gnu/javax/rmi/CORBA/CorbaInput.java,
+ gnu/javax/rmi/CORBA/CorbaOutput.java,
+ gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java,
+ gnu/javax/rmi/CORBA/RmiUtilities.java: New files.
+ * gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/holderFactory.java,
+ gnu/CORBA/IOR_contructed_object.java,
+ gnu/CORBA/IOR_Delegate.java,
+ gnu/CORBA/Simple_delegate.java,
+ gnu/CORBA/Restricted_ORB.java,
+ gnu/CORBA/Functional_ORB.java,
+ gnu/CORBA/Focused_ORB.java: Removed.
+ * gnu/CORBA/HolderLocator.java
+ gnu/CORBA/IorDelegate.java
+ gnu/CORBA/IorObject.java
+ gnu/CORBA/OrbFocused.java
+ gnu/CORBA/OrbFunctional.java
+ gnu/CORBA/OrbRestricted.java
+ gnu/CORBA/SimpleDelegate.java: New files.
+ * gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/DynAn/abstractRecord.java,
+ gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/DynAn/gnuDynAnyFactory.java,
+ gnu/CORBA/DynAn/gnuDynArray.java,
+ gnu/CORBA/DynAn/gnuDynValueBox.java,
+ gnu/CORBA/GIOP/ErrorMessage.java,
+ gnu/CORBA/NamingService/NameParser.java,
+ gnu/CORBA/NamingService/NamingServiceTransient.java,
+ gnu/CORBA/Poa/ForwardedServant.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/StubLocator.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil.java,
+ org/omg/CORBA/CompletionStatusHelper.java,
+ org/omg/CORBA/DefinitionKindHelper.java,
+ org/omg/CORBA/FieldNameHelper.java,
+ org/omg/CORBA/IDLTypeHelper.java,
+ org/omg/CORBA/IdentifierHelper.java,
+ org/omg/CORBA/ORB.java,
+ org/omg/CORBA/ParameterModeHelper.java,
+ org/omg/CORBA/RepositoryIdHelper.java,
+ org/omg/CORBA/SetOverrideTypeHelper.java,
+ org/omg/CORBA/StringValueHelper.java,
+ org/omg/CORBA/StructMemberHelper.java,
+ org/omg/CORBA/UnionMemberHelper.java,
+ org/omg/CORBA/ValueMemberHelper.java,
+ org/omg/CORBA/VersionSpecHelper.java,
+ org/omg/CORBA/VisibilityHelper.java,
+ org/omg/CORBA/WStringValueHelper.java,
+ org/omg/CORBA/_IDLTypeStub.java,
+ org/omg/CosNaming/IstringHelper.java,
+ org/omg/DynamicAny/FieldNameHelper.java,
+ org/omg/PortableInterceptor/AdapterNameHelper.java,
+ org/omg/PortableInterceptor/ORBIdHelper.java,
+ org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java,
+ org/omg/PortableInterceptor/ObjectIdHelper.java,
+ org/omg/PortableInterceptor/ServerIdHelper.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/universalHolder.java
+ gnu/CORBA/stubFinder.java
+ gnu/CORBA/typeNamer.java
+ gnu/CORBA/streamRequest.java
+ gnu/CORBA/streamReadyHolder.java
+ gnu/CORBA/binaryReply.java
+ gnu/CORBA/bufferedResponseHandler.java
+ gnu/CORBA/cdrEncapsCodec.java
+ gnu/CORBA/corbaArrayList.java: Removed.
+ * gnu/CORBA/CdrEncapsCodecImpl.java,
+ gnu/CORBA/CorbaList.java,
+ gnu/CORBA/GeneralHolder.java,
+ gnu/CORBA/RawReply.java,
+ gnu/CORBA/ResponseHandlerImpl.java,
+ gnu/CORBA/StreamBasedRequest.java,
+ gnu/CORBA/StreamHolder.java,
+ gnu/CORBA/StubLocator.java,
+ gnu/CORBA/TypeKindNamer.java: New files.
+ * gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/DynAn/abstractDynAny.java,
+ gnu/CORBA/DynAn/anyDivideable.java,
+ gnu/CORBA/DynAn/gnuDynAny.java,
+ gnu/CORBA/DynAn/gnuDynAnyFactory.java,
+ gnu/CORBA/Functional_ORB.java,
+ gnu/CORBA/IOR_Delegate.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/Poa/LocalDelegate.java,
+ gnu/CORBA/Poa/LocalRequest.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/Restricted_ORB.java,
+ gnu/CORBA/ServiceRequestAdapter.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuCodecFactory.java,
+ gnu/CORBA/gnuContextList.java,
+ gnu/CORBA/gnuExceptionList.java,
+ gnu/CORBA/gnuNVList.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/CORBA/typecodes/RecordTypeCode.java:
+ References updated.
+
+2005-10-28 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/typecodes/AliasTypeCode.java,
+ gnu/CORBA/typecodes/ArrayTypeCode.java,
+ gnu/CORBA/typecodes/FixedTypeCode.java,
+ gnu/CORBA/typecodes/GeneralTypeCode.java,
+ gnu/CORBA/typecodes/PrimitiveTypeCode.java,
+ gnu/CORBA/typecodes/RecordTypeCode.java,
+ gnu/CORBA/typecodes/RecursiveTypeCode.java,
+ gnu/CORBA/typecodes/StringTypeCode.java,
+ gnu/CORBA/typecodes/package.html: New files.
+ * gnu/CORBA/aliasTypeCode.java,
+ gnu/CORBA/primitiveArrayTypeCode.java,
+ gnu/CORBA/fixedTypeCode.java,
+ gnu/CORBA/generalTypeCode.java,
+ gnu/CORBA/primitiveTypeCode.java,
+ gnu/CORBA/recordTypeCode.java,
+ gnu/CORBA/recursiveTypeCode.java,
+ gnu/CORBA/stringTypeCode.java: Deleted.
+ * gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/OctetHolder.java,
+ gnu/CORBA/Poa/LocalRequest.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/Restricted_ORB.java,
+ gnu/CORBA/TypeCodeHelper.java,
+ gnu/CORBA/WCharHolder.java,
+ gnu/CORBA/WStringHolder.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/typeNamer.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ org/omg/CORBA/AnyHolder.java,
+ org/omg/CORBA/AnySeqHelper.java,
+ org/omg/CORBA/AnySeqHolder.java,
+ org/omg/CORBA/BooleanHolder.java,
+ org/omg/CORBA/BooleanSeqHelper.java,
+ org/omg/CORBA/BooleanSeqHolder.java,
+ org/omg/CORBA/ByteHolder.java,
+ org/omg/CORBA/CharHolder.java,
+ org/omg/CORBA/CharSeqHelper.java,
+ org/omg/CORBA/CharSeqHolder.java,
+ org/omg/CORBA/DefinitionKindHelper.java,
+ org/omg/CORBA/DoubleHolder.java,
+ org/omg/CORBA/DoubleSeqHelper.java,
+ org/omg/CORBA/DoubleSeqHolder.java,
+ org/omg/CORBA/FixedHolder.java,
+ org/omg/CORBA/FloatHolder.java,
+ org/omg/CORBA/FloatSeqHelper.java,
+ org/omg/CORBA/FloatSeqHolder.java,
+ org/omg/CORBA/IntHolder.java,
+ org/omg/CORBA/LongHolder.java,
+ org/omg/CORBA/LongLongSeqHelper.java,
+ org/omg/CORBA/LongLongSeqHolder.java,
+ org/omg/CORBA/LongSeqHelper.java,
+ org/omg/CORBA/LongSeqHolder.java,
+ org/omg/CORBA/NameValuePairHelper.java,
+ org/omg/CORBA/ORB.java,
+ org/omg/CORBA/ObjectHelper.java,
+ org/omg/CORBA/ObjectHolder.java,
+ org/omg/CORBA/OctetSeqHelper.java,
+ org/omg/CORBA/OctetSeqHolder.java,
+ org/omg/CORBA/PolicyErrorCodeHelper.java,
+ org/omg/CORBA/PrincipalHolder.java,
+ org/omg/CORBA/ShortHolder.java,
+ org/omg/CORBA/ShortSeqHelper.java,
+ org/omg/CORBA/ShortSeqHolder.java,
+ org/omg/CORBA/StringHolder.java,
+ org/omg/CORBA/StringSeqHelper.java,
+ org/omg/CORBA/StringSeqHolder.java,
+ org/omg/CORBA/TypeCodeHolder.java,
+ org/omg/CORBA/ULongLongSeqHelper.java,
+ org/omg/CORBA/ULongLongSeqHolder.java,
+ org/omg/CORBA/ULongSeqHelper.java,
+ org/omg/CORBA/ULongSeqHolder.java,
+ org/omg/CORBA/UShortSeqHelper.java,
+ org/omg/CORBA/UShortSeqHolder.java,
+ org/omg/CORBA/ValueBaseHelper.java,
+ org/omg/CORBA/WCharSeqHelper.java,
+ org/omg/CORBA/WCharSeqHolder.java,
+ org/omg/CORBA/WStringSeqHelper.java,
+ org/omg/CORBA/WStringSeqHolder.java,
+ org/omg/Messaging/SyncScopeHelper.java: References modified.
+
+2005-10-28 Nicolas Geoffray <nicolas.geoffray@menlina.com>
+
+ Reported by: Gael Thomas <gael.thomas@imag.fr>
+ * NEWS : added entry about new implementation of
+ VMClassLoader.getPackage(s), and new method
+ VMClassLoader.getBootPackages
+ * vm/reference/java/lang/VMClassLoader.java:
+ Added new definedPackages field to store packages
+ loaded by the bootstrap classloader.
+ Added new static initializer to create all packages
+ which names are returned by getBootPackages
+ (getBootPackages): new private method. Helper
+ to get as a String[] the native package names
+ (getPackage): uses the new definedPackages field
+ (getPackages): uses the new definedPackages field
+ * java/lang/Class.java:
+ (getPackage): if the classloader of the class is null
+ then call VMClassLoader.getPackage
+
+2005-10-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JEditorPane.java:
+ (getScrollableTracksViewportWidth): Return true if the component is
+ valid.
+ (getScrollableTracksViewportHeight): Likewise.
+
+2005-10-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/ScrollPaneLayout.java:
+ (preferredLayoutSize): Fixed the conditions for allocating space for
+ the scrollbars. Should allocate space if the View's dimension is
+ larger than the Viewport's dimension. This fixes the problem in
+ comment 1) for PR 23530.
+
+2005-10-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JViewport.java:
+ (scrollRectToVisible): Use the viewport bounds instead of the view
+ bounds when scrolling up and scrolling left.
+
+2005-10-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/FieldView.java
+ (getPreferredSpan): For the Y_AXIS call the superclass behaviour as
+ described in the Swing book by OReilly.
+
+2005-10-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectIdHelper.java:
+ Assuming ObjectId as alias of byte[], not alias of String.
+
+2005-10-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTextField.java
+ (createDefaultModel): Return a normal PlainDocument here.
+ * javax/swing/text/AbstractDocument.java
+ (insertString): Correctly placed locking so that insertUpdate() is
+ called within a lock as specified. Do not setup any ElementChanges
+ here, this must be done in subclasses in insertUpdate() method.
+ Fire an UndoableEditEvent.
+ * javax/swing/text/PlainDocument.java
+ (insertString): New method. Replaces newlines with whitespace
+ when document property 'filterNewlines' is set.
+
+2005-10-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (PropertyChangeHandler.propertyChange): If orientation property
+ changes, re-setup the UI.
+ (TrackListener.mouseReleased): Removed unused code.
+ (createIncreaseButton): Simply return a new instance without any
+ hacks.
+ (createDecreaseButton): Likewise.
+ (installComponents): Do not create the incrButton and decrButton
+ here, only install them on the ScrollBar.
+ (installDefaults): Also initialize the incrButton and decrButton
+ fields here.
+ (uninstallComponents): Added some null checks.
+ (uninstallDefaults): Uninstall border using the LookAndFeel utility
+ method. Set incrButton and decrButton to null here.
+ (uninstallListeners): Added null checks.
+ (uninstallUI): Changed order of method calls. First uninstall
+ listeners then uninstallDefaults, because uninstallDefaults sets
+ the incrButton and decrButton fields to null, and uninstallListeners
+ removes a listener from them. Avoids NPE.
+
+2005-10-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java: API doc updates,
+ * javax/swing/plaf/metal/MetalButtonUI.java: likewise,
+ * javax/swing/plaf/metal/MetalCheckBoxIcon.java: likewise,
+ * javax/swing/plaf/metal/MetalCheckBoxUI.java: likewise,
+ * javax/swing/plaf/metal/MetalDesktopIconUI.java: likewise,
+ * javax/swing/plaf/metal/MetalIconFactory.java: likewise,
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java: likewise,
+ * javax/swing/plaf/metal/MetalInternalFrameUI.java: likewise,
+ * javax/swing/plaf/metal/MetalLabelUI.java: likewise,
+ * javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java: likewise,
+ * javax/swing/plaf/metal/MetalProgressBarUI.java: likewise,
+ * javax/swing/plaf/metal/MetalRadioButtonUI.java: likewise,
+ * javax/swing/plaf/metal/MetalRootPaneUI.java: likewise,
+ * javax/swing/plaf/metal/MetalScrollBarUI.java: likewise,
+ * javax/swing/plaf/metal/MetalScrollPaneUI.java: likewise,
+ * javax/swing/plaf/metal/MetalSeparatorUI.java: likewise,
+ * javax/swing/plaf/metal/MetalSliderUI.java: likewise,
+ * javax/swing/plaf/metal/MetalSplitPaneUI.java: likewise,
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java: likewise,
+ * javax/swing/plaf/metal/MetalTextFieldUI.java: likewise,
+ * javax/swing/plaf/metal/MetalToolBarUI.java: likewise,
+ * javax/swing/plaf/metal/MetalToolTipUI.java: likewise,
+ * javax/swing/plaf/metal/MetalTreeUI.java: likewise,
+ * javax/swing/plaf/metal/package.html: likewise.
+
+2005-10-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalToggleButtonUI.java:
+ (MetalToggleButtonUI): removed color field initialisation,
+ (installDefaults): added color field initialisation formerly in
+ the constructor.
+
+2005-10-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/RepaintManager.java
+ (paintDirtyRegions): replaced characters in comment that caused
+ warnings in gjdoc and Eclipse.
+
+2005-10-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * BUGS: URL refreshed.
+
+2005-10-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/ExceptionCreator.java: Deleted.
+
+2005-10-26 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/ObjectReferenceFactory.java,
+ org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java,
+ org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java,
+ org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java:
+ New files.
+
+2005-10-26 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/ViewportLayout.java:
+ (layoutContainer): Fixed incorrect boundary checks, should have been
+ checking for viewport being smaller than minimum size, not smaller
+ than preferred size.
+
+2005-10-26 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * configure.ac: Rename --with-qtdir to --with-qt4dir to make clear
+ which Qt version is meant.
+
+2005-10-26 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JList.java:
+ (getPreferredScrollableViewportSize): Use the preferred width instead
+ of the width of the widest element. This allows us to use the
+ user-specified preferred width if setPreferredSize was called. Use
+ the height of the first row, not the first visible row, when
+ calculating the preferred height. Added comments and made code cleaner
+ and more readable.
+
+2005-10-26 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/spi/ImageReaderWriterSpi.java
+ (getStreamMetadataFormat): Implement.
+ (getImageMetadataFormat): Likewise.
+
+2005-10-26 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/colorchooser/AbstractColorChooserPanel.java
+ (getMnemonic): implemented,
+ (getDisplayedMnemonicIndex): implemented.
+
+2005-10-26 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/PortableInterceptor/AdapterManagerIdHelper.java,
+ org/omg/PortableInterceptor/AdapterNameHelper.java,
+ org/omg/PortableInterceptor/AdapterStateHelper.java,
+ org/omg/PortableInterceptor/ORBIdHelper.java,
+ org/omg/PortableInterceptor/ObjectIdHelper.java,
+ org/omg/PortableInterceptor/ServerIdHelper.java: New files.
+ * org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java
+ (type): Fixed typo in typecode name.
+
+2005-10-25 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/WrappedPlainView: New class.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): Removed initialization of unnecessary focusColor
+ field.
+ (paintButtonPressed): Only paint if button is opaque.
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (paintButtonPressed): Only paint if button is opaque and
+ contentAreaFilled.
+
+2005-10-25 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/CompositeView.java:
+ (getViewIndexAtPosition): Fixed boundary conditions (less than and
+ greater than signs were backward).
+
+2005-10-25 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getBreakLocation): New API method.
+
+2005-10-25 Tom Tromey <tromey@redhat.com>
+
+ * java/io/ObjectOutputStream.java (useProtocolVersion): Typo fix.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * gnu/java/awt/peer/gtk/GtkDialogPeer.java
+ (create): Changed classname for the heavyweight testclass to match
+ the new classes introduced by my popup patch earlier this day.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkMenuBar): Replaced some demos with new external demo programs,
+ namely the button demo, the scrollbar demo, the combobox demo and
+ the slider demo.
+ (mkButtonBar): Likewise.
+ * examples/gnu/classpath/examples/swing/ButtonDemo.java
+ (createContent): Made package private so that the Demo.java can
+ access it.
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java
+ (createContent): Made package private so that the Demo.java can
+ access it.
+ * examples/gnu/classpath/examples/swing/ScrollBarDemo.java
+ (createContent): Made package private so that the Demo.java can
+ access it.
+ * examples/gnu/classpath/examples/swing/SliderDemo.java
+ (createContent): Made package private so that the Demo.java can
+ access it.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLayeredPane.java
+ (addImpl): Removed unnecessary repaint() and revalidate() calls.
+ * javax/swing/JPopupMenu.java
+ (remove): Removed unnecessary revalidate() call.
+ (insert): Removed code that installs GridBagConstraints. JPopupMenu
+ uses a BoxLayout and this is not needed anymore.
+ (pack): Send this method call to the event queue to avoid
+ synchronization problems. Set size to preferredSize of this menu.
+ (setVisible): Send this method call to the event queue to avoid
+ synchronization problems. Use PopupFactory for creating a popup.
+ (setLocation): Use int fields instead of a Point field.
+ (Popup): Removed inner interface. We use javax.swing.Popup now.
+ (LightweightPopup): Likewise.
+ (MediumWeightPopup): Likewise.
+ (HeavyWeightPopup): Likewise.
+ * javax/swing/Popup.java
+ (JWindowPopup.JWindowPopup): Add contents to contentPane of window.
+ Set focusableWindowState to false.
+ (JWindowPopup.show): Set size of window here.
+ (LightweightPopup): New inner class.
+ * javax/swing/PopupFactory.java
+ (getPopup): Return heavyweight or lightweight popup depending on
+ the parameters.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (PropertyChangeHandler): Removed unneeded inner class.
+ (BasicMenuItemUI): Removed instantiation of PropertyChangeHandler.
+ (installListeners): Removed handling of the PropertyChangeHandler.
+ (uninstallListeners): Removed handling of the PropertyChangeHandler.
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (getMaximumSize): Don't treat popup menus different.
+
+2005-10-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/classpath/examples/CORBA/NamingService/Demo.java (main):
+ Make arguments not final.
+
+2005-10-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/IDLEntity.java: Deleted.
+ * gnu/CORBA/primitiveTypeCode.java,
+ org/omg/CORBA/PolicyError.java,
+ org/omg/CORBA/TypeCodePackage/BadKind.java,
+ org/omg/CORBA/TypeCodePackage/Bounds.java:
+ Use org.omg.CORBA.portable.IDLEntity.
+
+2005-10-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/interfaces/SocketFactory.java: New file.
+ * gnu/CORBA/interfaces/gnuSocketFactory.java: Deleted.
+ * gnu/CORBA/DefaultSocketFactory.java,
+ gnu/CORBA/Functional_ORB.java,
+ org/omg/CORBA/ORB.java: Replacing gnuSocketFactory into SocketFactory.
+
+2005-10-25 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CosNaming/BindingIteratorHelper.java,
+ org/omg/CosNaming/NamingContextExtHelper.java,
+ org/omg/CosNaming/NamingContextHelper.java,
+ org/omg/DynamicAny/DynAnyFactoryHelper.java,
+ org/omg/DynamicAny/DynAnyHelper.java,
+ org/omg/DynamicAny/DynArrayHelper.java,
+ org/omg/DynamicAny/DynEnumHelper.java,
+ org/omg/DynamicAny/DynFixedHelper.java,
+ org/omg/DynamicAny/DynSequenceHelper.java,
+ org/omg/DynamicAny/DynStructHelper.java,
+ org/omg/DynamicAny/DynUnionHelper.java,
+ org/omg/DynamicAny/DynValueHelper.java,
+ org/omg/IOP/CodecFactoryHelper.java,
+ org/omg/PortableInterceptor/CurrentHelper.java,
+ org/omg/PortableServer/ServantActivatorHelper.java,
+ org/omg/PortableServer/ServantLocatorHelper.java: Added
+ unchecked_narrow method.
+
+2005-10-25 Roman Kennke <kennke@aicas.com>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen):
+ Call gdk_window_get_root_origin instead of gdk_window_get_origin
+ so that the window decorations are correctly respected.
+
+2005-10-24 Tom Tromey <tromey@redhat.com>
+
+ * java/io/ObjectOutputStream.java (useProtocolVersion): Fixed typo
+ in javadoc.
+
+2005-10-24 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/StringBuffer.java (appendCodePoint): Added @since.
+ * java/lang/StringBuilder.java (insert): New overloads.
+ (appendCodePoint): New method.
+
+2005-10-24 Dalibor Topic <robilad@kaffe.org>
+
+ * test/native/lib/PrimlibInterface.c,
+ * test/native/lib/PrimlibInterface.h,
+ * test/native/lib/PrimlibTest.java:
+ Removed unused test.
+
+2005-10-24 Dalibor Topic <robilad@kaffe.org>
+
+ * native/jni/classpath/primlib.c,
+ native/jni/classpath/primlib.h: Removed since unused.
+
+ * native/jni/classpath/Makefile.am: (libclasspath_la_SOURCES)
+ Removed primlib.c and primlib.h.
+
+2005-10-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ScrollBarDemo.java: New file.
+
+2005-10-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (ModelListener.stateChanged): changed call to getThumbBounds() to
+ updateThumbRect(),
+ (PropertyChangeHandler.propertyChange): likewise, plus added handling
+ for 'enabled' property,
+ (getMaximumSize): return maximum dimension,
+ (getThumbBounds): just return field value,
+ (getTrackBounds): just return field value,
+ (installUI): switch order of calls to installDefaults() and
+ installComponents(),
+ (layoutHScrollBar): reimplemented using new updateThumbRect() method,
+ (layoutVScrollBar): likewise,
+ (updateThumbRect): new method,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added 'ScrollBar.width' default,
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ (MIN_THUMB_SIZE): changed value,
+ (MIN_THUMB_SIZE_FREE_STANDING): new field,
+ (isFreeStanding): set default to true,
+ (scrollBarShadowColor): new field,
+ (installDefaults): initialise scrollBarShadowColor,
+ (createDecreaseButton): retain reference in decreaseButton field,
+ (createIncreaseButton): retain reference in increaseButton field,
+ (paintTrackHorizontal): use scrollBarShadowColor, add special handling
+ for free standing scroll bar in disabled state,
+ (paintTrackVertical): likewise,
+ (paintThumb): separate horizontal and vertical cases,
+ (paintThumbHorizontal): new method,
+ (paintThumbVertical): new method,
+ (getMinimumThumbSize): return different size depending on whether or
+ not the scroll bar is free standing,
+ * javax/swing/plaf/metal/MetalScrollButton.java
+ (paintNorthBorderFreeStanding): modified drawing.
+
+2005-10-24 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/metadata/IIOMetadataFormatImpl.java: Complete.
+ * javax/imageio/metadata/IIOMetadataNode.java: Complete stubs.
+ * javax/imageio/metadata/IIOAttr.java: Replace with
+ IIOMetadataFormatImpl.IIOMetadataNodeAttr. Remove file.
+ * javax/imageio/metadata/IIONamedNodeMap.java: Replace with
+ IIOMetadataNode.IIONamedNodeMap. Remove file.
+ * javax/imageio/metadata/IIONodeList.java: Replace with
+ IIOMetadataNode.IIONodeList. Remove file.
+
+2005-10-24 Tom Tromey <tromey@redhat.com>
+
+ * java/text/AttributedStringIterator.java (getRunLimit): Add
+ explicit qualification.
+ (getRunStart): Likewise.
+
+2005-10-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/AttributedString.java
+ (AttributedString(AttributedCharacterIterator, int, int,
+ AttributedCharacterIterator.Attribute[])): renamed arguments, and
+ updated IllegalArgumentException check,
+ (addAttribute(AttributedCharacterIterator.Attribute, Object, int,
+ int)): likewise,
+ (addAttributes(Map, int, int)): changed IllegalArgumentException to
+ NullPointerException, and modified check for illegal range,
+ * java/text/AttributedStringIterator.java
+ (getRunLimit(Set)): reimplemented,
+ (getRunStart): added API docs,
+ (getRunStart(AttributedCharacterIterator.Attribute)): handle null
+ argument as a special case,
+ (getRunStart(Set)): reimplemented,
+ (getAttribute(AttributedCharacterIterator.Attribute, int)): new
+ private method,
+ (getAttribute(AttributedCharacterIterator.Attribute)): reimplemented
+ using new private method.
+ * java/text/CharacterIterator.java: minor API doc fix.
+
+2005-10-24 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24359
+ * javax/swing/BoxLayout.java:
+ Made class thread safe.
+
+2005-10-23 Tom Tromey <tromey@redhat.com>
+
+ * java/util/InvalidPropertiesFormatException.java: New file.
+
+2005-10-23 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/util/Properties.java
+ (storeToXML(OutputStream,String,String)): Added null pointer checks.
+ (loadFromXML(InputStream)): Implemented.
+ (PropertiesHandler): New class to handle parsing events.
+ (PropertiesHandler()): New constructor.
+ (startDTD(String,String,String)): Implemented.
+ (startElement(String,String,String,Attributes)): Implemented.
+ (characters(char[],int,int)): Implemented.
+ (endElement(String,String,String)): Implemented.
+ (endDocument()): Implemented.
+
+2005-10-23 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * java/lang/Thread.java
+ (sleep): Better exception message.
+
+ * java/security/AccessControlContext.java
+ (checkPermission): Likewise.
+
+ * java/util/ResourceBundle.java
+ (getBundle): Likewise.
+
+ * java/util/SimpleTimeZone.java
+ (setStartRule): Added some documentation.
+
+2005-10-23 Guilhem Lavaux <guilhem@kaffe.org>
+
+ * configure.ac: Added support for "--with-native-libdir" and
+ "--with-glibj-dir". Generate copy-vmresources.sh
+
+ * lib/Makefile.am: Call copy-vmresources.sh to fetch possible vm
+ resources from the vmdirs.
+
+ * lib/copy-vmresources.sh.in: New script file.
+
+ * lib/gen-classlist.sh.in: Include com/ as base package for the
+ vm directories.
+
+ * native/jawt/Makefile.am,
+ native/jni/gtk-peer/Makefile.am,
+ native/jni/java-io/Makefile.am,
+ native/jni/java-lang/Makefile.am,
+ native/jni/java-net/Makefile.am,
+ native/jni/java-nio/Makefile.am,
+ native/jni/java-util/Makefile.am,
+ native/jni/midi-alsa/Makefile.am,
+ native/jni/midi-dssi/Makefile.am,
+ native/jni/qt-peer/Makefile.am,
+ native/jni/xmlj/Makefile.am: Install libraries in nativelibdir
+ and not pkglib.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ PR classpath/22972
+ * java/io/File (createTempFile): Rewritten.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/IOP/RMICustomMaxStreamFormat.java,
+ * org/omg/IOP/ExceptionDetailMessage.java: New files.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Interceptor/Registrator.java (m_prefix): Made static.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/javax/rmi/CORBA/gnuRmiUtil.java (readValue):
+ Do not read fields of the ObjectImpl.
+
+2005-10-23 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT,
+ * org/omg/PortableInterceptor/ACTIVE.java,
+ * org/omg/PortableInterceptor/DISCARDING.java,
+ * org/omg/PortableInterceptor/HOLDING.java,
+ * org/omg/PortableInterceptor/INACTIVE.java,
+ * org/omg/PortableInterceptor/NON_EXISTENT.java: New files.
+
+2005-10-22 Julian Scheid <julian@sektor37.de>
+
+ * java/util/Map.java (Entry.equals): Fixed invalid example code
+ in documentation.
+
+2005-10-22 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/ACTIVITY_COMPLETED.java,
+ * org/omg/CORBA/ACTIVITY_REQUIRED.java,
+ * org/omg/CORBA/BAD_QOS.java,
+ * org/omg/CORBA/CODESET_INCOMPATIBLE.java,
+ * org/omg/CORBA/INVALID_ACTIVITY.java,
+ * org/omg/CORBA/REBIND.java,
+ * org/omg/CORBA/TIMEOUT.java,
+ * org/omg/CORBA/TRANSACTION_MODE.java,
+ * org/omg/CORBA/TRANSACTION_UNAVAILABLE.java: New exceptions.
+
+2005-10-22 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/rmi/CORBA/ValueHandlerMultiFormat.java: New interface.
+ * gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java
+ (getMaximumStreamFormatVersion, writeValue): New methods.
+
+2005-10-22 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URLClassloader.java (addURLs): Add comment about jboss.
+
+2005-10-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+ (BasicCheckBoxMenuItem): Implemented.
+ (installDefaults): Removed method, not in API.
+ (processMouseEvent): Implemented.
+ * javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+ (processMouseEvent): Implemented.
+
+2005-10-21 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * configure.ac: Also check for pangoft2 without cairo and
+ additionally check for freetype2.
+ * native/jni/gtk-peer/Makefile.am: Added X, pangoft2 and
+ freetype2 CFLAGS and LDFLAGS.
+
+2005-10-21 Nicolas Geoffray <nicolas.geoffray@menlina.com>
+
+ * vm/reference/java/lang/VMClassLoader.java
+ (getResources): uses a new static field HashMap to
+ store opened zip files from property java.boot.class.path.
+
+2005-10-21 Nicolas Geoffray <nicolas.geoffray@menlina.com>
+
+ * vm/reference/java/lang/VMClassLoader.java
+ (getRessources): In case the property java.boot.class.path
+ contains directories, tests if the ressource exists before adding
+ it to the vector result.
+
+2005-10-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (paint): Only paint focus if enabled.
+
+2005-10-21 David Daney <ddaney@avtrex.com>
+
+ * NEWS: Added entry about HttpURLConnection improvements.
+
+2005-10-21 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/DefaultSocketFactory.java,
+ * gnu/CORBA/interfaces/gnuSocketFactory.java,
+ * gnu/CORBA/interfaces/package.html: New files.
+ * gnu/CORBA/Functional_ORB.java,
+ * gnu/CORBA/Focused_ORB.java (getPortServer),
+ * gnu/CORBA/GIOP/ErrorMessage.java (send),
+ * gnu/CORBA/gnuRequest.java (submit): Rewritten to support
+ gnu.Corba.SocketFactory property.
+ * org/omg/CORBA/ORB.java: Documentation update.
+
+2005-10-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPopupMenu.java
+ (show): Fixed to set the size if it was never set.
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (menuDeselected): Added check to prevent NPE.
+ * javax/swing/plaf/basic/BasicSeparatorUI.java:
+ Removed minSize, horizontalPrefSize, verticalPrefSize and
+ maxSize fields. They were causing problems when other classes
+ were setting this variables to something else. More reliable if
+ actual value is returned.
+ (getPreferredSize): Returned appropriate values.
+ (getMinimumSize): Likewise.
+ (getMaximumSize): Likewise.
+
+2005-10-21 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/reflect/Proxy.java
+ (ProxyType.ProxyType): Don't replace null with system class loader.
+ (ProxyType.hashCode): Handle null loader.
+
+2005-10-20 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/DefaultListSelectionModel.java:
+ (setLeadSelectionIndex): If the selection mode is SINGLE_SELECTION then
+ pass this call to setSelectionInterval.
+ (addSelectionInterval): If the selection mode is SINGLE_SELECTION then
+ pass the call to setSelectionInterval and avoid the lengthy checks
+ that don't apply to this mode.
+ * javax/swing/JList.java:
+ (getSelectedIndices): Changed bounds of for loop to include the
+ maxSelectionIndex.
+
+2005-10-20 Lillian Angel <langel@redhat.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkRadio): Changed to create a panel that contains
+ 2 buttons in a ButtonGroup.
+ * javax/swing/ButtonGroup.java
+ (add): Fixed to initialize sel if the newly added
+ button is already selected.
+ * javax/swing/JToggleButton.java
+ (isSelected): Implemented.
+ (setSelected): Implemented.
+ * javax/swing/plaf/metal/MetalRadioButtonUI.java
+ (paintFocus): Fixed size of border drawn around the
+ radio button.
+
+2005-10-20 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/ScrollPaneAdjustable.java:
+ (addAdjustmentListener): If parameter is null take no action and throw
+ no exception. Store the resulting listener chain from call to
+ AWTEventMulticaster.add.
+ (removeAdjustmentListener): If parameter is null take no action and
+ throw no exception. Store the resulting listener chain from call to
+ AWTEventMulticaster.remove.
+
+2005-10-20 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/LookAndFeel.java:
+ (loadKeyBindings): Implemented and added docs.
+ (makeComponentInputMap): Likewise.
+ (makeInputMap): Likewise.
+ (makeKeyBindings): Likewise.
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (convertModifiers): Removed this no longer needed private method.
+ (installKeyboardActions): Removed the code relating to modifier
+ conversion and made code more readable by using local variables.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (convertModifiers): Removed this no longer needed private method.
+ (installKeyboardActions): Removed the code relating to modifier
+ conversion and made code more readbale by using local variables.
+
+2005-10-20 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Added new ItemListener field.
+ (BasicMenuItemUI): Initialized new field.
+ (installListeners): Installed new listener.
+ (removeListeners): Removed new listener.
+ (MenuDragMouseHandler): Class should be private, not
+ in API.
+ (MenuKeyHandler): Likewise.
+ (PropertyChangeHandler): Likewise.
+ (ItemHandler): New class implemented to change the
+ state of the menu item if it is a checkbox menu item.
+
+2005-10-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/BoxView.java
+ (layoutMinorAxis): Calculate total requirements before calling
+ the SizeRequirements utility method. Avoids an NPE.
+
+2005-10-20 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java: Updated API docs all
+ over, plus:
+ (defaultSize): removed field,
+ (upIcon): removed field,
+ (downIcon): removed field,
+ (leftIcon): removed field,
+ (rightIcon): removed field,
+ (darkShadow): changed color value,
+ (paint): ignore insets for triangle positioning, but check 'armed'
+ state,
+ (paintTriangle): delegate to new private methods depending on
+ direction,
+ (paintTriangleNorth): new private method,
+ (paintTriangleSouth): new private method,
+ (paintTriangleEast): new private method,
+ (paintTriangleWest): new private method.
+
+2005-10-20 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/ietf/jgss/GSSCredential.java (hashCode),
+ * org/ietf/jgss/GSSName.java (hashCode): New declarations.
+
+2005-10-19 Mark Wielaard <mark@klomp.org>
+
+ * java/net/URLClassLoader.java (addURLs): Don't call addURL(), but
+ call urls.add() and addURLImpl() directly on each URL.
+
+2005-10-19 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * javax/swing/text/html/HTMLEditorKit.java: Add missing import.
+
+2005-10-19 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/text/html/HTMLEditorKit.java (getParser): New method.
+
+2005-10-19 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/text/html/parser/ContentModel.java: Fixed comments for
+ parameterless constructor.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (getDebugGraphicsOptions): Removed debug output.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (isShowing): Fixed condition.
+ (show): Only repaint if component is showing.
+ (hide): Only repaint if component was showing.
+
+2005-10-19 Mark Wielaard <mark@klomp.org>
+
+ * javax/security/auth/login/LoginContext.java (lookupModule):
+ Load LoginModule through Thread context class loader.
+
+2005-10-19 Mark Wielaard <mark@klomp.org>
+
+ * java/net/Socket.java (getImpl): Chain exception before throwing.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractSpinnerModel.java
+ * javax/swing/ActionMap.java
+ * javax/swing/BoundedRangeModel.java
+ * javax/swing/Box.java
+ * javax/swing/BoxLayout.java
+ * javax/swing/ButtonGroup.java
+ * javax/swing/CellEditor.java
+ * javax/swing/CellRendererPane.java
+ * javax/swing/ComboBoxEditor.java
+ * javax/swing/DefaultButtonModel.java
+ * javax/swing/DefaultCellEditor.java
+ * javax/swing/DefaultDesktopManager.java
+ * javax/swing/DefaultListCellRenderer.java
+ * javax/swing/DesktopManager.java
+ * javax/swing/ImageIcon.java
+ * javax/swing/InputVerifier.java
+ * javax/swing/JCheckBoxMenuItem.java
+ * javax/swing/JColorChooser.java
+ * javax/swing/JDesktopPane.java
+ * javax/swing/JFileChooser.java
+ * javax/swing/JLayeredPane.java
+ * javax/swing/JList.java
+ * javax/swing/JMenu.java
+ * javax/swing/JMenuBar.java
+ * javax/swing/JMenuItem.java
+ * javax/swing/JOptionPane.java
+ * javax/swing/JPasswordField.java
+ * javax/swing/JPopupMenu.java
+ * javax/swing/JProgressBar.java
+ * javax/swing/JRadioButtonMenuItem.java
+ * javax/swing/JRootPane.java
+ * javax/swing/JSeparator.java
+ * javax/swing/JSlider.java
+ * javax/swing/JSpinner.java
+ * javax/swing/JSplitPane.java
+ * javax/swing/JTabbedPane.java
+ * javax/swing/JTable.java
+ * javax/swing/JTextPane.java
+ * javax/swing/JToolBar.java
+ * javax/swing/JToolTip.java
+ * javax/swing/JTree.java
+ * javax/swing/KeyStroke.java
+ * javax/swing/LookAndFeel.java
+ * javax/swing/MutableComboBoxModel.java
+ * javax/swing/Popup.java
+ * javax/swing/PopupFactory.java
+ * javax/swing/RepaintManager.java
+ * javax/swing/SortingFocusTraversalPolicy.java
+ * javax/swing/Spring.java
+ * javax/swing/SwingUtilities.java
+ * javax/swing/ToolTipManager.java
+ * javax/swing/TransferHandler.java
+ * javax/swing/ViewportLayout.java
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors. Removed some unneeded imports. Removed
+ unneeded serialization methods.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/OverlayLayout.java
+ (checkLayout): Respect the container's insets correctly.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLabel.java
+ (setText): Call revalidate() and repaint().
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JEditorPane.java
+ Added comments to empty blocks.
+ (read): Implemented this previously stubbed method.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComboBox.java
+ Added comments to empty blocks.
+ (writeObject): Removed unnecessary serialization method.
+ (processKeyEvent): Implemented this previously stubbed method.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JButton.java
+ (removeNotify): Implemented this previously stubbed method.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/undo/CannotRedoException.java
+ * javax/swing/undo/CannotUndoException.java
+ Put super() call in empty constructors.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/tree/DefaultMutableTreeNode.java
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ * javax/swing/tree/TreeCellRenderer.java
+ * javax/swing/tree/TreeModel.java
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors. Removed some unneeded imports.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/AbstractDocument.java
+ * javax/swing/text/AttributeSet.java
+ * javax/swing/text/ComponentView.java
+ * javax/swing/text/DefaultCaret.java
+ * javax/swing/text/DefaultEditorKit.java
+ * javax/swing/text/DefaultHighlighter.java
+ * javax/swing/text/EditorKit.java
+ * javax/swing/text/FieldView.java
+ * javax/swing/text/FlowView.java
+ * javax/swing/text/GlyphView.java
+ * javax/swing/text/JTextComponent.java
+ * javax/swing/text/LayoutQueue.java
+ * javax/swing/text/PlainView.java
+ * javax/swing/text/Segment.java
+ * javax/swing/text/StyledDocument.java
+ * javax/swing/text/html/HTMLEditorKit.java
+ * javax/swing/text/html/HTMLFrameHyperlinkEvent.java
+ * javax/swing/text/html/parser/DocumentParser.java
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors. Removed some unneeded imports.
+
+2005-10-19 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java
+ (buttonBorder): removed,
+ (BasicArrowButton): don't set border, use default border,
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (configureArrowButton): don't set margin here,
+ (getPreferredSize): added comment,
+ (getMinimumSize): icon width is the same as the display area height,
+ (getDefaultSize): return size of space char plus 1 pixel margin,
+ (getDisplaySize): take into account the prototype display value, if
+ there is one,
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): updated 'Button.margin' default,
+ * javax/swing/plaf/metal/MetalComboBoxButton.java
+ (MetalComboBoxButton(JComboBox, Icon, boolean, CellRendererPane,
+ JList)): check for null JComboBox, don't set margin here,
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ (createArrowButton): set margin,
+ (getMinimumSize): reimplemented,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): changed 'Button.margin' default to from Insets
+ to InsetsUIResource.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/html/HTML.java
+ * javax/swing/text/html/HTMLDocument.java
+ Filled emtpy blocks with comments.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/html/parser/ContentModel.java
+ * javax/swing/text/html/parser/DTD.java
+ * javax/swing/text/html/parser/DocumentParser.java
+ * javax/swing/text/html/parser/Element.java
+ * javax/swing/text/html/parser/Parser.java
+ Filled emtpy blocks with comments.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/TableColumnModel.java:
+ Fixed some minor API doc errors.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/ActionMapUIResource.java
+ * javax/swing/plaf/BorderUIResource.java
+ * javax/swing/plaf/ButtonUI.java
+ * javax/swing/plaf/ColorChooserUI.java
+ * javax/swing/plaf/ColorUIResource.java
+ * javax/swing/plaf/ComboBoxUI.java
+ * javax/swing/plaf/ComponentInputMapUIResource.java
+ * javax/swing/plaf/DesktopIconUI.java
+ * javax/swing/plaf/DesktopPaneUI.java
+ * javax/swing/plaf/DimensionUIResource.java
+ * javax/swing/plaf/FileChooserUI.java
+ * javax/swing/plaf/FontUIResource.java
+ * javax/swing/plaf/IconUIResource.java
+ * javax/swing/plaf/InputMapUIResource.java
+ * javax/swing/plaf/InsetsUIResource.java
+ * javax/swing/plaf/InternalFrameUI.java
+ * javax/swing/plaf/LabelUI.java
+ * javax/swing/plaf/ListUI.java
+ * javax/swing/plaf/MenuBarUI.java
+ * javax/swing/plaf/MenuItemUI.java
+ * javax/swing/plaf/PanelUI.java
+ * javax/swing/plaf/PopupMenuUI.java
+ * javax/swing/plaf/ProgressBarUI.java
+ * javax/swing/plaf/RootPaneUI.java
+ * javax/swing/plaf/ScrollBarUI.java
+ * javax/swing/plaf/ScrollPaneUI.java
+ * javax/swing/plaf/SeparatorUI.java
+ * javax/swing/plaf/SliderUI.java
+ * javax/swing/plaf/SpinnerUI.java
+ * javax/swing/plaf/SplitPaneUI.java
+ * javax/swing/plaf/TabbedPaneUI.java
+ * javax/swing/plaf/TableHeaderUI.java
+ * javax/swing/plaf/TableUI.java
+ * javax/swing/plaf/TextUI.java
+ * javax/swing/plaf/ToolBarUI.java
+ * javax/swing/plaf/ToolTipUI.java
+ * javax/swing/plaf/TreeUI.java
+ * javax/swing/plaf/UIResource.java
+ * javax/swing/plaf/ViewportUI.java
+ Reformatted slightly. Filled emtpy blocks with comments.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/ComponentUI.java
+ Filled empty blocks with comments.
+ (update): Reverted my patch from 2005-10-12. This is wrong. If there
+ are still clipping problems, then certainly in another area.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/multi/MultiLookAndFeel.java
+ Filled empty block with comment.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ * javax/swing/plaf/metal/MetalButtonListener.java
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ * javax/swing/plaf/metal/MetalFileChooserUI.java
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+ * javax/swing/plaf/metal/MetalProgressBarUI.java
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ * javax/swing/plaf/metal/MetalSliderUI.java
+ * javax/swing/plaf/metal/MetalSplitPaneUI.java
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java
+ * javax/swing/plaf/metal/MetalTextFieldUI.java
+ * javax/swing/plaf/metal/MetalToolBarUI.java
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ * javax/swing/plaf/metal/MetalUtils.java:
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors. Removed some unneeded imports.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (getDebugGraphicsOptions): Fixed to load system property if present.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/DebugGraphics.java
+ (counter): New field.
+ (color): Removed unneeded field.
+ (DebugGraphics()): Count up.
+ (DebugGraphics(Graphics,JComponent)): Call this(Graphics).
+ (DebugGraphics(Graphics)): Call this().
+ (setColor): Implemented logging facility.
+ (create): Copy debugOptions over to new DebugGraphics instance.
+ (create(int,int,int,int)): Likewise.
+ (setFont): Implemented logging facility.
+ (getColor): Return graphics.getColor().
+ (translate): Implemented logging facility.
+ (setPaintMode): Likewise.
+ (setXORMode): Likewise.
+ (clipRect): Likewise.
+ (setClip(int,int,int,int)): Likewise.
+ (setClip(Shape)): Likewise.
+ (drawRect): Likewise. Only flash when FLASH_OPTION is set.
+ (fillRect): Likewise.
+ (clearRect): Implemented logging facility.
+ (drawRoundRect): Likewise.
+ (fillRoundRect): Likewise.
+ (drawLine): Likewise.
+ (draw3DRect): Likewise.
+ (fill3DRect): Likewise.
+ (drawOval): Likewise.
+ (fillOval): Likewise.
+ (drawArc): Likewise.
+ (fillArc): Likewise.
+ (drawPolyline): Likewise.
+ (drawPolygon): Likewise.
+ (fillPolygon): Likewise.
+ (drawString(String,int,int)): Likewise.
+ (drawString(AttributedCharacterIterator,int,int)): Likewise.
+ (drawByted): Likewise.
+ (drawChars): Likewise. Only flash if FLASH_OPTION is set.
+ (drawImage): Implemented logging facility. (Also applies to all
+ overloaded versions of this method).
+ (copyArea): Likewise.
+ (setDebugOptions): Likewise.
+ (prefix): New helper method.
+ * javax/swing/JComponent.java
+ (getComponentGraphics): Implemented to return DebugGraphics when
+ needed.
+ (getDebugGraphicsOptions): Implemented to return the correct options.
+ Also, this loads a system property gnu.javax.swing.DebugGraphics
+ if present and evaluates it.
+
+2005-10-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JList.java
+ (getAccessibleContext): Returned an instance of
+ AccessibleJList. Should never return null.
+
+2005-10-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Added MouseListener and removed MouseInputListener.
+ (BasicTreeUI): Initialized mouseListener and removed
+ mouseInputListener.
+ (removeListeners): Removed mouseListener and removed
+ mouseInputListener code.
+ (installListeners): Likewise.
+ (MouseInputHandler.mousePressed): Moved code to MouseHandler.
+ (MouseHandler.mousePressed): Likewise.
+ * javax/swing/plaf/metal/MetalTreeUI.java:
+ Added MouseListener and removed MouseInputListener.
+ (installUI): Initialized mouseListener and removed
+ mouseInputListener.
+ (uninstallUI): Removed mouseListener and removed
+ mouseInputListener code.
+
+2005-10-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicBorders.java
+ * javax/swing/plaf/basic/BasicButtonListener.java
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+ * javax/swing/plaf/basic/BasicComboBoxEditor.java
+ * javax/swing/plaf/basic/BasicComboBoxRenderer.java
+ * javax/swing/plaf/basic/BasicDesktopIconUI.java
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ * javax/swing/plaf/basic/BasicFileChooserUI.java
+ * javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
+ * javax/swing/plaf/basic/BasicGraphicsUtils.java
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ * javax/swing/plaf/basic/BasicLabelUI.java
+ * javax/swing/plaf/basic/BasicListUI.java
+ * javax/swing/plaf/basic/BasicMenuBarUI.java
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ * javax/swing/plaf/basic/BasicPasswordFieldUI.java
+ * javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+ * javax/swing/plaf/basic/BasicRootPaneUI.java
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ * javax/swing/plaf/basic/BasicSplitPaneDivider.java
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java
+ * javax/swing/plaf/basic/BasicTableUI.java
+ * javax/swing/plaf/basic/BasicTextAreaUI.java
+ * javax/swing/plaf/basic/BasicTextUI.java
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ * javax/swing/plaf/basic/BasicViewportUI.java:
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/filechooser/FileFilter.java:
+ * javax/swing/filechooser/FileView.java:
+ Filled empty blocks with comments.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/event/EventListenerList.java:
+ * javax/swing/event/InternalFrameAdapter.java:
+ * javax/swing/event/MouseInputListener.java:
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/colorchooser/AbstractColorChooserPanel.java:
+ * javax/swing/colorchooser/ColorChooserComponentFactory.java:
+ * javax/swing/colorchooser/DefaultSwatchChooserPanel.java:
+ Filled empty blocks with comments.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/border/AbstractBorder.java:
+ * javax/swing/border/BevelBorder.java:
+ * javax/swing/border/Border.java:
+ * javax/swing/border/CompoundBorder.java:
+ * javax/swing/border/EmptyBorder.java:
+ * javax/swing/border/EtchedBorder.java:
+ * javax/swing/border/LineBorder.java:
+ * javax/swing/border/MatteBorder.java:
+ * javax/swing/border/SoftBevelBorder.java:
+ * javax/swing/border/TitledBorder.java:
+ Reformatted slightly. Filled emtpy blocks with comments. Fixed some
+ slight API doc errors
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * java/awt/GridBagLayout.java
+ (GetLayoutInfo): Added a null check for lastComponent. Prevents
+ NPE.
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTable.java
+ (JTable): Moved code around so all models are set before
+ any other function is called. Prevents all NPEs with
+ models.
+
+2005-10-18 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/DefaultListSelectionModel.java:
+ (setLeadSelectionIndex): Avoid index out of bounds error on initial
+ call of this method by checking explicitly for oldLeadIndex being -1.
+ Also remove unused BitSet newRange and oldRange.
+ (moveLeadSelectionIndex): New API method implemented (@since 1.5).
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (ListAction.actionPerformed): Make code more readable by declaring
+ local variables for the actionCommand and for the list's
+ selectionModel. Implemented the following bindings:
+ selectLastRowChangeLead, scrollDownChangeLead, scrollUpChangeLead,
+ selectFirstRowChangeLead, selectNextRowChangeLead,
+ selectPreviousRowChangeLead, addToSelection, toggleAndAnchor,
+ extendTo.
+ (MouseInputHandler.mousePressed): Made code more readable by removing
+ unnecessary full qualification from variable 'list'. Change
+ behaviour of shift-click based on whether or not the anchor index is
+ selected.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ (initComponentDefaults): Added remaining bindings for
+ Table.ancestorMap.
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (TableAction.actionPerformed): Made type of variables rowModel and
+ colModel more specific to avoid many casts later on (makes code more
+ readable). Also declare local variable to store the action command to
+ make the code more readable. Implemented the following bindings:
+ selectNextRowChangeLead, selectPreviousRowChangeLead,
+ selectNextColumnChangeLead, selectPreviousColumnChangeLead,
+ addToSelection, extendTo, toggleAndAnchor. Added commented-out debug
+ statement to print unimplemented bindings when used. Added check for
+ the SPACE character to make sure it doesn't stop editing.
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Removed leafIcon field.
+ (BasicTreeUI): Removed leafIcon initialization.
+ (installDefaults): Icon defaults were wrong, fixed.
+ (isLocationInExpandControl): Fixed to incorporated gap.
+ (mousePressed): Fixed to include correct icon widths. Sometimes
+ the labels icon is different from what the tree's default icon is
+ set to. Added a check for this.
+ (getCellBounds): No need to include gap here.
+ (getCurrentControlIcon): Fixed to use expandedIcon and collapsedIcon.
+ (paintRow): No need paint beyond preferred width of tree here.
+ (updateCurrentVisiblePath): If nothing is selected, the root should
+ be selected without focus.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installDefaults): Fixed defaults for the expanded/collapsed icons.
+
+2005-10-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JComboBox.java
+ (setModel): update the selectedItemReminder field,
+ (selectedItemChanged): only send ItemEvent.SELECTED event if the new
+ selection is non-null.
+
+2005-10-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): only set default editor if the current editor is
+ null or implements UIResource,
+ (uninstallComponents): only clear editor if it implements UIResource.
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installDefaults): Set the selected text color for the
+ text component.
+
+2005-10-18 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (scrollPathToVisible): Reimplemented to make the path visible if its
+ parent is not expanded.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installDefaults): Initialized row height for the tree.
+ (updateCurrentVisiblePath): Updated the visible row count.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installUI): Initialized row height for the tree.
+
+2005-10-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ (editablePropertyChanged): handle null selected item.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (PropertyChangeHandler.propertyChange): Removed repaint call.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ Filled empty blocks with comments.
+ (ButtonChangeListener.stateChanged): Moved implementation from
+ inner class in createChangeListener to this protected class.
+ (setEnabled): Do nothing if actual state does not change.
+ (createChangeListener): Return instance of ButtonChangeListener
+ here.
+
+2005-10-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (buttonBackground): new field,
+ (shadow): renamed buttonShadow,
+ (darkShadow): renamed buttonDarkShadow,
+ (highlight): renamed buttonHighlight,
+ (installDefaults): initialise buttonBackground, plus updates for
+ renamed fields,
+ (uninstallDefaults): clear buttonBackground, plus updates for renamed
+ fields,
+ (createEditor): return subclass that implements UIResource,
+ (createArrowButton): use constructor that accepts colors,
+ (getMaximumSize): fix API doc error,
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): correct 'ComboBox.buttonDarkShadow' default.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (setView): Added repaint() call.
+ (revalidate): Removed unnecessary and unspecified method.
+ (reshape): Fire stateChanged if only the size changes. Do not fire
+ stateChanged if only the location changes.
+ (scrollRectToVisible): Reworked most of this method to correctly
+ determine the scroll offsets. Added validation of view as specified.
+
+2005-10-18 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ScrollPaneLayout.java
+ (preferredLayoutSize): Removed check for JScrollPane argument.
+ Added code to respect the insets of the JScrollPane.
+ (minimumLayoutSize): Likewise.
+ (layoutContainer): Removed check for JScrollPane argument.
+
+2005-10-18 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java
+ (parseContent): Removed bogus println and fixed bug #24422.
+
+2005-10-17 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (setDividerLocation): Added a check for the size
+ of the splitpane, in some cases the divider's
+ initial location was being set to 0.
+
+2005-10-17 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JViewport.java:
+ (scrollRectToVisible): Return immediately if the View is null. Check
+ for contentRect being bigger than the port bounds separately in each
+ direction, rather than together.
+ * javax/swing/plaf/basic/BasicListUI.java:
+ (KeyHandler): Removed this private class that listened directly for
+ key presses. This is now handled through InputMap-ActionMap pairs.
+ (ActionListenerProxy): New class to wrap the Actions for this lists
+ ActionMap.
+ (ListAction): New class, the actions for keypresses on this list.
+ (convertModifiers): New private method converts key press modifiers to
+ the old style (CTRL_MASK instead of CTRL_DOWN_MASK, etc.).
+ (installKeyboardActions): Get the InputMap from the UIManager and
+ register new InputMap-ActionMap pairs, then set these as the parents
+ of the list's InputMap and ActionMap.
+ (selectNextIndex): Avoid NPE by checking if we're already at the last
+ index.
+ (selectPreviousIndex): Check if we're already at the first index.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java:
+ (initComponentDefaults): Added bindings for List.focusInputMap.
+
+2005-10-17 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installUI): Moved call to installKeyboardActions and Listeners
+ to before expansion of root.
+ (paint): Added check to make sure the cached visible path is updated.
+ (treeExpanded): Added call to update visible path.
+ (treeCollapsed): Likewise.
+ (treeNodesChanged): Likewise.
+ (treeNodesInserted): Likewise.
+ (treeNodesRemoved): Likewise.
+ (treeStructureChanged): Likewise.
+ (paintRecursive): Moved code to paintRow.
+ (paintControlIcons): Fixed to paint custom control icons properly.
+ (paintExpandControl): Removed unneeded parameter.
+ (paintRow): Added code to paint the row with the correct width.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installUI): Moved code to expand the root after all the listeners
+ have been initialized.
+
+2005-10-17 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (ItemHandler.itemStateChanged): if combo box is editable, update edit
+ text field with new selection.
+
+2005-10-17 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/event/ListDataListener:
+ reformatted and added API docs.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): Set size according to the size property instead of
+ the preferredSize property.
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ (ListMouseHandler.mouseReleased): Set comboBox selected index before
+ closing the popup.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/DefaultTableCellRenderer.java
+ (getTableCellRendererComponent): Setup colors (more) correctly.
+ * javax/swing/DefaultListSelectionModel.java
+ (isSelectedIndex): Check for an illegal index argument.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ Filled empty blocks with comments.
+ (setVisible): Notify AncestorListeners when visibility state is
+ changed.
+ (removeNotifiy): Notify AncestorListeners via fireAncestorEvent
+ method.
+ (addNotifiy): Notify AncestorListeners via fireAncestorEvent
+ method.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (setView): Removed unnecessary loop. We only have on component.
+ (isOptimizedDrawingEnabled): Added comment explaining why this
+ method is necessary.
+
+2005-10-17 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ Filled empty blocks with comments.
+ (FocusHandler.focusLost): Close popup when the combobox loses focus.
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ Filled empty blocks with comments.
+ (updateListBoxSelectionForEvent): Implemented partly.
+ (ListMouseHandler.mouseReleased): Call updateListBoxSelectionForEvent.
+ (ListMouseMotionHandler.mouseReleased): Likewise.
+
+2005-10-17 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java:
+ (CustomCellRenderer): new inner class,
+ (comboState6): new field,
+ (combo11): new field,
+ (combo12): new field,
+ (createContent): add panel from createPanel6(),
+ (createPanel6): new method,
+ (actionPerformed): update state for new JComboBoxes,
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): don't create arrowButton until after listBox is
+ created, set listBox to the JList created by the popup,
+ * javax/swing/plaf/metal/MetalComboBoxButton.java:
+ (MetalComboBoxButton(JComboBox, Icon, boolean, CellRendererPane,
+ JList)): set margins to zero,
+ (paintComponent): use list cell renderer to paint button content,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): add 'List.font' default.
+
+2005-10-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/util/Properties.java:
+ (storeToXML(OutputStream,String)): Implemented.
+ (storeToXml(OutputStream,String,String)): Likewise.
+
+2005-10-17 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Focused_ORB.java: New file.
+ * gnu/CORBA/Functional_ORB.java,
+ org/omg/CORBA/ORB.java: Adapted to support the
+ gnu.CORBA.ListenerPort property.
+
+2005-10-15 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/DynamicImplementation.java: Made concrete.
+ (invoke): Implemented.
+ gnu/CORBA/Simple_delegate.java (request): Implemented.
+
+2005-10-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (treeNodesChanged): Added call to revalidate and resize tree.
+ * javax/swing/tree/DefaultTreeModel.java
+ (insertNodeInto): Needed to set parent for new node.
+
+2005-10-14 Robert Schuster <robertschuster@fsfe.org>
+
+ * java/net/URLStreamHandler.java:
+ (toExternalForm): Use "//" + authority format when file part starts
+ with two slashes.
+
+2005-10-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintLock): Removed unneeded field.
+ (isCompletelyDirty): New field.
+ (setBorder): Don't get active if actual value didn't change.
+ Otherwise trigger a repaint.
+ (paint): Mark this component as clean after painting when the clip
+ covered the whole component.
+ (paintImmediately): Find more sensible paint root via new helper
+ methods.
+ (paintDoubleBuffered): Don't synchronize here.
+ (setFont): Don't get active if actual value didn't change.
+ Otherwise trigger a repaint and revalidate.
+ (setBackground): Don't get active if actual value didn't change.
+ Otherwise trigger a repaint.
+ (setForeground): Don't get active if actual value didn't change.
+ Otherwise trigger a repaint.
+ (setUI): Trigger a repaint.
+ (findPaintRoot): New helper method.
+ (findOverlapFreeParent): New helper method.
+ (findOpaqueParent): New helper method.
+ * javax/swing/RepaintManager.java
+ (ComponentComparator): New inner class. Used to sort components
+ according to their depth in the containment hierarchy.
+ (dirtyComponents): Use HashMap instead of Hashtable.
+ (workDirtyComponents): New field.
+ (repaintOrder): New field.
+ (workRepaintOrder): New field.
+ (comparator): New field.
+ (invalidComponents): Use ArrayList instead of Vector.
+ (workInvalidComponents): New field.
+ (RepaintManager): Initialize new fields.
+ (removeInvalidComponent): Adjusted for ArrayList.
+ (addDirtyRegion): Return if component in question is not showing.
+ Insert the new component in the repaintOrder list.
+ (insertRepaintOrder): New method. Maintains a sorted list of
+ components.
+ (getDirtyRegion): Return empty Rectangle instead of null when
+ component is not dirty, as specified.
+ (markCompletelyDirty): Set flag in JComponent.
+ (markCompletelyClean): Synchronize access to fields.
+ (isCompletelyDirty): Use flag in JComponent to determine this
+ property.
+ (validateInvalidComponents): Use workInvalidComponents when
+ revalidating. This avoids blocking of application threads
+ in revalidate() calls.
+ (paintDirtyRegion): Use work* fields when
+ repainting. This avoids blocking of application threads
+ in repaint() calls. Simplify actual work, now we simply call
+ paintImmediatly() on the dirty components.
+
+2005-10-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/LookAndFeel.java
+ (makeIcon): Implemented.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (updateCachedPreferredSize): Should only add with of control icon if
+ not a leaf.
+ (mousePressed): Fixed to use new gap field.
+ (paintRecursive): Likewise.
+ (paintRow): Likewise.
+ (updateCurrentVisiblePath): Shouldn't include root if it is
+ not of a valid size to be painted.
+
+2005-10-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLayeredPane.java
+ (isOptimizedDrawingEnabled): New method.
+
+2005-10-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/PolicyErrorHelper.java,
+ org/omg/CORBA/PolicyErrorHolder.java,
+ org/omg/CORBA/UnknownUserExceptionHelper.java,
+ org/omg/CORBA/UnknownUserExceptionHolder.java,
+ org/omg/CORBA/WrongTransactionHelper.java,
+ org/omg/CORBA/WrongTransactionHolder.java: New files.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (nextTabStop): Tab size should be multiplied by the width of 'm', not
+ added to it.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (getTabSize): Check the Document's properties for
+ PlainDocument.tabSizeAttribute before defaulting to 8.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/BoxView.java:
+ (preferenceChanged): New method (overrides method in View). Set flag
+ indicating that cached layout information is invalid, then call super
+ implementation.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/CompositeView.java: Minor doc fixes.
+ * javax/swing/text/BoxView.java: Minor doc fixes.
+
+2005-10-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (getAccessibleContext): Fixed API docs, and returned the correct value.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (updateCachedPreferredSize): Fixed parameter passed to isLeaf, node
+ should be passed in and not a path.
+
+2005-10-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/DefaultCaret.java:
+ (ALWAYS_UPDATE): New field.
+ (NEVER_UPDATE): New field.
+ (UPDATE_WHEN_ON_EDIT): New field.
+ (insertUpdate): Fixed docs. Only update the dot if the policy is
+ ALWAYS_UPDATE or if the policy is UPDATE_WHEN_ON_EDT and the event
+ was generated on the Event Dispatch thread.
+ (removeUpdate): Fixed docs. Only update the dot if the policy is
+ ALWAYS_UPDATE, if the policy is UPDATE_WHEN_ON_EDT and the event was
+ generated on the Event Dispatch thread, or if the document length
+ has become less than the current dot position.
+ (setUpdatePolicy): New method.
+ (getUpdatePolicy): New method.
+
+2005-10-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (layoutContainer): Perform layout inside the container's treeLock.
+ Respect the insets of the container.
+
+2005-10-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (getAccessibleSelectionCount): Fixed API documentation.
+ (getScrollableTracksViewportWidth): Was using height instead of
+ width, fixed this.
+ (getScrollableTracksViewportHeight): Likewise.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (BasicTreeUI): Initialized validCachedPreferredSize.
+ (updateCachedPreferredSize): Implemented.
+ (pathWasExpanded): Implemented.
+ (pathWasCollapsed): Implemented.
+ (installDefaults): Fixed API documentation.
+ (uninstallDefaults): Likewise.
+ (setPreferredMinSize): Likewise.
+ (getPreferredMinSize): Likewise.
+ (getPreferredSize): Reimplemented to use updateCachedPreferredSize.
+ (startEditing): set validCachedPreferredSize.
+ (editingStopped): Likewise.
+ (editingCanceled): Likewise.
+ (treeExpanded): Likewise.
+ (treeCollaped): Likewise.
+ (treeNodesInserted): Likewise.
+ (treeNodesRemoved): Likewise.
+ (treeStructureChanged): Likewise.
+ (getNextVisibleNode): Fixed API documentation.
+ (getNextNode): Likewise.
+ (getNextSibling): Likewise.
+ (getPreviousSibling): Likewise.
+ (getLevel): Likewise.
+ (paintVerticalPartOfLeg): Likewise.
+
+2005-10-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/PolicyErrorCodeHelper.java: New class.
+
+2005-10-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CORBA/LocalObject.java (_get_interface, _invoke, _is_local,
+ _orb, _releaseReply, _request, _servant_postinvoke, _servant_preinvoke,
+ validate_connection): New methods.
+
+2005-10-14 Michael Koch <konqueror@gmx.de>
+
+ * native/jni/midi-alsa/.cvsignore,
+ native/jni/midi-dssi/.cvsignore: New files
+
+2005-10-13 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/ObjectCreator.java (forName):
+ Use gnu.classpath.VMStackWalker.
+ * gnu/CORBA/Interceptor/Registrator.java,
+ gnu/CORBA/gnuValueHolder.java,
+ gnu/CORBA/stubFinder.java,
+ gnu/javax/rmi/CORBA/DelegateFactory.java,
+ gnu/javax/rmi/CORBA/StubDelegateImpl.java,
+ org/omg/CORBA/ORB.java: Load class via ObjectCreator.
+
+2005-10-13 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (updateDamage): Made this method protected, not package-private.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (xChildren): New field.
+ (yChildren): New field.
+ (xTotal): New field.
+ (yTotal): New field.
+ (offsetsX): New field.
+ (offsetsY): New field.
+ (spansX): New field.
+ (spansY): New field.
+ (preferredLayoutSize): Rewritted to use cached values if available.
+ (minimumLayoutSize): Rewritted to use cached values if available.
+ (maximumLayoutSize): Rewritted to use cached values if available.
+ (layoutContainer): Rewritted to use cached values if available.
+ (getAlignmentX): Implemented.
+ (getAlignmentY): Implemented.
+ (invalidateLayout): Clear the cache.
+ (getSizeRequirements): Removed unneeded method. Replaced by
+ checkRequirements().
+ (checkTotalRequirements): New helper method.
+ (checkRequirements): New helper method.
+ (checkLayout): New helper method.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (calculateAlignedPositions): Determine baseline using the total
+ requirements argument.
+ (adjustFromRight): Use float instead of int for baseline argument.
+ Don't handle the <minimum case.
+ (adjustFromLeft): Likewise.
+
+2005-10-13 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Added leafIcon field.
+ (BasicTreeUI): Initialized leafIcon field.
+ (installDefaults): Fixed icon defaults.
+ (getPreferredSize): Fixed up code slightly.
+ (startEditing): Called revalidate because size of
+ view may change.
+ (EditingStopped): Likewise.
+ (EditingCanceled): Likewise.
+ (mousePressed): Fixed up icon sizes.
+ (paintRecursive): Fixed up width painted.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installDefaults): Fixed icon defaults.
+
+2005-10-13 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java:
+ (paint): Reset the clip of the Graphics object after each iteration.
+
+2005-10-13 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java:
+ (installDefaults): Initialize rendererPane.
+ (paintCell): New method to paint an individual cell using a
+ CellRendererPane, taking borders and highlighting into account.
+ (paint): Removed direct painting code, let paintCell handle this.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ScrollPaneLayout.java
+ (preferredLayoutSize): Added some more null checks to avoid NPEs.
+ (minimumLayoutSize): Added some more null checks to avoid NPEs.
+
+2005-10-13 Jan Roehrich <jan@roehrich.info>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installUI): Fixed setting of local JTree reference
+
+2005-10-13 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPreferredSize): Added check to prevent NPE.
+ (mousePressed): Likewise.
+ (paintRecursive): Likewise.
+ (paintExpandedControlIcons): Likewise.
+ (paintRow): Fixed painting location of textarea.
+
+2005-10-13 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (updateDamage): Repaint the container if a new line is added.
+
+2005-10-13 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPathForRow): Added check to prevent NPE.
+ (getRowCount): Likewise.
+ (getRowForPath): Likewise.
+ (getPreferredSize): Adjusted width depending on x location and
+ icon.
+ (paintRecursive): Likewise.
+ (getPreviousNode): Added check to prevent NPE.
+ (getNextVisibleNode): Likewise.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/PlainView.java
+ (lineBuffer): New field used as buffer to fetch text from a
+ document.
+ (getLineBuffer): New method, provides access to the new field
+ above.
+ (modelToView): Use new lineBuffer.
+ (drawSelectedText): Likewise.
+ (drawUnselectedText): Likewise.
+ (determineMaxLineLength): Likewise.
+ (viewToModel): Likewise.
+ (updateDamage): Likewise.
+
+2005-10-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/JTextComponent.java
+ (replaceSelection): Removed debug statement.
+ * javax/swing/text/PlainView.java
+ (updateDamage): Removed unnecessary repaint call.
+ (damageLineRange): Trigger repaint over the whole width of the
+ text component at the requested line range. Otherwise we might
+ not clear deleted text.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (DocumentHandler.changedUpdate): Use visibleEditorRect as
+ initial allocation.
+ (DocumentHandler.removeUpdate): Use visibleEditorRect as
+ initial allocation.
+ (DocumentHandler.insertUpdate): Use visibleEditorRect as
+ initial allocation.
+ (getVisibleEditorRect): If component width and height values are
+ invalid (==uninitialized), return a Rectangle of (0,0,0,0) instead
+ of null.
+
+2005-10-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalFileChooserUI.java
+ (DirectoryComboBoxAction): new inner class,
+ (FileRenderer): new inner class,
+ (directoryModel): new private field.
+
+2005-10-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added default value for
+ 'List.focusCellHighlightBorder'.
+
+2005-10-12 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/UIDefaults.java
+ (getUIClass): Fixed to use the system class loader if
+ the loader is null.
+
+2005-10-12 David Daney <ddaney@avtrex.com>
+
+ PR classpath/24259
+ * gnu/java/net/LineInputStream.java: Import BufferedInputStream.
+ (Constructor): Don't do blockReads on BufferedInputStreams.
+ (readLine): Rename MIN_LENGTH to MAX_LENGTH. Limit buffer size to
+ MAX_LENGTH.
+
+2005-10-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTable.java: Fixed some API docs and unused imports.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintImmediately): Find the paint root more cleverly, instead of
+ going up to the root.
+ (findPaintRoot): New helper method.
+ (findOverlapFreeParent): New helper method.
+ (findOpaqueParent): New helper method.
+ * javax/swing/RepaintManager.java
+ (addDirtyRegion): Collapse overlapping dirty regions into single
+ regions.
+ (paintDirtyRegions): Simple iterator over dirty regions and
+ paint them. The optimizations are done in JComponent and
+ addDirtyRegion.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ScrollPaneLayout.java
+ (minimumLayoutSize): Added checks to avoid NPEs.
+
+2005-10-12 David Daney <ddaney@avtrex.com>
+
+ PR classpath/24086, PR classpath/24091, PR classpath/24104
+ * gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java: Removed.
+ * gnu/java/net/protocol/http/ResponseBodyReader.java: Removed.
+ * gnu/java/net/protocol/http/event/ConnectionEvent.java: Removed.
+ * gnu/java/net/protocol/http/event/ConnectionListener.java: Removed.
+ * gnu/java/net/protocol/http/event/RequestEvent.java: Removed.
+ * gnu/java/net/protocol/http/event/RequestListener.java: Removed.
+ * gnu/java/net/protocol/http/event/package.html: Removed.
+ * gnu/java/net/protocol/http/HTTPConnection.java: Cleaned up imports.
+ (connectionListeners): Removed.
+ (requestListeners): Removed.
+ (pool): New field.
+ (Constructor): Don't initialize connectionListeners or
+ requestListeners.
+ (useCount): New field.
+ (getPoolKey): New method.
+ (setPool): New method.
+ (release): New method.
+ (newRequest): Don't call fireRequestEvent. Use StringBuilder instead
+ of StringBuffer.
+ (close): Don't call fireConnectionEvent.
+ (getURI):Use StringBuilder instead of StringBuffer.
+ (addConnectionListener): Removed.
+ (removeConnectionListener): Removed.
+ (fireConnectionEvent): Removed.
+ (addRequestListener): Removed.
+ (removeRequestListener): Removed.
+ (fireRequestEvent): Removed.
+ * gnu/java/net/protocol/http/HTTPURLConnection.java:Cleaned up imports.
+ (connectionPool): Changed type to LinkedHashMap.
+ (maxConnections): Made static.
+ (responseSink): Changed type to InputStream.
+ (errorSink): Likewise.
+ (connect): Eliminate reader. Get responseSink from response.
+ (getConnection): Rewrote.
+ (getHeaderFields): Use null as key for status line. Return
+ unmodifiable Map.
+ * gnu/java/net/protocol/http/Headers.java: Extend LinkedHashMap,
+ instead of implement Map.
+ (headers): Removed.
+ (Constructor): Do not initialize headers.
+ (size): Removed.
+ (isEmpth): Removed.
+ (containsKey): Rewrote.
+ (containsValue): Removed.
+ (get): Call super.get().
+ (getValue): Likewise.
+ (getLongValue): New method.
+ (put): Call super.put().
+ (remove): Call super.remove().
+ (putAll): Rewrote.
+ (clear): Removed.
+ (keySet): Call super.keySet().
+ (values): Removed.
+ (entrySet): Call super.entrySet().
+ (equals): Removed.
+ (hashCode): Removed.
+ (parse): Use StringBuilder instead of StringBuffer.
+ (addValue): Call super.* instead of headers.*.
+ * gnu/java/net/protocol/http/LimitedLengthInputStream.java: New class.
+ * gnu/java/net/protocol/http/Request.java: Cleaned up imports.
+ (responseBodyReader): Removed.
+ (setResponseBodyReader): Removed.
+ (dispatch): Don't create LineInputStream. Don't call fireRequestEvent.
+ Don't append CRLF to Request body. Handle unsolicited 100 Continue
+ response.
+ (readResponse): Rewrote.
+ (readResponseBody): Renamed to ...
+ (createResponseBodyStream): ... And rewritten.
+ (parseAuthParams): Use StringBuilder instead of StringBuffer.
+ (getNonceCount): Likewise.
+ (handleSetCookie): Likewise.
+ * gnu/java/net/protocol/http/Response.java: Cleaned up imports.
+ (codeClass): Removed.
+ (body): New field.
+ (Constructor): Don't initialize codeClass. Initialize body.
+ (getCodeClass): Rewrote.
+ (getLongHeader): New method.
+ (getBody): New method.
+ * gnu/java/net/protocol/http/ChunkedInputStream.java (read): Use
+ StringBuilder instead of StringBuffer.
+ * gnu/java/net/protocol/http/Cookie.java (toString): Use StringBuilder
+ instead of StringBuffer.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicFileChooserUI.java
+ (getFileView): Don't call back into the JFileChooser, avoids
+ a StackOverflow.
+ (getApproveButtonText): Likewise.
+
+2005-10-12 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #22841
+ * java/io/ObjectInputStream (validators): Removed field.
+ (isDeserializing): Removed field.
+ (currentObjectValidators): New field.
+ (ObjectInputStream): Remove validators and isDeserializing
+ initialization.
+ (readObject): Remove isDeserializing logic. Don't call
+ invokeValidators() here.
+ (parseContent): Call invokeValidators() after TC_OBJECT done.
+ (registerValidation): Create currentObjectValidators if needed.
+ (invokeValidators): Rewritten.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/CellRendererPane.java
+ (paintComponent): Fix clipping of cells.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (paint): Fix clipping of cells.
+
+2005-10-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (insertString): Don't include an ElementChange if no children were
+ added.
+ (remove): Don't include an ElementChange if no children were removed.
+
+2005-10-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (insertOrRemoveUpdate): Renamed this method to udpateDamage because
+ changedUpdate calls it as well.
+ (updateDamage): This method used to be named insertOrRemoveDamage.
+ Changes are: If no children were added or removed, repaint only the
+ area containing the line that was changed. Also, if children were
+ added or removed, call repaint on the entire container. Also fixed a
+ serious logic error in the bounds for Document.getText().
+ (insertUpdate): Changed call from insertOrRemoveUpdate to updateDamage
+ and removed repaint call (this is done in updateDamage).
+ (removeUpdate): Likewise.
+ (changedUpdate): Implemented.
+ (damageLineRange): Implemented.
+
+2005-10-12 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (treeExpanded): Added revalidate call.
+ (treeCollapsed): Likewise.
+ (treeNodesInserted): Likewise.
+ (treeNodesRemoved): Likewise.
+ (treeStructureChanged): Likewise.
+
+2005-10-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added defaults for FileView.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (sizeChanged): A new flag, indicating when the size of the
+ viewport has changed relative to the last painting operation.
+ (reshape): Set sizeChanged flag if size has changed.
+ (paintBackingStore): Only create new backingstore image when
+ the size has changed.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (reshape): Fixed calculation of newBounds and oldBounds to create
+ rectangles relative to the parent, and not to the parent's parent.
+ Solves a painting problem in an app here.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/ComponentUI.java
+ (update): Only fill the current clip. This solves a problem with
+ components in JViewport and should also optimize drawing a little.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ScrollPaneLayout.java
+ (preferredLayoutSize): Reworked. The old impl used to actually
+ modify the layout, which is not allowed.
+ (minimumLayoutSize): Reworked. The old impl used to actually
+ modify the layout, which is not allowed.
+ (layoutContainer): Reworked. The old impl did not properly determine
+ when the scrollbars should be visible and when not.
+
+2005-10-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (FileIcon16.getIconHeight): add result of getAdditionalHeight(),
+ (FolderIcon16.getIconHeight): add result of getAdditionalHeight(),
+ (checkBoxIcon): new private field,
+ (checkBoxMenuItemIcon): likewise,
+ (fileChooserDetailViewIcon): likewise,
+ (fileChooserHomeFolderIcon): likewise,
+ (fileChooserListViewIcon): likewise,
+ (fileChooserNewFolderIcon): likewise,
+ (fileChooserUpFolderIcon): likewise,
+ (radioButtonMenuItemIcon): likewise,
+ (internalFrameDefaultMenuIcon): likewise,
+ (treeComputerIcon): likewise,
+ (treeFloppyDriveIcon): likewise,
+ (treeHardDriveIcon): likewise,
+ (getCheckBoxIcon): return single instance,
+ (getCheckBoxMenuItemIcon): likewise,
+ (getFileChooserDetailViewIcon): likewise,
+ (getFileChooserHomeFolderIcon): likewise,
+ (getFileChooserListViewIcon): likewise,
+ (getFileChooserNewFolderIcon): likewise,
+ (getFileChooserUpFolderIcon): likewise,
+ (getRadioButtonMenuItemIcon): likewise,
+ (getInternalFrameDefaultMenuIcon): likewise,
+ (getTreeComputerIcon): likewise,
+ (getTreeFloppyDriveIcon): likewise,
+ (getTreeHardDriveIcon): likewise.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ (AbstractButton): Set button to be opaque.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JList.java
+ (locationToIndex): Put opening brace on next line.
+ (indexToLocation): Call UI's indexToLocation.
+ (getCellBounds): Replaced cast with getUI() call.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JFileChooser.java
+ (getDialogTitle): If no dialog title has been set, forward this
+ call to the UI.
+ (getApproveButtonText): If no text has been set, forward this
+ call to the UI.
+ (getFileView): If no file view has been set, forward this call
+ to the UI.
+ (getInternalFileView): Removed unneeded method.
+ (getName): Call getFileView instead of getInternalFileView.
+ (getDescription): Call getFileView instead of getInternalFileView.
+ (getTypeDescription): Call getFileView instead of
+ getInternalFileView.
+ (getIcon): Call getFileView instead of getInternalFileView.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (setFont): Only get active if the new font differs from the old one.
+ Call revalidate when font changes.
+ (setUI): Call revalidate when UI changes.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComboBox.java
+ (isFocusTraversable): Removed unneeded and unspecified method.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (ViewListener.componentResized): Only call revalidate instead of
+ going through weird reverting code.
+ (JViewport): First call updateUI, then set layout.
+ (setViewPosition): Don't do anything if there is no real
+ change.
+ (setView): Don't remove the old component. This is handled by
+ addImpl. Call revalidate().
+ * javax/swing/ViewportLayout.java
+ (layoutContainer): Preferably set view size to it's preferredSize
+ instead of its minimumSize.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/JTextComponent.java
+ (getToolTipText): New method.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Fixed value for
+ Table.focusCellHighlightBorder.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+ (installDefaults): Use UIManager.get* methods instead of
+ UIManager.getDefaults().get* methods.
+ * javax/swing/plaf/basic/BasicColorChooserUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ (installDefaults): Only install background color, if installed
+ color is null or an UIResource instance.
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicLabelUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicListUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Added default for List.font.
+ * javax/swing/plaf/basic/BasicMenuBarUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicPanelUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicPopupMenuUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicProgressBarUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicSeparatorUI.java
+ (installDefaults): Use UIManager.get* methods instead of
+ UIManager.getDefaults().get* methods.
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicSpinnerUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
+ (installDefaults): Use UIManager.get* methods instead of
+ UIManager.getDefaults().get* methods.
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installDefaults): Use new LookAndFeel install* methods. Use
+ UIManager.get* methods instead of UIManager.getDefaults().get*
+ methods.
+ * javax/swing/plaf/basic/BasicViewportUI.java
+ (installDefaults): Use new LookAndFeel install* methods.
+
+2005-10-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/LookAndFeel.java
+ (installBorder): Implemented.
+ (installColors): Implemented.
+ (installColorsAndFont): Implemented.
+
+2005-10-12 Mark Wielaard <mark@klomp.org>
+
+ Reported by Christian Thalinger <twisti@complang.tuwien.ac.at>
+ * native/jni/java-lang/java_lang_VMProcess.c
+ (Java_java_lang_VMProcess_nativeSpawn): Don't delete clazz local
+ reference twice.
+
+2005-10-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/event/SwingPropertyChangeSupport.java
+ (firePropertyChange(PropertyChangeEvent)): if old and new values are
+ both null, listeners should be notified.
+
+2005-10-11 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/DefaultComboBoxModel.java
+ (setSelectedItem): allow values not in list, and don't fire an event
+ if the value is unchanged.
+
+2005-10-11 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/GapContent.java:
+ (getPositionsInRange): Corrected interval check. This mirrors Roman's
+ change in GapContent from 2005-10-05 for adjustPositionsInRange and
+ setPositionsInRange.
+
+2005-10-11 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java:
+ (viewToModel): Implemented.
+ * javax/swing/text/DefaultCaret.java:
+ (mousePressed): Implemented.
+ * javax/swing/text/PlainView.java:
+ (viewToModel): Implemented.
+
+2005-10-11 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (insertUpdate): Repaint the JTextComponent after the update.
+ (removeUpdate): Likewise.
+
+2005-10-11 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JFileChooser.java: Added API docs all over.
+
+2005-10-11 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JEditorPane.java
+ (AccessibleJEditorPaneHTML): New inner class.
+ (JEditorPaneAccessibleHypertextSupport): New inner class.
+ (getAccessibleContext): Handle special case when we have
+ a HTMLEditorKit.
+ (setEditorKit): Reset the accessibleContext.
+
+2005-10-11 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/filechooser/FileSystemView.java
+ (defaultFileSystemView): new private field,
+ (getFileSystemView): initialise (if necessary) and return
+ defaultFileSystemView.
+
+2005-10-11 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
+ (main): Message removed from the loop.
+
+2005-10-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
+ (main): 3 sec pause replaced by while(..) loop.
+
+2005-10-10 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Interceptor/Registrator.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/gnuValueHolder.java,
+ gnu/CORBA/stubFinder.java,
+ gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java,
+ gnu/javax/rmi/CORBA/StubDelegateImpl.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ org/omg/CORBA/ORB.java: Use context class loader.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/View.java
+ (modelToView(pos, Shape)): New method.
+ (viewToModel(float, float, Shape)): New method.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JEditorPane.java
+ (AccessibleJEditorPane): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJEditorPane.
+ * javax/swing/JScrollPane.java
+ (AccessibleJScrollPane): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJScrollPane.
+ (setViewport): Call accessibleContext's resetViewPort() method.
+ * javax/swing/JTextArea.java
+ (AccessibleJTextArea): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJTextArea.
+ * javax/swing/JTextField.java
+ (AccessibleJTextField): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJTextField.
+ * javax/swing/JRootPane.java
+ (defaultPressAction): New field.
+ (defaultReleaseAction): New field.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JMenuBar.java
+ (AccessibleJMenuBar): New inner class.
+ (getAccessibleContext): Implemented to return an instance of
+ AccessibleJMenuBar.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintChildren): Skip children if their clip _doesn't_ hit the
+ current clip.
+ (setVisible): Do nothing if the actual value didn't change.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Graphics.java
+ (hitClip): Implemented this method.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Graphics.java: Reformatted file.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * java/beans/IndexedPropertyDescriptor.java
+ (setIndexedReadMethod): Changed signature to throw
+ IntrospectionException as specified.
+ (setIndexedWriteMethod): Changed signature to throw
+ IntrospectionException as specified.
+
+2005-10-10 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (rectCache): New field. Caches Rectangle objects for reuse.
+ (paintChildren): Changed to reuse cached Rectangle object.
+
+2005-10-10 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/border/TitledBorder.java
+ (TitledBorder(String)): Changed default justification and position,
+ (TitledBorder(Border)): Likewise,
+ (TitledBorder(Border, String)): Likewise,
+ (BorderPainter.paint(Graphics)): Use full width and height,
+ (BorderPainter.paintExcept): Fixed bounds for region 3,
+ (paintBorder): indented left justified title further, adjusted
+ ABOVE_TOP text position, adjusted bounds for call to paintExcept(),
+ updated for renamed fields in Measurements class,
+ (getMeasurements): added special handling for null text, increased
+ outer spacing, adjusted spacing for TOP, BOTTOM and BELOW_BOTTOM title
+ positions,
+ (Measurements.borderSpacing): renamed outerSpacing,
+ (Measurements.edgeSpacing): renamed innerSpacing,
+ (Measurements.getContentInsets): updated for renamed fields,
+ (Measurements.getMinimumSize): wrap at 80 columns.
+
+2005-10-09 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #24006
+ * java/net/Socket.java (bound): Make package private.
+ * java/net/ServerSocket.java (implAccept): Set Socket.bound to true.
+
+2005-10-07 Anthony Green <green@redhat.com>
+
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (process): call run_multiple_synths if required.
+
+2005-10-07 Anthony Green <green@redhat.com>
+
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1): Attempt
+ to connect to the jack server automatically. Fail gracefully.
+
+2005-10-07 Anthony Green <green@redhat.com>
+
+ * gnu/javax/sound/midi/dssi/DSSISynthesizer.java (loadInstrument):
+ Implement.
+ (selectProgram_): New native method.
+ * include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h: Rebuilt.
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (selectProgram_): New function.
+
+2005-10-07 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkChoicePeer.java (postChoiceItemEvent):
+ Don't call select on the AWT Choice component.
+ * java/awt/Choice.java (processItemEvent): Set the selected index
+ without calling into the peers.
+
+2005-10-07 Anthony Green <green@redhat.com>
+
+ * gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+ Doc cleanups.
+ (DSSISynthesizer.DSSISoundbank): New class.
+ (DSSISynthesizer.DSSIInstrument): New class.
+ (soundbanks, defaultSoundbank): New fields.
+ (getDefaultSoundbank): Implemented.
+ (getAvailableInstruments): Implemented.
+ (getProgramName_, getProgramBank_, getProgramProgram_): New native
+ methods.
+ (DSSISynthesizer): Create default soundbank.
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1,
+ Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1,
+ Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1):
+ New functions.
+ * include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h: Rebuilt.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (tableChanged): Revalidate table if its structure changes.
+
+2005-10-07 Jan Roehrich <jan@roehrich.info>
+
+ * javax/swing/JTree.java: (JTree):
+ * javax/swing/plaf/basic/BasicTreeUI.java: (updateRenderer):
+ moved setting of TreeCellRenderer from JTree to BasicTreeUI.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * java/beans/IndexedPropertyDescriptor.java
+ (setIndexedReadMethod): New method.
+ (setIndexedWriteMethod): New method.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * java/beans/IndexedPropertyDescriptor.java: Reformatted.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (currentIcon): Fix icon for disabled selected buttons.
+ (paint): Only paint focus indicator if button is actually
+ focusPainted.
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (installDefaults): Install icons for disabledIcon and
+ disabledSelectedIcon.
+ (paint): Paint the correct icon. Only paint focus indicator
+ if button is actually focusPainted.
+ * javax/swing/plaf/basic/BasicToggleButtonUI.java
+ (paint): Only paint focus indicator if button is actually
+ focusPainted.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Call paintBorder before paintChildren.
+ (reshape): Fire AncestorEvent if position has changed.
+ (fireAncestorMoved): New method. Fires AncestorEvents to this
+ component and all of it's children.
+
+2005-10-07 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BorderFactory.java
+ (createLineBorder(Color)): Forward call to
+ createLineBorder(Color, int) with thickness of 1.
+
+2005-10-06 Anthony Green <green@redhat.com>
+
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1): Ignore
+ controllers that aren't mapped to MIDI controls.
+
+2005-10-06 Anthony Green <green@redhat.com>
+
+ * INSTALL: Describe midi provider dependencies.
+
+ * native/jni/midi-dssi/README: New file.
+ * LICENSE (terms): Add notice about code copied from the DSSI
+ distribution.
+
+ * examples/gnu/classpath/examples/midi/Demo.java: New file.
+
+ * native/jni/midi-dssi/dssi_data.h (dssi_data): Add control_count,
+ control_port_map, control_value_map, sample_rate, and
+ control_values fields.
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (DEBUG_DSSI_PROVIDER): New macro.
+ (get_port_default): New function.
+ (set_control): New function.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1): Remove
+ debug output. Reformat. Allocate the control ports and assign
+ proper default values.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1): Use
+ JLONG_TO_PTR.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1): Ditto.
+ * gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+ (Channel.controlChange): Implement.
+ (controlChange_): New native method.
+ * include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h: Rebuilt.
+
+ * gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java: Make
+ instance final.
+
+2005-10-06 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (determineMaxLength): Avoid NPE by checking the Segment that getText
+ returns. No need to return Math.max (0, maxLineLength) because
+ maxLineLength is guaranteed to be 0 or greater.
+
+2005-10-06 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (determineMaxLength): If maxLineLength is -1 we should return 0.
+ (insertOrRemoveUpdate): Avoid NPE by checking the Segment that
+ getText returns.
+
+2005-10-06 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/metadata/IIOMetadata.java: Complete.
+
+2005-10-06 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/BoxView.java
+ (paint): Only call paintChild if child allocation is not empty.
+ (layout): Don't store the width and height fields here.
+ (setSize): Store the width and height fields here.
+ * javax/swing/text/CompositeView.java
+ (getViewIndexAtPosition): Reworked child view searching.
+ (getInsideAllocation): Fixed insets calculation.
+ * javax/swing/text/FlowView.java
+ (FlowStrategy.layoutRow): Return an offset of -1 if no more child
+ views are in the logical view.
+ (FlowStrategy.createView): If there are no more child views,
+ then return null.
+ (LogicalView.getViewIndex): New method. Implements child view
+ searching for the LogicalView.
+ * javax/swing/text/GlyphView.java
+ (DefaultGlyphPainter.getHeight): Use Toolkit FontMetrics instead
+ of parent containers FontMetrics.
+ (DefaultGlyphPainter.getSpan): Use Toolkit FontMetrics instead
+ of parent containers FontMetrics.
+ * javax/swing/text/Utilities.java
+ (getTabbedTextOffset): Check for 0 in the char array and stop
+ there.
+ * javax/swing/text/View.java
+ (getContainer): If there's no parent, don't throw an Error, instead
+ return null as specified.
+
+2005-10-06 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java: Implemeted locking.
+ (insertString): Obtain write lock before altering document.
+ (readLock): Implemented.
+ (readUnlock): Implemented.
+ (remove): Obtain write lock before altering document.
+ (render): Implemented.
+ (writeLock): Implemented.
+ (writeUnlock): Implemented.
+ (getCurrentWriter): Implemented.
+
+2005-10-06 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JLabel.java
+ (JLabel): Set alignmentX value to 0.0F.
+
+2005-10-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (startEditing): Should always change the bounds, whenever
+ we start editing.
+ (paintRow): Fixed location where editing component should
+ be drawn. The constant takes care of the space around the
+ icon.
+ * javax/swing/JTree.java
+ (JTree): Called updateUI first so currentVisiblePath is
+ cached right away. Prevents NPEs.
+
+2005-10-06 Tom Tromey <tromey@redhat.com>
+
+ * javax/print/attribute/SetOfIntegerSyntax.java (toString): Wrote.
+ (hashCode): Likewise.
+ (equals): Likewise.
+ (getMembers): Likewise.
+ (contains): Fixed boundary condition check.
+ (next): Wrote.
+ (normalize): Rewrote.
+ (SetOfIntegerSyntax): Updated.
+ (SetOfIntegerSyntax(String)): New constructor.
+ (skipNumber): New method.
+ (skipWhitespace): Likewise.
+
+2005-10-06 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicRootPaneUI.java
+ (installUI): Call new hook methods.
+ (installDefaults): New hook method.
+ (installComponents): New hook method.
+ (installListeners): New hook method.
+ (installKeyboardActions): New hook method.
+ (uninstallUI): New method.
+ (uninstallDefaults): New hook method.
+ (uninstallComponents): New hook method.
+ (uninstallListeners): New hook method.
+ (uninstallKeyboardActions): New hook method.
+
+2005-10-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (mousePressed): Shouldn't change x location for leaf.
+
+2005-10-06 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * configure.ac: Add Qt4 configury bits for OS-X.
+
+2005-10-05 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paintRow): Fixed indentation.
+ (updateCurrentVisiblePath): Added FIXME
+ comment.
+
+2005-10-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/BoxView.java
+ (baselineLayout): New method.
+ (calculateMajorAxisRequirements): Reimplemented to use the
+ SizeRequirements utility methods.
+ (calculateMinorAxisRequirements): Reimplemented to use the
+ SizeRequirements utility methods.
+ (layout): Use the new baselineLayout method.
+ (layoutMajorAxis): Reimplemented to use the new
+ getChildRequirements method.
+ (layoutMinorAxis): Reimplemented to use the new
+ getChildRequirements method.
+ (getChildRequirements): New method.
+ (getSpan): New method.
+ (getOffset): New method.
+ (getAlignment): New method.
+ * javax/swing/text/ParagraphView.java
+ (Row.getAlignment): New method.
+ (getAlignment): New method.
+ * javax/swing/text/View.java
+ (getContainer): Improved error message in assertion a little.
+
+2005-10-05 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installUI): Fixed to call toggleExpandState instead.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getPathForRow): Used currentVisiblePath to get Path.
+ (getRowForPath): Used currentVisiblePath to get row.
+ (getRowCount): Returned currentVisiblePath length.
+ (updateLayoutCacheExpandedNodes): Took out unneeded code.
+ (installUI): Fixed to call toggleExpandState instead.
+ (getPreferredSize): Made more efficent by using currentVisiblePath.
+ (toggleExpandState): Called updateCurrentVisiblePath.
+ (getCellLocation): Made more efficent.
+ (paintNode): Removed.
+ (paintRecursive): Made more efficent, changed paintNode calls to
+ paintRow.
+ (getNextVisibleNode): Reimplemented to use currentVisiblePath.
+ (getPreviousVisibleNode): Likewise.
+ (paintRow): Implemented.
+ (updateCurrentVisiblePath): New helper used to cache the current
+ visible path.
+
+2005-10-05 Mark Wielaard <mark@klomp.org>
+
+ Reported by Nicolas Geoffray <nicolas.geoffray@lip6.fr>
+ * java/security/AccessController.java
+ (doPrivileged(PrivilegedExceptionAction)): If the Exception is a
+ Runtime exception, then throw the exception directly, otherwise
+ wrap it.
+ (doPrivileged(PrivilegedExceptionAction,AccessControlContext)):
+ Likewise.
+
+2005-10-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/GapContent.java
+ (setPositionsInRange): Changed check for interval end to actually
+ check for the position offsets.
+ (adjustPositionsInRange): Changed check for interval end to actually
+ check for the position offsets.
+ (dump): New method for debugging.
+ (dumpPositions): New method for debugging.
+
+2005-10-05 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * m4/acattribute.m4: Added.
+ * configure.ac: Added AC_C_ATTRIBUTE.
+ * native/fdlibm/java-assert.h: Added missing config.h include,
+ changed comments to C comments.
+ * native/jni/java-lang/java_lang_reflect_Array.c: Added missing
+ config.h include.
+
+2005-10-05 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (insertOrRemoveUpdate): New method.
+ (insertUpdate): New method.
+ (removeUpdate): New method.
+
+2005-10-05 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/JOptionPane.java
+ (showInputDialog(Component,Object,String,int,Icon,Object[],Object)):
+ Don't cast return value.
+ (internalShowInputDialog(Component,Object,String,int,Icon,Object[],
+ Object)): Likewise.
+
+2005-10-05 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/EmptyExceptionHolder.java,
+ gnu/CORBA/ForwardRequestHelper.java,
+ gnu/CORBA/Functional_ORB.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/_PolicyImplBase.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/universalHolder.java,
+ org/omg/CORBA/CompletionStatus.java,
+ org/omg/CORBA/NameValuePairHelper.java,
+ org/omg/CORBA/ObjectHelper.java,
+ org/omg/CORBA/PolicyHelper.java,
+ org/omg/CORBA/PolicyListHelper.java,
+ org/omg/CORBA/ServiceDetailHelper.java,
+ org/omg/CORBA/StringValueHelper.java,
+ org/omg/CORBA/WStringValueHelper.java,
+ org/omg/CosNaming/BindingHelper.java,
+ org/omg/CosNaming/BindingIteratorHelper.java,
+ org/omg/CosNaming/BindingIteratorPOA.java,
+ org/omg/CosNaming/BindingTypeHelper.java,
+ org/omg/CosNaming/NameComponentHelper.java,
+ org/omg/CosNaming/NameHelper.java,
+ org/omg/CosNaming/NamingContextExtHelper.java,
+ org/omg/CosNaming/NamingContextExtPOA.java,
+ org/omg/CosNaming/NamingContextHelper.java,
+ org/omg/CosNaming/NamingContextPOA.java,
+ org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java,
+ org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java,
+ org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java,
+ org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java,
+ org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java,
+ org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java,
+ org/omg/CosNaming/_BindingIteratorImplBase.java,
+ org/omg/CosNaming/_NamingContextImplBase.java,
+ org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java,
+ org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java,
+ org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java,
+ org/omg/DynamicAny/DynAnySeqHelper.java,
+ org/omg/DynamicAny/NameDynAnyPairHelper.java,
+ org/omg/DynamicAny/NameDynAnyPairSeqHelper.java,
+ org/omg/DynamicAny/NameValuePairHelper.java,
+ org/omg/DynamicAny/NameValuePairSeqHelper.java,
+ org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java,
+ org/omg/IOP/CodecPackage/FormatMismatchHelper.java,
+ org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java,
+ org/omg/IOP/CodecPackage/TypeMismatchHelper.java,
+ org/omg/IOP/IORHelper.java,
+ org/omg/IOP/MultipleComponentProfileHelper.java,
+ org/omg/IOP/ServiceContextHelper.java,
+ org/omg/IOP/ServiceContextListHelper.java,
+ org/omg/IOP/TaggedComponentHelper.java,
+ org/omg/IOP/TaggedProfileHelper.java,
+ org/omg/PortableInterceptor/ForwardRequestHelper.java,
+ org/omg/PortableInterceptor/InvalidSlotHelper.java,
+ org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java,
+ org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java,
+ org/omg/PortableServer/CurrentPackage/NoContextHelper.java,
+ org/omg/PortableServer/ForwardRequestHelper.java,
+ org/omg/PortableServer/IdAssignmentPolicyValue.java,
+ org/omg/PortableServer/IdUniquenessPolicyValue.java,
+ org/omg/PortableServer/ImplicitActivationPolicyValue.java,
+ org/omg/PortableServer/LifespanPolicyValue.java,
+ org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java,
+ org/omg/PortableServer/POAManagerPackage/State.java,
+ org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java,
+ org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java,
+ org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java,
+ org/omg/PortableServer/POAPackage/NoServantHelper.java,
+ org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java,
+ org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java,
+ org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java,
+ org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java,
+ org/omg/PortableServer/POAPackage/WrongAdapterHelper.java,
+ org/omg/PortableServer/POAPackage/WrongPolicyHelper.java,
+ org/omg/PortableServer/RequestProcessingPolicyValue.java,
+ org/omg/PortableServer/Servant.java,
+ org/omg/PortableServer/ServantLocatorHelper.java,
+ org/omg/PortableServer/ServantRetentionPolicyValue.java,
+ org/omg/PortableServer/ThreadPolicyValue.java: Added minor codes for BAD_PARAM and NO_RESOURCES.
+ * gnu/CORBA/Minor.java: Introduces new minor codes.
+ * org/omg/CORBA/BAD_OPERATION.java,
+ org/omg/CORBA/MARSHAL.java,
+ org/omg/CORBA/NO_RESOURCES.java: Documentation update.
+
+2005-10-05 Stuart Ballard <stuart.a.ballard@gmail.com>
+
+ * java/rmi/LoaderHandler.java (packagePrefix): Match Sun's value.
+ * java/rmi/RemoteRef.java (packagePrefix): Likewise.
+ * java/rmi/RemoteObject.java (readObject): Hardcode the GNU package
+ prefix.
+
+2005-10-05 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (remove): If removing content returns an UndoableEdit, then add an
+ ElementEdit to the DocumentEvent before firing.
+ * javax/swing/text/GapContent.java:
+ (UndoRemove): New class to implement UndoableEdit for remove operation.
+ (remove): Return an UndoableEdit instead of null.
+
+2005-10-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/LabelView.java
+ (LabelView): Implemented the constructor.
+ (setPropertiesFromAttributes): New method.
+ (changedUpdate): New method.
+ (getBackground): New method.
+ (setBackground): New method.
+ (getForeground): New method.
+ (getFont): New method.
+ (getFontMetrics): New method.
+ (isUnderline): New method.
+ (setUnderline): New method.
+ (isSubscript): New method.
+ (setSubscript): New method.
+ (isSuperscript): New method.
+ (setSuperscript): New method.
+ (isStrikeThrough): New method.
+ (setStrikeThrough): New method.
+
+2005-10-05 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/table/JTableHeader.java
+ (accessibleContext): Removed unneeded field. The protected
+ field with the same name should be used instead.
+ (JTableHeader): Moved field initialization to new method
+ initializeLocalVars().
+ (setColumnModel): Add and remove this to the old and new model.
+ (columnAdded): New listener method.
+ (columnMarginChanged): New listener method.
+ (columnMoved): New listener method.
+ (columnRemoved): New listener method.
+ (columnSelectionChanged): New listener method.
+ (resizeAndRepaint): New method.
+ (initializeLocalVars): New method.
+
+2005-10-04 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicFileChooserUI.java: Added API docs all
+ over.
+
+2005-10-04 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (insertString): If inserting a string into the Content returns an
+ UndoableEdit, then add an ElementEdit to the DocumentEvent before
+ firing.
+ (remove): Don't fire a removeUpdate unless some content was actually
+ removed.
+ * javax/swing/text/GapContent.java:
+ (UndoInsertString): New class to implement UndoableEdit functions.
+ (insertString): Return an UndoableEdit instead of null. Also use
+ locally calculated length of String rather than calculating again.
+ * javax/swing/text/JTextComponent.java:
+ (setText): If the Document is an AbstractDocument this should pass
+ through AbstractDocument.replace rather than calling remove and insert.
+ * javax/swing/text/PlainView.java:
+ (determineMaxLength): Keep track of which line was the longest as well
+ as the length of it. We'll need this to know when the longest line is
+ removed and we need to redetermine the longest line.
+
+2005-10-04 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/ImageWriter.java
+ (processWarningOccurred(int,String,String)): New method.
+ * javax/imageio/ImageReader.java
+ (processWarningOccurred(String,String)): New method.
+
+2005-10-04 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/ImageReader.java (getDestination): Throw
+ IIOException, not IOException.
+ * javax/imageio/ImageTypeSpecifier.java
+ (createGrayscale(int,int,boolean)): Rename from createGrayScale.
+ (createGrayscale(int,int,boolean,boolean)): Likewise.
+ (createIndexed): Rename from createIndex.
+
+2005-10-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * doc/www.gnu.org/corba.wml:
+ Link to http://doc.omg.org/vendor-tags.
+
+2005-10-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Minor.java: New file.
+ * gnu/CORBA/CDR/IDLTypeHelper.java,
+ gnu/CORBA/CDR/UnknownExceptionCtxHandler.java,
+ gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/CDR/gnuRuntime.java,
+ gnu/CORBA/CDR/noHeaderInput.java,
+ gnu/CORBA/DynAn/gnuDynValue.java,
+ gnu/CORBA/GIOP/CloseMessage.java,
+ gnu/CORBA/GIOP/ErrorMessage.java,
+ gnu/CORBA/GIOP/MessageHeader.java,
+ gnu/CORBA/GIOP/v1_2/RequestHeader.java,
+ gnu/CORBA/IOR.java,
+ gnu/CORBA/Poa/ForwardedServant.java,
+ gnu/CORBA/Version.java,
+ gnu/CORBA/cdrEncapsCodec.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuRequest.java,
+ gnu/CORBA/streamReadyHolder.java,
+ gnu/CORBA/universalHolder.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ gnu/javax/rmi/CORBA/corbaObjectOutput.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil.java,
+ org/omg/CORBA/StringValueHelper.java,
+ org/omg/CORBA/StructMemberHelper.java,
+ org/omg/CORBA/UnionMemberHelper.java,
+ org/omg/CORBA/ValueMemberHelper.java,
+ org/omg/CORBA/WStringValueHelper.java,
+ org/omg/CORBA/_IDLTypeStub.java,
+ org/omg/DynamicAny/DynAnyFactoryHelper.java,
+ org/omg/DynamicAny/_DynAnyFactoryStub.java,
+ org/omg/IOP/TaggedComponentHelper.java,
+ org/omg/IOP/TaggedProfileHelper.java,
+ org/omg/PortableInterceptor/CurrentHelper.java,
+ org/omg/PortableServer/POAHelper.java,
+ org/omg/PortableServer/ServantActivatorHelper.java,
+ org/omg/PortableServer/ServantLocatorHelper.java:
+ Initialising minor codes for MARSHAL.
+ * org/omg/CORBA/SystemException.java: Documentation update and
+ add minor code to the exception message.
+ * org/omg/CORBA/MARSHAL.java: Documentation update.
+
+2005-10-04 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/plaf/metal/MetalBorders.java (paintBorder): Check
+ whether Component is JTextComponent.
+
+2005-10-04 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * javax/imageio/ImageWriter.java (availableLocales, locale,
+ originatingProvider, output, progressListeners, warningListeners,
+ warningLocales): Initialize.
+ (addIIOWriteProgressListener): Check progressListeners against null
+ to avoid NPE. Create new ArrayList if progressListeners is null.
+ (addIIOWriteWarningListener): Likewise for warningListeners.
+ (processImageComplete): Check progressListeners against null to
+ avoid NPE.
+ (processImageProgress): Likewise.
+ (processImageStarted): Likewise.
+ (processThumbnailComplete): Likewise.
+ (processThumbnailProgress): Likewise.
+ (processThumbnailStarted): Likewise.
+ (processWarningOccurred): Likewise for warningListeners.
+ (processWriteAborted): Likewise for progressListeners.
+ (removeAllIIOWriteProgressListeners): Likewise.
+ (removeAllIIOWriteWarningListeners): Likewise.
+ (removeIIOWriteProgressListener): Likewise.
+ (removeIIOWriteWarningListener): Likewise for warningListeners.
+
+ * javax/imageio/ImageReader.java (addIIOReadProgressListener): Check
+ progressListeners against null to avoid NPE. Create new ArrayList
+ if progressListeners is null.
+ (addIIOReadUpdateListener): Likewise for updateListeners.
+ (addIIOReadWarningListener): Likewise for warningListeners.
+ (processImageComplete): Check progressListeners against null to
+ avoid NPE.
+ (processImageProgress): Likewise.
+ (processImageStarted): Likewise.
+ (processImageUpdate): Likewise for updateListeners.
+ (processPassComplete): Likewise.
+ (processPassStarted): Likewise.
+ (processReadAborted): Likewise for progressListeners.
+ (processSequenceComplete): Likewise.
+ (processSequenceStarted): Likewise.
+ (processThumbnailComplete): Likewise.
+ (processThumbnailPassComplete): Likewise for updateListeners.
+ (processThumbnailPassStarted): Likewise.
+ (processThumbnailProgress): Likewise for progressListeners.
+ (processThumbnailStarted): Likewise.
+ (processThumbnailUpdate): Likewise for updateListeners.
+ (processWarningOccurred): Likewise for warningListeners.
+ (removeIIOReadProgressListener): Likewise for progressListeners.
+ (removeIIOReadUpdateListener): Likewise for updateListeners.
+ (removeIIOReadWarningListener): Likewise for warningListeners.
+
+2005-10-04 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/metal/MetalToolTipUI.java
+ (paint): Added space around the toolTip's accelerator.
+ (fetchAcceleratorString): Added code to get mnemonic for
+ JMenuItem if it does not have an accelerator.
+
+2005-10-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultCaret.java
+ (repaint): Adjust repaint rectangle.
+ (setVisible): Only repaint if the visible property actually changed.
+
+2005-10-04 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/JTextComponent.java: Reformatted file.
+
+2005-10-04 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24080
+ * javax/swing/SizeRequirements.java
+ (adjustGreater): Added check to prevent overflow.
+
+2005-10-04 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (accText): removed,
+ (accDeliminator): removed,
+ (accFont): removed,
+ (accFore): removed,
+ (getPreferredSize): removed accelerator code (now in MetalToolTipUI),
+ (getAcceleratorText): removed (equivalent is now in MetalToolTipUI),
+ (paint): removed accelerator painting,
+ * javax/swing/plaf/metal/MetalToolTipUI.java
+ (padSpaceBetweenStrings): new field,
+ (MetalToolTipUI): initialise defaults,
+ (getAcceleratorString): new method,
+ (installUI): new method,
+ (uninstallUI): new method,
+ (isAcceleratorHidden): new method,
+ (getPreferredSize): new method,
+ (paint): new method,
+ (fetchAcceleratorString): new private method,
+ (acceleratorToString): new private method,
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkButton): set tool tip.
+
+2005-10-04 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (getFont): Fall back to peer.getGraphics().getFont() if no font
+ is found.
+ (getGraphics): Set font here. This avoids a loop in the above
+ fallback.
+ * gnu/java/awt/peer/gtk/GdkGraphics.java
+ (GdkGraphics): Don't initialize font here. This would cause a
+ loop in the above fallback.
+
+2005-10-04 Anthony Green <green@redhat.com>
+
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+ (process): Add comments. Remove unused gettimeofday call.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1): Remove
+ debug output. Add comments.
+ (Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1,
+ Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1): Add
+ comments. Remove bogus __attribute__((unused)).
+ * native/jni/midi-dssi/dssi_data.h (JLONG_TO_PTR, PTR_TO_JLONG):
+ Document helper macros.
+ (dssi_data): Document.
+ * native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c:
+ Formatting fixes.
+ * native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c
+ (Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1):
+ Remove debugging output.
+
+2005-10-04 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/AbstractButton.java
+ (AbstractButton): Set text to "" here.
+
+2005-10-04 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (clearRect): Check bg
+ against null to avoid NPE.
+
+2005-10-03 Tom Tromey <tromey@redhat.com>
+
+ * gnu/java/awt/peer/qt/QtToolkit.java (initToolkit): Use Configuration
+ to see if library should be loaded.
+
+2005-10-03 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainView.java:
+ (maxLineLength): New variable to cache the length of the longest line.
+ (determineMaxLength): New implementation method.
+ (getPreferredSpan): Call determine max length instead of calculating
+ it here.
+
+2005-10-03 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/image/ComponentSampleModel.java (numBands): Updated
+ javadoc.
+ (ComponentSampleModel): Set numBands.
+ * java/awt/image/SampleModel.java (numBands): Now protected.
+
+2005-10-03 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/Polygon.java (evaluateCrossings): Removed @see.
+ * java/awt/image/ImageConsumer.java (SINGLEPASS): Javadoc fix.
+ * java/awt/Image.java (getGraphics): Removed @see.
+ * java/awt/MenuComponent.java (setEnabled): Javadoc fix.
+ (setBackground): Likewise.
+ * java/awt/event/MouseEvent.java: Added import for javadoc.
+ * java/awt/im/spi/InputMethodDescriptor.java: Added import for javadoc.
+ (getAvailableLocales): Javadoc fix.
+ * java/awt/KeyboardFocusManager.java: Added import for javadoc.
+ (defaultPolicy): Javadoc fix.
+ (setGlobalObject): Javadoc fixes.
+ (getObject): Likewise.
+ (getGlobalObject): Likewise.
+ * java/awt/im/InputMethodRequests.java: Added imports for javadoc.
+ * java/awt/im/spi/InputMethodContext.java: Added imports for javadoc.
+ (enableClientWindowNotification): Javadoc fix.
+ * java/awt/im/spi/InputMethod.java: Added imports for javadoc.
+ (removeNotify): Javadoc fix.
+ (notifyClientWindowChange): Likewise.
+ * java/awt/im/InputContext.java: Added import for javadoc.
+ * java/awt/image/ColorModel.java (getDataElements): Javadoc fix.
+ * java/awt/geom/Area.java (recursiveSubdivide): Javadoc fix.
+ * java/awt/geom/GeneralPath.java (GeneralPathIterator): Javadoc fix.
+ * java/awt/im/InputMethodHighlight.java: Javadoc fixes. Added
+ imports.
+ * java/awt/color/ICC_Profile.java (getInstance): Javadoc fix.
+ (getInstance): Likewise.
+ * java/awt/EventQueue.java: Organized imports.
+ * java/awt/image/BufferedImage.java: Organized imports.
+ * java/awt/image/PackedColorModel.java (initMasks): Javadoc fix.
+ * java/awt/GraphicsConfiguration.java (createCompatibleVolatileImage):
+ Javadoc fixes.
+ * java/awt/DefaultKeyboardFocusManager.java (delayRequests): Javadoc
+ fix.
+ * java/awt/ColorPaintContext.java (ColorPaintContext): Javadoc fix.
+
+2005-10-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JOptionPane.java
+ (getInputValue): If the option selected is 'Cancel', then
+ the input value is set to null.
+ (showInternalConfirmDialog): Added check to prevent NPE.
+ (showInternalConfirmDialog): Likewise.
+ (showInternalConfirmDialog): Likewise.
+ (showInternalConfirmDialog): Likewise.
+ (showInternalOptionDialog): Likewise.
+ (showOptionDialog): Likewise.
+
+2005-10-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/rmi/CORBA/ValueHandler.java (getRunTimeCodeBase):
+ Fixed return type.
+ * gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java
+ (getRunTimeCodeBase): Implemented.
+
+2005-10-03 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JMenuItem.java
+ (init): Set horizontalTextPosition to TRAILING, instead of
+ LEFT. Icons are drawn in the correct spot now.
+
+2005-10-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * doc/www.gnu.org/corba.wml: New file.
+
+2005-10-03 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (layoutLabel): place text to the right of the icon, if there is one.
+
+2005-10-03 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxButton.java
+ (paintComponent): reposition text and truncate if necessary,
+ (truncateText): private utility method.
+
+2005-10-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * NEWS: Added entry about Classpath VMCID and IIOP.
+
+2005-10-02 Anthony Green <green@redhat.com>
+
+ * native/jni/Makefile.am: Maybe build ALSA code.
+ Maybe build DSSI code.
+
+ * gnu/javax/sound/midi/alsa/AlsaPortDevice.java,
+ gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java
+ gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java
+ gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java
+ gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java: Rebuilt.
+ native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c,
+ native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c,
+ native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaSequencerDevice.c,
+ native/jni/midi-dssi/dssi_data.h, native/jni/midi-dssi/Makefile.am,
+ native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c
+ native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c,
+ native/jni/midi-alsa/Makefile.am: New files.
+
+ * include/Makefile.am: Add sound header files.
+ * include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h,
+ include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h
+ include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
+ include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h,
+ include/gnu_javax_sound_midi_alsa_AlsaSequencerDevice.h: New
+ files.
+
+ * configure.ac (AC_CONFIG_FILES): Add
+ native/jni/midi-alsa/Makefile, native/jni/midi-dssi/Makefile.
+
+2005-10-02 Mark Wielaard <mark@klomp.org>
+
+ * java/awt/Font.java (peer): Make field transient.
+ (Font(String,int,int)): Explicitly set name field.
+ (Font(String,Map)): Likewise.
+ (readObject): New private method.
+
+2005-10-02 Mark Wielaard <mark@klomp.org>
+
+ * java/io/ObjectOutputStream.java (writeObject): Add defining class
+ to NotSerializableException.
+
+2005-10-02 Tom Tromey <tromey@redhat.com>
+
+ * java/net/URLStreamHandler.java (hostsEqual): Javadoc fix.
+ * java/net/URLClassLoader.java (definePackage): Javadoc fixes.
+ * java/net/Inet4Address.java (Inet4Address): Javadoc fix.
+ * java/net/Socket.java (getLocalAddress): Javadoc fix.
+ * java/net/DatagramSocket.java (connect): Javadoc fix.
+
+2005-10-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/javax/rmi/PortableServer.java,
+ gnu/javax/rmi/CORBA/ValueHandlerImpl.java,
+ javax/rmi/BAD_OPERATION.java,
+ javax/rmi/ORB.java,
+ javax/rmi/CORBA/ObjectImpl.java,
+ javax/rmi/CORBA/SystemException.java: Deleted.
+
+2005-10-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/javax/rmi/CORBA/corbaObjectOutput.java (main):
+ Removed method.
+
+2005-10-02 Casey Marshall <csm@gnu.org>
+
+ * gnu/javax/crypto/DiffieHellmanImpl.java (random): removed.
+ (<init>): removed 'random' initialization.
+ (engineDoPhase): use params from the incoming key; generate the
+ intermediate result from the incoming key, not a random one; only
+ support one-phase DH, for now.
+ (engineInit): removed 'random' initialization.
+
+2005-10-02 Robert Schuster <robertschuster@fsfe.org>
+
+ * gnu/xml/stream/XMLOutputFactoryImpl.java:
+ (setProperty): Added 'else'.
+
+2005-10-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CDR/cdrBufOutput.java,
+ gnu/CORBA/CDR/gnuRuntime.java,
+ gnu/javax/rmi/CORBA/corbaObjectInput.java,
+ gnu/javax/rmi/CORBA/dwoTester.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil.java: Corrected copyright
+ header identation.
+
+2005-10-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/CDR/ArrayValueHelper.java,
+ gnu/CORBA/CDR/IDLTypeHelper.java,
+ gnu/CORBA/CDR/UnknownExceptionCtxHandler.java,
+ gnu/CORBA/CDR/gnuRuntime.java,
+ gnu/CORBA/CDR/gnuValueStream.java,
+ gnu/CORBA/CDR/VMVio.java,
+ gnu/CORBA/IorProvider.java,
+ gnu/javax/rmi/CORBA/TieTargetRecord.java,
+ gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java,
+ gnu/javax/rmi/CORBA/corbaObjectInput.java,
+ gnu/javax/rmi/CORBA/corbaObjectOutput.java,
+ gnu/javax/rmi/CORBA/dwoTester.java,
+ gnu/javax/rmi/CORBA/gnuRmiUtil.java: New files.
+ * gnu/CORBA/CDR/aligningInputStream.java,
+ gnu/CORBA/CDR/aligningOutputStream.java:
+ gnu/CORBA/CDR/Vio.java,
+ gnu/CORBA/CDR/cdrBufInput.java,
+ gnu/CORBA/CDR/cdrBufOutput.java,
+ gnu/CORBA/CDR/cdrInput.java,
+ gnu/CORBA/CDR/cdrOutput.java,
+ gnu/CORBA/CDR/noHeaderInput.java,
+ gnu/CORBA/Functional_ORB.java,
+ gnu/CORBA/GIOP/MessageHeader.java,
+ gnu/CORBA/GIOP/ServiceContext.java,
+ gnu/CORBA/IOR_Delegate.java,
+ gnu/CORBA/IOR_contructed_object.java,
+ gnu/CORBA/Interceptor/Registrator.java,
+ gnu/CORBA/NamingService/NameParser.java,
+ gnu/CORBA/NamingService/NamingServiceTransient.java,
+ gnu/CORBA/ObjectCreator.java,
+ gnu/CORBA/Poa/LocalDelegate.java,
+ gnu/CORBA/Poa/ORB_1_4.java,
+ gnu/CORBA/Poa/gnuPOA.java,
+ gnu/CORBA/Poa/gnuServantObject.java,
+ gnu/CORBA/Simple_delegate.java,
+ gnu/CORBA/gnuAny.java,
+ gnu/CORBA/gnuRequest.java,
+ org/omg/CORBA/OMGVMCID.java,
+ org/omg/CORBA/StringValueHelper.java,
+ org/omg/CORBA/SystemException.java,
+ org/omg/CORBA/WStringValueHelper.java,
+ org/omg/CORBA/portable/ObjectImpl.java,
+ org/omg/CORBA_2_3/ORB.java,
+ org/omg/CORBA_2_3/portable/InputStream.java,
+ org/omg/CORBA_2_3/portable/OutputStream.java: Modified to support
+ RMI over CORBA mechanism.
+ * gnu/javax/rmi/CORBA/DelegateFactory.java,
+ gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java,
+ gnu/javax/rmi/CORBA/StubDelegateImpl.java,
+ gnu/javax/rmi/CORBA/UtilDelegateImpl.java,
+ javax/rmi/CORBA/ClassDesc.java,
+ javax/rmi/CORBA/PortableRemoteObjectDelegate.java,
+ javax/rmi/CORBA/Stub.java,
+ javax/rmi/CORBA/StubDelegate.java,
+ javax/rmi/CORBA/Tie.java,
+ javax/rmi/CORBA/Util.java,
+ javax/rmi/CORBA/UtilDelegate.java,
+ javax/rmi/CORBA/ValueHandler.java,
+ javax/rmi/CORBA/package.html,
+ javax/rmi/PortableRemoteObject.java,
+ javax/rmi/package.html: New files (replacing).
+ * gnu/javax/rmi/CORBA/ValueHandlerImpl.java,
+ gnu/javax/rmi/PortableServer.java: Modified to keep the code
+ compileable between subsequent patches.
+
+2005-10-02 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/ImageIO.java: Fix compilation problems.
+
+2005-10-01 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ (MetalScrollBarPropertyChangeHandler.propertyChange):
+ Only set free standing when increase or decrease button isn't null.
+ If not FREE_STANDING_PROP pass up event to super class.
+
+2005-10-02 Mark Wielaard <mark@klomp.org>
+
+ Workarounds for bug #24166
+ * javax/imageio/ImageIO.java (filter): Catch IOException in
+ canDecodeInput().
+ (TranscoderFilter.WriterObjectFilter): Renamed to TranscoderFilter.
+ (getImageReadersBySuffix): Use ReaderObjectFilter, not the nonexisting
+ ReaderSuffixFilter.
+ (createImageInputStream): Test with Class.isAssignableFrom() and for
+ foundSpi == null.
+ (createImageOutputStream): Likewise and use output, not input.
+ (getImageReader): Always return null for now.
+ (getImageReaders): Use input, not object.
+ (getImageWriters): Rename formatName to format and create a
+ WriterObjectFilter with type and format not just object.
+ (getImageWriter): Always return null for now.
+ (getImageTranscoders): Create TranscoderFilter not ImageTranscoderSpi
+ instance.
+
+2005-10-02 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java: API doc updates.
+
+2005-10-02 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/imageio/IIOException.java: Document.
+ * javax/imageio/IIOImage.java: Document.
+ * javax/imageio/IIOParam.java: Complete and document.
+ * javax/imageio/IIOParamController.java: Document.
+ * javax/imageio/ImageIO.java: Complete and document.
+ * javax/imageio/ImageReader.java: Complete and document.
+ * javax/imageio/ImageTranscoder.java: Document.
+ * javax/imageio/ImageTypeSpecifier.java: Complete and document.
+ * javax/imageio/ImageWriter.java: Complete and document.
+ * javax/imageio/package.html: Write.
+
+2005-10-01 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23890:
+ * java/util/Calendar.java (equals): Include other calendar
+ attributes.
+ (hashCode): Updated.
+ * java/util/GregorianCalendar.java (hashCode): New method.
+ (equals): Use super.equals().
+
+2005-10-01 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/image/ComponentSampleModel.java (numBands): Shadow
+ package-private field in parent class with this protected field.
+ * java/awt/image/SampleModel.java (numBands): Make field
+ package-private.
+
+2005-10-01 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23880:
+ * gnu/java/security/x509/ext/Extension.java (Value.hashCode): New
+ method.
+ * gnu/java/security/der/BitString.java (hashCode): New method.
+ * javax/security/auth/x500/X500Principal.java (hashCode): New method.
+
+2005-10-01 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/net/URLClassLoader.java
+ (Resource.name): Removed field.
+ (JarURLResource.name): Added field.
+ (FileResource.getURL): Use File.toURL() instead of doing it in
+ a way that breaks on Windows.
+
+2005-10-01 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/include/layout.wml: Point Tasks menu item to
+ mediation wiki.
+ * doc/www.gnu.org/tasks.wml: Redirect to mediation wiki.
+
+2005-10-01 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked):
+ Call cairo_pattern_set_extend after gr->pattern has been set and checked
+ versus NULL.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTextPane.java
+ (replaceSelection): Don't update the caret position here.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (DocumentHandler.insertUpdate): Likewise.
+ (DocumentHandler.removeUpdate): Likewise.
+ * javax/swing/text/DefaultCaret.java
+ (DocumentHandler): New inner class. Handles caret position updates.
+ (PropertyChangeHandler): New inner class. (Un)installs document
+ listener when the text component's document changes.
+ (install): Install the new listeners on the text component.
+ (deinstall): Deinstall the new listeners on the text component.
+ * javax/swing/text/DefaultEditorKit.java
+ (DefaultKeyTypedAction.actionPerformed): Don't update the caret
+ position here.
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/AbstractButton.java
+ (AbstractButton): updateUI should be called after
+ everything is initialized, so everything is revalidated.
+ * javax/swing/JMenuItem.java
+ (JMenuItem): Added call to init so model is set.
+ (JMenuItem): Likewise.
+ * javax/swing/JOptionPane.java
+ (createDialog): Removed invalidate and repaint calls.
+ (JOptionPane): Likewise.
+ * javax/swing/JPopupMenu.java
+ (setVisible): Changed size to be the preferred size.
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (paintTabArea): Added check to adjust runCount if
+ it is less that tabCount.
+
+2005-09-30 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/PlainDocument.java:
+ (removeUpdate): Fixed length of new LeafElement and off-by-one error
+ in call to rootElement.replace().
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (propertyChange): No reason to reset the layout manager here.
+ (setDividerLocation): Changed to check right component, not left.
+ Also, updated the location to a valid spot.
+
+2005-09-30 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/SliderDemo.java:
+ New file.
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/AbstractButton.java
+ (setActionCommand): Added check to prevent NPE.
+ (getMnemonic): Likewise.
+ (setMnemonic): Likewise.
+ (setSelected): Likewise.
+ (isSelected): Likewise.
+ (setEnabled): Likewise.
+ (doClick): Likewise.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paintMenuItem): Added check to prevent NPE.
+ (paintText): Likewise.
+
+2005-09-30 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSplitPaneUI.java
+ (propertyChange): Added call to reset the layout manager
+ whenever the size of the divider is changed.
+ (setDividerLocation): Added adjustment to container
+ sizes if the divider goes over the bottom/right side.
+ Also, fixed the size of the right/top component.
+ (validLocation): Added check for min/max location returned.
+
+2005-09-30 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/StyleContext.java:
+ (SmallAttributeSet.getAttribute): If the attribute we're looking for is
+ ResolveAttribute, don't try to check the resolve parent, because this
+ will cause an infinite loop.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (accessibleContext): Removed unneeded field. This is already
+ declared in JComponent.
+ * javax/swing/Box.java
+ (accessibleContext): Removed unneeded field. This is already
+ declared in JComponent.
+ * javax/swing/JFrame.java
+ (EXIT_ON_CLOSE): New constant field.
+
+2005-09-30 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/GapContent.java:
+ (shiftEnd): Call adjustPositionsInRange rather than getPositionsInRange
+ and then iterating over the set and adjusting them.
+ (shiftGap): Likewise.
+ (shiftGapStartDown): Call setPositionsInRange rather than
+ getPositionsInRange and then iterating over the set to set each
+ Position.
+ (shiftGapEndUp): Likewise.
+ (setPositionsInRange): New implementation method.
+ (adjustPositionsInRange): New implementation method.
+ (resetMarksAtZero): Call setPositionsInRange rather than
+ getPositionsInRange and then iterating over the set to set each
+ Position.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (getScrollableUnitIncrement): Respect the direction argument.
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (VSBChangeListener.stateChanged): Compare ypos with viewPosition.y
+ instead of viewPosition.x.
+ (ViewportChangeHandler.stateChanged): Call
+ syncScrollPaneWithViewport in all cases, not only when the
+ extents have changed.
+ (syncScrollPaneWithViewport): Also sync the maximum and value
+ properties of the scrollbar models with the viewport.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (paint): Only call paintFocus if button is actually focused.
+
+2005-09-30 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24115
+ * javax/swing/AbstractButton.java
+ (AbstractButton): Don't call init() from here. Moved some
+ initialization code from init() to the constructor.
+ (init): Moved most of the initialization code to the constructor.
+ * javax/swing/JCheckBox.java
+ (JCheckBox()): call this(..) instead of super(..). Don't call init()
+ here, this is already performed by the JToggleButton constructor.
+ (JCheckBox(Action)): Don't call init() here, this is already
+ performed by the JToggleButton constructor.
+ (JCheckBox(Icon)): call this(..) instead of super(..). Don't call
+ init() here, this is already performed by the JToggleButton
+ constructor.
+ (JCheckBox(Icon, boolean)): Likewise.
+ (JCheckBox(String)): Likewise.
+ (JCheckBox(String, boolean)): Likewise.
+ (JCheckBox(String, Icon)): Likewise.
+ (JCheckBox(String, Icon, boolean)): Don' call init here. This is
+ already performed by the JToggleButton constructor. Set the
+ correct defaults for horizontalAlignment and borderPainted
+ properties here.
+ * javax/swing/JRadioButton.java
+ (JRadioButton(String, Icon, boolean)): Use acccessor methods
+ instead of directly manipulating package private fields of
+ AbstractButton.
+ * javax/swing/JToggleButton.java
+ (JToggleButton(String, Icon, boolean)): Set correct value for the
+ alignmentX property.
+
+2005-09-30 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/JFileChooser.java: Import AccessibleRole.
+
+2005-09-30 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (cp_gtk_graphics2d_init_jni): Check ExceptionOccured after running
+ class initializer.
+
+2005-09-30 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkFontMetrics.java (initFont): New static
+ method.
+ (GdkFontMetrics): Use initFont() in super() call.
+
+2005-09-30 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
+ (Java_gnu_java_awt_peer_gtk_GdkTextLayout_getOutline): Initialize all
+ fields of the FT_Outline_Funcs ftCallbacks struct.
+ (_moveTo): Takes an void * as argument.
+ (_lineTo): Likewise.
+ (_quadTo): Likewise.
+ (_curveTo): Likewise.
+
+2005-09-30 Sven de Marothy <sven@physto.se>
+
+ * javax/swing/JFileChooser.java:
+ (getAccessibleContext): Implement.
+ (AccessibleJFileChooser): Inner class implemented.
+
+2005-09-30 Jeroen Frijters <jeroen@frijters.net>
+
+ Fixes Bug 24122
+ * gnu/xml/transform/TransformerImpl.java
+ (writeStreamResult): Added call to connection.setDoInput(false).
+
+2005-09-29 Tom Tromey <tromey@redhat.com>
+
+ * java/net/URLConnection.java (setDoInput): Javadoc fix.
+ (setDoOutput): Likewise.
+ (setContentHandlerFactory): Likewise.
+ (setFileNameMap): Likewise.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (installUI): Call the new installKeyboardActions hook.
+ (uninstallUI): Call the new uninstallKeyboardActions hook.
+ (installKeyboardActions): New hook method.
+ (uninstallKeyboardActions): New hook method.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (ActionScroller.ActionScroller): Added constructor.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (KeyHandler): New inner class.
+ (createKeyListener): New method.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getLeftChildIndent): Fixed method signature.
+ (drawCentered): Fixed method signature.
+
+2005-09-29 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23381:
+ * java/beans/PropertyDescriptor.java (hashCode): New method.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/OverlayLayout.java: Added API docs all over.
+
+2005-09-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ButtonDemo.java
+ (createContent): add a close button,
+ (actionPerformed): perform close action,
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java
+ (createContent): add a close button,
+ (actionPerformed): perform close action.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (getAlignedSizeRequirements): Fixed calculation of preferred and
+ maximum size as well as the alignment.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #23851
+ * javax/swing/OverlayLayout.java
+ (OverlayLayout): Implemented.
+ (invalidateLayout): Implemented.
+ (addLayoutComponent(Component, Object)): Implemented.
+ (addLayoutComponent(String, Component)): Implemented.
+ (removeLayoutComponent): Implemented.
+ (preferredLayoutSize): Implemented.
+ (minimumLayoutSize): Implemented.
+ (maximumLayoutSize): Implemented.
+ (getLayoutAlignmentX): Implemented.
+ (getLayoutAlignmentY): Implemented.
+ (layoutContainer): Implemented.
+ (checkRequirements): New private helper method.
+ (checkTotalRequirements): New private helper method.
+ (checkLayout): New private helper method.
+
+2005-09-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ComboBoxDemo.java: new demo.
+
+2005-09-29 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/print/PrinterJob.java
+ (print(PrintRequestAttributeSet)): Remove abstract modifier and
+ implement.
+
+2005-09-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): use current size, not preferred size, when checking for
+ screen edge,
+ * javax/swing/plaf/basic/BasicComboPopup.java
+ (show): include top and bottom insets in preferred size,
+ * javax/swing/plaf/metal/MetalComboBoxButton.java
+ (MetalComboBoxButton): don't pass icon to super class,
+ (paintComponent): call super.paintComponent() and reworked label
+ drawing.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24105
+ * javax/swing/text/GapContent.java
+ (GapContentPosition.getOffset): Adjusted assert statement.
+ (shiftGap): Adjusted index in getPositionsInRange call. Call
+ resetMarksAtZero if gapStart has moved to 0.
+ (replace): Call shiftGap and shiftGapEndUp only if necessary.
+ (resetMarksAtZero): New method.
+
+2005-09-29 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Added a new field for the gap between the icon and text.
+ (setPreferredMenuItemSize): Changed gap from defaultTextIconGap
+ to defaultTextArrowIconGap
+
+2005-09-29 Tom Tromey <tromey@redhat.com>
+
+ * java/rmi/activation/ActivationGroup_Stub.java (serialVersionUID):
+ New field.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24080
+ * java/awt/Window.java
+ (show): Fixed the synchronized block to fix deadlock
+ problem.
+
+2005-09-29 Sven de Marothy <sven@physto.se>
+
+ * gnu/java/awt/peer/gtk/GdkTextLayout.java
+ (getOutline): Implement as native
+ * include/gnu_java_awt_peer_gtk_GdkTextLayout.h
+ Add declaration
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
+ (getOutline): Implement.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ * java/rmi/server/RMIClassLoader.java
+ (loadClass(URL, String)): New method.
+
+2005-09-29 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug #24114
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installDefaults): Set the background color correctly.
+
+2005-09-29 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicIconFactory.java
+ (getMenuArrowIcon): adjusted the size and painting of the returned
+ icon,
+ * javax/swing/plaf/basic/BasicMenuItemUI.java
+ (paintMenuItem): adjusted arrow icon position.
+
+2005-09-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (BranchElement.getElementIndex): If there are no children, don't return
+ -1, instead getStartOffset() will throw NPE. Also, if no child Element
+ contains the specified offset, return the closest one.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Added check to prevent NPE.
+ (adjustLocation): Changed else if to if, to
+ check final y position of tooltip incase
+ it is still cut off.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * java/rmi/server/RMIClassLoader.java:
+ Moved all implementation code to
+ gnu.java.rmi.server.RMIClassLoaderImpl.
+ (getProviderInstance): New helper method to find a provider.
+ (getDefaultProviderInstance): New helper method to find a provider.
+ (loadClass(String, String, Class)): New method.
+ * gnu/java/rmi/server/RMIClassLoaderImpl.java:
+ New class. The implementation is moved from
+ java.rmi.server.RMIClassLoader.
+
+2005-09-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/AbstractDocument.java:
+ (AbstractElement.getResolveParent): If the AttributeSet's
+ getResolveParent returns null, use the Element's parent's AttributeSet.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * java/rmi/activation/ActivationGroup_Stub.java:
+ New class.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (paint): No need to call calculateThumbLocation, called
+ by calculateGeometry.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23934
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (paint): Called calculateGeometry, so the slider is
+ initially set up.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24080
+ * java/awt/Window.java
+ (show): Added a synchronized block to fix deadlock
+ problem.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicSliderUI.java
+ (ActionScroller): Added unused class for binary compatibility.
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java
+ (MouseInputHandler): Made inner class public as specified.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (FocusHandler): Made inner class public as specified.
+ (MouseInputHandler): Made inner class public as specified.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (currentIcon): Made method package private, so that other button
+ UIs can access it.
+ (paint): Removed unnecessary call to paintButtonNormal().
+ (paintButtonNormal): Removed unnecessary method. The background
+ is already filled correctly when paint() is entered.
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (paint): Call the new paintFocus() method instead of the inherited
+ from BasicButtonUI.
+ (paintFocus): New method. Paints the focus indicator for
+ JRadioButtons and subclasses.
+ * javax/swing/plaf/basic/BasicToggleButtonUI.java
+ (paint): New method. Implements custom painting. Mostly, this
+ is needed in order to call the new paintIcon() method.
+ (paintIcon): New method. Narrows the types from the super-class
+ method.
+
+2005-09-28 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getRowEnd): Call getText() rather than trying to get the Element-
+ specific portion to avoid GapContent errors.
+ (getRowStart): Likewise.
+
+2005-09-28 Tom Tromey <tromey@redhat.com>
+
+ * javax/sound/midi/MidiUnavailableException.java (serialVersionUID):
+ New field.
+ * javax/sound/midi/InvalidMidiDataException.java (serialVersionUID):
+ New field.
+
+2005-09-28 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/UIDefaults.java
+ (getBoolean(Object)): API doc correction.
+
+2005-09-28 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalButtonListener.java
+ (propertyChange): check new value of property to determine which
+ border to set.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installDefaults): Fixed checks for setting defaults.
+ Should check if default is null also.
+
+2005-09-28 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24077
+ * gnu/java/awt/peer/gtk/GdkFontMetrics.java
+ (GdkFontMetrics): Added a check for the font
+ being null. Fixed a NPE.
+ * gnu/java/awt/peer/gtk/GdkGraphics.java
+ (GdkGraphics): Added check if the font is null.
+ If it is, the font should be set to the default.
+ (setFont): If font parameter is null, this.font should not
+ be changed.
+ * javax/swing/JPopupMenu.java:
+ Fixed API documentation to say 'JDialog' rather than
+ 'JWindow'.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (currentIcon): Made method package private, so that other button
+ UIs can access it.
+ (paint): Removed unnecessary call to paintButtonNormal().
+ (paintButtonNormal): Removed unnecessary method. The background
+ is already filled correctly when paint() is entered.
+ * javax/swing/plaf/basic/BasicRadioButtonUI.java
+ (paint): Call the new paintFocus() method instead of the inherited
+ from BasicButtonUI.
+ (paintFocus): New method. Paints the focus indicator for
+ JRadioButtons and subclasses.
+ * javax/swing/plaf/basic/BasicToggleButtonUI.java
+ (paint): New method. Implements custom painting. Mostly, this
+ is needed in order to call the new paintIcon() method.
+ (paintIcon): New method. Narrows the types from the super-class
+ method.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (createDefaultTheme): Change default back to DefaultMetalTheme.
+ The Ocean theme is too inconsistent.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Font.java
+ (tk): Made method package private. Must not be protected.
+ (getFontFromToolkit): Made method package private. Must not
+ be protected.
+ (getPeerFromToolkit): Made method package private. Must not
+ be protected.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (createMouseWheelListener): New hook method for creating
+ mouse wheel listeners.
+ (installListeners): Use new hook method to create mouse wheel
+ listeners.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalProgressBarUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/MetalSeparatorUI.java
+ (paint): New method. Uses the metal colors for drawing separators.
+ * javax/swing/plaf/metal/MetalSplitPaneUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/MetalTabbedPaneUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/MetalTextFieldUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (createUI): Removed Hashtable lookup.
+ * javax/swing/plaf/metal/Ocean.java
+ (addCustomEntriesToTable): New method. Adds some custom UI defaults
+ for the Ocean theme.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ (paintThumb): Use new MetalUtils.fillMetalPattern signature.
+ * javax/swing/plaf/metal/MetalSplitPaneDivider.java
+ (paint): Use new MetalUtils.fillMetalPattern signature.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+ (paintPalette): Use new MetalUtils.fillMetalPattern signature.
+ (paintComponent): Use new MetalUtils.fillMetalPattern signature.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (MenuItemBorder.paintBorder): Fixed painting so that a thin white
+ line is drawn on the left of unarmed items. Fixed color handling.
+ (PopupMenuBorder.borderInsets): Fixed insets.
+ (PopupMenuBorder.paintBorder): Removed left white line. This is
+ drawn now in the MenuItemBorder.
+ (ToolBarBorder.paintBorder): Use correct call to new MetalUtils
+ fillMetalPattern method signature.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalUtils.java
+ (fillMetalPattern): If we have a Graphics2D, then go into
+ optimized drawing mode.
+ (fillMetalPattern2D): New method. Implements pattern drawing using
+ textures.
+ (initializePattern): New method. Initializes the texture.
+
+2005-09-28 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Font.java: Reformatted file.
+
+2005-09-28 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (TreeHardDriveIcon): new private class,
+ (TreeFloppyDriveIcon): new private class,
+ (TreeComputerIcon): new private class,
+ (getTreeControlIcon): implemented,
+ (getTreeComputerIcon): implemented,
+ (getTreeHardDriveIcon): implemented.
+
+2005-09-28 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (ToolBarBorder): now implements SwingConstants.
+
+2005-09-27 Anthony Green <green@redhat.com>
+
+ * javax/sound/midi/MidiSystem.java (getSequence): Add
+ missing methods.
+ * javax/sound/midi/Sequencer.java (stopRecording): Ditto.
+ * javax/sound/midi/ShortMessage.java (ShortMessage): Ditto.
+ (setMessage): Fix visibility. Add missing implementations.
+ * javax/sound/midi/ShoundbankResouce.java: Rename "soundBank" to
+ "soundbank", and "getSoundBank" to "getSoundbank".
+
+2005-09-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (rolloverBorder): new field,
+ (getRolloverBorder): new method,
+ * javax/swing/plaf/metal/MetalButtonListener.java: new class,
+ * javax/swing/plaf/metal/MetalButtonUI.java
+ (instance): removed field,
+ (constructor): initialise fields from UI defaults,
+ (getFocusColor): just return field value,
+ (getSelectColor): just return field value,
+ (getDisabledTextColor): just return field value,
+ (createUI): return a new instance every time,
+ (installDefaults): check for isRolloverEnabled and install rollover
+ border if necessary,
+ (uninstallDefaults): implemented,
+ (createButtonListener): implemented,
+ (paintButtonPressed): implemented,
+ (paintFocus): implemented,
+ (paintText): implemented.
+
+2005-09-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/SimpleAttributeSet.java:
+ (containsAttribute): Check the resolve parent if the attribute is not
+ found locally.
+ (containsAttributeLocally): New package-private method.
+ (isEqual): Re-implemented. Return true if the two sets have the same
+ size and this set contains the given set.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JSeparator.java
+ (updateUI): Removed invalidate call. This is unnecessary.
+ * javax/swing/plaf/basic/BasicSeparatorUI.java
+ (paint): Reworked painting so that it paints the separator
+ correctly.
+ (getPreferredSize): Fixed to return the correct values according
+ to the JDK.
+ (getMinimumSize): Likewise.
+ (getMaximumSize): Likewise.
+
+2005-09-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (RolloverButtonBorder): new class.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (preferredLayoutSize): Fixed to respect the containers insets.
+ (layoutComponent): Likewise.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (calculateTiledPositions): Only adjust sizes if the allocated
+ span is actually different from the used span.
+ (calculateAlignedPositions): Call adjustFromRight also if
+ baseline == 0, otherwise we get strange results because 0 * x = 0.
+
+2005-09-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/SimpleAttributeSet.java:
+ (removeAttributes(AttributeSet)): Only remove attributes from the
+ current set if their keys AND values are found in the given set
+
+2005-09-27 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24067
+ * java/awt/Component.java
+ (removeNotify): Should call hide on the peer before
+ disposing of it. This stops the flashing when the
+ tooltips are removed from the component.
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (getPreferredSize): If the accelerator is null, we should
+ paint the mnenomic if it is available.
+
+2005-09-27 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/Window.java (createBufferStrategy): Can throw AWTException.
+ * java/awt/Canvas.java (createBufferStrategy): Can throw AWTException.
+
+2005-09-27 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24044
+ * javax/swing/ToolTipManager.java
+ (showTip): currentTip needs to be revalidated on HeavyWeightPopups
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (getPreferredSize): Fixed to get the preferred size of the
+ tooltip including the accelerator, if it has one.
+ (paint): Fixed to paint the accelerator in its font
+ and color, if it has one.
+
+2005-09-27 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getRowEnd): New method.
+ (getRowStart): New method.
+
+2005-09-27 Tom Tromey <tromey@redhat.com>
+
+ * java/beans/beancontext/BeanContextServicesSupport.java
+ (BCSSChild.serialVersionUID): Fixed.
+ * java/beans/beancontext/BeanContextSupport.java
+ (BCSChild.serialVersionUID): Fixed.
+
+2005-09-27 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (installDefaults): get border from UI defaults,
+ * javax/swing/plaf/metal/MetalBorders.java:
+ (ToolBarBorder): new class,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added tool bar border default,
+ * javax/swing/plaf/metal/MetalToolBarUI.java
+ (MetalContainerListener): new class,
+ (instance): removed field,
+ (MetalRolloverListener): new class,
+ (contListener): new field,
+ (rolloverListener): new field,
+ (createUI): return a new instance every time,
+ (createRolloverListener): implemented,
+ (createContainerListener): implemented,
+ (createNonRolloverBorder): implemented.
+
+2005-09-27 Anthony Green <green@redhat.com>
+
+ * javax/sound/midi/MidiFileFormat.java (bytes, microseconds):
+ Rename to byteLength and microsecondLength respectively.
+
+2005-09-26 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): validating of toolTipWindow should not have been
+ removed.
+
+2005-09-26 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Removed validating of currentTip. setVisible(true)
+ does this. Also, removed validating of toolTipWindow because
+ show() does this.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (adjustGreater): Special handle the case when the components have
+ no spare room for adjustment.
+ (adjustSmaller): Special handle the case when the components have
+ no spare room for adjustment.
+
+2005-09-27 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (hide): Repaint component before invalidating the parent.
+ (show): Repaint component before invalidating the parent.
+ * javax/swing/JComponent.java
+ (revalidate): Check if we are in the event thread, and if not,
+ then queue a self-request in the event thread.
+ (setVisible): Repaint the parent and queue a revalidate.
+
+2005-09-27 Sven de Marothy <sven@physto.se>
+
+ * javax/swing/JComboBox.java
+ (firePopupMenuCanceled): Implement
+ (firePopupMenuWillBecomeInvisible): Implement
+ (firePopupMenuWillBecomeVisible): Implement
+
+2005-09-27 Sven de Marothy <sven@physto.se>
+
+ * javax/swing/text/html/CSS.java
+ (getAttribute,getAllAttributeKeys): Implement
+
+2005-09-26 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (JTree): Root should be visible by default.
+ * javax/swing/ToolTipManager.java
+ (showTip): Added check for validity of currentTip. Prevents
+ over-validating.
+ (hideTip): currentTip should be reset.
+ * javax/swing/JMenuItem.java
+ (setAccelerator): Registered accelerator as a keyboard action.
+
+2005-09-26 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/reflect/Proxy.java: Javadoc fix.
+ * java/io/OutputStreamWriter.java (OutputStreamWriter): Javadoc fix.
+
+2005-09-26 Anthony Green <green@redhat.com>
+
+ * javax/sound/midi/Synthesizer.java (loadInstrument,
+ unloadInstrument, remapInstrument, loadAllInstruments,
+ unloadAllInstruments, unloadInstrument, loadInstrument): Don't
+ declare the unchecked IllegalArgumentException.
+ * javax/sound/midi/MidiSystem.java (getMidiDevice, write): Ditto.
+ * javax/sound/midi/ShortMessage.java: Fix 80-column formatting
+ problem.
+ * javax/sound/midi/Sequence.java: Ditto.
+ * javax/sound/midi/MidiMessage.java: Ditto.
+ * javax/sound/midi/MidiSystem.java: Ditto.
+ * javax/sound/midi/MidiFileFormat.java: Ditto.
+
+2005-09-26 Anthony Green <green@redhat.com>
+
+ * javax/sound/midi/InvalidMidiDataException.java
+ * javax/sound/midi/MidiFileFormat.java
+ * javax/sound/midi/ControllerEventListener.java
+ * javax/sound/midi/Patch.java javax/sound/midi/Sequence.java
+ * javax/sound/midi/SysexMessage.java javax/sound/midi/Sequencer.java
+ * javax/sound/midi/spi/MidiFileReader.java
+ * javax/sound/midi/spi/MidiFileWriter.java
+ * javax/sound/midi/spi/SoundbankReader.java
+ * javax/sound/midi/spi/MidiDeviceProvider.java
+ * javax/sound/midi/Track.java javax/sound/midi/MidiChannel.java
+ * javax/sound/midi/MetaMessage.java javax/sound/midi/Instrument.java
+ * javax/sound/midi/MidiMessage.java
+ * javax/sound/midi/MidiUnavailableException.java
+ * javax/sound/midi/Transmitter.java javax/sound/midi/MidiEvent.java
+ * javax/sound/midi/VoiceStatus.java javax/sound/midi/MidiDevice.java
+ * javax/sound/midi/SoundbankResource.java
+ * javax/sound/midi/Soundbank.java javax/sound/midi/Receiver.java
+ * javax/sound/midi/MetaEventListener.java
+ * javax/sound/midi/ShortMessage.java
+ * javax/sound/midi/Synthesizer.java
+ * javax/sound/midi/MidiSystem.java: New files.
+
+2005-09-26 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkDialogPeer.java
+ (create): If the dialog is a toolTip or a
+ PopupMenu, its type should be set to:
+ GDK_WINDOW_TYPE_HINT_MENU, so the parent
+ window does not lose focus.
+ * javax/swing/JTree.java
+ (setModel): Should update the UI everytime the
+ model is changed.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installUI): Should not set the root to be visible.
+ (paintControlIcons): changed to use getVisibleRect.
+ * javax/swing/plaf/metal/MetalTreeUI.java
+ (installUI): Should not set the root to be visible.
+
+2005-09-26 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * gnu/java/text/BaseBreakIterator.java:
+ (following): Removed unused local variable.
+
+2005-09-26 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (calculateTiledPositions): Improved to also take minimum and maximum
+ sizes into account and better use the allocated space.
+ (adjustGreater): New helper function.
+ (adjustSmaller): New helper function.
+
+2005-09-25 Casey Marshall <csm@gnu.org>
+
+ Fixes PR classpath/23916. Fix suggested by Santiago Gala
+ <sgala@apache.org>.
+ * java/security/AccessControlContext.java
+ (<init>): update javadoc; check SecurityPermission
+ "createAccessControlContext" if a security manager is set.
+ (getProtectionDomains): new method.
+ * vm/reference/java/security/VMAccessController.java
+ (DEBUG): set to 'gnu.classpath.Configuration.DEBUG.'
+ (pushContext, popContext): add debug statement.
+ (getContext): debug output changes; include the DomainCombiner
+ specified in the AccessControlContext, if any.
+
+2005-09-25 Tom Tromey <tromey@redhat.com>
+
+ * javax/security/sasl/SaslServerFactory.java: Updated javadoc.
+ * javax/security/sasl/Sasl.java: Updated javadoc.
+ * javax/security/sasl/SaslClientFactory.java: Updated javadoc.
+ * javax/security/sasl/RealmChoiceCallback.java: Updated javadoc.
+ * javax/security/sasl/RealmCallback.java: Updated javadoc.
+ * javax/security/sasl/AuthenticationException.java: Updated
+ javadoc.
+ * javax/security/sasl/SaslServer.java (getNegotiatedProperty):
+ Don't throw SaslException.
+ * javax/security/sasl/SaslClient.java (getNegotiatedProperty):
+ Don't throw SaslException.
+ * javax/security/sasl/SaslException.java (serialVersionUID): New
+ field.
+ * javax/security/sasl/AuthorizeCallback.java (AuthorizeCallback):
+ Implements Serializable.
+ (serialVersionUID): New field.
+
+2005-09-25 Casey Marshall <csm@gnu.org>
+
+ * gnu/java/security/provider/Gnu.java
+ (<init>): add Diffie-Hellman key factory and key pair generator.
+ * gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java,
+ * gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java:
+ new files.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (calculateAlignedPositions): Improved algorithm to better respect
+ the minimum and maximum size and to better use the available space.
+ (adjustFromRight): New helper method.
+ (adjustFromLeft): New helper method.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (layoutContainer): Respect the insets of the container.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ Fixed some API comments.
+ (paintChildren): Set clip to exclude the border area.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Paint border after the children are painted. Otherwise the
+ children could draw over the border.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (getAlignedRequirements): Implemented this method.
+ (calculateAlignedPositions): Implemented this method.
+ * javax/swing/BoxLayout.java
+ (Direction): Removed unneeded inner interface.
+ (Horizontal): Removed unneeded inner class.
+ (Vertical): Removed unneeded inner class.
+ (SizeReq): Removed unneeded inner class.
+ (preferredLayoutSize): Reimplemented to use SizeRequirements.
+ (minimumLayoutSize): Reimplemented to use SizeRequirements.
+ (maximumLayoutSize): Reimplemented to use SizeRequirements.
+ (layoutContainer): Reimplemented to use SizeRequirements.
+ (layoutAlgorithm): Removed unneeded package private method.
+ (distributeSpace): Removed unneeded package private method.
+ (getSizeRequirements): New private helper method.
+
+2005-09-24 Sven de Marothy <sven@physto.se>
+
+ * gnu/javax/imageio/bmp/BMPDecoder.java
+ (BMPDecoder): Fix static field references.
+
+2005-09-24 Sven de Marothy <sven@physto.se>
+
+ * java/awt/Font.java
+ Fixed comments.
+ (pointSize): New field.
+ (Font): Set size fields.
+ (getSize, getSize2D): Return size fields.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Check if clip == null and if so set it to the component's
+ bounds.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (getClipBounds): Added null check so that null is returned when
+ clip == null, instead of throwing an NPE while accessing
+ null.getBounds2D().
+
+2005-09-24 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+ (Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit): Replace deprecated
+ gtk colormap stuff.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paint): Activate double buffering if it is not already activated.
+ (paintImmediately2): Prepare a component graphics object here and
+ call paintDoubleBuffered with this.
+ (paintDoubleBuffered): Changed to work nicely with the new paint()
+ and paintImmediately2() methods.
+
+2005-09-24 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Added font default for
+ FormattedTextField.font. Solves an NPE that was caused by a null
+ font on a JFormattedTextField.
+
+2005-09-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/DefaultComboBoxModel.java
+ (addElement): always fire event for interval added, and call
+ setSelectedItem() if this is the first item.
+
+2005-09-24 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/DefaultComboBoxModel.java: updated API docs all over.
+
+2005-09-24 Sven de Marothy <sven@physto.se>
+
+ * java/awt/FontMetrics.java
+ (getMaxCharBounds, hasUniformLineMetrics): New methods.
+
+2005-09-24 Sven de Marothy <sven@physto.se>
+
+ * gnu/javax/imageio/bmp/BMPDecoder.java,
+ * gnu/javax/imageio/bmp/BMPImageReaderSpi.java,
+ * gnu/javax/imageio/bmp/DecodeBF32.java,
+ * gnu/javax/imageio/bmp/DecodeRGB8.java,
+ * gnu/javax/imageio/bmp/BMPException.java,
+ * gnu/javax/imageio/bmp/BMPInfoHeader.java,
+ * gnu/javax/imageio/bmp/DecodeRGB1.java,
+ * gnu/javax/imageio/bmp/DecodeRLE4.java,
+ * gnu/javax/imageio/bmp/BMPFileHeader.java,
+ * gnu/javax/imageio/bmp/DecodeRGB24.java,
+ * gnu/javax/imageio/bmp/DecodeRLE8.java,
+ * gnu/javax/imageio/bmp/BMPImageReader.java,
+ * gnu/javax/imageio/bmp/DecodeBF16.java,
+ * gnu/javax/imageio/bmp/DecodeRGB4.java:
+ New files.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (setFont): If font == null, simply return. Avoids a NPE.
+
+2005-09-23 Sven de Marothy <sven@physto.se>
+
+ * java/io/OutputStreamWriter.java:
+ (OutputStreamWriter): Added missing constructors.
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Component.java
+ (getFont): Should return null, not a default font.
+ * javax/swing/ToolTipManager.java
+ (showTip): Called revalidate currentTip before painted, and
+ called validate on JDialog toolTip.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SwingUtilities.java
+ (layoutCompoundLabel): Removed debug code.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JScrollPane.java
+ (setHorizontalScrollBar): Removed handling of listeners on the model.
+ This is now done in the BasicScrollPaneUI.
+ (setHorizontalScrollBarPolicy): Added revalidate call.
+ (setVerticalScrollBar): Removed handling of listeners on the model.
+ This is now done in the BasicScrollPaneUI.
+ (setVerticalScrollBarPolicy): Added revalidate call.
+ (setViewport): Removed handling of listeners on the viewport.
+ This is now done in the BasicScrollPaneUI.
+ (createScrollListener): Removed unnecessary and undocumented method.
+ The functionality of this method is moved to BasicScrollPaneUI
+ as specified.
+ (JScrollPane): Removed initialization of removed listener.
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (HSBChangeListener): New inner class.
+ (VSBChangeListener): New inner class.
+ (ViewportChangeHandler): New inner class.
+ (PropertyChangeHandler): New inner class.
+ (MouseWheelHandler): New inner class.
+ (installUI): Also call installListeners.
+ (installListeners): New method. Initializes the listeners on the
+ scrollpane.
+ (createHSBChangeListener): New method.
+ (createVSBChangeListener): New method.
+ (createViewport): New method.
+ (createPropertyChangeListener): New method.
+ (uninstallUI): Also call uninstallListeners.
+ (uninstallListeners): New method.
+ (syncScrollPaneWithViewport): New method.
+ (updateColumnHeader): New method.
+ (updateRowHeader): New method.
+ (updateScrollBarDisplayPolicy): New method.
+ (updateViewport): New method.
+
+2005-09-23 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTextField.java: Reformatted and added API docs.
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Set lightWeightPopupEnabled to default.
+ Validated and repainted new containerPanel and
+ repainted toolTipWindow and repainted currentTip. The
+ toolTips paint well now.
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paintRecursive): Changed clip to be the visible
+ rectangle of the view.
+
+2005-09-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/DefaultComboBoxModel.java
+ (DefaultComboBoxModel(Object[])): set selected item,
+ (DefaultComboBoxModel(Vector): likewise,
+ (addElement): reimplemented,
+ (removeElementAt): update selected item,
+ (removeAllElements): clear selected item and fire correct event,
+ (setSelectedItem): update item always,
+ (getElementAt): return null for index out of bounds,
+ * javax/swing/plaf/metal/MetalComboBoxButton.java
+ (paintComponent): check for null selection.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ Added some deprecated and unused fields for binary compatibility.
+ (installListeners): Fixed method parameters.
+ (installUI): Call installListeners with fixed method parameters.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicPanelUI.java
+ (uninstallUI): New method.
+ (uninstallDefaults): New method.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ (MinimumHeight): New constant field.
+ (MinimumWidth): New constant field.
+ (minimumWidth): Removed unused field.
+ (minimumHeight): Removed unused field.
+ (installDefaults): Removed initializing of minimumSize and
+ minimumHeight.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Initialize OptionPane.minimumSize from
+ constant fields in BasicOptionPaneUI.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicMenuUI.java
+ (ChangeHandler): Added some deprecated and unused fields for
+ binary compatibility.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java
+ (deactivateFrame): New method.
+ (InternalFramePropertyChangeListener.propertyChange): Call
+ new deactivate() method instead of getDesktopManager.deactivate()
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #24022
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (paint): Took out unneeded code.
+
+2005-09-23 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23529
+ * javax/swing/plaf/basic/BasicScrollBarUI.java
+ (mousepressed): Made delay shorted while pressing the arrow
+ button. This makes the scrollbar move more smoothly.
+ (mouseReleased): Reset the delay to the default, so single
+ clicks only move the scrollbar 1 unit. Also, when the
+ mouse is released, the scrollbar should move 1 unit.
+ (shouldScroll): Should not be able to scroll by block
+ when the mouse is in the thumbRect.
+ (mousePressed): Made delay shorted while pressing in the
+ scroll area. This makes the scrollbar move more smoothly.
+ (mouseReleased): Should move the scrollbar 1 block when the
+ mouse is released. Also, reset the timer to default delay.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ (installKeyboardActions): Call renamed method registerKeyboardActions.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicDesktopPaneUI.java
+ (registerKeyboardAction): Renamed this method to
+ registerKeyboardActions as specifie.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicListUI.java
+ (FocusHandler.repaintCellFocus): Marked protected instead of
+ package private as specified.
+ (KeyHandler.keyPressed): Call new methods selectNextIndex and
+ selectPreviousIndex instead of doing the work here.
+ (PropertyChangeHandler.propertyChange): Update the
+ updateLayoutStateNeeded field correctly.
+ (BasicListUI): Removed listener initialization. Moved this
+ to installListeners.
+ (installListeners): Initialize listeners here instead in the
+ constructor. Use the createXXXListener hooks instead of creating
+ the listeners directly.
+ (createFocusListener): New hook method for creating a focus listener.
+ (createListDataListener): New hook method for creating a list
+ data listener.
+ (createListSelectionListener): New hook method for creating a list
+ selection listener.
+ (createMouseInputListener): New hook method for creating a mouse
+ input listener.
+ (createPropertyChangeListener): New hook method for creating a
+ property change listener.
+
+2005-09-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (OptionDialogBorder): new class.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicColorChooserUI.java
+ (uninstallDefaultChoosers): New method.
+ (uninstallUI): Call uninstallDefaultChoosers.
+
+2005-09-23 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SwingUtilities.java
+ (layoutCompoundLabel): Fix the case when verticalTextPosition=BOTTOM
+ and without icon. The label text slipped out of the view rectangle
+ in this case.
+
+2005-09-23 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (setCurrentTheme): throw exception if argument is null, improved API
+ docs.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JPanel.java
+ (accessibleContext): Removed this unnecessary field. Use the
+ inherited field of the same name from JComponent instead.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/UIManager.java
+ (static_initializer): Load MetalLookAndFeel only as fallback, if
+ the system property 'swing.defaultlaf' is not defined. Before
+ it has accidentally loaded the MetalLookAndFeel in all cases,
+ regardless of the property setting.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (paintChildren): If a child component is invisible, skip it.
+ Handle the (rare) case when no clip is set as if it's set to the
+ child component's bounds. These fixes should make Swing working
+ again as before.
+
+2005-09-22 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResizable):
+ Replace deprecated gtk_window_set_policy with gtk_window_set_resizable.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem): Replace deprecated
+ gtk_container_children with gtk_container_get_children.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMenu): Likewise.
+ (Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu): Likewise.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
+ (Java_gnu_java_awt_peer_gtk_GtkImage_freePixmap): Replace deprecated
+ gdk_pixmap_unref with g_object_unref.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked):
+ Replace deprecated gdk_cursor_destroy with gdk_cursor_unref.
+ (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent):
+ Replace deprecated gtk_container_children with
+ gtk_container_get_children.
+ (find_fg_color_widget): Replace deprecated macro GTK_IS_OPTION_MENU with
+ GTK_IS_COMBO_BOX.
+ (component_button_release_cb): Replace deprecated gdk_window_get_size
+ with gdk_drawable_get_size.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup):
+ Replace deprecated gtk_radio_button_group with
+ gtk_radio_button_get_group.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove): Likewise.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+ (Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create): Replace deprecated
+ gtk_type_new with gtk_drawing_area_new.
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState): Replace deprecated
+ gdk_*_ref with g_object_ref.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II): Likewise.
+ Replace deprecated gdk_rgb_get_cmap with gdk_rgb_get_colormap.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage): Replace
+ deprecated gdk_*_ref with g_object_ref.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked): Likewise.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose): Replace deprecated
+ gdk_*_unref with g_object_unref.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea): Replace deprecated
+ gdk_window_copy_area with gdk_draw_drawable.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor): Replace deprecated
+ gdk_color_alloc with gdk_colormap_alloc_color.
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getWordEnd): Implemented.
+ (getWordStart): Implemented.
+
+2005-09-22 Keith SEitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/event/filters/StepFilter.java (StepFilter): Do not test
+ for null thread ID -- just test if it has not been garbage collected.
+ * gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java (ThreadOnlyFilter):
+ Likewise.
+
+2005-09-22 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): Size of menu should always be the preferred
+ size. It was sometimes cutting of the accelerator.
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Increased defaultAcceleratorLabelGap field to 10, to
+ make menuItem more readable.
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getPreviousWord): Fixed incorrect logic. Use preceding() instead of
+ following(), previous() instead of next().
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * gnu/java/text/BaseBreakIterator.java:
+ (following): Don't restore old CharacterIterator index.
+
+2005-09-22 Tom Tromey <tromey@redhat.com>
+
+ * javax/swing/JList.java (AccessibleJList): New constructor.
+
+2005-09-22 Tom Tromey <tromey@redhat.com>
+
+ * java/net/ServerSocket.java (accept): Use correct security manager
+ call.
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/Utilities.java:
+ (getNextWord): Implemented.
+ (getPreviousWord): Implemented.
+
+2005-09-22 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/MetalLookAndFeel.java
+ (initComponentDefaults): Changed back to original
+ values.
+
+2005-09-22 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Moved tooltip location adjustments to a
+ helper method.
+ (adjustLocation): New helper method.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Fixed defaults for Table,
+ TableHeader, Tree to match JDK.
+ * javax/swing/plaf/MetalLookAndFeel.java
+ (initComponentDefaults): Fixed defaults for Table and
+ TableHeader to match JDK.
+ * javax/swing/plaf/basic/BasicToolTipUI.java
+ (defaultBorder): Removed, along with inner class. Not needed.
+ (installDefaults): Changed border to be the default border in
+ L&F.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JSpinner.java
+ (ListEditor): New inner class. Provides an editor for the
+ SpinnerListModel.
+
+2005-09-22 Tom Tromey <tromey@redhat.com>
+
+ * java/io/FileWriter.java (FileWriter): Typo fix.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JApplet.java
+ (accessibleContext): Made field protected as specified.
+ * javax/swing/JButton.java
+ (accessibleContext): Removed field. The inherited JComponents
+ accessibleContext field should be used instead.
+ * javax/swing/JLabel.java
+ (accessibleContext): Removed field. The inherited JComponents
+ accessibleContext field should be used instead.
+ * javax/swing/JRootPane.java
+ (JRootPane): Removed unnecessary setDoubleBuffered() call.
+
+2005-09-22 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/html/HTML.java:
+ (SYNTHETIC): Renamed variable SYNTETIC to SYNTHETIC.
+ (Tag): Changed comment for static Tag IMPLIED.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JViewport.java
+ (JViewport): Initialize cached fields for blitting.
+ (setViewPosition): Repaint viewport.
+ (revalidate): Set damaged flag. Used for blitting.
+ (reshape): Likewise.
+ (paint): New method. Decide which paint method to use.
+ (computeBlit): New method. Computes the parameters for blitting.
+ (paintSimple): New method. Performs painting in simple mode.
+ (paintBackingStore): New method. Performs painting in backingstore
+ mode.
+ (paintBlit): New method. Performs painting in blit mode. For
+ now this falls back to backing store mode.
+ * javax/swing/plaf/basic/BasicViewportUI.java
+ (ChangeListener): Removed inner class.
+ (installDefaults): Load default for background color. Changed
+ signature to protected.
+ (installListeners): Removed method.
+ (uninstallDefaults): Changed signature to protected.
+ (installUI): Call installDefaults().
+ (uninstallUI): Call uninstallDefaults().
+ (getPreferredSize): Removed.
+ (paint): Removed.
+ (paintSimple): Removed.
+ (paintBackingStore): Removed.
+
+2005-09-22 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (AccessibleJComponent.addPropertyChangeListener): Partly omplemented.
+ (AccessibleJComponent.getAccessibleStateSet): Partly implemented.
+ (doubleBuffered): Default value of this field is true.
+ (paint): Moved double buffer painting stuff to separate method.
+ (paintChildren): Don't call into AWT painting code here. This allows
+ for a small optimization.
+ (paintImmediately): Don't go up to the parent window, try to start
+ painting on the nearest JRootPane if possible.
+ (paintImmediately2): New method. Actually performs repainting
+ on the repaint root.
+ (paintDoubleBuffered): New method. Performs painting using
+ a double buffer.
+ (paintSimple): New method. Performs painting without buffer.
+
+2005-09-22 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/filechooser/FileFilter.java: reformatted and added API
+ docs.
+
+2004-10-09 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ClassLoader.java
+ (defineClass(String,ByteBuffer,ProtectionDomain)): New method.
+
+2005-09-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Fixed location of tooltip. Sometimes
+ the ToolTip was being cut off.
+
+2005-09-21 Mark Wielaard <mark@klomp.org>
+
+ * gnu/classpath/ByteArray.java: Reindent boilerplate.
+
+2005-09-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * gnu/classpath/ByteArray.java,
+ * gnu/javax/crypto/DiffieHellmanImpl.java,
+ * gnu/javax/crypto/GnuDHPrivateKey.java,
+ * gnu/javax/crypto/RSACipherImpl.java:
+ Fixed address within GPL license.
+
+2005-09-21 Mark Wielaard <mark@klomp.org>
+
+ * lib/split-for-gcj.sh: Cut list to 3 package levels deep.
+
+2005-09-21 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/html/HTML.java:
+ (Tag): Changed name of IMPLIED Tag from "implied" to "p-implied" to
+ match the JDK.
+ * javax/swing/text/html/HTMLDocument.java:
+ (AdditionalComments): New field.
+
+2005-09-21 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/html/HTMLDocument.java:
+ (getBase): Implemented.
+ (setBase): Implemented.
+ (getPreservesUnknownTags): Implemented.
+ (setPreservesUnknownTags): Implemented.
+ (BlockElement): New class partially implemented.
+
+2005-09-21 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/BorderLayout.java: Reverted field reordering.
+
+2005-09-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTable.java
+ (distributeSpill): Fixed a NPE.
+ * javax/swing/ToolTipManager.java
+ (mouseExited): No need to do this stuff, removed code.
+ (showTip): Revalidating and repainting too much, removed.
+ (hideTip): Likewise.
+
+2005-09-21 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/BorderLayout.java (invalidateLayout): Updated comment.
+ (setBounds): Likewise.
+ (MIN, MAX, PREF): Moved nearer top of file.
+ (getLayoutComponent): New methods.
+ (getConstraints): New method.
+ (vgap, hgap, north, south, east, west): Reordered fields to conform
+ to serialization spec.
+
+2005-09-21 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/html/HTMLDocument.java:
+ (LeafIterator): New class.
+ (getIterator): Implemented.
+ (Iterator): New abstract class.
+
+2005-09-21 Tom Tromey <tromey@redhat.com>
+
+ * java/math/BigDecimal.java (ZERO, ONE): Now public. Updated
+ javadoc.
+ (TEN): New constant.
+ * java/math/BigInteger.java (ZERO): Updated javadoc.
+ (ONE): Likewise.
+ (TEN): New constant.
+
+2005-09-21 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23937
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ (propertyChange): When WANTS_INPUT_PROPERTY is changed,
+ the buttons should be updated.
+ (getButtons): Applied patch in bug report. Sets default
+ buttons.
+
+2005-09-21 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (showTip): Added code to move currentPoint to a new place.
+ (getGoodPoint): Removed, not needed.
+
+2005-09-21 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalFileChooserUI.java: new file (partial
+ implementation).
+
+2005-09-20 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JPopupMenu.java
+ (setVisible): If HeavyWeightPopup, setLightWeightPopupEnabled
+ is false.
+ * javax/swing/ToolTipManager.java
+ (showTip): Change so toolTips on lightWeightPopups are
+ added different than those on heavyWeightPopups.
+ (canToolTipFit): Removed. This is not needed/used.
+
+2005-09-20 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java
+ (mouseMoved): Removed unneeded code. If the mouse
+ moves into another component, then mouseEntered would
+ do the same thing. Otherwise, it is not needed.
+ (showTip): Fixed so that the containerPanel is an
+ instance of Panel. Made code more efficent.
+ Tooltips were causing weird problems with the
+ JMenus.
+ (getGoodPoint): Fixed to return a better location.
+ * javax/swing/plaf/basic/BasicMenuBarUI.java
+ (mouseClicked): Fixed to prevent a NPE.
+
+2005-09-20 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/22906:
+ * gnu/java/net/protocol/jar/Connection.java (get): Added useCaches
+ argument.
+ (connect): Updated.
+
+2005-09-20 Tom Tromey <tromey@redhat.com>
+
+ * javax/print/DocFlavor.java (serialVersionUID): Fixed typo.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/DefaultEditorKit.java:
+ (write): Partially Implemented and made slight correction to API docs.
+ * javax/swing/text/html/HTMLEditorKit.java:
+ (createDefaultDocument): Override parent method because we need to
+ return an HTMLDocument not a DefaultStyledDocument.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ Fixes PR #23900.
+ * javax/swing/JLayeredPane.java
+ (remove(int)): Removed repaint() call. This is unnecessary because
+ already triggered by Container.remove().
+ (remove(Component)): Removed this superfluous method. It's not
+ in the specs and the functionality is already in Container.
+ (paint): New method. Overridden in order to provide reasonable
+ painting for JLayeredPanes.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (UpdateHandler): Renamed to PropertyChangeHandler. This name is
+ closer to the purpose of this class.
+ (PropertyChangeHandler.propertyChange): Delegate property change
+ to propertyChange hook method in the enclosing BasicTextUI.
+ (propertyChange): New protected method. This serves as a hook
+ for subclasses to handle property changes in the text component.
+ * javax/swing/plaf/basic/BasicTextFieldUI.java
+ (properyChange): Handle editable property here and adjust background
+ accordingly.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (getParagraphElement): If the position argument is out of the
+ document's bounds, then the closest paragraph element must be
+ returned. This is fixed.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (resizeAndRepaint): New protected method.
+
+2005-09-20 Tom Tromey <tromey@redhat.com>
+
+ * javax/xml/namespace/QName.java: Now Serializable.
+ (serialVersionUID): New field.
+ (qName, hashCode): Now transient.
+ (QName): Don't compute qName here.
+ (equals): Now final.
+ (hashCode): Simplified.
+ (toString): Compute qName here.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (getTextFieldBorder): This method must return an BorderUIResource
+ instance. Fixed.
+
+2005-09-20 Mark Wielaard <mark@klomp.org>
+
+ Reported by Martin Cordova <martin.cordova@gmail.com>
+ * native/jni/java-net/javanet.c (_javanet_accept): Throw
+ SocketTimeoutException on EAGAIN timeout.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): Handle the rollover UIDefaults property.
+ (paintText): Correctly paint disabled button label text.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Fix some text component border defaults.
+ * javax/swing/plaf/basic/BasicTextPaneUI.java
+ (installUI): New method. This sets up some style attributes
+ for the JTextPane.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefault): Added and fixed some UI defaults.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (ButtonBorder.paintBorder): Fetch correct color for disabled
+ button border.
+ (getTextFieldBorder): Correctly initialize text field border. This
+ should be a compound border with a MarginBorder and TextFieldBorder
+ instead of a plain TextFieldBorder.
+ (getTextBorder): New method.
+
+2005-09-20 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (setParagraphAttributes): Implemented this method.
+ (insertUpdate): Fixed attribute comparison to avoid NPE.
+
+2005-09-20 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/23951
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (isRealized): Leave GDK critical region when exiting early.
+
+2005-09-19 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/PopupMenu.java (AccessibleAWTPopupMenu.serialVersionUID):
+ New field.
+ * java/awt/TextField.java (AccessibleAWTTextField.serialVersionUID):
+ New field.
+ * java/awt/TextArea.java (AccessibleAWTTextArea.serialVersionUID):
+ New field.
+ * java/awt/Menu.java (AccessibleAWTMenu.serialVersionUID): New field.
+ * java/awt/CheckboxMenuItem.java (AccessibleAWTCheckboxMenuItem.serialVersionUID):
+ New field.
+ * java/awt/TextComponent.java (AccessibleAWTTextComponent.serialVersionUID):
+ New field.
+ * java/awt/MenuItem.java (AccessibleAWTMenuItem.serialVersionUID):
+ New field.
+ * java/awt/Frame.java (AccessibleAWTFrame.serialVersionUID): New
+ field.
+ * java/awt/Dialog.java (AccessibleAWTDialog.serialVersionUID): New
+ field.
+ * java/awt/Button.java (AccessibleAWTButton.serialVersionUID): New
+ field.
+ * java/awt/Window.java (AccessibleAWTWindow.serialVersionUID): New
+ field.
+ * java/awt/ScrollPane.java (AccessibleAWTScrollPane.serialVersionUID):
+ New field.
+ * java/awt/List.java (AccessibleAWTList.serialVersionUID): New field.
+ (AccessibleAWTListChild.serialVersionUID): Likewise.
+ (AccessibleAWTListChild.parent): Moved earlier.
+ (AccessibleAWTListChild.indexInParent): Renamed.
+
+2005-09-19 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/filechooser/FileView.java:
+ Reformatted and added API doc comments.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JRootPane.java:
+ (createGlassPane): Don't set the layout manager to BorderLayout. Leave
+ it as JPanel's default FlowLayout.
+
+2005-09-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/ToolTipManager.java:
+ Changed tooltip to be JDialog (no entry in taskbar),
+ instead of JWindow.
+ (actionPerformed): No need to start timer here.
+ (mouseEntered): No need to call showTip here, it is called
+ when the timer fires.
+ (showTip): Shouldn't show tip if it is already visible or
+ the current component is not showing.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (getRowForPath): Re-implemented.
+ (mousePressed): Call getRowForPath instead, also
+ added a check in for leaf icons.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JLayeredPane.java:
+ (<init>): Set layout manager to null.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java:
+ (GlassPaneDispatcher.handleEvent): Added check for mouseEventTarget
+ being null to avoid NPE.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JRootPane.java:
+ (RootLayout.layoutContainer): Added comment about how the
+ components should be sized. Fixed size of glassPane which fills the
+ entire viewable region, including overtop the menuBar. Used bounds
+ minus insets for containerSize, as indicated in comment, rather than
+ getSize(). Used setBounds instead of setSize for layeredPane because
+ its relation to the other components' sizes is more obvious that way.
+
+2005-09-19 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java:
+ (GlassPaneDispatcher.handleEvent): Replaced call to SwingUtilities'
+ convertMouseEvent (with identical source and desination) with a simple
+ cast. If acquireComponentForMouseEvent reveals we're going to
+ re-dispatch this event to ourselves (and loop infinitely), return. Also
+ replaced contentPane by glassPane as the source argument to
+ SwingUtilities.convertMouseEvent since the glassPane is the real
+ source.
+
+2005-09-19 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java
+ (paintTriangle): minor correction to highlight on triangle for disabled
+ buttons.
+
+2005-09-19 Tom Tromey <tromey@redhat.com>
+
+ * javax/print/DocFlavor.java (BYTE_ARRAY.serialVersionUID): New field.
+ (INPUT_STREAM.serialVersionUID): Likewise.
+
+2005-09-19 Tom Tromey <tromey@redhat.com>
+
+ * java/text/DateFormat.java (serialVersionUID): New field.
+
+2005-19-19 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (selectPath): Changed so DISCONTIGUOUS_TREE_SELECTION is the
+ default.
+ * javax/swing/JTree.java
+ (AccessibleJTreeNode): Initialized all fields.
+ (addAccessibleSelection): Implemented.
+ (clearAccessibleSelection): Implemented.
+ (doAccessibleAction): Implemented.
+ (getAccessibleAction): Implemented.
+ (getAccessibleActionCount): Implemented.
+ (getAccessibleActionDescription): Implemented.
+ (getAccesssibleChild): Remove mod variable, made global.
+ (getAccessibleComponent): Changed to return this, since this
+ class implements AccessibleComponent.
+ (getAccessibleSelection): Likewise.
+ (getAccessibleSelection): Implemented.
+ (getAccessibleSelectionCount): Implemented.
+ (getAccessibleStateSet): Remove mod variable, made global.
+ (getCursor): Implemented.
+ (isAccessibleChildSelected): Remove mod variable, made global.
+ (removeAccessibleSelection): Implemented.
+ (selectAllAccessibleSelection): Implemented.
+ (setCursor): Implemented.
+ (AccessibleJTree): Nothing to do.
+ (getAccessibleAt): Implemented.
+ (getAccessibleSelection): Implemented.
+ (getAccessibleSelection): Implemented.
+
+2005-09-19 Tom Tromey <tromey@redhat.com>
+
+ * javax/xml/xpath/XPathFunctionException.java (serialVersionUID): New
+ field.
+ * javax/xml/xpath/XPathFactoryConfigurationException.java
+ (serialVersionUID): New field.
+ * javax/xml/xpath/XPathExpressionException.java (serialVersionUID): New
+ field.
+ * javax/xml/xpath/XPathException.java (serialVersionUID): New field.
+ * javax/xml/transform/TransformerConfigurationException.java (locator):
+ Removed.
+ (TransformerConfigurationException): Pass locator to super constructor.
+ (serialVersionUID): New field.
+ * javax/xml/transform/TransformerFactoryConfigurationError.java
+ (serialVersionUID): New field.
+ * javax/xml/transform/TransformerException.java (containedException):
+ Renamed field.
+ (serialVersionUID): New field.
+
+2005-09-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (UpdateHandler.propertyChange): Handle changes of the editable
+ property.
+ (paintBackground): Moved implementation to
+ UpdateHandler.propertyChange. This method itself should not fill
+ the background.
+
+2005-09-19 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/java-net/java_net_VMInetAddress.c
+ (Java_java_net_VMInetAddress_getHostByAddr): Add error string as
+ exception message.
+ * native/jni/java-net/javanet.c (_javanet_accept): Likewise.
+ (_javanet_shutdownInput): Likewise.
+ (_javanet_shutdownOutput): Likewise.
+
+2005-09-19 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/border/TitledBorder.java
+ (paintBorder): Correctly set the Y offset for the border title.
+ (getMeasurements): Determine the correct Y offset for the border
+ title.
+
+2005-09-19 Robert Schuster <robertschuster@fsfe.org>
+
+ * java/awt/Checkbox.java:
+ (Checkbox): Properly set as selected checkbox in corresponding
+ checkbox group.
+ (paramString): Removed checkbox group information.
+ * java/awt/Component.java:
+ (paramString): Removed redundant "=".
+
+2005-09-19 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): call configureArrowButton after creating button,
+ (configureEditor): set the selected item,
+ (configureArrowButton): set a zero margin,
+ (getPreferredSize): delegate to getMinimumSize(),
+ (getMinimumSize): now uses code that was in getPreferredSize(),
+ (getDefaultSize): reduce default height,
+ (ComboBoxLayoutManager.layoutComponent): use comboBox height as button
+ width,
+ (PropertyChangeHandler.propertyChange): set font on arrow button,
+ * javax/swing/plaf/metal/MetalComboBoxUI.java
+ (instances): deleted field,
+ (MetalComboBoxLayoutManager): new class,
+ (MetalPropertyChangeListener): new class,
+ (MetalComboPopup): new class,
+ (createUI): just return new instance,
+ (createEditor): implemented,
+ (createPopup): implemented,
+ (createArrowButton): implemented,
+ (createPropertyChangeListener): implemented,
+ (paint): implemented,
+ (editablePropertyChanged): implemented,
+ (createLayoutManager): implemented,
+ (removeListeners): implemented,
+ (getMinimumSize): implemented.
+
+2005-09-19 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+ (Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose): Fix double
+ unreferencing pfont->font. Unref pfont->layout instead.
+
+2005-09-18 Tom Tromey <tromey@redhat.com>
+
+ * java/util/Timer.java (TaskQueue.purge): New method.
+ (Timer(String)): New constructor.
+ (Timer(String,boolean)): Likewise.
+ (purge): New method.
+
+2005-09-18 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Short.java (valueOf): New method.
+ * java/lang/Double.java (valueOf): New method.
+ * java/lang/Float.java (valueOf): New method.
+
+2005-09-18 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Long.java (reverse): Correctly handle sign extension.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installComponents): remove listBox color settings,
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): corrected ComboBox and ListBox defaults.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxRenderer.java
+ (BasicComboBoxRenderer): set no focus border,
+ (getListCellRendererComponent): set background color if cell has focus,
+ removed border switching code.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (borderInsets): deleted,
+ (arrowButtonWidth): deleted,
+ (configureEditor): set font,
+ (isFocusTraversable): set to true for non-editable combobox,
+ (paint): deleted border painting code,
+ (paintBorder): deleted,
+ (getPreferredSize): returns a value, not null,
+ (getMinimumSize): likewise,
+ (getMaximumSize): likewise,
+ (rectangleForCurrentValue): reimplemented,
+ (paintCurrentValue): no longer adjusts for border insets,
+ (getDisplaySize): update maximum width and height independently,
+ (ComboBoxLayoutManager): removed redundant 'extends Object',
+ (ComboBoxLayoutManager.preferredLayoutSize): call getPreferredSize(),
+ (ComboBoxLayoutManager.minimumLayoutSize): delegate to
+ preferredLayoutSize(),
+ (ComboBoxLayoutManager.layoutContainer): use arrow button preferred
+ size in layout,
+ (PropertyChangeHandler.propertyChange): added 'font' handling.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (installListeners): add listener to arrowButton instead of comboBox,
+ deleted call to configureArrowButton(),
+ (uninstallListeners): remove listener from arrowButton instead of
+ comboBox, and deleted call to unconfigureArrowButton(),
+ (configureArrowButton): set font and enabled state, deleted
+ addMouseListener() call,
+ (unconfigureArrowButton): deleted removeMouseListener() call,
+ (MouseHandler.mousePressed): just toggle display status of popup,
+ (MouseHandler.mouseReleased): deleted.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (largestItemSize): renamed displaySize,
+ (getLargestItemSize): renamed getDisplaySize and changed to protected,
+ (ComboBoxLayoutManager.preferredLayoutSize): updated for renamed field
+ and method,
+ (ListDataHandler.intervalAdded): likewise,
+ (ListDataHandler.intervalRemoved): likewise.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java:
+ Updated API docs all over.
+
+2005-09-18 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/text/RuleBasedCollator.java:
+ Fixed spelling error in comment.
+
+2005-09-17 Tom Tromey <tromey@redhat.com>
+
+ * .settings/org.eclipse.jdt.ui.prefs: Add file template.
+
+2005-09-17 Anthony Green <green@redhat.com>
+
+ * java/security/Security.java (getProviders): Pre-allocate the
+ target array for Collection.toArray call.
+ * gnu/java/security/PolicyFile.java (parse): Ditto.
+ * javax/swing/filechooser/FileSystemView.java: Ditto.
+ * javax/swing/JFileChooser.java (getChoosableFileFilters): Ditto.
+
+2005-09-17 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/22963:
+ * java/nio/charset/Charset.java (forName): Javadoc fix.
+ (providers2): Use ServiceFactory.
+
+2005-09-17 Mark Wielaard <mark@klomp.org>
+
+ * org/ietf/jgss/GSSException.java (BAD_BINDINGS, BAD_MECH,
+ BAD_NAME, BAD_NAMETYPE, CONTEXT_EXPIRED, CREDENTIALS_EXPIRED,
+ DEFECTIVE_CREDENTIAL, DEFECTIVE_TOKEN, DUPLICATE_TOKEN, FAILURE,
+ NO_CONTEXT, NO_CRED, OLD_TOKEN): Document official RFC values.
+
+2005-09-17 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Short.java (SIZE): New constant.
+ (MIN_CACHE, MAX_CACHE): Likewise.
+ (shortCache): New field.
+ (reverseBytes): New method.
+ * java/lang/Long.java (SIZE): New constant.
+ (valueOf): New method.
+ (bitCount): New method.
+ (rotateLeft): New method.
+ (rotateRight): New method.
+ (highestOneBit): New method.
+ (numberOfLeadingZeros): New method.
+ (lowestOneBit): New method.
+ (numberOfTrailingZeros): New method.
+ (signum): New method.
+ (reverseBytes): New method.
+ (reverse): New method.
+ * java/lang/Float.java (SIZE): New constant.
+ * java/lang/Double.java (SIZE): New constant.
+ * java/lang/Character.java (SIZE): New constant.
+ (MAX_CACHE): Likewise.
+ (charCache): New field.
+ (valueOf): New method.
+ (reverseBytes): Likewise.
+ * java/lang/Byte.java (SIZE): New constant.
+ (byteCache): New field.
+ (valueOf): New method.
+ * java/lang/Boolean.java (parseBoolean): New method.
+
+2005-09-17 Mark Wielaard <mark@klomp.org>
+
+ Reported by David Lichteblau <david@lichteblau.com>
+ * native/jni/classpath/jcl.c (JCL_NewRawDataObject): Create
+ NewGlobalRef before calling DeleteLocalRef.
+
+2005-09-17 Paul Jenner <psj@harker.dyndns.org>
+
+ * configure.ac: Clarify that Werror configure option is
+ disabled by default.
+
+2005-09-17 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java: Reindent boilerplate.
+
+2005-09-17 Tom Tromey <tromey@redhat.com>
+
+ * java/util/prefs/Preferences.java (systemNodeForPackage):
+ Javadoc fix.
+ (userNodeForPackage): Likewise.
+ * java/util/logging/LoggingPermission.java (serialVersionUID):
+ New field.
+ * java/io/ObjectInputStream.java (parseContent): Javadoc fix.
+
+2005-09-17 Mark Wielaard <mark@klomp.org>
+
+ * doc/www.gnu.org/home.wml: Update mauve link.
+
+2005-09-16 Anthony Green <green@redhat.com>
+
+ PR libgcj/20198
+ * java/net/URLClassLoader.java (FileURLLoader.getResource): File
+ resources should all have canonicalized names.
+
+2005-09-16 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (AccessibleJTreeNode): Fixed documentation.
+ (addAccessibleSelection): Likewise, still needs to
+ be implemented.
+ (addFocusListener): Implemented.
+ (addPropertyChangeListener): Implemented.
+ (clearAccessibleSelection): Implemented.
+ (contains): Implemented.
+ (doAccessibleAction): Fixed documentation, still
+ needs to be implemented.
+ (getAccessibleAction): Likewise.
+ (getAccessibleActionCount): Likewise.
+ (getAccessibleActionDescription): Implemented.
+ (getAccessibleAt): Implemented.
+ (getAccessibleChild): Implemented.
+ (getAccessibleChildrenCount): Implemented.
+ (getAccessibleComponent): Fixed documentation.
+ (getAccessibleContext): Implemented.
+ (getAccessibleDescription): Implemented.
+ (getAccessibleIndexInParent): Implemented.
+ (getAccessibleName): Implemented.
+ (getAccessibleParent): Fixed documentation.
+ (getAccessibleRole): Likewise.
+ (getAccessibleSelection): Likewise, still needs to
+ be implemented.
+ (getAccessibleSelection): Likewise.
+ (getAccessibleSelectionCount): Implemented.
+ (getAccessibleStateSet): Implemented.
+ (getAccessibleText): Fixed documentation.
+ (getAccessibleValue): Likewise.
+ (getBackground): Implemented.
+ (getBounds): Implemented.
+ (getCursor): Fixed documentation, still needs to be
+ implemented.
+ (getFont): Implemented.
+ (getFontMetrics): Implemented.
+ (getForeground): Implemented.
+ (getLocale): Implemented.
+ (getLocation): Implemented.
+ (getLocationInJTree): Implemented.
+ (getLocationOnScreen): Implemented.
+ (getSize): Implemented.
+ (isAccessibleChildSelected): Implemented.
+ (isEnabled): Implemented.
+ (isFocusTraversable): Implemented.
+ (isShowing): Implemented.
+ (isVisible): Implemented.
+ (removeAccessibleSelection): Fixed documentation, need to
+ fix current implementation.
+ (removeFocusListener): Implemented.
+ (removePropertyChangeListener): Implemented.
+ (requestFocus): Implemented.
+ (selectAllAccessibleSelection): Need to implement. Added FIXME.
+ (setAccessibleDescription): Implemented.
+ (setAccessibleName): Implemented.
+ (setBackground): Implemented.
+ (setBounds): Implemented.
+ (setCursor): Fixed documentation, still need to implement.
+ (setEnabled): Implemented.
+ (setFont): Implemented.
+ (setForeground): Implemented.
+ (setLocation): Implemented.
+ (setSize): Implemented.
+ (setVisible): Implemented.
+ (AccessibleJTree): Fixed documentation, still need
+ to implement.
+ (addAccessibleSelection): Implemented.
+ (clearAccessibleSelection): Implemented.
+ (fireVisibleDataPropertyChange): Implemented.
+ (getAccessibleAt): Fixed documentation, need to implement.
+ (getAccessibleChild): Implemented.
+ (getAccessibleChildrenCount): Implemented.
+ (getAccessibleIndexInParent): Fixed documentation.
+ (getAccessibleRole): Likewise.
+ (getAccessibleSelection): Likewise, still need to implement.
+ (getAccessibleSelection): Likewise.
+ (getAccessibleSelectionCount): Implemented.
+ (isAccessibleChildSelected): Implemented.
+ (removeAccessibleSelection): Implemented.
+ (selectAllAccessibleSelection): Implemented.
+ (treeCollapsed): Implemented.
+ (treeExpanded): Implemented.
+ (treeNodesChanged): Implemented.
+ (treeNodesInserted): Implemented.
+ (treeNodesRemoved): Implemented.
+ (treeStructureChanged): Implemented.
+ (valueChanged): Implemented.
+ (TreeModelListener): Fixed documentation.
+
+2005-09-16 Tom Tromey <tromey@redhat.com>
+
+ * java/io/PrintWriter.java (PrintWriter): New constructors.
+
+2005-09-16 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/22689:
+ * java/io/PrintWriter.java (closed): New field.
+ (checkError): Only flush if stream not closed.
+ (close): Set 'closed'.
+
+2005-09-16 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Character.java (MIN_SURROGATE, MAX_SURROGATE): New
+ constants.
+ (isHighSurrogate): New method.
+ (isLowSurrogate): Likewise.
+ (isSurrogatePair): Likewise.
+ (toCodePoint): Likewise.
+ (codePointAt): Likewise.
+ (codePointBefore): Likewise.
+ * java/lang/StringBuffer.java (codePointCount): Check bounds.
+ (codePointAt): Rewrote.
+ (codePointBefore): Likewise.
+ * java/lang/String.java (codePointAt): New method.
+ (codePointBefore): Likewise.
+ (codePointCount): Likewise.
+ (contentEquals): New overload.
+
+2005-09-16 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/ProgressMonitor: Implemented the former stubbed
+ class and added documentation.
+ (close): Implemented and added documentation.
+ (setProgress): Dito.
+ (isCanceled): Dito.
+ (setMinimum): Added documentation.
+ (getMinimum): Dito.
+ (setMaximum): Dito.
+ (getMaximum): Dito.
+ (setNote): Dito.
+ (getMillisToDecideToPopup): Dito.
+ (setMillisToDecideToPopup): Dito.
+ (getMillisToPopup): Dito.
+ (setMillisToPopup): Dito.
+ (getNote): Dito.
+ * javax/swing/ProgressMonitorInputStream: Implemented stub
+ methods.
+ (close): Implemented.
+ (read): Dito.
+ (reset): Dito.
+ (skip): Dito.
+ (getProgressMonitor): Dito.
+
+2005-09-16 Tom Tromey <tromey@redhat.com>
+
+ PR classpath/23882:
+ * java/text/StringCharacterIterator.java (StringCharacterIterator):
+ Javadoc fix.
+ (hashCode): New method.
+ * java/text/ParsePosition.java (hashCode): New method
+
+2005-09-16 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * javax/swing/Timer.java (Waker.run): Do not enter loop on
+ repeats = false (fixes #23918).
+
+2005-09-16 Andrew Haley <aph@redhat.com>
+
+ * java/io/ObjectStreamClass.java (findAccessibleMethod): Allow
+ protected readResolve(). Rewrite accessibility check.
+
+2005-09-16 Andrew Haley <aph@redhat.com>
+
+ * scripts/loc: New file.
+
+2005-09-16 Anthony Green <green@redhat.com>
+
+ * java/lang/String.java (getBytes): Throw an InternalError instead
+ of silently returning null.
+
+2005-09-16 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #22610
+ * java/awt/Container.java
+ (remove): Removed component listeners from the component
+ being removed. This was a problem if that same component
+ that was removed was added to a new component.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java
+ (MetalComboBoxEditorBorder.paintBorder): modified border appearance.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxRenderer.java: updated API docs
+ and minor reformatting.
+
+2005-09-16 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JList.java
+ (AccessibleJList): New inner class.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/ButtonDemo.java: new file.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (RadioButtonIcon.paintIcon): change color of selection indicator
+ according to component state.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalCheckBoxIcon.java
+ (drawCheck): change color according to component state.
+
+2005-09-16 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (ButtonBorder.paintBorder): draw a different border for a disabled
+ button.
+
+2005-09-15 Anthony Green <green@redhat.com>
+
+ * java/awt/Color.java (RGBtoHSB): Don't use integer division when
+ calculating saturation.
+ * java/awt/Rectangle.java (equals): Explain why hashCode() isn't
+ required.
+ * java/awt/Point.java (equals): Ditto.
+
+ * java/util/zip/ZipFile.java (checkZipFile): Make sure we read the
+ 4 byte magic number.
+
+2005-09-15 Tom Tromey <tromey@redhat.com>
+
+ * javax/swing/text/html/parser/DTD.java (FILE_VERSION): Now
+ final.
+
+2005-09-15 Tom Tromey <tromey@redhat.com>
+
+ * javax/naming/Name.java: Extends Comparable.
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Component.java:
+ (isDisplayable): Don't check the parent's displayability, only return
+ true if peer is non-null and false if peer is null.
+
+2005-09-15 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/SwingUtilities.java
+ (layoutCompoundLabel): check for empty text string,
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (paint): check isBorderPainted() when calculating view rect,
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (CloseAction): new constructor,
+ (IconifyAction): new constructor,
+ (MaximizeAction): new constructor,
+ (MoveAction): new constructor,
+ (RestoreAction): new constructor,
+ (SizeAction): new constructor,
+ (TitlePaneLayout.layoutContainer): calculate button widths from icon
+ widths,
+ (installDefaults): initialise icon fields,
+ (uninstallDefaults): clear icon fields,
+ (createButtons): set button text to null,
+ (setButtonIcons): use icon fields.
+
+2005-09-15 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxRenderer.java
+ (getListCellRendererComponent): Added code in to check if string
+ is larger than comboBox. If it is, the string is truncated and
+ '...' is drawn at the end of it.
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (getDefaultSize): Initially too small, still not fully implemented.
+ (getLargestItemSize): Made private, not in API.
+ (minimumLayoutSize): Implemented properly.
+ (intervalAdded): ComboBox should not be resized with every new
+ component. This is fixed.
+
+2005-09-15 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/EnumConstantNotPresentException.java: New file.
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/plaf/basic/BasicInternalFrameUI.java:
+ Reformatted file.
+
+2005-09-15 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23678
+ * javax/swing/plaf/basic/BasicFileChooserUI.java
+ (CBLabelRenderer): Removed. Not in API, and it is really
+ redundant to have.
+ (installComponents): Changed the renderer set for the combo box.
+ Also, added the buttonPanel to the parentsPanel, so they are
+ always painted correctly. Set the FlowLayout to LEFT
+ instead of default being CENTER.
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JRootPane.java:
+ (setContentPane): Remove the old content pane first. Throw
+ IllegalComponentStateException if the parameter is null. Added docs.
+
+2005-09-15 Tom Tromey <tromey@redhat.com>
+
+ Workaround for PR classpath/23863:
+ * native/fdlibm/mprec.h (MAX_BIGNUM_WDS): Define as 128 on
+ non-Pack_32 platforms.
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Component.java:
+ (isDisplayable): Return true if peer != null.
+ * java/awt/Window.java:
+ (isDisplayable): Removed this method. Now inherits from Component.
+
+2005-09-15 Anthony Green <green@redhat.com>
+
+ * java/io/PushbackInputStream.java (available, read, skip): Handle
+ closed stream operations gracefully.
+
+2005-09-15 Anthony Green <green@redhat.com>
+
+ * java/nio/charset/Charset.java: close() each stream we open.
+ * java/net/URLStreamHandler.java: Remove redundant null pointer
+ check.
+ * java/security/Identity.java (equals, identityEquals): Don't use
+ `==' to compare uninterned Strings. Use String.equals().
+ * java/lang/Class.java (pd): Mark this field as transient for
+ FindBugs won't complain (although not strictly necessary).
+
+2005-09-15 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTextArea.java:
+ (append): Changed invalidate call to revalidate call.
+ (setRows): Likewise.
+ (setColumns): Likewise.
+
+2005-09-15 Lillian Angel <langel@redhat.com>
+
+ Fixes #23873
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java
+ (createMessageArea): Changed orientation of message from EAST to
+ CENTER. Also, fixed empty border values to make message more centered.
+ * javax/swing/JOptionPane.java
+ (showConfirmDialog): Added check for pane.getValue, since clicking on
+ 'x' of window does not have an initialized value. Was causing a
+ ClassCastException.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+ (showConfirmDialog): Likewise.
+
+2005-09-15 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (installDefaults): set font,
+ (uninstallDefaults): clear font,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): update ToggleButton defaults,
+ * javax/swing/plaf/metal/MetalToggleButtonUI.java
+ (instance): removed field,
+ (createUI): just return new instance every time,
+ (MetalToggleButtonUI): look up defaults directly,
+ (getFocusColor): return value from field initialised in constructor,
+ (getSelectColor): likewise,
+ (getDisabledTextColor): likewise,
+ (installDefaults): override to make public,
+ (paintButtonPressed): implemented,
+ (paintText): implemented,
+ (paintFocus): implemented.
+
+2005-09-15 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (toggleButtonBorder): new private field,
+ (ToggleButtonBorder): new class,
+ (getToggleButtonBorder): new method.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (insertUpdate): Tweaked attribute comparison to avoid NPE.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (insertUpdate): Tweaked attribute comparison to avoid NPE.
+ * javax/swing/text/GlyphView.java
+ (DefaultGlyphPainter.getBoundedPosition): Implemented.
+ (DefaultGlyphPainter.viewToModel): Implemented.
+ (getTabExpander): Don't be specific to ParagraphView here. All
+ parents that implement TabExpander can be accepted.
+ (getBeginIndex): Removed. This method is not documented in the
+ specs.
+ (getBreakWeight): Implemented.
+ (changedUpdate): Implemented.
+ (insertUpdate): Implemented.
+ (removeUpdate): Implemented.
+ (createFragment): Implemented.
+ (breakView): Use createFragment.
+ * javax/swing/text/Utilities.java
+ (getTabbedTextOffset): Implemented both variants of this method.
+
+2005-09-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * gnu/CORBA/Connected_objects.java (equals),
+ * gnu/CORBA/Poa/activeObjectMap.java (equals): Removed, fixes
+ #23879.
+ * gnu/CORBA/Version.java (hashCode),
+ * gnu/CORBA/gnuAny.java (hashCode): New method, fixes #23879.
+
+2005-09-14 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JProgressBar.java
+ (JProgressBar): Fixed to use setOrientation function.
+ * javax/swing/plaf/metal/MetalProgressBarUI.java
+ (createUI): Was using the same instance of the UI for
+ each new JProgressBar. Fixed this.
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installUI): Added call to prepareForUIInstall.
+ (uninstallUI): Added call to prepareForUIUninstall.
+
+2005-09-14 Anthony Balkisoon <abalkiss@redhat.com>
+
+ * javax/swing/text/ComponentView.java:
+ (createComponent): Implemented.
+
+2005-09-14 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * org/omg/CosNaming/NameComponent (hashCode): New method,
+ fixes #23883).
+
+2005-09-14 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #23795
+ * javax/swing/plaf/basic/BasicTreeUI.java:
+ Made private fields package private.
+ (setCellRenderer): Took out code that updateRenderer takes
+ care of.
+ (getPathBounds): Fixed to use treeModel field.
+ (getPathForRow): Likewise.
+ (getRowCount): Likewise.
+ (installComponents): Implemented.
+ (createNodeDimensions): Implemented.
+ (uninstallComponents): Implemented.
+ (getVerticalLegBuffer): Implemented.
+ (getHorizontalLegBuffer): Implemented.
+ (updateLayoutCacheExpandedNodes): Implemented.
+ (updateExpandedDescendants): Implemented.
+ (updateDepthOffset): Implemented.
+ (updateRenderer): Implemented.
+ (updateSize): Implemented.
+ (installDefaults): Added some more defaults.
+ (installUI): Moved code to installComponents.
+ (paint): Fixed to use treeModel field.
+ (ensureRowsAreVisible): Implemented.
+ (getMinimumSize): Implemented.
+ (getMaximumSize): Implemented.
+ (checkForClickInExpandControl): Implemented.
+ (isLocationInExpandControl): Implemented.
+ (handleExpandControlClick): Implemented.
+ (toggleExpandState): Implemented.
+ (isToggleSelectionEvent): Implemented.
+ (isMultiSelectEvent): Implemented.
+ (isToggleEvent): Implemented.
+ (selectPathForEvent): Implemented.
+ (actionPerformed): Changed to use toggleExpandState.
+ (mousePressed): Fixed code to use helper methods. Made
+ more efficent.
+ (TreeCancelEditingAction): Fixed Constructor signature.
+ (actionPerformed): Fixed to use treeModel field.
+ (paintRecursive): Fixed to use line drawing helper methods.
+ (paintControlIcons): Fixed to use control icons helper methods.
+ (getCurrentControlIcon): New method.
+ (findNode): Changed to use treeModel field.
+ (getNextNode): Likewise.
+ (getPreviousNode): Likewise.
+ (getNextSibling): Likewise.
+ (getPreviousSibling): Likewise.
+ (getPathToRoot): Likewise.
+ (drawDashedHorizontalLine): Implemented.
+ (drawDashedVerticalLine): Implemented.
+ (paintExpandControl): Implemented.
+ (paintHorizontalPartOfLeg): New method.
+ (paintVerticalPartOfLeg): New method.
+ (paintRow): New method.
+ (shouldPaintExpandControl): New Method.
+ * javax/swing/plaf/metal/MetalTreeUI.java:
+ Added private fields for listeners.
+ (getHorizontalLegBuffer): Implemented.
+ (installUI): Implemented.
+ (uninstallUI): Implemented.
+ (decodeLineStyle): New method.
+ (isLocationInExpandControl): Implemented.
+ (paint): Implemented.
+ (paintHorizontalSeparators): New method.
+ (paintVerticalPartOfLeg): Implemented.
+ (paintHorizontalPartOfLeg): Implemented.
+
+2005-09-14 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JTextArea.java:
+ (append): After non-empty append, invalidate.
+ (setRows): If number of rows changes, invalidate.
+ (setColumns): If number of columns changes, invalidate.
+
+2005-09-14 Anthony Green <green@redhat.com>
+
+ * java/net/InetSocketAddress.java (toString): Adjust to match Sun
+ JRE output, which is [HOSTNAME]/[IPADDRESS]:[PORT].
+ * gnu/java/security/der/DERReader.java: Remove stray semicolon.
+ * gnu/xml/pipeline/ValidationConsumer.java: Fix flags test (was
+ constant expression).
+ * javax/swing/plaf/basic/BasicFileChooserUI.java,
+ * javax/swing/filechooser/FileSystemView.java,
+ * java/util/logging/LogManager.java,
+ * gnu/xml/libxmlj/dom/GnomeDocument.java,
+ * gnu/xml/aelfred2/JAXPFactory.java,
+ * gnu/java/security/x509/ext/Extension.java,
+ * gnu/java/security/x509/ext/BasicConstraints.java,
+ * gnu/java/rmi/server/RMIObjectInputStream.java,
+ * gnu/java/rmi/dgc/DGCImpl_Stub.java,
+ * gnu/java/beans/decoder/BooleanHandler.java: Use
+ Boolean.valueOf() instead of new Boolean.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/StringBuffer.java (StringBuffer): New constructor.
+ (trimToSize): New method.
+ (codePointAt): Likewise.
+ (codePointBefore): Likewise.
+ (codePointCount): Likewise.
+ (appendCodePoint): Likewise.
+ (append): New overloads.
+ (insert): Likewise.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Character.java: Typo fixes in javadoc.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java
+ (calculateTabWidth): Don't use the calcRect here. This lead to an
+ inconsistent state when this method is called from another method
+ that also uses calcRect.
+ (calculateTabHeight): Don't use the calcRect here. This lead to an
+ inconsistent state when this method is called from another method
+ that also uses calcRect.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java:
+ Reformatted file.
+
+2005-09-14 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/io/ObjectInputStream.java:
+ (readObject()): Moved marker parsing to its own method.
+ (parseContent(byte)): Fixed TC_OBJECT handling to loop on
+ blockdata written manually by the class.
+
+2005-09-14 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * native/jni/classpath/jcl.c: Replaced undefined
+ POINTERS_ARE_64BIT with SIZEOF_VOID_P == 8.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (PaletteCloseIcon): now implements UIResource.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/ButtonModel.java: Added API docs all over.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTabbedPane.java: Added API comments to make clear
+ that null values for tab titles are allowed.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ Fixes Bug#23859.
+ * javax/swing/JTabbedPane.java
+ (insertTab): Check if title == null and if so, then set it
+ to "". Otherwise the null string would cause a segfault or
+ an assertion failure in font metrics calculation as reported
+ in bug#23859.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * gnu/CORBA/ExceptionCreator.java: minor API doc fixes,
+ * gnu/CORBA/Version.java: likewise.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicFormattedTextFieldUI.java:
+ (getPropertyPrefix): added API docs,
+ * javax/swing/plaf/basic/BasicPasswordFieldUI.java:
+ (getPropertyPrefix): added API docs,
+ * javax/swing/plaf/basic/BasicTextAreaUI.java:
+ (getPropertyPrefix): added API docs,
+ * javax/swing/plaf/basic/BasicTextFieldUI.java:
+ (getPropertyPrefix): added API docs,
+ * javax/swing/plaf/basic/BasicTextPaneUI.java:
+ (getPropertyPrefix): added API docs.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * org/omg/CORBA/ORB.java: minor API doc fixes,
+ * org/omg/CORBA/PERSIST_STORE.java: likewise,
+ * org/omg/CORBA/PolicyError.java: likewise,
+ * org/omg/CORBA/ValueBaseHolder.java: likewise,
+ * org/omg/CORBA/VisibilityHelper.java: likewise.
+
+2005-09-14 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxIcon.java: fixed header,
+ (paintIcon): change color to reflect component state.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * .settings/org.eclipse.jdt.core.prefs: Ignore javadoc warnings
+ for hidden or deprecated members.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/AbstractDocument.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ (getContent): Made method final.
+ (AbstractElement.dumpElement): Removed superfluous private method.
+ (AbstractElement.dump): Made diagnostic output more speaking.
+ * javax/swing/text/BoxView.java
+ (paintChild): Don't allocate the child region here.
+ (paint): Allocate the child region here instead.
+ * javax/swing/text/ComponentView.java:
+ Added API doc comments.
+ * javax/swing/text/CompositeView.java
+ (getNextVisualPositionFrom): Declared to throw BadLocationException.
+ (getNextNorthSouthVisualPositionFrom): Likewise.
+ (getNextEastWestVisualPositionFrom): Likewise.
+ * javax/swing/text/DefaultCaret.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/DefaultEditorKit.java
+ Slight reformatting.
+ * javax/swing/text/DefaultFormatter.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/DefaultStyledEditorKit.java
+ (ElementBuffer.insertUpdate): Removed unneeded statement.
+ (ElementBuffer.insertStartTag): Attach a resolve parent to new
+ paragraph elements.
+ (createDefaultRoot): Attach a resolve parent to new paragraph
+ elements.
+ * javax/swing/text/InternationalFormatter.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/JTextComponent.java
+ Slight reformatting.
+ (paramString): Added TODO comment.
+ * javax/swing/text/SimpleAttributeSet.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ (equals): Don't require object to be SimpleAttributeSet. Allows
+ comparing to all kinds of AttributeSets.
+ (isEqual): Likewise.
+ * javax/swing/text/StringContent.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/StyleConstants.java
+ (getBackground): Return white as default background instead of black.
+ * javax/swing/text/StyleConstext.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ (SmallAttributeSet.equals): Don't require object to be
+ SmallAttributeSet. Allows comparing to all kinds of AttributeSets.
+ * javax/swing/text/StyledEditorKit.java
+ Fixed some comments.
+ * javax/swing/text/TabSet.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/TabStop.java
+ Bumped up serialVersionUIDs to JDK 1.5 compatibility.
+ * javax/swing/text/View.java
+ Removed unneeded import.
+
+2005-09-14 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/JOptionPane.java:
+ (showConfirmDialog): Changed QUESTION_MESSAGE like the JDK
+ does.
+ * javax/swing/plaf/basic/BasicOptionPaneUI.java:
+ (getButtons): Treat DEFAULT_OPTION like
+ YES_NO_CANCEL_OPTION like the JDK.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/GapContent.java
+ (GapContentPosition.getOffset): Made assertion more speaking.
+ (GapContent): Modified initialization for compatibility with JDK.
+ (shiftEnd): Update marks prior to modification of the content.
+ Use new getPositionsInRange method.
+ (shiftGap): Use new getPositionsInRange method. Tweaked to corectly
+ update the marks.
+ (shiftGapStartDown): New method.
+ (shiftGapEndUp): New method.
+ (replace): Use shiftGapEndUp. Modified resizing offset.
+ (getGapStart): New method.
+ (getGapEnd): New method.
+ (getPositionsInRange): New method.
+
+2005-09-14 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/GlyphView.java
+ (AbstractGlyphPainter.getAscent): New abstract method.
+ (AbstractGlyphPainter.getDescent): New abstract method.
+ (AbstractGlyphPainter.getBoundedPosition): New abstract method.
+ (AbstractGlyphPainter.viewToModel): New abstract method.
+ (AbstractGlyphPainter.getNextVisualPositionFrom): New method.
+ (AbstractGlyphPainter.getPainter): New method.
+ (DefaultGlyphPainter.paint): Add support for more text attributes.
+ (DefaultGlyphPainter.getAscent): New method.
+ (DefaultGlyphPainter.getDescent): New method.
+ (DefaultGlyphPainter.getBoundedPosition): New method.
+ (DefaultGlyphPainter.viewToModel): New method.
+ (GlyphView): Store start and end offset in the GlyphView.
+ (getPreferredSpan): Differentiate the axis parameter.
+ (viewToModel): Implemented this method.
+ (getStartOffset): Return value of private field instead of the
+ element value.
+ (getEndOffset): Return value of private field instead of the
+ element value.
+ (getBackground): New method.
+ (isStrikeThrough): New method.
+ (isSubscript): New method.
+ (isSuperscript): New method.
+ (isUnderline): New method.
+ (clone): New method.
+ (breakView): New method.
+ (getBreakWeight): New method.
+ (changedUpdate): New method.
+ (insertUpdate): New method.
+ (removeUpdate): New method.
+ (createFragment): New method.
+ (getAlignment): New method.
+ (getNextVisualPositionFrom): New method.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * java/util/regex/Matcher.java (matches): Javadoc fix.
+ (start): Likewise.
+ * java/lang/reflect/Proxy.java (equals): Javadoc fix.
+ * java/io/ObjectInputStream.java (inputGetObjectStreamClasses): Javadoc
+ fix.
+ * java/util/zip/ZipFile.java (getEntry): Javadoc fix.
+ * java/util/logging/XMLFormatter.java (getHead): Javadoc fix.
+ * java/util/logging/LogManager.java (getLevelProperty): Javadoc fix.
+ * java/util/logging/Handler.java (getEncoding): Javadoc fix.
+ (setFilter): Likewise.
+ * java/util/logging/FileHandler.java: Organized imports.
+ * java/util/jar/Manifest.java (Manifest): Javadoc fix.
+ * java/util/TreeMap.java (putFromObjStream): Javadoc fix.
+ * java/util/SimpleTimeZone.java (isBefore): Javadoc fix.
+ * java/util/ResourceBundle.java (tryBundle): Javadoc fix.
+ * java/util/Random.java (seed): Javadoc fix.
+ * java/util/Collections.java (SynchronizedSortedSet): Javadoc fix.
+ (SingletonMap): Likewise.
+ (addAll): Javadoc fix.
+ * java/lang/reflect/UndeclaredThrowableException.java: Javadoc fix.
+ * java/lang/reflect/Member.java (DECLARED, PUBLIC): Javadoc fix.
+ * java/lang/ref/WeakReference.java: Javadoc fix.
+ * java/lang/ref/Reference.java: Javadoc fix.
+ (Reference): Likewise.
+ * java/lang/Thread.java (setContextClassLoader): Javadoc fix.
+ (getContextClassLoader): Likewise.
+ (stop): Likewise.
+ * java/lang/System.java (runFinalizersOnExit): Javadoc fix.
+ * java/lang/String.java (upperExpand): Javadoc fix.
+ * java/lang/StrictMath.java: Javadoc fixes.
+ * java/lang/SecurityManager.java: Added imports for javadoc.
+ (currentClassLoader): Javadoc fix.
+ (classLoaderDepth): Likewise.
+ (currentLoadedClass): Likewise.
+ (checkRead): Likewise.
+ (checkWrite): Likewise.
+ (checkAccess): Likewise.
+ * java/lang/RuntimePermission.java: Added import for javadoc.
+ * java/lang/Readable.java (read): Added import for javadoc.
+
+2005-09-13 Casey Marshall <csm@gnu.org>
+
+ * gnu/classpath/ByteArray.java: new file.
+ * gnu/java/security/provider/Gnu.java
+ (<init>): add Diffie Hellman and RSA algorithms.
+ * gnu/javax/crypto/DiffieHellmanImpl.java: new file.
+ * gnu/javax/crypto/GnuDHPrivateKey.java: new file.
+ * gnu/javax/crypto/RSACipherImpl.java: new file.
+
+2005-09-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalComboBoxButton.java: new file,
+ * javax/swing/plaf/metal/MetalComboBoxEditor.java: likewise.
+
+2005-09-13 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/Process.java: Added import for javadoc.
+ * java/lang/Object.java (notify): Javadoc fix.
+ (notifyAll): Likewise.
+ * java/io/PipedInputStream.java (connect): Javadoc fix.
+ * java/io/OutputStreamWriter.java: Organized imports.
+ * java/io/ObjectStreamField.java (setOffset): Javadoc fix.
+ * java/io/ObjectInputStream.java (readFields): Javadoc fix.
+ * java/io/DataOutputStream.java (writeChars): Javadoc fix.
+ (writeFloat): Likewise.
+ (writeDouble): Likewise.
+ * java/util/Locale.java (readObject): Javadoc fix.
+ (writeObject): Likewise.
+ * java/io/LineNumberReader.java (read): Javadoc fix.
+ (setLineNumber): Likewise.
+ (mark): Likewise.
+ * java/io/InputStreamReader.java: Updated imports.
+ * java/lang/Integer.java (parseInt): Javadoc fix.
+ * java/io/FilterReader.java (skip): Javadoc fix.
+ * java/util/HashMap.java (containsValue): Javadoc fix.
+ * java/lang/ClassLoader.java (findLibrary): Javadoc fix.
+ (setPackageAssertionStatus): Likewise.
+ (setClassAssertionStatus): Likewise.
+ * java/lang/Class.java: Added imports for javadoc.
+ (matchMethod): Javadoc fix.
+ * java/util/ArrayList.java (readObject): Javadoc fix.
+ (writeObject): Likewise.
+ * java/lang/String.java (CaseInsensitiveComparator): Javadoc fix.
+ * java/util/zip/PendingBuffer.java (toByteArray): Javadoc fix.
+ * javax/swing/plaf/metal/OceanTheme.java: Mark as 1.5.
+ * java/util/logging/SimpleFormatter.java (format): Javadoc fix.
+ * java/util/zip/ZipFile.java (getEntries): Javadoc fix.
+
+2005-09-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (lightHighlight): removed,
+ (installDefaults): only update component attributes if they are tagged
+ with UIResource, initialise button colors from correct defaults,
+ (uninstallDefaults): only clear attributes that are tagged with
+ UIResource.
+
+2005-09-13 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/JTree.java
+ (AccessibleJTree): Added new Inner class.
+ (AccessibleJTree.addAccessibleSelection): New method.
+ (AccessibleJTree.clearAccessibleSelection): New method.
+ (AccessibleJTree.fireVisibleDataPropertyChange): New method.
+ (AccessibleJTree.getAccessibleAt): New method.
+ (AccessibleJTree.getAccessibleChild): New method.
+ (AccessibleJTree.getAccessibleChildrenCount): New method.
+ (AccessibleJTree.getAccessibleIndexInParent): New method.
+ (AccessibleJTree.getAccessibleRole): New method.
+ (AccessibleJTree.getAccessibleSelection): New method.
+ (AccessibleJTree.getAccessibleSelection): New method.
+ (AccessibleJTree.getAccessibleSelectionCount): New method.
+ (AccessibleJTree.isAccessibleChildSelected): New method.
+ (AccessibleJTree.removeAccessibleSelection): New method.
+ (AccessibleJTree.selectAllAccessibleSelection): New method.
+ (AccessibleJTree.treeCollapsed): New method.
+ (AccessibleJTree.treeExpanded): New method.
+ (AccessibleJTree.treeNodesChanged): New method.
+ (AccessibleJTree.treeNodesInserted): New method.
+ (AccessibleJTree.treeNodesRemoved): New method.
+ (AccessibleJTree.treeStructureChanged): New method.
+ (AccessibleJTree.valueChanged): New method.
+ (AccessibleJTreeNode): Likewise.
+ (AccessibleJTreeNode.addAccessibleSelection): New method.
+ (AccessibleJTreeNode.addFocusListener): New method.
+ (AccessibleJTreeNode.addPropertyChangeListener): New method.
+ (AccessibleJTreeNode.clearAccessibleSelection): New method.
+ (AccessibleJTreeNode.contains): New method.
+ (AccessibleJTreeNode.doAccessibleAction): New method.
+ (AccessibleJTreeNode.getAccessibleAction): New method.
+ (AccessibleJTreeNode.getAccessibleActionCount): New method.
+ (AccessibleJTreeNode.getAccessibleActionDescription): New method.
+ (AccessibleJTreeNode.getAccessibleAt): New method.
+ (AccessibleJTreeNode.getAccessibleChild): New method.
+ (AccessibleJTreeNode.getAccessibleChildrenCount): New method.
+ (AccessibleJTreeNode.getAccessibleComponent): New method.
+ (AccessibleJTreeNode.getAccessibleContext): New method.
+ (AccessibleJTreeNode.getAccessibleDescription): New method.
+ (AccessibleJTreeNode.getAccessibleIndexInParent): New method.
+ (AccessibleJTreeNode.getAccessibleName): New method.
+ (AccessibleJTreeNode.getAccessibleParent): New method.
+ (AccessibleJTreeNode.getAccessibleRole): New method.
+ (AccessibleJTreeNode.getAccessibleSelection): New method.
+ (AccessibleJTreeNode.getAccessibleSelectionCount): New method.
+ (AccessibleJTreeNode.getAccessibleStateSet): New method.
+ (AccessibleJTreeNode.getAccessibleText): New method.
+ (AccessibleJTreeNode.getAccessibleValue): New method.
+ (AccessibleJTreeNode.getBackground): New method.
+ (AccessibleJTreeNode.getBounds): New method.
+ (AccessibleJTreeNode.getCursor): New method.
+ (AccessibleJTreeNode.getFont): New method.
+ (AccessibleJTreeNode.getFontMetrics): New method.
+ (AccessibleJTreeNode.getForeground): New method.
+ (AccessibleJTreeNode.getLocale): New method.
+ (AccessibleJTreeNode.getLocation): New method.
+ (AccessibleJTreeNode.getLocationInJTree): New method.
+ (AccessibleJTreeNode.getLocationOnScreen): New method.
+ (AccessibleJTreeNode.getSize): New method.
+ (AccessibleJTreeNode.isAccessibleChildSelected): New method.
+ (AccessibleJTreeNode.isEnabled): New method.
+ (AccessibleJTreeNode.isVisible): New method.
+ (AccessibleJTreeNode.removeAccessibleSelection): New method.
+ (AccessibleJTreeNode.removeFocusListener): New method.
+ (AccessibleJTreeNode.removePropertyChangeListener): New method.
+ (AccessibleJTreeNode.requestFocus): New method.
+ (AccessibleJTreeNode.selectAllAccessibleSelection): New method.
+ (AccessibleJTreeNode.setAccessibleDescription): New method.
+ (AccessibleJTreeNode.setAccessibleName): New method.
+ (AccessibleJTreeNode.setBackground): New method.
+ (AccessibleJTreeNode.setBounds): New method.
+ (AccessibleJTreeNode.setCursor): New method.
+ (AccessibleJTreeNode.setEnabled): New method.
+ (AccessibleJTreeNode.setFont): New method.
+ (AccessibleJTreeNode.setForeground): New method.
+ (AccessibleJTreeNode.setLocation): New method.
+ (AccessibleJTreeNode.setVisible): New method.
+ (removeDescendantToggledPaths): Implemented.
+ (treeDidChange): Implemented.
+
+2005-09-13 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * native/jawt/jawt.c (_Jv_AWTLock): Do nothing.
+ (_Jv_AWTUnlock): Likewise.
+
+2005-09-13 David Daney <ddaney@avtrex.com>
+
+ * java/io/ByteArrayOutputStream.java: Reformated copyright notice.
+ (toString(int)): Pass correct parameters to String constructor.
+
+2005-09-13 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JComboBox.java
+ (getPrototypeDisplayValue): added API docs,
+ (setPrototypeDisplayValue): fire property change event.
+
+2005-09-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/DefaultStyledDocument.java
+ (ElementSpec): New inner class.
+ (ElementBuffer.change): Also store the DefaultDocumentEvent.
+ (ElementBuffer.split): Also update the document event.
+ (ElementBuffer.insert): New method.
+ (ElementBuffer.insertUpdate): New method.
+ (ElementBuffer.insertStartTag): New method.
+ (ElementBuffer.insertEndTag): New method.
+ (ElementBuffer.insertContentTag): New method.
+ (SectionElement): New inner class.
+ (createDefaultRoot): Return SectionElement instead of BranchElement.
+ (getParagraphElement): Optimized access to paragraph element.
+ (setCharacterAttributes): Fire changedUpdate after modification.
+ (insertUpdate): New method.
+
+2005-09-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/SizeRequirements.java
+ (toString): Implemented this method.
+ (calculateAlignedPositions): Partly implemented this method.
+
+2005-09-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTabbedPane.java: Added API comments all over.
+
+2005-09-13 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTree.java: Reformatted file.
+ * javax/swing/ListCellRenderer.java: Likewise.
+ * javax/swing/ListSelectionModel.java: Likewise.
+ * javax/swing/MenuElement.java: Likewise.
+ * javax/swing/OverlayLayout.java: Likewise.
+ * javax/swing/ProgressMonitor.java: Likewise.
+ * javax/swing/ProgressMonitorInputStream.java: Likewise.
+ * javax/swing/Renderer.java: Likewise.
+ * javax/swing/RepaintManager.java: Likewise.
+ * javax/swing/RootPaneContainer.java: Likewise.
+ * javax/swing/Scrollable.java: Likewise.
+ * javax/swing/SingleSelectionModel.java: Likewise.
+ * javax/swing/SizeSequence.java: Likewise.
+ * javax/swing/SpinnerListModel.java: Likewise.
+ * javax/swing/UnsupportedLookAndFeelException.java: Likewise.
+ * javax/swing/ViewportLayout.java: Likewise.
+ * javax/swing/WindowConstants.java: Likewise.
+
+2005-09-12 Tom Tromey <tromey@redhat.com>
+
+ * .settings/org.eclipse.jdt.core.prefs: Enable javadoc warnings.
+
+2005-09-12 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ThreadLocal.java: Organized imports.
+ * java/lang/Double.java: Organized imports.
+
+2005-09-12 Casey Marshall <csm@gnu.org>
+
+ PR 23819
+ * javax/security/auth/Subject.java (SecureSet.<init>): rename
+ input paremeter to 'inElements.'
+ (SecureSet.contains): return 'elements.contains,' not
+ 'elements.remove.'
+
+ PR 23822
+ * javax/security/auth/SubjectDomainCombiner.java
+ (combine): don't access 'subject' if null.
+
+2005-09-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * examples/gnu/classpath/examples/swing/Demo.java
+ (mkDesktopWorld): add palette style frame,
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (closeIcon): new field,
+ (installListeners): call createPropertyChangeListener() to create the
+ new listener to allow for overriding,
+ (installDefaults): set the font in the title, read closeIcon from
+ defaults,
+ (uninstallDefaults): clear closeIcon,
+ (setButtonIcons): set icon for closeButton,
+ (paintComponent): set font for title,
+ * javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+ (MetalInternalFrameTitlePanePropertyChangeHandler): new support class,
+ (MetalTitlePaneLayout): likewise,
+ (paletteTitleHeight): initialise from defaults elsewhere,
+ (title): new private field,
+ (installDefaults): initialise various defaults,
+ (uninstallDefaults): clear defaults,
+ (addSubComponents): add sub-components used in this look and feel,
+ (createLayout): return new instance of MetalTitlePaneLayout,
+ (paintPalette): renders the title pane using the palette style,
+ (paintComponent): call paintPalette() if the internal frame uses the
+ palette style, otherwise handle painting without calling superclass
+ anymore,
+ (setPalette): update the icon visibility,
+ (createPropertyChangeListener): return a new change handler,
+ * javax/swing/plaf/metal/MetalInternalFrameUI.java
+ (IS_PALETTE): new static field,
+ (installUI): check IS_PALETTE property,
+ (createNorthPane): removed empty border,
+ (setPalette): update border as appropriate,
+ (paletteListener): new private field,
+ (installListeners): install a listener to handle changes in the
+ IS_PALETTE property,
+ (uninstallListeners): clear the listener from installListeners(),
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added defaults for 'DesktopIcon.border',
+ 'InternalFrame.paletteBorder', 'InternalFrame.paletteCloseIcon', and
+ 'InternalFrame.paletteTitleHeight'.
+
+2005-09-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/JComponent.java
+ (putClientProperty): fire property change event.
+
+2005-09-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/JScrollPane.java:
+ (addNonNull): Changed from adding to container with no constraints to
+ adding to container with the appropriate ScrollPaneConstant as a
+ constraint. This avoids IllegalArgumentExceptions in ScrollPaneLayout.
+ (setColumnHeader): Added constraint to addNonNull call.
+ (setCorner): Likewise.
+ (setHorizontalScrollBar): Likewise.
+ (setRowHeader): Likewise.
+ (setVerticalScrollBar): Likewise.
+ (setViewport): Likewise.
+ * javax/swing/JViewport.java:
+ (setViewSize): Don't set the size or fireStateChanged unless the new
+ size is different from the old size.
+ (setView): Reset isViewSizeSet to false.
+ * javax/swing/ScrollPaneLayout:
+ (addSingletonComponent): Implemented and documented.
+ (addLayoutComponent): Throw an IllegalArgumentException if key is
+ not one of the appropriate ScrollPaneConstants constants. Added docs.
+ (setVerticalScrollBarPolicy): Likewise.
+ (setHorizontalScrollBarPolicy): Likewise.
+ (getCorner): Added docs.
+
+2005-09-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JCheckBox.java
+ (AccessibleJCheckBox): New inner class.
+ (getAccessibleContext): Implemented this method.
+ * javax/swing/JLayeredPane.java
+ (AccessibleJLayeredPane): New inner class.
+ (getAccessibleContext): Implemented this method.
+
+2005-09-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (getCellRect): Don't include cell gap in cell rectangle
+ calculation. It's already included in TableColumnModel.getWidth().
+ (createDefaultColumnsFromModel): Initialize table header values.
+ * javax/swing/plaf/basic/BasicTableUI.java
+ (paint): Don't include cell gap in cell rectangle
+ calculation. It's already included in TableColumnModel.getWidth().
+
+2005-09-12 Tom Tromey <tromey@redhat.com>
+
+ * org/ietf/jgss/GSSException.java (BAD_BINDINGS, BAD_MECH,
+ BAD_NAME, BAD_NAMETYPE, CONTEXT_EXPIRED, CREDENTIALS_EXPIRED,
+ DEFECTIVE_CREDENTIAL, DEFECTIVE_TOKEN, DUPLICATE_TOKEN, FAILURE,
+ NO_CONTEXT, NO_CRED, OLD_TOKEN): Use values from JDK, not RFC.
+
+2005-09-12 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * lib/Makefile.am (JAVAC): Specify -source 1.4 to ecj.
+
+2005-09-12 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/tree/DefaultTreeCellEditor.java
+ (isCellEditable): Stopped the timer if it is started and
+ should not be restarted. This is a fix for the 'click-pause-
+ click' method to start editing.
+
+2005-09-12 Lillian Angel <langel@redhat.com>
+
+ * gnu/java/awt/AWTUtilities.java
+ (convertPoint): Added a check to determine if source and
+ destination components are showing.
+ * javax/swing/JPopupMenu.java
+ (setVisible): Added check to determine if component is showing.
+ (show): Likewise.
+ * javax/swing/MenuSelectionManager.java
+ (componentForPoint): Added check to determine if component is showing.
+ * javax/swing/ToolTipManager.java
+ (showTip): Added check to determine if component is showing.
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (mousePressed): Added check to determine if component is showing.
+
+2005-09-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (InternalFrameCloseIcon.paintIcon): change colors according to button
+ state,
+ (InternalFrameAltMaximizeIcon.paintIcon): likewise,
+ (InternalFrameMaximizeIcon.paintIcon): likewise,
+ (InternalFrameMinimizeIcon.paintIcon): likewise.
+
+2005-09-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (TableHeaderBorder): New inner class.
+ (TextFieldBorder.paintBorder): Only paint the active border
+ if the text field is enabled _and_ editable.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Added default to use the new
+ TableHeaderBorder for table headers.
+
+2005-09-12 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Container.java:
+ (findComponentForMouseEventAt): Reduced visibility to package-private.
+ (getDeepestComponentForMouseEventAt): Reduced visibility to
+ package-private and removed static modifier.
+
+2005-09-12 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (desktopIconBorder): new private field,
+ (DesktopIconBorder): new support class,
+ (getDesktopIconBorder): implemented,
+ (InternalFrameBorder.paintBorder): change color of line highlights if
+ the internal frame is selected.
+
+2005-09-12 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/dom/DomDocument.java: Implementation of xml:id W3C
+ Recommendation.
+
+2005-09-12 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (TableColumnPropertyChangeHandler): New inner class. Handles
+ changes of column widths.
+ (JTable(TableModel, TableColumnModel, ListSelectionModel)):
+ Check if column model == null and if so, create a default model.
+ (initializeLocalVars): Changed to use createDefaultColumnsFromModel
+ instead of createColumnsFromModel.
+ (addColumn): Add property change handler to new column.
+ (createColumnsFromModel): Removed redundant private method.
+ Use the public createDefaultColumnsFromModel instead.
+ (tableChanged): Use createDefaultColumnsFromModel instead of
+ createColumnsFromModel.
+ (setModel): Use createDefaultColumnsFromModel instead of
+ createColumnsFromModel.
+ (doLayout): When handling AUTO_RESIZE_OFF, then adjust the
+ size of the resizing column to it's (new) preferred size.
+ (createDefaultColumnsFromModel): Added assertion to make sure
+ that the column model is not null. Add property change handler
+ to new columns.
+ * javax/swing/table/TableColumn.java
+ (setWidth): Fire property change with name 'width' instead
+ of using the (obsolete) constant field COLUMN_WIDTH_PROPERTY.
+ (setPreferredWidth): Make this property a bound property.
+
+2005-09-11 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/22922
+ * java/awt/event/InputEvent.java (modifiersEx): New field.
+ (InputEvent): Assume modifiers parameter contains both new- and
+ old-style masks.
+ (isShiftDown): Check modifiers for old-style shift mask and
+ modifiersEx for new-style shift mask.
+ (isControlDown): Likewise for control mask.
+ (isMetaDown): Likewise for meta mask.
+ (isAltDown): Likewise for alt mask.
+ (isAltGraphDown): Likewise for alt-graph mask.
+ (getModifiers): Return value of modifiers field.
+ (getModifiersEx): Return value of modifiersEx field.
+ * java/awt/event/MouseEvent.java
+ (MouseEvent(Component,int,long,int,int,int,int,boolean,int)):
+ Clear button new-style mask for mouse released events.
+ (paramString): Remove old-style modifier handling.
+ (readObject): Extend modifiers and assign to modifiersEx.
+ * java/awt/event/KeyEvent.java (readObject): Extend modifiers and
+ assign to modifiersEx.
+ * native/jni/gtk-peer/gtkpeer.h: Define macros for new-style mouse
+ masks. Define macros for old-style key masks.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
+ Remove macros for old-style key masks.
+ (button_to_awt_mods): Always return bitwise OR of new- and
+ old-style modifiers.
+ (cp_gtk_state_to_awt_mods): Likewise.
+ (state_to_awt_mods_with_button_states): Likewise.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (keyevent_state_to_awt_mods): Likewise.
+
+2005-09-11 Mark Wielaard <mark@klomp.org>
+
+ * m4/acinclude.m4 (CLASSPATH_CHECK_GCJ): Check for gcj 4 with
+ #if __GNUC__ <= 3.
+
+2005-09-11 Mark Wielaard <mark@klomp.org>
+
+ * lib/gen-classlist.sh.in: Use sort -r to work around bug #21418.
+
+2005-09-11 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/nio/channels/FileChannelImpl.java (finalize): Check whether
+ fd != -1 before calling close().
+
+2005-09-10 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalBorders.java
+ (PaletteBorder): new class.
+
+2005-09-10 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (PaletteCloseIcon): new class.
+
+2005-09-10 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalInternalFrameUI.java:
+ (instances): removed,
+ (createUI): just return new instance,
+ API docs all over.
+
+2005-09-10 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (fail_g2d): New method.
+ (GdkGraphics2D(GdkGraphics2D)): Call fail_g2d if Graphics2D not
+ specified.
+ (GdkGraphics2D(int,int)): Likewise.
+ (GdkGraphics2D(GtkComponentPeer)): Likewise.
+
+2005-09-10 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/EmbeddedWindow.java (addNotify): Throw
+ AssertionError if field access fails.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (static): Reindent
+ second error message.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR awt/23692
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (static): Only call
+ initStaticState if using Graphics2D. Otherwise print error and
+ exit.
+ (setClip(Shape)): If clip == null and component == null, do
+ nothing.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java
+ (GdkGraphics(GtkComponentPeer)): Set font field to a sensible
+ default if component font is null.
+
+2005-09-09 Keith Seitz <keiths@redhat.com>
+
+ * vm/reference/gnu/classpath/jdwp/VMIdManager.java (newObjectId):
+ Set the reference for the ID.
+
+2005-09-09 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/event/VmDeathEvent.java: New file.
+
+2005-09-09 Tom Tromey <tromey@redhat.com>
+
+ For PR libgcj/23288:
+ * java/net/URLClassLoader.java (definePackage): Correctly order
+ arguments to definePackage. Look up per-entry Attributes.
+ (getAttributeValue): New method.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java (installUI): Install
+ defaults after initializing tree.
+
+2005-09-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/html/CSS.java
+ New file. Defines standard CSS attributes.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * java/awt/Window.java (isDisplayable): Do not call super's
+ isDisplayable.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/23796
+ * gnu/java/awt/peer/gtk/GtkDialogPeer.java
+ (create): Respect dialog's decorated flag.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/23558
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (window_get_new_state): Remove function.
+ (window_get_new_state): Mark widget parameter as unused. Remove
+ call to window_get_new_state.
+ (window_active_state_change_cb): Remove function.
+ (connectSignals): Do not connect window_active_state_change_cb
+ callback.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/23796
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (create): Respect
+ frame's decorated flag.
+
+2005-09-09 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicTreeUI.java
+ (installDefaults): Fixed method signature.
+ (uninstallDefaults): Likewise.
+ (uninstallUI): Fixed call to uninstallDefaults.
+ (installUI): Fixed call to installDefaults.
+ * javax/swing/JPopupMenu.java
+ (HeavyWeightPopup): Fixed to extend JDialog, since
+ nothing is added to the taskbar with JDialog. Also,
+ fixed so the popup menu is undecorated. Frames and
+ title bars should not be drawn, when popup is a
+ HeavyWeightPopup. A new bug was filed since the
+ decorated and undecorated frames are all drawn
+ alike.
+ * javax/swing/JRootPane.java
+ (setWindowDecorationStyle): Added check for
+ PLAIN_DIALOG.
+
+2005-09-09 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Added the remaining color defaults.
+
+2005-09-09 Andrew Haley <aph@redhat.com>
+
+ * java/net/URLClassLoader.java (addURLImpl): Synchronize on the
+ loader.
+ (toString): Likewise.
+
+2005-09-09 Jeroen Frijters <jeroen@frijters.net>
+
+ * javax/security/auth/login/Configuration.java
+ (getConfiguration): Call getConfig() instead of doing the work.
+ (getConfig): Instantiate the configuration provider.
+
+2005-09-09 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/reflect/Proxy.java
+ (pack): Initialize field.
+
+2005-09-09 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java: Removed static initializer.
+ * java/io/ObjectOutputStream.java: Removed static initializer.
+ * vm/reference/java/io/VMObjectInputStream.java: Added static
+ initializer.
+ (oisClass, vmoisClass): Removed unused fields.
+ * vm/reference/java/io/VMObjectStreamClass.java: Added static
+ initializer.
+
+2005-09-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): re-added 'ScrollBar.width' default.
+
+2005-09-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java
+ (buttonBorder.paintBorder): fixed drawing issues,
+ (getMaximumSize): return constant value,
+ (getMinimumSize): likewise,
+ (getPreferredSize): likewise.
+
+2005-09-09 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ PR swing/23558
+ * javax/swing/plaf/basic/BasicComboBoxUI.java
+ (FocusHandler.focusLost): Do not call popup.hide.
+
+2005-09-08 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (static): Fix typo
+ (Grahics -> Graphics).
+
+2005-09-08 Tom Tromey <tromey@redhat.com>
+
+ * examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch:
+ New file.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (MetalLookAndFeel): Only load default theme if no theme has been
+ set before.
+ (initComponentDefaults): Fixed and added color default values
+ for various components.
+
+2005-09-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Container.java:
+ (findComponentForMouseEventAt): Removed check for opacity.
+
+2005-09-08 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+ (executeVersion): Major and minor version are integers, not bytes.
+
+2005-09-08 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * java/awt/Container.java:
+ (findComponentForMouseEventAt): New implementation method.
+ (getDeepestComponentForMouseEventAt): New implementation method.
+ (acquireComponentForMouseEvent): Replaced call to
+ AWTUtilities.getDeepestComponentAt with call to new implementation
+ method getDeepestComponentAt to appropriately handle transparent
+ components with no MouseListeners attached.
+
+2005-09-08 Tom Tromey <tromey@redhat.com>
+
+ * .classpath: Enable compilation of jdwp.
+
+2005-09-08 Keith Seitz <keiths@redhat.com>
+
+ * gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
+ (runCommand): Return value is true to indicate that the back-end
+ should shutdown; not whether it should stay alive.
+ * gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/EventRequestCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/MethodCommandSet.java (runCommand):
+ Likewise
+ * gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/StackFrameCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
+ (runCommand): Likewise.
+ * gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+ (runCommand): Likewise.
+
+2005-09-08 Lillian Angel <langel@gmail.com>
+
+ * javax/swing/JPopupMenu.java:
+ Fixes Bug #PR23533
+ (setVisible): Adjusted popup menu's location
+ depending on the size of the screen.
+
+2005-09-08 Mark Wielaard <mark@klomp.org>
+
+ * Makefile.am (EXTRA_DIST): Add autogen.sh
+ * lib/standard.omit: Remove gnu/classpath/jdwp, gnu/xml/stream and
+ javax/xml/stream.
+ * vm/reference/standard.omit: Removed.
+
+2005-09-08 Tom Tromey <tromey@redhat.com>
+
+ * .classpath: Omit more directories and files.
+ * .settings/org.eclipse.jdt.core.prefs: Compile to 1.4 platform.
+ * .settings/org.eclipse.jdt.ui.prefs: Likewise.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/OceanTheme.java
+ New class. Implements the ocean theme for Metal.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (createDefaultTheme): Made Ocean the default theme as in JDK1.5.
+
+2005-09-08 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (FileChooserDetailViewIcon): new private class,
+ (FileChooserHomeFolderIcon): likewise,
+ (FileChooserListViewIcon): likewise,
+ (FileChooserNewFolderIcon): likewise,
+ (FileChooserUpFolderIcon): likewise,
+ (getFileChooserDetailViewIcon): implemented,
+ (getFileChooserHomeFolderIcon): implemented,
+ (getFileChooserListViewIcon): implemented,
+ (getFileChooserNewFolderIcon): implemented,
+ (getFileChooserUpFolderIcon): implemented.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (foreground): Removed this field. This is better stored
+ in the text component itself.
+ (inactiveForeground): Removed this field. This is stored
+ in the disabledTextColor property of the text component.
+ (installDefaults): Load foreground and disabledTextColor
+ properties from UIDefaults. Remove call to updateComponentColors.
+ (paintBackground): Set the correct background color here.
+ (updateComponentColor): Removed this method.
+ * javax/swing/text/PlainView.java
+ (disabledColor): New field. Stores the text color for disabled
+ text fields.
+ (drawUnselectedText): Respect the 'enabled' property of
+ the text component.
+ (paint): Fetch the disabled color of the text component.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (UpdateHandler.propertyChanged): Also update colors if the
+ 'editable' property is changed.
+ (updateComponentColors): Correctly handle editable vs. enabled
+ changes.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Fixed color defaults for TextFields
+ to use the current theme.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (UpdateHandler.propertyChanged): Update the components colors
+ when the state of the 'enabled' property changes.
+ (foreground): New field that stores the foreground color.
+ (background): New field that stores the background color.
+ (inactiveForeground): New field that stores the inactive
+ foreground color.
+ (inactiveBackground): New field that stores the inactive
+ background color.
+ (updateComponentColors): New method. Updates the text
+ components' colors according to the state of the 'enabled'
+ property.
+ (installDefaults): Load the defaults for the component colors.
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): Added defaults for TextField colors
+ and border.
+
+2005-09-08 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/text/GapContent.java
+ Fixes Bug #22966.
+ (GapContentPosition.getOffset): Added assertion to check for
+ consistent state of the Position. Fixed condition in if-statement.
+ (serialVersionUID): Updated serialVersionUID to match JDK1.5.
+ (shiftGap): If gapStart == newGapStart, then return immediatly.
+
+2005-09-08 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): added 'ScrollBar.width' default,
+ * javax/swing/plaf/metal/MetalScrollBarUI.java
+ (MetalScrollBarPropertyChangeHandler): new class,
+ (FREE_STANDING_PROP): added,
+ (MIN_THUMB_SIZE): modified dimensions,
+ (increaseButton): new field,
+ (decreaseButton): new field,
+ (scrollBarWidth): new field,
+ (isFreeStanding): new field,
+ (createUI): just return a new instance,
+ (installDefaults): implemented,
+ (createPropertyChangeListener): implemented,
+ (createDecreaseButton): implemented,
+ (createIncreaseButton): implemented,
+ (paintTrack): implemented,
+ (paintTrackHorizontal): new private method,
+ (paintTrackVertical): new private method,
+ (paintThumb): updated,
+ * javax/swing/plaf/metal/MetalScrollButton.java: implemented,
+ * javax/swing/plaf/metal/MetalUtils.java
+ (fillMetalPattern): modified alternating color calculation.
+
+2005-09-08 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/io/ObjectInputStream.java
+ (readObject): Removed println and fixed Proxy class descriptor
+ deserialization.
+ (resolveProxyClass): Use Class.forName() instead of calling
+ ClassLoader.loadClass() directly.
+ * java/io/ObjectOutputStream.java
+ (writeClassDescriptor): Added support for serializing Proxy
+ class descriptor.
+
+2005-09-08 Jeroen Frijters <jeroen@frijters.net>
+
+ * javax/naming/CompoundName.java
+ (readObject, writeObject): New methods.
+
+2005-09-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/SpringLayout.java:
+ Fixes Bug #PR23003
+ (getConstraints): Width and height should always
+ be reset, even if constraints is not null. Constraints
+ deal with the location of the component.
+
+2005-09-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/text/GapContent.java:
+ Fixes Bug #PR22966
+ (getOffset): Fixed check, was redundant.
+
+2005-09-07 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/text/GapContent.java:
+ Fixes Bug #PR22966
+ (getOffset): Added check for mark <= gapEnd
+
+2005-09-07 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JApplet.java
+ (AccessibleJApplet): New inner class.
+ (getAccesibleContext): Implemented accessibility support.
+ * javax/swing/JDialog.java
+ (AccessibleJDialog): New inner class.
+ (getAccesibleContext): Implemented accessibility support.
+ * javax/swing/JFrame.java
+ (AccessibleJFrame): New inner class.
+ (getAccesibleContext): Implemented accessibility support.
+ * javax/swing/JWindow.java
+ (AccessibleJWindow): New inner class.
+ (getAccesibleContext): Implemented accessibility support.
+
+2005-09-07 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JPanel.java
+ (AccessibleJPanel): New inner class.
+ (getAccessibleContext): Implemented this method.
+
+2005-09-07 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JPanel.java: Reformatted to match our coding
+ standards.
+
+2005-09-07 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/JViewport.java
+ (AccessibleJViewport): New inner class.
+ (getAccessibleContext): New method. Implements the Accessible
+ interface for JViewport.
+
+2005-09-07 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (HorizontalSliderThumbIcon.paintIcon): handle disabled component state,
+ and fetch colors from the look and feel,
+ (VerticalSliderThumbIcon.paintIcon): likewise,
+ * javax/swing/plaf/metal/MetalSliderUI.java
+ (MetalPropertyListener): implemented,
+ (constructor): added color initialisation,
+ (createUI): reimplemented to return a new instance every time,
+ (createPropertyChangeListener): return a new instance of
+ MetalPropertyListener,
+ (paintTrack): reimplemented to handle track fill option, and the
+ disabled component state,
+ (paintMinorTickForHorizSlider): fetch colors from look and feel,
+ (paintMajorTickForHorizSlider): likewise,
+ (paintMinorTickForVertSlider): likewise,
+ (paintMajorTickForVertSlider): likewise.
+
+2005-09-07 Robert Schuster <robertschuster@fsfe.org>
+
+ * native/jni/qt-peer/componentevent.cpp: Added inclusion
+ of assert.h
+
+2005-09-07 Robert Schuster <robertschuster@fsfe.org>
+
+ * INSTALL: Mention that GCJ4 is now mandatory.
+
+2005-09-07 Robert Schuster <robertschuster@fsfe.org>
+
+ * javax/swing/Box.java: Added java.awt.Container import statement.
+
+2005-09-06 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added some RadioButton defaults,
+ * javax/swing/plaf/metal/MetalRadioButtonUI.java
+ (instance): removed,
+ (focusColor): added,
+ (selectColor): added,
+ (disabledTextColor): added,
+ (createUI): return a new instance for every component,
+ (installDefaults): implemented,
+ (uninstallDefaults): implemented,
+ (getSelectColor): implemented,
+ (getDisabledTextColor): implemented,
+ (getFocusColor): implemented,
+ (paint): added FIXME note,
+ (paintFocus): implemented.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #PR23023
+ * javax/swing/plaf/basic/BasicFileChooserUI.java:
+ Added 2 fields and reformatted copyright.
+ (actionPerformed): Should be able to open directories.
+ (mouseClicked): Set text in text field.
+ (installUI): Initialized the current parent path.
+ (installComponents): Fixed initialization for text field.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicFileChooserUI.java:
+ Formatted entire class.
+
+2005-09-06 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Set version to 0.19-pre.
+
+ * doc/www.gnu.org/announce/20050906.wml: New file.
+ * doc/www.gnu.org/newsitems.txt: Add 0.18 release announcement.
+ * doc/www.gnu.org/downloads/downloads.wml: Add 0.18.
+
+2005-09-06 Roman Kennke <roman@kennke.org>
+
+ * javax/swing/Box.java
+ (AccessibleBox): Extend Container.AccessibleAWTContainer.
+ (Filler.AccessibleBoxFiller): Extend Component.AccessibleAWTComponent.
+ (Filler.getAccessibleContext): Uncomment disabled code.
+ (getAccessibleContext): Uncomment disabled code.
+ * javax/swing/JRootPane.java:
+ JRootPane implements Accessible.
+ (AccessibleJRootPane): Extend AccessibleJComponent.
+
+2005-09-06 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/plaf/metal/MetalIconFactory.java
+ (RadioButtonIcon.drawCheck): removed,
+ (RadioButtonIcon.paintIcon): reimplemented,
+ * javax/swing/plaf/metal/MetalLookAndFeel.java
+ (initComponentDefaults): added defaults for JRadioButton.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ Fixes Bug #PR20015
+ * javax/swing/JMenuBar.java
+ (getUIClassID): Fixed API documentation.
+ * javax/swing/plaf/basic/BasicMenuBarUI.java:
+ Added a private field for the mouse listener.
+ (BasicMenuBarUI): Initialized mouseListener.
+ (installListeners): Added mouseListener.
+ (uninstallListeners): Removed mouseListener.
+ (MouseInputHandler): New class added.
+ (mouseClicked): Added code to deselect menu items
+ when menu bar is clicked.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Fixes Bug #PR23527
+ (paintMenuItem): Moved view rectangle over to the
+ left the same amount as defaultTextIconGap so the
+ accelerator is painted with some space on the right.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicMenuItemUI.java:
+ Formatted class.
+
+2005-09-06 Lillian Angel <langel@redhat.com>
+
+ * javax/swing/plaf/basic/BasicScrollBarUI:
+ Fixes Bug PR23529.
+ (installUI): Changed delay for Timer. Was set too
+ long and actionPerformed was not being called fast
+ enough when the user clicks on the scroll bar. This
+ is because the timer is stopped after the mouse is
+ released.
+
2005-09-06 Mark Wielaard <mark@klomp.org>
* NEWS: Add new features for 0.18.
diff --git a/libjava/classpath/INSTALL b/libjava/classpath/INSTALL
index 91515076cd3..7da23666937 100644
--- a/libjava/classpath/INSTALL
+++ b/libjava/classpath/INSTALL
@@ -1,4 +1,4 @@
-Installing GNU Classpath - Last updated: August 31, 2005
+Installing GNU Classpath - Last updated: September 7, 2005
First, this is a development release only! Unless you are interested in
active development and debugging, or just like running random alpha code,
@@ -31,12 +31,17 @@ Suggested Software
--with-jikes, --with-gcj, --with-ecj or --with-kjc as argument to
configure; the present default is gcj.
- - GCJ 3.3+ (part of the GNU GCC package).
+ - GCJ 4.0+ (part of the GNU GCC package).
- IBM jikes 1.19+.
- Eclipse Compiler for Java 3.1+
- The kjc compiler is supported with configure but we have
been unable to successfully compile with it.
+ IMPORTANT: Versions of GCJ which are earlier than 4.0 contain
+ bugs which make it impossible to compile the class library and
+ are *not* supported any more. If you are stuck on a system where
+ GCC 3.x is the system compiler we recommend using Jikes.
+
For building the gtk+ AWT peer JNI native libraries, the following
are required unless --disable-gtk-peer is used as an argument to
configure.
@@ -74,6 +79,29 @@ Suggested Software
- texinfo 4.2 or higher.
+ For building the ALSA midi provider code you will need
+ ALSA. http://www.alsa-project.org.
+
+ For building the DSSI midi synthesizer provider code you will
+ need DSSI from http://dssi.sourceforge.net. This, in turn,
+ introduces many dependencies, including:
+
+ - liblo: the Lightweight OSC implementation
+ http://plugin.org.uk/liblo/
+
+ - LADSPA: Linux Audio Developer's Simple Plugin API
+ http://www.ladspa.org
+
+ - the JACK Audio Connection Kit: A low latency audio server
+ http://jackit.sourceforge.net
+
+ - libsndfile: an audio file I/O library
+ http://www.mega-nerd.com/libsndfile/
+
+ - fluidsynth: a real-time SoundFont 2 based soft-synth
+ http://www.fluidsynth.org/
+
+
This package was designed to use the GNU standard for configuration
and makefiles. To build and install do the following:
@@ -99,8 +127,7 @@ gives a complete list.
--enable-Werror whether to compile C code with -Werror which turns
any compiler warning into a compilation failure
default=no
- --enable-xmlj compile native libxml/xslt library default=no
- --with-gjdoc generate documentation using gjdoc default=no
+ --with-gjdoc generate documentation using gjdoc default=no
--with-jay Regenerate the parsers with jay must be given the
path to the jay executable
diff --git a/libjava/classpath/LICENSE b/libjava/classpath/LICENSE
index 240f834ddff..273623b2c48 100644
--- a/libjava/classpath/LICENSE
+++ b/libjava/classpath/LICENSE
@@ -284,3 +284,17 @@ All these files are distributed under the following terms:
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in these Data Files or Software without prior
written authorization of the copyright holder.
+
+
+The file native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+contains two functions (get_port_default and set_control) derived from
+example code in the DSSI distribution (http://dssi.sourceforge.net).
+The original DSSI example code is distributed under the following
+terms:
+
+ Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton.
+
+ Permission to use, copy, modify, distribute, and sell this software
+ for any purpose is hereby granted without fee, provided that the
+ above copyright notice and this permission notice are included in
+ all copies or substantial portions of the software.
diff --git a/libjava/classpath/Makefile.am b/libjava/classpath/Makefile.am
index 63b26c197d1..69bdb4aa431 100644
--- a/libjava/classpath/Makefile.am
+++ b/libjava/classpath/Makefile.am
@@ -11,7 +11,8 @@ native: lib
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 \
- ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj
+ ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \
+ autogen.sh
#DISTCHECK_CONFIGURE_FLAGS = --enable-gjdoc
diff --git a/libjava/classpath/Makefile.in b/libjava/classpath/Makefile.in
index 957fc5325a4..410171efc59 100644
--- a/libjava/classpath/Makefile.in
+++ b/libjava/classpath/Makefile.in
@@ -44,10 +44,8 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
ltmain.sh missing mkinstalldirs
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -100,10 +98,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -240,6 +242,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -253,6 +256,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -272,7 +276,8 @@ DIST_SUBDIRS = lib doc external include native resource scripts examples
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 \
- ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj
+ ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \
+ autogen.sh
all: all-recursive
@@ -446,7 +451,7 @@ distclean-tags:
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
- $(mkdir_p) $(distdir)/../.. $(distdir)/../../config $(distdir)/examples $(distdir)/gnu/classpath $(distdir)/lib $(distdir)/m4 $(distdir)/scripts
+ $(mkdir_p) $(distdir)/../.. $(distdir)/examples $(distdir)/gnu/classpath $(distdir)/lib $(distdir)/m4 $(distdir)/scripts
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
diff --git a/libjava/classpath/NEWS b/libjava/classpath/NEWS
index 4d918525963..778369385b7 100644
--- a/libjava/classpath/NEWS
+++ b/libjava/classpath/NEWS
@@ -1,3 +1,58 @@
+New in release 0.20
+
+Runtime interface changes:
+
+* New method VMStackWalker.getClassLoader() was added to avoid an infinite
+ loop between getCallingClassLoader() and Class.getClassLoader().
+
+New in release 0.19 (Nov 2, 2005)
+
+* The Swing RepaintManager has been reworked for more efficient painting,
+ especially for large GUIs.
+
+* The Swing layout manager OverlayLayout has been implemented, the BoxLayout
+ has been rewritten to make use of the SizeRequirements utility class and
+ caching for more efficient layout.
+
+* Improved accessibility support for Swing.
+
+* The java.net.HttpURLConnection implementation no longer buffers the
+ entire response body in memory. This means that response bodies
+ larger than available memory can now be handled.
+
+* The Andrew Watson, Vice President and Technical Director of the Object
+ Management Group, has officially assigned us 20 bit Vendor Minor Code Id:
+ 0x47430 ("GC") that will mark remote Classpath - specific system exceptions.
+ Obtaining the VMCID means that GNU Classpath now is a recogniseable type of
+ node in a highly interoperable CORBA world.
+
+* Classpath now includes the first working draft to support the RMI over
+ IIOP protocol. The current implementation is capable for remote invocations,
+ transferring various Serializables and Externalizables via RMI-IIOP protocol.
+ It can flatten graphs and, at least for the simple cases, is interoperable
+ with Sun's jdk 1.5.
+
+* Qt4 configury switches for OS-X. Additional to the --enable-qt-peer, OS-X
+ users with a Qt4 installation can build the qt-peers with the argument
+ --with-qt4dir=<Qt4-installation-dir>.
+
+* Significant progress has been made in the implementation of the
+ javax.swing.plaf.metal.* package, with most UI delegates in a working state
+ now. Please test this with your own applications and provide feedback that
+ will help us to improve this package.
+
+* The GUI demo (gnu.classpath.examples.swing.Demo) has been extended to
+ highlight various features in our free-swing implementation. And includes
+ a look and feel switcher (Metal default, Ocean or GNU).
+
+Runtime interface changes:
+
+* Changed implementation of VMClassLoader.getPackage(s) : new method
+ VMClassLoader.getBootPackages should be implemented by the vm, and sould
+ return a string array of boot package names ("java.lang", "java.net", ...).
+ Feedback from vm implementors for usability and relevance of the
+ getBootPackages method would be greatly appreciated.
+
New in release 0.18 (Sep 6, 2005)
* GNU JAWT implementation, the AWT Native Interface, which allows direct
diff --git a/libjava/classpath/aclocal.m4 b/libjava/classpath/aclocal.m4
index fbe1f32dd7a..7f4f5c62f22 100644
--- a/libjava/classpath/aclocal.m4
+++ b/libjava/classpath/aclocal.m4
@@ -547,6 +547,39 @@ AC_DEFUN([AM_PROG_INSTALL_SH],
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
+# -*- Autoconf -*-
+# Copyright (C) 2003 Free Software Foundation, Inc.
+
+# 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, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
@@ -1053,10 +1086,8 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
-m4_include([../../config/depstand.m4])
-m4_include([../../config/lead-dot.m4])
-m4_include([../../config/no-executables.m4])
m4_include([../../libtool.m4])
+m4_include([m4/acattribute.m4])
m4_include([m4/accross.m4])
m4_include([m4/acinclude.m4])
m4_include([m4/iconv.m4])
diff --git a/libjava/classpath/autogen.sh b/libjava/classpath/autogen.sh
index e20cc38695a..babfa4e5d83 100755
--- a/libjava/classpath/autogen.sh
+++ b/libjava/classpath/autogen.sh
@@ -16,7 +16,7 @@ LIBTOOLIZE=libtoolize
have_libtool=false
if ${LIBTOOLIZE} --version < /dev/null > /dev/null 2>&1 ; then
- libtool_version=`${LIBTOOLIZE} --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+ libtool_version=`${LIBTOOLIZE} --version | sed 's/^.*[^0-9.]\([0-9]\{1,\}\.[0-9.]\{1,\}\).*/\1/'`
case $libtool_version in
1.5*)
have_libtool=true
diff --git a/libjava/classpath/config.guess b/libjava/classpath/config.guess
index 2fc3acce2ea..917bbc50f36 100755
--- a/libjava/classpath/config.guess
+++ b/libjava/classpath/config.guess
@@ -1,9 +1,9 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-timestamp='2003-06-17'
+timestamp='2005-07-08'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -17,13 +17,15 @@ timestamp='2003-06-17'
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
+
# Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
@@ -53,7 +55,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -66,11 +68,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
+ echo "$timestamp" ; exit ;;
--version | -v )
- echo "$version" ; exit 0 ;;
+ echo "$version" ; exit ;;
--help | --h* | -h )
- echo "$usage"; exit 0 ;;
+ echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@@ -123,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ;'
+esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
@@ -136,13 +138,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-## for Red Hat Linux
-if test -f /etc/redhat-release ; then
- VENDOR=redhat ;
-else
- VENDOR= ;
-fi
-
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -203,50 +198,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
- exit 0 ;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- macppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvmeppc:OpenBSD:*:*)
- echo powerpc-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mipseb-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
+ case $UNAME_RELEASE in
+ *4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
@@ -284,42 +258,49 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
+ # A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit 0 ;;
- Alpha*:OpenVMS:*:*)
- echo alpha-hp-vms
- exit 0 ;;
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
- exit 0 ;;
+ exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
- exit 0 ;;
+ exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
- exit 0;;
+ exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
- exit 0 ;;
+ exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
- exit 0 ;;
+ exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
- exit 0 ;;
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
+ exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
@@ -327,32 +308,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
else
echo pyramid-pyramid-bsd
fi
- exit 0 ;;
+ exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
- exit 0 ;;
+ exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
- exit 0 ;;
- DRS?6000:UNIX_SV:4.2*:7*)
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7 && exit 0 ;;
+ sparc) echo sparc-icl-nx7; exit ;;
esac ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
@@ -361,10 +342,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit 0 ;;
+ exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
@@ -376,10 +357,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
- exit 0 ;;
+ exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
@@ -390,37 +371,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
- exit 0 ;;
+ exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -444,32 +428,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit (-1);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c \
- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && exit 0
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
- exit 0 ;;
+ exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
- exit 0 ;;
+ exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
- exit 0 ;;
+ exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
- exit 0 ;;
+ exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
- exit 0 ;;
+ exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
- exit 0 ;;
+ exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
- exit 0 ;;
+ exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
@@ -485,29 +470,29 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
- exit 0 ;;
+ exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
- exit 0 ;;
+ exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
- exit 0 ;;
+ exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
- exit 0 ;;
+ exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
- exit 0 ;;
+ exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit 0 ;;
+ exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
- exit 0 ;;
+ exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
@@ -515,7 +500,7 @@ EOF
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit 0 ;;
+ exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
@@ -530,14 +515,18 @@ EOF
exit(0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
- echo rs6000-ibm-aix3.2.5
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
- exit 0 ;;
+ exit ;;
*:AIX:*:[45])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
@@ -551,28 +540,28 @@ EOF
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
+ exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
- exit 0 ;;
+ exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
- exit 0 ;;
+ exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
+ exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
- exit 0 ;;
+ exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
- exit 0 ;;
+ exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
- exit 0 ;;
+ exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
- exit 0 ;;
+ exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
@@ -634,9 +623,19 @@ EOF
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
- # avoid double evaluation of $set_cc_for_build
- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
@@ -644,11 +643,11 @@ EOF
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
+ exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
- exit 0 ;;
+ exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -676,150 +675,166 @@ EOF
exit (0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
- exit 0 ;;
+ exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
- exit 0 ;;
+ exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
- exit 0 ;;
+ exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
- exit 0 ;;
+ exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
- exit 0 ;;
+ exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
- exit 0 ;;
+ exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
- exit 0 ;;
+ exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
- exit 0 ;;
+ exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
- exit 0 ;;
+ exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit 0 ;;
+ exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
- exit 0 ;;
+ exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
- exit 0 ;;
+ exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
- exit 0 ;;
+ exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ exit ;;
*:UNICOS/mp:*:*)
- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit 0 ;;
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit 0 ;;
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
- # Determine whether the default compiler uses glibc.
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #if __GLIBC__ >= 2
- LIBC=gnu
- #else
- LIBC=
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
- exit 0 ;;
+ exit ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
- exit 0 ;;
+ exit ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
- exit 0 ;;
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
- exit 0 ;;
+ exit ;;
x86:Interix*:[34]*)
echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
- exit 0 ;;
+ exit ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
- exit 0 ;;
+ exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
- exit 0 ;;
+ exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
- exit 0 ;;
+ exit ;;
+ amd64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
- exit 0 ;;
+ exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
+ exit ;;
*:GNU:*:*)
+ # the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
- exit 0 ;;
+ exit ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
- exit 0 ;;
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu
- exit 0 ;;
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
@@ -837,7 +852,7 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
@@ -856,14 +871,14 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
ppc:Linux:*:*)
- echo powerpc-${VENDOR:-unknown}-linux-gnu
- exit 0 ;;
+ echo powerpc-unknown-linux-gnu
+ exit ;;
ppc64:Linux:*:*)
- echo powerpc64-${VENDOR:-unknown}-linux-gnu
- exit 0 ;;
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@@ -877,7 +892,7 @@ EOF
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit 0 ;;
+ exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -885,25 +900,25 @@ EOF
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
- exit 0 ;;
+ exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu
- exit 0 ;;
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit 0 ;;
+ exit ;;
x86_64:Linux:*:*)
- echo x86_64-${VENDOR:-unknown}-linux-gnu
- exit 0 ;;
+ echo x86_64-unknown-linux-gnu
+ exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
@@ -921,15 +936,15 @@ EOF
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0 ;;
+ exit ;;
coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit 0 ;;
+ exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit 0 ;;
+ exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
@@ -952,17 +967,23 @@ EOF
LIBC=gnuaout
#endif
#endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR:-pc}-linux-${LIBC}" && exit 0
- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
- exit 0 ;;
+ exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
@@ -970,24 +991,27 @@ EOF
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit 0 ;;
+ exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
- exit 0 ;;
+ exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
- exit 0 ;;
+ exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
- exit 0 ;;
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit 0 ;;
+ exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@@ -995,15 +1019,16 @@ EOF
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
- exit 0 ;;
- i*86:*:5:[78]*)
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit 0 ;;
+ exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
@@ -1021,73 +1046,73 @@ EOF
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
- exit 0 ;;
+ exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
- exit 0 ;;
+ exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
- exit 0 ;;
+ exit ;;
paragon:*:*:*)
echo i860-intel-osf1
- exit 0 ;;
+ exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
- exit 0 ;;
+ exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
- exit 0 ;;
+ exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
- exit 0 ;;
+ exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
- exit 0 ;;
- M68*:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
+ && { echo i486-ncr-sysv4; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
- exit 0 ;;
+ exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
- exit 0 ;;
+ exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
- exit 0 ;;
+ exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -1095,68 +1120,73 @@ EOF
else
echo ns32k-sni-sysv
fi
- exit 0 ;;
+ exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
- exit 0 ;;
+ exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
- exit 0 ;;
+ exit ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
- exit 0 ;;
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
- exit 0 ;;
+ exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
- exit 0 ;;
+ exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
- exit 0 ;;
+ exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
- exit 0 ;;
+ exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
- exit 0 ;;
+ exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
- exit 0 ;;
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Darwin:*:*)
- case `uname -p` in
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
*86) UNAME_PROCESSOR=i686 ;;
- powerpc) UNAME_PROCESSOR=powerpc ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
@@ -1164,22 +1194,25 @@ EOF
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
- exit 0 ;;
- NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
- exit 0 ;;
+ exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
- exit 0 ;;
+ exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
@@ -1190,28 +1223,44 @@ EOF
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
- exit 0 ;;
+ exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
- exit 0 ;;
+ exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
- exit 0 ;;
+ exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
- exit 0 ;;
+ exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
- exit 0 ;;
+ exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
- exit 0 ;;
+ exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
- exit 0 ;;
+ exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
- exit 0 ;;
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1243,7 +1292,7 @@ main ()
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
+ printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
@@ -1332,11 +1381,12 @@ main ()
}
EOF
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
@@ -1345,22 +1395,22 @@ then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
- exit 0 ;;
+ exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit 0 ;;
+ exit ;;
c34*)
echo c34-convex-bsd
- exit 0 ;;
+ exit ;;
c38*)
echo c38-convex-bsd
- exit 0 ;;
+ exit ;;
c4*)
echo c4-convex-bsd
- exit 0 ;;
+ exit ;;
esac
fi
@@ -1371,7 +1421,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
- ftp://ftp.gnu.org/pub/gnu/config/
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
diff --git a/libjava/classpath/config.sub b/libjava/classpath/config.sub
index 6b2ff9f6a7a..1c366dfde9a 100755
--- a/libjava/classpath/config.sub
+++ b/libjava/classpath/config.sub
@@ -1,9 +1,9 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-timestamp='2003-06-18'
+timestamp='2005-07-08'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -21,14 +21,15 @@ timestamp='2003-06-18'
#
# 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., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
+
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
#
@@ -70,7 +71,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -83,11 +84,11 @@ Try \`$me --help' for more information."
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
- echo "$timestamp" ; exit 0 ;;
+ echo "$timestamp" ; exit ;;
--version | -v )
- echo "$version" ; exit 0 ;;
+ echo "$version" ; exit ;;
--help | --h* | -h )
- echo "$usage"; exit 0 ;;
+ echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
@@ -99,7 +100,7 @@ while test $# -gt 0 ; do
*local*)
# First pass through any local machine types.
echo $1
- exit 0;;
+ exit ;;
* )
break ;;
@@ -118,7 +119,8 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -144,7 +146,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis)
+ -apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
@@ -228,14 +230,16 @@ case $basic_machine in
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
- | ip2k \
- | m32r | m68000 | m68k | m88k | mcore \
+ | ip2k | iq2000 \
+ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -244,31 +248,37 @@ case $basic_machine in
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
+ | ms1 \
| msp430 \
| ns16k | ns32k \
- | openrisc | or32 \
+ | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
- | s390 | s390x \
- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
- | x86 | xscale | xstormy16 | xtensa \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
+ m32c)
+ basic_machine=$basic_machine-unknown
+ ;;
m6811 | m68hc11 | m6812 | m68hc12)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
@@ -296,19 +306,19 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* \
- | bs2000-* \
+ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | clipper-* | cydra-* \
+ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* \
- | m32r-* \
+ | ip2k-* | iq2000-* \
+ | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | mcore-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -317,34 +327,40 @@ case $basic_machine in
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | ms1-* \
| msp430-* \
- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
- | s390-* | s390x-* \
- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
- | xtensa-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
| ymp-* \
| z8k-*)
;;
+ m32c-*)
+ ;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@@ -361,6 +377,9 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
@@ -378,6 +397,9 @@ case $basic_machine in
amd64)
basic_machine=x86_64-pc
;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
amdahl)
basic_machine=580-amdahl
os=-sysv
@@ -437,12 +459,27 @@ case $basic_machine in
basic_machine=j90-cray
os=-unicos
;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16c)
+ basic_machine=cr16c-unknown
+ os=-elf
+ ;;
crds | unos)
basic_machine=m68k-crds
;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
da30 | da30-*)
basic_machine=m68k-da30
;;
@@ -465,6 +502,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
@@ -643,10 +684,6 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
- mmix*)
- basic_machine=mmix-knuth
- os=-mmixware
- ;;
monitor)
basic_machine=m68k-rom68k
os=-coff
@@ -727,10 +764,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
- nv1)
- basic_machine=nv1-cray
- os=-unicosmp
- ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -738,9 +771,12 @@ case $basic_machine in
basic_machine=hppa1.1-oki
os=-proelf
;;
- or32 | or32-*)
+ openrisc | openrisc-*)
basic_machine=or32-unknown
- os=-coff
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
@@ -833,6 +869,12 @@ case $basic_machine in
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
sa29200)
basic_machine=a29k-amd
os=-udi
@@ -956,6 +998,10 @@ case $basic_machine in
tower | tower-32)
basic_machine=m68k-ncr
;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
udi29k)
basic_machine=a29k-amd
os=-udi
@@ -999,6 +1045,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
xps | xps100)
basic_machine=xps100-honeywell
;;
@@ -1029,6 +1079,9 @@ case $basic_machine in
romp)
basic_machine=romp-ibm
;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
rs6000)
basic_machine=rs6000-ibm
;;
@@ -1045,12 +1098,9 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
- sh64)
- basic_machine=sh64-unknown
- ;;
sparc | sparcv8 | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
@@ -1124,19 +1174,21 @@ case $os in
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1154,12 +1206,15 @@ case $os in
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@@ -1172,6 +1227,9 @@ case $os in
-opened*)
os=-openedition
;;
+ -os400*)
+ os=-os400
+ ;;
-wince*)
os=-wince
;;
@@ -1193,6 +1251,9 @@ case $os in
-atheos*)
os=-atheos
;;
+ -syllable*)
+ os=-syllable
+ ;;
-386bsd)
os=-bsd
;;
@@ -1215,6 +1276,9 @@ case $os in
-sinix*)
os=-sysv4
;;
+ -tpf*)
+ os=-tpf
+ ;;
-triton*)
os=-sysv3
;;
@@ -1251,6 +1315,9 @@ case $os in
-kaos*)
os=-kaos
;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
-none)
;;
*)
@@ -1282,9 +1349,9 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
@@ -1328,9 +1395,15 @@ case $basic_machine in
*-be)
os=-beos
;;
+ *-haiku)
+ os=-haiku
+ ;;
*-ibm)
os=-aix
;;
+ *-knuth)
+ os=-mmixware
+ ;;
*-wec)
os=-proelf
;;
@@ -1463,9 +1536,15 @@ case $basic_machine in
-mvs* | -opened*)
vendor=ibm
;;
+ -os400*)
+ vendor=ibm
+ ;;
-ptx*)
vendor=sequent
;;
+ -tpf*)
+ vendor=ibm
+ ;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
@@ -1490,7 +1569,7 @@ case $basic_machine in
esac
echo $basic_machine$os
-exit 0
+exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
diff --git a/libjava/classpath/configure b/libjava/classpath/configure
index 0c6781a815a..203822ddd78 100755
--- a/libjava/classpath/configure
+++ b/libjava/classpath/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for GNU Classpath 0.18.
+# Generated by GNU Autoconf 2.59 for GNU Classpath 0.20-pre.
#
# Report bugs to <classpath@gnu.org>.
#
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='GNU Classpath'
PACKAGE_TARNAME='classpath'
-PACKAGE_VERSION='0.18'
-PACKAGE_STRING='GNU Classpath 0.18'
+PACKAGE_VERSION='0.20-pre'
+PACKAGE_STRING='GNU Classpath 0.20-pre'
PACKAGE_BUGREPORT='classpath@gnu.org'
ac_unique_file="java/lang/System.java"
@@ -312,7 +312,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os LIBVERSION CLASSPATH_MODULE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CREATE_JNI_LIBRARIES_TRUE CREATE_JNI_LIBRARIES_FALSE CREATE_CORE_JNI_LIBRARIES_TRUE CREATE_CORE_JNI_LIBRARIES_FALSE default_toolkit CREATE_XMLJ_LIBRARY_TRUE CREATE_XMLJ_LIBRARY_FALSE CREATE_GTK_PEER_LIBRARIES_TRUE CREATE_GTK_PEER_LIBRARIES_FALSE GTK_CAIRO_ENABLED GTK_CAIRO_TRUE GTK_CAIRO_FALSE CREATE_QT_PEER_LIBRARIES_TRUE CREATE_QT_PEER_LIBRARIES_FALSE CREATE_JNI_HEADERS_TRUE CREATE_JNI_HEADERS_FALSE LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB LIBTOOL CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP EGREP LIBICONV LTLIBICONV WARNING_CFLAGS STRICT_WARNING_CFLAGS ERROR_CFLAGS PKG_CONFIG XML_CFLAGS XML_LIBS XSLT_CFLAGS XSLT_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GTK_CFLAGS GTK_LIBS QT_CFLAGS QT_LIBS MOC CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS USER_JAVAH USER_SPECIFIED_JAVAH_TRUE USER_SPECIFIED_JAVAH_FALSE CLASSPATH_INCLUDES GCJ JIKES JIKESENCODING KJC GCJX ECJ FOUND_GCJ_TRUE FOUND_GCJ_FALSE FOUND_JIKES_TRUE FOUND_JIKES_FALSE FOUND_ECJ_TRUE FOUND_ECJ_FALSE FOUND_KJC_TRUE FOUND_KJC_FALSE FOUND_GCJX_TRUE FOUND_GCJX_FALSE USER_CLASSLIB USER_SPECIFIED_CLASSLIB_TRUE USER_SPECIFIED_CLASSLIB_FALSE vm_classes MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBDEBUG INIT_LOAD_LIBRARY JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION REMOVE MKDIR CP DATE FIND ZIP INSTALL_GLIBJ_ZIP_TRUE INSTALL_GLIBJ_ZIP_FALSE INSTALL_CLASS_FILES_TRUE INSTALL_CLASS_FILES_FALSE BUILD_CLASS_FILES_TRUE BUILD_CLASS_FILES_FALSE EXAMPLESDIR GJDOC CREATE_API_DOCS_TRUE CREATE_API_DOCS_FALSE JAY JAY_SKELETON REGEN_PARSERS_TRUE REGEN_PARSERS_FALSE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os LIBVERSION CLASSPATH_MODULE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CREATE_JNI_LIBRARIES_TRUE CREATE_JNI_LIBRARIES_FALSE CREATE_CORE_JNI_LIBRARIES_TRUE CREATE_CORE_JNI_LIBRARIES_FALSE default_toolkit CREATE_XMLJ_LIBRARY_TRUE CREATE_XMLJ_LIBRARY_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP CREATE_ALSA_LIBRARIES_TRUE CREATE_ALSA_LIBRARIES_FALSE CREATE_DSSI_LIBRARIES_TRUE CREATE_DSSI_LIBRARIES_FALSE CREATE_GTK_PEER_LIBRARIES_TRUE CREATE_GTK_PEER_LIBRARIES_FALSE GTK_CAIRO_ENABLED GTK_CAIRO_TRUE GTK_CAIRO_FALSE CREATE_QT_PEER_LIBRARIES_TRUE CREATE_QT_PEER_LIBRARIES_FALSE nativelibdir glibjdir CREATE_JNI_HEADERS_TRUE CREATE_JNI_HEADERS_FALSE LN_S RANLIB ac_ct_RANLIB LIBTOOL CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP LIBICONV LTLIBICONV WARNING_CFLAGS STRICT_WARNING_CFLAGS ERROR_CFLAGS PKG_CONFIG XML_CFLAGS XML_LIBS XSLT_CFLAGS XSLT_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS GTK_CFLAGS GTK_LIBS CAIRO_CFLAGS CAIRO_LIBS PANGOFT2_CFLAGS PANGOFT2_LIBS QT_CFLAGS QT_LIBS MOC USER_JAVAH USER_SPECIFIED_JAVAH_TRUE USER_SPECIFIED_JAVAH_FALSE CLASSPATH_INCLUDES GCJ JIKES JIKESENCODING KJC GCJX ECJ FOUND_GCJ_TRUE FOUND_GCJ_FALSE FOUND_JIKES_TRUE FOUND_JIKES_FALSE FOUND_ECJ_TRUE FOUND_ECJ_FALSE FOUND_KJC_TRUE FOUND_KJC_FALSE FOUND_GCJX_TRUE FOUND_GCJX_FALSE USER_CLASSLIB USER_SPECIFIED_CLASSLIB_TRUE USER_SPECIFIED_CLASSLIB_FALSE vm_classes MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBDEBUG INIT_LOAD_LIBRARY JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION REMOVE MKDIR CP DATE FIND ZIP INSTALL_GLIBJ_ZIP_TRUE INSTALL_GLIBJ_ZIP_FALSE INSTALL_CLASS_FILES_TRUE INSTALL_CLASS_FILES_FALSE BUILD_CLASS_FILES_TRUE BUILD_CLASS_FILES_FALSE EXAMPLESDIR GJDOC CREATE_API_DOCS_TRUE CREATE_API_DOCS_FALSE JAY JAY_SKELETON REGEN_PARSERS_TRUE REGEN_PARSERS_FALSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -793,7 +793,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GNU Classpath 0.18 to adapt to many kinds of systems.
+\`configure' configures GNU Classpath 0.20-pre to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -864,7 +864,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GNU Classpath 0.18:";;
+ short | recursive ) echo "Configuration of GNU Classpath 0.20-pre:";;
esac
cat <<\_ACEOF
@@ -873,12 +873,18 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-jni compile JNI source default=yes
--enable-core-jni compile JNI sources for core default=yes
- --disable-Werror whether to compile C code with -Werror which turns
+ --enable-Werror whether to compile C code with -Werror which turns
any compiler warning into a compilation failure
default=no
--enable-default-toolkit
fully qualified class name of default AWT toolkit
--enable-xmlj compile native libxml/xslt library default=no
+ --disable-alsa compile ALSA providers (enable by --enable-alsa)
+ default=yes
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --disable-dssi compile DSSI providers (enable by --enable-dssi)
+ default=yes
--disable-gtk-peer compile GTK native peers (disabled by --disable-jni)
default=yes
@@ -890,8 +896,6 @@ Optional Features:
--enable-static=PKGS build static libraries default=no
--enable-shared=PKGS build shared libraries default=yes
--enable-fast-install=PKGS optimize for fast installation default=yes
- --disable-dependency-tracking speeds up one-time build
- --enable-dependency-tracking do not reject slow dependency extractors
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-rpath do not hardcode runtime library paths
--enable-maintainer-mode enable make rules and dependencies not useful
@@ -908,11 +912,17 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-native-libdir sets the installation directore for native libraries
+ default='${libdir}/${PACKAGE}'
+ --with-glibj-dir sets the installation directory for glibj.zip
+ default='${libdir}/${PACKAGE}'
--with-gnu-ld assume the C compiler uses GNU ld default=no
--with-pic try to use only PIC/non-PIC objects default=use both
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
--without-libiconv-prefix don't search for libiconv in includedir and libdir
--with-x use the X Window System
+ --with-qt4dir=DIR Qt4 installation directory used for OS-X. For other
+ systems use pkg-config.
--with-javah specify path or name of a javah-like program
--with-gcj bytecode compilation with gcj
--with-jikes bytecode compilation with jikes
@@ -1031,14 +1041,14 @@ esac
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
- cd $ac_popdir
+ cd "$ac_popdir"
done
fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-GNU Classpath configure 0.18
+GNU Classpath configure 0.20-pre
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1052,7 +1062,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GNU Classpath $as_me 0.18, which was
+It was created by GNU Classpath $as_me 0.20-pre, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1797,7 +1807,7 @@ fi
# Define the identity of the package.
PACKAGE='classpath'
- VERSION='0.18'
+ VERSION='0.20-pre'
cat >>confdefs.h <<_ACEOF
@@ -2062,7 +2072,7 @@ if test "${enable_Werror+set}" = set; then
case "${enableval}" in
yes) ENABLE_WERROR=yes ;;
no) ENABLE_WERROR=no ;;
- *) ENABLE_WERROR=yes ;;
+ *) ENABLE_WERROR=no ;;
esac
else
ENABLE_WERROR=no
@@ -2101,270 +2111,6 @@ else
fi
-# Check whether --enable-gtk-peer or --disable-gtk-peer was given.
-if test "${enable_gtk_peer+set}" = set; then
- enableval="$enable_gtk_peer"
- case "${enableval}" in
- yes) COMPILE_GTK_PEER=yes ;;
- no) COMPILE_GTK_PEER=no ;;
- *) COMPILE_GTK_PEER=yes ;;
- esac
-else
- COMPILE_GTK_PEER=yes
-fi;
-
-
-if test "x${COMPILE_GTK_PEER}" = xyes; then
- CREATE_GTK_PEER_LIBRARIES_TRUE=
- CREATE_GTK_PEER_LIBRARIES_FALSE='#'
-else
- CREATE_GTK_PEER_LIBRARIES_TRUE='#'
- CREATE_GTK_PEER_LIBRARIES_FALSE=
-fi
-
-
-# Check whether --enable-gtk-peers or --disable-gtk-peers was given.
-if test "${enable_gtk_peers+set}" = set; then
- enableval="$enable_gtk_peers"
- { { echo "$as_me:$LINENO: error: No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer" >&5
-echo "$as_me: error: No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer" >&2;}
- { (exit 1); exit 1; }; }
-fi;
-
-# Check whether --enable-gtk-cairo or --disable-gtk-cairo was given.
-if test "${enable_gtk_cairo+set}" = set; then
- enableval="$enable_gtk_cairo"
- case "${enableval}" in
- yes) GTK_CAIRO_ENABLED=true ;;
- no) GTK_CAIRO_ENABLED=false ;;
- *) GTK_CAIRO_ENABLED=true ;;
- esac
-else
- GTK_CAIRO_ENABLED=false
-fi;
-
-if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
-
-cat >>confdefs.h <<\_ACEOF
-#define GTK_CAIRO 1
-_ACEOF
-
-fi
-
-
-if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
- GTK_CAIRO_TRUE=
- GTK_CAIRO_FALSE='#'
-else
- GTK_CAIRO_TRUE='#'
- GTK_CAIRO_FALSE=
-fi
-
-
-# Check whether --enable-qt-peer or --disable-qt-peer was given.
-if test "${enable_qt_peer+set}" = set; then
- enableval="$enable_qt_peer"
- case "${enableval}" in
- yes) COMPILE_QT_PEER=yes ;;
- no) COMPILE_QT_PEER=no ;;
- *) COMPILE_QT_PEER=yes ;;
- esac
-else
- COMPILE_QT_PEER=no
-fi;
-
-
-if test "x${COMPILE_QT_PEER}" = xyes; then
- CREATE_QT_PEER_LIBRARIES_TRUE=
- CREATE_QT_PEER_LIBRARIES_FALSE='#'
-else
- CREATE_QT_PEER_LIBRARIES_TRUE='#'
- CREATE_QT_PEER_LIBRARIES_FALSE=
-fi
-
-
-# Check whether --enable-regen-headers or --disable-regen-headers was given.
-if test "${enable_regen_headers+set}" = set; then
- enableval="$enable_regen_headers"
- case "${enableval}" in
- yes) REGENERATE_JNI_HEADERS=yes ;;
- no) REGENERATE_JNI_HEADERS=no ;;
- *) REGENERATE_JNI_HEADERS=no ;;
- esac
-else
- REGENERATE_JNI_HEADERS=no
-fi;
-
-
-if test "x${REGENERATE_JNI_HEADERS}" = xyes; then
- CREATE_JNI_HEADERS_TRUE=
- CREATE_JNI_HEADERS_FALSE='#'
-else
- CREATE_JNI_HEADERS_TRUE='#'
- CREATE_JNI_HEADERS_FALSE=
-fi
-
-
-echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-else
- echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6
-fi
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
- ./ | .// | /cC/* | \
- /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
- /usr/ucb/* ) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
- if test $ac_prog = install &&
- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- elif test $ac_prog = install &&
- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # program-specific install script used by HP pwplus--don't use.
- :
- else
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
- fi
- fi
- done
- done
- ;;
-esac
-done
-
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL=$ac_cv_path_install
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL=$ac_install_sh
- fi
-fi
-echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-
-
-
-# Check whether --enable-static or --disable-static was given.
-if test "${enable_static+set}" = set; then
- enableval="$enable_static"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_static=yes ;;
-no) enable_static=no ;;
-*)
- enable_static=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_static=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_static=no
-fi;
-# Check whether --enable-shared or --disable-shared was given.
-if test "${enable_shared+set}" = set; then
- enableval="$enable_shared"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_shared=yes ;;
-no) enable_shared=no ;;
-*)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_shared=yes
-fi;
-# Check whether --enable-fast-install or --disable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
- enableval="$enable_fast_install"
- p=${PACKAGE-default}
-case $enableval in
-yes) enable_fast_install=yes ;;
-no) enable_fast_install=no ;;
-*)
- enable_fast_install=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_fast_install=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac
-else
- enable_fast_install=yes
-fi;
DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depfiles"
@@ -2780,39 +2526,6 @@ main ()
return 0;
}
_ACEOF
-# FIXME: Cleanup?
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- gcc_no_link=no
-else
- gcc_no_link=yes
-fi
-
-if test x$gcc_no_link = xyes; then
- # Setting cross_compile will disable run tests; it will
- # also disable AC_CHECK_FILE but that's generally
- # correct if we can't link.
- cross_compiling=yes
- EXEEXT=
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
@@ -2949,7 +2662,6 @@ echo "${ECHO_T}$ac_cv_exeext" >&6
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-fi
echo "$as_me:$LINENO: checking for suffix of object files" >&5
echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
@@ -3032,8 +2744,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3091,8 +2802,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3208,8 +2918,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3263,8 +2972,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3309,8 +3017,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3354,8 +3061,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3504,6 +3210,1132 @@ fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Check whether --enable-alsa or --disable-alsa was given.
+if test "${enable_alsa+set}" = set; then
+ enableval="$enable_alsa"
+ case "${enableval}" in
+ yes) COMPILE_ALSA=yes ;;
+ no) COMPILE_ALSA=no ;;
+ *) COMPILE_ALSA=yes ;;
+ esac
+else
+
+for ac_header in alsa/asoundlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to classpath@gnu.org ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ COMPILE_ALSA=yes
+else
+ COMPILE_ALSA=no
+fi
+
+done
+
+fi;
+
+
+if test "x${COMPILE_ALSA}" = xyes; then
+ CREATE_ALSA_LIBRARIES_TRUE=
+ CREATE_ALSA_LIBRARIES_FALSE='#'
+else
+ CREATE_ALSA_LIBRARIES_TRUE='#'
+ CREATE_ALSA_LIBRARIES_FALSE=
+fi
+
+
+# Check whether --enable-dssi or --disable-dssi was given.
+if test "${enable_dssi+set}" = set; then
+ enableval="$enable_dssi"
+ case "${enableval}" in
+ yes) COMPILE_DSSI=yes ;;
+ no) COMPILE_DSSI=no ;;
+ *) COMPILE_DSSI=yes ;;
+ esac
+else
+
+for ac_header in dssi.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## -------------------------------- ##
+## Report this to classpath@gnu.org ##
+## -------------------------------- ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ COMPILE_DSSI=yes
+else
+ COMPILE_DSSI=no
+fi
+
+done
+
+fi;
+
+
+if test "x${COMPILE_DSSI}" = xyes; then
+ CREATE_DSSI_LIBRARIES_TRUE=
+ CREATE_DSSI_LIBRARIES_FALSE='#'
+else
+ CREATE_DSSI_LIBRARIES_TRUE='#'
+ CREATE_DSSI_LIBRARIES_FALSE=
+fi
+
+
+# Check whether --enable-gtk-peer or --disable-gtk-peer was given.
+if test "${enable_gtk_peer+set}" = set; then
+ enableval="$enable_gtk_peer"
+ case "${enableval}" in
+ yes) COMPILE_GTK_PEER=yes ;;
+ no) COMPILE_GTK_PEER=no ;;
+ *) COMPILE_GTK_PEER=yes ;;
+ esac
+else
+ COMPILE_GTK_PEER=yes
+fi;
+
+
+if test "x${COMPILE_GTK_PEER}" = xyes; then
+ CREATE_GTK_PEER_LIBRARIES_TRUE=
+ CREATE_GTK_PEER_LIBRARIES_FALSE='#'
+else
+ CREATE_GTK_PEER_LIBRARIES_TRUE='#'
+ CREATE_GTK_PEER_LIBRARIES_FALSE=
+fi
+
+
+# Check whether --enable-gtk-peers or --disable-gtk-peers was given.
+if test "${enable_gtk_peers+set}" = set; then
+ enableval="$enable_gtk_peers"
+ { { echo "$as_me:$LINENO: error: No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer" >&5
+echo "$as_me: error: No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer" >&2;}
+ { (exit 1); exit 1; }; }
+fi;
+
+# Check whether --enable-gtk-cairo or --disable-gtk-cairo was given.
+if test "${enable_gtk_cairo+set}" = set; then
+ enableval="$enable_gtk_cairo"
+ case "${enableval}" in
+ yes) GTK_CAIRO_ENABLED=true ;;
+ no) GTK_CAIRO_ENABLED=false ;;
+ *) GTK_CAIRO_ENABLED=true ;;
+ esac
+else
+ GTK_CAIRO_ENABLED=false
+fi;
+
+if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
+
+cat >>confdefs.h <<\_ACEOF
+#define GTK_CAIRO 1
+_ACEOF
+
+fi
+
+
+if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
+ GTK_CAIRO_TRUE=
+ GTK_CAIRO_FALSE='#'
+else
+ GTK_CAIRO_TRUE='#'
+ GTK_CAIRO_FALSE=
+fi
+
+
+# Check whether --enable-qt-peer or --disable-qt-peer was given.
+if test "${enable_qt_peer+set}" = set; then
+ enableval="$enable_qt_peer"
+ case "${enableval}" in
+ yes) COMPILE_QT_PEER=yes ;;
+ no) COMPILE_QT_PEER=no ;;
+ *) COMPILE_QT_PEER=yes ;;
+ esac
+else
+ COMPILE_QT_PEER=no
+fi;
+
+
+if test "x${COMPILE_QT_PEER}" = xyes; then
+ CREATE_QT_PEER_LIBRARIES_TRUE=
+ CREATE_QT_PEER_LIBRARIES_FALSE='#'
+else
+ CREATE_QT_PEER_LIBRARIES_TRUE='#'
+ CREATE_QT_PEER_LIBRARIES_FALSE=
+fi
+
+
+
+
+# Check whether --with-native-libdir or --without-native-libdir was given.
+if test "${with_native_libdir+set}" = set; then
+ withval="$with_native_libdir"
+
+ nativelibdir=${withval}
+
+else
+
+ nativelibdir='${libdir}/${PACKAGE}'
+
+fi;
+
+
+
+
+# Check whether --with-glibj-dir or --without-glibj-dir was given.
+if test "${with_glibj_dir+set}" = set; then
+ withval="$with_glibj_dir"
+
+ glibjdir=${withval}
+
+else
+
+ glibjdir='${datadir}/${PACKAGE}'
+
+fi;
+
+
+
+# Check whether --enable-regen-headers or --disable-regen-headers was given.
+if test "${enable_regen_headers+set}" = set; then
+ enableval="$enable_regen_headers"
+ case "${enableval}" in
+ yes) REGENERATE_JNI_HEADERS=yes ;;
+ no) REGENERATE_JNI_HEADERS=no ;;
+ *) REGENERATE_JNI_HEADERS=no ;;
+ esac
+else
+ REGENERATE_JNI_HEADERS=no
+fi;
+
+
+if test "x${REGENERATE_JNI_HEADERS}" = xyes; then
+ CREATE_JNI_HEADERS_TRUE=
+ CREATE_JNI_HEADERS_FALSE='#'
+else
+ CREATE_JNI_HEADERS_TRUE='#'
+ CREATE_JNI_HEADERS_FALSE=
+fi
+
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+
+GCC_NO_EXECUTABLES
+
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=no
+fi;
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi;
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi;
+
# Check whether --with-gnu-ld or --without-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
withval="$with_gnu_ld"
@@ -3825,7 +4657,6 @@ deplibs_check_method=$lt_cv_deplibs_check_method
-
# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
# find the maximum length of command line arguments
@@ -4222,7 +5053,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 4225 "configure"' > conftest.$ac_ext
+ echo '#line 5056 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -4340,12 +5171,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -4369,8 +5195,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4880,8 +5705,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4939,8 +5763,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5056,8 +5879,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5111,8 +5933,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5157,8 +5978,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5202,8 +6022,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5730,8 +6549,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5789,8 +6607,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5861,8 +6678,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5906,8 +6722,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_cxx_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6306,23 +7121,7 @@ exec 5>>./config.log
if test "x${COMPILE_JNI}" = xyes; then
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -6355,8 +7154,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6522,8 +7320,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6596,8 +7393,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6638,8 +7434,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -6772,78 +7567,6 @@ echo "$as_me: error: unknown endianess - sorry, please pre-set ac_cv_c_bigendian
fi
- # On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-eval "$as_ac_Header=no"
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
@@ -6899,8 +7622,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7150,12 +7872,7 @@ echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -7215,8 +7932,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7282,8 +7998,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7345,8 +8060,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7411,8 +8125,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7458,8 +8171,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7505,12 +8217,7 @@ echo $ECHO_N "checking for tzname... $ECHO_C" >&6
if test "${ac_cv_var_tzname+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -7538,8 +8245,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7599,8 +8305,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7651,8 +8356,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7703,8 +8407,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7811,8 +8514,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -7843,6 +8545,66 @@ _ACEOF
fi
+ echo "$as_me:$LINENO: checking for __attribute__" >&5
+echo $ECHO_N "checking for __attribute__... $ECHO_C" >&6
+if test "${ac_cv_c_attribute+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+void foo(void) __attribute__ ((__noreturn__));
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_attribute=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_attribute=no
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_attribute" >&5
+echo "${ECHO_T}$ac_cv_c_attribute" >&6
+
+
+case $ac_cv_c_attribute in
+ yes) ;;
+ no)
+ cat >>confdefs.h <<_ACEOF
+#define __attribute__(x) /* nothing */
+_ACEOF
+ ;;
+esac
+
if test "X$prefix" = "XNONE"; then
@@ -8425,12 +9187,7 @@ else
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -8457,8 +9214,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8481,12 +9237,7 @@ rm -f conftest.err conftest.$ac_objext \
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -8513,8 +9264,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8604,8 +9354,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -8860,9 +9609,12 @@ echo "$as_me: error: Library requirements (libxslt >= 1.1.11) not met; consider
fi
if test "x${COMPILE_GTK_PEER}" = xyes; then
- echo "$as_me:$LINENO: checking for X" >&5
+
+if test "x$ac_path_x_has_been_run" != xyes; then
+ echo "$as_me:$LINENO: checking for X" >&5
echo $ECHO_N "checking for X... $ECHO_C" >&6
+ac_path_x_has_been_run=yes
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -8955,7 +9707,7 @@ ac_x_header_dirs='
/usr/openwin/share/include'
if test "$ac_x_includes" = no; then
- # Guess where to find include files, by looking for Intrinsic.h.
+ # Guess where to find include files, by looking for a specified header file.
# First, try using that file with no special directory specified.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -8963,7 +9715,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -8990,7 +9742,7 @@ else
sed 's/^/| /' conftest.$ac_ext >&5
for ac_dir in $ac_x_header_dirs; do
- if test -r "$ac_dir/X11/Intrinsic.h"; then
+ if test -r "$ac_dir/X11/Xlib.h"; then
ac_x_includes=$ac_dir
break
fi
@@ -9004,23 +9756,18 @@ if test "$ac_x_libraries" = no; then
# See if we find them without any special options.
# Don't add to $LIBS permanently.
ac_save_LIBS=$LIBS
- LIBS="-lXt $LIBS"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ LIBS="-lX11 $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
int
main ()
{
-XtMalloc (0)
+XrmInitialize ()
;
return 0;
}
@@ -9034,8 +9781,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9059,7 +9805,7 @@ for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
# Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
- if test -r $ac_dir/libXt.$ac_extension; then
+ if test -r $ac_dir/libX11.$ac_extension; then
ac_x_libraries=$ac_dir
break 2
fi
@@ -9095,10 +9841,15 @@ else
# Update the cache value to reflect the command line values.
ac_cv_have_x="have_x=yes \
ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
- echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
-echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
+ # It might be that x_includes is empty (headers are found in the
+ # standard search path. Then output the corresponding message
+ ac_out_x_includes=$x_includes
+ test "x$x_includes" = x && ac_out_x_includes="in standard search path"
+ echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6
fi
+fi
if test "$no_x" = yes; then
# Not all programs may use this symbol, but it does not hurt to define it.
@@ -9122,12 +9873,7 @@ else
echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5
echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6
ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9151,8 +9897,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9179,12 +9924,7 @@ echo "${ECHO_T}no" >&6
X_LIBS="$X_LIBS -R$x_libraries"
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9208,8 +9948,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9254,12 +9993,7 @@ echo "${ECHO_T}neither works" >&6
# libraries were built with DECnet support. And Karl Berry says
# the Alpha needs dnet_stub (dnet does not exist).
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9290,8 +10024,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9315,11 +10048,6 @@ if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldnet $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9351,8 +10079,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9389,11 +10116,6 @@ if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldnet_stub $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9425,8 +10147,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9474,12 +10195,7 @@ echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
if test "${ac_cv_func_gethostbyname+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9539,8 +10255,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9573,11 +10288,6 @@ if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnsl $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9609,8 +10319,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9647,11 +10356,6 @@ if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lbsd $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9683,8 +10387,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9728,12 +10431,7 @@ echo $ECHO_N "checking for connect... $ECHO_C" >&6
if test "${ac_cv_func_connect+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9793,8 +10491,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9827,11 +10524,6 @@ if test "${ac_cv_lib_socket_connect+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -9863,8 +10555,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -9901,12 +10592,7 @@ echo $ECHO_N "checking for remove... $ECHO_C" >&6
if test "${ac_cv_func_remove+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -9966,8 +10652,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10000,11 +10685,6 @@ if test "${ac_cv_lib_posix_remove+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lposix $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -10036,8 +10716,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10074,12 +10753,7 @@ echo $ECHO_N "checking for shmat... $ECHO_C" >&6
if test "${ac_cv_func_shmat+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
-cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -10139,8 +10813,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10173,11 +10846,6 @@ if test "${ac_cv_lib_ipc_shmat+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lipc $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -10209,8 +10877,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10258,11 +10925,6 @@ if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -10294,8 +10956,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10328,23 +10989,18 @@ fi
fi
- if test "$no_x" = yes; then
- { { echo "$as_me:$LINENO: error: GTK+ peers requested but no X library available" >&5
+ if test "$no_x" = yes; then
+ { { echo "$as_me:$LINENO: error: GTK+ peers requested but no X library available" >&5
echo "$as_me: error: GTK+ peers requested but no X library available" >&2;}
{ (exit 1); exit 1; }; }
- fi
- echo "$as_me:$LINENO: checking for XTestQueryExtension in -lXtst" >&5
+ fi
+ echo "$as_me:$LINENO: checking for XTestQueryExtension in -lXtst" >&5
echo $ECHO_N "checking for XTestQueryExtension in -lXtst... $ECHO_C" >&6
if test "${ac_cv_lib_Xtst_XTestQueryExtension+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lXtst ${X_LIBS} $LIBS"
-if test x$gcc_no_link = xyes; then
- { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
-echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
- { (exit 1); exit 1; }; }
-fi
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -10376,8 +11032,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -10509,10 +11164,7 @@ echo "$as_me: error: Library requirements (gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gd
fi
-
- fi
-
- if test "x${COMPILE_QT_PEER}" = xyes; then
+ if test "x${enable_gtk_cairo}" = xyes; then
succeeded=no
@@ -10567,32 +11219,32 @@ fi
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
- echo "$as_me:$LINENO: checking for QtGui >= 4.0.1" >&5
-echo $ECHO_N "checking for QtGui >= 4.0.1... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for cairo >= 0.5.0" >&5
+echo $ECHO_N "checking for cairo >= 0.5.0... $ECHO_C" >&6
- if $PKG_CONFIG --exists "QtGui >= 4.0.1" ; then
+ if $PKG_CONFIG --exists "cairo >= 0.5.0" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
succeeded=yes
- echo "$as_me:$LINENO: checking QT_CFLAGS" >&5
-echo $ECHO_N "checking QT_CFLAGS... $ECHO_C" >&6
- QT_CFLAGS=`$PKG_CONFIG --cflags "QtGui >= 4.0.1"`
- echo "$as_me:$LINENO: result: $QT_CFLAGS" >&5
-echo "${ECHO_T}$QT_CFLAGS" >&6
+ echo "$as_me:$LINENO: checking CAIRO_CFLAGS" >&5
+echo $ECHO_N "checking CAIRO_CFLAGS... $ECHO_C" >&6
+ CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo >= 0.5.0"`
+ echo "$as_me:$LINENO: result: $CAIRO_CFLAGS" >&5
+echo "${ECHO_T}$CAIRO_CFLAGS" >&6
- echo "$as_me:$LINENO: checking QT_LIBS" >&5
-echo $ECHO_N "checking QT_LIBS... $ECHO_C" >&6
- QT_LIBS=`$PKG_CONFIG --libs "QtGui >= 4.0.1"`
- echo "$as_me:$LINENO: result: $QT_LIBS" >&5
-echo "${ECHO_T}$QT_LIBS" >&6
+ echo "$as_me:$LINENO: checking CAIRO_LIBS" >&5
+echo $ECHO_N "checking CAIRO_LIBS... $ECHO_C" >&6
+ CAIRO_LIBS=`$PKG_CONFIG --libs "cairo >= 0.5.0"`
+ echo "$as_me:$LINENO: result: $CAIRO_LIBS" >&5
+echo "${ECHO_T}$CAIRO_LIBS" >&6
else
- QT_CFLAGS=""
- QT_LIBS=""
+ CAIRO_CFLAGS=""
+ CAIRO_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
- QT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "QtGui >= 4.0.1"`
- echo $QT_PKG_ERRORS
+ CAIRO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "cairo >= 0.5.0"`
+ echo $CAIRO_PKG_ERRORS
fi
@@ -10606,104 +11258,13 @@ echo "${ECHO_T}$QT_LIBS" >&6
if test $succeeded = yes; then
:
else
- { { echo "$as_me:$LINENO: error: Library requirements (QtGui >= 4.0.1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (QtGui >= 4.0.1) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+ { { echo "$as_me:$LINENO: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+echo "$as_me: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
{ (exit 1); exit 1; }; }
fi
- QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
- EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
- as_ac_File=`echo "ac_cv_file_$QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $QT_INCLUDE_DIR/QWidget" >&5
-echo $ECHO_N "checking for $QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
-if eval "test \"\${$as_ac_File+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- test "$cross_compiling" = yes &&
- { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
- { (exit 1); exit 1; }; }
-if test -r "$QT_INCLUDE_DIR/QWidget"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
-if test `eval echo '${'$as_ac_File'}'` = yes; then
- { echo "$as_me:$LINENO: No extra QT_INCLUDE_DIR needed" >&5
-echo "$as_me: No extra QT_INCLUDE_DIR needed" >&6;}
-else
- as_ac_File=`echo "ac_cv_file_$EXTRA_QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $EXTRA_QT_INCLUDE_DIR/QWidget" >&5
-echo $ECHO_N "checking for $EXTRA_QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
-if eval "test \"\${$as_ac_File+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- test "$cross_compiling" = yes &&
- { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
- { (exit 1); exit 1; }; }
-if test -r "$EXTRA_QT_INCLUDE_DIR/QWidget"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
-if test `eval echo '${'$as_ac_File'}'` = yes; then
- QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR"
-else
- { echo "$as_me:$LINENO: WARNING: QWidget not found" >&5
-echo "$as_me: WARNING: QWidget not found" >&2;}
-fi
-
-fi
-
- { echo "$as_me:$LINENO: Set QT_CFLAGS... $QT_CFLAGS" >&5
-echo "$as_me: Set QT_CFLAGS... $QT_CFLAGS" >&6;}
- # Extract the first word of "moc", so it can be a program name with args.
-set dummy moc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_MOC+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test -n "$MOC"; then
- ac_cv_prog_MOC="$MOC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_MOC="moc"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-
-fi
-fi
-MOC=$ac_cv_prog_MOC
-if test -n "$MOC"; then
- echo "$as_me:$LINENO: result: $MOC" >&5
-echo "${ECHO_T}$MOC" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-
-
- fi
+ fi
- if test "x${enable_gtk_cairo}" = xyes; then
succeeded=no
@@ -10758,32 +11319,32 @@ fi
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
- echo "$as_me:$LINENO: checking for cairo >= 0.5.0" >&5
-echo $ECHO_N "checking for cairo >= 0.5.0... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for pangoft2" >&5
+echo $ECHO_N "checking for pangoft2... $ECHO_C" >&6
- if $PKG_CONFIG --exists "cairo >= 0.5.0" ; then
+ if $PKG_CONFIG --exists "pangoft2" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
succeeded=yes
- echo "$as_me:$LINENO: checking CAIRO_CFLAGS" >&5
-echo $ECHO_N "checking CAIRO_CFLAGS... $ECHO_C" >&6
- CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo >= 0.5.0"`
- echo "$as_me:$LINENO: result: $CAIRO_CFLAGS" >&5
-echo "${ECHO_T}$CAIRO_CFLAGS" >&6
+ echo "$as_me:$LINENO: checking PANGOFT2_CFLAGS" >&5
+echo $ECHO_N "checking PANGOFT2_CFLAGS... $ECHO_C" >&6
+ PANGOFT2_CFLAGS=`$PKG_CONFIG --cflags "pangoft2"`
+ echo "$as_me:$LINENO: result: $PANGOFT2_CFLAGS" >&5
+echo "${ECHO_T}$PANGOFT2_CFLAGS" >&6
- echo "$as_me:$LINENO: checking CAIRO_LIBS" >&5
-echo $ECHO_N "checking CAIRO_LIBS... $ECHO_C" >&6
- CAIRO_LIBS=`$PKG_CONFIG --libs "cairo >= 0.5.0"`
- echo "$as_me:$LINENO: result: $CAIRO_LIBS" >&5
-echo "${ECHO_T}$CAIRO_LIBS" >&6
+ echo "$as_me:$LINENO: checking PANGOFT2_LIBS" >&5
+echo $ECHO_N "checking PANGOFT2_LIBS... $ECHO_C" >&6
+ PANGOFT2_LIBS=`$PKG_CONFIG --libs "pangoft2"`
+ echo "$as_me:$LINENO: result: $PANGOFT2_LIBS" >&5
+echo "${ECHO_T}$PANGOFT2_LIBS" >&6
else
- CAIRO_CFLAGS=""
- CAIRO_LIBS=""
+ PANGOFT2_CFLAGS=""
+ PANGOFT2_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
- CAIRO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "cairo >= 0.5.0"`
- echo $CAIRO_PKG_ERRORS
+ PANGOFT2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "pangoft2"`
+ echo $PANGOFT2_PKG_ERRORS
fi
@@ -10797,12 +11358,22 @@ echo "${ECHO_T}$CAIRO_LIBS" >&6
if test $succeeded = yes; then
:
else
- { { echo "$as_me:$LINENO: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (cairo >= 0.5.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+ { { echo "$as_me:$LINENO: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+echo "$as_me: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
{ (exit 1); exit 1; }; }
fi
+
+
+
+
+
+
+ fi
+
+ if test "x${COMPILE_QT_PEER}" = xyes; then
+
succeeded=no
if test -z "$PKG_CONFIG"; then
@@ -10856,32 +11427,32 @@ fi
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
- echo "$as_me:$LINENO: checking for pangoft2" >&5
-echo $ECHO_N "checking for pangoft2... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for QtGui >= 4.0.1" >&5
+echo $ECHO_N "checking for QtGui >= 4.0.1... $ECHO_C" >&6
- if $PKG_CONFIG --exists "pangoft2" ; then
+ if $PKG_CONFIG --exists "QtGui >= 4.0.1" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
succeeded=yes
- echo "$as_me:$LINENO: checking PANGOFT2_CFLAGS" >&5
-echo $ECHO_N "checking PANGOFT2_CFLAGS... $ECHO_C" >&6
- PANGOFT2_CFLAGS=`$PKG_CONFIG --cflags "pangoft2"`
- echo "$as_me:$LINENO: result: $PANGOFT2_CFLAGS" >&5
-echo "${ECHO_T}$PANGOFT2_CFLAGS" >&6
+ echo "$as_me:$LINENO: checking QT_CFLAGS" >&5
+echo $ECHO_N "checking QT_CFLAGS... $ECHO_C" >&6
+ QT_CFLAGS=`$PKG_CONFIG --cflags "QtGui >= 4.0.1"`
+ echo "$as_me:$LINENO: result: $QT_CFLAGS" >&5
+echo "${ECHO_T}$QT_CFLAGS" >&6
- echo "$as_me:$LINENO: checking PANGOFT2_LIBS" >&5
-echo $ECHO_N "checking PANGOFT2_LIBS... $ECHO_C" >&6
- PANGOFT2_LIBS=`$PKG_CONFIG --libs "pangoft2"`
- echo "$as_me:$LINENO: result: $PANGOFT2_LIBS" >&5
-echo "${ECHO_T}$PANGOFT2_LIBS" >&6
+ echo "$as_me:$LINENO: checking QT_LIBS" >&5
+echo $ECHO_N "checking QT_LIBS... $ECHO_C" >&6
+ QT_LIBS=`$PKG_CONFIG --libs "QtGui >= 4.0.1"`
+ echo "$as_me:$LINENO: result: $QT_LIBS" >&5
+echo "${ECHO_T}$QT_LIBS" >&6
else
- PANGOFT2_CFLAGS=""
- PANGOFT2_LIBS=""
+ QT_CFLAGS=""
+ QT_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
- PANGOFT2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "pangoft2"`
- echo $PANGOFT2_PKG_ERRORS
+ QT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "QtGui >= 4.0.1"`
+
fi
@@ -10893,18 +11464,177 @@ echo "${ECHO_T}$PANGOFT2_LIBS" >&6
fi
if test $succeeded = yes; then
- :
+ HAVE_QT4="yes"
else
- { { echo "$as_me:$LINENO: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (pangoft2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+ HAVE_QT4="no"
+ fi
+
+ if test "x$HAVE_QT4" = "xyes"; then
+ QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
+ EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
+ as_ac_File=`echo "ac_cv_file_$QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $QT_INCLUDE_DIR/QWidget" >&5
+echo $ECHO_N "checking for $QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+if test -r "$QT_INCLUDE_DIR/QWidget"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+ { echo "$as_me:$LINENO: No extra QT_INCLUDE_DIR needed" >&5
+echo "$as_me: No extra QT_INCLUDE_DIR needed" >&6;}
+else
+ as_ac_File=`echo "ac_cv_file_$EXTRA_QT_INCLUDE_DIR/QWidget" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $EXTRA_QT_INCLUDE_DIR/QWidget" >&5
+echo $ECHO_N "checking for $EXTRA_QT_INCLUDE_DIR/QWidget... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
{ (exit 1); exit 1; }; }
+if test -r "$EXTRA_QT_INCLUDE_DIR/QWidget"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+ QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR"
+else
+ { echo "$as_me:$LINENO: WARNING: QWidget not found" >&5
+echo "$as_me: WARNING: QWidget not found" >&2;}
+fi
+
+fi
+
+ # Extract the first word of "moc", so it can be a program name with args.
+set dummy moc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_MOC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$MOC"; then
+ ac_cv_prog_MOC="$MOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MOC="moc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
+done
+done
+
+fi
+fi
+MOC=$ac_cv_prog_MOC
+if test -n "$MOC"; then
+ echo "$as_me:$LINENO: result: $MOC" >&5
+echo "${ECHO_T}$MOC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ fi
+ if test "x$HAVE_QT4" = "xno"; then
+ { echo "$as_me:$LINENO: Looking for QT_CFLAGS and QT_LIBS without pkg-config" >&5
+echo "$as_me: Looking for QT_CFLAGS and QT_LIBS without pkg-config" >&6;}
+ case "$host_os" in
+ darwin*)
+
+# Check whether --with-qt4dir or --without-qt4dir was given.
+if test "${with_qt4dir+set}" = set; then
+ withval="$with_qt4dir"
+ QT4DIR=$withval
+fi;
+ if test x"$QT4DIR" = x ; then
+ { { echo "$as_me:$LINENO: error: *** No path for Qt4 --with-qt4dir option given" >&5
+echo "$as_me: error: *** No path for Qt4 --with-qt4dir option given" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ echo "$as_me:$LINENO: result: QT4DIR... $QT4DIR" >&5
+echo "${ECHO_T}QT4DIR... $QT4DIR" >&6
+ # Extract the first word of "moc", so it can be a program name with args.
+set dummy moc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_MOC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$MOC"; then
+ ac_cv_prog_MOC="$MOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $QT4DIR/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MOC="$QT4DIR/bin/moc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
+done
+done
+fi
+fi
+MOC=$ac_cv_prog_MOC
+if test -n "$MOC"; then
+ echo "$as_me:$LINENO: result: $MOC" >&5
+echo "${ECHO_T}$MOC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+ if test x"$MOC" = x; then
+ { { echo "$as_me:$LINENO: error: *** This is not the right Qt installation" >&5
+echo "$as_me: error: *** This is not the right Qt installation" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
+ QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
+ QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
+ QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
+ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: *** Please check PKG_CONFIG_PATH or the version
+ of your installed Qt4 installation." >&5
+echo "$as_me: error: *** Please check PKG_CONFIG_PATH or the version
+ of your installed Qt4 installation." >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+ fi
+ { echo "$as_me:$LINENO: Set QT_CFLAGS... $QT_CFLAGS" >&5
+echo "$as_me: Set QT_CFLAGS... $QT_CFLAGS" >&6;}
+ fi
fi
@@ -11347,51 +12077,36 @@ echo "${ECHO_T}no" >&6
fi
fi
-
- if test "x$GCJ" != x; then
- ## GCC version 2 puts out version messages that looked like:
- ## 2.95
-
- ## GCC version 3 puts out version messages like:
- ## gcj (GCC) 3.3.3
- ## Copyright (C) 2003 Free Software Foundation, Inc.
- ## This is free software; see the source for copying conditions. There is NO
- ## warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- echo "$as_me:$LINENO: checking gcj version" >&5
-echo $ECHO_N "checking gcj version... $ECHO_C" >&6
- ## Take the output from gcj --version and extract just the version number
- ## into GCJ_VERSION.
- ## (we need to do this to be compatible with both GCC 2 and GCC 3 version
- ## numbers)
- ##
- ## First, we get rid of everything before the first number on that line.
- ## Assume that the first number on that line is the start of the
- ## version.
- ##
- ## Second, while we're at it, go ahead and get rid of the first character
- ## that is not part of a version number (i.e., is neither a digit nor
- ## a dot).
- ##
- ## Third, quit, so that we won't process the second and subsequent lines.
- GCJ_VERSION=`$GCJ --version | sed -e 's/^[^0-9]*//' -e 's/[^.0-9][^.0-9]*//' -e 'q'`
- GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
- GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
-
- if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
- GCJ=""
- fi
- if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
- if expr "$GCJ_VERSION_MINOR" \< 3; then
- GCJ=""
- fi
- fi
if test "x$GCJ" != x; then
- echo "$as_me:$LINENO: result: $GCJ_VERSION" >&5
-echo "${ECHO_T}$GCJ_VERSION" >&6
+ echo "$as_me:$LINENO: checking gcj version 4.0" >&5
+echo $ECHO_N "checking gcj version 4.0... $ECHO_C" >&6
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+#if __GNUC__ <= 3
+ #error GCJ 4.0.0 or higher is required
+ #endif
+
+_ACEOF
+ $GCJ -E conftest.c > /dev/null
+ gcj_4_result=$?
+ if test "x$gcj_4_result" = "x0"; then
+ echo "$as_me:$LINENO: result: 4.0 or higher found" >&5
+echo "${ECHO_T}4.0 or higher found" >&6
else
- { echo "$as_me:$LINENO: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&5
-echo "$as_me: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&2;}
+ { echo "$as_me:$LINENO: WARNING: 4.0 or higher required" >&5
+echo "$as_me: WARNING: 4.0 or higher required" >&2;}
fi
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
fi
else
@@ -11482,51 +12197,36 @@ echo "${ECHO_T}no" >&6
fi
fi
-
- if test "x$GCJ" != x; then
- ## GCC version 2 puts out version messages that looked like:
- ## 2.95
-
- ## GCC version 3 puts out version messages like:
- ## gcj (GCC) 3.3.3
- ## Copyright (C) 2003 Free Software Foundation, Inc.
- ## This is free software; see the source for copying conditions. There is NO
- ## warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- echo "$as_me:$LINENO: checking gcj version" >&5
-echo $ECHO_N "checking gcj version... $ECHO_C" >&6
- ## Take the output from gcj --version and extract just the version number
- ## into GCJ_VERSION.
- ## (we need to do this to be compatible with both GCC 2 and GCC 3 version
- ## numbers)
- ##
- ## First, we get rid of everything before the first number on that line.
- ## Assume that the first number on that line is the start of the
- ## version.
- ##
- ## Second, while we're at it, go ahead and get rid of the first character
- ## that is not part of a version number (i.e., is neither a digit nor
- ## a dot).
- ##
- ## Third, quit, so that we won't process the second and subsequent lines.
- GCJ_VERSION=`$GCJ --version | sed -e 's/^[^0-9]*//' -e 's/[^.0-9][^.0-9]*//' -e 'q'`
- GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
- GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
-
- if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
- GCJ=""
- fi
- if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
- if expr "$GCJ_VERSION_MINOR" \< 3; then
- GCJ=""
- fi
- fi
if test "x$GCJ" != x; then
- echo "$as_me:$LINENO: result: $GCJ_VERSION" >&5
-echo "${ECHO_T}$GCJ_VERSION" >&6
+ echo "$as_me:$LINENO: checking gcj version 4.0" >&5
+echo $ECHO_N "checking gcj version 4.0... $ECHO_C" >&6
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+#if __GNUC__ <= 3
+ #error GCJ 4.0.0 or higher is required
+ #endif
+
+_ACEOF
+ $GCJ -E conftest.c > /dev/null
+ gcj_4_result=$?
+ if test "x$gcj_4_result" = "x0"; then
+ echo "$as_me:$LINENO: result: 4.0 or higher found" >&5
+echo "${ECHO_T}4.0 or higher found" >&6
else
- { echo "$as_me:$LINENO: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&5
-echo "$as_me: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&2;}
+ { echo "$as_me:$LINENO: WARNING: 4.0 or higher required" >&5
+echo "$as_me: WARNING: 4.0 or higher required" >&2;}
fi
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
fi
fi
@@ -11621,51 +12321,36 @@ echo "${ECHO_T}no" >&6
fi
fi
-
- if test "x$GCJ" != x; then
- ## GCC version 2 puts out version messages that looked like:
- ## 2.95
-
- ## GCC version 3 puts out version messages like:
- ## gcj (GCC) 3.3.3
- ## Copyright (C) 2003 Free Software Foundation, Inc.
- ## This is free software; see the source for copying conditions. There is NO
- ## warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- echo "$as_me:$LINENO: checking gcj version" >&5
-echo $ECHO_N "checking gcj version... $ECHO_C" >&6
- ## Take the output from gcj --version and extract just the version number
- ## into GCJ_VERSION.
- ## (we need to do this to be compatible with both GCC 2 and GCC 3 version
- ## numbers)
- ##
- ## First, we get rid of everything before the first number on that line.
- ## Assume that the first number on that line is the start of the
- ## version.
- ##
- ## Second, while we're at it, go ahead and get rid of the first character
- ## that is not part of a version number (i.e., is neither a digit nor
- ## a dot).
- ##
- ## Third, quit, so that we won't process the second and subsequent lines.
- GCJ_VERSION=`$GCJ --version | sed -e 's/^[^0-9]*//' -e 's/[^.0-9][^.0-9]*//' -e 'q'`
- GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
- GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
-
- if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
- GCJ=""
- fi
- if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
- if expr "$GCJ_VERSION_MINOR" \< 3; then
- GCJ=""
- fi
- fi
if test "x$GCJ" != x; then
- echo "$as_me:$LINENO: result: $GCJ_VERSION" >&5
-echo "${ECHO_T}$GCJ_VERSION" >&6
+ echo "$as_me:$LINENO: checking gcj version 4.0" >&5
+echo $ECHO_N "checking gcj version 4.0... $ECHO_C" >&6
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+#if __GNUC__ <= 3
+ #error GCJ 4.0.0 or higher is required
+ #endif
+
+_ACEOF
+ $GCJ -E conftest.c > /dev/null
+ gcj_4_result=$?
+ if test "x$gcj_4_result" = "x0"; then
+ echo "$as_me:$LINENO: result: 4.0 or higher found" >&5
+echo "${ECHO_T}4.0 or higher found" >&6
else
- { echo "$as_me:$LINENO: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&5
-echo "$as_me: WARNING: $GCJ_VERSION: gcj 3.3 or higher required" >&2;}
+ { echo "$as_me:$LINENO: WARNING: 4.0 or higher required" >&5
+echo "$as_me: WARNING: 4.0 or higher required" >&2;}
fi
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
fi
@@ -13601,10 +14286,12 @@ echo "$as_me: error: bad value ${enableval} for --enable-portable-native-sync" >
esac
fi;
- ac_config_files="$ac_config_files Makefile doc/Makefile doc/api/Makefile external/Makefile external/sax/Makefile external/w3c_dom/Makefile gnu/classpath/Configuration.java include/Makefile native/Makefile native/fdlibm/Makefile native/jawt/Makefile native/jni/Makefile native/jni/classpath/Makefile native/jni/java-io/Makefile native/jni/java-lang/Makefile native/jni/java-net/Makefile native/jni/java-nio/Makefile native/jni/java-util/Makefile native/jni/gtk-peer/Makefile native/jni/qt-peer/Makefile native/jni/xmlj/Makefile native/target/Makefile native/target/Linux/Makefile native/target/generic/Makefile resource/Makefile scripts/Makefile scripts/classpath.spec lib/Makefile lib/gen-classlist.sh examples/Makefile examples/Makefile.jawt"
+ ac_config_files="$ac_config_files Makefile doc/Makefile doc/api/Makefile external/Makefile external/sax/Makefile external/w3c_dom/Makefile gnu/classpath/Configuration.java include/Makefile native/Makefile native/fdlibm/Makefile native/jawt/Makefile native/jni/Makefile native/jni/classpath/Makefile native/jni/java-io/Makefile native/jni/java-lang/Makefile native/jni/java-net/Makefile native/jni/java-nio/Makefile native/jni/java-util/Makefile native/jni/gtk-peer/Makefile native/jni/qt-peer/Makefile native/jni/xmlj/Makefile native/jni/midi-alsa/Makefile native/jni/midi-dssi/Makefile native/target/Makefile native/target/Linux/Makefile native/target/generic/Makefile resource/Makefile scripts/Makefile scripts/classpath.spec lib/Makefile lib/gen-classlist.sh lib/copy-vmresources.sh examples/Makefile examples/Makefile.jawt"
ac_config_commands="$ac_config_commands gen-classlist"
+ ac_config_commands="$ac_config_commands copy-vmresources"
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -13717,6 +14404,34 @@ echo "$as_me: error: conditional \"CREATE_XMLJ_LIBRARY\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${CREATE_ALSA_LIBRARIES_TRUE}" && test -z "${CREATE_ALSA_LIBRARIES_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"CREATE_ALSA_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"CREATE_ALSA_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${CREATE_DSSI_LIBRARIES_TRUE}" && test -z "${CREATE_DSSI_LIBRARIES_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"CREATE_DSSI_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"CREATE_DSSI_LIBRARIES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${CREATE_GTK_PEER_LIBRARIES_TRUE}" && test -z "${CREATE_GTK_PEER_LIBRARIES_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"CREATE_GTK_PEER_LIBRARIES\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -13745,20 +14460,6 @@ echo "$as_me: error: conditional \"CREATE_JNI_HEADERS\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -14156,7 +14857,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by GNU Classpath $as_me 0.18, which was
+This file was extended by GNU Classpath $as_me 0.20-pre, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14222,7 +14923,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-GNU Classpath config.status 0.18
+GNU Classpath config.status 0.20-pre
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -14353,6 +15054,8 @@ do
"native/jni/gtk-peer/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/gtk-peer/Makefile" ;;
"native/jni/qt-peer/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/qt-peer/Makefile" ;;
"native/jni/xmlj/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/xmlj/Makefile" ;;
+ "native/jni/midi-alsa/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/midi-alsa/Makefile" ;;
+ "native/jni/midi-dssi/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/jni/midi-dssi/Makefile" ;;
"native/target/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/target/Makefile" ;;
"native/target/Linux/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/target/Linux/Makefile" ;;
"native/target/generic/Makefile" ) CONFIG_FILES="$CONFIG_FILES native/target/generic/Makefile" ;;
@@ -14361,11 +15064,13 @@ do
"scripts/classpath.spec" ) CONFIG_FILES="$CONFIG_FILES scripts/classpath.spec" ;;
"lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
"lib/gen-classlist.sh" ) CONFIG_FILES="$CONFIG_FILES lib/gen-classlist.sh" ;;
+ "lib/copy-vmresources.sh" ) CONFIG_FILES="$CONFIG_FILES lib/copy-vmresources.sh" ;;
"examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
"examples/Makefile.jawt" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile.jawt" ;;
"$ac_config_links_1" ) CONFIG_LINKS="$CONFIG_LINKS $ac_config_links_1" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"gen-classlist" ) CONFIG_COMMANDS="$CONFIG_COMMANDS gen-classlist" ;;
+ "copy-vmresources" ) CONFIG_COMMANDS="$CONFIG_COMMANDS copy-vmresources" ;;
"include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -14496,16 +15201,6 @@ s,@CREATE_CORE_JNI_LIBRARIES_FALSE@,$CREATE_CORE_JNI_LIBRARIES_FALSE,;t t
s,@default_toolkit@,$default_toolkit,;t t
s,@CREATE_XMLJ_LIBRARY_TRUE@,$CREATE_XMLJ_LIBRARY_TRUE,;t t
s,@CREATE_XMLJ_LIBRARY_FALSE@,$CREATE_XMLJ_LIBRARY_FALSE,;t t
-s,@CREATE_GTK_PEER_LIBRARIES_TRUE@,$CREATE_GTK_PEER_LIBRARIES_TRUE,;t t
-s,@CREATE_GTK_PEER_LIBRARIES_FALSE@,$CREATE_GTK_PEER_LIBRARIES_FALSE,;t t
-s,@GTK_CAIRO_ENABLED@,$GTK_CAIRO_ENABLED,;t t
-s,@GTK_CAIRO_TRUE@,$GTK_CAIRO_TRUE,;t t
-s,@GTK_CAIRO_FALSE@,$GTK_CAIRO_FALSE,;t t
-s,@CREATE_QT_PEER_LIBRARIES_TRUE@,$CREATE_QT_PEER_LIBRARIES_TRUE,;t t
-s,@CREATE_QT_PEER_LIBRARIES_FALSE@,$CREATE_QT_PEER_LIBRARIES_FALSE,;t t
-s,@CREATE_JNI_HEADERS_TRUE@,$CREATE_JNI_HEADERS_TRUE,;t t
-s,@CREATE_JNI_HEADERS_FALSE@,$CREATE_JNI_HEADERS_FALSE,;t t
-s,@LN_S@,$LN_S,;t t
s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t
@@ -14522,10 +15217,27 @@ s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
s,@CCDEPMODE@,$CCDEPMODE,;t t
s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@CREATE_ALSA_LIBRARIES_TRUE@,$CREATE_ALSA_LIBRARIES_TRUE,;t t
+s,@CREATE_ALSA_LIBRARIES_FALSE@,$CREATE_ALSA_LIBRARIES_FALSE,;t t
+s,@CREATE_DSSI_LIBRARIES_TRUE@,$CREATE_DSSI_LIBRARIES_TRUE,;t t
+s,@CREATE_DSSI_LIBRARIES_FALSE@,$CREATE_DSSI_LIBRARIES_FALSE,;t t
+s,@CREATE_GTK_PEER_LIBRARIES_TRUE@,$CREATE_GTK_PEER_LIBRARIES_TRUE,;t t
+s,@CREATE_GTK_PEER_LIBRARIES_FALSE@,$CREATE_GTK_PEER_LIBRARIES_FALSE,;t t
+s,@GTK_CAIRO_ENABLED@,$GTK_CAIRO_ENABLED,;t t
+s,@GTK_CAIRO_TRUE@,$GTK_CAIRO_TRUE,;t t
+s,@GTK_CAIRO_FALSE@,$GTK_CAIRO_FALSE,;t t
+s,@CREATE_QT_PEER_LIBRARIES_TRUE@,$CREATE_QT_PEER_LIBRARIES_TRUE,;t t
+s,@CREATE_QT_PEER_LIBRARIES_FALSE@,$CREATE_QT_PEER_LIBRARIES_FALSE,;t t
+s,@nativelibdir@,$nativelibdir,;t t
+s,@glibjdir@,$glibjdir,;t t
+s,@CREATE_JNI_HEADERS_TRUE@,$CREATE_JNI_HEADERS_TRUE,;t t
+s,@CREATE_JNI_HEADERS_FALSE@,$CREATE_JNI_HEADERS_FALSE,;t t
+s,@LN_S@,$LN_S,;t t
s,@RANLIB@,$RANLIB,;t t
s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@LIBTOOL@,$LIBTOOL,;t t
-s,@CPP@,$CPP,;t t
s,@CXX@,$CXX,;t t
s,@CXXFLAGS@,$CXXFLAGS,;t t
s,@ac_ct_CXX@,$ac_ct_CXX,;t t
@@ -14533,7 +15245,6 @@ s,@CXXDEPMODE@,$CXXDEPMODE,;t t
s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
s,@CXXCPP@,$CXXCPP,;t t
-s,@EGREP@,$EGREP,;t t
s,@LIBICONV@,$LIBICONV,;t t
s,@LTLIBICONV@,$LTLIBICONV,;t t
s,@WARNING_CFLAGS@,$WARNING_CFLAGS,;t t
@@ -14550,13 +15261,13 @@ s,@X_LIBS@,$X_LIBS,;t t
s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t
s,@GTK_LIBS@,$GTK_LIBS,;t t
-s,@QT_CFLAGS@,$QT_CFLAGS,;t t
-s,@QT_LIBS@,$QT_LIBS,;t t
-s,@MOC@,$MOC,;t t
s,@CAIRO_CFLAGS@,$CAIRO_CFLAGS,;t t
s,@CAIRO_LIBS@,$CAIRO_LIBS,;t t
s,@PANGOFT2_CFLAGS@,$PANGOFT2_CFLAGS,;t t
s,@PANGOFT2_LIBS@,$PANGOFT2_LIBS,;t t
+s,@QT_CFLAGS@,$QT_CFLAGS,;t t
+s,@QT_LIBS@,$QT_LIBS,;t t
+s,@MOC@,$MOC,;t t
s,@USER_JAVAH@,$USER_JAVAH,;t t
s,@USER_SPECIFIED_JAVAH_TRUE@,$USER_SPECIFIED_JAVAH_TRUE,;t t
s,@USER_SPECIFIED_JAVAH_FALSE@,$USER_SPECIFIED_JAVAH_FALSE,;t t
@@ -14775,11 +15486,6 @@ esac
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
@@ -14818,6 +15524,12 @@ echo "$as_me: error: cannot find input file: $f" >&2;}
fi;;
esac
done` || { (exit 1); exit 1; }
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
@@ -15430,6 +16142,7 @@ echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
done
;;
gen-classlist ) chmod 755 lib/gen-classlist.sh ;;
+ copy-vmresources ) chmod 755 lib/copy-vmresources.sh ;;
esac
done
_ACEOF
diff --git a/libjava/classpath/configure.ac b/libjava/classpath/configure.ac
index 8a39cb037db..d13526b5b9b 100644
--- a/libjava/classpath/configure.ac
+++ b/libjava/classpath/configure.ac
@@ -6,7 +6,7 @@ dnl -----------------------------------------------------------
dnl define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
-AC_INIT([GNU Classpath],[0.18],[classpath@gnu.org],[classpath])
+AC_INIT([GNU Classpath],[0.20-pre],[classpath@gnu.org],[classpath])
AC_CONFIG_SRCDIR(java/lang/System.java)
AC_CANONICAL_TARGET
@@ -65,15 +65,15 @@ AC_ARG_ENABLE([core-jni],
[COMPILE_CORE_JNI=yes])
AM_CONDITIONAL(CREATE_CORE_JNI_LIBRARIES, test "x${COMPILE_CORE_JNI}" = xyes)
-dnl -----------------------------------------------------------
-dnl Whether to compile with -Werror or not (enabled by default)
-dnl -----------------------------------------------------------
+dnl ------------------------------------------------------------
+dnl Whether to compile with -Werror or not (disabled by default)
+dnl ------------------------------------------------------------
AC_ARG_ENABLE([Werror],
- [AS_HELP_STRING(--disable-Werror,whether to compile C code with -Werror which turns any compiler warning into a compilation failure [default=no])],
+ [AS_HELP_STRING(--enable-Werror,whether to compile C code with -Werror which turns any compiler warning into a compilation failure [default=no])],
[case "${enableval}" in
yes) ENABLE_WERROR=yes ;;
no) ENABLE_WERROR=no ;;
- *) ENABLE_WERROR=yes ;;
+ *) ENABLE_WERROR=no ;;
esac],
[ENABLE_WERROR=no])
@@ -103,6 +103,32 @@ AC_ARG_ENABLE([xmlj],
AM_CONDITIONAL(CREATE_XMLJ_LIBRARY, test "x${COMPILE_XMLJ}" = xyes)
dnl -----------------------------------------------------------
+dnl ALSA code (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([alsa],
+ [AS_HELP_STRING(--disable-alsa,compile ALSA providers (enable by --enable-alsa) [default=yes])],
+ [case "${enableval}" in
+ yes) COMPILE_ALSA=yes ;;
+ no) COMPILE_ALSA=no ;;
+ *) COMPILE_ALSA=yes ;;
+ esac],
+ [AC_CHECK_HEADERS([alsa/asoundlib.h],COMPILE_ALSA=yes,COMPILE_ALSA=no)])
+AM_CONDITIONAL(CREATE_ALSA_LIBRARIES, test "x${COMPILE_ALSA}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl DSSI code (enabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([dssi],
+ [AS_HELP_STRING(--disable-dssi,compile DSSI providers (enable by --enable-dssi) [default=yes])],
+ [case "${enableval}" in
+ yes) COMPILE_DSSI=yes ;;
+ no) COMPILE_DSSI=no ;;
+ *) COMPILE_DSSI=yes ;;
+ esac],
+ [AC_CHECK_HEADERS([dssi.h],COMPILE_DSSI=yes,COMPILE_DSSI=no)])
+AM_CONDITIONAL(CREATE_DSSI_LIBRARIES, test "x${COMPILE_DSSI}" = xyes)
+
+dnl -----------------------------------------------------------
dnl GTK native peer (enabled by default)
dnl -----------------------------------------------------------
AC_ARG_ENABLE([gtk-peer],
@@ -150,6 +176,35 @@ AC_ARG_ENABLE([qt-peer],
[COMPILE_QT_PEER=no])
AM_CONDITIONAL(CREATE_QT_PEER_LIBRARIES, test "x${COMPILE_QT_PEER}" = xyes)
+
+dnl -----------------------------------------------------------
+dnl Sets the native libraries installation dir
+dnl -----------------------------------------------------------
+AC_ARG_WITH([native-libdir],
+ [AS_HELP_STRING(--with-native-libdir,sets the installation directore for native libraries [default='${libdir}/${PACKAGE}'])],
+ [
+ nativelibdir=${withval}
+ ],
+ [
+ nativelibdir='${libdir}/${PACKAGE}'
+ ])
+
+AC_SUBST(nativelibdir)
+
+dnl -----------------------------------------------------------
+dnl Sets the Java library installation dir.
+dnl -----------------------------------------------------------
+AC_ARG_WITH([glibj-dir],
+ [AS_HELP_STRING(--with-glibj-dir,sets the installation directory for glibj.zip [default='${libdir}/${PACKAGE}'])],
+ [
+ glibjdir=${withval}
+ ],
+ [
+ glibjdir='${datadir}/${PACKAGE}'
+ ])
+
+AC_SUBST(glibjdir)
+
dnl -----------------------------------------------------------
dnl Regenerate headers at build time (disabled by default)
dnl -----------------------------------------------------------
@@ -246,6 +301,7 @@ if test "x${COMPILE_JNI}" = xyes; then
[AC_MSG_RESULT(no)])])])
AC_C_CONST
+ AC_C_ATTRIBUTE
dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
AM_ICONV
@@ -286,45 +342,78 @@ if test "x${COMPILE_JNI}" = xyes; then
dnl Check for AWT related gthread/gtk
if test "x${COMPILE_GTK_PEER}" = xyes; then
- AC_PATH_XTRA
- if test "$no_x" = yes; then
- AC_MSG_ERROR([GTK+ peers requested but no X library available])
- fi
- dnl We explicitly want the XTest Extension for Robot support.
- AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
- [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
- [${X_LIBS}])
- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
- AC_SUBST(GTK_CFLAGS)
- AC_SUBST(GTK_LIBS)
+ AC_PATH_XTRA
+ if test "$no_x" = yes; then
+ AC_MSG_ERROR([GTK+ peers requested but no X library available])
+ fi
+ dnl We explicitly want the XTest Extension for Robot support.
+ AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
+ [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
+ [${X_LIBS}])
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
+
+ if test "x${enable_gtk_cairo}" = xyes; then
+ PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
+ fi
+
+ PKG_CHECK_MODULES(PANGOFT2, pangoft2)
+
+ AC_SUBST(GTK_CFLAGS)
+ AC_SUBST(GTK_LIBS)
+ AC_SUBST(CAIRO_LIBS)
+ AC_SUBST(CAIRO_CFLAGS)
+ AC_SUBST(PANGOFT2_LIBS)
+ AC_SUBST(PANGOFT2_CFLAGS)
fi
dnl Check for AWT related Qt4
if test "x${COMPILE_QT_PEER}" = xyes; then
- PKG_CHECK_MODULES(QT, QtGui >= 4.0.1)
- dnl Check needed because in some cases the QtGui includedir
- dnl doesn't contain the subsystem dir.
- QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
- EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
- AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
- AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
- AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
- QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
- AC_MSG_WARN([QWidget not found])))
+ PKG_CHECK_MODULES(QT, QtGui >= 4.0.1, HAVE_QT4="yes", HAVE_QT4="no")
+ if test "x$HAVE_QT4" = "xyes"; then
+ dnl Check needed because in some cases the QtGui includedir
+ dnl doesn't contain the subsystem dir.
+ QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
+ EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
+ AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
+ AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
+ AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
+ QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
+ AC_MSG_WARN([QWidget not found])))
+ AC_CHECK_PROG(MOC, [moc], [moc])
+ fi
+ if test "x$HAVE_QT4" = "xno"; then
+ AC_MSG_NOTICE([Looking for QT_CFLAGS and QT_LIBS without pkg-config])
+ case "$host_os" in
+ darwin*)
+ AC_ARG_WITH([qt4dir],
+ [AS_HELP_STRING([--with-qt4dir=DIR],
+ [Qt4 installation directory used for OS-X.
+ For other systems use pkg-config.])],
+ [QT4DIR=$withval]
+ )
+ if test x"$QT4DIR" = x ; then
+ AC_MSG_ERROR([*** No path for Qt4 --with-qt4dir option given])
+ fi
+ AC_MSG_RESULT([QT4DIR... $QT4DIR])
+ AC_CHECK_PROG(MOC, [moc], [$QT4DIR/bin/moc], [], $QT4DIR/bin)
+ if test x"$MOC" = x; then
+ AC_MSG_ERROR([*** This is not the right Qt installation])
+ fi
+ QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
+ QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
+ QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
+ QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
+ ;;
+ *)
+ AC_MSG_ERROR([*** Please check PKG_CONFIG_PATH or the version
+ of your installed Qt4 installation.])
+ ;;
+ esac
+ fi
AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
- AC_CHECK_PROG(MOC, [moc], [moc])
AC_SUBST(QT_CFLAGS)
AC_SUBST(QT_LIBS)
fi
-
- if test "x${enable_gtk_cairo}" = xyes; then
- PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
- PKG_CHECK_MODULES(PANGOFT2, pangoft2)
- fi
- AC_SUBST(CAIRO_LIBS)
- AC_SUBST(CAIRO_CFLAGS)
- AC_SUBST(PANGOFT2_LIBS)
- AC_SUBST(PANGOFT2_CFLAGS)
fi
CLASSPATH_WITH_JAVAH
@@ -493,6 +582,8 @@ native/jni/java-util/Makefile
native/jni/gtk-peer/Makefile
native/jni/qt-peer/Makefile
native/jni/xmlj/Makefile
+native/jni/midi-alsa/Makefile
+native/jni/midi-dssi/Makefile
native/target/Makefile
native/target/Linux/Makefile
native/target/generic/Makefile
@@ -501,7 +592,9 @@ scripts/Makefile
scripts/classpath.spec
lib/Makefile
lib/gen-classlist.sh
+lib/copy-vmresources.sh
examples/Makefile
examples/Makefile.jawt])
AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
+AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh])
AC_OUTPUT
diff --git a/libjava/classpath/doc/Makefile.in b/libjava/classpath/doc/Makefile.in
index fe23b3a65e4..34bdbb19c16 100644
--- a/libjava/classpath/doc/Makefile.in
+++ b/libjava/classpath/doc/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in texinfo.tex
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -84,10 +82,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -224,6 +226,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -237,6 +240,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/doc/api/Makefile.in b/libjava/classpath/doc/api/Makefile.in
index c0b6e87312d..dafdd41f5b5 100644
--- a/libjava/classpath/doc/api/Makefile.in
+++ b/libjava/classpath/doc/api/Makefile.in
@@ -40,10 +40,8 @@ target_triplet = @target@
subdir = doc/api
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -77,10 +75,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -217,6 +219,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -230,6 +233,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/doc/www.gnu.org/announce/20050906.wml b/libjava/classpath/doc/www.gnu.org/announce/20050906.wml
new file mode 100644
index 00000000000..2f95d58b3b9
--- /dev/null
+++ b/libjava/classpath/doc/www.gnu.org/announce/20050906.wml
@@ -0,0 +1,221 @@
+#!wml --include=..
+
+#use wml::std::page
+#use wml::std::lang
+#use wml::fmt::isolatin
+#use wml::std::case global=upper
+
+<lang:star:slice:>
+
+<set-var last-modified-author="mjw">
+
+#include <include/macros.wml>
+
+<header title="GNU Classpath 0.18 Announcement (2005-09-06)">
+<pre>
+GNU Classpath 0.18 released.
+
+We are pleased to announce a new developer snapshot of GNU Classpath.
+
+GNU Classpath, essential libraries for java, is a project to create free
+core class libraries for use with runtimes, compilers and tools for the
+java programming language.
+
+The GNU Classpath developer snapshot releases are not directly aimed
+at the end user but are meant to be integrated into larger development
+platforms. For example the GCC (gcj) and Kaffe projects will use the
+developer snapshots as a base for future versions.
+
+This is our first release after "The Big Merge" with GCC/GCJ. GNU
+Classpath can now be used as a subdirectory of libgcj inside the GCC
+tree so it will be much easier to keep GCC up-to-date with the latest
+GNU Classpath developer release snapshots.
+
+Some highlights of changes in this release (more extensive list below):
+
+ Added GNU JAWT for awt native interface support. Datatransfer
+ clipboard updated to 1.5 including support for copy/paste of
+ serialized objects, images and files. Completed the org.omg
+ PortableInterceptor, DynamicAny and Portable Object Adapter
+ packages. Multi plaf support for Free Swing. Editing support for
+ JTree and JTable. Lots of icons and look and feel improvements for
+ Free Swing basic and metal themes. NIO FileChannel.map implemented
+ and DirectByteBuffer put method speedups. Image loading speedups for
+ awt. Support for darwin and solaris out of the box.
+
+29 people actively contributed to this release and made 535 CVS
+commits during the two months of development. diffstat since 0.17:
+ 994 files changed, 114744 insertions(+), 13663 deletions(-)
+
+More details about the various changes and contributions below.
+
+A full list of bug reports fixed for this release can be found at:
+http://gcc.gnu.org/bugzilla/buglist.cgi?product=classpath&target_milestone=0.18
+
+This release depends on gtk+ 2.4 for AWT support. But gtk+ 2.6 or
+higher is recommended. Included, but not activated by default in this
+release is a Graphics2D implementation based on the Cairo Graphics
+framework (http://www.cairographics.org). Enabling this makes programs
+like JFreeChart and JEdit start up on GNU Classpath based runtimes.
+To enable this support install the cairo 0.5.x snapshot, configure GNU
+Classpath with --enable-gtk-cairo.
+
+One of the major focuses of the GNU Classpath project is expanding
+and using the Mauve test suite for Compatibility, Completeness and
+Correctness checking. Various groups around GNU Classpath collaborate
+on the free software Mauve test suite which contains 32.000+ core
+library tests. Mauve has various modules for testing core class
+library implementations, byte code verifiers, source to byte code and
+native code compiler tests. Mauve also contains the Wonka visual test
+suite and the Jacks Compiler Killer Suite.
+See for more information: http://www.sourceware.org/mauve/
+This release passes 31194 out of 32253 Mauve core library tests.
+
+Conformance reports for the included jaxp support can be found in the
+doc/README.jaxp file.
+
+GNU Classpath 0.18 can be downloaded from
+ftp://ftp.gnu.org/pub/gnu/classpath/
+or one of the ftp.gnu.org mirrors
+http://www.gnu.org/order/ftp.html
+
+File: classpath-0.18.tar.gz
+MD5sum: c0650c257aa93eafb709553f172f0bbb
+SHA1sum: 28061c750244cac4ff0151da6aba183b94b98b25
+
+The GNU Classpath developers site http://developer.classpath.org/
+provides detailed information on how to start with helping the GNU
+Classpath project and gives an overview of the core class library
+packages currently provided. For each snapshot release generated
+documentation is provided through the GNU Classpath Tools gjdoc
+project. A documentation generation framework for java source
+files used by the GNU project. Full documentation on the currently
+implementated packages and classes can be found at:
+http://developer.classpath.org/doc/
+
+New in release 0.18 (Sep 6, 2005)
+(See the ChangeLog file for a full list of changes.)
+
+* GNU JAWT implementation, the AWT Native Interface, which allows
+ direct access to native screen resources from within a Canvas's
+ paint method. GNU Classpath Examples comes with a Demo, see
+ examples/README.
+* awt.datatransfer updated to 1.5 with supports for FlavorEvents.
+ The gtk+ awt peers now allow copy/paste of text, images, uris/files
+ and serialized objects with other applications and tracking
+ clipboard change events with gtk+ 2.6 (for gtk+ 2.4 only text and
+ serialized objects are supported). A GNU Classpath Examples
+ datatransfer Demo was added to show the new functionality.
+* org.omg.PortableInterceptor and related functionality in other
+ packages is now implemented:
+ - The sever and client interceptors work as required since 1.4.
+ - The IOR interceptor works as needed for 1.5.
+* The org.omg.DynamicAny package is completed and passes the prepared
+ tests.
+* The Portable Object Adapter should now support the output of the
+ recent IDL to java compilers. These compilers now generate servants and
+ not CORBA objects as before, making the output depended on the existing
+ POA implementation. Completing POA means that such code can already be
+ tried to run on Classpath. Our POA is tested for the following usager
+ scenarios:
+ - POA converts servant to the CORBA object.
+ - Servant provides to the CORBA object.
+ - POA activates new CORBA object with the given Object Id
+ (byte array) that is later accessible for the servant.
+ - During the first call, the ServantActivator provides servant for
+ this and all subsequent calls on the current object.
+ - During each call, the ServantLocator provides servant for this call
+ only.
+ - ServantLocator or ServantActivator forwards call to another server.
+ - POA has a single servant, responsible for all objects.
+ - POA has a default servant, but some objects are explicitly
+ connected to they specific servants.
+ The POA is verified using tests from the former cost.omg.org.
+* The javax.swing.plaf.multi.* package is now implemented.
+* Editing and several key actions for JTree and JTable were implemented.
+* Lots of icons and look and feel improvements for Free Swing basic
+ and metal themes were added. Try running the GNU Classpath Swing
+ Demo in examples (gnu.classpath.examples.swing.Demo) with:
+ -Dswing.defaultlaf=javax.swing.plaf.basic.BasicLookAndFeel
+ -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel
+* Start of styled text capabilites for java.swing.text.
+* NIO FileChannel.map implementation, fast bulk put implementation for
+ DirectByteBuffer (speeds up this method 10x).
+* Split gtk+ awt peers event handling in two threads and improve gdk
+ lock handling (solves several AWT lock ups).
+* Speed up awt Image loading.
+* Updated TimeZone data against Olson tzdata2005l.
+* Make zip and jar UTF-8 "clean".
+* "native" code builds and compiles (warning free) on Darwin and
+ Solaris.
+
+Runtime interface changes:
+
+* All native resource "pointers" in the VM interface classes are now
+ exposed as gnu.classpath.Pointer objects. This might impact runtimes
+ that optimize and support java.nio.DirectByteBuffers. Creating these
+ classes and accessing the contents as void * pointers for the native
+ reference JNI implementation is done through the
+ JCL_NewRawDataObject and JCL_GetRawData functions.
+* Simplified the Class/VMClass interface.
+* Removed loadedClasses map from ClassLoader. It's now the VMs
+ responsibility to manage the list of defined and loaded classes for
+ each class loader.
+* Moved native methods from java.lang.reflect.Proxy to VMProxy.
+* Added hook to VMClassLoader to allow VM to do class caching.
+
+New Untested/Disabled Features:
+
+ The following new features are included, but not ready for
+ production yet. They are explicitly disabled and not supported. But
+ if you want to help with the development of these new features we
+ are interested in feedback. You will have to explicitly enable them
+ to try them out (and they will most likely contain bugs). If you are
+ interested in any of these then please join the mailing-list and
+ follow development in CVS.
+
+* QT4 AWT peers, enable by giving configure --enable-qt-peer.
+* JDWP framework, enable by deleting the jdwp references from
+ lib/standard.omit and vm/reference/standard.omit. No default
+ implementation is provided. Work is being done on gcj/gij
+ integration.
+* StAX java.xml.stream, enable by deleting the gnu.xml.stream and
+ java.xml.stream references in lib/standard.omit.
+
+The following people helped with this release:
+
+Aaron Luchko (Lots of JDWP work)
+Andreas Tobler (Darwin and Solaris testing and fixing
+Andrew Haley (gcj build speedups)
+Anthony Balkissoon (Lots of Free Swing work including JTable editing)
+Archie Cobbs (Build fixes)
+Audrius Meskauskas (Lots of omg corba work plus testing and documenting)
+Bastiaan Huisman (TimeZone bug fixing)
+Casey Marshall (NIO FileChannel.map support, security and policy updates)
+Chris Burdess (StAX work and gnu xml fixes)
+Christian Schlichtherle (Zip fixes and cleanups)
+Christian Thalinger (64-bit cleanups)
+Dalibor Topic (Qt4 build infrastructure)
+David Gilbert (Basic and Metal icon and plaf and lots of documenting)
+Guilhem Lavaux (JCL native Pointer updates)
+Ingo Proetel (Image, Logger and URLClassLoader updates)
+Ito Kazumitsu (NetworkInterfaces implementation and updates)
+Jan Roehrich (BasicTreeUI updates)
+Jeroen Frijters (VMProxy and VMClassLoader updates, RMIClassLoader fixes)
+Keith Seitz (Lots of JDWP work)
+Kelley Cook (Build fixes)
+Lillian Angel (Lots of Free Swing work including JTree editing)
+Mark Wielaard (Clipboard implementation, build and release infrastructure)
+Rainer Orth (Build fixes)
+Robert Schuster (Documentation updates and beans fixes)
+Roman Kennke (Lots of Free Swing work including styled text)
+Sven de Marothy (Qt4 peers)
+Thomas Fitzsimmons (Lots of gtk+ awt peer work)
+Tom Tromey (Lots of fixes including coordinating The Big Merge)
+Wolfgang Baer (GapContent bug fixes)
+
+We would also like to thank the numerous bug reporters and testers!
+
+</pre>
+
+<footer>
diff --git a/libjava/classpath/doc/www.gnu.org/announce/20051102.wml b/libjava/classpath/doc/www.gnu.org/announce/20051102.wml
new file mode 100644
index 00000000000..e39a4eaa5c5
--- /dev/null
+++ b/libjava/classpath/doc/www.gnu.org/announce/20051102.wml
@@ -0,0 +1,247 @@
+#!wml --include=..
+
+#use wml::std::page
+#use wml::std::lang
+#use wml::fmt::isolatin
+#use wml::std::case global=upper
+
+<lang:star:slice:>
+
+<set-var last-modified-author="mjw">
+
+#include <include/macros.wml>
+
+<header title="GNU Classpath 0.19 Announcement (2005-11-02)">
+<pre>
+GNU Classpath "95% and counting" 0.19 released
+
+GNU Classpath, essential libraries for java, is a project to create
+free core class libraries for use with runtimes, compilers and tools
+for the java programming language.
+
+The GNU Classpath developer snapshot releases are not directly aimed
+at the end user but are meant to be integrated into larger development
+platforms. For example the GCC (gcj) and Kaffe projects will use the
+developer snapshots as a base for future versions.
+
+Some highlights of changes in this release (more extensive list below):
+
+ Much more efficient painting for large Free Swing GUIs. Improved
+ accessibility support. HttpURLConnection rewrite. Official CORBA
+ VMCID assigned. Start of RMI over IIOP support. Qt4 support for
+ OS-X. Much improved Free Swing Metal theme. Free Swing Demo includes
+ theme switcher example (Metal, Ocean, GNU). JBoss now starts up and
+ Jonas testsuite passes for 95%. Support for the javax.sound.midi
+ framework and experimental DSSI and ALSA service providers. Early
+ version of the popular StAX API. Now has 96% coverage of 1.4 API.
+
+This is the first time we also have a pre-release of our 1.5 generics
+work. classpath-0.19-generics contains a version of the core library
+that uses the new 1.5 language features such as generics and
+enumerations. ECJ and JamVM are known to support the generics release
+out of the box. And you should be able to run Eclipse 3.1 with it to
+develop programs that use the new 1.5 language and core library
+additions. classpath-generics is a work in progress and not as
+extensively tested as our regular releases. But please try it out if
+you want to help us test the new 1.5 support of the core libraries.
+
+For this release we setup a Free Swing Test Application page
+http://developer.classpath.org/mediation/FreeSwingTestApps
+Please see that page for showcases of applications that work with this
+release and to help test other applications.
+
+It is also the first release that has GNU Classpath promotion banners.
+http://developer.classpath.org/mediation/ClasspathBanners
+Please feel free to add them to your project pages if your project is
+known to work with GNU Classpath or just to promote the project.
+
+32 people actively contributed to this release and made
+787 CVS commits during the last two months of development
+(excluding the generics branch work). diffstat since 0.18:
+ 1158 files changed, 93916 insertions(+), 36407 deletions(-)
+
+More details about the various changes and contributions below.
+
+A full list of bug reports fixed for this release can be found at:
+http://gcc.gnu.org/bugzilla/buglist.cgi?product=classpath&target_milestone=0.19
+
+This release depends on gtk+ 2.4 for AWT support. But gtk+ 2.6 or
+higher is recommended. Included, but not activated by default in this
+release is a Graphics2D implementation based on the Cairo Graphics
+framework (http://www.cairographics.org). Enabling this makes programs
+like JFreeChart and JEdit start up on GNU Classpath based runtimes.
+To enable this support install the cairo 0.5.x snapshot, configure GNU
+Classpath with --enable-gtk-cairo.
+
+One of the major focuses of the GNU Classpath project is expanding and
+using the Mauve test suite for Compatibility, Completeness and
+Correctness checking. Various groups around GNU Classpath collaborate
+on the free software Mauve test suite which contains around 34.000
+core library tests. Mauve has various modules for testing core class
+library implementations, byte code verifiers, source to byte code and
+native code compiler tests. Mauve also contains the Wonka visual test
+suite and the Jacks Compiler Killer Suite.
+See for more information: http://www.sourceware.org/mauve/
+This release passes 33.381 out of 34.262 Mauve core library tests.
+
+Conformance reports for the included jaxp support can be found in the
+doc/README.jaxp file.
+
+GNU Classpath 0.19 can be downloaded from
+ftp://ftp.gnu.org/pub/gnu/classpath/
+or one of the ftp.gnu.org mirrors
+http://www.gnu.org/order/ftp.html
+
+File: classpath-0.19.tar.gz
+MD5sum: 0b93b1c1dd3d33ef7fb6a47dbb29e41d
+SHA1sum: 43d499e8b83e04a7fc4a1d4d301638c5cec6c679
+
+File: classpath-0.19-generics.tar.gz (EXPERIMENTAL)
+MD5sum: 4c0ccc91a147af4010d19f48dbf441b3
+SHA1sum: b2a2b968523b3af35cd7e44bcc4f940621b3ca66
+
+The GNU Classpath developers site http://developer.classpath.org/
+provides detailed information on how to start with helping the GNU
+Classpath project and gives an overview of the core class library
+packages currently provided. For each snapshot release generated
+documentation is provided through the GNU Classpath Tools gjdoc
+project. A documentation generation framework for java source
+files used by the GNU project. Full documentation on the currently
+implementated packages and classes can be found at:
+http://developer.classpath.org/doc/
+
+New in release 0.19 (Nov 2, 2005)
+(See the ChangeLog file for a full list of changes.)
+
+* The Swing RepaintManager has been reworked for more efficient
+ painting, especially for large GUIs.
+
+* The Swing layout manager OverlayLayout has been implemented, the
+ BoxLayout has been rewritten to make use of the SizeRequirements
+ utility class and caching for more efficient layout.
+
+* Improved accessibility support for Swing.
+
+* The java.net.HttpURLConnection implementation no longer buffers the
+ entire response body in memory. This means that response bodies
+ larger than available memory can now be handled.
+
+* The Andrew Watson, Vice President and Technical Director of the
+ Object Management Group, has officially assigned us 20 bit Vendor
+ Minor Code Id: 0x47430 ("GC") that will mark remote Classpath -
+ specific system exceptions. Obtaining the VMCID means that GNU
+ Classpath now is a recogniseable type of node in a highly
+ interoperable CORBA world.
+
+* Classpath now includes the first working draft to support the RMI
+ over IIOP protocol. The current implementation is capable for remote
+ invocations, transferring various Serializables and Externalizables
+ via RMI-IIOP protocol. It can flatten graphs and, at least for the
+ simple cases, is interoperable with Sun's jdk 1.5.
+
+* Qt4 configury switches for OS-X. Additional to the --enable-qt-peer,
+ OS-X users with a Qt4 installation can build the qt-peers with the
+ argument --with-qt4dir=<Qt4-installation-dir>.
+
+* Significant progress has been made in the implementation of the
+ javax.swing.plaf.metal.* package, with most UI delegates in a
+ working state now. Please test this with your own applications and
+ provide feedback that will help us to improve this package.
+
+* The GUI demo (gnu.classpath.examples.swing.Demo) has been extended
+ to highlight various features in our free-swing implementation. And
+ includes a look and feel switcher (Metal default, Ocean or GNU).
+
+Runtime interface changes:
+
+* Changed implementation of VMClassLoader.getPackage(s) : new method
+ VMClassLoader.getBootPackages should be implemented by the vm, and
+ sould return a string array of boot package names ("java.lang",
+ "java.net", ...). Feedback from vm implementors for usability and
+ relevance of the getBootPackages method would be greatly
+ appreciated.
+
+New Untested/Disabled Features:
+
+ The following new features are included, but not ready for
+ production yet. They are explicitly disabled and not supported. But
+ if you want to help with the development of these new features we
+ are interested in feedback. You will have to explicitly enable them
+ to try them out (and they will most likely contain bugs). If you are
+ interested in any of these then please join the mailing-list and
+ follow development in CVS.
+
+* Cairo Gtk+ Graphics2D support, enabled by giving configure
+ --enable-gtk-cairo.
+* QT4 AWT peers, enable by giving configure --enable-qt-peer.
+
+The following people helped with this release:
+
+Andreas Tobler
+ Qt4 support for Darwin/OSX, Graphics2D support, gtk+ updates.
+Andrew Haley
+ Serialization and URLClassLoader fixes.
+Andrew John Hughes
+ Serialization fixes, Properties XML support and generic branch work.
+Anthony Balkissoon
+ Lots of Free Swing additions.
+Anthony Green
+ MIDI framework, ALSA and DSSI providers.
+Audrius Meskauskas
+ Lots of new CORBA and RMI work and bugfixes.
+Casey Marshall
+ Crypto algorithm fixes.
+Chris Burdess
+ StAX and dom xml:id support.
+Christian Thalinger
+ Configuration and VM inteface fixes and CACAO integration.
+Dalibor Topic
+ Build cleanups and Kaffe integration.
+David Daney
+ HttpURLConnection rewrite and improvements.
+David Gilbert
+ Lots of Free Swing and metal theme additions.
+David Lichteblau
+ JCL support library global/local reference cleanups.
+Gael Thomas
+ VMClassLoader boot packages support sugestions.
+Guilhem Lavaux
+ Configuration, thread and channel fixes and Kaffe integration.
+Jan Roehrich
+ BasicTreeUI fixes.
+Jeroen Frijters
+ Serialization fixes, better Proxy support, bug fixes and IKVM integration.
+Julian Scheid
+ Documentation updates and gjdoc support.
+Keith Seitz
+ JDWP support.
+Lillian Angel
+ Lots of Free Swing additions.
+Mark Wielaard
+ Bug fixes, packaging and release management
+Martin Cordova
+ Suggestions for better SocketTimeoutException.
+Michael Koch
+ Configuration fixes.
+Nicolas Geoffray
+ VMClassLoader and AccessController improvements.
+Paul Jenner
+ Better -Werror support.
+Robert Schuster
+ XML and URL, AWT and Free Swing bug fixes
+Roman Kennke
+ Lots of Free Swing additions.
+Santiago Gala
+ AccessControlContext fixes.
+Stuart Ballard
+ RMI constant fixes.
+Sven de Marothy
+ BMP imageio support, CSS and TextLayout fixes.
+Thomas Fitzsimmons
+ Lots of imageio framework additions, lots of AWT and Free Swing bug fixes.
+Tom Tromey
+ Eclipse integration, generics work, lots of bug fixes and gcj integration.
+
+We would also like to thank the numerous bug reporters and testers!
+</pre>
+<footer>
diff --git a/libjava/classpath/doc/www.gnu.org/corba.wml b/libjava/classpath/doc/www.gnu.org/corba.wml
new file mode 100644
index 00000000000..cb9d7c58d8d
--- /dev/null
+++ b/libjava/classpath/doc/www.gnu.org/corba.wml
@@ -0,0 +1,37 @@
+#include "include/layout.wml"
+
+<subject "GNU Classpath CORBA interoperability page">
+
+<box>
+
+<boxtitle>GNU Classpath::Object management group</boxtitle>
+<boxitem>
+This page is referenced from the official
+<a href="http://doc.omg.org/vendor-tags">OMG Vendor tag list</a>,
+maintained by the <a href = "http://www.corba.org/">OMG</a>.
+It is is designed to help programmers debugging interoperation
+with our ORB.
+</boxitem>
+
+<boxtitle>GNU Classpath::CORBA interoperability</boxtitle>
+<boxitem>
+<ol>
+<li><a href="http://developer.classpath.org/mediation/CorbaInteroperability">
+Interoperability information (system exception minor codes, etc).</a></li>
+<li><a href="http://developer.classpath.org/doc/">GNU Classpath API Specification</a></li>
+<li><a href="bugs.html">Bug database.</a></li>
+<li>GNU Classpath CORBA vs:
+<a href="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk12-classpath.html">JDK 1.2</a>
+<a href="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk13-classpath.html">JDK 1.3</a>
+<a href="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk14-classpath.html">JDK 1.4</a>
+ (updated nightly)</li>
+<li><a href="http://www.gnu.org/software/classpath/classpath.html">Project home page</a></li>
+</ol>
+Registered information
+<ul>
+<li>GNU Classpath Vendor Minor Code Id (VMCID) is 0x47430xxx
+("GC\x00\x00" - "GC\x0f\xff").</li>
+</ul>
+</boxitem>
+
+</box>
diff --git a/libjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml b/libjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml
index 902544fbe32..a5139fbd5b6 100755
--- a/libjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml
+++ b/libjava/classpath/doc/www.gnu.org/cp-tools/cp-tools.wml
@@ -35,6 +35,15 @@ page describing them in more detail:
</box>
<box>
+<boxtitle><a name="Development">GNU Classpath::Tools::Downloads</a></boxtitle>
+<boxitem>
+At the moment there are only official releases of gjdoc on
+<createlink url="ftp://ftp.gnu.org/gnu/classpath/" name="ftp.gnu.org"/>.
+All other tools are available from CVS from the savannah project page below.
+</boxitem>
+</box>
+
+<box>
<boxtitle><a name="Development">GNU Classpath::Tools::Development</a></boxtitle>
<boxitem>
GNU Classpath Tools is part of the GNU Classpath project which is hosted at
diff --git a/libjava/classpath/doc/www.gnu.org/downloads/downloads.wml b/libjava/classpath/doc/www.gnu.org/downloads/downloads.wml
index 48bbe5ea270..96018f60331 100644
--- a/libjava/classpath/doc/www.gnu.org/downloads/downloads.wml
+++ b/libjava/classpath/doc/www.gnu.org/downloads/downloads.wml
@@ -77,10 +77,10 @@ sub mylink {
<download-block>
<download
- date="15 July 2005"
- version="0.17"
- url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.17.tar.gz"
- notes="http://www.gnu.org/software/classpath/announce/20050715.html"
+ date="02 November 2005"
+ version="0.19"
+ url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.19.tar.gz"
+ notes="http://www.gnu.org/software/classpath/announce/20051102.html"
>
<!-- download
@@ -100,6 +100,18 @@ sub mylink {
<download-block>
<download
+ date="06 September 2005"
+ version="0.18"
+ url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.18.tar.gz"
+ notes="http://www.gnu.org/software/classpath/announce/20050906.html"
+>
+<download
+ date="15 July 2005"
+ version="0.17"
+ url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.17.tar.gz"
+ notes="http://www.gnu.org/software/classpath/announce/20050715.html"
+>
+<download
date="30 June 2005"
version="0.16"
url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.16.tar.gz"
diff --git a/libjava/classpath/doc/www.gnu.org/home.wml b/libjava/classpath/doc/www.gnu.org/home.wml
index 1d59593b8f4..ff512f22a9d 100644
--- a/libjava/classpath/doc/www.gnu.org/home.wml
+++ b/libjava/classpath/doc/www.gnu.org/home.wml
@@ -36,7 +36,7 @@ obtained by looking at these resources.
<ul>
<li><createlink url="tasks.html" name="Task descriptions"></li>
<li>GNU Classpath vs: <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk10-classpath.html" name="JDK 1.0"> <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk11-classpath.html" name="JDK 1.1"> <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk12-classpath.html" name="JDK 1.2"> <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk13-classpath.html" name="JDK 1.3"> <createlink url="http://www.kaffe.org/~stuart/japi/htmlout/h-jdk14-classpath.html" name="JDK 1.4"> (updated nightly)</li>
- <li>GNU Classpath <createlink url="http://ontographics.com/classpath/mauve/mauvereport.cgi" name="Mauve Results"></li>
+ <li>GNU Classpath <createlink url="http://www.object-refinery.com/classpath/mauve/report/" name="Mauve Results"></li>
</ul>
</p>
</boxitem>
diff --git a/libjava/classpath/doc/www.gnu.org/include/layout.wml b/libjava/classpath/doc/www.gnu.org/include/layout.wml
index a82849205cb..485b9860146 100644
--- a/libjava/classpath/doc/www.gnu.org/include/layout.wml
+++ b/libjava/classpath/doc/www.gnu.org/include/layout.wml
@@ -116,7 +116,7 @@
<menuitem><createlink name="CVS" url="http://savannah.gnu.org/cvs/?group=classpath"></menuitem>
<menutitle>Development</menutitle>
-<menuitem><createlink name="Tasks" url="tasks.html"></menuitem>
+<menuitem><createlink name="Tasks" url="http://developer.classpath.org/mediation/ClasspathOpenTasks"></menuitem>
<menuitem><createlink name="Docs" url="docs/docs.html"></menuitem>
<menuitem><createlink name="Testing" url="benchmarks.html#testing"></menuitem>
<menuitem><createlink name="Benchmarks" url="benchmarks.html#benchmarks"></menuitem>
diff --git a/libjava/classpath/doc/www.gnu.org/newsitems.txt b/libjava/classpath/doc/www.gnu.org/newsitems.txt
index b4976dffc43..dbfcfd2ced9 100644
--- a/libjava/classpath/doc/www.gnu.org/newsitems.txt
+++ b/libjava/classpath/doc/www.gnu.org/newsitems.txt
@@ -1,3 +1,13 @@
+<newsitem date="02 Nov 2005">
+<createlink name="GNU Classpath 0.19"
+ url="announce/20051102.html">
+</newsitem>
+
+<newsitem date="06 Sep 2005">
+<createlink name="GNU Classpath 0.18"
+ url="announce/20050906.html">
+</newsitem>
+
<newsitem date="03 Aug 2005">
<createlink name="Generics Branch Merge Announcement"
url="http://lists.gnu.org/archive/html/classpath/2005-08/msg00002.html">
diff --git a/libjava/classpath/doc/www.gnu.org/tasks.wml b/libjava/classpath/doc/www.gnu.org/tasks.wml
index 00959bd9a48..34e36512f3d 100755
--- a/libjava/classpath/doc/www.gnu.org/tasks.wml
+++ b/libjava/classpath/doc/www.gnu.org/tasks.wml
@@ -1,326 +1,14 @@
-#include "include/layout.wml"
+<html>
+<head>
+<title>GNU Classpath Tasklist - GNU Project - Free Software Foundation (FSF)</title>
+<META HTTP-EQUIV="Refresh"
+ CONTENT="0; URL=http://developer.classpath.org/mediation/ClasspathOpenTasks">
+</head>
+<body>
+This page has moved. If your browser doesn't automatically redirect to
+its new location, click
+<a href="http://developer.classpath.org/mediation/ClasspathOpenTasks">
+http://developer.classpath.org/mediation/ClasspathOpenTasks</a>.
+</body>
+</html>
-##
-#
-# Special Tags
-#
-
-# <task
-# title="task title"
-# contact="contact person"
-# skills="..."
-# estimation="..."
-# >
-# ... task description ...
-# </task>
-
-
-
-# the task counter
-#
-<set-var __TASKSEQCNT=1>
-
-<define-tag task-section endtag=required>
- <preserve name>
- <set-var %attributes>
-{#TASKINDEX#:
- <boxitem>
- <!---boxtitle--->
- <strong><get-var __TASKSEQCNT>. <get-var name></strong> <br>
- <!---/boxtitle--->
-:#TASKINDEX#}
- <boxtitle><get-var __TASKSEQCNT>. <get-var name></boxtitle>
- <set-var __TASKCNT=1>
- %body
-{#TASKINDEX#:
- </boxitem>
- <br>
-:#TASKINDEX#}
- <increment __TASKSEQCNT>
- <restore name>
-</define-tag>
-
-<define-tag task endtag=required>
-<preserve title>
-<preserve contact>
-<preserve skills>
-<preserve estimation>
-<set-var %attributes>
-{#TASKINDEX#:
- <!---strong--><a href="tasks.html#task<get-var __TASKSEQCNT>_<get-var __TASKCNT>"><get-var __TASKSEQCNT>.<get-var __TASKCNT> <get-var title></a><!---/strong--> (<get-var estimation>)<br>
-:#TASKINDEX#}
- <boxitem>
- <h3><a name="task<get-var __TASKSEQCNT>_<get-var __TASKCNT>"><get-var __TASKSEQCNT>.<get-var __TASKCNT> <get-var title></a></h3>
- <table border="0">
- <tr><td valign="top"><strong>Description:</strong></td><td>%body</td></tr>
- <tr><td><strong>Skills:</strong></td><td><get-var skills></td></tr>
- <tr><td><strong>Estimated time:</strong></td><td><get-var estimation></td></tr>
- <tr><td><strong>Contact person:</strong></td><td><get-var contact></td></tr>
- </table>
- </boxitem>
-<increment __TASKCNT>
-<restore estimation>
-<restore skills>
-<restore contact>
-<restore title>
-
-</define-tag>
-
-
-<define-tag sb>
- Sascha Brawer
-</define-tag>
-<define-tag mw>
- Mark Wielaard
-</define-tag>
-<define-tag pr>
- Patrik Reali
-</define-tag>
-<define-tag cm>
- Casey Marshall
-</define-tag>
-<define-tag dt>
- Dalibor Topic
-</define-tag>
-<define-tag mk>
- Michael Koch
-</define-tag>
-
-<set-var last-modified-author="prk">
-
-<subject "GNU Classpath Tasklist">
-
-<h1>GNU Classpath Tasklist</h1>
-
-<box>
-
-<boxitem>
-This list is a collection of tasks for helping GNU Classpath's progress. They are a good starting point if you would like to help in producing a complete and high-quality free Java implementation.
-
-<p>Another source of inspiration are GNU Classpath's <createlink name="task list" url="http://savannah.gnu.org/pm/?group=classpath"> and <createlink name="patch list" url="http://savannah.gnu.org/patch/?group=classpath"> on Savannah, though these are usually meant for the project members.
-</boxitem>
-
-<boxtitle>Index</boxtitle>
-{#TASKINDEX#}
-
-
-
-<task-section name="Graphics">
-<task
- title="javax.imageio"
- estimation="2 weeks"
- skills=""
- contact="<sb> or <mk>"
->
-Write an implementation of the javax.imageio framework.
-</task>
-
-<task
- title="Constructive Area Geometry"
- estimation="6 weeks (?)."
- skills="Computational geometry skills"
- contact="<sb>"
->
-Implement java.awt.geom.Area. This would be useful for some
-graphics applications.
-</task>
-
-<task
- title="Composite Contexts"
- estimation="2 days for each operator"
- skills="It helps if you are familiar with the java.awt.image framework."
- contact="<sb>"
->
-Implement some CompositeContexts for Porter/Duff operators on raster
-images. This would be useful for supporting 2D graphics. See
-java.awt.AlphaComposite and its createContext method.
-</task>
-
-</task-section>
-
-<task-section name="CORBA">
-<task
- title="Help with CORBA implementation"
- estimation="This depends on the sub-task you pick."
- skills="Know or be ready to read the OMG documentation."
- contact="Audrius Meskauskas"
->
-The CORBA implementation in the Classpath project is
-now a working but incomplete prototype. A number of CORBA
-related tasks are available. If you are not a CORBA expert, you should be ready
-to learn by reading the <createlink name="OMG specifications"
-url="http://www.omg.org/cgi-bin/doc?formal/04-03-12"> and probably by writing some
-relatively simple classes.
-</task>
-</task-section>
-
-<task-section name="Testing">
-<task
- title="Make Mauve an application"
- estimation=""
- skills=""
- contact="<pr>"
->
-On some environments, it is not possible to run shell scripts
-because there is no shell. Make the Mauve test suite a self-contained
-application (one big JAR file).
-</task>
-
-<task
- title="Write Mauve tests"
- estimation=""
- skills=""
- contact="<mw>"
->
-Write Mauve tests.
-</task>
-
-<task
- title="Mauve tests for javax.image.io"
- estimation="1 week"
- skills=""
- contact="<sb>"
->
-<p>Write Mauve tests for reading in images. You could use the test images
-at libpng.org and write Mauve testlets that load each image from
-a file. Compute a hash (such as SHA-1) over the contents of the
-DataBuffer. If the hash matches, the test succeeds.
-</p><p>
-Note that we don't have javax.imageio yet, so you'd have to develop
-this with the Sun JDK.
-</p>
-</task>
-
-<task
- title="Generator for Mauve tests"
- estimation="2 weeks (prototype) + 2 weeks (tuning)"
- skills=""
- contact="<dt>"
->
-Write a program which automatically generates basic Mauve tests.
-
-
-</task>
-
-</task-section>
-
-<task-section name="Automation">
-
-<task
- title="Script for running regression tests"
- estimation="1 week"
- skills="???"
- contact=""
->
-Write a script that once a night checks out Classpath from cvs,
-compiles it, runs the Mauve test suite (also from cvs) on it
-using some free JVM (e.g. Kissme), and posts the results to
-some web site. For comparison, it would be very helpful if the
-same Mauve testlets were also run with a current Sun JVM.
-</task>
-
-<task
- title="Integrate Classpath testsuite into Mauve"
- estimation=""
- skills=""
- contact="<mw>"
->
-Classpath has a rather small number of tests in the subdirectories
-test/ and testsuite/. Look through these tests and check whether the
-same functionality is already tested by Mauve. If not, write a
-Mauve testlet and submit it to mauve-patches@sources.redhat.com <mailto:mauve-patches@sources.redhat.com>.
-The goal is to remove the test suite from Classpath.
-</task>
-
-
-<task
- title="Script for running Japitools"
- estimation="1 week"
- skills=""
- contact="???"
->
-Write a script that once a night checks out Classpath from cvs,
-runs Japitools on it, and posts the results on some web site.
-</task>
-
-<task
- title="Script for running gjdoc"
- estimation="1 week"
- skills=""
- contact=""
->
-Write a script that once a night checks out Classpath from cvs,
-runs gjdoc on it, and posts the generated documentation on some
-web site. While you're at it, fix gjdoc so it copies embedded
-documentation images (classpath-tools support request #102205).
-</task>
-
-<task
- title="JAR file verification"
- estimation=""
- skills=""
- contact="<mw>"
->
-</task>
-</task-section>
-
-<task-section name="Native stuff">
-
-<task
- title="Libiconv Service Provider for java.nio.charset"
- estimation="2 weeks"
- skills=""
- contact=""
->Write a service provider for java.nio.charset that uses the
-libiconv library for converting character encodings to and
-from UTF-16. This would be a first step for replacing
-gnu.java.io.EncodingManager by the java.nio.charset framework,
-which is richer and not specific to Classpath.
-</task>
-</task-section>
-
-<task-section name="Security">
-
-<task
- title="Security Audit"
- estimation=""
- skills=""
- contact=""
->We need to make a pass over the Classpath Java source, making sure
-that all required calls to the SecurityManager are in place. At the same
-time we need to ensure that there is no way to get around
-SecurityManager by directly calling code in gnu.*.
-</task>
-
-<task
- title="Security Testing"
- estimation=""
- skills=""
- contact=""
->We need Mauve tests for all the calls to SecurityManager.
-Additionally, enabling a security manager will probably reveal
-code in Classpath that needs to be wrapped in AccessController.doPrivileged().
-</task>
-
-</task-section>
-
-<task-section name="Related Projects">
-<task
- title="Help GNU Crypto"
- estimation=""
- skills=""
- contact="<cm>"
->
-</task>
-<task
- title="Help Classpath-x"
- estimation=""
- skills=""
- contact=""
->
-??? (maybe this should be more specific, e.g. "Write an
-IMAP plug-in for javax.mail on top of inetlib" (if they want
-this at all)
-</task-section>
-
-</box>
diff --git a/libjava/classpath/examples/Makefile.am b/libjava/classpath/examples/Makefile.am
index b7eeacb63fe..341fc5e8e23 100644
--- a/libjava/classpath/examples/Makefile.am
+++ b/libjava/classpath/examples/Makefile.am
@@ -20,7 +20,7 @@ endif
endif
# All our example java source files
-EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java
+EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*/*.java
# The example C source files
EXAMPLE_C_FILES = $(srcdir)/gnu/classpath/examples/*/*.c
@@ -34,8 +34,11 @@ BUILT_SOURCES = $(EXAMPLE_ZIP)
# the png icons we use in some of the examples.
EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
+# The example specific README files.
+READMES = $(srcdir)/gnu/classpath/examples/CORBA/swing/README.html
+
# All the files we find "interesting"
-ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_ICONS)
+ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_ICONS) $(READMES)
# Some architecture independent data to be installed.
example_DATA = $(EXAMPLE_ZIP) README
diff --git a/libjava/classpath/examples/Makefile.in b/libjava/classpath/examples/Makefile.in
index 5c067bce5e1..5ba479cf5e2 100644
--- a/libjava/classpath/examples/Makefile.in
+++ b/libjava/classpath/examples/Makefile.in
@@ -41,10 +41,8 @@ subdir = examples
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/Makefile.jawt.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -86,10 +84,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -226,6 +228,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -239,6 +242,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -259,7 +263,7 @@ vm_classes = @vm_classes@
@FOUND_GCJ_TRUE@JCOMPILER = $(GCJ) --bootclasspath '$(top_builddir)/lib' --classpath . -C
# All our example java source files
-EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java
+EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*/*.java
# The example C source files
EXAMPLE_C_FILES = $(srcdir)/gnu/classpath/examples/*/*.c
@@ -273,8 +277,11 @@ BUILT_SOURCES = $(EXAMPLE_ZIP)
# the png icons we use in some of the examples.
EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
+# The example specific README files.
+READMES = $(srcdir)/gnu/classpath/examples/CORBA/swing/README.html
+
# All the files we find "interesting"
-ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_ICONS)
+ALL_EXAMPLE_FILES = $(EXAMPLE_JAVA_FILES) $(EXAMPLE_C_FILES) $(EXAMPLE_ICONS) $(READMES)
# Some architecture independent data to be installed.
example_DATA = $(EXAMPLE_ZIP) README
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java
index b4a37720faa..fb5ebdbb5dc 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java
@@ -73,7 +73,7 @@ import org.omg.CosNaming.NamingContextHelper;
*/
public class Demo
{
- public static void main(final String[] args)
+ public static void main(String[] an_args)
{
// We create the following naming graph:
// <ROOT CONTEXT>
@@ -90,6 +90,8 @@ public class Demo
System.out.println("Starting the GNU Classpath " +
"built-in transient naming service"
);
+
+ final String[] args = an_args;
new Thread()
{
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
index 85f233a1d4c..f53609cf718 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication;
+import java.io.File;
+
import gnu.classpath.examples.CORBA.SimpleCommunication.communication.DirectTest;
import gnu.classpath.examples.CORBA.SimpleCommunication.communication.RequestTest;
@@ -61,23 +63,34 @@ public class Demo
{
public static void main(final String[] args)
{
+ File ior = new File("IOR.txt");
+ if (ior.exists())
+ ior.delete();
+
// Start the server.
new Thread()
{
public void run()
{
- comServer.start_server(args);
+ DemoServer.start_server(args);
}
}.start();
- System.out.println("Waiting for three seconds for the server to start...");
-
- // Pause some time for the server to start.
- try {
- Thread.sleep(3000);
- }
- catch (InterruptedException ex) {
- }
+ System.out.print("Waiting for the server to start ");
+ while (!ior.exists())
+ {
+ // Pause some time for the server to start.
+ try
+ {
+ Thread.sleep(200);
+ }
+ catch (InterruptedException ex)
+ {
+ }
+ System.out.print(".");
+ }
+ System.out.println("ok.");
+ System.out.println();
// Test the stream oriented communication.
DirectTest.main(args);
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/comServer.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java
index d4e0c56b2c8..d7b1a7771fb 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/comServer.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/DemoServer.java
@@ -1,4 +1,4 @@
-/* comServer.java --
+/* DemoServer.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication;
-import gnu.classpath.examples.CORBA.SimpleCommunication.communication.comServant;
+import gnu.classpath.examples.CORBA.SimpleCommunication.communication.DemoServant;
import org.omg.CORBA.ORB;
@@ -47,7 +47,7 @@ import java.io.PrintStream;
/**
* This is the server class that handles the client requests,
- * delegating the functionality to the {@link comServant}.
+ * delegating the functionality to the {@link DemoServant}.
*
* When starting, the server writes the IOR.txt file into the current
* folder. With the information, stored in this file, the server
@@ -62,7 +62,7 @@ import java.io.PrintStream;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class comServer
+public class DemoServer
{
public static void main(String[] args)
@@ -78,7 +78,7 @@ public class comServer
final ORB orb = org.omg.CORBA.ORB.init(args, null);
// Create the servant and register it with the ORB.
- comServant tester = new comServant();
+ DemoServant tester = new DemoServant();
orb.connect(tester);
// Storing the IOR reference.
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comServant.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java
index 08d1759d8d2..c07b77b1728 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comServant.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoServant.java
@@ -1,4 +1,4 @@
-/* comServant.java --
+/* DemoServant.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,12 +45,6 @@ import org.omg.CORBA.DoubleHolder;
import org.omg.CORBA.ShortHolder;
import org.omg.CORBA.StringHolder;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.PrintStream;
-
/**
* This class handles the actual server functionality in this test
* application. When the client calls the remote method, this
@@ -62,8 +56,8 @@ import java.io.PrintStream;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class comServant
- extends _comTesterImplBase
+public class DemoServant
+ extends _DemoTesterImplBase
{
/**
* The field, that can be set and checked by remote client.
@@ -129,7 +123,7 @@ public class comServant
/**
* Accept and return the structures.
*/
- public returnThis passStructure(passThis in_structure)
+ public StructureToReturn passStructure(StructureToPass in_structure)
{
System.out.println("SERVER: ***** Transferring structures");
System.out.println("SERVER: Received " + in_structure.a + ":" +
@@ -137,7 +131,7 @@ public class comServant
);
// Create and send back the returned structure.
- returnThis r = new returnThis();
+ StructureToReturn r = new StructureToReturn();
r.c = in_structure.a + in_structure.b;
r.n = 555;
r.arra = new int[] { 11, 22, 33 };
@@ -147,14 +141,14 @@ public class comServant
/**
* Pass and return the tree structure
*/
- public void passTree(nodeHolder tree)
+ public void passTree(TreeNodeHolder tree)
{
System.out.println("SERVER: ***** Transferring tree");
StringBuffer b = new StringBuffer();
// This both creates the tree string representation
- // and changes the node names.
+ // and changes the TreeNode names.
getImage(b, tree.value);
System.out.println("SERVER: The tree was: " + b + ", returning changed.");
}
@@ -190,11 +184,11 @@ public class comServant
*
* @param parameter specifies which exception will be thrown.
*
- * @throws ourUserException for the non negative parameter.
+ * @throws WeThrowThisException for the non negative parameter.
* @throws BAD_OPERATION for the negative parameter.
*/
public void throwException(int parameter)
- throws ourUserException
+ throws WeThrowThisException
{
System.out.println("SERVER: ***** Testing exceptions");
if (parameter > 0)
@@ -202,7 +196,7 @@ public class comServant
System.out.println("SERVER: Throwing the user exception, " +
"specific field = "+parameter
);
- throw new ourUserException(parameter);
+ throw new WeThrowThisException(parameter);
}
else
{
@@ -215,12 +209,12 @@ public class comServant
/**
* Visit all tree nodes, getting the string representation
- * and adding '++' to the node names.
+ * and adding '++' to the TreeNode names.
*
* @param b the buffer to collect the string representation.
- * @param n the rott tree node.
+ * @param n the rott tree TreeNode.
*/
- private void getImage(StringBuffer b, node n)
+ private void getImage(StringBuffer b, TreeNode n)
{
b.append(n.name);
n.name = n.name + "++";
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java
index 495807eb980..f3766f3251a 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester.java
@@ -1,4 +1,4 @@
-/* comTester.java --
+/* DemoTester.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,12 +45,12 @@ import org.omg.CORBA.StringHolder;
/**
* The interface of our remote object. Some IDL compiles split it
- * into "comTester" and "comTesterOperations", but we do not see
+ * into "DemoTester" and "comTesterOperations", but we do not see
* much sense in doing this here.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface comTester
+public interface DemoTester
{
/**
* Passes wide (UTF-16) string and narrow (ISO8859_1) string.
@@ -77,14 +77,14 @@ public interface comTester
/**
* Passes and returns the structures.
*/
- returnThis passStructure(passThis in_structure);
+ StructureToReturn passStructure(StructureToPass in_structure);
/**
* Pass and return the tree structure
*
- * @param tree the root node of the tree.
+ * @param tree the root TreeNode of the tree.
*/
- void passTree(nodeHolder tree);
+ void passTree(TreeNodeHolder tree);
/**
* Just prints the "Hello" message.
@@ -102,10 +102,10 @@ public interface comTester
void theField(int newTheField);
/**
- * Throws either 'ourUserException' with the 'ourField' field
+ * Throws either 'WeThrowThisException' with the 'ourField' field
* initialised to the passed positive value
* or system exception (if the parameter is zero or negative).
*/
void throwException(int parameter)
- throws ourUserException;
+ throws WeThrowThisException;
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java
index 5cf372b26a5..732b00cfb30 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java
@@ -57,7 +57,7 @@ import java.io.IOException;
* where the program has been started.
*
* The IOR.txt file is written by the server
- * {@link gnu.classpath.examples.CORBA.SimpleCommunication.comServer}.
+ * {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}.
* The server should be reachable over Internet, unless blocked by
* security tools.
*
@@ -83,7 +83,7 @@ public class DirectTest
/**
* The invocation target.
*/
- comTester object;
+ DemoTester object;
/**
* Get the object reference.
@@ -102,7 +102,7 @@ public class DirectTest
String ior = new String(c);
DirectTest we = new DirectTest();
- we.object = (comTester) orb.string_to_object(ior);
+ we.object = (DemoTester) orb.string_to_object(ior);
we.Demo();
orb.shutdown(false);
}
@@ -199,11 +199,11 @@ public class DirectTest
{
System.out.println("***** Pass structure");
- passThis arg = new passThis();
+ StructureToPass arg = new StructureToPass();
arg.a = "A";
arg.b = "B";
- returnThis r = object.passStructure(arg);
+ StructureToReturn r = object.passStructure(arg);
System.out.println(" Fields of the returned structure:");
@@ -257,15 +257,15 @@ public class DirectTest
// +-- bb
System.out.println("***** Pass and return the tree.");
- node n = nod("Root");
+ TreeNode n = nod("Root");
- n.children = new node[] { nod("a"), nod("b") };
- n.children [ 1 ].children = new node[] { nod("ba"), nod("bb") };
- n.children [ 1 ].children [ 0 ].children = new node[] { nod("bac") };
+ n.children = new TreeNode[] { nod("a"), nod("b") };
+ n.children [ 1 ].children = new TreeNode[] { nod("ba"), nod("bb") };
+ n.children [ 1 ].children [ 0 ].children = new TreeNode[] { nod("bac") };
- nodeHolder nh = new nodeHolder(n);
+ TreeNodeHolder nh = new TreeNodeHolder(n);
- // The server should add '++' to each node name.
+ // The server should add '++' to each TreeNode name.
object.passTree(nh);
// Convert the returned tree to some strig representation.
@@ -288,7 +288,7 @@ public class DirectTest
object.throwException(123);
throw new InternalError();
}
- catch (ourUserException uex)
+ catch (WeThrowThisException uex)
{
System.out.println(" The user exception with field " + uex.ourField +
", has been thrown on remote side."
@@ -312,9 +312,9 @@ public class DirectTest
/**
* Get the string representation of the passed tree.
* @param b the string buffer to accumulate the representation.
- * @param n the tree (root node).
+ * @param n the tree (root TreeNode).
*/
- private void getImage(StringBuffer b, node n)
+ private void getImage(StringBuffer b, TreeNode n)
{
b.append(n.name);
b.append(": (");
@@ -328,15 +328,15 @@ public class DirectTest
}
/**
- * Create a node with the given header.
+ * Create a TreeNode with the given header.
*
- * @param hdr the node header.
- * @return the created node.
+ * @param hdr the TreeNode header.
+ * @return the created TreeNode.
*/
- private node nod(String hdr)
+ private TreeNode nod(String hdr)
{
- node n = new node();
- n.children = new node[ 0 ];
+ TreeNode n = new TreeNode();
+ n.children = new TreeNode[ 0 ];
n.name = hdr;
return n;
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
index 977fb428287..9c908e520cc 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java
@@ -1,3 +1,39 @@
+/* RequestTest.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
@@ -7,14 +43,10 @@ import java.io.FileReader;
import java.io.IOException;
import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.ByteHolder;
-import org.omg.CORBA.DoubleHolder;
import org.omg.CORBA.ExceptionList;
import org.omg.CORBA.NVList;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Request;
-import org.omg.CORBA.ShortHolder;
-import org.omg.CORBA.StringHolder;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.UnknownUserException;
@@ -25,7 +57,7 @@ import org.omg.CORBA.UnknownUserException;
* where the program has been started.
*
* The IOR.txt file is written by the server
- * {@link gnu.classpath.examples.CORBA.SimpleCommunication.comServer}.
+ * {@link gnu.classpath.examples.CORBA.SimpleCommunication.DemoServer}.
* The server should be reachable over Internet, unless blocked by
* security tools.
*
@@ -106,7 +138,6 @@ public class RequestTest
throw new InternalError();
}
testSystemException();
- testUserException();
testWideNarrowStrings();
}
@@ -135,13 +166,6 @@ public class RequestTest
Request r =
object._create_request(null, "passSimple", orb.create_list(0), null);
- ByteHolder a_byte = new ByteHolder((byte) 0);
- ShortHolder a_short = new ShortHolder((short) 3);
- StringHolder a_string = new StringHolder("[string 4]");
-
- // This is an 'out' parameter; the value must not be passed to servant.
- DoubleHolder a_double = new DoubleHolder(56.789);
-
r.add_inout_arg().insert_octet((byte) 0);
r.add_in_arg().insert_long(2);
r.add_inout_arg().insert_short((short) 3);
@@ -188,7 +212,7 @@ public class RequestTest
try
{
ExceptionList exList = orb.create_exception_list();
- exList.add(ourUserExceptionHelper.type());
+ exList.add(WeThrowThisExceptionHelper.type());
Request rq =
object._create_request(null, "throwException", orb.create_list(1),
@@ -217,7 +241,7 @@ public class RequestTest
System.out.println("**** Test user exception:");
ExceptionList exList = orb.create_exception_list();
- exList.add(ourUserExceptionHelper.type());
+ exList.add(WeThrowThisExceptionHelper.type());
Request rq =
object._create_request(null, "throwException", orb.create_list(1), null,
@@ -228,7 +252,7 @@ public class RequestTest
rq.invoke();
UnknownUserException uku = (UnknownUserException) rq.env().exception();
- ourUserException our_exception = ourUserExceptionHelper.extract(uku.except);
+ WeThrowThisException our_exception = WeThrowThisExceptionHelper.extract(uku.except);
System.out.println(" Our user exception, field " + our_exception.ourField +
", has been thrown on remote side."
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java
index 2a680b91bee..d17e91fbac0 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java
@@ -1,4 +1,4 @@
-/* passThis.java --
+/* StructureToPass.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,9 +44,14 @@ package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class passThis
+public class StructureToPass
implements org.omg.CORBA.portable.IDLEntity
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The first string, stored in this structure (defined as
* "narrow string").
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHelper.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java
index 6b9f4ce0102..c41ebe237ea 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHelper.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHelper.java
@@ -1,4 +1,4 @@
-/* passThisHelper.java --
+/* StructureToPassHelper.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
-import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.StructMember;
import org.omg.CORBA.TypeCode;
@@ -46,17 +45,17 @@ import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
/**
- * The helper operations for the {@link passThis}.
+ * The helper operations for the {@link StructureToPass}.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class passThisHelper
+public abstract class StructureToPassHelper
{
/**
- * The repository ID of the {@link passThis}.
+ * The repository ID of the {@link StructureToPass}.
*/
private static String id =
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis:1.0";
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass:1.0";
/**
* Get the repository id.
@@ -69,9 +68,9 @@ public abstract class passThisHelper
/**
* Read the structure from the CDR stram.
*/
- public static passThis read(InputStream istream)
+ public static StructureToPass read(InputStream istream)
{
- passThis value = new passThis();
+ StructureToPass value = new StructureToPass();
value.a = istream.read_string();
value.b = istream.read_wstring();
return value;
@@ -88,13 +87,13 @@ public abstract class passThisHelper
members [ 0 ] = new StructMember("a", member, null);
member = ORB.init().create_string_tc(0);
members [ 1 ] = new StructMember("b", member, null);
- return ORB.init().create_struct_tc(passThisHelper.id(), "passThis", members);
+ return ORB.init().create_struct_tc(StructureToPassHelper.id(), "StructureToPass", members);
}
/**
* Write the structure into the CDR stream.
*/
- public static void write(OutputStream ostream, passThis value)
+ public static void write(OutputStream ostream, StructureToPass value)
{
ostream.write_string(value.a);
ostream.write_wstring(value.b);
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHolder.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java
index 0d93cbaf66f..5bbe6908e27 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHolder.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPassHolder.java
@@ -6,32 +6,32 @@ import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
-public final class passThisHolder
+public final class StructureToPassHolder
implements Streamable
{
- public passThis value;
+ public StructureToPass value;
- public passThisHolder()
+ public StructureToPassHolder()
{
}
- public passThisHolder(passThis initialValue)
+ public StructureToPassHolder(StructureToPass initialValue)
{
value = initialValue;
}
public void _read(InputStream i)
{
- value = passThisHelper.read(i);
+ value = StructureToPassHelper.read(i);
}
public org.omg.CORBA.TypeCode _type()
{
- return passThisHelper.type();
+ return StructureToPassHelper.type();
}
public void _write(OutputStream o)
{
- passThisHelper.write(o, value);
+ StructureToPassHelper.write(o, value);
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java
index b7c3923ce16..5dc843ae8c7 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java
@@ -1,4 +1,4 @@
-/* returnThis.java --
+/* StructureToReturn.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,9 +44,14 @@ import org.omg.CORBA.portable.IDLEntity;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class returnThis
+public class StructureToReturn
implements IDLEntity
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The string field.
*/
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHelper.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java
index 79838d75ca4..42fb7a574a7 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHelper.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHelper.java
@@ -1,4 +1,4 @@
-/* returnThisHelper.java --
+/* StructureToReturnHelper.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,7 +37,6 @@ exception statement from your version. */
package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
-import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
import org.omg.CORBA.StructMember;
import org.omg.CORBA.TCKind;
@@ -46,17 +45,17 @@ import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
/**
- * This class defines the helper operations for {@link returnThis}.
+ * This class defines the helper operations for {@link StructureToReturn}.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class returnThisHelper
+public abstract class StructureToReturnHelper
{
/**
* The repository id.
*/
private static String _id =
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis:1.0";
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn:1.0";
/**
* Return the repository id.
@@ -69,9 +68,9 @@ public abstract class returnThisHelper
/**
* Read the structure from the CDR stream.
*/
- public static returnThis read(InputStream istream)
+ public static StructureToReturn read(InputStream istream)
{
- returnThis value = new returnThis();
+ StructureToReturn value = new StructureToReturn();
value.n = istream.read_long();
value.c = istream.read_wstring();
value.arra = new int[ 3 ];
@@ -95,7 +94,7 @@ public abstract class returnThisHelper
member = ORB.init().get_primitive_tc(TCKind.tk_long);
member = ORB.init().create_array_tc(3, member);
members [ 2 ] = new StructMember("arra", member, null);
- return ORB.init().create_struct_tc(returnThisHelper.id(), "returnThis",
+ return ORB.init().create_struct_tc(StructureToReturnHelper.id(), "StructureToReturn",
members
);
}
@@ -103,7 +102,7 @@ public abstract class returnThisHelper
/**
* Write the structure to the CDR stream.
*/
- public static void write(OutputStream ostream, returnThis value)
+ public static void write(OutputStream ostream, StructureToReturn value)
{
ostream.write_long(value.n);
ostream.write_wstring(value.c);
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHolder.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java
index 294e37ac3ef..c70f9cfccdd 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHolder.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturnHolder.java
@@ -10,25 +10,25 @@ import org.omg.CORBA.portable.Streamable;
/**
* The holder for the structure, returned from the server.
*/
-public final class returnThisHolder
+public final class StructureToReturnHolder
implements Streamable
{
/**
* The enclosed structure.
*/
- public returnThis value = null;
+ public StructureToReturn value = null;
/**
* Create the empty holder.
*/
- public returnThisHolder()
+ public StructureToReturnHolder()
{
}
/**
* Crate the holder with the defined initial value.
*/
- public returnThisHolder(returnThis initialValue)
+ public StructureToReturnHolder(StructureToReturn initialValue)
{
value = initialValue;
}
@@ -38,7 +38,7 @@ public final class returnThisHolder
*/
public void _read(InputStream in)
{
- value = returnThisHelper.read(in);
+ value = StructureToReturnHelper.read(in);
}
/**
@@ -46,7 +46,7 @@ public final class returnThisHolder
*/
public TypeCode _type()
{
- return returnThisHelper.type();
+ return StructureToReturnHelper.type();
}
/**
@@ -55,6 +55,6 @@ public final class returnThisHolder
*/
public void _write(OutputStream out)
{
- returnThisHelper.write(out, value);
+ StructureToReturnHelper.write(out, value);
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/node.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java
index 527d02d0668..b267f39eaff 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/node.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java
@@ -1,4 +1,4 @@
-/* node.java --
+/* TreeNode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,12 +44,17 @@ package gnu.classpath.examples.CORBA.SimpleCommunication.communication;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class node
+public class TreeNode
implements org.omg.CORBA.portable.IDLEntity
{
- /** The node name */
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /** The TreeNode name */
public String name = null;
- /** The node children. */
- public node[] children = null;
+ /** The TreeNode children. */
+ public TreeNode[] children = null;
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHelper.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java
index 8d4121cda3f..f111d0eac93 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHelper.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHelper.java
@@ -1,4 +1,4 @@
-/* nodeHelper.java --
+/* TreeNodeHelper.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,13 +51,13 @@ import org.omg.CORBA.portable.OutputStream;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class nodeHelper
+public abstract class TreeNodeHelper
{
/**
- * The node repository id, used to identify the structure.
+ * The TreeNode repository id, used to identify the structure.
*/
private static String _id =
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/node:1.0";
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode:1.0";
/**
* Caches the typecode, allowing to compute it only once.
@@ -66,21 +66,21 @@ public abstract class nodeHelper
/**
* This is used to handle the recursive object references in
- * CORBA - supported way. The tree node definition is recursive,
- * as the node contains the sequence of the nodes as its field.
+ * CORBA - supported way. The tree TreeNode definition is recursive,
+ * as the TreeNode contains the sequence of the nodes as its field.
*/
private static boolean active;
/**
- * Extract the tree node from the unversal CORBA wrapper, Any.
+ * Extract the tree TreeNode from the unversal CORBA wrapper, Any.
*/
- public static node extract(Any a)
+ public static TreeNode extract(Any a)
{
return read(a.create_input_stream());
}
/**
- * Get the node string identifer.
+ * Get the TreeNode string identifer.
*/
public static String id()
{
@@ -88,9 +88,9 @@ public abstract class nodeHelper
}
/**
- * Insert the node into the universal CORBA wrapper, Any.
+ * Insert the TreeNode into the universal CORBA wrapper, Any.
*/
- public static void insert(Any a, node that)
+ public static void insert(Any a, TreeNode that)
{
OutputStream out = a.create_output_stream();
a.type(type());
@@ -99,22 +99,22 @@ public abstract class nodeHelper
}
/**
- * Read the node from the common data reprentation (CDR) stream.
+ * Read the TreeNode from the common data reprentation (CDR) stream.
*/
- public static node read(InputStream istream)
+ public static TreeNode read(InputStream istream)
{
- node value = new node();
+ TreeNode value = new TreeNode();
value.name = istream.read_string();
int _len0 = istream.read_long();
- value.children = new node[ _len0 ];
+ value.children = new TreeNode[ _len0 ];
for (int i = 0; i < value.children.length; ++i)
- value.children [ i ] = nodeHelper.read(istream);
+ value.children [ i ] = TreeNodeHelper.read(istream);
return value;
}
/**
- * Get the node type code definition.
+ * Get the TreeNode type code definition.
*/
public static synchronized TypeCode type()
{
@@ -131,7 +131,7 @@ public abstract class nodeHelper
return ORB.init().create_recursive_tc(_id);
active = true;
- // List all memebers of the node structure.
+ // List all memebers of the TreeNode structure.
StructMember[] members = new StructMember[ 2 ];
TypeCode memberType;
memberType = ORB.init().create_string_tc(0);
@@ -139,7 +139,7 @@ public abstract class nodeHelper
memberType = ORB.init().create_recursive_tc("");
members [ 1 ] = new StructMember("children", memberType, null);
typeCode =
- ORB.init().create_struct_tc(nodeHelper.id(), "node", members);
+ ORB.init().create_struct_tc(TreeNodeHelper.id(), "TreeNode", members);
active = false;
}
}
@@ -148,13 +148,13 @@ public abstract class nodeHelper
}
/**
- * Write the node into the common data reprentation (CDR) stream.
+ * Write the TreeNode into the common data reprentation (CDR) stream.
*/
- public static void write(OutputStream ostream, node value)
+ public static void write(OutputStream ostream, TreeNode value)
{
ostream.write_string(value.name);
ostream.write_long(value.children.length);
for (int i = 0; i < value.children.length; ++i)
- nodeHelper.write(ostream, value.children [ i ]);
+ TreeNodeHelper.write(ostream, value.children [ i ]);
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHolder.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java
index 8e4913912dc..ec180ce579a 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHolder.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNodeHolder.java
@@ -1,4 +1,4 @@
-/* nodeHolder.java --
+/* TreeNodeHolder.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,57 +44,57 @@ import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
/**
- * The node holder is a wrapper about the node data structure. It
- * can be used where the node must be passed both to and from
+ * The TreeNode holder is a wrapper about the TreeNode data structure. It
+ * can be used where the TreeNode must be passed both to and from
* the method being called. The same structure holds the tree,
- * as it can be represented as a root node with children.
+ * as it can be represented as a root TreeNode with children.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class nodeHolder
+public class TreeNodeHolder
implements Streamable
{
/**
- * Stores the node value.
+ * Stores the TreeNode value.
*/
- public node value;
+ public TreeNode value;
/**
- * Creates the node holder with the null initial value.
+ * Creates the TreeNode holder with the null initial value.
*/
- public nodeHolder()
+ public TreeNodeHolder()
{
}
/**
- * Creates the node holder with the given initial value.
+ * Creates the TreeNode holder with the given initial value.
*/
- public nodeHolder(node initialValue)
+ public TreeNodeHolder(TreeNode initialValue)
{
value = initialValue;
}
/**
- * Reads the node value from the common data representation (CDR)
+ * Reads the TreeNode value from the common data representation (CDR)
* stream.
*/
public void _read(InputStream in)
{
- value = nodeHelper.read(in);
+ value = TreeNodeHelper.read(in);
}
/**
- * Writes the node value into common data representation (CDR)
+ * Writes the TreeNode value into common data representation (CDR)
* stream.
* @return
*/
public TypeCode _type()
{
- return nodeHelper.type();
+ return TreeNodeHelper.type();
}
public void _write(OutputStream out)
{
- nodeHelper.write(out, value);
+ TreeNodeHelper.write(out, value);
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java
index 51ea5f2d6d8..cf20d61ecdc 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java
@@ -1,4 +1,4 @@
-/* ourUserException.java --
+/* WeThrowThisException.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,10 +49,15 @@ import org.omg.CORBA.portable.IDLEntity;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class ourUserException
+public class WeThrowThisException
extends UserException
implements IDLEntity
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* Our specific field, transferred to client.
*/
@@ -63,7 +68,7 @@ public class ourUserException
*
* @param _ourField the value of our specific field.
*/
- public ourUserException(int _ourField)
+ public WeThrowThisException(int _ourField)
{
ourField = _ourField;
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserExceptionHelper.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java
index 8c499df6472..4d5eee74b4b 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserExceptionHelper.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java
@@ -1,4 +1,4 @@
-/* ourUserExceptionHelper.java --
+/* WeThrowThisExceptionHelper.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,14 +50,14 @@ import org.omg.CORBA.TypeCode;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class ourUserExceptionHelper
+public abstract class WeThrowThisExceptionHelper
{
/**
* The exception repository id. This name is also used to find the
* mapping local CORBA class.
*/
private static String _id =
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException:1.0";
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException:1.0";
/**
* Get the exception repository id.
@@ -71,7 +71,7 @@ public abstract class ourUserExceptionHelper
* Extract the exception from the given Any where it might be
* wrapped.
*/
- public static ourUserException extract(Any a)
+ public static WeThrowThisException extract(Any a)
{
return read(a.create_input_stream());
}
@@ -79,9 +79,9 @@ public abstract class ourUserExceptionHelper
/**
* Read the exception from the CDR stream.
*/
- public static ourUserException read(org.omg.CORBA.portable.InputStream istream)
+ public static WeThrowThisException read(org.omg.CORBA.portable.InputStream istream)
{
- ourUserException value = new ourUserException(0);
+ WeThrowThisException value = new WeThrowThisException(0);
// The repository ID is not used
istream.read_string();
@@ -98,8 +98,8 @@ public abstract class ourUserExceptionHelper
TypeCode member = null;
member = ORB.init().get_primitive_tc(TCKind.tk_long);
members [ 0 ] = new StructMember("ourField", member, null);
- return ORB.init().create_struct_tc(ourUserExceptionHelper.id(),
- "ourUserException", members
+ return ORB.init().create_struct_tc(WeThrowThisExceptionHelper.id(),
+ "WeThrowThisException", members
);
}
@@ -107,7 +107,7 @@ public abstract class ourUserExceptionHelper
* Write the exception into the CDR stream.
*/
public static void write(org.omg.CORBA.portable.OutputStream ostream,
- ourUserException value
+ WeThrowThisException value
)
{
ostream.write_string(id());
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterImplBase.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java
index 4c8f5b94c68..237c23086eb 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterImplBase.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java
@@ -1,4 +1,4 @@
-/* _comTesterImplBase.java --
+/* _DemoTesterImplBase.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,13 +53,16 @@ import org.omg.CORBA.portable.ResponseHandler;
/**
* The base for the class that is actually implementing the functionality
- * of the object on the server side ({@link comServant} of our case).
+ * of the object on the server side ({@link DemoServant} of our case).
+ *
+ * Following CORBA standards, the name of this class must start from
+ * underscore and end by the "ImplBase".
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class _comTesterImplBase
+public abstract class _DemoTesterImplBase
extends ObjectImpl
- implements comTester, InvokeHandler
+ implements DemoTester, InvokeHandler
{
/**
* When the server receives the request message from client, it
@@ -138,7 +141,7 @@ public abstract class _comTesterImplBase
}
else
/*
- Throws either 'ourUserException' with the 'ourField' field
+ Throws either 'WeThrowThisException' with the 'ourField' field
initialised to the passed positive value
or system exception (if the parameter is zero or negative).
*/
@@ -150,21 +153,21 @@ public abstract class _comTesterImplBase
throwException(parameter);
out = rh.createReply();
}
- catch (ourUserException exception)
+ catch (WeThrowThisException exception)
{
out = rh.createExceptionReply();
- ourUserExceptionHelper.write(out, exception);
+ WeThrowThisExceptionHelper.write(out, exception);
}
}
else
/* Passes and returns the structures. */
if (a_method.equals("passStructure"))
{
- passThis in_structure = passThisHelper.read(in);
- returnThis result = null;
+ StructureToPass in_structure = StructureToPassHelper.read(in);
+ StructureToReturn result = null;
result = passStructure(in_structure);
out = rh.createReply();
- returnThisHelper.write(out, result);
+ StructureToReturnHelper.write(out, result);
}
else
/* Passes and returns the string sequence. */
@@ -180,11 +183,11 @@ public abstract class _comTesterImplBase
/** Pass and return the tree structure */
if (a_method.equals("passTree"))
{
- nodeHolder tree = new nodeHolder();
- tree.value = nodeHelper.read(in);
+ TreeNodeHolder tree = new TreeNodeHolder();
+ tree.value = TreeNodeHelper.read(in);
passTree(tree);
out = rh.createReply();
- nodeHelper.write(out, tree.value);
+ TreeNodeHelper.write(out, tree.value);
}
else
@@ -201,6 +204,6 @@ public abstract class _comTesterImplBase
public String[] _ids()
{
// They are the same as for the stub.
- return _comTesterStub._ids;
+ return _DemoTesterStub._ids;
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterStub.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java
index b71cd8e863f..c8e0ccd6d27 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterStub.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java
@@ -1,4 +1,4 @@
-/* _comTesterStub.java --
+/* _DemoTesterStub.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,23 +55,26 @@ import org.omg.CORBA.portable.RemarshalException;
* side. It has all the same methods as the actual implementation
* on the server side. These methods contain the code for remote
* invocation.
+ *
+ * Following CORBA standards, the name of this class must start from
+ * underscore and end by the "Stub".
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class _comTesterStub
+public class _DemoTesterStub
extends ObjectImpl
- implements comTester
+ implements DemoTester
{
/**
- * A string array of comTester repository ids.
+ * A string array of DemoTester repository ids.
*/
public static String[] _ids =
{
- "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester:1.0"
+ "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/DemoTester:1.0"
};
/**
- * Return an array of comTester repository ids.
+ * Return an array of DemoTester repository ids.
*/
public String[] _ids()
{
@@ -217,7 +220,7 @@ public class _comTesterStub
/**
Passes and returns the structures.
*/
- public returnThis passStructure(passThis in_structure)
+ public StructureToReturn passStructure(StructureToPass in_structure)
{
InputStream in = null;
try
@@ -226,13 +229,13 @@ public class _comTesterStub
OutputStream out = _request("passStructure", true);
// Write the structure, using its helper.
- passThisHelper.write(out, in_structure);
+ StructureToPassHelper.write(out, in_structure);
// Invoke the method.
in = _invoke(out);
// Read the returned structer, using another helper.
- returnThis result = returnThisHelper.read(in);
+ StructureToReturn result = StructureToReturnHelper.read(in);
return result;
}
catch (ApplicationException ex)
@@ -253,7 +256,7 @@ public class _comTesterStub
/**
* Pass and return the tree structure
*/
- public void passTree(nodeHolder tree)
+ public void passTree(TreeNodeHolder tree)
{
InputStream in = null;
try
@@ -261,15 +264,15 @@ public class _comTesterStub
// Get the stream where the parameters must be written.
OutputStream out = _request("passTree", true);
- // Write the tree (node with its chilred, grandchildren and so on),
+ // Write the tree (TreeNode with its chilred, grandchildren and so on),
// using the appropriate helper.
- nodeHelper.write(out, tree.value);
+ TreeNodeHelper.write(out, tree.value);
// Call the method.
in = _invoke(out);
// Read the returned tree.
- tree.value = nodeHelper.read(in);
+ tree.value = TreeNodeHelper.read(in);
}
catch (ApplicationException ex)
{
@@ -382,10 +385,10 @@ public class _comTesterStub
* of the positive value of this argument, and system
* exception otherwise.
*
- * @throws ourUserException
+ * @throws WeThrowThisException
*/
public void throwException(int parameter)
- throws ourUserException
+ throws WeThrowThisException
{
InputStream in = null;
try
@@ -408,9 +411,9 @@ public class _comTesterStub
// If this is the user exception we expect to catch, read and throw
// it here. The system exception, if thrown, is handled by _invoke.
- if (id.equals("IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException:1.0")
+ if (id.equals("IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException:1.0")
)
- throw ourUserExceptionHelper.read(in);
+ throw WeThrowThisExceptionHelper.read(in);
else
throw new MARSHAL(id);
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/README.html b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/README.html
new file mode 100644
index 00000000000..a3a9e62823e
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/README.html
@@ -0,0 +1,493 @@
+<html>
+ <head>
+ <title>Five-in-a-row v 0.0</title>
+ </head>
+ <body LANG="en-US">
+ <h1>
+ <i>Five-in-a-row
+ </i> 0.0 supplementary documentation
+ </h1>
+ <h3>Introduction and rules
+ </h3>
+ <p>
+ <i>Five-in-a-row
+ </i> is a two player strategy game. The players
+ are connected via network using CORBA-based RMI/IIOP protocol and
+ make they moves with the help of the Swing-based
+ interface. While playing, the users can also chat.
+ </p>
+ <p>The system consists of the single server and any number of
+ interconnected players. The person, willing to play, starts the
+ client and connects the server. The server redirects call to the
+ partner that has previously connected the same server, also willing
+ to play.
+ </p>
+ <p>The game desk is a field where it is possible to set O's
+ and X'es, one per move. The goal is to get five O's in a row while
+ preventing your partner from getting five X's in a row. Vertical,
+ horizontal and diagonal rows are allowed. The system detects the
+ loss-victory situation on the desk, but currently does not serve as a
+ playing partner, requiring at least two human players for this game.
+ </p>
+ <p>Both players can at any time reset the game (restarting it with
+ the same player) or leave the game (disconnecting). The disconnected
+ player can contact the game manager again, requesting to find another
+ partner.
+ </p>
+ <p>Simple as it is, the application has some features of the typical
+ role playing game that frequently just has more states, actions,
+ possible moves and also provides far richer graphics environment. The
+ game manger serves as a World-Wide-Pub where you can always find a
+ partner to play.
+
+ The players can made both unsynchronized (chatting, game reset and
+ leaving) and synchronized (moves) actions. The game state changes
+ while playing, and the set of the available actions depends on the
+ current state. Finally, the mouse and canvas are involved. However
+ using RMI/IIOP machinery allowed to implement all this functionality
+ with just 13 classes (plus 4 generated), all of them being rather
+ simple.
+
+ This example refers to the standard classes only and must be buildable
+ from your IDE as long as it has any java 1.4 compiler.
+ </p>
+ <p>
+ The used IIOP protocol must ensure interoperability, allowing players
+ to use different java virtual machines and operating systems.
+ The processors may have the opposite byte order.
+ </p>
+ <h3>Configuration and run
+ </h3>
+ <p>The game manager server executable class is
+ <i>gnu.classpath.examples.CORBA.swing.x5.X5Server
+ </i>. After start,
+ it will print to console the Internet address that must be entered to
+ the client to reach the manager.
+ </p>
+ <p>The client executable class it
+ <i>gnu.classpath.examples.CORBA.swing.x5.Demo
+ </i>.
+ </p>
+ <p>The game should run with GNU Classpath
+ 0.19 and Sun Microsystems java 1.5.0_04. Due later fixed bugs it will
+ not run with the older versions of these two implementations.
+ </p>
+ <p>The game manager HTTP server uses port
+ 1500. Hence all firewalls between the server and the player must be
+ configured to allow HTTP on 1500. The ports, used by the RMI/IIOP are
+ not persistent. GNU Classpath is configured to take ports 1501, 1502
+ and 1503 (the firewalls must allow to use them for RMI/IIOP). The
+ CORBA implementation other than Classpath may use different port
+ values. Unfortunately, there is no standard method to configure the
+ used port range in a vendor-independent way.
+ </p>
+ <h3>The game server
+ </h3>
+ <p>The game manager is first reachable via http:// protocol (for
+ instance http://123.456.7.89:1500). The simple server at this port
+ always serves much longer string, representing the CORBA stringified
+ object reference (IOR). The
+ <i>Five-in-a-row&nbsp;
+ </i>client uses
+ this reference to find and access the remote game server object.
+ </p>
+ <p>If the server player queue is empty, it simply queues this player.
+ If the queue is not empty, the server introduces the arrived player
+ and queued player to each other as leaves the them alone. When
+ playing, the two clients communicate with each other directly, so the
+ server is just a &ldquo;meeting point&rdquo; where the players can
+ find each other. The game server is a console-only application.
+ </p>
+ <p>The initial server http:// address must be transferred to players
+ by some other means of communication (web chat, E-mail, link in a web
+ site and so on). The server writes this address to the specified
+ file, and the client can also take the default value from the same
+ file. This is convenient when all applications run on a single
+ machine, but also may be used to transfer the address via shared
+ filesystem.
+ </p>
+ <h3>The game client
+ </h3>
+ <p>The clients are Swing-based GUI applications, capable for remote
+ communication with each other and with the game manager. They have a
+ set of predefined states and switch between these states in
+ accordance to the preprogrammed logic. The client states are defined
+ in the
+ <i>State
+ </i> interface. They are displayed in the bottom left
+ corner of the window and are summarized in the following table:
+ </p>
+ <table BORDER=1 CELLPADDING=4 CELLSPACING=0 WIDTH="100%">
+ <thead>
+ <tr BGCOLOR="#ccccff">
+ <th BGCOLOR="#e6e6ff">
+ Our state
+ </th>
+ <th BGCOLOR="#e6e6ff">
+ Partner state
+ </th>
+ <th BGCOLOR="#e6e6ff">
+ Possible actions
+ </th>
+ <th BGCOLOR="#e6e6ff">
+ Comment
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ Disconnected
+ </td>
+ <td>
+ Partner not accessible
+ </td>
+ <td>
+ Connect
+ </td>
+ <td>
+ Initial state.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Queued
+ </td>
+ <td>
+ Partner not accessible
+ </td>
+ <td>
+ Leave
+ </td>
+ <td>
+ Queued by the game manager.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ I think.
+ </td>
+ <td>
+ I wait for your move
+ </td>
+ <td>
+ Make move, reset game, leave, chat.
+ </td>
+ <td>
+ The person who waited for another player to come starts
+ the game first.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ I wait for your move
+ </td>
+ <td>
+ I think
+ </td>
+ <td>
+ Chat, reset game, leave.
+ </td>
+ <td>
+ After the partner makes the move, the state changes to
+ <i>I think
+ </i>, unless the end of game situation is detected by
+ the desk analyzer.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ I have lost
+ </td>
+ <td>
+ I have won
+ </td>
+ <td>
+ Chat, reset game, leave.
+ </td>
+ <td>
+ Can be entered with the help of the desk analyzer only.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ I have won
+ </td>
+ <td>
+ I have lost
+ </td>
+ <td>
+ Chat, reset game, leave
+ </td>
+ <td>
+ Can be entered with the help of the desk analyzer only.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Error
+ </td>
+ <td>
+ Any
+ </td>
+ <td>
+ Chat, leave
+ </td>
+ <td>
+ This should never happen under normal work, but the demo
+ program may be modified by the user.
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <br>
+ <br>
+ As it is seen, being in one of the states, the client expects to
+ be the partner client in a certain defined state, and both clients
+ change they states in a synchronized manner. Each state has its own
+ set of the available actions and each action either preserves the
+ current state (chat, reset) or changes it following the rules. For
+ this simple example, the state change rules are obvious.
+ <h3>The used RMI-IIOP architecture
+ </h3>
+ Both player and game manager servants are derived from the
+ <i>org.omg.PortableServer.Servant
+ </i> and, being servants, are simply
+ connected to the
+ <i>POA
+ </i>with
+ <i>POA.servant_to_reference
+ </i>. The
+ first remote object (game manager) is found using the stringified
+ object reference. No naming service is involved.
+</p>
+Where required, the CORBA objects are narrowed into required
+player and game manager interfaces using method
+<i>PortableRemoteObject.narrow(org.omg.CORBA.Object object, Class
+ interface_class)
+</i>, passing the actual interface of the object as
+the second parameter. After narrowing, the remote side obtains
+possibility to invoke remote methods, defined in the interface of
+this object. After the first remote object is found, other objects
+can be simply passed as the method parameters. For instance, the game
+manager introduces another player by passing its reference as a
+parameter to the method
+<i>Player.start_game.
+</i>
+<h3>Class and interface summary
+</h3>
+<table BORDER=1 CELLPADDING=3 CELLSPACING=0 WIDTH="100%">
+ <col>
+ <col>
+ <tr>
+ <th COLSPAN=2 BGCOLOR="#e6e6ff">
+ Executables classes
+ </th>
+ </tr>
+ <tr>
+ <td>
+ Demo
+ </td>
+ <td>
+ The main executable class of the game client.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ X5Server
+ </td>
+ <td>
+ The main executable class of the game manager server.
+ </td>
+ </tr>
+</table>
+<p></p>
+<table BORDER=1 CELLPADDING=3 CELLSPACING=0 WIDTH="100%">
+ <tr BGCOLOR="#ccccff">
+ <th COLSPAN=2 BGCOLOR="#e6e6ff">
+ Interface Summary
+ </th>
+ </tr>
+ <tr>
+ <td>
+ GameManager
+ </td>
+ <td>
+ The game manager interface.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Player
+ </td>
+ <td>
+ Defines remote methods that are invoked by another player or by
+ the challenge server.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ State
+ </td>
+ <td>
+ Defines the states in that the player can be.
+ </td>
+ </tr>
+</table>
+&nbsp;
+<table BORDER=1 CELLPADDING=3 CELLSPACING=0 WIDTH="100%">
+ <col>
+ <col>
+ <tr BGCOLOR="#ccccff">
+ <th COLSPAN=2 BGCOLOR="#e6e6ff">
+ Class Summary
+ </th>
+ </tr>
+ <tr>
+ <td>
+ _GameManager_Stub
+ </td>
+ <td>
+ Normally generated with rmic compiler, this class represents
+ the GameManager Stub on the client side.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ _GameManagerImpl_Tie
+ </td>
+ <td>
+ Normally generated with rmic compiler, this class represents
+ the GameManager Tie on the client side.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ _Player_Stub
+ </td>
+ <td>
+ Generate with rmic, command line rmic -iiop -poa -keep
+ gnu.classpath.examples.CORBA.swing.x5.PlayerImpl (the compiled
+ package must be present in the current folder).
+ </td>
+ </tr>
+ <tr>
+ <td>
+ _PlayerImpl_Tie
+ </td>
+ <td>
+ Generate with rmic, command line rmic -iiop -poa -keep
+ gnu.classpath.examples.CORBA.swing.x5.PlayerImpl (the compiled
+ package must be present in the current folder).
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ChatConstants
+ </td>
+ <td>
+ The chat color code constants, used to indicate who is talking.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ClientFrame
+ </td>
+ <td>
+ The JFrame of the GUI client.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ GameManagerImpl
+ </td>
+ <td>
+ The manager connects two players into the game.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ IorReader
+ </td>
+ <td>
+ Reads the remote URL.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ OrbStarter
+ </td>
+ <td>
+ Starts the ORBs, involved into this application.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ PlayerImpl
+ </td>
+ <td>
+ The implementation of the PlayerCommunicator, providing the
+ local functionality.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ PlayingDesk
+ </td>
+ <td>
+ Manages actions, related to the game rules and also does all
+ painting.
+ </td>
+ </tr>
+</table>
+<h3>See also
+</h3>
+<p>
+ <a HREF="http://www.javascripter.net/games/xo/xo.htm">http://www.javascripter.net/games/xo/xo.htm
+ </a>
+</p>
+<p>
+ <a HREF="http://www.leepoint.net/notes-java/45examples/55games/five/five.html">http://www.leepoint.net/notes-java/45examples/55games/five/five.html
+ </a>
+</p>
+<p>Copyright
+</p>
+<p>
+ <font COLOR="#b3b3b3">Copyright (C) 2005 Free Software Foundation,
+ Inc. This file is part of GNU Classpath. GNU Classpath 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, or (at your option) any later version.
+ GNU Classpath 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 GNU Classpath; see
+ the file COPYING. If not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination. As a special exception, the copyright holders of this
+ library give you permission to link this library with independent
+ modules to produce an executable, regardless of the license terms of
+ these independent modules, and to copy and distribute the resulting
+ executable under terms of your choice, provided that you also meet,
+ for each linked independent module, the terms and conditions of the
+ license of that module. An independent module is a module which is
+ not derived from or based on this library. If you modify this
+ library, you may extend this exception to your version of the
+ library, but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version.
+ </font>
+</p>
+<p>
+ <br>
+ <br>
+</p>
+<p>
+First version written by <a href="http://savannah.gnu.org/users/audriusa">
+Audrius Me&scaron;kauskas</a>
+</p>
+</body>
+</html>
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java
new file mode 100644
index 00000000000..9e1a70fcc16
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java
@@ -0,0 +1,307 @@
+/* CanvasWorld.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+
+/**
+ * The purpose of this simple example is to check if the mouse events are
+ * correctly received in a scrollable canvas and also if the canvas are
+ * correctly repainted. The similar canvas are used in various games and
+ * interactive demonstrations.
+ *
+ * The user can set one of the three possible figures with the different
+ * mouse buttons. The figure must be set where the user have clicked the
+ * mouse.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class CanvasWorld
+ extends JComponent
+ implements MouseListener, State
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Red oval, set by the left mouse button.
+ */
+ public static final int RED = 0;
+
+ /**
+ * Black cross, set by the right mouse button.
+ */
+ public static final int BLACK = 1;
+
+ /**
+ * Blue and smaller oval, set by the middle mouse button.
+ */
+ public static final int HINT = 2;
+
+ /**
+ * The message string is displayed at the top of the window.
+ */
+ String message = "Click left, right or middle button in to set the figure";
+
+ /**
+ * The additinal message, related to the mouse events.
+ */
+ String mouse = "No mouse event so far";
+
+ /**
+ * The grid spacing.
+ */
+ static int W = 16;
+
+ /**
+ * The radius of the dots being painted.
+ */
+ static int R = W / 3;
+
+ /**
+ * The collection of the red dots.
+ */
+ ArrayList reds = new ArrayList();
+
+ /**
+ * The collection of the black crosses.
+ */
+ ArrayList blacks = new ArrayList();
+
+ /**
+ * The collection of the smaller blue crosses.
+ */
+ ArrayList hints = new ArrayList();
+
+ public CanvasWorld()
+ {
+ try
+ {
+ addMouseListener(this);
+ }
+ catch (Exception e)
+ {
+ throw new AssertionError(e);
+ }
+ }
+
+ /**
+ * Paint this component.
+ */
+ public void paintComponent(Graphics g)
+ {
+ int w = getWidth();
+ int h = getHeight();
+
+ g.setColor(Color.white);
+ g.fillRect(0, 0, w, h);
+
+ drawGrid(w, h, g);
+
+ g.setColor(Color.black);
+
+ g.drawString(message, W, W);
+ g.drawString(mouse, W, 2*W);
+
+ drawFigures(g);
+ }
+
+ /**
+ * Check for the presence of the given point in the collection.
+ */
+ public final boolean pointPresent(int x, int y, Collection in)
+ {
+ Iterator iter = in.iterator();
+ Point p;
+ while (iter.hasNext())
+ {
+ p = (Point) iter.next();
+ if (p.x == x && p.y == y)
+ return true;
+ }
+ return false;
+ }
+
+ public void drawGrid(int w, int h, Graphics g)
+ {
+ g.setColor(Color.lightGray);
+
+ int xs = 2*W+W/2;
+
+ // Draw vertical lines:
+ for (int x = 0; x < w; x += W)
+ {
+ g.drawLine(x, xs, x, h);
+ }
+
+ // Draw horizontal lines:
+ for (int y = 3*W; y < h; y += W)
+ {
+ g.drawLine(0, y, w, y);
+ }
+
+ g.setColor(Color.gray);
+ }
+
+ public void drawFigures(Graphics g)
+ {
+ g.setColor(Color.red);
+ drawDots(reds, g, RED);
+
+ g.setColor(Color.black);
+ drawDots(blacks, g, BLACK);
+
+ g.setColor(Color.blue);
+ drawDots(hints, g, HINT);
+ }
+
+ public Point makePoint(int x, int y)
+ {
+ return new Point(x / W, y / W);
+ }
+
+ /**
+ * Draw a collection of dots (the collor must be set before calling the
+ * method).
+ */
+ public void drawDots(Collection dots, Graphics g, int mode)
+ {
+ Iterator iter = dots.iterator();
+ int x;
+ int y;
+
+ int hW = W / 2;
+ int RR = R * 2;
+ int hR = R / 2;
+ Point p;
+ while (iter.hasNext())
+ {
+ p = (Point) iter.next();
+ x = p.x * W + hW;
+ y = p.y * W + hW;
+
+ if (mode == RED)
+ g.drawOval(x - R, y - R, RR, RR);
+ else if (mode == BLACK)
+ {
+ g.drawLine(x - R, y - R, x + R, y + R);
+ g.drawLine(x - R, y + R, x + R, y - R);
+ }
+ else
+ {
+ // Hint.
+ g.drawOval(x - hR, y - hR, R, R);
+ }
+ }
+ }
+
+ public void mouseClicked(MouseEvent e)
+ {
+ int x = e.getX();
+ int y = e.getY();
+
+ Point p = makePoint(x, y);
+
+ // Ignore clicks on the occupied cells.
+ if (pointPresent(p.x, p.y, reds) || (pointPresent(p.x, p.y, blacks)))
+ {
+ message = "Clicked on the occupied cell.";
+ return;
+ }
+ else
+ message = "Figure set at ["+p.x+","+p.y+"]";
+
+ if (e.getButton() == MouseEvent.BUTTON1)
+ reds.add(p);
+ else if (e.getButton() == MouseEvent.BUTTON3)
+ blacks.add(p);
+ else if (e.getButton() == MouseEvent.BUTTON2)
+ hints.add(p);
+ repaint();
+ }
+
+ public void mouseEntered(MouseEvent m)
+ {
+ mouse = "Mouse entered.";
+ repaint();
+ }
+
+ public void mousePressed(MouseEvent m)
+ {
+ mouse = "Mouse pressed at "+m.getX()+","+m.getY();
+ repaint();
+ }
+
+ public void mouseReleased(MouseEvent m)
+ {
+ mouse = "Mouse released at "+m.getX()+","+m.getY();
+ repaint();
+ }
+
+ public void mouseExited(MouseEvent m)
+ {
+ mouse = "Mouse exited";
+ repaint();
+ }
+
+ public static void main(String[] args)
+ {
+ JFrame frame = new JFrame();
+ CanvasWorld world = new CanvasWorld();
+ world.setPreferredSize(new Dimension(1000,1000));
+ frame.add(new JScrollPane(world));
+ frame.setSize(400, 200);
+ frame.setVisible(true);
+ }
+
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java
new file mode 100644
index 00000000000..b0552b43943
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java
@@ -0,0 +1,80 @@
+/* ChatConstants.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Color;
+
+/**
+ * The chat color code constants, used to indicate who is talking.
+ * Additionally, the red color is reseved for the most important messages,
+ * related to the start and end of the game.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class ChatConstants
+{
+ /**
+ * Messages from the local system.
+ */
+ public static byte SYSTEM = 0;
+
+ /**
+ * Mirrored messsages from the local player.
+ */
+ public static byte SELF = 1;
+
+ /**
+ * Messages from the remote player.
+ */
+ public static byte REMOTE_PLAYER = 2;
+
+ /**
+ * Messages from the game server/
+ */
+ public static byte GAME_SERVER = 3;
+
+ /**
+ * The array of the used colors.
+ */
+ public static Color[] colors =
+ new Color[]
+ {
+ Color.black, new Color(0, 80, 0), new Color(0, 0, 128), Color.blue
+ };
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java
new file mode 100644
index 00000000000..c3d8300b7c3
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java
@@ -0,0 +1,417 @@
+/* ClientFrame.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.event.*;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+
+import java.rmi.RemoteException;
+
+import javax.rmi.PortableRemoteObject;
+
+import javax.swing.*;
+import java.awt.Dimension;
+
+/**
+ * The JFrame of the GUI client.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class ClientFrame
+ extends JFrame
+{
+ /**
+ * The size of the playing field.
+ */
+ public final Dimension DESK_SIZE =
+ new Dimension(624, 352-PlayingDesk.W);
+
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ // Define the application components:
+
+ /**
+ * Central panel where the main action takes place.
+ */
+ PlayingDesk desk = new PlayingDesk();
+
+ /**
+ * The scroll pane for canvas.
+ */
+ JScrollPane scroll = new JScrollPane();
+
+ /**
+ * Will remember the manager IOR.
+ */
+ String mior = "";
+
+ // The bottom panel contains the area that is used both to enter URL and
+ // for chatting.
+ JPanel pnBottom = new JPanel();
+
+ BorderLayout layBottom = new BorderLayout();
+
+ JTextField taUrl = new JTextField();
+
+ // The top primitive chatting panel, composed from labels.
+ JPanel pnChat = new JPanel();
+
+ GridLayout layChat = new GridLayout();
+
+ JLabel lbC3 = new JLabel();
+
+ JLabel lbC2 = new JLabel();
+
+ JLabel lbC1 = new JLabel();
+
+ // The button panel.
+ JPanel pnButtons = new JPanel();
+
+ GridLayout layButtons = new GridLayout();
+
+ JButton bLeave = new JButton();
+
+ JButton bConnect = new JButton();
+
+ JButton bExit = new JButton();
+
+ JButton bReset = new JButton();
+
+ JLabel lbState = new JLabel();
+
+ JButton bChat = new JButton();
+
+ JButton bPaste = new JButton();
+
+ public ClientFrame()
+ {
+ try
+ {
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void jbInit()
+ throws Exception
+ {
+ desk.frame = this;
+
+ pnBottom.setLayout(layBottom);
+
+ pnChat.setLayout(layChat);
+ layChat.setColumns(1);
+ layChat.setRows(3);
+
+ lbC1.setText("This program needs the game server (see README on how to start it).");
+ lbC2.setText("Enter the game server address (host:port)");
+ lbC3.setText("Pressing \'Connect\' with the empty address will start the server on "
+ + "the local machine.");
+ bLeave.setEnabled(true);
+ bLeave.setToolTipText("Leave if either you have lost or do not want longer to play with "
+ + "this partner.");
+ bLeave.setText("Leave game");
+ bLeave.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ bLeave_actionPerformed(e);
+ }
+ });
+ bConnect.setToolTipText("Connect your playing partner");
+ bConnect.setText("Connect");
+ bConnect.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ bConnect_actionPerformed(e);
+ }
+ });
+ pnButtons.setLayout(layButtons);
+ bExit.setToolTipText("Exit this program");
+ bExit.setText("Exit");
+ bExit.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ bExit_actionPerformed(e);
+ }
+ });
+ layButtons.setHgap(2);
+ bReset.setToolTipText("Restart the game. The partner may choose to exit!");
+ bReset.setText("Reset game");
+ bReset.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ bReset_actionPerformed(e);
+ }
+ });
+ lbState.setText("Disconnected");
+ bChat.setToolTipText("Send message to player. Reuse the address "+
+ "field to enter the message.");
+ bChat.setText("Chat");
+ bChat.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ bChat_actionPerformed(e);
+ }
+ });
+
+ bPaste.setText("Paste");
+ bPaste.setToolTipText("Paste, same as Ctrl-V");
+ bPaste.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ bPaste_actionPerformed(e);
+ }
+ });
+
+ desk.setMaximumSize(DESK_SIZE);
+ desk.setPreferredSize(DESK_SIZE);
+
+ scroll.getViewport().add(desk, null);
+ getContentPane().add(scroll, BorderLayout.CENTER);
+ getContentPane().add(pnBottom, BorderLayout.SOUTH);
+
+ pnBottom.add(taUrl, BorderLayout.CENTER);
+ pnBottom.add(pnChat, BorderLayout.NORTH);
+
+ pnChat.add(lbC1, null);
+ pnChat.add(lbC2, null);
+ pnChat.add(lbC3, null);
+ pnBottom.add(pnButtons, BorderLayout.SOUTH);
+ pnButtons.add(lbState, null);
+ pnButtons.add(bConnect, null);
+ pnButtons.add(bChat, null);
+ pnButtons.add(bLeave, null);
+ pnButtons.add(bReset, null);
+ pnButtons.add(bExit, null);
+ pnButtons.add(bPaste, null);
+
+ desk.player.set_current_state(State.DISCONNECTED);
+ }
+
+ /**
+ * Handles exit procedure.
+ */
+ protected void processWindowEvent(WindowEvent e)
+ {
+ super.processWindowEvent(e);
+ if (e.getID() == WindowEvent.WINDOW_CLOSING)
+ {
+ bExit_actionPerformed(null);
+ }
+ }
+
+ /**
+ * Handles the connection procedure.
+ */
+ void bConnect_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ int state = desk.player.get_current_state();
+
+ if (state == State.DISCONNECTED || state == State.ERROR)
+ {
+ talk(ChatConstants.colors[0], "Connecting...");
+
+ if (desk.manager == null)
+ {
+ mior = taUrl.getText().trim();
+
+ // Obtain the manager object:
+ org.omg.CORBA.Object object = null;
+
+ try
+ {
+ object = desk.orb.string_to_object(mior);
+ }
+ catch (Exception exc)
+ {
+ // Maybe CORBA 3.0.3 is not completely implemented?
+ if (mior.startsWith("http://") || mior.startsWith("ftp://")
+ || mior.startsWith("file://"))
+ object = desk.orb.string_to_object(IorReader.readUrl(mior));
+ else
+ throw exc;
+ }
+
+ desk.manager = (GameManager) PortableRemoteObject.narrow(
+ object, GameManager.class);
+
+ // Export the desk.player as a remote object.
+ PortableRemoteObject.exportObject(desk.player);
+ }
+
+ desk.player.set_current_state(State.QUEUED);
+ desk.manager.requestTheGame(desk.player);
+ }
+
+ // Save the specified IOR for the future use:
+ File gmf = new File(OrbStarter.WRITE_URL_TO_FILE);
+ FileWriter f = new FileWriter(gmf);
+ BufferedWriter b = new BufferedWriter(f);
+
+ b.write(mior);
+ b.close();
+ }
+ catch (Exception ex)
+ {
+ talk(Color.red, "The manager is not reachable by this address.");
+ talk(Color.red, ex.getMessage());
+ desk.player.set_current_state(State.DISCONNECTED);
+ }
+ }
+
+ /**
+ * Display the new message with the given color. Shift the other messages over
+ * the labels.
+ */
+ public void talk(Color color, String text)
+ {
+ lbC1.setText(lbC2.getText());
+ lbC1.setForeground(lbC2.getForeground());
+
+ lbC2.setText(lbC3.getText());
+ lbC2.setForeground(lbC3.getForeground());
+
+ lbC3.setText(text);
+ lbC3.setForeground(color);
+ }
+
+ /**
+ * Exit this program.
+ */
+ void bExit_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ if (desk.player.get_current_state() != State.DISCONNECTED
+ && desk.player.partner != null)
+ {
+ desk.player.partner.receive_chat(ChatConstants.REMOTE_PLAYER,
+ "I close the program!");
+ desk.player.partner.disconnect();
+ }
+ }
+ catch (RemoteException ex)
+ {
+ // We will print the exception because this is a demo application that
+ // may be modified for learning purposes.
+ ex.printStackTrace();
+ }
+ System.exit(0);
+ }
+
+ void bReset_actionPerformed(ActionEvent e)
+ {
+ if (desk.player.partner != null)
+ {
+ try
+ {
+ desk.player.partner.receive_chat(ChatConstants.REMOTE_PLAYER,
+ "Your partner restarted the game.");
+
+ desk.player.start_game(desk.player.partner, false);
+ desk.player.partner.start_game(desk.player, true);
+ }
+ catch (RemoteException ex)
+ {
+ // We will print the exception because this is a demo application
+ // that
+ // may be modified for learning purposes.
+ ex.printStackTrace();
+ }
+ }
+ else
+ talk(Color.black, "You have not started the game yet.");
+ }
+
+ void bLeave_actionPerformed(ActionEvent e)
+ {
+ desk.player.leave();
+ }
+
+ void bChat_actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ if (desk.player.partner != null)
+ {
+ String message = taUrl.getText();
+ desk.player.partner.receive_chat(ChatConstants.REMOTE_PLAYER, message);
+ talk(ChatConstants.colors[ChatConstants.SELF], message);
+ taUrl.setText("");
+ }
+ else
+ {
+ talk(Color.black, "Sorry, not connected to anybody");
+ }
+ }
+ catch (RemoteException ex)
+ {
+ // We will print the exception because this is a demo application that
+ // may be modified for learning purposes.
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Work around our keyboard shortcut handling that is still not working
+ * properly.
+ */
+ void bPaste_actionPerformed(ActionEvent e)
+ {
+ taUrl.paste();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java
new file mode 100644
index 00000000000..b83217896d5
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java
@@ -0,0 +1,99 @@
+/* Demo.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+/**
+ * The main executable class of the game client.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class Demo
+{
+
+ public static void main(String[] args)
+ {
+ ClientFrame frame = new ClientFrame();
+ frame.setSize(new Dimension(640, 480));
+ frame.setTitle("Make vertical, horizontal or diagonal line of 5 dots. "
+ + "Click mouse to set the dot.");
+ frame.validate();
+
+ // Center the window
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension frameSize = frame.getSize();
+ if (frameSize.height > screenSize.height)
+ {
+ frameSize.height = screenSize.height;
+ }
+ if (frameSize.width > screenSize.width)
+ {
+ frameSize.width = screenSize.width;
+ }
+ frame.setLocation((screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2);
+ frame.setVisible(true);
+
+ // Set the ior.
+ try
+ {
+ if (OrbStarter.WRITE_URL_TO_FILE != null)
+ {
+ File saved_ior = new File(OrbStarter.WRITE_URL_TO_FILE);
+ if (saved_ior.exists())
+ {
+ FileReader f = new FileReader(saved_ior);
+ String s = new BufferedReader(f).readLine();
+ frame.taUrl.setText(s);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // We will print the exception, because this is a demo program -
+ // expected to be modified by user.
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java
new file mode 100644
index 00000000000..4d632e8bf57
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java
@@ -0,0 +1,68 @@
+/* GameManager.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * The game manager interface.
+ *
+ * Defines the operations of the game server that connects two players into
+ * the game. The game server does not participate in the game itself.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface GameManager extends Remote
+{
+ /**
+ * Register the newPlayer as the person who is willing to play. When another
+ * player calls this method, the Manager connects them by calling
+ * {@link PlayerCommunicator#start_game}. The manager provides the partner
+ * and sets (randomly) the starting side.
+ */
+ void requestTheGame(Player newPlayer) throws RemoteException;
+
+ /**
+ * Unregister the player that left and is no longer waiting for a playing
+ * partner to come.
+ * @throws RemoteException
+ */
+ void unregister(Player player) throws RemoteException;
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java
new file mode 100644
index 00000000000..fc449bc50ba
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java
@@ -0,0 +1,135 @@
+/* GameManagerImpl.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.RemoteException;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+
+/**
+ * The manager connects two players into the game.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class GameManagerImpl
+ implements GameManager
+{
+ /**
+ * The game manager IOR.
+ */
+ static String ior;
+
+ /**
+ * The game manager ORB.
+ */
+ static ORB orb;
+
+ /**
+ * True if the manager started ok.
+ */
+ static boolean ok;
+
+ /**
+ * Another player that is already waiting for the game.
+ */
+ Player queuedPlayer = null;
+
+ public synchronized void requestTheGame(Player newPlayer)
+ throws RemoteException
+ {
+ System.out.println("Game requested");
+
+ if (queuedPlayer == null)
+ {
+ // No other player so far.
+ newPlayer.receive_chat(ChatConstants.GAME_SERVER,
+ "Request registered, waiting for the other player to come...");
+ System.out.println("Player queued.");
+ queuedPlayer = newPlayer;
+ }
+ else if (queuedPlayer.equals(newPlayer))
+ {
+ // The same player applies again.
+ newPlayer.receive_chat(ChatConstants.GAME_SERVER,
+ "No other player so far... Please wait.");
+ }
+ else
+ {
+ // As the queued player waited for the game, we allow him/her
+ // to start the game. This is a reward for waiting.
+ newPlayer.receive_chat(ChatConstants.GAME_SERVER,
+ "The other player is waiting. The game started, your "
+ + "partner begins...");
+ queuedPlayer.receive_chat(ChatConstants.GAME_SERVER,
+ "The other player arrived. Lets play, you begin the game now...");
+
+ newPlayer.start_game(queuedPlayer, false);
+ queuedPlayer.start_game(newPlayer, true);
+
+ queuedPlayer = null;
+ System.out.println("Players connected.");
+ }
+ }
+
+ /**
+ * Unregister the player who left and is no longer waiting for another side.
+ */
+ public void unregister(Player player)
+ throws RemoteException
+ {
+ if (queuedPlayer != null)
+ {
+ // We need to verify the identity of the player being unregistered.
+ // The stubs, being derived from the org.omg.CORBA.Object, have the
+ // method for this. This method compares the player host address,
+ // used port and the object key.
+ if (player instanceof Object && queuedPlayer instanceof Object)
+ {
+ Object a = (Object) player;
+ Object b = (Object) queuedPlayer;
+
+ if (a._is_equivalent(b))
+ queuedPlayer = null;
+ }
+ else
+ queuedPlayer = null;
+ }
+ System.out.println("Unregistering player");
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java
new file mode 100644
index 00000000000..a976def74f3
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java
@@ -0,0 +1,124 @@
+/* IorReader.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.DATA_CONVERSION;
+
+/**
+ * Reads the remote URL. Following formal/04-03-12, CORBA should be able to do
+ * this without the help of this class. However some popular class libraries
+ * are written using the older CORBA specifications and may not handle
+ * functionality, require by this game. This class substitutes the functionality,
+ * ensuring that these implementations will also start and we will be able
+ * to test the interoperability.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class IorReader
+{
+ /**
+ * Read IOR from the remote URL.
+ */
+ public static String readUrl(String url)
+ {
+ URL u;
+ try
+ {
+ u = new URL(url);
+ }
+ catch (MalformedURLException mex)
+ {
+ throw new BAD_PARAM("Malformed URL: '" + url + "'");
+ }
+
+ try
+ {
+ InputStreamReader r = new InputStreamReader(u.openStream());
+
+ StringBuffer b = new StringBuffer();
+ int c;
+
+ while ((c = r.read()) > 0)
+ b.append((char) c);
+
+ return b.toString().trim();
+ }
+ catch (Exception exc)
+ {
+ DATA_CONVERSION d = new DATA_CONVERSION("Reading " + url + " failed.");
+ throw d;
+ }
+ }
+
+ /**
+ * Read IOR from the file in the local file system.
+ */
+ public static String readFile(String file)
+ {
+ File f = new File(file);
+ if (!f.exists())
+ {
+ DATA_CONVERSION err = new DATA_CONVERSION(f.getAbsolutePath()
+ + " does not exist.");
+ throw err;
+ }
+ try
+ {
+ char[] c = new char[(int) f.length()];
+ FileReader fr = new FileReader(f);
+ fr.read(c);
+ fr.close();
+ return new String(c).trim();
+ }
+ catch (IOException ex)
+ {
+ DATA_CONVERSION d = new DATA_CONVERSION();
+ d.initCause(ex);
+ throw (d);
+ }
+ }
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java
new file mode 100644
index 00000000000..3852945c6b9
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java
@@ -0,0 +1,236 @@
+/* OrbStarter.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.RemoteException;
+import java.util.Properties;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.ORB;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.Servant;
+
+/**
+ * Starts the ORBs, involved into this application.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class OrbStarter
+{
+ /**
+ * The game manager name server port. This server allows to access the game
+ * manager by host (IP) and port rather than by the rather long IOR string.
+ */
+ static int MANAGER_NAMER_PORT = 1500;
+
+ /**
+ * The used port range (understood and used by GNU Classpath only).
+ */
+ static String USED_PORT_RANGE = "1501-1503";
+
+ /**
+ * Specify the file where under start the game manager writes its IOR.
+ * You may specify the path if the game manager and player clients have
+ * access to some share file system or if you prefer to write IOR to
+ * floppy and then read from the floppy on the client side. Both clients
+ * and server will use this constant. Set to null not to write the IOR.
+ */
+ static String WRITE_URL_TO_FILE = "game_manager_ior.txt";
+
+ /**
+ * Start the manager ORB.
+ * @return the manager URL if it starts.
+ */
+ public static String startManager(final String[] args)
+ {
+ GameManagerImpl.ior = null;
+ GameManagerImpl.ok = false;
+
+ final Properties p = new Properties();
+ p.put("gnu.CORBA.ListenerPort", USED_PORT_RANGE);
+
+ try
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ GameManagerImpl.orb = ORB.init(args, p);
+
+ // Obtain the root poa:
+ POA rootPOA = POAHelper.narrow(GameManagerImpl.orb.resolve_initial_references("RootPOA"));
+
+ GameManagerImpl impl = new GameManagerImpl();
+
+ PortableRemoteObject.exportObject(impl);
+
+ // Construct the tie that is also the servant.
+ Tie tie = new _GameManagerImpl_Tie();
+
+ // Set the invocation target for this tie.
+ tie.setTarget(impl);
+
+ // Obtain the reference to the corresponding CORBA object:
+ org.omg.CORBA.Object object = rootPOA.servant_to_reference((Servant) tie);
+
+ GameManagerImpl.ok = true;
+
+ // Activate the root POA.
+ rootPOA.the_POAManager().activate();
+
+ // Get the IOR URL that must be passed to clients.
+ GameManagerImpl.ior = GameManagerImpl.orb.object_to_string(object);
+
+ GameManagerImpl.orb.run();
+ }
+ catch (Exception exc)
+ {
+ exc.printStackTrace();
+ GameManagerImpl.ior = "Unable to start the ORB: " + exc;
+ }
+ }
+ }.start();
+
+ // Wait the thread to enter orb.run.
+ long t = System.currentTimeMillis();
+ while (GameManagerImpl.ior == null
+ && System.currentTimeMillis() - t < 20000)
+ {
+ Thread.sleep(100);
+ }
+
+ return GameManagerImpl.ior;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ return "Exception: " + e;
+ }
+ }
+
+ /**
+ * Start the client ORB.
+ */
+ public static String startPlayer(final Player player, final PlayingDesk desk)
+ {
+ desk.ior = null;
+ desk.ok = false;
+
+ final Properties p = new Properties();
+ p.put("gnu.CORBA.ListenerPort", USED_PORT_RANGE);
+
+ try
+ {
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ desk.orb = ORB.init(new String[0], p);
+
+ POA rootPOA = POAHelper.narrow(desk.orb.resolve_initial_references("RootPOA"));
+ rootPOA.the_POAManager().activate();
+
+ // Construct the tie.
+ Tie tie = new _PlayerImpl_Tie();
+
+ // Set the implementing class (invocation target).
+ tie.setTarget(new PlayerImpl());
+
+ // Connect the tie as POA servant.
+ org.omg.CORBA.Object object = rootPOA.servant_to_reference((Servant) tie);
+
+ // Get the stringified reference.
+ desk.ior = desk.orb.object_to_string(object);
+
+ // Mark that the object was created OK.
+ desk.ok = true;
+ desk.orb.run();
+ }
+ catch (Exception exc)
+ {
+ exc.printStackTrace();
+ desk.ior = "Unable to start the ORB: " + exc;
+ }
+ }
+ }.start();
+
+ long t = System.currentTimeMillis();
+ while (desk.ior == null && System.currentTimeMillis() - t < 20000)
+ {
+ Thread.sleep(100);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ return "Exception: " + e;
+ }
+
+ // Add shutdown hook to unregister from the manager.
+ Runtime.getRuntime().addShutdownHook(new Thread()
+ {
+ public void run()
+ {
+ if (desk.manager != null && player != null)
+ {
+ try
+ {
+ desk.manager.unregister(player);
+ }
+ catch (RemoteException ex)
+ {
+ // We will print the exception because this is a demo
+ // application that
+ // may be modified for learning purposes.
+ ex.printStackTrace();
+ }
+ desk.manager = null;
+ }
+ }
+ });
+ return desk.ior;
+ }
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Player.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Player.java
new file mode 100644
index 00000000000..ff5624b79c4
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/Player.java
@@ -0,0 +1,96 @@
+/* Player.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Point;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * Defines remote methods that are invoked by another player or by the
+ * challenge server.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface Player extends Remote
+{
+ /**
+ * Receive the invitation to play from the patner or the game manager.
+ *
+ * @param address the address (host and port) of the remote partner.
+ * @param youStart if true, the game manager instructs to start
+ * the game first (another side is instructed to start the game second).
+ *
+ * @return true on success.
+ */
+ boolean start_game(Player otherPlayer, boolean youStart)
+ throws RemoteException;
+
+ /**
+ * Get the state of the local player (one of the constants, defined
+ * in this interface).
+ */
+ int get_current_state() throws RemoteException;
+
+ /**
+ * Receive the chat message from the friend or challenge server (remote).
+ * Possible at any state, always remote.
+ *
+ * @param color the color code, used to highlight the message.
+ * @param text the message text.
+ */
+ void receive_chat(byte color, String test) throws RemoteException;
+
+ /**
+ * Indicated that the remote side leaves the game (capitulating).
+ */
+ void disconnect() throws RemoteException;
+
+ /**
+ * Receive friends move (possible at I_WAIT_FOR_YOUR_MOVE).
+ *
+ * @param x grid position.
+ * @param y grid position.
+ *
+ * @param sessionId the session id, must match (otherwise the call is ignored).
+ * @param victory if not a null, the friend thinks that it has won, the parameter
+ * containing the ends of the builded line.
+ */
+ void receive_move(int x, int y, Point[] victory) throws RemoteException;
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java
new file mode 100644
index 00000000000..c30f7d51a42
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java
@@ -0,0 +1,275 @@
+/* PlayerImpl.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Color;
+import java.awt.Point;
+
+import java.rmi.RemoteException;
+
+/**
+ * The implementation of the PlayerCommunicator, providing the local
+ * functionality. Apart remote methods, the class also defines some local
+ * methods, needed for the co-ordinated work with the game user interface.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class PlayerImpl
+ implements Player, State
+{
+ /**
+ * The playing table.
+ */
+ PlayingDesk desk;
+
+ /**
+ * The state of this player (one of the constants, defined in the player
+ * interface.
+ */
+ private int state = DISCONNECTED;
+
+ /**
+ * The other player.
+ */
+ Player partner;
+
+ /**
+ * Called when the local player refuses to continue the game.
+ */
+ public void leave()
+ {
+ try
+ {
+ if (state == I_THINK || state == I_WAIT_FOR_YOUR_MOVE)
+ {
+ partner.receive_chat(ChatConstants.REMOTE_PLAYER,
+ "Your partner has left the game.");
+ partner.disconnect();
+ }
+ else if (state == State.QUEUED)
+ {
+ if (desk.manager != null)
+ desk.manager.unregister(desk.player);
+ receive_chat(ChatConstants.SYSTEM,
+ "Do not be so pessimistic, try to play first!");
+ }
+ set_current_state(State.DISCONNECTED);
+
+ desk.frame.bChat.setEnabled(false);
+ desk.frame.bLeave.setEnabled(false);
+ desk.frame.bConnect.setEnabled(true);
+ desk.frame.taUrl.setText(desk.frame.mior);
+ }
+ catch (RemoteException ex)
+ {
+ // We will print the exception because this is a demo application that
+ // may be modified for learning purposes.
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Called when we make the move. The PlayingTable is responsible for checking
+ * the correctness of the move and detecting the victory.
+ *
+ * @param x x position of the new dot.
+ * @param y y position of the new dot.
+ *
+ * @param victory array of two memebers, representing the endpoints of the
+ * drawn line (victory detected) or null if no such yet exists.
+ */
+ public void we_move(int x, int y, Point[] victory)
+ {
+ try
+ {
+ set_current_state(I_WAIT_FOR_YOUR_MOVE);
+ partner.receive_move(x, y, victory);
+ }
+ catch (RemoteException ex)
+ {
+ // We will print the exception because this is a demo application that
+ // may be modified for learning purposes.
+ ex.printStackTrace();
+
+ state = ERROR;
+ }
+ }
+
+ /**
+ * Set the current state.
+ */
+ public void set_current_state(int new_state)
+ {
+ state = new_state;
+
+ if (state == DISCONNECTED)
+ {
+ setStatus("Disconnected");
+ }
+ else if (state == I_THINK)
+ {
+ setStatus("Our move");
+ }
+ else if (state == I_WAIT_FOR_YOUR_MOVE)
+ {
+ setStatus("Partner's move");
+ }
+ else if (state == ERROR)
+ {
+ setStatus("Error.");
+ }
+ else if (state == I_HAVE_LOST)
+ {
+ setStatus("We lost");
+ }
+ else if (state == I_HAVE_WON)
+ {
+ setStatus("Victory");
+ }
+ else if (state == QUEUED)
+ {
+ setStatus("Queued");
+ }
+ else
+ {
+ setStatus("State " + state);
+ }
+
+ boolean connected = state != State.DISCONNECTED;
+
+ desk.frame.bConnect.setEnabled(!connected && state != State.QUEUED);
+ desk.frame.bReset.setEnabled(connected);
+ desk.frame.bLeave.setEnabled(connected);
+ desk.frame.bChat.setEnabled(connected);
+ }
+
+ /**
+ * Show the state in the status line.
+ */
+ public void setStatus(String status)
+ {
+ desk.frame.lbState.setText(status);
+ }
+
+ /**
+ * Receive the invitation to play from the patner or the game manager.
+ *
+ * @param address the address (host and port) of the remote partner.
+ * @param youStart if true, the game manager instructs to start the game first
+ * (another side is instructed to start the game second).
+ *
+ * Game server may also chat a little bit with both players, saying that the
+ * game has started.
+ *
+ * @return true on success.
+ */
+ public boolean start_game(Player otherPlayer, boolean youStart)
+ throws RemoteException
+ {
+ partner = otherPlayer;
+ desk.reset();
+
+ if (youStart)
+ {
+ set_current_state(I_THINK);
+ }
+ else
+ {
+ set_current_state(I_WAIT_FOR_YOUR_MOVE);
+ }
+
+ desk.frame.taUrl.setText("");
+
+ return true;
+ }
+
+ /**
+ * Get the state of the local player (one of the constants, defined in this
+ * interface).
+ */
+ public int get_current_state()
+ throws RemoteException
+ {
+ return state;
+ }
+
+ /**
+ * Receive the chat message from the friend or challenge server (remote).
+ * Possible at any state, always remote.
+ *
+ * @param color the color code, used to highlight the message.
+ * @param text the message text.
+ */
+ public void receive_chat(byte color, String text)
+ throws RemoteException
+ {
+ if (color >= ChatConstants.colors.length)
+ color = ChatConstants.REMOTE_PLAYER;
+
+ desk.frame.talk(ChatConstants.colors[color], text);
+ }
+
+ /**
+ * Indicated that the remote side leaves the game (capitulating).
+ */
+ public void disconnect()
+ throws RemoteException
+ {
+ desk.frame.talk(Color.red, "The partner leaves the game.");
+ partner = null;
+ set_current_state(DISCONNECTED);
+
+ desk.frame.taUrl.setText(desk.frame.mior);
+ }
+
+ /**
+ * Receive friends move (possible at I_WAIT_FOR_YOUR_MOVE).
+ *
+ * @param x grid position.
+ * @param y grid position.
+ * @param victory if not a null, the friend thinks that it has won, the
+ * parameter containing the ends of the builded line.
+ */
+ public void receive_move(int x, int y, Point[] victory)
+ throws RemoteException
+ {
+ // The state changes are handled by the PlayingTable
+ desk.friendsMove(x, y, victory);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java
new file mode 100644
index 00000000000..83178f93606
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java
@@ -0,0 +1,512 @@
+/* PlayingDesk.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.swing.JComponent;
+
+import org.omg.CORBA.ORB;
+
+/**
+ * Manages actions, related to the game rules and also does all painting.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class PlayingDesk
+ extends JComponent
+ implements MouseListener, State
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Indicates that the field point state is the red oval.
+ */
+ public static final int RED = 0;
+
+ /**
+ * Indicates that the field point state is the black cross.
+ */
+ public static final int BLACK = 1;
+
+ /**
+ * Indicates that the field point state is the hint, suggested by the fan.
+ */
+ public static final int HINT = 2;
+
+ /**
+ * The access to the main frame methods.
+ */
+ ClientFrame frame;
+
+ /**
+ * The access to the player communicator.
+ */
+ PlayerImpl player;
+
+ /**
+ * The game manager.
+ */
+ GameManager manager;
+
+ /**
+ * The player ORB.
+ */
+ ORB orb;
+
+ /**
+ * The player IOR.
+ */
+ String ior;
+
+ /**
+ * True if the player ORB started ok.
+ */
+ boolean ok;
+
+ /**
+ * The grid spacing.
+ */
+ static int W = 16;
+
+ /**
+ * The radius of the dots being painted.
+ */
+ static int R = W / 3;
+
+ /**
+ * The collection of the red dots.
+ */
+ ArrayList reds = new ArrayList();
+
+ /**
+ * The collection of the black dots.
+ */
+ ArrayList blacks = new ArrayList();
+
+ /**
+ * The array of hints.
+ */
+ ArrayList hints = new ArrayList();
+
+ /**
+ * When the game is completed, obtains the value of the two end points of the
+ * created line.
+ */
+ Point[] endOfGame;
+
+ public PlayingDesk()
+ {
+ try
+ {
+ player = new PlayerImpl();
+ player.desk = this;
+
+ OrbStarter.startPlayer(player, this);
+
+ jbInit();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Paint this component.
+ */
+ public void paintComponent(Graphics g)
+ {
+ int w = getWidth();
+ int h = getHeight();
+
+ g.setColor(Color.white);
+ g.fillRect(0, 0, w, h);
+
+ drawGrid(w, h, g);
+ drawFigures(g);
+ }
+
+ /**
+ * Check maybe a game is finished after setting the point N
+ */
+ public Point[] checkFinished(Collection x, Point N)
+ {
+ Iterator iter = x.iterator();
+ Point p;
+
+ // The victory, if happens, must occur inside these boundaries:
+ int ax = N.x - 5;
+ int bx = N.x + 5;
+
+ int ay = N.y - 5;
+ int by = N.y + 5;
+
+ while (iter.hasNext())
+ {
+ p = (Point) iter.next();
+
+ if (p.x > ax && p.x < bx && p.y > ay && p.y < by)
+ {
+ // Check the vertical line down
+ if (pointPresent(p.x, p.y + 1, x))
+ if (pointPresent(p.x, p.y + 2, x))
+ if (pointPresent(p.x, p.y + 3, x))
+ if (pointPresent(p.x, p.y + 4, x))
+ return new Point[] { p, new Point(p.x, p.y + 4) };
+
+ // Check the horizontal line left
+ if (pointPresent(p.x + 1, p.y, x))
+ if (pointPresent(p.x + 2, p.y, x))
+ if (pointPresent(p.x + 3, p.y, x))
+ if (pointPresent(p.x + 4, p.y, x))
+ return new Point[] { p, new Point(p.x + 4, p.y) };
+
+ // Check the diagonal line right down.
+ if (pointPresent(p.x + 1, p.y + 1, x))
+ if (pointPresent(p.x + 2, p.y + 2, x))
+ if (pointPresent(p.x + 3, p.y + 3, x))
+ if (pointPresent(p.x + 4, p.y + 4, x))
+ return new Point[] { p, new Point(p.x + 4, p.y + 4) };
+
+ // Check the diagonal line left down.
+ if (pointPresent(p.x - 1, p.y + 1, x))
+ if (pointPresent(p.x - 2, p.y + 2, x))
+ if (pointPresent(p.x - 3, p.y + 3, x))
+ if (pointPresent(p.x - 4, p.y + 4, x))
+ return new Point[] { p, new Point(p.x - 4, p.y + 4) };
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Called when the "end of the game" situation is detected.
+ */
+ public void drawFinishLine(int xa, int ya, int xb, int yb, Graphics g)
+ {
+ g.setColor(Color.blue);
+
+ int hW = W / 2;
+ g.drawLine(xa * W + hW, ya * W + hW, xb * W + hW, yb * W + hW);
+ }
+
+ /**
+ * Check for the presence of the given point in the collection.
+ */
+ public final boolean pointPresent(int x, int y, Collection in)
+ {
+ Iterator iter = in.iterator();
+ Point p;
+ while (iter.hasNext())
+ {
+ p = (Point) iter.next();
+ if (p.x == x && p.y == y)
+ return true;
+ }
+ return false;
+ }
+
+ public void drawGrid(int w, int h, Graphics g)
+ {
+ g.setColor(Color.lightGray);
+
+ // Draw vertical lines:
+ for (int x = 0; x < w; x += W)
+ {
+ g.drawLine(x, 0, x, h);
+ }
+
+ // Draw horizontal lines:
+ for (int y = 0; y < h; y += W)
+ {
+ g.drawLine(0, y, w, y);
+ }
+
+ g.setColor(Color.gray);
+ g.drawRect(0,0, frame.DESK_SIZE.width, frame.DESK_SIZE.height);
+ g.drawRect(0,0, frame.DESK_SIZE.width+3, frame.DESK_SIZE.height+3);
+ }
+
+ public void drawFigures(Graphics g)
+ {
+ g.setColor(Color.red);
+ drawDots(reds, g, RED);
+
+ g.setColor(Color.black);
+ drawDots(blacks, g, BLACK);
+
+ g.setColor(Color.lightGray);
+ drawDots(hints, g, HINT);
+
+ if (endOfGame != null)
+ drawFinishLine(endOfGame[0].x, endOfGame[0].y, endOfGame[1].x,
+ endOfGame[1].y, g);
+ }
+
+ public Point makePoint(int x, int y)
+ {
+ return new Point(x / W, y / W);
+ }
+
+ /**
+ * Draw a collection of dots (the collor must be set before calling the
+ * method).
+ */
+ public void drawDots(Collection dots, Graphics g, int mode)
+ {
+ Iterator iter = dots.iterator();
+ int x;
+ int y;
+
+ int hW = W / 2;
+ int RR = R * 2;
+ int hR = R / 2;
+ Point p;
+ while (iter.hasNext())
+ {
+ p = (Point) iter.next();
+ x = p.x * W + hW;
+ y = p.y * W + hW;
+
+ if (mode == RED)
+ g.drawOval(x - R, y - R, RR, RR);
+ else if (mode == BLACK)
+ {
+ g.drawLine(x - R, y - R, x + R, y + R);
+ g.drawLine(x - R, y + R, x + R, y - R);
+ }
+ else
+ {
+ // Hint.
+ g.drawOval(x - hR, y - hR, R, R);
+ }
+ }
+ }
+
+ private void jbInit()
+ throws Exception
+ {
+ addMouseListener(this);
+ }
+
+ public void mouseClicked(MouseEvent e)
+ {
+ try
+ {
+ int state = player.get_current_state();
+
+ // Check if the state is correct.
+ if (state == I_WAIT_FOR_YOUR_MOVE)
+ {
+ frame.talk(Color.black,
+ "It is now time for our partner's move, not ours. Please wait.");
+ }
+ else if (state == DISCONNECTED)
+ {
+ frame.talk(Color.black,
+ "We are not connected to the playing partner yet.");
+ }
+ else if (state == I_HAVE_LOST)
+ {
+ frame.talk(Color.black,
+ "We have already lost this battle, but why not to try again?");
+ }
+ else if (state == I_HAVE_WON)
+ {
+ frame.talk(Color.black,
+ "The victory is ours, nothing more to do here.");
+ }
+ else if (player.partner == null)
+ frame.talk(Color.black, "No other player so far.");
+ else
+ {
+ int x = e.getX();
+ int y = e.getY();
+
+ if (x>frame.DESK_SIZE.width ||
+ y>frame.DESK_SIZE.height)
+ {
+ frame.talk(Color.black,"Outside the game area.");
+ return;
+ }
+
+ Point p = makePoint(x, y);
+
+ // Ignore clicks on the occupied cells.
+ if (pointPresent(p.x, p.y, reds)
+ || (pointPresent(p.x, p.y, blacks)))
+ {
+ frame.talk(Color.black,
+ "This is against the rules, select the unoccupied cell.");
+ return;
+ }
+
+ reds.add(p);
+
+ endOfGame = checkFinished(reds, p);
+ repaint();
+
+ if (endOfGame != null)
+ {
+ frame.talk(Color.red, "Our move " + p.x + "-" + p.y
+ + " and we win!");
+ player.set_current_state(I_HAVE_WON);
+ }
+ else
+ {
+ frame.talk(Color.black, "Our move " + p.x + "-" + p.y
+ + ". Waiting for the other side move...");
+ player.set_current_state(I_WAIT_FOR_YOUR_MOVE);
+ }
+
+ player.partner.receive_move(p.x, p.y, endOfGame);
+ }
+ }
+ catch (RemoteException ex)
+ {
+ // We will print the exception because this is a demo application
+ // that may be modified for learning purposes.
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Handle the move of the other playing side.
+ */
+ public void friendsMove(int x, int y, Point[] victory)
+ {
+ try
+ {
+ int state = player.get_current_state();
+ if (state != I_WAIT_FOR_YOUR_MOVE || pointPresent(x, y, blacks))
+ {
+ stateFailed("Move " + x + "-" + y);
+ }
+ else
+ {
+ blacks.add(new Point(x, y));
+ repaint();
+
+ if (victory != null)
+ {
+ frame.talk(Color.red,
+ " We have lost this time, unfortunately..");
+ player.set_current_state(I_HAVE_LOST);
+ endOfGame = victory;
+ }
+ else
+ {
+ frame.talk(Color.black, "Partner goes " + x + "-" + y
+ + ". Your move?");
+ player.set_current_state(I_THINK);
+ }
+ }
+ }
+ catch (RemoteException rex)
+ {
+ rex.printStackTrace();
+ }
+ }
+
+ /**
+ * Prepare for the new game.
+ */
+ public void reset()
+ {
+ blacks.clear();
+ reds.clear();
+ hints.clear();
+ endOfGame = null;
+ repaint();
+ }
+
+ public void mouseEntered(MouseEvent m)
+ {
+ // Nothing to do.
+ }
+
+ public void mousePressed(MouseEvent m)
+ {
+ // Nothing to do.
+ }
+
+ public void mouseReleased(MouseEvent m)
+ {
+ // Nothing to do.
+ }
+
+ public void mouseExited(MouseEvent m)
+ {
+ // Nothing to do.
+ }
+
+ /**
+ * The systems detected the error conditions. The game cannot continue (the
+ * chat is still possible).
+ */
+ public void stateFailed(String reason)
+ {
+ try
+ {
+ player.receive_chat(ChatConstants.REMOTE_PLAYER,
+ "Wrong move, game cannot continue (our state was "
+ + player.get_current_state() + ")");
+ frame.talk(Color.red, "The remote side violates communicating rules.");
+ player.set_current_state(State.ERROR);
+ }
+ catch (RemoteException ex)
+ {
+ // We will print the exception because this is a demo application
+ // that may be modified for learning purposes.
+ ex.printStackTrace();
+ }
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/State.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/State.java
new file mode 100644
index 00000000000..7285396cdc8
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/State.java
@@ -0,0 +1,82 @@
+/* State.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+/**
+ * Defines the states in that the player can be.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface State {
+ /**
+ * The initial ("disconnected") state.
+ */
+ int DISCONNECTED = 0;
+
+ /**
+ * The state, indicating that the player has been queued for the game and
+ * waiting for the partner to come.
+ */
+ int QUEUED = 1;
+
+ /**
+ * The "my move" state.
+ */
+ int I_THINK = 2;
+
+ /**
+ * The "friend's move" state.
+ */
+ int I_WAIT_FOR_YOUR_MOVE = 3;
+
+ /**
+ * States that we have won.
+ */
+ int I_HAVE_WON = 4;
+
+ /**
+ * States that we have lost.
+ */
+ int I_HAVE_LOST = 5;
+
+ /**
+ * The "inconsistent" state when it is not possible to continue the game.
+ */
+ int ERROR = -1;
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java
new file mode 100644
index 00000000000..2ef9241c520
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java
@@ -0,0 +1,175 @@
+/* GameManagerAddressServer.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * The main executable class of the game manager server.
+ *
+ * The manager address server returns the IOR address string of the game
+ * manager. Hence the user does not need to enter the rather long IOR address
+ * string and only needs to specify the host and port of the machine where the
+ * game manager is running.
+ *
+ * The manager address server starts the main game manager as well.
+ *
+ * This server acts as a HTTP server that always returns the same response. This
+ * primitive functionality is sufficient for its task.
+ *
+ * The more complex CORBA applications should use the name service instead. We
+ * do not use the name service as this would require to start additional
+ * external application, specific for the different java platforms.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class X5Server
+{
+ /**
+ * Start the game manager.
+ */
+ public static void main(String[] args)
+ {
+ // Start the game manager, write the IOR to the agreed location.
+ OrbStarter.startManager(args);
+
+ if (!GameManagerImpl.ok)
+ {
+ System.out.println("Unable to start the game manager:");
+ System.exit(1);
+ }
+
+ // Print the IOR.
+ System.out.println(GameManagerImpl.ior);
+
+ String manager_address = null;
+
+ // Start the game manager server.
+ ServerSocket nameServer = null;
+ try
+ {
+ nameServer = new ServerSocket(OrbStarter.MANAGER_NAMER_PORT);
+
+ System.out.println("The game manager is listening at:");
+ manager_address = "http://"
+ + InetAddress.getLocalHost().getHostAddress() + ":"
+ + nameServer.getLocalPort();
+
+ System.out.println(manager_address);
+
+ System.out.println("Enter this address to the "
+ + "input field of the game client.");
+
+ System.out.println("Use ^C to stop the manager.");
+ }
+ catch (Exception ex)
+ {
+ System.out.println("The port " + OrbStarter.MANAGER_NAMER_PORT
+ + " is not available. The game manager namer will not start.");
+ System.exit(1);
+ }
+
+ // Write the IOR to the local file system.
+ if (OrbStarter.WRITE_URL_TO_FILE != null)
+ {
+ try
+ {
+ File gmf = new File(OrbStarter.WRITE_URL_TO_FILE);
+ FileWriter f = new FileWriter(gmf);
+ BufferedWriter b = new BufferedWriter(f);
+
+ b.write(manager_address);
+ b.close();
+ }
+ catch (IOException e)
+ {
+ System.out.println("Local filesystem not accessible."
+ + "Read IOR from console.");
+ }
+ }
+
+ // Do forever.
+ while (true)
+ {
+ try
+ {
+ Socket socket = nameServer.accept();
+
+ System.out.println("Connected.");
+
+ // Set the two minutes timeout.
+ socket.setSoTimeout(1000 * 120);
+
+ OutputStream out = socket.getOutputStream();
+
+ int length = GameManagerImpl.ior.length();
+
+ StringBuffer b = new StringBuffer();
+ b.append("HTTP/1.0 200 OK\r\n");
+ b.append("Content-Length: " + length + "\r\n");
+ b.append("Connection: close\r\n");
+ b.append("Content-Type: text/plain; charset=UTF-8\r\n");
+ b.append("\r\n");
+
+ b.append(GameManagerImpl.ior);
+
+ out.write(b.toString().getBytes("UTF-8"));
+
+ socket.shutdownOutput();
+
+ if (!socket.isClosed())
+ socket.close();
+
+ System.out.println("Completed.");
+ }
+ catch (Exception exc)
+ {
+ exc.printStackTrace();
+ System.out.println("Network problem.");
+ }
+ }
+ }
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java
new file mode 100644
index 00000000000..17a62600c96
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java
@@ -0,0 +1,214 @@
+/* _GameManagerImpl_Tie.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.Remote;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.PortableServer.Servant;
+
+/**
+ * Normally generated with rmic compiler, this class represents the GameManager
+ * Tie on the client side. The Game Manager methods contain the code for remote
+ * invocation.
+ *
+ * This class is normally generated with rmic from the {@link GameManagerImpl}:
+ *
+ * <pre>
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.GameManagerImpl
+ * </pre>
+ *
+ * (the compiled package must be present in the current folder).
+ *
+ * In this example the class was manually edited and commented for better
+ * understanding of functionality.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class _GameManagerImpl_Tie
+ extends Servant
+ implements Tie
+{
+ /**
+ * The target, where remote invocations are forwarded.
+ */
+ private GameManagerImpl target = null;
+
+ /**
+ * The GameManager repository Id.
+ */
+ private static final String[] _type_ids =
+ { "RMI:gnu.classpath.examples.CORBA.swing.x5.GameManager:0000000000000000" };
+
+ /**
+ * Set the target where the remote invocations are forwarded.
+ */
+ public void setTarget(Remote a_target)
+ {
+ this.target = (GameManagerImpl) a_target;
+ }
+
+ /**
+ * Get the target where the remote invocations are forwarded.
+ */
+ public Remote getTarget()
+ {
+ return target;
+ }
+
+ /**
+ * Get the CORBA object for that this Tie is currently serving the request.
+ * The same tie may serve multiple requests for the different objects in
+ * parallel threads.
+ */
+ public org.omg.CORBA.Object thisObject()
+ {
+ return _this_object();
+ }
+
+ /**
+ * Deactivate this object.
+ */
+ public void deactivate()
+ {
+ try
+ {
+ _poa().deactivate_object(_poa().servant_to_id(this));
+ }
+ catch (org.omg.PortableServer.POAPackage.WrongPolicy exception)
+ {
+ }
+ catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception)
+ {
+ }
+ catch (org.omg.PortableServer.POAPackage.ServantNotActive exception)
+ {
+ }
+ }
+
+ /**
+ * Get the ORB for this tie.
+ */
+ public ORB orb()
+ {
+ return _orb();
+ }
+
+ /**
+ * Set the ORB for this tie.
+ */
+ public void orb(ORB orb)
+ {
+ try
+ {
+ ((org.omg.CORBA_2_3.ORB) orb).set_delegate(this);
+ }
+ catch (ClassCastException e)
+ {
+ throw new org.omg.CORBA.BAD_PARAM(
+ "POA Servant requires an instance of org.omg.CORBA_2_3.ORB");
+ }
+ }
+
+ /**
+ * Return all interfaces, supported by this method.
+ */
+ public String[] _all_interfaces(org.omg.PortableServer.POA poa,
+ byte[] objectId)
+ {
+ return _type_ids;
+ }
+
+ /**
+ * This method is invoked by CORBA system to handle the remote invocation.
+ *
+ * @param method the name of the method being invoked.
+ * @param _in the stream to read the method parameters.
+ * @param reply the responsed handler that can create the output stream to
+ * write the parameters being returned.
+ */
+ public OutputStream _invoke(String method, InputStream _in,
+ ResponseHandler reply)
+ throws SystemException
+ {
+ try
+ {
+ org.omg.CORBA_2_3.portable.InputStream in =
+ (org.omg.CORBA_2_3.portable.InputStream) _in;
+ if (method.equals("requestTheGame"))
+ {
+ Player p = (Player) PortableRemoteObject.narrow(
+ in.read_Object(), Player.class);
+ target.requestTheGame(p);
+
+ OutputStream out = reply.createReply();
+ return out;
+ }
+ else if (method.equals("unregister"))
+ {
+ Player p = (Player) PortableRemoteObject.narrow(
+ in.read_Object(), Player.class);
+ target.unregister(p);
+
+ OutputStream out = reply.createReply();
+ return out;
+ }
+ else
+ throw new BAD_OPERATION();
+ }
+ catch (SystemException ex)
+ {
+ throw ex;
+ }
+ catch (Throwable ex)
+ {
+ ex.printStackTrace();
+ throw new UnknownException(ex);
+ }
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java
new file mode 100644
index 00000000000..e9279963a6a
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java
@@ -0,0 +1,207 @@
+/* _GameManager_Stub.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+/**
+ * Normally generated with rmic compiler, this class represents the GameManager
+ * Stub on the client side. The Game Manager methods contain the code for
+ * remote invocation.
+ *
+ * This class is normally generated with rmic from the {@link GameManagerImpl}:
+ * <pre>
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.GameManagerImpl
+ * </pre>
+ * (the compiled package must be present in the current folder).
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class _GameManager_Stub extends Stub implements GameManager
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ private static final String[] _type_ids =
+ { "RMI:gnu.classpath.examples.CORBA.swing.x5.GameManager:0000000000000000" };
+
+ public String[] _ids()
+ {
+ return _type_ids;
+ }
+
+ /**
+ * Notify the manager that the player is no longer willing to play and
+ * should be removed from the queue.
+ */
+ public void unregister(Player p)
+ throws RemoteException
+ {
+ if (!Util.isLocal(this))
+ {
+ try
+ {
+ org.omg.CORBA.portable.InputStream in = null;
+ try
+ {
+ OutputStream out = _request("unregister", true);
+ Util.writeRemoteObject(out, p);
+ _invoke(out);
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ }
+ catch (RemarshalException ex)
+ {
+ unregister(p);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+ catch (SystemException ex)
+ {
+ throw Util.mapSystemException(ex);
+ }
+ }
+ else
+ {
+ ServantObject so =
+ _servant_preinvoke("requestTheGame", GameManager.class);
+ if (so == null)
+ {
+ unregister(p);
+ return;
+ }
+ try
+ {
+ ((GameManager) so.servant).unregister(p);
+ }
+ catch (Throwable ex)
+ {
+ Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+ throw Util.wrapException(exCopy);
+ }
+ finally
+ {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+
+ /**
+ * The method that the user should invoke.
+ */
+ public void requestTheGame(Player arg0) throws RemoteException
+ {
+ if (!Util.isLocal(this))
+ {
+ try
+ {
+ org.omg.CORBA.portable.InputStream in = null;
+ try
+ {
+ OutputStream out = _request("requestTheGame", true);
+ Util.writeRemoteObject(out, arg0);
+ _invoke(out);
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ }
+ catch (RemarshalException ex)
+ {
+ requestTheGame(arg0);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+ catch (SystemException ex)
+ {
+ throw Util.mapSystemException(ex);
+ }
+ }
+ else
+ {
+ ServantObject so =
+ _servant_preinvoke("requestTheGame", GameManager.class);
+ if (so == null)
+ {
+ requestTheGame(arg0);
+ return;
+ }
+ try
+ {
+ Player arg0Copy = (Player) Util.copyObject(arg0, _orb());
+ ((GameManager) so.servant).requestTheGame(arg0Copy);
+ }
+ catch (Throwable ex)
+ {
+ Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+ throw Util.wrapException(exCopy);
+ }
+ finally
+ {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java
new file mode 100644
index 00000000000..730c6f469a0
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java
@@ -0,0 +1,212 @@
+/* _PlayerImpl_Tie.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Point;
+import java.rmi.Remote;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.PortableServer.Servant;
+
+/**
+ * Generate with rmic, command line
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
+ * (the compiled package must be present in the current folder).
+ *
+ * This class is normally generated with rmic from the {@link PlayerImpl}:
+ * <pre>
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
+ * </pre>
+ * (the compiled package must be present in the current folder).
+ *
+ * In this example the class was manually edited and commented for better
+ * understanding of functionality.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class _PlayerImpl_Tie extends Servant implements Tie
+{
+ private PlayerImpl target = null;
+ private static final String[] _type_ids =
+ { "RMI:gnu.classpath.examples.CORBA.swing.x5.Player:0000000000000000" };
+
+ public void setTarget(Remote a_target)
+ {
+ this.target = (PlayerImpl) a_target;
+ }
+
+ public Remote getTarget()
+ {
+ return target;
+ }
+
+ public org.omg.CORBA.Object thisObject()
+ {
+ return _this_object();
+ }
+
+ public void deactivate()
+ {
+ try
+ {
+ _poa().deactivate_object(_poa().servant_to_id(this));
+ }
+ catch (org.omg.PortableServer.POAPackage.WrongPolicy exception)
+ {
+ }
+ catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception)
+ {
+ }
+ catch (org.omg.PortableServer.POAPackage.ServantNotActive exception)
+ {
+ }
+ }
+
+ public ORB orb()
+ {
+ return _orb();
+ }
+
+ public void orb(ORB orb)
+ {
+ try
+ {
+ ((org.omg.CORBA_2_3.ORB) orb).set_delegate(this);
+ }
+ catch (ClassCastException e)
+ {
+ throw new org.omg.CORBA.BAD_PARAM(
+ "POA Servant requires an instance of org.omg.CORBA_2_3.ORB"
+ );
+ }
+ }
+
+ public String[] _all_interfaces(org.omg.PortableServer.POA poa,
+ byte[] objectId
+ )
+ {
+ return _type_ids;
+ }
+
+ public OutputStream _invoke(String method, InputStream _in,
+ ResponseHandler reply
+ ) throws SystemException
+ {
+ try
+ {
+ org.omg.CORBA_2_3.portable.InputStream in =
+ (org.omg.CORBA_2_3.portable.InputStream) _in;
+ switch (method.charAt(9))
+ {
+ case 101 :
+ if (method.equals("start_game"))
+ {
+ Player arg0 =
+ (Player) PortableRemoteObject.narrow(in.read_Object(),
+ Player.class
+ );
+ boolean arg1 = in.read_boolean();
+ boolean result = target.start_game(arg0, arg1);
+ OutputStream out = reply.createReply();
+ out.write_boolean(result);
+ return out;
+ }
+
+ case 104 :
+ if (method.equals("receive_chat"))
+ {
+ byte arg0 = in.read_octet();
+ String arg1 = (String) in.read_value(String.class);
+ target.receive_chat(arg0, arg1);
+
+ OutputStream out = reply.createReply();
+ return out;
+ }
+
+ case 111 :
+ if (method.equals("receive_move"))
+ {
+ int arg0 = in.read_long();
+ int arg1 = in.read_long();
+ Point[] arg2 = (Point[]) in.read_value(Point[].class);
+ target.receive_move(arg0, arg1, arg2);
+
+ OutputStream out = reply.createReply();
+ return out;
+ }
+
+ case 114 :
+ if (method.equals("_get_J_current_state"))
+ {
+ int result = target.get_current_state();
+ OutputStream out = reply.createReply();
+ out.write_long(result);
+ return out;
+ }
+
+ case 116 :
+ if (method.equals("disconnect"))
+ {
+ target.disconnect();
+
+ OutputStream out = reply.createReply();
+ return out;
+ }
+ }
+ throw new BAD_OPERATION("No such method: '"+method+"'");
+ }
+ catch (SystemException ex)
+ {
+ throw ex;
+ }
+ catch (Throwable ex)
+ {
+ throw new UnknownException(ex);
+ }
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java
new file mode 100644
index 00000000000..eeb5cf0daa4
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java
@@ -0,0 +1,397 @@
+/* _Player_Stub.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.classpath.examples.CORBA.swing.x5;
+
+import java.awt.Point;
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+/**
+ * Generate with rmic, command line
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.PlayerImpl
+ * (the compiled package must be present in the current folder).
+ *
+ * This class is normally generated with rmic from the {@link GameManagerImpl}:
+ * <pre>
+ * rmic -iiop -poa -keep gnu.classpath.examples.CORBA.swing.x5.GameManagerImpl
+ * </pre>
+ * (the compiled package must be present in the current folder).
+ *
+ * In this example the class was manually edited and commented for better
+ * understanding of functionality.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class _Player_Stub extends Stub implements Player
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ private static final String[] _type_ids =
+ { "RMI:gnu.classpath.examples.CORBA.swing.x5.Player:0000000000000000" };
+
+ public String[] _ids()
+ {
+ return _type_ids;
+ }
+
+ public boolean start_game(Player arg0, boolean arg1)
+ throws RemoteException
+ {
+ if (!Util.isLocal(this))
+ {
+ try
+ {
+ org.omg.CORBA.portable.InputStream in = null;
+ try
+ {
+ OutputStream out = _request("start_game", true);
+ Util.writeRemoteObject(out, arg0);
+ out.write_boolean(arg1);
+ in = _invoke(out);
+ return in.read_boolean();
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ }
+ catch (RemarshalException ex)
+ {
+ return start_game(arg0, arg1);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+ catch (SystemException ex)
+ {
+ throw Util.mapSystemException(ex);
+ }
+ }
+ else
+ {
+ ServantObject so = _servant_preinvoke("start_game", Player.class);
+ if (so == null)
+ {
+ return start_game(arg0, arg1);
+ }
+ try
+ {
+ Player arg0Copy = (Player) Util.copyObject(arg0, _orb());
+ return ((Player) so.servant).start_game(arg0Copy, arg1);
+ }
+ catch (Throwable ex)
+ {
+ Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+ throw Util.wrapException(exCopy);
+ }
+ finally
+ {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+
+ public int get_current_state() throws RemoteException
+ {
+ if (!Util.isLocal(this))
+ {
+ try
+ {
+ org.omg.CORBA.portable.InputStream in = null;
+ try
+ {
+ OutputStream out = _request("_get_J_current_state", true);
+ in = _invoke(out);
+ return in.read_long();
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ }
+ catch (RemarshalException ex)
+ {
+ return get_current_state();
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+ catch (SystemException ex)
+ {
+ throw Util.mapSystemException(ex);
+ }
+ }
+ else
+ {
+ ServantObject so =
+ _servant_preinvoke("_get_J_current_state", Player.class);
+ if (so == null)
+ {
+ return get_current_state();
+ }
+ try
+ {
+ return ((Player) so.servant).get_current_state();
+ }
+ catch (Throwable ex)
+ {
+ Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+ throw Util.wrapException(exCopy);
+ }
+ finally
+ {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+
+ public void receive_chat(byte arg0, String arg1) throws RemoteException
+ {
+ if (!Util.isLocal(this))
+ {
+ try
+ {
+ org.omg.CORBA_2_3.portable.InputStream in = null;
+ try
+ {
+ org.omg.CORBA_2_3.portable.OutputStream out =
+ (org.omg.CORBA_2_3.portable.OutputStream) _request("receive_chat",
+ true
+ );
+ out.write_octet(arg0);
+ out.write_value(arg1, String.class);
+ _invoke(out);
+ }
+ catch (ApplicationException ex)
+ {
+ in =
+ (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ }
+ catch (RemarshalException ex)
+ {
+ receive_chat(arg0, arg1);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+ catch (SystemException ex)
+ {
+ throw Util.mapSystemException(ex);
+ }
+ }
+ else
+ {
+ ServantObject so = _servant_preinvoke("receive_chat", Player.class);
+ if (so == null)
+ {
+ receive_chat(arg0, arg1);
+ return;
+ }
+ try
+ {
+ ((Player) so.servant).receive_chat(arg0, arg1);
+ }
+ catch (Throwable ex)
+ {
+ Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+ throw Util.wrapException(exCopy);
+ }
+ finally
+ {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+
+ public void disconnect() throws RemoteException
+ {
+ if (!Util.isLocal(this))
+ {
+ try
+ {
+ org.omg.CORBA.portable.InputStream in = null;
+ try
+ {
+ OutputStream out = _request("disconnect", true);
+ _invoke(out);
+ }
+ catch (ApplicationException ex)
+ {
+ in = ex.getInputStream();
+
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ }
+ catch (RemarshalException ex)
+ {
+ disconnect();
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+ catch (SystemException ex)
+ {
+ throw Util.mapSystemException(ex);
+ }
+ }
+ else
+ {
+ ServantObject so = _servant_preinvoke("disconnect", Player.class);
+ if (so == null)
+ {
+ disconnect();
+ return;
+ }
+ try
+ {
+ ((Player) so.servant).disconnect();
+ }
+ catch (Throwable ex)
+ {
+ Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+ throw Util.wrapException(exCopy);
+ }
+ finally
+ {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+
+ public void receive_move(int arg0, int arg1, Point[] arg2)
+ throws RemoteException
+ {
+ if (!Util.isLocal(this))
+ {
+ try
+ {
+ org.omg.CORBA_2_3.portable.InputStream in = null;
+ try
+ {
+ org.omg.CORBA_2_3.portable.OutputStream out =
+ (org.omg.CORBA_2_3.portable.OutputStream) _request("receive_move",
+ true
+ );
+ out.write_long(arg0);
+ out.write_long(arg1);
+ out.write_value(cast_array(arg2), Point[].class);
+ _invoke(out);
+ }
+ catch (ApplicationException ex)
+ {
+ in =
+ (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
+
+ String id = in.read_string();
+ throw new UnexpectedException(id);
+ }
+ catch (RemarshalException ex)
+ {
+ receive_move(arg0, arg1, arg2);
+ }
+ finally
+ {
+ _releaseReply(in);
+ }
+ }
+ catch (SystemException ex)
+ {
+ throw Util.mapSystemException(ex);
+ }
+ }
+ else
+ {
+ ServantObject so = _servant_preinvoke("receive_move", Player.class);
+ if (so == null)
+ {
+ receive_move(arg0, arg1, arg2);
+ return;
+ }
+ try
+ {
+ Point[] arg2Copy = (Point[]) Util.copyObject(arg2, _orb());
+ ((Player) so.servant).receive_move(arg0, arg1, arg2Copy);
+ }
+ catch (Throwable ex)
+ {
+ Throwable exCopy = (Throwable) Util.copyObject(ex, _orb());
+ throw Util.wrapException(exCopy);
+ }
+ finally
+ {
+ _servant_postinvoke(so);
+ }
+ }
+ }
+
+ // This method is required as a work-around for
+ // a bug in the JDK 1.1.6 verifier.
+ private Serializable cast_array(Object obj)
+ {
+ return (Serializable) obj;
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java
new file mode 100644
index 00000000000..7e403d8d686
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/midi/Demo.java
@@ -0,0 +1,137 @@
+/* Demo.java -- And example of MIDI support
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.midi;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import javax.sound.midi.*;
+
+/**
+ * An example how javax.sound.midi facilities work.
+ */
+public class Demo extends Frame implements ItemListener
+{
+ Choice midiInChoice = new Choice();
+ Choice midiOutChoice = new Choice();
+
+ MidiDevice inDevice = null;
+ MidiDevice outDevice = null;
+
+ ArrayList inDevices = new ArrayList();
+ ArrayList outDevices = new ArrayList();
+
+ public Demo () throws Exception
+ {
+ MenuBar mb = new MenuBar ();
+ Menu menu = new Menu ("File");
+ MenuItem quit = new MenuItem("Quit", new MenuShortcut('Q'));
+ quit.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ System.exit(0);
+ }
+ });
+ menu.add (quit);
+ mb.add(menu);
+
+ setTitle("synthcity: the GNU Classpath MIDI Demo");
+ setLayout(new FlowLayout());
+
+ MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo();
+
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = MidiSystem.getMidiDevice(infos[i]);
+ if (device.getMaxReceivers() > 0)
+ {
+ midiOutChoice.addItem(infos[i].getDescription());
+ outDevices.add(device);
+ }
+ if (device.getMaxTransmitters() > 0)
+ {
+ midiInChoice.addItem(infos[i].getDescription());
+ inDevices.add(device);
+ }
+ }
+
+ setMenuBar (mb);
+ add(new Label("MIDI IN: "));
+ add(midiInChoice);
+ add(new Label(" MIDI OUT: "));
+ add(midiOutChoice);
+
+ midiInChoice.addItemListener(this);
+ midiOutChoice.addItemListener(this);
+
+ pack();
+ show();
+ }
+
+ public void itemStateChanged (ItemEvent e)
+ {
+ try
+ {
+ if (e.getItemSelectable() == midiInChoice)
+ {
+ if (inDevice != null)
+ inDevice.close();
+ inDevice = (MidiDevice)
+ inDevices.get(midiInChoice.getSelectedIndex());
+ }
+
+ if (e.getItemSelectable() == midiOutChoice)
+ {
+ if (outDevice != null)
+ outDevice.close();
+ outDevice = (MidiDevice)
+ outDevices.get(midiOutChoice.getSelectedIndex());
+ }
+
+ if (inDevice != null && outDevice != null)
+ {
+ if (! inDevice.isOpen())
+ inDevice.open();
+ if (! outDevice.isOpen())
+ outDevice.open();
+ Transmitter t = inDevice.getTransmitter();
+ if (t == null)
+ System.err.println (inDevice + ".getTransmitter() == null");
+ Receiver r = outDevice.getReceiver();
+ if (r == null)
+ System.err.println (outDevice + ".getReceiver() == null");
+
+ if (t != null && r != null)
+ t.setReceiver (r);
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public static void main (String args[]) throws Exception
+ {
+ new Demo();
+ }
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java
new file mode 100644
index 00000000000..b53ba3b5c85
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ButtonDemo.java
@@ -0,0 +1,284 @@
+/* ButtonDemo.java -- An example showing various buttons in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JToggleButton;
+import javax.swing.SwingConstants;
+import javax.swing.plaf.metal.MetalIconFactory;
+
+/**
+ * A simple button demo showing various buttons in different states.
+ */
+public class ButtonDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ private JCheckBox buttonState;
+ private JButton button1;
+ private JButton button2;
+ private JButton button3;
+ private JButton button4;
+
+ private JCheckBox toggleState;
+ private JToggleButton toggle1;
+ private JToggleButton toggle2;
+ private JToggleButton toggle3;
+ private JToggleButton toggle4;
+
+ private JCheckBox checkBoxState;
+ private JCheckBox checkBox1;
+ private JCheckBox checkBox2;
+ private JCheckBox checkBox3;
+
+ private JCheckBox radioState;
+ private JRadioButton radio1;
+ private JRadioButton radio2;
+ private JRadioButton radio3;
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param title the frame title.
+ */
+ public ButtonDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(4, 1));
+ panel.add(createButtonPanel());
+ panel.add(createTogglePanel());
+ panel.add(createCheckBoxPanel());
+ panel.add(createRadioPanel());
+ content.add(panel);
+ return content;
+ }
+
+ private JPanel createButtonPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.buttonState = new JCheckBox("Enabled", true);
+ this.buttonState.setActionCommand("BUTTON_STATE");
+ this.buttonState.addActionListener(this);
+ panel.add(this.buttonState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JButton"));
+ this.button1 = new JButton("Button 1");
+
+ this.button2 = new JButton("Button 2");
+ this.button2.setIcon(MetalIconFactory.getInternalFrameDefaultMenuIcon());
+
+ this.button3 = new JButton("Button 3");
+ this.button3.setIcon(MetalIconFactory.getFileChooserHomeFolderIcon());
+ this.button3.setHorizontalTextPosition(SwingConstants.CENTER);
+ this.button3.setVerticalTextPosition(SwingConstants.BOTTOM);
+
+ this.button4 = new JButton("Button 4");
+ this.button4.setIcon(MetalIconFactory.getFileChooserUpFolderIcon());
+ this.button4.setText(null);
+
+ buttonPanel.add(button1);
+ buttonPanel.add(button2);
+ buttonPanel.add(button3);
+ buttonPanel.add(button4);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ private JPanel createTogglePanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ this.toggleState = new JCheckBox("Enabled", true);
+ this.toggleState.setActionCommand("TOGGLE_STATE");
+ this.toggleState.addActionListener(this);
+
+ panel.add(this.toggleState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JToggleButton"));
+
+ this.toggle1 = new JToggleButton("Toggle 1");
+
+ this.toggle2 = new JToggleButton("Toggle 2");
+ this.toggle2.setIcon(MetalIconFactory.getInternalFrameDefaultMenuIcon());
+
+ this.toggle3 = new JToggleButton("Toggle 3");
+ this.toggle3.setIcon(MetalIconFactory.getFileChooserHomeFolderIcon());
+ this.toggle3.setHorizontalTextPosition(SwingConstants.CENTER);
+ this.toggle3.setVerticalTextPosition(SwingConstants.BOTTOM);
+
+ this.toggle4 = new JToggleButton("Toggle 4");
+ this.toggle4.setIcon(MetalIconFactory.getFileChooserUpFolderIcon());
+ this.toggle4.setText(null);
+
+ ButtonGroup toggleGroup = new ButtonGroup();
+ toggleGroup.add(toggle1);
+ toggleGroup.add(toggle2);
+ toggleGroup.add(toggle3);
+ toggleGroup.add(toggle4);
+
+ buttonPanel.add(toggle1);
+ buttonPanel.add(toggle2);
+ buttonPanel.add(toggle3);
+ buttonPanel.add(toggle4);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ private JPanel createCheckBoxPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ this.checkBoxState = new JCheckBox("Enabled", true);
+ this.checkBoxState.setActionCommand("CHECKBOX_STATE");
+ this.checkBoxState.addActionListener(this);
+
+ panel.add(this.checkBoxState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JCheckBox"));
+ this.checkBox1 = new JCheckBox("CheckBox 1");
+
+ this.checkBox2 = new JCheckBox("CheckBox 2");
+
+ this.checkBox3 = new JCheckBox("CheckBox 3");
+
+ buttonPanel.add(checkBox1);
+ buttonPanel.add(checkBox2);
+ buttonPanel.add(checkBox3);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ private JPanel createRadioPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ this.radioState = new JCheckBox("Enabled", true);
+ this.radioState.setActionCommand("RADIO_STATE");
+ this.radioState.addActionListener(this);
+ panel.add(this.radioState, BorderLayout.EAST);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.setBorder(BorderFactory.createTitledBorder("JRadioButton"));
+ this.radio1 = new JRadioButton("Radio 1");
+
+ this.radio2 = new JRadioButton("Radio 2");
+
+ this.radio3 = new JRadioButton("Radio 3");
+
+ ButtonGroup radioGroup = new ButtonGroup();
+ radioGroup.add(radio1);
+ radioGroup.add(radio2);
+ radioGroup.add(radio3);
+
+ buttonPanel.add(radio1);
+ buttonPanel.add(radio2);
+ buttonPanel.add(radio3);
+
+ panel.add(buttonPanel);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("BUTTON_STATE"))
+ {
+ button1.setEnabled(buttonState.isSelected());
+ button2.setEnabled(buttonState.isSelected());
+ button3.setEnabled(buttonState.isSelected());
+ button4.setEnabled(buttonState.isSelected());
+ }
+ else if (e.getActionCommand().equals("TOGGLE_STATE"))
+ {
+ toggle1.setEnabled(toggleState.isSelected());
+ toggle2.setEnabled(toggleState.isSelected());
+ toggle3.setEnabled(toggleState.isSelected());
+ toggle4.setEnabled(toggleState.isSelected());
+ }
+ else if (e.getActionCommand().equals("CHECKBOX_STATE"))
+ {
+ checkBox1.setEnabled(checkBoxState.isSelected());
+ checkBox2.setEnabled(checkBoxState.isSelected());
+ checkBox3.setEnabled(checkBoxState.isSelected());
+ }
+ else if (e.getActionCommand().equals("RADIO_STATE"))
+ {
+ radio1.setEnabled(radioState.isSelected());
+ radio2.setEnabled(radioState.isSelected());
+ radio3.setEnabled(radioState.isSelected());
+ }
+ else if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ ButtonDemo app = new ButtonDemo("Button Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch b/libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch
new file mode 100644
index 00000000000..7d041a0b0e7
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.cdt.launch.localCLaunch">
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="org.eclipse.cdt.debug.mi.core.CDebugger"/>
+<stringAttribute key="org.eclipse.cdt.launch.protocol" value="mi"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.STOP_ON_SOLIB_EVENTS" value="false"/>
+<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
+<listAttribute key="org.eclipse.cdt.debug.mi.core.SOLIB_PATH"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_REGISTER_BOOKKEEPING" value="false"/>
+<booleanAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB" value="true"/>
+<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
+<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="jamvm"/>
+<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_VARIABLE_BOOKKEEPING" value="false"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="gdb"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="src/jamvm"/>
+<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel gnu.classpath.examples.swing.Demo"/>
+<stringAttribute key="org.eclipse.cdt.debug.mi.core.GDB_INIT" value=""/>
+</launchConfiguration>
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java
new file mode 100644
index 00000000000..52431cb5d53
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ComboBoxDemo.java
@@ -0,0 +1,360 @@
+/* ComboBoxDemo.java -- An example showing various combo boxes in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalIconFactory;
+
+/**
+ * A simple demo showing various combo boxes in different states.
+ */
+public class ComboBoxDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ class CustomCellRenderer extends DefaultListCellRenderer
+ {
+ public Component getListCellRendererComponent(JList list,
+ Object value,
+ int index,
+ boolean isSelected,
+ boolean cellHasFocus)
+ {
+ DefaultListCellRenderer result = (DefaultListCellRenderer)
+ super.getListCellRendererComponent(list, value, index, isSelected,
+ cellHasFocus);
+ Icon icon = (Icon) value;
+ result.setIcon(icon);
+ result.setText("Index = " + index);
+ return result;
+ }
+ }
+
+ private JCheckBox comboState1;
+ private JComboBox combo1;
+ private JComboBox combo2;
+
+ private JCheckBox comboState2;
+ private JComboBox combo3;
+ private JComboBox combo4;
+
+ private JCheckBox comboState3;
+ private JComboBox combo5;
+ private JComboBox combo6;
+
+ private JCheckBox comboState4;
+ private JComboBox combo7;
+ private JComboBox combo8;
+
+ private JCheckBox comboState5;
+ private JComboBox combo9;
+ private JComboBox combo10;
+
+ private JCheckBox comboState6;
+ private JComboBox combo11;
+ private JComboBox combo12;
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param title the frame title.
+ */
+ public ComboBoxDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(6, 1));
+ panel.add(createPanel1());
+ panel.add(createPanel2());
+ panel.add(createPanel3());
+ panel.add(createPanel4());
+ panel.add(createPanel5());
+ panel.add(createPanel6());
+ content.add(panel);
+ return content;
+ }
+
+ private JPanel createPanel1()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState1 = new JCheckBox("Enabled", true);
+ this.comboState1.setActionCommand("COMBO_STATE1");
+ this.comboState1.addActionListener(this);
+ panel.add(this.comboState1, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Regular: "));
+ this.combo1 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+
+ this.combo2 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo2.setEditable(true);
+
+ controlPanel.add(combo1);
+ controlPanel.add(combo2);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ private JPanel createPanel2()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState2 = new JCheckBox("Enabled", true);
+ this.comboState2.setActionCommand("COMBO_STATE2");
+ this.comboState2.addActionListener(this);
+ panel.add(this.comboState2, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Large Font: "));
+ this.combo3 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo3.setFont(new Font("Dialog", Font.PLAIN, 20));
+
+ this.combo4 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo4.setEditable(true);
+ this.combo4.setFont(new Font("Dialog", Font.PLAIN, 20));
+
+ controlPanel.add(combo3);
+ controlPanel.add(combo4);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ private JPanel createPanel3()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState3 = new JCheckBox("Enabled", true);
+ this.comboState3.setActionCommand("COMBO_STATE3");
+ this.comboState3.addActionListener(this);
+ panel.add(this.comboState3, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Colored Background: "));
+ this.combo5 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo5.setBackground(Color.yellow);
+
+ this.combo6 = new JComboBox(new Object[] {"Australia", "New Zealand",
+ "England"});
+ this.combo6.setEditable(true);
+ this.combo6.setBackground(Color.yellow);
+
+ controlPanel.add(combo5);
+ controlPanel.add(combo6);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ /**
+ * This panel contains combo boxes that are empty.
+ *
+ * @return A panel.
+ */
+ private JPanel createPanel4()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState4 = new JCheckBox("Enabled", true);
+ this.comboState4.setActionCommand("COMBO_STATE4");
+ this.comboState4.addActionListener(this);
+ panel.add(this.comboState4, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Empty: "));
+ this.combo7 = new JComboBox();
+ this.combo8 = new JComboBox();
+ this.combo8.setEditable(true);
+
+ controlPanel.add(combo7);
+ controlPanel.add(combo8);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ /**
+ * This panel contains combo boxes that are narrow but contain long text
+ * items.
+ *
+ * @return A panel.
+ */
+ private JPanel createPanel5()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState5 = new JCheckBox("Enabled", true);
+ this.comboState5.setActionCommand("COMBO_STATE5");
+ this.comboState5.addActionListener(this);
+ panel.add(this.comboState5, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Narrow: "));
+ this.combo9 = new JComboBox(new Object[] {
+ "A really long item that will be truncated when displayed"});
+ this.combo9.setPreferredSize(new Dimension(100, 30));
+ this.combo10 = new JComboBox(new Object[] {
+ "A really long item that will be truncated when displayed"});
+ this.combo10.setPreferredSize(new Dimension(100, 30));
+ this.combo10.setEditable(true);
+
+ controlPanel.add(combo9);
+ controlPanel.add(combo10);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ /**
+ * This panel contains combo boxes with a custom renderer.
+ *
+ * @return A panel.
+ */
+ private JPanel createPanel6()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ this.comboState6 = new JCheckBox("Enabled", true);
+ this.comboState6.setActionCommand("COMBO_STATE6");
+ this.comboState6.addActionListener(this);
+ panel.add(this.comboState6, BorderLayout.EAST);
+
+ JPanel controlPanel = new JPanel();
+ controlPanel.setBorder(BorderFactory.createTitledBorder("Custom Renderer: "));
+ this.combo11 = new JComboBox(new Object[] {
+ MetalIconFactory.getFileChooserHomeFolderIcon(),
+ MetalIconFactory.getFileChooserNewFolderIcon()});
+ this.combo11.setPreferredSize(new Dimension(100, 30));
+ this.combo11.setRenderer(new CustomCellRenderer());
+ this.combo12 = new JComboBox(new Object[] {
+ MetalIconFactory.getFileChooserHomeFolderIcon(),
+ MetalIconFactory.getFileChooserNewFolderIcon()});
+ this.combo12.setPreferredSize(new Dimension(100, 30));
+ this.combo12.setRenderer(new CustomCellRenderer());
+ this.combo12.setEditable(true);
+
+ controlPanel.add(combo11);
+ controlPanel.add(combo12);
+
+ panel.add(controlPanel);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("COMBO_STATE1"))
+ {
+ combo1.setEnabled(comboState1.isSelected());
+ combo2.setEnabled(comboState1.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE2"))
+ {
+ combo3.setEnabled(comboState2.isSelected());
+ combo4.setEnabled(comboState2.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE3"))
+ {
+ combo5.setEnabled(comboState3.isSelected());
+ combo6.setEnabled(comboState3.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE4"))
+ {
+ combo7.setEnabled(comboState4.isSelected());
+ combo8.setEnabled(comboState4.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE5"))
+ {
+ combo9.setEnabled(comboState5.isSelected());
+ combo10.setEnabled(comboState5.isSelected());
+ }
+ else if (e.getActionCommand().equals("COMBO_STATE6"))
+ {
+ combo11.setEnabled(comboState6.isSelected());
+ combo12.setEnabled(comboState6.isSelected());
+ }
+ else if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ try
+ {
+ UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ ComboBoxDemo app = new ComboBoxDemo("ComboBox Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
index e8c428b5963..549a42e4b99 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/Demo.java
@@ -24,20 +24,16 @@ package gnu.classpath.examples.swing;
import java.awt.*;
import java.awt.event.*;
-import java.awt.font.*;
-import java.awt.geom.*;
-import java.awt.image.*;
import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.plaf.*;
-import javax.swing.plaf.basic.*;
-import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.tree.*;
import javax.swing.border.*;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.metal.OceanTheme;
+
import java.net.URL;
-import java.util.*;
public class Demo
{
@@ -51,26 +47,44 @@ public class Demo
if (System.getProperty("swing.defaultlaf") == null)
{
StringBuffer text = new StringBuffer();
- text.append("\tYou may change the Look and Feel of this\n");
- text.append("\tDemo by setting the system property\n");
- text.append("\t-Dswing.defaultlaf=<LAFClassName>\n\n");
- text.append("\tPossible values for <LAFClassName> are:\n");
- text.append("\t * javax.swing.plaf.metal.MetalLookAndFeel\n");
- text.append("\t\tthe default Java L&F\n");
- text.append("\t * gnu.classpath.examples.swing.GNULookAndFeel\n");
- text.append("\tthe GNU Look and Feel\n");
- text.append("\t(derived from javax.swing.plaf.basic.BasicLookAndFeel\n\n");
- text.append("\tthe default is gnu.classpath.examples.swing.GNULookAndFeel\n");
- JEditorPane textPane = new JEditorPane();
- // temporary hack, preferred size should be computed by the
- // component
- textPane.setPreferredSize(new Dimension(400, 300));
- textPane.setText(text.toString());
- JOptionPane.showMessageDialog(null, textPane,
- "Look and Feel notice",
- JOptionPane.INFORMATION_MESSAGE);
-
- UIManager.setLookAndFeel(new GNULookAndFeel());
+ text.append("You may change the Look and Feel of this\n");
+ text.append("Demo by setting the system property\n");
+ text.append("-Dswing.defaultlaf=<LAFClassName>\n");
+ text.append("\n");
+ text.append("Possible values for <LAFClassName> are:\n");
+ text.append("\n");
+ text.append("* javax.swing.plaf.metal.MetalLookAndFeel\n");
+ text.append(" the default GNU Classpath L&F\n");
+ text.append("\n");
+ text.append("* gnu.classpath.examples.swing.GNULookAndFeel\n");
+ text.append(" the GNU Look and Feel\n");
+ text.append(" (derived from javax.swing.plaf.basic.BasicLookAndFeel)\n");
+ text.append("\n");
+ text.append("MetalLookAndFeel supports different Themes.\n");
+ text.append("DefaultMetalTheme (the default) and OceanTheme (in development)\n");
+
+ final String DEFAULT = "MetalLookAndFeel (default)";
+ final String OCEAN = "MetalLookAndFeel (Ocean)";
+ final String GNU = "GNULookAndFeel";
+ final String[] lafs = new String[] { DEFAULT, OCEAN, GNU };
+
+ int laf = JOptionPane.showOptionDialog(null, text /* textPane */,
+ "Look and Feel choice",
+ JOptionPane.OK_OPTION,
+ JOptionPane.QUESTION_MESSAGE,
+ null, lafs, DEFAULT);
+ if (laf == 0)
+ {
+ MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ if (laf == 1)
+ {
+ MetalLookAndFeel.setCurrentTheme(new OceanTheme());
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ else if (laf == 2)
+ UIManager.setLookAndFeel(new GNULookAndFeel());
}
}
catch (UnsupportedLookAndFeelException e)
@@ -147,10 +161,7 @@ public class Demo
JMenu examples = new JMenu("Examples");
new PopUpAction("Buttons",
- mkPanel(new JComponent[]
- {mkBigButton("mango"),
- mkBigButton("guava"),
- mkBigButton("lemon")}),
+ (new ButtonDemo("Button Demo")).createContent(),
examples);
new PopUpAction("Toggles",
@@ -166,9 +177,13 @@ public class Demo
examples);
new PopUpAction("Slider",
- mkSliders(),
+ (new SliderDemo("Slider Demo")).createContent(),
examples);
+ new PopUpAction("ProgressBar",
+ ProgressBarDemo.createContent(),
+ examples);
+
new PopUpAction("List",
mkListPanel(new String[] { "hello",
"this",
@@ -181,7 +196,7 @@ public class Demo
examples);
new PopUpAction("Scrollbar",
- mkScrollBar(),
+ (new ScrollBarDemo("ScrollBarDemo")).createContent(),
examples);
new PopUpAction("Viewport",
@@ -189,8 +204,8 @@ public class Demo
examples);
new PopUpAction("ScrollPane",
- mkScrollPane(mkBigButton("Scroll Me!")),
- examples);
+ mkScrollPane(mkBigButton("Scroll Me!")),
+ examples);
new PopUpAction("TabPane",
mkTabs(new String[] {"happy",
@@ -203,19 +218,19 @@ public class Demo
examples);
new PopUpAction("TextField",
- mkTextField("Hello, World!"),
+ (new TextFieldDemo("TextField Demo")).createContent(),
examples);
+ new PopUpAction("FileChooser",
+ (new FileChooserDemo("FileChooser Demo")).createContent(),
+ examples);
+
new PopUpAction("ColorChooser",
mkColorChooser(),
examples);
new PopUpAction("ComboBox",
- mkComboBox(new String[] {"Stop",
- "Software",
- "Hoarders",
- "Support",
- "GNU!"}),
+ (new ComboBoxDemo("ComboBox Demo")).createContent(),
examples);
new PopUpAction("Editor",
@@ -317,6 +332,7 @@ public class Demo
else
b = new JButton(title, icon);
+ b.setToolTipText(title);
if (hAlign != -1) b.setHorizontalAlignment(hAlign);
if (vAlign != -1) b.setVerticalAlignment(vAlign);
if (hPos != -1) b.setHorizontalTextPosition(hPos);
@@ -640,6 +656,14 @@ public class Demo
panel.add(but, BorderLayout.NORTH);
but.doClick();
but.doClick();
+ JInternalFrame palette = new JInternalFrame("Palette", true, true, true,
+ true);
+ palette.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
+ desk.add(palette, JDesktopPane.PALETTE_LAYER);
+ JLabel label = new JLabel("This is a floating palette!");
+ palette.getContentPane().add(label);
+ palette.pack();
+ palette.setVisible(true);
return panel;
}
@@ -678,26 +702,6 @@ public class Demo
return tabs;
}
- static JComponent mkSliders()
- {
- JSlider slider = new JSlider();
- slider.setPaintTrack(true);
- slider.setPaintTicks(true);
- slider.setMajorTickSpacing(30);
- slider.setMinorTickSpacing(5);
- slider.setPaintLabels(true);
- slider.setInverted(false);
- JProgressBar progress = new JProgressBar();
- BoundedRangeModel model = new DefaultBoundedRangeModel(10, 1, 0, 100);
- progress.setModel(model);
- slider.setModel(model);
- JPanel panel = new JPanel();
- panel.setLayout(new GridLayout(1, 2));
- panel.add(slider);
- panel.add(progress);
- return panel;
- }
-
public Demo()
{
frame = new JFrame("Swing Activity Board");
@@ -735,11 +739,17 @@ public class Demo
return c;
}
- public static JRadioButton mkRadio(String label)
+ public static JPanel mkRadio(String label)
{
+ JPanel p = new JPanel();
JRadioButton c = new JRadioButton(label);
- c.setFont(new Font("Luxi", Font.PLAIN, 14));
- return c;
+ JRadioButton d = new JRadioButton("not " + label);
+ ButtonGroup bg = new ButtonGroup();
+ bg.add(c);
+ bg.add(d);
+ p.add(c);
+ p.add(d);
+ return p;
}
public static JList mkList(Object[] elts)
@@ -1002,31 +1012,34 @@ public class Demo
private JPanel mkButtonBar()
{
- JPanel panel = new JPanel ();
- panel.setLayout(new FlowLayout());
+ JPanel panel = new JPanel (new GridLayout(2, 1));
+ JPanel panelA = new JPanel(new FlowLayout());
+ JPanel panelB = new JPanel(new FlowLayout());
new PopUpAction("Buttons",
- mkPanel(new JComponent[]
- {mkBigButton("mango"),
- mkBigButton("guava"),
- mkBigButton("lemon")}),
- panel);
+ (new ButtonDemo("Button Demo")).createContent(),
+ panelA);
new PopUpAction("Toggles",
mkToggle("cool and refreshing"),
- panel);
+ panelA);
new PopUpAction("Checkbox",
mkCheckbox("ice cold"),
- panel);
+ panelA);
new PopUpAction("Radio",
mkRadio("delicious"),
- panel);
+ panelA);
new PopUpAction("Slider",
- mkSliders(),
- panel);
+ (new SliderDemo("Slider Demo")).createContent(),
+ panelA);
+
+ new PopUpAction("ProgressBar",
+ ProgressBarDemo.createContent(),
+ panelA);
+
new PopUpAction("List",
mkListPanel(new String[] { "hello",
@@ -1037,60 +1050,60 @@ public class Demo
"that",
"wraps",
"over"}),
- panel);
+ panelA);
new PopUpAction("Scrollbar",
- mkScrollBar(),
- panel);
+ (new ScrollBarDemo("ScrollBar Demo")).createContent(),
+ panelA);
new PopUpAction("Viewport",
mkViewportBox(mkBigButton("View Me!")),
- panel);
+ panelA);
new PopUpAction("ScrollPane",
mkScrollPane(mkBigButton("Scroll Me!")),
- panel);
+ panelA);
new PopUpAction("TabPane",
mkTabs(new String[] {"happy",
"sad",
"indifferent"}),
- panel);
+ panelB);
new PopUpAction("Spinner",
mkSpinner(),
- panel);
+ panelB);
new PopUpAction("TextField",
- mkTextField("Hello, World!"),
- panel);
+ (new TextFieldDemo("TextField Demo")).createContent(),
+ panelB);
+
+ new PopUpAction("FileChooser",
+ (new FileChooserDemo("FileChooser Demo")).createContent(),
+ panelB);
new PopUpAction("ColorChooser",
mkColorChooser(),
- panel);
+ panelB);
new PopUpAction("ComboBox",
- mkComboBox(new String[] {"Stop",
- "Software",
- "Hoarders",
- "Support",
- "GNU!"}),
- panel);
+ (new ComboBoxDemo("ComboBox Demo")).createContent(),
+ panelB);
new PopUpAction("Editor",
mkEditorPane(),
- panel);
+ panelB);
new PopUpAction("Tree",
mkTree(),
- panel);
+ panelB);
new PopUpAction("Table",
mkTable(),
- panel);
+ panelB);
JButton exitDisposer = mkDisposerButton(frame);
- panel.add(exitDisposer);
+ panelB.add(exitDisposer);
exitDisposer.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
@@ -1098,11 +1111,8 @@ public class Demo
System.exit(1);
}
});
+ panel.add(panelA);
+ panel.add(panelB);
return panel;
}
-
- public static JTextField mkTextField(String sometext)
- {
- return new JTextField(sometext, 40);
- }
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java
new file mode 100644
index 00000000000..70bb56d66cf
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/FileChooserDemo.java
@@ -0,0 +1,228 @@
+/* FileChooserDemo.java -- An example showing file choosers in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * A simple demo showing the {@link JFileChooser} component used in different
+ * ways.
+ */
+public class FileChooserDemo extends JFrame implements ActionListener
+{
+ /**
+ * A file filter for Java source files.
+ */
+ static class JavaFileFilter extends FileFilter
+ {
+ public String getDescription()
+ {
+ return "Java Source Files (.java)";
+ }
+ public boolean accept(File f)
+ {
+ if (f != null)
+ {
+ return f.getName().endsWith(".java") || f.isDirectory();
+ }
+ else
+ return false;
+ }
+ }
+
+ /** A label to display the selected file. */
+ JLabel selectedFileLabel;
+
+ /**
+ * A list showing the selected files (where multi selections are
+ * allowed).
+ */
+ JList selectedFilesList;
+
+ /** A label to display the return code for the JFileChooser. */
+ JLabel returnCodeLabel;
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param frameTitle the frame title.
+ */
+ public FileChooserDemo(String frameTitle)
+ {
+ super(frameTitle);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ // create a panel of buttons to select the different styles of file
+ // chooser...
+ JPanel buttonPanel = new JPanel(new GridLayout(5, 1));
+ JButton openButton = new JButton("Open...");
+ openButton.setActionCommand("OPEN");
+ openButton.addActionListener(this);
+ buttonPanel.add(openButton);
+ JButton saveButton = new JButton("Save...");
+ saveButton.setActionCommand("SAVE");
+ saveButton.addActionListener(this);
+ buttonPanel.add(saveButton);
+ JButton queryButton = new JButton("Select Directory...");
+ queryButton.setActionCommand("SELECT_DIRECTORY");
+ queryButton.addActionListener(this);
+ buttonPanel.add(queryButton);
+ JButton openJavaButton = new JButton("Open Java file...");
+ openJavaButton.setActionCommand("OPEN_JAVA");
+ openJavaButton.addActionListener(this);
+ buttonPanel.add(openJavaButton);
+ JButton openMultiButton = new JButton("Open multiple files...");
+ openMultiButton.setActionCommand("OPEN_MULTI");
+ openMultiButton.addActionListener(this);
+ buttonPanel.add(openMultiButton);
+ panel.add(buttonPanel, BorderLayout.WEST);
+
+ // create a panel to display the selected file(s) and the return code
+ JPanel displayPanel = new JPanel(new BorderLayout());
+
+ selectedFileLabel = new JLabel("-");
+ selectedFileLabel.setBorder(BorderFactory.createTitledBorder("Selected File/Directory: "));
+ displayPanel.add(selectedFileLabel, BorderLayout.NORTH);
+
+ selectedFilesList = new JList();
+ JScrollPane sp = new JScrollPane(selectedFilesList);
+ sp.setBorder(BorderFactory.createTitledBorder("Selected Files: "));
+ displayPanel.add(sp);
+
+ returnCodeLabel = new JLabel("0");
+ returnCodeLabel.setBorder(BorderFactory.createTitledBorder("Return Code:"));
+ displayPanel.add(returnCodeLabel, BorderLayout.SOUTH);
+
+ panel.add(displayPanel);
+ return panel;
+ }
+
+ /**
+ * When the user clicks on a button, launch the appropriate file chooser
+ * and report the results.
+ *
+ * @param e the event.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ int option = 0;
+ File selectedFile = null;
+ File[] selectedFiles = new File[0];
+
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("OPEN"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ option = chooser.showOpenDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("OPEN_MULTI"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setMultiSelectionEnabled(true);
+ option = chooser.showOpenDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("OPEN_JAVA"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setAcceptAllFileFilterUsed(false);
+ chooser.setFileFilter(new JavaFileFilter());
+ option = chooser.showOpenDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("SAVE"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ option = chooser.showSaveDialog(this);
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+ else if (e.getActionCommand().equals("SELECT_DIRECTORY"))
+ {
+ JFileChooser chooser = new JFileChooser();
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ option = chooser.showDialog(this, "Select");
+ selectedFile = chooser.getSelectedFile();
+ selectedFiles = chooser.getSelectedFiles();
+ }
+
+ // display the selection and return code
+ if (selectedFile != null)
+ selectedFileLabel.setText(selectedFile.toString());
+ else
+ selectedFileLabel.setText("null");
+ DefaultListModel listModel = new DefaultListModel();
+ for (int i = 0; i < selectedFiles.length; i++)
+ listModel.addElement(selectedFiles[i]);
+ selectedFilesList.setModel(listModel);
+ returnCodeLabel.setText(Integer.toString(option));
+ }
+
+ public static void main(String[] args)
+ {
+ FileChooserDemo app = new FileChooserDemo("File Chooser Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java b/libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java
index 97e91a89f3f..c8fd09d744c 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/GNULookAndFeel.java
@@ -22,8 +22,13 @@ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
package gnu.classpath.examples.swing;
import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import javax.swing.Icon;
import javax.swing.ImageIcon;
+import javax.swing.JCheckBox;
+import javax.swing.JRadioButton;
import javax.swing.UIDefaults;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.IconUIResource;
@@ -64,8 +69,10 @@ public class GNULookAndFeel extends BasicLookAndFeel
"MenuBar.background", new ColorUIResource(blueGray),
"MenuItem.background", new ColorUIResource(blueGray),
"ScrollBar.background", new ColorUIResource(blueGray),
-
- "Tree.closedIcon",
+ "CheckBox.icon", new CheckBoxIcon(),
+ "RadioButton.icon", new RadioButtonIcon(),
+
+ "Tree.closedIcon",
new IconUIResource(new ImageIcon
(getClass().getResource
(iconspath + "TreeClosed.png"))),
@@ -82,4 +89,177 @@ public class GNULookAndFeel extends BasicLookAndFeel
}
return LAF_defaults;
}
+
+ /**
+ * The icon used for CheckBoxes in the BasicLookAndFeel. This is an empty
+ * icon with a size of 13x13 pixels.
+ */
+ static class CheckBoxIcon
+ implements Icon
+ {
+ /**
+ * Returns the height of the icon. The BasicLookAndFeel CheckBox icon
+ * has a height of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconHeight()
+ {
+ return 13;
+ }
+
+ /**
+ * Returns the width of the icon. The BasicLookAndFeel CheckBox icon
+ * has a width of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconWidth()
+ {
+ return 13;
+ }
+
+ /**
+ * Paints the icon. The BasicLookAndFeel CheckBox icon is empty and does
+ * not need to be painted.
+ *
+ * @param c the component to be painted
+ * @param g the Graphics context to be painted with
+ * @param x the x position of the icon
+ * @param y the y position of the icon
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color save = g.getColor();
+ g.setColor(c.getForeground());
+ g.drawRect(x, y, getIconWidth(), getIconHeight());
+
+ JCheckBox item = (JCheckBox) c;
+ if (item.isSelected())
+ {
+ g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
+ g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
+ g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
+ g.drawLine(5 + x, 8 + y, 9 + x, 4 + y);
+ }
+
+ g.setColor(save);
+ }
+ }
+
+ /**
+ * The icon used for RadioButtons in the GNULookAndFeel. This is an empty
+ * icon with a size of 13x13 pixels.
+ */
+ static class RadioButtonIcon
+ implements Icon
+ {
+ /**
+ * Returns the height of the icon. The GNULookAndFeel RadioButton icon
+ * has a height of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconHeight()
+ {
+ return 13;
+ }
+
+ /**
+ * Returns the width of the icon. The GNULookAndFeel RadioButton icon
+ * has a width of 13 pixels.
+ *
+ * @return the height of the icon
+ */
+ public int getIconWidth()
+ {
+ return 13;
+ }
+
+ /**
+ * Paints the icon. The GNULookAndFeel RadioButton icon is empty and does
+ * not need to be painted.
+ *
+ * @param c the component to be painted
+ * @param g the Graphics context to be painted with
+ * @param x the x position of the icon
+ * @param y the y position of the icon
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ JRadioButton b = (JRadioButton) c;
+
+ // draw outer circle
+ if (b.isEnabled())
+ g.setColor(Color.GRAY);
+ else
+ g.setColor(Color.GRAY);
+ g.drawLine(x + 2, y + 1, x + 3, y + 1);
+ g.drawLine(x + 4, y, x + 7, y);
+ g.drawLine(x + 8, y + 1, x + 9, y + 1);
+ g.drawLine(x + 10, y + 2, x + 10, y + 3);
+ g.drawLine(x + 11, y + 4, x + 11, y + 7);
+ g.drawLine(x + 10, y + 8, x + 10, y + 9);
+ g.drawLine(x + 8, y + 10, x + 9, y + 10);
+ g.drawLine(x + 4, y + 11, x + 7, y + 11);
+ g.drawLine(x + 2, y + 10, x + 3, y + 10);
+ g.drawLine(x + 1, y + 9, x + 1, y + 8);
+ g.drawLine(x, y + 7, x, y + 4);
+ g.drawLine(x + 1, y + 2, x + 1, y + 3);
+
+ if (b.getModel().isArmed())
+ {
+ g.setColor(Color.GRAY);
+ g.drawLine(x + 4, y + 1, x + 7, y + 1);
+ g.drawLine(x + 4, y + 10, x + 7, y + 10);
+ g.drawLine(x + 1, y + 4, x + 1, y + 7);
+ g.drawLine(x + 10, y + 4, x + 10, y + 7);
+ g.fillRect(x + 2, y + 2, 8, 8);
+ }
+ else
+ {
+ // only draw inner highlight if not filled
+ if (b.isEnabled())
+ {
+ g.setColor(Color.WHITE);
+
+ g.drawLine(x + 2, y + 8, x + 2, y + 9);
+ g.drawLine(x + 1, y + 4, x + 1, y + 7);
+ g.drawLine(x + 2, y + 2, x + 2, y + 3);
+ g.drawLine(x + 3, y + 2, x + 3, y + 2);
+ g.drawLine(x + 4, y + 1, x + 7, y + 1);
+ g.drawLine(x + 8, y + 2, x + 9, y + 2);
+ }
+ }
+
+ // draw outer highlight
+ if (b.isEnabled())
+ {
+ g.setColor(Color.WHITE);
+
+ // outer
+ g.drawLine(x + 10, y + 1, x + 10, y + 1);
+ g.drawLine(x + 11, y + 2, x + 11, y + 3);
+ g.drawLine(x + 12, y + 4, x + 12, y + 7);
+ g.drawLine(x + 11, y + 8, x + 11, y + 9);
+ g.drawLine(x + 10, y + 10, x + 10, y + 10);
+ g.drawLine(x + 8, y + 11, x + 9, y + 11);
+ g.drawLine(x + 4, y + 12, x + 7, y + 12);
+ g.drawLine(x + 2, y + 11, x + 3, y + 11);
+ }
+
+ if (b.isSelected())
+ {
+ if (b.isEnabled())
+ g.setColor(Color.BLACK);
+ else
+ g.setColor(Color.GRAY);
+ g.drawLine(x + 4, y + 3, x + 7, y + 3);
+ g.fillRect(x + 3, y + 4, 6, 4);
+ g.drawLine(x + 4, y + 8, x + 7, y + 8);
+ }
+ g.setColor(savedColor);
+ }
+ }
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java
new file mode 100644
index 00000000000..d62175bcd79
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ProgressBarDemo.java
@@ -0,0 +1,219 @@
+/* ProgressBarDemo.java -- A demonstration of JProgressBars
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import javax.swing.JSlider;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+public class ProgressBarDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ /**
+ * Creates a new ProgressBarDemo window with the specified title.
+ *
+ * @param title the title of the program window
+ */
+ ProgressBarDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ getContentPane().add(content);
+ getContentPane().add(closePanel, BorderLayout.SOUTH);
+ }
+
+ static JPanel createContent()
+ {
+ JPanel content = new JPanel();
+ content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
+ JPanel horizontalProgressBar = createHorizontalProgressBar();
+ content.add(horizontalProgressBar);
+ content.add(Box.createVerticalStrut(10));
+ JPanel verticalProgressBar = createVerticalProgressBar();
+ content.add(verticalProgressBar);
+ return content;
+ }
+
+ private static JPanel createHorizontalProgressBar()
+ {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+
+ // Plain progress bar.
+ final JProgressBar hor1 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ panel.add(hor1);
+ final JSlider slider1 = new JSlider(JSlider.HORIZONTAL, 0, 100, 0);
+ slider1.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ hor1.setValue(slider1.getValue());
+ }
+ });
+ panel.add(slider1);
+
+ panel.add(Box.createVerticalStrut(5));
+
+ // Plain progress bar with some text.
+ final JProgressBar hor2 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ hor2.setString("ProgressBar Demo");
+ hor2.setStringPainted(true);
+ panel.add(hor2);
+ final JSlider slider2 = new JSlider(JSlider.HORIZONTAL, 0, 100, 0);
+ slider2.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ hor2.setValue(slider2.getValue());
+ }
+ });
+ panel.add(slider2);
+
+ panel.add(Box.createVerticalStrut(5));
+
+ // Indeterminate progress bar.
+ final JProgressBar hor3 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ hor3.setIndeterminate(true);
+ panel.add(hor3);
+
+ panel.add(Box.createVerticalStrut(5));
+
+ // Indeterminate progress bar with text.
+ final JProgressBar hor4 = new JProgressBar(JProgressBar.HORIZONTAL, 0, 100);
+ hor4.setIndeterminate(true);
+ hor4.setString("Indeterminate ProgressBar");
+ hor4.setStringPainted(true);
+ panel.add(hor4);
+
+ return panel;
+ }
+
+ private static JPanel createVerticalProgressBar()
+ {
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
+ final JProgressBar vert = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ panel.add(vert);
+ final JSlider slider = new JSlider(JSlider.VERTICAL, 0, 100, 0);
+ slider.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ vert.setValue(slider.getValue());
+ }
+ });
+ panel.add(slider);
+
+ panel.add(Box.createHorizontalStrut(5));
+
+ final JProgressBar vert2 = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ vert2.setString("ProgressBar Demo");
+ panel.add(vert2);
+ vert2.setStringPainted(true);
+ final JSlider slider2 = new JSlider(JSlider.VERTICAL, 0, 100, 0);
+ slider2.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent event)
+ {
+ vert2.setValue(slider2.getValue());
+ }
+ });
+ panel.add(slider2);
+
+ panel.add(Box.createHorizontalStrut(5));
+
+ // Indeterminate progress bar.
+ final JProgressBar vert3 = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ vert3.setIndeterminate(true);
+ panel.add(vert3);
+
+ panel.add(Box.createHorizontalStrut(5));
+
+ // Indeterminate progress bar with text.
+ final JProgressBar vert4 = new JProgressBar(JProgressBar.VERTICAL, 0, 100);
+ vert4.setIndeterminate(true);
+ vert4.setString("Indeterminate ProgressBar");
+ vert4.setStringPainted(true);
+ panel.add(vert4);
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * The entry point when running as a standalone program.
+ *
+ * @param args command line arguments
+ */
+ public static void main(String[] args)
+ {
+ SwingUtilities.invokeLater(
+ new Runnable()
+ {
+ public void run()
+ {
+ ProgressBarDemo app = new ProgressBarDemo("ProgressBar Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+ });
+ }
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java
new file mode 100644
index 00000000000..fce137301d7
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/ScrollBarDemo.java
@@ -0,0 +1,141 @@
+/* ScrollBarDemo.java -- An example showing scroll bars in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollBar;
+
+/**
+ * A simple scroll bar demo showing various scroll bars in different states.
+ */
+public class ScrollBarDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param title the frame title.
+ */
+ public ScrollBarDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = createScrollBarPanel();
+ content.add(panel);
+ return content;
+ }
+
+ private JPanel createScrollBarPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ JPanel horizontalPanel = new JPanel();
+
+ JScrollBar scroll1a = new JScrollBar(JScrollBar.HORIZONTAL);
+ JScrollBar scroll1b = new JScrollBar(JScrollBar.HORIZONTAL);
+ scroll1b.setEnabled(false);
+ JScrollBar scroll1c = new JScrollBar(JScrollBar.HORIZONTAL);
+ scroll1c.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+ JScrollBar scroll1d = new JScrollBar(JScrollBar.HORIZONTAL);
+ scroll1d.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+ scroll1d.setEnabled(false);
+ horizontalPanel.add(scroll1a);
+ horizontalPanel.add(scroll1b);
+ horizontalPanel.add(scroll1c);
+ horizontalPanel.add(scroll1d);
+
+ panel.add(horizontalPanel, BorderLayout.NORTH);
+
+ JPanel verticalPanel = new JPanel();
+ verticalPanel.setLayout(new GridLayout(1, 7));
+
+ JScrollBar scroll2a = new JScrollBar(JScrollBar.VERTICAL);
+ JScrollBar scroll2b = new JScrollBar(JScrollBar.VERTICAL);
+ scroll2b.setEnabled(false);
+ JScrollBar scroll2c = new JScrollBar(JScrollBar.VERTICAL);
+ scroll2c.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+ JScrollBar scroll2d = new JScrollBar(JScrollBar.VERTICAL);
+ scroll2d.setEnabled(false);
+ scroll2d.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
+
+ verticalPanel.add(scroll2a);
+ verticalPanel.add(new JPanel());
+ verticalPanel.add(scroll2b);
+ verticalPanel.add(new JPanel());
+ verticalPanel.add(scroll2c);
+ verticalPanel.add(new JPanel());
+ verticalPanel.add(scroll2d);
+
+ panel.add(verticalPanel, BorderLayout.EAST);
+
+ JPanel centerPanel = new JPanel(new GridLayout(1, 2));
+ centerPanel.add(new JScrollBar(JScrollBar.HORIZONTAL));
+ centerPanel.add(new JScrollBar(JScrollBar.VERTICAL));
+ panel.add(centerPanel);
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ ScrollBarDemo app = new ScrollBarDemo("ScrollBar Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java
new file mode 100644
index 00000000000..736024c48da
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/SliderDemo.java
@@ -0,0 +1,249 @@
+/* SliderDemo.java -- An example showing JSlider in various configurations.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+
+public class SliderDemo extends JFrame implements ActionListener
+{
+
+ JSlider hslider1;
+ JSlider hslider2;
+ JSlider hslider3;
+ JSlider hslider4;
+ JSlider hslider5;
+ JSlider hslider6;
+ JSlider hslider7;
+ JSlider hslider8;
+
+ JSlider vslider1;
+ JSlider vslider2;
+ JSlider vslider3;
+ JSlider vslider4;
+ JSlider vslider5;
+ JSlider vslider6;
+ JSlider vslider7;
+ JSlider vslider8;
+
+ JCheckBox enabledCheckBox;
+
+ public SliderDemo(String frameTitle)
+ {
+ super(frameTitle);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(1, 2));
+ panel.add(createHorizontalPanel());
+ panel.add(createVerticalPanel());
+ enabledCheckBox = new JCheckBox("Enabled");
+ enabledCheckBox.setSelected(true);
+ enabledCheckBox.setActionCommand("TOGGLE_ENABLED");
+ enabledCheckBox.addActionListener(this);
+ JPanel checkBoxPanel = new JPanel();
+ checkBoxPanel.add(enabledCheckBox);
+ JPanel panel2 = new JPanel(new BorderLayout());
+ panel2.add(panel);
+ panel2.add(checkBoxPanel, BorderLayout.SOUTH);
+ content.add(panel2);
+ return content;
+ }
+
+ private JPanel createHorizontalPanel()
+ {
+ JPanel panel = new JPanel(new GridLayout(8, 1));
+
+ hslider1 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ panel.add(hslider1);
+
+ hslider2 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider2.setMajorTickSpacing(20);
+ hslider2.setMinorTickSpacing(5);
+ hslider2.setPaintTicks(true);
+ panel.add(hslider2);
+
+ hslider3 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider3.setMajorTickSpacing(20);
+ hslider3.setMinorTickSpacing(5);
+ hslider3.setPaintLabels(true);
+ hslider3.setPaintTicks(true);
+ panel.add(hslider3);
+
+ hslider4 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider4.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ hslider4.setMajorTickSpacing(20);
+ hslider4.setMinorTickSpacing(5);
+ hslider4.setPaintLabels(true);
+ hslider4.setPaintTicks(true);
+ panel.add(hslider4);
+
+ hslider5 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider5.setInverted(true);
+ panel.add(hslider5);
+
+ hslider6 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider6.setInverted(true);
+ hslider6.setMajorTickSpacing(20);
+ hslider6.setMinorTickSpacing(5);
+ hslider6.setPaintTicks(true);
+ panel.add(hslider6);
+
+ hslider7 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider7.setInverted(true);
+ hslider7.setMajorTickSpacing(20);
+ hslider7.setMinorTickSpacing(5);
+ hslider7.setPaintLabels(true);
+ hslider7.setPaintTicks(true);
+ panel.add(hslider7);
+
+ hslider8 = new JSlider(JSlider.HORIZONTAL, 0, 100, 35);
+ hslider8.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ hslider8.setInverted(true);
+ hslider8.setMajorTickSpacing(20);
+ hslider8.setMinorTickSpacing(5);
+ hslider8.setPaintLabels(true);
+ hslider8.setPaintTicks(true);
+ panel.add(hslider8);
+
+ return panel;
+ }
+
+ private JPanel createVerticalPanel()
+ {
+ JPanel panel = new JPanel(new GridLayout(1, 8));
+
+ vslider1 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ panel.add(vslider1);
+
+ vslider2 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider2.setMajorTickSpacing(20);
+ vslider2.setMinorTickSpacing(5);
+ vslider2.setPaintTicks(true);
+ panel.add(vslider2);
+
+ vslider3 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider3.setMajorTickSpacing(20);
+ vslider3.setMinorTickSpacing(5);
+ vslider3.setPaintLabels(true);
+ vslider3.setPaintTicks(true);
+ panel.add(vslider3);
+
+ vslider4 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider4.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ vslider4.setMajorTickSpacing(20);
+ vslider4.setMinorTickSpacing(5);
+ vslider4.setPaintLabels(true);
+ vslider4.setPaintTicks(true);
+ panel.add(vslider4);
+
+ vslider5 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider5.setInverted(true);
+ panel.add(vslider5);
+
+ vslider6 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider6.setInverted(true);
+ vslider6.setMajorTickSpacing(20);
+ vslider6.setMinorTickSpacing(5);
+ vslider6.setPaintTicks(true);
+ panel.add(vslider6);
+
+ vslider7 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider7.setInverted(true);
+ vslider7.setMajorTickSpacing(20);
+ vslider7.setMinorTickSpacing(5);
+ vslider7.setPaintLabels(true);
+ vslider7.setPaintTicks(true);
+ panel.add(vslider7);
+
+ vslider8 = new JSlider(JSlider.VERTICAL, 0, 100, 35);
+ vslider8.putClientProperty("JSlider.isFilled", Boolean.TRUE);
+ vslider8.setInverted(true);
+ vslider8.setMajorTickSpacing(20);
+ vslider8.setMinorTickSpacing(5);
+ vslider8.setPaintLabels(true);
+ vslider8.setPaintTicks(true);
+ panel.add(vslider8);
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("TOGGLE_ENABLED"))
+ {
+ boolean enabled = enabledCheckBox.isSelected();
+ hslider1.setEnabled(enabled);
+ hslider2.setEnabled(enabled);
+ hslider3.setEnabled(enabled);
+ hslider4.setEnabled(enabled);
+ hslider5.setEnabled(enabled);
+ hslider6.setEnabled(enabled);
+ hslider7.setEnabled(enabled);
+ hslider8.setEnabled(enabled);
+ vslider1.setEnabled(enabled);
+ vslider2.setEnabled(enabled);
+ vslider3.setEnabled(enabled);
+ vslider4.setEnabled(enabled);
+ vslider5.setEnabled(enabled);
+ vslider6.setEnabled(enabled);
+ vslider7.setEnabled(enabled);
+ vslider8.setEnabled(enabled);
+ }
+ }
+ public static void main(String[] args)
+ {
+ SliderDemo app = new SliderDemo("Slider Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java
new file mode 100644
index 00000000000..5ddf1168061
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/TextFieldDemo.java
@@ -0,0 +1,488 @@
+/* TextFieldDemo.java -- An example showing various textfields in Swing.
+ Copyright (C) 2005, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
+package gnu.classpath.examples.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultCaret;
+import javax.swing.text.JTextComponent;
+
+/**
+ * A simple textfield demo showing various textfields in different states.
+ */
+public class TextFieldDemo
+ extends JFrame
+ implements ActionListener
+{
+
+ /**
+ * A custom caret for demonstration purposes. This class is inspired by the
+ * CornerCaret from the OReilly Swing book.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ static class CornerCaret extends DefaultCaret
+ {
+ public CornerCaret()
+ {
+ super();
+ setBlinkRate(500);
+ }
+
+ protected synchronized void damage(Rectangle r)
+ {
+ if (r == null) return;
+ x = r.x;
+ y = r.y + (r.height * 4 / 5 - 3);
+ width = 5;
+ height = 5;
+ repaint();
+ }
+
+ public void paint(Graphics g)
+ {
+ JTextComponent comp = getComponent();
+ if (comp == null) return;
+ int dot = getDot();
+ Rectangle r = null;
+ try
+ {
+ r = comp.modelToView(dot);
+ }
+ catch (BadLocationException e)
+ {
+ return;
+ }
+ if (r == null) return;
+ int dist = r.height * 4 / 5 - 3;
+ if ((x != r.x) || (y != r.y + dist))
+ {
+ repaint();
+ x = r.x;
+ y = r.y + dist;
+ width = 5;
+ height = 5;
+ }
+ if (isVisible())
+ {
+ g.drawLine(r.x, r.y + dist, r.x, r.y + dist + 4);
+ g.drawLine(r.x, r.y + dist + 4, r.x + 4, r.y + dist + 4);
+ }
+ }
+ }
+
+ /**
+ * The left aligned textfields and state buttons.
+ */
+ JTextField textfield1;
+ JTextField textfield2;
+ JTextField textfield3;
+ JCheckBox enabled1;
+ JCheckBox editable1;
+JPanel textFieldPanel1;
+ /**
+ * The right aligned textfields and state buttons.
+ */
+ JTextField textfield4;
+ JTextField textfield5;
+ JTextField textfield6;
+ JCheckBox enabled2;
+ JCheckBox editable2;
+
+ /**
+ * The centered textfields and state buttons.
+ */
+ JTextField textfield7;
+ JTextField textfield8;
+ JTextField textfield9;
+ JCheckBox enabled3;
+ JCheckBox editable3;
+
+ /**
+ * The custom colored textfields and state buttons.
+ */
+ JTextField textfield10;
+ JTextField textfield11;
+ JTextField textfield12;
+ JTextField textfield13;
+ JTextField textfield14;
+ JCheckBox enabled4;
+ JCheckBox editable4;
+
+ /**
+ * Some miscallenous textfield demos.
+ */
+ JTextField textfield15;
+ JTextField textfield16;
+ JCheckBox enabled5;
+ JCheckBox editable5;
+
+ /**
+ * Creates a new demo instance.
+ *
+ * @param title the frame title.
+ */
+ public TextFieldDemo(String title)
+ {
+ super(title);
+ JPanel content = createContent();
+ JPanel closePanel = new JPanel();
+ JButton closeButton = new JButton("Close");
+ closeButton.setActionCommand("CLOSE");
+ closeButton.addActionListener(this);
+ closePanel.add(closeButton);
+ content.add(closePanel, BorderLayout.SOUTH);
+ getContentPane().add(content);
+ }
+
+ /**
+ * Returns a panel with the demo content. The panel
+ * uses a BorderLayout(), and the BorderLayout.SOUTH area
+ * is empty, to allow callers to add controls to the
+ * bottom of the panel if they want to (a close button is
+ * added if this demo is being run as a standalone demo).
+ */
+ JPanel createContent()
+ {
+ JPanel content = new JPanel(new BorderLayout());
+ JPanel panel = new JPanel(new GridLayout(5, 1));
+ panel.add(createLeftAlignedPanel());
+ panel.add(createRightAlignedPanel());
+ panel.add(createCenteredPanel());
+ panel.add(createCustomColoredPanel());
+ panel.add(createMiscPanel());
+ content.add(panel);
+ //content.setPreferredSize(new Dimension(400, 300));
+ return content;
+ }
+
+ private JPanel createLeftAlignedPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Left aligned"));
+
+ textFieldPanel1 = new JPanel();
+ textFieldPanel1.setLayout(new BoxLayout(textFieldPanel1, BoxLayout.X_AXIS));
+
+ textfield1 = new JTextField("Hello World!");
+ textfield1.setHorizontalAlignment(JTextField.LEFT);
+ textfield1.setFont(new Font("Dialog", Font.PLAIN, 8));
+ textFieldPanel1.add(textfield1);
+
+ textfield2 = new JTextField("Hello World!");
+ textfield2.setHorizontalAlignment(JTextField.LEFT);
+ textfield2.setFont(new Font("Dialog", Font.ITALIC, 12));
+ textFieldPanel1.add(textfield2);
+
+ textfield3 = new JTextField("Hello World!");
+ textfield3.setHorizontalAlignment(JTextField.LEFT);
+ textfield3.setFont(new Font("Dialog", Font.BOLD, 14));
+ textFieldPanel1.add(textfield3);
+
+ panel.add(textFieldPanel1);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled1 = new JCheckBox("enabled");
+ enabled1.setSelected(true);
+ enabled1.addActionListener(this);
+ enabled1.setActionCommand("ENABLED1");
+ statePanel.add(enabled1);
+ editable1 = new JCheckBox("editable");
+ editable1.setSelected(true);
+ editable1.addActionListener(this);
+ editable1.setActionCommand("EDITABLE1");
+ statePanel.add(editable1);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createRightAlignedPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Right aligned"));
+
+ JPanel textFieldPanel = new JPanel();
+ textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.X_AXIS));
+
+ textfield4 = new JTextField("Hello World!");
+ textfield4.setHorizontalAlignment(JTextField.RIGHT);
+ textfield4.setFont(new Font("Dialog", Font.PLAIN, 8));
+ textFieldPanel.add(textfield4);
+
+ textfield5 = new JTextField("Hello World!");
+ textfield5.setHorizontalAlignment(JTextField.RIGHT);
+ textfield5.setFont(new Font("Dialog", Font.ITALIC, 12));
+ textFieldPanel.add(textfield5);
+
+ textfield6 = new JTextField("Hello World!");
+ textfield6.setHorizontalAlignment(JTextField.RIGHT);
+ textfield6.setFont(new Font("Dialog", Font.BOLD, 14));
+ textFieldPanel.add(textfield6);
+
+ panel.add(textFieldPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled2 = new JCheckBox("enabled");
+ enabled2.setSelected(true);
+ enabled2.addActionListener(this);
+ enabled2.setActionCommand("ENABLED2");
+ statePanel.add(enabled2);
+ editable2 = new JCheckBox("editable");
+ editable2.setSelected(true);
+ editable2.addActionListener(this);
+ editable2.setActionCommand("EDITABLE2");
+ statePanel.add(editable2);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createCenteredPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Centered"));
+
+ JPanel textFieldPanel = new JPanel();
+ textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.X_AXIS));
+
+ textfield7 = new JTextField("Hello World!");
+ textfield7.setHorizontalAlignment(JTextField.CENTER);
+ textfield7.setFont(new Font("Dialog", Font.PLAIN, 8));
+ textFieldPanel.add(textfield7);
+
+ textfield8 = new JTextField("Hello World!");
+ textfield8.setHorizontalAlignment(JTextField.CENTER);
+ textfield8.setFont(new Font("Dialog", Font.ITALIC, 12));
+ textFieldPanel.add(textfield8);
+
+ textfield9 = new JTextField("Hello World!");
+ textfield9.setHorizontalAlignment(JTextField.CENTER);
+ textfield9.setFont(new Font("Dialog", Font.BOLD, 14));
+ textFieldPanel.add(textfield9);
+
+ panel.add(textFieldPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled3 = new JCheckBox("enabled");
+ enabled3.setSelected(true);
+ enabled3.addActionListener(this);
+ enabled3.setActionCommand("ENABLED3");
+ statePanel.add(enabled3);
+ editable3 = new JCheckBox("editable");
+ editable3.setSelected(true);
+ editable3.addActionListener(this);
+ editable3.setActionCommand("EDITABLE3");
+ statePanel.add(editable3);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createCustomColoredPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+
+ JPanel textFieldPanel = new JPanel();
+ panel.setBorder(BorderFactory.createTitledBorder("Custom colors"));
+ textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.X_AXIS));
+
+ textfield10 = new JTextField("custom foreground");
+ textfield10.setForeground(Color.GREEN);
+ textFieldPanel.add(textfield10);
+
+ textfield11 = new JTextField("custom background");
+ textfield11.setForeground(Color.YELLOW);
+ textFieldPanel.add(textfield11);
+
+ textfield12 = new JTextField("custom disabled textcolor");
+ textfield12.setDisabledTextColor(Color.BLUE);
+ textFieldPanel.add(textfield12);
+
+ textfield13 = new JTextField("custom selected text color");
+ textfield13.setSelectedTextColor(Color.RED);
+ textFieldPanel.add(textfield13);
+
+ textfield14 = new JTextField("custom selection color");
+ textfield14.setSelectionColor(Color.CYAN);
+ textFieldPanel.add(textfield14);
+
+ panel.add(textFieldPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled4 = new JCheckBox("enabled");
+ enabled4.setSelected(true);
+ enabled4.addActionListener(this);
+ enabled4.setActionCommand("ENABLED4");
+ statePanel.add(enabled4);
+ editable4 = new JCheckBox("editable");
+ editable4.setSelected(true);
+ editable4.addActionListener(this);
+ editable4.setActionCommand("EDITABLE4");
+ statePanel.add(editable4);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ private JPanel createMiscPanel()
+ {
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setBorder(BorderFactory.createTitledBorder("Miscallenous"));
+
+ JPanel textFieldPanel = new JPanel();
+ textFieldPanel.setLayout(new BoxLayout(textFieldPanel, BoxLayout.X_AXIS));
+
+ textfield15 = new JTextField("Custom Caret");
+ textfield15.setCaret(new CornerCaret());
+ textFieldPanel.add(textfield15);
+
+ textfield16 = new JTextField("Custom Caret color");
+ textfield16.setCaretColor(Color.MAGENTA);
+ textFieldPanel.add(textfield16);
+
+ panel.add(textFieldPanel);
+
+ JPanel statePanel = new JPanel();
+ statePanel.setLayout(new BoxLayout(statePanel, BoxLayout.Y_AXIS));
+ statePanel.add(Box.createVerticalGlue());
+ enabled5 = new JCheckBox("enabled");
+ enabled5.setSelected(true);
+ enabled5.addActionListener(this);
+ enabled5.setActionCommand("ENABLED5");
+ statePanel.add(enabled5);
+ editable5 = new JCheckBox("editable");
+ editable5.setSelected(true);
+ editable5.addActionListener(this);
+ editable5.setActionCommand("EDITABLE5");
+ statePanel.add(editable5);
+ statePanel.add(Box.createVerticalGlue());
+ panel.add(statePanel, BorderLayout.EAST);
+
+ return panel;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ if (e.getActionCommand().equals("CLOSE"))
+ {
+ System.exit(0);
+ }
+ else if (e.getActionCommand().equals("ENABLED1"))
+ {
+ boolean enabled = enabled1.isSelected();
+ textfield1.setEnabled(enabled);
+ textfield2.setEnabled(enabled);
+ textfield3.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE1"))
+ {
+ boolean editable = editable1.isSelected();
+ textfield1.setEditable(editable);
+ textfield2.setEditable(editable);
+ textfield3.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED2"))
+ {
+ boolean enabled = enabled2.isSelected();
+ textfield4.setEnabled(enabled);
+ textfield5.setEnabled(enabled);
+ textfield6.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE2"))
+ {
+ boolean editable = editable2.isSelected();
+ textfield4.setEditable(editable);
+ textfield5.setEditable(editable);
+ textfield6.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED3"))
+ {
+ boolean enabled = enabled3.isSelected();
+ textfield7.setEnabled(enabled);
+ textfield8.setEnabled(enabled);
+ textfield9.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE3"))
+ {
+ boolean editable = editable3.isSelected();
+ textfield7.setEditable(editable);
+ textfield8.setEditable(editable);
+ textfield9.setEditable(editable);
+ }
+ else if (e.getActionCommand().equals("ENABLED4"))
+ {
+ boolean enabled = enabled4.isSelected();
+ textfield10.setEnabled(enabled);
+ textfield11.setEnabled(enabled);
+ textfield12.setEnabled(enabled);
+ textfield13.setEnabled(enabled);
+ textfield14.setEnabled(enabled);
+ }
+ else if (e.getActionCommand().equals("EDITABLE4"))
+ {
+ boolean editable = editable4.isSelected();
+ textfield10.setEditable(editable);
+ textfield11.setEditable(editable);
+ textfield12.setEditable(editable);
+ textfield13.setEditable(editable);
+ textfield14.setEditable(editable);
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ TextFieldDemo app = new TextFieldDemo("TextField Demo");
+ app.pack();
+ app.setVisible(true);
+ }
+
+}
diff --git a/libjava/classpath/external/Makefile.in b/libjava/classpath/external/Makefile.in
index 45d7baf1421..f0d2a3b0d48 100644
--- a/libjava/classpath/external/Makefile.in
+++ b/libjava/classpath/external/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = external
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -84,10 +82,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -224,6 +226,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -237,6 +240,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/external/sax/Makefile.in b/libjava/classpath/external/sax/Makefile.in
index 22f59a5b608..15c949d2253 100644
--- a/libjava/classpath/external/sax/Makefile.in
+++ b/libjava/classpath/external/sax/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = external/sax
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -75,10 +73,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -215,6 +217,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -228,6 +231,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/external/w3c_dom/Makefile.in b/libjava/classpath/external/w3c_dom/Makefile.in
index 30b1a1d4658..6305a265c5d 100644
--- a/libjava/classpath/external/w3c_dom/Makefile.in
+++ b/libjava/classpath/external/w3c_dom/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = external/w3c_dom
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -75,10 +73,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -215,6 +217,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -228,6 +231,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrInput.java b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java
index 69f9c8c5837..866ec2cc945 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrInput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java
@@ -1,4 +1,4 @@
-/* cdrInput.java --
+/* AbstractCdrInput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,16 +39,17 @@ exception statement from your version. */
package gnu.CORBA.CDR;
import gnu.CORBA.BigDecimalHelper;
-import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.GIOP.CharSets_OSF;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import gnu.CORBA.IOR;
-import gnu.CORBA.IOR_Delegate;
+import gnu.CORBA.IorDelegate;
+import gnu.CORBA.Minor;
import gnu.CORBA.TypeCodeHelper;
import gnu.CORBA.Unexpected;
import gnu.CORBA.Version;
import gnu.CORBA.gnuAny;
-import gnu.CORBA.stubFinder;
+import gnu.CORBA.StubLocator;
import org.omg.CORBA.Any;
import org.omg.CORBA.AnySeqHolder;
@@ -81,38 +82,44 @@ import java.io.Serializable;
import java.math.BigDecimal;
/**
- * A simple CORBA CDR (common data representation)
- * input stream, reading data from the
- * given {@link java.io.InputStream}. The primitive types
- * are aligned on they natural boundaries by implementing the
- * abstract method {@link #align(int boundary)}.
- *
- * The same class also implements {@link org.omg.CORBA.DataInputStream} to
- * read the object content in a user defined way.
- *
+ * A simple CORBA CDR (common data representation) input stream, reading data
+ * from the given {@link java.io.InputStream}. The primitive types are aligned
+ * on they natural boundaries by implementing the abstract method
+ * {@link #align(int boundary)}.
+ *
+ * The same class also implements {@link org.omg.CORBA.DataInputStream} to read
+ * the object content in a user defined way.
+ *
+ * TODO This class uses 16 bits per Unicode character only, as it was until jdk
+ * 1.4 inclusive.
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public abstract class cdrInput
+public abstract class AbstractCdrInput
extends org.omg.CORBA_2_3.portable.InputStream
implements org.omg.CORBA.DataInputStream
{
/**
- * The message, explaining that the exception has been thrown due
- * unexpected end of the input stream. This usually happens the
- * server and client disagree on communication or data representation
- * rules.
+ * The runtime, associated with this stream. This field is only used when
+ * reading and writing value types and filled-in in gnu.CORBA.CDR.Vio.
+ */
+ public transient gnuRuntime runtime;
+
+ /**
+ * The message, explaining that the exception has been thrown due unexpected
+ * end of the input stream. This usually happens the server and client
+ * disagree on communication or data representation rules.
*/
protected static final String UNEXP_EOF = "Unexpected end of stream";
/**
- * This instance is used to convert primitive data types into the
- * byte sequences.
+ * This instance is used to convert primitive data types into the byte
+ * sequences.
*/
- protected abstractDataInputStream b;
+ protected AbstractDataInput b;
/**
- * The input stream, from where the data are actually
- * being read.
+ * The input stream, from where the data are actually being read.
*/
protected java.io.InputStream actual_stream;
@@ -129,71 +136,68 @@ public abstract class cdrInput
/**
* The code set information.
*/
- protected cxCodeSet codeset = cxCodeSet.STANDARD;
+ protected CodeSetServiceContext codeset = CodeSetServiceContext.STANDARD;
/**
- * The name of the currently used narrow charset, null if
- * the native narrow charset is used.
+ * The name of the currently used narrow charset, null if the native narrow
+ * charset is used.
*/
private String narrow_charset = null;
/**
- * The name of the currently used wide charset, null if
- * the native wide charset is used.
+ * The name of the currently used wide charset, null if the native wide
+ * charset is used.
*/
private String wide_charset = null;
/**
- * True if the native code set is used for narrow characters.
- * If the set is native, no the intermediate Reader object
- * is instantiated when writing characters.
+ * True if the native code set is used for narrow characters. If the set is
+ * native, no the intermediate Reader object is instantiated when writing
+ * characters.
*/
private boolean narrow_native;
/**
- * True if the native code set is used for wide characters.
- * If the set is native, no the intermediate Reader object
- * is instantiated when writing characters.
+ * True if the native code set is used for wide characters. If the set is
+ * native, no the intermediate Reader object is instantiated when writing
+ * characters.
*/
private boolean wide_native;
/**
- * If true, the stream expect
- * the multi-byte data in the form "less significant byte
- * first" (Little Endian). This is the opposite to the
- * java standard (Big Endian).
+ * If true, the stream expect the multi-byte data in the form "less
+ * significant byte first" (Little Endian). This is the opposite to the java
+ * standard (Big Endian).
*/
private boolean little_endian;
/**
- * Creates the stream. The stream reads Big Endian by
- * default.
- *
+ * Creates the stream. The stream reads Big Endian by default.
+ *
* @param readFrom a stream to read CORBA input from.
*/
- public cdrInput(java.io.InputStream readFrom)
+ public AbstractCdrInput(java.io.InputStream readFrom)
{
setInputStream(readFrom);
- setCodeSet(cxCodeSet.STANDARD);
+ setCodeSet(CodeSetServiceContext.STANDARD);
}
/**
- * Creates the stream, requiring the subsequent call
- * of {@link #setInputStream(java.io.InputStream)}.
+ * Creates the stream, requiring the subsequent call of
+ * {@link #setInputStream(java.io.InputStream)}.
*/
- public cdrInput()
+ public AbstractCdrInput()
{
- setCodeSet(cxCodeSet.STANDARD);
+ setCodeSet(CodeSetServiceContext.STANDARD);
}
/**
- * Set the Big Endian or Little Endian encoding.
- * The stream reads Big Endian by default.
- *
- * @param use_little_endian if true, the stream expect
- * the multi-byte data in the form "less significant byte
- * first" (Little Endian). This is the opposite to the
- * java standard (Big Endian).
+ * Set the Big Endian or Little Endian encoding. The stream reads Big Endian
+ * by default.
+ *
+ * @param use_little_endian if true, the stream expect the multi-byte data in
+ * the form "less significant byte first" (Little Endian). This is the
+ * opposite to the java standard (Big Endian).
*/
public void setBigEndian(boolean use_big_endian)
{
@@ -202,8 +206,29 @@ public abstract class cdrInput
}
/**
+ * Get the used encoding.
+ *
+ * @param true for Big Endian, false for Little Endian.
+ */
+ public boolean isBigEndian()
+ {
+ return !little_endian;
+ }
+
+ /**
+ * Clone all important settings to another stream.
+ */
+ public void cloneSettings(AbstractCdrInput stream)
+ {
+ stream.setBigEndian(isBigEndian());
+ stream.setCodeSet(getCodeSet());
+ stream.setVersion(giop);
+ stream.setOrb(orb);
+ }
+
+ /**
* Set the input stream that receives the CORBA input.
- *
+ *
* @param readFrom the stream.
*/
public void setInputStream(java.io.InputStream readFrom)
@@ -217,13 +242,14 @@ public abstract class cdrInput
}
/**
- * Set the alignment offset, if the index of the first byte in the
- * stream is different from 0.
+ * Set the alignment offset, if the index of the first byte in the stream is
+ * different from 0.
*/
public abstract void setOffset(int offset);
/**
* Set the orb, associated with this stream.
+ *
* @param an_orb
*/
public void setOrb(ORB an_orb)
@@ -232,8 +258,8 @@ public abstract class cdrInput
}
/**
- * Set the GIOP version. Some data types are written differently
- * for the different versions. The default version is 1.0 .
+ * Set the GIOP version. Some data types are written differently for the
+ * different versions. The default version is 1.0 .
*/
public void setVersion(Version giop_version)
{
@@ -246,8 +272,8 @@ public abstract class cdrInput
public abstract void align(int boundary);
/**
- * Reads the CORBA unsigned long (java int), returning the
- * value in the sufficiently large java long.
+ * Reads the CORBA unsigned long (java int), returning the value in the
+ * sufficiently large java long.
*/
public long gnu_read_ulong()
{
@@ -260,6 +286,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -270,8 +297,8 @@ public abstract class cdrInput
}
/**
- * Read the unsigned short integer value and return it as java
- * int, sufficiently large to hold all values.
+ * Read the unsigned short integer value and return it as java int,
+ * sufficiently large to hold all values.
*/
public int gnu_read_ushort()
{
@@ -283,6 +310,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -295,6 +323,7 @@ public abstract class cdrInput
/**
* Return the associated {@link ORB}.
+ *
* @return the associated {@link ORB} or null is no such is set.
*/
public ORB orb()
@@ -306,7 +335,7 @@ public abstract class cdrInput
* Read a single byte directly from the buffer.
*/
public int read()
- throws java.io.IOException
+ throws java.io.IOException
{
try
{
@@ -315,6 +344,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -324,7 +354,7 @@ public abstract class cdrInput
* Read bytes directly from the buffer.
*/
public int read(byte[] x, int ofs, int len)
- throws java.io.IOException
+ throws java.io.IOException
{
try
{
@@ -333,6 +363,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -342,7 +373,7 @@ public abstract class cdrInput
* Read bytes directly from the buffer.
*/
public int read(byte[] x)
- throws java.io.IOException
+ throws java.io.IOException
{
try
{
@@ -351,24 +382,25 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
}
/**
- * Read the CORBA object. The object to read is represented in the
- * form of the plain (not a string-encoded) IOR profile without the
- * heading endian indicator. The responsible method for reading such
- * data is {@link IOR.read_no_endian}.
- *
- * The returned object is usually casted into the given type using
- * the .narrow method of its helper, despite in some cases the direct
- * cast would also work.
- *
- * The null objects are recognised from the empty profile set.
- * For such objects, null is returned.
- *
+ * Read the CORBA object. The object to read is represented in the form of the
+ * plain (not a string-encoded) IOR profile without the heading endian
+ * indicator. The responsible method for reading such data is
+ * {@link IOR.read_no_endian}.
+ *
+ * The returned object is usually casted into the given type using the .narrow
+ * method of its helper, despite in some cases the direct cast would also
+ * work.
+ *
+ * The null objects are recognised from the empty profile set. For such
+ * objects, null is returned.
+ *
* @return the loaded and constructed object.
*/
public org.omg.CORBA.Object read_Object()
@@ -384,41 +416,42 @@ public abstract class cdrInput
// Check maybe this is a remote reference to the local object.
// This is only possible if we access the repository of the
// connected object.
- if (orb instanceof Functional_ORB)
+ if (orb instanceof OrbFunctional)
{
- Functional_ORB forb = (Functional_ORB) orb;
+ OrbFunctional forb = (OrbFunctional) orb;
org.omg.CORBA.Object local = forb.find_local_object(ior);
if (local != null)
return local;
}
// Search for the available stubs.
- ObjectImpl impl = stubFinder.search(orb, ior);
+ ObjectImpl impl = StubLocator.search(orb, ior);
try
{
if (impl._get_delegate() == null)
- impl._set_delegate(new IOR_Delegate(orb, ior));
+ impl._set_delegate(new IorDelegate(orb, ior));
}
catch (BAD_OPERATION ex)
{
// Some colaborants may throw this exception
// in response to the attempt to get the unset delegate.
- impl._set_delegate(new IOR_Delegate(orb, ior));
+ impl._set_delegate(new IorDelegate(orb, ior));
}
return impl;
}
catch (IOException ex)
{
- BAD_OPERATION bad = new BAD_OPERATION();
+ MARSHAL bad = new MARSHAL();
+ bad.minor = Minor.IOR;
bad.initCause(ex);
throw bad;
}
}
/**
- * Read the type code. The type code format is defined in the
- * CORBA documenation.
+ * Read the type code. The type code format is defined in the CORBA
+ * documenation.
*/
public TypeCode read_TypeCode()
{
@@ -438,9 +471,8 @@ public abstract class cdrInput
}
/**
- * Read the CORBA {@link Any}. This method first reads the
- * type code, then delegates the functionality
- * to {@link Any#read_value}.
+ * Read the CORBA {@link Any}. This method first reads the type code, then
+ * delegates the functionality to {@link Any#read_value}.
*/
public Any read_any()
{
@@ -451,8 +483,7 @@ public abstract class cdrInput
}
/**
- * Read the boolean, treating any non zero byte as true,
- * zero byte as false.
+ * Read the boolean, treating any non zero byte as true, zero byte as false.
*/
public boolean read_boolean()
{
@@ -463,6 +494,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -481,12 +513,13 @@ public abstract class cdrInput
{
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.read() == 0 ? false : true;
+ x[i] = b.read() == 0 ? false : true;
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -498,8 +531,8 @@ public abstract class cdrInput
}
/**
- * Read a character using narrow charset encoding. Depending form
- * which encoding is set, this still can be Unicode or ever wider.
+ * Read a character using narrow charset encoding. Depending form which
+ * encoding is set, this still can be Unicode or ever wider.
*/
public char read_char()
{
@@ -513,6 +546,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -533,18 +567,19 @@ public abstract class cdrInput
if (narrow_native)
{
for (int i = offset; i < offset + length; i++)
- x [ i ] = (char) b.read();
+ x[i] = (char) b.read();
}
else
{
- InputStreamReader reader =
- new InputStreamReader((InputStream) b, narrow_charset);
+ InputStreamReader reader = new InputStreamReader((InputStream) b,
+ narrow_charset);
reader.read(x, offset, length);
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -568,6 +603,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -588,12 +624,13 @@ public abstract class cdrInput
align(8);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readDouble();
+ x[i] = b.readDouble();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -605,26 +642,24 @@ public abstract class cdrInput
}
/**
- * Read the encapsulated stream.
- * If the encapsulated sequence appears to be in the
- * Little endian format, the flag of the returned stream
- * is set to read Little endian.
+ * Read the encapsulated stream. If the encapsulated sequence appears to be in
+ * the Little endian format, the flag of the returned stream is set to read
+ * Little endian.
*/
- public cdrBufInput read_encapsulation()
+ public BufferredCdrInput read_encapsulation()
{
try
{
int l = read_long();
- byte[] r = new byte[ l ];
+ byte[] r = new byte[l];
int n = 0;
- reading:
- while (n < r.length)
+ reading: while (n < r.length)
{
n += read(r, n, r.length - n);
}
- cdrBufInput capsule = new cdrBufInput(r);
+ BufferredCdrInput capsule = new BufferredCdrInput(r);
capsule.setOrb(orb);
int endian = capsule.read_octet();
@@ -639,6 +674,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -650,9 +686,8 @@ public abstract class cdrInput
}
/**
- * Read the CORBA fixed (the end of the <code>fixed</code>
- * can be determined by its last byte). The scale is always
- * assumed to be zero.
+ * Read the CORBA fixed (the end of the <code>fixed</code> can be determined
+ * by its last byte). The scale is always assumed to be zero.
*/
public BigDecimal read_fixed()
{
@@ -663,6 +698,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -686,6 +722,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -706,12 +743,13 @@ public abstract class cdrInput
align(4);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readFloat();
+ x[i] = b.readFloat();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -735,6 +773,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -755,12 +794,13 @@ public abstract class cdrInput
align(4);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readInt();
+ x[i] = b.readInt();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -783,7 +823,9 @@ public abstract class cdrInput
}
catch (EOFException ex)
{
- throw new MARSHAL(UNEXP_EOF);
+ MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
+ throw t;
}
catch (IOException ex)
@@ -802,12 +844,13 @@ public abstract class cdrInput
align(8);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readLong();
+ x[i] = b.readLong();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -830,6 +873,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -852,6 +896,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -863,24 +908,24 @@ public abstract class cdrInput
}
/**
- * Read the length of the byte array as CORBA long and then
- * the array itseld.
+ * Read the length of the byte array as CORBA long and then the array itseld.
*/
public byte[] read_sequence()
{
try
{
int l = read_long();
- byte[] b = new byte[ l ];
+ byte[] buf = new byte[l];
if (l > 0)
{
- read(b);
+ b.readFully(buf);
}
- return b;
+ return buf;
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -904,6 +949,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -924,12 +970,13 @@ public abstract class cdrInput
align(2);
for (int i = offs; i < offs + len; i++)
{
- x [ i ] = b.readShort();
+ x[i] = b.readShort();
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -941,21 +988,21 @@ public abstract class cdrInput
}
/**
- * Read a singe byte string. The method firs reads the
- * byte array and then calls a constructor to create a
- * string from this array. The character encoding, if
- * previously set, is taken into consideration.
- *
+ * Read a singe byte string. The method firs reads the byte array and then
+ * calls a constructor to create a string from this array. The character
+ * encoding, if previously set, is taken into consideration.
+ *
* @return a loaded string.
*/
public String read_string()
{
+ int n = 0;
try
{
align(4);
- int n = b.readInt();
- byte[] s = new byte[ n ];
+ n = b.readInt();
+ byte[] s = new byte[n];
b.read(s);
// Discard the null terminator.
@@ -967,19 +1014,26 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
-
catch (IOException ex)
{
throw new Unexpected();
}
+ catch (NegativeArraySizeException nex)
+ {
+ MARSHAL m = new MARSHAL("Input stream broken, got " + n + "(0x"
+ + Integer.toHexString(n) + ") as a string size");
+ m.minor = Minor.Negative;
+ throw m;
+ }
}
/**
- * Reads the CORBA unsigned long (java int), delegating
- * functionality to {@link #read_long}.
+ * Reads the CORBA unsigned long (java int), delegating functionality to
+ * {@link #read_long}.
*/
public int read_ulong()
{
@@ -987,9 +1041,8 @@ public abstract class cdrInput
}
/**
- * Reads the array of CORBA unsigned long (java integer) values,
- * delegating functionality to
- * {@link #real_long_array}.
+ * Reads the array of CORBA unsigned long (java integer) values, delegating
+ * functionality to {@link #real_long_array}.
*/
public void read_ulong_array(int[] x, int offs, int len)
{
@@ -997,11 +1050,9 @@ public abstract class cdrInput
}
/**
- * Read the CORBA unsigned long long value,
- * delegating functionality to {@link #read_longlong}.
- * There is no way to return values over the limit of
- * the java signed long in other way than returning
- * the negative value.
+ * Read the CORBA unsigned long long value, delegating functionality to
+ * {@link #read_longlong}. There is no way to return values over the limit of
+ * the java signed long in other way than returning the negative value.
*/
public long read_ulonglong()
{
@@ -1009,9 +1060,8 @@ public abstract class cdrInput
}
/**
- * Reads the array of CORBA long long (java long) values,
- * delegating functionality to
- * {@link #real_longlong_array}.
+ * Reads the array of CORBA long long (java long) values, delegating
+ * functionality to {@link #real_longlong_array}.
*/
public void read_ulonglong_array(long[] x, int offs, int len)
{
@@ -1019,10 +1069,9 @@ public abstract class cdrInput
}
/**
- * Read the unsigned short integer value. Due strange specification,
- * the returned value must be the short type as well, so the
- * the best solution seems just to delegete functionality to
- * read_short.
+ * Read the unsigned short integer value. Due strange specification, the
+ * returned value must be the short type as well, so the the best solution
+ * seems just to delegete functionality to read_short.
*/
public short read_ushort()
{
@@ -1030,8 +1079,8 @@ public abstract class cdrInput
}
/**
- * Read an array of unsigned short values, delegating the
- * functionality to {@link read_short_array}.
+ * Read an array of unsigned short values, delegating the functionality to
+ * {@link read_short_array}.
*/
public void read_ushort_array(short[] x, int offs, int len)
{
@@ -1039,24 +1088,64 @@ public abstract class cdrInput
}
/**
- * Reads the wide character using the encoding, specified in the
- * wide_charset.
+ * Reads the wide character using the encoding, specified in the wide_charset.
*/
public char read_wchar()
{
try
{
if (giop.until_inclusive(1, 1))
- align(2);
+ {
+ align(2);
- if (wide_native)
- return (char) b.readShort();
+ if (wide_native)
+ return (char) b.readShort();
+ else
+ return (char) new InputStreamReader((InputStream) b, wide_charset).read();
+ }
else
- return (char) new InputStreamReader((InputStream) b, wide_charset).read();
+ {
+ int l = b.read();
+ if (l == 2 && wide_native)
+ return b.readChar();
+ else if (l <= 0)
+ {
+ MARSHAL m = new MARSHAL("wchar size " + l);
+ m.minor = Minor.Negative;
+ throw m;
+ }
+ else
+ {
+ byte[] bytes = new byte[l];
+ b.readFully(bytes);
+ String cs;
+
+ if (bytes.length > 2 && bytes[0] == 0xFE && bytes[1] == 0xFF)
+ cs = new String(bytes, 2, bytes.length - 2, wide_charset);
+ else if (bytes.length > 2 && bytes[0] == 0xFF
+ && bytes[1] == 0xFE)
+ {
+ // Litle endian detected - swap bytes.
+ byte t;
+ for (int i = 3; i < bytes.length; i = i + 2)
+ {
+ t = bytes[i];
+ bytes[i - 1] = bytes[i];
+ bytes[i] = t;
+ }
+ cs = new String(bytes, 2, bytes.length - 2, wide_charset);
+ }
+ else
+ cs = new String(bytes, wide_charset);
+
+ return cs.charAt(0);
+ }
+ }
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -1067,8 +1156,8 @@ public abstract class cdrInput
}
/**
- * Read an array of "wide chars", each representing a two byte
- * Unicode character, high byte first.
+ * Read an array of "wide chars", each representing a two byte Unicode
+ * character, high byte first.
*/
public void read_wchar_array(char[] x, int offset, int length)
{
@@ -1080,18 +1169,19 @@ public abstract class cdrInput
if (wide_native)
{
for (int i = offset; i < offset + length; i++)
- x [ i ] = (char) b.readShort();
+ x[i] = (char) b.readShort();
}
else
{
- InputStreamReader reader =
- new InputStreamReader((InputStream) b, wide_charset);
+ InputStreamReader reader = new InputStreamReader((InputStream) b,
+ wide_charset);
reader.read(x, offset, length);
}
}
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -1103,13 +1193,11 @@ public abstract class cdrInput
}
/**
- * Reads the string in wide character format
- * (ussually UTF-16, Unicode). Takes the currently set charset
- * into consideration.
- *
- * If the native (UTF-16) encoding is used
- * of the GIOP protocol is before 1.2, delegates functionality
- * to "plain" {@link #read_wstring_UTF_16}.
+ * Reads the string in wide character format (ussually UTF-16, Unicode). Takes
+ * the currently set charset into consideration.
+ *
+ * If the native (UTF-16) encoding is used of the GIOP protocol is before 1.2,
+ * delegates functionality to "plain" {@link #read_wstring_UTF_16}.
*/
public String read_wstring()
{
@@ -1121,7 +1209,7 @@ public abstract class cdrInput
align(4);
int n = b.readInt();
- byte[] s = new byte[ n ];
+ byte[] s = new byte[n];
b.read(s);
return new String(s, 0, n, wide_charset);
@@ -1129,6 +1217,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -1140,9 +1229,9 @@ public abstract class cdrInput
}
/**
- * Reads first length of the string and the all characters as an
- * Unicode (UTF-16) characters. Mind that GIOP 1.1 has the extra
- * null character at the end that must be discarded.
+ * Reads first length of the string and the all characters as an Unicode
+ * (UTF-16) characters. Mind that GIOP 1.1 has the extra null character at the
+ * end that must be discarded.
*/
public String read_wstring_UTF_16()
{
@@ -1150,6 +1239,13 @@ public abstract class cdrInput
{
int p = 0;
int n = read_long();
+
+ if (n<0)
+ {
+ MARSHAL m = new MARSHAL("Negative string size");
+ m.minor = Minor.Negative;
+ throw m;
+ }
// The null terminator that is no longer present since 1.2 .
int nt = giop.since_inclusive(1, 2) ? 0 : 1;
@@ -1157,26 +1253,30 @@ public abstract class cdrInput
// Convert bytes to shorts.
n = n / 2;
- char[] s = new char[ n ];
+ // Empty string.
+ if (n == 0)
+ return "";
+
+ char[] s = new char[n];
for (int i = 0; i < s.length; i++)
- s [ i ] = (char) b.readShort();
+ s[i] = (char) b.readShort();
// Check for the byte order marker here.
- if (s [ 0 ] == 0xFEFF)
+ if (s[0] == 0xFEFF)
{
// Big endian encoding - do nothing, but move the pointer
// one position forward.
p = 1;
}
- else if (s [ 0 ] == 0xFFFE)
+ else if (s[0] == 0xFFFE)
{
// Little endian encoding, swap the bytes and move one
// position forward.
p = 1;
for (int i = p; i < s.length; i++)
- s [ i ] = swap(s [ i ]);
+ s[i] = swap(s[i]);
}
// Discard the null terminator and, if needed, the endian marker.
@@ -1186,6 +1286,7 @@ public abstract class cdrInput
catch (EOFException ex)
{
MARSHAL t = new MARSHAL(UNEXP_EOF);
+ t.minor = Minor.EOF;
t.initCause(ex);
throw t;
}
@@ -1213,7 +1314,7 @@ public abstract class cdrInput
/**
* Set the current code set context.
*/
- public void setCodeSet(cxCodeSet a_codeset)
+ public void setCodeSet(CodeSetServiceContext a_codeset)
{
this.codeset = a_codeset;
narrow_charset = CharSets_OSF.getName(codeset.char_data);
@@ -1226,7 +1327,7 @@ public abstract class cdrInput
/**
* Get the current code set context.
*/
- public cxCodeSet getCodeSet()
+ public CodeSetServiceContext getCodeSet()
{
return codeset;
}
@@ -1235,9 +1336,9 @@ public abstract class cdrInput
* Read the object that is an instance of the given class. The current
* implementation delegates functionality to the parameterless
* {@link readObject()}.
- *
+ *
* @param klass a class of that this object the instance is.
- *
+ *
* @return the returned object.
*/
public org.omg.CORBA.Object read_Object(Class klass)
@@ -1247,11 +1348,11 @@ public abstract class cdrInput
/**
* Read a value type structure from the stream.
- *
- * OMG specification states the writing format is outside the scope
- * of GIOP definition. This implementation uses java serialization
- * mechanism, calling {@link ObjectInputStream#readObject}
- *
+ *
+ * OMG specification states the writing format is outside the scope of GIOP
+ * definition. This implementation uses java serialization mechanism, calling
+ * {@link ObjectInputStream#readObject}
+ *
* @return an value type structure, unmarshaled from the stream
*/
public Serializable read_Value()
@@ -1260,14 +1361,13 @@ public abstract class cdrInput
}
/**
- * Read the abstract interface. An abstract interface can be either
- * CORBA value type or CORBA object and is returned as an abstract
- * java.lang.Object.
- *
- * As specified in OMG specification, this reads a single
- * boolean and then delegates either to {@link #read_Object()} (for false)
- * or to {@link #read_Value()} (for true).
- *
+ * Read the abstract interface. An abstract interface can be either CORBA
+ * value type or CORBA object and is returned as an abstract java.lang.Object.
+ *
+ * As specified in OMG specification, this reads a single boolean and then
+ * delegates either to {@link #read_Object()} (for false) or to
+ * {@link #read_Value()} (for true).
+ *
* @return an abstract interface, unmarshaled from the stream
*/
public java.lang.Object read_Abstract()
@@ -1276,10 +1376,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_char_array(CharSeqHolder holder, int offset, int length)
{
@@ -1288,10 +1388,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_wchar_array(WCharSeqHolder holder, int offset, int length)
{
@@ -1300,23 +1400,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the char array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the char array to fit the newly read
+ * values.
+ *
* @param holder_value the existing char array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private char[] ensureArray(char[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new char[ offset + length ];
+ return new char[offset + length];
else if (holder_value.length < offset + length)
{
- char[] value = new char[ offset + length ];
+ char[] value = new char[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1325,10 +1425,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_ulong_array(ULongSeqHolder holder, int offset, int length)
{
@@ -1337,10 +1437,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_long_array(LongSeqHolder holder, int offset, int length)
{
@@ -1349,23 +1449,22 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the int array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the int array to fit the newly read values.
+ *
* @param holder_value the existing int array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private int[] ensureArray(int[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new int[ offset + length ];
+ return new int[offset + length];
else if (holder_value.length < offset + length)
{
- int[] value = new int[ offset + length ];
+ int[] value = new int[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1374,10 +1473,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_float_array(FloatSeqHolder holder, int offset, int length)
{
@@ -1386,23 +1485,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the float array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the float array to fit the newly read
+ * values.
+ *
* @param holder_value the existing float array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private float[] ensureArray(float[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new float[ offset + length ];
+ return new float[offset + length];
else if (holder_value.length < offset + length)
{
- float[] value = new float[ offset + length ];
+ float[] value = new float[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1411,10 +1510,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_double_array(DoubleSeqHolder holder, int offset, int length)
{
@@ -1423,23 +1522,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the double array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the double array to fit the newly read
+ * values.
+ *
* @param holder_value the existing double array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private double[] ensureArray(double[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new double[ offset + length ];
+ return new double[offset + length];
else if (holder_value.length < offset + length)
{
- double[] value = new double[ offset + length ];
+ double[] value = new double[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1448,10 +1547,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_short_array(ShortSeqHolder holder, int offset, int length)
{
@@ -1467,23 +1566,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the short array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the short array to fit the newly read
+ * values.
+ *
* @param holder_value the existing short array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private short[] ensureArray(short[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new short[ offset + length ];
+ return new short[offset + length];
else if (holder_value.length < offset + length)
{
- short[] value = new short[ offset + length ];
+ short[] value = new short[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1492,10 +1591,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_octet_array(OctetSeqHolder holder, int offset, int length)
{
@@ -1504,23 +1603,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the byte array to fit the newly
- * read values.
- *
+ * If required, allocate or resize the byte array to fit the newly read
+ * values.
+ *
* @param holder_value the existing byte array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private byte[] ensureArray(byte[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new byte[ offset + length ];
+ return new byte[offset + length];
else if (holder_value.length < offset + length)
{
- byte[] value = new byte[ offset + length ];
+ byte[] value = new byte[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1529,51 +1628,49 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_longlong_array(LongLongSeqHolder holder, int offset,
- int length
- )
+ int length)
{
holder.value = ensureArray(holder.value, offset, length);
read_longlong_array(holder.value, offset, length);
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_ulonglong_array(ULongLongSeqHolder holder, int offset,
- int length
- )
+ int length)
{
holder.value = ensureArray(holder.value, offset, length);
read_ulonglong_array(holder.value, offset, length);
}
/**
- * If required, allocate or resize the array of longs to fit the newly
- * read values.
- *
+ * If required, allocate or resize the array of longs to fit the newly read
+ * values.
+ *
* @param holder_value the existing array, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private long[] ensureArray(long[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new long[ offset + length ];
+ return new long[offset + length];
else if (holder_value.length < offset + length)
{
- long[] value = new long[ offset + length ];
+ long[] value = new long[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1582,10 +1679,10 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_boolean_array(BooleanSeqHolder holder, int offset, int length)
{
@@ -1594,23 +1691,23 @@ public abstract class cdrInput
}
/**
- * If required, allocate or resize the array of booleans to fit the newly
- * read values.
- *
+ * If required, allocate or resize the array of booleans to fit the newly read
+ * values.
+ *
* @param holder_value the existing array of booleans, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private boolean[] ensureArray(boolean[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new boolean[ offset + length ];
+ return new boolean[offset + length];
else if (holder_value.length < offset + length)
{
- boolean[] value = new boolean[ offset + length ];
+ boolean[] value = new boolean[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1619,38 +1716,38 @@ public abstract class cdrInput
}
/**
- * Read an array. In OMG specification is written that if the data does
- * not fit into the holder value field, that array must be resized.
- * The implementation follows this rule. If the holder value field
- * contains null, it is newly instantiated.
+ * Read an array. In OMG specification is written that if the data does not
+ * fit into the holder value field, that array must be resized. The
+ * implementation follows this rule. If the holder value field contains null,
+ * it is newly instantiated.
*/
public void read_any_array(AnySeqHolder holder, int offset, int length)
{
holder.value = ensureArray(holder.value, offset, length);
for (int i = offset; i < offset + length; i++)
{
- holder.value [ i ] = read_any();
+ holder.value[i] = read_any();
}
}
/**
- * If required, allocate or resize the array of Anys to fit the newly
- * read values.
- *
+ * If required, allocate or resize the array of Anys to fit the newly read
+ * values.
+ *
* @param holder_value the existing array of Anys, may be null.
* @param offset the required offset to read.
* @param length the length of the new sequence.
- *
+ *
* @return the allocated or resized array, same array if no such operations
* are required.
*/
private Any[] ensureArray(Any[] holder_value, int offset, int length)
{
if (holder_value == null)
- return new Any[ offset + length ];
+ return new Any[offset + length];
else if (holder_value.length < offset + length)
{
- Any[] value = new Any[ offset + length ];
+ Any[] value = new Any[offset + length];
System.arraycopy(holder_value, 0, value, 0, holder_value.length);
return value;
}
@@ -1659,11 +1756,10 @@ public abstract class cdrInput
}
/**
- * This method is required to represent the DataInputStream as a value
- * type object.
- *
- * @return a single entity "IDL:omg.org/CORBA/DataInputStream:1.0",
- * always.
+ * This method is required to represent the DataInputStream as a value type
+ * object.
+ *
+ * @return a single entity "IDL:omg.org/CORBA/DataInputStream:1.0", always.
*/
public String[] _truncatable_ids()
{
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrOutput.java b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java
index 85f341c912d..7b4d5ec58ff 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrOutput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java
@@ -1,4 +1,4 @@
-/* cdrOutput.java --
+/* AbstractCdrOutput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,27 +39,28 @@ exception statement from your version. */
package gnu.CORBA.CDR;
import gnu.CORBA.BigDecimalHelper;
-import gnu.CORBA.GIOP.CharSets_OSF;
-import gnu.CORBA.GIOP.cxCodeSet;
-import gnu.CORBA.Poa.gnuServantObject;
import gnu.CORBA.IOR;
-import gnu.CORBA.Simple_delegate;
+import gnu.CORBA.IorProvider;
+import gnu.CORBA.Minor;
import gnu.CORBA.TypeCodeHelper;
import gnu.CORBA.Unexpected;
import gnu.CORBA.Version;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.GIOP.CharSets_OSF;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.Context;
import org.omg.CORBA.ContextList;
+import org.omg.CORBA.DataInputStream;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.UserException;
+import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.ObjectImpl;
import org.omg.CORBA.portable.OutputStream;
@@ -68,7 +69,6 @@ import org.omg.CORBA.portable.Streamable;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Serializable;
-
import java.math.BigDecimal;
/**
@@ -79,18 +79,27 @@ import java.math.BigDecimal;
* The same class also implements the {@link DataInputStream},
* providing support for writing the value type objects
* in a user defined way.
+ *
+ * TODO This class uses 16 bits per Unicode character only, as it was until
+ * jdk 1.4 inclusive.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public abstract class cdrOutput
+public abstract class AbstractCdrOutput
extends org.omg.CORBA_2_3.portable.OutputStream
implements org.omg.CORBA.DataOutputStream
{
/**
+ * The runtime, associated with this stream. This field is only used when
+ * reading and writing value types and filled-in in gnu.CORBA.CDR.Vio.
+ */
+ public transient gnuRuntime runtime;
+
+ /**
* This instance is used to convert primitive data types into the
* byte sequences.
*/
- protected abstractDataOutputStream b;
+ protected AbstractDataOutput b;
/**
* The associated orb, if any.
@@ -105,7 +114,7 @@ public abstract class cdrOutput
/**
* The code set information.
*/
- protected cxCodeSet codeset;
+ protected CodeSetServiceContext codeset;
/**
* The name of the currently used narrow charset.
@@ -148,19 +157,19 @@ public abstract class cdrOutput
*
* @param writeTo a stream to write CORBA output to.
*/
- public cdrOutput(java.io.OutputStream writeTo)
+ public AbstractCdrOutput(java.io.OutputStream writeTo)
{
setOutputStream(writeTo);
- setCodeSet(cxCodeSet.STANDARD);
+ setCodeSet(CodeSetServiceContext.STANDARD);
}
/**
* Creates the stream, requiring the subsequent call
* of {@link #setOutputStream(java.io.OutputStream)}.
*/
- public cdrOutput()
+ public AbstractCdrOutput()
{
- setCodeSet(cxCodeSet.STANDARD);
+ setCodeSet(CodeSetServiceContext.STANDARD);
}
/**
@@ -168,11 +177,22 @@ public abstract class cdrOutput
* stream is different from 0.
*/
public abstract void setOffset(int an_offset);
+
+ /**
+ * Clone all important settings to another stream.
+ */
+ public void cloneSettings(AbstractCdrOutput stream)
+ {
+ stream.setBigEndian(!little_endian);
+ stream.setCodeSet(getCodeSet());
+ stream.setVersion(giop);
+ stream.setOrb(orb);
+ }
/**
* Set the current code set context.
*/
- public void setCodeSet(cxCodeSet a_codeset)
+ public void setCodeSet(CodeSetServiceContext a_codeset)
{
this.codeset = a_codeset;
narrow_charset = CharSets_OSF.getName(codeset.char_data);
@@ -185,7 +205,7 @@ public abstract class cdrOutput
/**
* Get the current code set context.
*/
- public cxCodeSet getCodeSet()
+ public CodeSetServiceContext getCodeSet()
{
return codeset;
}
@@ -255,9 +275,9 @@ public abstract class cdrOutput
*
* @return the encapsulated stream.
*/
- public cdrOutput createEncapsulation()
+ public AbstractCdrOutput createEncapsulation()
{
- return new encapsulatedOutput(this, !little_endian);
+ return new EncapsulationStream(this, !little_endian);
}
/**
@@ -313,53 +333,56 @@ public abstract class cdrOutput
}
/**
- * Read the CORBA object. The object is written
- * form of the plain (not a string-encoded) IOR profile without the
- * heading endian indicator. The responsible method for reading such
- * data is {@link IOR.write_no_endian}.
- *
- * The null value is written as defined in OMG specification
- * (zero length string, followed by an empty set of profiles).
- */
+ * Read the CORBA object. The object is written form of the plain (not a
+ * string-encoded) IOR profile without the heading endian indicator. The
+ * responsible method for reading such data is {@link IOR.write_no_endian}.
+ *
+ * The null value is written as defined in OMG specification (zero length
+ * string, followed by an empty set of profiles).
+ */
public void write_Object(org.omg.CORBA.Object x)
{
- if (x == null)
+ ORB w_orb = orb;
+ if (x instanceof IorProvider)
{
- IOR.write_null(this);
+ ((IorProvider) x).getIor()._write_no_endian(this);
return;
}
- else if (x instanceof gnuServantObject)
+ else if (x == null)
{
- // The ORB may be different if several ORBs coexist
- // in the same machine.
- gnuServantObject g = (gnuServantObject) x;
- IOR ior = g.orb.getLocalIor(x);
- ior._write_no_endian(this);
+ IOR.write_null(this);
return;
}
else if (x instanceof ObjectImpl)
{
Delegate d = ((ObjectImpl) x)._get_delegate();
- if (d instanceof Simple_delegate)
+ if (d instanceof IorProvider)
{
- Simple_delegate ido = (Simple_delegate) d;
- ido.getIor()._write_no_endian(this);
+ ((IorProvider) d).getIor()._write_no_endian(this);
return;
}
+ else
+ {
+ ORB d_orb = d.orb(x);
+ if (d_orb != null)
+ w_orb = d_orb;
+ }
}
// Either this is not an ObjectImpl or it has the
// unexpected delegate. Try to convert via ORBs
// object_to_string().
- if (orb != null)
+ if (w_orb != null)
{
- IOR ior = IOR.parse(orb.object_to_string(x));
+ IOR ior = IOR.parse(w_orb.object_to_string(x));
ior._write_no_endian(this);
return;
}
else
- throw new BAD_OPERATION("Please set the ORB for this stream.");
+ throw new BAD_OPERATION(
+ "Please set the ORB for this stream, cannot write "
+ + x.getClass().getName());
}
/**
@@ -399,7 +422,7 @@ public abstract class cdrOutput
}
else
{
- primitiveTypeCode p = new primitiveTypeCode(TCKind.tk_null);
+ PrimitiveTypeCode p = new PrimitiveTypeCode(TCKind.tk_null);
write_TypeCode(p);
}
}
@@ -726,6 +749,7 @@ public abstract class cdrOutput
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.CDR;
t.initCause(ex);
throw t;
}
@@ -737,7 +761,7 @@ public abstract class cdrOutput
* representing the stream buffer length (the number of
* bytes being subsequently written).
*/
- public void write_sequence(cdrBufOutput from)
+ public void write_sequence(BufferedCdrOutput from)
{
try
{
@@ -747,6 +771,7 @@ public abstract class cdrOutput
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.CDR;
t.initCause(ex);
throw t;
}
@@ -874,28 +899,41 @@ public abstract class cdrOutput
}
/**
- * Writes the character as two byte short integer (Unicode value),
- * high byte first. Writes in Big Endian, but never writes the
- * endian indicator.
- *
- * The character is always written using the native UTF-16BE charset
- * because its size under arbitrary encoding is not evident.
+ * Writes the character as two byte short integer (Unicode value), high byte
+ * first. Writes in Big Endian, but never writes the endian indicator.
+ *
+ * The character is always written using the native UTF-16BE charset because
+ * its size under arbitrary encoding is not evident.
*/
public void write_wchar(char x)
{
try
{
if (giop.until_inclusive(1, 1))
- align(2);
+ {
+ align(2);
- if (wide_native)
- b.writeShort(x);
+ if (wide_native)
+ b.writeShort(x);
+ else
+ {
+ OutputStreamWriter ow = new OutputStreamWriter(
+ (OutputStream) b, wide_charset);
+ ow.write(x);
+ ow.flush();
+ }
+ }
+ else if (wide_native)
+ {
+ b.writeByte(2);
+ b.writeChar(x);
+ }
else
{
- OutputStreamWriter ow =
- new OutputStreamWriter((OutputStream) b, wide_charset);
- ow.write(x);
- ow.flush();
+ String encoded = new String(new char[] { x });
+ byte[] bytes = encoded.getBytes(wide_charset);
+ b.write(bytes.length + 2);
+ b.write(bytes);
}
}
catch (IOException ex)
@@ -906,13 +944,13 @@ public abstract class cdrOutput
/**
* Write the array of wide chars.
- *
+ *
* @param chars the array of wide chars
* @param offset offset
* @param length length
- *
- * The char array is always written using the native UTF-16BE charset
- * because the character size under arbitrary encoding is not evident.
+ *
+ * The char array is always written using the native UTF-16BE charset because
+ * the character size under arbitrary encoding is not evident.
*/
public void write_wchar_array(char[] chars, int offset, int length)
{
@@ -998,12 +1036,12 @@ public abstract class cdrOutput
/** {@inheritDoc} */
public void write_Abstract(java.lang.Object value)
{
- write_Abstract(value);
+ write_abstract_interface(value);
}
/** {@inheritDoc} */
public void write_Value(Serializable value)
{
- write_Value(value);
+ write_value(value);
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/CDR/abstractDataInputStream.java b/libjava/classpath/gnu/CORBA/CDR/AbstractDataInput.java
index be926254dd0..4d120fa2c0c 100644
--- a/libjava/classpath/gnu/CORBA/CDR/abstractDataInputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractDataInput.java
@@ -1,4 +1,4 @@
-/* abstractDataInputStream.java --
+/* AbstractDataInput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import java.io.IOException;
* @author Warren Levy (warrenl@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface abstractDataInputStream
+public interface AbstractDataInput
{
/**
* This method reads bytes from the underlying stream into the specified
diff --git a/libjava/classpath/gnu/CORBA/CDR/abstractDataOutputStream.java b/libjava/classpath/gnu/CORBA/CDR/AbstractDataOutput.java
index 2f9b8c419fc..e37c0cb7ddd 100644
--- a/libjava/classpath/gnu/CORBA/CDR/abstractDataOutputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractDataOutput.java
@@ -1,4 +1,4 @@
-/* abstractDataOutputStream.java --
+/* AbstractDataOutput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ import java.io.IOException;
* @author Warren Levy (warrenl@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface abstractDataOutputStream
+public interface AbstractDataOutput
{
/**
* This method flushes any unwritten bytes to the underlying stream.
diff --git a/libjava/classpath/gnu/CORBA/CDR/aligningInputStream.java b/libjava/classpath/gnu/CORBA/CDR/AligningInput.java
index a719b32ee1e..e2710628a52 100644
--- a/libjava/classpath/gnu/CORBA/CDR/aligningInputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AligningInput.java
@@ -1,4 +1,4 @@
-/* aligningInputStream.java --
+/* AligningInput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,7 +48,7 @@ import org.omg.CORBA.BAD_PARAM;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class aligningInputStream
+public class AligningInput
extends ByteArrayInputStream
{
/**
@@ -61,24 +61,12 @@ public class aligningInputStream
*
* @param a_buffer a buffer to read from.
*/
- public aligningInputStream(byte[] a_buffer)
+ public AligningInput(byte[] a_buffer)
{
super(a_buffer);
}
/**
- * Create a stream, reading from the given buffer region.
- *
- * @param a_buffer a buffer to read from.
- * @param offset the offset of the region.
- * @param length thr length of the region.
- */
- public aligningInputStream(byte[] a_buffer, int offset, int length)
- {
- super(a_buffer, offset, length);
- }
-
- /**
* Set the alignment offset, if the index of the first byte in the
* stream is different from 0.
*/
@@ -119,4 +107,25 @@ public class aligningInputStream
{
return buf;
}
+
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition()
+ {
+ return pos + offset;
+ }
+
+ /**
+ * Jump to the given position, taking offset into consideration.
+ */
+ public void seek(int position)
+ {
+ if (position < offset || position > (count+offset))
+ throw new ArrayIndexOutOfBoundsException(position
+ + " is out of valid ["+offset+".." + (count+offset) + "[ range");
+ pos = position - offset;
+ }
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/aligningOutputStream.java b/libjava/classpath/gnu/CORBA/CDR/AligningOutput.java
index 8a682c1fd6d..135f75af6a7 100644
--- a/libjava/classpath/gnu/CORBA/CDR/aligningOutputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AligningOutput.java
@@ -1,4 +1,4 @@
-/* aligningOutputStream.java --
+/* AligningOutput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.CORBA.CDR;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import org.omg.CORBA.BAD_PARAM;
@@ -49,7 +48,7 @@ import org.omg.CORBA.BAD_PARAM;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class aligningOutputStream
+public class AligningOutput
extends ByteArrayOutputStream
{
/**
@@ -60,14 +59,14 @@ public class aligningOutputStream
/**
* Create a stream with the default intial buffer size.
*/
- public aligningOutputStream()
+ public AligningOutput()
{
}
/**
* Create a stream with the given intial buffer size.
*/
- public aligningOutputStream(int initial_size)
+ public AligningOutput(int initial_size)
{
super(initial_size);
}
@@ -118,4 +117,32 @@ public class aligningOutputStream
write(0);
}
}
+
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition()
+ {
+ return size()+offset;
+ }
+
+ /**
+ * Seek to the given position (not in use).
+ */
+ public void seek(int position)
+ {
+ count = position - offset;
+ }
+
+ /**
+ * Get the buffer without copying it. Use with care.
+ */
+ public byte[] getBuffer()
+ {
+ return buf;
+ }
+
+
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/ArrayValueHelper.java b/libjava/classpath/gnu/CORBA/CDR/ArrayValueHelper.java
new file mode 100644
index 00000000000..7a4d9c5aa8f
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/ArrayValueHelper.java
@@ -0,0 +1,254 @@
+/* ArrayValueHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.ObjectCreator;
+
+import org.omg.CORBA.BooleanSeqHelper;
+import org.omg.CORBA.CharSeqHelper;
+import org.omg.CORBA.DoubleSeqHelper;
+import org.omg.CORBA.FloatSeqHelper;
+import org.omg.CORBA.LongLongSeqHelper;
+import org.omg.CORBA.LongSeqHelper;
+import org.omg.CORBA.OctetSeqHelper;
+import org.omg.CORBA.ShortSeqHelper;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.rmi.Remote;
+
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+
+/**
+ * Writes arrays as a boxed value types. A single instance is used to write a
+ * single array. This class is only used with RMI/IIOP, to handle array boxed
+ * values.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+class ArrayValueHelper
+ implements BoxedValueHelper
+{
+ /**
+ * The value handler (one for all instances).
+ */
+ static ValueHandler handler = Util.createValueHandler();
+
+ /**
+ * A class of the array being written.
+ */
+ Class arrayClass;
+
+ /**
+ * The array component class.
+ */
+ Class component;
+
+ /**
+ * The array component repository Id.
+ */
+ String componentId;
+
+ /**
+ * If true, the array members are written as objects rather than as values.
+ * True for Remotes and CORBA objects.
+ */
+ boolean written_as_object()
+ {
+ return org.omg.CORBA.Object.class.isAssignableFrom(component)
+ || Remote.class.isAssignableFrom(component);
+ }
+
+ /**
+ * Creates the instance of the helper to write this specific array class.
+ */
+ ArrayValueHelper(Class an_arrayClass)
+ {
+ arrayClass = an_arrayClass;
+ }
+
+ /**
+ * Get the array repository Id that will be the RMI repository id.
+ */
+ public String get_id()
+ {
+ return ObjectCreator.getRepositoryId(arrayClass);
+ }
+
+ /**
+ * Read the array from the input stream.
+ */
+ public Serializable read_value(InputStream input)
+ {
+ if (input instanceof HeadlessInput)
+ {
+ ((HeadlessInput) input).subsequentCalls = true;
+ }
+
+ component = arrayClass.getComponentType();
+
+ if (component.equals(byte.class))
+ return OctetSeqHelper.read(input);
+ else if (component.equals(String.class))
+ {
+ // String array is optimized because this may be frequent.
+ String[] s = new String[input.read_long()];
+
+ for (int i = 0; i < s.length; i++)
+ s[i] = (String) Vio.read(input, Vio.m_StringValueHelper);
+ return s;
+ }
+ else if (component.equals(int.class))
+ return LongSeqHelper.read(input);
+ else if (component.equals(long.class))
+ return LongLongSeqHelper.read(input);
+ else if (component.equals(double.class))
+ return DoubleSeqHelper.read(input);
+ else if (component.equals(float.class))
+ return FloatSeqHelper.read(input);
+ else if (component.equals(boolean.class))
+ return BooleanSeqHelper.read(input);
+ else if (component.equals(short.class))
+ return ShortSeqHelper.read(input);
+ else if (component.equals(char.class))
+ return CharSeqHelper.read(input);
+ else
+ {
+ // Read others, use reflection.
+ int n = input.read_long();
+
+ gnuValueStream s = null;
+
+ Serializable array = (Serializable) Array.newInstance(component, n);
+ if (written_as_object())
+ for (int i = 0; i < n; i++)
+ {
+ gnuRuntime g;
+ int position;
+ if (input instanceof gnuValueStream)
+ {
+ s = (gnuValueStream) input;
+ g = s.getRunTime();
+ position = s.getPosition();
+ }
+ else
+ {
+ g = null;
+ position = -1;
+ }
+
+ if (input instanceof HeadlessInput)
+ ((HeadlessInput) input).subsequentCalls = true;
+
+ Object o = handler.readValue(input, position, component, null, g);
+ Array.set(array, i, o);
+ }
+ else
+ for (int i = 0; i < n; i++)
+ Array.set(array, i, Vio.read(input, component));
+ return array;
+ }
+ }
+
+ /**
+ * Write the array to the input stream.
+ */
+ public void write_value(OutputStream output, Serializable value)
+ {
+ if (output instanceof gnuValueStream)
+ {
+ gnuRuntime r = ((gnuValueStream) output).getRunTime();
+ if (r != null)
+ r.target = null;
+ }
+
+ if (value instanceof byte[])
+ OctetSeqHelper.write(output, (byte[]) value);
+ else if (value instanceof String[])
+ {
+ String[] s = (String[]) value;
+ output.write_long(s.length);
+ for (int i = 0; i < s.length; i++)
+ Vio.write(output, s[i], Vio.m_StringValueHelper);
+ }
+ else if (value instanceof int[])
+ LongSeqHelper.write(output, (int[]) value);
+ else if (value instanceof long[])
+ LongLongSeqHelper.write(output, (long[]) value);
+ else if (value instanceof double[])
+ DoubleSeqHelper.write(output, (double[]) value);
+ else if (value instanceof float[])
+ FloatSeqHelper.write(output, (float[]) value);
+ else if (value instanceof boolean[])
+ BooleanSeqHelper.write(output, (boolean[]) value);
+ else if (value instanceof short[])
+ ShortSeqHelper.write(output, (short[]) value);
+ else if (value instanceof char[])
+ CharSeqHelper.write(output, (char[]) value);
+ else
+ {
+ // Write others, use reflection.
+ component = arrayClass.getComponentType();
+
+ int n = Array.getLength(value);
+ output.write_long(n);
+ if (written_as_object())
+ for (int i = 0; i < n; i++)
+ {
+ Object o = Array.get(value, i);
+ if (o == null)
+ output.write_Object(null);
+ else
+ // CORBA objects have another notation.
+ handler.writeValue(output, (Serializable) o);
+ }
+ else
+ {
+ for (int i = 0; i < n; i++)
+ Vio.write(output, (Serializable) Array.get(value, i),
+ component);
+ }
+
+ }
+ }
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java b/libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java
index bc019396adb..1559d75a41e 100644
--- a/libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/BigEndianInputStream.java
@@ -49,7 +49,7 @@ import java.io.InputStream;
*/
public class BigEndianInputStream
extends DataInputStream
- implements abstractDataInputStream
+ implements AbstractDataInput
{
/**
* Delegates to the parent constructor.
diff --git a/libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java b/libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java
index e0aa7da773e..7d3b02ec950 100644
--- a/libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/BigEndianOutputStream.java
@@ -50,7 +50,7 @@ import java.io.OutputStream;
*/
public class BigEndianOutputStream
extends DataOutputStream
- implements abstractDataOutputStream
+ implements AbstractDataOutput
{
/**
* Delegate functionality to the parent constructor.
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrBufOutput.java b/libjava/classpath/gnu/CORBA/CDR/BufferedCdrOutput.java
index 47f5f176b39..69bf95beb66 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrBufOutput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/BufferedCdrOutput.java
@@ -1,4 +1,4 @@
-/* cdrBufOutput.java --
+/* BufferedCdrOutput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,41 +41,47 @@ package gnu.CORBA.CDR;
import java.io.ByteArrayOutputStream;
/**
- * A CORBA output stream, writing data into the internal
- * buffer ({@link ByteArrayOutputStream}).
- *
+ * A CORBA output stream, writing data into the internal buffer ({@link ByteArrayOutputStream}).
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class cdrBufOutput
- extends cdrOutput
+public class BufferedCdrOutput
+ extends AbstractCdrOutput
+ implements gnuValueStream
{
/**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
* The byte buffer.
*/
- public final aligningOutputStream buffer;
+ public final AligningOutput buffer;
/**
* Creates the instance with the given initial buffer size.
+ *
* @param bufSize the buffer size.
*/
- public cdrBufOutput(int bufSize)
+ public BufferedCdrOutput(int bufSize)
{
- buffer = new aligningOutputStream(bufSize);
+ buffer = new AligningOutput(bufSize);
setOutputStream(buffer);
}
/**
* Creates the instance with the default buffer size.
*/
- public cdrBufOutput()
+ public BufferedCdrOutput()
{
- buffer = new aligningOutputStream();
+ buffer = new AligningOutput();
setOutputStream(buffer);
}
/**
- * Set the alignment offset, if the index of the first byte in the
- * stream is different from 0.
+ * Set the alignment offset, if the index of the first byte in the stream is
+ * different from 0.
*/
public void setOffset(int an_offset)
{
@@ -95,7 +101,7 @@ public class cdrBufOutput
*/
public org.omg.CORBA.portable.InputStream create_input_stream()
{
- cdrBufInput in = new cdrBufInput(buffer.toByteArray());
+ BufferredCdrInput in = new BufferredCdrInput(buffer.toByteArray());
in.setOrb(orb);
in.setVersion(giop);
@@ -112,4 +118,39 @@ public class cdrBufOutput
buffer.reset();
setOutputStream(buffer);
}
+
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition()
+ {
+ return buffer.getPosition();
+ }
+
+ /**
+ * Get the associated RunTime.
+ */
+ public gnuRuntime getRunTime()
+ {
+ return runtime;
+ }
+
+ /**
+ * Replace the instance of RunTime.
+ */
+ public void setRunTime(gnuRuntime a_runtime)
+ {
+ runtime = a_runtime;
+ }
+
+ /**
+ * Seek to the given position.
+ */
+ public void seek(int position)
+ {
+ buffer.seek(position);
+ }
+
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/cdrBufInput.java b/libjava/classpath/gnu/CORBA/CDR/BufferredCdrInput.java
index 3cab7216c3b..f0159a88dac 100644
--- a/libjava/classpath/gnu/CORBA/CDR/cdrBufInput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/BufferredCdrInput.java
@@ -1,4 +1,4 @@
-/* cdrBufInput.java --
+/* BufferredCdrInput.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,18 +43,20 @@ package gnu.CORBA.CDR;
* The CDR input stream that reads data from the byte buffer.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
- *
- * TODO character encoding. Now the encoding can be set, but it is ignored.
- * If you take this task, scan 'TODO character encoding' for
- * relevant places.
*/
-public class cdrBufInput
- extends cdrInput
+public class BufferredCdrInput
+ extends AbstractCdrInput
+ implements gnuValueStream
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The byte array input stream to read data from.
*/
- public final aligningInputStream buffer;
+ public final AligningInput buffer;
/**
* Creates the CDR input stream that reads from the given buffer
@@ -62,9 +64,9 @@ public class cdrBufInput
*
* @param a_buffer an array to read from.
*/
- public cdrBufInput(byte[] a_buffer)
+ public BufferredCdrInput(byte[] a_buffer)
{
- buffer = new aligningInputStream(a_buffer);
+ buffer = new AligningInput(a_buffer);
setInputStream(buffer);
}
@@ -112,4 +114,40 @@ public class cdrBufInput
buffer.reset();
setInputStream(buffer);
}
+
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition()
+ {
+ return buffer.getPosition();
+ }
+
+ /**
+ * Jump to the given position, taking offset into consideration.
+ */
+ public void seek(int position)
+ {
+ buffer.seek(position);
+ setInputStream(buffer);
+ }
+
+ /**
+ * Get the associated RunTime.
+ */
+ public gnuRuntime getRunTime()
+ {
+ return runtime;
+ }
+
+ /**
+ * Replace the instance of RunTime.
+ */
+ public void setRunTime(gnuRuntime a_runtime)
+ {
+ runtime = a_runtime;
+ }
+
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/encapsulatedOutput.java b/libjava/classpath/gnu/CORBA/CDR/EncapsulationStream.java
index 3350291bc73..4945d9c906a 100644
--- a/libjava/classpath/gnu/CORBA/CDR/encapsulatedOutput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/EncapsulationStream.java
@@ -48,8 +48,8 @@ import java.io.IOException;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class encapsulatedOutput
- extends cdrOutput
+public class EncapsulationStream
+ extends AbstractCdrOutput
{
/**
* The Big Endian (most siginificant byte first flag).
@@ -64,7 +64,7 @@ public class encapsulatedOutput
/**
* The byte buffer.
*/
- public final aligningOutputStream buffer;
+ public final AligningOutput buffer;
/**
* The stream, where the data are being encapsulated.
@@ -75,11 +75,11 @@ public class encapsulatedOutput
* Create the EncapsulationOutput with the given parent stream
* and the specified encoding.
*/
- public encapsulatedOutput(org.omg.CORBA.portable.OutputStream _parent,
+ public EncapsulationStream(org.omg.CORBA.portable.OutputStream _parent,
boolean use_big_endian)
{
super();
- buffer = new aligningOutputStream();
+ buffer = new AligningOutput();
setOutputStream(buffer);
parent = _parent;
write(use_big_endian?BIG_ENDIAN:LITTLE_ENDIAN);
@@ -126,7 +126,7 @@ public class encapsulatedOutput
*/
public org.omg.CORBA.portable.InputStream create_input_stream()
{
- cdrBufInput in = new cdrBufInput(buffer.toByteArray());
+ BufferredCdrInput in = new BufferredCdrInput(buffer.toByteArray());
in.setOrb(orb);
in.setVersion(giop);
diff --git a/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java b/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java
new file mode 100644
index 00000000000..0c18dafb195
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java
@@ -0,0 +1,749 @@
+/* HeadlessInput.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.AnySeqHolder;
+import org.omg.CORBA.BooleanSeqHolder;
+import org.omg.CORBA.CharSeqHolder;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.DataInputStream;
+import org.omg.CORBA.DoubleSeqHolder;
+import org.omg.CORBA.FloatSeqHolder;
+import org.omg.CORBA.LongLongSeqHolder;
+import org.omg.CORBA.LongSeqHolder;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.OctetSeqHolder;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.ShortSeqHolder;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.ULongLongSeqHolder;
+import org.omg.CORBA.ULongSeqHolder;
+import org.omg.CORBA.UShortSeqHolder;
+import org.omg.CORBA.WCharSeqHolder;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.InputStream;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * Substitutes the main stream in factories when the header is already behind.
+ * Overrides methods that may be invoked from the factory, forcing not to read
+ * the header if called first time on this stream.
+ *
+ * This stream reverts to default behavior if one or more call are made (reading
+ * value types that are nested fields of the value type).
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class HeadlessInput
+ extends org.omg.CORBA_2_3.portable.InputStream
+ implements DataInputStream, gnuValueStream
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Indicates that no positional information is available.
+ */
+ static final int NONE = -1;
+
+ /**
+ * If true, this is not the first call.
+ */
+ public boolean subsequentCalls;
+
+ /**
+ * The enclosed stream.
+ */
+ final BufferredCdrInput stream;
+
+ /**
+ * Create an instance, reading from the given buffer.
+ *
+ * @param a_stram a stream from where the data will be read.
+ * @param inheritSettings a stream from that endian and other settings are
+ * inherited.
+ */
+ public HeadlessInput(BufferredCdrInput a_stream, InputStream inheritSettings)
+ {
+ stream = a_stream;
+
+ if (inheritSettings instanceof AbstractCdrInput)
+ {
+ AbstractCdrInput t = (AbstractCdrInput) inheritSettings;
+ t.cloneSettings(stream);
+ }
+ else if (stream.orb() == null)
+ stream.setOrb(inheritSettings.orb());
+
+ if (inheritSettings instanceof gnuValueStream
+ && stream.getRunTime() == null)
+ {
+ stream.setRunTime(((gnuValueStream) inheritSettings).getRunTime());
+ }
+ }
+
+ /**
+ * Tries to read using boxed value helper.
+ */
+ public Serializable read_value(BoxedValueHelper helper)
+ {
+ if (subsequentCalls)
+ return stream.read_value(helper);
+ else
+ {
+ subsequentCalls = true;
+ return helper.read_value(this);
+ }
+ }
+
+ /**
+ * Tries to locate a factory using repository id.
+ */
+ public Serializable read_value(String repository_id)
+ {
+ if (subsequentCalls)
+ return stream.read_value(repository_id);
+ else
+ {
+ subsequentCalls = true;
+ Serializable value = (Serializable) Vio.readValue(this, NONE, null,
+ null, repository_id, null, null);
+ return value;
+ }
+ }
+
+ /**
+ * Try to read when having an unitialised value.
+ */
+ public Serializable read_value(Serializable value)
+ {
+ if (subsequentCalls)
+ return stream.read_value(value);
+ else
+ {
+ subsequentCalls = true;
+ value = (Serializable) Vio.readValue(this, NONE, value, null, null,
+ null, null);
+ return value;
+ }
+ }
+
+ /**
+ * Try to read when having an unitialised value.
+ */
+ public Serializable read_value(Class clz)
+ {
+ if (subsequentCalls)
+ return stream.read_value(clz);
+ else
+ {
+ try
+ {
+ subsequentCalls = true;
+ Serializable value = (Serializable) Vio.instantiateAnyWay(clz);
+ value = (Serializable) Vio.readValue(this, NONE, value, null, null,
+ null, null);
+ return value;
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Can't read an instance of "
+ + clz.getName());
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int available()
+ throws IOException
+ {
+ return stream.available();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void close()
+ throws IOException
+ {
+ stream.close();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void mark(int readlimit)
+ {
+ stream.mark(readlimit);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public boolean markSupported()
+ {
+ return stream.markSupported();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public ORB orb()
+ {
+ return stream.orb();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Object read_abstract_interface()
+ {
+ return stream.read_abstract_interface();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Object read_abstract_interface(Class clz)
+ {
+ return stream.read_abstract_interface(clz);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Any read_any()
+ {
+ return stream.read_any();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_boolean_array(boolean[] value, int offset, int length)
+ {
+ stream.read_boolean_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public boolean read_boolean()
+ {
+ return stream.read_boolean();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_char_array(char[] value, int offset, int length)
+ {
+ stream.read_char_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public char read_char()
+ {
+ return stream.read_char();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Context read_Context()
+ {
+ return stream.read_Context();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_double_array(double[] value, int offset, int length)
+ {
+ stream.read_double_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public double read_double()
+ {
+ return stream.read_double();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public BigDecimal read_fixed()
+ {
+ return stream.read_fixed();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_float_array(float[] value, int offset, int length)
+ {
+ stream.read_float_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public float read_float()
+ {
+ return stream.read_float();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_long_array(int[] value, int offset, int length)
+ {
+ stream.read_long_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read_long()
+ {
+ return stream.read_long();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_longlong_array(long[] value, int offset, int length)
+ {
+ stream.read_longlong_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public long read_longlong()
+ {
+ return stream.read_longlong();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public org.omg.CORBA.Object read_Object()
+ {
+ return stream.read_Object();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public org.omg.CORBA.Object read_Object(Class klass)
+ {
+ return stream.read_Object(klass);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_octet_array(byte[] value, int offset, int length)
+ {
+ stream.read_octet_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public byte read_octet()
+ {
+ return stream.read_octet();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Principal read_Principal()
+ {
+ return stream.read_Principal();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_short_array(short[] value, int offset, int length)
+ {
+ stream.read_short_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public short read_short()
+ {
+ return stream.read_short();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public String read_string()
+ {
+ return stream.read_string();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public TypeCode read_TypeCode()
+ {
+ return stream.read_TypeCode();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ulong_array(int[] value, int offset, int length)
+ {
+ stream.read_ulong_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read_ulong()
+ {
+ return stream.read_ulong();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ulonglong_array(long[] value, int offset, int length)
+ {
+ stream.read_ulonglong_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public long read_ulonglong()
+ {
+ return stream.read_ulonglong();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ushort_array(short[] value, int offset, int length)
+ {
+ stream.read_ushort_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public short read_ushort()
+ {
+ return stream.read_ushort();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Serializable read_value()
+ {
+ return read_value((Serializable) null);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_wchar_array(char[] value, int offset, int length)
+ {
+ stream.read_wchar_array(value, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public char read_wchar()
+ {
+ return stream.read_wchar();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public String read_wstring()
+ {
+ return stream.read_wstring();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read()
+ throws IOException
+ {
+ return stream.read();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read(byte[] b, int off, int len)
+ throws IOException
+ {
+ return stream.read(b, off, len);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int read(byte[] b)
+ throws IOException
+ {
+ return stream.read(b);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void reset()
+ throws IOException
+ {
+ stream.reset();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public long skip(long n)
+ throws IOException
+ {
+ return stream.skip(n);
+ }
+
+ /**
+ * Get a string representation.
+ */
+ public String toString()
+ {
+ return "HeadlessInput+" + stream.toString();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public String[] _truncatable_ids()
+ {
+ return stream._truncatable_ids();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public Object read_Abstract()
+ {
+ return stream.read_Abstract();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_any_array(AnySeqHolder holder, int offset, int length)
+ {
+ stream.read_any_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_boolean_array(BooleanSeqHolder holder, int offset, int length)
+ {
+ stream.read_boolean_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_char_array(CharSeqHolder holder, int offset, int length)
+ {
+ stream.read_char_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_double_array(DoubleSeqHolder holder, int offset, int length)
+ {
+ stream.read_double_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_float_array(FloatSeqHolder holder, int offset, int length)
+ {
+ stream.read_float_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_long_array(LongSeqHolder holder, int offset, int length)
+ {
+ stream.read_long_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_longlong_array(LongLongSeqHolder holder, int offset,
+ int length)
+ {
+ stream.read_longlong_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_octet_array(OctetSeqHolder holder, int offset, int length)
+ {
+ stream.read_octet_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_short_array(ShortSeqHolder holder, int offset, int length)
+ {
+ stream.read_short_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ulong_array(ULongSeqHolder holder, int offset, int length)
+ {
+ stream.read_ulong_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ulonglong_array(ULongLongSeqHolder holder, int offset,
+ int length)
+ {
+ stream.read_ulonglong_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_ushort_array(UShortSeqHolder holder, int offset, int length)
+ {
+ stream.read_ushort_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to read_value.
+ */
+ public Serializable read_Value()
+ {
+ return read_value();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void read_wchar_array(WCharSeqHolder holder, int offset, int length)
+ {
+ stream.read_wchar_array(holder, offset, length);
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public int getPosition()
+ {
+ return stream.getPosition();
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public gnuRuntime getRunTime()
+ {
+ return stream.runtime;
+ }
+
+ /**
+ * Replace the instance of RunTime.
+ */
+ public void setRunTime(gnuRuntime a_runtime)
+ {
+ stream.runtime = a_runtime;
+ }
+
+ /**
+ * Delegates functionality to the underlying stream.
+ */
+ public void seek(int position)
+ {
+ stream.seek(position);
+ }
+
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/CDR/IDLTypeHelper.java b/libjava/classpath/gnu/CORBA/CDR/IDLTypeHelper.java
new file mode 100644
index 00000000000..3259a48770c
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/IDLTypeHelper.java
@@ -0,0 +1,169 @@
+/* IDLTypeHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+/**
+ * Handles case when the CORBA IDL type with the known helper is wrapped into
+ * Value type.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class IDLTypeHelper
+ implements BoxedValueHelper
+{
+ /**
+ * A helper class.
+ */
+ protected Class helper;
+
+ /**
+ * Argument values for Helper.id().
+ */
+ static final Object[] ARGS_ID_V = new Object[0];
+
+ /**
+ * Argument types for Helper.id()).
+ */
+ static final Class[] ARGS_ID = new Class[0];
+
+ /**
+ * Argument types for Helper.read.
+ */
+ static final Class[] ARGS_READ = new Class[] { org.omg.CORBA.portable.InputStream.class };
+
+ /**
+ * Create an IDLTypeHelper that works via given helper class.
+ */
+ public IDLTypeHelper(Class a_helperClass)
+ {
+ helper = a_helperClass;
+ }
+
+ /**
+ * Get the Id, returned by this helper (use reflection).
+ */
+ public String get_id()
+ {
+ try
+ {
+ Method m = helper.getMethod("id", ARGS_ID);
+ return (String) m.invoke(null, ARGS_ID_V);
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL(msg() + " id()");
+ m.minor = Minor.Boxed;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Read an instance from the stream.
+ */
+ public Serializable read_value(InputStream input)
+ {
+ try
+ {
+ Method m = helper.getMethod("read", ARGS_READ);
+ return (Serializable) m.invoke(null, new Object[] { input });
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL(msg() + " read(..)");
+ m.minor = Minor.Boxed;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Write the instance to the stream.
+ */
+ public void write_value(OutputStream output, Serializable value)
+ {
+ try
+ {
+ Method[] m = helper.getMethods();
+
+ for (int i = 0; i < m.length; i++)
+ {
+ if (m[i].getName().equals("write")
+ && ((m[i].getModifiers() & Modifier.STATIC) != 0))
+ {
+ Class[] p = m[i].getParameterTypes();
+
+ if (p.length == 2 && OutputStream.class.isAssignableFrom(p[0])
+ && p[1].isAssignableFrom(value.getClass()))
+ {
+ m[i].invoke(null, new Object[] { output, value });
+ return;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL(msg() + " write(..)");
+ m.minor = Minor.Boxed;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Create the start of message for exceptions.
+ */
+ String msg()
+ {
+ return "Failed calling " + helper.getName() + " method: ";
+ }
+
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java b/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java
index b71a9a4f66d..02cfa08ae8e 100644
--- a/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java
@@ -55,7 +55,7 @@ import java.io.PushbackInputStream;
*/
public class LittleEndianInputStream
extends FilterInputStream
- implements abstractDataInputStream
+ implements AbstractDataInput
{
// Byte buffer, used to make primitive read calls more efficient.
byte[] buf = new byte[ 8 ];
diff --git a/libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java b/libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java
index a6d56cfa6d0..6791a82e7c3 100644
--- a/libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/LittleEndianOutputStream.java
@@ -55,7 +55,7 @@ import java.io.OutputStream;
*/
public class LittleEndianOutputStream
extends FilterOutputStream
- implements abstractDataOutputStream
+ implements AbstractDataOutput
{
/**
* This method initializes an instance of <code>DataOutputStream</code> to
diff --git a/libjava/classpath/gnu/CORBA/CDR/UnknownExceptionCtxHandler.java b/libjava/classpath/gnu/CORBA/CDR/UnknownExceptionCtxHandler.java
new file mode 100644
index 00000000000..314dd8eb948
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/UnknownExceptionCtxHandler.java
@@ -0,0 +1,292 @@
+/* UnknownExceptionCtxHandler.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.Minor;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.GIOP.ServiceContext;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.StringValueHelper;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.lang.reflect.Constructor;
+import java.util.StringTokenizer;
+
+import javax.rmi.CORBA.Util;
+
+/**
+ * Reads the data about an unknown exception from the UnknownExceptionInfo.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class UnknownExceptionCtxHandler
+ extends Vio
+{
+ /**
+ * Encode exception and add its recored to the message service contexts.
+ */
+ public static ServiceContext[] addExceptionContext(ServiceContext[] current,
+ Throwable exception, Object details)
+ {
+ try
+ {
+ ServiceContext[] c = new ServiceContext[current.length + 1];
+ if (current.length > 0)
+ System.arraycopy(current, 0, c, 0, current.length);
+
+ BufferedCdrOutput output = new BufferedCdrOutput();
+
+ if (details instanceof OutputStream)
+ output.setOrb(((OutputStream) output).orb());
+
+ if (details instanceof AbstractCdrOutput)
+ ((AbstractCdrOutput) details).cloneSettings(output);
+
+ write(output, exception);
+
+ ServiceContext xc = new ServiceContext();
+ xc.context_id = ServiceContext.UnknownExceptionInfo;
+ xc.context_data = output.buffer.toByteArray();
+ c[current.length] = xc;
+ return c;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return current;
+ }
+ }
+
+ /**
+ * Write data about unknown exception.
+ */
+ public static void write(BufferedCdrOutput output, Throwable t)
+ {
+ t.fillInStackTrace();
+ output.write_Value(t);
+ }
+
+ /**
+ * Read the data about an unknown exception from the UnknownExceptionInfo.
+ * Following the documentation, this must be just value type, but it seems
+ * that in Sun's implementation is is not, as starts from 0x0. For value type,
+ * this would be null.
+ *
+ * TODO Implement reading and writing in Sun format, making Classpath IIOP
+ * interoperable with Sun's implementation. Current inmplementation reads and
+ * reproduces the exception class type only.
+ *
+ * @param input the input stream to read the context (orb and other settings
+ * are inherited from the main stream that received the message).
+ *
+ * @param contexts all service contexts that were present in the message.
+ *
+ * @return the Throwable, extracted from context, on null, if this has failed.
+ */
+ public static Throwable read(BufferredCdrInput input, ServiceContext[] contexts)
+ {
+ input.mark(Integer.MAX_VALUE);
+
+ int h = input.read_long();
+ if (h == 0)
+ {
+ // This block reads exception info in the Sun specific format.
+ // (currently we read the exception name only).
+ try
+ {
+ // We may need to jump back if the value is read via value
+ // factory.
+ input.mark(512);
+
+ int value_tag = input.read_long();
+ checkTag(value_tag);
+
+ String codebase = null;
+ String[] ids = null;
+ String id = null;
+
+ // Check for the agreed null value.
+ if (value_tag == vt_NULL)
+ return null;
+ else if (value_tag == vt_INDIRECTION)
+ return (Throwable) readIndirection(input);
+ else
+ {
+ // Read the value.
+ if ((value_tag & vf_CODEBASE) != 0)
+ {
+ // The codebase is present. The codebase is a space
+ // separated list of URLs from where the implementing
+ // code can be downloaded.
+ codebase = read_string(input);
+ }
+
+ if ((value_tag & vf_MULTIPLE_IDS) != 0)
+ {
+ // Multiple supported repository ids are present.
+ ids = read_string_array(input);
+ }
+ else if ((value_tag & vf_ID) != 0)
+ {
+ // Single supported repository id is present.
+ id = read_string(input);
+ }
+ }
+
+ java.lang.Object ox = createInstance(id, ids, codebase);
+
+ return (Throwable) ox;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+ else
+ {
+ input.reset();
+ // Read as defined in OMG documentation.
+ return (Throwable) input.read_Value();
+ }
+ }
+
+ /**
+ * Load exception by name and create the instance. The reason why this is
+ * different from Vio is because some exceptions have no parameterless
+ * constructor, but have a constructor with the string parameter instead.
+ */
+ static Object createInstance(String id, String[] ids, String codebase)
+ {
+ Object o = _createInstance(id, codebase);
+
+ if (ids != null)
+ for (int i = 0; i < ids.length && o == null; i++)
+ o = _createInstance(ids[i], codebase);
+ return o;
+ }
+
+ static Object _createInstance(String id, String codebase)
+ {
+ if (id == null)
+ return null;
+ if (id.equals(StringValueHelper.id()))
+ return "";
+ StringTokenizer st = new StringTokenizer(id, ":");
+
+ String prefix = st.nextToken();
+ if (prefix.equalsIgnoreCase("IDL"))
+ return ObjectCreator.Idl2Object(id);
+ else if (prefix.equalsIgnoreCase("RMI"))
+ {
+ String className = st.nextToken();
+ String hashCode = st.nextToken();
+ String sid = null;
+ if (st.hasMoreElements())
+ sid = st.nextToken();
+
+ try
+ {
+ Class objectClass = Util.loadClass(className, codebase,
+ Vio.class.getClassLoader());
+
+ String rid = ObjectCreator.getRepositoryId(objectClass);
+
+ if (!rid.equals(id))
+ {
+ // If direct string comparison fails, compare by meaning.
+ StringTokenizer st2 = new StringTokenizer(rid, ":");
+ if (!st2.nextToken().equals("RMI"))
+ throw new InternalError("RMI format expected: '" + rid + "'");
+ if (!st2.nextToken().equals(className))
+ throwIt("Class name mismatch", id, rid, null);
+
+ try
+ {
+ long h1 = Long.parseLong(hashCode, 16);
+ long h2 = Long.parseLong(st2.nextToken(), 16);
+ if (h1 != h2)
+ throwIt("Hashcode mismatch", id, rid, null);
+
+ if (sid != null && st2.hasMoreTokens())
+ {
+ long s1 = Long.parseLong(hashCode, 16);
+ long s2 = Long.parseLong(st2.nextToken(), 16);
+ if (s1 != s2)
+ throwIt("serialVersionUID mismatch", id, rid, null);
+ }
+ }
+ catch (NumberFormatException e)
+ {
+ throwIt("Invalid hashcode or svuid format: ", id, rid, e);
+ }
+ }
+
+ // Some RemoteExceptions have no public parameterless constructor,
+ // but they have constructor taking string as parameter.
+ try
+ {
+ return objectClass.newInstance();
+ }
+ catch (Exception ex)
+ {
+ // Try instantiate passing string as parameter.
+ Constructor c = objectClass.getConstructor(new Class[] { String.class });
+ return c.newInstance(new Object[] { "<message unavailable>" });
+ }
+ }
+ catch (MARSHAL m)
+ {
+ m.minor = Minor.Instantiation;
+ throw m;
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Unable to instantiate " + id);
+ m.minor = Minor.Instantiation;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+ else
+ throw new NO_IMPLEMENT("Unsupported prefix " + prefix + ":");
+ }
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/VMVio.java b/libjava/classpath/gnu/CORBA/CDR/VMVio.java
new file mode 100644
index 00000000000..9b719fd7c50
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/VMVio.java
@@ -0,0 +1,101 @@
+/* VMVio.java -- Native operations, required by value IO.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+/**
+ * This is a temporary replacement for the native call that would allocate
+ * objects without public constructors. The replacement only allocates
+ * objects with public parameterless constructor and objects with public
+ * constructor taking string (like some Throwables).
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ *
+ * TODO FIXME replace by native call like in VMObjectInputStream.
+ * Required modification of Classpath the build system.
+ */
+
+
+package gnu.CORBA.CDR;
+
+import java.lang.reflect.Constructor;
+
+public class VMVio
+{
+ /**
+ * Allocates a new Object of type clazz but without running the default
+ * constructor on it. It then calls the given constructor on it. The given
+ * constructor method comes from the constr_clazz which is a super class of
+ * the given clazz.
+ */
+ public static Object allocateObject(Class clazz, Class constr_clazz,
+ Constructor constructor)
+ throws InstantiationException
+ {
+ try
+ {
+ Constructor c = clazz.getConstructor(new Class[0]);
+ c.setAccessible(true);
+ return c.newInstance(new Object[0]);
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ Constructor c = clazz.getConstructor(new Class[] { String.class });
+ return c.newInstance(new Object[] { "" });
+ }
+ catch (Exception ex2)
+ {
+ Constructor c[] = clazz.getConstructors();
+
+ for (int i = 0; i < c.length; i++)
+ {
+ try
+ {
+ c[i].setAccessible(true);
+ Class[] args = c[i].getParameterTypes();
+ return c[i].newInstance(new Object[args.length]);
+ }
+ catch (Exception ex3)
+ {
+ // Try another one.
+ }
+ }
+ }
+ throw new InstantiationException(clazz.getName());
+ }
+ }
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/Vio.java b/libjava/classpath/gnu/CORBA/CDR/Vio.java
index 0a37132b26f..fd878cb3555 100644
--- a/libjava/classpath/gnu/CORBA/CDR/Vio.java
+++ b/libjava/classpath/gnu/CORBA/CDR/Vio.java
@@ -1,4 +1,4 @@
-/* gnuValueBaseHelper.java --
+/* Vio.java -- Value type IO operations.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.CORBA.CDR;
+import gnu.CORBA.Minor;
import gnu.CORBA.ObjectCreator;
import org.omg.CORBA.CustomMarshal;
@@ -46,106 +47,144 @@ import org.omg.CORBA.DataOutputStream;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.StringValueHelper;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.WStringValueHelper;
import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
import org.omg.CORBA.portable.ValueFactory;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.util.StringTokenizer;
-import java.lang.reflect.Method;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
/**
* A specialised class for reading and writing the value types.
- *
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class Vio
{
/**
- * If true, wrap value type data into chunks. This decrease the
- * performance, but is required for the interoperability with
- * Sun's CORBA implementation. Chunking may increase the security,
- * as there is more control on the number of bytes being transferred.
- *
+ * If true, wrap value type data into chunks. This decrease the performance,
+ * and is not required for interoperability with jdk 1.5, but is left in the
+ * implementation as the optional mode for solving possible interoperability
+ * problems with non-Sun CORBA implementations.
+ *
* The current implementation would accept both single chunk or multiple
- * chunks, but will always send a single chunk.
+ * chunks, but will always send a single chunk (if true) or unchunked data (if
+ * false).
*/
- public static boolean USE_CHUNKING = true;
+ public static boolean USE_CHUNKING = false;
/**
- * The first field in the value record. The last octet may contain
- * additional flags (vf_CODEBASE, vf_ID and vf_MULTIPLE_IDS). The tag
- * value is different for the indirections (vt_INDIRECTION) and
- * nulls (vt_NULL).
+ * The first field in the value record. The last octet may contain additional
+ * flags (vf_CODEBASE, vf_ID and vf_MULTIPLE_IDS). The tag value is different
+ * for the indirections (vt_INDIRECTION) and nulls (vt_NULL).
*/
public static final int vt_VALUE_TAG = 0x7fffff00;
/**
- * The value tag flag, indicating that the codebase URL is present
- * in the value tag record.
+ * The value tag flag, indicating that the codebase URL is present in the
+ * value tag record.
*/
public static final int vf_CODEBASE = 0x1;
/**
- * The value tag flag, indicating that a single repository id is present
- * in the value tag record.
+ * The value tag flag, indicating that a single repository id is present in
+ * the value tag record.
*/
public static final int vf_ID = 0x2;
/**
- * The value tag flag, indicating, that there are multiple repository
- * ids present in the record. If this flag is set, the flag vf_ID must
- * also be set, resulting the value of the least significant byte 0x6.
+ * The value tag flag, indicating, that there are multiple repository ids
+ * present in the record. If this flag is set, the flag vf_ID must also be
+ * set, resulting the value of the least significant byte 0x6.
*/
public static final int vf_MULTIPLE_IDS = 0x4;
/**
* The value tag flag, indicating the presence of chunking. Each chunk is
- * preceeded by a positive int, indicating the number of bytes in the chunk.
- * A sequence of chunks is terminated by a non positive int.
+ * preceeded by a positive int, indicating the number of bytes in the chunk. A
+ * sequence of chunks is terminated by a non positive int.
*/
public static final int vf_CHUNKING = 0x8;
/**
* The indirection tag value. Such tag must be followed by the CORBA long,
* indicating the offset in the CORBA message, where the indirected
- * information is present. This offset is assumed zero at the position
- * where the mentioned CORBA long starts and can refer both forward
- * (positive values) and backward (negative values).
+ * information is present. This offset is assumed zero at the position where
+ * the mentioned CORBA long starts and can refer both forward (positive
+ * values) and backward (negative values).
*/
public static final int vt_INDIRECTION = 0xffffffff;
/**
- * This tag value means that the value object being transferred is equal
- * to null.
+ * This tag value means that the value object being transferred is equal to
+ * null.
*/
public static final int vt_NULL = 0x0;
/**
- * Read the value base from the given input stream. Determines the
- * required class from the repository id. This includes operations
- * that are not required when an unitialised instance or at least
- * class of the value type is known. Hence it may be faster to use
- * the alternative methods, read(InputStream, Class) or
- * read(InputStream, Serializable).
- *
+ * The size of CORBA long (java int).
+ */
+ static final int INT_SIZE = 4;
+
+ /**
+ * The String value helper (one instance is sufficient).
+ */
+ public static final WStringValueHelper m_StringValueHelper = new WStringValueHelper();
+
+ /**
+ * An instance of the value handler.
+ */
+ static ValueHandler handler = Util.createValueHandler();
+
+ /**
+ * Read the value base from the given input stream. Determines the required
+ * class from the repository id. This includes operations that are not
+ * required when an unitialised instance or at least class of the value type
+ * is known. Hence it may be faster to use the alternative methods,
+ * read(InputStream, Class) or read(InputStream, Serializable).
+ *
* @param input a stream to read from.
- *
+ * @param repository_id a repository id of the object being read, may be null.
+ *
* @return the loaded value.
- *
+ *
* @throws MARSHAL if the reading has failed due any reason.
*/
public static Serializable read(InputStream input)
{
- // Explicitly prevent the stream from closing as we may need
- // to read the subsequent bytes as well. Stream may be auto-closed
- // in its finalizer.
+ return read(input, (String) null);
+ }
+
+ /**
+ * Read the value base from the given input stream. Determines the required
+ * class from the repository id. This includes operations that are not
+ * required when an unitialised instance or at least class of the value type
+ * is known. Hence it may be faster to use the alternative methods,
+ * read(InputStream, Class) or read(InputStream, Serializable).
+ *
+ * @param an_input a stream to read from.
+ * @param repository_id a repository id of the object being read, may be null.
+ *
+ * @return the loaded value.
+ *
+ * @throws MARSHAL if the reading has failed due any reason.
+ */
+ public static Serializable read(InputStream input, String repository_id)
+ {
try
{
+ final int position = getCurrentPosition(input);
// We may need to jump back if the value is read via value factory.
input.mark(512);
@@ -154,18 +193,13 @@ public abstract class Vio
String codebase = null;
String[] ids = null;
- String id = null;
-
- // The existing implementing object.
- java.lang.Object ox = null;
+ String id = repository_id;
// Check for the agreed null value.
if (value_tag == vt_NULL)
return null;
else if (value_tag == vt_INDIRECTION)
-
- // TODO FIXME Implement support for indirections.
- throw new NO_IMPLEMENT("Indirections unsupported");
+ return readIndirection(input);
else
{
// Read the value.
@@ -174,152 +208,173 @@ public abstract class Vio
// The codebase is present. The codebase is a space
// separated list of URLs from where the implementing
// code can be downloaded.
- codebase = input.read_string();
+ codebase = read_string(input);
}
if ((value_tag & vf_MULTIPLE_IDS) != 0)
{
// Multiple supported repository ids are present.
- ids = StringSeqHelper.read(input);
- for (int i = 0; (i < ids.length) && (ox == null); i++)
- {
- ox = ObjectCreator.Idl2Object(ids [ i ]);
-
- if (ox == null)
- {
- // Try to find the value factory.
- ValueFactory f =
- ((org.omg.CORBA_2_3.ORB) input.orb()).lookup_value_factory(ids [ i ]);
-
- if (f != null)
- {
- // Reset, as the value factory reads from beginning.
- input.reset();
- return f.read_value((org.omg.CORBA_2_3.portable.InputStream) input);
- }
- }
- }
+ ids = read_string_array(input);
}
else if ((value_tag & vf_ID) != 0)
{
// Single supported repository id is present.
- id = input.read_string();
- ox = ObjectCreator.Idl2Object(id);
-
- if (ox == null)
- {
- // Try to find the value factory.
- ValueFactory f =
- ((org.omg.CORBA_2_3.ORB) input.orb()).lookup_value_factory(id);
-
- if (f != null)
- {
- input.reset();
- return f.read_value((org.omg.CORBA_2_3.portable.InputStream) input);
- }
- }
+ id = read_string(input);
}
}
- if (ox == null)
- throw new MARSHAL("Unable to instantiate the value type");
+ BoxedValueHelper helper = getHelper(null, id);
+ // The existing implementing object.
+ java.lang.Object ox = null;
+
+ if (helper != null)
+ ox = null; // Helper will care about the instantiating.
+ else if (id.equals(WStringValueHelper.id()))
+ helper = m_StringValueHelper;
else
- {
- read_instance(input, ox, value_tag, null);
- return (Serializable) ox;
- }
+ ox = createInstance(id, ids, codebase);
+ return (Serializable) read_instance(input, position, ox, value_tag,
+ helper, id, ids, codebase);
}
catch (Exception ex)
{
- throw new MARSHAL(ex + ":" + ex.getMessage());
+ MARSHAL m = new MARSHAL();
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
}
}
/**
- * Read the value base from the given input stream when
- * the value base class is available. Hence there is no need
- * to guess it from the repository id.
- *
+ * Read the value base from the given input stream when the value base class
+ * is available. Hence there is no need to guess it from the repository id.
+ *
* @param input a stream to read from.
* @param value_class the class of the value being read.
- *
+ *
* @return the loaded value.
- *
+ *
* @throws MARSHAL if the reading has failed due any reason.
*/
public static Serializable read(InputStream input, Class value_class)
{
- // Explicitly prevent the stream from closing as we may need
- // to read the subsequent bytes as well. Stream may be auto-closed
- // in its finalizer.
+ final int position = getCurrentPosition(input);
+
+ String id = null;
+ String[] ids = null;
+ String codebase = null;
+
try
{
int value_tag = input.read_long();
checkTag(value_tag);
- // The existing implementing object.
- java.lang.Object ox = value_class.newInstance();
-
// Check for the agreed null value.
if (value_tag == vt_NULL)
return null;
else if (value_tag == vt_INDIRECTION)
-
- // TODO FIXME Implement support for indirections.
- throw new NO_IMPLEMENT("Indirections unsupported");
+ return readIndirection(input);
else
{
// Read the value.
if ((value_tag & vf_CODEBASE) != 0)
{
- // The codebase is present, but skip it.
- input.read_string();
+ // The codebase is present.
+ codebase = read_string(input);
}
if ((value_tag & vf_MULTIPLE_IDS) != 0)
{
- // Multiple supported repository ids are present, but skip them.
- StringSeqHelper.read(input);
+ // Multiple supported repository ids are present.
+ ids = read_string_array(input);
}
else if ((value_tag & vf_ID) != 0)
{
- // Single supported repository id is present, but skip it.
- input.read_string();
+ // Single supported repository id is present.
+ id = read_string(input);
}
}
- read_instance(input, ox, value_tag, null);
+ BoxedValueHelper vHelper = id != null ? getHelper(value_class, id)
+ : getHelper(value_class, ids);
+
+ java.lang.Object ox;
+
+ if (vHelper == null)
+ {
+ try
+ {
+ ox = createInstance(id, ids, codebase);
+ }
+ catch (Exception e)
+ {
+ ox = null;
+ }
+
+ if (ox != null)
+ {
+ if (value_class != null
+ && !value_class.isAssignableFrom(ox.getClass()))
+ {
+ MARSHAL m = new MARSHAL(ox.getClass() + " is not a "
+ + value_class.getName());
+ m.minor = Minor.ClassCast;
+ throw m;
+ }
+ }
+ }
+ else
+ ox = null;
+
+ ox = read_instance(input, position, ox, value_tag, vHelper, id, ids,
+ codebase);
return (Serializable) ox;
}
+ catch (MARSHAL m)
+ {
+ throw m;
+ }
+ catch (SystemException sysEx)
+ {
+ // OK.
+ throw sysEx;
+ }
catch (Exception ex)
{
- throw new MARSHAL(ex + ":" + ex.getMessage());
+ MARSHAL m = new MARSHAL("Cant read " + value_class);
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
}
}
/**
- * Read the value base from the given input stream when
- * the unitialised instance is available. Hence there is no need
- * to guess the class from the repository id and then to instantiate
- * an instance.
- *
+ * Read the value base from the given input stream when the unitialised
+ * instance is available. Hence there is no need to guess the class from the
+ * repository id and then to instantiate an instance.
+ *
* @param input a stream to read from.
- *
- * @param value_instance an pre-created instance of the value. If the
- * helper is not null, this parameter is ignored an should be null.
- *
- * @param helper a helper to create an instance and read the object-
- * specific part of the record. If the value_instance is used instead,
- * this parameter should be null.
- *
+ *
+ * @param value_instance an pre-created instance of the value. If the helper
+ * is not null, this parameter is ignored an should be null.
+ *
+ * @param helper a helper to create an instance and read the object- specific
+ * part of the record. If the value_instance is used instead, this parameter
+ * should be null.
+ *
* @return the loaded value.
- *
+ *
* @throws MARSHAL if the reading has failed due any reason.
*/
public static Object read(InputStream input, Object value_instance,
- Object helper
- )
+ BoxedValueHelper helper)
{
+ final int position = getCurrentPosition(input);
+
+ String id = null;
+ String[] ids = null;
+ String codebase = null;
+
try
{
int value_tag = input.read_long();
@@ -329,207 +384,396 @@ public abstract class Vio
if (value_tag == vt_NULL)
return null;
else if (value_tag == vt_INDIRECTION)
-
- // TODO FIXME Implement support for indirections.
- throw new NO_IMPLEMENT("Indirections unsupported");
+ return readIndirection(input);
else
{
// Read the value.
if ((value_tag & vf_CODEBASE) != 0)
{
- // The codebase is present, but skip it.
- input.read_string();
+ // The codebase is present.
+ codebase = read_string(input);
}
if ((value_tag & vf_MULTIPLE_IDS) != 0)
{
- // Multiple supported repository ids are present, but skip them.
- StringSeqHelper.read(input);
+ // Multiple supported repository ids are present.
+ ids = read_string_array(input);
}
else if ((value_tag & vf_ID) != 0)
{
- // Single supported repository id is present, but skip it.
- input.read_string();
+ // Single supported repository id is present.
+ id = read_string(input);
}
}
- value_instance =
- read_instance(input, value_instance, value_tag, helper);
+ Class value_class = value_instance == null ? null
+ : value_instance.getClass();
+
+ if (helper == null)
+ helper = id != null ? getHelper(value_class, id) : getHelper(
+ value_class, ids);
+
+ value_instance = read_instance(input, position, value_instance,
+ value_tag, helper, id, ids, codebase);
return value_instance;
}
catch (Exception ex)
{
- throw new MARSHAL(ex + ":" + ex.getMessage());
+ MARSHAL m = new MARSHAL();
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
}
}
/**
- * Read using provided boxed value helper. This method expects
- * the full value type header, followed by contents, that are
- * delegated to the provided helper. It handles null.
- *
+ * Read using provided boxed value helper. This method expects the full value
+ * type header, followed by contents, that are delegated to the provided
+ * helper. It handles null.
+ *
* @param input the stream to read from.
- * @param helper the helper that reads the type-specific part of
- * the content.
- *
- * @return the value, created by the helper, or null if the
- * header indicates that null was previously written.
+ * @param helper the helper that reads the type-specific part of the content.
+ *
+ * @return the value, created by the helper, or null if the header indicates
+ * that null was previously written.
*/
- public static Serializable read(InputStream input, Object helper)
+ public static Serializable read(InputStream input, BoxedValueHelper helper)
{
return (Serializable) read(input, null, helper);
}
/**
- * Fill in the instance fields by the data from the input stream.
- * The method assumes that the value header, if any, is already
- * behind. The information from the stream is stored into the
- * passed ox parameter.
- *
+ * Fill in the instance fields by the data from the input stream. The method
+ * assumes that the value header, if any, is already behind. The information
+ * from the stream is stored into the passed ox parameter.
+ *
* @param input an input stream to read from.
- *
+ *
* @param value a pre-instantiated value type object, must be either
- * Streamable or CustomMarshal. If the helper is used, this parameter
- * is ignored and should be null.
- *
+ * Streamable or CustomMarshal. If the helper is used, this parameter is
+ * ignored and should be null.
+ *
* @param value_tag the tag that must be read previously.
- * @param helper the helper for read object specific part; may be
- * null to read in using other methods.
- *
+ * @param helper the helper for read object specific part; may be null to read
+ * in using other methods.
+ *
* @return the value that was read.
*/
- private static Object read_instance(InputStream input, Object value,
- int value_tag, Object helper
- )
+ static Object read_instance(InputStream input, final int position,
+ Object value, int value_tag, BoxedValueHelper helper, String id,
+ String[] ids, String codebase)
{
+ if (helper != m_StringValueHelper && id != null)
+ if (id.equals(StringValueHelper.id()))
+ {
+ value = null;
+ helper = m_StringValueHelper;
+ }
+
try
{
if ((value_tag & vf_CHUNKING) != 0)
{
- ByteArrayOutputStream bout = null;
- int n = -1;
-
- // Read all chunks.
- int chunk_size = input.read_long();
- if (chunk_size < 0)
- throw new MARSHAL("Invalid first chunk size " + chunk_size);
-
- byte[] r = new byte[ chunk_size ];
-
- while (chunk_size > 0)
- {
- if (r.length < chunk_size)
- r = new byte[ chunk_size + 256 ];
-
- n = 0;
- reading:
- while (n < chunk_size)
- n += input.read(r, n, r.length - n);
-
- // Read the size of the next chunk.
- chunk_size = input.read_long();
-
- // If the value is non negative, there is more than one chunk.
- // Accumulate chunks in the buffer.
- // The last chunk (or the only chunk, if only one chunk is
- // present) is not written in the buffer. It is stored in the
- // array r, avoiding unnecessary buffer operations.
- if (chunk_size > 0)
- {
- bout = new ByteArrayOutputStream(2 * chunk_size);
- bout.write(r, 0, chunk_size);
- }
- }
+ BufferedCdrOutput output = createBuffer(input, 1024);
+ // Read the current (not a nested one) value in this spec case.
+ readNestedValue(value_tag, input, output, -1);
+ BufferredCdrInput ci = new BufferredCdrInput(output.buffer.getBuffer());
+ ci.setRunTime(output.getRunTime());
- if (bout != null)
- {
- // More than one chunk was present.
- // Add the last chunk.
- bout.write(r, 0, n);
- input = new noHeaderInput(bout.toByteArray());
- }
- else
- {
- // Only one chunk was present.
- input = new noHeaderInput(r);
- }
+ input = new HeadlessInput(ci, input);
}
else
{
- if (input instanceof cdrBufInput)
+ if (input instanceof BufferredCdrInput)
{
// Highly probable case.
- input =
- new noHeaderInput(((cdrBufInput) input).buffer.getBuffer());
+ input = new HeadlessInput((BufferredCdrInput) input, null);
+ }
+ else if (input instanceof HeadlessInput)
+ {
+ // There is no need to instantiate one more HeadlessInput
+ // as we can just reset.
+ ((HeadlessInput) input).subsequentCalls = false;
}
else
{
- cdrBufOutput bout = new cdrBufOutput();
+ BufferedCdrOutput bout = new BufferedCdrOutput();
int c;
while ((c = input.read()) >= 0)
bout.write((byte) c);
- input = new noHeaderInput(bout.buffer.toByteArray());
+ input = new HeadlessInput(
+ (BufferredCdrInput) bout.create_input_stream(), input);
}
}
}
catch (IOException ex)
{
MARSHAL m = new MARSHAL("Unable to read chunks");
+ m.minor = Minor.Value;
m.initCause(ex);
throw m;
}
- // The user-defines io operations are implemented.
- if (value instanceof CustomMarshal)
+ return readValue(input, position, value, helper, id, ids, codebase);
+ }
+
+ /**
+ * Create a buffer, inheriting critical settings from the passed input stream.
+ */
+ private static BufferedCdrOutput createBuffer(InputStream input, int proposed_size)
+ {
+ BufferedCdrOutput bout;
+ bout = new BufferedCdrOutput(2 * proposed_size + 256);
+
+ if (input instanceof BufferredCdrInput)
{
- CustomMarshal marsh = (CustomMarshal) value;
- try
+ BufferredCdrInput in = (BufferredCdrInput) input;
+ bout.setBigEndian(in.isBigEndian());
+ }
+
+ if (input instanceof gnuValueStream)
+ bout.setRunTime(((gnuValueStream) input).getRunTime());
+ else
+ bout.setRunTime(new gnuRuntime(null, null));
+ return bout;
+ }
+
+ /**
+ * Read the chunked nested value from the given input stream, transferring the
+ * contents to the given output stream.
+ *
+ * @param value_tag the value tag of the value being read.
+ * @param input the input stream from where the remainder of the nested value
+ * must be read.
+ * @param output the output stream where the unchunked nested value must be
+ * copied.
+ *
+ * @return the tag that ended the nested value.
+ */
+ public static int readNestedValue(int value_tag, InputStream input,
+ BufferedCdrOutput output, int level)
+ throws IOException
+ {
+ String id = null;
+ if (level < -1)
+ {
+ // For the first level, this information is already behind.
+ output.write_long(value_tag - vf_CHUNKING);
+
+ // The nested value should be aways chunked.
+ if ((value_tag & vf_CHUNKING) == 0)
+ {
+ MARSHAL m = new MARSHAL("readNestedValue: must be chunked");
+ m.minor = Minor.Chunks;
+ throw m;
+ }
+ else if (value_tag == vt_NULL)
+ {
+ MARSHAL m = new MARSHAL("readNestedValue: nul");
+ m.minor = Minor.Chunks;
+ throw m;
+ }
+ else if (value_tag == vt_INDIRECTION)
{
- marsh.unmarshal((DataInputStream) input);
+ MARSHAL m = new MARSHAL("readNestedValue: indirection");
+ m.minor = Minor.Chunks;
+ throw m;
}
- catch (ClassCastException ex)
+ else
{
- incorrect_plug_in(ex);
+ // Read the value.
+ if ((value_tag & vf_CODEBASE) != 0)
+ {
+ String codebase = read_string(input);
+ write_string(output, codebase);
+ }
+
+ if ((value_tag & vf_MULTIPLE_IDS) != 0)
+ {
+ // Multiple supported repository ids are present.
+ String[] ids = read_string_array(input);
+ id = ids[0];
+ write_string_array(output, ids);
+ }
+ else if ((value_tag & vf_ID) != 0)
+ {
+ id = read_string(input);
+ write_string(output, id);
+ }
}
}
+
+ int n = -1;
+
+ // Read all chunks.
+ int chunk_size;
+
+ byte[] r = null;
+
+ while (true)
+ {
+ // Read the size of the next chunk or it may also be the
+ // header of the nested value.
+ chunk_size = input.read_long();
+
+ // End of chunk terminator.
+ if (chunk_size < 0 && chunk_size >= level)
+ return chunk_size;
+ else if (chunk_size >= 0x7FFFFF00)
+ {
+ int onInput = getCurrentPosition(input) - 4;
+ int onOutput = output.getPosition();
+ output.getRunTime().redirect(onInput, onOutput);
+ // Value over 0x7FFFFF00 indicates that the nested value
+ // starts here. Read the nested value, storing it into the output.
+ // First parameter is actually the value tag.
+ chunk_size = readNestedValue(chunk_size, input, output, level - 1);
+ if (chunk_size < 0 && chunk_size >= level)
+ return chunk_size;
+ }
+ else
+ {
+ // The chunk follows.
+ if (r == null || r.length < chunk_size)
+ r = new byte[chunk_size + 256];
+
+ n = 0;
+ reading: while (n < chunk_size)
+ n += input.read(r, n, chunk_size - n);
+ output.write(r, 0, n);
+ }
+ }
+ }
+
+ /**
+ * Read the value (the header must be behind).
+ */
+ public static Serializable readValue(InputStream input, final int position,
+ Object value, BoxedValueHelper helper, String id, String[] ids,
+ String codebase)
+ {
+ gnuRuntime g;
+ gnuValueStream c = ((gnuValueStream) input);
+ if (c.getRunTime() == null)
+ {
+ g = new gnuRuntime(codebase, value);
+ c.setRunTime(g);
+ }
+ else
+ {
+ g = c.getRunTime();
+ g.addCodeBase(codebase);
+ g.target = (Serializable) value;
+ }
+ if (value != null)
+ g.objectWritten(value, position);
+
+ if (input instanceof HeadlessInput)
+ ((HeadlessInput) input).subsequentCalls = false;
+
+ boolean ok = true;
+
+ // The user-defined io operations are implemented.
+ if (value instanceof CustomMarshal)
+ {
+ CustomMarshal marsh = (CustomMarshal) value;
+ marsh.unmarshal((DataInputStream) input);
+ }
else
// The IDL-generated io operations are implemented.
if (value instanceof Streamable)
{
((Streamable) value)._read(input);
}
- else if (helper instanceof BoxedValueHelper)
- value = ((BoxedValueHelper) helper).read_value(input);
- else if (helper instanceof ValueFactory)
- value =
- ((ValueFactory) helper).read_value((org.omg.CORBA_2_3.portable.InputStream) input);
+ else if (helper != null)
+ {
+ // If helper is non-null the value should normally be null.
+ value = helper.read_value(input);
+ g.objectWritten(value, position);
+ }
else
+ {
+ ok = false;
+ ValueFactory factory = null;
+ org.omg.CORBA_2_3.ORB orb = (org.omg.CORBA_2_3.ORB) input.orb();
- // Stating the interfaces that the USER should use.
- throw new MARSHAL("The " + value.getClass().getName() +
- " must implement either StreamableValue or CustomValue."
- );
+ if (id != null)
+ factory = orb.lookup_value_factory(id);
- // The negative end of state marker is expected from OMG standard.
- // If the chunking is used, this marker is already extracted.
- if ((value_tag & vf_CHUNKING) == 0)
+ if (factory == null && ids != null)
+ {
+ for (int i = 0; i < ids.length && factory == null; i++)
+ {
+ factory = orb.lookup_value_factory(ids[i]);
+ }
+ }
+
+ if (factory != null)
+ {
+ value = factory.read_value((org.omg.CORBA_2_3.portable.InputStream) input);
+ ok = true;
+ }
+ }
+
+ if (!ok && value instanceof Serializable)
+ // Delegate to ValueHandler
{
- int eor = input.read_long();
- if (eor >= 0)
- throw new MARSHAL("End of state marker has an invalid value " + eor);
+ if (ids != null && ids.length > 0)
+ id = ids[0];
+
+ value = handler.readValue(input, position, value.getClass(), id, g);
+ ok = true;
}
- return value;
+ if (!ok)
+ {
+ if (value != null)
+ {
+ MARSHAL m = new MARSHAL(value.getClass().getName()
+ + " must be Streamable, CustomMarshal or Serializable");
+ m.minor = Minor.UnsupportedValue;
+ throw m;
+ }
+ else
+ {
+ MARSHAL m = new MARSHAL("Unable to instantiate " + id + ":" + list(ids)
+ + " helper " + helper);
+ m.minor = Minor.UnsupportedValue;
+ throw m;
+ }
+ }
+ else
+ return (Serializable) value;
+ }
+
+ /**
+ * Conveniency method to list ids in exception reports.
+ */
+ static String list(String[] s)
+ {
+ if (s == null)
+ return "null";
+ else
+ {
+ StringBuffer b = new StringBuffer("{");
+ for (int i = 0; i < s.length; i++)
+ {
+ b.append(s[i]);
+ b.append(" ");
+ }
+ b.append("}");
+ return b.toString();
+ }
}
/**
* Write the value base into the given stream.
- *
+ *
* @param output a stream to write to.
- *
+ *
* @param value a value type object, must be either Streamable or
* CustomMarshal.
- *
+ *
* @throws MARSHAL if the writing failed due any reason.
*/
public static void write(OutputStream output, Serializable value)
@@ -537,45 +781,82 @@ public abstract class Vio
// Write null if this is a null value.
if (value == null)
output.write_long(vt_NULL);
+ else if (value instanceof String)
+ write(output, value, m_StringValueHelper);
else
- write(output, value, ObjectCreator.toIDL(value.getClass().getName()));
- }
-
- /**
- * Write the value base into the given stream, stating that it is an
- * instance of the given class. The written record has no repository
- * id and requires to supply a class or initialised instance for reading
- * rather than an actual class it is.
- *
- * This results writing a different repository id.
- *
- * If the passed value implements the {@link CustomMarshal},
- * the helper uses {@link CustomMarshal#marshal}
- * to write the content in a user defined way. Otherwise,
- * this implementation initialises the {@link ObjectOutputStream}
- * and writes through it.
- *
+ write(output, value, value.getClass());
+ }
+
+ /**
+ * Write the value base into the given stream, stating that it is an instance
+ * of the given class.
+ *
* @param output a stream to write to.
- *
+ *
* @param value a value to write.
- *
+ *
* @throws MARSHAL if the writing failed due any reason.
*/
public static void write(OutputStream output, Serializable value,
- Class substitute
- )
+ Class substitute)
{
// Write null if this is a null value.
if (value == null)
output.write_long(vt_NULL);
+ else if (value instanceof String || substitute == String.class)
+ writeString(output, value);
+ else
+ {
+ String vId = ObjectCreator.getRepositoryId(value.getClass());
+ if (substitute == null || value.getClass().equals(substitute))
+ write_instance(output, value, vId, getHelper(value.getClass(), vId));
+ else
+ {
+ String vC = ObjectCreator.getRepositoryId(substitute);
+ String[] ids = new String[] { vId, vC };
+ BoxedValueHelper h = getHelper(substitute.getClass(), ids);
+ // If the helper is available, it is also responsible for
+ // providing the repository Id. Otherwise, write both
+ // ids.
+ if (h == null)
+ write_instance(output, value, ids, null);
+ else
+ write_instance(output, value, h.get_id(), null);
+ }
+ }
+ }
+ /**
+ * Write the value base into the given stream, supplementing it with an array
+ * of the provided repository ids plus the repository id, derived from the
+ * passed value.
+ *
+ * @param output a stream to write to.
+ *
+ * @param value a value to write.
+ *
+ * @throws MARSHAL if the writing failed due any reason.
+ */
+ public static void write(OutputStream output, Serializable value,
+ String[] multiple_ids)
+ {
+ // Write null if this is a null value.
+ if (value == null)
+ output.write_long(vt_NULL);
else
- write(output, value, ObjectCreator.toIDL(substitute.getName()));
+ {
+ String[] ids = new String[multiple_ids.length + 1];
+ ids[0] = ObjectCreator.getRepositoryId(value.getClass());
+ System.arraycopy(multiple_ids, 0, ids, 1, multiple_ids.length);
+ BoxedValueHelper h = getHelper(value.getClass(), ids);
+ write_instance(output, value, ids, h);
+ }
}
/**
- * Write value when its repository Id is explicitly given.
- *
+ * Write value when its repository Id is explicitly given. Only this Id is
+ * written, the type of value is not taken into consideration.
+ *
* @param output an output stream to write into.
* @param value a value to write.
* @param id a value repository id.
@@ -585,172 +866,608 @@ public abstract class Vio
if (value == null)
output.write_long(vt_NULL);
else
- write_instance(output, value, id, null);
+ write_instance(output, value, id, getHelper(value.getClass(), id));
}
/**
- * Write standard value type header, followed by contents, produced
- * by the boxed value helper.
- *
+ * Write standard value type header, followed by contents, produced by the
+ * boxed value helper.
+ *
* @param output the stream to write to.
* @param value the value to write, can be null.
- * @param helper the helper that writes the value content if it is
- * not null.
+ * @param helper the helper that writes the value content if it is not null
+ * (must be provided for this method).
*/
public static void write(OutputStream output, Serializable value,
- Object helper
- )
+ BoxedValueHelper helper)
{
+ if (helper == null)
+ throw new AssertionError("Helper must be provided");
if (value == null)
output.write_long(vt_NULL);
else
+ write_instance(output, value, helper.get_id(), helper);
+ }
+
+ /**
+ * Write the parameter that is surely a string and not null.
+ */
+ private static void writeString(OutputStream output, Serializable string)
+ {
+ write_instance(output, string, m_StringValueHelper.get_id(),
+ m_StringValueHelper);
+ }
+
+ /**
+ * Write value when its repository Id is explicitly given. Does not handle
+ * null.
+ *
+ * @param output an output stream to write into.
+ * @param value a value to write.
+ * @param id a value repository id (can be either single string or string
+ * array).
+ * @param helper a helper, writing object - specifical part. Can be null if
+ * the value should be written using other methods.
+ */
+ static void write_instance(OutputStream output, Serializable value,
+ Object ids, BoxedValueHelper helper)
+ {
+ gnuValueStream rout = null;
+ gnuRuntime runtime = null;
+
+ try
{
- String id;
+ if (output instanceof gnuValueStream)
+ {
+ int position;
+ rout = (gnuValueStream) output;
+ runtime = rout.getRunTime();
+
+ if (runtime == null)
+ {
+ runtime = new gnuRuntime(null, value);
+ rout.setRunTime(runtime);
+ rout.getRunTime().objectWritten(value,
+ position = rout.getPosition());
+ }
+ else if (runtime.target == value)
+ {
+ if (!writeSelf(output, value))
+ throw new InternalError("Recursive helper call for "
+ + value.getClass().getName());
+ return;
+ }
+ else
+ {
+ position = runtime.isWrittenAt(value);
+ if (position >= 0)
+ {
+ // The object was already written.
+ output.write_long(vt_INDIRECTION);
+ output.write_long(position - rout.getPosition());
+ // Replacing object write data by indirection reference.
+ return;
+ }
+ else
+ {
+ runtime.objectWritten(value, position = rout.getPosition());
+ }
+ }
+ }
+
+ int value_tag = vt_VALUE_TAG;
+
+ if (ids instanceof String)
+ value_tag |= vf_ID;
+ else if (ids instanceof String[])
+ // OMG standard requires to set both flags.
+ value_tag |= vf_MULTIPLE_IDS | vf_ID;
- if (helper instanceof BoxedValueHelper)
- id = ((BoxedValueHelper) helper).get_id();
+ int chunkSizeLocation;
+
+ OutputStream outObj;
+
+ if (USE_CHUNKING)
+ {
+ // Wrap the value being written into one chunk (makes sense only for
+ // compatibility reasons).
+ outObj = output;
+ value_tag |= vf_CHUNKING;
+ }
+ else
+ outObj = output;
+
+ output.write_long(value_tag);
+
+ if ((value_tag & vf_MULTIPLE_IDS) != 0)
+ write_string_array(output, (String[]) ids);
+ else if ((value_tag & vf_ID) != 0)
+ write_string(output, (String) ids);
+
+ if (USE_CHUNKING)
+ {
+ // So far, write 0x55555555 instead of the chunk size (alignment may
+ // take place).
+ output.write_long(0x55555555);
+ // If the chunking is involved, the chunk size must be written here.
+ chunkSizeLocation = rout.getPosition() - INT_SIZE;
+ }
else
- id = "";
+ // Not in use for this case.
+ chunkSizeLocation = -1;
+
+ writeValue(outObj, value, helper);
- write_instance(output, value, id, helper);
+ if (USE_CHUNKING)
+ {
+ // Write the chunk size where the place for it was reserved.
+ int chunkSize = rout.getPosition() - chunkSizeLocation - INT_SIZE;
+ int current = rout.getPosition();
+ rout.seek(chunkSizeLocation);
+ output.write_long(chunkSize);
+ rout.seek(current);
+
+ // The end of record marker.
+ output.write_long(-1);
+ }
+ }
+ finally
+ {
+ if (runtime != null)
+ runtime.target = null;
}
}
/**
- * Write value when its repository Id is explicitly given.
- * Does not handle null.
- *
- * @param output an output stream to write into.
- * @param value a value to write.
- * @param id a value repository id.
- * @param helper a helper, writing object - specifica part. Can be null
- * if the value should be written unsing other methods.
+ * Write value (after header).
*/
- private static void write_instance(OutputStream output, Serializable value,
- String id, Object helper
- )
+ static void writeValue(OutputStream output, Serializable value,
+ BoxedValueHelper helper)
{
- // This implementation always writes a single repository id.
- // It never writes multiple repository ids and currently does not use
- // a codebase.
- int value_tag = vt_VALUE_TAG | vf_ID;
+ ((gnuValueStream) output).getRunTime().target = value;
+ if (helper != null)
+ helper.write_value(output, value);
+ else if (!writeSelf(output, value))
+ {
+ // Try to find helper via class loader.
+ boolean ok = false;
- OutputStream outObj;
- cdrBufOutput out = null;
+ if (!ok)
+ {
+ if (output instanceof BufferedCdrOutput)
+ {
+ BufferedCdrOutput b = (BufferedCdrOutput) output;
+ if (b.runtime == null)
+ b.runtime = new gnuRuntime(null, value);
+ }
- if (USE_CHUNKING)
+ handler.writeValue(output, value);
+ }
+ }
+ }
+
+ /**
+ * Try to write value supposing that it implements self-streamable interfaces.
+ * Return false if it does not or true on success.
+ */
+ static boolean writeSelf(OutputStream output, Serializable value)
+ {
+ // User defined write method is present.
+ if (value instanceof CustomMarshal)
{
- out = new cdrBufOutput();
- out.setOrb(output.orb());
- outObj = out;
- value_tag |= vf_CHUNKING;
+ ((CustomMarshal) value).marshal((DataOutputStream) output);
+ return true;
}
- else
- outObj = output;
+ else if (value instanceof Streamable)
+ {
+ ((Streamable) value)._write(output);
+ return true;
+ }
+ return false;
+ }
- output.write_long(value_tag);
- output.write_string(id);
+ /**
+ * Read the indirection data and return the object that was already written to
+ * this stream.
+ *
+ * @param an_input the input stream, must be BufferredCdrInput.
+ */
+ static Serializable readIndirection(InputStream an_input)
+ {
+ if (!(an_input instanceof gnuValueStream))
+ throw new NO_IMPLEMENT(gnuValueStream.class.getName()
+ + " expected as parameter");
- if (helper instanceof BoxedValueHelper)
+ gnuValueStream in = (gnuValueStream) an_input;
+
+ int current_pos = in.getPosition();
+
+ int offset = an_input.read_long();
+ if (offset > -INT_SIZE)
{
- ((BoxedValueHelper) helper).write_value(outObj, value);
+ MARSHAL m = new MARSHAL("Indirection tag refers to " + offset
+ + " (must be less than -" + INT_SIZE + ")");
+ m.minor = Minor.Offset;
+ throw m;
}
- else
- // User defince write method is present.
- if (value instanceof CustomMarshal)
+
+ int stored_at = current_pos + offset;
+
+ if (in.getRunTime() == null)
+ {
+ MARSHAL m = new MARSHAL(stored_at + " offset " + offset + ": not written");
+ m.minor = Minor.Value;
+ throw m;
+ }
+
+ return (Serializable) in.getRunTime().isObjectWrittenAt(stored_at, offset);
+ }
+
+ /**
+ * Check the passed value tag for correctness.
+ *
+ * @param value_tag a tag to check, must be between 0x7fffff00 and 0x7fffffff
+ *
+ * @throws MARSHAL if the tag is outside this interval.
+ */
+ static void checkTag(int value_tag)
+ {
+ if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff)
+ && value_tag != vt_NULL && value_tag != vt_INDIRECTION)
+ {
+ MARSHAL m = new MARSHAL("Invalid value record, unsupported header tag: "
+ + value_tag + " (0x" + Integer.toHexString(value_tag) + ")");
+ m.minor = Minor.ValueHeaderTag;
+ throw m;
+ }
+
+ if ((value_tag & vf_MULTIPLE_IDS) != 0 && (value_tag & vf_ID) == 0)
{
+ MARSHAL m = new MARSHAL("Invalid value record header flag combination (0x"
+ + Integer.toHexString(value_tag) + ")");
+ m.minor = Minor.ValueHeaderFlags;
+ throw m;
+ }
+ }
+
+ /**
+ * Throw MARSHAL.
+ */
+ static void throwIt(String msg, String id1, String id2, Throwable e)
+ throws MARSHAL
+ {
+ MARSHAL m = new MARSHAL(msg + ":'" + id1 + "' versus '" + id2 + "'");
+ if (e != null)
+ m.initCause(e);
+ m.minor = Minor.Value;
+ throw m;
+ }
+
+ /**
+ * Load class by name and create the instance.
+ */
+ static Object createInstance(String id, String[] ids, String codebase)
+ {
+ Object o = null;
+
+ if (id != null)
+ o = _createInstance(id, codebase);
+
+ if (ids != null)
+ for (int i = 0; i < ids.length && o == null; i++)
+ o = _createInstance(ids[i], codebase);
+ return o;
+ }
+
+ static Object _createInstance(String id, String codebase)
+ {
+ if (id == null)
+ return null;
+ if (id.equals(StringValueHelper.id()))
+ return "";
+ StringTokenizer st = new StringTokenizer(id, ":");
+
+ String prefix = st.nextToken();
+ if (prefix.equalsIgnoreCase("IDL"))
+ return ObjectCreator.Idl2Object(id);
+ else if (prefix.equalsIgnoreCase("RMI"))
+ {
+ String className = st.nextToken();
+ String hashCode = st.nextToken();
+ String sid = null;
+ if (st.hasMoreElements())
+ sid = st.nextToken();
+
try
{
- ((CustomMarshal) value).marshal((DataOutputStream) outObj);
+ Class objectClass = Util.loadClass(className, codebase,
+ Vio.class.getClassLoader());
+
+ String rid = ObjectCreator.getRepositoryId(objectClass);
+
+ if (!rid.equals(id))
+ {
+ // If direct string comparison fails, compare by meaning.
+ StringTokenizer st2 = new StringTokenizer(rid, ":");
+ if (!st2.nextToken().equals("RMI"))
+ throw new InternalError("RMI format expected: '" + rid + "'");
+ if (!st2.nextToken().equals(className))
+ throwIt("Class name mismatch", id, rid, null);
+
+ try
+ {
+ long h1 = Long.parseLong(hashCode, 16);
+ long h2 = Long.parseLong(st2.nextToken(), 16);
+ if (h1 != h2)
+ throwIt("Hashcode mismatch", id, rid, null);
+
+ if (sid != null && st2.hasMoreTokens())
+ {
+ long s1 = Long.parseLong(hashCode, 16);
+ long s2 = Long.parseLong(st2.nextToken(), 16);
+ if (s1 != s2)
+ throwIt("serialVersionUID mismatch", id, rid, null);
+ }
+ }
+ catch (NumberFormatException e)
+ {
+ throwIt("Invalid hashcode or svuid format: ", id, rid, e);
+ }
+ }
+
+ // Low - level instantiation required here.
+ return instantiateAnyWay(objectClass);
}
- catch (ClassCastException ex)
+ catch (Exception ex)
{
- incorrect_plug_in(ex);
+ MARSHAL m = new MARSHAL("Unable to instantiate " + id);
+ m.minor = Minor.Instantiation;
+ m.initCause(ex);
+ throw m;
}
}
- else if (value instanceof Streamable)
+ else
+ throw new NO_IMPLEMENT("Unsupported prefix " + prefix + ":");
+ }
+
+ /**
+ * Read string, expecting the probable indirection.
+ */
+ static String read_string(InputStream input)
+ {
+ gnuValueStream g = (gnuValueStream) input;
+ int previous = g.getPosition();
+ int l = input.read_long();
+ if (l != vt_INDIRECTION)
{
- ((Streamable) value)._write(outObj);
+ g.seek(previous);
+ String s = input.read_string();
+ if (g.getRunTime() == null)
+ g.setRunTime(new gnuRuntime(null, null));
+ g.getRunTime().singleIdWritten(s, previous);
+ return s;
}
else
{
- // Try to find helper via class loader.
- boolean ok = false;
- try
+ gnuRuntime r = g.getRunTime();
+ int base = g.getPosition();
+ int delta = input.read_long();
+ if (r == null)
{
- Class helperClass = Class.forName(ObjectCreator.toHelperName(id));
-
- // It will be the helper for the encapsulated boxed value, not the
- // for the global boxed value type itself.
- Method write =
- helperClass.getMethod("write",
- new Class[]
- {
- org.omg.CORBA.portable.OutputStream.class, value.getClass()
- }
- );
- write.invoke(null, new Object[] { outObj, value });
- ok = true;
+ previous = g.getPosition();
+ g.seek(base + delta);
+ String indir = input.read_string();
+ g.seek(previous);
+ return indir;
}
- catch (Exception ex)
+ else
{
- ok = false;
+ return (String) r.isObjectWrittenAt(base + delta, delta);
}
+ }
+ }
- // Stating the interfaces that the USER should use.
- if (!ok)
- throw new MARSHAL("The " + value.getClass().getName() +
- " must implement either StreamableValue" + " or CustomValue."
- );
+ /**
+ * Read string array, expecting the probable indirection.
+ */
+ static String[] read_string_array(InputStream input)
+ {
+ gnuValueStream g = (gnuValueStream) input;
+ int previous = g.getPosition();
+ int l = input.read_long();
+ if (l != vt_INDIRECTION)
+ {
+ g.seek(previous);
+ String[] s = StringSeqHelper.read(input);
+ if (g.getRunTime() == null)
+ g.setRunTime(new gnuRuntime(null, null));
+ g.getRunTime().objectWritten(s, previous);
+ return s;
}
+ else
+ {
+ gnuRuntime r = g.getRunTime();
+ int base = g.getPosition();
+ int delta = input.read_long();
+ if (r == null)
+ {
+ previous = g.getPosition();
+ g.seek(base + delta);
+ String[] indir = StringSeqHelper.read(input);
+ g.seek(previous);
+ return indir;
+ }
+ else
+ {
+ return (String[]) r.isObjectWrittenAt(base + delta, delta);
+ }
+ }
+ }
- if (USE_CHUNKING)
+ /**
+ * Write repository Id, probably shared.
+ */
+ static void write_string(OutputStream output, String id)
+ {
+ if (output instanceof gnuValueStream)
{
- output.write_long(out.buffer.size());
- try
+ gnuValueStream b = (gnuValueStream) output;
+ if (b != null)
+ {
+ int written = b.getRunTime().idWrittenAt(id);
+ if (written >= 0)
+ {
+ // Reuse existing id record.
+ output.write_long(vt_INDIRECTION);
+ int p = b.getPosition();
+ output.write_long(written - p);
+ }
+ else
+ {
+ b.getRunTime().singleIdWritten(id, b.getPosition());
+ output.write_string(id);
+ }
+ }
+ }
+ else
+ output.write_string(id);
+ }
+
+ /**
+ * Write repository Id, probably shared.
+ */
+ static void write_string_array(OutputStream output, String[] ids)
+ {
+ if (output instanceof gnuValueStream)
+ {
+ gnuValueStream b = (gnuValueStream) output;
+ if (b != null)
{
- out.buffer.writeTo(output);
+ int written = b.getRunTime().idWrittenAt(ids);
+ if (written >= 0)
+ {
+ // Reuse existing id record.
+ output.write_long(vt_INDIRECTION);
+ int p = b.getPosition();
+ output.write_long(written - p);
+ }
+ else
+ {
+ b.getRunTime().multipleIdsWritten(ids, b.getPosition());
+ StringSeqHelper.write(output, ids);
+ }
}
- catch (IOException ex)
+ }
+ else
+ StringSeqHelper.write(output, ids);
+ }
+
+ /**
+ * Get the helper that could write the given object, or null if no pre-defined
+ * helper available for this object.
+ */
+ public static BoxedValueHelper getHelper(Class x, Object ids)
+ {
+ if (x != null && x.equals(String.class))
+ return m_StringValueHelper;
+ else if (x != null && x.isArray())
+ return new ArrayValueHelper(x);
+ else if (ids instanceof String)
+ return locateHelper((String) ids);
+ else if (ids instanceof String[])
+ {
+ String[] ia = (String[]) ids;
+ BoxedValueHelper h;
+ for (int i = 0; i < ia.length; i++)
{
- MARSHAL m = new MARSHAL();
- m.initCause(ex);
- throw m;
+ h = locateHelper(ia[i]);
+ if (h != null)
+ return h;
}
+ return null;
}
+ else
+ return null;
+ }
- // The end of record marker, required by OMG standard.
- output.write_long(-1);
+ /**
+ * Get the helper that could write the given object, or null if no pre-defined
+ * helper available for this object.
+ */
+ public static BoxedValueHelper getHelper(Class x, String id)
+ {
+ if (x != null && x.equals(String.class))
+ return m_StringValueHelper;
+ else if (x != null && x.isArray())
+ return new ArrayValueHelper(x);
+ else
+ return locateHelper(id);
}
/**
- * This can be called if the alternative CORBA implementation
- * is incorrectly plugged in.
- *
- * @throws NO_IMPLEMENT, always.
+ * Try to locate helper from the repository id.
*/
- static void incorrect_plug_in(Throwable ex) throws NO_IMPLEMENT
+ static BoxedValueHelper locateHelper(String id)
{
- NO_IMPLEMENT no = new NO_IMPLEMENT("Incorrect CORBA plug-in");
- no.initCause(ex);
- throw no;
+ if (id != null)
+ {
+ if (id.equals(m_StringValueHelper.get_id()))
+ return m_StringValueHelper;
+ else
+ // Try to locate helper for IDL type.
+ if (id.startsWith("IDL:"))
+ {
+ try
+ {
+ Class helperClass = ObjectCreator.findHelper(id);
+ if (BoxedValueHelper.class.isAssignableFrom(helperClass))
+ return (BoxedValueHelper) helperClass.newInstance();
+ else if (helperClass != null)
+ return new IDLTypeHelper(helperClass);
+ else
+ return null;
+ }
+ catch (Exception ex)
+ {
+ return null;
+ }
+ }
+ }
+ return null;
}
/**
- * Check the passed value tag for correctness.
- *
- * @param value_tag a tag to check, must be between 0x7fffff00 and 0x7fffffff
- *
- * @throws MARSHAL if the tag is outside this interval.
+ * Get the current position.
*/
- private static final void checkTag(int value_tag)
+ static int getCurrentPosition(InputStream x)
{
- if ((value_tag < 0x7fffff00 || value_tag > 0x7fffffff) &&
- value_tag != vt_NULL &&
- value_tag != vt_INDIRECTION
- )
- throw new MARSHAL("Invalid value record, unsupported header tag: " +
- value_tag
- );
+ if (x instanceof gnuValueStream)
+ return ((gnuValueStream) x).getPosition();
+ else
+ return 0;
+ }
+
+ /**
+ * Instantiate an instance of this class anyway; also in the case when it has
+ * no parameterless or any other constructor. The fields will be assigned
+ * while reading the class from the stream.
+ *
+ * @param clazz a class for that the instance should be instantiated.
+ */
+ public static Object instantiateAnyWay(Class clazz)
+ throws Exception
+ {
+ Class first_nonserial = clazz;
+
+ while (Serializable.class.isAssignableFrom(first_nonserial)
+ || Modifier.isAbstract(first_nonserial.getModifiers()))
+ first_nonserial = first_nonserial.getSuperclass();
+
+ final Class local_constructor_class = first_nonserial;
+
+ Constructor constructor = local_constructor_class.getDeclaredConstructor(new Class[0]);
+
+ return VMVio.allocateObject(clazz, constructor.getDeclaringClass(),
+ constructor);
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java b/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java
new file mode 100644
index 00000000000..774c92816ae
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java
@@ -0,0 +1,336 @@
+/* gnuRuntime.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.MARSHAL;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+/**
+ * Our implementation of the sending context runtime.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class gnuRuntime
+ extends LocalObject
+ implements org.omg.SendingContext.RunTime
+{
+ /**
+ * The data entry about the object that was written.
+ */
+ static class Entry
+ {
+ /**
+ * The stream position, where the object was written.
+ */
+ int at;
+
+ /**
+ * The object that was written.
+ */
+ Object object;
+
+ public String toString()
+ {
+ return object + "[" + at + "] "+object.getClass().getName();
+ }
+ }
+
+ /**
+ * The instruction that the actual object is stored at different location.
+ * Used when processing chunked data where positions shifts due removing the
+ * chunking tags.
+ */
+ static class Redirection
+ extends Entry
+ {
+ public String toString()
+ {
+ return "->" + at;
+ }
+ }
+
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * The history of the written objects, maps object to records. The different
+ * objects must be treated as different regardless that .equals returns.
+ */
+ private Map sh_objects = new IdentityHashMap();
+
+ /**
+ * The written repository Ids that can be shared.
+ */
+ private Map sh_ids = new TreeMap(new Comparator()
+ {
+ public int compare(Object a, Object b)
+ {
+ if (a instanceof String && b instanceof String)
+ // Comparing string with string.
+ return ((String) a).compareTo((String) b);
+ else if (a instanceof String[] && b instanceof String[])
+ {
+ // Comparing array with array.
+ String[] sa = (String[]) a;
+ String[] sb = (String[]) b;
+
+ if (sa.length != sb.length)
+ return sa.length - sb.length;
+ else
+ {
+ int c;
+ for (int i = 0; i < sa.length; i++)
+ {
+ c = sa[i].compareTo(sb[i]);
+ if (c != 0)
+ return c;
+ }
+ return 0;
+ }
+ }
+ else
+ // Comparing string with array.
+ return a instanceof String ? 1 : -1;
+ }
+ });
+
+ /**
+ * The history of the written objects, maps positions to records. The
+ * different objects must be treated as different regardless that .equals
+ * returns.
+ */
+ private Map positions = new HashMap();
+
+ /**
+ * The Codebase.
+ */
+ private String codebase;
+
+ /**
+ * The pre-created instance of the object being written (avoid
+ * re-instantiation).
+ */
+ public Serializable target;
+
+ /**
+ * Create Runtime.
+ *
+ * @param a_id a repository Id, if only one Id was specified in the stream.
+ * @param a_ids a repository Ids, if the multiple Ids were specified in te
+ * stream.
+ * @param a_codabase a codebase, if it was specified in the stream.
+ */
+ public gnuRuntime(String a_codebase, Object a_target)
+ {
+ if (a_target instanceof Serializable)
+ target = (Serializable) a_target;
+
+ codebase = a_codebase;
+ }
+
+ /**
+ * Mark the given object as written at the given position.
+ */
+ public void objectWritten(Object object, int at)
+ {
+ if (object == null || at < 0)
+ return; // No positional information provided.
+ if (sh_objects.containsKey(object))
+ throw new AssertionError("Repetetive writing of the same object "
+ + object + " at " + at + dump());
+
+ Entry e = new Entry();
+ e.at = at;
+ e.object = object;
+
+ sh_objects.put(object, e);
+ positions.put(new Integer(at), e);
+ }
+
+ /**
+ * Check if the object is already written.
+ *
+ * @return the position, at that the object is allready written or -1 if it is
+ * not yet written.
+ */
+ public int isWrittenAt(Object x)
+ {
+ Entry e = (Entry) sh_objects.get(x);
+ return e == null ? -1 : e.at;
+ }
+
+ /**
+ * Set redirection, indicating that the object, searched at the p_searched
+ * position can be actually found at the p_present position.
+ */
+ public void redirect(int p_searched, int p_present)
+ {
+ Redirection redirection = new Redirection();
+ redirection.at = p_present;
+ positions.put(new Integer(p_searched), redirection);
+ }
+
+ /**
+ * Get the object, written at the given position. This returs both shared
+ * objects and repository Ids.
+ *
+ * @return the position, at that the object is allready written.
+ *
+ * @throws MARSHAL if there is no object written at that position.
+ */
+ public Object isObjectWrittenAt(int x, int offset)
+ {
+ Entry e = (Entry) positions.get(new Integer(x));
+ if (e instanceof Redirection)
+ return isObjectWrittenAt(e.at, offset);
+ else if (e != null)
+ return e.object;
+ else
+ {
+ MARSHAL m = new MARSHAL("No object was written at " + x +
+ " (offset " + offset + ") r " + this + dump());
+ m.minor = Minor.Graph;
+ throw m;
+ }
+ }
+
+ /**
+ * Mark the given object as written at the given position.
+ */
+ public void singleIdWritten(String id, int at)
+ {
+ if (sh_ids.containsKey(id))
+ throw new InternalError("Repetetive writing of the same string " +
+ id + dump());
+
+ Entry e = new Entry();
+ e.at = at;
+ e.object = id;
+
+ sh_ids.put(id, e);
+ positions.put(new Integer(at), e);
+ }
+
+ /**
+ * Mark the given object as written at the given position.
+ */
+ public void multipleIdsWritten(String[] ids, int at)
+ {
+ if (sh_ids.containsKey(ids))
+ throw new InternalError("Repetetive writing of the same string " +
+ ids + dump());
+
+ Entry e = new Entry();
+ e.at = at;
+ e.object = ids;
+
+ sh_ids.put(ids, e);
+ positions.put(new Integer(at), e);
+ }
+
+ /**
+ * Check if the object is already written.
+ *
+ * @return the position, at that the object is allready written or -1 if it is
+ * not yet written.
+ */
+ public int idWrittenAt(Object x)
+ {
+ Entry e = (Entry) sh_ids.get(x);
+ return e == null ? -1 : e.at;
+ }
+
+ /**
+ * Get the codebase.
+ */
+ public String getCodeBase()
+ {
+ return codebase;
+ }
+
+ /**
+ * Set the codebase, preserving the old value if the passed parameter is null
+ * and forming the space delimited list if both new and old values are not
+ * null.
+ */
+ public void addCodeBase(String base)
+ {
+ if (base != null)
+ {
+ if (codebase == null)
+ codebase = base;
+ else
+ codebase = codebase + " " + base;
+ }
+ }
+
+ /**
+ * Dump all objects that are currently stored.
+ */
+ public String dump()
+ {
+ StringBuffer b = new StringBuffer(" Stream content: \n");
+
+ // Sort by position.
+ TreeSet t = new TreeSet(positions.keySet());
+ Iterator p = t.iterator();
+
+ while (p.hasNext())
+ {
+ Object k = p.next();
+ b.append(" " + k + ": " + ((Entry) positions.get(k)).toString()
+ + "\n");
+ }
+ return b.toString();
+ }
+
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/gnuValueStream.java b/libjava/classpath/gnu/CORBA/CDR/gnuValueStream.java
new file mode 100644
index 00000000000..663c9901861
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/CDR/gnuValueStream.java
@@ -0,0 +1,71 @@
+/* gnuValueStream.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.CDR;
+
+/**
+ * A stream, implementing this interface, provides methods to get/set a position
+ * and get the RunTime.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface gnuValueStream
+{
+ /**
+ * Get the current position in the buffer.
+ *
+ * @return The position in the buffer, taking offset into consideration.
+ */
+ public int getPosition();
+
+ /**
+ * Jump to the given position, taking offset into consideration.
+ */
+ public void seek(int position);
+
+ /**
+ * Get the RunTime information.
+ */
+ public gnuRuntime getRunTime();
+
+ /**
+ * Replace the instance of RunTime.
+ */
+ public void setRunTime(gnuRuntime a_runtime);
+
+}
diff --git a/libjava/classpath/gnu/CORBA/CDR/noHeaderInput.java b/libjava/classpath/gnu/CORBA/CDR/noHeaderInput.java
deleted file mode 100644
index 0c787ddc2df..00000000000
--- a/libjava/classpath/gnu/CORBA/CDR/noHeaderInput.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/* noHeaderInput.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.CORBA.CDR;
-
-import org.omg.CORBA.CustomMarshal;
-import org.omg.CORBA.DataInputStream;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.portable.BoxedValueHelper;
-import org.omg.CORBA.portable.Streamable;
-import org.omg.CORBA.portable.ValueFactory;
-
-import java.io.Serializable;
-
-/**
- * Substitutes the main stream in factories when the header is already
- * behind. Overrides methods that may be invoked from the factory,
- * forcing not to read the header if called first time on this stream.
- *
- * This stream reverts to default behavior if one or more call are
- * made (reading value types that are nested fields of the value type).
- *
- * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
- */
-class noHeaderInput
- extends cdrBufInput
- implements DataInputStream
-{
- /**
- * If true, this is not the first call.
- */
- boolean notFirst;
-
- /**
- * Create an instance, reading from the given buffer.
- */
- public noHeaderInput(byte[] buffer)
- {
- super(buffer);
- }
-
- /**
- * Read when knowning the class instance.
- */
- public Serializable read_value(Class clz)
- {
- if (notFirst)
- return super.read_value(clz);
- else
- {
- try
- {
- notFirst = true;
- return read_value((Serializable) clz.newInstance());
- }
- catch (Exception ex)
- {
- MARSHAL m = new MARSHAL("Unable to create an instance");
- m.initCause(ex);
- throw m;
- }
- }
- }
-
- /**
- * Tries to read using boxed value helper.
- */
- public Serializable read_value(BoxedValueHelper helper)
- {
- if (notFirst)
- return super.read_value(helper);
- else
- {
- notFirst = true;
- return helper.read_value(this);
- }
- }
-
- /**
- * Tries to locate a factory using repository id.
- */
- public Serializable read_value(String repository_id)
- {
- if (notFirst)
- return super.read_value(repository_id);
- else
- {
- notFirst = true;
-
- ValueFactory factory =
- ((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id);
- if (factory == null)
- throw new MARSHAL("No factory");
- return factory.read_value(this);
- }
- }
-
- /**
- * Try to read when having an unitialised value.
- */
- public Serializable read_value(Serializable value)
- {
- if (notFirst)
- return super.read_value(value);
- else
- {
- notFirst = true;
-
- // The user-defines io operations are implemented.
- if (value instanceof CustomMarshal)
- {
- CustomMarshal marsh = (CustomMarshal) value;
- try
- {
- marsh.unmarshal((DataInputStream) this);
- }
- catch (ClassCastException ex)
- {
- Vio.incorrect_plug_in(ex);
- }
- }
- else
- // The IDL-generated io operations are implemented.
- if (value instanceof Streamable)
- {
- ((Streamable) value)._read(this);
- }
- return value;
- }
- }
-} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/cdrEncapsCodec.java b/libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java
index 699c6f76a9c..93dd1cdcdfb 100644
--- a/libjava/classpath/gnu/CORBA/cdrEncapsCodec.java
+++ b/libjava/classpath/gnu/CORBA/CdrEncapsCodecImpl.java
@@ -1,4 +1,4 @@
-/* cdrEncapsCodec.java --
+/* CdrEncapsCodecImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,9 +38,9 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import org.omg.CORBA.Any;
import org.omg.CORBA.LocalObject;
@@ -57,19 +57,19 @@ import org.omg.IOP.CodecPackage.TypeMismatch;
/**
* The local {@link Codec} implementation for ENCODING_CDR_ENCAPS
* encoding. This is a local implementation; the remote side should
- * have its own Codec of this kind.
+ * have its own Codec of this kind.
*
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class cdrEncapsCodec
+public class CdrEncapsCodecImpl
extends LocalObject
implements Codec
{
- /**
- * The default version of encoding, used in parameterless constructor.
+ /**
+ * Use serialVersionUID for interoperability.
*/
- private static final Version DEFAULT_VERSION = new Version(1, 2);
+ private static final long serialVersionUID = 1;
/**
* If set to true, no wide string or wide character is allowed (GIOP 1.0).
@@ -99,7 +99,7 @@ public class cdrEncapsCodec
/**
* Create an instance of this Codec, encoding following the given version.
*/
- public cdrEncapsCodec(ORB _orb, Version _version)
+ public CdrEncapsCodecImpl(ORB _orb, Version _version)
{
orb = _orb;
version = _version;
@@ -125,8 +125,8 @@ public class cdrEncapsCodec
public Any decode(byte[] them)
throws FormatMismatch
{
- cdrBufInput input = createInput(them);
- cdrBufInput encapsulation = createEncapsulation(them, input);
+ BufferredCdrInput input = createInput(them);
+ BufferredCdrInput encapsulation = createEncapsulation(them, input);
TypeCode type = encapsulation.read_TypeCode();
@@ -142,9 +142,9 @@ public class cdrEncapsCodec
return readAny(type, encapsulation);
}
- private cdrBufInput createEncapsulation(byte[] them, cdrBufInput input)
+ private BufferredCdrInput createEncapsulation(byte[] them, BufferredCdrInput input)
{
- cdrBufInput encapsulation;
+ BufferredCdrInput encapsulation;
if ((them [ 0 ] | them [ 1 ] | them [ 2 ] | them [ 3 ]) == 0)
{
@@ -163,10 +163,10 @@ public class cdrEncapsCodec
{
checkTypePossibility("", that.type());
- cdrBufOutput output = createOutput(that);
+ BufferedCdrOutput output = createOutput(that);
- // cdrBufOutput has internal support for this encoding.
- cdrOutput encapsulation = output.createEncapsulation();
+ // BufferedCdrOutput has internal support for this encoding.
+ AbstractCdrOutput encapsulation = output.createEncapsulation();
try
{
@@ -179,6 +179,7 @@ public class cdrEncapsCodec
catch (Exception ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(ex);
throw m;
}
@@ -206,8 +207,8 @@ public class cdrEncapsCodec
throw new TypeMismatch(ex.getMessage());
}
- cdrBufInput input = createInput(them);
- cdrBufInput encapsulation = createEncapsulation(them, input);
+ BufferredCdrInput input = createInput(them);
+ BufferredCdrInput encapsulation = createEncapsulation(them, input);
return readAny(type, encapsulation);
}
@@ -217,13 +218,13 @@ public class cdrEncapsCodec
* @param type a type of the Any to read.
* @param input the encapsulation stream.
*/
- private Any readAny(TypeCode type, cdrBufInput encapsulation)
+ private Any readAny(TypeCode type, BufferredCdrInput encapsulation)
throws MARSHAL
{
gnuAny a = new gnuAny();
a.setOrb(orb);
- // cdrBufInput has internal support for this encoding.
+ // BufferredCdrInput has internal support for this encoding.
a.read_value(encapsulation, type);
return a;
}
@@ -234,9 +235,9 @@ public class cdrEncapsCodec
{
checkTypePossibility("", that.type());
- cdrBufOutput output = createOutput(that);
+ BufferedCdrOutput output = createOutput(that);
- cdrOutput encapsulation = output.createEncapsulation();
+ AbstractCdrOutput encapsulation = output.createEncapsulation();
try
{
@@ -248,6 +249,7 @@ public class cdrEncapsCodec
catch (Exception ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(ex);
throw m;
}
@@ -256,7 +258,7 @@ public class cdrEncapsCodec
/**
* Create the CDR output stream for writing the given Any.
- * The cdrBufOutput has internal support for encapsulation encodings.
+ * The BufferedCdrOutput has internal support for encapsulation encodings.
*
* @param that the Any that will be written.
*
@@ -265,10 +267,10 @@ public class cdrEncapsCodec
* @throws InvalidTypeForEncoding if that Any cannot be written under the
* given version.
*/
- private cdrBufOutput createOutput(Any that)
+ private BufferedCdrOutput createOutput(Any that)
throws InvalidTypeForEncoding
{
- cdrBufOutput output = new cdrBufOutput();
+ BufferedCdrOutput output = new BufferedCdrOutput();
output.setOrb(orb);
output.setVersion(version);
return output;
@@ -325,9 +327,9 @@ public class cdrEncapsCodec
*
* @return the stream.
*/
- private cdrBufInput createInput(byte[] them)
+ private BufferredCdrInput createInput(byte[] them)
{
- cdrBufInput input = new cdrBufInput(them);
+ BufferredCdrInput input = new BufferredCdrInput(them);
input.setOrb(orb);
input.setVersion(version);
return input;
diff --git a/libjava/classpath/gnu/CORBA/Connected_objects.java b/libjava/classpath/gnu/CORBA/Connected_objects.java
index b7eefb133a2..ce5761007c0 100644
--- a/libjava/classpath/gnu/CORBA/Connected_objects.java
+++ b/libjava/classpath/gnu/CORBA/Connected_objects.java
@@ -90,17 +90,6 @@ public class Connected_objects
* applicable.
*/
public final java.lang.Object identity;
-
- public boolean equals(java.lang.Object other)
- {
- if (other instanceof cObject)
- {
- cObject o = (cObject) other;
- return o.object.equals(object) && o.port == port;
- }
- else
- return false;
- }
}
/**
diff --git a/libjava/classpath/gnu/CORBA/corbaArrayList.java b/libjava/classpath/gnu/CORBA/CorbaList.java
index 1690f0583cb..25bea923099 100644
--- a/libjava/classpath/gnu/CORBA/corbaArrayList.java
+++ b/libjava/classpath/gnu/CORBA/CorbaList.java
@@ -1,4 +1,4 @@
-/* corbaArrayList.java --
+/* CorbaList.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import org.omg.CORBA.Bounds;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class corbaArrayList
+public class CorbaList
extends ArrayList
implements Serializable
{
@@ -64,7 +64,7 @@ public class corbaArrayList
/**
* Creates the list with the given initial size.
*/
- public corbaArrayList(int initial_size)
+ public CorbaList(int initial_size)
{
super(initial_size);
}
@@ -72,7 +72,7 @@ public class corbaArrayList
/**
* Creates the list with the default size.
*/
- public corbaArrayList()
+ public CorbaList()
{
}
diff --git a/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java b/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java
new file mode 100644
index 00000000000..51df047192c
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/DefaultSocketFactory.java
@@ -0,0 +1,79 @@
+/* DefaultSocketFactory.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.CORBA;
+
+import gnu.CORBA.interfaces.SocketFactory;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * The default socket factory that forges "plain" server and client sockets. The
+ * class can be replaced by setting the gnu.CORBA.SocketFactory property.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class DefaultSocketFactory
+ implements SocketFactory
+{
+ /**
+ * It is enough to have one instance of this class for all ORBs.
+ */
+ public static final DefaultSocketFactory Singleton = new DefaultSocketFactory();
+
+ /**
+ * Create a client socket.
+ */
+ public Socket createClientSocket(String host, int port)
+ throws IOException
+ {
+ return new Socket(host, port);
+ }
+
+ /**
+ * Create a server socket.
+ */
+ public ServerSocket createServerSocket(int port)
+ throws IOException
+ {
+ return new ServerSocket(port);
+ }
+
+}
diff --git a/libjava/classpath/gnu/CORBA/DynAn/abstractDynAny.java b/libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java
index 47176c4b589..7060f86b27f 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/abstractDynAny.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/AbstractAny.java
@@ -1,4 +1,4 @@
-/* abstractDynAny.java --
+/* AbstractAny.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
-import gnu.CORBA.typeNamer;
+import gnu.CORBA.TypeKindNamer;
import org.omg.CORBA.Any;
import org.omg.CORBA.LocalObject;
@@ -54,7 +54,7 @@ import java.io.Serializable;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class abstractDynAny
+public abstract class AbstractAny
extends LocalObject
implements Serializable
{
@@ -108,12 +108,12 @@ public abstract class abstractDynAny
/**
* The change value listener.
*/
- valueChangedListener listener;
+ ValueChangeListener listener;
/**
* Create the abstract dyn any.
*/
- public abstractDynAny(TypeCode oType, TypeCode aType,
+ public AbstractAny(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
@@ -163,8 +163,8 @@ public abstract class abstractDynAny
*/
String typeMismatch(TypeCode expected, TypeCode actual)
{
- return typeNamer.nameIt(expected) + " expected " +
- typeNamer.nameIt(actual);
+ return TypeKindNamer.nameIt(expected) + " expected " +
+ TypeKindNamer.nameIt(actual);
}
/**
diff --git a/libjava/classpath/gnu/CORBA/DynAn/anyDivideable.java b/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java
index 5f52c8078eb..c96cbedc73b 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/anyDivideable.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java
@@ -1,4 +1,4 @@
-/* anyDivideable.java --
+/* DivideableAny.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
-import gnu.CORBA.typeNamer;
+import gnu.CORBA.TypeKindNamer;
import org.omg.CORBA.Any;
import org.omg.CORBA.CompletionStatus;
@@ -58,8 +58,8 @@ import java.io.Serializable;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class anyDivideable
- extends abstractDynAny
+public abstract class DivideableAny
+ extends AbstractAny
implements Serializable
{
/**
@@ -78,7 +78,7 @@ public abstract class anyDivideable
*/
protected int pos = 0;
- public anyDivideable(TypeCode oType, TypeCode aType,
+ public DivideableAny(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
@@ -486,9 +486,9 @@ public abstract class anyDivideable
{
if (!official_type.equal(other.type()))
return false;
- else if (other instanceof anyDivideable)
+ else if (other instanceof DivideableAny)
{
- anyDivideable x = (anyDivideable) other;
+ DivideableAny x = (DivideableAny) other;
if (x.array.length != array.length)
return false;
@@ -499,7 +499,7 @@ public abstract class anyDivideable
}
return true;
}
- else if (other == null || other instanceof abstractDynAny)
+ else if (other == null || other instanceof AbstractAny)
return false;
else
return other.to_any().equal(to_any());
diff --git a/libjava/classpath/gnu/CORBA/DynAn/abstractRecord.java b/libjava/classpath/gnu/CORBA/DynAn/RecordAny.java
index 8d8b7a559b1..a3e3680d966 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/abstractRecord.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/RecordAny.java
@@ -1,4 +1,4 @@
-/* abstractRecord.java --
+/* RecordAny.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.holderFactory;
+import gnu.CORBA.HolderLocator;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -65,8 +65,8 @@ import java.lang.reflect.Field;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class abstractRecord
- extends anyDivideable
+public abstract class RecordAny
+ extends DivideableAny
implements DynAny, Serializable
{
/**
@@ -80,7 +80,7 @@ public abstract class abstractRecord
*
* @param fields The DynAny's, representing the fields of the structure.
*/
- public abstractRecord(TypeCode oType, TypeCode aType,
+ public RecordAny(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
@@ -277,7 +277,7 @@ public abstract class abstractRecord
c [ i ] = array [ i ].copy();
}
- abstractRecord d = newInstance(official_type, final_type, factory, orb);
+ RecordAny d = newInstance(official_type, final_type, factory, orb);
d.array = c;
return d;
}
@@ -285,7 +285,7 @@ public abstract class abstractRecord
/**
* Create a new instance when copying.
*/
- protected abstract abstractRecord newInstance(TypeCode oType, TypeCode aType,
+ protected abstract RecordAny newInstance(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory,
ORB anOrb
);
@@ -297,7 +297,7 @@ public abstract class abstractRecord
{
try
{
- Streamable sHolder = holderFactory.createHolder(official_type);
+ Streamable sHolder = HolderLocator.createHolder(official_type);
Class sHolderClass = sHolder.getClass();
Field sHolderValue = sHolderClass.getField("value");
@@ -371,7 +371,7 @@ public abstract class abstractRecord
fField = structure.getClass().getField(fNames [ i ]);
field = fField.get(structure);
fType = array [ i ].type();
- holder = holderFactory.createHolder(fType);
+ holder = HolderLocator.createHolder(fType);
member = createAny();
holder.getClass().getField("value").set(holder, field);
diff --git a/libjava/classpath/gnu/CORBA/DynAn/anyUndivideable.java b/libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java
index b31a6b357f9..da4e9618ee7 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/anyUndivideable.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/UndivideableAny.java
@@ -55,8 +55,8 @@ import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class anyUndivideable
- extends abstractDynAny
+public abstract class UndivideableAny
+ extends AbstractAny
implements Serializable
{
/**
@@ -67,7 +67,7 @@ public abstract class anyUndivideable
/**
* Create a new instance with the given typecode.
*/
- public anyUndivideable(TypeCode oType, TypeCode aType,
+ public UndivideableAny(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb)
{
super(oType, aType, aFactory, anOrb);
diff --git a/libjava/classpath/gnu/CORBA/DynAn/valueChangedListener.java b/libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java
index 94ddffbecf7..59727615999 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/valueChangedListener.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/ValueChangeListener.java
@@ -1,4 +1,4 @@
-/* valueChangedListener.java --
+/* ValueChangeListener.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,7 +44,7 @@ package gnu.CORBA.DynAn;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface valueChangedListener
+public interface ValueChangeListener
{
void changed();
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java
index 015628ebf90..23141de3d96 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynAny.java
@@ -38,14 +38,14 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.OctetHolder;
import gnu.CORBA.Unexpected;
import gnu.CORBA.WCharHolder;
import gnu.CORBA.WStringHolder;
-import gnu.CORBA.holderFactory;
-import gnu.CORBA.typeNamer;
-import gnu.CORBA.universalHolder;
+import gnu.CORBA.HolderLocator;
+import gnu.CORBA.TypeKindNamer;
+import gnu.CORBA.GeneralHolder;
import org.omg.CORBA.Any;
import org.omg.CORBA.AnyHolder;
@@ -84,7 +84,7 @@ import java.util.Arrays;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
+public class gnuDynAny extends AbstractAny implements DynAny, Serializable
{
/**
* Use serialVersionUID for interoperability.
@@ -132,7 +132,7 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
{
if (holder != null)
{
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
holder._write(buffer);
gnuDynAny other;
@@ -165,7 +165,7 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
public DynAny current_component() throws TypeMismatch
{
throw new TypeMismatch("Not applicable for " +
- typeNamer.nameIt(final_type)
+ TypeKindNamer.nameIt(final_type)
);
}
@@ -193,14 +193,14 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
{
throw new InvalidValue(ISNULL);
}
- else if (a_holder instanceof universalHolder)
+ else if (a_holder instanceof GeneralHolder)
{
- holder = holderFactory.createHolder(official_type);
+ holder = HolderLocator.createHolder(official_type);
if (holder == null)
- holder = holderFactory.createHolder(final_type);
+ holder = HolderLocator.createHolder(final_type);
if (holder == null)
- holder = ((universalHolder) a_holder).Clone();
+ holder = ((GeneralHolder) a_holder).Clone();
else
{
InputStream in = an_any.create_input_stream();
@@ -890,7 +890,7 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
*/
public boolean equal(DynAny other)
{
- if (other instanceof abstractDynAny)
+ if (other instanceof AbstractAny)
{
if (other instanceof gnuDynAny)
{
@@ -899,10 +899,10 @@ public class gnuDynAny extends abstractDynAny implements DynAny, Serializable
if (!x.holder.getClass().equals(holder.getClass()))
return false;
- cdrBufOutput b1 = new cdrBufOutput();
+ BufferedCdrOutput b1 = new BufferedCdrOutput();
x.holder._write(b1);
- cdrBufOutput b2 = new cdrBufOutput(b1.buffer.size() + 10);
+ BufferedCdrOutput b2 = new BufferedCdrOutput(b1.buffer.size() + 10);
holder._write(b2);
return Arrays.equals(b1.buffer.toByteArray(),
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java
index dd1762890de..b8b39bfbcdf 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynAnyFactory.java
@@ -40,8 +40,8 @@ package gnu.CORBA.DynAn;
import gnu.CORBA.Poa.ORB_1_4;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.holderFactory;
-import gnu.CORBA.typeNamer;
+import gnu.CORBA.HolderLocator;
+import gnu.CORBA.TypeKindNamer;
import org.omg.CORBA.Any;
import org.omg.CORBA.LocalObject;
@@ -227,7 +227,7 @@ public class gnuDynAnyFactory
*/
public DynAny create_simple(TypeCode official, TypeCode type)
{
- Streamable holder = holderFactory.createHolder(type);
+ Streamable holder = HolderLocator.createHolder(type);
return new gnuDynAny(holder, official, type, this, orb);
}
@@ -314,7 +314,7 @@ public class gnuDynAnyFactory
case TCKind._tk_Principal :
case TCKind._tk_abstract_interface :
throw new InconsistentTypeCode("Following API, the " +
- typeNamer.nameIt(type) +
+ TypeKindNamer.nameIt(type) +
" must not be supported."
);
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
index 1c08496d423..825cd0a5638 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.holderFactory;
+import gnu.CORBA.HolderLocator;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
@@ -66,7 +66,7 @@ import java.lang.reflect.Field;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynArray
- extends anyDivideable
+ extends DivideableAny
implements DynArray, Serializable
{
/**
@@ -238,10 +238,10 @@ public class gnuDynArray
try
{
Streamable memberHolder =
- holderFactory.createHolder(official_components);
+ HolderLocator.createHolder(official_components);
if (memberHolder == null)
- memberHolder = holderFactory.createHolder(final_components);
+ memberHolder = HolderLocator.createHolder(final_components);
Class memberHolderClass = memberHolder.getClass();
Class memberClass = memberHolderClass.getField("value").getType();
@@ -260,7 +260,7 @@ public class gnuDynArray
Array.set(members, i, member);
}
- Streamable arrayHolder = holderFactory.createHolder(official_type);
+ Streamable arrayHolder = HolderLocator.createHolder(official_type);
arrayHolder.getClass().getField("value").set(arrayHolder, members);
Any g = createAny();
@@ -296,9 +296,9 @@ public class gnuDynArray
{
if (holderClass == null)
{
- holder = holderFactory.createHolder(official_components);
+ holder = HolderLocator.createHolder(official_components);
if (holder == null)
- holder = holderFactory.createHolder(final_components);
+ holder = HolderLocator.createHolder(final_components);
holderClass = holder.getClass();
}
else
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java
index 2fccc85c59d..6eb7fe2bcac 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynEnum.java
@@ -60,7 +60,7 @@ import java.util.Arrays;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class gnuDynEnum extends anyUndivideable implements DynEnum
+public class gnuDynEnum extends UndivideableAny implements DynEnum
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java
index 39b00226245..9655f0387da 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynFixed.java
@@ -57,7 +57,7 @@ import java.math.BigDecimal;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class gnuDynFixed extends anyUndivideable implements DynFixed
+public class gnuDynFixed extends UndivideableAny implements DynFixed
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java
index b086d6478cc..b15aff3e124 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynStruct.java
@@ -54,7 +54,7 @@ import org.omg.DynamicAny.DynAny;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynStruct
- extends abstractRecord
+ extends RecordAny
implements DynStruct, Serializable
{
/**
@@ -89,7 +89,7 @@ public class gnuDynStruct
}
/** @inheritDoc */
- protected abstractRecord newInstance(TypeCode oType, TypeCode aType,
+ protected RecordAny newInstance(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb)
{
return new gnuDynStruct(oType, aType, aFactory, anOrb);
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
index ad41e24b6ae..ef5aed64512 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
@@ -62,8 +62,8 @@ import java.io.Serializable;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynUnion
- extends anyDivideable
- implements DynUnion, Serializable, valueChangedListener
+ extends DivideableAny
+ implements DynUnion, Serializable, ValueChangeListener
{
/**
* Use serialVersionUID for interoperability.
@@ -96,7 +96,7 @@ public class gnuDynUnion
discriminator =
factory.create_dyn_any_from_type_code(final_type.discriminator_type());
- ((abstractDynAny) discriminator).listener = this;
+ ((AbstractAny) discriminator).listener = this;
if (final_type.default_index() >= 0)
set_to_default_member();
@@ -114,7 +114,7 @@ public class gnuDynUnion
/*
* (non-Javadoc)
*
- * @see gnu.CORBA.DynAn.anyDivideable#to_any()
+ * @see gnu.CORBA.DynAn.DivideableAny#to_any()
*/
public Any to_any()
{
@@ -171,7 +171,7 @@ public class gnuDynUnion
gnuDynUnion other =
new gnuDynUnion(official_type, final_type, factory, orb);
other.discriminator = discriminator.copy();
- ((abstractDynAny) other.discriminator).listener = other;
+ ((AbstractAny) other.discriminator).listener = other;
if (array.length == 1)
{
other.array = new DynAny[] { other.discriminator };
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java
index c2db9479785..0c31d4093e2 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynValue.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
+import gnu.CORBA.Minor;
import gnu.CORBA.Unexpected;
import org.omg.CORBA.Any;
@@ -66,7 +67,7 @@ import java.io.Serializable;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class gnuDynValue extends abstractRecord implements DynValue,
+public class gnuDynValue extends RecordAny implements DynValue,
Serializable
{
/**
@@ -243,7 +244,7 @@ public class gnuDynValue extends abstractRecord implements DynValue,
/**
* Create a new instance.
*/
- protected abstractRecord newInstance(TypeCode oType, TypeCode aType,
+ protected RecordAny newInstance(TypeCode oType, TypeCode aType,
gnuDynAnyFactory aFactory, ORB anOrb
)
{
@@ -301,9 +302,12 @@ public class gnuDynValue extends abstractRecord implements DynValue,
ValueFactory factory =
((org.omg.CORBA_2_3.ORB) orb).lookup_value_factory(official_type.id());
if (factory == null)
- throw new MARSHAL("Factory for " + official_type.id() +
- " not registered."
- );
+ {
+ MARSHAL m = new MARSHAL("Factory for " + official_type.id() +
+ " not registered.");
+ m.minor = Minor.Factory;
+ throw m;
+ }
OutputStream out = orb.create_output_stream();
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java
index 66e18f3b2fe..a13e9fc2c50 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynValueBox.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.holderFactory;
+import gnu.CORBA.HolderLocator;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -65,7 +65,7 @@ import java.lang.reflect.Field;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class gnuDynValueBox
- extends anyDivideable
+ extends DivideableAny
implements DynValueBox, Serializable
{
/**
@@ -208,7 +208,7 @@ public class gnuDynValueBox
{
try
{
- Streamable holder = holderFactory.createHolder(content);
+ Streamable holder = HolderLocator.createHolder(content);
Field v = holder.getClass().getField("value");
v.set(holder, s);
diff --git a/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java b/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
index 890ca5fe51c..8fc8697a4f3 100644
--- a/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
+++ b/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
@@ -125,6 +125,7 @@ public class EmptyExceptionHolder
catch (Exception ex)
{
BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.CDR;
bad.initCause(ex);
throw bad;
}
diff --git a/libjava/classpath/gnu/CORBA/ExceptionCreator.java b/libjava/classpath/gnu/CORBA/ExceptionCreator.java
deleted file mode 100644
index 8b75205056b..00000000000
--- a/libjava/classpath/gnu/CORBA/ExceptionCreator.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/* ExceptionCreator.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.CORBA;
-
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.CompletionStatusHelper;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-
-/**
- * Creates the objects from the agreed IDL names.
- *
- * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
- */
-public class ExceptionCreator
-{
- /**
- * The standard OMG prefix.
- */
- public static final String OMG_PREFIX = "omg.org/";
-
- /**
- * The standard java prefix.
- */
- public static final String JAVA_PREFIX = "org.omg.";
-
- /**
- * Create the system exception with the given idl name.
- *
- * @param idl the exception IDL name, must match the syntax
- * "IDL:<class/name>:1.0".
- * @param minor the exception minor code.
- * @param completed the exception completion status.
- *
- * @return the created exception.
- */
- public static SystemException createSystemException(String idl, int minor,
- CompletionStatus completed
- )
- {
- try
- {
- String cl = toClassName(idl);
- Class exClass = Class.forName(cl);
-
- Constructor constructor =
- exClass.getConstructor(new Class[]
- {
- String.class, int.class,
- CompletionStatus.class
- }
- );
-
- Object exception =
- constructor.newInstance(new Object[]
- {
- " Remote exception " + idl + ", minor " +
- minor + ", " + completed + ".",
- new Integer(minor), completed
- }
- );
-
- return (SystemException) exception;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return new UNKNOWN("Unsupported system exception", minor, completed);
- }
- }
-
- /**
- * Read the system exception from the given stream.
- * @param input the CDR stream to read from.
- * @return the exception that has been stored in the stream
- * (IDL name, minor code and completion status).
- */
- public static SystemException readSystemException(InputStream input)
- {
- String idl = input.read_string();
- int minor = input.read_ulong();
- CompletionStatus status = CompletionStatusHelper.read(input);
-
- SystemException exception =
- ExceptionCreator.createSystemException(idl, minor, status);
-
- return exception;
- }
-
- /**
- * Reads the user exception, having the given Id, from the
- * input stream. The id is expected to be in the form like
- * 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
- *
- * @param idl the exception idl name.
- * @param input the stream to read from.
- *
- * @return the loaded exception.
- * @return null if the helper class cannot be found.
- */
- public static UserException readUserException(String idl, InputStream input)
- {
- try
- {
- String helper = toHelperName(idl);
- Class helperClass = Class.forName(helper);
-
- Method read =
- helperClass.getMethod("read",
- new Class[]
- {
- org.omg.CORBA.portable.InputStream.class
- }
- );
-
- return (UserException) read.invoke(null, new Object[] { input });
- }
- catch (MARSHAL mex)
- {
- // This one is ok to throw
- throw mex;
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return null;
- }
- }
-
- /**
- * Writes the system exception data to CDR output stream.
- *
- * @param output a stream to write data to.
- * @param ex an exception to write.
- */
- public static void writeSystemException(OutputStream output,
- SystemException ex
- )
- {
- String exIDL = toIDL(ex.getClass().getName());
- output.write_string(exIDL);
- output.write_ulong(ex.minor);
- CompletionStatusHelper.write(output, ex.completed);
- }
-
- /**
- * Converts teh given IDL name to class name.
- *
- * @param IDL the idl name.
- *
- */
- protected static String toClassName(String IDL)
- {
- String s = IDL;
- int a = s.indexOf(':') + 1;
- int b = s.lastIndexOf(':');
-
- s = IDL.substring(a, b);
-
- if (s.startsWith(OMG_PREFIX))
- s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
-
- return s.replace('/', '.');
- }
-
- /**
- * Gets the helper class name from the string like
- * 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
- *
- * @param IDL the idl name.
- */
- protected static String toHelperName(String IDL)
- {
- String s = IDL;
- int a = s.indexOf(':') + 1;
- int b = s.lastIndexOf(':');
-
- s = IDL.substring(a, b);
-
- if (s.startsWith(OMG_PREFIX))
- s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
-
- return s.replace('/', '.') + "Helper";
- }
-
- /**
- * Convert the class name to IDL name.
- *
- * @param cn the class name.
- *
- * @return the idl name.
- */
- protected static String toIDL(String cn)
- {
- if (cn.startsWith(JAVA_PREFIX))
- cn = cn.substring(JAVA_PREFIX.length());
-
- cn = cn.replace('.', '/');
-
- return "IDL:" + OMG_PREFIX + cn + ":1.0";
- }
-}
diff --git a/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java b/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java
index c7fae5b061b..cbdf46f259a 100644
--- a/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java
+++ b/libjava/classpath/gnu/CORBA/ForwardRequestHelper.java
@@ -81,6 +81,7 @@ public abstract class ForwardRequestHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ForwardRequest expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java b/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
index f3f35dbaa21..bffb02678aa 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CharSets_OSF.java
@@ -47,7 +47,10 @@ import java.util.Set;
/**
* This class contains the codes, used to identify character sets
* in CORBA. These codes are defined in Open Software Foundation (OSF)
- * code set registry
+ * code set registry.
+ *
+ * The name of this class specially sets "OSF" apart if somebody would start
+ * searching Open Software Foundation abbreviation.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
diff --git a/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java b/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
index d884329c440..38039c2ed21 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CloseMessage.java
@@ -38,15 +38,13 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.IOR;
+import gnu.CORBA.Minor;
import org.omg.CORBA.MARSHAL;
import java.io.IOException;
import java.io.OutputStream;
-import java.net.Socket;
-
/**
* The explicit command to close the connection.
*
@@ -60,6 +58,11 @@ import java.net.Socket;
public class CloseMessage
extends MessageHeader
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The singleton close message is typically enough, despite new
* instances may be instantiated if the specific version field
@@ -95,6 +98,7 @@ public class CloseMessage
catch (IOException ex)
{
MARSHAL m = new MARSHAL("Unable to flush the stream");
+ m.minor = Minor.Header;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/cxCodeSet.java b/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
index 7f42c07f236..ab565db3797 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/cxCodeSet.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.IOR;
import gnu.CORBA.IOR.CodeSets_profile;
@@ -51,7 +51,7 @@ import java.io.IOException;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class cxCodeSet
+public class CodeSetServiceContext
extends ServiceContext
{
/**
@@ -62,7 +62,7 @@ public class cxCodeSet
/**
* The standard component to include in the messages.
*/
- public static final cxCodeSet STANDARD = new cxCodeSet();
+ public static final CodeSetServiceContext STANDARD = new CodeSetServiceContext();
/**
* The encoding, used to transfer the narrow (1 byte) character data.
@@ -84,13 +84,13 @@ public class cxCodeSet
*
* @param contexts the array of contexts, can be null.
*/
- public static cxCodeSet find(ServiceContext[] contexts)
+ public static CodeSetServiceContext find(ServiceContext[] contexts)
{
if (contexts != null)
for (int i = 0; i < contexts.length; i++)
{
- if (contexts [ i ] instanceof cxCodeSet)
- return (cxCodeSet) contexts [ i ];
+ if (contexts [ i ] instanceof CodeSetServiceContext)
+ return (CodeSetServiceContext) contexts [ i ];
}
return STANDARD;
}
@@ -102,12 +102,12 @@ public class cxCodeSet
* If you take this task, scan 'TODO character encoding' for
* relevant places.
*/
- public static cxCodeSet negotiate(IOR.CodeSets_profile profile)
+ public static CodeSetServiceContext negotiate(IOR.CodeSets_profile profile)
{
if (profile.negotiated != null)
return profile.negotiated;
- cxCodeSet use = new cxCodeSet();
+ CodeSetServiceContext use = new CodeSetServiceContext();
use.char_data =
negotiate(profile.narrow, STANDARD.char_data, CharSets_OSF.ISO8859_1);
@@ -124,9 +124,9 @@ public class cxCodeSet
* Read the context from the given stream. Does not read the
* code sets id.
*/
- public void readContext(cdrInput input)
+ public void readContext(AbstractCdrInput input)
{
- cdrInput encap = input.read_encapsulation();
+ AbstractCdrInput encap = input.read_encapsulation();
char_data = encap.read_ulong();
wide_char_data = encap.read_ulong();
@@ -145,11 +145,11 @@ public class cxCodeSet
* Write the context to the given stream, including the code
* sets id.
*/
- public void write(cdrOutput output)
+ public void write(AbstractCdrOutput output)
{
output.write_ulong(ID);
- cdrOutput enout = output.createEncapsulation();
+ AbstractCdrOutput enout = output.createEncapsulation();
enout.write_long(char_data);
enout.write_ulong(wide_char_data);
diff --git a/libjava/classpath/gnu/CORBA/GIOP/contextSupportingHeader.java b/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java
index ba6c1f88d8f..77ea20e38f0 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/contextSupportingHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ContextHandler.java
@@ -1,4 +1,4 @@
-/* contextSupportingHeader.java --
+/* ContextHandler.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import org.omg.CORBA.BAD_INV_ORDER;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class contextSupportingHeader
+public abstract class ContextHandler
{
/**
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java b/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
index 8d3b3539be5..99942fee359 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ErrorMessage.java
@@ -38,7 +38,9 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
+import gnu.CORBA.Minor;
import java.io.IOException;
import java.io.OutputStream;
@@ -46,6 +48,7 @@ import java.io.OutputStream;
import java.net.Socket;
import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.ORB;
/**
* The error message is sent in response to the message, encoded
@@ -59,6 +62,11 @@ import org.omg.CORBA.MARSHAL;
public class ErrorMessage
extends MessageHeader
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* Create a new error message, setting the message field
* to the {@link MESSAGE_ERROR} and the version number to
@@ -73,14 +81,22 @@ public class ErrorMessage
/**
* Send the error message to the given IOR address.
*
- * @param to the IOR address (host and port, other fields
+ * @param ior the IOR address (host and port, other fields
* are not used).
+ *
+ * @param orb the ORB, sending the error message.
*/
- public void send(IOR ior)
+ public void send(IOR ior, ORB orb)
{
try
{
- Socket socket = new Socket(ior.Internet.host, ior.Internet.port);
+ Socket socket;
+
+ if (orb instanceof OrbFunctional)
+ socket = ((OrbFunctional) orb).socketFactory.createClientSocket(
+ ior.Internet.host, ior.Internet.port);
+ else
+ socket = new Socket(ior.Internet.host, ior.Internet.port);
OutputStream socketOutput = socket.getOutputStream();
write(socketOutput);
@@ -90,6 +106,7 @@ public class ErrorMessage
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java b/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
index 61c46e11ea4..e1bdb512bfb 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
@@ -1,4 +1,4 @@
-/* MessageHeader.java -- GIOP 1.0 message header.
+/* MessageHeader.java -- GIOP message header.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,33 +38,39 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
+import gnu.CORBA.Minor;
+import gnu.CORBA.Version;
+import gnu.CORBA.CDR.BigEndianInputStream;
import gnu.CORBA.CDR.BigEndianOutputStream;
import gnu.CORBA.CDR.LittleEndianInputStream;
import gnu.CORBA.CDR.LittleEndianOutputStream;
-import gnu.CORBA.CDR.abstractDataOutputStream;
-import gnu.CORBA.Version;
+import gnu.CORBA.CDR.AbstractDataInput;
+import gnu.CORBA.CDR.AbstractDataOutput;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.portable.IDLEntity;
-import java.io.DataInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
-
+import java.net.Socket;
import java.util.Arrays;
-import gnu.CORBA.CDR.BigEndianInputStream;
-import gnu.CORBA.CDR.abstractDataInputStream;
-import java.io.InputStream;
/**
* The GIOP message header.
- *
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class MessageHeader
implements IDLEntity
{
/**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
* Request message.
*/
public static final byte REQUEST = 0;
@@ -80,16 +86,15 @@ public class MessageHeader
public static final byte CANCEL_REQUEST = 2;
/**
- * Locate request message, used to check the server ability to
- * process requests for the object reference.
- * This message is also used to get the
+ * Locate request message, used to check the server ability to process
+ * requests for the object reference. This message is also used to get the
* address where the object reference should be sent.
*/
public static final byte LOCATE_REQUEST = 3;
/**
- * Locate reply message, sent in response to the
- * {@link #LocateRequest} message.
+ * Locate reply message, sent in response to the {@link #LocateRequest}
+ * message.
*/
public static final byte LOCATE_REPLY = 4;
@@ -104,8 +109,8 @@ public class MessageHeader
public static final byte MESSAGE_ERROR = 6;
/**
- * The fragment messge, following the previous message that
- * has more fragments flag set. Added in GIOP 1.1
+ * The fragment messge, following the previous message that has more fragments
+ * flag set. Added in GIOP 1.1
*/
public static final byte FRAGMENT = 7;
@@ -117,12 +122,9 @@ public class MessageHeader
/**
* The message type names.
*/
- protected static String[] types =
- new String[]
- {
- "Request", "Reply", "Cancel", "Locate request", "Locate reply",
- "Close connection", "Error", "Fragment"
- };
+ protected static String[] types = new String[] { "Request", "Reply",
+ "Cancel", "Locate request", "Locate reply", "Close connection", "Error",
+ "Fragment" };
/**
* The GIOP version. Initialised to 1.0 .
@@ -154,7 +156,7 @@ public class MessageHeader
/**
* Create an empty message header, corresponding the given version.
- *
+ *
* @param major the major message header version.
* @param minor the minot message header version.
*/
@@ -164,8 +166,8 @@ public class MessageHeader
}
/**
- * Checks if the message is encoded in the Big Endian, most significant
- * byte first.
+ * Checks if the message is encoded in the Big Endian, most significant byte
+ * first.
*/
public boolean isBigEndian()
{
@@ -173,10 +175,18 @@ public class MessageHeader
}
/**
+ * Checks if the message is partial, and more subsequent fragments follow.
+ */
+ public boolean moreFragmentsFollow()
+ {
+ return (flags & 0x2) != 0;
+ }
+
+ /**
* Set the encoding to use.
- *
- * @param use_big_endian if true (default), the Big Endian
- * encoding is used. If false, the Little Endian encoding is used.
+ *
+ * @param use_big_endian if true (default), the Big Endian encoding is used.
+ * If false, the Little Endian encoding is used.
*/
public void setBigEndian(boolean use_big_endian)
{
@@ -196,16 +206,16 @@ public class MessageHeader
/**
* Get the message type as string.
- *
+ *
* @param type the message type as int (the field {@link message_type}).
- *
+ *
* @return the message type as string.
*/
public String getTypeString(int type)
{
try
{
- return types [ type ];
+ return types[type];
}
catch (ArrayIndexOutOfBoundsException ex)
{
@@ -215,10 +225,10 @@ public class MessageHeader
/**
* Creates reply header, matching the message header version number.
- *
+ *
* @return one of {@link gnu.CORBA.GIOP.v1_0.ReplyHeader},
- * {@link gnu.CORBA.GIOP.v1_2.ReplyHeader}, etc - depending on
- * the version number in this header.
+ * {@link gnu.CORBA.GIOP.v1_2.ReplyHeader}, etc - depending on the version
+ * number in this header.
*/
public ReplyHeader create_reply_header()
{
@@ -230,10 +240,10 @@ public class MessageHeader
/**
* Creates request header, matching the message header version number.
- *
+ *
* @return one of {@link gnu.CORBA.GIOP.v1_0.RequestHeader},
- * {@link gnu.CORBA.GIOP.v1_2.RequestHeader}, etc - depending on
- * the version number in this header.
+ * {@link gnu.CORBA.GIOP.v1_2.RequestHeader}, etc - depending on the version
+ * number in this header.
*/
public RequestHeader create_request_header()
{
@@ -261,24 +271,28 @@ public class MessageHeader
/**
* Read the header from the stream.
- *
+ *
* @param istream a stream to read from.
- *
+ *
* @throws MARSHAL if this is not a GIOP 1.0 header.
*/
public void read(java.io.InputStream istream)
- throws MARSHAL
+ throws MARSHAL
{
try
{
- byte[] xMagic = new byte[ MAGIC.length ];
+ byte[] xMagic = new byte[MAGIC.length];
istream.read(xMagic);
if (!Arrays.equals(xMagic, MAGIC))
- throw new MARSHAL("Not a GIOP message");
+ {
+ MARSHAL m = new MARSHAL("Not a GIOP message");
+ m.minor = Minor.Giop;
+ throw m;
+ }
version = Version.read_version(istream);
- abstractDataInputStream din;
+ AbstractDataInput din;
flags = (byte) istream.read();
@@ -295,6 +309,7 @@ public class MessageHeader
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
@@ -302,26 +317,26 @@ public class MessageHeader
/**
* Get the short string summary of the message.
- *
+ *
* @return a short message summary.
*/
public String toString()
{
- return "GIOP " + version + ", " + (isBigEndian() ? "Big" : "Little") +
- " endian, " + getTypeString(message_type) + ", " + message_size +
- " bytes. ";
+ return "GIOP " + version + ", " + (isBigEndian() ? "Big" : "Little")
+ + " endian, " + getTypeString(message_type) + ", " + message_size
+ + " bytes. ";
}
/**
* Write the header to stream.
- *
+ *
* @param out a stream to write into.
*/
public void write(java.io.OutputStream out)
{
try
{
- abstractDataOutputStream dout;
+ AbstractDataOutput dout;
if (isBigEndian())
dout = new BigEndianOutputStream(out);
@@ -333,18 +348,99 @@ public class MessageHeader
// Write version number.
version.write((OutputStream) dout);
-
dout.write(flags);
-
dout.write(message_type);
-
dout.writeInt(message_size);
}
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
}
+
+ /**
+ * Read data, followed by the message header. Handle fragmented messages.
+ *
+ * @param source the data source to read from.
+ * @param service the socket on that the time outs are set. Can be null (no
+ * timeouts are set).
+ * @param to_read the timeout while reading the message.
+ * @param to_pause the timeout for pauses between the message parts.
+ */
+ public byte[] readMessage(InputStream source, Socket service, int to_read,
+ int to_pause)
+ {
+ try
+ {
+ byte[] r = new byte[message_size];
+
+ int n = 0;
+ if (service != null)
+ service.setSoTimeout(to_read);
+
+ reading: while (n < r.length)
+ {
+ n += source.read(r, n, r.length - n);
+ }
+ if (service != null)
+ service.setSoTimeout(to_pause);
+
+ // Read the message remainder if the message is fragmented.
+ if (moreFragmentsFollow())
+ {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream(
+ 2 * r.length);
+ buffer.write(r);
+
+ if (r.length < 10)
+ // Increase the buffer size if the default value (size of the
+ // previous message) is really too small.
+ r = new byte[1024];
+
+ MessageHeader h2 = new MessageHeader();
+
+ do
+ {
+ h2.read(source);
+
+ int dn;
+
+ n = 0;
+ reading: while (n < h2.message_size)
+ {
+ dn = source.read(r, 0, h2.message_size - n);
+
+ if (n == 0 && service != null)
+ service.setSoTimeout(to_read);
+
+ if (n == 0 && version.since_inclusive(1, 2))
+ {
+ // Skip the four byte request id.
+ buffer.write(r, 4, dn - 4);
+ }
+ else
+ buffer.write(r, 0, dn);
+ n = +dn;
+ }
+
+ if (service != null)
+ service.setSoTimeout(to_pause);
+ }
+ while (h2.moreFragmentsFollow());
+ return buffer.toByteArray();
+ }
+ else
+ return r;
+ }
+ catch (IOException ioex)
+ {
+ MARSHAL m = new MARSHAL("Unable to read the message continuation.");
+ m.minor = Minor.Header;
+ m.initCause(ioex);
+ throw m;
+ }
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
index f0f409394e6..d1448290331 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ReplyHeader.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
/**
* The header of the standard reply.
@@ -47,7 +47,7 @@ import gnu.CORBA.CDR.cdrOutput;
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class ReplyHeader
- extends contextSupportingHeader
+ extends ContextHandler
{
/**
* Reply status, if no exception occured.
@@ -121,7 +121,7 @@ public abstract class ReplyHeader
*
* @param in a stream to read from.
*/
- public abstract void read(cdrInput in);
+ public abstract void read(AbstractCdrInput in);
/**
* Returns a short string representation.
@@ -141,5 +141,5 @@ public abstract class ReplyHeader
*
* @param out a stream to write into.
*/
- public abstract void write(cdrOutput out);
+ public abstract void write(AbstractCdrOutput out);
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
index 17cccb8834a..3cfadfd7867 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/RequestHeader.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import org.omg.CORBA.portable.IDLEntity;
@@ -49,7 +49,7 @@ import org.omg.CORBA.portable.IDLEntity;
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class RequestHeader
- extends contextSupportingHeader
+ extends ContextHandler
implements IDLEntity
{
/**
@@ -137,7 +137,7 @@ public abstract class RequestHeader
*
* @param in a stream to read from.
*/
- public abstract void read(cdrInput in);
+ public abstract void read(AbstractCdrInput in);
/**
* Return a string representation.
@@ -149,6 +149,6 @@ public abstract class RequestHeader
*
* @param out a stream to write into.
*/
- public abstract void write(cdrOutput out);
+ public abstract void write(AbstractCdrOutput out);
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
index 29a8ea8ac77..78519510cb7 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/ServiceContext.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA.GIOP;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.BAD_PARAM;
@@ -48,7 +48,7 @@ import org.omg.CORBA.portable.IDLEntity;
/**
* Contains the ORB service data being passed.
- *
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class ServiceContext
@@ -59,6 +59,50 @@ public class ServiceContext
*/
private static final long serialVersionUID = 1;
+ /* Standard values for the context_id. */
+ public static final int TransactionService = 0;
+
+ /**
+ * Defines code sets, used to encode wide and narrow characters. Required for
+ * messages with data structures, involving wide characters.
+ */
+ public static final int CodeSets = 1;
+
+ public static final int ChainBypassCheck = 2;
+
+ public static final int ChainBypassInfo = 3;
+
+ public static final int LogicalThreadId = 4;
+
+ public static final int BI_DIR_IIOP = 5;
+
+ public static final int SendingContextRunTime = 6;
+
+ public static final int INVOCATION_POLICIES = 7;
+
+ public static final int FORWARDED_IDENTITY = 8;
+
+ /**
+ * Contains exception details if exception being transferred is other than
+ * System or User exception. javax.rmi uses this context to transfer arbitrary
+ * java exceptions as CORBA value types.
+ */
+ public static final int UnknownExceptionInfo = 9;
+
+ public static final int RTCorbaPriority = 10;
+
+ public static final int RTCorbaPriorityRange = 11;
+
+ public static final int FT_GROUP_VERSION = 12;
+
+ public static final int FT_REQUEST = 13;
+
+ public static final int ExceptionDetailMessage = 14;
+
+ public static final int SecurityAttributeService = 15;
+
+ public static final int ActivityService = 16;
+
/**
* The context id (for instance, 0x1 for code sets context). At the moment of
* writing, the OMG defines 16 standard values and provides rules to register
@@ -90,18 +134,18 @@ public class ServiceContext
/**
* Read the context values from the stream.
- *
+ *
* @param istream a stream to read from.
*/
- public static ServiceContext read(cdrInput istream)
+ public static ServiceContext read(AbstractCdrInput istream)
{
int id = istream.read_ulong();
switch (id)
{
- case cxCodeSet.ID:
+ case CodeSetServiceContext.ID:
- cxCodeSet codeset = new cxCodeSet();
+ CodeSetServiceContext codeset = new CodeSetServiceContext();
codeset.readContext(istream);
return codeset;
@@ -117,7 +161,7 @@ public class ServiceContext
/**
* Read a sequence of contexts from the input stream.
*/
- public static ServiceContext[] readSequence(cdrInput istream)
+ public static ServiceContext[] readSequence(AbstractCdrInput istream)
{
int size = istream.read_long();
ServiceContext[] value = new gnu.CORBA.GIOP.ServiceContext[size];
@@ -128,10 +172,10 @@ public class ServiceContext
/**
* Write the context values into the stream.
- *
+ *
* @param ostream a stream to write the data to.
*/
- public void write(cdrOutput ostream)
+ public void write(AbstractCdrOutput ostream)
{
ostream.write_ulong(context_id);
ostream.write_sequence(context_data);
@@ -140,7 +184,7 @@ public class ServiceContext
/**
* Write the sequence of contexts into the input stream.
*/
- public static void writeSequence(cdrOutput ostream, ServiceContext[] value)
+ public static void writeSequence(AbstractCdrOutput ostream, ServiceContext[] value)
{
ostream.write_long(value.length);
for (int i = 0; i < value.length; i++)
@@ -172,8 +216,7 @@ public class ServiceContext
// Replace context.
if (!replace)
throw new BAD_INV_ORDER("Repetetive setting of the context "
- + service_context.context_id, 15,
- CompletionStatus.COMPLETED_NO);
+ + service_context.context_id, 15, CompletionStatus.COMPLETED_NO);
else
cx[exists] = service_context;
}
@@ -205,15 +248,13 @@ public class ServiceContext
// Replace context.
if (!replace)
throw new BAD_INV_ORDER("Repetetive setting of the context "
- + service_context.context_id, 15,
- CompletionStatus.COMPLETED_NO);
+ + service_context.context_id, 15, CompletionStatus.COMPLETED_NO);
else
cx[exists] = new ServiceContext(service_context);
return cx;
}
}
-
/**
* Find context with the given name in the context array.
*/
@@ -227,8 +268,8 @@ public class ServiceContext
}
/**
- * Find context with the given name in the context array,
- * converting into org.omg.IOP.ServiceContext.
+ * Find context with the given name in the context array, converting into
+ * org.omg.IOP.ServiceContext.
*/
public static org.omg.IOP.ServiceContext findContext(int ctx_name,
ServiceContext[] cx)
@@ -240,6 +281,17 @@ public class ServiceContext
}
/**
+ * Find context with the given name in the context array without conversions.
+ */
+ public static ServiceContext find(int ctx_name, ServiceContext[] cx)
+ {
+ for (int i = 0; i < cx.length; i++)
+ if (cx[i].context_id == ctx_name)
+ return cx[i];
+ return null;
+ }
+
+ /**
* Return a string representation.
*/
public String toString()
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
index 27181ca6347..c085c17fb9b 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_0/ReplyHeader.java
@@ -38,10 +38,10 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_0;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
/**
* The header of the standard reply.
@@ -98,13 +98,13 @@ public class ReplyHeader
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
service_context = ServiceContext.readSequence(in);
request_id = in.read_ulong();
reply_status = in.read_ulong();
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
/**
@@ -128,12 +128,12 @@ public class ReplyHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
ServiceContext.writeSequence(out, service_context);
out.write_ulong(request_id);
out.write_ulong(reply_status);
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
index 7ede4e5b926..5cf723cbc42 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_0/RequestHeader.java
@@ -38,10 +38,10 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_0;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import org.omg.CORBA.portable.IDLEntity;
@@ -112,7 +112,7 @@ public class RequestHeader
*
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
service_context = ServiceContext.readSequence(in);
request_id = in.read_ulong();
@@ -121,7 +121,7 @@ public class RequestHeader
operation = in.read_string();
requesting_principal = in.read_sequence();
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
/**
@@ -143,7 +143,7 @@ public class RequestHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
ServiceContext.writeSequence(out, service_context);
out.write_ulong(request_id);
@@ -152,6 +152,6 @@ public class RequestHeader
out.write_string(operation);
out.write_sequence(requesting_principal);
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
index c3f51a37b91..3fc1541d9ab 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_2/ReplyHeader.java
@@ -38,10 +38,10 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_2;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
/**
* GIOP 1.2 reply header.
@@ -56,7 +56,7 @@ public class ReplyHeader
*/
public ReplyHeader()
{
- service_context = new ServiceContext[] { cxCodeSet.STANDARD };
+ service_context = new ServiceContext[] { CodeSetServiceContext.STANDARD };
}
/**
@@ -89,13 +89,13 @@ public class ReplyHeader
*
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
request_id = in.read_ulong();
reply_status = in.read_ulong();
service_context = gnu.CORBA.GIOP.ServiceContext.readSequence(in);
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
/**
@@ -107,12 +107,12 @@ public class ReplyHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
out.write_ulong(request_id);
out.write_ulong(reply_status);
gnu.CORBA.GIOP.ServiceContext.writeSequence(out, service_context);
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
index d294d006723..6b37b6c676c 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_2/RequestHeader.java
@@ -38,10 +38,11 @@ exception statement from your version. */
package gnu.CORBA.GIOP.v1_2;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.Minor;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.ServiceContext;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import java.io.IOException;
@@ -58,6 +59,11 @@ import org.omg.CORBA.NO_IMPLEMENT;
public class RequestHeader
extends gnu.CORBA.GIOP.v1_0.RequestHeader
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* Indicates that the object is addressed by the object key.
*/
@@ -89,7 +95,7 @@ public class RequestHeader
*/
public RequestHeader()
{
- service_context = new ServiceContext[] { cxCodeSet.STANDARD };
+ service_context = new ServiceContext[] { CodeSetServiceContext.STANDARD };
}
/**
@@ -123,7 +129,7 @@ public class RequestHeader
*
* @param in a stream to read from.
*/
- public void read(cdrInput in)
+ public void read(AbstractCdrInput in)
{
try
{
@@ -150,20 +156,23 @@ public class RequestHeader
throw new NO_IMPLEMENT("Object addressing by by IOR addressing info");
default :
- throw new MARSHAL("Unknow addressing method in request, " +
+ MARSHAL m = new MARSHAL("Unknow addressing method in request, " +
AddressingDisposition
);
+ m.minor = Minor.UnsupportedAddressing;
+ throw m;
}
operation = in.read_string();
service_context = gnu.CORBA.GIOP.ServiceContext.readSequence(in);
// No requesting principal in this new format.
- in.setCodeSet(cxCodeSet.find(service_context));
+ in.setCodeSet(CodeSetServiceContext.find(service_context));
}
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Header;
t.initCause(ex);
throw t;
}
@@ -186,7 +195,7 @@ public class RequestHeader
*
* @param out a stream to write into.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
out.write_ulong(request_id);
@@ -208,6 +217,6 @@ public class RequestHeader
ServiceContext.writeSequence(out, service_context);
// No requesting principal in this new format.
- out.setCodeSet(cxCodeSet.find(service_context));
+ out.setCodeSet(CodeSetServiceContext.find(service_context));
}
}
diff --git a/libjava/classpath/gnu/CORBA/universalHolder.java b/libjava/classpath/gnu/CORBA/GeneralHolder.java
index c20dac442dd..ffba69d79f6 100644
--- a/libjava/classpath/gnu/CORBA/universalHolder.java
+++ b/libjava/classpath/gnu/CORBA/GeneralHolder.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.MARSHAL;
@@ -60,18 +60,18 @@ import java.io.IOException;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class universalHolder
+public class GeneralHolder
implements Streamable
{
/**
* The binary data, stored inside this holder.
*/
- private cdrBufOutput value = new cdrBufOutput();
+ private BufferedCdrOutput value = new BufferedCdrOutput();
/**
* Create the universal holder that uses the given buffer to store the data.
*/
- public universalHolder(cdrBufOutput buffer)
+ public GeneralHolder(BufferedCdrOutput buffer)
{
value = buffer;
}
@@ -89,9 +89,9 @@ public class universalHolder
{
try
{
- if (input instanceof cdrBufInput)
+ if (input instanceof BufferredCdrInput)
{
- cdrBufInput b = (cdrBufInput) input;
+ BufferredCdrInput b = (BufferredCdrInput) input;
value.write(b.buffer.getBuffer());
}
else
@@ -110,6 +110,7 @@ public class universalHolder
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Any;
t.initCause(ex);
throw t;
}
@@ -122,7 +123,9 @@ public class universalHolder
*/
public TypeCode _type()
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.Inappropriate;
+ throw bad;
}
/**
@@ -142,6 +145,7 @@ public class universalHolder
catch (IOException ex)
{
MARSHAL t = new MARSHAL();
+ t.minor = Minor.Any;
t.initCause(ex);
throw t;
}
@@ -158,13 +162,13 @@ public class universalHolder
/**
* Clone.
*/
- public universalHolder Clone()
+ public GeneralHolder Clone()
{
try
{
- cdrBufOutput nb = new cdrBufOutput(value.buffer.size());
+ BufferedCdrOutput nb = new BufferedCdrOutput(value.buffer.size());
value.buffer.writeTo(nb);
- return new universalHolder(nb);
+ return new GeneralHolder(nb);
}
catch (IOException ex)
{
diff --git a/libjava/classpath/gnu/CORBA/holderFactory.java b/libjava/classpath/gnu/CORBA/HolderLocator.java
index 159d22332dc..edd4d2cf7a4 100644
--- a/libjava/classpath/gnu/CORBA/holderFactory.java
+++ b/libjava/classpath/gnu/CORBA/HolderLocator.java
@@ -1,4 +1,4 @@
-/* holderFactory.java --
+/* HolderLocator.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -75,7 +75,7 @@ import org.omg.CORBA.ObjectHolder;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class holderFactory
+public class HolderLocator
{
/**
* The array, sufficiently large to use any {@link TCKind}._tk* constant as
diff --git a/libjava/classpath/gnu/CORBA/IOR.java b/libjava/classpath/gnu/CORBA/IOR.java
index 02e94aa6426..5d6d3152f8f 100644
--- a/libjava/classpath/gnu/CORBA/IOR.java
+++ b/libjava/classpath/gnu/CORBA/IOR.java
@@ -38,12 +38,12 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
-import gnu.CORBA.CDR.cdrInput;
-import gnu.CORBA.CDR.cdrOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.GIOP.CharSets_OSF;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.CompletionStatus;
@@ -59,6 +59,8 @@ import org.omg.IOP.TaggedProfileHelper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.zip.Adler32;
/**
* The implementaton of the Interoperable Object Reference (IOR). IOR can be
@@ -174,16 +176,16 @@ public class IOR
* The negotiated coding result for this IOR. Saves time, requred for
* negotiation computations.
*/
- public cxCodeSet negotiated;
+ public CodeSetServiceContext negotiated;
/**
* Read the code set profile information from the given input stream.
*
* @param profile a stream to read from.
*/
- public void read(cdrInput profile)
+ public void read(AbstractCdrInput profile)
{
- cdrBufInput encapsulation = profile.read_encapsulation();
+ BufferredCdrInput encapsulation = profile.read_encapsulation();
narrow.read(encapsulation);
wide.read(encapsulation);
}
@@ -201,9 +203,9 @@ public class IOR
*
* @param profile a stream to write into.
*/
- public void write(cdrOutput profile)
+ public void write(AbstractCdrOutput profile)
{
- cdrOutput encapsulation = profile.createEncapsulation();
+ AbstractCdrOutput encapsulation = profile.createEncapsulation();
narrow.write(encapsulation);
wide.write(encapsulation);
try
@@ -274,13 +276,13 @@ public class IOR
/**
* Write the internet profile (except the heading tag.
*/
- public void write(cdrOutput out)
+ public void write(AbstractCdrOutput out)
{
try
{
// Need to write the Internet profile into the separate
// stream as we must know the size in advance.
- cdrOutput b = out.createEncapsulation();
+ AbstractCdrOutput b = out.createEncapsulation();
version.write(b);
b.write_string(host);
@@ -310,6 +312,7 @@ public class IOR
catch (Exception e)
{
MARSHAL m = new MARSHAL("Unable to write Internet profile.");
+ m.minor = Minor.IOR;
m.initCause(e);
throw m;
}
@@ -392,7 +395,7 @@ public class IOR
buf.write(cx);
}
- cdrBufInput cdr = new cdrBufInput(buf.toByteArray());
+ BufferredCdrInput cdr = new BufferredCdrInput(buf.toByteArray());
r._read(cdr);
return r;
@@ -411,7 +414,7 @@ public class IOR
* @param c a stream to read from.
* @throws IOException if the stream throws it.
*/
- public void _read(cdrInput c)
+ public void _read(AbstractCdrInput c)
throws IOException, BAD_PARAM
{
int endian;
@@ -433,13 +436,13 @@ public class IOR
* If the stream contains a null value, the Id and Internet fields become
* equal to null. Otherwise Id contains some string (possibly empty).
*
- * Id is checked for null in cdrInput that then returns null instead of
+ * Id is checked for null in AbstractCdrInput that then returns null instead of
* object.
*
* @param c a stream to read from.
* @throws IOException if the stream throws it.
*/
- public void _read_no_endian(cdrInput c)
+ public void _read_no_endian(AbstractCdrInput c)
throws IOException, BAD_PARAM
{
Id = c.read_string();
@@ -456,7 +459,7 @@ public class IOR
for (int i = 0; i < n_profiles; i++)
{
int tag = c.read_long();
- cdrBufInput profile = c.read_encapsulation();
+ BufferredCdrInput profile = c.read_encapsulation();
if (tag == Internet_profile.TAG_INTERNET_IOP)
{
@@ -515,7 +518,7 @@ public class IOR
* Write this IOR record to the provided CDR stream. This procedure writes the
* zero (Big Endian) marker first.
*/
- public void _write(cdrOutput out)
+ public void _write(AbstractCdrOutput out)
{
// Always use Big Endian.
out.write(0);
@@ -528,7 +531,7 @@ public class IOR
* The null value is written as defined in OMG specification (zero length
* string, followed by an empty set of profiles).
*/
- public static void write_null(cdrOutput out)
+ public static void write_null(AbstractCdrOutput out)
{
// Empty Id string.
out.write_string("");
@@ -541,7 +544,7 @@ public class IOR
* Write this IOR record to the provided CDR stream. The procedure writed data
* in Big Endian, but does NOT add any endian marker to the beginning.
*/
- public void _write_no_endian(cdrOutput out)
+ public void _write_no_endian(AbstractCdrOutput out)
{
// Write repository id.
out.write_string(Id);
@@ -595,7 +598,7 @@ public class IOR
*/
public String toStringifiedReference()
{
- cdrBufOutput out = new cdrBufOutput();
+ BufferedCdrOutput out = new BufferedCdrOutput();
_write(out);
@@ -675,7 +678,7 @@ public class IOR
TaggedComponent[] present;
if (profile.profile_data.length > 0)
{
- cdrBufInput in = new cdrBufInput(profile.profile_data);
+ BufferredCdrInput in = new BufferredCdrInput(profile.profile_data);
present = new TaggedComponent[in.read_long()];
@@ -687,7 +690,7 @@ public class IOR
else
present = new TaggedComponent[0];
- cdrBufOutput out = new cdrBufOutput(profile.profile_data.length
+ BufferedCdrOutput out = new BufferedCdrOutput(profile.profile_data.length
+ component.component_data.length
+ 8);
@@ -715,4 +718,51 @@ public class IOR
// The future supported tagged profiles should be added here.
throw new BAD_PARAM("Unsupported profile type " + profile.tag);
}
+
+ /**
+ * Checks for equality.
+ */
+ public boolean equals(Object x)
+ {
+ if (x instanceof IOR)
+ {
+ boolean keys;
+ boolean hosts = true;
+
+ IOR other = (IOR) x;
+
+ if (Internet==null || other.Internet==null)
+ return Internet == other.Internet;
+
+ if (key != null && other.key != null)
+ keys = Arrays.equals(key, other.key);
+ else
+ keys = key == other.key;
+
+ if (Internet != null && Internet.host != null)
+ if (other.Internet != null && other.Internet.host != null)
+ hosts = other.Internet.host.equals(Internet.host);
+
+ return keys & hosts && Internet.port==other.Internet.port;
+ }
+ else
+ return false;
+ }
+
+ /**
+ * Get the hashcode of this IOR.
+ */
+ public int hashCode()
+ {
+ Adler32 adler = new Adler32();
+ if (key != null)
+ adler.update(key);
+ if (Internet != null)
+ {
+ if (Internet.host != null)
+ adler.update(Internet.host.getBytes());
+ adler.update(Internet.port);
+ }
+ return (int) adler.getValue();
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java b/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
index 88756988c92..2b77de58e0e 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
@@ -38,16 +38,20 @@ exception statement from your version. */
package gnu.CORBA.Interceptor;
+import org.omg.CORBA.OBJ_ADAPTER;
+import org.omg.CORBA.OMGVMCID;
import org.omg.PortableInterceptor.IORInfo;
import org.omg.PortableInterceptor.IORInterceptor;
import org.omg.PortableInterceptor.IORInterceptorOperations;
+import org.omg.PortableInterceptor.IORInterceptor_3_0Operations;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
/**
* A block of the all registered IOR interceptors.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class IORInterceptors implements IORInterceptorOperations
+public class IORInterceptors implements IORInterceptor_3_0Operations
{
/**
* The array of all registered IOR interceptors.
@@ -106,4 +110,81 @@ public class IORInterceptors implements IORInterceptorOperations
{
return getClass().getName();
}
+
+ /**
+ * Call this method for all registered CORBA 3.0 interceptors.
+ */
+ public void adapter_manager_state_changed(int adapterManagerId, short adapterState)
+ {
+ for (int i = 0; i < interceptors.length; i++)
+ {
+ try
+ {
+ if (interceptors[i] instanceof IORInterceptor_3_0Operations)
+ {
+ ((IORInterceptor_3_0Operations) interceptors[i]).
+ adapter_manager_state_changed(adapterManagerId, adapterState);
+ }
+ }
+ catch (Exception exc)
+ {
+ OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed");
+ oa.initCause(exc);
+ oa.minor = 6 | OMGVMCID.value;
+ throw oa;
+ }
+ }
+ }
+
+ /**
+ * Call this method for all registered CORBA 3.0 interceptors.
+ */
+ public void adapter_state_changed(ObjectReferenceTemplate[] adapters, short adaptersState)
+ {
+ for (int i = 0; i < interceptors.length; i++)
+ {
+ try
+ {
+ if (interceptors[i] instanceof IORInterceptor_3_0Operations)
+ {
+ ((IORInterceptor_3_0Operations) interceptors[i]).
+ adapter_state_changed(adapters, adaptersState);
+ }
+ }
+ catch (Exception exc)
+ {
+ OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed");
+ oa.initCause(exc);
+ oa.minor = 6 | OMGVMCID.value;
+ throw oa;
+ }
+ }
+ }
+
+ /**
+ * Call this method for all registered CORBA 3.0 interceptors.
+ *
+ * @throws OBJ_ADAPTER minor 6 on any failure (as defined by OMG specs).
+ */
+ public void components_established(IORInfo info)
+ {
+ for (int i = 0; i < interceptors.length; i++)
+ {
+ try
+ {
+ if (interceptors[i] instanceof IORInterceptor_3_0Operations)
+ {
+ ((IORInterceptor_3_0Operations) interceptors[i]).
+ components_established(info);
+ }
+ }
+ catch (Exception exc)
+ {
+ OBJ_ADAPTER oa = new OBJ_ADAPTER("components_established failed");
+ oa.initCause(exc);
+ oa.minor = 6 | OMGVMCID.value;
+ throw oa;
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java b/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
index ff35cd0c85e..4bb895bb376 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package gnu.CORBA.Interceptor;
import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.ObjectCreator;
import gnu.CORBA.gnuCodecFactory;
import org.omg.CORBA.BAD_INV_ORDER;
@@ -87,7 +88,7 @@ public class Registrator extends LocalObject implements ORBInitInfo
/**
* The agreed properties prefix.
*/
- public final static String m_prefix =
+ public static final String m_prefix =
"org.omg.PortableInterceptor.ORBInitializerClass.";
/**
@@ -182,7 +183,8 @@ public class Registrator extends LocalObject implements ORBInitInfo
try
{
String cn = sk.substring(m_prefix.length());
- Class iClass = Class.forName(cn);
+ Class iClass = ObjectCreator.forName(cn);
+
ORBInitializer initializer =
(ORBInitializer) iClass.newInstance();
m_initializers.add(initializer);
@@ -467,4 +469,4 @@ public class Registrator extends LocalObject implements ORBInitInfo
{
return m_ior.size() > 0;
}
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java b/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java
index ee8af7fc0b4..a33afc3362e 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/gnuIcCurrent.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.Interceptor;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.Poa.ORB_1_4;
import org.omg.CORBA.Any;
@@ -198,7 +198,7 @@ public class gnuIcCurrent extends ObjectImpl implements Current
Any[] r = get_slots();
Any[] copy = new Any[ r.length ];
- cdrBufOutput buf = new cdrBufOutput();
+ BufferedCdrOutput buf = new BufferedCdrOutput();
buf.setOrb(orb);
for (int i = 0; i < copy.length; i++)
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java b/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java
index 1c406cb5e46..256a28cb567 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/gnuIorInfo.java
@@ -40,12 +40,14 @@ package gnu.CORBA.Interceptor;
import gnu.CORBA.IOR;
import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.Poa.gnuPOA;
import org.omg.CORBA.LocalObject;
import org.omg.CORBA.Policy;
import org.omg.IOP.TaggedComponent;
import org.omg.PortableInterceptor.IORInfo;
-import org.omg.PortableServer.POA;
+import org.omg.PortableInterceptor.ObjectReferenceFactory;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
/**
* Implements IORInfo.
@@ -67,7 +69,7 @@ public class gnuIorInfo extends LocalObject implements IORInfo
/**
* The POA, to that IOR is related.
*/
- public final POA poa;
+ public final gnuPOA poa;
/**
* The IOR itself.
@@ -77,7 +79,7 @@ public class gnuIorInfo extends LocalObject implements IORInfo
/**
* Create an instance.
*/
- public gnuIorInfo(ORB_1_4 an_orb, POA a_poa, IOR an_ior)
+ public gnuIorInfo(ORB_1_4 an_orb, gnuPOA a_poa, IOR an_ior)
{
orb = an_orb;
poa = a_poa;
@@ -113,8 +115,42 @@ public class gnuIorInfo extends LocalObject implements IORInfo
/**
* Return the state of the object POA.
*/
- short state()
+ public short state()
{
return (short) poa.the_POAManager().get_state().value();
}
+
+ /**
+ * Get the adapter template, associated with this poa.
+ */
+ public ObjectReferenceTemplate adapter_template()
+ {
+ return poa.getReferenceTemplate();
+ }
+
+ /**
+ * Get the object factory of the current POA.
+ */
+ public ObjectReferenceFactory current_factory()
+ {
+ return poa.getReferenceFactory();
+ }
+
+ /**
+ * Set the object factory of the current POA.
+ */
+ public void current_factory(ObjectReferenceFactory factory)
+ {
+ poa.setReferenceFactory(factory);
+ }
+
+ /**
+ * The method currently uses system identity hashcode that should be
+ * different for each object.
+ */
+ public int manager_id()
+ {
+ // The System.identityHashCode is also called in gnuPoaManager.
+ return System.identityHashCode(poa.the_POAManager());
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java b/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java
index 5f75f76878a..8d5c681e705 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/gnuServerRequestInfo.java
@@ -42,6 +42,7 @@ import gnu.CORBA.GIOP.ReplyHeader;
import gnu.CORBA.GIOP.RequestHeader;
import gnu.CORBA.ObjectCreator;
import gnu.CORBA.Poa.gnuServantObject;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.Unexpected;
import gnu.CORBA.gnuRequest;
@@ -453,4 +454,23 @@ public class gnuServerRequestInfo extends LocalObject
}
return p;
}
+
+ /** @inheritDoc */
+ public String[] adapter_name()
+ {
+ return m_object.poa.getReferenceTemplate().adapter_name();
+ }
+
+ /** @inheritDoc */
+ public String orb_id()
+ {
+ return m_object.orb.orb_id;
+ }
+
+ /** @inheritDoc */
+ public String server_id()
+ {
+ return OrbFunctional.server_id;
+ }
+
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/IOR_Delegate.java b/libjava/classpath/gnu/CORBA/IorDelegate.java
index 3b64eb585c4..27fb5de9a55 100644
--- a/libjava/classpath/gnu/CORBA/IOR_Delegate.java
+++ b/libjava/classpath/gnu/CORBA/IorDelegate.java
@@ -38,9 +38,8 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
+import gnu.CORBA.CDR.BufferredCdrInput;
import gnu.CORBA.GIOP.ReplyHeader;
-import gnu.CORBA.Poa.activeObjectMap;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.Context;
@@ -70,23 +69,12 @@ import java.net.Socket;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class IOR_Delegate extends Simple_delegate
+public class IorDelegate extends SimpleDelegate
{
/**
- * True if the current IOR does not map into the local servant. If false, the
- * IOR is either local or should be checked.
- */
- boolean remote_ior;
-
- /**
- * If not null, this field contains data about the local servant.
- */
- activeObjectMap.Obj local_ior;
-
- /**
* Contructs an instance of object using the given IOR.
*/
- public IOR_Delegate(ORB an_orb, IOR an_ior)
+ public IorDelegate(ORB an_orb, IOR an_ior)
{
super(an_orb, an_ior);
}
@@ -168,37 +156,36 @@ public class IOR_Delegate extends Simple_delegate
* request to the new direction. The ReplyHeader.LOCATION_FORWARD_PERM will
* cause additionally to remember the new location by this delegate, so
* subsequent calls will be immediately delivered to the new target.
- *
+ *
* @param target the target object.
* @param output the output stream, previously returned by
* {@link #request(org.omg.CORBA.Object, String, boolean)}.
- *
+ *
* @return the input stream, to read the response from or null for a one-way
* request.
- *
+ *
* @throws SystemException if the SystemException has been thrown on the
* remote side (the exact type and the minor code matches the data of the
* remote exception that has been thrown).
- *
+ *
* @throws org.omg.CORBA.portable.ApplicationException as specified.
* @throws org.omg.CORBA.portable.RemarshalException as specified.
*/
public InputStream invoke(org.omg.CORBA.Object target, OutputStream output)
throws ApplicationException, RemarshalException
{
- streamRequest request = (streamRequest) output;
- Forwardings:
- while (true)
+ StreamBasedRequest request = (StreamBasedRequest) output;
+ Forwardings: while (true)
{
try
{
if (request.response_expected)
{
- binaryReply response = request.request.submit();
+ RawReply response = request.request.submit();
// Read reply header.
ReplyHeader rh = response.header.create_reply_header();
- cdrBufInput input = response.getStream();
+ BufferredCdrInput input = response.getStream();
input.setOrb(orb);
rh.read(input);
request.request.m_rph = rh;
@@ -207,34 +194,33 @@ public class IOR_Delegate extends Simple_delegate
switch (rh.reply_status)
{
- case ReplyHeader.NO_EXCEPTION :
+ case ReplyHeader.NO_EXCEPTION:
if (request.request.m_interceptor != null)
- request.request.m_interceptor.
- receive_reply(request.request.m_info);
+ request.request.m_interceptor.receive_reply(request.request.m_info);
if (response.header.version.since_inclusive(1, 2))
input.align(8);
return input;
- case ReplyHeader.SYSTEM_EXCEPTION :
+ case ReplyHeader.SYSTEM_EXCEPTION:
if (response.header.version.since_inclusive(1, 2))
input.align(8);
showException(request, input);
- throw ObjectCreator.readSystemException(input);
+ throw ObjectCreator.readSystemException(input,
+ rh.service_context);
- case ReplyHeader.USER_EXCEPTION :
+ case ReplyHeader.USER_EXCEPTION:
if (response.header.version.since_inclusive(1, 2))
input.align(8);
showException(request, input);
- throw new ApplicationException(request.
- request.m_exception_id, input
- );
+ throw new ApplicationException(
+ request.request.m_exception_id, input);
- case ReplyHeader.LOCATION_FORWARD_PERM :
+ case ReplyHeader.LOCATION_FORWARD_PERM:
moved_permanently = true;
- case ReplyHeader.LOCATION_FORWARD :
+ case ReplyHeader.LOCATION_FORWARD:
if (response.header.version.since_inclusive(1, 2))
input.align(8);
@@ -245,10 +231,8 @@ public class IOR_Delegate extends Simple_delegate
}
catch (IOException ex)
{
- MARSHAL t =
- new MARSHAL("Cant read forwarding info", 5102,
- CompletionStatus.COMPLETED_NO
- );
+ MARSHAL t = new MARSHAL("Cant read forwarding info",
+ 5102, CompletionStatus.COMPLETED_NO);
t.initCause(ex);
throw t;
}
@@ -277,8 +261,8 @@ public class IOR_Delegate extends Simple_delegate
r.setIor(forwarded);
- IOR_contructed_object it =
- new IOR_contructed_object(orb, forwarded);
+ IorObject it = new IorObject(orb,
+ forwarded);
r.m_target = it;
@@ -298,11 +282,10 @@ public class IOR_Delegate extends Simple_delegate
setIor(prev_ior);
}
- default :
- throw new MARSHAL("Unknow reply status: " +
- rh.reply_status, 8000 + rh.reply_status,
- CompletionStatus.COMPLETED_NO
- );
+ default:
+ throw new MARSHAL("Unknow reply status: "
+ + rh.reply_status, 8000 + rh.reply_status,
+ CompletionStatus.COMPLETED_NO);
}
}
else
@@ -314,8 +297,7 @@ public class IOR_Delegate extends Simple_delegate
catch (ForwardRequest forwarded)
{
ForwardRequest fw = forwarded;
- Forwarding2:
- while (true)
+ Forwarding2: while (true)
{
try
{
@@ -356,7 +338,7 @@ public class IOR_Delegate extends Simple_delegate
/**
* Show exception to interceptor.
*/
- void showException(streamRequest request, cdrBufInput input)
+ void showException(StreamBasedRequest request, BufferredCdrInput input)
throws ForwardRequest
{
input.mark(2048);
@@ -408,9 +390,10 @@ public class IOR_Delegate extends Simple_delegate
request.set_target(target);
request.setOperation(operation);
- streamRequest out = request.getParameterStream();
+ StreamBasedRequest out = request.getParameterStream();
out.response_expected = response_expected;
request.setORB(orb);
+ out.setOrb(orb);
return out;
}
@@ -447,8 +430,6 @@ public class IOR_Delegate extends Simple_delegate
public void setIor(IOR an_ior)
{
super.setIor(an_ior);
- remote_ior = false;
- local_ior = null;
}
/**
@@ -456,11 +437,6 @@ public class IOR_Delegate extends Simple_delegate
*/
public boolean is_local(org.omg.CORBA.Object self)
{
- if (remote_ior)
- return false;
- else if (local_ior != null)
- return true;
- else
- return super.is_local(self);
+ return false;
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/IOR_contructed_object.java b/libjava/classpath/gnu/CORBA/IorObject.java
index 2fab70799db..02f5a495d49 100644
--- a/libjava/classpath/gnu/CORBA/IOR_contructed_object.java
+++ b/libjava/classpath/gnu/CORBA/IorObject.java
@@ -1,4 +1,4 @@
-/* IOR_contructed_object.java --
+/* IorObject.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,8 +46,9 @@ import org.omg.CORBA.portable.ObjectImpl;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class IOR_contructed_object
+public class IorObject
extends ObjectImpl
+ implements IorProvider
{
/**
* The IOR, from which the object was constructed.
@@ -64,10 +65,10 @@ public class IOR_contructed_object
*
* @param an_ior the IOR.
*/
- public IOR_contructed_object(ORB orb, IOR an_ior)
+ public IorObject(ORB orb, IOR an_ior)
{
ior = an_ior;
- _set_delegate(new IOR_Delegate(orb, ior));
+ _set_delegate(new IorDelegate(orb, ior));
id = new String[] { ior.Id };
}
@@ -76,12 +77,20 @@ public class IOR_contructed_object
*
* @param an_ior the IOR in the string form.
*/
- public IOR_contructed_object(Functional_ORB orb, String an_ior)
+ public IorObject(OrbFunctional orb, String an_ior)
{
ior = IOR.parse(an_ior);
- _set_delegate(new IOR_Delegate(orb, ior));
+ _set_delegate(new IorDelegate(orb, ior));
id = new String[] { ior.Id };
}
+
+ /**
+ * Get the IOR of this object.
+ */
+ public IOR getIor()
+ {
+ return ior;
+ }
public String[] _ids()
{
diff --git a/libjava/classpath/org/omg/CORBA/IDLEntity.java b/libjava/classpath/gnu/CORBA/IorProvider.java
index 6515d83305b..875b5de1f7d 100644
--- a/libjava/classpath/org/omg/CORBA/IDLEntity.java
+++ b/libjava/classpath/gnu/CORBA/IorProvider.java
@@ -1,4 +1,4 @@
-/* IDLEntity.java --
+/* IorProvider.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,16 +35,18 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
-package org.omg.CORBA;
-
-import java.io.Serializable;
+package gnu.CORBA;
/**
- * Indicates that this class has a corresponding Helper class.
- * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ * Marks the possibility of the implementing object to return the associated
+ * IOR.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface IDLEntity
- extends Serializable
+public interface IorProvider
{
+ /**
+ * Get the IOR of the associated object.
+ */
+ IOR getIor();
}
diff --git a/libjava/classpath/gnu/CORBA/Minor.java b/libjava/classpath/gnu/CORBA/Minor.java
new file mode 100644
index 00000000000..511a34d559b
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/Minor.java
@@ -0,0 +1,282 @@
+/* Minor.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package gnu.CORBA;
+
+
+/**
+ * Provides information and operations, related to about the 20 bit vendor minor
+ * code Id. This code is included into all CORBA system exceptions and is also
+ * transferred to remote side.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface Minor
+{
+ // Note: MARSHAL done.
+
+ /* MARSHAL */
+
+ /**
+ * The GNU Classpath VMCID. The last 12 bits can be used to mark up to 4096
+ * possible exceptions.
+ */
+ int vendor = 0x47430000;
+
+ /*
+ * Minor codes form MARSHAL exception.
+ */
+
+ /**
+ * The message being received is not a GIOP message. It does not start from
+ * the expected magic sequence byte[] { 'G', 'I', 'O', 'P' }.
+ */
+ int Giop = 1 | vendor;
+
+ /**
+ * The unexpected IOException while reading or writing the GIOP message header
+ * or the subsequent request or response header
+ */
+ int Header = 2 | vendor;
+
+ /**
+ * The data stream ended before reading all expected values from it. This
+ * usually means that the CORBA message is corrupted, but may also indicate
+ * that the server expects the remote method being invoked to have more or
+ * different parameters.
+ */
+ int EOF = 3 | vendor;
+
+ /**
+ * The unexpected IOException while reading or writing the data via Commond
+ * Data Representation stream.
+ */
+ int CDR = 5 | vendor;
+
+ /**
+ * The unexpected IOException while reading or writing the Value type.
+ */
+ int Value = 6 | vendor;
+
+ /**
+ * The unexpected IOException while handling request forwarding.
+ */
+ int Forwarding = 7 | vendor;
+
+ /**
+ * The unexpected IOException while handling data encapsulation, tagged
+ * components, tagged profiles, etc.
+ */
+ int Encapsulation = 8 | vendor;
+
+ /**
+ * The unexpected IOException while inserting or extracting data to/from the
+ * Any or DynamicAny.
+ */
+ int Any = 9 | vendor;
+
+ /**
+ * The unexpected UserException in the context where it cannot be handled and
+ * must be converted to the SystemException.
+ */
+ int UserException = 10 | vendor;
+
+ /**
+ * While the operation could formally be applied to the target, the OMG
+ * standard states that it is actually not applicable. For example, some CORBA
+ * objects like POA are always local and should not be passed to or returned
+ * from the remote side.
+ */
+ int Inappropriate = 11 | vendor;
+
+ /**
+ * When reading data, it was discovered that size of the data structure like
+ * string, sequence or character is written as the negative number.
+ */
+ int Negative = 12 | vendor;
+
+ /**
+ * Reference to non-existing node in the data grapth while reading the value
+ * types.
+ */
+ int Graph = 14 | vendor;
+
+ /**
+ * Unexpected exception was thrown from the IDL type helper while handling the
+ * object of this type as a boxed value.
+ */
+ int Boxed = 15 | vendor;
+
+ /**
+ * Unable to instantiate an value type object while reading it from the
+ * stream.
+ */
+ int Instantiation = 16 | vendor;
+
+ /**
+ * The header tag of the value type being read from the CDR stream contains an
+ * unexpected value outside 0x7fffff00 .. 0x7fffffff and also not null and not
+ * an indirection.
+ */
+ int ValueHeaderTag = 17 | vendor;
+
+ /**
+ * The header tag flags of the value type being read from the CDR stream make
+ * the invalid combination (for instance, 0x7fffff04).
+ */
+ int ValueHeaderFlags = 18 | vendor;
+
+ /**
+ * The value type class, written on the wire, is not compatible with the
+ * expected class, passed as a parameter to the InputStream.read_value.
+ */
+ int ClassCast = 19 | vendor;
+
+ /**
+ * Positive or otherwise invalid indirection offset when reading the data
+ * graph of the value type.
+ */
+ int Offset = 20 | vendor;
+
+ /**
+ * Errors while reading the chunked value type.
+ */
+ int Chunks = 21 | vendor;
+
+ /**
+ * No means are provided to write this value type.
+ */
+ int UnsupportedValue = 22 | vendor;
+
+ /**
+ * The value factory, required for the operation being invoked, is not
+ * registered with this ORB.
+ */
+ int Factory = 23 | vendor;
+
+ /**
+ * Unsupported object addressing method in GIOP request header.
+ */
+ int UnsupportedAddressing = 24 | vendor;
+
+ /**
+ * Invalid stringified object reference (IOR).
+ */
+ int IOR = 25 | vendor;
+
+ /**
+ * Problems with converting between stubs, ties, interfaces and
+ * implementations.
+ */
+ int TargetConversion = 26 | vendor;
+
+ /**
+ * Problems with reading or writing the fields of the value type object.
+ */
+ int ValueFields = 27 | vendor;
+
+ /**
+ * The instance of the value type is not serializable.
+ */
+ int NonSerializable = 28 | vendor;
+
+ /* BAD_OPERATION */
+
+ /**
+ * The remote side requested to invoke the method that is not available on
+ * that target (client and server probably disagree in the object definition).
+ */
+ int Method = 0 | vendor;
+
+ /**
+ * Failed to activate the inactive object.
+ */
+ int Activation = 10 | vendor;
+
+ /*
+ * Any - Attempt to extract from the Any value of the different type that was
+ * stored into that Any.
+ */
+
+ /* ClassCast - Unable to narrow the object into stub. */
+
+ /**
+ * The policies, applying to ORB or POA prevent the requested operation.
+ */
+ int Policy = 11 | vendor;
+
+ /**
+ * Socket related errors like failure to open socket on the expected port,
+ * failure to get a free port when required and so on.
+ */
+ int Socket = 12 | vendor;
+
+ /**
+ * The passed value for enumeration is outside the valid range for that
+ * enumeration.
+ */
+ int Enumeration = 14 | vendor;
+
+ /**
+ * The passed policy code is outside the valid range of the possible policies
+ * for the given policy type.
+ */
+ int PolicyType = 15 | vendor;
+
+ /* NO_RESOURCES */
+
+ /**
+ * Unable to get a free port for a new socket. Proably too many objects under
+ * unsuitable POA policy.
+ */
+ int Ports = 20 | vendor;
+
+ /**
+ * Too many parallel calls (too many parallel threads). The thread control
+ * prevents malicios client from knocking the server out by suddenly
+ * submitting large number of requests.
+ */
+ int Threads = 21 | vendor;
+
+ /**
+ * The IOR starts with file://, http:// or ftp://, but this local or remote
+ * resource is not accessible.
+ */
+ int Missing_IOR = 22 | vendor;
+
+}
diff --git a/libjava/classpath/gnu/CORBA/NamingService/Ext.java b/libjava/classpath/gnu/CORBA/NamingService/Ext.java
index fb7406c4618..ee27e68cd79 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/Ext.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/Ext.java
@@ -73,7 +73,7 @@ public class Ext
* The converter class converts between string and array form of the
* name.
*/
- private snConverter converter = new snConverter();
+ private NameTransformer converter = new NameTransformer();
/**
* Create the extensions for the given instance of the context.
diff --git a/libjava/classpath/gnu/CORBA/NamingService/cmpNameComponent.java b/libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java
index 1e06fb8ee35..6116ba94e74 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/cmpNameComponent.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameComponentComparator.java
@@ -1,4 +1,4 @@
-/* cmpNameComponent.java --
+/* NameComponentComparator.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,18 +49,18 @@ import java.util.Comparator;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public final class cmpNameComponent
+public final class NameComponentComparator
implements Comparator
{
/**
* The singleton instance of the name comparator.
*/
- public static final cmpNameComponent singleton = new cmpNameComponent();
+ public static final NameComponentComparator singleton = new NameComponentComparator();
/**
* It is enough to have a singleton.
*/
- private cmpNameComponent()
+ private NameComponentComparator()
{
}
@@ -93,6 +93,6 @@ public final class cmpNameComponent
*/
public boolean equals(Object x)
{
- return x instanceof cmpNameComponent;
+ return x instanceof NameComponentComparator;
}
}
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NameParser.java b/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
index f886cf93533..422db1c58da 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
@@ -1,44 +1,45 @@
/* NameParser.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
- This file is part of GNU Classpath.
-
- GNU Classpath 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, or (at your option)
- any later version.
-
- GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
package gnu.CORBA.NamingService;
-import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
import gnu.CORBA.Unexpected;
import gnu.CORBA.Version;
@@ -51,11 +52,15 @@ import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.ObjectImpl;
import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextExtHelper;
-import org.omg.CosNaming.NamingContextHelper;
import org.omg.CosNaming._NamingContextStub;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.StringTokenizer;
@@ -74,7 +79,7 @@ import java.util.StringTokenizer;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class NameParser
- extends snConverter
+ extends NameTransformer
{
/**
* The corbaloc prefix.
@@ -90,6 +95,21 @@ public class NameParser
* The IOR prefix.
*/
public static final String pxIOR = "ior";
+
+ /**
+ * The file:// prefix.
+ */
+ public static final String pxFILE = "file://";
+
+ /**
+ * The ftp:// prefix.
+ */
+ public static final String pxFTP = "ftp://";
+
+ /**
+ * The http:// prefix.
+ */
+ public static final String pxHTTP = "http://";
/**
* Marks iiop protocol.
@@ -114,7 +134,7 @@ public class NameParser
/**
* The string to name converter, initialized on demand.
*/
- static snConverter converter;
+ static NameTransformer converter;
/**
* The current position.
@@ -134,6 +154,9 @@ public class NameParser
* 2. corbaloc:rir:[/key] <br>
* 3. corbaname:[iiop][version.subversion@]:host[:port]/key <br>
* 4. corbaname:rir:[/key] <br>
+ * 5. file://[file name]<br>
+ * 6. http://[url]<br>
+ * 7. ftp://[url]<br>
*
* Protocol defaults to IOP, the object key defaults to the NameService.
*
@@ -143,9 +166,31 @@ public class NameParser
* @return the resolved object.
*/
public synchronized org.omg.CORBA.Object corbaloc(String corbaloc,
- Functional_ORB orb)
+ OrbFunctional orb)
throws BAD_PARAM
{
+ return corbaloc(corbaloc, orb, 0);
+ }
+
+ /**
+ * Parse controlling against the infinite recursion loop.
+ */
+ private org.omg.CORBA.Object corbaloc(String corbaloc,
+ OrbFunctional orb, int recursion)
+ {
+ // The used CORBA specification does not state how many times we should to
+ //redirect, but the infinite loop may be used to knock out the system.
+ // by malicious attempt.
+ if (recursion > 10)
+ throw new DATA_CONVERSION("More than 10 redirections");
+
+ if (corbaloc.startsWith(pxFILE))
+ return corbaloc(readFile(corbaloc.substring(pxFILE.length())), orb, recursion+1);
+ else if (corbaloc.startsWith(pxHTTP))
+ return corbaloc(readUrl(corbaloc), orb, recursion+1);
+ else if (corbaloc.startsWith(pxFTP))
+ return corbaloc(readUrl(corbaloc), orb, recursion+1);
+
boolean corbaname;
// The alternative addresses, if given.
@@ -304,6 +349,70 @@ public class NameParser
else
throw new DATA_CONVERSION("Unsupported protocol '" + t[p] + "'");
}
+
+ /**
+ * Read IOR from the file in the local file system.
+ */
+ String readFile(String file)
+ {
+ File f = new File(file);
+ if (!f.exists())
+ {
+ DATA_CONVERSION err = new DATA_CONVERSION(f.getAbsolutePath()
+ + " does not exist.");
+ err.minor = Minor.Missing_IOR;
+ }
+ try
+ {
+ char[] c = new char[(int) f.length()];
+ FileReader fr = new FileReader(f);
+ fr.read(c);
+ fr.close();
+ return new String(c).trim();
+ }
+ catch (IOException ex)
+ {
+ DATA_CONVERSION d = new DATA_CONVERSION();
+ d.initCause(ex);
+ d.minor = Minor.Missing_IOR;
+ throw (d);
+ }
+ }
+
+ /**
+ * Read IOR from the remote URL.
+ */
+ String readUrl(String url)
+ {
+ URL u;
+ try
+ {
+ u = new URL(url);
+ }
+ catch (MalformedURLException mex)
+ {
+ throw new BAD_PARAM("Malformed URL: '" + url + "'");
+ }
+
+ try
+ {
+ InputStreamReader r = new InputStreamReader(u.openStream());
+
+ StringBuffer b = new StringBuffer();
+ int c;
+
+ while ((c = r.read()) > 0)
+ b.append((char) c);
+
+ return b.toString().trim();
+ }
+ catch (Exception exc)
+ {
+ DATA_CONVERSION d = new DATA_CONVERSION("Reading " + url + " failed.");
+ d.minor = Minor.Missing_IOR;
+ throw d;
+ }
+ }
private org.omg.CORBA.Object resolve(org.omg.CORBA.Object object)
{
@@ -329,7 +438,7 @@ public class NameParser
}
if (converter == null)
- converter = new snConverter();
+ converter = new NameTransformer();
try
{
@@ -380,7 +489,7 @@ public class NameParser
static NameParser n = new NameParser();
- static void corbalocT(String ior, Functional_ORB orb)
+ static void corbalocT(String ior, OrbFunctional orb)
{
System.out.println(ior);
System.out.println(n.corbaloc(ior, orb));
@@ -391,7 +500,7 @@ public class NameParser
{
try
{
- Functional_ORB orb = (Functional_ORB) ORB.init(args, null);
+ OrbFunctional orb = (OrbFunctional) ORB.init(args, null);
corbalocT("corbaloc:iiop:1.3@155axyz.com/Prod/aTradingService", orb);
corbalocT("corbaloc:iiop:2.7@255bxyz.com/Prod/bTradingService", orb);
corbalocT("corbaloc:iiop:355cxyz.com/Prod/cTradingService", orb);
diff --git a/libjava/classpath/gnu/CORBA/NamingService/snConverter.java b/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
index a9b9219d76a..0e0782a5756 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/snConverter.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
@@ -1,4 +1,4 @@
-/* snConverter.java --
+/* NameTransformer.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ import java.util.StringTokenizer;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class snConverter
+public class NameTransformer
{
/**
* A string, indicating the escape character.
@@ -301,7 +301,7 @@ public class snConverter
NameComponent b = new NameComponent("b/z", "b.k");
NameComponent c = new NameComponent("c", "");
- snConverter sn = new snConverter();
+ NameTransformer sn = new NameTransformer();
try
{
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java b/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java
index a69b0617269..95deb0096bd 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NamingMap.java
@@ -66,7 +66,7 @@ public class NamingMap
*/
public NamingMap()
{
- map = new TreeMap(cmpNameComponent.singleton);
+ map = new TreeMap(NameComponentComparator.singleton);
}
/**
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java b/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
index e46bed7f7a1..bf72637d7d7 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NamingServiceTransient.java
@@ -1,4 +1,4 @@
-/* Server.java --
+/* NamingServiceTransient.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.NamingService;
-import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
import org.omg.CosNaming.NamingContextExt;
@@ -102,7 +102,7 @@ public class NamingServiceTransient
try
{
// Create and initialize the ORB
- final Functional_ORB orb = new Functional_ORB();
+ final OrbFunctional orb = new OrbFunctional();
if (args.length > 1)
for (int i = 0; i < args.length - 1; i++)
@@ -114,7 +114,7 @@ public class NamingServiceTransient
iorf = args[i + 1];
}
- Functional_ORB.setPort(port);
+ OrbFunctional.setPort(port);
// Create the servant and register it with the ORB
NamingContextExt namer = new Ext(new TransientContext());
@@ -159,6 +159,6 @@ public class NamingServiceTransient
// Restore the default value for allocating ports for the subsequent
// objects.
- Functional_ORB.setPort(Functional_ORB.DEFAULT_INITIAL_PORT);
+ OrbFunctional.setPort(OrbFunctional.DEFAULT_INITIAL_PORT);
}
}
diff --git a/libjava/classpath/gnu/CORBA/ObjectCreator.java b/libjava/classpath/gnu/CORBA/ObjectCreator.java
index 81c1d06e775..5937e76b31e 100644
--- a/libjava/classpath/gnu/CORBA/ObjectCreator.java
+++ b/libjava/classpath/gnu/CORBA/ObjectCreator.java
@@ -38,27 +38,37 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.UnknownExceptionCtxHandler;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.CDR.AbstractCdrInput;
+import gnu.CORBA.GIOP.ServiceContext;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.classpath.VMStackWalker;
import org.omg.CORBA.Any;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.CompletionStatusHelper;
import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.StructMember;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.UNKNOWN;
import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ValueBase;
-import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import javax.rmi.CORBA.Util;
/**
* Creates java objects from the agreed IDL names for the simple case when the
* CORBA object is directly mapped into the locally defined java class.
- *
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class ObjectCreator
@@ -79,91 +89,137 @@ public class ObjectCreator
public static final String CLASSPATH_PREFIX = "gnu.CORBA.";
/**
+ * Maps classes to they IDL or RMI names. Computing RMI name is an expensive
+ * operations, so frequently used RMI keys are reused. The map must be weak to
+ * ensure that the class can be unloaded, when applicable.
+ */
+ public static Map m_names = new WeakHashMap();
+
+ /**
+ * Maps IDL strings into known classes. The map must be weak to ensure that
+ * the class can be unloaded, when applicable.
+ */
+ public static Map m_classes = new WeakHashMap();
+
+ /**
+ * Maps IDL types to they helpers.
+ */
+ public static Map m_helpers = new WeakHashMap();
+
+ /**
* Try to instantiate an object with the given IDL name. The object must be
* mapped to the local java class. The omg.org domain must be mapped into the
* object in either org/omg or gnu/CORBA namespace.
- *
+ *
* @param IDL name
* @return instantiated object instance or null if no such available.
*/
public static java.lang.Object createObject(String idl, String suffix)
{
- try
- {
- return Class.forName(toClassName(JAVA_PREFIX, idl) + suffix)
- .newInstance();
- }
- catch (Exception ex)
+ synchronized (m_classes)
{
- try
+ Class known = (Class) (suffix == null ? m_classes.get(idl)
+ : m_classes.get(idl + 0xff + suffix));
+ Object object;
+
+ if (known != null)
{
- return Class.forName(toClassName(CLASSPATH_PREFIX, idl) + suffix)
- .newInstance();
+ try
+ {
+ return known.newInstance();
+ }
+ catch (Exception ex)
+ {
+ RuntimeException rex = new RuntimeException(idl + " suffix "
+ + suffix, ex);
+ throw rex;
+ }
}
- catch (Exception exex)
+ else
{
- return null;
+ if (suffix == null)
+ suffix = "";
+ try
+ {
+ known = forName(toClassName(JAVA_PREFIX, idl) + suffix);
+ object = known.newInstance();
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ known = forName(toClassName(CLASSPATH_PREFIX, idl)
+ + suffix);
+ object = known.newInstance();
+ }
+ catch (Exception exex)
+ {
+ return null;
+ }
+ }
+ m_classes.put(idl + 0xff + suffix, known);
+ return object;
}
}
}
/**
- * Create the system exception with the given idl name.
- *
- * @param idl the exception IDL name, must match the syntax "IDL:<class/name>:1.0".
- * @param minor the exception minor code.
- * @param completed the exception completion status.
- *
- * @return the created exception.
+ * Read the system exception from the given stream.
+ *
+ * @param input the CDR stream to read from.
+ * @param contexts the service contexts in request/reply header/
+ *
+ * @return the exception that has been stored in the stream (IDL name, minor
+ * code and completion status).
*/
- public static SystemException createSystemException(String idl, int minor,
- CompletionStatus completed
- )
+ public static SystemException readSystemException(InputStream input,
+ ServiceContext[] contexts)
{
+ SystemException exception;
+
+ String idl = input.read_string();
+ int minor = input.read_ulong();
+ CompletionStatus completed = CompletionStatusHelper.read(input);
+
try
{
- String cl = toClassName(JAVA_PREFIX, idl);
- Class exClass = Class.forName(cl);
-
- Constructor constructor =
- exClass.getConstructor(new Class[]
- {
- String.class, int.class, CompletionStatus.class
- }
- );
-
- Object exception =
- constructor.newInstance(new Object[]
- {
- " Remote exception " + idl + ", minor " + minor + ", " +
- completed + ".", new Integer(minor), completed
- }
- );
-
- return (SystemException) exception;
+ exception = (SystemException) createObject(idl, null);
+ exception.minor = minor;
+ exception.completed = completed;
}
catch (Exception ex)
{
- ex.printStackTrace();
- return new UNKNOWN("Unsupported system exception", minor, completed);
+ UNKNOWN u = new UNKNOWN("Unsupported system exception " + idl, minor,
+ completed);
+ u.initCause(ex);
+ throw u;
}
- }
- /**
- * Read the system exception from the given stream.
- *
- * @param input the CDR stream to read from.
- * @return the exception that has been stored in the stream (IDL name, minor
- * code and completion status).
- */
- public static SystemException readSystemException(InputStream input)
- {
- String idl = input.read_string();
- int minor = input.read_ulong();
- CompletionStatus status = CompletionStatusHelper.read(input);
+ try
+ {
+ // If UnknownExceptionInfo is present in the contexts, read it and
+ // set as a cause of this exception.
+ ServiceContext uEx = ServiceContext.find(
+ ServiceContext.UnknownExceptionInfo, contexts);
- SystemException exception =
- ObjectCreator.createSystemException(idl, minor, status);
+ if (uEx != null)
+ {
+ BufferredCdrInput in = new BufferredCdrInput(uEx.context_data);
+ in.setOrb(in.orb());
+ if (input instanceof AbstractCdrInput)
+ {
+ ((AbstractCdrInput) input).cloneSettings(in);
+ }
+
+ Throwable t = UnknownExceptionCtxHandler.read(in, contexts);
+ exception.initCause(t);
+ }
+ }
+ catch (Exception ex)
+ {
+ // Unsupported context format. Do not terminate as the user program may
+ // not need it.
+ }
return exception;
}
@@ -172,10 +228,10 @@ public class ObjectCreator
* Reads the user exception, having the given Id, from the input stream. The
* id is expected to be in the form like
* 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
- *
+ *
* @param idl the exception idl name.
* @param input the stream to read from.
- *
+ *
* @return the loaded exception.
* @return null if the helper class cannot be found.
*/
@@ -183,13 +239,10 @@ public class ObjectCreator
{
try
{
- String helper = toHelperName(idl);
- Class helperClass = Class.forName(helper);
+ Class helperClass = findHelper(idl);
- Method read =
- helperClass.getMethod("read",
- new Class[] { org.omg.CORBA.portable.InputStream.class }
- );
+ Method read = helperClass.getMethod("read",
+ new Class[] { org.omg.CORBA.portable.InputStream.class });
return (UserException) read.invoke(null, new Object[] { input });
}
@@ -208,7 +261,7 @@ public class ObjectCreator
/**
* Gets the helper class name from the string like
* 'IDL:test/org/omg/CORBA/ORB/communication/ourUserException:1.0'
- *
+ *
* @param IDL the idl name.
*/
public static String toHelperName(String IDL)
@@ -227,15 +280,14 @@ public class ObjectCreator
/**
* Writes the system exception data to CDR output stream.
- *
+ *
* @param output a stream to write data to.
* @param ex an exception to write.
*/
public static void writeSystemException(OutputStream output,
- SystemException ex
- )
+ SystemException ex)
{
- String exIDL = toIDL(ex.getClass().getName());
+ String exIDL = getRepositoryId(ex.getClass());
output.write_string(exIDL);
output.write_ulong(ex.minor);
CompletionStatusHelper.write(output, ex.completed);
@@ -243,9 +295,9 @@ public class ObjectCreator
/**
* Converts the given IDL name to class name.
- *
+ *
* @param IDL the idl name.
- *
+ *
*/
protected static String toClassName(String prefix, String IDL)
{
@@ -265,34 +317,43 @@ public class ObjectCreator
* Converts the given IDL name to class name and tries to load the matching
* class. The OMG prefix (omg.org) is replaced by the java prefix org.omg. No
* other prefixes are added.
- *
+ *
* @param IDL the idl name.
- *
- * TODO Cache the returned classes, avoiding these string manipulations each
- * time the conversion is required.
- *
+ *
* @return the matching class or null if no such is available.
*/
public static Class Idl2class(String IDL)
{
- String s = IDL;
- int a = s.indexOf(':') + 1;
- int b = s.lastIndexOf(':');
-
- s = IDL.substring(a, b);
-
- if (s.startsWith(OMG_PREFIX))
- s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
-
- String cn = s.replace('/', '.');
-
- try
+ synchronized (m_classes)
{
- return Class.forName(cn);
- }
- catch (ClassNotFoundException ex)
- {
- return null;
+ Class c = (Class) m_classes.get(IDL);
+
+ if (c != null)
+ return c;
+ else
+ {
+ String s = IDL;
+ int a = s.indexOf(':') + 1;
+ int b = s.lastIndexOf(':');
+
+ s = IDL.substring(a, b);
+
+ if (s.startsWith(OMG_PREFIX))
+ s = JAVA_PREFIX + s.substring(OMG_PREFIX.length());
+
+ String cn = s.replace('/', '.');
+
+ try
+ {
+ c = forName(cn);
+ m_classes.put(IDL, c);
+ return c;
+ }
+ catch (ClassNotFoundException ex)
+ {
+ return null;
+ }
+ }
}
}
@@ -301,9 +362,9 @@ public class ObjectCreator
* and create an object instance with parameterless constructor. The OMG
* prefix (omg.org) is replaced by the java prefix org.omg. No other prefixes
* are added.
- *
+ *
* @param IDL the idl name.
- *
+ *
* @return instantiated object instance or null if such attempt was not
* successful.
*/
@@ -325,34 +386,53 @@ public class ObjectCreator
}
/**
- * Convert the class name to IDL name.
- *
- * @param cn the class name.
- *
- * @return the idl name.
+ * Convert the class name to IDL or RMI name (repository id). If the class
+ * inherits from IDLEntity, ValueBase or SystemException, returns repository
+ * Id in the IDL:(..) form. If it does not, returns repository Id in the
+ * RMI:(..) form.
+ *
+ * @param cx the class for that the name must be computed.
+ *
+ * @return the idl or rmi name.
*/
- public static String toIDL(String cn)
+ public static synchronized String getRepositoryId(Class cx)
{
- if (cn.startsWith(JAVA_PREFIX))
- cn = OMG_PREFIX + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
- else if (cn.startsWith(CLASSPATH_PREFIX))
- cn =
- OMG_PREFIX +
- cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');
-
- return "IDL:" + cn + ":1.0";
+ String name = (String) m_names.get(cx);
+ if (name != null)
+ return name;
+
+ String cn = cx.getName();
+ if (!(IDLEntity.class.isAssignableFrom(cx)
+ || ValueBase.class.isAssignableFrom(cx) || SystemException.class.isAssignableFrom(cx)))
+ {
+ // Not an IDL entity.
+ name = Util.createValueHandler().getRMIRepositoryID(cx);
+ }
+ else
+ {
+ if (cn.startsWith(JAVA_PREFIX))
+ cn = OMG_PREFIX
+ + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
+ else if (cn.startsWith(CLASSPATH_PREFIX))
+ cn = OMG_PREFIX
+ + cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');
+
+ name = "IDL:" + cn + ":1.0";
+ }
+ m_names.put(cx, name);
+ return name;
}
/**
* Insert the passed parameter into the given Any, assuming that the helper
* class is available. The helper class must have the "Helper" suffix and be
* in the same package as the class of the object being inserted.
- *
+ *
* @param into the target to insert.
- *
+ *
* @param object the object to insert. It can be any object as far as the
* corresponding helper is provided.
- *
+ *
* @return true on success, false otherwise.
*/
public static boolean insertWithHelper(Any into, Object object)
@@ -360,12 +440,10 @@ public class ObjectCreator
try
{
String helperClassName = object.getClass().getName() + "Helper";
- Class helperClass = Class.forName(helperClassName);
+ Class helperClass = forName(helperClassName);
- Method insert =
- helperClass.getMethod("insert",
- new Class[] { Any.class, object.getClass() }
- );
+ Method insert = helperClass.getMethod("insert", new Class[] {
+ Any.class, object.getClass() });
insert.invoke(null, new Object[] { into, object });
@@ -385,20 +463,20 @@ public class ObjectCreator
{
try
{
- cdrBufOutput output = new cdrBufOutput();
+ BufferedCdrOutput output = new BufferedCdrOutput();
- String m_exception_id = toIDL(exception.getClass().getName());
+ String m_exception_id = getRepositoryId(exception.getClass());
output.write_string(m_exception_id);
output.write_ulong(exception.minor);
CompletionStatusHelper.write(output, exception.completed);
String name = getDefaultName(m_exception_id);
- universalHolder h = new universalHolder(output);
+ GeneralHolder h = new GeneralHolder(output);
into.insert_Streamable(h);
- recordTypeCode r = new recordTypeCode(TCKind.tk_except);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_except);
r.setId(m_exception_id);
r.setName(name);
into.type(r);
@@ -444,4 +522,69 @@ public class ObjectCreator
if (!ok)
throw new InternalError("Exception wrapping broken");
}
+
+ /**
+ * Find helper for the class with the given name.
+ */
+ public static Class findHelper(String idl)
+ {
+ synchronized (m_helpers)
+ {
+ Class c = (Class) m_helpers.get(idl);
+ if (c != null)
+ return c;
+ try
+ {
+ String helper = toHelperName(idl);
+ c = forName(helper);
+
+ m_helpers.put(idl, c);
+ return c;
+ }
+ catch (Exception ex)
+ {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Load the class with the given name. This method tries to use the context
+ * class loader first. If this fails, it searches for the suitable class
+ * loader in the caller stack trace. This method is a central point where all
+ * requests to find a class by name are delegated.
+ */
+ public static Class forName(String className) throws ClassNotFoundException
+ {
+ try
+ {
+ return Class.forName(className, true,
+ Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException nex)
+ {
+ /**
+ * Returns the first user defined class loader on the call stack, or
+ * null when no non-null class loader was found.
+ */
+ Class[] ctx = VMStackWalker.getClassContext();
+ for (int i = 0; i < ctx.length; i++)
+ {
+ // Since we live in a class loaded by the bootstrap
+ // class loader, getClassLoader is safe to call without
+ // needing to be wrapped in a privileged action.
+ ClassLoader cl = ctx[i].getClassLoader();
+ try
+ {
+ if (cl != null)
+ return Class.forName(className, true, cl);
+ }
+ catch (ClassNotFoundException nex2)
+ {
+ // Try next.
+ }
+ }
+ }
+ throw new ClassNotFoundException(className);
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/OctetHolder.java b/libjava/classpath/gnu/CORBA/OctetHolder.java
index 02fd9a432ec..06d7538d70f 100644
--- a/libjava/classpath/gnu/CORBA/OctetHolder.java
+++ b/libjava/classpath/gnu/CORBA/OctetHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -64,7 +64,7 @@ public final class OctetHolder
* The default type code for this holder.
*/
private static final TypeCode t_octet =
- new primitiveTypeCode(TCKind.tk_octet);
+ new PrimitiveTypeCode(TCKind.tk_octet);
/**
* The <code>long</code> (CORBA <code>octet</code>) value,
diff --git a/libjava/classpath/gnu/CORBA/OrbFocused.java b/libjava/classpath/gnu/CORBA/OrbFocused.java
new file mode 100644
index 00000000000..a0f9993c1a0
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/OrbFocused.java
@@ -0,0 +1,375 @@
+/* OrbFocused.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA;
+
+import gnu.CORBA.Poa.ORB_1_4;
+
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.portable.InvokeHandler;
+
+import java.applet.Applet;
+import java.net.ServerSocket;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Random;
+import java.util.StringTokenizer;
+
+/**
+ * This class implements the ORB that uses a single port or the restricted port
+ * range for all its objects. It is required to for use together with various
+ * firewalls that does not allow opening multiple randomly selected ports, as
+ * the defauld CORBA implementation used to do. The firewal must be configured
+ * to allow CORBA to work on one fixed port or (for better performance) on a
+ * small fixed range of ports. This does not restrict the maximal number of the
+ * connected objects as the objects can share the same port.
+ *
+ * The used port or the used port range can be specified via property
+ * gnu.CORBA.ListenerPort. The value of this property is a single port or range
+ * of ports, boundary values (inclusive) being separeted by dash (for instance,
+ * "1245-1250").
+ *
+ * It is possible to instantiate multiple instances of the focused ORBs and
+ * combine them with the ordinary ORBs. If you instantiate several instances of
+ * the focused ORBs on the same host, they used port sets should not overlap.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class OrbFocused
+ extends ORB_1_4
+{
+ /**
+ * The name of the fixed port range property. The presence of this property
+ * indicates that the default focused ORB must be used.
+ */
+ public static final String LISTENER_PORT = "gnu.CORBA.ListenerPort";
+
+ /**
+ * The start of the range of the available ports, inclusive.
+ */
+ int m_ports_from = -1;
+
+ /**
+ * The end of the range of the available ports, inclusive.
+ */
+ int m_ports_to = -1;
+
+ /**
+ * The requests to port are served in parallel threads.
+ */
+ static final int PARALLEL = 0;
+
+ /**
+ * The requests to port are served in the same thread.
+ */
+ static final int SEQUENTIAL = 1;
+
+ /**
+ * The random number generator to get a random port in the valid range.
+ */
+ Random m_random = new Random();
+
+ /**
+ * Parse the "gnu.CORBA.ListenerPort" property and initialize the valid port
+ * set range.
+ */
+ public void setPortRange(String property)
+ {
+ int from, to;
+ try
+ {
+ StringTokenizer st = new StringTokenizer(property, " -");
+ if (st.countTokens() == 1)
+ from = to = Integer.parseInt(st.nextToken());
+ else
+ {
+ from = Integer.parseInt(st.nextToken());
+ to = Integer.parseInt(st.nextToken());
+ m_random = new Random();
+ }
+ setPortRange(from, to);
+ }
+ catch (Exception ex)
+ {
+ throw new BAD_PARAM("Unable to parse port range '" + property + "'");
+ }
+ }
+
+ /**
+ * Set the port range.
+ *
+ * @param from - start of the port range, inclusive.
+ * @param to - end of the port range, inclusive.
+ */
+ public void setPortRange(int from, int to)
+ {
+ if (from < 0 || to < 0 || to < from)
+ throw new BAD_PARAM("Invalid range");
+ m_ports_from = from;
+ m_ports_to = to;
+ }
+
+ /**
+ * Get the port from the previously specified usage range.
+ */
+ int getPortFromRange(int attempt)
+ {
+ if (m_ports_from == m_ports_to)
+ return m_ports_from;
+ else if (m_ports_to - m_ports_from < RANDOM_PORT_ATTEMPTS)
+ return m_ports_from + (attempt % (m_ports_to - m_ports_from + 1));
+ else
+ return m_random.nextInt(m_ports_to - m_ports_from + 1) + m_ports_from;
+ }
+
+ /**
+ * Get the shared port server where the new object can be added. This may
+ * result reusing the existing server or instantiating a new server. If the
+ * new server is instantiated and the ORB is already running, the server is
+ * started.
+ */
+ protected portServer getPortServer(int type)
+ {
+ portServer p;
+
+ int n;
+ if (m_ports_from < m_ports_to)
+ n = RANDOM_PORT_ATTEMPTS;
+ else
+ n = 1;
+
+ Ports: for (int a = 0; a < n; a++)
+ {
+ int port = getPortFromRange(a);
+ for (int i = 0; i < portServers.size(); i++)
+ {
+ p = (portServer) portServers.get(i);
+ if (p.s_port == port)
+ {
+ return (portServer) p;
+ }
+ }
+ // The server is not yet instantiated. Instantiate.
+ try
+ {
+ // Check if the port is ok:
+ ServerSocket s = socketFactory.createServerSocket(port);
+ s.close();
+
+ portServer shared;
+
+ switch (type)
+ {
+ case PARALLEL:
+ shared = new portServer(port);
+ break;
+
+ case SEQUENTIAL:
+ shared = new sharedPortServer(port);
+ break;
+
+ default:
+ throw new InternalError("Invalid server type " + type);
+ }
+
+ portServers.add(shared);
+
+ if (running)
+ shared.start();
+
+ return shared;
+ }
+ catch (Exception ex)
+ {
+ // Port is taken or probably other problems.
+ continue Ports;
+ }
+ }
+ throw new NO_RESOURCES("No free port available at " + m_ports_from + "-"
+ + m_ports_to, Minor.Ports, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Start the ORBs main working cycle (receive invocation - invoke on the local
+ * object - send response - wait for another invocation).
+ *
+ * The method only returns after calling {@link #shutdown(boolean)}.
+ */
+ public void run()
+ {
+ if (m_ports_from < 0 || m_ports_to < 0)
+ throw new BAD_INV_ORDER("For " + getClass().getName() + " "
+ + LISTENER_PORT + " property must be set");
+
+ running = true;
+
+ // Start all port servers. In the current subclass, the portServers
+ // collection must be already filled in.
+ Iterator iter = portServers.iterator();
+
+ while (iter.hasNext())
+ {
+ portServer subserver = (portServer) iter.next();
+
+ if (!subserver.isAlive())
+ {
+ // Reuse the current thread for the last portServer.
+ if (!iter.hasNext())
+ {
+ // Discard the iterator.
+ iter = null;
+ subserver.run();
+ return;
+ }
+ else
+ subserver.start();
+ }
+ }
+ }
+
+ /**
+ * Get free port from the allowed range. This method instantiates the port
+ * server for the returned port.
+ */
+ public int getFreePort()
+ throws BAD_OPERATION
+ {
+ portServer s = getPortServer(PARALLEL);
+ return s.s_port;
+ }
+
+ /**
+ * Connect the given CORBA object to this ORB, explicitly specifying the
+ * object key and the identity of the thread (and port), where the object must
+ * be served. The identity is normally the POA.
+ *
+ * The new port server will be started only if there is no one already running
+ * for the same identity. Otherwise, the task of the existing port server will
+ * be widened, including duty to serve the given object. All objects,
+ * connected to a single identity by this method, will process they requests
+ * subsequently in the same thread. The method is used when the expected
+ * number of the objects is too large to have a single port and thread per
+ * object. This method is used by POAs, having a single thread policy.
+ *
+ * @param object the object, must implement the {@link InvokeHandler})
+ * interface.
+ * @param key the object key, usually used to identify the object from remote
+ * side.
+ * @param port the port, where the object must be connected.
+ *
+ * @throws BAD_PARAM if the object does not implement the
+ * {@link InvokeHandler}).
+ */
+ public void connect_1_thread(org.omg.CORBA.Object object, byte[] key,
+ java.lang.Object identity)
+ {
+ sharedPortServer shared = (sharedPortServer) identities.get(identity);
+ if (shared == null)
+ {
+ shared = (sharedPortServer) getPortServer(SEQUENTIAL);
+ identities.put(identity, shared);
+ if (running)
+ {
+ shared.start();
+ }
+ }
+
+ Connected_objects.cObject ref = connected_objects.add(key, object,
+ shared.s_port, identity);
+ IOR ior = createIOR(ref);
+ prepareObject(object, ior);
+ }
+
+ /**
+ * In this type of ORB, the service is started by {@link #getPortServer}. The
+ * method below is not in use and should return without action.
+ */
+ public void startService(IOR ior)
+ {
+ }
+
+ /**
+ * Set parameters (additionally search for the port range property).
+ */
+ protected void set_parameters(Applet applet, Properties props)
+ {
+ super.set_parameters(applet, props);
+ String lp = applet.getParameter(LISTENER_PORT);
+ if (lp != null)
+ setPortRange(lp);
+ }
+
+ /**
+ * Set parameters (additionally search for the port range property).
+ */
+ protected void set_parameters(String[] args, Properties props)
+ {
+ super.set_parameters(args, props);
+ String lp = null;
+
+ String lpKey = "-" + LISTENER_PORT;
+
+ if (args != null)
+ if (args.length >= 2)
+ {
+ for (int i = 0; i < args.length - 1; i++)
+ if (args[i].equals(lpKey))
+ lp = args[i + 1];
+ }
+
+ if (lp != null)
+ setPortRange(lp);
+
+ }
+
+ /**
+ * Additionally set the port range property, when applicable.
+ */
+ protected void useProperties(Properties props)
+ {
+ super.useProperties(props);
+ String lp = props.getProperty(LISTENER_PORT);
+ if (lp != null)
+ setPortRange(lp);
+ }
+
+}
diff --git a/libjava/classpath/gnu/CORBA/Functional_ORB.java b/libjava/classpath/gnu/CORBA/OrbFunctional.java
index 1565b2cf14a..7b9c34ada12 100644
--- a/libjava/classpath/gnu/CORBA/Functional_ORB.java
+++ b/libjava/classpath/gnu/CORBA/OrbFunctional.java
@@ -1,4 +1,4 @@
-/* Functional_ORB.java --
+/* OrbFunctional.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,9 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.UnknownExceptionCtxHandler;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.GIOP.CloseMessage;
import gnu.CORBA.GIOP.ErrorMessage;
import gnu.CORBA.GIOP.MessageHeader;
@@ -48,38 +49,35 @@ import gnu.CORBA.GIOP.RequestHeader;
import gnu.CORBA.NamingService.NameParser;
import gnu.CORBA.NamingService.NamingServiceTransient;
import gnu.CORBA.Poa.gnuForwardRequest;
+import gnu.CORBA.interfaces.SocketFactory;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.DATA_CONVERSION;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.NO_RESOURCES;
import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.Request;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.UNKNOWN;
import org.omg.CORBA.WrongTransaction;
+import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.InvokeHandler;
import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.UnknownException;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import java.applet.Applet;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.net.UnknownHostException;
-
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -87,6 +85,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Properties;
+import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
@@ -98,14 +97,15 @@ import java.util.TreeMap;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class Functional_ORB extends Restricted_ORB
+public class OrbFunctional extends OrbRestricted
{
/**
* A server, responsible for listening on requests on some local port. The ORB
* may listen on multiple ports and process the requests in separate threads.
* Normally the server takes one port per object being served.
*/
- class portServer extends Thread
+ protected class portServer
+ extends Thread
{
/**
* The number of the currently running parallel threads.
@@ -133,26 +133,27 @@ public class Functional_ORB extends Restricted_ORB
portServer(int _port)
{
s_port = _port;
- }
-
- /**
- * Enter the serving loop (get request/process it). All portServer normally
- * terminate thy threads when the Functional_ORB.running is set to false.
- */
- public void run()
- {
+ setDaemon(true);
try
{
- service = new ServerSocket(s_port);
+ service = socketFactory.createServerSocket(s_port);
}
catch (IOException ex)
{
- BAD_OPERATION bad =
- new BAD_OPERATION("Unable to open the server socket.");
+ BAD_OPERATION bad = new BAD_OPERATION(
+ "Unable to open the server socket at " + s_port);
+ bad.minor = Minor.Socket;
bad.initCause(ex);
throw bad;
}
+ }
+ /**
+ * Enter the serving loop (get request/process it). All portServer normally
+ * terminate thy threads when the OrbFunctional.running is set to false.
+ */
+ public void run()
+ {
while (running)
{
try
@@ -168,11 +169,11 @@ public class Functional_ORB extends Restricted_ORB
}
catch (Exception iex)
{
- // Wait 5 seconds. Do not terminate the
+ // Wait. Do not terminate the
// service due potentially transient error.
try
{
- Thread.sleep(5000);
+ Thread.sleep(TWAIT_SERVER_ERROR_PAUSE);
}
catch (InterruptedException ex)
{
@@ -183,10 +184,11 @@ public class Functional_ORB extends Restricted_ORB
/**
* Perform a single serving step.
- *
+ *
* @throws java.lang.Exception
*/
- void tick() throws Exception
+ void tick()
+ throws Exception
{
serve(this, service);
}
@@ -222,7 +224,7 @@ public class Functional_ORB extends Restricted_ORB
* serving multiple requests (probably to the different objects) on the same
* thread.
*/
- class sharedPortServer extends portServer
+ protected class sharedPortServer extends portServer
{
/**
* Create a new portServer, serving on specific port.
@@ -249,6 +251,23 @@ public class Functional_ORB extends Restricted_ORB
* for a free port.
*/
public static int DEFAULT_INITIAL_PORT = 1126;
+
+ /**
+ * When trying to open the socket on a random port, start of the interval to
+ * try.
+ */
+ public static int RANDOM_PORT_FROM = 1024;
+
+ /**
+ * When trying to open the socket on a random port, end of the interval to
+ * try.
+ */
+ public static int RANDOM_PORT_TO = 4024;
+
+ /**
+ * The number of attempts to try when opening random port.
+ */
+ public static int RANDOM_PORT_ATTEMPTS = 64;
/**
* The property of port, on that this ORB is listening for requests from
@@ -277,7 +296,18 @@ public class Functional_ORB extends Restricted_ORB
* The string, defining the naming service initial reference.
*/
public static final String NAME_SERVICE = "NameService";
-
+
+ /**
+ * Defines the ORB ID that is accessible by IOR interceptors.
+ */
+ public static final String ORB_ID = "org.omg.CORBA.ORBid";
+
+
+ /**
+ * Defines the SERVER ID that is accessible by IOR interceptors.
+ */
+ public static final String SERVER_ID = "org.omg.CORBA.ServerId";
+
/**
* The if the client has once opened a socket, it should start sending the
* message header in a given time. Otherwise the server will close the socket.
@@ -301,6 +331,13 @@ public class Functional_ORB extends Restricted_ORB
*/
public static String AFTER_RECEIVING =
"gnu.classpath.CORBA.TOUT_AFTER_RECEIVING";
+
+ /**
+ * The server waits for this duration after the potentially transient error
+ * during its servicing cycle.
+ */
+ public static String SERVER_ERROR_PAUSE =
+ "gnu.classpath.CORBA.SERVER_ERROR_PAUSE";
/**
* The address of the local host.
@@ -313,7 +350,7 @@ public class Functional_ORB extends Restricted_ORB
* This prevents server hang when the client opens the socket, but does not
* send any message, usually due crash on the client side.
*/
- private int TOUT_START_READING_MESSAGE = 20 * 1000;
+ public int TOUT_START_READING_MESSAGE = 20 * 1000;
// (Here and below, we use * to make the meaning of the constant clearler).
@@ -321,14 +358,20 @@ public class Functional_ORB extends Restricted_ORB
* If the client has started to send the request message, the socket time out
* changes to the specified value.
*/
- private int TOUT_WHILE_READING = 2 * 60 * 1000;
+ public int TOUT_WHILE_READING = 2 * 60 * 1000;
/**
* If the message body is received, the time out changes to the specifice
* value. This must be longer, as includes time, required to process the
* received task. We make it 40 minutes.
*/
- private int TOUT_AFTER_RECEIVING = 40 * 60 * 1000;
+ public int TOUT_AFTER_RECEIVING = 40 * 60 * 1000;
+
+ /**
+ * The server waits for this duration after the potentially transient error
+ * during its servicing cycle.
+ */
+ public int TWAIT_SERVER_ERROR_PAUSE = 5000;
/**
* Some clients tend to submit multiple requests over the same socket. The
@@ -338,6 +381,17 @@ public class Functional_ORB extends Restricted_ORB
* seven seconds.
*/
public static int TANDEM_REQUESTS = 7000;
+
+ /**
+ * The Id of this ORB.
+ */
+ public String orb_id = "orb_"+hashCode();
+
+ /**
+ * The Id of this Server. This field is defined static to ensure it has
+ * the same value over all ORB's in this machine.
+ */
+ public static String server_id = "server_"+OrbFunctional.class.hashCode();
/**
* The map of the already conncted objects.
@@ -365,7 +419,7 @@ public class Functional_ORB extends Restricted_ORB
/**
* The currently active portServers.
*/
- private ArrayList portServers = new ArrayList();
+ protected ArrayList portServers = new ArrayList();
/**
* The host, on that the name service is expected to be running.
@@ -414,11 +468,16 @@ public class Functional_ORB extends Restricted_ORB
* exceeding this limit, the NO_RESOURCES is thrown back to the client.
*/
private int MAX_RUNNING_THREADS = 256;
+
+ /**
+ * The producer of the client and server sockets for this ORB.
+ */
+ public SocketFactory socketFactory = DefaultSocketFactory.Singleton;
/**
* Create the instance of the Functional ORB.
*/
- public Functional_ORB()
+ public OrbFunctional()
{
try
{
@@ -457,13 +516,14 @@ public class Functional_ORB extends Restricted_ORB
/**
* Get the currently free port, starting from the initially set port and going
* up max 20 steps, then trying to bind into any free address.
- *
+ *
* @return the currently available free port.
- *
+ *
* @throws NO_RESOURCES if the server socked cannot be opened on the local
* host.
*/
- public int getFreePort() throws BAD_OPERATION
+ public int getFreePort()
+ throws BAD_OPERATION
{
ServerSocket s;
int a_port;
@@ -475,7 +535,7 @@ public class Functional_ORB extends Restricted_ORB
{
Integer free = (Integer) freed_ports.getLast();
freed_ports.removeLast();
- s = new ServerSocket(free.intValue());
+ s = socketFactory.createServerSocket(free.intValue());
s.close();
return free.intValue();
}
@@ -491,7 +551,7 @@ public class Functional_ORB extends Restricted_ORB
{
try
{
- s = new ServerSocket(a_port);
+ s = socketFactory.createServerSocket(a_port);
s.close();
Port = a_port + 1;
return a_port;
@@ -502,21 +562,31 @@ public class Functional_ORB extends Restricted_ORB
}
}
- try
+ Random rand = new Random();
+ // Try any random port in the interval RANDOM_PORT_FROM.RANDOM_PORT_TO.
+ int range = RANDOM_PORT_TO - RANDOM_PORT_FROM;
+ IOException ioex = null;
+ for (int i = 0; i < RANDOM_PORT_ATTEMPTS; i++)
{
- // Try any port.
- s = new ServerSocket();
- a_port = s.getLocalPort();
- s.close();
- return a_port;
- }
- catch (IOException ex)
- {
- NO_RESOURCES bad =
- new NO_RESOURCES("Unable to open the server socket.");
- bad.initCause(ex);
- throw bad;
+ try
+ {
+ a_port = RANDOM_PORT_FROM + rand.nextInt(range);
+ s = socketFactory.createServerSocket(a_port);
+ s.close();
+ return a_port;
+ }
+ catch (IOException ex)
+ {
+ // Repeat the loop if this exception has been thrown.
+ ioex = ex;
+ }
}
+
+ NO_RESOURCES bad = new NO_RESOURCES("Unable to open the server socket.");
+ bad.minor = Minor.Ports;
+ if (ioex != null)
+ bad.initCause(ioex);
+ throw bad;
}
/**
@@ -525,7 +595,7 @@ public class Functional_ORB extends Restricted_ORB
* on this port first. It the port is busy, or if more objects are connected,
* the subsequent object will receive a larger port values, skipping
* unavailable ports, if required. The change applies globally.
- *
+ *
* @param a_Port a port, on that the server is listening for requests.
*/
public static void setPort(int a_Port)
@@ -677,9 +747,9 @@ public class Functional_ORB extends Restricted_ORB
if (object instanceof ObjectImpl)
{
Delegate delegate = ((ObjectImpl) object)._get_delegate();
- if (delegate instanceof Simple_delegate)
+ if (delegate instanceof SimpleDelegate)
{
- byte[] key = ((Simple_delegate) delegate).getIor().key;
+ byte[] key = ((SimpleDelegate) delegate).getIor().key;
rmKey = connected_objects.get(key);
}
}
@@ -756,11 +826,7 @@ public class Functional_ORB extends Restricted_ORB
if (!ior.Internet.host.equals(LOCAL_HOST))
return null;
- // Must be the same port.
- if (ior.Internet.port != Port)
- return null;
-
- return find_connected_object(ior.key);
+ return find_connected_object(ior.key, ior.Internet.port);
}
/**
@@ -806,8 +872,8 @@ public class Functional_ORB extends Restricted_ORB
if (forObject instanceof ObjectImpl)
{
Delegate delegate = ((ObjectImpl) forObject)._get_delegate();
- if (delegate instanceof Simple_delegate)
- return ((Simple_delegate) delegate).getIor().toStringifiedReference();
+ if (delegate instanceof SimpleDelegate)
+ return ((SimpleDelegate) delegate).getIor().toStringifiedReference();
}
// Handle the case when the object is local.
@@ -899,7 +965,7 @@ public class Functional_ORB extends Restricted_ORB
}
else
subserver = (portServer) identities.get(obj.identity);
-
+
if (!subserver.isAlive())
{
// Reuse the current thread for the last portServer.
@@ -915,6 +981,30 @@ public class Functional_ORB extends Restricted_ORB
}
}
}
+
+ /**
+ * Start the server in a new thread, if not already running. This method is
+ * used to ensure that the objects being transfered will be served from the
+ * remote side, if required. If the ORB is started using this method, it
+ * starts as a daemon thread.
+ */
+ public void ensureRunning()
+ {
+ final OrbFunctional THIS = this;
+
+ if (!running)
+ {
+ Thread t = new Thread()
+ {
+ public void run()
+ {
+ THIS.run();
+ }
+ };
+ t.setDaemon(true);
+ t.start();
+ }
+ }
/**
* Shutdown the ORB server.
@@ -961,21 +1051,22 @@ public class Functional_ORB extends Restricted_ORB
org.omg.CORBA.Object object = find_local_object(ior);
if (object == null)
{
- ObjectImpl impl = stubFinder.search(this, ior);
+ ObjectImpl impl = StubLocator.search(this, ior);
try
{
if (impl._get_delegate() == null)
- impl._set_delegate(new IOR_Delegate(this, ior));
+ impl._set_delegate(new IorDelegate(this, ior));
}
catch (BAD_OPERATION ex)
{
// Some colaborants may throw this exception
// in response to the attempt to get the unset delegate.
- impl._set_delegate(new IOR_Delegate(this, ior));
+ impl._set_delegate(new IorDelegate(this, ior));
}
object = impl;
- connected_objects.add(ior.key, impl, ior.Internet.port, null);
+ // TODO remove commented out code below.
+ // connected_objects.add(ior.key, impl, ior.Internet.port, null);
}
return object;
}
@@ -995,7 +1086,7 @@ public class Functional_ORB extends Restricted_ORB
ior.Internet.port = ns_port;
ior.key = NamingServiceTransient.getDefaultKey();
- IOR_contructed_object iorc = new IOR_contructed_object(this, ior);
+ IorObject iorc = new IorObject(this, ior);
NamingContextExt namer = NamingContextExtHelper.narrow(iorc);
initial_references.put(NAME_SERVICE, namer);
return namer;
@@ -1004,23 +1095,29 @@ public class Functional_ORB extends Restricted_ORB
/**
* Find and return the object, that must be previously connected to this ORB.
* Return null if no such object is available.
- *
+ *
* @param key the object key.
- *
+ * @param port the port where the object is connected.
+ *
* @return the connected object, null if none.
*/
- protected org.omg.CORBA.Object find_connected_object(byte[] key)
+ protected org.omg.CORBA.Object find_connected_object(byte[] key, int port)
{
Connected_objects.cObject ref = connected_objects.get(key);
- return ref == null ? null : ref.object;
+ if (ref == null)
+ return null;
+ if (port >= 0 && ref.port != port)
+ return null;
+ else
+ return ref.object;
}
/**
* Set the ORB parameters. This method is normally called from
* {@link #init(Applet, Properties)}.
- *
+ *
* @param app the current applet.
- *
+ *
* @param props application specific properties, passed as the second
* parameter in {@link #init(Applet, Properties)}. Can be <code>null</code>.
*/
@@ -1033,37 +1130,39 @@ public class Functional_ORB extends Restricted_ORB
{
for (int i = 0; i < para.length; i++)
{
- if (para [ i ] [ 0 ].equals(LISTEN_ON))
- Port = Integer.parseInt(para [ i ] [ 1 ]);
- if (para [ i ] [ 0 ].equals(REFERENCE))
+ if (para[i][0].equals(LISTEN_ON))
+ Port = Integer.parseInt(para[i][1]);
+ if (para[i][0].equals(REFERENCE))
{
- StringTokenizer st =
- new StringTokenizer(para [ i ] [ 1 ], "=");
+ StringTokenizer st = new StringTokenizer(para[i][1], "=");
initial_references.put(st.nextToken(),
- string_to_object(st.nextToken())
- );
+ string_to_object(st.nextToken()));
}
- if (para [ i ] [ 0 ].equals(NS_HOST))
- ns_host = para [ i ] [ 1 ];
- if (para [ i ] [ 0 ].equals(START_READING_MESSAGE))
- TOUT_START_READING_MESSAGE = Integer.parseInt(para [ i ] [ 1 ]);
- if (para [ i ] [ 0 ].equals(WHILE_READING))
- TOUT_WHILE_READING = Integer.parseInt(para [ i ] [ 1 ]);
- if (para [ i ] [ 0 ].equals(AFTER_RECEIVING))
- TOUT_AFTER_RECEIVING = Integer.parseInt(para [ i ] [ 1 ]);
+ if (para[i][0].equals(ORB_ID))
+ orb_id = para[i][1];
+
+ if (para[i][0].equals(SERVER_ID))
+ server_id = para[i][1];
+
+ if (para[i][0].equals(NS_HOST))
+ ns_host = para[i][1];
+ if (para[i][0].equals(START_READING_MESSAGE))
+ TOUT_START_READING_MESSAGE = Integer.parseInt(para[i][1]);
+ if (para[i][0].equals(WHILE_READING))
+ TOUT_WHILE_READING = Integer.parseInt(para[i][1]);
+ if (para[i][0].equals(AFTER_RECEIVING))
+ TOUT_AFTER_RECEIVING = Integer.parseInt(para[i][1]);
try
{
- if (para [ i ] [ 0 ].equals(NS_PORT))
- ns_port = Integer.parseInt(para [ i ] [ 1 ]);
+ if (para[i][0].equals(NS_PORT))
+ ns_port = Integer.parseInt(para[i][1]);
}
catch (NumberFormatException ex)
{
- BAD_PARAM bad =
- new BAD_PARAM("Invalid " + NS_PORT +
- "property, unable to parse '" +
- props.getProperty(NS_PORT) + "'"
- );
+ BAD_PARAM bad = new BAD_PARAM("Invalid " + NS_PORT
+ + "property, unable to parse '" + props.getProperty(NS_PORT)
+ + "'");
bad.initCause(ex);
throw bad;
}
@@ -1074,11 +1173,11 @@ public class Functional_ORB extends Restricted_ORB
/**
* Set the ORB parameters. This method is normally called from
* {@link #init(String[], Properties)}.
- *
+ *
* @param para the parameters, that were passed as the parameters to the
* <code>main(String[] args)</code> method of the current standalone
* application.
- *
+ *
* @param props application specific properties that were passed as a second
* parameter in {@link init(String[], Properties)}). Can be <code>null</code>.
*/
@@ -1088,29 +1187,33 @@ public class Functional_ORB extends Restricted_ORB
{
for (int i = 0; i < para.length - 1; i++)
{
- if (para [ i ].endsWith("ListenOn"))
- Port = Integer.parseInt(para [ i + 1 ]);
- if (para [ i ].endsWith("ORBInitRef"))
+ if (para[i].endsWith("ListenOn"))
+ Port = Integer.parseInt(para[i + 1]);
+ if (para[i].endsWith("ORBInitRef"))
{
- StringTokenizer st = new StringTokenizer(para [ i + 1 ], "=");
+ StringTokenizer st = new StringTokenizer(para[i + 1], "=");
initial_references.put(st.nextToken(),
- string_to_object(st.nextToken())
- );
+ string_to_object(st.nextToken()));
}
- if (para [ i ].endsWith("ORBInitialHost"))
- ns_host = para [ i + 1 ];
+ if (para[i].endsWith("ORBInitialHost"))
+ ns_host = para[i + 1];
+
+ if (para[i].endsWith("ServerId"))
+ server_id = para[i++];
+ else if (para[i].endsWith("ORBid"))
+ orb_id = para[i++];
+
try
{
- if (para [ i ].endsWith("ORBInitialPort"))
- ns_port = Integer.parseInt(para [ i + 1 ]);
+ if (para[i].endsWith("ORBInitialPort"))
+ ns_port = Integer.parseInt(para[i + 1]);
}
catch (NumberFormatException ex)
{
- throw new BAD_PARAM("Invalid " + para [ i ] +
- "parameter, unable to parse '" +
- props.getProperty(para [ i + 1 ]) + "'"
- );
+ throw new BAD_PARAM("Invalid " + para[i]
+ + "parameter, unable to parse '"
+ + props.getProperty(para[i + 1]) + "'");
}
}
}
@@ -1156,7 +1259,7 @@ public class Functional_ORB extends Restricted_ORB
* @throws BAD_PARAM if the object does not implement the
* {@link InvokeHandler}).
*/
- private void prepareObject(org.omg.CORBA.Object object, IOR ior)
+ protected void prepareObject(org.omg.CORBA.Object object, IOR ior)
throws BAD_PARAM
{
/*
@@ -1172,12 +1275,12 @@ public class Functional_ORB extends Restricted_ORB
try
{
if (impl._get_delegate() == null)
- impl._set_delegate(new Simple_delegate(this, ior));
+ impl._set_delegate(new SimpleDelegate(this, ior));
}
catch (BAD_OPERATION ex)
{
// Some colaborants may throw this exception.
- impl._set_delegate(new Simple_delegate(this, ior));
+ impl._set_delegate(new SimpleDelegate(this, ior));
}
}
}
@@ -1197,7 +1300,7 @@ public class Functional_ORB extends Restricted_ORB
*/
private void respond_to_client(OutputStream net_out,
MessageHeader msh_request, RequestHeader rh_request,
- bufferedResponseHandler handler, SystemException sysEx
+ ResponseHandlerImpl handler, SystemException sysEx
) throws IOException
{
// Set the reply header properties.
@@ -1211,8 +1314,8 @@ public class Functional_ORB extends Restricted_ORB
reply.reply_status = ReplyHeader.NO_EXCEPTION;
reply.request_id = rh_request.request_id;
- cdrBufOutput out =
- new cdrBufOutput(50 + handler.getBuffer().buffer.size());
+ BufferedCdrOutput out =
+ new BufferedCdrOutput(50 + handler.getBuffer().buffer.size());
out.setOrb(this);
out.setOffset(msh_request.getHeaderSize());
@@ -1256,7 +1359,7 @@ public class Functional_ORB extends Restricted_ORB
rh_forward.request_id = rh_request.request_id;
// The forwarding code is either LOCATION_FORWARD or LOCATION_FORWARD_PERM.
- cdrBufOutput out = new cdrBufOutput();
+ BufferedCdrOutput out = new BufferedCdrOutput();
out.setOrb(this);
out.setOffset(msh_forward.getHeaderSize());
@@ -1324,11 +1427,11 @@ public class Functional_ORB extends Restricted_ORB
/**
* A single servicing step, when the client socket is alrady open.
- *
+ *
* Normally, each task matches a single remote invocation. However under
* frequent tandem submissions the same task may span over several
* invocations.
- *
+ *
* @param service the opened client socket.
* @param no_resources if true, the "NO RESOURCES" exception is thrown to the
* client.
@@ -1337,8 +1440,7 @@ public class Functional_ORB extends Restricted_ORB
{
try
{
- Serving:
- while (true)
+ Serving: while (true)
{
InputStream in = service.getInputStream();
service.setSoTimeout(TOUT_START_READING_MESSAGE);
@@ -1358,9 +1460,7 @@ public class Functional_ORB extends Restricted_ORB
if (max_version != null)
{
if (!msh_request.version.until_inclusive(max_version.major,
- max_version.minor
- )
- )
+ max_version.minor))
{
OutputStream out = service.getOutputStream();
new ErrorMessage(max_version).write(out);
@@ -1368,25 +1468,14 @@ public class Functional_ORB extends Restricted_ORB
}
}
- byte[] r = new byte[ msh_request.message_size ];
-
- int n = 0;
-
- service.setSoTimeout(TOUT_WHILE_READING);
-
- reading:
- while (n < r.length)
- {
- n += in.read(r, n, r.length - n);
- }
-
- service.setSoTimeout(TOUT_AFTER_RECEIVING);
+ byte[] r = msh_request.readMessage(in, service, TOUT_WHILE_READING,
+ TOUT_AFTER_RECEIVING);
if (msh_request.message_type == MessageHeader.REQUEST)
{
RequestHeader rh_request;
- cdrBufInput cin = new cdrBufInput(r);
+ BufferredCdrInput cin = new BufferredCdrInput(r);
cin.setOrb(this);
cin.setVersion(msh_request.version);
cin.setOffset(msh_request.getHeaderSize());
@@ -1406,8 +1495,8 @@ public class Functional_ORB extends Restricted_ORB
// find the target object.
}
- InvokeHandler target =
- (InvokeHandler) find_connected_object(rh_request.object_key);
+ InvokeHandler target = (InvokeHandler) find_connected_object(
+ rh_request.object_key, -1);
// Prepare the reply header. This must be done in advance,
// as the size must be known for handler to set alignments
@@ -1415,17 +1504,19 @@ public class Functional_ORB extends Restricted_ORB
ReplyHeader rh_reply = msh_request.create_reply_header();
// TODO log errors about not existing objects and methods.
- bufferedResponseHandler handler =
- new bufferedResponseHandler(this, msh_request, rh_reply,
- rh_request
- );
+ ResponseHandlerImpl handler = new ResponseHandlerImpl(
+ this, msh_request, rh_reply, rh_request);
SystemException sysEx = null;
try
{
if (no_resources)
- throw new NO_RESOURCES();
+ {
+ NO_RESOURCES no = new NO_RESOURCES("Too many parallel calls");
+ no.minor = Minor.Threads;
+ throw no;
+ }
if (target == null)
throw new OBJECT_NOT_EXIST();
target._invoke(rh_request.operation, cin, handler);
@@ -1442,24 +1533,45 @@ public class Functional_ORB extends Restricted_ORB
continue Serving;
}
}
+ catch (UnknownException uex)
+ {
+ sysEx = new UNKNOWN("Unknown", 2,
+ CompletionStatus.COMPLETED_MAYBE);
+ sysEx.initCause(uex.originalEx);
+
+ org.omg.CORBA.portable.OutputStream ech = handler.createExceptionReply();
+
+ rh_reply.service_context = UnknownExceptionCtxHandler.addExceptionContext(
+ rh_reply.service_context, uex.originalEx, ech);
+
+ ObjectCreator.writeSystemException(ech, sysEx);
+ }
catch (SystemException ex)
{
sysEx = ex;
-
- org.omg.CORBA.portable.OutputStream ech =
- handler.createExceptionReply();
+
+ org.omg.CORBA.portable.OutputStream ech = handler.createExceptionReply();
+
+ rh_reply.service_context = UnknownExceptionCtxHandler.addExceptionContext(
+ rh_reply.service_context, ex, ech);
+
ObjectCreator.writeSystemException(ech, ex);
}
catch (Exception except)
{
+ // This should never happen under normal operation and
+ // can only indicate errors in user object implementation.
+ // We inform the user.
except.printStackTrace();
- sysEx =
- new UNKNOWN("Unknown", 2,
- CompletionStatus.COMPLETED_MAYBE
- );
- org.omg.CORBA.portable.OutputStream ech =
- handler.createExceptionReply();
+ sysEx = new UNKNOWN("Unknown", 2,
+ CompletionStatus.COMPLETED_MAYBE);
+ sysEx.initCause(except);
+
+ org.omg.CORBA.portable.OutputStream ech = handler.createExceptionReply();
+
+ rh_reply.service_context = UnknownExceptionCtxHandler.addExceptionContext(
+ rh_reply.service_context, except, ech);
ObjectCreator.writeSystemException(ech, sysEx);
}
@@ -1469,21 +1581,17 @@ public class Functional_ORB extends Restricted_ORB
{
OutputStream sou = service.getOutputStream();
respond_to_client(sou, msh_request, rh_request, handler,
- sysEx
- );
+ sysEx);
}
}
- else if (msh_request.message_type == MessageHeader.CLOSE_CONNECTION ||
- msh_request.message_type == MessageHeader.MESSAGE_ERROR
- )
+ else if (msh_request.message_type == MessageHeader.CLOSE_CONNECTION
+ || msh_request.message_type == MessageHeader.MESSAGE_ERROR)
{
CloseMessage.close(service.getOutputStream());
service.close();
return;
}
- ;
- // TODO log error: "Not a request message."
if (service != null && !service.isClosed())
// Wait for the subsequent invocations on the
@@ -1504,9 +1612,25 @@ public class Functional_ORB extends Restricted_ORB
// TODO log it.
return;
}
+ finally
+ {
+ try
+ {
+ if (service!=null && !service.isClosed())
+ service.close();
+ }
+ catch (IOException ioex)
+ {
+ // OK.
+ }
+ }
}
-
- private void useProperties(Properties props)
+
+ /**
+ * Set the ORB parameters from the properties that were accumulated
+ * from several locations.
+ */
+ protected void useProperties(Properties props)
{
if (props != null)
{
@@ -1527,6 +1651,9 @@ public class Functional_ORB extends Restricted_ORB
if (props.containsKey(AFTER_RECEIVING))
TOUT_AFTER_RECEIVING =
Integer.parseInt(props.getProperty(AFTER_RECEIVING));
+ if (props.containsKey(SERVER_ERROR_PAUSE))
+ TWAIT_SERVER_ERROR_PAUSE =
+ Integer.parseInt(props.getProperty(SERVER_ERROR_PAUSE));
}
catch (NumberFormatException ex)
{
@@ -1535,7 +1662,31 @@ public class Functional_ORB extends Restricted_ORB
"'"
);
}
-
+
+ if (props.containsKey(SocketFactory.PROPERTY))
+ {
+ String factory = null;
+ try
+ {
+ factory = props.getProperty(SocketFactory.PROPERTY);
+ if (factory!=null)
+ socketFactory = (SocketFactory)
+ ObjectCreator.forName(factory).newInstance();
+ }
+ catch (Exception ex)
+ {
+ BAD_PARAM p = new BAD_PARAM("Bad socket factory "+factory);
+ p.initCause(ex);
+ throw p;
+ }
+ }
+
+ if (props.containsKey(ORB_ID))
+ orb_id = props.getProperty(ORB_ID);
+
+ if (props.containsKey(SERVER_ID))
+ server_id = props.getProperty(SERVER_ID);
+
Enumeration en = props.elements();
while (en.hasMoreElements())
{
diff --git a/libjava/classpath/gnu/CORBA/Restricted_ORB.java b/libjava/classpath/gnu/CORBA/OrbRestricted.java
index 247cd205ccb..c0401800a89 100644
--- a/libjava/classpath/gnu/CORBA/Restricted_ORB.java
+++ b/libjava/classpath/gnu/CORBA/OrbRestricted.java
@@ -38,7 +38,11 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.typecodes.AliasTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
@@ -60,6 +64,7 @@ import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.ValueFactory;
import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
import org.omg.PortableInterceptor.IORInterceptorOperations;
+import org.omg.PortableInterceptor.IORInterceptor_3_0Operations;
import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
import java.applet.Applet;
@@ -82,18 +87,18 @@ import java.util.Properties;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
+public class OrbRestricted extends org.omg.CORBA_2_3.ORB
{
/**
* The singleton instance of this ORB.
*/
- public static final ORB Singleton = new Restricted_ORB();
+ public static final ORB Singleton = new OrbRestricted();
/**
* The cumulated listener for all IOR interceptors. Interceptors are used by
* {@link gnu.CORBA.Poa.ORB_1_4}.
*/
- public IORInterceptorOperations iIor;
+ public IORInterceptor_3_0Operations iIor;
/**
* The cumulated listener for all server request interceptors. Interceptors
@@ -126,14 +131,14 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
* Create a new instance of the RestrictedORB. This is used in derived classes
* only.
*/
- protected Restricted_ORB()
+ protected OrbRestricted()
{
}
/** {@inheritDoc} */
public TypeCode create_alias_tc(String id, String name, TypeCode typecode)
{
- return new aliasTypeCode(typecode, id, name);
+ return new AliasTypeCode(typecode, id, name);
}
/** {@inheritDoc} */
@@ -147,8 +152,8 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_array_tc(int length, TypeCode element_type)
{
- primitiveArrayTypeCode p =
- new primitiveArrayTypeCode(TCKind.tk_array, element_type);
+ ArrayTypeCode p =
+ new ArrayTypeCode(TCKind.tk_array, element_type);
p.setLength(length);
return p;
}
@@ -162,7 +167,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_enum_tc(String id, String name, String[] values)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_enum);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_enum);
for (int i = 0; i < values.length; i++)
{
r.field().name = values [ i ];
@@ -191,7 +196,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
StructMember[] members
)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_except);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_except);
r.setId(id);
r.setName(name);
@@ -229,7 +234,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public OutputStream create_output_stream()
{
- cdrBufOutput stream = new cdrBufOutput();
+ BufferedCdrOutput stream = new BufferedCdrOutput();
stream.setOrb(this);
return stream;
}
@@ -237,8 +242,8 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_sequence_tc(int bound, TypeCode element_type)
{
- primitiveArrayTypeCode p =
- new primitiveArrayTypeCode(TCKind.tk_sequence, element_type);
+ ArrayTypeCode p =
+ new ArrayTypeCode(TCKind.tk_sequence, element_type);
p.setLength(bound);
return p;
}
@@ -246,7 +251,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_string_tc(int bound)
{
- stringTypeCode p = new stringTypeCode(TCKind.tk_string);
+ StringTypeCode p = new StringTypeCode(TCKind.tk_string);
p.setLength(bound);
return p;
}
@@ -256,7 +261,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
StructMember[] members
)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_struct);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_struct);
r.setId(id);
r.setName(name);
@@ -273,7 +278,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
TypeCode discriminator_type, UnionMember[] members
)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_union);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_union);
r.setId(id);
r.setName(name);
r.setDiscriminator_type(discriminator_type);
@@ -290,7 +295,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
/** {@inheritDoc} */
public TypeCode create_wstring_tc(int bound)
{
- stringTypeCode p = new stringTypeCode(TCKind.tk_wstring);
+ StringTypeCode p = new StringTypeCode(TCKind.tk_wstring);
p.setLength(bound);
return p;
}
@@ -300,7 +305,7 @@ public class Restricted_ORB extends org.omg.CORBA_2_3.ORB
{
try
{
- return typeNamer.getPrimitveTC(tcKind);
+ return TypeKindNamer.getPrimitveTC(tcKind);
}
catch (BadKind ex)
{
diff --git a/libjava/classpath/gnu/CORBA/Poa/activeObjectMap.java b/libjava/classpath/gnu/CORBA/Poa/AOM.java
index 1354ba9c5e1..9faf0883ded 100644
--- a/libjava/classpath/gnu/CORBA/Poa/activeObjectMap.java
+++ b/libjava/classpath/gnu/CORBA/Poa/AOM.java
@@ -1,4 +1,4 @@
-/* activeObjectMap.java --
+/* AOM.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,6 @@ package gnu.CORBA.Poa;
import gnu.CORBA.ByteArrayComparator;
-import org.omg.PortableServer.POA;
import org.omg.PortableServer.Servant;
import java.util.Iterator;
@@ -57,7 +56,7 @@ import java.util.TreeMap;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class activeObjectMap
+public class AOM
{
/**
* The reference data about the object, placed on the AOM.
@@ -67,7 +66,7 @@ public class activeObjectMap
/**
* Create an initialised instance.
*/
- Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, POA _poa)
+ Obj(org.omg.CORBA.Object _object, byte[] _key, Servant _servant, gnuPOA _poa)
{
object = _object;
key = _key;
@@ -96,7 +95,7 @@ public class activeObjectMap
/**
* The POA, where the object is connected.
*/
- public final POA poa;
+ public final gnuPOA poa;
/**
* The object key.
@@ -142,17 +141,6 @@ public class activeObjectMap
{
deactivated = state;
}
-
- public boolean equals(java.lang.Object other)
- {
- if (other instanceof Obj)
- {
- Obj o = (Obj) other;
- return o.object.equals(object);
- }
- else
- return false;
- }
}
/**
@@ -269,7 +257,7 @@ public class activeObjectMap
*
* @return the newly created object record.
*/
- public Obj add(org.omg.CORBA.Object object, Servant servant, POA poa)
+ public Obj add(org.omg.CORBA.Object object, Servant servant, gnuPOA poa)
{
return add(generateObjectKey(object), object, servant, poa);
}
@@ -283,7 +271,7 @@ public class activeObjectMap
* @param poa the POA, where the object is connected.
*/
public Obj add(byte[] key, org.omg.CORBA.Object object, Servant servant,
- POA poa
+ gnuPOA poa
)
{
Obj rec = new Obj(object, key, servant, poa);
@@ -298,7 +286,7 @@ public class activeObjectMap
* and object.
* @param port the port that this object would take.
*/
- public Obj add(servantDelegate delegate)
+ public Obj add(ServantDelegateImpl delegate)
{
Obj rec =
new Obj(delegate.object, delegate.servant_id, delegate.servant,
diff --git a/libjava/classpath/gnu/CORBA/Poa/vPolicy.java b/libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java
index 9e45b56d7ee..44ebaf45351 100644
--- a/libjava/classpath/gnu/CORBA/Poa/vPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/AccessiblePolicy.java
@@ -1,4 +1,4 @@
-/* vPolicy.java --
+/* AccessiblePolicy.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,7 +46,7 @@ import org.omg.CORBA.Policy;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface vPolicy
+public interface AccessiblePolicy
extends Policy
{
/**
diff --git a/libjava/classpath/gnu/CORBA/Poa/dynImpHandler.java b/libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java
index 1cc3e131cd7..903f8bfbbe1 100644
--- a/libjava/classpath/gnu/CORBA/Poa/dynImpHandler.java
+++ b/libjava/classpath/gnu/CORBA/Poa/DynamicImpHandler.java
@@ -1,4 +1,4 @@
-/* dynImpHandler.java --
+/* DynamicImpHandler.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ import org.omg.PortableServer.DynamicImplementation;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class dynImpHandler
+public class DynamicImpHandler
implements InvokeHandler
{
/**
@@ -66,7 +66,7 @@ public class dynImpHandler
* Create a new instance, wrapping some dyn implementation.
* @param _servant
*/
- public dynImpHandler(DynamicImplementation _servant)
+ public DynamicImpHandler(DynamicImplementation _servant)
{
servant = _servant;
}
diff --git a/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java b/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java
index 2df378df6a4..b1d5eaf8c03 100644
--- a/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java
+++ b/libjava/classpath/gnu/CORBA/Poa/ForwardedServant.java
@@ -39,8 +39,9 @@ exception statement from your version. */
package gnu.CORBA.Poa;
import gnu.CORBA.IOR;
-import gnu.CORBA.IOR_Delegate;
-import gnu.CORBA.IOR_contructed_object;
+import gnu.CORBA.IorDelegate;
+import gnu.CORBA.IorObject;
+import gnu.CORBA.Minor;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.CompletionStatus;
@@ -101,9 +102,9 @@ public class ForwardedServant
ObjectImpl fto = (ObjectImpl) a_ref;
// Check maybe the remote side forwarded back to our local object.
- if (fto instanceof IOR_contructed_object)
+ if (fto instanceof IorObject)
{
- IOR_contructed_object iref = (IOR_contructed_object) fto;
+ IorObject iref = (IorObject) fto;
// Check maybe the IOR is local.
ORB t_orb = iref._orb();
@@ -111,13 +112,13 @@ public class ForwardedServant
{
ORB_1_4 orb = (ORB_1_4) t_orb;
Delegate d = iref._get_delegate();
- if (d instanceof IOR_Delegate)
+ if (d instanceof IorDelegate)
{
- IOR_Delegate ird = (IOR_Delegate) iref._get_delegate();
+ IorDelegate ird = (IorDelegate) iref._get_delegate();
IOR ior = ird.getIor();
if (orb.LOCAL_HOST.equalsIgnoreCase(ior.Internet.host))
{
- activeObjectMap.Obj rx = orb.rootPOA.findIorKey(ior.key);
+ AOM.Obj rx = orb.rootPOA.findIorKey(ior.key);
if (rx != null)
{
if (rx.object == fto ||
@@ -175,6 +176,7 @@ public class ForwardedServant
catch (IOException io_ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Forwarding;
m.initCause(io_ex);
throw m;
}
diff --git a/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java b/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java
index 7af3369d2e8..72dd8f0cf50 100644
--- a/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java
+++ b/libjava/classpath/gnu/CORBA/Poa/LocalDelegate.java
@@ -38,8 +38,10 @@ exception statement from your version. */
package gnu.CORBA.Poa;
-import gnu.CORBA.CDR.cdrOutput;
-import gnu.CORBA.streamRequest;
+import gnu.CORBA.CDR.AbstractCdrOutput;
+import gnu.CORBA.IOR;
+import gnu.CORBA.IorProvider;
+import gnu.CORBA.StreamBasedRequest;
import org.omg.CORBA.ARG_INOUT;
import org.omg.CORBA.Bounds;
@@ -68,17 +70,22 @@ import java.util.Arrays;
* A local delegate, transferring all object requests to the locally available
* servant. This class is involved in handling the method invocations on the
* local object, obtained by POA.create_reference_with_id.
- *
+ *
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
+public class LocalDelegate
+ extends org.omg.CORBA_2_3.portable.Delegate
+ implements IorProvider
{
/**
* The same servant as an invocation handler.
*/
gnuServantObject object;
+
String operation;
- final gnuPOA poa;
+
+ public final gnuPOA poa;
+
final byte[] Id;
/**
@@ -91,6 +98,14 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
poa = a_poa;
Id = an_id;
}
+
+ /**
+ * Get the IOR of the connected object.
+ */
+ public IOR getIor()
+ {
+ return object.getIor();
+ }
public Request request(org.omg.CORBA.Object target, String method)
{
@@ -107,8 +122,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
}
public boolean is_equivalent(org.omg.CORBA.Object target,
- org.omg.CORBA.Object other
- )
+ org.omg.CORBA.Object other)
{
if (target == other)
return true;
@@ -157,9 +171,9 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
/**
* Check if this object could be named by the given repository id.
- *
+ *
* @param idl_id the repository id to check.
- *
+ *
* @return true if it is one of the possible repository ids of this object.
*/
public boolean is_a(org.omg.CORBA.Object a_servant, String idl_id)
@@ -167,7 +181,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
String[] maybe = object._ids();
for (int i = 0; i < maybe.length; i++)
{
- if (maybe [ i ].equals(idl_id))
+ if (maybe[i].equals(idl_id))
return true;
}
return false;
@@ -186,8 +200,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
*/
public Request create_request(org.omg.CORBA.Object target, Context context,
String method, NVList parameters, NamedValue returns,
- ExceptionList exceptions, ContextList ctx_list
- )
+ ExceptionList exceptions, ContextList ctx_list)
{
operation = method;
@@ -204,8 +217,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
* Create request for using with DII.
*/
public Request create_request(org.omg.CORBA.Object target, Context context,
- String method, NVList parameters, NamedValue returns
- )
+ String method, NVList parameters, NamedValue returns)
{
operation = method;
@@ -226,23 +238,20 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
/**
* Create a request to invoke the method of this CORBA object.
- *
+ *
* @param operation the name of the method to invoke.
* @param response_expected specifies if this is one way message or the
* response to the message is expected.
- *
+ *
* @return the stream where the method arguments should be written.
*/
public org.omg.CORBA.portable.OutputStream request(
- org.omg.CORBA.Object target,
- String method,
- boolean response_expected
- )
+ org.omg.CORBA.Object target, String method, boolean response_expected)
{
operation = method;
// Check if the object is not explicitly deactivated.
- activeObjectMap.Obj e = poa.aom.get(Id);
+ AOM.Obj e = poa.aom.get(Id);
if (e != null && e.isDeactiveted())
{
if (poa.servant_activator != null || poa.servant_locator != null)
@@ -280,7 +289,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
/**
* Make an invocation.
- *
+ *
* @param target not in use.
* @param output the stream request that should be returned by
* {@link #m_request} in this method.
@@ -292,31 +301,29 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
{
try
{
- streamRequest sr = (streamRequest) output;
+ StreamBasedRequest sr = (StreamBasedRequest) output;
LocalRequest lr = (LocalRequest) sr.request;
- InvokeHandler handler =
- lr.object.getHandler(lr.operation(), lr.cookie, false);
+ InvokeHandler handler = lr.object.getHandler(lr.operation(), lr.cookie,
+ false);
- if (handler instanceof dynImpHandler)
+ if (handler instanceof DynamicImpHandler)
{
// The local request known how to handle it, but the different
// method must be called.
lr.invoke();
// The encapsulation will inherit orb, endian, charsets, etc.
- cdrOutput buf = sr.createEncapsulation();
+ AbstractCdrOutput buf = sr.createEncapsulation();
// Write all request parameters to the buffer stream.
if (lr.env().exception() != null)
{
try
{
- UnknownUserException uex =
- (UnknownUserException) lr.env().exception();
+ UnknownUserException uex = (UnknownUserException) lr.env().exception();
throw new ApplicationException(uex.except.type().id(),
- uex.except.create_input_stream()
- );
+ uex.except.create_input_stream());
}
catch (BadKind ex)
{
@@ -334,9 +341,8 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
for (int i = 0; i < lr.arguments().count(); i++)
{
a = lr.arguments().item(i);
- if (a.flags() == ARG_INOUT.value ||
- a.flags() == ARG_INOUT.value
- )
+ if (a.flags() == ARG_INOUT.value
+ || a.flags() == ARG_INOUT.value)
{
a.value().write_value(buf);
}
@@ -362,10 +368,7 @@ public class LocalDelegate extends org.omg.CORBA_2_3.portable.Delegate
try
{
return ((ObjectImpl) f.forward_reference)._invoke(f.forward_reference._request(
- operation,
- true
- )
- );
+ operation, true));
}
catch (RemarshalException e)
{
diff --git a/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java b/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
index a727499fce5..a2c0bb106c3 100644
--- a/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
+++ b/libjava/classpath/gnu/CORBA/Poa/LocalRequest.java
@@ -38,19 +38,19 @@ exception statement from your version. */
package gnu.CORBA.Poa;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.GIOP.MessageHeader;
import gnu.CORBA.GIOP.v1_2.ReplyHeader;
import gnu.CORBA.GIOP.v1_2.RequestHeader;
import gnu.CORBA.Interceptor.gnuClientRequestInfo;
import gnu.CORBA.Interceptor.gnuServerRequestInfo;
+import gnu.CORBA.typecodes.RecordTypeCode;
import gnu.CORBA.ObjectCreator;
import gnu.CORBA.Unexpected;
import gnu.CORBA.gnuAny;
import gnu.CORBA.gnuRequest;
-import gnu.CORBA.recordTypeCode;
-import gnu.CORBA.streamReadyHolder;
-import gnu.CORBA.streamRequest;
+import gnu.CORBA.StreamHolder;
+import gnu.CORBA.StreamBasedRequest;
import org.omg.CORBA.ARG_OUT;
import org.omg.CORBA.Any;
@@ -115,7 +115,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
/**
* The buffer to write into.
*/
- cdrBufOutput buffer;
+ BufferedCdrOutput buffer;
/**
* The responsible POA.
@@ -252,7 +252,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
handler = object.getHandler(operation(), cookie, false);
}
- cdrBufOutput request_part = new cdrBufOutput();
+ BufferedCdrOutput request_part = new BufferedCdrOutput();
request_part.setOrb(orb());
@@ -288,7 +288,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
request_part.create_input_stream();
// Ensure the servant (handler) has a delegate set.
- servantDelegate sd = null;
+ ServantDelegateImpl sd = null;
Delegate d = null;
@@ -300,19 +300,19 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
{
// In some cases exception is thrown if the delegate is not set.
}
- if (d instanceof servantDelegate)
+ if (d instanceof ServantDelegateImpl)
{
// If the delegate is already set, try to reuse the existing
// instance.
- sd = (servantDelegate) d;
+ sd = (ServantDelegateImpl) d;
if (sd.object != object)
{
- sd = new servantDelegate(servant, poa, Id);
+ sd = new ServantDelegateImpl(servant, poa, Id);
}
}
else
{
- sd = new servantDelegate(servant, poa, Id);
+ sd = new ServantDelegateImpl(servant, poa, Id);
}
servant._set_delegate(sd);
@@ -368,13 +368,13 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
{
// Failed due any reason, insert without
// helper.
- a.insert_Streamable(new streamReadyHolder(
+ a.insert_Streamable(new StreamHolder(
buf.create_input_stream()
)
);
- recordTypeCode r =
- new recordTypeCode(TCKind.tk_except);
+ RecordTypeCode r =
+ new RecordTypeCode(TCKind.tk_except);
r.setId(uex_idl);
r.setName(ObjectCreator.getDefaultName(uex_idl));
}
@@ -531,9 +531,9 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
{
InvokeHandler handler = object.getHandler(operation(), cookie, false);
- if (handler instanceof dynImpHandler)
+ if (handler instanceof DynamicImpHandler)
{
- DynamicImplementation dyn = ((dynImpHandler) handler).servant;
+ DynamicImplementation dyn = ((DynamicImpHandler) handler).servant;
if (serverRequest == null)
{
serverRequest = new LocalServerRequest(this);
@@ -589,7 +589,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
// Prepare an Any that will hold the exception.
gnuAny exc = new gnuAny();
- exc.insert_Streamable(new streamReadyHolder(input));
+ exc.insert_Streamable(new StreamHolder(input));
UnknownUserException unuex = new UnknownUserException(exc);
m_environment.exception(unuex);
@@ -637,7 +637,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
*
* @return the CDR output stream, containing the written output.
*/
- cdrBufOutput getBuffer()
+ BufferedCdrOutput getBuffer()
{
return buffer;
}
@@ -656,7 +656,7 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
*/
private void prepareStream()
{
- buffer = new cdrBufOutput();
+ buffer = new BufferedCdrOutput();
buffer.setOrb(orb());
}
@@ -664,9 +664,9 @@ public class LocalRequest extends gnuRequest implements ResponseHandler,
* Get the parameter stream, where the invocation arguments should be written
* if they are written into the stream directly.
*/
- public streamRequest getParameterStream()
+ public StreamBasedRequest getParameterStream()
{
- m_parameter_buffer = new streamRequest();
+ m_parameter_buffer = new StreamBasedRequest();
m_parameter_buffer.request = this;
m_parameter_buffer.setOrb(poa.orb());
return m_parameter_buffer;
diff --git a/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java b/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
index d95bf2be8f6..bb00aab70eb 100644
--- a/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
+++ b/libjava/classpath/gnu/CORBA/Poa/ORB_1_4.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA.Poa;
-import gnu.CORBA.Functional_ORB;
+import gnu.CORBA.OrbFunctional;
import gnu.CORBA.IOR;
import gnu.CORBA.Connected_objects.cObject;
import gnu.CORBA.DynAn.gnuDynAnyFactory;
@@ -53,11 +53,13 @@ import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.ORB;
import org.omg.CORBA.Policy;
import org.omg.CORBA.PolicyError;
import org.omg.CORBA.portable.ObjectImpl;
import org.omg.PortableInterceptor.PolicyFactory;
-import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POAManagerPackage.State;
import org.omg.PortableServer.POAPackage.InvalidPolicy;
import java.applet.Applet;
@@ -69,7 +71,7 @@ import java.util.Properties;
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class ORB_1_4
- extends Functional_ORB
+ extends OrbFunctional
{
/**
* The root POA.
@@ -100,7 +102,7 @@ public class ORB_1_4
super();
try
{
- rootPOA = new gnuPOA(null, "RootPOA", null, policySets.rootPoa(), this);
+ rootPOA = new gnuPOA(null, "RootPOA", null, StandardPolicies.rootPoa(), this);
}
catch (InvalidPolicy ex)
{
@@ -130,7 +132,7 @@ public class ORB_1_4
{
try
{
- activeObjectMap.Obj exists = rootPOA.findObject(forObject);
+ AOM.Obj exists = rootPOA.findObject(forObject);
if (exists == null)
throw new OBJECT_NOT_EXIST(forObject == null ? "null"
: forObject.toString());
@@ -201,9 +203,9 @@ public class ORB_1_4
IOR ior = super.createIOR(ref);
if (iIor != null)
{
- activeObjectMap.Obj obj = rootPOA.findIorKey(ior.key);
+ AOM.Obj obj = rootPOA.findIorKey(ior.key);
- POA poa;
+ gnuPOA poa;
// Null means that the object was connected to the ORB directly.
if (obj == null)
@@ -215,6 +217,7 @@ public class ORB_1_4
// This may modify the ior.
iIor.establish_components(info);
+ iIor.components_established(info);
}
return ior;
}
@@ -252,5 +255,39 @@ public class ORB_1_4
super.set_parameters(para, props);
registerInterceptors(props, para);
}
+
+ /**
+ * This method is called by RMI-IIOP {@link javax.rmi.Tie#orb(ORB)}, passing
+ * <code>this</code> as parameter. The ORB will try to connect that tie as
+ * one of its objects, if it is not already connected. If the wrapper is an
+ * instance of Servant this method also activates the root poa (if not already
+ * active).
+ */
+ public void set_delegate(java.lang.Object wrapper)
+ {
+ if (wrapper instanceof org.omg.CORBA.Object)
+ {
+ org.omg.CORBA.Object object = (org.omg.CORBA.Object) wrapper;
+ if (connected_objects.getKey(object) == null)
+ connect(object);
+ }
+ else if (wrapper instanceof Servant)
+ {
+ Servant s = (Servant) wrapper;
+ if (rootPOA.findServant(s) == null)
+ try
+ {
+ rootPOA.servant_to_reference(s);
+ if (rootPOA.the_POAManager().get_state().value() == State._HOLDING)
+ rootPOA.the_POAManager().activate();
+ }
+ catch (Exception e)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("Unable to connect "
+ + wrapper + " to " + this);
+ throw bad;
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Poa/servantDelegate.java b/libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java
index f59c01c6b3e..e65214d4a9a 100644
--- a/libjava/classpath/gnu/CORBA/Poa/servantDelegate.java
+++ b/libjava/classpath/gnu/CORBA/Poa/ServantDelegateImpl.java
@@ -1,4 +1,4 @@
-/* servantDelegate.java --
+/* ServantDelegateImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,7 +60,7 @@ import org.omg.PortableServer.portable.Delegate;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class servantDelegate
+public class ServantDelegateImpl
implements Delegate
{
/**
@@ -93,7 +93,7 @@ public class servantDelegate
* @param a_servant the servant.
* @param a_servant_id the servant id.
*/
- public servantDelegate(Servant a_servant, gnuPOA a_poa, byte[] a_servant_id)
+ public ServantDelegateImpl(Servant a_servant, gnuPOA a_poa, byte[] a_servant_id)
{
poa = a_poa;
servant = a_servant;
diff --git a/libjava/classpath/gnu/CORBA/Poa/policySets.java b/libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java
index eb688467ae7..b2edc4056ab 100644
--- a/libjava/classpath/gnu/CORBA/Poa/policySets.java
+++ b/libjava/classpath/gnu/CORBA/Poa/StandardPolicies.java
@@ -1,4 +1,4 @@
-/* policySets.java --
+/* StandardPolicies.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,14 +56,14 @@ import java.util.ArrayList;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class policySets
+public class StandardPolicies
{
/**
* The default policy set, as defined in OMG specs. This is also
* the policy set for the root POA.
*/
- private static final vPolicy[] rootPOASet =
- new vPolicy[]
+ private static final AccessiblePolicy[] rootPOASet =
+ new AccessiblePolicy[]
{
new gnuThreadPolicy(ThreadPolicyValue.ORB_CTRL_MODEL),
new gnuLifespanPolicy(LifespanPolicyValue.TRANSIENT),
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java b/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java
index 3019a2ae966..17d5a0f9e04 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuAdapterActivator.java
@@ -69,7 +69,7 @@ public class gnuAdapterActivator
{
try
{
- POA n = parent.create_POA(child_name, null, policySets.rootPoa());
+ POA n = parent.create_POA(child_name, null, StandardPolicies.rootPoa());
n.the_POAManager().activate();
}
catch (Exception ex)
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java
index a404486ce70..91531909a6a 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuIdAssignmentPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.IdAssignmentPolicyValue;
*/
public class gnuIdAssignmentPolicy
extends _PolicyImplBase
- implements IdAssignmentPolicy, vPolicy
+ implements IdAssignmentPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java
index 2abd1f4845f..0b5fa1420bd 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuIdUniquenessPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.IdUniquenessPolicyValue;
*/
public class gnuIdUniquenessPolicy
extends _PolicyImplBase
- implements IdUniquenessPolicy, vPolicy
+ implements IdUniquenessPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java
index 1e539a2c4e0..f1721beef64 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuImplicitActivationPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.ImplicitActivationPolicyValue;
*/
public class gnuImplicitActivationPolicy
extends _PolicyImplBase
- implements ImplicitActivationPolicy, vPolicy
+ implements ImplicitActivationPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java
index 97b3f2d7a9b..f26596cd951 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuLifespanPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.LifespanPolicyValue;
*/
public class gnuLifespanPolicy
extends _PolicyImplBase
- implements LifespanPolicy, vPolicy
+ implements LifespanPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
index 1d9e838532a..6f2a019a3bb 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
@@ -49,10 +49,15 @@ import org.omg.CORBA.LocalObject;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.OBJ_ADAPTER;
import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
import org.omg.CORBA.Policy;
import org.omg.CORBA.SetOverrideType;
import org.omg.CORBA.TRANSIENT;
import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableInterceptor.NON_EXISTENT;
+import org.omg.PortableInterceptor.ObjectReferenceFactory;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
+import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper;
import org.omg.PortableServer.AdapterActivator;
import org.omg.PortableServer.ForwardRequest;
import org.omg.PortableServer.IdAssignmentPolicy;
@@ -87,8 +92,10 @@ import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
import org.omg.PortableServer.POAPackage.ServantNotActive;
import org.omg.PortableServer.POAPackage.WrongAdapter;
import org.omg.PortableServer.POAPackage.WrongPolicy;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
/**
* Our POA implementation.
@@ -97,12 +104,108 @@ import gnu.CORBA.CDR.cdrBufOutput;
*/
public class gnuPOA
extends LocalObject
- implements POA
+ implements POA, ObjectReferenceFactory
{
/**
+ * The object reference template, associated with this POA.
+ *
+ * @since 1.5
+ */
+ class RefTemplate implements ObjectReferenceTemplate
+ {
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ RefTemplate()
+ {
+ // The adapter name is computed once.
+ ArrayList names = new ArrayList();
+ names.add(the_name());
+
+ POA poa = the_parent();
+ while (poa != null)
+ {
+ names.add(poa.the_name());
+ poa = poa.the_parent();
+ }
+
+ // Fill in the string array in reverse (more natural) order,
+ // root POA first.
+ m_adapter_name = new String[names.size()];
+
+ for (int i = 0; i < m_adapter_name.length; i++)
+ m_adapter_name[i] = (String) names.get(m_adapter_name.length - i - 1);
+ }
+
+ /**
+ * The adapter name
+ */
+ final String[] m_adapter_name;
+
+ /**
+ * Get the name of this POA.
+ */
+ public String[] adapter_name()
+ {
+ return (String[]) m_adapter_name.clone();
+ }
+
+ /**
+ * Get the ORB id.
+ */
+ public String orb_id()
+ {
+ return m_orb.orb_id;
+ }
+
+ /**
+ * Get the server id.
+ */
+ public String server_id()
+ {
+ return OrbFunctional.server_id;
+ }
+
+ /**
+ * Create the object.
+ */
+ public Object make_object(String repositoryId, byte[] objectId)
+ {
+ return create_reference_with_id(objectId, repositoryId);
+ }
+
+ /**
+ * Get the array of truncatible repository ids.
+ */
+ public String[] _truncatable_ids()
+ {
+ return ref_template_ids;
+ }
+ }
+
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * The adapter reference template.
+ */
+ ObjectReferenceTemplate refTemplate;
+
+ /**
+ * The reference template repository ids. Defined outside the class as it
+ * cannot have static members.
+ */
+ final static String[] ref_template_ids =
+ new String[] { ObjectReferenceTemplateHelper.id() };
+
+ /**
* The active object map, mapping between object keys, objects and servants.
*/
- public final activeObjectMap aom = new activeObjectMap();
+ public final AOM aom = new AOM();
/**
* The children of this POA.
@@ -182,6 +285,12 @@ public class gnuPOA
* necessity of the frequent checks.
*/
public final boolean retain_servant;
+
+ /**
+ * The object reference factory, used to create the new object
+ * references.
+ */
+ ObjectReferenceFactory m_object_factory = this;
/**
* Create a new abstract POA.
@@ -199,7 +308,7 @@ public class gnuPOA
throws InvalidPolicy
{
// Add default policies.
- Policy[] all_policies = policySets.withDefault(a_policies);
+ Policy[] all_policies = StandardPolicies.withDefault(a_policies);
name = a_name;
parent = a_parent;
@@ -222,12 +331,14 @@ public class gnuPOA
for (int i = 0; i < s_policies.length; i++)
{
s_policies [ i ] = all_policies [ i ].copy();
- m_policies.add(((vPolicy) s_policies [ i ]).getValue());
+ m_policies.add(((AccessiblePolicy) s_policies [ i ]).getValue());
}
retain_servant = applies(ServantRetentionPolicyValue.RETAIN);
validatePolicies(a_policies);
+
+ refTemplate = new RefTemplate();
}
/**
@@ -281,7 +392,7 @@ public class gnuPOA
keys.addAll(aom.keySet());
byte[] key;
- activeObjectMap.Obj obj;
+ AOM.Obj obj;
boolean last;
for (int i = 0; i < keys.size(); i++)
{
@@ -422,30 +533,30 @@ public class gnuPOA
}
/**
- * Generate the Object Id for the given servant and add the servant to
- * the Active Object Map using this Id a a key. If the servant
- * activator is set, its incarnate method will be called.
- *
- * @param a_servant a servant that would serve the object with the
- * returned Object Id. If null is passed, under apporoprate policies the
- * servant activator is invoked.
- *
+ * Generate the Object Id for the given servant and add the servant to the
+ * Active Object Map using this Id a a key. If the servant activator is set,
+ * its incarnate method will be called.
+ *
+ * @param a_servant a servant that would serve the object with the returned
+ * Object Id. If null is passed, under apporoprate policies the servant
+ * activator is invoked.
+ *
* @return the generated objert Id for the given servant.
- *
- * @throws ServantAlreadyActive if this servant is already in the
- * Active Object Map and the UNIQUE_ID policy applies.
- *
- * @throws WrongPolicy if the required policies SYSTEM_ID and RETAIN
- * do not apply to this POA.
+ *
+ * @throws ServantAlreadyActive if this servant is already in the Active
+ * Object Map and the UNIQUE_ID policy applies.
+ *
+ * @throws WrongPolicy if the required policies SYSTEM_ID and RETAIN do not
+ * apply to this POA.
*/
public byte[] activate_object(Servant a_servant)
- throws ServantAlreadyActive, WrongPolicy
+ throws ServantAlreadyActive, WrongPolicy
{
checkDiscarding();
required(ServantRetentionPolicyValue.RETAIN);
required(IdAssignmentPolicyValue.SYSTEM_ID);
- activeObjectMap.Obj exists = aom.findServant(a_servant);
+ AOM.Obj exists = aom.findServant(a_servant);
if (exists != null)
{
@@ -464,28 +575,30 @@ public class gnuPOA
// activations.
}
- byte[] object_key = activeObjectMap.getFreeId();
- servantDelegate delegate = new servantDelegate(a_servant, this, object_key);
- connectDelegate(object_key, delegate);
+ byte[] object_key = AOM.getFreeId();
+ ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this,
+ object_key);
+ create_and_connect(object_key,
+ a_servant._all_interfaces(this, object_key)[0], delegate);
return object_key;
}
/**
- * Add the given servant to the Active Object Map as a servant for the
- * object with the provided Object Id. If the servant activator is
- * set, its incarnate method will be called.
- *
+ * Add the given servant to the Active Object Map as a servant for the object
+ * with the provided Object Id. If the servant activator is set, its incarnate
+ * method will be called.
+ *
* @param an_Object_Id an object id for the given object.
- * @param a_servant a servant that will serve the object with the given
- * Object Id. If null is passed, under apporoprate policies the
- * servant activator is invoked.
- *
- * @throws ObjectAlreadyActive if the given object id is already in the
- * Active Object Map.
- * @throws ServantAlreadyActive if the UNIQUE_ID policy applies and
- * this servant is already in use.
- * @throws WrongPolicy if the required RETAIN policy does not apply to
- * this POA.
+ * @param a_servant a servant that will serve the object with the given Object
+ * Id. If null is passed, under apporoprate policies the servant activator is
+ * invoked.
+ *
+ * @throws ObjectAlreadyActive if the given object id is already in the Active
+ * Object Map.
+ * @throws ServantAlreadyActive if the UNIQUE_ID policy applies and this
+ * servant is already in use.
+ * @throws WrongPolicy if the required RETAIN policy does not apply to this
+ * POA.
* @throws BAD_PARAM if the passed object id is invalid due any reason.
*/
public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant)
@@ -496,16 +609,14 @@ public class gnuPOA
}
/**
- * Same as activate_object_with_id, but permits gnuForwardRequest
- * forwarding exception. This is used when the activation is called
- * from the remote invocation context and we have possibility
- * to return the forwarding message.
+ * Same as activate_object_with_id, but permits gnuForwardRequest forwarding
+ * exception. This is used when the activation is called from the remote
+ * invocation context and we have possibility to return the forwarding
+ * message.
*/
public void activate_object_with_id(byte[] an_Object_Id, Servant a_servant,
- boolean use_forwarding
- )
- throws ServantAlreadyActive, ObjectAlreadyActive,
- WrongPolicy
+ boolean use_forwarding)
+ throws ServantAlreadyActive, ObjectAlreadyActive, WrongPolicy
{
checkDiscarding();
required(ServantRetentionPolicyValue.RETAIN);
@@ -514,12 +625,12 @@ public class gnuPOA
// already active.
if (applies(IdUniquenessPolicyValue.UNIQUE_ID))
{
- activeObjectMap.Obj sx = aom.findServant(a_servant, false);
+ AOM.Obj sx = aom.findServant(a_servant, false);
if (sx != null)
throw new ServantAlreadyActive();
}
- activeObjectMap.Obj exists = aom.get(an_Object_Id);
+ AOM.Obj exists = aom.get(an_Object_Id);
if (exists != null)
{
if (exists.servant == null)
@@ -537,26 +648,27 @@ public class gnuPOA
}
else
{
- servantDelegate delegate =
- new servantDelegate(a_servant, this, an_Object_Id);
- connectDelegate(an_Object_Id, delegate);
+ ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this,
+ an_Object_Id);
+ create_and_connect(an_Object_Id, a_servant._all_interfaces(this,
+ an_Object_Id)[0], delegate);
}
}
/**
* Locate the servant for this object Id and connect it to ORB.
- *
+ *
* @param an_Object_Id the object id.
* @param a_servant the servant (may be null).
* @param exists an existing active object map entry.
- * @param use_forwarding allow to throw the gnuForwardRequest
- * if the activator throws ForwardRequest.
- *
- * @throws OBJ_ADAPTER minor 4 if the servant cannot be located
- * (the required servant manager may be missing).
+ * @param use_forwarding allow to throw the gnuForwardRequest if the activator
+ * throws ForwardRequest.
+ *
+ * @throws OBJ_ADAPTER minor 4 if the servant cannot be located (the required
+ * servant manager may be missing).
*/
private void locateServant(byte[] an_Object_Id, Servant a_servant,
- activeObjectMap.Obj exists, boolean use_forwarding
+ AOM.Obj exists, boolean use_forwarding
)
throws InternalError
{
@@ -582,8 +694,8 @@ public class gnuPOA
throw new OBJ_ADAPTER("no servant", 4, CompletionStatus.COMPLETED_NO);
}
- servantDelegate delegate =
- new servantDelegate(exists.servant, this, an_Object_Id);
+ ServantDelegateImpl delegate =
+ new ServantDelegateImpl(exists.servant, this, an_Object_Id);
exists.servant._set_delegate(delegate);
object.setServant(exists.servant);
connect_to_orb(an_Object_Id, delegate.object);
@@ -605,7 +717,7 @@ public class gnuPOA
{
required(ServantRetentionPolicyValue.RETAIN);
- activeObjectMap.Obj exists = aom.get(the_Object_Id);
+ AOM.Obj exists = aom.get(the_Object_Id);
if (exists == null || exists.isDeactiveted())
throw new ObjectNotActive();
@@ -615,7 +727,7 @@ public class gnuPOA
// Check if this servant is serving something else.
aom.remove(the_Object_Id);
- activeObjectMap.Obj other = aom.findServant(exists.servant, false);
+ AOM.Obj other = aom.findServant(exists.servant, false);
boolean remaining = other != null;
@@ -643,7 +755,7 @@ public class gnuPOA
throws WrongPolicy
{
required(IdAssignmentPolicyValue.SYSTEM_ID);
- return create_reference_with_id(activeObjectMap.getFreeId(), a_repository_id);
+ return create_reference_with_id(AOM.getFreeId(), a_repository_id);
}
/**
@@ -662,8 +774,8 @@ public class gnuPOA
* servant.
*/
public org.omg.CORBA.Object create_reference_with_id(byte[] an_object_id,
- String a_repository_id
- )
+ String a_repository_id
+ )
{
String[] ids;
if (a_repository_id == null)
@@ -672,7 +784,7 @@ public class gnuPOA
ids = new String[] { a_repository_id };
// Check maybe such object is already activated.
- activeObjectMap.Obj e = aom.get(an_object_id);
+ AOM.Obj e = aom.get(an_object_id);
Servant servant;
if (e == null)
@@ -847,7 +959,7 @@ public class gnuPOA
return m_poa_id;
else
{
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
POA p = this;
while (p != null)
{
@@ -874,7 +986,7 @@ public class gnuPOA
{
required(ServantRetentionPolicyValue.RETAIN);
- activeObjectMap.Obj ref = aom.get(the_Object_Id);
+ AOM.Obj ref = aom.get(the_Object_Id);
if (ref == null)
throw new ObjectNotActive();
else
@@ -897,7 +1009,7 @@ public class gnuPOA
{
if (applies(ServantRetentionPolicyValue.RETAIN))
{
- activeObjectMap.Obj ref = aom.get(the_Object_Id);
+ AOM.Obj ref = aom.get(the_Object_Id);
if (ref == null || ref.isDeactiveted())
{
if (default_servant != null)
@@ -932,7 +1044,7 @@ public class gnuPOA
public byte[] reference_to_id(org.omg.CORBA.Object the_Object)
throws WrongAdapter, WrongPolicy
{
- activeObjectMap.Obj ref = aom.findObject(the_Object);
+ AOM.Obj ref = aom.findObject(the_Object);
if (ref == null)
throw new WrongAdapter();
return ref.key;
@@ -958,7 +1070,7 @@ public class gnuPOA
{
if (applies(ServantRetentionPolicyValue.RETAIN))
{
- activeObjectMap.Obj ref = aom.findObject(the_Object);
+ AOM.Obj ref = aom.findObject(the_Object);
if (ref == null)
throw new WrongAdapter();
else if (ref.isDeactiveted() || ref.servant == null)
@@ -1017,7 +1129,7 @@ public class gnuPOA
)
)
{
- activeObjectMap.Obj ref = null;
+ AOM.Obj ref = null;
if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
ref = aom.findServant(the_Servant);
if (ref == null &&
@@ -1047,31 +1159,31 @@ public class gnuPOA
}
/**
- * <p>Converts the given servant to the object reference.
- * The servant will serve all methods, invoked on the returned object.
- * The returned object reference can be passed to the remote client,
- * enabling remote invocations.
- * </p><p>
- * If the specified servant is active, it is returned. Otherwise,
- * if the POA has the IMPLICIT_ACTIVATION policy the method activates
- * the servant. In this case, if the servant activator is set,
- * the {@link ServantActivatorOperations#incarnate} method will be called.
+ * <p>
+ * Converts the given servant to the object reference. The servant will serve
+ * all methods, invoked on the returned object. The returned object reference
+ * can be passed to the remote client, enabling remote invocations.
* </p>
- *
+ * <p>
+ * If the specified servant is active, it is returned. Otherwise, if the POA
+ * has the IMPLICIT_ACTIVATION policy the method activates the servant. In
+ * this case, if the servant activator is set, the
+ * {@link ServantActivatorOperations#incarnate} method will be called.
+ * </p>
+ *
* @throws ServantNotActive if the servant is inactive and no
* IMPLICIT_ACTIVATION policy applies.
* @throws WrongPolicy This method needs the RETAIN policy and either the
* UNIQUE_ID or IMPLICIT_ACTIVATION policies.
- *
+ *
* @return the object, exposing the given servant in the context of this POA.
*/
public org.omg.CORBA.Object servant_to_reference(Servant the_Servant)
- throws ServantNotActive,
- WrongPolicy
+ throws ServantNotActive, WrongPolicy
{
required(ServantRetentionPolicyValue.RETAIN);
- activeObjectMap.Obj exists = null;
+ AOM.Obj exists = null;
if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID))
exists = aom.findServant(the_Servant);
@@ -1092,17 +1204,17 @@ public class gnuPOA
else
return exists.object;
}
- if (exists == null &&
- applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)
- )
+ if (exists == null
+ && applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION))
{
checkDiscarding();
- byte[] object_key = activeObjectMap.getFreeId();
+ byte[] object_key = AOM.getFreeId();
- servantDelegate delegate =
- new servantDelegate(the_Servant, this, object_key);
- connectDelegate(object_key, delegate);
+ ServantDelegateImpl delegate = new ServantDelegateImpl(the_Servant,
+ this, object_key);
+ create_and_connect(object_key, the_Servant._all_interfaces(this,
+ object_key)[0], delegate);
return delegate.object;
}
@@ -1111,22 +1223,22 @@ public class gnuPOA
}
/**
- * Incarnate in cases when request forwarding is not expected
- * because the servant must be provided by the servant activator.
- *
- * @param x the aom entry, where the object is replaced by
- * value, returned by servant activator (if not null).
- *
+ * Incarnate in cases when request forwarding is not expected because the
+ * servant must be provided by the servant activator.
+ *
+ * @param x the aom entry, where the object is replaced by value, returned by
+ * servant activator (if not null).
+ *
* @param key the object key.
- *
+ *
* @param a_servant the servant that was passed as a parameter in the
* activation method.
- *
- * @param use_forwarding if true, the gnuForwardRequest is throw
- * under the forwarding exception (for remote client). Otherwise, the
- * request is internally redirected (for local invocation).
+ *
+ * @param use_forwarding if true, the gnuForwardRequest is throw under the
+ * forwarding exception (for remote client). Otherwise, the request is
+ * internally redirected (for local invocation).
*/
- private Servant incarnate(activeObjectMap.Obj x, byte[] object_key,
+ private Servant incarnate(AOM.Obj x, byte[] object_key,
Servant a_servant, boolean use_forwarding
)
{
@@ -1281,34 +1393,46 @@ public class gnuPOA
}
/**
- * <p> Destroy this POA and all descendant POAs. The destroyed POAs can be
- * later re-created via {@link AdapterActivator} or by invoking
- * {@link #create_POA}.
- * This differs from {@link PoaManagerOperations#deactivate} that does
- * not allow recreation of the deactivated POAs. After deactivation,
- * recreation is only possible if the POAs were later destroyed.
- * </p><p>
- * The remote invocation on the target, belonging to the POA that is
- * currently destroyed return the remote exception ({@link TRANSIENT},
- * minor code 4).
+ * <p>
+ * Destroy this POA and all descendant POAs. The destroyed POAs can be later
+ * re-created via {@link AdapterActivator} or by invoking {@link #create_POA}.
+ * This differs from {@link PoaManagerOperations#deactivate} that does not
+ * allow recreation of the deactivated POAs. After deactivation, recreation is
+ * only possible if the POAs were later destroyed.
* </p>
+ * <p>
+ * The remote invocation on the target, belonging to the POA that is currently
+ * destroyed return the remote exception ({@link TRANSIENT}, minor code 4).
+ * </p>
+ *
* @param etherealize_objects if true, and POA has RETAIN policy, and the
* servant manager is available, the servant manager method
- * {@link ServantActivatorOperations#etherealize} is called for each
- * <i>active</i> object in the Active Object Map. This method should not
- * try to access POA being destroyed. If <code>destroy</code> is called
- * multiple times before the destruction completes,
- * the etherialization should be invoked only once.
- *
+ * {@link ServantActivatorOperations#etherealize} is called for each <i>active</i>
+ * object in the Active Object Map. This method should not try to access POA
+ * being destroyed. If <code>destroy</code> is called multiple times before
+ * the destruction completes, the etherialization should be invoked only once.
+ *
* @param wait_for_completion if true, the method waits till the POA being
- * destroyed completes all current requests and etherialization. If false,
- * the method returns immediately.
+ * destroyed completes all current requests and etherialization. If false, the
+ * method returns immediately.
*/
public void destroy(boolean etherealize_objects, boolean wait_for_completion)
{
+ // Notify the IOR interceptors about that the POA is destroyed.
+ if (m_orb.iIor != null)
+ m_orb.iIor.adapter_state_changed(
+ new ObjectReferenceTemplate[] { getReferenceTemplate() },
+ NON_EXISTENT.value);
+
if (wait_for_completion)
waitWhileRunning();
+ // Nofify the IOR interceptors that the POA is destroyed.
+ if (m_manager instanceof gnuPOAManager)
+ {
+ ((gnuPOAManager) m_manager).poaDestroyed(this);
+ }
+
// Put the brake instead of manager, preventing the subsequent
// requests.
gnuPOAManager g = new gnuPOAManager();
@@ -1328,7 +1452,7 @@ public class gnuPOA
keys.addAll(aom.keySet());
byte[] key;
- activeObjectMap.Obj obj;
+ AOM.Obj obj;
for (int i = 0; i < keys.size(); i++)
{
key = (byte[]) keys.get(i);
@@ -1348,7 +1472,7 @@ public class gnuPOA
POA[] ch = the_children();
for (int i = 0; i < ch.length; i++)
{
- ch [ i ].destroy(etherealize_objects, wait_for_completion);
+ ch[i].destroy(etherealize_objects, wait_for_completion);
}
}
@@ -1430,13 +1554,14 @@ public class gnuPOA
}
/**
- * Connect the given delegate under the given key, also calling
- * incarnate.
+ * Connect the given delegate under the given key, also calling incarnate.
*/
- private void connectDelegate(byte[] object_key, servantDelegate delegate)
+ private void create_and_connect(byte[] object_key, String repository_id,
+ ServantDelegateImpl delegate)
{
aom.add(delegate);
- connect_to_orb(object_key, delegate.object);
+ connect_to_orb(object_key, getReferenceFactory().make_object(repository_id,
+ object_key));
if (servant_activator != null)
incarnate(null, object_key, delegate.servant, false);
}
@@ -1517,9 +1642,9 @@ public class gnuPOA
/**
* Recursively searches for the given object in the POA tree.
*/
- public activeObjectMap.Obj findObject(org.omg.CORBA.Object object)
+ public AOM.Obj findObject(org.omg.CORBA.Object object)
{
- activeObjectMap.Obj h = aom.findObject(object);
+ AOM.Obj h = aom.findObject(object);
if (h != null)
return h;
else
@@ -1533,16 +1658,16 @@ public class gnuPOA
}
return h;
}
-
+
/**
* Recursively searches for the given key in the POA tree.
* @param ior_key the key, ecapsulating both object
* and poa ids.
* @return
*/
- public activeObjectMap.Obj findKey(byte[] object_id, byte[] poa_id)
+ public AOM.Obj findKey(byte[] object_id, byte[] poa_id)
{
- activeObjectMap.Obj h = null;
+ AOM.Obj h = null;
if (Arrays.equals(poa_id, id()))
h = aom.get(object_id);
if (h != null)
@@ -1563,9 +1688,9 @@ public class gnuPOA
* Parses the given key, extracts poa and object id and searches
* for such reference.
*/
- public activeObjectMap.Obj findIorKey(byte[] ior_key)
+ public AOM.Obj findIorKey(byte[] ior_key)
{
- cdrBufInput in = new cdrBufInput(ior_key);
+ BufferredCdrInput in = new BufferredCdrInput(ior_key);
int signature = in.read_long();
if (signature != SIGNATURE)
return null;
@@ -1582,7 +1707,7 @@ public class gnuPOA
*/
public byte[] toIORKey(byte[] object_id)
{
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
buffer.write_long(SIGNATURE);
buffer.write_sequence(object_id);
buffer.write_sequence(id());
@@ -1600,7 +1725,7 @@ public class gnuPOA
*/
public byte[] idFormIor(byte[] ior_key)
{
- cdrBufInput in = new cdrBufInput(ior_key);
+ BufferredCdrInput in = new BufferredCdrInput(ior_key);
int signature = in.read_long();
if (signature != SIGNATURE)
return null;
@@ -1612,4 +1737,70 @@ public class gnuPOA
else
return null;
}
+
+ /**
+ * Recursively searches for the given servant in the POA tree.
+ */
+ public AOM.Obj findServant(Servant servant)
+ {
+ AOM.Obj h = aom.findServant(servant);
+ if (h != null)
+ return h;
+ else
+ {
+ for (int i = 0; i < children.size(); i++)
+ {
+ h = ((gnuPOA) children.get(i)).findServant(servant);
+ if (h != null)
+ return h;
+ }
+ }
+ return h;
+ }
+
+ /**
+ * Get the object reference template of this POA.
+ * Instantiate a singleton instance, if required.
+ */
+ public ObjectReferenceTemplate getReferenceTemplate()
+ {
+ if (refTemplate == null)
+ refTemplate = new RefTemplate();
+
+ return refTemplate;
+ }
+
+ public ObjectReferenceFactory getReferenceFactory()
+ {
+ return m_object_factory;
+ }
+
+ public void setReferenceFactory(ObjectReferenceFactory factory)
+ {
+ m_object_factory = factory;
+ }
+
+ /**
+ * Create the object (needed by the factory interface).
+ */
+ public Object make_object(String a_repository_id, byte[] an_object_id)
+ {
+ AOM.Obj existing = aom.get(an_object_id);
+ // The object may already exist. In this case, it is just returned.
+ if (existing != null && existing.object != null)
+ return existing.object;
+ else
+ {
+ return new gnuServantObject(new String[] { a_repository_id },
+ an_object_id, this, m_orb);
+ }
+ }
+
+ /**
+ * Required by object reference factory ops.
+ */
+ public String[] _truncatable_ids()
+ {
+ return ref_template_ids;
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java b/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
index 6c1b5644f36..7710306b748 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
@@ -40,6 +40,8 @@ package gnu.CORBA.Poa;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.LocalObject;
+import org.omg.PortableInterceptor.NON_EXISTENT;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
import org.omg.PortableServer.POAManager;
import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
import org.omg.PortableServer.POAManagerPackage.State;
@@ -59,18 +61,22 @@ public class gnuPOAManager
extends LocalObject
implements POAManager
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
- * The POAs, controlled by this manager. The members must be instances of
- * the gnuAbstractPOA.
+ * The POAs, controlled by this manager.
*/
- HashSet POAs = new HashSet();
+ private HashSet POAs = new HashSet();
/**
* The state of the manager. The newly created manager is always
* in the holding state.
*/
State state = State.HOLDING;
-
+
/**
* Get the state of the POA manager.
*/
@@ -94,6 +100,8 @@ public class gnuPOAManager
state = State.ACTIVE;
else
throw new AdapterInactive();
+
+ notifyInterceptors(state.value());
}
/**
@@ -113,6 +121,9 @@ public class gnuPOAManager
state = State.HOLDING;
else
throw new AdapterInactive();
+
+ notifyInterceptors(state.value());
+
if (wait_for_completion)
waitForIdle();
}
@@ -144,6 +155,9 @@ public class gnuPOAManager
if (state == State.INACTIVE)
throw new AdapterInactive("Repetetive inactivation");
state = State.INACTIVE;
+
+ notifyInterceptors(state.value());
+
if (wait_for_completion)
waitForIdle();
@@ -178,6 +192,9 @@ public class gnuPOAManager
state = State.DISCARDING;
else
throw new AdapterInactive();
+
+ notifyInterceptors(state.value());
+
if (wait_for_completion)
waitForIdle();
}
@@ -193,11 +210,13 @@ public class gnuPOAManager
{
if (state == State.ACTIVE)
throw new BAD_INV_ORDER("The state is active");
-
+
+ gnuPOA poa;
Iterator iter = POAs.iterator();
+
while (iter.hasNext())
{
- gnuPOA poa = (gnuPOA) iter.next();
+ poa = (gnuPOA) iter.next();
poa.waitWhileRunning();
}
}
@@ -222,4 +241,33 @@ public class gnuPOAManager
{
POAs.remove(poa);
}
+
+ /**
+ * This method is called when POA is destryed. The interceptors are
+ * notified.
+ */
+ public void poaDestroyed(gnuPOA poa)
+ {
+ notifyInterceptors(NON_EXISTENT.value);
+ }
+
+ /**
+ * Notify CORBA 3.0 interceptors about the status change.
+ */
+ public synchronized void notifyInterceptors(int new_state)
+ {
+ gnuPOA poa;
+ Iterator iter = POAs.iterator();
+
+ // The System.identityHashCode is also called in gnuIorInfo.
+ while (iter.hasNext())
+ {
+ poa = (gnuPOA) iter.next();
+ if (poa.m_orb.iIor != null)
+ {
+ poa.m_orb.iIor.adapter_manager_state_changed(
+ System.identityHashCode(this), (short) new_state);
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java
index 5bbcd1321b3..2f77639c698 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuRequestProcessingPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.RequestProcessingPolicyValue;
*/
public class gnuRequestProcessingPolicy
extends _PolicyImplBase
- implements RequestProcessingPolicy, vPolicy
+ implements RequestProcessingPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java b/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
index 1ad98d1cecd..020897a45b4 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
@@ -39,14 +39,17 @@ exception statement from your version. */
package gnu.CORBA.Poa;
import gnu.CORBA.GIOP.ReplyHeader;
-import gnu.CORBA.IOR_Delegate;
-import gnu.CORBA.IOR_contructed_object;
+import gnu.CORBA.IorDelegate;
+import gnu.CORBA.IorObject;
import gnu.CORBA.Interceptor.gnuServerRequestInfo;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.IOR;
+import gnu.CORBA.IorProvider;
+import gnu.CORBA.Minor;
import gnu.CORBA.ObjectCreator;
import gnu.CORBA.Unexpected;
-import gnu.CORBA.bufferedResponseHandler;
-import gnu.CORBA.recordTypeCode;
-import gnu.CORBA.streamReadyHolder;
+import gnu.CORBA.ResponseHandlerImpl;
+import gnu.CORBA.StreamHolder;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -90,7 +93,8 @@ import java.util.Arrays;
public class gnuServantObject extends ObjectImpl
implements org.omg.CORBA.Object,
InvokeHandler,
- CurrentOperations
+ CurrentOperations,
+ IorProvider
{
/**
* The associated servant that must also implement the {@link InvokeHandler}
@@ -144,6 +148,14 @@ public class gnuServantObject extends ObjectImpl
poa = a_poa;
orb = an_orb;
}
+
+ /**
+ * Get the IOR as it would be for this object.
+ */
+ public IOR getIor()
+ {
+ return orb.getLocalIor(this);
+ }
/**
* Create a servant object, associated with the passed servant.
@@ -257,10 +269,8 @@ public class gnuServantObject extends ObjectImpl
}
catch (Exception ex)
{
- ex.printStackTrace();
-
BAD_OPERATION bad =
- new BAD_OPERATION("Unable to activate", 0x5004,
+ new BAD_OPERATION("Unable to activate", Minor.Activation,
CompletionStatus.COMPLETED_NO
);
bad.initCause(ex);
@@ -276,7 +286,7 @@ public class gnuServantObject extends ObjectImpl
// No servant and no servant manager - throw exception.
else
{
- throw new BAD_OPERATION("Unable to activate", 0x5002,
+ throw new BAD_OPERATION("Unable to activate", Minor.Activation,
CompletionStatus.COMPLETED_NO
);
}
@@ -294,7 +304,7 @@ public class gnuServantObject extends ObjectImpl
}
else if (a_servant instanceof DynamicImplementation)
{
- return new dynImpHandler((DynamicImplementation) a_servant);
+ return new DynamicImpHandler((DynamicImplementation) a_servant);
}
else
{
@@ -402,17 +412,17 @@ public class gnuServantObject extends ObjectImpl
boolean intercept = false;
ServerRequestInterceptorOperations interceptor = null;
gnuServerRequestInfo info = null;
- bufferedResponseHandler i_handler = null;
+ ResponseHandlerImpl i_handler = null;
try
{
if (orb.iServer != null &&
- r_handler instanceof bufferedResponseHandler
+ r_handler instanceof ResponseHandlerImpl
)
{
interceptor = orb.iServer;
- i_handler = (bufferedResponseHandler) r_handler;
+ i_handler = (ResponseHandlerImpl) r_handler;
info =
new gnuServerRequestInfo(this, i_handler.request_header,
@@ -426,7 +436,7 @@ public class gnuServantObject extends ObjectImpl
try
{
CookieHolder cookie = null;
- activeObjectMap.Obj self = poa.aom.get(Id);
+ AOM.Obj self = poa.aom.get(Id);
if (poa.servant_locator != null)
{
@@ -467,18 +477,18 @@ public class gnuServantObject extends ObjectImpl
{
// In some cases exception is thrown if the delegate is not set.
}
- if (d instanceof servantDelegate)
+ if (d instanceof ServantDelegateImpl)
{
// If the delegate is already set, check maybe we can
// reuse the existing instance.
- if (((servantDelegate) d).object != this)
+ if (((ServantDelegateImpl) d).object != this)
{
- servant._set_delegate(new servantDelegate(servant, poa, Id));
+ servant._set_delegate(new ServantDelegateImpl(servant, poa, Id));
}
}
else
{
- servant._set_delegate(new servantDelegate(servant, poa, Id));
+ servant._set_delegate(new ServantDelegateImpl(servant, poa, Id));
}
try
@@ -536,13 +546,13 @@ public class gnuServantObject extends ObjectImpl
{
// Failed due any reason, insert without
// helper.
- a.insert_Streamable(new streamReadyHolder(
+ a.insert_Streamable(new StreamHolder(
buf.create_input_stream()
)
);
- recordTypeCode r =
- new recordTypeCode(TCKind.tk_except);
+ RecordTypeCode r =
+ new RecordTypeCode(TCKind.tk_except);
r.setId(uex_idl);
r.setName(ObjectCreator.getDefaultName(
uex_idl
@@ -774,12 +784,12 @@ public class gnuServantObject extends ObjectImpl
gnuServantObject g = (gnuServantObject) other;
return orb == g.orb && poa == g.poa && Arrays.equals(Id, g.Id);
}
- else if (other instanceof IOR_contructed_object)
+ else if (other instanceof IorObject)
{
- IOR_contructed_object ir = ((IOR_contructed_object) other);
+ IorObject ir = ((IorObject) other);
try
{
- IOR_Delegate ird = (IOR_Delegate) ir._get_delegate();
+ IorDelegate ird = (IorDelegate) ir._get_delegate();
byte[] ior_id = poa.idFormIor(ird.getIor().key);
if (ior_id != null && Arrays.equals(ior_id, Id))
{
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java
index 009e70e1b35..9fb61ab3f1f 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuServantRetentionPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.ServantRetentionPolicyValue;
*/
public class gnuServantRetentionPolicy
extends _PolicyImplBase
- implements ServantRetentionPolicy, vPolicy
+ implements ServantRetentionPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java b/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java
index f42ebefb363..1de94a10145 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuThreadPolicy.java
@@ -51,7 +51,7 @@ import org.omg.PortableServer.ThreadPolicyValue;
*/
public class gnuThreadPolicy
extends _PolicyImplBase
- implements ThreadPolicy, vPolicy
+ implements ThreadPolicy, AccessiblePolicy
{
/**
* Use serialVersionUID for interoperability.
diff --git a/libjava/classpath/gnu/CORBA/binaryReply.java b/libjava/classpath/gnu/CORBA/RawReply.java
index 71afa377679..a36f4b4b2d7 100644
--- a/libjava/classpath/gnu/CORBA/binaryReply.java
+++ b/libjava/classpath/gnu/CORBA/RawReply.java
@@ -1,4 +1,4 @@
-/* binaryReply.java --
+/* RawReply.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
+import gnu.CORBA.CDR.BufferredCdrInput;
import gnu.CORBA.GIOP.MessageHeader;
import org.omg.CORBA.ORB;
@@ -48,7 +48,7 @@ import org.omg.CORBA.ORB;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-class binaryReply
+class RawReply
{
/**
* The message header.
@@ -71,7 +71,7 @@ class binaryReply
* @param an_header the message header
* @param a_data the message data.
*/
- binaryReply(ORB an_orb, MessageHeader an_header, byte[] a_data)
+ RawReply(ORB an_orb, MessageHeader an_header, byte[] a_data)
{
orb = an_orb;
header = an_header;
@@ -83,9 +83,9 @@ class binaryReply
*
* @return the CDR stream to read the message data.
*/
- cdrBufInput getStream()
+ BufferredCdrInput getStream()
{
- cdrBufInput in = new cdrBufInput(data);
+ BufferredCdrInput in = new BufferredCdrInput(data);
in.setOffset(header.getHeaderSize());
in.setVersion(header.version);
in.setOrb(orb);
diff --git a/libjava/classpath/gnu/CORBA/bufferedResponseHandler.java b/libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java
index 0fe945ca1f0..4d509cc5253 100644
--- a/libjava/classpath/gnu/CORBA/bufferedResponseHandler.java
+++ b/libjava/classpath/gnu/CORBA/ResponseHandlerImpl.java
@@ -1,4 +1,4 @@
-/* bufferedResponseHandler.java --
+/* ResponseHandlerImpl.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,11 +38,11 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.GIOP.MessageHeader;
import gnu.CORBA.GIOP.ReplyHeader;
import gnu.CORBA.GIOP.RequestHeader;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import org.omg.CORBA.ORB;
import org.omg.CORBA.portable.OutputStream;
@@ -53,7 +53,7 @@ import org.omg.CORBA.portable.ResponseHandler;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class bufferedResponseHandler
+public class ResponseHandlerImpl
implements ResponseHandler
{
/**
@@ -86,7 +86,7 @@ public class bufferedResponseHandler
/**
* The buffer to write into.
*/
- private cdrBufOutput buffer;
+ private BufferedCdrOutput buffer;
/**
* Create a new buffered response handler that uses the given message headers.
@@ -96,7 +96,7 @@ public class bufferedResponseHandler
* @param m_header a message header.
* @param r_header a reply header.
*/
- bufferedResponseHandler(ORB an_orb, MessageHeader m_header,
+ ResponseHandlerImpl(ORB an_orb, MessageHeader m_header,
ReplyHeader r_header, RequestHeader rq_header)
{
message_header = m_header;
@@ -147,7 +147,7 @@ public class bufferedResponseHandler
*
* @return the CDR output stream, containing the written output.
*/
- public cdrBufOutput getBuffer()
+ public BufferedCdrOutput getBuffer()
{
return buffer;
}
@@ -166,10 +166,10 @@ public class bufferedResponseHandler
*/
private void prepareStream()
{
- buffer = new cdrBufOutput();
+ buffer = new BufferedCdrOutput();
buffer.setOrb(orb);
buffer.setVersion(message_header.version);
- buffer.setCodeSet(cxCodeSet.find(reply_header.service_context));
+ buffer.setCodeSet(CodeSetServiceContext.find(reply_header.service_context));
// Since 1.2, the data section is always aligned on the 8 byte boundary.
// In older versions, it is necessary to set the offset correctly.
diff --git a/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java b/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
index 7f40fc84d2d..a6f7aa52b8d 100644
--- a/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
+++ b/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import org.omg.CORBA.ARG_IN;
import org.omg.CORBA.ARG_INOUT;
@@ -67,7 +67,7 @@ public class ServiceRequestAdapter
/**
* A buffer for writing the response.
*/
- cdrBufOutput reply = new cdrBufOutput();
+ BufferedCdrOutput reply = new BufferedCdrOutput();
/**
* If set to true, an exception has been thrown during the invocation.
@@ -105,7 +105,7 @@ public class ServiceRequestAdapter
int OUT = ARG_OUT.value;
// Write all arguments to the buffer output stream.
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
gnuNVList args = new gnuNVList();
request.arguments(args);
@@ -127,7 +127,7 @@ public class ServiceRequestAdapter
{
// Write the exception information
gnuAny exc = new gnuAny();
- universalHolder uku = new universalHolder(h.reply);
+ GeneralHolder uku = new GeneralHolder(h.reply);
exc.insert_Streamable(uku);
request.set_exception(exc);
}
@@ -146,7 +146,7 @@ public class ServiceRequestAdapter
{
// Use the universal holder otherwise.
gnuAny r = new gnuAny();
- r.insert_Streamable(new streamReadyHolder(in));
+ r.insert_Streamable(new StreamHolder(in));
}
// Unpack the arguments
diff --git a/libjava/classpath/gnu/CORBA/Simple_delegate.java b/libjava/classpath/gnu/CORBA/SimpleDelegate.java
index 5eabc7da8a0..c6e20e17374 100644
--- a/libjava/classpath/gnu/CORBA/Simple_delegate.java
+++ b/libjava/classpath/gnu/CORBA/SimpleDelegate.java
@@ -57,8 +57,9 @@ import org.omg.CORBA.portable.ObjectImpl;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class Simple_delegate
+public class SimpleDelegate
extends Delegate
+ implements IorProvider
{
/**
* The orb.
@@ -70,7 +71,7 @@ public class Simple_delegate
*/
protected IOR ior;
- public Simple_delegate(ORB an_orb, IOR an_ior)
+ public SimpleDelegate(ORB an_orb, IOR an_ior)
{
orb = an_orb;
ior = an_ior;
@@ -195,13 +196,11 @@ public class Simple_delegate
}
/**
- * Returns true if the objects are the same of have
- * the same delegate set. All objects in this implementation
- * have a separate delegate.
+ * Returns true if the objects are the same or have the same delegate set. All
+ * objects in this implementation have a separate delegate.
*/
public boolean is_equivalent(org.omg.CORBA.Object target,
- org.omg.CORBA.Object other
- )
+ org.omg.CORBA.Object other)
{
if (target == other)
return true;
@@ -209,14 +208,26 @@ public class Simple_delegate
{
try
{
- org.omg.CORBA.portable.Delegate a =
- ((ObjectImpl) target)._get_delegate();
- org.omg.CORBA.portable.Delegate b =
- ((ObjectImpl) other)._get_delegate();
+ org.omg.CORBA.portable.Delegate a = ((ObjectImpl) target)._get_delegate();
+ org.omg.CORBA.portable.Delegate b = ((ObjectImpl) other)._get_delegate();
if (a == b)
{
return true;
}
+ else
+ {
+ // We compere the IOR's in this case.
+ if (a instanceof IorProvider && b instanceof IorProvider)
+ {
+ IOR ia = ((IorProvider) a).getIor();
+ IOR ib = ((IorProvider) b).getIor();
+
+ if (ia != null && ib != null)
+ return (ia.equals(ib));
+ else
+ return ia == ib;
+ }
+ }
if (a != null && b != null)
{
return a.equals(b);
@@ -265,12 +276,19 @@ public class Simple_delegate
}
/**
- * This should never be called this type delegate.
- *
- * @throws InternalError, always.
+ * This method assumes that the target is local and connected to the ORB.
*/
public Request request(org.omg.CORBA.Object target, String operation)
{
- throw new InternalError();
+ if (orb instanceof OrbFunctional)
+ {
+ ((OrbFunctional) orb).ensureRunning();
+ }
+ gnuRequest g = new gnuRequest();
+ g.setORB(orb);
+ g.setOperation(operation);
+ g.setIor(ior);
+ g.m_target = target;
+ return g;
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/SocketRepository.java b/libjava/classpath/gnu/CORBA/SocketRepository.java
index a6b99200a48..e48a9a5da17 100644
--- a/libjava/classpath/gnu/CORBA/SocketRepository.java
+++ b/libjava/classpath/gnu/CORBA/SocketRepository.java
@@ -40,8 +40,9 @@ package gnu.CORBA;
import java.net.Socket;
import java.net.SocketException;
-
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
/**
* This class caches the opened sockets that are reused during the
@@ -56,9 +57,10 @@ public class SocketRepository
* The socket map.
*/
private static HashMap sockets = new HashMap();
-
+
/**
- * Put a socket.
+ * Put a socket. This method also discards all not reusable sockets from
+ * the map.
*
* @param key as socket key.
*
@@ -66,7 +68,41 @@ public class SocketRepository
*/
public static void put_socket(Object key, Socket s)
{
- sockets.put(key, s);
+ synchronized (sockets)
+ {
+ sockets.put(key, s);
+ gc();
+ }
+ }
+
+ /**
+ * Removes all non reusable sockets. As it is private,
+ * we know we call from the synchronized code already.
+ */
+ private static void gc()
+ {
+ Iterator iter = sockets.entrySet().iterator();
+
+ Map.Entry e;
+ Socket sx;
+
+ while (iter.hasNext())
+ {
+ e = (Map.Entry) iter.next();
+ sx = (Socket) e.getValue();
+
+ if (not_reusable(sx))
+ iter.remove();
+ }
+ }
+
+ /**
+ * Return true if the socket is no longer reusable.
+ */
+ static boolean not_reusable(Socket s)
+ {
+ return (s.isClosed() || !s.isBound() || !s.isConnected() ||
+ s.isInputShutdown() || s.isOutputShutdown());
}
/**
@@ -75,31 +111,41 @@ public class SocketRepository
* @param key a socket key.
*
* @return an opened socket for reuse, null if no such available or it is
- * closed.
+ * closed, its input or output has been shutown or otherwise the socket is not
+ * reuseable.
*/
public static Socket get_socket(Object key)
{
- Socket s = (Socket) sockets.get(key);
- if (s == null)
+ if (true)
return null;
- else if (s.isClosed())
- {
- sockets.remove(key);
- return null;
- }
- else
+
+ synchronized (sockets)
{
- sockets.remove(key);
- try
+ Socket s = (Socket) sockets.get(key);
+ if (s == null)
+ return null;
+
+ // Ensure that the socket is fully reusable.
+ else if (not_reusable(s))
{
- // Set one minute time out that will be changed later.
- s.setSoTimeout(60*1000);
+ sockets.remove(key);
+ return null;
}
- catch (SocketException e)
+ else
{
- s = null;
+ try
+ {
+ // Set one minute time out that will be changed later.
+ s.setSoTimeout(60 * 1000);
+ }
+ catch (SocketException e)
+ {
+ s = null;
+ }
+
+ sockets.remove(key);
+ return s;
}
- return s;
}
}
} \ No newline at end of file
diff --git a/libjava/classpath/gnu/CORBA/streamRequest.java b/libjava/classpath/gnu/CORBA/StreamBasedRequest.java
index a0f7eb09928..66796d653c9 100644
--- a/libjava/classpath/gnu/CORBA/streamRequest.java
+++ b/libjava/classpath/gnu/CORBA/StreamBasedRequest.java
@@ -38,15 +38,15 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
/**
* A stream, additionally holding the gnu request.
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class streamRequest
- extends cdrBufOutput
+public class StreamBasedRequest
+ extends BufferedCdrOutput
{
/**
* The enclosed request.
diff --git a/libjava/classpath/gnu/CORBA/streamReadyHolder.java b/libjava/classpath/gnu/CORBA/StreamHolder.java
index a777bd55597..de2fda0ba89 100644
--- a/libjava/classpath/gnu/CORBA/streamReadyHolder.java
+++ b/libjava/classpath/gnu/CORBA/StreamHolder.java
@@ -1,4 +1,4 @@
-/* streamReadyHolder.java --
+/* StreamHolder.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import java.io.IOException;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class streamReadyHolder
+public class StreamHolder
implements Streamable
{
/**
@@ -65,7 +65,7 @@ public class streamReadyHolder
*
* @param a_stream a stream.
*/
- public streamReadyHolder(InputStream a_stream)
+ public StreamHolder(InputStream a_stream)
{
stream = a_stream;
}
@@ -98,7 +98,10 @@ public class streamReadyHolder
}
catch (IOException ex)
{
- throw new MARSHAL(ex + ":" + ex.getMessage());
+ MARSHAL m = new MARSHAL();
+ m.initCause(ex);
+ m.minor = Minor.CDR;
+ throw m;
}
}
diff --git a/libjava/classpath/gnu/CORBA/stubFinder.java b/libjava/classpath/gnu/CORBA/StubLocator.java
index 77efd004717..d9e5ee4712c 100644
--- a/libjava/classpath/gnu/CORBA/stubFinder.java
+++ b/libjava/classpath/gnu/CORBA/StubLocator.java
@@ -1,4 +1,4 @@
-/* stubFinder.java --
+/* StubLocator.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ import org.omg.CORBA.portable.ObjectImpl;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class stubFinder
+public class StubLocator
{
/**
* Search for the possibly available default stub.
@@ -83,7 +83,7 @@ public class stubFinder
String stub = "_" + s.substring(b + 1) + "Stub";
- Class stubClass = Class.forName(path + stub);
+ Class stubClass = ObjectCreator.forName(path + stub);
return (ObjectImpl) stubClass.newInstance();
}
@@ -105,6 +105,6 @@ public class stubFinder
*/
protected static ObjectImpl createDefaultStub(ORB orb, IOR ior)
{
- return new IOR_contructed_object(orb, ior);
+ return new IorObject(orb, ior);
}
}
diff --git a/libjava/classpath/gnu/CORBA/TypeCodeHelper.java b/libjava/classpath/gnu/CORBA/TypeCodeHelper.java
index c742275420e..4ffb0b74446 100644
--- a/libjava/classpath/gnu/CORBA/TypeCodeHelper.java
+++ b/libjava/classpath/gnu/CORBA/TypeCodeHelper.java
@@ -38,6 +38,13 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.typecodes.FixedTypeCode;
+import gnu.CORBA.typecodes.GeneralTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
@@ -62,10 +69,10 @@ public class TypeCodeHelper
{
TCKind kind = TCKind.from_int(in.read_long());
TypeCode rt;
- generalTypeCode g;
- recordTypeCode r;
- recordTypeCode.Field f;
- stringTypeCode s;
+ GeneralTypeCode g;
+ RecordTypeCode r;
+ RecordTypeCode.Field f;
+ StringTypeCode s;
int n;
switch (kind.value())
@@ -73,21 +80,21 @@ public class TypeCodeHelper
case TCKind._tk_sequence :
case TCKind._tk_array :
- primitiveArrayTypeCode p = new primitiveArrayTypeCode(kind);
+ ArrayTypeCode p = new ArrayTypeCode(kind);
p.setLength(in.read_long());
rt = p;
break;
case TCKind._tk_string :
case TCKind._tk_wstring :
- s = new stringTypeCode(kind);
+ s = new StringTypeCode(kind);
s.setLength(in.read_long());
rt = s;
break;
case TCKind._tk_fixed :
- fixedTypeCode fx = new fixedTypeCode();
+ FixedTypeCode fx = new FixedTypeCode();
fx.setDigits(in.read_short());
fx.setScale(in.read_short());
rt = fx;
@@ -96,7 +103,7 @@ public class TypeCodeHelper
case TCKind._tk_objref :
case TCKind._tk_native :
case TCKind._tk_abstract_interface :
- g = new generalTypeCode(kind);
+ g = new GeneralTypeCode(kind);
g.setId(in.read_string());
g.setName(in.read_string());
rt = g;
@@ -104,7 +111,7 @@ public class TypeCodeHelper
case TCKind._tk_alias :
case TCKind._tk_value_box :
- g = new generalTypeCode(kind);
+ g = new GeneralTypeCode(kind);
g.setId(in.read_string());
g.setName(in.read_string());
g.setContentType(in.read_TypeCode());
@@ -113,7 +120,7 @@ public class TypeCodeHelper
case TCKind._tk_struct :
case TCKind._tk_except :
- r = new recordTypeCode(kind);
+ r = new RecordTypeCode(kind);
r.setId(in.read_string());
r.setName(in.read_string());
@@ -129,7 +136,7 @@ public class TypeCodeHelper
break;
case TCKind._tk_enum :
- r = new recordTypeCode(kind);
+ r = new RecordTypeCode(kind);
r.setId(in.read_string());
r.setName(in.read_string());
@@ -144,7 +151,7 @@ public class TypeCodeHelper
break;
case TCKind._tk_union :
- r = new recordTypeCode(kind);
+ r = new RecordTypeCode(kind);
r.setId(in.read_string());
r.setName(in.read_string());
r.setDiscriminator_type(in.read_TypeCode());
@@ -164,7 +171,7 @@ public class TypeCodeHelper
break;
case TCKind._tk_value :
- r = new recordTypeCode(kind);
+ r = new RecordTypeCode(kind);
r.setId(in.read_string());
r.setName(in.read_string());
r.setTypeModifier(in.read_short());
@@ -183,7 +190,7 @@ public class TypeCodeHelper
break;
default :
- rt = new primitiveTypeCode(kind);
+ rt = new PrimitiveTypeCode(kind);
}
return rt;
}
diff --git a/libjava/classpath/gnu/CORBA/typeNamer.java b/libjava/classpath/gnu/CORBA/TypeKindNamer.java
index f790dc95970..3296db3600a 100644
--- a/libjava/classpath/gnu/CORBA/typeNamer.java
+++ b/libjava/classpath/gnu/CORBA/TypeKindNamer.java
@@ -38,6 +38,9 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
@@ -48,7 +51,7 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class typeNamer
+public class TypeKindNamer
{
/**
* Names of the primitve types.
@@ -69,46 +72,46 @@ public class typeNamer
protected static final TypeCode[] primitveCodes =
new TypeCode[]
{
- new primitiveTypeCode(TCKind.tk_null),
- new primitiveTypeCode(TCKind.tk_void),
- new primitiveTypeCode(TCKind.tk_short),
- new primitiveTypeCode(TCKind.tk_long),
- new primitiveTypeCode(TCKind.tk_ushort),
- new primitiveTypeCode(TCKind.tk_ulong),
- new primitiveTypeCode(TCKind.tk_float),
- new primitiveTypeCode(TCKind.tk_double),
- new primitiveTypeCode(TCKind.tk_boolean),
- new primitiveTypeCode(TCKind.tk_char),
- new primitiveTypeCode(TCKind.tk_octet),
- new primitiveTypeCode(TCKind.tk_any),
- new primitiveTypeCode(TCKind.tk_TypeCode),
- new primitiveTypeCode(TCKind.tk_Principal),
- new recordTypeCode(TCKind.tk_objref),
- new primitiveTypeCode(TCKind.tk_struct),
- new primitiveTypeCode(TCKind.tk_union),
- new primitiveTypeCode(TCKind.tk_enum),
- new primitiveTypeCode(TCKind.tk_string),
- new primitiveTypeCode(TCKind.tk_sequence),
- new primitiveTypeCode(TCKind.tk_array),
- new primitiveTypeCode(TCKind.tk_alias),
- new primitiveTypeCode(TCKind.tk_except),
- new primitiveTypeCode(TCKind.tk_longlong),
- new primitiveTypeCode(TCKind.tk_ulonglong),
- new primitiveTypeCode(TCKind.tk_longdouble),
- new primitiveTypeCode(TCKind.tk_wchar),
- new primitiveTypeCode(TCKind.tk_wstring),
- new primitiveTypeCode(TCKind.tk_fixed),
- new primitiveTypeCode(TCKind.tk_value),
- new primitiveTypeCode(TCKind.tk_value_box),
- new primitiveTypeCode(TCKind.tk_native),
- new primitiveTypeCode(TCKind.tk_abstract_interface)
+ new PrimitiveTypeCode(TCKind.tk_null),
+ new PrimitiveTypeCode(TCKind.tk_void),
+ new PrimitiveTypeCode(TCKind.tk_short),
+ new PrimitiveTypeCode(TCKind.tk_long),
+ new PrimitiveTypeCode(TCKind.tk_ushort),
+ new PrimitiveTypeCode(TCKind.tk_ulong),
+ new PrimitiveTypeCode(TCKind.tk_float),
+ new PrimitiveTypeCode(TCKind.tk_double),
+ new PrimitiveTypeCode(TCKind.tk_boolean),
+ new PrimitiveTypeCode(TCKind.tk_char),
+ new PrimitiveTypeCode(TCKind.tk_octet),
+ new PrimitiveTypeCode(TCKind.tk_any),
+ new PrimitiveTypeCode(TCKind.tk_TypeCode),
+ new PrimitiveTypeCode(TCKind.tk_Principal),
+ new RecordTypeCode(TCKind.tk_objref),
+ new PrimitiveTypeCode(TCKind.tk_struct),
+ new PrimitiveTypeCode(TCKind.tk_union),
+ new PrimitiveTypeCode(TCKind.tk_enum),
+ new PrimitiveTypeCode(TCKind.tk_string),
+ new PrimitiveTypeCode(TCKind.tk_sequence),
+ new PrimitiveTypeCode(TCKind.tk_array),
+ new PrimitiveTypeCode(TCKind.tk_alias),
+ new PrimitiveTypeCode(TCKind.tk_except),
+ new PrimitiveTypeCode(TCKind.tk_longlong),
+ new PrimitiveTypeCode(TCKind.tk_ulonglong),
+ new PrimitiveTypeCode(TCKind.tk_longdouble),
+ new PrimitiveTypeCode(TCKind.tk_wchar),
+ new PrimitiveTypeCode(TCKind.tk_wstring),
+ new PrimitiveTypeCode(TCKind.tk_fixed),
+ new PrimitiveTypeCode(TCKind.tk_value),
+ new PrimitiveTypeCode(TCKind.tk_value_box),
+ new PrimitiveTypeCode(TCKind.tk_native),
+ new PrimitiveTypeCode(TCKind.tk_abstract_interface)
};
static
{
// The Id of the "abstract object" is defined as empty string.
- recordTypeCode object =
- (recordTypeCode) primitveCodes [ TCKind._tk_objref ];
+ RecordTypeCode object =
+ (RecordTypeCode) primitveCodes [ TCKind._tk_objref ];
object.setId("");
object.setName("Object");
}
diff --git a/libjava/classpath/gnu/CORBA/Version.java b/libjava/classpath/gnu/CORBA/Version.java
index 84f40bf4f39..efc27c22081 100644
--- a/libjava/classpath/gnu/CORBA/Version.java
+++ b/libjava/classpath/gnu/CORBA/Version.java
@@ -70,8 +70,8 @@ public class Version
/**
* Create the version with the given version numbers.
*
- * @param major major number (0..255)
- * @param minor minor number (0..255)
+ * @param _major major number (0..255)
+ * @param _minor minor number (0..255)
*/
public Version(int _major, int _minor)
{
@@ -99,6 +99,15 @@ public class Version
Version that = (Version) other;
return same(that);
}
+
+ /**
+ * Get the hashcode, higher 8 bits being the major version and lower 8 bits
+ * the minor version.
+ */
+ public int hashCode()
+ {
+ return major << 8 | minor;
+ }
/**
* Read from the input stream, major number first.
@@ -114,7 +123,10 @@ public class Version
}
catch (IOException ex)
{
- throw new MARSHAL("IOException while reading message header");
+ MARSHAL m = new MARSHAL("IOException while reading message header");
+ m.initCause(ex);
+ m.minor = Minor.Header;
+ throw m;
}
}
@@ -166,7 +178,7 @@ public class Version
* Returs true if the given version is lower or equal to the
* version, specified by the provided minor and major version
* number. This means, the version, specified by these two numbers,
- * should be supported by teh current version.
+ * should be supported by the current version.
*
* @param a_major a major version number.
* @param a_minor a minor version number.
@@ -200,7 +212,11 @@ public class Version
}
catch (IOException ex)
{
- throw new MARSHAL("IOException while writing message header");
+ MARSHAL m = new MARSHAL("IOException while writing message header");
+ m.minor = Minor.Header;
+ m.initCause(ex);
+ throw m;
}
}
+
}
diff --git a/libjava/classpath/gnu/CORBA/WCharHolder.java b/libjava/classpath/gnu/CORBA/WCharHolder.java
index 23f0ad100f9..3c6a87fbe2d 100644
--- a/libjava/classpath/gnu/CORBA/WCharHolder.java
+++ b/libjava/classpath/gnu/CORBA/WCharHolder.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
@@ -61,7 +63,7 @@ public final class WCharHolder
/**
* The default type code for this holder.
*/
- private static final TypeCode t_char = new primitiveTypeCode(TCKind.tk_wchar);
+ private static final TypeCode t_char = new PrimitiveTypeCode(TCKind.tk_wchar);
/**
* The <code>char</code> (CORBA <code>wchar</code>) value,
diff --git a/libjava/classpath/gnu/CORBA/WStringHolder.java b/libjava/classpath/gnu/CORBA/WStringHolder.java
index c9e8e33234d..7f18791dfee 100644
--- a/libjava/classpath/gnu/CORBA/WStringHolder.java
+++ b/libjava/classpath/gnu/CORBA/WStringHolder.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.CORBA;
+import gnu.CORBA.typecodes.StringTypeCode;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
@@ -62,8 +64,8 @@ public class WStringHolder
/**
* The default type code for this holder.
*/
- private static final stringTypeCode t_string =
- new stringTypeCode(TCKind.tk_wstring);
+ private static final StringTypeCode t_string =
+ new StringTypeCode(TCKind.tk_wstring);
/**
* The <code>String</code> (CORBA <code>string</code>) value,
diff --git a/libjava/classpath/gnu/CORBA/_PolicyImplBase.java b/libjava/classpath/gnu/CORBA/_PolicyImplBase.java
index d9ff9d648ad..17a5f4a40e5 100644
--- a/libjava/classpath/gnu/CORBA/_PolicyImplBase.java
+++ b/libjava/classpath/gnu/CORBA/_PolicyImplBase.java
@@ -165,7 +165,8 @@ public abstract class _PolicyImplBase
output.write_long(policyCode);
}
else
- throw new BAD_OPERATION(method, 0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(method, Minor.Method,
+ CompletionStatus.COMPLETED_MAYBE);
return output;
}
diff --git a/libjava/classpath/gnu/CORBA/gnuAny.java b/libjava/classpath/gnu/CORBA/gnuAny.java
index 7e5ef335149..729386da2c4 100644
--- a/libjava/classpath/gnu/CORBA/gnuAny.java
+++ b/libjava/classpath/gnu/CORBA/gnuAny.java
@@ -39,8 +39,10 @@ exception statement from your version. */
package gnu.CORBA;
import gnu.CORBA.CDR.Vio;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
import org.omg.CORBA.Any;
import org.omg.CORBA.AnyHolder;
@@ -62,19 +64,14 @@ import org.omg.CORBA.StringHolder;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodeHolder;
-import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.ValueBaseHolder;
-import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.Streamable;
-import java.io.IOException;
import java.io.Serializable;
-
import java.lang.reflect.Field;
-
import java.math.BigDecimal;
-
import java.util.Arrays;
+import java.util.zip.Adler32;
/**
* The implementation of {@link Any}.
@@ -93,12 +90,17 @@ import java.util.Arrays;
public class gnuAny
extends Any
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The value, returned by {@link #type()} if the value has been
* not intialized.
*/
protected static final TypeCode nullType =
- new primitiveTypeCode(TCKind.tk_null);
+ new PrimitiveTypeCode(TCKind.tk_null);
/**
* The Streamable, representing the value, held by this gnuAny.
@@ -137,11 +139,11 @@ public class gnuAny
*/
public gnuAny Clone()
{
- cdrBufOutput out = new cdrBufOutput();
+ BufferedCdrOutput out = new BufferedCdrOutput();
out.setOrb(orb);
out.write_any(this);
- cdrBufInput in = new cdrBufInput(out.buffer.toByteArray());
+ BufferredCdrInput in = new BufferredCdrInput(out.buffer.toByteArray());
in.setOrb(orb);
return (gnuAny) in.read_any();
}
@@ -152,18 +154,18 @@ public class gnuAny
*/
public org.omg.CORBA.portable.InputStream create_input_stream()
{
- if (has instanceof universalHolder)
+ if (has instanceof GeneralHolder)
{
- universalHolder u = (universalHolder) has;
+ GeneralHolder u = (GeneralHolder) has;
return u.getInputStream();
}
else
{
- cdrBufOutput out = new cdrBufOutput();
+ BufferedCdrOutput out = new BufferedCdrOutput();
out.setOrb(orb);
write_value(out);
- cdrBufInput in = new cdrBufInput(out.buffer.toByteArray());
+ BufferredCdrInput in = new BufferredCdrInput(out.buffer.toByteArray());
in.setOrb(orb);
return in;
}
@@ -174,7 +176,7 @@ public class gnuAny
*/
public org.omg.CORBA.portable.OutputStream create_output_stream()
{
- cdrBufOutput stream = new cdrBufOutput();
+ BufferedCdrOutput stream = new BufferedCdrOutput();
stream.setOrb(orb);
return stream;
}
@@ -194,11 +196,11 @@ public class gnuAny
if (has.equals(((gnuAny) other).has))
return true;
- cdrBufOutput a = new cdrBufOutput();
+ BufferedCdrOutput a = new BufferedCdrOutput();
a.setOrb(orb);
write_value(a);
- cdrBufOutput b = new cdrBufOutput();
+ BufferedCdrOutput b = new BufferedCdrOutput();
b.setOrb(orb);
other.write_value(b);
@@ -207,6 +209,28 @@ public class gnuAny
return Arrays.equals(ba, bb);
}
+
+ /**
+ * Get the content - dependent hashcode.
+ */
+ public int hashCode()
+ {
+ if (has == null)
+ return type().kind().value();
+ else
+ {
+ Adler32 adler = new Adler32();
+
+ BufferedCdrOutput a = new BufferedCdrOutput();
+ a.setOrb(orb);
+ write_value(a);
+
+ adler.update(a.buffer.toByteArray());
+ adler.update(type().kind().value());
+
+ return (int) adler.getValue() & Integer.MAX_VALUE;
+ }
+ }
/**
* Delegates functionality to {@link #equal(Any)}.
@@ -232,7 +256,10 @@ public class gnuAny
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
@@ -297,7 +324,10 @@ public class gnuAny
}
catch (Exception ex)
{
- return new BAD_OPERATION("Value type expected");
+ BAD_OPERATION bad = new BAD_OPERATION("Value type expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
}
}
@@ -664,7 +694,7 @@ public class gnuAny
else
has = new StringHolder(x);
- typecode = new stringTypeCode(TCKind.tk_string);
+ typecode = new StringTypeCode(TCKind.tk_string);
}
/** {@inheritDoc} */
@@ -751,40 +781,27 @@ public class gnuAny
}
else
{
- has = holderFactory.createHolder(a_type);
+ has = HolderLocator.createHolder(a_type);
if (has == null)
{
// Use the Universal Holder that reads till the end of stream.
// This works with the extract/insert pair of the typical
// Helper.
- cdrBufOutput buffer = new cdrBufOutput();
+ BufferedCdrOutput buffer = new BufferedCdrOutput();
buffer.setOrb(orb);
- has = new universalHolder(buffer);
+ has = new GeneralHolder(buffer);
}
}
type(a_type);
- if (!(has instanceof universalHolder) &&
+ if (!(has instanceof GeneralHolder) &&
(kind == TCKind._tk_value_box))
{
// The streamable only contains operations for
// reading the value, not the value header.
Field vField = has.getClass().getField("value");
- BoxedValueHelper helper;
-
- try
- {
- Class helperClass =
- Class.forName(ObjectCreator.toHelperName(a_type.id()));
- helper = (BoxedValueHelper) helperClass.newInstance();
- }
- catch (Exception ex)
- {
- helper = null;
- }
-
- Object content = Vio.read(input, helper);
+ Object content = Vio.read(input, a_type.id());
vField.set(has, content);
}
else
@@ -793,6 +810,7 @@ public class gnuAny
catch (Exception ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Any;
m.initCause(ex);
throw m;
}
@@ -805,7 +823,7 @@ public class gnuAny
return typecode;
else if (xKind >= 0)
{
- typecode = new primitiveTypeCode(TCKind.from_int(xKind));
+ typecode = new PrimitiveTypeCode(TCKind.from_int(xKind));
return typecode;
}
else
@@ -838,38 +856,43 @@ public class gnuAny
/**
* Check if the current value if the value of the given kind.
+ *
* @param kind a kind to check.
* @throws BAD_OPERATION if the value is not set of is different kind.
*/
protected void check(int kind)
- throws BAD_OPERATION
+ throws BAD_OPERATION
{
if (has == null)
- throw new BAD_OPERATION("value not set");
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("value not set");
+ bad.minor = Minor.Any;
+ throw bad;
+ }
if (xKind >= 0)
{
if (xKind != kind)
- if (!(
- xKind == TCKind._tk_alias &&
- has._type().kind().value() == kind
- )
- )
- throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
- " when stored " + typeNamer.nameIt(xKind)
- );
+ if (!(xKind == TCKind._tk_alias && has._type().kind().value() == kind))
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("Extracting "
+ + TypeKindNamer.nameIt(kind) + " when stored "
+ + TypeKindNamer.nameIt(xKind));
+ bad.minor = Minor.Any;
+ throw bad;
+ }
}
else
{
if (type().kind().value() != kind)
- if (!(
- type().kind().value() == TCKind._tk_alias &&
- has._type().kind().value() == kind
- )
- )
- throw new BAD_OPERATION("Extracting " + typeNamer.nameIt(kind) +
- " stored " + typeNamer.nameIt(type())
- );
+ if (!(type().kind().value() == TCKind._tk_alias && has._type().kind().value() == kind))
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("Extracting "
+ + TypeKindNamer.nameIt(kind) + " stored "
+ + TypeKindNamer.nameIt(type()));
+ bad.minor = Minor.Any;
+ throw bad;
+ }
}
}
diff --git a/libjava/classpath/gnu/CORBA/gnuCodecFactory.java b/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
index 067de498c79..8cf9ccf7bc4 100644
--- a/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
+++ b/libjava/classpath/gnu/CORBA/gnuCodecFactory.java
@@ -83,7 +83,7 @@ public class gnuCodecFactory extends LocalObject implements CodecFactory
"supported by this factory."
);
- return new cdrEncapsCodec(orb,
+ return new CdrEncapsCodecImpl(orb,
new Version(for_encoding.major_version, for_encoding.minor_version)
);
}
diff --git a/libjava/classpath/gnu/CORBA/gnuContextList.java b/libjava/classpath/gnu/CORBA/gnuContextList.java
index 2a26437debe..68584c3891c 100644
--- a/libjava/classpath/gnu/CORBA/gnuContextList.java
+++ b/libjava/classpath/gnu/CORBA/gnuContextList.java
@@ -53,7 +53,7 @@ public class gnuContextList
/**
* The collection, holding the actual list of strings.
*/
- corbaArrayList strings = new corbaArrayList();
+ CorbaList strings = new CorbaList();
/** {@inheritDoc} */
public void add(String name)
diff --git a/libjava/classpath/gnu/CORBA/gnuExceptionList.java b/libjava/classpath/gnu/CORBA/gnuExceptionList.java
index b684ec928cf..5f0c0c9f50d 100644
--- a/libjava/classpath/gnu/CORBA/gnuExceptionList.java
+++ b/libjava/classpath/gnu/CORBA/gnuExceptionList.java
@@ -54,7 +54,7 @@ public class gnuExceptionList
/**
* A list to store the objects.
*/
- protected corbaArrayList list = new corbaArrayList();
+ protected CorbaList list = new CorbaList();
/** {@inheritDoc} */
public void add(TypeCode an_exception)
diff --git a/libjava/classpath/gnu/CORBA/gnuNVList.java b/libjava/classpath/gnu/CORBA/gnuNVList.java
index e436c332caa..3645a3e8dd2 100644
--- a/libjava/classpath/gnu/CORBA/gnuNVList.java
+++ b/libjava/classpath/gnu/CORBA/gnuNVList.java
@@ -53,14 +53,14 @@ public class gnuNVList
/**
* The list of the named values.
*/
- protected corbaArrayList list;
+ protected CorbaList list;
/**
* Creates the list with the default initial size.
*/
public gnuNVList()
{
- list = new corbaArrayList();
+ list = new CorbaList();
}
/**
@@ -68,7 +68,7 @@ public class gnuNVList
*/
public gnuNVList(int initial_size)
{
- list = new corbaArrayList(initial_size);
+ list = new CorbaList(initial_size);
}
/** {@inheritDoc} */
diff --git a/libjava/classpath/gnu/CORBA/gnuRequest.java b/libjava/classpath/gnu/CORBA/gnuRequest.java
index 7d756eddba3..5adf7412926 100644
--- a/libjava/classpath/gnu/CORBA/gnuRequest.java
+++ b/libjava/classpath/gnu/CORBA/gnuRequest.java
@@ -38,12 +38,12 @@ exception statement from your version. */
package gnu.CORBA;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import gnu.CORBA.GIOP.MessageHeader;
import gnu.CORBA.GIOP.ReplyHeader;
import gnu.CORBA.GIOP.RequestHeader;
-import gnu.CORBA.GIOP.cxCodeSet;
+import gnu.CORBA.GIOP.CodeSetServiceContext;
import gnu.CORBA.Interceptor.gnuClientRequestInfo;
import gnu.CORBA.Poa.ORB_1_4;
@@ -54,6 +54,7 @@ import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.Bounds;
+import org.omg.CORBA.COMM_FAILURE;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.Context;
import org.omg.CORBA.ContextList;
@@ -134,8 +135,8 @@ public class gnuRequest extends Request implements Cloneable
/**
* The empty byte array.
*/
- private static final binaryReply EMPTY =
- new binaryReply(null, new MessageHeader(), new byte[ 0 ]);
+ private static final RawReply EMPTY =
+ new RawReply(null, new MessageHeader(), new byte[ 0 ]);
/**
* The context holder for methods ctx(Context) and ctx().
@@ -222,7 +223,7 @@ public class gnuRequest extends Request implements Cloneable
* The request arguments in the case when they are directly written into the
* parameter buffer.
*/
- protected streamRequest m_parameter_buffer;
+ protected StreamBasedRequest m_parameter_buffer;
/**
* The array of slots.
@@ -294,8 +295,8 @@ public class gnuRequest extends Request implements Cloneable
orb = an_orb;
// Take the interceptor from the ORB.
- if (orb instanceof Restricted_ORB)
- m_interceptor = ((Restricted_ORB) orb).iClient;
+ if (orb instanceof OrbRestricted)
+ m_interceptor = ((OrbRestricted) orb).iClient;
if (m_interceptor != null && orb instanceof ORB_1_4)
{
@@ -332,12 +333,12 @@ public class gnuRequest extends Request implements Cloneable
* Get the parameter stream, where the invocation arguments should be written
* if they are written into the stream directly.
*/
- public streamRequest getParameterStream()
+ public StreamBasedRequest getParameterStream()
{
- m_parameter_buffer = new streamRequest();
+ m_parameter_buffer = new StreamBasedRequest();
m_parameter_buffer.request = this;
m_parameter_buffer.setVersion(ior.Internet.version);
- m_parameter_buffer.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets));
+ m_parameter_buffer.setCodeSet(CodeSetServiceContext.negotiate(ior.Internet.CodeSets));
m_parameter_buffer.setOrb(orb);
m_parameter_buffer.setBigEndian(Big_endian);
@@ -345,7 +346,7 @@ public class gnuRequest extends Request implements Cloneable
// correctly.
if (ior.Internet.version.until_inclusive(1, 1))
{
- cdrBufOutput measure = new cdrBufOutput();
+ BufferedCdrOutput measure = new BufferedCdrOutput();
measure.setOffset(12);
if (m_rqh == null)
m_rqh = new gnu.CORBA.GIOP.v1_0.RequestHeader();
@@ -513,8 +514,8 @@ public class gnuRequest extends Request implements Cloneable
try
{
ObjectImpl impl = (ObjectImpl) e.forward;
- Simple_delegate delegate =
- (Simple_delegate) impl._get_delegate();
+ SimpleDelegate delegate =
+ (SimpleDelegate) impl._get_delegate();
ior = delegate.getIor();
}
catch (Exception ex)
@@ -714,14 +715,15 @@ public class gnuRequest extends Request implements Cloneable
/**
* Do the actual invocation. This implementation requires to set the IOR
* property ({@link #setIOR(IOR)} before calling this method.
- *
+ *
* @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously set
* or if the direct argument addition is mixed with the direct argument
* writing into the output stream.
- *
+ *
* @return the server response in binary form.
*/
- public synchronized binaryReply submit() throws ForwardRequest
+ public synchronized RawReply submit()
+ throws ForwardRequest
{
gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader();
@@ -742,26 +744,25 @@ public class gnuRequest extends Request implements Cloneable
m_interceptor.send_request(m_info);
// Prepare the submission.
- cdrBufOutput request_part = new cdrBufOutput();
+ BufferedCdrOutput request_part = new BufferedCdrOutput();
request_part.setOffset(header.getHeaderSize());
request_part.setVersion(header.version);
- request_part.setCodeSet(cxCodeSet.negotiate(ior.Internet.CodeSets));
+ request_part.setCodeSet(CodeSetServiceContext.negotiate(ior.Internet.CodeSets));
request_part.setOrb(orb);
request_part.setBigEndian(header.isBigEndian());
// This also sets the stream encoding to the encoding, specified
// in the header.
rh.write(request_part);
-
+
if (m_args != null && m_args.count() > 0)
{
write_parameters(header, request_part);
if (m_parameter_buffer != null)
- throw new BAD_INV_ORDER("Please either add parameters or " +
- "write them into stream, but not both " + "at once."
- );
+ throw new BAD_INV_ORDER("Please either add parameters or "
+ + "write them into stream, but not both " + "at once.");
}
if (m_parameter_buffer != null)
@@ -789,12 +790,15 @@ public class gnuRequest extends Request implements Cloneable
{
// The BindException may be thrown under very heavy parallel
// load. For some time, just wait, exceptiong the socket to free.
- Open:
- for (int i = 0; i < PAUSE_STEPS; i++)
+ Open: for (int i = 0; i < PAUSE_STEPS; i++)
{
try
{
- socket = new Socket(ior.Internet.host, ior.Internet.port);
+ if (orb instanceof OrbFunctional)
+ socket = ((OrbFunctional) orb).socketFactory.createClientSocket(
+ ior.Internet.host, ior.Internet.port);
+ else
+ socket = new Socket(ior.Internet.host, ior.Internet.port);
break Open;
}
catch (BindException ex)
@@ -816,9 +820,8 @@ public class gnuRequest extends Request implements Cloneable
}
if (socket == null)
- throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port +
- " in use"
- );
+ throw new NO_RESOURCES(ior.Internet.host + ":" + ior.Internet.port
+ + " in use");
socket.setKeepAlive(true);
OutputStream socketOutput = socket.getOutputStream();
@@ -836,25 +839,26 @@ public class gnuRequest extends Request implements Cloneable
InputStream socketInput = socket.getInputStream();
response_header.read(socketInput);
- byte[] r = new byte[ response_header.message_size ];
- int n = 0;
- reading:
- while (n < r.length)
+ byte[] r;
+ if (orb instanceof OrbFunctional)
{
- n += socketInput.read(r, n, r.length - n);
+ OrbFunctional fo = (OrbFunctional) orb;
+ r = response_header.readMessage(socketInput, socket,
+ fo.TOUT_WHILE_READING, fo.TOUT_AFTER_RECEIVING);
}
- return new binaryReply(orb, response_header, r);
+ else
+ r = response_header.readMessage(socketInput, null, 0, 0);
+
+ return new RawReply(orb, response_header, r);
}
else
return EMPTY;
}
catch (IOException io_ex)
{
- MARSHAL m =
- new MARSHAL("Unable to open a socket at " + ior.Internet.host + ":" +
- ior.Internet.port, 10000 + ior.Internet.port,
- CompletionStatus.COMPLETED_NO
- );
+ COMM_FAILURE m = new COMM_FAILURE("Unable to open a socket at "
+ + ior.Internet.host + ":" + ior.Internet.port, 0xC9,
+ CompletionStatus.COMPLETED_NO);
m.initCause(io_ex);
throw m;
}
@@ -864,7 +868,7 @@ public class gnuRequest extends Request implements Cloneable
{
if (socket != null && !socket.isClosed())
{
- socket.setSoTimeout(Functional_ORB.TANDEM_REQUESTS);
+ socket.setSoTimeout(OrbFunctional.TANDEM_REQUESTS);
SocketRepository.put_socket(key, socket);
}
}
@@ -929,14 +933,15 @@ public class gnuRequest extends Request implements Cloneable
* Do actual invocation. This method recursively calls itself if the
* redirection is detected.
*/
- private void p_invoke() throws SystemException, ForwardRequest
+ private void p_invoke()
+ throws SystemException, ForwardRequest
{
- binaryReply response = submit();
+ RawReply response = submit();
if (m_rph == null)
m_rph = response.header.create_reply_header();
- cdrBufInput input = response.getStream();
+ BufferredCdrInput input = response.getStream();
input.setOrb(orb);
m_rph.read(input);
@@ -946,7 +951,7 @@ public class gnuRequest extends Request implements Cloneable
switch (m_rph.reply_status)
{
- case ReplyHeader.NO_EXCEPTION :
+ case ReplyHeader.NO_EXCEPTION:
NamedValue arg;
@@ -992,7 +997,7 @@ public class gnuRequest extends Request implements Cloneable
break;
- case ReplyHeader.SYSTEM_EXCEPTION :
+ case ReplyHeader.SYSTEM_EXCEPTION:
if (align)
{
input.align(8);
@@ -1000,7 +1005,8 @@ public class gnuRequest extends Request implements Cloneable
}
readExceptionId(input);
- m_sys_ex = ObjectCreator.readSystemException(input);
+ m_sys_ex = ObjectCreator.readSystemException(input,
+ m_rph.service_context);
m_environment.exception(m_sys_ex);
if (m_interceptor != null)
@@ -1008,7 +1014,7 @@ public class gnuRequest extends Request implements Cloneable
throw m_sys_ex;
- case ReplyHeader.USER_EXCEPTION :
+ case ReplyHeader.USER_EXCEPTION:
if (align)
{
input.align(8);
@@ -1020,7 +1026,7 @@ public class gnuRequest extends Request implements Cloneable
gnuAny exc = new gnuAny();
exc.setOrb(orb);
- exc.insert_Streamable(new streamReadyHolder(input));
+ exc.insert_Streamable(new StreamHolder(input));
UnknownUserException unuex = new UnknownUserException(exc);
m_environment.exception(unuex);
@@ -1030,8 +1036,8 @@ public class gnuRequest extends Request implements Cloneable
break;
- case ReplyHeader.LOCATION_FORWARD_PERM :
- case ReplyHeader.LOCATION_FORWARD :
+ case ReplyHeader.LOCATION_FORWARD_PERM:
+ case ReplyHeader.LOCATION_FORWARD:
if (response.header.version.since_inclusive(1, 2))
input.align(8);
@@ -1043,8 +1049,7 @@ public class gnuRequest extends Request implements Cloneable
catch (IOException ex)
{
new MARSHAL("Cant read forwarding info", 5103,
- CompletionStatus.COMPLETED_NO
- );
+ CompletionStatus.COMPLETED_NO);
}
setIor(forwarded);
@@ -1058,17 +1063,16 @@ public class gnuRequest extends Request implements Cloneable
p_invoke();
return;
- default :
+ default:
throw new MARSHAL("Unknow reply status", 8100 + m_rph.reply_status,
- CompletionStatus.COMPLETED_NO
- );
+ CompletionStatus.COMPLETED_NO);
}
}
/**
* Read exception id without changing the stream pointer position.
*/
- void readExceptionId(cdrBufInput input)
+ void readExceptionId(BufferredCdrInput input)
{
input.mark(2048);
m_exception_id = input.read_string();
@@ -1084,7 +1088,7 @@ public class gnuRequest extends Request implements Cloneable
* @throws MARSHAL if the attempt to write the parameters has failde.
*/
protected void write_parameter_buffer(MessageHeader header,
- cdrBufOutput request_part
+ BufferedCdrOutput request_part
) throws MARSHAL
{
try
@@ -1097,7 +1101,9 @@ public class gnuRequest extends Request implements Cloneable
}
catch (IOException ex)
{
- throw new MARSHAL("Unable to write method arguments to CDR output.");
+ MARSHAL m = new MARSHAL("Unable to write method arguments to CDR output.");
+ m.minor = Minor.CDR;
+ throw m;
}
}
@@ -1110,7 +1116,7 @@ public class gnuRequest extends Request implements Cloneable
* @throws MARSHAL if the attempt to write the parameters has failde.
*/
protected void write_parameters(MessageHeader header,
- cdrBufOutput request_part
+ BufferedCdrOutput request_part
) throws MARSHAL
{
// Align after 1.2, but only once.
@@ -1161,7 +1167,7 @@ public class gnuRequest extends Request implements Cloneable
*/
public TaggedProfile effective_profile()
{
- cdrBufOutput buf = new cdrBufOutput(512);
+ BufferedCdrOutput buf = new BufferedCdrOutput(512);
buf.setOrb(orb);
ior.Internet.write(buf);
@@ -1176,7 +1182,7 @@ public class gnuRequest extends Request implements Cloneable
*/
public org.omg.CORBA.Object effective_target()
{
- return new IOR_contructed_object(orb, ior);
+ return new IorObject(orb, ior);
}
/**
@@ -1188,7 +1194,7 @@ public class gnuRequest extends Request implements Cloneable
if (id == TAG_CODE_SETS.value)
{
// Codesets are encoded separately.
- cdrBufOutput buf = new cdrBufOutput(512);
+ BufferedCdrOutput buf = new BufferedCdrOutput(512);
buf.setOrb(orb);
ior.Internet.CodeSets.write(buf);
@@ -1289,7 +1295,7 @@ public class gnuRequest extends Request implements Cloneable
return m_forwarding_target;
if (m_forward_ior != null)
- return new IOR_contructed_object(orb, m_forward_ior);
+ return new IorObject(orb, m_forward_ior);
else
return null;
}
diff --git a/libjava/classpath/gnu/CORBA/gnuValueHolder.java b/libjava/classpath/gnu/CORBA/gnuValueHolder.java
index 0b382648981..8263113ec2a 100644
--- a/libjava/classpath/gnu/CORBA/gnuValueHolder.java
+++ b/libjava/classpath/gnu/CORBA/gnuValueHolder.java
@@ -123,7 +123,7 @@ public class gnuValueHolder
try
{
Class helperClass =
- Class.forName(ObjectCreator.toHelperName(type.id()));
+ ObjectCreator.forName(ObjectCreator.toHelperName(type.id()));
helper = (BoxedValueHelper) helperClass.newInstance();
}
diff --git a/libjava/classpath/gnu/CORBA/interfaces/SocketFactory.java b/libjava/classpath/gnu/CORBA/interfaces/SocketFactory.java
new file mode 100644
index 00000000000..7797dcbf917
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/interfaces/SocketFactory.java
@@ -0,0 +1,95 @@
+/* SocketFactory.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.CORBA.interfaces;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * This class produces sockets for serving and submitting CORBA requests. The
+ * socket factory can be set using {@link gnuOrb.setSocketFactory()} for
+ * producting all sockets for that ORB. This is needed for using secure sockets,
+ * for implementing the desired timeout policies, for HTTP tunnels and in some
+ * other similar cases. While such functionality is provided by near all
+ * existing CORBA implementations, no standard mechanism is defined.
+ *
+ * The socket factory may need to put additional information to the IORs of the
+ * objects, released by the ORB. Because of this reason, this interface extends
+ * IORInterceptorOperations.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface SocketFactory
+{
+ /**
+ * The name of the ORB property that forces the ORB to use the socket
+ * factory class, the name of that (String) is the value of this property.
+ */
+ final String PROPERTY = "gnu.CORBA.SocketFactory";
+
+ /**
+ * Create a server socket that should serve remote invocations on the given
+ * port. The ORB may use this socket to serve either one or more objects.
+ *
+ * @param port the port, on that the socket should be listening for requests.
+ * The port policy can be controlled by {@link gnuPortManager}.
+ *
+ * @throws IOException if the socket cannot be created on the given port due
+ * any reasons. The ORB may try to open the socket on another port, calling
+ * this method with the different parameter.
+ */
+ ServerSocket createServerSocket(int port)
+ throws IOException;
+
+ /**
+ * Create a client socket that should send a request to the remote side. When
+ * returned, the socket should be opened and ready to communicate.
+ *
+ * @param port the port, on that the socket should be openend. The port is
+ * usually part of the internet profile.
+ *
+ * @throws IOException if the socket cannot be created on the given port due
+ * any reasons. The ORB may try to open the socket on another port, calling
+ * this method with the different parameter.
+ */
+ Socket createClientSocket(String host, int port)
+ throws IOException;
+
+}
diff --git a/libjava/classpath/gnu/CORBA/interfaces/package.html b/libjava/classpath/gnu/CORBA/interfaces/package.html
new file mode 100644
index 00000000000..101475b2da1
--- /dev/null
+++ b/libjava/classpath/gnu/CORBA/interfaces/package.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html -
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - gnu.CORBA.interfaces</title></head>
+
+<body>
+<p>This package contains Classpath specific interfaces that
+the user program may be forced to use in cases when no
+other, better solution of the problem is available. The
+existing classes and methods in this package should not
+be removed without the real need</p>
+</body>
+</html>
diff --git a/libjava/classpath/gnu/CORBA/aliasTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/AliasTypeCode.java
index 88466310142..3cb8ebfb393 100644
--- a/libjava/classpath/gnu/CORBA/aliasTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/AliasTypeCode.java
@@ -1,4 +1,4 @@
-/* aliasTypeCode.java --
+/* AliasTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
@@ -47,9 +48,14 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class aliasTypeCode
- extends primitiveTypeCode
+public class AliasTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The typecode repository id.
*/
@@ -76,7 +82,7 @@ public class aliasTypeCode
*
* @param a_name the name of the newly created typecode.
*/
- public aliasTypeCode(TypeCode an_aliasFor, String an_id, String a_name)
+ public AliasTypeCode(TypeCode an_aliasFor, String an_id, String a_name)
{
super(TCKind.tk_alias);
aliasFor = an_aliasFor;
diff --git a/libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/ArrayTypeCode.java
index fc020bed788..bb798101a99 100644
--- a/libjava/classpath/gnu/CORBA/primitiveArrayTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/ArrayTypeCode.java
@@ -1,4 +1,4 @@
-/* primitiveArrayTypeCode.java --
+/* ArrayTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
@@ -46,9 +47,15 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
* A TypeCode for arrays.
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class primitiveArrayTypeCode
- extends primitiveTypeCode
+public class ArrayTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+
/**
* The array components.
*/
@@ -67,10 +74,10 @@ public class primitiveArrayTypeCode
*
* @param array_of the sequence member type.
*/
- public primitiveArrayTypeCode(TCKind array_of)
+ public ArrayTypeCode(TCKind array_of)
{
super(TCKind.tk_sequence);
- of = new primitiveTypeCode(array_of);
+ of = new PrimitiveTypeCode(array_of);
}
/**
@@ -81,7 +88,7 @@ public class primitiveArrayTypeCode
* sequence of array).
* @param array_of the sequence member type.
*/
- public primitiveArrayTypeCode(TCKind this_type, TypeCode array_of)
+ public ArrayTypeCode(TCKind this_type, TypeCode array_of)
{
super(this_type);
of = array_of;
diff --git a/libjava/classpath/gnu/CORBA/fixedTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java
index eb610417b29..c5fae63bd28 100644
--- a/libjava/classpath/gnu/CORBA/fixedTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java
@@ -1,4 +1,4 @@
-/* fixedTypeCode.java --
+/* FixedTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import java.math.BigDecimal;
@@ -48,9 +49,15 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
* A typecode for CORBA <code>fixed</code>
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class fixedTypeCode
- extends primitiveTypeCode
+public class FixedTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+
/**
* The number of the used digits.
*/
@@ -64,7 +71,7 @@ public class fixedTypeCode
/**
* Creates the instance of the fixed type code.
*/
- public fixedTypeCode()
+ public FixedTypeCode()
{
super(TCKind.tk_fixed);
}
@@ -73,7 +80,7 @@ public class fixedTypeCode
* Creates the instance of the fixed type code,
* setting the digits and scale by example.
*/
- public fixedTypeCode(BigDecimal example)
+ public FixedTypeCode(BigDecimal example)
{
super(TCKind.tk_fixed);
if (example != null)
diff --git a/libjava/classpath/gnu/CORBA/generalTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/GeneralTypeCode.java
index 3b7914878c3..0a907844ad9 100644
--- a/libjava/classpath/gnu/CORBA/generalTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/GeneralTypeCode.java
@@ -1,4 +1,4 @@
-/* generalTypeCode.java --
+/* GeneralTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,9 +36,9 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import java.util.Arrays;
import java.util.BitSet;
@@ -56,9 +56,15 @@ import org.omg.CORBA.TypeCodePackage.BadKind;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class generalTypeCode
- extends primitiveTypeCode
+public class GeneralTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+
/**
* Indicates that the field value has not been previously set.
*/
@@ -87,21 +93,21 @@ public class generalTypeCode
/**
* Create a new instance, setting kind to the given kind.
- * @param kind
+ * @param a_kind the kind of the typecode being created.
*/
- public generalTypeCode(TCKind kind)
+ public GeneralTypeCode(TCKind a_kind)
{
- super(kind);
- if (!lengthAllowed.get(kind.value()))
+ super(a_kind);
+ if (!lengthAllowed.get(a_kind.value()))
len = UNSET;
}
/**
* Set this property.
*/
- public void setConcreteBase_type(TypeCode concrete_base_type)
+ public void setConcreteBase_type(TypeCode a_concrete_base_type)
{
- this.concrete_base_type = concrete_base_type;
+ this.concrete_base_type = a_concrete_base_type;
}
/**
@@ -115,9 +121,9 @@ public class generalTypeCode
/**
* Set this property.
*/
- public void setId(String id)
+ public void setId(String an_id)
{
- this.id = id;
+ this.id = an_id;
}
/**
@@ -132,9 +138,9 @@ public class generalTypeCode
/**
* Set this property.
*/
- public void setName(String name)
+ public void setName(String a_name)
{
- this.name = name;
+ this.name = a_name;
}
/**
@@ -179,8 +185,8 @@ public class generalTypeCode
if (kind() != other.kind())
return false;
- cdrBufOutput a = new cdrBufOutput(16);
- cdrBufOutput b = new cdrBufOutput(16);
+ BufferedCdrOutput a = new BufferedCdrOutput(16);
+ BufferedCdrOutput b = new BufferedCdrOutput(16);
a.write_TypeCode(this);
b.write_TypeCode(other);
diff --git a/libjava/classpath/gnu/CORBA/primitiveTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/PrimitiveTypeCode.java
index 4bf97d0230b..22d39a82c97 100644
--- a/libjava/classpath/gnu/CORBA/primitiveTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/PrimitiveTypeCode.java
@@ -1,4 +1,4 @@
-/* primitiveTypeCode.java --
+/* PrimitiveTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
Copyright (C) 2005 Free Software Foundation, Inc.
@@ -37,17 +37,17 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
import java.io.Serializable;
import org.omg.CORBA.Any;
-import org.omg.CORBA.IDLEntity;
import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.CORBA.portable.IDLEntity;
/**
* An information about a primitive CORBA data type
@@ -60,16 +60,21 @@ import org.omg.CORBA.TypeCodePackage.Bounds;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class primitiveTypeCode
+public class PrimitiveTypeCode
extends TypeCode
implements IDLEntity, Serializable
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The kind of this TypeCode.
*/
protected final TCKind kind;
- public primitiveTypeCode(TCKind a_kind)
+ public PrimitiveTypeCode(TCKind a_kind)
{
kind = a_kind;
}
diff --git a/libjava/classpath/gnu/CORBA/recordTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/RecordTypeCode.java
index 8f2ecde7d1a..89f3425465b 100644
--- a/libjava/classpath/gnu/CORBA/recordTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/RecordTypeCode.java
@@ -1,4 +1,4 @@
-/* recordTypeCode.java --
+/* RecordTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,9 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
+import gnu.CORBA.CorbaList;
import org.omg.CORBA.Any;
import org.omg.CORBA.StructMember;
@@ -53,9 +55,14 @@ import org.omg.CORBA.ValueMember;
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class recordTypeCode
- extends generalTypeCode
+public class RecordTypeCode
+ extends GeneralTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The individual field of the record.
*/
@@ -85,16 +92,16 @@ public class recordTypeCode
/**
* The members of this data structure.
*/
- protected corbaArrayList members = new corbaArrayList();
+ protected CorbaList members = new CorbaList();
private TypeCode discriminator_type;
private int default_index = UNSET;
/**
* Creates the type code of the given kind.
*/
- public recordTypeCode(TCKind kind)
+ public RecordTypeCode(TCKind a_kind)
{
- super(kind);
+ super(a_kind);
}
/**
diff --git a/libjava/classpath/gnu/CORBA/recursiveTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java
index 6bc672e6e49..0e6ac375e50 100644
--- a/libjava/classpath/gnu/CORBA/recursiveTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java
@@ -1,4 +1,4 @@
-/* recursiveTypeCode.java --
+/* RecursiveTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import org.omg.CORBA.TCKind;
@@ -44,9 +45,14 @@ import org.omg.CORBA.TCKind;
* The typecode, serving as a placeholder in defining
* typecodes, containing recursion.
*/
-public class recursiveTypeCode
- extends primitiveTypeCode
+public class RecursiveTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
/**
* The id of the type for that this type serves as a
* placeholder.
@@ -60,7 +66,7 @@ public class recursiveTypeCode
* @param id the Id of the type for that this type serves as a
* placeholder.
*/
- public recursiveTypeCode(String an_id)
+ public RecursiveTypeCode(String an_id)
{
super(TCKind.tk_null);
the_id = an_id;
diff --git a/libjava/classpath/gnu/CORBA/stringTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/StringTypeCode.java
index 27aa119f30e..2d1689b4560 100644
--- a/libjava/classpath/gnu/CORBA/stringTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/StringTypeCode.java
@@ -1,4 +1,4 @@
-/* stringTypeCode.java --
+/* StringTypeCode.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -36,7 +36,8 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.CORBA;
+package gnu.CORBA.typecodes;
+
import org.omg.CORBA.TCKind;
@@ -44,9 +45,14 @@ import org.omg.CORBA.TCKind;
* The typecode for string and wide string.
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
-public class stringTypeCode
- extends primitiveTypeCode
+public class StringTypeCode
+ extends PrimitiveTypeCode
{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
private int len = 0;
/**
@@ -55,7 +61,7 @@ public class stringTypeCode
* @param a_kind a kind of this typecode, normally
* either tk_string or tk_wstring.
*/
- public stringTypeCode(TCKind a_kind)
+ public StringTypeCode(TCKind a_kind)
{
super(a_kind);
}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/package.html b/libjava/classpath/gnu/CORBA/typecodes/package.html
index 6aed0fc0169..891b3b96574 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/event/package.html
+++ b/libjava/classpath/gnu/CORBA/typecodes/package.html
@@ -1,5 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- package.html - describes classes in gnu.java.net.protocol.http.event package.
+<!-- package.html
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,10 +37,12 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. -->
<html>
-<head><title>GNU Classpath - gnu.java.net.protocol.http.event</title></head>
+<head><title>GNU Classpath - gnu.CORBA.typecodes</title></head>
<body>
-<p></p>
-
+ Contains GNU Classpath specific typecode definitions.
+
+ @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
</body>
</html>
+
diff --git a/libjava/classpath/gnu/classpath/ByteArray.java b/libjava/classpath/gnu/classpath/ByteArray.java
new file mode 100644
index 00000000000..6307b8abd79
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/ByteArray.java
@@ -0,0 +1,109 @@
+/* ByteArray.java -- wrapper around a byte array, with nice toString output.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public final class ByteArray
+{
+ private final byte[] value;
+
+ public ByteArray (final byte[] value)
+ {
+ this.value = value;
+ }
+
+ public byte[] getValue ()
+ {
+ return value;
+ }
+
+ public String toString ()
+ {
+ StringWriter str = new StringWriter ();
+ PrintWriter out = new PrintWriter (str);
+ int i = 0;
+ int len = value.length;
+ while (i < len)
+ {
+ out.print (formatInt (i, 16, 8));
+ out.print (" ");
+ int l = Math.min (16, len - i);
+ String s = toHexString (value, i, l, ' ');
+ out.print (s);
+ for (int j = 56 - (56 - s.length ()); j < 56; j++)
+ out.print (" ");
+ for (int j = 0; j < l; j++)
+ {
+ byte b = value[i+j];
+ if ((b & 0xFF) < 0x20 || (b & 0xFF) > 0x7E)
+ out.print (".");
+ else
+ out.print ((char) (b & 0xFF));
+ }
+ out.println ();
+ i += 16;
+ }
+ return str.toString ();
+ }
+
+ public static String toHexString (byte[] buf, int off, int len, char sep)
+ {
+ StringBuffer str = new StringBuffer();
+ for (int i = 0; i < len; i++)
+ {
+ str.append (Character.forDigit (buf[i+off] >>> 4 & 0x0F, 16));
+ str.append (Character.forDigit (buf[i+off] & 0x0F, 16));
+ if (i < len - 1)
+ str.append(sep);
+ }
+ return str.toString();
+ }
+
+ public static String formatInt (int value, int radix, int len)
+ {
+ String s = Integer.toString (value, radix);
+ StringBuffer buf = new StringBuffer ();
+ for (int j = 0; j < len - s.length(); j++)
+ buf.append ("0");
+ buf.append (s);
+ return buf.toString();
+ }
+}
diff --git a/libjava/classpath/gnu/classpath/SystemProperties.java b/libjava/classpath/gnu/classpath/SystemProperties.java
index 600e1a6c159..524f04099aa 100644
--- a/libjava/classpath/gnu/classpath/SystemProperties.java
+++ b/libjava/classpath/gnu/classpath/SystemProperties.java
@@ -106,12 +106,6 @@ public class SystemProperties
if (defaultProperties.get("file.encoding") == null)
defaultProperties.put("file.encoding", "8859_1");
- // Default to the Swing FocusManager so that the old-style Swing API
- // for FocusManager can be supported without hardcoding it in AWT.
- if (defaultProperties.get("gnu.java.awt.FocusManager") == null)
- defaultProperties.put("gnu.java.awt.FocusManager",
- "gnu.java.awt.FocusManager");
-
// XXX FIXME - Temp hack for old systems that set the wrong property
if (defaultProperties.get("java.io.tmpdir") == null)
defaultProperties.put("java.io.tmpdir",
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java
new file mode 100644
index 00000000000..b0d9b656562
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/jdwp/event/VmDeathEvent.java
@@ -0,0 +1,85 @@
+/* VmDeathEvent.java -- An event specifying that the VM has terminated
+ Copyright (C) 2005 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.jdwp.event;
+
+import gnu.classpath.jdwp.JdwpConstants;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+/**
+ * Event notifying the debugger that the virtual machine has terminated.
+ *
+ * @author Keith Seitz (keiths@redhat.com)
+ */
+public class VmDeathEvent
+ extends Event
+{
+ /**
+ * Constructs a <code>VmDeathEvent</code> object
+ *
+ * @param thread the initial thread
+ */
+ public VmDeathEvent ()
+ {
+ super (JdwpConstants.EventKind.VM_DEATH);
+ }
+
+ /**
+ * Returns a specific filtering parameter for this event.
+ * This event has no valid types.
+ *
+ * @param type the type of parameter desired
+ * @returns the desired parameter or <code>null</code>
+ */
+ public Object getParameter (Class type)
+ {
+ return null;
+ }
+
+ /**
+ * Writes out event-specific data
+ */
+ protected void _writeData (DataOutputStream outStream)
+ throws IOException
+ {
+ // no data (request ID done by VMIdManager)
+ }
+}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java
index 75753cda095..d029e61e10d 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java
@@ -66,7 +66,7 @@ public class StepFilter
public StepFilter (ThreadId tid, int size, int depth)
throws InvalidThreadException
{
- if (tid == null | tid.getReference().get () == null)
+ if (tid.getReference().get () == null)
throw new InvalidThreadException (tid.getId ());
_tid = tid;
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
index 039b4372125..83ad4094660 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
@@ -66,7 +66,7 @@ public class ThreadOnlyFilter
public ThreadOnlyFilter (ThreadId tid)
throws InvalidThreadException
{
- if (tid == null | tid.getReference().get () == null)
+ if (tid.getReference().get () == null)
throw new InvalidThreadException (tid.getId ());
_tid = tid;
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
index 24702166252..a9dc6cc815f 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java
@@ -88,7 +88,8 @@ public class ArrayReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeLength(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
index 8ae1b450862..b77c3a833a2 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java
@@ -82,7 +82,8 @@ public class ArrayTypeCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
public void executeNewInstance(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
index 4e8e23ede23..cc591b17dd1 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java
@@ -86,7 +86,8 @@ public class ClassLoaderReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
public void executeVisibleClasses(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java
index dcafa6f84d2..cfec20bc7ce 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java
@@ -79,7 +79,8 @@ public class ClassObjectReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
public void executeReflectedType(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
index ff6010e59cb..f60da7b7021 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java
@@ -95,7 +95,8 @@ public class ClassTypeCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeSuperclass(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java
index 389b2d349f9..e4b1b602ef5 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java
@@ -102,7 +102,8 @@ public class EventRequestCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeSet(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java
index b5db664e4e4..53308d7c11b 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java
@@ -94,7 +94,8 @@ public class MethodCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeLineTable(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
index 23a64c341e6..ef421ea5b28 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
@@ -106,7 +106,8 @@ public class ObjectReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeReferenceType(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
index b9944f7d9a0..7338480fcab 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
@@ -128,7 +128,8 @@ public class ReferenceTypeCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeSignature(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java
index 480f4ca2833..7890a8e4b1b 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java
@@ -91,7 +91,8 @@ public class StackFrameCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeGetValues(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
index 8f5bc685cda..13fde0ac732 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java
@@ -84,7 +84,8 @@ public class StringReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeValue(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
index 8a11195a708..ba36251f665 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java
@@ -85,7 +85,8 @@ public class ThreadGroupReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeName(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
index 73643b6a83a..559e405b65a 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java
@@ -118,7 +118,8 @@ public class ThreadReferenceCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return true;
+
+ return false;
}
private void executeName(ByteBuffer bb, DataOutputStream os)
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
index b83406873e3..6bdb236818c 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
@@ -67,7 +67,7 @@ public class VirtualMachineCommandSet
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command)
throws JdwpException
{
- boolean keepRunning = true;
+ boolean shutdown = false;
try
{
switch (command)
@@ -91,7 +91,7 @@ public class VirtualMachineCommandSet
executeIDsizes(bb, os);
break;
case JdwpConstants.CommandSet.VirtualMachine.DISPOSE:
- keepRunning = false;
+ shutdown = true;
executeDispose(bb, os);
break;
case JdwpConstants.CommandSet.VirtualMachine.SUSPEND:
@@ -101,7 +101,7 @@ public class VirtualMachineCommandSet
executeResume(bb, os);
break;
case JdwpConstants.CommandSet.VirtualMachine.EXIT:
- keepRunning = false;
+ shutdown = true;
executeExit(bb, os);
break;
case JdwpConstants.CommandSet.VirtualMachine.CREATE_STRING:
@@ -145,7 +145,8 @@ public class VirtualMachineCommandSet
// So if we throw an IOException we're in serious trouble
throw new JdwpInternalErrorException(ex);
}
- return keepRunning;
+
+ return shutdown;
}
private void executeVersion(ByteBuffer bb, DataOutputStream os)
@@ -164,8 +165,8 @@ public class VirtualMachineCommandSet
String vmVersion = props.getProperty("java.version");
String vmName = props.getProperty("java.vm.name");
JdwpString.writeString(os, description);
- os.write(jdwpMajor);
- os.write(jdwpMinor);
+ os.writeInt(jdwpMajor);
+ os.writeInt(jdwpMinor);
JdwpString.writeString(os, vmName);
JdwpString.writeString(os, vmVersion);
}
diff --git a/libjava/classpath/gnu/java/awt/AWTUtilities.java b/libjava/classpath/gnu/java/awt/AWTUtilities.java
index af1fc13ca50..ca7b5511853 100644
--- a/libjava/classpath/gnu/java/awt/AWTUtilities.java
+++ b/libjava/classpath/gnu/java/awt/AWTUtilities.java
@@ -592,9 +592,12 @@ public class AWTUtilities
if (destination == null)
destination = getRoot(source);
-
- convertPointToScreen(pt, source);
- convertPointFromScreen(pt, destination);
+
+ if (source.isShowing() && destination.isShowing())
+ {
+ convertPointToScreen(pt, source);
+ convertPointFromScreen(pt, destination);
+ }
return pt;
}
diff --git a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
index 08b2140f443..99f90c9f85d 100644
--- a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
+++ b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
@@ -98,13 +98,11 @@ public class EmbeddedWindow extends Frame
}
catch (IllegalAccessException e)
{
- throw new RuntimeException
- ("couldn't set java.awt.Component.peer field");
+ throw new AssertionError (e);
}
catch (NoSuchFieldException e)
{
- throw new RuntimeException
- ("couldn't set java.awt.Component.peer field");
+ throw new AssertionError (e);
}
super.addNotify();
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java
index 7a439e83a9d..c79f403edfd 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontMetrics.java
@@ -1,5 +1,5 @@
/* GdkFontMetrics.java
- Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,15 +62,28 @@ public class GdkFontMetrics extends FontMetrics
static final int TEXT_METRICS_HEIGHT = 3;
static final int TEXT_METRICS_X_ADVANCE = 4;
static final int TEXT_METRICS_Y_ADVANCE = 5;
-
-
+
+ /**
+ * Makes sure to return a Font based on the given Font that has as
+ * peer a GdkFontPeer. Used in the initializer.
+ */
+ private static Font initFont(Font font)
+ {
+ if (font == null)
+ return new Font("Dialog", Font.PLAIN, 12);
+ else if (font.getPeer() instanceof GdkFontPeer)
+ return font;
+ else
+ {
+ ClasspathToolkit toolkit;
+ toolkit = (ClasspathToolkit) Toolkit.getDefaultToolkit();
+ return toolkit.getFont(font.getName(), font.getAttributes());
+ }
+ }
+
public GdkFontMetrics (Font font)
{
- super (font.getPeer() instanceof GdkFontPeer
- ? font
- : ((ClasspathToolkit)(Toolkit.getDefaultToolkit ()))
- .getFont (font.getName(), font.getAttributes ()));
-
+ super(initFont(font));
peer = (GdkFontPeer) this.font.getPeer();
font_metrics = new int[5];
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
index 160602b03bf..d80306c8a82 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics.java
@@ -68,7 +68,7 @@ public class GdkGraphics extends Graphics
Color color, xorColor;
GtkComponentPeer component;
- Font font;
+ Font font = new Font ("Dialog", Font.PLAIN, 12);
Rectangle clip;
GtkImage image;
@@ -88,6 +88,8 @@ public class GdkGraphics extends Graphics
color = g.color;
xorColor = g.xorColor;
font = g.font;
+ if (font == null)
+ font = new Font ("Dialog", Font.PLAIN, 12);
clip = new Rectangle (g.clip);
component = g.component;
@@ -115,7 +117,6 @@ public class GdkGraphics extends Graphics
GdkGraphics (GtkComponentPeer component)
{
this.component = component;
- font = component.awtComponent.getFont ();
color = Color.black;
if (component.isRealized ())
@@ -128,6 +129,8 @@ public class GdkGraphics extends Graphics
{
initState (component);
color = component.awtComponent.getForeground ();
+ if (color == null)
+ color = Color.BLACK;
Dimension d = component.awtComponent.getSize ();
clip = new Rectangle (0, 0, d.width, d.height);
}
@@ -137,6 +140,8 @@ public class GdkGraphics extends Graphics
{
initStateUnlocked (component);
color = component.awtComponent.getForeground ();
+ if (color == null)
+ color = Color.BLACK;
Dimension d = component.awtComponent.getSize ();
clip = new Rectangle (0, 0, d.width, d.height);
}
@@ -378,7 +383,8 @@ public class GdkGraphics extends Graphics
public void setFont (Font font)
{
- this.font = font;
+ if (font != null)
+ this.font = font;
}
native void setFunction (int gdk_func);
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java
index 6d9aabf77d5..c9ed3012658 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphics2D.java
@@ -101,7 +101,7 @@ public class GdkGraphics2D extends Graphics2D
static
{
if (! Configuration.GTK_CAIRO_ENABLED)
- throw new Error("Grahics2D not implemented. "
+ throw new Error("Graphics2D not implemented. "
+ "Cairo was not found or disabled at configure time");
if (Configuration.INIT_LOAD_LIBRARY)
@@ -154,11 +154,22 @@ public class GdkGraphics2D extends Graphics2D
public Graphics create(int x, int y, int width, int height)
{
- return new GdkGraphics2D(width, height);
+ return new GdkGraphics2D(this, x, y, width, height);
+ }
+
+ private void fail_g2d ()
+ {
+ System.err.println ("Attempted to instantiate GdkGraphics2D"
+ + " but Graphics2D not enabled. Try again with"
+ + " -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D");
+ System.exit (1);
}
GdkGraphics2D(GdkGraphics2D g)
{
+ if (!GtkToolkit.useGraphics2D ())
+ fail_g2d ();
+
paint = g.paint;
stroke = g.stroke;
setRenderingHints(g.hints);
@@ -198,8 +209,18 @@ public class GdkGraphics2D extends Graphics2D
stateStack = new Stack();
}
+ GdkGraphics2D(GdkGraphics2D g, int x, int y, int widht, int height)
+ {
+ this(g);
+ translate(x, y);
+ clipRect(0, 0, widht, height);
+ }
+
GdkGraphics2D(int width, int height)
{
+ if (!GtkToolkit.useGraphics2D ())
+ fail_g2d ();
+
initState(width, height);
setColor(Color.black);
@@ -215,6 +236,9 @@ public class GdkGraphics2D extends Graphics2D
GdkGraphics2D(GtkComponentPeer component)
{
+ if (!GtkToolkit.useGraphics2D ())
+ fail_g2d ();
+
this.component = component;
if (component.isRealized())
@@ -949,7 +973,10 @@ public class GdkGraphics2D extends Graphics2D
public Shape getClip()
{
- return clip.getBounds2D(); //getClipInDevSpace();
+ if (clip == null)
+ return null;
+ else
+ return clip.getBounds2D(); //getClipInDevSpace();
}
public Rectangle getClipBounds()
@@ -992,8 +1019,11 @@ public class GdkGraphics2D extends Graphics2D
if (clip == null)
{
// Reset clipping.
- Dimension d = component.awtComponent.getSize();
- setClip(0, 0, d.width, d.height);
+ if (component != null)
+ {
+ Dimension d = component.awtComponent.getSize();
+ setClip(0, 0, d.width, d.height);
+ }
}
else
{
@@ -1045,8 +1075,9 @@ public class GdkGraphics2D extends Graphics2D
public void clearRect(int x, int y, int width, int height)
{
- cairoSetRGBAColor(bg.getRed() / 255.0, bg.getGreen() / 255.0,
- bg.getBlue() / 255.0, 1.0);
+ if (bg != null)
+ cairoSetRGBAColor(bg.getRed() / 255.0, bg.getGreen() / 255.0,
+ bg.getBlue() / 255.0, 1.0);
cairoNewPath();
cairoRectangle(x, y, width, height);
cairoFill();
@@ -1371,7 +1402,8 @@ public class GdkGraphics2D extends Graphics2D
public void copyArea(int x, int y, int width, int height, int dx, int dy)
{
- throw new java.lang.UnsupportedOperationException();
+ GdkGraphics2D g = (GdkGraphics2D) create(x, y, width, height);
+ gdkDrawDrawable(g, x + dx, y + dy);
}
public void drawArc(int x, int y, int width, int height, int startAngle,
@@ -1604,6 +1636,11 @@ public class GdkGraphics2D extends Graphics2D
public void setFont(Font f)
{
+ // Sun's JDK does not throw NPEs, instead it leaves the current setting
+ // unchanged. So do we.
+ if (f == null)
+ return;
+
if (f.getPeer() instanceof GdkFontPeer)
font = f;
else
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java
index ff51745f26c..c3ae581b14f 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java
@@ -388,10 +388,7 @@ public class GdkTextLayout
throw new Error("not implemented");
}
- public Shape getOutline (AffineTransform tx)
- {
- throw new Error("not implemented");
- }
+ public native Shape getOutline (AffineTransform tx);
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
TextHitInfo secondEndpoint,
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java
index c140744397a..ed7dc74d22e 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java
@@ -131,9 +131,6 @@ public class GtkChoicePeer extends GtkComponentPeer
protected void postChoiceItemEvent (String label, int stateChange)
{
- // Must set our state before notifying listeners
- if (stateChange == ItemEvent.SELECTED)
- ((Choice) awtComponent).select (label);
postItemEvent (label, stateChange);
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index 60e8371277f..fe0dae70dd0 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -71,6 +71,7 @@ import java.awt.image.ImageProducer;
import java.awt.image.VolatileImage;
import java.awt.peer.ComponentPeer;
import java.awt.peer.ContainerPeer;
+import java.awt.peer.WindowPeer;
import java.util.Timer;
import java.util.TimerTask;
@@ -98,6 +99,7 @@ public class GtkComponentPeer extends GtkGenericPeer
native int[] gtkWidgetGetBackground ();
native void gtkWidgetGetDimensions (int[] dim);
native void gtkWidgetGetPreferredDimensions (int[] dim);
+ native void gtkWindowGetLocationOnScreen (int[] point);
native void gtkWidgetGetLocationOnScreen (int[] point);
native void gtkWidgetSetCursor (int type);
native void gtkWidgetSetCursorUnlocked (int type);
@@ -270,7 +272,10 @@ public class GtkComponentPeer extends GtkGenericPeer
public Point getLocationOnScreen ()
{
int point[] = new int[2];
- gtkWidgetGetLocationOnScreen (point);
+ if( this instanceof WindowPeer )
+ gtkWindowGetLocationOnScreen (point);
+ else
+ gtkWidgetGetLocationOnScreen (point);
return new Point (point[0], point[1]);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java
index c2cbc37dce9..3e3125a2b38 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkDialogPeer.java
@@ -82,10 +82,10 @@ public class GtkDialogPeer extends GtkWindowPeer
void create ()
{
- // Create a decorated dialog window.
- create (GDK_WINDOW_TYPE_HINT_DIALOG, true);
-
Dialog dialog = (Dialog) awtComponent;
+
+ // Create a decorated dialog window.
+ create (GDK_WINDOW_TYPE_HINT_DIALOG, !((Dialog) awtComponent).isUndecorated ());
gtkWindowSetModal (dialog.isModal ());
setTitle (dialog.getTitle ());
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
index 6eb90ffa0bd..99cca0cffa7 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
@@ -168,7 +168,8 @@ public class GtkFramePeer extends GtkWindowPeer
void create ()
{
// Create a normal decorated window.
- create (GDK_WINDOW_TYPE_HINT_NORMAL, true);
+ create (GDK_WINDOW_TYPE_HINT_NORMAL,
+ !((Frame) awtComponent).isUndecorated ());
Frame frame = (Frame) awtComponent;
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java
index c84d51037e3..57fb87f37bf 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java
@@ -41,7 +41,6 @@ package gnu.java.awt.peer.gtk;
import java.awt.Component;
import java.awt.Frame;
import java.awt.Window;
-import java.awt.event.ComponentEvent;
import java.awt.event.WindowEvent;
import java.awt.peer.WindowPeer;
@@ -80,12 +79,16 @@ public class GtkWindowPeer extends GtkContainerPeer
void create (int type, boolean decorated)
{
+ Window window = (Window) awtComponent;
GtkWindowPeer parent_peer = null;
Component parent = awtComponent.getParent();
-
+
+ if (!window.isFocusableWindow())
+ type = GDK_WINDOW_TYPE_HINT_MENU;
+
if (parent != null)
parent_peer = (GtkWindowPeer) awtComponent.getParent().getPeer();
-
+
create (type, decorated, parent_peer);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java b/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java
index 54f4888cf8d..591b528035d 100644
--- a/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java
+++ b/libjava/classpath/gnu/java/awt/peer/qt/QtToolkit.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package gnu.java.awt.peer.qt;
+import gnu.classpath.Configuration;
import gnu.java.awt.EmbeddedWindow;
import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.java.awt.peer.EmbeddedWindowPeer;
@@ -135,7 +136,8 @@ public class QtToolkit extends ClasspathToolkit
{
eventQueue = new EventQueue();
repaintThread = new QtRepaintThread();
- System.loadLibrary("qtpeer");
+ if (Configuration.INIT_LOAD_LIBRARY)
+ System.loadLibrary("qtpeer");
String theme = null;
try
diff --git a/libjava/classpath/gnu/java/beans/DummyAppletContext.java b/libjava/classpath/gnu/java/beans/DummyAppletContext.java
index 4facb470d95..583d2f5cbee 100644
--- a/libjava/classpath/gnu/java/beans/DummyAppletContext.java
+++ b/libjava/classpath/gnu/java/beans/DummyAppletContext.java
@@ -63,7 +63,6 @@ import java.util.Iterator;
class DummyAppletContext implements AppletContext
{
private static final Enumeration EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_SET);
- private static final AudioClip DUMMY_CLIP = new DummyAudioClip();
DummyAppletContext()
{
@@ -80,14 +79,7 @@ class DummyAppletContext implements AppletContext
*/
public AudioClip getAudioClip(URL url)
{
- try
- {
- return (url.openConnection() != null ? DUMMY_CLIP : null);
- }
- catch (IOException ioe)
- {
- return null;
- }
+ return Applet.newAudioClip(url);
}
/** Loads the <code>Image</code> instance by delegating to
@@ -170,31 +162,4 @@ class DummyAppletContext implements AppletContext
{
return Collections.EMPTY_SET.iterator();
}
-
- /** Dummy <code>AudioClip</code> implementation that does nothing but
- * preventing <code>NullPointerException</code>S being thrown in programs
- * that expect a valid <code>AudioClip</code> instance to be returned by
- * their Applet.
- *
- * @author Robert Schuster
- */
- static class DummyAudioClip implements AudioClip
- {
- public void play()
- {
- }
-
- public void stop()
- {
- }
-
- public void loop()
- {
- }
-
- public String toString()
- {
- return "DummyAudioClip never plays anything - implement javax.sound and make us happy :)";
- }
- }
}
diff --git a/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java b/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
index a34fe346e0f..a675e8c9012 100644
--- a/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
+++ b/libjava/classpath/gnu/java/beans/decoder/BooleanHandler.java
@@ -57,10 +57,10 @@ class BooleanHandler extends SimpleHandler
protected Object parse(String number) throws AssemblyException
{
if (number.equals("true"))
- return new Boolean(true);
+ return Boolean.TRUE;
if (number.equals("false"))
- return new Boolean(false);
+ return Boolean.FALSE;
throw new AssemblyException(new IllegalArgumentException("Element contained no valid boolean value."));
}
diff --git a/libjava/classpath/gnu/java/io/PlatformHelper.java b/libjava/classpath/gnu/java/io/PlatformHelper.java
index d2c60123192..79ce6e8f470 100644
--- a/libjava/classpath/gnu/java/io/PlatformHelper.java
+++ b/libjava/classpath/gnu/java/io/PlatformHelper.java
@@ -109,11 +109,6 @@ public class PlatformHelper
String tmppath = path.replace('/', separatorChar);
StringBuffer canonpath;
- // We found it'll be more efficient and easy to handle to
- // return a lowercased canonical path
- if(isWindows)
- tmppath = tmppath.toLowerCase();
-
int i;
if ((i = beginWithRootPathPrefix(tmppath)) == 0 )
diff --git a/libjava/classpath/gnu/java/net/LineInputStream.java b/libjava/classpath/gnu/java/net/LineInputStream.java
index 5ca068618da..81a3c7d1fd4 100644
--- a/libjava/classpath/gnu/java/net/LineInputStream.java
+++ b/libjava/classpath/gnu/java/net/LineInputStream.java
@@ -1,5 +1,5 @@
/* LineInputStream.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.net;
+import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FilterInputStream;
import java.io.IOException;
@@ -91,7 +92,8 @@ public class LineInputStream
buf = new ByteArrayOutputStream();
this.encoding = encoding;
eof = false;
- blockReads = in.markSupported();
+ // If it is already buffered, additional buffering gains nothing.
+ blockReads = !(in instanceof BufferedInputStream) && in.markSupported();
}
/**
@@ -109,11 +111,12 @@ public class LineInputStream
if (blockReads)
{
// Use mark and reset to read chunks of bytes
- final int MIN_LENGTH = 1024;
+ final int MAX_LENGTH = 1024;
int len, pos;
-
+
len = in.available();
- len = (len < MIN_LENGTH) ? MIN_LENGTH : len;
+ if (len == 0 || len > MAX_LENGTH)
+ len = MAX_LENGTH;
byte[] b = new byte[len];
in.mark(len);
// Read into buffer b
diff --git a/libjava/classpath/gnu/java/net/protocol/file/Connection.java b/libjava/classpath/gnu/java/net/protocol/file/Connection.java
index 52bd0484510..8e4a413667d 100644
--- a/libjava/classpath/gnu/java/net/protocol/file/Connection.java
+++ b/libjava/classpath/gnu/java/net/protocol/file/Connection.java
@@ -59,6 +59,7 @@ import java.security.Permission;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
+import java.net.MalformedURLException;
/**
* This subclass of java.net.URLConnection models a URLConnection via
@@ -125,6 +126,54 @@ public class Connection extends URLConnection
}
/**
+ * Unquote "%" + hex quotes characters
+ *
+ * @param str The string to unquote or null.
+ *
+ * @return The unquoted string or null if str was null.
+ *
+ * @exception MalformedURLException If the given string contains invalid
+ * escape sequences.
+ *
+ * Sadly the same as URI.unquote, but there's nothing we can do to
+ * make it accessible.
+ *
+ */
+ public static String unquote(String str) throws MalformedURLException
+ {
+ if (str == null)
+ return null;
+ byte[] buf = new byte[str.length()];
+ int pos = 0;
+ for (int i = 0; i < str.length(); i++)
+ {
+ char c = str.charAt(i);
+ if (c > 127)
+ throw new MalformedURLException(str + " : Invalid character");
+ if (c == '%')
+ {
+ if (i + 2 >= str.length())
+ throw new MalformedURLException(str + " : Invalid quoted character");
+ int hi = Character.digit(str.charAt(++i), 16);
+ int lo = Character.digit(str.charAt(++i), 16);
+ if (lo < 0 || hi < 0)
+ throw new MalformedURLException(str + " : Invalid quoted character");
+ buf[pos++] = (byte) (hi * 16 + lo);
+ }
+ else
+ buf[pos++] = (byte) c;
+ }
+ try
+ {
+ return new String(buf, 0, pos, "utf-8");
+ }
+ catch (java.io.UnsupportedEncodingException x2)
+ {
+ throw (Error) new InternalError().initCause(x2);
+ }
+ }
+
+ /**
* "Connects" to the file by opening it.
*/
public void connect() throws IOException
@@ -134,7 +183,7 @@ public class Connection extends URLConnection
return;
// If not connected, then file needs to be openned.
- file = new File (getURL().getFile());
+ file = new File (unquote(getURL().getFile()));
if (! file.isDirectory())
{
diff --git a/libjava/classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java b/libjava/classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java
deleted file mode 100644
index 680e45d3e49..00000000000
--- a/libjava/classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Authenticator.java --ByteArrayResponseBodyReader.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * Simple response body reader that stores content in a byte array.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public class ByteArrayResponseBodyReader
- implements ResponseBodyReader
-{
-
- /**
- * The content.
- */
- protected byte[] content;
-
- /**
- * The position in the content at which the next write will occur.
- */
- protected int pos;
-
- /**
- * The length of the buffer.
- */
- protected int len;
-
- /**
- * Constructs a new byte array response body reader.
- */
- public ByteArrayResponseBodyReader()
- {
- this(4096);
- }
-
- /**
- * Constructs a new byte array response body reader with the specified
- * initial buffer size.
- * @param size the initial buffer size
- */
- public ByteArrayResponseBodyReader(int size)
- {
- content = new byte[size];
- pos = len = 0;
- }
-
- /**
- * This reader accepts all responses.
- */
- public boolean accept(Request request, Response response)
- {
- return true;
- }
-
- public void read(byte[] buffer, int offset, int length)
- {
- int l = length - offset;
- if (pos + l > content.length)
- {
- byte[] tmp = new byte[content.length * 2];
- System.arraycopy(content, 0, tmp, 0, pos);
- content = tmp;
- }
- System.arraycopy(buffer, offset, content, pos, l);
- pos += l;
- len = pos;
- }
-
- public void close()
- {
- pos = 0;
- }
-
- /**
- * Retrieves the content of this reader as a byte array.
- * The size of the returned array is the number of bytes read.
- */
- public byte[] toByteArray()
- {
- byte[] ret = new byte[len];
- System.arraycopy(content, 0, ret, 0, len);
- return ret;
- }
-
-}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java b/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java
index c0706b70840..a4487d146e8 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java
@@ -110,7 +110,7 @@ public class ChunkedInputStream
// Read chunk header
int c, last = 0;
boolean seenSemi = false;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
do
{
c = in.read();
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Cookie.java b/libjava/classpath/gnu/java/net/protocol/http/Cookie.java
index 45e2f733ff3..0be7a097e5b 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Cookie.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Cookie.java
@@ -139,7 +139,7 @@ public class Cookie
public String toString(boolean showPath, boolean showDomain)
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(name);
buf.append('=');
buf.append(value);
diff --git a/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java
index 6d9f447a2ac..573a7918d82 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java
@@ -41,10 +41,6 @@ package gnu.java.net.protocol.http;
import gnu.classpath.Configuration;
import gnu.classpath.SystemProperties;
import gnu.java.net.EmptyX509TrustManager;
-import gnu.java.net.protocol.http.event.ConnectionEvent;
-import gnu.java.net.protocol.http.event.ConnectionListener;
-import gnu.java.net.protocol.http.event.RequestEvent;
-import gnu.java.net.protocol.http.event.RequestListener;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
@@ -57,6 +53,7 @@ import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -131,8 +128,6 @@ public class HTTPConnection
*/
protected int minorVersion;
- private final List connectionListeners;
- private final List requestListeners;
private final List handshakeCompletedListeners;
/**
@@ -165,6 +160,12 @@ public class HTTPConnection
*/
protected CookieManager cookieManager;
+
+ /**
+ * The pool that this connection is a member of (if any).
+ */
+ private LinkedHashMap pool;
+
/**
* Creates a new HTTP connection.
* @param hostname the name of the host to connect to
@@ -236,8 +237,6 @@ public class HTTPConnection
this.connectionTimeout = connectionTimeout;
this.timeout = timeout;
majorVersion = minorVersion = 1;
- connectionListeners = new ArrayList(4);
- requestListeners = new ArrayList(4);
handshakeCompletedListeners = new ArrayList(2);
}
@@ -332,6 +331,73 @@ public class HTTPConnection
}
/**
+ * The number of times this HTTPConnection has be used via keep-alive.
+ */
+ int useCount;
+
+ /**
+ * Generates a key for connections in the connection pool.
+ *
+ * @param h the host name.
+ * @param p the port.
+ * @param sec true if using https.
+ *
+ * @return the key.
+ */
+ static Object getPoolKey(String h, int p, boolean sec)
+ {
+ StringBuilder buf = new StringBuilder(sec ? "https://" : "http://");
+ buf.append(h);
+ buf.append(':');
+ buf.append(p);
+ return buf.toString();
+ }
+
+ /**
+ * Set the connection pool that this HTTPConnection is a member of.
+ * If left unset or set to null, it will not be a member of any pool
+ * and will not be a candidate for reuse.
+ *
+ * @param p the pool.
+ */
+ void setPool(LinkedHashMap p)
+ {
+ pool = p;
+ }
+
+ /**
+ * Signal that this HTTPConnection is no longer needed and can be
+ * returned to the connection pool.
+ *
+ */
+ void release()
+ {
+ if (pool != null)
+ {
+ synchronized (pool)
+ {
+ useCount++;
+ Object key = HTTPConnection.getPoolKey(hostname, port, secure);
+ pool.put(key, this);
+ while (pool.size() >= HTTPURLConnection.maxConnections)
+ {
+ // maxConnections must always be >= 1
+ Object lru = pool.keySet().iterator().next();
+ HTTPConnection c = (HTTPConnection)pool.remove(lru);
+ try
+ {
+ c.closeConnection();
+ }
+ catch (IOException ioe)
+ {
+ // Ignore it. We are just cleaning up.
+ }
+ }
+ }
+ }
+ }
+
+ /**
* Creates a new request using this connection.
* @param method the HTTP method to invoke
* @param path the URI-escaped RFC2396 <code>abs_path</code> with
@@ -367,7 +433,7 @@ public class HTTPConnection
Cookie[] cookies = cookieManager.getCookies(hostname, secure, path);
if (cookies != null && cookies.length > 0)
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append("$Version=1");
for (int i = 0; i < cookies.length; i++)
{
@@ -378,7 +444,6 @@ public class HTTPConnection
ret.setHeader("Cookie", buf.toString());
}
}
- fireRequestEvent(RequestEvent.REQUEST_CREATED, ret);
return ret;
}
@@ -388,14 +453,7 @@ public class HTTPConnection
public void close()
throws IOException
{
- try
- {
- closeConnection();
- }
- finally
- {
- fireConnectionEvent(ConnectionEvent.CONNECTION_CLOSED);
- }
+ closeConnection();
}
/**
@@ -534,7 +592,7 @@ public class HTTPConnection
*/
protected String getURI()
{
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(secure ? "https://" : "http://");
buf.append(hostname);
if (secure)
@@ -584,84 +642,6 @@ public class HTTPConnection
// -- Events --
- public void addConnectionListener(ConnectionListener l)
- {
- synchronized (connectionListeners)
- {
- connectionListeners.add(l);
- }
- }
-
- public void removeConnectionListener(ConnectionListener l)
- {
- synchronized (connectionListeners)
- {
- connectionListeners.remove(l);
- }
- }
-
- protected void fireConnectionEvent(int type)
- {
- ConnectionEvent event = new ConnectionEvent(this, type);
- ConnectionListener[] l = null;
- synchronized (connectionListeners)
- {
- l = new ConnectionListener[connectionListeners.size()];
- connectionListeners.toArray(l);
- }
- for (int i = 0; i < l.length; i++)
- {
- switch (type)
- {
- case ConnectionEvent.CONNECTION_CLOSED:
- l[i].connectionClosed(event);
- break;
- }
- }
- }
-
- public void addRequestListener(RequestListener l)
- {
- synchronized (requestListeners)
- {
- requestListeners.add(l);
- }
- }
-
- public void removeRequestListener(RequestListener l)
- {
- synchronized (requestListeners)
- {
- requestListeners.remove(l);
- }
- }
-
- protected void fireRequestEvent(int type, Request request)
- {
- RequestEvent event = new RequestEvent(this, type, request);
- RequestListener[] l = null;
- synchronized (requestListeners)
- {
- l = new RequestListener[requestListeners.size()];
- requestListeners.toArray(l);
- }
- for (int i = 0; i < l.length; i++)
- {
- switch (type)
- {
- case RequestEvent.REQUEST_CREATED:
- l[i].requestCreated(event);
- break;
- case RequestEvent.REQUEST_SENDING:
- l[i].requestSent(event);
- break;
- case RequestEvent.REQUEST_SENT:
- l[i].requestSent(event);
- break;
- }
- }
- }
-
void addHandshakeCompletedListener(HandshakeCompletedListener l)
{
synchronized (handshakeCompletedListeners)
diff --git a/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
index 9f2055fe658..d5da7d61ae4 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.java.net.protocol.http;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -75,7 +74,8 @@ public class HTTPURLConnection
/**
* Pool of reusable connections, used if keepAlive is true.
*/
- private static final Map connectionPool = new LinkedHashMap();
+ private static final LinkedHashMap connectionPool = new LinkedHashMap();
+ static int maxConnections;
/*
* The underlying connection.
@@ -87,7 +87,6 @@ public class HTTPURLConnection
int proxyPort;
String agent;
boolean keepAlive;
- int maxConnections;
private Request request;
private Headers requestHeaders;
@@ -95,8 +94,8 @@ public class HTTPURLConnection
private boolean requestMethodSetExplicitly;
private Response response;
- private ByteArrayInputStream responseSink;
- private ByteArrayInputStream errorSink;
+ private InputStream responseSink;
+ private InputStream errorSink;
private HandshakeCompletedEvent handshakeEvent;
@@ -202,34 +201,59 @@ public class HTTPURLConnection
}
connection.setProxy(proxyHostname, proxyPort);
}
- request = connection.newRequest(method, file);
- if (!keepAlive)
- {
- request.setHeader("Connection", "close");
- }
- if (agent != null)
- {
- request.setHeader("User-Agent", agent);
- }
- request.getHeaders().putAll(requestHeaders);
- if (requestSink != null)
+ try
{
- byte[] content = requestSink.toByteArray();
- RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content);
- request.setRequestBodyWriter(writer);
+ request = connection.newRequest(method, file);
+ if (!keepAlive)
+ {
+ request.setHeader("Connection", "close");
+ }
+ if (agent != null)
+ {
+ request.setHeader("User-Agent", agent);
+ }
+ request.getHeaders().putAll(requestHeaders);
+ if (requestSink != null)
+ {
+ byte[] content = requestSink.toByteArray();
+ RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content);
+ request.setRequestBodyWriter(writer);
+ }
+ if (creds != null)
+ {
+ request.setAuthenticator(new Authenticator() {
+ public Credentials getCredentials(String realm, int attempts)
+ {
+ return (attempts < 2) ? creds : null;
+ }
+ });
+ }
+ response = request.dispatch();
}
- ByteArrayResponseBodyReader reader = new ByteArrayResponseBodyReader();
- request.setResponseBodyReader(reader);
- if (creds != null)
+ catch (IOException ioe)
{
- request.setAuthenticator(new Authenticator() {
- public Credentials getCredentials(String realm, int attempts)
+ if (connection.useCount > 0)
+ {
+ // Connection re-use failed: Try a new connection.
+ try
+ {
+ connection.close();
+ }
+ catch (IOException _)
+ {
+ // Ignore.
+ }
+ connection = null;
+ retry = true;
+ continue;
+ }
+ else
{
- return (attempts < 2) ? creds : null;
+ // First time the connection was used: Hard failure.
+ throw ioe;
}
- });
}
- response = request.dispatch();
+
if (response.getCodeClass() == 3 && getInstanceFollowRedirects())
{
// Follow redirect
@@ -307,7 +331,8 @@ public class HTTPURLConnection
}
else
{
- responseSink = new ByteArrayInputStream(reader.toByteArray ());
+ responseSink = response.getBody();
+
if (response.getCode() == 404)
{
errorSink = responseSink;
@@ -328,27 +353,14 @@ public class HTTPURLConnection
HTTPConnection connection;
if (keepAlive)
{
- StringBuffer buf = new StringBuffer(secure ? "https://" : "http://");
- buf.append(Thread.currentThread().hashCode());
- buf.append('@');
- buf.append(host);
- buf.append(':');
- buf.append(port);
- String key = buf.toString();
+ Object key = HTTPConnection.getPoolKey(host, port, secure);
synchronized (connectionPool)
{
- connection = (HTTPConnection) connectionPool.get(key);
+ connection = (HTTPConnection) connectionPool.remove(key);
if (connection == null)
{
connection = new HTTPConnection(host, port, secure);
- // Good housekeeping
- if (connectionPool.size() == maxConnections)
- {
- // maxConnections must always be >= 1
- Object lru = connectionPool.keySet().iterator().next();
- connectionPool.remove(lru);
- }
- connectionPool.put(key, connection);
+ connection.setPool(connectionPool);
}
}
}
@@ -502,9 +514,9 @@ public class HTTPURLConnection
return null;
}
}
- Map headers = response.getHeaders();
- Map ret = new LinkedHashMap();
- ret.put("", Collections.singletonList(getStatusLine(response)));
+ Headers headers = response.getHeaders();
+ LinkedHashMap ret = new LinkedHashMap();
+ ret.put(null, Collections.singletonList(getStatusLine(response)));
for (Iterator i = headers.entrySet().iterator(); i.hasNext(); )
{
Map.Entry entry = (Map.Entry) i.next();
@@ -512,7 +524,7 @@ public class HTTPURLConnection
String value = (String) entry.getValue();
ret.put(key, Collections.singletonList(value));
}
- return ret;
+ return Collections.unmodifiableMap(ret);
}
String getStatusLine(Response response)
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Headers.java b/libjava/classpath/gnu/java/net/protocol/http/Headers.java
index 847ebefc1f6..9306fc411c9 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Headers.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Headers.java
@@ -60,7 +60,7 @@ import java.util.Set;
* @author Chris Burdess (dog@gnu.org)
*/
public class Headers
- implements Map
+ extends LinkedHashMap
{
static final DateFormat dateFormat = new HTTPDateFormat();
@@ -143,36 +143,18 @@ public class Headers
}
- private LinkedHashMap headers;
-
public Headers()
{
- headers = new LinkedHashMap();
- }
-
- public int size()
- {
- return headers.size();
- }
-
- public boolean isEmpty()
- {
- return headers.isEmpty();
}
public boolean containsKey(Object key)
{
- return headers.containsKey(new Header((String) key));
- }
-
- public boolean containsValue(Object value)
- {
- return headers.containsValue(value);
+ return super.containsKey(new Header((String) key));
}
public Object get(Object key)
{
- return headers.get(new Header((String) key));
+ return super.get(new Header((String) key));
}
/**
@@ -180,7 +162,7 @@ public class Headers
*/
public String getValue(String header)
{
- return (String) headers.get(new Header(header));
+ return (String) super.get(new Header(header));
}
/**
@@ -205,6 +187,27 @@ public class Headers
}
/**
+ * Returns the value of the specified header as a long, or -1 if the
+ * header is not present or cannot be parsed as a long.
+ */
+ public long getLongValue(String header)
+ {
+ String val = getValue(header);
+ if (val == null)
+ {
+ return -1;
+ }
+ try
+ {
+ return Long.parseLong(val);
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ return -1;
+ }
+
+ /**
* Returns the value of the specified header as a date,
* or <code>null</code> if the header is not present or not a date.
*/
@@ -227,12 +230,12 @@ public class Headers
public Object put(Object key, Object value)
{
- return headers.put(new Header((String) key), value);
+ return super.put(new Header((String) key), value);
}
public Object remove(Object key)
{
- return headers.remove(new Header((String) key));
+ return super.remove(new Header((String) key));
}
public void putAll(Map t)
@@ -241,18 +244,13 @@ public class Headers
{
String key = (String) i.next();
String value = (String) t.get(key);
- headers.put(new Header(key), value);
+ put(key, value);
}
}
- public void clear()
- {
- headers.clear();
- }
-
public Set keySet()
{
- Set keys = headers.keySet();
+ Set keys = super.keySet();
Set ret = new LinkedHashSet();
for (Iterator i = keys.iterator(); i.hasNext(); )
{
@@ -261,14 +259,9 @@ public class Headers
return ret;
}
- public Collection values()
- {
- return headers.values();
- }
-
public Set entrySet()
{
- Set entries = headers.entrySet();
+ Set entries = super.entrySet();
Set ret = new LinkedHashSet();
for (Iterator i = entries.iterator(); i.hasNext(); )
{
@@ -278,16 +271,6 @@ public class Headers
return ret;
}
- public boolean equals(Object other)
- {
- return headers.equals(other);
- }
-
- public int hashCode()
- {
- return headers.hashCode();
- }
-
/**
* Parse the specified input stream, adding headers to this collection.
*/
@@ -298,7 +281,7 @@ public class Headers
(LineInputStream) in : new LineInputStream(in);
String name = null;
- StringBuffer value = new StringBuffer();
+ StringBuilder value = new StringBuilder();
while (true)
{
String line = lin.readLine();
@@ -354,14 +337,14 @@ public class Headers
private void addValue(String name, String value)
{
Header key = new Header(name);
- String old = (String) headers.get(key);
+ String old = (String) super.get(key);
if (old == null)
{
- headers.put(key, value);
+ super.put(key, value);
}
else
{
- headers.put(key, old + ", " + value);
+ super.put(key, old + ", " + value);
}
}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java b/libjava/classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java
new file mode 100644
index 00000000000..16cf56a2919
--- /dev/null
+++ b/libjava/classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java
@@ -0,0 +1,220 @@
+/* LimitedLengthInputStream.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.net.protocol.http;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * InputStream that limits the total number of bytes that can be read
+ * from an underlying stream. In addition to limiting the number of
+ * bytes read, close() is not propagated to the underlying stream.
+ *
+ * @author David Daney (ddaney@avtrex.com)
+ */
+class LimitedLengthInputStream
+ extends InputStream
+{
+ private long remainingLen;
+ private boolean restrictLen;
+ private HTTPConnection connection;
+ private boolean eof;
+ private InputStream in;
+ private boolean doClose;
+
+
+ private void handleClose()
+ throws IOException
+ {
+ eof = true;
+ if (doClose)
+ {
+ in.close();
+ }
+ else
+ {
+ connection.release();
+ }
+ in = null;
+ connection = null;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param in the underlying stream
+ *
+ * @param maxLen the maximum number of bytes to read
+ *
+ * @param restrictLen if true the number of bytes that can be read
+ * from this stream will be limited to maxLen, otherwise the number
+ * of bytes is not restricted.
+ *
+ * @param con the HTTPConnection associated with this stream
+ *
+ * @param doClose if true con will be closed when finished reading,
+ * else it will be placed back in the connection pool.
+ *
+ */
+ LimitedLengthInputStream(InputStream in,
+ long maxLen,
+ boolean restrictLen,
+ HTTPConnection con,
+ boolean doClose)
+ throws IOException
+
+ {
+ this.in = in;
+ this.remainingLen = maxLen;
+ this.restrictLen = restrictLen;
+ this.connection = con;
+ this.doClose = doClose;
+
+ if (restrictLen)
+ {
+ if (maxLen < 0)
+ throw new IllegalArgumentException();
+ else if (maxLen == 0)
+ handleClose(); // Nothing to do, release the connection.
+ }
+ }
+
+ public synchronized int read()
+ throws IOException
+ {
+ if (eof)
+ return -1; // EOF
+
+ int r;
+
+ if (restrictLen)
+ {
+ r = in.read();
+ if (-1 != r)
+ remainingLen--;
+
+ if (0 == remainingLen)
+ handleClose();
+ }
+ else
+ {
+ r = in.read();
+ if (r == -1)
+ handleClose();
+ }
+
+ return r;
+ }
+
+ public int read(byte[] buffer)
+ throws IOException
+ {
+ return read(buffer, 0, buffer.length);
+ }
+
+ public synchronized int read(byte[] buffer, int offset, int length)
+ throws IOException
+ {
+ if (eof)
+ return -1; // EOF
+
+ if (restrictLen && length > remainingLen)
+ length = (int) remainingLen;
+
+ int r = in.read(buffer, offset, length);
+
+ if (-1 == r)
+ handleClose();
+
+ if (restrictLen && r > 0)
+ {
+ remainingLen -= r;
+ if (0 == remainingLen)
+ handleClose();
+ }
+ return r;
+ }
+
+ public synchronized long skip(long n)
+ throws IOException
+ {
+
+ if (eof)
+ return 0;
+
+ if (restrictLen && n > remainingLen)
+ n = remainingLen;
+
+ long r = in.skip(n);
+
+ if (restrictLen)
+ {
+ remainingLen -= r;
+ if (0 == remainingLen)
+ handleClose();
+ }
+ return r;
+ }
+
+ public synchronized int available()
+ throws IOException
+ {
+ if (eof)
+ return 0;
+
+ int a = in.available();
+ if (restrictLen && a > remainingLen)
+ a = (int)remainingLen;
+ return a;
+ }
+
+ public synchronized void close()
+ throws IOException
+ {
+ if (eof)
+ return;
+
+ // If we get to here, the stream was not fully read. Just throw
+ // it away.
+
+ doClose = true;
+
+ handleClose();
+ }
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Request.java b/libjava/classpath/gnu/java/net/protocol/http/Request.java
index 21205e6bba8..b9441b3f736 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Request.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Request.java
@@ -1,5 +1,5 @@
/* Request.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,6 @@ package gnu.java.net.protocol.http;
import gnu.java.net.BASE64;
import gnu.java.net.LineInputStream;
-import gnu.java.net.protocol.http.event.RequestEvent;
import java.io.IOException;
import java.io.InputStream;
@@ -100,11 +99,6 @@ public class Request
protected int requestBodyNegotiationThreshold;
/**
- * The response body reader.
- */
- protected ResponseBodyReader responseBodyReader;
-
- /**
* Map of response header handlers.
*/
protected Map responseHeaderHandlers;
@@ -236,16 +230,6 @@ public class Request
}
/**
- * Sets the response body reader.
- * @param responseBodyReader the handler to receive notifications of
- * response body content
- */
- public void setResponseBodyReader(ResponseBodyReader responseBodyReader)
- {
- this.responseBodyReader = responseBodyReader;
- }
-
- /**
* Sets a callback handler to be invoked for the specified header name.
* @param name the header name
* @param handler the handler to receive the value for the header
@@ -324,13 +308,10 @@ public class Request
do
{
retry = false;
- // Send request
- connection.fireRequestEvent(RequestEvent.REQUEST_SENDING, this);
// Get socket output and input streams
OutputStream out = connection.getOutputStream();
- LineInputStream in =
- new LineInputStream(connection.getInputStream());
+
// Request line
String requestUri = path;
if (connection.isUsingProxy() &&
@@ -369,28 +350,42 @@ public class Request
count += len;
}
while (len > -1 && count < contentLength);
- out.write(CRLF.getBytes(US_ASCII));
}
out.flush();
- // Sent event
- connection.fireRequestEvent(RequestEvent.REQUEST_SENT, this);
// Get response
- response = readResponse(in);
- int sc = response.getCode();
- if (sc == 401 && authenticator != null)
- {
- if (authenticate(response, attempts++))
- {
- retry = true;
- }
- }
- else if (sc == 100 && expectingContinue)
- {
- requestHeaders.remove("Expect");
- setHeader("Content-Length", Integer.toString(contentLength));
- expectingContinue = false;
- retry = true;
- }
+ while(true)
+ {
+ response = readResponse(connection.getInputStream());
+ int sc = response.getCode();
+ if (sc == 401 && authenticator != null)
+ {
+ if (authenticate(response, attempts++))
+ {
+ retry = true;
+ }
+ }
+ else if (sc == 100)
+ {
+ if (expectingContinue)
+ {
+ requestHeaders.remove("Expect");
+ setHeader("Content-Length",
+ Integer.toString(contentLength));
+ expectingContinue = false;
+ retry = true;
+ }
+ else
+ {
+ // A conforming server can send an unsoliceted
+ // Continue response but *should* not (RFC 2616
+ // sec 8.2.3). Ignore the bogus Continue
+ // response and get the real response that
+ // should follow
+ continue;
+ }
+ }
+ break;
+ }
}
while (retry);
}
@@ -402,14 +397,16 @@ public class Request
return response;
}
- Response readResponse(LineInputStream in)
+ Response readResponse(InputStream in)
throws IOException
{
String line;
int len;
// Read response status line
- line = in.readLine();
+ LineInputStream lis = new LineInputStream(in);
+
+ line = lis.readLine();
if (line == null)
{
throw new ProtocolException("Peer closed connection");
@@ -438,30 +435,25 @@ public class Request
String message = line.substring(end + 1, len - 1);
// Read response headers
Headers responseHeaders = new Headers();
- responseHeaders.parse(in);
+ responseHeaders.parse(lis);
notifyHeaderHandlers(responseHeaders);
- // Construct response
- int codeClass = code / 100;
- Response ret = new Response(majorVersion, minorVersion, code,
- codeClass, message, responseHeaders);
+ InputStream body = null;
+
switch (code)
{
+ case 100:
case 204:
case 205:
case 304:
break;
default:
- // Does response body reader want body?
- boolean notify = (responseBodyReader != null);
- if (notify)
- {
- if (!responseBodyReader.accept(this, ret))
- {
- notify = false;
- }
- }
- readResponseBody(ret, in, notify);
+ body = createResponseBodyStream(responseHeaders, majorVersion,
+ minorVersion, in);
}
+
+ // Construct response
+ Response ret = new Response(majorVersion, minorVersion, code,
+ message, responseHeaders, body);
return ret;
}
@@ -487,25 +479,40 @@ public class Request
}
}
- void readResponseBody(Response response, InputStream in,
- boolean notify)
+ private InputStream createResponseBodyStream(Headers responseHeaders,
+ int majorVersion,
+ int minorVersion,
+ InputStream in)
throws IOException
{
- byte[] buffer = new byte[4096];
- int contentLength = -1;
+ long contentLength = -1;
Headers trailer = null;
- String transferCoding = response.getHeader("Transfer-Encoding");
+ // Persistent connections are the default in HTTP/1.1
+ boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) ||
+ "close".equalsIgnoreCase(responseHeaders.getValue("Connection")) ||
+ (connection.majorVersion == 1 && connection.minorVersion == 0) ||
+ (majorVersion == 1 && minorVersion == 0);
+
+ String transferCoding = responseHeaders.getValue("Transfer-Encoding");
if ("chunked".equalsIgnoreCase(transferCoding))
{
- trailer = new Headers();
- in = new ChunkedInputStream(in, trailer);
+ in = new LimitedLengthInputStream(in, -1, false, connection, doClose);
+
+ in = new ChunkedInputStream(in, responseHeaders);
}
else
{
- contentLength = response.getIntHeader("Content-Length");
+ contentLength = responseHeaders.getLongValue("Content-Length");
+
+ if (contentLength < 0)
+ doClose = true; // No Content-Length, must close.
+
+ in = new LimitedLengthInputStream(in, contentLength,
+ contentLength >= 0,
+ connection, doClose);
}
- String contentCoding = response.getHeader("Content-Encoding");
+ String contentCoding = responseHeaders.getValue("Content-Encoding");
if (contentCoding != null && !"identity".equals(contentCoding))
{
if ("gzip".equals(contentCoding))
@@ -522,51 +529,7 @@ public class Request
contentCoding);
}
}
-
- // Persistent connections are the default in HTTP/1.1
- boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) ||
- "close".equalsIgnoreCase(response.getHeader("Connection")) ||
- (connection.majorVersion == 1 && connection.minorVersion == 0) ||
- (response.majorVersion == 1 && response.minorVersion == 0);
-
- int count = contentLength;
- int len = (count > -1) ? count : buffer.length;
- len = (len > buffer.length) ? buffer.length : len;
- while (len > -1)
- {
- len = in.read(buffer, 0, len);
- if (len < 0)
- {
- // EOF
- connection.closeConnection();
- break;
- }
- if (notify)
- {
- responseBodyReader.read(buffer, 0, len);
- }
- if (count > -1)
- {
- count -= len;
- if (count < 1)
- {
- if (doClose)
- {
- connection.closeConnection();
- }
- break;
- }
- }
- }
- if (notify)
- {
- responseBodyReader.close();
- }
- if (trailer != null)
- {
- response.getHeaders().putAll(trailer);
- notifyHeaderHandlers(trailer);
- }
+ return in;
}
boolean authenticate(Response response, int attempts)
@@ -686,7 +649,7 @@ public class Request
{
int len = text.length();
String key = null;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
Properties ret = new Properties();
boolean inQuote = false;
for (int i = 0; i < len; i++)
@@ -739,7 +702,7 @@ public class Request
{
int nc = connection.getNonceCount(nonce);
String hex = Integer.toHexString(nc);
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for (int i = 8 - hex.length(); i > 0; i--)
{
buf.append('0');
@@ -810,7 +773,7 @@ public class Request
int len = text.length();
String attr = null;
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
boolean inQuote = false;
for (int i = 0; i <= len; i++)
{
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Response.java b/libjava/classpath/gnu/java/net/protocol/http/Response.java
index 29dc28b17d3..58d74542c30 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Response.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Response.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.net.protocol.http;
+import java.io.InputStream;
import java.util.Date;
/**
@@ -64,19 +65,6 @@ public class Response
protected final int code;
/**
- * The class of the response. This is the most significant digit of the
- * status code.
- * <dl>
- * <dt><code>1xx</code></dt> <dd>Informational response</dd>
- * <dt><code>2xx</code></dt> <dd>Success</dd>
- * <dt><code>3xx</code></dt> <dd>Redirection</dd>
- * <dt><code>4xx</code></dt> <dd>Client error</dd>
- * <dt><code>5xx</code></dt> <dd>Server error</dd>
- * </dl>
- */
- protected final int codeClass;
-
- /**
* Human-readable text of the response.
*/
protected final String message;
@@ -87,18 +75,22 @@ public class Response
protected final Headers headers;
/**
+ * An InputStream that returns the body of the response.
+ */
+ protected final InputStream body;
+
+ /**
* Constructs a new response with the specified parameters.
*/
protected Response(int majorVersion, int minorVersion, int code,
- int codeClass, String message,
- Headers headers)
+ String message, Headers headers, InputStream body)
{
this.majorVersion = majorVersion;
this.minorVersion = minorVersion;
this.code = code;
- this.codeClass = codeClass;
this.message = message;
this.headers = headers;
+ this.body = body;
}
/**
@@ -129,12 +121,19 @@ public class Response
}
/**
- * Returns the class of the response.
- * @see #codeClass
+ * Returns the class of the response. This is the most significant
+ * digit of the status code.
+ * <dl>
+ * <dt><code>1xx</code></dt> <dd>Informational response</dd>
+ * <dt><code>2xx</code></dt> <dd>Success</dd>
+ * <dt><code>3xx</code></dt> <dd>Redirection</dd>
+ * <dt><code>4xx</code></dt> <dd>Client error</dd>
+ * <dt><code>5xx</code></dt> <dd>Server error</dd>
+ * </dl>
*/
public int getCodeClass()
{
- return codeClass;
+ return code / 100;
}
/**
@@ -173,6 +172,15 @@ public class Response
}
/**
+ * Returns the header value for the specified name as a long.
+ * @param name the header name
+ */
+ public long getLongHeader(String name)
+ {
+ return headers.getLongValue(name);
+ }
+
+ /**
* Returns the header value for the specified name as a date.
* @param name the header name
*/
@@ -181,5 +189,14 @@ public class Response
return headers.getDateValue(name);
}
+ /**
+ * Returns an InputStream that returns the body of the response.
+ *
+ * @return the body of the response
+ */
+ public InputStream getBody()
+ {
+ return body;
+ }
}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/ResponseBodyReader.java b/libjava/classpath/gnu/java/net/protocol/http/ResponseBodyReader.java
deleted file mode 100644
index 49e1b376f0f..00000000000
--- a/libjava/classpath/gnu/java/net/protocol/http/ResponseBodyReader.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ResponseBodyReader.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http;
-
-/**
- * Callback interface for receiving notification of response body content.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface ResponseBodyReader
-{
-
- /**
- * Indicate whether this reader is interested in the specified response.
- * If it returns false, it will not receive body content notifications for
- * that response.
- */
- boolean accept(Request request, Response response);
-
- /**
- * Receive notification of body content.
- * @param buffer the content buffer
- * @param offset the offset within the buffer that content starts
- * @param length the length of the content
- */
- void read(byte[] buffer, int offset, int length);
-
- /**
- * Notifies the reader that the end of the content was reached.
- */
- void close();
-
-}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/RequestListener.java b/libjava/classpath/gnu/java/net/protocol/http/event/RequestListener.java
deleted file mode 100644
index c880fbce6f0..00000000000
--- a/libjava/classpath/gnu/java/net/protocol/http/event/RequestListener.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/* RequestListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.java.net.protocol.http.event;
-
-import java.util.EventListener;
-
-/**
- * A request listener.
- *
- * @author Chris Burdess (dog@gnu.org)
- */
-public interface RequestListener
- extends EventListener
-{
-
- /**
- * Callback invoked when a request is created from the associated
- * connection.
- */
- void requestCreated(RequestEvent event);
-
- /**
- * Callback invoked when the request has been initialised with all data
- * and before sending this data to the server.
- */
- void requestSending(RequestEvent event);
-
- /**
- * Callback invoked after all request data has been sent to the server.
- */
- void requestSent(RequestEvent event);
-
-}
-
diff --git a/libjava/classpath/gnu/java/net/protocol/jar/Connection.java b/libjava/classpath/gnu/java/net/protocol/jar/Connection.java
index bd7a80da739..e2a052ef581 100644
--- a/libjava/classpath/gnu/java/net/protocol/jar/Connection.java
+++ b/libjava/classpath/gnu/java/net/protocol/jar/Connection.java
@@ -47,7 +47,10 @@ import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.net.URLConnection;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.Hashtable;
+import java.util.Locale;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.zip.ZipFile;
@@ -60,6 +63,12 @@ import java.util.zip.ZipFile;
*/
public final class Connection extends JarURLConnection
{
+ /**
+ * HTTP-style DateFormat, used to format the last-modified header.
+ * Lazy initialized since jar files are used during bootstrapping.
+ */
+ private static SimpleDateFormat dateFormat;
+
private JarFile jar_file;
private JarEntry jar_entry;
private URL jar_url;
@@ -69,16 +78,22 @@ public final class Connection extends JarURLConnection
private static Hashtable cache = new Hashtable();
private static final int READBUFSIZE = 4*1024;
- public static synchronized JarFile get (URL url) throws IOException
+ public static synchronized JarFile get (URL url, boolean useCaches)
+ throws IOException
{
- JarFile jf = (JarFile) cache.get (url);
+ JarFile jf;
+ if (useCaches)
+ {
+ jf = (JarFile) cache.get (url);
+ if (jf != null)
+ return jf;
+ }
- if (jf != null)
- return jf;
-
if ("file".equals (url.getProtocol()))
{
- File f = new File (url.getFile());
+ String fn = url.getFile();
+ fn = gnu.java.net.protocol.file.Connection.unquote(fn);
+ File f = new File (fn);
jf = new JarFile (f, true, ZipFile.OPEN_READ);
}
else
@@ -100,9 +115,10 @@ public final class Connection extends JarURLConnection
jf = new JarFile (f, true,
ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
}
-
- cache.put (url, jf);
-
+
+ if (useCaches)
+ cache.put (url, jf);
+
return jf;
}
}
@@ -120,7 +136,7 @@ public final class Connection extends JarURLConnection
return;
jar_url = getJarFileURL();
- jar_file = JarFileCache.get (jar_url);
+ jar_file = JarFileCache.get (jar_url, useCaches);
String entry_name = getEntryName();
if (entry_name != null
@@ -160,6 +176,38 @@ public final class Connection extends JarURLConnection
return jar_file;
}
+ public String getHeaderField(String field)
+ {
+ try
+ {
+ if (!connected)
+ connect();
+
+ if (field.equals("content-type"))
+ return guessContentTypeFromName(getJarEntry().getName());
+ else if (field.equals("content-length"))
+ return Long.toString(getJarEntry().getSize());
+ else if (field.equals("last-modified"))
+ {
+ // Both creating and manipulating dateFormat need synchronization.
+ synchronized (this.getClass())
+ {
+ if (dateFormat == null)
+ dateFormat = new SimpleDateFormat
+ ("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
+ new Locale ("En", "Us", "Unix"));
+
+ return dateFormat.format(new Date(getJarEntry().getTime()));
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ // Fall through.
+ }
+ return null;
+ }
+
public int getContentLength()
{
if (!connected)
@@ -167,4 +215,19 @@ public final class Connection extends JarURLConnection
return (int) jar_entry.getSize();
}
+
+ public long getLastModified()
+ {
+ if (!connected)
+ return -1;
+
+ try
+ {
+ return getJarEntry().getTime();
+ }
+ catch (IOException e)
+ {
+ return -1;
+ }
+ }
}
diff --git a/libjava/classpath/gnu/java/nio/SocketChannelImpl.java b/libjava/classpath/gnu/java/nio/SocketChannelImpl.java
index 9fb71c1ae1c..fcddbd6c351 100644
--- a/libjava/classpath/gnu/java/nio/SocketChannelImpl.java
+++ b/libjava/classpath/gnu/java/nio/SocketChannelImpl.java
@@ -258,7 +258,7 @@ public final class SocketChannelImpl extends SocketChannel
}
else
{
- dst.put (data, offset, len);
+ dst.put (data, offset, readBytes);
}
return readBytes;
diff --git a/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java b/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java
index 0ee5d3fc287..466f3dd5587 100644
--- a/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java
+++ b/libjava/classpath/gnu/java/nio/channels/FileChannelImpl.java
@@ -175,7 +175,8 @@ public final class FileChannelImpl extends FileChannel
*/
protected void finalize() throws IOException
{
- this.close();
+ if (fd != -1)
+ close();
}
public int read (ByteBuffer dst) throws IOException
diff --git a/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java b/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java
index e3927d99466..fa1dbc412f4 100644
--- a/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java
+++ b/libjava/classpath/gnu/java/nio/charset/UTF_16Decoder.java
@@ -54,6 +54,8 @@ final class UTF_16Decoder extends CharsetDecoder
static final int BIG_ENDIAN = 0;
static final int LITTLE_ENDIAN = 1;
static final int UNKNOWN_ENDIAN = 2;
+ static final int MAYBE_BIG_ENDIAN = 3;
+ static final int MAYBE_LITTLE_ENDIAN = 4;
private static final char BYTE_ORDER_MARK = 0xFEFF;
private static final char REVERSED_BYTE_ORDER_MARK = 0xFFFE;
@@ -81,26 +83,37 @@ final class UTF_16Decoder extends CharsetDecoder
byte b2 = in.get ();
// handle byte order mark
- if (byteOrder == UNKNOWN_ENDIAN)
+ if (byteOrder == UNKNOWN_ENDIAN ||
+ byteOrder == MAYBE_BIG_ENDIAN ||
+ byteOrder == MAYBE_LITTLE_ENDIAN)
{
char c = (char) (((b1 & 0xFF) << 8) | (b2 & 0xFF));
if (c == BYTE_ORDER_MARK)
{
+ if (byteOrder == MAYBE_LITTLE_ENDIAN)
+ {
+ return CoderResult.malformedForLength (2);
+ }
byteOrder = BIG_ENDIAN;
inPos += 2;
continue;
}
else if (c == REVERSED_BYTE_ORDER_MARK)
{
+ if (byteOrder == MAYBE_BIG_ENDIAN)
+ {
+ return CoderResult.malformedForLength (2);
+ }
byteOrder = LITTLE_ENDIAN;
inPos += 2;
continue;
}
else
{
- // assume big endian, do not consume bytes,
+ // assume big or little endian, do not consume bytes,
// continue with normal processing
- byteOrder = BIG_ENDIAN;
+ byteOrder = (byteOrder == MAYBE_LITTLE_ENDIAN ?
+ LITTLE_ENDIAN : BIG_ENDIAN);
}
}
diff --git a/libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java b/libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java
index d354e04e5de..63f2855d520 100644
--- a/libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java
+++ b/libjava/classpath/gnu/java/nio/charset/UnicodeLittle.java
@@ -64,7 +64,7 @@ final class UnicodeLittle extends Charset
public CharsetDecoder newDecoder ()
{
- return new UTF_16Decoder (this, UTF_16Decoder.UNKNOWN_ENDIAN);
+ return new UTF_16Decoder (this, UTF_16Decoder.MAYBE_LITTLE_ENDIAN);
}
public CharsetEncoder newEncoder ()
diff --git a/libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java b/libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java
index 58eaa85bac4..873e9ecda41 100644
--- a/libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java
+++ b/libjava/classpath/gnu/java/nio/charset/iconv/IconvProvider.java
@@ -62,7 +62,11 @@ public final class IconvProvider extends CharsetProvider
}
}
- private IconvProvider()
+ // Declaring the construtor public may violate the use of singleton.
+ // But it must be public so that an instance of this class can be
+ // created by Class.newInstance(), which is the case when this provider is
+ // defined in META-INF/services/java.nio.charset.spi.CharsetProvider.
+ public IconvProvider()
{
IconvMetaData.setup();
}
diff --git a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java
index b1e086a73b2..9f18d129e71 100644
--- a/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java
+++ b/libjava/classpath/gnu/java/rmi/dgc/DGCImpl_Stub.java
@@ -81,7 +81,7 @@ public final class DGCImpl_Stub
public void clean(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.VMID $param_2, boolean $param_3) throws java.rmi.RemoteException {
try {
if (useNewInvoke) {
- ref.invoke(this, $method_clean_0, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2, new java.lang.Boolean($param_3)}, -5803803475088455571L);
+ ref.invoke(this, $method_clean_0, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2, Boolean.valueOf($param_3)}, -5803803475088455571L);
}
else {
java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 0, interfaceHash);
diff --git a/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java b/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java
new file mode 100644
index 00000000000..2e1e7805531
--- /dev/null
+++ b/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java
@@ -0,0 +1,350 @@
+/* RMIClassLoaderImpl.java -- FIXME: briefly describe file purpose
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.rmi.server;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.rmi.server.RMIClassLoaderSpi;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+/**
+ * The default implementation of {@link java.rmi.server.RMIClassLoaderSpi}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class RMIClassLoaderImpl extends RMIClassLoaderSpi
+{
+ private static class MyClassLoader extends URLClassLoader
+ {
+ // Package-private to avoid a trampoline constructor.
+ MyClassLoader (URL[] urls, ClassLoader parent, String annotation)
+ {
+ super (urls, parent);
+ this.annotation = annotation;
+ }
+
+ private MyClassLoader (URL[] urls, ClassLoader parent)
+ {
+ super (urls, parent);
+ this.annotation = urlToAnnotation (urls);
+ }
+
+ public static String urlToAnnotation (URL[] urls)
+ {
+ if (urls.length == 0)
+ return null;
+
+ StringBuffer annotation = new StringBuffer (64 * urls.length);
+
+ for (int i = 0; i < urls.length; i++)
+ {
+ annotation.append (urls [i].toExternalForm());
+ annotation.append (' ');
+ }
+
+ return annotation.toString();
+ }
+
+ public final String getClassAnnotation()
+ {
+ return annotation;
+ }
+
+ private final String annotation;
+ }
+
+ /**
+ * This class is used to identify a cached classloader by its codebase and
+ * the context classloader that is its parent.
+ */
+ private static class CacheKey
+ {
+ private String mCodeBase;
+ private ClassLoader mContextClassLoader;
+
+ public CacheKey (String theCodebase, ClassLoader theContextClassLoader)
+ {
+ mCodeBase = theCodebase;
+ mContextClassLoader = theContextClassLoader;
+ }
+
+ /**
+ * @return true if the codebase and the context classloader are equal
+ */
+ public boolean equals (Object theOther)
+ {
+ if (theOther instanceof CacheKey)
+ {
+ CacheKey key = (CacheKey) theOther;
+
+ return (equals (this.mCodeBase,key.mCodeBase)
+ && equals (this.mContextClassLoader, key.mContextClassLoader));
+ }
+ return false;
+ }
+
+ /**
+ * Test if the two objects are equal or both null.
+ * @param theOne
+ * @param theOther
+ * @return
+ */
+ private boolean equals (Object theOne, Object theOther)
+ {
+ return theOne != null ? theOne.equals (theOther) : theOther == null;
+ }
+
+ /**
+ * @return hashCode
+ */
+ public int hashCode()
+ {
+ return ((mCodeBase != null ? mCodeBase.hashCode() : 0)
+ ^(mContextClassLoader != null ? mContextClassLoader.hashCode() : -1));
+ }
+
+ public String toString()
+ {
+ return "[" + mCodeBase + "," + mContextClassLoader + "]";
+ }
+
+ }
+
+ private static RMIClassLoaderImpl instance = null;
+
+ private static Map cacheLoaders; //map annotations to loaders
+ private static Map cacheAnnotations; //map loaders to annotations
+ //class loader for defaultAnnotation
+ private static MyClassLoader defaultClassLoader;
+
+ //defaultAnnotation is got from system property
+ // "java.rmi.server.defaultAnnotation"
+ private static String defaultAnnotation;
+
+ //URL object for defaultAnnotation
+ private static URL defaultCodebase;
+
+ static
+ {
+ // 89 is a nice prime number for Hashtable initial capacity
+ cacheLoaders = new Hashtable (89);
+ cacheAnnotations = new Hashtable (89);
+
+ defaultAnnotation = System.getProperty ("java.rmi.server.defaultAnnotation");
+
+ try
+ {
+ if (defaultAnnotation != null)
+ defaultCodebase = new URL (defaultAnnotation);
+ }
+ catch (Exception _)
+ {
+ defaultCodebase = null;
+ }
+
+ if (defaultCodebase != null)
+ {
+ defaultClassLoader = new MyClassLoader (new URL[] { defaultCodebase }, null,
+ defaultAnnotation);
+ cacheLoaders.put (new CacheKey (defaultAnnotation,
+ Thread.currentThread().getContextClassLoader()),
+ defaultClassLoader);
+ }
+ }
+
+ /**
+ * This is a singleton class and may only be instantiated once from within
+ * the {@link #getInstance} method.
+ */
+ private RMIClassLoaderImpl()
+ {
+ }
+
+ /**
+ * Returns an instance of RMIClassLoaderImpl.
+ *
+ * @return an instance of RMIClassLoaderImpl
+ */
+ public static RMIClassLoaderSpi getInstance()
+ {
+ if (instance == null)
+ instance = new RMIClassLoaderImpl();
+ return instance;
+ }
+
+ public Class loadClass(String codeBase, String name,
+ ClassLoader defaultLoader)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ ClassLoader loader;
+ if (defaultLoader == null)
+ loader = Thread.currentThread().getContextClassLoader();
+ else
+ loader = defaultLoader;
+
+ //try context class loader first
+ try
+ {
+ return Class.forName(name, false, loader);
+ }
+ catch (ClassNotFoundException e)
+ {
+ // class not found in the local classpath
+ }
+
+ if (codeBase.length() == 0) //==""
+ {
+ loader = defaultClassLoader;
+ }
+ else
+ {
+ loader = getClassLoader(codeBase);
+ }
+
+ if (loader == null)
+ {
+ //do not throw NullPointerException
+ throw new ClassNotFoundException ("Could not find class (" + name +
+ ") at codebase (" + codeBase + ")");
+ }
+
+ return Class.forName(name, false, loader);
+ }
+
+ public Class loadProxyClass(String codeBase, String[] interfaces,
+ ClassLoader defaultLoader)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ // FIXME: Implement this.
+ return null;
+ }
+
+ /**
+ * Gets a classloader for the given codebase and with the current
+ * context classloader as parent.
+ *
+ * @param codebase
+ *
+ * @return a classloader for the given codebase
+ *
+ * @throws MalformedURLException if the codebase contains a malformed URL
+ */
+ public ClassLoader getClassLoader(String codebase)
+ throws MalformedURLException
+ {
+ ClassLoader loader;
+ CacheKey loaderKey = new CacheKey
+ (codebase, Thread.currentThread().getContextClassLoader());
+ loader = (ClassLoader) cacheLoaders.get (loaderKey);
+
+ if (loader == null)
+ {
+ //create an entry in cacheLoaders mapping a loader to codebases.
+ // codebases are separated by " "
+ StringTokenizer tok = new StringTokenizer (codebase, " ");
+ ArrayList urls = new ArrayList();
+
+ while (tok.hasMoreTokens())
+ urls.add (new URL(tok.nextToken()));
+
+ loader = new MyClassLoader((URL[]) urls.toArray(new URL [urls.size()]),
+ Thread.currentThread().getContextClassLoader(),
+ codebase);
+ cacheLoaders.put (loaderKey, loader);
+ }
+
+ return loader;
+ }
+
+ /**
+ * Returns a string representation of the network location where a remote
+ * endpoint can get the class-definition of the given class.
+ *
+ * @param cl
+ *
+ * @return a space seperated list of URLs where the class-definition
+ * of cl may be found
+ */
+ public String getClassAnnotation(Class cl)
+ {
+ ClassLoader loader = cl.getClassLoader();
+
+ if (loader == null
+ || loader == ClassLoader.getSystemClassLoader())
+ {
+ return System.getProperty ("java.rmi.server.codebase");
+ }
+
+ if (loader instanceof MyClassLoader)
+ {
+ return ((MyClassLoader) loader).getClassAnnotation();
+ }
+
+ String s = (String) cacheAnnotations.get (loader);
+
+ if (s != null)
+ return s;
+
+ if (loader instanceof URLClassLoader)
+ {
+ URL[] urls = ((URLClassLoader) loader).getURLs();
+
+ if (urls.length == 0)
+ return null;
+
+ StringBuffer annotation = new StringBuffer (64 * urls.length);
+
+ for (int i = 0; i < urls.length; i++)
+ {
+ annotation.append (urls [i].toExternalForm());
+ annotation.append (' ');
+ }
+
+ s = annotation.toString();
+ cacheAnnotations.put (loader, s);
+ return s;
+ }
+
+ return System.getProperty ("java.rmi.server.codebase");
+ }
+}
diff --git a/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java b/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java
index 888b30bf6b6..587d57fc7bb 100644
--- a/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java
+++ b/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java
@@ -102,7 +102,7 @@ protected Class resolveProxyClass(String intfs[])
protected Object readValue(Class valueClass) throws IOException, ClassNotFoundException {
if(valueClass.isPrimitive()){
if(valueClass == Boolean.TYPE)
- return new Boolean(readBoolean());
+ return Boolean.valueOf(readBoolean());
if(valueClass == Byte.TYPE)
return new Byte(readByte());
if(valueClass == Character.TYPE)
diff --git a/libjava/classpath/gnu/java/rmi/server/UnicastServer.java b/libjava/classpath/gnu/java/rmi/server/UnicastServer.java
index 065ef8c77ee..a8da7256320 100644
--- a/libjava/classpath/gnu/java/rmi/server/UnicastServer.java
+++ b/libjava/classpath/gnu/java/rmi/server/UnicastServer.java
@@ -51,13 +51,16 @@ import java.rmi.RemoteException;
import java.rmi.ServerError;
import java.rmi.server.ObjID;
import java.rmi.server.UID;
+import java.util.Collections;
+import java.util.Map;
import java.util.Hashtable;
+import java.util.IdentityHashMap;
public class UnicastServer
implements ProtocolConstants {
static private Hashtable objects = new Hashtable(); //mapping OBJID to server ref
-static private Hashtable refcache = new Hashtable(); //mapping obj itself to server ref
+static private Map refcache = Collections.synchronizedMap(new IdentityHashMap()); //mapping obj itself to server ref
static private DGCImpl dgc;
public static void exportObject(UnicastServerRef obj) {
diff --git a/libjava/classpath/gnu/java/security/PolicyFile.java b/libjava/classpath/gnu/java/security/PolicyFile.java
index c6a3061ead2..3064f041b9d 100644
--- a/libjava/classpath/gnu/java/security/PolicyFile.java
+++ b/libjava/classpath/gnu/java/security/PolicyFile.java
@@ -533,7 +533,7 @@ public final class PolicyFile extends Policy
if (clazz == null)
{
currentPerms.add(new UnresolvedPermission(className,
- null, null, (Certificate[]) currentCerts.toArray(new Certificate[0])));
+ null, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()])));
continue;
}
try
@@ -555,7 +555,7 @@ public final class PolicyFile extends Policy
if (clazz == null)
{
currentPerms.add(new UnresolvedPermission(className,
- target, null, (Certificate[]) currentCerts.toArray(new Certificate[0])));
+ target, null, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()])));
continue;
}
try
@@ -598,7 +598,7 @@ public final class PolicyFile extends Policy
if (clazz == null)
{
currentPerms.add(new UnresolvedPermission(className,
- target, action, (Certificate[]) currentCerts.toArray(new Certificate[0])));
+ target, action, (Certificate[]) currentCerts.toArray(new Certificate[currentCerts.size()])));
continue;
}
else
diff --git a/libjava/classpath/gnu/java/security/der/BitString.java b/libjava/classpath/gnu/java/security/der/BitString.java
index b88b14541b6..02b1c037762 100644
--- a/libjava/classpath/gnu/java/security/der/BitString.java
+++ b/libjava/classpath/gnu/java/security/der/BitString.java
@@ -286,6 +286,19 @@ public class BitString implements Cloneable, Comparable
return 0; // not reached.
}
+ public int hashCode()
+ {
+ int result = 0;
+ for (int i = 0; i < bytes.length - 1; ++i)
+ result = result * 31 + bytes[i];
+ if (bytes.length > 0)
+ {
+ int lastByte = bytes[bytes.length - 1] & ~ ((1 << ignoredBits) - 1);
+ result = result * 31 + lastByte;
+ }
+ return result;
+ }
+
public boolean equals(Object o)
{
if (!(o instanceof BitString))
diff --git a/libjava/classpath/gnu/java/security/der/DERReader.java b/libjava/classpath/gnu/java/security/der/DERReader.java
index cb07f14325f..09ec1e2dff0 100644
--- a/libjava/classpath/gnu/java/security/der/DERReader.java
+++ b/libjava/classpath/gnu/java/security/der/DERReader.java
@@ -389,7 +389,7 @@ public class DERReader implements DER
Integer.parseInt(str.substring( 4, 6)), // day
Integer.parseInt(str.substring( 6, 8)), // hour
Integer.parseInt(str.substring( 8, 10))); // minute
- if (date.length() == 12);
+ if (date.length() == 12)
calendar.set(Calendar.SECOND,
Integer.parseInt(str.substring(10, 12)));
}
diff --git a/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java b/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java
new file mode 100644
index 00000000000..591fc688cc0
--- /dev/null
+++ b/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java
@@ -0,0 +1,123 @@
+/* DiffieHellmanKeyFactoryImpl.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.security.provider;
+
+import gnu.javax.crypto.GnuDHPrivateKey;
+
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.KeyFactorySpi;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.KeySpec;
+
+import javax.crypto.spec.DHParameterSpec;
+import javax.crypto.spec.DHPrivateKeySpec;
+import javax.crypto.spec.DHPublicKeySpec;
+
+import javax.crypto.interfaces.DHPrivateKey;
+import javax.crypto.interfaces.DHPublicKey;
+
+public class DiffieHellmanKeyFactoryImpl extends KeyFactorySpi
+{
+ protected PrivateKey engineGeneratePrivate (final KeySpec spec)
+ throws InvalidKeySpecException
+ {
+ if (spec instanceof DHPrivateKeySpec)
+ {
+ DHPrivateKeySpec dh = (DHPrivateKeySpec) spec;
+ return new GnuDHPrivateKey (dh.getX (),
+ new DHParameterSpec (dh.getP (), dh.getG ()));
+ }
+ throw new InvalidKeySpecException ();
+ }
+
+ protected PublicKey engineGeneratePublic (final KeySpec spec)
+ throws InvalidKeySpecException
+ {
+ if (spec instanceof DHPublicKeySpec)
+ {
+ DHPublicKeySpec dh = (DHPublicKeySpec) spec;
+ return new GnuDHPublicKey (new DHParameterSpec (dh.getP (), dh.getG ()),
+ dh.getY(), null);
+ }
+ throw new InvalidKeySpecException ();
+ }
+
+ protected KeySpec engineGetKeySpec (final Key key, final Class specClass)
+ throws InvalidKeySpecException
+ {
+ if (key instanceof DHPrivateKey)
+ {
+ if (DHPrivateKeySpec.class.isAssignableFrom (specClass))
+ {
+ DHParameterSpec params = ((DHPrivateKey) key).getParams ();
+ return new DHPrivateKeySpec (((DHPrivateKey) key).getX (),
+ params.getP (), params.getG ());
+ }
+ }
+ if (key instanceof DHPublicKey)
+ {
+ if (DHPublicKeySpec.class.isAssignableFrom (specClass))
+ {
+ DHParameterSpec params = ((DHPublicKey) key).getParams ();
+ return new DHPublicKeySpec (((DHPublicKey) key).getY (),
+ params.getP (), params.getG ());
+ }
+ }
+ throw new InvalidKeySpecException ();
+ }
+
+ protected Key engineTranslateKey (final Key key)
+ throws InvalidKeyException
+ {
+ if (key instanceof DHPrivateKey)
+ {
+ return new GnuDHPrivateKey (((DHPrivateKey) key).getX (),
+ ((DHPrivateKey) key).getParams ());
+ }
+ if (key instanceof DHPublicKey)
+ {
+ return new GnuDHPublicKey (((DHPublicKey) key).getParams (),
+ ((DHPublicKey) key).getY (), null);
+ }
+ throw new InvalidKeyException ();
+ }
+}
diff --git a/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java b/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java
new file mode 100644
index 00000000000..1b68d274fa8
--- /dev/null
+++ b/libjava/classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java
@@ -0,0 +1,86 @@
+/* DiffieHellmanKeyPairGeneratorImpl.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.security.provider;
+
+import gnu.javax.crypto.GnuDHPrivateKey;
+
+import java.math.BigInteger;
+
+import java.security.KeyPair;
+import java.security.KeyPairGeneratorSpi;
+import java.security.SecureRandom;
+import java.security.spec.AlgorithmParameterSpec;
+
+import javax.crypto.spec.DHParameterSpec;
+
+public class DiffieHellmanKeyPairGeneratorImpl extends KeyPairGeneratorSpi
+{
+ private SecureRandom random;
+ private DHParameterSpec params;
+
+ public KeyPair generateKeyPair ()
+ {
+ if (params == null || random == null)
+ throw new IllegalStateException ("not initialized");
+ byte[] buf = new byte[(params.getP ().bitLength() >>> 3)];
+ random.nextBytes (buf);
+ BigInteger x = new BigInteger (1, buf);
+ BigInteger y = params.getG ().modPow (x, params.getP ());
+ GnuDHPublicKey pub = new GnuDHPublicKey (params, y, null);
+ GnuDHPrivateKey priv = new GnuDHPrivateKey (x, params);
+
+ return new KeyPair (pub, priv);
+ }
+
+ public void initialize (final int keysize, final SecureRandom random)
+ {
+ throw new UnsupportedOperationException ("key generation without parameters not supported");
+ }
+
+ public void initialize (final AlgorithmParameterSpec params,
+ final SecureRandom random)
+ {
+ if (!(params instanceof DHParameterSpec))
+ throw new IllegalArgumentException ("expecting Diffie-Hellman parameters");
+ this.params = (DHParameterSpec) params;
+ this.random = random;
+ if (this.random == null)
+ this.random = new SecureRandom ();
+ }
+}
diff --git a/libjava/classpath/gnu/java/security/provider/Gnu.java b/libjava/classpath/gnu/java/security/provider/Gnu.java
index 849f63c1601..e553bbcbd8a 100644
--- a/libjava/classpath/gnu/java/security/provider/Gnu.java
+++ b/libjava/classpath/gnu/java/security/provider/Gnu.java
@@ -46,7 +46,7 @@ public final class Gnu extends Provider
{
public Gnu()
{
- super("GNU", 1.0, "GNU provider v1.0 implementing SHA-1, MD5, DSA, RSA, X.509 Certificates and CRLs, PKIX certificate path validators, Collection cert stores");
+ super("GNU", 1.0, "GNU provider v1.0 implementing SHA-1, MD5, DSA, RSA, X.509 Certificates and CRLs, PKIX certificate path validators, Collection cert stores, Diffie-Hellman key agreement and key pair generator");
AccessController.doPrivileged (new PrivilegedAction()
{
@@ -100,10 +100,12 @@ public final class Gnu extends Provider
// Key Pair Generator
put("KeyPairGenerator.DSA",
gnu.java.security.provider.DSAKeyPairGenerator.class.getName());
+ put("KeyPairGenerator.DiffieHellman", DiffieHellmanKeyPairGeneratorImpl.class.getName ());
put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA");
+ put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
// Key Factory
put("KeyFactory.DSA",
@@ -122,6 +124,9 @@ public final class Gnu extends Provider
put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
+ put("KeyFactory.DiffieHellman", DiffieHellmanKeyFactoryImpl.class.getName());
+ put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
+
// Message Digests
put("MessageDigest.SHA", gnu.java.security.provider.SHA.class.getName());
put("MessageDigest.MD5", gnu.java.security.provider.MD5.class.getName());
@@ -161,6 +166,14 @@ public final class Gnu extends Provider
// CertStore
put("CertStore.Collection", CollectionCertStoreImpl.class.getName());
+ // KeyAgreement
+ put("KeyAgreement.DiffieHellman", gnu.javax.crypto.DiffieHellmanImpl.class.getName());
+ put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
+
+ // Cipher
+ put("Cipher.RSAES-PKCS1-v1_5", gnu.javax.crypto.RSACipherImpl.class.getName());
+ put("Alg.Alias.Cipher.RSA", "RSAES-PKCS1-v1_5");
+
return null;
}
});
diff --git a/libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java b/libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java
index 00f7a6ed220..d8f5c6158e3 100644
--- a/libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java
+++ b/libjava/classpath/gnu/java/security/x509/ext/BasicConstraints.java
@@ -112,7 +112,7 @@ public class BasicConstraints extends Extension.Value
if (encoded == null)
{
List bc = new ArrayList (2);
- bc.add (new DERValue (DER.BOOLEAN, new Boolean (ca)));
+ bc.add (new DERValue (DER.BOOLEAN, Boolean.valueOf (ca)));
if (pathLenConstraint >= 0)
bc.add (new DERValue (DER.INTEGER,
BigInteger.valueOf ((long) pathLenConstraint)));
diff --git a/libjava/classpath/gnu/java/security/x509/ext/Extension.java b/libjava/classpath/gnu/java/security/x509/ext/Extension.java
index 5ca9ac3a91d..97097a2f380 100644
--- a/libjava/classpath/gnu/java/security/x509/ext/Extension.java
+++ b/libjava/classpath/gnu/java/security/x509/ext/Extension.java
@@ -232,7 +232,7 @@ public class Extension
{
List ext = new ArrayList (3);
ext.add (new DERValue (DER.OBJECT_IDENTIFIER, oid));
- ext.add (new DERValue (DER.BOOLEAN, new Boolean (critical)));
+ ext.add (new DERValue (DER.BOOLEAN, Boolean.valueOf (critical)));
ext.add (new DERValue (DER.OCTET_STRING, value.getEncoded()));
return new DERValue (DER.CONSTRUCTED|DER.SEQUENCE, ext);
}
@@ -274,6 +274,14 @@ public class Extension
return (byte[]) encoded;
}
+ public int hashCode()
+ {
+ int result = 0;
+ for (int i = 0; i < encoded.length; ++i)
+ result = result * 31 + encoded[i];
+ return result;
+ }
+
public boolean equals(Object o)
{
if (!(o instanceof Value))
diff --git a/libjava/classpath/gnu/java/text/BaseBreakIterator.java b/libjava/classpath/gnu/java/text/BaseBreakIterator.java
index c28a2089ad7..4afd8ae6611 100644
--- a/libjava/classpath/gnu/java/text/BaseBreakIterator.java
+++ b/libjava/classpath/gnu/java/text/BaseBreakIterator.java
@@ -68,12 +68,15 @@ public abstract class BaseBreakIterator extends BreakIterator
return iter.getBeginIndex();
}
+ /**
+ * Return the first boundary after <code>pos</code>.
+ * This has the side effect of setting the index of the
+ * CharacterIterator.
+ */
public int following (int pos)
{
- int save = iter.getIndex();
iter.setIndex(pos);
int r = next ();
- iter.setIndex(save);
return r;
}
diff --git a/libjava/classpath/gnu/javax/crypto/DiffieHellmanImpl.java b/libjava/classpath/gnu/javax/crypto/DiffieHellmanImpl.java
new file mode 100644
index 00000000000..4797af7cf79
--- /dev/null
+++ b/libjava/classpath/gnu/javax/crypto/DiffieHellmanImpl.java
@@ -0,0 +1,159 @@
+/* DiffieHellmanImpl.java -- implementation of the Diffie-Hellman key agreement.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.crypto;
+
+import gnu.java.security.provider.GnuDHPublicKey;
+
+import java.math.BigInteger;
+
+import java.security.Key;
+import java.security.InvalidKeyException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.SecureRandom;
+import java.security.spec.AlgorithmParameterSpec;
+
+import javax.crypto.KeyAgreementSpi;
+import javax.crypto.SecretKey;
+import javax.crypto.interfaces.DHPrivateKey;
+import javax.crypto.interfaces.DHPublicKey;
+import javax.crypto.spec.DHParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * The Diffie-Hellman key agreement.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public final class DiffieHellmanImpl extends KeyAgreementSpi
+{
+
+ /** The private key being used for this agreement. */
+ private DHPrivateKey key;
+
+ /** The current result. */
+ private BigInteger result;
+
+ /** True if the caller told us we are done. */
+ private boolean last_phase_done;
+
+ /** Trivial default constructor. */
+ public DiffieHellmanImpl ()
+ {
+ key = null;
+ result = null;
+ last_phase_done = false;
+ }
+
+ // KeyAgreementSpi methods.
+
+ protected Key engineDoPhase (final Key incoming, final boolean lastPhase)
+ throws InvalidKeyException
+ {
+ if (key == null)
+ throw new IllegalStateException ("not initialized");
+ if (last_phase_done)
+ throw new IllegalStateException ("last phase already done");
+
+ if (!(incoming instanceof DHPublicKey))
+ throw new InvalidKeyException ("expecting javax.crypto.interfaces.DHPublicKey");
+ DHPublicKey pub = (DHPublicKey) incoming;
+ DHParameterSpec s1 = key.getParams();
+ DHParameterSpec s2 = pub.getParams();
+ if (!s1.getG().equals (s2.getG())
+ || !s1.getP().equals (s2.getP())
+ || s1.getL() != s2.getL())
+ throw new InvalidKeyException ("supplied key is not compatible");
+
+ result = pub.getY().modPow (key.getX(), s1.getP());
+ if (lastPhase)
+ {
+ last_phase_done = true;
+ return null;
+ }
+
+ throw new IllegalArgumentException ("only supports two-party Diffie Hellman");
+ }
+
+ protected byte[] engineGenerateSecret ()
+ {
+ if (result == null || !last_phase_done)
+ throw new IllegalStateException ("not finished");
+
+ byte[] buf = result.toByteArray ();
+ if (buf[0] == 0x00)
+ {
+ byte[] buf2 = new byte[buf.length - 1];
+ System.arraycopy (buf, 1, buf2, 0, buf2.length);
+ buf = buf2;
+ }
+ return buf;
+ }
+
+ protected int engineGenerateSecret (final byte[] secret, final int offset)
+ {
+ byte[] s = engineGenerateSecret();
+ System.arraycopy (s, 0, secret, offset, s.length);
+ return s.length;
+ }
+
+ protected SecretKey engineGenerateSecret (final String algorithm)
+ throws InvalidKeyException
+ {
+ byte[] s = engineGenerateSecret();
+ return new SecretKeySpec (s, algorithm);
+ }
+
+ protected void engineInit (final Key key, final SecureRandom random)
+ throws InvalidKeyException
+ {
+ if (!(key instanceof DHPrivateKey))
+ throw new InvalidKeyException ("not a javax.crypto.interfaces.DHPrivateKey");
+ this.key = (DHPrivateKey) key;
+ result = null;
+ last_phase_done = false;
+ }
+
+ protected void engineInit (final Key key, final AlgorithmParameterSpec params,
+ final SecureRandom random)
+ throws InvalidKeyException
+ {
+ engineInit (key, random);
+ }
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java b/libjava/classpath/gnu/javax/crypto/GnuDHPrivateKey.java
index 3f6f5454e73..f70cd7d2aec 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java
+++ b/libjava/classpath/gnu/javax/crypto/GnuDHPrivateKey.java
@@ -1,5 +1,5 @@
-/* ConnectionEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+/* GnuDHPrivateKey.java -- a Diffie-Hellman private key.
+ Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath 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, or (at your option)
any later version.
-
+
GNU Classpath 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
@@ -36,46 +36,55 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.java.net.protocol.http.event;
+package gnu.javax.crypto;
+
+import java.math.BigInteger;
-import java.util.EventObject;
+import javax.crypto.interfaces.DHKey;
+import javax.crypto.interfaces.DHPrivateKey;
+import javax.crypto.spec.DHParameterSpec;
/**
- * A connection event.
+ * A Diffie-Hellman private key.
*
- * @author Chris Burdess (dog@gnu.org)
+ * @author Casey Marshall (csm@gnu.org)
*/
-public class ConnectionEvent
- extends EventObject
+public class GnuDHPrivateKey implements DHPrivateKey
{
- /**
- * The connection closed event type.
- */
- public static final int CONNECTION_CLOSED = 0;
-
- /**
- * The type of this event.
- */
- protected int type;
-
- /**
- * Constructs a connection event with the specified source and type.
- */
- public ConnectionEvent(Object source, int type)
+ private final BigInteger x;
+ private final DHParameterSpec params;
+
+ public GnuDHPrivateKey (final BigInteger x, final DHParameterSpec params)
{
- super(source);
- this.type = type;
+ x.getClass ();
+ params.getClass ();
+ this.x = x;
+ this.params = params;
}
- /**
- * Returns the type of this event.
- * @see #type
- */
- public int getType()
+ public DHParameterSpec getParams()
{
- return type;
+ return params;
+ }
+
+ public String getAlgorithm()
+ {
+ return "DiffieHellman";
+ }
+
+ public String getFormat ()
+ {
+ return "NONE";
+ }
+
+ public byte[] getEncoded ()
+ {
+ return null;
}
-
-}
+ public BigInteger getX ()
+ {
+ return x;
+ }
+}
diff --git a/libjava/classpath/gnu/javax/crypto/RSACipherImpl.java b/libjava/classpath/gnu/javax/crypto/RSACipherImpl.java
new file mode 100644
index 00000000000..0a4c29db6f1
--- /dev/null
+++ b/libjava/classpath/gnu/javax/crypto/RSACipherImpl.java
@@ -0,0 +1,311 @@
+/* DiffieHellmanImpl.java -- implementation of the Diffie-Hellman key agreement.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.crypto;
+
+import gnu.classpath.ByteArray;
+import gnu.classpath.debug.Component;
+import gnu.classpath.debug.SystemLogger;
+
+import java.math.BigInteger;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+
+import java.security.interfaces.RSAKey;
+import java.security.interfaces.RSAPrivateKey;
+import java.security.interfaces.RSAPrivateCrtKey;
+import java.security.interfaces.RSAPublicKey;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+import java.util.logging.Logger;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.CipherSpi;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.ShortBufferException;
+
+public class RSACipherImpl extends CipherSpi
+{
+ private static final Logger logger = SystemLogger.SYSTEM;
+
+ private static final byte[] EMPTY = new byte[0];
+ private int opmode = -1;
+ private RSAPrivateKey decipherKey = null;
+ private RSAPublicKey blindingKey = null;
+ private RSAPublicKey encipherKey = null;
+ private SecureRandom random = null;
+ private byte[] dataBuffer = null;
+ private int pos = 0;
+
+ protected void engineSetMode (String mode) throws NoSuchAlgorithmException
+ {
+ throw new NoSuchAlgorithmException ("only one mode available");
+ }
+
+ protected void engineSetPadding (String pad) throws NoSuchPaddingException
+ {
+ throw new NoSuchPaddingException ("only one padding available");
+ }
+
+ protected int engineGetBlockSize ()
+ {
+ return 1;
+ }
+
+ protected int engineGetOutputSize (int inputLen)
+ {
+ int outputLen = 0;
+ if (decipherKey != null)
+ {
+ outputLen = (decipherKey.getModulus ().bitLength () + 7) / 8;
+ }
+ else if (encipherKey != null)
+ {
+ outputLen = (encipherKey.getModulus ().bitLength () + 7) / 8;
+ }
+ else
+ throw new IllegalStateException ("not initialized");
+ if (inputLen > outputLen)
+ throw new IllegalArgumentException ("not configured to encode " + inputLen
+ + "bytes; at most " + outputLen);
+ return outputLen;
+ }
+
+ protected int engineGetKeySize (final Key key) throws InvalidKeyException
+ {
+ if (!(key instanceof RSAKey))
+ throw new InvalidKeyException ("not an RSA key");
+ return ((RSAKey) key).getModulus ().bitLength ();
+ }
+
+ protected byte[] engineGetIV ()
+ {
+ return null;
+ }
+
+ protected AlgorithmParameters engineGetParameters()
+ {
+ return null;
+ }
+
+ protected void engineInit (int opmode, Key key, SecureRandom random)
+ throws InvalidKeyException
+ {
+ int outputLen = 0;
+ if (opmode == Cipher.ENCRYPT_MODE)
+ {
+ if (!(key instanceof RSAPublicKey))
+ throw new InvalidKeyException ("expecting a RSAPublicKey");
+ encipherKey = (RSAPublicKey) key;
+ decipherKey = null;
+ blindingKey = null;
+ outputLen = (encipherKey.getModulus ().bitLength () + 7) / 8;
+ }
+ else if (opmode == Cipher.DECRYPT_MODE)
+ {
+ if (key instanceof RSAPrivateKey)
+ {
+ decipherKey = (RSAPrivateKey) key;
+ encipherKey = null;
+ blindingKey = null;
+ outputLen = (decipherKey.getModulus ().bitLength () + 7) / 8;
+ }
+ else if (key instanceof RSAPublicKey)
+ {
+ if (decipherKey == null)
+ throw new IllegalStateException ("must configure decryption key first");
+ if (!decipherKey.getModulus ().equals (((RSAPublicKey) key).getModulus ()))
+ throw new InvalidKeyException ("blinding key is not compatible");
+ blindingKey = (RSAPublicKey) key;
+ return;
+ }
+ else
+ throw new InvalidKeyException ("expecting either an RSAPrivateKey or an RSAPublicKey (for blinding)");
+ }
+ else
+ throw new IllegalArgumentException ("only encryption and decryption supported");
+ this.random = random;
+ this.opmode = opmode;
+ pos = 0;
+ dataBuffer = new byte[outputLen];
+ }
+
+ protected void engineInit (int opmode, Key key, AlgorithmParameterSpec spec, SecureRandom random)
+ throws InvalidKeyException
+ {
+ engineInit (opmode, key, random);
+ }
+
+ protected void engineInit (int opmode, Key key, AlgorithmParameters params, SecureRandom random)
+ throws InvalidKeyException
+ {
+ engineInit (opmode, key, random);
+ }
+
+ protected byte[] engineUpdate (byte[] in, int offset, int length)
+ {
+ if (opmode != Cipher.ENCRYPT_MODE && opmode != Cipher.DECRYPT_MODE)
+ throw new IllegalStateException ("not initialized");
+ System.arraycopy (in, offset, dataBuffer, pos, length);
+ pos += length;
+ return EMPTY;
+ }
+
+ protected int engineUpdate (byte[] in, int offset, int length, byte[] out, int outOffset)
+ {
+ engineUpdate (in, offset, length);
+ return 0;
+ }
+
+ protected byte[] engineDoFinal (byte[] in, int offset, int length)
+ throws IllegalBlockSizeException, BadPaddingException
+ {
+ engineUpdate (in, offset, length);
+ if (opmode == Cipher.DECRYPT_MODE)
+ {
+ if (pos < dataBuffer.length)
+ throw new IllegalBlockSizeException ("expecting exactly " + dataBuffer.length + " bytes");
+ BigInteger enc = new BigInteger (1, dataBuffer);
+ byte[] dec = rsaDecrypt (enc);
+ logger.log (Component.CRYPTO, "RSA: decryption produced\n{0}",
+ new ByteArray (dec));
+ if (dec[0] != 0x02)
+ throw new BadPaddingException ("expected padding type 2");
+ int i;
+ for (i = 1; i < dec.length && dec[i] != 0x00; i++);
+ int len = dec.length - i;
+ byte[] result = new byte[len];
+ System.arraycopy (dec, i, result, 0, len);
+ pos = 0;
+ return result;
+ }
+ else
+ {
+ offset = dataBuffer.length - pos;
+ if (offset < 3)
+ throw new IllegalBlockSizeException ("input is too large to encrypt");
+ byte[] dec = new byte[dataBuffer.length];
+ dec[0] = 0x02;
+ if (random == null)
+ random = new SecureRandom ();
+ byte[] pad = new byte[offset - 2];
+ random.nextBytes (pad);
+ for (int i = 0; i < pad.length; i++)
+ if (pad[i] == 0)
+ pad[i] = 1;
+ System.arraycopy (pad, 0, dec, 1, pad.length);
+ dec[dec.length - pos] = 0x00;
+ System.arraycopy (dataBuffer, 0, dec, offset, pos);
+ logger.log (Component.CRYPTO, "RSA: produced padded plaintext\n{0}",
+ new ByteArray (dec));
+ BigInteger x = new BigInteger (1, dec);
+ BigInteger y = x.modPow (encipherKey.getPublicExponent (),
+ encipherKey.getModulus ());
+ byte[] enc = y.toByteArray ();
+ if (enc[0] == 0x00)
+ {
+ byte[] tmp = new byte[enc.length - 1];
+ System.arraycopy (enc, 1, tmp, 0, tmp.length);
+ enc = tmp;
+ }
+ pos = 0;
+ return enc;
+ }
+ }
+
+ protected int engineDoFinal (byte[] out, int offset)
+ throws ShortBufferException, IllegalBlockSizeException, BadPaddingException
+ {
+ byte[] result = engineDoFinal (EMPTY, 0, 0);
+ if (out.length - offset < result.length)
+ throw new ShortBufferException ("need " + result.length + ", have "
+ + (out.length - offset));
+ System.arraycopy (result, 0, out, offset, result.length);
+ return result.length;
+ }
+
+ protected int engineDoFinal (final byte[] input, final int offset, final int length,
+ final byte[] output, final int outputOffset)
+ throws ShortBufferException, IllegalBlockSizeException, BadPaddingException
+ {
+ byte[] result = engineDoFinal (input, offset, length);
+ if (output.length - outputOffset < result.length)
+ throw new ShortBufferException ("need " + result.length + ", have "
+ + (output.length - outputOffset));
+ System.arraycopy (result, 0, output, outputOffset, result.length);
+ return result.length;
+ }
+
+ /**
+ * Decrypts the ciphertext, employing RSA blinding if possible.
+ */
+ private byte[] rsaDecrypt (BigInteger enc)
+ {
+ if (random == null)
+ random = new SecureRandom ();
+ BigInteger n = decipherKey.getModulus ();
+ BigInteger r = null;
+ BigInteger pubExp = null;
+ if (blindingKey != null)
+ pubExp = blindingKey.getPublicExponent ();
+ if (pubExp != null && (decipherKey instanceof RSAPrivateCrtKey))
+ pubExp = ((RSAPrivateCrtKey) decipherKey).getPublicExponent ();
+ if (pubExp != null)
+ {
+ r = new BigInteger (n.bitLength () - 1, random);
+ enc = r.modPow (pubExp, n).multiply (enc).mod (n);
+ }
+
+ BigInteger dec = enc.modPow (decipherKey.getPrivateExponent (), n);
+
+ if (pubExp != null)
+ {
+ dec = dec.multiply (r.modInverse (n)).mod (n);
+ }
+
+ return dec.toByteArray ();
+ }
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPDecoder.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPDecoder.java
new file mode 100644
index 00000000000..c4a582bfa20
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPDecoder.java
@@ -0,0 +1,169 @@
+/* BMPDecoder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.awt.image.ColorModel;
+import java.awt.image.IndexColorModel;
+import java.awt.image.BufferedImage;
+
+public abstract class BMPDecoder {
+
+ protected BMPInfoHeader infoHeader;
+ protected BMPFileHeader fileHeader;
+ protected long offset;
+
+ public BMPDecoder(BMPFileHeader fh, BMPInfoHeader ih){
+ fileHeader = fh;
+ infoHeader = ih;
+ offset = BMPFileHeader.SIZE + BMPInfoHeader.SIZE;
+ }
+
+ /**
+ * Determines the coding type of the bitmap and returns the corresponding
+ * decoder.
+ */
+ public static BMPDecoder getDecoder(BMPFileHeader fh, BMPInfoHeader ih){
+ switch(ih.getCompression()){
+ case BMPInfoHeader.BI_RGB: // uncompressed RGB
+ switch(ih.getBitCount()){
+ case 32:
+ return new DecodeBF32(fh, ih, true);
+
+ case 24:
+ return new DecodeRGB24(fh, ih);
+
+ case 16:
+ return new DecodeBF16(fh, ih, true);
+
+ case 8:
+ return new DecodeRGB8(fh, ih);
+
+ case 4:
+ return new DecodeRGB4(fh, ih);
+
+ case 1:
+ return new DecodeRGB1(fh, ih);
+
+ default:
+ return null;
+ }
+
+ case BMPInfoHeader.BI_RLE8:
+ return new DecodeRLE8(fh, ih);
+
+ case BMPInfoHeader.BI_RLE4:
+ return new DecodeRLE4(fh, ih);
+
+ case BMPInfoHeader.BI_BITFIELDS:
+ switch(ih.getBitCount()){
+ case 16:
+ return new DecodeBF16(fh, ih, false);
+
+ case 32:
+ return new DecodeBF32(fh, ih, false);
+
+ default:
+ return null;
+ }
+
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * The image decoder.
+ */
+ public abstract BufferedImage decode(ImageInputStream in)
+ throws IOException, BMPException;
+
+ /**
+ * Reads r,g,b bit masks from an inputstream
+ */
+ protected int[] readBitMasks(ImageInputStream in) throws IOException {
+ int[] bitmasks = new int[3];
+ byte[] temp = new byte[12];
+ if(in.read(temp) != 12)
+ throw new IOException("Couldn't read bit masks.");
+ offset += 12;
+
+ ByteBuffer buf = ByteBuffer.wrap(temp);
+ buf.order(ByteOrder.LITTLE_ENDIAN);
+ bitmasks[0] = buf.getInt();
+ bitmasks[1] = buf.getInt();
+ bitmasks[2] = buf.getInt();
+ return bitmasks;
+ }
+
+ /**
+ * Reads an N-color palette from an inputstream in RGBQUAD format and
+ * returns an equivalent ColorModel object
+ */
+ protected IndexColorModel readPalette(ImageInputStream in) throws IOException {
+ int N = infoHeader.getNumberOfPaletteEntries();
+ byte[] r = new byte[N];
+ byte[] g = new byte[N];
+ byte[] b = new byte[N];
+ for(int i=0;i<N;i++){
+ byte[] RGBquad = new byte[4];
+ if(in.read(RGBquad) != 4)
+ throw new IOException("Error reading palette information.");
+ // RGBQUAD structure is b,g,r,0
+ r[i] = RGBquad[2];
+ g[i] = RGBquad[1];
+ b[i] = RGBquad[0];
+ }
+
+ offset += 4*N;
+ return new IndexColorModel(8, N, r, g, b);
+ }
+
+ /**
+ * Read bytes to the start of the image data
+ */
+ protected void skipToImage(ImageInputStream in) throws IOException {
+ byte[] d = new byte[1];
+ long n = fileHeader.getOffset() - offset;
+ for(int i=0;i<n;i++)
+ in.read(d);
+ }
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPException.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPException.java
new file mode 100644
index 00000000000..d3c62e7597e
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPException.java
@@ -0,0 +1,47 @@
+/* BMPException.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import javax.imageio.IIOException;
+
+public class BMPException extends IIOException {
+
+ public BMPException(String message){
+ super(message);
+ }
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPFileHeader.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPFileHeader.java
new file mode 100644
index 00000000000..246e0eacfeb
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPFileHeader.java
@@ -0,0 +1,128 @@
+/* BMPFileHeader.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+public class BMPFileHeader {
+ /** Header signature, always 'BM' */
+ private final static short bfType = 0x424d;
+
+ /** Bitmap file size, in bytes. */
+ private long bfSize;
+
+ /** Offset from the beginning of the file to the bitmap data */
+ private long bfOffBits;
+
+ /** BITMAPFILEHEADER is 14 bytes */
+ public static final int SIZE = 14;
+
+ /**
+ * Creates the header from an input stream, which is not closed.
+ * @throws IOException if an I/O error occured.
+ * @throws BMPException if the header was invalid
+ */
+ public BMPFileHeader(ImageInputStream in) throws IOException, BMPException {
+ byte[] data = new byte[SIZE];
+
+ if (in.read(data) != SIZE)
+ throw new IOException("Couldn't read header.");
+ ByteBuffer buf = ByteBuffer.wrap(data);
+
+ if(buf.getShort(0) != bfType)
+ throw new BMPException("Not a BMP file.");
+
+ buf.order(ByteOrder.LITTLE_ENDIAN);
+
+ // get size (keep unsigned)
+ bfSize = ((long)buf.getInt(2) & (0xFFFFFFFF));
+
+ // Two reserved shorts are here, and should be zero,
+ // perhaps they should be tested to be zero, but I don't
+ // feel this strictness is necessary.
+
+ bfOffBits = ((long)buf.getInt(10) & (0xFFFFFFFF));
+ }
+
+ /**
+ * Writes the header to an output stream, which is not closed or flushed.
+ * @throws IOException if an I/O error occured.
+ */
+ public void write(OutputStream out) throws IOException {
+ ByteBuffer buf = ByteBuffer.allocate(SIZE);
+ buf.putShort(0, bfType); // ID
+ buf.putInt(2, (int)(bfSize & (0xFFFFFFFF))); // size
+ buf.putInt(6, 0); // 4 reserved bytes set to zero
+ buf.putInt(2, (int)(bfOffBits & (0xFFFFFFFF))); // size
+ out.write(buf.array());
+ }
+
+ /**
+ * Sets the file size
+ */
+ public void setSize(long size){
+ bfSize = size;
+ }
+
+ /**
+ * Sets the bitmap offset within the file
+ */
+ public void setOffset(long offset){
+ bfOffBits = offset;
+ }
+
+ /**
+ * Gets the file size
+ */
+ public long getSize(){
+ return bfSize;
+ }
+
+ /**
+ * Gets the bitmap offset within the file
+ */
+ public long getOffset(){
+ return bfOffBits;
+ }
+}
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReader.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReader.java
new file mode 100644
index 00000000000..3341d4b4aed
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReader.java
@@ -0,0 +1,153 @@
+/* BMPImageReader.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.*;
+import javax.imageio.spi.*;
+import javax.imageio.metadata.*;
+import javax.imageio.stream.ImageInputStream;
+import java.util.Iterator;
+import java.awt.image.BufferedImage;
+
+public class BMPImageReader extends ImageReader {
+ private BMPInfoHeader infoHeader;
+ private BMPFileHeader fileHeader;
+ private BMPDecoder decoder;
+
+ protected BMPImageReader(ImageReaderSpi originatingProvider){
+ super(originatingProvider);
+ infoHeader = null;
+ fileHeader = null;
+ decoder = null;
+ }
+
+ private void validateIndex(int imageIndex)
+ throws IndexOutOfBoundsException {
+ if (imageIndex != 0)
+ throw new IndexOutOfBoundsException("Invalid image index.");
+ }
+
+ public void setInput(Object input) {
+ super.setInput(input);
+ }
+
+ public void setInput(Object input,
+ boolean seekForwardOnly,
+ boolean ignoreMetadata) {
+ super.setInput(input, seekForwardOnly, ignoreMetadata);
+ }
+
+ public void setInput(Object input, boolean isStreamable) {
+ super.setInput(input, isStreamable);
+
+ if (!(input instanceof ImageInputStream))
+ throw new IllegalArgumentException("Input not an ImageInputStream.");
+ }
+
+ private void checkStream() throws IOException {
+ if (!(input instanceof ImageInputStream))
+ throw new IllegalStateException("Input not an ImageInputStream.");
+ if(input == null)
+ throw new IllegalStateException("No input stream.");
+
+ }
+
+ private void readHeaders() throws IOException, IIOException {
+ if(fileHeader != null)
+ return;
+
+ checkStream();
+
+ fileHeader = new BMPFileHeader((ImageInputStream)input);
+ infoHeader = new BMPInfoHeader((ImageInputStream)input);
+ decoder = BMPDecoder.getDecoder(fileHeader, infoHeader);
+ }
+
+ public int getWidth(int imageIndex) throws IOException {
+ validateIndex(imageIndex);
+ readHeaders();
+ return infoHeader.getWidth();
+ }
+
+ public int getHeight(int imageIndex) throws IOException {
+ validateIndex(imageIndex);
+ readHeaders();
+ return infoHeader.getHeight();
+ }
+
+ public Iterator getImageTypes(int imageIndex){
+ validateIndex(imageIndex);
+ return null;
+ }
+
+ /**
+ * Returns the number of images. BMP files can only contain a single one.
+ */
+ public int getNumImages(boolean allowSearch){
+ return 1;
+ }
+
+
+ // FIXME: Support metadata
+ public IIOMetadata getImageMetadata(int imageIndex){
+ validateIndex(imageIndex);
+ return null;
+ }
+
+ // FIXME: Support metadata
+ public IIOMetadata getStreamMetadata(){
+ return null;
+ }
+
+ /**
+ * Reads the image indexed by imageIndex and returns it as
+ * a complete BufferedImage, using a supplied ImageReadParam.
+ */
+ public BufferedImage read(int imageIndex, ImageReadParam param)
+ throws IOException, IIOException {
+ validateIndex(imageIndex);
+ readHeaders();
+ return decoder.decode((ImageInputStream)input);
+ }
+
+
+}
+
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java
new file mode 100644
index 00000000000..b175c7d076b
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java
@@ -0,0 +1,123 @@
+/* BMPImageReaderSpi.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import java.util.Locale;
+import javax.imageio.ImageReader;
+import javax.imageio.spi.ImageReaderSpi;
+import javax.imageio.stream.ImageInputStream;
+
+public class BMPImageReaderSpi extends ImageReaderSpi {
+
+ static final String vendorName = "GNU";
+ static final String version = "0.1";
+ static final String readerClassName =
+ "gnu.javax.imageio.bmp.BMPImageReader";
+ static final String[] names = { "Microsoft Windows BMP" };
+ static final String[] suffixes = { ".bmp", ".bm" };
+ static final String[] MIMETypes = {
+ "image/bmp",
+ "image/x-windows-bmp"};
+
+ static final String[] writerSpiNames = null;
+ //{"com.mycompany.imageio.MyFormatImageWriterSpi" };
+
+ static final boolean supportsStandardStreamMetadataFormat = false;
+ static final String nativeStreamMetadataFormatName = null;
+ static final String nativeStreamMetadataFormatClassName = null;
+ static final String[] extraStreamMetadataFormatNames = null;
+ static final String[] extraStreamMetadataFormatClassNames = null;
+ static final boolean supportsStandardImageMetadataFormat = false;
+ static final String nativeImageMetadataFormatName = null;
+ static final String nativeImageMetadataFormatClassName = null;
+ static final String[] extraImageMetadataFormatNames = null;
+ static final String[] extraImageMetadataFormatClassNames = null;
+
+ public BMPImageReaderSpi() {
+ super(vendorName, version,
+ names, suffixes, MIMETypes,
+ readerClassName,
+ STANDARD_INPUT_TYPE, // Accept ImageImageInputStreams
+ writerSpiNames,
+ supportsStandardStreamMetadataFormat,
+ nativeStreamMetadataFormatName,
+ nativeStreamMetadataFormatClassName,
+ extraStreamMetadataFormatNames,
+ extraStreamMetadataFormatClassNames,
+ supportsStandardImageMetadataFormat,
+ nativeImageMetadataFormatName,
+ nativeImageMetadataFormatClassName,
+ extraImageMetadataFormatNames,
+ extraImageMetadataFormatClassNames);
+ }
+
+ public String getDescription(Locale locale) {
+ return "Microsoft BMP v3";
+ }
+
+ public boolean canDecodeInput(Object input)
+ throws IOException {
+ if (!(input instanceof ImageInputStream))
+ return false;
+
+ ImageInputStream in = (ImageInputStream)input;
+ boolean retval;
+
+ in.mark();
+ try {
+ new BMPFileHeader(in);
+ retval = true;
+ } catch(BMPException e){
+ retval = false;
+ }
+ in.reset();
+
+ return retval;
+ }
+
+ public ImageReader createReaderInstance(Object extension) {
+ return new BMPImageReader(this);
+ }
+}
+
+
+
+
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java b/libjava/classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java
new file mode 100644
index 00000000000..edcb4e644cc
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java
@@ -0,0 +1,201 @@
+/* BMPInfoHeader.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.awt.Dimension;
+
+public class BMPInfoHeader {
+ /** Size of the bitmap info header*/
+ private int biSize;
+
+ /** Pixel width of the bitmap */
+ private int biWidth;
+
+ /** Pixel height of the bitmap */
+ private int biHeight;
+
+ /** Number of bitplanes = 1 */
+ private short biPlanes;
+
+ /** Number of bpp = 1,4,8,24 */
+ private short biBitCount;
+
+ /** Compression type, RGB8, RLE8, RLE4, BITFIELDS */
+ private int biCompression;
+
+ /** Byte size of the uncompressed bitmap, can be 0. */
+ private int biSizeImage;
+
+ /** X resolution, dots per meter */
+ private int biXPelsPerMeter;
+
+ /** Y resolution, dots per meter */
+ private int biYPelsPerMeter;
+
+ /** Number of colors used (palette only, can be 0 for all) */
+ private int biClrUsed;
+
+ /** Number of 'important' colors, 0 for all */
+ private int biClrImportant;
+
+ /** BITMAPINFOHEADER is 40 bytes */
+ public static final int SIZE = 40;
+
+ /**
+ * Compression types
+ */
+ public static final int BI_RGB = 0;
+ public static final int BI_RLE8 = 1;
+ public static final int BI_RLE4 = 2;
+ public static final int BI_BITFIELDS = 3;
+
+ /**
+ * Creates the header from an input stream, which is not closed.
+ * @throws IOException if an I/O error occured.
+ * @throws BMPException if the header was invalid
+ */
+ public BMPInfoHeader(ImageInputStream in) throws IOException, BMPException {
+ byte[] data = new byte[SIZE];
+
+ if (in.read(data) != SIZE)
+ throw new IOException("Couldn't read header.");
+ ByteBuffer buf = ByteBuffer.wrap(data);
+ buf.order(ByteOrder.LITTLE_ENDIAN);
+
+ int n;
+ if((n=buf.getInt()) != SIZE)
+ throw new BMPException("Invalid BITMAPINFOHEADER size: "+n);
+
+ biWidth = buf.getInt();
+ biHeight = buf.getInt();
+ biPlanes = buf.getShort();
+ setBitCount(buf.getShort());
+ setCompression(buf.getInt());
+ biSizeImage = buf.getInt();
+ biXPelsPerMeter = buf.getInt();
+ biYPelsPerMeter = buf.getInt();
+ biClrUsed = buf.getInt();
+ biClrImportant = buf.getInt();
+ }
+
+ public void setBitCount(short bitcount) throws BMPException {
+ switch(bitcount){
+ case 1:
+ case 4:
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ biBitCount = bitcount;
+ break;
+
+ default:
+ throw new BMPException("Invalid number of bits per pixel: "+
+ bitcount);
+ }
+ }
+
+ public short getBitCount() { return biBitCount; }
+
+ public void setCompression(int compression) throws BMPException {
+ switch(compression){
+ case BI_RLE8:
+ if(getBitCount() != 8)
+ throw new BMPException("Invalid number of bits per pixel.");
+ biCompression = compression;
+ break;
+ case BI_RLE4:
+ if(getBitCount() != 4)
+ throw new BMPException("Invalid number of bits per pixel.");
+ biCompression = compression;
+ break;
+
+ case BI_RGB:
+ case BI_BITFIELDS:
+ biCompression = compression;
+ break;
+
+ default:
+ throw new BMPException("Unknown bitmap compression type.");
+ }
+ }
+
+ public int getNumberOfPaletteEntries(){
+ if(biClrUsed == 0)
+ switch(biBitCount){
+ case 1:
+ return 2;
+ case 4:
+ return 16;
+ case 8:
+ return 256;
+
+ default: // should not happen
+ return 0;
+ }
+
+ return biClrUsed;
+ }
+
+ public int getCompression(){
+ return biCompression;
+ }
+
+ public Dimension getSize(){
+ return new Dimension(biWidth, biHeight);
+ }
+
+ public int getWidth(){
+ return biWidth;
+ }
+
+ public int getHeight(){
+ return biHeight;
+ }
+
+ public void setSize(Dimension d){
+ biWidth = (int)d.getWidth();
+ biHeight = (int)d.getHeight();
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java
new file mode 100644
index 00000000000..702c93ab3ca
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java
@@ -0,0 +1,104 @@
+/* DecodeBF16.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferUShort;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeBF16 extends BMPDecoder {
+ private int[] bitmasks;
+ private boolean useDefaultMasks;
+
+ public DecodeBF16(BMPFileHeader fh, BMPInfoHeader ih,
+ boolean udm){
+ super(fh,ih);
+
+ useDefaultMasks = udm;
+ if(useDefaultMasks) // 5-6-5 mask, B,G,R
+ bitmasks = new int[] { 0x00F800, 0x0007E0, 0x00001F };
+ }
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ if(!useDefaultMasks)
+ bitmasks = readBitMasks(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ // BMP scanlines are padded to dword offsets
+ int scansize = (w + (w&1)) << 1;
+ short[] data = new short[w*h];
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<w;x++)
+ data[x + y*w] = (short)((scanline[x*2] & (0xFF)) |
+ ((scanline[x*2+1] & (0xFF)) << 8));
+ }
+
+ ColorModel cm = new DirectColorModel(16,
+ bitmasks[0], bitmasks[1], bitmasks[2]);
+ SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_USHORT,
+ w, h,
+ bitmasks);
+ DataBuffer db = new DataBufferUShort(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+ return new BufferedImage(cm, raster, false, null);
+ }
+
+}
+
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF32.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF32.java
new file mode 100644
index 00000000000..ee64f4b0eac
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF32.java
@@ -0,0 +1,108 @@
+/* DecodeBF32.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferInt;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeBF32 extends BMPDecoder {
+ private int[] bitmasks;
+ private boolean useDefaultMasks;
+
+ public DecodeBF32(BMPFileHeader fh, BMPInfoHeader ih,
+ boolean udm){
+ super(fh,ih);
+
+ useDefaultMasks = udm;
+ if(useDefaultMasks)
+ bitmasks = new int[] { 0x00FF0000, 0x0000FF00, 0x000000FF };
+ }
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ if(!useDefaultMasks)
+ bitmasks = readBitMasks(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ // BMP scanlines are padded to dword offsets
+ int scansize = w << 2;
+ int[] data = new int[w*h];
+
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<w;x++)
+ data[x + y*w] = ((scanline[x<<2] & (0xFF)) |
+ ((scanline[(x<<2)+1] & (0xFF)) << 8) |
+ ((scanline[(x<<2)+2] & (0xFF)) << 16) |
+ ((scanline[(x<<2)+3] & (0xFF)) << 24));
+ }
+
+ ColorModel cm = new DirectColorModel(32,
+ bitmasks[0], bitmasks[1], bitmasks[2]);
+ SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT,
+ w, h,
+ bitmasks);
+ DataBuffer db = new DataBufferInt(data, w*h);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(cm, raster, false, null);
+ }
+
+}
+
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB1.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB1.java
new file mode 100644
index 00000000000..9ca82d9ee4a
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB1.java
@@ -0,0 +1,96 @@
+/* DecodeRGB1.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeRGB1 extends BMPDecoder {
+
+ public DecodeRGB1(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ public BufferedImage decode(ImageInputStream in)
+ throws IOException, BMPException {
+
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+ int size = (w*h)>>3;
+
+ int scansize = w>>3;
+ byte[] data = new byte[size];
+
+ for(int y=h-1;y>=0;y--){
+ // Scanlines are padded to dword boundries
+ int readsize = scansize;
+ if((readsize & 3) != 0) readsize += (4 - (scansize & 3));
+
+ byte[] scanline = new byte[readsize];
+ if(in.read(scanline) != readsize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<scansize;x++)
+ data[x + y*scansize] = scanline[x];
+ }
+
+ SampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h, 1);
+
+ DataBuffer db = new DataBufferByte(data, size, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(palette, raster, false, null);
+ }
+
+}
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB24.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB24.java
new file mode 100644
index 00000000000..2a910cb3063
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB24.java
@@ -0,0 +1,77 @@
+/* DecodeRGB24.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.Dimension;
+
+public class DecodeRGB24 extends BMPDecoder {
+
+ public DecodeRGB24(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+ BufferedImage image = new BufferedImage(w, h,
+ BufferedImage.TYPE_INT_RGB);
+ // BMP scanlines are padded to dword offsets
+ int scansize = ((w*3 & 3) != 0)? w*3 + 4 - (w*3 & 3): w*3;
+ int[] data = new int[w*h];
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<w;x++)
+ data[x + y*w] = scanline[x*3] +
+ (scanline[x*3+1] << 8) +
+ (scanline[x*3+2] << 16);
+ }
+ image.setRGB(0, 0, w, h, data, 0, w);
+ return image;
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB4.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB4.java
new file mode 100644
index 00000000000..a10d390ab82
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB4.java
@@ -0,0 +1,92 @@
+/* DecodeRGB4.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeRGB4 extends BMPDecoder {
+
+ public DecodeRGB4(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+ int size = (w*h) >> 1;
+
+ // Scanline padded to dword offsets
+ int wbytes = (w + (w & 1)) >> 1;
+ int scansize = ((wbytes & 3) != 0)? (wbytes + 4 - (wbytes&3)) : wbytes;
+
+ byte[] data = new byte[wbytes*h];
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<wbytes;x++)
+ data[x + y*wbytes] = scanline[x];
+ }
+ SampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h, 4);
+
+ DataBuffer db = new DataBufferByte(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(palette, raster, false, null);
+ }
+
+}
+
+
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerImpl.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB8.java
index 906381fe478..dfe4a19e8be 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerImpl.java
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRGB8.java
@@ -1,5 +1,5 @@
-/* ValueHandlerImpl.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* DecodeRGB8.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,48 +35,56 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+package gnu.javax.imageio.bmp;
-package gnu.javax.rmi.CORBA;
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
-import java.io.*;
-//import org.omg.CORBA.portable.InputStream;
-//import org.omg.CORBA.portable.OutputStream;
-//import org.omg.SendingContext.RunTime;
-import javax.rmi.CORBA.ValueHandler;
+public class DecodeRGB8 extends BMPDecoder {
-public class ValueHandlerImpl
- implements ValueHandler
-{
+ public DecodeRGB8(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
- public String getRMIRepositoryID(Class clz)
- {
- throw new Error("Not implemented for ValueHandler");
- }
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
- // XXX - Runtime -> RunTime
- public Runtime getRunTimeCodeBase()
- {
- throw new Error("Not implemented for ValueHandler");
- }
-
- public boolean isCustomMarshaled(Class clz)
- {
- throw new Error("Not implemented for ValueHandler");
- }
-
- // XXX - Runtime -> RunTime
- public Serializable readValue(InputStream in, int offset, Class clz, String repositoryID, Runtime sender)
- {
- throw new Error("Not implemented for ValueHandler");
- }
-
- public Serializable writeReplace(Serializable value)
- {
- throw new Error("Not implemented for ValueHandler");
- }
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ // BMP scanlines are padded to dword offsets
+ int scansize = ((w & 3) != 0)? w + 4 - (w & 3): w;
+ byte[] data = new byte[w*h];
+
+ for(int y=h-1;y>=0;y--){
+ byte[] scanline = new byte[scansize];
+ if(in.read(scanline) != scansize)
+ throw new IOException("Couldn't read image data.");
+
+ for(int x=0;x<w;x++)
+ data[x + y*w] = scanline[x];
+ }
+
+ SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h,
+ new int[] {0xFF});
+ DataBuffer db = new DataBufferByte(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
- public void writeValue(OutputStream out, Serializable value)
- {
- throw new Error("Not implemented for ValueHandler");
- }
+ return new BufferedImage(palette, raster, false, null);
+ }
+
}
+
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE4.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE4.java
new file mode 100644
index 00000000000..55d314f05f1
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE4.java
@@ -0,0 +1,176 @@
+/* DecodeRLE4.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeRLE4 extends BMPDecoder {
+
+ public DecodeRLE4(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ /**
+ * RLE control codes
+ */
+ private static final byte ESCAPE = (byte)0;
+ private static final byte EOL = (byte)0; // end of line
+ private static final byte EOB = (byte)1; // end of bitmap
+ private static final byte DELTA = (byte)2; // delta
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ byte[] data = uncompress(w, h, in);
+ SampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h, 4);
+
+ DataBuffer db = new DataBufferByte(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(palette, raster, false, null);
+ }
+
+ private byte[] uncompress(int w, int h, ImageInputStream in)
+ throws BMPException, IOException {
+ byte[] cmd = new byte[2];
+ byte[] data = new byte[w*h>>1];
+ int offIn = 0;
+ int x=0,y=0;
+
+ // width in bytes
+ w += (w&1);
+ w = w >> 1;
+
+ try {
+ while(((x>>1) + y*w) < w*h){
+ if(in.read(cmd) != 2)
+ throw new IOException("Error reading compressed data.");
+
+ if(cmd[0] == ESCAPE){
+ switch(cmd[1]){
+ case EOB: // end of bitmap
+ return data;
+ case EOL: // end of line
+ x = 0;
+ y++;
+ break;
+ case DELTA: // delta
+ if(in.read(cmd) != 2)
+ throw new IOException("Error reading compressed data.");
+ int dx = cmd[0] & (0xFF);
+ int dy = cmd[1] & (0xFF);
+ x += dx;
+ y += dy;
+ break;
+
+ default:
+ // decode a literal run
+ int length = cmd[1] & (0xFF);
+
+ // size of run, which is word aligned.
+ int bytesize = length;
+ bytesize += (bytesize & 1);
+ bytesize >>= 1;
+ bytesize += (bytesize & 1);
+
+ byte[] run = new byte[bytesize];
+ if(in.read(run) != bytesize)
+ throw new IOException("Error reading compressed data.");
+
+ if((x&1) == 0){
+ length += (length&1);
+ length >>= 1;
+ System.arraycopy(run, 0, data, ((x>>1) + w*(h-y-1)),
+ length);
+ } else {
+ for(int i=0;i<length;i++){
+ if((i&1) == 0) // copy high to low
+ data[((x+i)>>1) + w*(h-y-1)]
+ |= ((run[i>>1]&0xF0) >> 4);
+ else // copy low to high
+ data[((x+i)>>1) + w*(h-y-1)]
+ |= ((run[i>>1]&0x0F) << 4);
+ }
+ }
+ x += cmd[1] & (0xFF);
+ break;
+ }
+ } else {
+ // decode a byte run
+ int length = cmd[0] & (0xFF);
+ if((x&1) == 0){
+ length += (length&1);
+ length >>= 1;
+ for(int i=0;i<length;i++)
+ data[(h-y-1)*w + i + (x >> 1)] = cmd[1];
+ } else {
+ for(int i=0;i<length;i++){
+ if((i&1) == 0) // copy high to low
+ data[((x+i)>>1) + w*(h-y-1)]
+ |= ((cmd[1]&0xF0) >> 4);
+ else // copy low to high
+ data[((x+i)>>1) + w*(h-y-1)]
+ |= ((cmd[1]&0x0F) << 4);
+ }
+ }
+ x += cmd[0] & (0xFF);
+ }
+ }
+ return data;
+ } catch(ArrayIndexOutOfBoundsException e){
+ throw new BMPException("Invalid RLE data.");
+ }
+ }
+}
+
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE8.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE8.java
new file mode 100644
index 00000000000..1d00e6751d0
--- /dev/null
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeRLE8.java
@@ -0,0 +1,143 @@
+/* DecodeRLE8.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.javax.imageio.bmp;
+
+import java.io.IOException;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.image.BufferedImage;
+import java.awt.image.IndexColorModel;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.SampleModel;
+import java.awt.Dimension;
+
+public class DecodeRLE8 extends BMPDecoder {
+
+ public DecodeRLE8(BMPFileHeader fh, BMPInfoHeader ih){
+ super(fh, ih);
+ }
+
+ /**
+ * RLE control codes
+ */
+ private static final byte ESCAPE = (byte)0;
+ private static final byte EOL = (byte)0; // end of line
+ private static final byte EOB = (byte)1; // end of bitmap
+ private static final byte DELTA = (byte)2; // delta
+
+ public BufferedImage decode(ImageInputStream in) throws IOException, BMPException {
+ IndexColorModel palette = readPalette(in);
+ skipToImage(in);
+
+ Dimension d = infoHeader.getSize();
+ int h = (int)d.getHeight();
+ int w = (int)d.getWidth();
+
+ byte[] data = uncompress(w, h, in);
+ SampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ w, h,
+ new int[] {0xFF});
+ DataBuffer db = new DataBufferByte(data, w*h, 0);
+ WritableRaster raster = Raster.createWritableRaster(sm, db, null);
+
+ return new BufferedImage(palette, raster, false, null);
+ }
+
+ private byte[] uncompress(int w, int h, ImageInputStream in)
+ throws BMPException, IOException {
+ byte[] cmd = new byte[2];
+ byte[] data = new byte[w*h];
+ int offIn = 0;
+ int x=0,y=0;
+
+ try {
+ while((x + y*w) < w*h){
+ if(in.read(cmd) != 2)
+ throw new IOException("Error reading compressed data.");
+
+ if(cmd[0] == ESCAPE){
+ switch(cmd[1]){
+ case EOB: // end of bitmap
+ return data;
+ case EOL: // end of line
+ x = 0;
+ y++;
+ break;
+ case DELTA: // delta
+ if(in.read(cmd) != 2)
+ throw new IOException("Error reading compressed data.");
+ int dx = cmd[0] & (0xFF);
+ int dy = cmd[1] & (0xFF);
+ x += dx;
+ y += dy;
+ break;
+
+ default:
+ // decode a literal run
+ int length = cmd[1] & (0xFF);
+ int copylength = length;
+
+ // absolute mode must be word-aligned
+ length += (length & 1);
+
+ byte[] run = new byte[length];
+ if(in.read(run) != length)
+ throw new IOException("Error reading compressed data.");
+
+ System.arraycopy(run, 0, data, (x+w*(h-y-1)),
+ copylength);
+ x += copylength;
+ break;
+ }
+ } else {
+ // decode a byte run
+ int length = cmd[0] & (0xFF);
+ for(int i=0;i<length;i++)
+ data[(h-y-1)*w + x++] = cmd[1];
+ }
+ }
+ return data;
+ } catch(ArrayIndexOutOfBoundsException e){
+ throw new BMPException("Invalid RLE data.");
+ }
+ }
+}
+
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/CorbaInput.java b/libjava/classpath/gnu/javax/rmi/CORBA/CorbaInput.java
new file mode 100644
index 00000000000..e80cabf6b2b
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/CorbaInput.java
@@ -0,0 +1,297 @@
+/* CorbaInput.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import gnu.CORBA.CDR.gnuRuntime;
+
+import org.omg.CORBA_2_3.portable.InputStream;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+/**
+ * Converts calls on java ObjectOutputStream to calls on CORBA OutputStream. A
+ * class to substitute for objects using readObject method.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class CorbaInput
+ extends ObjectInputStream
+ implements ObjectInput
+{
+
+ /**
+ * The underlying CORBA stream from where the actual input is taken.
+ */
+ public InputStream stream;
+
+ /**
+ * The utility class to write the object fields in default way.
+ */
+ final RmiUtilities util;
+
+ /**
+ * The object currently being read.
+ */
+ Object current;
+
+ /**
+ * The offset of the object currently being read.
+ */
+ int offset;
+
+ /**
+ * The repository id of the object currently being read.
+ */
+ String rid;
+
+ /**
+ * The runtime, related to the object currently being read.
+ */
+ gnuRuntime runtime;
+
+ /**
+ * Create an instance, delegating calls to the given CORBA stream.
+ */
+ public CorbaInput(InputStream an_input, Object firstObject,
+ RmiUtilities an_util, int an_offset, String a_rid,
+ gnuRuntime a_runtime)
+ throws Exception
+ {
+ stream = an_input;
+ current = firstObject;
+ util = an_util;
+
+ offset = an_offset;
+ rid = a_rid;
+ runtime = a_runtime;
+ }
+
+ /** @inheritDoc */
+ public int available()
+ throws IOException
+ {
+ return stream.available();
+ }
+
+ /**
+ * No action.
+ */
+ public void close()
+ throws IOException
+ {
+ }
+
+ /** @inheritDoc */
+ public void defaultReadObject()
+ throws IOException, ClassNotFoundException
+ {
+ util.readFields(offset, rid, (Serializable) current, stream, runtime);
+ }
+
+ /** @inheritDoc */
+ public void mark(int readlimit)
+ {
+ stream.mark(readlimit);
+ }
+
+ /** @inheritDoc */
+ public boolean markSupported()
+ {
+ return stream.markSupported();
+ }
+
+ /** @inheritDoc */
+ public int read()
+ throws IOException
+ {
+ return stream.read();
+ }
+
+ /** @inheritDoc */
+ public int read(byte[] buf, int off, int len)
+ throws IOException
+ {
+ return stream.read(buf, off, len);
+ }
+
+ /** @inheritDoc */
+ public int read(byte[] b)
+ throws IOException
+ {
+ return stream.read(b);
+ }
+
+ /** @inheritDoc */
+ public boolean readBoolean()
+ throws IOException
+ {
+ return stream.read_boolean();
+ }
+
+ /** @inheritDoc */
+ public byte readByte()
+ throws IOException
+ {
+ return (byte) stream.read();
+ }
+
+ /** @inheritDoc */
+ public char readChar()
+ throws IOException
+ {
+ return stream.read_char();
+ }
+
+ /** @inheritDoc */
+ public double readDouble()
+ throws IOException
+ {
+ return stream.read_double();
+ }
+
+ /** @inheritDoc */
+ public float readFloat()
+ throws IOException
+ {
+ return stream.read_float();
+ }
+
+ /** @inheritDoc */
+ public void readFully(byte[] buf, int off, int len)
+ throws IOException
+ {
+ // This class only reads from the buffered streams.
+ stream.read(buf, off, len);
+ }
+
+ /** @inheritDoc */
+ public void readFully(byte[] buf)
+ throws IOException
+ {
+ // This class only reads from the buffered streams.
+ stream.read(buf);
+ }
+
+ /** @inheritDoc */
+ public int readInt()
+ throws IOException
+ {
+ return stream.read_long();
+ }
+
+ /** @inheritDoc */
+ public String readLine()
+ throws IOException
+ {
+ return new DataInputStream(this).readLine();
+ }
+
+ /** @inheritDoc */
+ public long readLong()
+ throws IOException
+ {
+ return stream.read_longlong();
+ }
+
+ /** @inheritDoc */
+ public short read_short()
+ throws IOException
+ {
+ return stream.read_short();
+ }
+
+ /** @inheritDoc */
+ public int readUnsignedByte()
+ throws IOException
+ {
+ return (stream.read() & 0xFF);
+ }
+
+ /** @inheritDoc */
+ public int readUnsignedShort()
+ throws IOException
+ {
+ return (stream.read_short() & 0xFFFF);
+ }
+
+ /**
+ * Read as wide string (not as UTF).
+ */
+ public String readUTF()
+ throws IOException
+ {
+ return stream.read_wstring();
+ }
+
+ /** @inheritDoc */
+ public void reset()
+ throws IOException
+ {
+ stream.reset();
+ }
+
+ /** @inheritDoc */
+ public long skip(long n)
+ throws IOException
+ {
+ return stream.skip(n);
+ }
+
+ /** @inheritDoc */
+ public int skipBytes(int len)
+ throws IOException
+ {
+ return (int) stream.skip(len);
+ }
+
+ /**
+ * Objects are read as abstract interfaces.
+ */
+ protected Object readObjectOverride()
+ throws IOException, ClassNotFoundException
+ {
+ current = stream.read_abstract_interface();
+ return current;
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/CorbaOutput.java b/libjava/classpath/gnu/javax/rmi/CORBA/CorbaOutput.java
new file mode 100644
index 00000000000..1c723407980
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/CorbaOutput.java
@@ -0,0 +1,219 @@
+/* CorbaOutput.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import java.io.IOException;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+/**
+ * A class to substitute as an ObjectOutputStream for objects using writeObject
+ * method.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class CorbaOutput
+ extends ObjectOutputStream
+ implements ObjectOutput
+{
+ /**
+ * A CORBA stream where the output is forwarded.
+ */
+ final OutputStream stream;
+
+ /**
+ * The utility class to write the object fields in default way.
+ */
+ final RmiUtilities util;
+
+ /**
+ * The object currently being written.
+ */
+ Object current;
+
+ /**
+ * Create an instance, delegating calls to the given CORBA stream.
+ */
+ public CorbaOutput(OutputStream an_output, Object firstObject,
+ RmiUtilities an_util)
+ throws Exception
+ {
+ stream = an_output;
+ current = firstObject;
+ util = an_util;
+ }
+
+ /**
+ * No action.
+ */
+ public void close()
+ throws IOException
+ {
+ }
+
+ /** @inheritDoc */
+ public void flush()
+ throws IOException
+ {
+ stream.flush();
+ }
+
+ /** @inheritDoc */
+ public void write(byte[] buf, int off, int len)
+ throws IOException
+ {
+ stream.write(buf, off, len);
+ }
+
+ /** @inheritDoc */
+ public void write(byte[] buf)
+ throws IOException
+ {
+ stream.write(buf);
+ }
+
+ /** @inheritDoc */
+ public void write(int val)
+ throws IOException
+ {
+ stream.write(val);
+ }
+
+ /** @inheritDoc */
+ public void writeBoolean(boolean val)
+ throws IOException
+ {
+ stream.write_boolean(val);
+ }
+
+ /** @inheritDoc */
+ public void writeByte(int val)
+ throws IOException
+ {
+ stream.write(val);
+ }
+
+ /** @inheritDoc */
+ public void writeBytes(String str)
+ throws IOException
+ {
+ stream.write_string(str);
+ }
+
+ /** @inheritDoc */
+ public void writeChar(int val)
+ throws IOException
+ {
+ stream.write_wchar((char) val);
+ }
+
+ /** @inheritDoc */
+ public void writeChars(String str)
+ throws IOException
+ {
+ stream.write_char_array(str.toCharArray(), 0, str.length());
+ }
+
+ /** @inheritDoc */
+ public void writeDouble(double val)
+ throws IOException
+ {
+ stream.write_double(val);
+ }
+
+ /** @inheritDoc */
+ public void writeFloat(float val)
+ throws IOException
+ {
+ stream.write_float(val);
+ }
+
+ /** @inheritDoc */
+ public void writeInt(int val)
+ throws IOException
+ {
+ stream.write_long(val);
+ }
+
+ /** @inheritDoc */
+ public void writeLong(long val)
+ throws IOException
+ {
+ stream.write_longlong(val);
+ }
+
+ /**
+ * Objects are written as abstract interfaces.
+ */
+ protected void writeObjectOverride(Object obj)
+ throws IOException
+ {
+ current = obj;
+ stream.write_abstract_interface(obj);
+ }
+
+ /** @inheritDoc */
+ public void writeShort(int val)
+ throws IOException
+ {
+ stream.write_short((short) val);
+ }
+
+ /**
+ * Such strings are written as wide strings, not as UTF.
+ */
+ public void writeUTF(String str)
+ throws IOException
+ {
+ stream.write_wstring(str);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public void defaultWriteObject()
+ throws IOException
+ {
+ util.writeFields(stream, (Serializable) current);
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java b/libjava/classpath/gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java
new file mode 100644
index 00000000000..5bdf7dac933
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/DefaultWriteObjectTester.java
@@ -0,0 +1,85 @@
+/* DefaultWriteObjectTester.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import gnu.CORBA.CDR.BufferedCdrOutput;
+
+import java.io.IOException;
+
+/**
+ * Tests if the defaultWriteObject method has been called.
+ * This information is required by RMI-IIOP header.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class DefaultWriteObjectTester
+ extends CorbaOutput
+{
+ /**
+ * The flag, indicating, that the defaultWriteObject method was called.
+ */
+ public boolean dwo_called;
+
+ /**
+ * Create an instance, delegating calls to the given CORBA stream.
+ */
+ public DefaultWriteObjectTester(Object firstObject)
+ throws Exception
+ {
+ super(new BufferedCdrOutput(), firstObject, null);
+ }
+
+ /**
+ * Set the flag that defaultWriteObject was called.
+ */
+ public void defaultWriteObject()
+ throws IOException
+ {
+ dwo_called = true;
+ }
+
+ /**
+ * Do not write other objects.
+ */
+ protected void writeObjectOverride(Object obj)
+ throws IOException
+ {
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java b/libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java
index d71546d7561..0607c9f9626 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/DelegateFactory.java
@@ -1,5 +1,5 @@
/* DelegateFactory.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,38 +38,70 @@ exception statement from your version. */
package gnu.javax.rmi.CORBA;
-import java.util.HashMap;
+import gnu.CORBA.ObjectCreator;
+
+/**
+ * This class produces delegates, using the system properties. If not
+ * corresponding property is specified, returns default implementations.
+ *
+ * @author Wu Gansha (gansha.wu@intel.com)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public class DelegateFactory
{
- private static HashMap cache = new HashMap(4);
-
- public static synchronized Object getInstance(String type)
- throws GetDelegateInstanceException
+ /**
+ * The name to get a stub delegate.
+ */
+ public static final String STUB = "Stub";
+
+ /**
+ * The name to get the util delegate.
+ */
+ public static final String UTIL = "Util";
+
+ /**
+ * The name to get the ValueHandler delegate.
+ */
+ public static final String VALUEHANDLER = "ValueHandler";
+
+ /**
+ * The name to get the PortableRemoteObject delegate.
+ */
+ public static final String PORTABLE_REMOTE_OBJECT = "PortableRemoteObject";
+
+ /**
+ * Get an instance of the given delegate. As in all cases the singleton
+ * instance is used, the caching here would be redundant.
+ *
+ * @param type a delegate type.
+ *
+ * @return the associated delegate.
+ *
+ * @throws InternalError if the delegate class, indicated in the system
+ * properties, cannot be instantiated.
+ */
+ public static Object getInstance(String type)
+ throws InternalError
{
- Object r = cache.get(type);
- if (r != null)
- return r;
- String dcname = System.getProperty("javax.rmi.CORBA." + type + "Class");
+ String propertyName = "javax.rmi.CORBA." + type + "Class";
+ String dcname = System.getProperty(propertyName);
if (dcname == null)
{
- //throw new DelegateException
- // ("no javax.rmi.CORBA.XXXClass property sepcified.");
- dcname = "gnu.javax.rmi.CORBA." + type + "DelegateImpl";
+ // // No javax.rmi.CORBA.XXXClass property sepcified.
+ dcname = "gnu.javax.rmi.CORBA." + type + "DelegateImpl";
}
try
{
- Class dclass = Class.forName(dcname,
- true,
- Thread.currentThread().getContextClassLoader());
- r = dclass.newInstance();
- cache.put(type, r);
- return r;
+ Class dclass = ObjectCreator.forName(dcname);
+ return dclass.newInstance();
}
- catch(Exception e)
+ catch (Exception e)
{
- throw new GetDelegateInstanceException
- ("Exception when trying to get delegate instance:" + dcname, e);
+ InternalError ierr = new InternalError("Exception when trying to get "
+ + type + "delegate instance:" + dcname);
+ ierr.initCause(e);
+ throw ierr;
}
}
}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java b/libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java
index 6a7e6b74622..ea4f73811f0 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/PortableRemoteObjectDelegateImpl.java
@@ -1,5 +1,5 @@
/* PortableRemoteObjectDelegateImpl.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,99 +38,325 @@ exception statement from your version. */
package gnu.javax.rmi.CORBA;
-import gnu.javax.rmi.PortableServer;
+import gnu.CORBA.SimpleDelegate;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.Poa.LocalDelegate;
+import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.Poa.AOM;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
+import java.rmi.server.RMIClassLoader;
import javax.rmi.CORBA.PortableRemoteObjectDelegate;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POAManagerPackage.State;
+
+/**
+ * Implements PortableRemoteObjectDelegate.
+ *
+ * @author Wu Gansha (gansha.wu@intel.com) (stub)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) (implementation)
+ */
public class PortableRemoteObjectDelegateImpl
implements PortableRemoteObjectDelegate
{
-
- public PortableRemoteObjectDelegateImpl()
- {
- }
-
- public void connect(Remote remote, Remote remote1)
+ /**
+ * <p>
+ * Makes the remote object <code>a_target</code> ready for remote
+ * communication using the same communications runtime as for the passed
+ * <code>a_source</code> parameter. The a_target is connected to the same
+ * ORB (and, if applicable, to the same POA) as the a_source.
+ *
+ * @param a_target the target to connect to ORB, must be an instance of either
+ * {@link ObjectImpl} (Stubs and old-style ties) or {@link Servant} (POA-bases
+ * ties).
+ *
+ * @param a_source the object, providing the connection information, must be
+ * an instance of either {@link ObjectImpl} (Stubs and old-style ties) or
+ * {@link Servant} (POA-bases ties).
+ *
+ * @throws RemoteException if the target is already connected to another ORB.
+ */
+ public void connect(Remote a_target, Remote a_source)
throws RemoteException
{
- throw new Error("Not implemented for PortableRemoteObjectDelegateImpl");
- }
-
- public void exportObject(Remote obj)
- throws RemoteException
- {
- PortableServer.exportObject(obj);
+ ORB orb = null;
+ POA poa = null;
+ boolean ok = false;
+
+ try
+ {
+ if (a_source instanceof Servant)
+ {
+ Servant s = (Servant) a_source;
+ orb = s._orb();
+ poa = s._poa();
+ ok = true;
+ }
+
+ if (!ok && a_source instanceof ObjectImpl)
+ {
+ ObjectImpl o = (ObjectImpl) a_source;
+ orb = o._orb();
+ ok = true;
+ try
+ {
+ if (orb instanceof ORB_1_4)
+ {
+ // POA information available.
+ ORB_1_4 xorb = (ORB_1_4) orb;
+ Delegate d = o._get_delegate();
+
+ if (d instanceof LocalDelegate)
+ {
+ LocalDelegate l = (LocalDelegate) d;
+ poa = l.poa;
+ }
+ else if (d instanceof SimpleDelegate)
+ {
+ byte[] ior_key = ((SimpleDelegate) d).getIor().key;
+ AOM.Obj ref = xorb.rootPOA.findIorKey(ior_key);
+ if (ref != null)
+ poa = ref.poa;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ // OK, POA info is not available, but as ORB is available, we
+ // will connect in a default way.
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ RuntimeException rex = new RuntimeException("Unable to get info from "
+ + a_source);
+ rex.initCause(ex);
+ throw rex;
+ }
+
+ if (!ok && a_source instanceof Tie)
+ {
+ Tie t = (Tie) a_source;
+ orb = t.orb();
+ poa = null;
+ ok = true;
+ }
+
+ if (orb == null)
+ throw new RemoteException("Unable to determine ORB from " + a_source);
+
+ if (a_target instanceof Stub)
+ {
+ StubDelegateImpl.connect((Stub) a_target, orb, poa);
+ }
+ else if (a_target instanceof Servant)
+ {
+ try
+ {
+ if (poa == null)
+ {
+ poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
+ // Activate if not active.
+ if (poa.the_POAManager().get_state().value() == State._HOLDING)
+ poa.the_POAManager().activate();
+ }
+ poa.servant_to_reference((Servant) a_target);
+ }
+ catch (Exception ex)
+ {
+ throw new Unexpected(ex);
+ }
+ }
+ else if (a_target instanceof org.omg.CORBA.Object)
+ {
+ // Connect as object.
+ orb.connect((org.omg.CORBA.Object) a_target);
+ }
+ else if (a_target instanceof Tie)
+ {
+ // We avoid calling this because it will aways connect to the root poa.
+ ((Tie) a_target).orb(orb);
+ }
}
+ /**
+ * Narrow the given object to the instance of the given class. The currently
+ * supported narrowing types are:
+ *
+ * 1. Simple widening conversion.<br>
+ * 2. ObjectImpl -> RMI interface.<br>
+ * 3. ObjectImpl -> ObjectImpl.<br>
+ * 4. Tie -> Remote (implementation)<br>
+ * 5. Remote (implementation) -> Tie.<br>
+ *
+ * The narrowing has sense only for derived classes.
+ */
public Object narrow(Object narrowFrom, Class narrowTo)
throws ClassCastException
{
if (narrowTo == null)
throw new ClassCastException("Can't narrow to null class");
- if (narrowFrom == null)
+ else if (narrowFrom == null)
return null;
+ else
+ // Simple narrowing case.
+ if (narrowTo.isAssignableFrom(narrowFrom.getClass()))
+ return narrowFrom;
+ else if (narrowTo.isInterface() || narrowFrom instanceof ObjectImpl)
+ {
+ // Narrow CORBA object to passed interface.
+
+ String interf = narrowTo.getName();
+ String stubClassName;
- Class fromClass = narrowFrom.getClass();
- Object result = null;
-
+ stubClassName = getStubClassName(interf);
+
+ try
+ {
+ // Replace the interface class by the stub class.
+ narrowTo = Util.loadClass(stubClassName, null,
+ narrowTo.getClassLoader());
+ }
+ catch (ClassNotFoundException e)
+ {
+ ClassCastException cex = new ClassCastException("Class not found: "
+ + stubClassName);
+ cex.initCause(e);
+ throw cex;
+ }
+ }
+ else if (narrowFrom instanceof Tie)
+ {
+ // Try to substitute the return tie target as a return value.
+ Remote target = ((Tie) narrowFrom).getTarget();
+ if (target != null && narrowTo.isAssignableFrom(target.getClass()))
+ return target;
+ }
+
+ Object narrowed;
try
{
- if (narrowTo.isAssignableFrom(fromClass))
- result = narrowFrom;
- else
- {
- System.out.println("We still haven't implement this case: narrow "
- + narrowFrom + " of type " + fromClass + " to "
- + narrowTo);
- Class[] cs = fromClass.getInterfaces();
- for (int i = 0; i < cs.length; i++)
- System.out.println(cs[i]);
- Exception e1 = new Exception();
- try
- {
- throw e1;
- }
- catch(Exception ee)
- {
- ee.printStackTrace();
- }
- System.exit(2);
- //throw new Error("We still haven't implement this case: narrow "
- // + narrowFrom + " of type " + fromClass + " to "
- // + narrowTo);
- /*
- ObjectImpl objimpl = (ObjectImpl)narrowFrom;
- if(objimpl._is_a(PortableServer.getTypeName(narrowTo)))
- result = PortableServer.getStubFromObjectImpl(objimpl, narrowTo);
- */
- }
- }
- catch(Exception e)
- {
- result = null;
- }
-
- if (result == null)
- throw new ClassCastException("Can't narrow from "
- + fromClass + " to " + narrowTo);
-
- return result;
+ narrowed = narrowTo.newInstance();
+ }
+ catch (Exception e)
+ {
+ ClassCastException cex = new ClassCastException("Cannot instantiate "
+ + narrowTo.getName());
+ cex.initCause(e);
+ throw cex;
+ }
+
+ if (narrowed instanceof ObjectImpl)
+ {
+ // This also works for the instances of the Stub.
+ ObjectImpl target = (ObjectImpl) narrowed;
+ // Set the delegate, as is done in *Helper.narrow(..).
+ target._set_delegate(((ObjectImpl) narrowFrom)._get_delegate());
+ }
+ else if (narrowed instanceof Tie && narrowFrom instanceof Remote)
+ {
+ // Try to set the narrowing object as a target for the Tie.
+ ((Tie) narrowed).setTarget((Remote) narrowFrom);
+ }
+ else
+ throw new ClassCastException("Narrowing of " + narrowFrom.getClass()
+ + " to " + narrowTo + " is either not possible or not implemented.");
+
+ return narrowed;
}
-
- public Remote toStub(Remote obj)
+
+ /**
+ * Get the Stub class name for the name, representing the given interface.
+ */
+ static String getStubClassName(String interf)
+ {
+ String stubClassName;
+ int p = interf.lastIndexOf('.');
+
+ if (p < 0)
+ // The interface is defined in the default package.
+ stubClassName = "_" + interf + "_Stub";
+ else
+ stubClassName = interf.substring(0, p + 1) + "_"
+ + interf.substring(p + 1) + "_Stub";
+ return stubClassName;
+ }
+
+ /**
+ * Get stub for the given implementation, searching by class name pattern. The
+ * found stub must implement Remote for this method to succeed.
+ */
+ public Remote toStub(Remote ObjImpl)
throws NoSuchObjectException
{
- return PortableServer.toStub(obj);
+ String icn = ObjImpl.getClass().getName();
+ if (!icn.endsWith("Impl"))
+ throw new BAD_PARAM("Invalid class name '" + icn
+ + "', must end with 'Impl'");
+
+ String sn = "_" + icn.substring(0, icn.length() - "Impl".length())
+ + "_Stub";
+
+ Class stubClass;
+ Object o_stub;
+
+ try
+ {
+ stubClass = RMIClassLoader.loadClass(sn);
+ o_stub = stubClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ NoSuchObjectException n = new NoSuchObjectException(sn);
+ n.initCause(e);
+ throw n;
+ }
+
+ if (!Remote.class.isAssignableFrom(stubClass))
+ throw new ClassCastException(stubClass.getName()
+ + " exists but cannot be returned as it does not inherit from "
+ + Remote.class.getName());
+
+ return (Remote) o_stub;
}
+ /**
+ * If the object tie is no longer in use, disconnet it from the orb.
+ */
public void unexportObject(Remote obj)
throws NoSuchObjectException
{
- PortableServer.unexportObject(obj);
+ Util.unexportObject(obj);
+ }
+
+ /**
+ * Find or create a tie for this target and mark it as being used by the given
+ * object.
+ */
+ public void exportObject(Remote obj)
+ throws RemoteException
+ {
+ if (obj instanceof Stub)
+ Util.registerTarget(StubDelegateImpl.getTieFromStub((Stub) obj), obj);
+ else if (obj instanceof Tie)
+ {
+ Tie t = (Tie) obj;
+ Util.registerTarget(t, null);
+ }
}
}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/RmiUtilities.java b/libjava/classpath/gnu/javax/rmi/CORBA/RmiUtilities.java
new file mode 100644
index 00000000000..91bfa3776dc
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/RmiUtilities.java
@@ -0,0 +1,946 @@
+/* RmiUtilities.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import gnu.CORBA.OrbFunctional;
+import gnu.CORBA.Minor;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.CDR.Vio;
+import gnu.CORBA.CDR.gnuRuntime;
+import gnu.CORBA.CDR.gnuValueStream;
+import gnu.CORBA.CDR.HeadlessInput;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.StringValueHelper;
+import org.omg.CORBA.WStringValueHelper;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ValueBase;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POAManagerPackage.State;
+import org.omg.SendingContext.RunTime;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.rmi.Remote;
+import java.security.MessageDigest;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.TreeSet;
+import java.util.WeakHashMap;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+
+/**
+ * Defines methods that must be accessible in several derived classes.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class RmiUtilities
+{
+ /**
+ * The currently used RMI-IIOP version format.
+ */
+ public static byte VERSION = 1;
+
+ /**
+ * The non - writable class fields.
+ */
+ static final int NON_WRITABLE = Modifier.STATIC | Modifier.TRANSIENT;
+
+ /**
+ * The standard String repository Id.
+ */
+ public static final String RMI_STRING_ID = StringValueHelper.id();
+
+ /**
+ * The standard Class repository Id.
+ */
+ public static final String RMI_CLASS_ID = "RMI:javax.rmi.CORBA.ClassDesc:2BABDA04587ADCCC:CFBF02CF5294176B";
+
+ /**
+ * The standard string array repository Id.
+ */
+ public static final String RMI_STRING_ARRAY_ID = "RMI:[Ljava.lang.String;:071DA8BE7F971128:A0F0A4387A3BB342";
+
+ /**
+ * An instance of the wide string value helper for writing strings.
+ */
+ static WStringValueHelper wStringValueHelper = new WStringValueHelper();
+
+ /**
+ * Set of serializable classes that have .writeObject and .readObject defined.
+ * Contains weak references to ensure that the classes will be unloadable.
+ */
+ WeakHashMap io_format = new WeakHashMap();
+
+ /**
+ * The standard IO format with no .writeObject and .readObject defined.
+ */
+ static final Object STANDARD = new Object();
+
+ /**
+ * The custom IO format with .writeObject and .readObject defined,
+ * defaultWriteObject called.
+ */
+ static final Object CUSTOM_DWO = new Object();
+
+ /**
+ * The custom IO format with .writeObject and .readObject defined,
+ * defaultWriteObject has not been called.
+ */
+ static final Object CUSTOM_NO_DWO = new Object();
+
+ /**
+ * The arguments for readObject.
+ */
+ static final Class[] READ_OBJECT_ARGS = new Class[] { ObjectInputStream.class };
+
+ /**
+ * The arguments for writeObject.
+ */
+ static final Class[] WRITE_OBJECT_ARGS = new Class[] { ObjectOutputStream.class };
+
+ /**
+ * The undocumented field that is heading the Sun's object data, written with
+ * writeObject.
+ */
+ static final int S_X = 16908034;
+
+ /**
+ * Write all fields of the passed value.
+ */
+ void writeFields(OutputStream an_output, Serializable object)
+ {
+ org.omg.CORBA_2_3.portable.OutputStream output = (org.omg.CORBA_2_3.portable.OutputStream) an_output;
+ try
+ {
+ Class o_class = object.getClass();
+ Field[] fields = getWritableFields(o_class);
+ Field f;
+
+ Class fc;
+
+ for (int i = 0; i < fields.length; i++)
+ {
+ f = fields[i];
+ fc = f.getType();
+ Object v = f.get(object);
+
+ if (fc == String.class)
+ {
+ output.write_value((Serializable) v, wStringValueHelper);
+ }
+ else if (fc == int.class)
+ output.write_long(((Integer) v).intValue());
+ else if (fc == long.class)
+ output.write_longlong(((Number) v).longValue());
+ else if (fc == double.class)
+ output.write_double(((Number) v).doubleValue());
+ else if (fc == float.class)
+ output.write_float(((Number) v).floatValue());
+ else if (fc == boolean.class)
+ output.write_boolean(((Boolean) v).booleanValue());
+ else if (fc == short.class)
+ output.write_short(((Number) v).shortValue());
+ else if (fc == byte.class)
+ output.write_octet(((Number) v).byteValue());
+ else if (fc == char.class)
+ output.write_wchar(((Character) v).charValue());
+ else
+ {
+ if (!fc.isInterface() && Remote.class.isAssignableFrom(fc))
+ fc = getExportedInterface(fc);
+ writeMember(output, v, fc);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Cannot write " + object);
+ m.minor = Minor.ValueFields;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Write a memeber (field) of the data structure.
+ */
+ void writeMember(org.omg.CORBA_2_3.portable.OutputStream output,
+ Object object, Class xClass)
+ {
+ if (output instanceof gnuValueStream)
+ {
+ gnuRuntime g = ((gnuValueStream) output).getRunTime();
+ // Reset the target as we are already beyond the critical point
+ // where is must have the value being written.
+ if (g != null)
+ g.target = null;
+ }
+ if (Serializable.class.isAssignableFrom(xClass)
+ || Remote.class.isAssignableFrom(xClass))
+ {
+ // Object handles null reference on its own.
+ if (org.omg.CORBA.Object.class.isAssignableFrom(xClass)
+ || Remote.class.isAssignableFrom(xClass))
+ {
+ if (object == null)
+ output.write_Object(null);
+ else if (isTieRequired(object))
+ exportTie(output, object, xClass);
+ else
+ writeValue(output, (Serializable) object);
+ }
+ else
+ output.write_value((Serializable) object, xClass);
+ }
+ else
+ {
+ MARSHAL m = new MARSHAL(xClass + " is not Serializable");
+ m.minor = Minor.NonSerializable;
+ throw m;
+ }
+ }
+
+ /**
+ * Check if the object must be wrapped into Tie, connected to the ORB and then
+ * the corresponding Stub be written.
+ */
+ public boolean isTieRequired(Object object)
+ {
+ return object instanceof Remote && !(object instanceof Stub);
+ }
+
+ /**
+ * Get the interface under that the class of this object must be exposed. The
+ * interface must be derived from Remote.
+ */
+ Class getExportedInterface(Object object)
+ throws MARSHAL
+ {
+ Class fc = null;
+ Class[] interfaces = object.getClass().getInterfaces();
+ for (int i = 0; i < interfaces.length; i++)
+ {
+ if (!Remote.class.equals(interfaces[i]))
+ if (Remote.class.isAssignableFrom(interfaces[i]))
+ {
+ if (fc == null)
+ fc = interfaces[i];
+ else
+ {
+ MARSHAL m = new MARSHAL("Both " + fc + " and " + interfaces[i]
+ + " extends Remote");
+ m.minor = Minor.TargetConversion;
+ throw m;
+ }
+ }
+ }
+ if (fc == null)
+ {
+ MARSHAL m = new MARSHAL(object.getClass()
+ + " does not implement any interface, derived from Remote");
+ m.minor = Minor.TargetConversion;
+ throw m;
+ }
+ return fc;
+ }
+
+ /**
+ * Get the persistent hash code for the given class, as defined by OMG
+ * standard. The inheritance, field names and types (but not the visibility)
+ * are taken into consideration as well as the presence of the writeObject
+ * method are taken into consideration. The class name and methods, if any,
+ * are not taken into consideration.
+ */
+ public static long getHashCode(Class c)
+ {
+ Class of = c.isArray() ? c.getComponentType() : null;
+ if (c.isArray()
+ && ((!Serializable.class.isAssignableFrom(of) || of.isPrimitive() || Remote.class.isAssignableFrom(of))))
+ return 0;
+ if (!Serializable.class.isAssignableFrom(c))
+ return 0;
+ try
+ {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ DataOutputStream out = new DataOutputStream(bout);
+
+ Class superClass = c.getSuperclass();
+ if (superClass != null)
+ out.writeLong(getHashCode(superClass));
+
+ int writeObjectPresentCode;
+ try
+ {
+ c.getDeclaredMethod("writeObject",
+ new Class[] { ObjectOutputStream.class });
+ writeObjectPresentCode = 2; // Exists.
+ }
+ catch (NoSuchMethodException e)
+ {
+ writeObjectPresentCode = 1; // Missing.
+ }
+ out.writeInt(writeObjectPresentCode);
+
+ Field[] fields = c.getDeclaredFields();
+
+ Arrays.sort(fields, new Comparator()
+ {
+ public int compare(Object a, Object b)
+ {
+ Field fa = (Field) a;
+ Field fb = (Field) b;
+ return fa.getName().compareTo(fb.getName());
+ }
+ });
+
+ Field f;
+ for (int i = 0; i < fields.length; i++)
+ {
+ f = fields[i];
+ if ((f.getModifiers() & NON_WRITABLE) == 0)
+ {
+ out.writeUTF(f.getName());
+ out.writeUTF(getDescriptor(f.getType()));
+ }
+ }
+
+ out.flush();
+ out.close();
+ MessageDigest shaDigest;
+ try
+ {
+ shaDigest = MessageDigest.getInstance("SHA");
+ }
+ catch (Exception ex)
+ {
+ throw new InternalError("SHA digesting algorithm is not available");
+ }
+
+ // Return the digest value to the calling
+ // method as an array of bytes.
+ byte[] sha = shaDigest.digest(bout.toByteArray());
+
+ long hash = 0;
+ for (int i = 0; i < Math.min(8, sha.length); i++)
+ {
+ hash += (long) (sha[i] & 255) << (i * 8);
+ }
+ return hash;
+ }
+ catch (IOException ioex)
+ {
+ throw new Unexpected(ioex);
+ }
+ }
+
+ /**
+ * Converts to hexadecimal string, supplementing leading zeros.
+ */
+ public static String toHex(long l)
+ {
+ StringBuffer b = new StringBuffer();
+ b.append(Long.toHexString(l).toUpperCase());
+ while (b.length() < 16)
+ b.insert(0, '0');
+ return b.toString();
+ }
+
+ /**
+ * Returns a <code>String</code> representing the type-encoding of a class.
+ */
+ static String getDescriptor(Class type)
+ {
+ if (type.equals(boolean.class))
+ return "Z";
+ if (type.equals(byte.class))
+ return "B";
+ if (type.equals(short.class))
+ return "S";
+ if (type.equals(char.class))
+ return "C";
+ if (type.equals(int.class))
+ return "I";
+ if (type.equals(long.class))
+ return "J";
+ if (type.equals(float.class))
+ return "F";
+ if (type.equals(double.class))
+ return "D";
+ if (type.equals(void.class))
+ return "V";
+ else if (type.isArray())
+ {
+ StringBuffer l = new StringBuffer("[");
+ Class component = type.getComponentType();
+
+ while (component.isArray())
+ {
+ l.append('[');
+ component = component.getComponentType();
+ }
+
+ l.append('L');
+ l.append(component.getName().replace('.', '/'));
+ l.append(';');
+ return l.toString();
+ }
+ else
+ return "L" + type.getName().replace('.', '/') + ';';
+ }
+
+ public static Field[] getWritableFields(Class c)
+ {
+ TreeSet set = new TreeSet(new Comparator()
+ {
+ public int compare(Object a, Object b)
+ {
+ return ((Field) a).getName().compareTo(((Field) b).getName());
+ }
+ });
+
+ while (!c.equals(Object.class))
+ {
+ Field[] f = c.getDeclaredFields();
+ for (int i = 0; i < f.length; i++)
+ {
+ if ((f[i].getModifiers() & NON_WRITABLE) == 0)
+ {
+ f[i].setAccessible(true);
+ set.add(f[i]);
+ }
+ }
+ c = c.getSuperclass();
+ }
+
+ Field[] r = new Field[set.size()];
+ int p = 0;
+ Iterator it = set.iterator();
+ while (it.hasNext())
+ {
+ r[p++] = (Field) it.next();
+ }
+ return r;
+ }
+
+ /**
+ * The method is called for Remotes that are not Stubs. It is assumed, that
+ * the Remote is an implementation. The method searches for the suitable tie
+ * and, if found, exports it by creating and connecting the stub. Such export
+ * is supported since jdk 1.5.
+ */
+ void exportTie(org.omg.CORBA_2_3.portable.OutputStream output,
+ Object implementation, Class interfaceClass)
+ {
+ try
+ {
+ // Remote, but non - stub class (implementation)
+ // must be replaced by stub.
+ Tie t = Util.getTie((Remote) implementation);
+ if (t instanceof Servant)
+ {
+ POA rootPoa = POAHelper.narrow(output.orb().resolve_initial_references(
+ "RootPOA"));
+ org.omg.CORBA.Object co = rootPoa.servant_to_reference((Servant) t);
+ Stub stub = (Stub) PortableRemoteObject.narrow(co, interfaceClass);
+ writeRemoteObject(output, stub);
+
+ if (rootPoa.the_POAManager().get_state().value() == State._HOLDING)
+ rootPoa.the_POAManager().activate();
+ }
+ else if (t instanceof org.omg.CORBA.Object)
+ {
+ org.omg.CORBA.Object co = (org.omg.CORBA.Object) t;
+ output.orb().connect(co);
+
+ Stub stub = (Stub) PortableRemoteObject.narrow(co, interfaceClass);
+ writeRemoteObject(output, stub);
+ }
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Unable to export " + implementation);
+ m.minor = Minor.TargetConversion;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+
+ /**
+ * Start the ORB, if it is not already runnning.
+ */
+ void ensureOrbRunning(org.omg.CORBA_2_3.portable.OutputStream output)
+ {
+ // Ensure ORB is running.
+ if (output.orb() instanceof OrbFunctional)
+ {
+ ((OrbFunctional) output.orb()).ensureRunning();
+ }
+ }
+
+ /**
+ * Write data to the CORBA output stream. Writes the object contents only; the
+ * header must be already written. For object, containing objects, may be
+ * called recursively.
+ *
+ * @param an_output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ public void writeRemoteObject(OutputStream an_output, Object object)
+ {
+ org.omg.CORBA_2_3.portable.OutputStream output = (org.omg.CORBA_2_3.portable.OutputStream) an_output;
+
+ if (isTieRequired(object))
+ {
+ // Find the interface that is implemented by the object and extends
+ // Remote.
+ Class fc = getExportedInterface(object);
+ exportTie(output, object, fc);
+ }
+ else if (object instanceof org.omg.CORBA.Object)
+ {
+ ensureOrbRunning(output);
+ an_output.write_Object((org.omg.CORBA.Object) object);
+ }
+ else if (object != null && object instanceof Serializable)
+ writeFields(an_output, (Serializable) object);
+ }
+
+ /**
+ * Write data to the CORBA output stream. Writes the object contents only; the
+ * header must be already written. For object, containing objects, may be
+ * called recursively.
+ *
+ * @param an_output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ public void writeValue(OutputStream an_output, Serializable object)
+ {
+ org.omg.CORBA_2_3.portable.OutputStream output = (org.omg.CORBA_2_3.portable.OutputStream) an_output;
+
+ if (isTieRequired(object))
+ {
+ // Find the interface that is implemented by the object and extends
+ // Remote.
+ Class fc = getExportedInterface(object);
+ exportTie(output, object, fc);
+ }
+ else if (object instanceof org.omg.CORBA.Object)
+ {
+ ensureOrbRunning(output);
+ an_output.write_Object((org.omg.CORBA.Object) object);
+ }
+ else if (object instanceof Externalizable)
+ {
+ try
+ {
+ ObjectOutputStream stream = new CorbaOutput(output, object,
+ this);
+ stream.write(VERSION);
+ ((Externalizable) object).writeExternal(stream);
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("writeExternal failed");
+ m.minor = Minor.Value;
+ m.initCause(ex);
+ throw m;
+ }
+ }
+ else if (object instanceof Serializable)
+ {
+ Object mode = null;
+ synchronized (io_format)
+ {
+ mode = io_format.get(object.getClass());
+ if (mode == STANDARD)
+ {
+ writeFields(an_output, (Serializable) object);
+ return;
+ }
+ }
+ try
+ {
+ Method m = object.getClass().getDeclaredMethod("writeObject",
+ WRITE_OBJECT_ARGS);
+ m.setAccessible(true); // May be private.
+
+ try
+ {
+ ObjectOutputStream stream = new CorbaOutput(output,
+ object, this);
+
+ // Write version.
+ stream.write(VERSION);
+
+ if (mode == CUSTOM_DWO)
+ // Write true, supposing that the defaultWriteObject
+ // has been called.
+ stream.write(1);
+ else if (mode == CUSTOM_NO_DWO)
+ // Write false (has not been called)
+ stream.write(0);
+ else
+ {
+ // Measure.
+ DefaultWriteObjectTester tester = new DefaultWriteObjectTester(object);
+ m.invoke(object, new Object[] { tester });
+
+ synchronized (io_format)
+ {
+ io_format.put(object.getClass(),
+ tester.dwo_called ? CUSTOM_DWO : CUSTOM_NO_DWO);
+ stream.write(tester.dwo_called ? 1 : 0);
+ }
+ }
+
+ m.invoke(object, new Object[] { stream });
+ stream.flush();
+ }
+ catch (Exception ex)
+ {
+ MARSHAL mx = new MARSHAL(object.getClass().getName()
+ + ".writeObject failed");
+ mx.initCause(ex);
+ throw mx;
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ // Write in a standard way.
+ writeFields(an_output, (Serializable) object);
+ synchronized (io_format)
+ {
+ io_format.put(object.getClass(), STANDARD);
+ }
+ }
+ }
+ }
+
+ /**
+ * Read data from the CDR input stream. Reads the object contents only; the
+ * header must be already read (the repository id or ids ara passed). For
+ * object, containing objects, may be called recursively.
+ *
+ * @param an_input the stream to read from, must be
+ * org.omg.CORBA_2_3.portable.InputStream
+ * @param object the instance of the object being read.
+ * @param id the repository Id from the stream in the case when single id was
+ * specified.
+ * @param ids the repository Ids from the stream in the case when multiple ids
+ * were specified.
+ * @param codebase the codebase, if it was included in the header of the value
+ * type. Null if not codebase was included.
+ *
+ * @return the object, extracted from the stream.
+ */
+ /**
+ * Read value from the input stream in the case when the value is not
+ * Streamable or CustomMarshalled.
+ */
+ public Serializable readValue(InputStream in, int offset, Class clz,
+ String repositoryID, RunTime sender)
+ {
+ if (in instanceof HeadlessInput)
+ ((HeadlessInput) in).subsequentCalls = true;
+
+ gnuRuntime g;
+ Serializable object = null;
+
+ try
+ {
+ g = (gnuRuntime) sender;
+ object = g.target;
+ }
+ catch (ClassCastException e)
+ {
+ // Working with the other CORBA implementation.
+ g = null;
+ }
+
+ org.omg.CORBA_2_3.portable.InputStream input = (org.omg.CORBA_2_3.portable.InputStream) in;
+
+ if (Remote.class.isAssignableFrom(clz)
+ || ValueBase.class.isAssignableFrom(clz))
+ {
+ // Interface is narrowed into Stub.
+ if (clz.isInterface())
+ try
+ {
+ clz = Util.loadClass(
+ PortableRemoteObjectDelegateImpl.getStubClassName(clz.getName()),
+ null, clz.getClassLoader());
+ }
+ catch (ClassNotFoundException e)
+ {
+ MARSHAL m = new MARSHAL("Cannot get stub from interface "
+ + clz.getClass().getName());
+ m.minor = Minor.TargetConversion;
+ m.initCause(e);
+ throw m;
+ }
+
+ // Remote needs special handling.
+ if (ObjectImpl.class.isAssignableFrom(clz))
+ {
+ // First read CORBA object reference.
+ Object ro = input.read_Object();
+
+ ObjectImpl obj = (ObjectImpl) ro;
+ if (obj == null)
+ return null;
+
+ Delegate delegate = obj._get_delegate();
+ object = instantiate(offset, clz, g);
+ ((ObjectImpl) object)._set_delegate(delegate);
+ }
+ // The object - specific data follows.
+ }
+ else if (org.omg.CORBA.Object.class.isAssignableFrom(clz))
+ object = (Serializable) input.read_Object();
+
+ if (object == null)
+ object = instantiate(offset, clz, g);
+
+ // The sentence below prevents attempt to read the internal fields of the
+ // ObjectImpl (or RMI Stub) that might follow the object definition.
+ // Sun's jre 1.5 does not write this information. The stubs, generated
+ // by rmic, does not contain such fields.
+ if (object instanceof ObjectImpl)
+ return object;
+
+ if (object instanceof Externalizable)
+ {
+ try
+ {
+ CorbaInput stream = new CorbaInput(input, object, this,
+ offset, repositoryID, g);
+
+ byte version = stream.readByte();
+ if (version != 1)
+ throw new MARSHAL("Unsuported RMI-IIOP version " + version);
+
+ ((Externalizable) object).readExternal(stream);
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("readExternal failed");
+ m.initCause(ex);
+ throw m;
+ }
+ }
+ else
+ {
+ Object mode = null;
+ synchronized (io_format)
+ {
+ mode = io_format.get(object.getClass());
+ }
+
+ if (mode == STANDARD)
+ {
+ readFields(offset, repositoryID, object, input, g);
+ }
+ else
+ {
+ try
+ {
+ Method m = object.getClass().getDeclaredMethod("readObject",
+ READ_OBJECT_ARGS);
+ try
+ {
+ m.setAccessible(true); // May be private.
+
+ CorbaInput stream = new CorbaInput(input,
+ object, this, offset, repositoryID, g);
+
+ byte version = stream.readByte();
+ if (version != 1)
+ throw new MARSHAL("Unsuported RMI-IIOP version "
+ + version);
+
+ // This would indicate is defaultWriteObject has been
+ // called,
+ // but the readObject method normally takes care about this.
+ boolean dwo = stream.readByte() != 0;
+
+ m.invoke(object, new Object[] { stream });
+ synchronized (io_format)
+ {
+ io_format.put(object.getClass(), dwo ? CUSTOM_DWO
+ : CUSTOM_NO_DWO);
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ MARSHAL mx = new MARSHAL(object.getClass().getName()
+ + ".readObject failed");
+ mx.initCause(ex);
+ throw mx;
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ // Read in a standard way.
+ synchronized (io_format)
+ {
+ io_format.put(object.getClass(), STANDARD);
+ readFields(offset, repositoryID, object, input, g);
+ }
+ }
+ }
+ }
+ return object;
+ }
+
+ /**
+ * Create an instance.
+ */
+ Serializable instantiate(int offset, Class clz, gnuRuntime g)
+ throws MARSHAL
+ {
+ Serializable object;
+ try
+ {
+ object = (Serializable) Vio.instantiateAnyWay(clz);
+ g.objectWritten(object, offset);
+ }
+ catch (Exception e)
+ {
+ MARSHAL m = new MARSHAL("Unable to instantiate " + clz);
+ m.minor = Minor.Instantiation;
+ m.initCause(e);
+ throw m;
+ }
+ return object;
+ }
+
+ /**
+ * Read fields of the object.
+ */
+ void readFields(int offset, String repositoryID, Serializable object,
+ org.omg.CORBA_2_3.portable.InputStream input, gnuRuntime r)
+ throws MARSHAL
+ {
+ Field f = null;
+ Class o_class = object.getClass();
+
+ try
+ {
+ // The returned field array must already be in canonical order.
+ Field[] fields = getWritableFields(o_class);
+
+ Class fc;
+
+ for (int i = 0; i < fields.length; i++)
+ {
+ // Full value type header expected ahead.
+ if (input instanceof HeadlessInput)
+ ((HeadlessInput) input).subsequentCalls = true;
+
+ f = fields[i];
+ fc = f.getType();
+
+ Object v;
+
+ if (fc == String.class)
+ {
+ v = input.read_value(wStringValueHelper);
+ }
+ else if (fc == int.class)
+ v = new Integer(input.read_long());
+ else if (fc == long.class)
+ v = new Long(input.read_longlong());
+ else if (fc == double.class)
+ v = new Double(input.read_double());
+ else if (fc == float.class)
+ v = new Float(input.read_float());
+ else if (fc == boolean.class)
+ v = input.read_boolean() ? Boolean.TRUE : Boolean.FALSE;
+ else if (fc == short.class)
+ v = new Short(input.read_short());
+ else if (fc == byte.class)
+ v = new Byte(input.read_octet());
+ else if (fc == char.class)
+ v = new Character(input.read_char());
+ else if (org.omg.CORBA.Object.class.isAssignableFrom(fc)
+ || Remote.class.isAssignableFrom(fc))
+ {
+ v = readValue(input, offset, fc, null, r);
+ }
+ else
+ {
+ v = Vio.read(input, fc);
+ }
+
+ f.set(object, v);
+ }
+ }
+ catch (Exception ex)
+ {
+ MARSHAL m = new MARSHAL("Cannot read " + o_class.getName() + " field "
+ + f);
+ m.initCause(ex);
+ m.minor = Minor.ValueFields;
+ throw m;
+ }
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java b/libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java
index 998d59e3379..afc254ddb49 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/StubDelegateImpl.java
@@ -1,5 +1,5 @@
-/* StubDelegateImpl.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* StubDelegateImpl.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,67 +38,273 @@ exception statement from your version. */
package gnu.javax.rmi.CORBA;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.rmi.Remote;
import java.rmi.RemoteException;
+
+import javax.rmi.PortableRemoteObject;
import javax.rmi.CORBA.Stub;
import javax.rmi.CORBA.StubDelegate;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAHelper;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POAManagerPackage.State;
+
+/**
+ * The default stub delegate.
+ *
+ * @author Wu Gansha (gansha.wu@intel.com) (stub)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) (implementation)
+ */
public class StubDelegateImpl
implements StubDelegate
{
-
- private int hashCode;
-
- public StubDelegateImpl(){
- hashCode = 0;
+ /**
+ * <p>
+ * Finds the suitable {@link Tie} for this Stub and connects it to the given
+ * ORB. The tie is found by the name pattern. If the found tie is derived from
+ * {@link org.omg.CORBA.PortableServer.Servant}, it is connected to the root
+ * POA, also activating it (if not already active).
+ * </p>
+ * <p>
+ * This method does not allow to specify, to which POA the found Tie must be
+ * connected and requires to use the deprecated method {@link ORB#connect}.
+ * Many useful POA features remain unaccessible. A better alternative it might
+ * be to generate a {@link org.omg.CORBA.PortableServer.Servant} - derived Tie
+ * (-poa key in rmic) and connect it to POA in one of the many ways, listed in
+ * the description of the {@link orb.omg.PortableServer} package). The
+ * obtained CORBA object can be narrowed into stub using
+ * {@link PortableRemoteObject#narrow}.
+ * </p>
+ *
+ * @param orb the ORB where the Stub must be connected.
+ *
+ * @throws RemoteException if the stub is already connected to some other ORB.
+ * If the stub is already connected to the ORB that was passed as parameter,
+ * the method returns without action.
+ *
+ * @throws BAD_PARAM if the name of this stub does not match the stub name
+ * pattern, "_*_Stub" or if the Tie class, "_*Impl_Tie", does not exists or an
+ * instance of this class cannot be instantiated.
+ */
+ public void connect(Stub self, ORB orb)
+ throws RemoteException
+ {
+ connect(self, orb, null);
}
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- public void connect(Stub self, javax.rmi.ORB orb)
+
+ /**
+ * Connect when the POA is specified.
+ */
+ public static void connect(Stub self, ORB orb, POA poa)
throws RemoteException
{
- throw new Error("Not implemented for StubDelegate");
+ ORB oorb = null;
+ try
+ {
+ Delegate d = self._get_delegate();
+ if (d != null)
+ oorb = d.orb(self);
+ }
+ catch (Exception e)
+ {
+ // Failed to get Delegate or ORB.
+ // (possible ony for user-written Stubs).
+ }
+
+ if (oorb != null)
+ {
+ if (!oorb.equals(orb))
+ throw new RemoteException("Stub " + self
+ + " is connected to another ORB, " + orb);
+ else
+ return;
+ }
+
+ Tie t = null;
+ if (self instanceof Remote)
+ t = Util.getTie((Remote) self);
+
+ // Find by name pattern.
+ if (t == null)
+ t = getTieFromStub(self);
+
+ Delegate delegate;
+
+ if (t instanceof Servant)
+ {
+ try
+ {
+ if (poa == null)
+ {
+ poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
+ // Activate if not active.
+ if (poa.the_POAManager().get_state().value() == State._HOLDING)
+ poa.the_POAManager().activate();
+ }
+
+ ObjectImpl obj = (ObjectImpl) poa.servant_to_reference((Servant) t);
+ delegate = obj._get_delegate();
+ }
+ catch (Exception ex)
+ {
+ throw new Unexpected(ex);
+ }
+ }
+ else if (t instanceof ObjectImpl)
+ {
+ ObjectImpl o = (ObjectImpl) t;
+ orb.connect(o);
+ delegate = o._get_delegate();
+ }
+ else
+ throw new BAD_PARAM("The Tie must be either Servant or ObjectImpl");
+
+ self._set_delegate(delegate);
}
- public boolean equals(Stub self, Object obj)
+ /**
+ * Locate a tie class, appropriate to the given stub class, by the name
+ * pattern.
+ */
+ public static Tie getTieFromStub(java.lang.Object self)
{
- if(self == null || obj == null)
- return self == obj;
- if(!(obj instanceof Stub))
- return false;
- return self.hashCode() == ((Stub)obj).hashCode();
+ Tie t;
+ String sn = self.getClass().getName();
+ if (!sn.endsWith("_Stub"))
+ throw new BAD_PARAM("The stub name, " + sn
+ + ", does not match _*_Stub pattern");
+
+ String tn = sn.substring(0, sn.length() - "_Stub".length()) + "Impl_Tie";
+ Class tieClass = null;
+
+ try
+ {
+ tieClass = ObjectCreator.forName(tn);
+ t = (Tie) tieClass.newInstance();
+ if (self instanceof Remote)
+ Util.registerTarget(t, (Remote) self);
+ }
+ catch (Exception e)
+ {
+ BAD_PARAM bad = new BAD_PARAM("Unable to instantiate '" + tn + "'");
+ bad.initCause(e);
+ throw bad;
+ }
+ return t;
+ }
+
+ /**
+ * Compare two stubs for equality.
+ */
+ public boolean equals(Stub self, java.lang.Object obj)
+ {
+ if (obj instanceof ObjectImpl)
+ {
+ ObjectImpl other = (ObjectImpl) obj;
+ Delegate d1 = other._get_delegate();
+ Delegate d2 = self._get_delegate();
+ if (d1 == null || d2 == null)
+ return d1 == d2;
+ else
+ return d1.equals(d2);
+ }
+ else return false;
}
+ /**
+ * Get the hash code (from IOR reference).
+ */
public int hashCode(Stub self)
{
- //FIX ME
- return hashCode;
+ Delegate d = self._get_delegate();
+ return d==null?0:d.hashCode();
}
+ /**
+ * Returns the IOR reference of the connected ORB.
+ *
+ * @see ORB#object_to_string(org.omg.CORBA.Object);
+ */
public String toString(Stub self)
{
try
{
- return self._orb().object_to_string(self);
+ return self._orb().object_to_string(self);
}
- // XXX javax.rmi.BAD_OPERATION -> org.omg.CORBA.BAD_OPERATION
- catch(javax.rmi.BAD_OPERATION bad_operation)
+ catch (Exception ex)
{
- return null;
+ return null;
}
}
- public void readObject(Stub self, ObjectInputStream s)
+ /**
+ * This should never be called. The ORB must be supplied.
+ *
+ * @see #connect
+ */
+ public void readObject(Stub self, ObjectInputStream input)
throws IOException, ClassNotFoundException
{
- throw new Error("Not implemented for StubDelegate");
+ readObject(self, input, null);
}
- public void writeObject(Stub self, ObjectOutputStream s)
+ /**
+ * Read as CORBA object when the ORB is known. The ORB must be set under the
+ * previous call of Stub.connect. The Stub is automatically registered with
+ * this ORB.
+ */
+ public void readObject(Stub self, ObjectInputStream input, ORB orb)
+ throws IOException, ClassNotFoundException
+ {
+ byte[] b = (byte[]) input.readObject();
+ BufferredCdrInput in = new BufferredCdrInput(b);
+
+ if (orb != null)
+ in.setOrb(orb);
+
+ ObjectImpl r = (ObjectImpl) in.read_Object();
+
+ self._set_delegate(r._get_delegate());
+ }
+
+ /**
+ * Write as CORBA object. The ORB is taken from the
+ * org.omg.CORBA.portable.Delegate. The Stub is automatically registered with
+ * this ORB (if not already done).
+ */
+ public void writeObject(Stub self, ObjectOutputStream output)
+ throws IOException
+ {
+ writeObject(self, output, null);
+ }
+
+ /**
+ * Write as CORBA object. The ORB must be either set under the previous call
+ * of Stub.connect or it is taken from the org.omg.CORBA.portable.Delegate.
+ * The Stub is automatically registered with this ORB (if not already done).
+ */
+ public void writeObject(Stub self, ObjectOutputStream output, ORB orb)
throws IOException
{
- throw new Error("Not implemented for StubDelegate");
+ BufferedCdrOutput out = new BufferedCdrOutput();
+ out.setOrb(orb == null ? self._orb() : orb);
+ out.write_Object(self);
+
+ output.writeObject(out.buffer.toByteArray());
}
-
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/TieTargetRecord.java b/libjava/classpath/gnu/javax/rmi/CORBA/TieTargetRecord.java
new file mode 100644
index 00000000000..70e751a6f2c
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/TieTargetRecord.java
@@ -0,0 +1,93 @@
+/* TieTargetRecord.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import java.util.HashSet;
+
+import javax.rmi.CORBA.Tie;
+
+/**
+ * Represents a Tie, connected to possibly multiple invocation targets.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class TieTargetRecord
+{
+ /**
+ * The associated Tie.
+ */
+ public final Tie tie;
+
+ /**
+ * The objects, exposing the tie.
+ */
+ public HashSet targets = new HashSet();
+
+ /**
+ * Create a new record.
+ */
+ public TieTargetRecord(Tie a_tie)
+ {
+ tie = a_tie;
+ }
+
+ /**
+ * Add a target.
+ */
+ public void add(Object target)
+ {
+ targets.add(target);
+ }
+
+ /**
+ * Remove target.
+ */
+ public void remove(Object target)
+ {
+ targets.remove(target);
+ }
+
+ /**
+ * Return true if the tie has no associated invocation targets.
+ */
+ public boolean unused()
+ {
+ return targets.size() == 0;
+ }
+}
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java b/libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java
index 7bed2aa22dc..66a4e24ff18 100644
--- a/libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/UtilDelegateImpl.java
@@ -1,5 +1,5 @@
-/* UtilDelegateImpl.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* UtilDelegateImpl.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,115 +38,717 @@ exception statement from your version. */
package gnu.javax.rmi.CORBA;
+import gnu.CORBA.Minor;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.Poa.ORB_1_4;
+import gnu.CORBA.Poa.AOM;
+import gnu.CORBA.Poa.gnuPOA;
+import gnu.CORBA.typecodes.GeneralTypeCode;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.INV_OBJREF;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.OMGVMCID;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.rmi.AccessException;
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
+import java.rmi.ServerError;
+import java.rmi.ServerException;
+import java.rmi.UnexpectedException;
import java.rmi.server.RMIClassLoader;
-import java.net.MalformedURLException;
-import java.io.*;
-//import org.omg.CORBA.ORB;
-//import org.omg.CORBA.SystemException;
-//import org.omg.CORBA.portable.InputStream;
-//import org.omg.CORBA.portable.OutputStream;
-import javax.rmi.CORBA.*;
+import java.util.Hashtable;
+
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.UtilDelegate;
+import javax.rmi.CORBA.ValueHandler;
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+/**
+ * The implementation of UtilDelegate.
+ *
+ * @author Wu Gansha (gansha.wu@intel.com) (stub)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) (implementation)
+ */
public class UtilDelegateImpl
+ extends RmiUtilities
implements UtilDelegate
{
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- public Object copyObject(Object obj, javax.rmi.ORB orb)
+ /**
+ * The instance of the value handler, requested once.
+ */
+ static ValueHandler m_ValueHandler;
+
+ /**
+ * The global map of all ties to they records.
+ */
+ static Hashtable m_Ties = new Hashtable();
+
+ /**
+ * The global map of all targets to they records.
+ */
+ static Hashtable m_Targets = new Hashtable();
+
+ /**
+ * The standard package for that the exception names are omitted.
+ */
+ static final String m_StandardPackage = "org.omg.CORBA.";
+
+ /**
+ * Make a deep copy of the object.
+ */
+ public Object copyObject(Object obj, ORB orb)
throws RemoteException
{
- throw new Error("Not implemented for UtilDelegate");
+ // Strings are immutable, can be shared.
+ if (obj instanceof String)
+ return obj;
+ else if (obj == null)
+ return null;
+ else if (obj instanceof String[] || obj instanceof String[][]
+ || obj instanceof String[][][])
+ {
+ // String arrays can be just cloned.
+ return ((Object[]) obj).clone();
+ }
+ else if (obj instanceof Serializable)
+ {
+ try
+ {
+ ByteArrayOutputStream a = new ByteArrayOutputStream();
+ ObjectOutputStream ou = new ObjectOutputStream(a);
+ ou.writeObject(obj);
+ ou.close();
+ ObjectInputStream input = new ObjectInputStream(
+ new ByteArrayInputStream(a.toByteArray()));
+ return input.readObject();
+ }
+ catch (Exception ex)
+ {
+ RemoteException rex = new RemoteException("Cannot copy " + obj);
+ throw rex;
+ }
+ }
+ else
+ return obj;
}
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- public Object[] copyObjects(Object obj[], javax.rmi.ORB orb)
+ /**
+ * Make a deep copy of the object array.
+ */
+ public Object[] copyObjects(Object[] obj, ORB orb)
throws RemoteException
{
- throw new Error("Not implemented for UtilDelegate");
+ return (Object[]) copyObject(obj, orb);
}
public ValueHandler createValueHandler()
{
- throw new Error("Not implemented for UtilDelegate");
+ if (m_ValueHandler == null)
+ m_ValueHandler = (ValueHandler) DelegateFactory.getInstance(DelegateFactory.VALUEHANDLER);
+ return m_ValueHandler;
}
-
+
+ /**
+ * Returns the codebase of the given class.
+ */
public String getCodebase(Class clz)
{
- throw new Error("Not implemented for UtilDelegate");
+ return RMIClassLoader.getClassAnnotation(clz);
}
-
+
+ /**
+ * Get the Tie that handles invocations on the given target. If the target/Tie
+ * pair has not been previously registered using {@link #registerTarget},
+ * this method tries to locate a tie class by the name pattern. If this
+ * succeeds, the tie-target pair is also registered.
+ *
+ * @return the Tie.
+ */
public Tie getTie(Remote target)
{
- throw new Error("Not implemented for UtilDelegate");
+ synchronized (m_Targets)
+ {
+ Tie tie;
+ TieTargetRecord r = ((TieTargetRecord) m_Targets.get(target));
+ if (r == null)
+ {
+ if (target instanceof Stub)
+ {
+ tie = StubDelegateImpl.getTieFromStub(target);
+ registerTarget(tie, target);
+ }
+ else
+ {
+ // Treat this as implementation.
+ String tieClassName = getTieClassName(target.getClass().getName());
+ try
+ {
+ Class tieClass = Util.loadClass(tieClassName, null,
+ target.getClass().getClassLoader());
+ tie = (Tie) tieClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ MARSHAL m = new MARSHAL("Unable to instantiate "
+ + tieClassName);
+ m.minor = Minor.TargetConversion;
+ m.initCause(e);
+ throw m;
+ }
+ tie.setTarget(target);
+ registerTarget(tie, target);
+ }
+ }
+ else
+ tie = r.tie;
+ return tie;
+ }
+ }
+
+ /**
+ * Get the Stub class name for the name, representing the given interface.
+ */
+ private String getTieClassName(String interf)
+ {
+ String stubClassName;
+ int p = interf.lastIndexOf('.');
+
+ if (p < 0)
+ // The interface is defined in the default package.
+ stubClassName = "_" + interf + "_Tie";
+ else
+ stubClassName = interf.substring(0, p + 1) + "_"
+ + interf.substring(p + 1) + "_Tie";
+ return stubClassName;
}
-
+
+ /**
+ * Register the Tie-target pair. As the Tie is a Servant, it can potentially
+ * be connected to several objects and hence may be registered with several
+ * targets.
+ */
+ public void registerTarget(Tie tie, Remote target)
+ {
+ synchronized (m_Ties)
+ {
+ synchronized (m_Targets)
+ {
+ TieTargetRecord r = (TieTargetRecord) m_Ties.get(tie);
+ if (r == null)
+ {
+ // First registration for this Tie.
+ r = new TieTargetRecord(tie);
+ m_Ties.put(tie, r);
+ }
+ if (target != null)
+ {
+ r.add(target);
+ m_Targets.put(target, r);
+ }
+ }
+ }
+ }
+
+ /**
+ * Deactivate the associated Tie, if it is found and is not connected to other
+ * registered targets. Independing from the POA policies, the transparent
+ * reactivation will not be possible.
+ */
+ public void unexportObject(Remote target)
+ throws NoSuchObjectException
+ {
+ synchronized (m_Ties)
+ {
+ synchronized (m_Targets)
+ {
+ TieTargetRecord r = ((TieTargetRecord) m_Targets.get(target));
+ if (r != null)
+ {
+ if (target instanceof org.omg.CORBA.Object)
+ r.tie.orb().disconnect((org.omg.CORBA.Object) target);
+
+ if (r.unused())
+ {
+ m_Targets.remove(target);
+ m_Ties.remove(r.tie);
+ r.tie.deactivate();
+
+ if (r.tie.orb() instanceof ORB_1_4)
+ {
+ // Standard case, when more deep cleanup is possible.
+ // Independing from the POA policies, the object will
+ // not be activable transparently.
+ ORB_1_4 orb = (ORB_1_4) r.tie.orb();
+
+ if (target instanceof org.omg.CORBA.Object)
+ {
+ AOM.Obj record = orb.rootPOA.findObject((org.omg.CORBA.Object) target);
+
+ if (record != null && record.servant == r.tie
+ && record.poa instanceof gnuPOA)
+ {
+ ((gnuPOA) record.poa).aom.remove(record.key);
+ record.deactivated = true;
+ record.servant = null;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks if the given stub is local.
+ *
+ * @param stub a stub to check.
+ * @return true if the stub is local, false otherwise.
+ */
public boolean isLocal(Stub stub)
throws RemoteException
{
- throw new Error("Not implemented for UtilDelegate");
+ try
+ {
+ return stub._is_local();
+ }
+ catch (SystemException e)
+ {
+ RemoteException rex = new RemoteException();
+ rex.initCause(e);
+ throw rex;
+ }
}
+ /**
+ * Load the class. The method uses class loaders from the call stact first. If
+ * this fails, the further behaviour depends on the System Property
+ * "java.rmi.server.useCodebaseOnly" with default value "false".
+ *
+ * <ul>
+ * <li>Try the current thread context class loader first.</li>
+ * <li>If remoteCodebase is non-null and useCodebaseOnly is "false" then call
+ * java.rmi.server.RMIClassLoader.loadClass (remoteCodebase, className)</li>
+ * <li> If remoteCodebase is null or useCodebaseOnly is true then call
+ * java.rmi.server.RMIClassLoader.loadClass(className)</li>
+ * <li>If a class is still not successfully loaded and the loader != null
+ * then try Class.forName(className, false, loader). </li>
+ * </ul>
+ *
+ * @param className the name of the class.
+ * @param remoteCodebase the codebase.
+ * @param loader the class loader.
+ * @return the loaded class.
+ *
+ * @throws ClassNotFoundException of the class cannot be loaded.
+ */
public Class loadClass(String className, String remoteCodebase,
- ClassLoader loader)
+ ClassLoader loader)
throws ClassNotFoundException
{
- try{
- if (remoteCodebase == null)
- return RMIClassLoader.loadClass(className);
- else
- return RMIClassLoader.loadClass(remoteCodebase, className);
- }
- catch (MalformedURLException e1)
+ if (loader == null)
+ loader = Thread.currentThread().getContextClassLoader();
+
+ String p_useCodebaseOnly = System.getProperty("java.rmi.server.useCodebaseOnly");
+
+ boolean useCodebaseOnly = p_useCodebaseOnly != null
+ && p_useCodebaseOnly.trim().equalsIgnoreCase("true");
+
+ try
{
- throw new ClassNotFoundException(className, e1);
+ if (remoteCodebase != null && !useCodebaseOnly)
+ return RMIClassLoader.loadClass(remoteCodebase, className);
}
- catch(ClassNotFoundException e2)
+ catch (Exception e)
{
- if(loader != null)
- return loader.loadClass(className);
- else
- return null;
+ // This failed but try others.
}
+
+ try
+ {
+ if (remoteCodebase == null || useCodebaseOnly)
+ return RMIClassLoader.loadClass(remoteCodebase, className);
+ }
+ catch (Exception e)
+ {
+ // This failed but try others.
+ }
+
+ if (loader != null)
+ return Class.forName(className, true, loader);
+
+ throw new ClassNotFoundException(className + " at " + remoteCodebase);
}
+ /**
+ * Converts CORBA {@link SystemException} into RMI {@link RemoteException}.
+ * The exception is converted as defined in the following table:
+ * <p>
+ * <table border = "1">
+ * <tr>
+ * <th>CORBA Exception</th>
+ * <th>RMI Exception</th>
+ * </tr>
+ * <tr>
+ * <td>{@link COMM_FAILURE}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INV_OBJREF}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link NO_PERMISSION}</td>
+ * <td>{@link AccessException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link MARSHAL}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link BAD_PARAM} (all other cases)</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OBJECT_NOT_EXIST}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_REQUIRED}</td>
+ * <td>{@link TransactionRequiredException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_ROLLEDBACK}</td>
+ * <td>{@link TransactionRolledbackException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INVALID_TRANSACTION}</td>
+ * <td>{@link InvalidTransactionException}</td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="lightgray">Any other {@link SystemException}</td>
+ * <td bgcolor="lightgray">{@link RemoteException}</td>
+ * </tr>
+ * </table>
+ * </p>
+ * <p>
+ * The exception detailed message always consists of
+ * <ol>
+ * <li>the string "CORBA "</li>
+ * <li>the CORBA name of the system exception</li>
+ * <li>single space</li>
+ * <li>the hexadecimal value of the system exception's minor code, preceeded
+ * by 0x (higher bits contain {@link OMGVMCID}).</li>
+ * <li>single space</li>
+ * <li>the {@link CompletionStatus} of the exception: "Yes", "No" or "Maybe".</li>
+ * </ol>
+ * <p>
+ * For instance, if the Internet connection was refused:
+ * </p>
+ * <p>
+ * <pre>
+ * <code>CORBA COMM_FAILURE 0x535500C9 No</code>
+ * </p>
+ * <p>
+ * The original CORBA exception is set as the cause of the RemoteException
+ * being created.
+ * </p>
+ */
public RemoteException mapSystemException(SystemException ex)
{
- throw new Error("Not implemented for UtilDelegate");
+ RemoteException rex;
+
+ String status;
+
+ switch (ex.completed.value())
+ {
+ case CompletionStatus._COMPLETED_MAYBE:
+ status = "Maybe";
+ break;
+
+ case CompletionStatus._COMPLETED_NO:
+ status = "No";
+ break;
+
+ case CompletionStatus._COMPLETED_YES:
+ status = "Yes";
+ break;
+
+ default:
+ status = "Unexpected completion status " + ex.completed.value();
+ }
+
+ String name = ex.getClass().getName();
+
+ if (name.startsWith(m_StandardPackage))
+ name = name.substring(m_StandardPackage.length());
+
+ String message = "CORBA " + name + " 0x" + Integer.toHexString(ex.minor)
+ + " " + status;
+
+ if (ex instanceof COMM_FAILURE)
+ rex = new MarshalException(message, ex);
+ else if (ex instanceof INV_OBJREF)
+ {
+ rex = new NoSuchObjectException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof NO_PERMISSION)
+ rex = new AccessException(message, ex);
+ else if (ex instanceof MARSHAL)
+ rex = new MarshalException(message, ex);
+ else if (ex instanceof BAD_PARAM)
+ rex = new MarshalException(message, ex);
+ else if (ex instanceof OBJECT_NOT_EXIST)
+ {
+ rex = new NoSuchObjectException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof TRANSACTION_REQUIRED)
+ {
+ rex = new TransactionRequiredException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof TRANSACTION_ROLLEDBACK)
+ {
+ rex = new TransactionRolledbackException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof INVALID_TRANSACTION)
+ {
+ rex = new InvalidTransactionException(message);
+ rex.detail = ex;
+ }
+ else if (ex instanceof UNKNOWN)
+ rex = wrapException(ex.getCause());
+ else
+ rex = new RemoteException(message, ex);
+
+ return rex;
}
- public Object readAny(InputStream in)
+ /**
+ * Converts the exception that was thrown by the implementation method on a
+ * server side into RemoteException that can be transferred and re-thrown on a
+ * client side. The method converts exceptions as defined in the following
+ * table: <table border = "1">
+ * <tr>
+ * <th>Exception to map (or subclass)</th>
+ * <th>Maps into</th>
+ * </tr>
+ * <tr>
+ * <td>{@link Error}</td>
+ * <td>{@link ServerError}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RemoteException}</td>
+ * <td>{@link ServerException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link SystemException}</td>
+ * <td>wrapException({@link #mapSystemException})</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RuntimeException}</td>
+ * <td><b>rethrows</b></td>
+ * </tr>
+ * <tr>
+ * <td>Any other exception</td>
+ * <td>{@link UnexpectedException}</td>
+ * </tr>
+ * </table>
+ *
+ * @param ex an exception that was thrown on a server side implementation.
+ *
+ * @return the corresponding RemoteException unless it is a RuntimeException.
+ *
+ * @throws RuntimeException the passed exception if it is an instance of
+ * RuntimeException.
+ *
+ * @specnote It is the same behavior, as in Suns implementations 1.4.0-1.5.0.
+ */
+ public RemoteException wrapException(Throwable ex)
+ throws RuntimeException
{
- throw new Error("Not implemented for UtilDelegate");
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException) ex;
+ else if (ex instanceof Error)
+ return new ServerError(ex.getMessage(), (Error) ex);
+ else if (ex instanceof RemoteException)
+ return new ServerException(ex.getMessage(), (Exception) ex);
+ else if (ex instanceof SystemException)
+ return wrapException(mapSystemException((SystemException) ex));
+ else
+ return new UnexpectedException("Unexpected", (Exception) ex);
}
- public void registerTarget(Tie tie, Remote target)
+ /**
+ * Write abstract interface to the CORBA output stream. The write format is
+ * matching CORBA abstract interface. Remotes and CORBA objects are written as
+ * objects, other classes are supposed to be value types and are written as
+ * such. {@link Remote}s are processed as defined in
+ * {@link #writeRemoteObject}. The written data contains discriminator,
+ * defining, that was written. Another method that writes the same content is
+ * {@link org.omg.CORBA_2_3.portable.OutputStream#write_abstract_interface(java.lang.Object)}.
+ *
+ * @param output a stream to write to, must be
+ * {@link org.omg.CORBA_2_3.portable.OutputStream}.
+ *
+ * @param object an object to write, must be CORBA object, Remote
+ */
+ public void writeAbstractObject(OutputStream output, Object object)
{
- throw new Error("Not implemented for UtilDelegate");
+ ((org.omg.CORBA_2_3.portable.OutputStream) output).write_abstract_interface(object);
}
-
- public void unexportObject(Remote target)
+
+ /**
+ * Write the passed java object to the output stream in the form of the CORBA
+ * {@link Any}. This includes creating an writing the object {@link TypeCode}
+ * first. Such Any can be later read by a non-RMI-IIOP CORBA implementation
+ * and manipulated, for instance, by means, provided in
+ * {@link org.omg.DynamicAny.DynAny}. Depending from the passed value, this
+ * method writes CORBA object, value type or value box. For value types Null
+ * is written with the abstract interface, its typecode having repository id
+ * "IDL:omg.org/CORBA/AbstractBase:1.0" and the empty string name.
+ *
+ * @param output the object to write.
+ * @param object the java object that must be written in the form of the CORBA
+ * {@link Any}.
+ */
+ public void writeAny(OutputStream output, Object object)
{
- throw new Error("Not implemented for UtilDelegate");
+ Any any = output.orb().create_any();
+ if (object == null)
+ {
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_abstract_interface);
+ t.setId("IDL:omg.org/CORBA/AbstractBase:1.0");
+ t.setName("");
+ any.type(t);
+ output.write_any(any);
+ return;
+ }
+ else if (object instanceof org.omg.CORBA.Object
+ && !(object instanceof Remote))
+ {
+ // Write as value type.
+ boolean inserted = ObjectCreator.insertWithHelper(any, object);
+ if (inserted)
+ {
+ output.write_any(any);
+ return;
+ }
+ }
+
+ if (object instanceof org.omg.CORBA.Object)
+ writeAnyAsRemote(output, object);
+ else if (object instanceof Serializable)
+ {
+ any.insert_Value((Serializable) object);
+ output.write_any(any);
+ }
+ else
+ {
+ MARSHAL m = new MARSHAL(object.getClass().getName()
+ + " must be CORBA Object, Remote or Serializable");
+ m.minor = Minor.NonSerializable;
+ throw m;
+ }
}
-
- public RemoteException wrapException(Throwable orig)
+
+ /**
+ * Write Any as for remote object.
+ */
+ void writeAnyAsRemote(OutputStream output, Object object)
{
- throw new Error("Not implemented for UtilDelegate");
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_objref);
+ t.setId(m_ValueHandler.getRMIRepositoryID(object.getClass()));
+ t.setName(object.getClass().getName());
+
+ // Writing Any (typecode, followed by value).
+ output.write_TypeCode(t);
+ writeRemoteObject(output, object);
}
-
- public void writeAbstractObject(OutputStream out, Object obj)
+
+ /**
+ * Get the class name excluding the package name.
+ */
+ String getName(String n)
{
- throw new Error("Not implemented for UtilDelegate");
+ int p = n.lastIndexOf('.');
+ if (p < 0)
+ return n;
+ else
+ return n.substring(p + 1);
}
-
- public void writeAny(OutputStream out, Object obj)
+
+ /**
+ * Read Any from the input stream.
+ */
+ public Object readAny(InputStream input)
{
- throw new Error("Not implemented for UtilDelegate");
+ return input.read_any();
}
- public void writeRemoteObject(OutputStream out, Object obj)
+ /**
+ * Write the passed parameter to the output stream as CORBA object. If the
+ * parameter is an instance of Remote and not an instance of Stub, the method
+ * instantiates a suitable Tie, connects the parameter to this Tie and then
+ * connects that Tie to the ORB that is requested from the output stream. Then
+ * the object reference is written to the stream, making remote invocations
+ * possible. This method is used in write_value(..) method group in
+ * {@link org.omg.CORBA_2_3.portable.OutputStream} and also may be called
+ * directly from generated Stubs and Ties.
+ *
+ * @param output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ public void writeRemoteObject(OutputStream an_output, Object object)
{
- throw new Error("Not implemented for UtilDelegate");
+ org.omg.CORBA_2_3.portable.OutputStream output = (org.omg.CORBA_2_3.portable.OutputStream) an_output;
+ if (object == null)
+ an_output.write_Object(null);
+ else if (isTieRequired(object))
+ {
+ // Find the interface that is implemented by the object and extends
+ // Remote.
+ Class fc = getExportedInterface(object);
+ exportTie(output, object, fc);
+ }
+ else if (object instanceof org.omg.CORBA.Object)
+ {
+ ensureOrbRunning(output);
+ an_output.write_Object((org.omg.CORBA.Object) object);
+ }
+ else if (object != null && object instanceof Serializable)
+ writeFields(an_output, (Serializable) object);
}
-}
+
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java b/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java
new file mode 100644
index 00000000000..dc3b3cd6ee8
--- /dev/null
+++ b/libjava/classpath/gnu/javax/rmi/CORBA/ValueHandlerDelegateImpl.java
@@ -0,0 +1,163 @@
+/* ValueHandlerDelegateImpl.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.rmi.CORBA;
+
+import gnu.CORBA.CDR.gnuRuntime;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CustomMarshal;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.SendingContext.RunTime;
+
+import java.io.Externalizable;
+import java.io.ObjectStreamClass;
+import java.io.Serializable;
+import java.rmi.Remote;
+
+import javax.rmi.CORBA.ValueHandler;
+import javax.rmi.CORBA.ValueHandlerMultiFormat;
+
+/**
+ * Implementation of the ValueHandler.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) (implementation)
+ */
+public class ValueHandlerDelegateImpl
+ extends RmiUtilities
+ implements ValueHandler, ValueHandlerMultiFormat
+{
+ /**
+ * Return the maximal supported stream format version. We currently
+ * support the version 1.
+ *
+ * TODO Support the version 2.
+ */
+ public byte getMaximumStreamFormatVersion()
+ {
+ return 1;
+ }
+
+ /**
+ * Write value using the given stream format version.
+ */
+ public void writeValue(OutputStream output, Serializable value, byte version)
+ {
+ if (version!=1)
+ throw new BAD_PARAM("Unsupported stream format version "+version);
+ else
+ writeValue(output, value);
+ }
+
+ /**
+ * This implementation associates RunTime with stream rather than with the
+ * value handler and this method is not used in the implementation. It is
+ * implemented just for the sake of compatibility.
+ */
+ public RunTime getRunTimeCodeBase()
+ {
+ return new gnuRuntime(null, null);
+ }
+
+ /**
+ * Checks if an instance of this class can write its fields itself.
+ */
+ public boolean isCustomMarshaled(Class clz)
+ {
+ return CustomMarshal.class.isAssignableFrom(clz)
+ || Streamable.class.isAssignableFrom(clz);
+ }
+
+ /**
+ * No replacement, returns the passed parameter.
+ */
+ public Serializable writeReplace(Serializable value)
+ {
+ return value;
+ }
+
+ /**
+ * Compute the repository id in the RMI hashed format.
+ */
+ public String getRMIRepositoryID(final Class cx)
+ {
+ long hash = 0;
+ Class of = cx.isArray() ? cx.getComponentType() : null;
+
+ if (cx.equals(String[].class))
+ return RMI_STRING_ARRAY_ID;
+ else if (cx.equals(String.class))
+ return RMI_STRING_ID;
+ else if (cx.equals(Class.class))
+ return RMI_CLASS_ID;
+ else if (Remote.class.isAssignableFrom(cx)
+ || !Serializable.class.isAssignableFrom(cx)
+ || cx.isInterface()
+ || (cx.isArray() && (!Serializable.class.isAssignableFrom(of)
+ || of.isPrimitive() || Remote.class.isAssignableFrom(of)))
+
+ )
+ // Some classes that have zero hash code and serial no version id
+ // included.
+ return "RMI:" + cx.getName() + ":" + toHex(hash);
+ else if (cx.isArray())
+ // Arrays have the same hashcode and uid as they components.
+ return "RMI:" + cx.getName() + ":" + toHex(getHashCode(of)) + ":"
+ + toHex(getSid(of));
+ else
+ {
+ if (Externalizable.class.isAssignableFrom(cx))
+ hash = 1;
+ else
+ hash = getHashCode(cx);
+
+ return "RMI:" + cx.getName() + ":" + toHex(hash) + ":"
+ + toHex(getSid(cx));
+ }
+ }
+
+ /**
+ * Get the class serial version UID.
+ */
+ long getSid(Class cx)
+ {
+ ObjectStreamClass osc = ObjectStreamClass.lookup(cx);
+ return osc.getSerialVersionUID();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/gnu/javax/rmi/PortableServer.java b/libjava/classpath/gnu/javax/rmi/PortableServer.java
deleted file mode 100644
index 4a841387dd7..00000000000
--- a/libjava/classpath/gnu/javax/rmi/PortableServer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/* PortableServer.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package gnu.javax.rmi;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.NoSuchObjectException;
-import java.rmi.server.UnicastRemoteObject;
-import java.rmi.server.RemoteStub;
-import java.util.Hashtable;
-
-import javax.rmi.CORBA.*;
-
-/**
- * The relationship of PortableRemoteObjectImpl with PortableServer
- * is like that of UnicastRemoteObject with UnicastServer
- */
-public class PortableServer
-{
- static private Hashtable tieCache = new Hashtable();
- static private Object NO_TIE = new Object();
-
- public static final synchronized void exportObject(Remote obj)
- throws RemoteException
- {
- if(Util.getTie(obj) != null)
- return;
-
- Tie tie = getTieFromRemote(obj);
- if (tie != null)
- Util.registerTarget(tie, obj);
- else
- UnicastRemoteObject.exportObject(obj);
- }
-
- public static final void unexportObject(Remote obj)
- {
- if (Util.getTie(obj) != null)
- Util.unexportObject(obj);
- if (tieCache.get(obj) != null) //??
- tieCache.remove(obj);
- }
-
- public static final Remote toStub(Remote obj)
- throws NoSuchObjectException
- {
- if (obj instanceof Stub || obj instanceof RemoteStub)
- return obj;
-
- Tie tie = Util.getTie(obj);
- Remote stub;
- if (tie != null)
- stub = getStubFromTie(tie);
- else
- throw new NoSuchObjectException("Can't toStub an unexported object");
- return stub;
- }
-
- static synchronized Tie getTieFromRemote(Remote obj)
- {
- Object tie = tieCache.get(obj);
- if (tie == null)
- {
- tie = getTieFromClass(obj.getClass());
- if(tie == null)
- tieCache.put(obj, NO_TIE);
- else
- tieCache.put(obj, tie);
- }
- else
- if(tie != NO_TIE)
- {
- try
- {
- tie = obj.getClass().newInstance();
- }
- catch(Exception _)
- {
- tie = null;
- }
- }
- else //NO_TIE
- tie = null;
-
- return (Tie)tie;
- }
-
- static synchronized Tie getTieFromClass(Class clz)
- {
- //FIX ME
- return null;
- }
-
- public static Remote getStubFromTie(Tie tie)
- {
- //FIX ME
- return null;
- }
-
- public static Remote getStubFromObjectImpl(ObjectImpl objimpl, Class toClass)
- {
- //FIX ME
- return null;
- }
-}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java
new file mode 100644
index 00000000000..fb9e684d096
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java
@@ -0,0 +1,130 @@
+/* AlsaInputPortDevice.java -- ALSA MIDI In Port
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
+import gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.AlsaPortInfo;
+
+/**
+ * ALSA MIDI In Port.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class AlsaInputPortDevice extends AlsaPortDevice
+{
+
+ AlsaInputPortDevice (AlsaPortInfo info)
+ {
+ super(info);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#open()
+ */
+ public void open() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#close()
+ */
+ public void close()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#isOpen()
+ */
+ public boolean isOpen()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMicrosecondPosition()
+ */
+ public long getMicrosecondPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxReceivers()
+ */
+ public int getMaxReceivers()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxTransmitters()
+ */
+ public int getMaxTransmitters()
+ {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getReceiver()
+ */
+ public Receiver getReceiver() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getTransmitter()
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ return new AlsaTransmitter();
+ }
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java
new file mode 100644
index 00000000000..4951be6059c
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java
@@ -0,0 +1,216 @@
+/* AlsaMidiDeviceProvider.java -- The ALSA MIDI Device Provider
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import gnu.classpath.Configuration;
+
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDevice.Info;
+import javax.sound.midi.spi.MidiDeviceProvider;
+
+/**
+ * Provide ALSA MIDI devices.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class AlsaMidiDeviceProvider extends MidiDeviceProvider
+{
+ /**
+ * Abstract base for ALSA specific MIDI device info.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static abstract class AlsaInfo extends Info
+ {
+ /**
+ * Create an ALSA specific MIDI device info object.
+ *
+ * @param name the device name
+ * @param description the device description
+ */
+ public AlsaInfo(String name, String description)
+ {
+ super(name, "Alsa", description, "0.0");
+ }
+
+ abstract MidiDevice getDevice ();
+ }
+
+ /**
+ * ALSA MIDI Port.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ public static abstract class AlsaPortInfo extends AlsaInfo
+ {
+ long client;
+ long port;
+
+ /**
+ * Create ALSA MIDI In Port.
+ *
+ * @param name the device name
+ * @param description the device description
+ * @param client the client ID
+ * @param port the port ID
+ */
+ public AlsaPortInfo(String name, String description, long client, long port)
+ {
+ super(name, description);
+ this.client = client;
+ this.port = port;
+ }
+ }
+
+ /**
+ * ALSA Sequencer specific info.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static class AlsaSequencerInfo extends AlsaInfo
+ {
+ public AlsaSequencerInfo(String name, String description)
+ {
+ super(name, description);
+ }
+
+ MidiDevice getDevice()
+ {
+ return AlsaMidiSequencerDevice.getInstance();
+ }
+ }
+
+ /**
+ * ALSA MIDI In Port.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static class AlsaInputPortInfo extends AlsaPortInfo
+ {
+ public AlsaInputPortInfo(String name, String description, long client, long port)
+ {
+ super(name, description, client, port);
+ }
+
+ MidiDevice getDevice()
+ {
+ return new AlsaInputPortDevice(this);
+ }
+ }
+
+ /**
+ * ALSA MIDI Out Port.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static class AlsaOutputPortInfo extends AlsaPortInfo
+ {
+ public AlsaOutputPortInfo(String name, String description, long client, long port)
+ {
+ super(name, description, client, port);
+ }
+
+ MidiDevice getDevice()
+ {
+ return new AlsaOutputPortDevice(this);
+ }
+ }
+
+ private static AlsaInfo[] infos;
+
+ private static native AlsaInfo[] getInputDeviceInfo_();
+ private static native AlsaInfo[] getOutputDeviceInfo_();
+
+ /**
+ * Initialize the ALSA system
+ */
+ private static native void init_();
+
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gjsmalsa");
+ }
+
+ init_();
+
+ AlsaInfo inputs[] = getInputDeviceInfo_();
+ AlsaInfo outputs[] = getOutputDeviceInfo_();
+
+ infos = new AlsaInfo[inputs.length + outputs.length + 1];
+ infos[0] = new AlsaSequencerInfo ("/dev/snd/seq", "ALSA Sequencer");
+ System.arraycopy(inputs, 0, infos, 1, inputs.length);
+ System.arraycopy(outputs, 0, infos, 1 + inputs.length, outputs.length);
+ }
+
+ public AlsaMidiDeviceProvider()
+ {
+ // Nothing.
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.spi.MidiDeviceProvider#getDeviceInfo()
+ */
+ public Info[] getDeviceInfo()
+ {
+ return infos;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.spi.MidiDeviceProvider#getDevice(javax.sound.midi.MidiDevice.Info)
+ */
+ public MidiDevice getDevice(Info info)
+ {
+ for (int i = 0; i < infos.length; i++)
+ {
+ if (info.equals(infos[i]))
+ {
+ return infos[i].getDevice();
+ }
+ }
+ throw new IllegalArgumentException("Don't recognize MIDI device " + info);
+ }
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java
new file mode 100644
index 00000000000..c91f1e39851
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java
@@ -0,0 +1,519 @@
+/* AlsaMidiSequencerDevice.java -- The ALSA MIDI sequencer device
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.sound.midi.ControllerEventListener;
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MetaEventListener;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Sequence;
+import javax.sound.midi.Sequencer;
+import javax.sound.midi.Track;
+import javax.sound.midi.Transmitter;
+
+// FIXME: These next two imports are only required by gcj it seems.
+import javax.sound.midi.MidiDevice.Info;
+import javax.sound.midi.Sequencer.SyncMode;
+
+/**
+ * The ALSA MIDI sequencer device. This is a singleton device.
+ *
+ * @author green@redhat.com
+ *
+ */
+public class AlsaMidiSequencerDevice implements Sequencer
+{
+ // The singleton instance.
+ public final static AlsaMidiSequencerDevice instance = new AlsaMidiSequencerDevice();
+
+ // A pointer to a native chunk of memory
+ private long nativeState;
+
+ // The sequence to process
+ private Sequence sequence;
+
+ /**
+ * A private constructor. There should only be one instance of this
+ * device.
+ */
+ private AlsaMidiSequencerDevice()
+ {
+ super();
+ }
+
+ /**
+ * Return the sequencer singleton.
+ *
+ * @return the sequencer singleton
+ */
+ public static AlsaMidiSequencerDevice getInstance()
+ {
+ return instance;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setSequence(javax.sound.midi.Sequence)
+ */
+ public void setSequence(Sequence seq) throws InvalidMidiDataException
+ {
+ sequence = seq;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setSequence(java.io.InputStream)
+ */
+ public void setSequence(InputStream istream) throws IOException,
+ InvalidMidiDataException
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getSequence()
+ */
+ public Sequence getSequence()
+ {
+ return sequence;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#start()
+ */
+ public void start()
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#stop()
+ */
+ public void stop()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#isRunning()
+ */
+ public boolean isRunning()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#startRecording()
+ */
+ public void startRecording()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#stopRecording()
+ */
+ public void stopRecording()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#isRecording()
+ */
+ public boolean isRecording()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#recordEnable(javax.sound.midi.Track, int)
+ */
+ public void recordEnable(Track track, int channel)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#recordDisable(javax.sound.midi.Track)
+ */
+ public void recordDisable(Track track)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTempoInBPM()
+ */
+ public float getTempoInBPM()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTempoInBPM(float)
+ */
+ public void setTempoInBPM(float bpm)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTempoInMPQ()
+ */
+ public float getTempoInMPQ()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTempoInMPQ(float)
+ */
+ public void setTempoInMPQ(float mpq)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTempoFactor(float)
+ */
+ public void setTempoFactor(float factor)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTempoFactor()
+ */
+ public float getTempoFactor()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTickLength()
+ */
+ public long getTickLength()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTickPosition()
+ */
+ public long getTickPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTickPosition(long)
+ */
+ public void setTickPosition(long tick)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getMicrosecondLength()
+ */
+ public long getMicrosecondLength()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getMicrosecondPosition()
+ */
+ public long getMicrosecondPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setMicrosecondPosition(long)
+ */
+ public void setMicrosecondPosition(long microsecond)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setMasterSyncMode(javax.sound.midi.Sequencer.SyncMode)
+ */
+ public void setMasterSyncMode(SyncMode sync)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getMasterSyncMode()
+ */
+ public SyncMode getMasterSyncMode()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getMasterSyncModes()
+ */
+ public SyncMode[] getMasterSyncModes()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setSlaveSyncMode(javax.sound.midi.Sequencer.SyncMode)
+ */
+ public void setSlaveSyncMode(SyncMode sync)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getSlaveSyncMode()
+ */
+ public SyncMode getSlaveSyncMode()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getSlaveSyncModes()
+ */
+ public SyncMode[] getSlaveSyncModes()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTrackMute(int, boolean)
+ */
+ public void setTrackMute(int track, boolean mute)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTrackMute(int)
+ */
+ public boolean getTrackMute(int track)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#setTrackSolo(int, boolean)
+ */
+ public void setTrackSolo(int track, boolean solo)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#getTrackSolo(int)
+ */
+ public boolean getTrackSolo(int track)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#addMetaEventListener(javax.sound.midi.MetaEventListener)
+ */
+ public boolean addMetaEventListener(MetaEventListener listener)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#removeMetaEventListener(javax.sound.midi.MetaEventListener)
+ */
+ public void removeMetaEventListener(MetaEventListener listener)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#addControllerEventListener(javax.sound.midi.ControllerEventListener, int[])
+ */
+ public int[] addControllerEventListener(ControllerEventListener listener,
+ int[] controllers)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Sequencer#removeControllerEventListener(javax.sound.midi.ControllerEventListener, int[])
+ */
+ public int[] removeControllerEventListener(ControllerEventListener listener,
+ int[] controllers)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getDeviceInfo()
+ */
+ public Info getDeviceInfo()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#open()
+ */
+ public void open() throws MidiUnavailableException
+ {
+ synchronized(this)
+ {
+ // Check to see if we're open already.
+ if (nativeState != 0)
+ return;
+
+ nativeState = open_();
+ }
+ }
+
+ /**
+ * Allocate the native state object, and open the sequencer.
+ *
+ * @return a long representation of a pointer to the nativeState.
+ */
+ private native long open_();
+
+ /**
+ * Close the sequencer and free the native state object.
+ */
+ private native void close_(long nativeState);
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#close()
+ */
+ public void close()
+ {
+ synchronized(this)
+ {
+ close_(nativeState);
+ nativeState = 0;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#isOpen()
+ */
+ public boolean isOpen()
+ {
+ synchronized(this)
+ {
+ return (nativeState != 0);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxReceivers()
+ */
+ public int getMaxReceivers()
+ {
+ return -1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxTransmitters()
+ */
+ public int getMaxTransmitters()
+ {
+ return -1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getReceiver()
+ */
+ public Receiver getReceiver() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getTransmitter()
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java
new file mode 100644
index 00000000000..bc5a5593967
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java
@@ -0,0 +1,131 @@
+/* AlsaOutputPortDevice.java -- ALSA MIDI Output Port Device
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.AlsaPortInfo;
+
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
+
+/**
+ * ALSA MIDI Out Device
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class AlsaOutputPortDevice extends AlsaPortDevice
+{
+ AlsaOutputPortDevice (AlsaPortInfo info)
+ {
+ super(info);
+ }
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#open()
+ */
+ public void open() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#close()
+ */
+ public void close()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#isOpen()
+ */
+ public boolean isOpen()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMicrosecondPosition()
+ */
+ public long getMicrosecondPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxReceivers()
+ */
+ public int getMaxReceivers()
+ {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMaxTransmitters()
+ */
+ public int getMaxTransmitters()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getReceiver()
+ */
+ public Receiver getReceiver() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getTransmitter()
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java
new file mode 100644
index 00000000000..d666be1f1ba
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java
@@ -0,0 +1,153 @@
+/* AlsaPortDevice.java -- ALSA MIDI Port Devices
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.alsa;
+
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.Transmitter;
+
+// FIXME: This next import is only rquired for gcj it seems.
+import javax.sound.midi.MidiDevice.Info;
+
+import gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider.AlsaPortInfo;
+
+/**
+ * ALSA Port Device
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public abstract class AlsaPortDevice implements MidiDevice
+{
+ /**
+ * The ALSA Receiver class.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ public class AlsaReceiver implements Receiver
+ {
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Receiver#send(javax.sound.midi.MidiMessage, long)
+ */
+ public void send(MidiMessage message, long timeStamp)
+ throws IllegalStateException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Receiver#close()
+ */
+ public void close()
+ {
+ // TODO Auto-generated method stub
+
+ }
+ }
+
+ AlsaMidiDeviceProvider.AlsaPortInfo info;
+
+ public AlsaPortDevice (AlsaPortInfo info)
+ {
+ this.info = info;
+ }
+
+ public Info getDeviceInfo()
+ {
+ return info;
+ }
+
+ native void run_receiver_thread_ (long client, long port, Receiver receiver);
+
+ /**
+ * The ALSA Transmitter class.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ protected class AlsaTransmitter implements Transmitter, Runnable
+ {
+ private Receiver receiver;
+
+ public void run()
+ {
+ run_receiver_thread_ (info.client, info.port, receiver);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Transmitter#setReceiver(javax.sound.midi.Receiver)
+ */
+ public void setReceiver(Receiver receiver)
+ {
+ synchronized (this)
+ {
+ this.receiver = receiver;
+ }
+
+ // Create the processing thread
+ new Thread(this).start();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Transmitter#getReceiver()
+ */
+ public Receiver getReceiver()
+ {
+ synchronized (this)
+ {
+ return receiver;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Transmitter#close()
+ */
+ public void close()
+ {
+ synchronized (this)
+ {
+ receiver.close();
+ receiver = null;
+ }
+ }
+ }
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java
new file mode 100644
index 00000000000..baf61732d18
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java
@@ -0,0 +1,173 @@
+/* DSSIMidiDeviceProvider.java -- DSSI Device Provider
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.dssi;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.io.File;
+import java.io.FilenameFilter;
+
+import gnu.classpath.Configuration;
+import gnu.javax.sound.midi.alsa.AlsaMidiSequencerDevice;
+
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.MidiDevice.Info;
+import javax.sound.midi.spi.MidiDeviceProvider;
+
+/**
+ * A DSSI MIDI device provider.
+ *
+ * DSSI (pronounced "dizzy") is an API for audio plugins, with particular
+ * application for software synthesis plugins with native user interfaces.
+ *
+ * Read about DSSI at http://dssi.sourceforge.net
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class DSSIMidiDeviceProvider extends MidiDeviceProvider
+{
+ /**
+ * The MidiDevice.Info specialized for DSSI synthesizers.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ private static class DSSIInfo extends Info
+ {
+ String soname;
+ long index;
+
+ public DSSIInfo(String name, String vendor, String description,
+ String version, String soname, long index)
+ {
+ super(name, vendor, description, version);
+ this.soname = soname;
+ this.index = index;
+ }
+ }
+
+ static native long dlopen_(String soname);
+ static native void dlclose_(long sohandle);
+ static native long getDSSIHandle_(long sohandle, long index);
+ static native String getDSSIName_(long handle);
+ static native String getDSSICopyright_(long handle);
+ static native String getDSSIVendor_(long handle);
+ static native String getDSSILabel_(long handle);
+
+ private static List examineLibrary(String soname)
+ {
+ List list = new ArrayList();
+ long index = 0;
+ long handle;
+
+ long sohandle = dlopen_(soname);
+ if (sohandle == 0)
+ return list;
+ do
+ {
+ handle = getDSSIHandle_(sohandle, index);
+ if (handle == 0)
+ break;
+ String name = getDSSILabel_(handle);
+ String copyright = getDSSICopyright_(handle);
+ String label = getDSSIName_(handle);
+ String vendor = getDSSIVendor_(handle);
+ list.add(new DSSIInfo(name, vendor, label,
+ "DSSI-1", soname, index));
+ index++;
+ } while (true);
+
+ // Close the library and free memory
+ dlclose_(sohandle);
+
+ return list;
+ }
+
+ private static DSSIInfo[] infos;
+
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ System.loadLibrary("gjsmdssi");
+
+ File dssidir = new File("/usr/lib/dssi/");
+ String sofiles[] = dssidir.list(new FilenameFilter()
+ {
+ public boolean accept(File dir, String n)
+ {
+ return n.endsWith(".so");
+ }
+ });
+ List ilist = new ArrayList();
+ for (int i = 0; i < sofiles.length; i++)
+ ilist.addAll(examineLibrary(new File(dssidir, sofiles[i]).getAbsolutePath()));
+ infos = (DSSIInfo[]) ilist.toArray(new DSSIInfo[ilist.size()]);
+ }
+
+ public DSSIMidiDeviceProvider()
+ {
+ // Empty.
+ }
+
+ /* Return the Info array.
+ * @see javax.sound.midi.spi.MidiDeviceProvider#getDeviceInfo()
+ */
+ public Info[] getDeviceInfo()
+ {
+ return infos;
+ }
+
+ /* Get a MIDI Device for info.
+ * @see javax.sound.midi.spi.MidiDeviceProvider#getDevice(javax.sound.midi.MidiDevice.Info)
+ */
+ public MidiDevice getDevice(Info info)
+ {
+ for (int i = 0; i < infos.length; i++)
+ {
+ if (info.equals(infos[i]))
+ {
+ return new DSSISynthesizer(infos[i],
+ infos[i].soname,
+ infos[i].index);
+ }
+ }
+ throw new IllegalArgumentException("Don't recognize MIDI device " + info);
+ }
+}
diff --git a/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
new file mode 100644
index 00000000000..ca09b305078
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
@@ -0,0 +1,745 @@
+/* DSSISynthesizer.java -- DSSI Synthesizer Provider
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.javax.sound.midi.dssi;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.sound.midi.Instrument;
+import javax.sound.midi.MidiChannel;
+import javax.sound.midi.MidiMessage;
+import javax.sound.midi.MidiUnavailableException;
+import javax.sound.midi.Patch;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.ShortMessage;
+import javax.sound.midi.Soundbank;
+import javax.sound.midi.SoundbankResource;
+import javax.sound.midi.Synthesizer;
+import javax.sound.midi.Transmitter;
+import javax.sound.midi.VoiceStatus;
+
+// FIXME: This import in only required for gcj it seems.
+import javax.sound.midi.MidiDevice.Info;
+
+/**
+ * DSSI soft-synth support.
+ *
+ * All DSSI soft-synths are expected to be installed in /usr/lib/dssi.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+public class DSSISynthesizer implements Synthesizer
+{
+ /**
+ * The DSSI Instrument class.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ class DSSIInstrument extends Instrument
+ {
+ DSSIInstrument (Soundbank soundbank, Patch patch, String name)
+ {
+ super (soundbank, patch, name, null);
+ }
+
+ /* @see javax.sound.midi.SoundbankResource#getData()
+ */
+ public Object getData()
+ {
+ return null;
+ }
+
+ }
+
+/**
+ * DSSISoundbank holds all instruments.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ class DSSISoundbank implements Soundbank
+ {
+ private String name;
+ private String description;
+ private List instruments = new ArrayList();
+ private List resources = new ArrayList();
+ private String vendor;
+ private String version;
+
+ public DSSISoundbank(String name, String description, String vendor, String version)
+ {
+ this.name = name;
+ this.description = description;
+ this.vendor = vendor;
+ this.version = version;
+ }
+
+ void add(Instrument instrument)
+ {
+ instruments.add(instrument);
+ }
+
+ /* @see javax.sound.midi.Soundbank#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /* @see javax.sound.midi.Soundbank#getVersion()
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /* @see javax.sound.midi.Soundbank#getVendor()
+ */
+ public String getVendor()
+ {
+ return vendor;
+ }
+
+ /* @see javax.sound.midi.Soundbank#getDescription()
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /* @see javax.sound.midi.Soundbank#getResources()
+ */
+ public SoundbankResource[] getResources()
+ {
+ return (SoundbankResource[])
+ resources.toArray(new SoundbankResource[resources.size()]);
+ }
+
+ /* @see javax.sound.midi.Soundbank#getInstruments()
+ */
+ public Instrument[] getInstruments()
+ {
+ return (Instrument[])
+ instruments.toArray(new Instrument[instruments.size()]);
+ }
+
+ /* @see javax.sound.midi.Soundbank#getInstrument(javax.sound.midi.Patch)
+ */
+ public Instrument getInstrument(Patch patch)
+ {
+ Iterator itr = instruments.iterator();
+
+ while (itr.hasNext())
+ {
+ Instrument i = (Instrument) itr.next();
+ if (i.getPatch().equals(patch))
+ return i;
+ }
+
+ return null;
+ }
+ }
+
+/**
+ * The Receiver class receives all MIDI messages from a connected
+ * Transmitter.
+ *
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ class DSSIReceiver implements Receiver
+ {
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Receiver#send(javax.sound.midi.MidiMessage, long)
+ */
+ public void send(MidiMessage message, long timeStamp)
+ throws IllegalStateException
+ {
+ if (message instanceof ShortMessage)
+ {
+ ShortMessage smessage = (ShortMessage) message;
+
+ switch (message.getStatus())
+ {
+ case ShortMessage.NOTE_ON:
+ int velocity = smessage.getData2();
+ if (velocity > 0)
+ channels[smessage.getChannel()].noteOn(smessage.getData1(),
+ smessage.getData2());
+ else
+ channels[smessage.getChannel()].noteOff(smessage.getData1());
+ break;
+ case ShortMessage.CONTROL_CHANGE:
+ channels[smessage.getChannel()].controlChange(smessage.getData1(),
+ smessage.getData2());
+ break;
+ default:
+ System.out.println ("Unhandled message: " + message.getStatus());
+ break;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Receiver#close()
+ */
+ public void close()
+ {
+ // TODO Auto-generated method stub
+ }
+
+ }
+
+ static native void noteOn_(long handle, int channel, int noteNumber, int velocity);
+ static native void noteOff_(long handle, int channel, int noteNumber, int velocity);
+ static native void setPolyPressure_(long handle, int channel, int noteNumber, int pressure);
+ static native int getPolyPressure_(long handle, int channel, int noteNumber);
+ static native void controlChange_(long handle, int channel, int control, int value);
+ static native void open_(long handle);
+ static native void close_(long handle);
+ static native String getProgramName_(long handle, int index);
+ static native int getProgramBank_(long handle, int index);
+ static native int getProgramProgram_(long handle, int index);
+ static native void selectProgram_(long handle, int bank, int program);
+
+ /**
+ * @author Anthony Green (green@redhat.com)
+ *
+ */
+ public class DSSIMidiChannel implements MidiChannel
+ {
+ int channel = 0;
+
+ /**
+ * Default contructor.
+ */
+ public DSSIMidiChannel(int channel)
+ {
+ super();
+ this.channel = channel;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#noteOn(int, int)
+ */
+ public void noteOn(int noteNumber, int velocity)
+ {
+ noteOn_(sohandle, channel, noteNumber, velocity);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#noteOff(int, int)
+ */
+ public void noteOff(int noteNumber, int velocity)
+ {
+ noteOff_(sohandle, channel, noteNumber, velocity);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#noteOff(int)
+ */
+ public void noteOff(int noteNumber)
+ {
+ noteOff_(sohandle, channel, noteNumber, -1);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setPolyPressure(int, int)
+ */
+ public void setPolyPressure(int noteNumber, int pressure)
+ {
+ setPolyPressure_(sohandle, channel, noteNumber, pressure);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getPolyPressure(int)
+ */
+ public int getPolyPressure(int noteNumber)
+ {
+ return getPolyPressure_(sohandle, channel, noteNumber);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setChannelPressure(int)
+ */
+ public void setChannelPressure(int pressure)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getChannelPressure()
+ */
+ public int getChannelPressure()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* @see javax.sound.midi.MidiChannel#controlChange(int, int) */
+ public void controlChange(int controller, int value)
+ {
+ controlChange_(sohandle, channel, controller, value);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getController(int)
+ */
+ public int getController(int controller)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#programChange(int)
+ */
+ public void programChange(int program)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#programChange(int, int)
+ */
+ public void programChange(int bank, int program)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getProgram()
+ */
+ public int getProgram()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setPitchBend(int)
+ */
+ public void setPitchBend(int bend)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getPitchBend()
+ */
+ public int getPitchBend()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#resetAllControllers()
+ */
+ public void resetAllControllers()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#allNotesOff()
+ */
+ public void allNotesOff()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#allSoundOff()
+ */
+ public void allSoundOff()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#localControl(boolean)
+ */
+ public boolean localControl(boolean on)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setMono(boolean)
+ */
+ public void setMono(boolean on)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getMono()
+ */
+ public boolean getMono()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setOmni(boolean)
+ */
+ public void setOmni(boolean on)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getOmni()
+ */
+ public boolean getOmni()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setMute(boolean)
+ */
+ public void setMute(boolean mute)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getMute()
+ */
+ public boolean getMute()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#setSolo(boolean)
+ */
+ public void setSolo(boolean solo)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiChannel#getSolo()
+ */
+ public boolean getSolo()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ }
+
+ long sohandle;
+ long handle;
+ private Info info;
+
+ MidiChannel channels[] = new MidiChannel[16];
+
+ // The list of known soundbanks, and the default one.
+ List soundbanks = new ArrayList();
+ DSSISoundbank defaultSoundbank;
+
+ /**
+ * Create a DSSI Synthesizer.
+ *
+ * @param info the DSSIInfo for this soft-synth
+ * @param soname the name of the .so file for this DSSI synth
+ * @param index the DSSI index for this soft-synth
+ */
+ public DSSISynthesizer(Info info, String soname, long index)
+ {
+ super();
+ this.info = info;
+ sohandle = DSSIMidiDeviceProvider.dlopen_(soname);
+ handle = DSSIMidiDeviceProvider.getDSSIHandle_(sohandle, index);
+ channels[0] = new DSSIMidiChannel(0);
+ defaultSoundbank = new DSSISoundbank("name", "description",
+ "vendor", "version");
+ soundbanks.add(defaultSoundbank);
+
+ int i = 0;
+ String name;
+ do
+ {
+ name = getProgramName_(sohandle, i);
+ if (name != null)
+ {
+ defaultSoundbank.
+ add(new DSSIInstrument(defaultSoundbank,
+ new Patch(getProgramBank_(sohandle, i),
+ getProgramProgram_(sohandle, i)),
+ name));
+ i++;
+ }
+ } while (name != null);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getMaxPolyphony()
+ */
+ public int getMaxPolyphony()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getLatency()
+ */
+ public long getLatency()
+ {
+ // DSSI and LADSPA provide no way to determine the latency.
+ // Let's just return 0 for now.
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getChannels()
+ */
+ public MidiChannel[] getChannels()
+ {
+ return channels;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getVoiceStatus()
+ */
+ public VoiceStatus[] getVoiceStatus()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#isSoundbankSupported(javax.sound.midi.Soundbank)
+ */
+ public boolean isSoundbankSupported(Soundbank soundbank)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* @see javax.sound.midi.Synthesizer#loadInstrument(javax.sound.midi.Instrument)
+ */
+ public boolean loadInstrument(Instrument instrument)
+ {
+ // FIXME: perhaps this isn't quite right. It can probably
+ // be in any soundbank.
+ if (instrument.getSoundbank() != defaultSoundbank)
+ throw new IllegalArgumentException ("Synthesizer doesn't support this instrument's soundbank");
+
+ Patch patch = instrument.getPatch();
+ selectProgram_(sohandle, patch.getBank(), patch.getProgram());
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#unloadInstrument(javax.sound.midi.Instrument)
+ */
+ public void unloadInstrument(Instrument instrument)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#remapInstrument(javax.sound.midi.Instrument, javax.sound.midi.Instrument)
+ */
+ public boolean remapInstrument(Instrument from, Instrument to)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* @see javax.sound.midi.Synthesizer#getDefaultSoundbank()
+ */
+ public Soundbank getDefaultSoundbank()
+ {
+ return defaultSoundbank;
+ }
+
+ /* @see javax.sound.midi.Synthesizer#getAvailableInstruments()
+ */
+ public Instrument[] getAvailableInstruments()
+ {
+ List instruments = new ArrayList();
+ Iterator itr = soundbanks.iterator();
+ while (itr.hasNext())
+ {
+ Soundbank sb = (Soundbank) itr.next();
+ Instrument ins[] = sb.getInstruments();
+ for (int i = 0; i < ins.length; i++)
+ instruments.add(ins[i]);
+ }
+ return (Instrument[])
+ instruments.toArray(new Instrument[instruments.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#getLoadedInstruments()
+ */
+ public Instrument[] getLoadedInstruments()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#loadAllInstruments(javax.sound.midi.Soundbank)
+ */
+ public boolean loadAllInstruments(Soundbank soundbank)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#unloadAllInstruments(javax.sound.midi.Soundbank)
+ */
+ public void unloadAllInstruments(Soundbank soundbank)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#loadInstruments(javax.sound.midi.Soundbank, javax.sound.midi.Patch[])
+ */
+ public boolean loadInstruments(Soundbank soundbank, Patch[] patchList)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.Synthesizer#unloadInstruments(javax.sound.midi.Soundbank, javax.sound.midi.Patch[])
+ */
+ public void unloadInstruments(Soundbank soundbank, Patch[] patchList)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getDeviceInfo()
+ */
+ public Info getDeviceInfo()
+ {
+ return info;
+ }
+
+ /* @see javax.sound.midi.MidiDevice#open()
+ */
+ public void open() throws MidiUnavailableException
+ {
+ open_(sohandle);
+ }
+
+ /* @see javax.sound.midi.MidiDevice#close()
+ */
+ public void close()
+ {
+ close_(sohandle);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#isOpen()
+ */
+ public boolean isOpen()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.sound.midi.MidiDevice#getMicrosecondPosition()
+ */
+ public long getMicrosecondPosition()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getMaxReceivers()
+ */
+ public int getMaxReceivers()
+ {
+ return 1;
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getMaxTransmitters()
+ */
+ public int getMaxTransmitters()
+ {
+ return 0;
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getReceiver()
+ */
+ public Receiver getReceiver() throws MidiUnavailableException
+ {
+ return new DSSIReceiver();
+ }
+
+ /* @see javax.sound.midi.MidiDevice#getTransmitter()
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ return null;
+ }
+}
diff --git a/libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java b/libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java
index 37e8cc9c120..011ca3c6a3d 100644
--- a/libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java
+++ b/libjava/classpath/gnu/xml/aelfred2/JAXPFactory.java
@@ -109,7 +109,7 @@ public final class JAXPFactory
// (flags can't necessarily be set before parsing)
new JaxpParser().getXMLReader().setFeature(name, value);
- flags.put(name, new Boolean(value));
+ flags.put(name, Boolean.valueOf(value));
}
catch (SAXNotRecognizedException e)
{
diff --git a/libjava/classpath/gnu/xml/aelfred2/SAXDriver.java b/libjava/classpath/gnu/xml/aelfred2/SAXDriver.java
index 7e950ce042a..6864ff65971 100644
--- a/libjava/classpath/gnu/xml/aelfred2/SAXDriver.java
+++ b/libjava/classpath/gnu/xml/aelfred2/SAXDriver.java
@@ -717,7 +717,9 @@ final public class SAXDriver
}
else
{
- in.setSystemId(absolutize(baseURI, in.getSystemId(), false));
+ in.setSystemId(absolutize(baseURI,
+ in.getSystemId(),
+ entityResolver != base));
source = entityResolver.resolveEntity(in.getPublicId(),
in.getSystemId());
if (source == null)
diff --git a/libjava/classpath/gnu/xml/dom/DomDocument.java b/libjava/classpath/gnu/xml/dom/DomDocument.java
index dc476b582ac..29b8dc72e53 100644
--- a/libjava/classpath/gnu/xml/dom/DomDocument.java
+++ b/libjava/classpath/gnu/xml/dom/DomDocument.java
@@ -210,13 +210,15 @@ public class DomDocument
*/
public Element getElementById(String id)
{
- DomDoctype doctype = (DomDoctype) getDoctype();
-
- if (doctype == null || !doctype.hasIds()
- || id == null || id.length() == 0)
+ if (id == null || id.length() == 0)
{
return null;
}
+ DomDoctype doctype = (DomDoctype) getDoctype();
+ if (doctype != null && !doctype.hasIds())
+ {
+ doctype = null;
+ }
// yes, this is linear in size of document.
// it'd be easy enough to maintain a hashtable.
@@ -233,25 +235,39 @@ public class DomDocument
if (current.getNodeType() == ELEMENT_NODE)
{
DomElement element = (DomElement) current;
- DTDElementTypeInfo info =
- doctype.getElementTypeInfo(current.getNodeName());
- if (info != null &&
- id.equals(element.getAttribute(info.idAttrName)))
- {
- return element;
- }
- else if (element.userIdAttrs != null)
+ if (doctype != null)
{
- for (Iterator i = element.userIdAttrs.iterator();
- i.hasNext(); )
+ DTDElementTypeInfo info =
+ doctype.getElementTypeInfo(current.getNodeName());
+ if (info != null &&
+ id.equals(element.getAttribute(info.idAttrName)))
{
- Node idAttr = (Node) i.next();
- if (id.equals(idAttr.getNodeValue()))
+ return element;
+ }
+ else if (element.userIdAttrs != null)
+ {
+ for (Iterator i = element.userIdAttrs.iterator();
+ i.hasNext(); )
{
- return element;
+ Node idAttr = (Node) i.next();
+ if (id.equals(idAttr.getNodeValue()))
+ {
+ return element;
+ }
}
}
}
+ // xml:id
+ String xmlId = element.getAttribute("xml:id");
+ if (xmlId == null)
+ {
+ xmlId = element.getAttributeNS(XMLConstants.XML_NS_URI,
+ "id");
+ }
+ if (id.equals(xmlId))
+ {
+ return element;
+ }
}
// descend?
diff --git a/libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java b/libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java
index 3706fba84f5..03420c463e8 100644
--- a/libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java
+++ b/libjava/classpath/gnu/xml/libxmlj/dom/GnomeDocument.java
@@ -376,31 +376,31 @@ public class GnomeDocument
name = name.toLowerCase();
if ("canonical-form".equals(name))
{
- return new Boolean(canonicalForm);
+ return Boolean.valueOf(canonicalForm);
}
else if ("cdata-sections".equals(name))
{
- return new Boolean(cdataSections);
+ return Boolean.valueOf(cdataSections);
}
else if ("check-character-normalization".equals(name))
{
- return new Boolean(checkCharacterNormalization);
+ return Boolean.valueOf(checkCharacterNormalization);
}
else if ("comments".equals(name))
{
- return new Boolean(comments);
+ return Boolean.valueOf(comments);
}
else if ("datatype-normalization".equals(name))
{
- return new Boolean(datatypeNormalization);
+ return Boolean.valueOf(datatypeNormalization);
}
else if ("element-content-whitespace".equals(name))
{
- return new Boolean(elementContentWhitespace);
+ return Boolean.valueOf(elementContentWhitespace);
}
else if ("entities".equals(name))
{
- return new Boolean(entities);
+ return Boolean.valueOf(entities);
}
else if ("error-handler".equals(name))
{
@@ -408,43 +408,43 @@ public class GnomeDocument
}
else if ("infoset".equals(name))
{
- return new Boolean(!validateIfSchema &&
- !entities &&
- !datatypeNormalization &&
- !cdataSections &&
- namespaceDeclarations &&
- wellFormed &&
- elementContentWhitespace &&
- comments &&
- namespaces);
+ return Boolean.valueOf(!validateIfSchema &&
+ !entities &&
+ !datatypeNormalization &&
+ !cdataSections &&
+ namespaceDeclarations &&
+ wellFormed &&
+ elementContentWhitespace &&
+ comments &&
+ namespaces);
}
else if ("namespaces".equals(name))
{
- return new Boolean(namespaces);
+ return Boolean.valueOf(namespaces);
}
else if ("namespace-declarations".equals(name))
{
- return new Boolean(namespaceDeclarations);
+ return Boolean.valueOf(namespaceDeclarations);
}
else if ("normalize-characters".equals(name))
{
- return new Boolean(normalizeCharacters);
+ return Boolean.valueOf(normalizeCharacters);
}
else if ("split-cdata-sections".equals(name))
{
- return new Boolean(splitCdataSections);
+ return Boolean.valueOf(splitCdataSections);
}
else if ("validate".equals(name))
{
- return new Boolean(validate);
+ return Boolean.valueOf(validate);
}
else if ("validate-if-schema".equals(name))
{
- return new Boolean(validateIfSchema);
+ return Boolean.valueOf(validateIfSchema);
}
else if ("well-formed".equals(name))
{
- return new Boolean(wellFormed);
+ return Boolean.valueOf(wellFormed);
}
else
{
@@ -497,7 +497,7 @@ public class GnomeDocument
}
else if (value instanceof String)
{
- return new Boolean ((String) value).booleanValue();
+ return Boolean.valueOf ((String) value).booleanValue();
}
return false;
}
diff --git a/libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java b/libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java
index 0fbfa9264aa..8391767490c 100644
--- a/libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java
+++ b/libjava/classpath/gnu/xml/pipeline/ValidationConsumer.java
@@ -1607,7 +1607,7 @@ public final class ValidationConsumer extends EventFilter
throw new RuntimeException ("patchNext");
}
- if (table != null && (flags | F_LOOPHEAD) != 0)
+ if (table != null && (flags & F_LOOPHEAD) != 0)
table.put (this, this);
}
diff --git a/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java b/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java
index 25f520416e2..05b6d6c0f11 100644
--- a/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java
+++ b/libjava/classpath/gnu/xml/stream/XMLOutputFactoryImpl.java
@@ -121,7 +121,8 @@ public class XMLOutputFactoryImpl
{
if (IS_PREFIX_DEFAULTING.equals(name))
prefixDefaulting = ((Boolean) value).booleanValue();
- throw new IllegalArgumentException(name);
+ else
+ throw new IllegalArgumentException(name);
}
public Object getProperty(String name)
diff --git a/libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java b/libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java
index 9ac0abe2712..d677048cfa1 100644
--- a/libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java
+++ b/libjava/classpath/gnu/xml/stream/XMLStreamWriterImpl.java
@@ -39,7 +39,10 @@ package gnu.xml.stream;
import java.io.IOException;
import java.io.Writer;
+import java.util.Enumeration;
+import java.util.HashSet;
import java.util.LinkedList;
+import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
@@ -57,16 +60,56 @@ public class XMLStreamWriterImpl
implements XMLStreamWriter
{
+ /**
+ * The underlying character stream to write to.
+ */
protected final Writer writer;
+
+ /**
+ * The encoding being used.
+ * Note that this must match the encoding of the character stream.
+ */
protected final String encoding;
+
+ /**
+ * Whether prefix defaulting is being used.
+ * If true and a prefix has not been defined for a namespace specified on
+ * an element or an attribute, a new prefix and namespace declaration will
+ * be created.
+ */
protected final boolean prefixDefaulting;
+
+ /**
+ * The namespace context used to determine the namespace-prefix mappings
+ * in scope.
+ */
protected NamespaceContext namespaceContext;
+ /**
+ * The stack of elements in scope.
+ * Used to close the remaining elements.
+ */
private LinkedList elements;
+
+ /**
+ * Whether a start element has been opened but not yet closed.
+ */
private boolean inStartElement;
+
+ /**
+ * Whether we are in an empty element.
+ */
private boolean emptyElement;
+
private NamespaceSupport namespaces;
-
+ private int count = 0;
+
+ /**
+ * Constructor.
+ * @see #writer
+ * @see #encoding
+ * @see #prefixDefaulting
+ */
protected XMLStreamWriterImpl(Writer writer, String encoding,
boolean prefixDefaulting)
{
@@ -77,6 +120,10 @@ public class XMLStreamWriterImpl
namespaces = new NamespaceSupport();
}
+ /**
+ * Write the end of a start-element event.
+ * This will close the element if it was defined to be an empty element.
+ */
private void endStartElement()
throws IOException
{
@@ -128,7 +175,7 @@ public class XMLStreamWriterImpl
if (!isDeclared)
{
if (prefixDefaulting)
- prefix = XMLConstants.DEFAULT_NS_PREFIX;
+ prefix = createPrefix(namespaceURI);
else
throw new XMLStreamException("namespace " + namespaceURI +
" has not been declared");
@@ -140,13 +187,13 @@ public class XMLStreamWriterImpl
writer.write(':');
}
writer.write(localName);
- if (prefixDefaulting && !isDeclared)
+ inStartElement = true;
+ if (!isDeclared)
{
writeNamespace(prefix, namespaceURI);
}
elements.addLast(new String[] { prefix, localName });
- inStartElement = true;
}
catch (IOException e)
{
@@ -156,6 +203,26 @@ public class XMLStreamWriterImpl
}
}
+ /**
+ * Creates a new unique prefix in the document.
+ * Subclasses may override this method to provide a suitably unique prefix
+ * for the given namespace.
+ * @param namespaceURI the namespace URI
+ */
+ protected String createPrefix(String namespaceURI)
+ {
+ Set prefixes = new HashSet();
+ for (Enumeration e = namespaces.getPrefixes(); e.hasMoreElements(); )
+ prefixes.add(e.nextElement());
+ String ret;
+ do
+ {
+ ret = "ns" + (count++);
+ }
+ while (prefixes.contains(ret));
+ return ret;
+ }
+
public void writeStartElement(String prefix, String localName,
String namespaceURI)
throws XMLStreamException
@@ -656,6 +723,12 @@ public class XMLStreamWriterImpl
throw new IllegalArgumentException(name);
}
+ /**
+ * Write the specified text, ensuring that the content is suitably encoded
+ * for XML.
+ * @param text the text to write
+ * @param inAttr whether we are in an attribute value
+ */
private void writeEncoded(String text, boolean inAttr)
throws IOException
{
diff --git a/libjava/classpath/gnu/xml/transform/StreamSerializer.java b/libjava/classpath/gnu/xml/transform/StreamSerializer.java
index eb045393dff..74b10057c12 100644
--- a/libjava/classpath/gnu/xml/transform/StreamSerializer.java
+++ b/libjava/classpath/gnu/xml/transform/StreamSerializer.java
@@ -694,7 +694,11 @@ public class StreamSerializer
{
buf = new StringBuffer(text.substring(0, i));
}
- buf.append("&apos;");
+ if (mode == Stylesheet.OUTPUT_HTML)
+ // HTML does not define &apos;, use character entity ref
+ buf.append("&#x27;");
+ else
+ buf.append("&apos;");
}
else if (c == '"' && inAttr)
{
diff --git a/libjava/classpath/gnu/xml/transform/TransformerImpl.java b/libjava/classpath/gnu/xml/transform/TransformerImpl.java
index a36aa6173f2..cf404884736 100644
--- a/libjava/classpath/gnu/xml/transform/TransformerImpl.java
+++ b/libjava/classpath/gnu/xml/transform/TransformerImpl.java
@@ -1,5 +1,5 @@
/* TransformerImpl.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -505,6 +505,12 @@ class TransformerImpl
{
URL url = new URL(systemId);
URLConnection connection = url.openConnection();
+ // We need to call setDoInput(false), because our
+ // implementation of the file protocol allows writing
+ // (unlike Sun), but it will fail with a FileNotFoundException
+ // if we also open the connection for input and the output
+ // file doesn't yet exist.
+ connection.setDoInput(false);
connection.setDoOutput(true);
out = connection.getOutputStream();
}
diff --git a/libjava/classpath/include/Makefile.am b/libjava/classpath/include/Makefile.am
index c775874ea98..ab9b40c0f41 100644
--- a/libjava/classpath/include/Makefile.am
+++ b/libjava/classpath/include/Makefile.am
@@ -7,6 +7,13 @@ ARG_JNI_JAVAH = -jni
ARG_CLASSPATH_JAVAH = -bootclasspath
JAVAH = $(USER_JAVAH) $(ARG_JNI_JAVAH) $(ARG_CLASSPATH_JAVAH) ../lib:$(USER_CLASSLIB)
+SOUND_H_FILES = \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
+
XMLJ_H_FILES = \
$(top_srcdir)/include/gnu_xml_libxmlj_dom_GnomeDocument.h \
$(top_srcdir)/include/gnu_xml_libxmlj_dom_GnomeXPathNodeList.h \
@@ -106,6 +113,7 @@ $(top_srcdir)/include/gnu_java_awt_peer_qt_QtContainerPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h
H_FILES = \
+$(SOUND_H_FILES) \
$(XMLJ_H_FILES) \
$(GTKPEER_H_FILES) \
$(QTPEER_H_FILES) \
@@ -150,6 +158,12 @@ $(top_srcdir)/include/gnu_java_awt_peer_gtk_%.h: $(top_builddir)/lib/gnu/java/aw
$(top_srcdir)/include/gnu_java_awt_peer_qt_%.h: $(top_builddir)/lib/gnu/java/awt/peer/qt/%.class
$(JAVAH) -o $@ gnu.java.awt.peer.qt.$*
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_%.h: $(top_builddir)/lib/gnu/javax/sound/midi/alsa/%.class
+ $(JAVAH) -o $@ gnu.javax.sound.midi.alsa.$*
+
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_%.h: $(top_builddir)/lib/gnu/javax/sound/midi/dssi/%.class
+ $(JAVAH) -o $@ gnu.javax.sound.midi.dssi.$*
+
$(top_srcdir)/include/gnu_java_net_PlainDatagramSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainDatagramSocketImpl.java
$(JAVAH) -o $@ gnu.java.net.PlainDatagramSocketImpl
$(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainSocketImpl.java
diff --git a/libjava/classpath/include/Makefile.in b/libjava/classpath/include/Makefile.in
index de575b9f0c4..fc59b767f9f 100644
--- a/libjava/classpath/include/Makefile.in
+++ b/libjava/classpath/include/Makefile.in
@@ -40,10 +40,8 @@ subdir = include
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -76,10 +74,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -216,6 +218,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -229,6 +232,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -245,6 +249,13 @@ DISTCLEANFILES = jni_md.h
ARG_JNI_JAVAH = -jni
ARG_CLASSPATH_JAVAH = -bootclasspath
JAVAH = $(USER_JAVAH) $(ARG_JNI_JAVAH) $(ARG_CLASSPATH_JAVAH) ../lib:$(USER_CLASSLIB)
+SOUND_H_FILES = \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h \
+$(top_srcdir)/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
+
XMLJ_H_FILES = \
$(top_srcdir)/include/gnu_xml_libxmlj_dom_GnomeDocument.h \
$(top_srcdir)/include/gnu_xml_libxmlj_dom_GnomeXPathNodeList.h \
@@ -344,6 +355,7 @@ $(top_srcdir)/include/gnu_java_awt_peer_qt_QtContainerPeer.h \
$(top_srcdir)/include/gnu_java_awt_peer_qt_QtEmbeddedWindowPeer.h
H_FILES = \
+$(SOUND_H_FILES) \
$(XMLJ_H_FILES) \
$(GTKPEER_H_FILES) \
$(QTPEER_H_FILES) \
@@ -568,6 +580,12 @@ uninstall-am: uninstall-info-am
@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_awt_peer_qt_%.h: $(top_builddir)/lib/gnu/java/awt/peer/qt/%.class
@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.java.awt.peer.qt.$*
+@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_javax_sound_midi_alsa_%.h: $(top_builddir)/lib/gnu/javax/sound/midi/alsa/%.class
+@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.javax.sound.midi.alsa.$*
+
+@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_javax_sound_midi_dssi_%.h: $(top_builddir)/lib/gnu/javax/sound/midi/dssi/%.class
+@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.javax.sound.midi.dssi.$*
+
@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_net_PlainDatagramSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainDatagramSocketImpl.java
@CREATE_JNI_HEADERS_TRUE@ $(JAVAH) -o $@ gnu.java.net.PlainDatagramSocketImpl
@CREATE_JNI_HEADERS_TRUE@$(top_srcdir)/include/gnu_java_net_PlainSocketImpl.h: $(top_srcdir)/gnu/java/net/PlainSocketImpl.java
diff --git a/libjava/classpath/include/config.h.in b/libjava/classpath/include/config.h.in
index ab5e10994f2..b67526ff95c 100644
--- a/libjava/classpath/include/config.h.in
+++ b/libjava/classpath/include/config.h.in
@@ -12,6 +12,9 @@
/* Define to 1 if you have the `accept' function. */
#undef HAVE_ACCEPT
+/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
+#undef HAVE_ALSA_ASOUNDLIB_H
+
/* Define to 1 if you have the <asm/ioctls.h> header file. */
#undef HAVE_ASM_IOCTLS_H
@@ -30,6 +33,9 @@
/* Define to 1 if you have the <crt_externs.h> header file. */
#undef HAVE_CRT_EXTERNS_H
+/* Define to 1 if you have the <dssi.h> header file. */
+#undef HAVE_DSSI_H
+
/* Define to 1 if you have the `execve' function. */
#undef HAVE_EXECVE
@@ -271,5 +277,8 @@
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
+/* Define to `__attribute__' to nothing if it's not supported. */
+#undef __attribute__
+
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h
index b4d0c5328c4..c74a574e719 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h
@@ -16,6 +16,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_indexToPos (JNIE
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_initState (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_dispose (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_initStaticState (JNIEnv *env, jclass);
+JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_GdkTextLayout_getOutline (JNIEnv *env, jobject, jobject);
#ifdef __cplusplus
}
diff --git a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
index 2c32e3f6c73..da86e23a80e 100644
--- a/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
+++ b/libjava/classpath/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
@@ -16,6 +16,7 @@ JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidge
JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetBackground (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetDimensions (JNIEnv *env, jobject, jintArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetPreferredDimensions (JNIEnv *env, jobject, jintArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWindowGetLocationOnScreen (JNIEnv *env, jobject, jintArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen (JNIEnv *env, jobject, jintArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked (JNIEnv *env, jobject, jint);
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h
new file mode 100644
index 00000000000..8e3ed710450
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider__
+#define __gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT jobjectArray JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getInputDeviceInfo_1 (JNIEnv *env, jclass);
+JNIEXPORT jobjectArray JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getOutputDeviceInfo_1 (JNIEnv *env, jclass);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_init_1 (JNIEnv *env, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider__ */
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h
new file mode 100644
index 00000000000..e6205394c6b
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h
@@ -0,0 +1,20 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice__
+#define __gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT jlong JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_open_1 (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_close_1 (JNIEnv *env, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice__ */
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h
new file mode 100644
index 00000000000..30fae5ff78a
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_alsa_AlsaPortDevice.h
@@ -0,0 +1,19 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_alsa_AlsaPortDevice__
+#define __gnu_javax_sound_midi_alsa_AlsaPortDevice__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1 (JNIEnv *env, jobject, jlong, jlong, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_alsa_AlsaPortDevice__ */
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h b/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h
new file mode 100644
index 00000000000..6306a3e7a64
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h
@@ -0,0 +1,25 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider__
+#define __gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT jlong JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlopen_1 (JNIEnv *env, jclass, jstring);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlclose_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIHandle_1 (JNIEnv *env, jclass, jlong, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIName_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSICopyright_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIVendor_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSILabel_1 (JNIEnv *env, jclass, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider__ */
diff --git a/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h b/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
new file mode 100644
index 00000000000..3cb0b77e6c2
--- /dev/null
+++ b/libjava/classpath/include/gnu_javax_sound_midi_dssi_DSSISynthesizer.h
@@ -0,0 +1,29 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_javax_sound_midi_dssi_DSSISynthesizer__
+#define __gnu_javax_sound_midi_dssi_DSSISynthesizer__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1 (JNIEnv *env, jclass, jlong, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1 (JNIEnv *env, jclass, jlong, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_setPolyPressure_1 (JNIEnv *env, jclass, jlong, jint, jint, jint);
+JNIEXPORT jint JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getPolyPressure_1 (JNIEnv *env, jclass, jlong, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_controlChange_1 (JNIEnv *env, jclass, jlong, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_close_1 (JNIEnv *env, jclass, jlong);
+JNIEXPORT jstring JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1 (JNIEnv *env, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1 (JNIEnv *env, jclass, jlong, jint);
+JNIEXPORT jint JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1 (JNIEnv *env, jclass, jlong, jint);
+JNIEXPORT void JNICALL Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_selectProgram_1 (JNIEnv *env, jclass, jlong, jint, jint);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_javax_sound_midi_dssi_DSSISynthesizer__ */
diff --git a/libjava/classpath/java/applet/Applet.java b/libjava/classpath/java/applet/Applet.java
index d0610ba0ea1..bb855351b8d 100644
--- a/libjava/classpath/java/applet/Applet.java
+++ b/libjava/classpath/java/applet/Applet.java
@@ -54,6 +54,10 @@ import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.Clip;
+import javax.sound.sampled.LineUnavailableException;
+import javax.sound.sampled.UnsupportedAudioFileException;
/**
* This is the base applet class. An applet is a Java program that
@@ -257,8 +261,6 @@ public class Applet extends Panel
* Returns an audio clip from the specified URL. This clip is not tied to
* any particular applet.
*
- * XXX Classpath does not yet implement this.
- *
* @param url the URL of the audio clip
* @return the retrieved audio clip
* @throws NullPointerException if url is null
@@ -267,8 +269,7 @@ public class Applet extends Panel
*/
public static final AudioClip newAudioClip(URL url)
{
- // This requires an implementation of AudioClip in gnu.java.applet.
- throw new Error("Not implemented");
+ return new URLAudioClip(url);
}
/**
@@ -521,4 +522,71 @@ public class Applet extends Panel
return s;
}
} // class AccessibleApplet
+
+ private static class URLAudioClip implements AudioClip
+ {
+ // The URL we will try to play.
+ // This is null if we have already tried to create an
+ // audio input stream from this URL.
+ private URL url;
+
+ // The real audio clip. This is null before the URL is read,
+ // and might be null afterward if we were unable to read the URL
+ // for some reason.
+ private Clip clip;
+
+ public URLAudioClip(URL url)
+ {
+ this.url = url;
+ }
+
+ private synchronized Clip getClip()
+ {
+ if (url == null)
+ return clip;
+ try
+ {
+ clip = AudioSystem.getClip();
+ clip.open(AudioSystem.getAudioInputStream(url));
+ }
+ catch (LineUnavailableException _)
+ {
+ // Ignore.
+ }
+ catch (IOException _)
+ {
+ // Ignore.
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Ignore.
+ }
+ url = null;
+ return clip;
+ }
+
+ public void loop()
+ {
+ Clip myclip = getClip();
+ if (myclip != null)
+ myclip.loop(Clip.LOOP_CONTINUOUSLY);
+ }
+
+ public void play()
+ {
+ Clip myclip = getClip();
+ if (myclip != null)
+ myclip.start();
+ }
+
+ public void stop()
+ {
+ Clip myclip = getClip();
+ if (myclip != null)
+ {
+ myclip.stop();
+ myclip.setFramePosition(0);
+ }
+ }
+ }
} // class Applet
diff --git a/libjava/classpath/java/awt/BorderLayout.java b/libjava/classpath/java/awt/BorderLayout.java
index adf2ebf65f6..1b67c01cfcb 100644
--- a/libjava/classpath/java/awt/BorderLayout.java
+++ b/libjava/classpath/java/awt/BorderLayout.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.awt;
+
/**
* This class implements a layout manager that positions components
* in certain sectors of the parent container.
@@ -229,6 +230,12 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
private int vgap;
+ // Some constants for use with calcSize().
+ private static final int MIN = 0;
+ private static final int MAX = 1;
+ private static final int PREF = 2;
+
+
/**
* Initializes a new instance of <code>BorderLayout</code> with no
* horiztonal or vertical gaps between components.
@@ -423,7 +430,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
*/
public float getLayoutAlignmentX(Container parent)
{
- return(parent.getAlignmentX());
+ return 0.5F;
}
/**
@@ -438,7 +445,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
*/
public float getLayoutAlignmentY(Container parent)
{
- return(parent.getAlignmentY());
+ return 0.5F;
}
/**
@@ -449,7 +456,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
*/
public void invalidateLayout(Container parent)
{
- // FIXME: Implement this properly!
+ // Nothing to do here.
}
/**
@@ -560,7 +567,8 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
}
/**
- * FIXME: Document me!
+ * This is a convenience method to set the bounds on a component.
+ * If the indicated component is null, nothing is done.
*/
private void setBounds(Component comp, int x, int y, int w, int h)
{
@@ -569,12 +577,6 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
comp.setBounds(x, y, w, h);
}
- // FIXME: Maybe move to top of file.
- // Some constants for use with calcSize().
- private static final int MIN = 0;
- private static final int MAX = 1;
- private static final int PREF = 2;
-
private Dimension calcCompSize(Component comp, int what)
{
if (comp == null || !comp.isVisible())
@@ -660,4 +662,112 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
return(new Dimension(width, height));
}
}
+
+ /**
+ * Return the component at the indicated location, or null if no component
+ * is at that location. The constraints argument must be one of the
+ * location constants specified by this class.
+ * @param constraints the location
+ * @return the component at that location, or null
+ * @throws IllegalArgumentException if the constraints argument is not
+ * recognized
+ * @since 1.5
+ */
+ public Component getLayoutComponent(Object constraints)
+ {
+ if (constraints == CENTER)
+ return center;
+ if (constraints == NORTH)
+ return north;
+ if (constraints == EAST)
+ return east;
+ if (constraints == SOUTH)
+ return south;
+ if (constraints == WEST)
+ return west;
+ if (constraints == PAGE_START)
+ return firstLine;
+ if (constraints == PAGE_END)
+ return lastLine;
+ if (constraints == LINE_START)
+ return firstItem;
+ if (constraints == LINE_END)
+ return lastItem;
+ throw new IllegalArgumentException("constraint " + constraints
+ + " is not recognized");
+ }
+
+ /**
+ * Return the component at the specified location, which must be one
+ * of the absolute constants such as CENTER or SOUTH. The container's
+ * orientation is used to map this location to the correct corresponding
+ * component, so for instance in a right-to-left container, a request
+ * for the EAST component could return the LINE_END component. This will
+ * return null if no component is available at the given location.
+ * @param container the container whose orientation is used
+ * @param constraints the absolute location of the component
+ * @return the component at the location, or null
+ * @throws IllegalArgumentException if the constraint is not recognized
+ */
+ public Component getLayoutComponent(Container container, Object constraints)
+ {
+ ComponentOrientation orient = container.getComponentOrientation();
+ if (constraints == CENTER)
+ return center;
+ // Note that we don't support vertical layouts.
+ if (constraints == NORTH)
+ return north;
+ if (constraints == SOUTH)
+ return south;
+ if (constraints == WEST)
+ {
+ // Note that relative layout takes precedence.
+ if (orient.isLeftToRight())
+ return firstItem == null ? west : firstItem;
+ return lastItem == null ? west : lastItem;
+ }
+ if (constraints == EAST)
+ {
+ // Note that relative layout takes precedence.
+ if (orient.isLeftToRight())
+ return lastItem == null ? east : lastItem;
+ return firstItem == null ? east : firstItem;
+ }
+ throw new IllegalArgumentException("constraint " + constraints
+ + " is not recognized");
+ }
+
+ /**
+ * Return the constraint corresponding to a component in this layout.
+ * If the component is null, or is not in this layout, returns null.
+ * Otherwise, this will return one of the constraint constants defined
+ * in this class.
+ * @param c the component
+ * @return the constraint, or null
+ * @since 1.5
+ */
+ public Object getConstraints(Component c)
+ {
+ if (c == null)
+ return null;
+ if (c == center)
+ return CENTER;
+ if (c == north)
+ return NORTH;
+ if (c == east)
+ return EAST;
+ if (c == south)
+ return SOUTH;
+ if (c == west)
+ return WEST;
+ if (c == firstLine)
+ return PAGE_START;
+ if (c == lastLine)
+ return PAGE_END;
+ if (c == firstItem)
+ return LINE_START;
+ if (c == lastItem)
+ return LINE_END;
+ return null;
+ }
}
diff --git a/libjava/classpath/java/awt/Button.java b/libjava/classpath/java/awt/Button.java
index 90be1e5b111..e788d824ee1 100644
--- a/libjava/classpath/java/awt/Button.java
+++ b/libjava/classpath/java/awt/Button.java
@@ -98,6 +98,8 @@ private transient ActionListener action_listeners;
protected class AccessibleAWTButton extends AccessibleAWTComponent
implements AccessibleAction, AccessibleValue
{
+ public static final long serialVersionUID = -5932203980244017102L;
+
protected AccessibleAWTButton()
{
// Do nothing here.
diff --git a/libjava/classpath/java/awt/Canvas.java b/libjava/classpath/java/awt/Canvas.java
index fe2f854847a..b599582ba93 100644
--- a/libjava/classpath/java/awt/Canvas.java
+++ b/libjava/classpath/java/awt/Canvas.java
@@ -292,8 +292,8 @@ public class Canvas
*
* @since 1.4
*/
- public void createBufferStrategy(int numBuffers,
- BufferCapabilities caps)
+ public void createBufferStrategy(int numBuffers, BufferCapabilities caps)
+ throws AWTException
{
if (numBuffers < 1)
throw new IllegalArgumentException("Canvas.createBufferStrategy: number"
@@ -305,15 +305,7 @@ public class Canvas
// a flipping strategy was requested
if (caps.isPageFlipping())
- {
- try
- {
- bufferStrategy = new CanvasFlipBufferStrategy(numBuffers);
- }
- catch (AWTException e)
- {
- }
- }
+ bufferStrategy = new CanvasFlipBufferStrategy(numBuffers);
else
bufferStrategy = new CanvasBltBufferStrategy(numBuffers, true);
}
diff --git a/libjava/classpath/java/awt/Checkbox.java b/libjava/classpath/java/awt/Checkbox.java
index cd39ad43617..93f60924723 100644
--- a/libjava/classpath/java/awt/Checkbox.java
+++ b/libjava/classpath/java/awt/Checkbox.java
@@ -392,6 +392,11 @@ Checkbox(String label, boolean state, CheckboxGroup group)
this.label = label;
this.state = state;
this.group = group;
+
+ if ( state && group != null )
+ {
+ group.setSelectedCheckbox(this);
+ }
}
/*************************************************************************/
@@ -610,8 +615,10 @@ dispatchEventImpl(AWTEvent e)
protected String
paramString()
{
- return ("label=" + label + ",state=" + state + ",group=" + group
- + "," + super.paramString());
+ // Note: We cannot add the checkbox group information here because this
+ // would trigger infinite recursion when CheckboxGroup.toString() is
+ // called and the box is in its selected state.
+ return ("label=" + label + ",state=" + state + "," + super.paramString());
}
/**
diff --git a/libjava/classpath/java/awt/CheckboxMenuItem.java b/libjava/classpath/java/awt/CheckboxMenuItem.java
index 5e446b84c8b..197065f6535 100644
--- a/libjava/classpath/java/awt/CheckboxMenuItem.java
+++ b/libjava/classpath/java/awt/CheckboxMenuItem.java
@@ -335,6 +335,8 @@ paramString()
implements AccessibleAction, AccessibleValue
{
// I think the base class provides the necessary implementation
+
+ private static final long serialVersionUID = -1122642964303476L;
}
/**
diff --git a/libjava/classpath/java/awt/Choice.java b/libjava/classpath/java/awt/Choice.java
index 5075ea92d83..df93c5b0742 100644
--- a/libjava/classpath/java/awt/Choice.java
+++ b/libjava/classpath/java/awt/Choice.java
@@ -565,6 +565,10 @@ processEvent(AWTEvent event)
protected void
processItemEvent(ItemEvent event)
{
+ int index = pItems.indexOf((String) event.getItem());
+ // Don't call back into the peers when selecting index here
+ if (event.getStateChange() == ItemEvent.SELECTED)
+ this.selectedIndex = index;
if (item_listeners != null)
item_listeners.itemStateChanged(event);
}
diff --git a/libjava/classpath/java/awt/Color.java b/libjava/classpath/java/awt/Color.java
index 4ad46d0c07c..b0312924170 100644
--- a/libjava/classpath/java/awt/Color.java
+++ b/libjava/classpath/java/awt/Color.java
@@ -762,7 +762,7 @@ public class Color implements Paint, Serializable
if (max == 0)
array[1] = 0;
else
- array[1] = (max - min) / max;
+ array[1] = ((float) (max - min)) / ((float) max);
// Calculate hue.
if (array[1] == 0)
array[0] = 0;
diff --git a/libjava/classpath/java/awt/ColorPaintContext.java b/libjava/classpath/java/awt/ColorPaintContext.java
index 759ba9d8734..82a78f63fb5 100644
--- a/libjava/classpath/java/awt/ColorPaintContext.java
+++ b/libjava/classpath/java/awt/ColorPaintContext.java
@@ -63,7 +63,7 @@ class ColorPaintContext implements PaintContext
/**
* Create the context for a given color.
*
- * @param c The solid color to use.
+ * @param colorRGB The solid color to use.
*/
ColorPaintContext(int colorRGB)
{
@@ -74,7 +74,7 @@ class ColorPaintContext implements PaintContext
* Create the context for a given color.
*
* @param cm The color model of this context.
- * @param c The solid color to use.
+ * @param colorRGB The solid color to use.
*/
ColorPaintContext(ColorModel cm,int colorRGB)
{
diff --git a/libjava/classpath/java/awt/Component.java b/libjava/classpath/java/awt/Component.java
index 0ae1ffa7d0b..ec03d631dcf 100644
--- a/libjava/classpath/java/awt/Component.java
+++ b/libjava/classpath/java/awt/Component.java
@@ -587,6 +587,7 @@ public abstract class Component
*/
protected Component()
{
+ // Nothing to do here.
}
/**
@@ -720,8 +721,9 @@ public abstract class Component
/**
* Tests if the component is displayable. It must be connected to a native
- * screen resource, and all its ancestors must be displayable. A containment
- * hierarchy is made displayable when a window is packed or made visible.
+ * screen resource. This reduces to checking that peer is not null. A
+ * containment hierarchy is made displayable when a window is packed or
+ * made visible.
*
* @return true if the component is displayable
* @see Container#add(Component)
@@ -733,9 +735,7 @@ public abstract class Component
*/
public boolean isDisplayable()
{
- if (parent != null)
- return parent.isDisplayable();
- return false;
+ return peer != null;
}
/**
@@ -763,7 +763,7 @@ public abstract class Component
if (! visible || peer == null)
return false;
- return parent == null ? true : parent.isShowing();
+ return parent == null ? false : parent.isShowing();
}
/**
@@ -902,15 +902,16 @@ public abstract class Component
if (currentPeer != null)
currentPeer.setVisible(true);
+ // The JDK repaints the component before invalidating the parent.
+ // So do we.
+ if (isShowing())
+ repaint();
// Invalidate the parent if we have one. The component itself must
// not be invalidated. We also avoid NullPointerException with
// a local reference here.
Container currentParent = parent;
if (currentParent != null)
- {
- currentParent.invalidate();
- currentParent.repaint();
- }
+ currentParent.invalidate();
ComponentEvent ce =
new ComponentEvent(this,ComponentEvent.COMPONENT_SHOWN);
@@ -946,18 +947,19 @@ public abstract class Component
ComponentPeer currentPeer=peer;
if (currentPeer != null)
currentPeer.setVisible(false);
-
+ boolean wasShowing = isShowing();
this.visible = false;
-
+
+ // The JDK repaints the component before invalidating the parent.
+ // So do we.
+ if (wasShowing)
+ repaint();
// Invalidate the parent if we have one. The component itself must
// not be invalidated. We also avoid NullPointerException with
// a local reference here.
Container currentParent = parent;
if (currentParent != null)
- {
- currentParent.invalidate();
- currentParent.repaint();
- }
+ currentParent.invalidate();
ComponentEvent ce =
new ComponentEvent(this,ComponentEvent.COMPONENT_HIDDEN);
@@ -976,7 +978,7 @@ public abstract class Component
{
if (foreground != null)
return foreground;
- return parent == null ? SystemColor.windowText : parent.getForeground();
+ return parent == null ? null : parent.getForeground();
}
/**
@@ -1075,8 +1077,9 @@ public abstract class Component
Component p = parent;
if (p != null)
return p.getFont();
- else
- return new Font("Dialog", Font.PLAIN, 12);
+ if (peer != null)
+ return peer.getGraphics().getFont();
+ return null;
}
/**
@@ -1402,17 +1405,13 @@ public abstract class Component
peer.setBounds (x, y, width, height);
// Erase old bounds and repaint new bounds for lightweights.
- if (isLightweight() && isShowing ())
+ if (isLightweight() && isShowing())
{
if (parent != null)
{
- Rectangle parentBounds = parent.getBounds();
- Rectangle oldBounds = new Rectangle(parent.getX() + oldx,
- parent.getY() + oldy,
- oldwidth, oldheight);
- Rectangle newBounds = new Rectangle(parent.getX() + x,
- parent.getY() + y,
- width, height);
+ Rectangle oldBounds = new Rectangle(oldx, oldy, oldwidth,
+ oldheight);
+ Rectangle newBounds = new Rectangle(x, y, width, height);
Rectangle destroyed = oldBounds.union(newBounds);
if (!destroyed.isEmpty())
parent.repaint(0, destroyed.x, destroyed.y, destroyed.width,
@@ -1646,7 +1645,7 @@ public abstract class Component
*/
public Dimension getMaximumSize()
{
- return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+ return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
}
/**
@@ -1720,7 +1719,7 @@ public abstract class Component
valid = false;
prefSize = null;
minSize = null;
- if (parent != null && parent.valid)
+ if (parent != null && parent.isValid())
parent.invalidate();
}
@@ -1736,11 +1735,8 @@ public abstract class Component
if (peer != null)
{
Graphics gfx = peer.getGraphics();
- if (gfx != null)
- return gfx;
- // create graphics for lightweight:
- Container parent = getParent();
- if (parent != null)
+ // Create peer for lightweights.
+ if (gfx == null && parent != null)
{
gfx = parent.getGraphics();
Rectangle bounds = getBounds();
@@ -1748,6 +1744,8 @@ public abstract class Component
gfx.translate(bounds.x, bounds.y);
return gfx;
}
+ gfx.setFont(font);
+ return gfx;
}
return null;
}
@@ -1887,14 +1885,8 @@ public abstract class Component
* @see #repaint(long, int, int, int, int)
*/
public void repaint()
- {
- if(!isShowing())
- {
- Component p = parent;
- if (p != null)
- p.repaint(0, getX(), getY(), width, height);
- }
- else
+ {
+ if (isShowing())
repaint(0, 0, 0, width, height);
}
@@ -1909,13 +1901,7 @@ public abstract class Component
*/
public void repaint(long tm)
{
- if(!isShowing())
- {
- Component p = parent;
- if (p != null)
- p.repaint(tm, getX(), getY(), width, height);
- }
- else
+ if (isShowing())
repaint(tm, 0, 0, width, height);
}
@@ -1933,13 +1919,7 @@ public abstract class Component
*/
public void repaint(int x, int y, int w, int h)
{
- if(!isShowing())
- {
- Component p = parent;
- if (p != null)
- p.repaint(0, x + getX(), y + getY(), width, height);
- }
- else
+ if (isShowing())
repaint(0, x, y, w, h);
}
@@ -1958,13 +1938,7 @@ public abstract class Component
*/
public void repaint(long tm, int x, int y, int width, int height)
{
- if(!isShowing())
- {
- Component p = parent;
- if (p != null)
- p.repaint(tm, x + getX(), y + getY(), width, height);
- }
- else
+ if (isShowing())
{
ComponentPeer p = peer;
if (p != null)
@@ -3481,7 +3455,10 @@ public abstract class Component
ComponentPeer tmp = peer;
peer = null;
if (tmp != null)
- tmp.dispose();
+ {
+ tmp.hide();
+ tmp.dispose();
+ }
}
/**
@@ -3807,13 +3784,16 @@ public abstract class Component
{
synchronized (getTreeLock ())
{
- // Find this Component's top-level ancestor.
- Container parent = getParent ();
-
+ // Find this Component's top-level ancestor.
+ Container parent = (this instanceof Container) ? (Container) this
+ : getParent();
while (parent != null
&& !(parent instanceof Window))
parent = parent.getParent ();
+ if (parent == null)
+ return;
+
Window toplevel = (Window) parent;
if (toplevel.isFocusableWindow ())
{
@@ -4241,9 +4221,9 @@ public abstract class Component
if (isDoubleBuffered())
param.append(",doublebuffered");
if (parent == null)
- param.append(",parent==null");
+ param.append(",parent=null");
else
- param.append(",parent==").append(parent.getName());
+ param.append(",parent=").append(parent.getName());
return param.toString();
}
@@ -5567,6 +5547,7 @@ p * <li>the set of backward traversal keys
*/
protected AccessibleAWTComponentHandler()
{
+ // Nothing to do here.
}
/**
@@ -5598,6 +5579,7 @@ p * <li>the set of backward traversal keys
*/
public void componentMoved(ComponentEvent e)
{
+ // Nothing to do here.
}
/**
@@ -5607,6 +5589,7 @@ p * <li>the set of backward traversal keys
*/
public void componentResized(ComponentEvent e)
{
+ // Nothing to do here.
}
} // class AccessibleAWTComponentHandler
@@ -5624,6 +5607,7 @@ p * <li>the set of backward traversal keys
*/
protected AccessibleAWTFocusHandler()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/java/awt/Container.java b/libjava/classpath/java/awt/Container.java
index 13d32f87f39..ed791dc8b88 100644
--- a/libjava/classpath/java/awt/Container.java
+++ b/libjava/classpath/java/awt/Container.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.awt;
+import java.awt.event.ComponentListener;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.awt.event.KeyEvent;
@@ -122,6 +123,7 @@ public class Container extends Component
*/
public Container()
{
+ // Nothing to do here.
}
/**
@@ -394,17 +396,20 @@ public class Container extends Component
layoutMgr.addLayoutComponent(null, comp);
}
- if (isShowing ())
- {
- // Post event to notify of adding the component.
- ContainerEvent ce = new ContainerEvent(this,
- ContainerEvent.COMPONENT_ADDED,
- comp);
- getToolkit().getSystemEventQueue().postEvent(ce);
-
- // Repaint this container.
- repaint();
- }
+ // We previously only sent an event when this container is showing.
+ // Also, the event was posted to the event queue. A Mauve test shows
+ // that this event is not delivered using the event queue and it is
+ // also sent when the container is not showing.
+ ContainerEvent ce = new ContainerEvent(this,
+ ContainerEvent.COMPONENT_ADDED,
+ comp);
+ ContainerListener[] listeners = getContainerListeners();
+ for (int i = 0; i < listeners.length; i++)
+ listeners[i].componentAdded(ce);
+
+ // Repaint this container.
+ repaint(comp.getX(), comp.getY(), comp.getWidth(),
+ comp.getHeight());
}
}
@@ -419,7 +424,12 @@ public class Container extends Component
{
Component r = component[index];
- r.removeNotify();
+ ComponentListener[] list = r.getComponentListeners();
+ for (int j = 0; j < list.length; j++)
+ r.removeComponentListener(list[j]);
+
+ if (r.isShowing())
+ r.removeNotify();
System.arraycopy(component, index + 1, component, index,
ncomponents - index - 1);
@@ -730,7 +740,16 @@ public class Container extends Component
*/
public float getAlignmentX()
{
- return super.getAlignmentX();
+ LayoutManager layout = getLayout();
+ float alignmentX = 0.0F;
+ if (layout != null && layout instanceof LayoutManager2)
+ {
+ LayoutManager2 lm2 = (LayoutManager2) layout;
+ alignmentX = lm2.getLayoutAlignmentX(this);
+ }
+ else
+ alignmentX = super.getAlignmentX();
+ return alignmentX;
}
/**
@@ -742,7 +761,16 @@ public class Container extends Component
*/
public float getAlignmentY()
{
- return super.getAlignmentY();
+ LayoutManager layout = getLayout();
+ float alignmentY = 0.0F;
+ if (layout != null && layout instanceof LayoutManager2)
+ {
+ LayoutManager2 lm2 = (LayoutManager2) layout;
+ alignmentY = lm2.getLayoutAlignmentY(this);
+ }
+ else
+ alignmentY = super.getAlignmentY();
+ return alignmentY;
}
/**
@@ -820,7 +848,7 @@ public class Container extends Component
*/
public void paintComponents(Graphics g)
{
- super.paint(g);
+ paint(g);
visitChildren(g, GfxPaintAllVisitor.INSTANCE, true);
}
@@ -1047,6 +1075,53 @@ public class Container extends Component
return this;
}
}
+
+ /**
+ * Finds the visible child component that contains the specified position.
+ * The top-most child is returned in the case where there is overlap.
+ * If the top-most child is transparent and has no MouseListeners attached,
+ * we discard it and return the next top-most component containing the
+ * specified position.
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return null if the <code>this</code> does not contain the position,
+ * otherwise the top-most component (out of this container itself and
+ * its descendants) meeting the criteria above.
+ */
+ Component findComponentForMouseEventAt(int x, int y)
+ {
+ synchronized (getTreeLock())
+ {
+ if (!contains(x, y))
+ return null;
+
+ for (int i = 0; i < ncomponents; ++i)
+ {
+ // Ignore invisible children...
+ if (!component[i].isVisible())
+ continue;
+
+ int x2 = x - component[i].x;
+ int y2 = y - component[i].y;
+ // We don't do the contains() check right away because
+ // findComponentAt would redundantly do it first thing.
+ if (component[i] instanceof Container)
+ {
+ Container k = (Container) component[i];
+ Component r = k.findComponentForMouseEventAt(x2, y2);
+ if (r != null)
+ return r;
+ }
+ else if (component[i].contains(x2, y2))
+ return component[i];
+ }
+
+ //don't return transparent components with no MouseListeners
+ if (this.getMouseListeners().length == 0)
+ return null;
+ return this;
+ }
+ }
public Component findComponentAt(Point p)
{
@@ -1899,6 +1974,7 @@ public class Container extends Component
*/
protected AccessibleContainerHandler()
{
+ // Nothing to do here.
}
/**
@@ -1955,6 +2031,29 @@ class LightweightDispatcher implements Serializable
eventMask |= l;
}
+ /**
+ * Returns the deepest visible descendent of parent that contains the
+ * specified location and that is not transparent and MouseListener-less.
+ * @param parent the root component to begin the search
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @return null if <code>parent</code> doesn't contain the location,
+ * parent if parent is not a container or has no child that contains the
+ * location, otherwise the appropriate component from the conditions
+ * above.
+ */
+ Component getDeepestComponentForMouseEventAt(Component parent, int x, int y)
+ {
+ if (parent == null || (! parent.contains(x, y)))
+ return null;
+
+ if (! (parent instanceof Container))
+ return parent;
+
+ Container c = (Container) parent;
+ return c.findComponentForMouseEventAt(x, y);
+ }
+
Component acquireComponentForMouseEvent(MouseEvent me)
{
int x = me.getX ();
@@ -1967,8 +2066,7 @@ class LightweightDispatcher implements Serializable
Point p = me.getPoint();
while (candidate == null && parent != null)
{
- candidate =
- AWTUtilities.getDeepestComponentAt(parent, p.x, p.y);
+ candidate = getDeepestComponentForMouseEventAt(parent, p.x, p.y);
if (candidate == null || (candidate.eventMask & me.getID()) == 0)
{
candidate = null;
@@ -2050,14 +2148,12 @@ class LightweightDispatcher implements Serializable
break;
}
- if (me.getID() == MouseEvent.MOUSE_RELEASED
- || me.getID() == MouseEvent.MOUSE_PRESSED && modifiers > 0
+ if (me.getID() == MouseEvent.MOUSE_PRESSED && modifiers > 0
|| me.getID() == MouseEvent.MOUSE_DRAGGED)
{
// If any of the following events occur while a button is held down,
// they should be dispatched to the same component to which the
// original MOUSE_PRESSED event was dispatched:
- // - MOUSE_RELEASED
// - MOUSE_PRESSED: another button pressed while the first is held
// down
// - MOUSE_DRAGGED
@@ -2069,7 +2165,10 @@ class LightweightDispatcher implements Serializable
// Don't dispatch CLICKED events whose target is not the same as the
// target for the original PRESSED event.
if (candidate != pressedComponent)
- mouseEventTarget = null;
+ {
+ mouseEventTarget = null;
+ pressCount = 0;
+ }
else if (pressCount == 0)
pressedComponent = null;
}
@@ -2104,7 +2203,10 @@ class LightweightDispatcher implements Serializable
// there is a CLICKED event after this, it will do clean up.
if (--pressCount == 0
&& mouseEventTarget != pressedComponent)
- pressedComponent = null;
+ {
+ pressedComponent = null;
+ pressCount = 0;
+ }
break;
}
diff --git a/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java b/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java
index f53cc5ef04d..bce6352a900 100644
--- a/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java
+++ b/libjava/classpath/java/awt/DefaultKeyboardFocusManager.java
@@ -146,8 +146,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
*/
private AWTKeyStroke waitForKeyStroke = null;
- /** The {@link java.util.SortedSet} of current {@link
- #EventDelayRequest}s. */
+ /** The {@link java.util.SortedSet} of current
+ * {@link EventDelayRequest}s. */
private SortedSet delayRequests = new TreeSet ();
public DefaultKeyboardFocusManager ()
diff --git a/libjava/classpath/java/awt/Dialog.java b/libjava/classpath/java/awt/Dialog.java
index d3eb975a86d..7e5e7215aac 100644
--- a/libjava/classpath/java/awt/Dialog.java
+++ b/libjava/classpath/java/awt/Dialog.java
@@ -519,6 +519,8 @@ paramString()
protected class AccessibleAWTDialog extends AccessibleAWTWindow
{
+ private static final long serialVersionUID = 4837230331833941201L;
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.DIALOG;
diff --git a/libjava/classpath/java/awt/EventQueue.java b/libjava/classpath/java/awt/EventQueue.java
index 15b6e1e7afd..235ad2ac17c 100644
--- a/libjava/classpath/java/awt/EventQueue.java
+++ b/libjava/classpath/java/awt/EventQueue.java
@@ -42,7 +42,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.InputMethodEvent;
import java.awt.event.InvocationEvent;
-import java.awt.event.WindowEvent;
import java.lang.reflect.InvocationTargetException;
import java.util.EmptyStackException;
diff --git a/libjava/classpath/java/awt/Font.java b/libjava/classpath/java/awt/Font.java
index 5de94586e2c..2e4c9f61c68 100644
--- a/libjava/classpath/java/awt/Font.java
+++ b/libjava/classpath/java/awt/Font.java
@@ -50,6 +50,7 @@ import java.awt.geom.Rectangle2D;
import java.awt.peer.FontPeer;
import java.io.IOException;
import java.io.InputStream;
+import java.io.ObjectInputStream;
import java.io.Serializable;
import java.text.AttributedCharacterIterator;
import java.text.CharacterIterator;
@@ -69,39 +70,35 @@ import java.util.StringTokenizer;
public class Font implements Serializable
{
-/*
- * Static Variables
- */
-
-/**
- * Constant indicating a "plain" font.
- */
-public static final int PLAIN = 0;
+ /**
+ * Constant indicating a "plain" font.
+ */
+ public static final int PLAIN = 0;
-/**
- * Constant indicating a "bold" font.
- */
-public static final int BOLD = 1;
+ /**
+ * Constant indicating a "bold" font.
+ */
+ public static final int BOLD = 1;
-/**
- * Constant indicating an "italic" font.
- */
-public static final int ITALIC = 2;
+ /**
+ * Constant indicating an "italic" font.
+ */
+ public static final int ITALIC = 2;
-/**
- * Constant indicating the baseline mode characteristic of Roman.
- */
-public static final int ROMAN_BASELINE = 0;
+ /**
+ * Constant indicating the baseline mode characteristic of Roman.
+ */
+ public static final int ROMAN_BASELINE = 0;
-/**
- * Constant indicating the baseline mode characteristic of Chinese.
- */
-public static final int CENTER_BASELINE = 1;
+ /**
+ * Constant indicating the baseline mode characteristic of Chinese.
+ */
+ public static final int CENTER_BASELINE = 1;
-/**
- * Constant indicating the baseline mode characteristic of Devanigri.
- */
-public static final int HANGING_BASELINE = 2;
+ /**
+ * Constant indicating the baseline mode characteristic of Devanigri.
+ */
+ public static final int HANGING_BASELINE = 2;
/**
@@ -170,1145 +167,1138 @@ public static final int HANGING_BASELINE = 2;
protected String name;
/**
- * The size of this font in pixels.
+ * The size of this font in points, rounded.
*
* @since 1.0
*/
protected int size;
/**
+ * The size of this font in points.
+ *
+ * @since 1.0
+ */
+ protected float pointSize;
+
+ /**
* The style of this font -- PLAIN, BOLD, ITALIC or BOLD+ITALIC.
*
* @since 1.0
*/
protected int style;
-// Serialization constant
-private static final long serialVersionUID = -4206021311591459213L;
+//Serialization constant
+ private static final long serialVersionUID = -4206021311591459213L;
// The ClasspathToolkit-provided peer which implements this font
- private ClasspathFontPeer peer;
-
-/*************************************************************************/
+ private transient ClasspathFontPeer peer;
-/*
- * Static Methods
- */
-/**
- * Creates a <code>Font</code> object from the specified string, which
- * is in one of the following formats:
- * <p>
- * <ul>
- * <li>fontname-style-pointsize
- * <li>fontname-style
- * <li>fontname-pointsize
- * <li>fontname
- * </ul>
- * <p>
- * The style should be one of BOLD, ITALIC, or BOLDITALIC. The default
- * style if none is specified is PLAIN. The default size if none
- * is specified is 12.
- *
- * @param fontspec a string specifying the required font (<code>null</code>
- * permitted, interpreted as 'Dialog-PLAIN-12').
- *
- * @return A font.
- */
- public static Font decode (String fontspec)
-{
- if (fontspec == null)
- fontspec = "Dialog-PLAIN-12";
- String name = null;
- int style = PLAIN;
- int size = 12;
-
- StringTokenizer st = new StringTokenizer(fontspec, "- ");
- while (st.hasMoreTokens())
- {
- String token = st.nextToken();
- if (name == null)
- {
- name = token;
- continue;
- }
-
- if (token.toUpperCase().equals("BOLD"))
- {
- style = BOLD;
- continue;
- }
- if (token.toUpperCase().equals("ITALIC"))
- {
- style = ITALIC;
- continue;
- }
- if (token.toUpperCase().equals("BOLDITALIC"))
- {
+ /**
+ * Creates a <code>Font</code> object from the specified string, which
+ * is in one of the following formats:
+ * <p>
+ * <ul>
+ * <li>fontname-style-pointsize
+ * <li>fontname-style
+ * <li>fontname-pointsize
+ * <li>fontname
+ * </ul>
+ * <p>
+ * The style should be one of BOLD, ITALIC, or BOLDITALIC. The default
+ * style if none is specified is PLAIN. The default size if none
+ * is specified is 12.
+ *
+ * @param fontspec a string specifying the required font (<code>null</code>
+ * permitted, interpreted as 'Dialog-PLAIN-12').
+ *
+ * @return A font.
+ */
+ public static Font decode(String fontspec)
+ {
+ if (fontspec == null)
+ fontspec = "Dialog-PLAIN-12";
+ String name = null;
+ int style = PLAIN;
+ int size = 12;
+
+ StringTokenizer st = new StringTokenizer(fontspec, "- ");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ if (name == null)
+ {
+ name = token;
+ continue;
+ }
+
+ if (token.toUpperCase().equals("BOLD"))
+ {
+ style = BOLD;
+ continue;
+ }
+ if (token.toUpperCase().equals("ITALIC"))
+ {
+ style = ITALIC;
+ continue;
+ }
+ if (token.toUpperCase().equals("BOLDITALIC"))
+ {
style = BOLD | ITALIC;
- continue;
- }
-
- int tokenval = 0;
- try
- {
- tokenval = Integer.parseInt(token);
- }
- catch(NumberFormatException e)
- {
- // Ignored.
- }
+ continue;
+ }
+
+ int tokenval = 0;
+ try
+ {
+ tokenval = Integer.parseInt(token);
+ }
+ catch (NumberFormatException e)
+ {
+ // Ignored.
+ }
if (tokenval != 0)
size = tokenval;
}
HashMap attrs = new HashMap();
- ClasspathFontPeer.copyStyleToAttrs (style, attrs);
- ClasspathFontPeer.copySizeToAttrs (size, attrs);
+ ClasspathFontPeer.copyStyleToAttrs(style, attrs);
+ ClasspathFontPeer.copySizeToAttrs(size, attrs);
- return getFontFromToolkit (name, attrs);
-}
+ return getFontFromToolkit(name, attrs);
+ }
/* These methods delegate to the toolkit. */
- protected static ClasspathToolkit tk ()
+ static ClasspathToolkit tk()
{
- return (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
+ return (ClasspathToolkit) Toolkit.getDefaultToolkit();
}
/* Every factory method in Font should eventually call this. */
- protected static Font getFontFromToolkit (String name, Map attribs)
+ static Font getFontFromToolkit(String name, Map attribs)
{
- return tk ().getFont (name, attribs);
+ return tk().getFont(name, attribs);
}
/* Every Font constructor should eventually call this. */
- protected static ClasspathFontPeer getPeerFromToolkit (String name, Map attrs)
+ static ClasspathFontPeer getPeerFromToolkit(String name, Map attrs)
{
- return tk ().getClasspathFontPeer (name, attrs);
+ return tk().getClasspathFontPeer(name, attrs);
}
-/*************************************************************************/
-
-/**
- * Returns a <code>Font</code> object from the passed property name.
- *
- * @param propname The name of the system property.
- * @param defval Value to use if the property is not found.
- *
- * @return The requested font, or <code>default</code> if the property
- * not exist or is malformed.
- */
- public static Font getFont (String propname, Font defval)
-{
- String propval = System.getProperty(propname);
- if (propval != null)
- return decode (propval);
+ /**
+ * Returns a <code>Font</code> object from the passed property name.
+ *
+ * @param propname The name of the system property.
+ * @param defval Value to use if the property is not found.
+ *
+ * @return The requested font, or <code>default</code> if the property
+ * not exist or is malformed.
+ */
+ public static Font getFont(String propname, Font defval)
+ {
+ String propval = System.getProperty(propname);
+ if (propval != null)
+ return decode(propval);
return defval;
-}
-
-/*************************************************************************/
-
-/**
- * Returns a <code>Font</code> object from the passed property name.
- *
- * @param propname The name of the system property.
- *
- * @return The requested font, or <code>null</code> if the property
- * not exist or is malformed.
- */
- public static Font getFont (String propname)
-{
- return getFont (propname, (Font)null);
-}
-
-/*************************************************************************/
+ }
-/*
- * Constructors
- */
+ /**
+ * Returns a <code>Font</code> object from the passed property name.
+ *
+ * @param propname The name of the system property.
+ *
+ * @return The requested font, or <code>null</code> if the property
+ * not exist or is malformed.
+ */
+ public static Font getFont(String propname)
+ {
+ return getFont(propname, (Font) null);
+ }
-/**
- * Initializes a new instance of <code>Font</code> with the specified
- * attributes.
- *
- * @param name The name of the font.
- * @param style The font style.
- * @param size The font point size.
- */
-
- public Font (String name, int style, int size)
+ /**
+ * Initializes a new instance of <code>Font</code> with the specified
+ * attributes.
+ *
+ * @param name The name of the font.
+ * @param style The font style.
+ * @param size The font point size.
+ */
+ public Font(String name, int style, int size)
{
HashMap attrs = new HashMap();
- ClasspathFontPeer.copyStyleToAttrs (style, attrs);
- ClasspathFontPeer.copySizeToAttrs (size, attrs);
- this.peer = getPeerFromToolkit (name, attrs);
+ ClasspathFontPeer.copyStyleToAttrs(style, attrs);
+ ClasspathFontPeer.copySizeToAttrs(size, attrs);
+ this.peer = getPeerFromToolkit(name, attrs);
+ this.size = size;
+ this.pointSize = (float) size;
+ if (name != null)
+ this.name = name;
+ else
+ this.name = peer.getName(this);
}
- public Font (Map attrs)
+ public Font(Map attrs)
{
this(null, attrs);
}
/* This extra constructor is here to permit ClasspathToolkit and to
- build a font with a "logical name" as well as attrs.
- ClasspathToolkit.getFont(String,Map) uses reflection to call this
- package-private constructor. */
- Font (String name, Map attrs)
+ build a font with a "logical name" as well as attrs.
+ ClasspathToolkit.getFont(String,Map) uses reflection to call this
+ package-private constructor. */
+ Font(String name, Map attrs)
{
// If attrs is null, setting it to an empty HashMap will give this
// Font default attributes.
if (attrs == null)
attrs = new HashMap();
- this.peer = getPeerFromToolkit (name, attrs);
+ peer = getPeerFromToolkit(name, attrs);
+ size = (int) peer.getSize(this);
+ pointSize = peer.getSize(this);
+ if (name != null)
+ this.name = name;
+ else
+ this.name = peer.getName(this);
}
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
+ /**
* Returns the logical name of the font. A logical name is the name the
* font was constructed with. It may be the name of a logical font (one
* of 6 required names in all java environments) or it may be a face
* name.
- *
- * @return The logical name of the font.
- *
- * @see #getFamily()
- * @see #getFontName()
- */
+ *
+ * @return The logical name of the font.
+ *
+ * @see #getFamily()
+ * @see #getFontName()
+ */
public String getName ()
-{
- return peer.getName (this);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the style of the font.
- *
- * @return The font style.
- */
- public int getSize ()
-{
- return (int) peer.getSize (this);
-}
-
- public float getSize2D ()
-{
- return peer.getSize (this);
-}
-
-/*************************************************************************/
-
-/**
- * Tests whether or not this is a plain font. This will be true if
- * and only if neither the bold nor the italics style is set.
- *
- * @return <code>true</code> if this is a plain font, <code>false</code>
- * otherwise.
- */
- public boolean isPlain ()
-{
- return peer.isPlain (this);
-}
+ {
+ return peer.getName(this);
+ }
-/*************************************************************************/
+ /**
+ * Returns the size of the font, in typographics points (1/72 of an inch),
+ * rounded to an integer.
+ *
+ * @return The font size
+ */
+ public int getSize()
+ {
+ return size;
+ }
-/**
- * Tests whether or not this font is bold.
- *
- * @return <code>true</code> if this font is bold, <code>false</code>
- * otherwise.
- */
- public boolean isBold ()
-{
- return peer.isBold (this);
-}
+ /**
+ * Returns the size of the font, in typographics points (1/72 of an inch).
+ *
+ * @return The font size
+ */
+ public float getSize2D()
+ {
+ return pointSize;
+ }
-/*************************************************************************/
+ /**
+ * Tests whether or not this is a plain font. This will be true if
+ * and only if neither the bold nor the italics style is set.
+ *
+ * @return <code>true</code> if this is a plain font, <code>false</code>
+ * otherwise.
+ */
+ public boolean isPlain()
+ {
+ return peer.isPlain(this);
+ }
-/**
- * Tests whether or not this font is italic.
- *
- * @return <code>true</code> if this font is italic, <code>false</code>
- * otherwise.
- */
- public boolean isItalic ()
-{
- return peer.isItalic (this);
-}
+ /**
+ * Tests whether or not this font is bold.
+ *
+ * @return <code>true</code> if this font is bold, <code>false</code>
+ * otherwise.
+ */
+ public boolean isBold()
+ {
+ return peer.isBold(this);
+ }
-/*************************************************************************/
+ /**
+ * Tests whether or not this font is italic.
+ *
+ * @return <code>true</code> if this font is italic, <code>false</code>
+ * otherwise.
+ */
+ public boolean isItalic()
+ {
+ return peer.isItalic(this);
+ }
-/**
+ /**
* Returns the family name of this font. A family name describes a design
* or "brand name" (such as Helvetica or Palatino). It is less specific
* than a font face name (such as Helvetica Bold).
- *
- * @return A string containing the font family name.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFontName()
- * @see GraphicsEnvironment#getAvailableFontFamilyNames()
- */
- public String getFamily ()
-{
- return peer.getFamily (this);
-}
+ *
+ * @return A string containing the font family name.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFontName()
+ * @see GraphicsEnvironment#getAvailableFontFamilyNames()
+ */
+ public String getFamily()
+ {
+ return peer.getFamily(this);
+ }
-/**
- * Returns integer code representing the sum of style flags of this font, a
- * combination of either {@link #PLAIN}, {@link #BOLD}, or {@link #ITALIC}.
- *
- * @return code representing the style of this font.
- *
- * @see #isPlain()
- * @see #isBold()
- * @see #isItalic()
- */
- public int getStyle ()
-{
- return peer.getStyle (this);
-}
+ /**
+ * Returns integer code representing the sum of style flags of this font, a
+ * combination of either {@link #PLAIN}, {@link #BOLD}, or {@link #ITALIC}.
+ *
+ * @return code representing the style of this font.
+ *
+ * @see #isPlain()
+ * @see #isBold()
+ * @see #isItalic()
+ */
+ public int getStyle()
+ {
+ return peer.getStyle(this);
+ }
-/**
- * Checks if specified character maps to a glyph in this font.
- *
- * @param c The character to check.
- *
- * @return Whether the character has a corresponding glyph in this font.
- *
- * @since 1.2
- */
- public boolean canDisplay (char c)
-{
- return peer.canDisplay (this, c);
-}
+ /**
+ * Checks if specified character maps to a glyph in this font.
+ *
+ * @param c The character to check.
+ *
+ * @return Whether the character has a corresponding glyph in this font.
+ *
+ * @since 1.2
+ */
+ public boolean canDisplay(char c)
+ {
+ return peer.canDisplay(this, c);
+ }
-/**
- * Checks how much of a given string can be mapped to glyphs in
- * this font.
- *
- * @param s The string to check.
- *
- * @return The index of the first character in <code>s</code> which cannot
- * be converted to a glyph by this font, or <code>-1</code> if all
- * characters can be mapped to glyphs.
- *
- * @since 1.2
- */
- public int canDisplayUpTo (String s)
-{
- return peer.canDisplayUpTo (this, new StringCharacterIterator (s),
- 0, s.length () - 1);
-}
+ /**
+ * Checks how much of a given string can be mapped to glyphs in
+ * this font.
+ *
+ * @param s The string to check.
+ *
+ * @return The index of the first character in <code>s</code> which cannot
+ * be converted to a glyph by this font, or <code>-1</code> if all
+ * characters can be mapped to glyphs.
+ *
+ * @since 1.2
+ */
+ public int canDisplayUpTo(String s)
+ {
+ return peer.canDisplayUpTo(this, new StringCharacterIterator(s),
+ 0, s.length() - 1);
+ }
-/**
- * Checks how much of a given sequence of text can be mapped to glyphs in
- * this font.
- *
- * @param text Array containing the text to check.
- * @param start Position of first character to check in <code>text</code>.
- * @param limit Position of last character to check in <code>text</code>.
- *
- * @return The index of the first character in the indicated range which
- * cannot be converted to a glyph by this font, or <code>-1</code> if all
- * characters can be mapped to glyphs.
- *
- * @since 1.2
- *
- * @throws IndexOutOfBoundsException if the range [start, limit] is
- * invalid in <code>text</code>.
- */
+ /**
+ * Checks how much of a given sequence of text can be mapped to glyphs in
+ * this font.
+ *
+ * @param text Array containing the text to check.
+ * @param start Position of first character to check in <code>text</code>.
+ * @param limit Position of last character to check in <code>text</code>.
+ *
+ * @return The index of the first character in the indicated range which
+ * cannot be converted to a glyph by this font, or <code>-1</code> if all
+ * characters can be mapped to glyphs.
+ *
+ * @since 1.2
+ *
+ * @throws IndexOutOfBoundsException if the range [start, limit] is
+ * invalid in <code>text</code>.
+ */
public int canDisplayUpTo (char[] text, int start, int limit)
-{
- return peer.canDisplayUpTo
- (this, new StringCharacterIterator (new String (text)), start, limit);
-}
+ {
+ return peer.canDisplayUpTo(this,
+ new StringCharacterIterator(new String (text)),
+ start, limit);
+ }
-/**
- * Checks how much of a given sequence of text can be mapped to glyphs in
- * this font.
- *
- * @param i Iterator over the text to check.
- * @param start Position of first character to check in <code>i</code>.
- * @param limit Position of last character to check in <code>i</code>.
- *
- * @return The index of the first character in the indicated range which
- * cannot be converted to a glyph by this font, or <code>-1</code> if all
- * characters can be mapped to glyphs.
- *
- * @since 1.2
- *
- * @throws IndexOutOfBoundsException if the range [start, limit] is
- * invalid in <code>i</code>.
- */
- public int canDisplayUpTo (CharacterIterator i, int start, int limit)
-{
- return peer.canDisplayUpTo (this, i, start, limit);
-}
+ /**
+ * Checks how much of a given sequence of text can be mapped to glyphs in
+ * this font.
+ *
+ * @param i Iterator over the text to check.
+ * @param start Position of first character to check in <code>i</code>.
+ * @param limit Position of last character to check in <code>i</code>.
+ *
+ * @return The index of the first character in the indicated range which
+ * cannot be converted to a glyph by this font, or <code>-1</code> if all
+ * characters can be mapped to glyphs.
+ *
+ * @since 1.2
+ *
+ * @throws IndexOutOfBoundsException if the range [start, limit] is
+ * invalid in <code>i</code>.
+ */
+ public int canDisplayUpTo(CharacterIterator i, int start, int limit)
+ {
+ return peer.canDisplayUpTo(this, i, start, limit);
+ }
-/**
- * Creates a new font with point size 1 and {@link #PLAIN} style,
- * reading font data from the provided input stream. The resulting font
- * can have further fonts derived from it using its
- * <code>deriveFont</code> method.
- *
- * @param fontFormat Integer code indicating the format the font data is
- * in.Currently this can only be {@link #TRUETYPE_FONT}.
- * @param is {@link InputStream} from which font data will be read. This
- * stream is not closed after font data is extracted.
- *
- * @return A new {@link Font} of the format indicated.
- *
- * @throws IllegalArgumentException if <code>fontType</code> is not
- * recognized.
- * @throws FontFormatException if data in InputStream is not of format
- * indicated.
- * @throws IOException if insufficient data is present on InputStream.
- *
- * @since 1.3
- */
- public static Font createFont (int fontFormat, InputStream is)
- throws FontFormatException, IOException
-{
- return tk().createFont (fontFormat, is);
-}
+ /**
+ * Creates a new font with point size 1 and {@link #PLAIN} style,
+ * reading font data from the provided input stream. The resulting font
+ * can have further fonts derived from it using its
+ * <code>deriveFont</code> method.
+ *
+ * @param fontFormat Integer code indicating the format the font data is
+ * in.Currently this can only be {@link #TRUETYPE_FONT}.
+ * @param is {@link InputStream} from which font data will be read. This
+ * stream is not closed after font data is extracted.
+ *
+ * @return A new {@link Font} of the format indicated.
+ *
+ * @throws IllegalArgumentException if <code>fontType</code> is not
+ * recognized.
+ * @throws FontFormatException if data in InputStream is not of format
+ * indicated.
+ * @throws IOException if insufficient data is present on InputStream.
+ *
+ * @since 1.3
+ */
+ public static Font createFont (int fontFormat, InputStream is)
+ throws FontFormatException, IOException
+ {
+ return tk().createFont(fontFormat, is);
+ }
-/**
- * Maps characters to glyphs in a one-to-one relationship, returning a new
- * {@link GlyphVector} with a mapped glyph for each input character. This
- * sort of mapping is often sufficient for some scripts such as Roman, but
- * is inappropriate for scripts with special shaping or contextual layout
- * requirements such as Arabic, Indic, Hebrew or Thai.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param str The string to convert to Glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
- */
- public GlyphVector createGlyphVector (FontRenderContext ctx, String str)
-{
- return peer.createGlyphVector (this, ctx, new StringCharacterIterator (str));
-}
+ /**
+ * Maps characters to glyphs in a one-to-one relationship, returning a new
+ * {@link GlyphVector} with a mapped glyph for each input character. This
+ * sort of mapping is often sufficient for some scripts such as Roman, but
+ * is inappropriate for scripts with special shaping or contextual layout
+ * requirements such as Arabic, Indic, Hebrew or Thai.
+ *
+ * @param ctx The rendering context used for precise glyph placement.
+ * @param str The string to convert to Glyphs.
+ *
+ * @return A new {@link GlyphVector} containing glyphs mapped from str,
+ * through the font's cmap table.
+ *
+ * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
+ */
+ public GlyphVector createGlyphVector(FontRenderContext ctx, String str)
+ {
+ return peer.createGlyphVector(this, ctx, new StringCharacterIterator(str));
+ }
-/**
- * Maps characters to glyphs in a one-to-one relationship, returning a new
- * {@link GlyphVector} with a mapped glyph for each input character. This
- * sort of mapping is often sufficient for some scripts such as Roman, but
- * is inappropriate for scripts with special shaping or contextual layout
- * requirements such as Arabic, Indic, Hebrew or Thai.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param i Iterator over the text to convert to glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
- */
- public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i)
-{
- return peer.createGlyphVector (this, ctx, i);
-}
+ /**
+ * Maps characters to glyphs in a one-to-one relationship, returning a new
+ * {@link GlyphVector} with a mapped glyph for each input character. This
+ * sort of mapping is often sufficient for some scripts such as Roman, but
+ * is inappropriate for scripts with special shaping or contextual layout
+ * requirements such as Arabic, Indic, Hebrew or Thai.
+ *
+ * @param ctx The rendering context used for precise glyph placement.
+ * @param i Iterator over the text to convert to glyphs.
+ *
+ * @return A new {@link GlyphVector} containing glyphs mapped from str,
+ * through the font's cmap table.
+ *
+ * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
+ */
+ public GlyphVector createGlyphVector(FontRenderContext ctx,
+ CharacterIterator i)
+ {
+ return peer.createGlyphVector(this, ctx, i);
+ }
-/**
- * Maps characters to glyphs in a one-to-one relationship, returning a new
- * {@link GlyphVector} with a mapped glyph for each input character. This
- * sort of mapping is often sufficient for some scripts such as Roman, but
- * is inappropriate for scripts with special shaping or contextual layout
- * requirements such as Arabic, Indic, Hebrew or Thai.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param chars Array of characters to convert to glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
- */
- public GlyphVector createGlyphVector (FontRenderContext ctx, char[] chars)
-{
- return peer.createGlyphVector
- (this, ctx, new StringCharacterIterator (new String (chars)));
-}
+ /**
+ * Maps characters to glyphs in a one-to-one relationship, returning a new
+ * {@link GlyphVector} with a mapped glyph for each input character. This
+ * sort of mapping is often sufficient for some scripts such as Roman, but
+ * is inappropriate for scripts with special shaping or contextual layout
+ * requirements such as Arabic, Indic, Hebrew or Thai.
+ *
+ * @param ctx The rendering context used for precise glyph placement.
+ * @param chars Array of characters to convert to glyphs.
+ *
+ * @return A new {@link GlyphVector} containing glyphs mapped from str,
+ * through the font's cmap table.
+ *
+ * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
+ */
+ public GlyphVector createGlyphVector(FontRenderContext ctx, char[] chars)
+ {
+ return peer.createGlyphVector(this, ctx,
+ new StringCharacterIterator(new String(chars)));
+ }
-/**
- * Extracts a sequence of glyphs from a font, returning a new {@link
- * GlyphVector} with a mapped glyph for each input glyph code.
- *
- * @param ctx The rendering context used for precise glyph placement.
- * @param glyphCodes Array of characters to convert to glyphs.
- *
- * @return A new {@link GlyphVector} containing glyphs mapped from str,
- * through the font's cmap table.
- *
- * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
- *
- * @specnote This method is documented to perform character-to-glyph
- * conversions, in the Sun documentation, but its second parameter name is
- * "glyphCodes" and it is not clear to me why it would exist if its
- * purpose was to transport character codes inside integers. I assume it
- * is mis-documented in the Sun documentation.
- */
-
- public GlyphVector createGlyphVector (FontRenderContext ctx, int[] glyphCodes)
-{
- return peer.createGlyphVector (this, ctx, glyphCodes);
-}
+ /**
+ * Extracts a sequence of glyphs from a font, returning a new {@link
+ * GlyphVector} with a mapped glyph for each input glyph code.
+ *
+ * @param ctx The rendering context used for precise glyph placement.
+ * @param glyphCodes Array of characters to convert to glyphs.
+ *
+ * @return A new {@link GlyphVector} containing glyphs mapped from str,
+ * through the font's cmap table.
+ *
+ * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int)
+ *
+ * @specnote This method is documented to perform character-to-glyph
+ * conversions, in the Sun documentation, but its second parameter name is
+ * "glyphCodes" and it is not clear to me why it would exist if its
+ * purpose was to transport character codes inside integers. I assume it
+ * is mis-documented in the Sun documentation.
+ */
+ public GlyphVector createGlyphVector(FontRenderContext ctx, int[] glyphCodes)
+ {
+ return peer.createGlyphVector(this, ctx, glyphCodes);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new size and style.
- *
- * @param style The style of the newly created font.
- * @param size The size of the newly created font.
- *
- * @return A clone of the current font, with the specified size and style.
- *
- * @since 1.2
- */
- public Font deriveFont (int style, float size)
-{
- return peer.deriveFont (this, style, size);
-}
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new size and style.
+ *
+ * @param style The style of the newly created font.
+ * @param size The size of the newly created font.
+ *
+ * @return A clone of the current font, with the specified size and style.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(int style, float size)
+ {
+ return peer.deriveFont(this, style, size);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new size.
- *
- * @param size The size of the newly created font.
- *
- * @return A clone of the current font, with the specified size.
- *
- * @since 1.2
- */
- public Font deriveFont (float size)
-{
- return peer.deriveFont (this, size);
-}
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new size.
+ *
+ * @param size The size of the newly created font.
+ *
+ * @return A clone of the current font, with the specified size.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(float size)
+ {
+ return peer.deriveFont(this, size);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new style.
- *
- * @param style The style of the newly created font.
- *
- * @return A clone of the current font, with the specified style.
- *
- * @since 1.2
- */
- public Font deriveFont (int style)
-{
- return peer.deriveFont (this, style);
-}
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new style.
+ *
+ * @param style The style of the newly created font.
+ *
+ * @return A clone of the current font, with the specified style.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(int style)
+ {
+ return peer.deriveFont(this, style);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new style and subjected to a new affine transformation.
- *
- * @param style The style of the newly created font.
- * @param a The transformation to apply.
- *
- * @return A clone of the current font, with the specified style and
- * transform.
- *
- * @throws IllegalArgumentException If transformation is
- * <code>null</code>.
- *
- * @since 1.2
- */
- public Font deriveFont (int style, AffineTransform a)
-{
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new style and subjected to a new affine transformation.
+ *
+ * @param style The style of the newly created font.
+ * @param a The transformation to apply.
+ *
+ * @return A clone of the current font, with the specified style and
+ * transform.
+ *
+ * @throws IllegalArgumentException If transformation is
+ * <code>null</code>.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(int style, AffineTransform a)
+ {
if (a == null)
- throw new IllegalArgumentException ("Affine transformation is null");
+ throw new IllegalArgumentException("Affine transformation is null");
- return peer.deriveFont (this, style, a);
-}
+ return peer.deriveFont(this, style, a);
+ }
-/**
- * Produces a new {@link Font} based on the current font, subjected
- * to a new affine transformation.
- *
- * @param a The transformation to apply.
- *
- * @return A clone of the current font, with the specified transform.
- *
- * @throws IllegalArgumentException If transformation is
- * <code>null</code>.
- *
- * @since 1.2
- */
- public Font deriveFont (AffineTransform a)
-{
+ /**
+ * Produces a new {@link Font} based on the current font, subjected
+ * to a new affine transformation.
+ *
+ * @param a The transformation to apply.
+ *
+ * @return A clone of the current font, with the specified transform.
+ *
+ * @throws IllegalArgumentException If transformation is
+ * <code>null</code>.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(AffineTransform a)
+ {
if (a == null)
- throw new IllegalArgumentException ("Affine transformation is null");
+ throw new IllegalArgumentException("Affine transformation is null");
- return peer.deriveFont (this, a);
-}
+ return peer.deriveFont(this, a);
+ }
-/**
- * Produces a new {@link Font} based on the current font, adjusted to a
- * new set of attributes.
- *
- * @param attributes Attributes of the newly created font.
- *
- * @return A clone of the current font, with the specified attributes.
- *
- * @since 1.2
- */
- public Font deriveFont (Map attributes)
-{
- return peer.deriveFont (this, attributes);
-}
+ /**
+ * Produces a new {@link Font} based on the current font, adjusted to a
+ * new set of attributes.
+ *
+ * @param attributes Attributes of the newly created font.
+ *
+ * @return A clone of the current font, with the specified attributes.
+ *
+ * @since 1.2
+ */
+ public Font deriveFont(Map attributes)
+ {
+ return peer.deriveFont(this, attributes);
+ }
-/**
- * Returns a map of chracter attributes which this font currently has set.
- *
- * @return A map of chracter attributes which this font currently has set.
- *
- * @see #getAvailableAttributes()
- * @see java.text.AttributedCharacterIterator.Attribute
- * @see java.awt.font.TextAttribute
- */
- public Map getAttributes ()
-{
- return peer.getAttributes (this);
-}
+ /**
+ * Returns a map of chracter attributes which this font currently has set.
+ *
+ * @return A map of chracter attributes which this font currently has set.
+ *
+ * @see #getAvailableAttributes()
+ * @see java.text.AttributedCharacterIterator.Attribute
+ * @see java.awt.font.TextAttribute
+ */
+ public Map getAttributes()
+ {
+ return peer.getAttributes(this);
+ }
-/**
- * Returns an array of chracter attribute keys which this font understands.
- *
- * @return An array of chracter attribute keys which this font understands.
- *
- * @see #getAttributes()
- * @see java.text.AttributedCharacterIterator.Attribute
- * @see java.awt.font.TextAttribute
- */
+ /**
+ * Returns an array of chracter attribute keys which this font understands.
+ *
+ * @return An array of chracter attribute keys which this font understands.
+ *
+ * @see #getAttributes()
+ * @see java.text.AttributedCharacterIterator.Attribute
+ * @see java.awt.font.TextAttribute
+ */
public AttributedCharacterIterator.Attribute[] getAvailableAttributes()
-{
- return peer.getAvailableAttributes (this);
-}
+ {
+ return peer.getAvailableAttributes(this);
+ }
-/**
- * Returns a baseline code (one of {@link #ROMAN_BASELINE}, {@link
- * #CENTER_BASELINE} or {@link #HANGING_BASELINE}) indicating which baseline
- * this font will measure baseline offsets for, when presenting glyph
- * metrics for a given character.
- *
- * Baseline offsets describe the position of a glyph relative to an
- * invisible line drawn under, through the center of, or over a line of
- * rendered text, respectively. Different scripts use different baseline
- * modes, so clients should not assume all baseline offsets in a glyph
- * vector are from a common baseline.
- *
- * @param c The character code to select a baseline mode for.
- *
- * @return The baseline mode which would be used in a glyph associated
- * with the provided character.
- *
- * @since 1.2
- *
- * @see LineMetrics#getBaselineOffsets()
- */
- public byte getBaselineFor (char c)
-{
- return peer.getBaselineFor (this, c);
-}
+ /**
+ * Returns a baseline code (one of {@link #ROMAN_BASELINE}, {@link
+ * #CENTER_BASELINE} or {@link #HANGING_BASELINE}) indicating which baseline
+ * this font will measure baseline offsets for, when presenting glyph
+ * metrics for a given character.
+ *
+ * Baseline offsets describe the position of a glyph relative to an
+ * invisible line drawn under, through the center of, or over a line of
+ * rendered text, respectively. Different scripts use different baseline
+ * modes, so clients should not assume all baseline offsets in a glyph
+ * vector are from a common baseline.
+ *
+ * @param c The character code to select a baseline mode for.
+ *
+ * @return The baseline mode which would be used in a glyph associated
+ * with the provided character.
+ *
+ * @since 1.2
+ *
+ * @see LineMetrics#getBaselineOffsets()
+ */
+ public byte getBaselineFor(char c)
+ {
+ return peer.getBaselineFor(this, c);
+ }
-/**
- * Returns the family name of this font. A family name describes a
- * typographic style (such as Helvetica or Palatino). It is more specific
- * than a logical font name (such as Sans Serif) but less specific than a
- * font face name (such as Helvetica Bold).
- *
- * @param lc The locale in which to describe the name of the font family.
- *
- * @return A string containing the font family name, localized for the
- * provided locale.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFontName()
- * @see GraphicsEnvironment#getAvailableFontFamilyNames()
- * @see Locale
- */
- public String getFamily (Locale lc)
-{
- return peer.getFamily (this, lc);
-}
+ /**
+ * Returns the family name of this font. A family name describes a
+ * typographic style (such as Helvetica or Palatino). It is more specific
+ * than a logical font name (such as Sans Serif) but less specific than a
+ * font face name (such as Helvetica Bold).
+ *
+ * @param lc The locale in which to describe the name of the font family.
+ *
+ * @return A string containing the font family name, localized for the
+ * provided locale.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFontName()
+ * @see GraphicsEnvironment#getAvailableFontFamilyNames()
+ * @see Locale
+ */
+ public String getFamily(Locale lc)
+ {
+ return peer.getFamily(this, lc);
+ }
-/**
- * Returns a font appropriate for the given attribute set.
- *
- * @param attributes The attributes required for the new font.
- *
- * @return A new Font with the given attributes.
- *
- * @since 1.2
- *
- * @see java.awt.font.TextAttribute
- */
- public static Font getFont (Map attributes)
-{
- return getFontFromToolkit (null, attributes);
-}
+ /**
+ * Returns a font appropriate for the given attribute set.
+ *
+ * @param attributes The attributes required for the new font.
+ *
+ * @return A new Font with the given attributes.
+ *
+ * @since 1.2
+ *
+ * @see java.awt.font.TextAttribute
+ */
+ public static Font getFont(Map attributes)
+ {
+ return getFontFromToolkit(null, attributes);
+ }
-/**
- * Returns the font face name of the font. A font face name describes a
- * specific variant of a font family (such as Helvetica Bold). It is more
- * specific than both a font family name (such as Helvetica) and a logical
- * font name (such as Sans Serif).
- *
- * @return The font face name of the font.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFamily()
- */
- public String getFontName ()
-{
- return peer.getFontName (this);
-}
+ /**
+ * Returns the font face name of the font. A font face name describes a
+ * specific variant of a font family (such as Helvetica Bold). It is more
+ * specific than both a font family name (such as Helvetica) and a logical
+ * font name (such as Sans Serif).
+ *
+ * @return The font face name of the font.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFamily()
+ */
+ public String getFontName()
+ {
+ return peer.getFontName(this);
+ }
-/**
- * Returns the font face name of the font. A font face name describes a
- * specific variant of a font family (such as Helvetica Bold). It is more
+ /**
+ * Returns the font face name of the font. A font face name describes a
+ * specific variant of a font family (such as Helvetica Bold). It is more
* specific than both a font family name (such as Helvetica).
- *
- * @param lc The locale in which to describe the name of the font face.
- *
- * @return A string containing the font face name, localized for the
- * provided locale.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFamily()
- */
- public String getFontName (Locale lc)
-{
- return peer.getFontName (this, lc);
-}
+ *
+ * @param lc The locale in which to describe the name of the font face.
+ *
+ * @return A string containing the font face name, localized for the
+ * provided locale.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFamily()
+ */
+ public String getFontName(Locale lc)
+ {
+ return peer.getFontName(this, lc);
+ }
-/**
- * Returns the italic angle of this font, a measurement of its slant when
- * style is {@link #ITALIC}. The precise meaning is the inverse slope of a
- * caret line which "best measures" the font's italic posture.
- *
- * @return The italic angle.
- *
- * @see java.awt.font.TextAttribute#POSTURE
- */
- public float getItalicAngle ()
-{
- return peer.getItalicAngle (this);
-}
+ /**
+ * Returns the italic angle of this font, a measurement of its slant when
+ * style is {@link #ITALIC}. The precise meaning is the inverse slope of a
+ * caret line which "best measures" the font's italic posture.
+ *
+ * @return The italic angle.
+ *
+ * @see java.awt.font.TextAttribute#POSTURE
+ */
+ public float getItalicAngle()
+ {
+ return peer.getItalicAngle(this);
+ }
-/**
- * Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
- *
- * @param text The string to calculate metrics from.
- * @param begin Index of first character in <code>text</code> to measure.
- * @param limit Index of last character in <code>text</code> to measure.
- * @param rc Context for calculating precise glyph placement and hints.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>text</code>.
- */
+ /**
+ * Returns a {@link LineMetrics} object constructed with the specified
+ * text and {@link FontRenderContext}.
+ *
+ * @param text The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param rc Context for calculating precise glyph placement and hints.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>text</code>.
+ */
public LineMetrics getLineMetrics(String text, int begin,
int limit, FontRenderContext rc)
-{
- return peer.getLineMetrics (this, new StringCharacterIterator (text),
- begin, limit, rc);
-}
+ {
+ return peer.getLineMetrics(this, new StringCharacterIterator(text),
+ begin, limit, rc);
+ }
-/**
- * Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
- *
- * @param chars The string to calculate metrics from.
- * @param begin Index of first character in <code>text</code> to measure.
- * @param limit Index of last character in <code>text</code> to measure.
- * @param rc Context for calculating precise glyph placement and hints.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>chars</code>.
- */
+ /**
+ * Returns a {@link LineMetrics} object constructed with the specified
+ * text and {@link FontRenderContext}.
+ *
+ * @param chars The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param rc Context for calculating precise glyph placement and hints.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>chars</code>.
+ */
public LineMetrics getLineMetrics(char[] chars, int begin,
int limit, FontRenderContext rc)
-{
- return peer.getLineMetrics (this, new StringCharacterIterator (new String(chars)),
- begin, limit, rc);
-}
+ {
+ return peer.getLineMetrics(this,
+ new StringCharacterIterator(new String(chars)),
+ begin, limit, rc);
+ }
-/**
- * Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
- *
- * @param ci The string to calculate metrics from.
- * @param begin Index of first character in <code>text</code> to measure.
- * @param limit Index of last character in <code>text</code> to measure.
- * @param rc Context for calculating precise glyph placement and hints.
- *
- * @return A new {@link LineMetrics} object.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>ci</code>.
- */
- public LineMetrics getLineMetrics (CharacterIterator ci, int begin,
- int limit, FontRenderContext rc)
-{
- return peer.getLineMetrics (this, ci, begin, limit, rc);
-}
+ /**
+ * Returns a {@link LineMetrics} object constructed with the specified
+ * text and {@link FontRenderContext}.
+ *
+ * @param ci The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param rc Context for calculating precise glyph placement and hints.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>ci</code>.
+ */
+ public LineMetrics getLineMetrics(CharacterIterator ci, int begin,
+ int limit, FontRenderContext rc)
+ {
+ return peer.getLineMetrics(this, ci, begin, limit, rc);
+ }
-/**
- * Returns the maximal bounding box of all the bounding boxes in this
- * font, when the font's bounding boxes are evaluated in a given {@link
- * FontRenderContext}
- *
- * @param rc Context in which to evaluate bounding boxes.
- *
- * @return The maximal bounding box.
- */
- public Rectangle2D getMaxCharBounds (FontRenderContext rc)
-{
- return peer.getMaxCharBounds (this, rc);
-}
+ /**
+ * Returns the maximal bounding box of all the bounding boxes in this
+ * font, when the font's bounding boxes are evaluated in a given {@link
+ * FontRenderContext}
+ *
+ * @param rc Context in which to evaluate bounding boxes.
+ *
+ * @return The maximal bounding box.
+ */
+ public Rectangle2D getMaxCharBounds(FontRenderContext rc)
+ {
+ return peer.getMaxCharBounds(this, rc);
+ }
-/**
- * Returns the glyph code this font uses to represent missing glyphs. This
- * code will be present in glyph vectors when the font was unable to
- * locate a glyph to represent a particular character code.
- *
- * @return The missing glyph code.
- *
- * @since 1.2
- */
- public int getMissingGlyphCode ()
-{
- return peer.getMissingGlyphCode (this);
-}
+ /**
+ * Returns the glyph code this font uses to represent missing glyphs. This
+ * code will be present in glyph vectors when the font was unable to
+ * locate a glyph to represent a particular character code.
+ *
+ * @return The missing glyph code.
+ *
+ * @since 1.2
+ */
+ public int getMissingGlyphCode()
+ {
+ return peer.getMissingGlyphCode(this);
+ }
-/**
- * Returns the overall number of glyphs in this font. This number is one
- * more than the greatest glyph code used in any glyph vectors this font
- * produces. In other words, glyph codes are taken from the range
- * <code>[ 0, getNumGlyphs() - 1 ]</code>.
- *
- * @return The number of glyphs in this font.
- *
- * @since 1.2
- */
- public int getNumGlyphs ()
-{
- return peer.getMissingGlyphCode (this);
-}
+ /**
+ * Returns the overall number of glyphs in this font. This number is one
+ * more than the greatest glyph code used in any glyph vectors this font
+ * produces. In other words, glyph codes are taken from the range
+ * <code>[ 0, getNumGlyphs() - 1 ]</code>.
+ *
+ * @return The number of glyphs in this font.
+ *
+ * @since 1.2
+ */
+ public int getNumGlyphs()
+ {
+ return peer.getMissingGlyphCode(this);
+ }
-/**
- * Returns the PostScript Name of this font.
- *
- * @return The PostScript Name of this font.
- *
- * @since 1.2
- *
- * @see #getName()
- * @see #getFamily()
- * @see #getFontName()
- */
- public String getPSName ()
-{
- return peer.getPostScriptName (this);
-}
+ /**
+ * Returns the PostScript Name of this font.
+ *
+ * @return The PostScript Name of this font.
+ *
+ * @since 1.2
+ *
+ * @see #getName()
+ * @see #getFamily()
+ * @see #getFontName()
+ */
+ public String getPSName()
+ {
+ return peer.getPostScriptName(this);
+ }
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param str The string to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @see #createGlyphVector(FontRenderContext, String)
- */
- public Rectangle2D getStringBounds (String str, FontRenderContext frc)
-{
- return getStringBounds (str, 0, str.length () - 1, frc);
-}
+ /**
+ * Returns the logical bounds of the specified string when rendered with this
+ * font in the specified {@link FontRenderContext}. This box will include the
+ * glyph origin, ascent, advance, height, and leading, but may not include all
+ * diacritics or accents. To get the complete visual bounding box of all the
+ * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+ * {@link TextLayout}.
+ *
+ * @param str The string to measure.
+ * @param frc The context in which to make the precise glyph measurements.
+ *
+ * @return A bounding box covering the logical bounds of the specified text.
+ *
+ * @see #createGlyphVector(FontRenderContext, String)
+ */
+ public Rectangle2D getStringBounds(String str, FontRenderContext frc)
+ {
+ return getStringBounds(str, 0, str.length() - 1, frc);
+ }
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param str The string to measure.
- * @param begin Index of the first character in <code>str</code> to measure.
- * @param limit Index of the last character in <code>str</code> to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>str</code>.
- *
- * @since 1.2
- *
- * @see #createGlyphVector(FontRenderContext, String)
- */
- public Rectangle2D getStringBounds (String str, int begin,
- int limit, FontRenderContext frc)
-{
- return peer.getStringBounds (this, new StringCharacterIterator(str), begin, limit, frc);
-}
+ /**
+ * Returns the logical bounds of the specified string when rendered with this
+ * font in the specified {@link FontRenderContext}. This box will include the
+ * glyph origin, ascent, advance, height, and leading, but may not include all
+ * diacritics or accents. To get the complete visual bounding box of all the
+ * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+ * {@link TextLayout}.
+ *
+ * @param str The string to measure.
+ * @param begin Index of the first character in <code>str</code> to measure.
+ * @param limit Index of the last character in <code>str</code> to measure.
+ * @param frc The context in which to make the precise glyph measurements.
+ *
+ * @return A bounding box covering the logical bounds of the specified text.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>str</code>.
+ *
+ * @since 1.2
+ *
+ * @see #createGlyphVector(FontRenderContext, String)
+ */
+ public Rectangle2D getStringBounds(String str, int begin,
+ int limit, FontRenderContext frc)
+ {
+ return peer.getStringBounds(this, new StringCharacterIterator(str), begin,
+ limit, frc);
+ }
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param ci The text to measure.
- * @param begin Index of the first character in <code>ci</code> to measure.
- * @param limit Index of the last character in <code>ci</code> to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>ci</code>.
- *
- * @since 1.2
- *
- * @see #createGlyphVector(FontRenderContext, CharacterIterator)
- */
- public Rectangle2D getStringBounds (CharacterIterator ci, int begin,
- int limit, FontRenderContext frc)
-{
- return peer.getStringBounds (this, ci, begin, limit, frc);
-}
+ /**
+ * Returns the logical bounds of the specified string when rendered with this
+ * font in the specified {@link FontRenderContext}. This box will include the
+ * glyph origin, ascent, advance, height, and leading, but may not include all
+ * diacritics or accents. To get the complete visual bounding box of all the
+ * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+ * {@link TextLayout}.
+ *
+ * @param ci The text to measure.
+ * @param begin Index of the first character in <code>ci</code> to measure.
+ * @param limit Index of the last character in <code>ci</code> to measure.
+ * @param frc The context in which to make the precise glyph measurements.
+ *
+ * @return A bounding box covering the logical bounds of the specified text.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>ci</code>.
+ *
+ * @since 1.2
+ *
+ * @see #createGlyphVector(FontRenderContext, CharacterIterator)
+ */
+ public Rectangle2D getStringBounds(CharacterIterator ci, int begin,
+ int limit, FontRenderContext frc)
+ {
+ return peer.getStringBounds(this, ci, begin, limit, frc);
+ }
-/**
- * Returns the logical bounds of the specified string when rendered with this
- * font in the specified {@link FontRenderContext}. This box will include the
- * glyph origin, ascent, advance, height, and leading, but may not include all
- * diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
- * {@link TextLayout}.
- *
- * @param chars The text to measure.
- * @param begin Index of the first character in <code>ci</code> to measure.
- * @param limit Index of the last character in <code>ci</code> to measure.
- * @param frc The context in which to make the precise glyph measurements.
- *
- * @return A bounding box covering the logical bounds of the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>chars</code>.
- *
- * @since 1.2
- *
- * @see #createGlyphVector(FontRenderContext, char[])
- */
- public Rectangle2D getStringBounds (char[] chars, int begin,
- int limit, FontRenderContext frc)
-{
- return peer.getStringBounds (this, new StringCharacterIterator (new String (chars)),
- begin, limit, frc);
-}
+ /**
+ * Returns the logical bounds of the specified string when rendered with this
+ * font in the specified {@link FontRenderContext}. This box will include the
+ * glyph origin, ascent, advance, height, and leading, but may not include all
+ * diacritics or accents. To get the complete visual bounding box of all the
+ * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+ * {@link TextLayout}.
+ *
+ * @param chars The text to measure.
+ * @param begin Index of the first character in <code>ci</code> to measure.
+ * @param limit Index of the last character in <code>ci</code> to measure.
+ * @param frc The context in which to make the precise glyph measurements.
+ *
+ * @return A bounding box covering the logical bounds of the specified text.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>chars</code>.
+ *
+ * @since 1.2
+ *
+ * @see #createGlyphVector(FontRenderContext, char[])
+ */
+ public Rectangle2D getStringBounds(char[] chars, int begin,
+ int limit, FontRenderContext frc)
+ {
+ return peer.getStringBounds(this,
+ new StringCharacterIterator(new String(chars)),
+ begin, limit, frc);
+ }
-/**
- * Returns a copy of the affine transformation this font is currently
- * subject to, if any.
- *
- * @return The current transformation.
- */
- public AffineTransform getTransform ()
-{
- return peer.getTransform (this);
-}
+ /**
+ * Returns a copy of the affine transformation this font is currently
+ * subject to, if any.
+ *
+ * @return The current transformation.
+ */
+ public AffineTransform getTransform()
+ {
+ return peer.getTransform(this);
+ }
-/**
- * Indicates whether this font's line metrics are uniform. A font may be
- * composed of several "subfonts", each covering a different code range,
- * and each with their own line metrics. A font with no subfonts, or
- * subfonts with identical line metrics, is said to have "uniform" line
- * metrics.
- *
- * @return Whether this font has uniform line metrics.
- *
- * @see LineMetrics
- * @see #getLineMetrics(String, FontRenderContext)
- */
- public boolean hasUniformLineMetrics ()
-{
- return peer.hasUniformLineMetrics (this);
-}
+ /**
+ * Indicates whether this font's line metrics are uniform. A font may be
+ * composed of several "subfonts", each covering a different code range,
+ * and each with their own line metrics. A font with no subfonts, or
+ * subfonts with identical line metrics, is said to have "uniform" line
+ * metrics.
+ *
+ * @return Whether this font has uniform line metrics.
+ *
+ * @see LineMetrics
+ * @see #getLineMetrics(String, FontRenderContext)
+ */
+ public boolean hasUniformLineMetrics()
+ {
+ return peer.hasUniformLineMetrics(this);
+ }
-/**
- * Indicates whether this font is subject to a non-identity affine
- * transformation.
- *
- * @return <code>true</code> iff the font has a non-identity affine
- * transformation applied to it.
- */
- public boolean isTransformed ()
-{
- return peer.isTransformed (this);
-}
+ /**
+ * Indicates whether this font is subject to a non-identity affine
+ * transformation.
+ *
+ * @return <code>true</code> iff the font has a non-identity affine
+ * transformation applied to it.
+ */
+ public boolean isTransformed()
+ {
+ return peer.isTransformed(this);
+ }
-/**
- * Produces a glyph vector representing a full layout fo the specified
- * text in this font. Full layouts may include complex shaping and
- * reordering operations, for scripts such as Arabic or Hindi.
- *
- * Bidirectional (bidi) layout is not performed in this method; text
- * should have its bidi direction specified with one of the flags {@link
- * #LAYOUT_LEFT_TO_RIGHT} or {@link #LAYOUT_RIGHT_TO_LEFT}.
- *
- * Some types of layout (notably Arabic glyph shaping) may examine context
- * characters beyond the bounds of the indicated range, in order to select
- * an appropriate shape. The flags {@link #LAYOUT_NO_START_CONTEXT} and
- * {@link #LAYOUT_NO_LIMIT_CONTEXT} can be provided to prevent these extra
- * context areas from being examined, for instance if they contain invalid
- * characters.
- *
- * @param frc Context in which to perform the layout.
- * @param chars Text to perform layout on.
- * @param start Index of first character to perform layout on.
- * @param limit Index of last character to perform layout on.
- * @param flags Combination of flags controlling layout.
- *
- * @return A new {@link GlyphVector} representing the specified text.
- *
- * @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>chars</code>.
- */
- public GlyphVector layoutGlyphVector (FontRenderContext frc,
- char[] chars, int start,
- int limit, int flags)
-{
- return peer.layoutGlyphVector (this, frc, chars, start, limit, flags);
-}
+ /**
+ * Produces a glyph vector representing a full layout fo the specified
+ * text in this font. Full layouts may include complex shaping and
+ * reordering operations, for scripts such as Arabic or Hindi.
+ *
+ * Bidirectional (bidi) layout is not performed in this method; text
+ * should have its bidi direction specified with one of the flags {@link
+ * #LAYOUT_LEFT_TO_RIGHT} or {@link #LAYOUT_RIGHT_TO_LEFT}.
+ *
+ * Some types of layout (notably Arabic glyph shaping) may examine context
+ * characters beyond the bounds of the indicated range, in order to select
+ * an appropriate shape. The flags {@link #LAYOUT_NO_START_CONTEXT} and
+ * {@link #LAYOUT_NO_LIMIT_CONTEXT} can be provided to prevent these extra
+ * context areas from being examined, for instance if they contain invalid
+ * characters.
+ *
+ * @param frc Context in which to perform the layout.
+ * @param chars Text to perform layout on.
+ * @param start Index of first character to perform layout on.
+ * @param limit Index of last character to perform layout on.
+ * @param flags Combination of flags controlling layout.
+ *
+ * @return A new {@link GlyphVector} representing the specified text.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>chars</code>.
+ */
+ public GlyphVector layoutGlyphVector(FontRenderContext frc,
+ char[] chars, int start,
+ int limit, int flags)
+ {
+ return peer.layoutGlyphVector(this, frc, chars, start, limit, flags);
+ }
-/**
- * Returns a native peer object for this font.
- *
- * @return A native peer object for this font.
- *
- * @deprecated
- */
- public FontPeer getPeer ()
-{
+ /**
+ * Returns a native peer object for this font.
+ *
+ * @return A native peer object for this font.
+ *
+ * @deprecated
+ */
+ public FontPeer getPeer()
+ {
return peer;
-}
+ }
-/**
- * Returns a hash value for this font.
- *
- * @return A hash for this font.
- */
+ /**
+ * Returns a hash value for this font.
+ *
+ * @return A hash for this font.
+ */
public int hashCode()
-{
+ {
return this.toString().hashCode();
-}
-
-
-/**
- * Tests whether or not the specified object is equal to this font. This
- * will be true if and only if:
- * <P>
- * <ul>
- * <li>The object is not <code>null</code>.
- * <li>The object is an instance of <code>Font</code>.
- * <li>The object has the same names, style, size, and transform as this object.
- * </ul>
- *
- * @return <code>true</code> if the specified object is equal to this
- * object, <code>false</code> otherwise.
- */
-public boolean
-equals(Object obj)
-{
- if (obj == null)
- return(false);
+ }
- if (!(obj instanceof Font))
- return(false);
- Font f = (Font)obj;
+ /**
+ * Tests whether or not the specified object is equal to this font. This
+ * will be true if and only if:
+ * <P>
+ * <ul>
+ * <li>The object is not <code>null</code>.
+ * <li>The object is an instance of <code>Font</code>.
+ * <li>The object has the same names, style, size, and transform as this object.
+ * </ul>
+ *
+ * @return <code>true</code> if the specified object is equal to this
+ * object, <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ return false;
- return (f.getName ().equals (this.getName ()) &&
- f.getFamily ().equals (this.getFamily ()) &&
- f.getFontName ().equals (this.getFontName ()) &&
- f.getTransform ().equals (this.getTransform ()) &&
- f.getSize() == this.getSize() &&
- f.getStyle() == this.getStyle());
-}
+ if (! (obj instanceof Font))
+ return false;
-/*************************************************************************/
+ Font f = (Font) obj;
-/**
- * Returns a string representation of this font.
- *
- * @return A string representation of this font.
- */
-public String
-toString()
-{
- String styleString = "";
-
- switch (getStyle ())
- {
- case 0:
- styleString = "plain";
- break;
- case 1:
- styleString = "bold";
- break;
- case 2:
- styleString = "italic";
- break;
- default:
- styleString = "unknown";
- }
+ return (f.getName().equals(this.getName())
+ && f.getFamily().equals(this.getFamily())
+ && f.getFontName().equals(this.getFontName())
+ && f.getTransform().equals(this.getTransform ())
+ && f.getSize() == this.getSize()
+ && f.getStyle() == this.getStyle());
+ }
- return getClass ().getName ()
- + "[family=" + getFamily ()
- + ",name=" + getFontName ()
- + ",style=" + styleString
- + ",size=" + getSize () + "]";
-}
+ /**
+ * Returns a string representation of this font.
+ *
+ * @return A string representation of this font.
+ */
+ public String toString()
+ {
+ String styleString = "";
+
+ switch (getStyle())
+ {
+ case 0:
+ styleString = "plain";
+ break;
+ case 1:
+ styleString = "bold";
+ break;
+ case 2:
+ styleString = "italic";
+ break;
+ default:
+ styleString = "unknown";
+ }
+
+ return getClass().getName()
+ + "[family=" + getFamily ()
+ + ",name=" + getFontName ()
+ + ",style=" + styleString
+ + ",size=" + getSize () + "]";
+ }
/**
@@ -1331,8 +1321,22 @@ toString()
*/
public LineMetrics getLineMetrics(String str, FontRenderContext frc)
{
- return getLineMetrics (str, 0, str.length () - 1, frc);
+ return getLineMetrics(str, 0, str.length() - 1, frc);
}
-} // class Font
+ /**
+ * Reads the normal fields from the stream and then constructs the
+ * peer from the style and size through getPeerFromToolkit().
+ */
+ private void readObject(ObjectInputStream ois)
+ throws IOException, ClassNotFoundException
+ {
+ ois.defaultReadObject();
+
+ HashMap attrs = new HashMap();
+ ClasspathFontPeer.copyStyleToAttrs(style, attrs);
+ ClasspathFontPeer.copySizeToAttrs(size, attrs);
+ peer = getPeerFromToolkit(name, attrs);
+ }
+}
diff --git a/libjava/classpath/java/awt/FontMetrics.java b/libjava/classpath/java/awt/FontMetrics.java
index 6dd73ec2560..91866462fee 100644
--- a/libjava/classpath/java/awt/FontMetrics.java
+++ b/libjava/classpath/java/awt/FontMetrics.java
@@ -362,6 +362,18 @@ public abstract class FontMetrics implements java.io.Serializable
rc = gRC;
return font.getLineMetrics(chars, begin, limit, rc);
}
+
+ /**
+ * Returns the bounds of the largest character in a Graphics context.
+ * @param context the Graphics context object.
+ * @return a <code>Rectangle2D</code> representing the bounds
+ */
+ public Rectangle2D getMaxCharBounds(Graphics context)
+ {
+ if( context instanceof Graphics2D )
+ return font.getMaxCharBounds(((Graphics2D)context).getFontRenderContext());
+ return font.getMaxCharBounds( gRC );
+ }
/**
* Returns a {@link LineMetrics} object constructed with the
@@ -424,4 +436,13 @@ public abstract class FontMetrics implements java.io.Serializable
return gRC;
}
+
+ /**
+ * Returns if the font has uniform line metrics.
+ * @see Font#hasUniformLineMetrics()
+ */
+ public boolean hasUniformLineMetrics()
+ {
+ return font.hasUniformLineMetrics();
+ }
}
diff --git a/libjava/classpath/java/awt/Frame.java b/libjava/classpath/java/awt/Frame.java
index 05c938496e0..d6651f83e40 100644
--- a/libjava/classpath/java/awt/Frame.java
+++ b/libjava/classpath/java/awt/Frame.java
@@ -591,6 +591,8 @@ public static Frame[] getFrames()
protected class AccessibleAWTFrame extends AccessibleAWTWindow
{
+ private static final long serialVersionUID = -6172960752956030250L;
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.FRAME;
diff --git a/libjava/classpath/java/awt/Graphics.java b/libjava/classpath/java/awt/Graphics.java
index ff26190e5f0..a28ca7e428c 100644
--- a/libjava/classpath/java/awt/Graphics.java
+++ b/libjava/classpath/java/awt/Graphics.java
@@ -42,726 +42,595 @@ import java.awt.image.ImageObserver;
import java.text.AttributedCharacterIterator;
/**
- * This is the abstract superclass of classes for drawing to graphics
- * devices such as the screen or printers.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public abstract class Graphics
-{
-
-/*
- * Instance Variables
- */
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Default constructor for subclasses.
- */
-protected
-Graphics()
-{
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
+ * This is the abstract superclass of classes for drawing to graphics
+ * devices such as the screen or printers.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
*/
-
-/**
- * Returns a copy of this <code>Graphics</code> object.
- *
- * @return A copy of this object.
- */
-public abstract Graphics
-create();
-
-/*************************************************************************/
-
-/**
- * Returns a copy of this <code>Graphics</code> object. The origin point
- * will be translated to the point (x, y) and the cliping rectangle set
- * to the intersection of the clipping rectangle in this object and the
- * rectangle specified by the parameters to this method.
- *
- * @param x The new X coordinate of the clipping region rect.
- * @param y The new Y coordinate of the clipping region rect.
- * @param width The width of the clipping region intersect rectangle.
- * @param height The height of the clipping region intersect rectangle.
- *
- * @return A copy of this object, modified as specified.
- */
-public Graphics
-create(int x, int y, int width, int height)
+public abstract class Graphics
{
- Graphics g = create();
-
- g.translate(x, y);
- // FIXME: I'm not sure if this will work. Are the old clip rect bounds
- // translated above?
- g.clipRect(0, 0, width, height);
- return(g);
-}
-
-/*************************************************************************/
-
-/**
- * Translates this context so that its new origin point is the point
- * (x, y).
- *
- * @param x The new X coordinate of the origin.
- * @param y The new Y coordinate of the origin.
- */
-public abstract void
-translate(int x, int y);
-
-/*************************************************************************/
-
-/**
- * Returns the current color for this object.
- *
- * @return The color for this object.
- */
-public abstract Color
-getColor();
-
-/*************************************************************************/
-
-/**
- * Sets the current color for this object.
- *
- * @param color The new color.
- */
-public abstract void
-setColor(Color color);
-
-/*************************************************************************/
-
-/**
- * Sets this context into "paint" mode, where the target pixels are
- * completely overwritten when drawn on.
- */
-public abstract void
-setPaintMode();
-
-/*************************************************************************/
-
-/**
- * Sets this context info "XOR" mode, where the targe pixles are
- * XOR-ed when drawn on.
- *
- * @param color The color to XOR against.
- */
-public abstract void
-setXORMode(Color color);
+ /**
+ * Default constructor for subclasses.
+ */
+ protected
+ Graphics()
+ {
+ }
+
+ /**
+ * Returns a copy of this <code>Graphics</code> object.
+ *
+ * @return A copy of this object.
+ */
+ public abstract Graphics create();
+
+ /**
+ * Returns a copy of this <code>Graphics</code> object. The origin point
+ * will be translated to the point (x, y) and the cliping rectangle set
+ * to the intersection of the clipping rectangle in this object and the
+ * rectangle specified by the parameters to this method.
+ *
+ * @param x The new X coordinate of the clipping region rect.
+ * @param y The new Y coordinate of the clipping region rect.
+ * @param width The width of the clipping region intersect rectangle.
+ * @param height The height of the clipping region intersect rectangle.
+ *
+ * @return A copy of this object, modified as specified.
+ */
+ public Graphics create(int x, int y, int width, int height)
+ {
+ Graphics g = create();
+
+ g.translate(x, y);
+ // FIXME: I'm not sure if this will work. Are the old clip rect bounds
+ // translated above?
+ g.clipRect(0, 0, width, height);
+
+ return(g);
+ }
+
+ /**
+ * Translates this context so that its new origin point is the point
+ * (x, y).
+ *
+ * @param x The new X coordinate of the origin.
+ * @param y The new Y coordinate of the origin.
+ */
+ public abstract void translate(int x, int y);
+
+ /**
+ * Returns the current color for this object.
+ *
+ * @return The color for this object.
+ */
+ public abstract Color getColor();
+
+ /**
+ * Sets the current color for this object.
+ *
+ * @param color The new color.
+ */
+ public abstract void setColor(Color color);
+
+ /**
+ * Sets this context into "paint" mode, where the target pixels are
+ * completely overwritten when drawn on.
+ */
+ public abstract void setPaintMode();
+
+ /**
+ * Sets this context info "XOR" mode, where the targe pixles are
+ * XOR-ed when drawn on.
+ *
+ * @param color The color to XOR against.
+ */
+ public abstract void setXORMode(Color color);
-/*************************************************************************/
-
-/**
- * Returns the current font for this graphics context.
- *
- * @return The current font.
- */
-public abstract Font
-getFont();
-
-/*************************************************************************/
-
-/**
- * Sets the font for this graphics context to the specified value.
- *
- * @param font The new font.
- */
-public abstract void
-setFont(Font font);
-
-/*************************************************************************/
-
-/**
- * Returns the font metrics for the current font.
- *
- * @return The font metrics for the current font.
- */
-public FontMetrics
-getFontMetrics()
-{
- return(getFontMetrics(getFont()));
-}
-
-/*************************************************************************/
-
-/**
- * Returns the font metrics for the specified font.
- *
- * @param font The font to return metrics for.
- *
- * @return The requested font metrics.
- */
-public abstract FontMetrics
-getFontMetrics(Font font);
-
-/*************************************************************************/
-
-/**
- * Returns the bounding rectangle of the clipping region for this
- * graphics context.
- *
- * @return The bounding rectangle for the clipping region.
- */
-public abstract Rectangle
-getClipBounds();
-
-/*************************************************************************/
-
-/**
- * Returns the bounding rectangle of the clipping region for this
- * graphics context.
- *
- * @return The bounding rectangle for the clipping region.
- *
- * @deprecated This method is deprecated in favor of
- * <code>getClipBounds()</code>.
- */
-public Rectangle
-getClipRect()
-{
- return(getClipBounds());
-}
-
-/*************************************************************************/
-
-/**
- * Sets the clipping region to the intersection of the current clipping
- * region and the rectangle determined by the specified parameters.
- *
- * @param x The X coordinate of the upper left corner of the intersect rect.
- * @param y The Y coordinate of the upper left corner of the intersect rect.
- * @param width The width of the intersect rect.
- * @param height The height of the intersect rect.
- */
-public abstract void
-clipRect(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Sets the clipping region to the rectangle determined by the specified
- * parameters.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- */
-public abstract void
-setClip(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Returns the current clipping region as a <code>Shape</code> object.
- *
- * @return The clipping region as a <code>Shape</code>.
- */
-public abstract Shape
-getClip();
-
-/*************************************************************************/
-
-/**
- * Sets the clipping region to the specified <code>Shape</code>.
- *
- * @param clip The new clipping region.
- */
-public abstract void
-setClip(Shape clip);
-
-/*************************************************************************/
-
-/**
- * Copies the specified rectangle to the specified offset location.
- *
- * @param x The X coordinate of the upper left corner of the copy rect.
- * @param y The Y coordinate of the upper left corner of the copy rect.
- * @param width The width of the copy rect.
- * @param height The height of the copy rect.
- * @param dx The offset from the X value to start drawing.
- * @param dy The offset from the Y value to start drawing.
- */
-public abstract void
-copyArea(int x, int y, int width, int height, int dx, int dy);
-
-/*************************************************************************/
-
-/**
- * Draws a line between the two specified points.
- *
- * @param x1 The X coordinate of the first point.
- * @param y1 The Y coordinate of the first point.
- * @param x2 The X coordinate of the second point.
- * @param y2 The Y coordinate of the second point.
- */
-public abstract void
-drawLine(int x1, int y1, int x2, int y2);
-
-/*************************************************************************/
-
-/**
- * Fills the area bounded by the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the fill rect.
- * @param y The Y coordinate of the upper left corner of the fill rect.
- * @param width The width of the fill rect.
- * @param height The height of the fill rect.
- */
-public abstract void
-fillRect(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Draws the outline of the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the draw rect.
- * @param y The Y coordinate of the upper left corner of the draw rect.
- * @param width The width of the draw rect.
- * @param height The height of the draw rect.
- */
-public void
-drawRect(int x, int y, int width, int height)
-{
- int x1 = x;
- int y1 = y;
- int x2 = x + width;
- int y2 = y + height;
- drawLine(x1, y1, x2, y1);
- drawLine(x2, y1, x2, y2);
- drawLine(x2, y2, x1, y2);
- drawLine(x1, y2, x1, y1);
-}
-
-/*************************************************************************/
-
-/**
- * Clears the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the clear rect.
- * @param y The Y coordinate of the upper left corner of the clear rect.
- * @param width The width of the clear rect.
- * @param height The height of the clear rect.
- */
-public abstract void
-clearRect(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Draws the outline of the specified rectangle with rounded cornders.
- *
- * @param x The X coordinate of the upper left corner of the draw rect.
- * @param y The Y coordinate of the upper left corner of the draw rect.
- * @param width The width of the draw rect.
- * @param height The height of the draw rect.
- * @param arcWidth The width of the corner arcs.
- * @param arcHeight The height of the corner arcs.
- */
-public abstract void
-drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
-
-/*************************************************************************/
-
-/**
- * Fills the specified rectangle with rounded cornders.
- *
- * @param x The X coordinate of the upper left corner of the fill rect.
- * @param y The Y coordinate of the upper left corner of the fill rect.
- * @param width The width of the fill rect.
- * @param height The height of the fill rect.
- * @param arcWidth The width of the corner arcs.
- * @param arcHeight The height of the corner arcs.
- */
-public abstract void
-fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
-
-/*************************************************************************/
-
-public void
-draw3DRect(int x, int y, int width, int height, boolean raised)
-{
- Color color = getColor();
- Color tl = color.brighter();
- Color br = color.darker();
+ /**
+ * Returns the current font for this graphics context.
+ *
+ * @return The current font.
+ */
+ public abstract Font getFont();
+
+ /**
+ * Sets the font for this graphics context to the specified value.
+ *
+ * @param font The new font.
+ */
+ public abstract void setFont(Font font);
+
+ /**
+ * Returns the font metrics for the current font.
+ *
+ * @return The font metrics for the current font.
+ */
+ public FontMetrics getFontMetrics()
+ {
+ return getFontMetrics(getFont());
+ }
+
+ /**
+ * Returns the font metrics for the specified font.
+ *
+ * @param font The font to return metrics for.
+ *
+ * @return The requested font metrics.
+ */
+ public abstract FontMetrics getFontMetrics(Font font);
+
+ /**
+ * Returns the bounding rectangle of the clipping region for this
+ * graphics context.
+ *
+ * @return The bounding rectangle for the clipping region.
+ */
+ public abstract Rectangle getClipBounds();
+
+ /**
+ * Returns the bounding rectangle of the clipping region for this
+ * graphics context.
+ *
+ * @return The bounding rectangle for the clipping region.
+ *
+ * @deprecated This method is deprecated in favor of
+ * <code>getClipBounds()</code>.
+ */
+ public Rectangle getClipRect()
+ {
+ return getClipBounds();
+ }
+
+ /**
+ * Sets the clipping region to the intersection of the current clipping
+ * region and the rectangle determined by the specified parameters.
+ *
+ * @param x The X coordinate of the upper left corner of the intersect rect.
+ * @param y The Y coordinate of the upper left corner of the intersect rect.
+ * @param width The width of the intersect rect.
+ * @param height The height of the intersect rect.
+ */
+ public abstract void clipRect(int x, int y, int width, int height);
+
+ /**
+ * Sets the clipping region to the rectangle determined by the specified
+ * parameters.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ */
+ public abstract void setClip(int x, int y, int width, int height);
+
+ /**
+ * Returns the current clipping region as a <code>Shape</code> object.
+ *
+ * @return The clipping region as a <code>Shape</code>.
+ */
+ public abstract Shape getClip();
+
+ /**
+ * Sets the clipping region to the specified <code>Shape</code>.
+ *
+ * @param clip The new clipping region.
+ */
+ public abstract void setClip(Shape clip);
+
+ /**
+ * Copies the specified rectangle to the specified offset location.
+ *
+ * @param x The X coordinate of the upper left corner of the copy rect.
+ * @param y The Y coordinate of the upper left corner of the copy rect.
+ * @param width The width of the copy rect.
+ * @param height The height of the copy rect.
+ * @param dx The offset from the X value to start drawing.
+ * @param dy The offset from the Y value to start drawing.
+ */
+ public abstract void copyArea(int x, int y, int width, int height, int dx,
+ int dy);
+
+ /**
+ * Draws a line between the two specified points.
+ *
+ * @param x1 The X coordinate of the first point.
+ * @param y1 The Y coordinate of the first point.
+ * @param x2 The X coordinate of the second point.
+ * @param y2 The Y coordinate of the second point.
+ */
+ public abstract void drawLine(int x1, int y1, int x2, int y2);
+
+ /**
+ * Fills the area bounded by the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the fill rect.
+ * @param y The Y coordinate of the upper left corner of the fill rect.
+ * @param width The width of the fill rect.
+ * @param height The height of the fill rect.
+ */
+ public abstract void fillRect(int x, int y, int width, int height);
+
+ /**
+ * Draws the outline of the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the draw rect.
+ * @param y The Y coordinate of the upper left corner of the draw rect.
+ * @param width The width of the draw rect.
+ * @param height The height of the draw rect.
+ */
+ public void drawRect(int x, int y, int width, int height)
+ {
+ int x1 = x;
+ int y1 = y;
+ int x2 = x + width;
+ int y2 = y + height;
+ drawLine(x1, y1, x2, y1);
+ drawLine(x2, y1, x2, y2);
+ drawLine(x2, y2, x1, y2);
+ drawLine(x1, y2, x1, y1);
+ }
+
+ /**
+ * Clears the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the clear rect.
+ * @param y The Y coordinate of the upper left corner of the clear rect.
+ * @param width The width of the clear rect.
+ * @param height The height of the clear rect.
+ */
+ public abstract void clearRect(int x, int y, int width, int height);
+
+ /**
+ * Draws the outline of the specified rectangle with rounded cornders.
+ *
+ * @param x The X coordinate of the upper left corner of the draw rect.
+ * @param y The Y coordinate of the upper left corner of the draw rect.
+ * @param width The width of the draw rect.
+ * @param height The height of the draw rect.
+ * @param arcWidth The width of the corner arcs.
+ * @param arcHeight The height of the corner arcs.
+ */
+ public abstract void drawRoundRect(int x, int y, int width, int height,
+ int arcWidth, int arcHeight);
+
+ /**
+ * Fills the specified rectangle with rounded cornders.
+ *
+ * @param x The X coordinate of the upper left corner of the fill rect.
+ * @param y The Y coordinate of the upper left corner of the fill rect.
+ * @param width The width of the fill rect.
+ * @param height The height of the fill rect.
+ * @param arcWidth The width of the corner arcs.
+ * @param arcHeight The height of the corner arcs.
+ */
+ public abstract void fillRoundRect(int x, int y, int width, int height,
+ int arcWidth, int arcHeight);
+
+ public void draw3DRect(int x, int y, int width, int height, boolean raised)
+ {
+ Color color = getColor();
+ Color tl = color.brighter();
+ Color br = color.darker();
- if (!raised)
- {
- Color tmp = tl;
- tl = br;
- br = tmp;
- }
+ if (!raised)
+ {
+ Color tmp = tl;
+ tl = br;
+ br = tmp;
+ }
- int x1 = x;
- int y1 = y;
- int x2 = x + width;
- int y2 = y + height;
+ int x1 = x;
+ int y1 = y;
+ int x2 = x + width;
+ int y2 = y + height;
- setColor(tl);
- drawLine(x1, y1, x2, y1);
- drawLine(x1, y2, x1, y1);
- setColor(br);
- drawLine(x2, y1, x2, y2);
- drawLine(x2, y2, x1, y2);
- setColor(color);
-}
-
-/**
- * Fills the specified rectangle with a 3D effect
- *
- * @param x The X coordinate of the upper left corner of the fill rect.
- * @param y The Y coordinate of the upper left corner of the fill rect.
- * @param width The width of the fill rect.
- * @param height The height of the fill rect.
- * @param raised <code>true</code> if the rectangle appears raised,
- * <code>false</code> if it should appear etched.
- */
-public void
-fill3DRect(int x, int y, int width, int height, boolean raised)
-{
- fillRect(x, y, width, height);
- draw3DRect(x, y, width-1, height-1, raised);
-}
-
-/*************************************************************************/
-
-/**
- * Draws an oval that just fits within the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- */
-public abstract void
-drawOval(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Fills an oval that just fits within the specified rectangle.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- */
-public abstract void
-fillOval(int x, int y, int width, int height);
-
-/*************************************************************************/
-
-/**
- * Draws an arc using the specified bounding rectangle and the specified
- * angle parameter. The arc is centered at the center of the rectangle.
- * The arc starts at the arcAngle position and extend for arcAngle
- * degrees. The degree origin is at the 3 o'clock position.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- * @param arcStart The beginning angle of the arc.
- * @param arcAngle The extent of the arc.
- */
-public abstract void
-drawArc(int x, int y, int width, int height, int arcStart, int arcAngle);
-
-/*************************************************************************/
-
-/**
- * Fills the arc define by the specified bounding rectangle and the specified
- * angle parameter. The arc is centered at the center of the rectangle.
- * The arc starts at the arcAngle position and extend for arcAngle
- * degrees. The degree origin is at the 3 o'clock position.
- *
- * @param x The X coordinate of the upper left corner of the rect.
- * @param y The Y coordinate of the upper left corner of the rect.
- * @param width The width of the rect.
- * @param height The height of the rect.
- * @param arcStart The beginning angle of the arc.
- * @param arcAngle The extent of the arc.
- */
-public abstract void
-fillArc(int x, int y, int width, int height, int arcStart, int arcAngle);
-
-/*************************************************************************/
-
-/**
- * Draws a series of interconnected lines determined by the arrays
- * of corresponding x and y coordinates.
- *
- * @param xPoints The X coordinate array.
- * @param yPoints The Y coordinate array.
- * @param npoints The number of points to draw.
- */
-public abstract void
-drawPolyline(int xPoints[], int yPoints[], int npoints);
-
-/*************************************************************************/
-
-/**
- * Draws a series of interconnected lines determined by the arrays
- * of corresponding x and y coordinates. The figure is closed if necessary
- * by connecting the first and last points.
- *
- * @param xPoints The X coordinate array.
- * @param yPoints The Y coordinate array.
- * @param npoints The number of points to draw.
- */
-public abstract void
-drawPolygon(int xPoints[], int yPoints[], int npoints);
-
-/*************************************************************************/
-
-/**
- * Draws the specified polygon.
- *
- * @param polygon The polygon to draw.
- */
-public void
-drawPolygon(Polygon polygon)
-{
- drawPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
-}
-
-/*************************************************************************/
-
-/**
- * Fills the polygon determined by the arrays
- * of corresponding x and y coordinates.
- *
- * @param xPoints The X coordinate array.
- * @param yPoints The Y coordinate array.
- * @param npoints The number of points to draw.
- */
-public abstract void
-fillPolygon(int xPoints[], int yPoints[], int npoints);
-
-/*************************************************************************/
-
-/**
- * Fills the specified polygon
- *
- * @param polygon The polygon to fill.
- */
-public void
-fillPolygon(Polygon polygon)
-{
- fillPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
-}
-
-/*************************************************************************/
-
-/**
- * Draws the specified string starting at the specified point.
- *
- * @param string The string to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- */
-public abstract void
-drawString(String string, int x, int y);
-
-public abstract void drawString (AttributedCharacterIterator ci, int x, int y);
-
-/*************************************************************************/
-
-/**
- * Draws the specified characters starting at the specified point.
- *
- * @param data The array of characters to draw.
- * @param offset The offset into the array to start drawing characters from.
- * @param length The number of characters to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- */
-public void
-drawChars(char data[], int offset, int length, int x, int y)
-{
- drawString(new String(data, offset, length), x, y);
-}
-
-public void
-drawBytes(byte[] data, int offset, int length, int x, int y)
-{
- String str = new String(data, offset, length);
- drawString(str, x, y);
-}
-
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return <code>true</code> if all the image data is available,
- * <code>false</code> otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, ImageObserver observer);
+ setColor(tl);
+ drawLine(x1, y1, x2, y1);
+ drawLine(x1, y2, x1, y1);
+ setColor(br);
+ drawLine(x2, y1, x2, y2);
+ drawLine(x2, y2, x1, y2);
+ setColor(color);
+ }
+
+ /**
+ * Fills the specified rectangle with a 3D effect
+ *
+ * @param x The X coordinate of the upper left corner of the fill rect.
+ * @param y The Y coordinate of the upper left corner of the fill rect.
+ * @param width The width of the fill rect.
+ * @param height The height of the fill rect.
+ * @param raised <code>true</code> if the rectangle appears raised,
+ * <code>false</code> if it should appear etched.
+ */
+ public void fill3DRect(int x, int y, int width, int height, boolean raised)
+ {
+ fillRect(x, y, width, height);
+ draw3DRect(x, y, width-1, height-1, raised);
+ }
+
+ /**
+ * Draws an oval that just fits within the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ */
+ public abstract void drawOval(int x, int y, int width, int height);
+
+ /**
+ * Fills an oval that just fits within the specified rectangle.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ */
+ public abstract void fillOval(int x, int y, int width, int height);
+
+ /**
+ * Draws an arc using the specified bounding rectangle and the specified
+ * angle parameter. The arc is centered at the center of the rectangle.
+ * The arc starts at the arcAngle position and extend for arcAngle
+ * degrees. The degree origin is at the 3 o'clock position.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ * @param arcStart The beginning angle of the arc.
+ * @param arcAngle The extent of the arc.
+ */
+ public abstract void drawArc(int x, int y, int width, int height,
+ int arcStart, int arcAngle);
+
+ /**
+ * Fills the arc define by the specified bounding rectangle and the specified
+ * angle parameter. The arc is centered at the center of the rectangle.
+ * The arc starts at the arcAngle position and extend for arcAngle
+ * degrees. The degree origin is at the 3 o'clock position.
+ *
+ * @param x The X coordinate of the upper left corner of the rect.
+ * @param y The Y coordinate of the upper left corner of the rect.
+ * @param width The width of the rect.
+ * @param height The height of the rect.
+ * @param arcStart The beginning angle of the arc.
+ * @param arcAngle The extent of the arc.
+ */
+ public abstract void fillArc(int x, int y, int width, int height,
+ int arcStart, int arcAngle);
+
+ /**
+ * Draws a series of interconnected lines determined by the arrays
+ * of corresponding x and y coordinates.
+ *
+ * @param xPoints The X coordinate array.
+ * @param yPoints The Y coordinate array.
+ * @param npoints The number of points to draw.
+ */
+ public abstract void drawPolyline(int xPoints[], int yPoints[], int npoints);
+
+ /**
+ * Draws a series of interconnected lines determined by the arrays
+ * of corresponding x and y coordinates. The figure is closed if necessary
+ * by connecting the first and last points.
+ *
+ * @param xPoints The X coordinate array.
+ * @param yPoints The Y coordinate array.
+ * @param npoints The number of points to draw.
+ */
+ public abstract void drawPolygon(int xPoints[], int yPoints[], int npoints);
+
+ /**
+ * Draws the specified polygon.
+ *
+ * @param polygon The polygon to draw.
+ */
+ public void drawPolygon(Polygon polygon)
+ {
+ drawPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
+ }
+
+ /**
+ * Fills the polygon determined by the arrays
+ * of corresponding x and y coordinates.
+ *
+ * @param xPoints The X coordinate array.
+ * @param yPoints The Y coordinate array.
+ * @param npoints The number of points to draw.
+ */
+ public abstract void fillPolygon(int xPoints[], int yPoints[], int npoints);
+
+ /**
+ * Fills the specified polygon
+ *
+ * @param polygon The polygon to fill.
+ */
+ public void fillPolygon(Polygon polygon)
+ {
+ fillPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
+ }
+
+ /**
+ * Draws the specified string starting at the specified point.
+ *
+ * @param string The string to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ */
+ public abstract void drawString(String string, int x, int y);
+
+ public abstract void drawString (AttributedCharacterIterator ci, int x,
+ int y);
+
+ /**
+ * Draws the specified characters starting at the specified point.
+ *
+ * @param data The array of characters to draw.
+ * @param offset The offset into the array to start drawing characters from.
+ * @param length The number of characters to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ */
+ public void drawChars(char data[], int offset, int length, int x, int y)
+ {
+ drawString(new String(data, offset, length), x, y);
+ }
+
+ public void drawBytes(byte[] data, int offset, int length, int x, int y)
+ {
+ String str = new String(data, offset, length);
+ drawString(str, x, y);
+ }
+
+ /**
+ * Draws all of the image that is available and returns. If the image
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
+ * available.
+ *
+ * @param image The image to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ * @param observer The image observer to notify as data becomes available.
+ *
+ * @return <code>true</code> if all the image data is available,
+ * <code>false</code> otherwise.
+ */
+ public abstract boolean drawImage(Image image, int x, int y,
+ ImageObserver observer);
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. The image
- * is scaled to fit in the specified rectangle. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param width The width of the rectangle to draw in.
- * @param height The height of the rectangle to draw in.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return <code>true</code> if all the image data is available,
- * <code>false</code> otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, int width, int height,
- ImageObserver observer);
+ /**
+ * Draws all of the image that is available and returns. The image
+ * is scaled to fit in the specified rectangle. If the image
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
+ * available.
+ *
+ * @param image The image to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ * @param width The width of the rectangle to draw in.
+ * @param height The height of the rectangle to draw in.
+ * @param observer The image observer to notify as data becomes available.
+ *
+ * @return <code>true</code> if all the image data is available,
+ * <code>false</code> otherwise.
+ */
+ public abstract boolean drawImage(Image image, int x, int y, int width,
+ int height, ImageObserver observer);
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param bgcolor The background color to use for the image.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return <code>true</code> if all the image data is available,
- * <code>false</code> otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, Color bgcolor, ImageObserver observer);
+ /**
+ * Draws all of the image that is available and returns. If the image
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
+ * available.
+ *
+ * @param image The image to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ * @param bgcolor The background color to use for the image.
+ * @param observer The image observer to notify as data becomes available.
+ *
+ * @return <code>true</code> if all the image data is available,
+ * <code>false</code> otherwise.
+ */
+ public abstract boolean drawImage(Image image, int x, int y, Color bgcolor,
+ ImageObserver observer);
-/*************************************************************************/
-
-/**
- * Draws all of the image that is available and returns. The image
- * is scaled to fit in the specified rectangle. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
- * available.
- *
- * @param image The image to draw.
- * @param x The X coordinate of the point to draw at.
- * @param y The Y coordinate of the point to draw at.
- * @param width The width of the rectangle to draw in.
- * @param height The height of the rectangle to draw in.
- * @param bgcolor The background color to use for the image.
- * @param observer The image observer to notify as data becomes available.
- *
- * @return <code>true</code> if all the image data is available,
- * <code>false</code> otherwise.
- */
-public abstract boolean
-drawImage(Image image, int x, int y, int width, int height, Color bgcolor,
- ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * FIXME: Write Javadocs for this when you understand it.
- */
-public abstract boolean
-drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
- int sx2, int sy2, ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * FIXME: Write Javadocs for this when you understand it.
- */
-public abstract boolean
-drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1,
- int sx2, int sy2, Color bgcolor, ImageObserver observer);
-
-/*************************************************************************/
-
-/**
- * Free any resources held by this graphics context immediately instead
- * of waiting for the object to be garbage collected and finalized.
- */
-public abstract void
-dispose();
-
-/*************************************************************************/
-
-/**
- * Frees the resources held by this graphics context when it is
- * garbage collected.
- */
-public void
-finalize()
-{
- dispose();
-}
-
-/*************************************************************************/
-
-/**
- * Returns a string representation of this object.
- *
- * @return A string representation of this object.
- */
-public String
-toString()
-{
- return getClass ().getName () + "[font=" + getFont () + ",color=" + getColor () + "]";
-}
-
-public boolean
-hitClip(int x, int y, int width, int height)
-{
- throw new UnsupportedOperationException("not implemented yet");
-}
-
-public Rectangle
-getClipBounds(Rectangle r)
-{
- Rectangle clipBounds = getClipBounds();
+ /**
+ * Draws all of the image that is available and returns. The image
+ * is scaled to fit in the specified rectangle. If the image
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
+ * available.
+ *
+ * @param image The image to draw.
+ * @param x The X coordinate of the point to draw at.
+ * @param y The Y coordinate of the point to draw at.
+ * @param width The width of the rectangle to draw in.
+ * @param height The height of the rectangle to draw in.
+ * @param bgcolor The background color to use for the image.
+ * @param observer The image observer to notify as data becomes available.
+ *
+ * @return <code>true</code> if all the image data is available,
+ * <code>false</code> otherwise.
+ */
+ public abstract boolean drawImage(Image image, int x, int y, int width,
+ int height, Color bgcolor,
+ ImageObserver observer);
+
+ /**
+ * FIXME: Write Javadocs for this when you understand it.
+ */
+ public abstract boolean drawImage(Image image, int dx1, int dy1, int dx2,
+ int dy2, int sx1, int sy1, int sx2,
+ int sy2, ImageObserver observer);
+
+ /**
+ * FIXME: Write Javadocs for this when you understand it.
+ */
+ public abstract boolean drawImage(Image image, int dx1, int dy1, int dx2,
+ int dy2, int sx1, int sy1, int sx2,
+ int sy2, Color bgcolor,
+ ImageObserver observer);
+
+ /**
+ * Free any resources held by this graphics context immediately instead
+ * of waiting for the object to be garbage collected and finalized.
+ */
+ public abstract void dispose();
+
+ /**
+ * Frees the resources held by this graphics context when it is
+ * garbage collected.
+ */
+ public void finalize()
+ {
+ dispose();
+ }
+
+ /**
+ * Returns a string representation of this object.
+ *
+ * @return A string representation of this object.
+ */
+ public String toString()
+ {
+ return getClass ().getName () + "[font=" + getFont () + ",color="
+ + getColor () + "]";
+ }
+
+ /**
+ * Returns <code>true</code> if the specified rectangle intersects with the
+ * current clip, <code>false</code> otherwise.
+ *
+ * @param x the X coordinate of the upper left corner of the test rectangle
+ * @param y the Y coordinate of the upper left corner of the test rectangle
+ * @param width the width of the upper left corner of the test rectangle
+ * @param height the height of the upper left corner of the test rectangle
+ * @return <code>true</code> if the specified rectangle intersects with the
+ * current clip, <code>false</code> otherwise
+ */
+ public boolean hitClip(int x, int y, int width, int height)
+ {
+ return getClip().intersects(x, y, width, height);
+ }
+
+ public Rectangle getClipBounds(Rectangle r)
+ {
+ Rectangle clipBounds = getClipBounds();
- if (r == null)
- return clipBounds;
-
- r.x = clipBounds.x;
- r.y = clipBounds.y;
- r.width = clipBounds.width;
- r.height = clipBounds.height;
- return r;
+ if (r == null)
+ return clipBounds;
+
+ r.x = clipBounds.x;
+ r.y = clipBounds.y;
+ r.width = clipBounds.width;
+ r.height = clipBounds.height;
+ return r;
+ }
}
-
-} // class Graphics
-
diff --git a/libjava/classpath/java/awt/GraphicsConfiguration.java b/libjava/classpath/java/awt/GraphicsConfiguration.java
index 069d7414b3d..1526ad3cfc0 100644
--- a/libjava/classpath/java/awt/GraphicsConfiguration.java
+++ b/libjava/classpath/java/awt/GraphicsConfiguration.java
@@ -130,11 +130,10 @@ public abstract class GraphicsConfiguration
* with the given transparency. Because the buffer is volatile, it
* can be optimized by native graphics accelerators.
*
- * @param w the width of the buffer
- * @param h the height of the buffer
+ * @param width the width of the buffer
+ * @param height the height of the buffer
* @param transparency the transparency value for the buffer
* @return the buffered image, or null if none is supported
- * @throws AWTException if the capabilities cannot be met
* @since 1.5
*/
public abstract VolatileImage createCompatibleVolatileImage(int width,
diff --git a/libjava/classpath/java/awt/GridBagLayout.java b/libjava/classpath/java/awt/GridBagLayout.java
index 7f9ab249b6d..083c0b7a7a3 100644
--- a/libjava/classpath/java/awt/GridBagLayout.java
+++ b/libjava/classpath/java/awt/GridBagLayout.java
@@ -705,17 +705,20 @@ public class GridBagLayout
if (lastInCol.containsKey(new Integer(x)))
{
Component lastComponent = (Component) lastInRow.get(new Integer(x));
- GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
-
- if (lastConstraints.gridheight == GridBagConstraints.RELATIVE)
+ if (lastComponent != null)
{
- constraints.gridy = max_y - 1;
- break;
- }
- else
- {
- constraints.gridy = Math.max (constraints.gridy,
- lastConstraints.gridy + Math.max (1, lastConstraints.gridheight));
+ GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
+
+ if (lastConstraints.gridheight == GridBagConstraints.RELATIVE)
+ {
+ constraints.gridy = max_y - 1;
+ break;
+ }
+ else
+ {
+ constraints.gridy = Math.max (constraints.gridy,
+ lastConstraints.gridy + Math.max (1, lastConstraints.gridheight));
+ }
}
}
}
diff --git a/libjava/classpath/java/awt/Image.java b/libjava/classpath/java/awt/Image.java
index b657ad007d9..93c2c479024 100644
--- a/libjava/classpath/java/awt/Image.java
+++ b/libjava/classpath/java/awt/Image.java
@@ -38,7 +38,9 @@ exception statement from your version. */
package java.awt;
+import java.awt.image.AreaAveragingScaleFilter;
import java.awt.image.FilteredImageSource;
+import java.awt.image.ImageFilter;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.ReplicateScaleFilter;
@@ -141,7 +143,6 @@ public abstract class Image
* This method is only valid for off-screen objects.
*
* @return a graphics context object for an off-screen object
- * @see Graphics#getcreateImage(int, int)
*/
public abstract Graphics getGraphics();
@@ -179,20 +180,25 @@ public abstract class Image
*/
public Image getScaledInstance(int width, int height, int flags)
{
+ ImageFilter filter;
switch (flags)
{
case SCALE_DEFAULT:
case SCALE_FAST:
case SCALE_REPLICATE:
- ImageProducer producer =
- new FilteredImageSource(this.getSource(),
- new ReplicateScaleFilter(width, height));
- return Toolkit.getDefaultToolkit().createImage(producer);
- case SCALE_SMOOTH:
+ filter = new ReplicateScaleFilter(width, height);
+ break;
case SCALE_AREA_AVERAGING:
+ filter = new AreaAveragingScaleFilter(width, height);
+ break;
+ case SCALE_SMOOTH:
+ throw new Error("SCALE_SMOOTH: not implemented");
default:
- throw new Error("not implemented");
+ throw new Error("Unknown flag or not implemented: " + flags);
}
+
+ ImageProducer producer = new FilteredImageSource(getSource(), filter);
+ return Toolkit.getDefaultToolkit().createImage(producer);
}
/**
diff --git a/libjava/classpath/java/awt/KeyboardFocusManager.java b/libjava/classpath/java/awt/KeyboardFocusManager.java
index f64618477bd..371ea9bdf8a 100644
--- a/libjava/classpath/java/awt/KeyboardFocusManager.java
+++ b/libjava/classpath/java/awt/KeyboardFocusManager.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.awt;
import java.applet.Applet;
+import java.awt.FocusTraversalPolicy;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
@@ -213,7 +214,7 @@ public abstract class KeyboardFocusManager
currentFocusOwners */
private static Map currentFocusCycleRoots = new HashMap ();
- /** The default {@link FocusTraveralPolicy} that focus-managing
+ /** The default {@link FocusTraversalPolicy} that focus-managing
{@link Container}s will use to define their initial focus
traversal policy. */
private FocusTraversalPolicy defaultPolicy;
@@ -287,7 +288,7 @@ public abstract class KeyboardFocusManager
KeyboardFocusManager manager;
if (m == null)
- manager = createFocusManager();
+ manager = new DefaultKeyboardFocusManager();
else
manager = m;
@@ -295,46 +296,6 @@ public abstract class KeyboardFocusManager
}
/**
- * Creates a KeyboardFocusManager. The exact class is determined by the
- * system property 'gnu.java.awt.FocusManager'. If this is not set,
- * we default to DefaultKeyboardFocusManager.
- */
- private static KeyboardFocusManager createFocusManager()
- {
- String fmClassName = System.getProperty("gnu.java.awt.FocusManager",
- "java.awt.DefaultKeyboardFocusManager");
- try
- {
- Class fmClass = Class.forName(fmClassName);
- KeyboardFocusManager fm = (KeyboardFocusManager) fmClass.newInstance();
- return fm;
- }
- catch (ClassNotFoundException ex)
- {
- System.err.println("The class " + fmClassName + " cannot be found.");
- System.err.println("Check the setting of the system property");
- System.err.println("gnu.java.awt.FocusManager");
- return null;
- }
- catch (InstantiationException ex)
- {
- System.err.println("The class " + fmClassName + " cannot be");
- System.err.println("instantiated.");
- System.err.println("Check the setting of the system property");
- System.err.println("gnu.java.awt.FocusManager");
- return null;
- }
- catch (IllegalAccessException ex)
- {
- System.err.println("The class " + fmClassName + " cannot be");
- System.err.println("accessed.");
- System.err.println("Check the setting of the system property");
- System.err.println("gnu.java.awt.FocusManager");
- return null;
- }
- }
-
- /**
* Retrieve the {@link Component} that has the keyboard focus, or
* null if the focus owner was not set by a thread in the current
* {@link java.lang.ThreadGroup}.
@@ -1364,11 +1325,11 @@ public abstract class KeyboardFocusManager
*
* @return a global object set by the current ThreadGroup, or null
*
- * @see getFocusOwner
- * @see getPermanentFocusOwner
- * @see getFocusedWindow
- * @see getActiveWindow
- * @see getCurrentFocusCycleRoot
+ * @see #getFocusOwner()
+ * @see #getPermanentFocusOwner()
+ * @see #getFocusedWindow()
+ * @see #getActiveWindow()
+ * @see #getCurrentFocusCycleRoot()
*/
private Object getObject (Map globalMap)
{
@@ -1388,11 +1349,11 @@ public abstract class KeyboardFocusManager
* @throws SecurityException if this is not the keyboard focus
* manager associated with the current {@link java.lang.ThreadGroup}
*
- * @see getGlobalFocusOwner
- * @see getGlobalPermanentFocusOwner
- * @see getGlobalFocusedWindow
- * @see getGlobalActiveWindow
- * @see getGlobalCurrentFocusCycleRoot
+ * @see #getGlobalFocusOwner()
+ * @see #getGlobalPermanentFocusOwner()
+ * @see #getGlobalFocusedWindow()
+ * @see #getGlobalActiveWindow()
+ * @see #getGlobalCurrentFocusCycleRoot()
*/
private Object getGlobalObject (Map globalMap)
{
@@ -1432,11 +1393,11 @@ public abstract class KeyboardFocusManager
* @param newObject the object to set
* @param property the property that will change
*
- * @see setGlobalFocusOwner
- * @see setGlobalPermanentFocusOwner
- * @see setGlobalFocusedWindow
- * @see setGlobalActiveWindow
- * @see setGlobalCurrentFocusCycleRoot
+ * @see #setGlobalFocusOwner(Component)
+ * @see #setGlobalPermanentFocusOwner(Component)
+ * @see #setGlobalFocusedWindow(Window)
+ * @see #setGlobalActiveWindow(Window)
+ * @see #setGlobalCurrentFocusCycleRoot(Container)
*/
private void setGlobalObject (Map globalMap,
Object newObject,
diff --git a/libjava/classpath/java/awt/List.java b/libjava/classpath/java/awt/List.java
index ab7d359633e..00636a0224f 100644
--- a/libjava/classpath/java/awt/List.java
+++ b/libjava/classpath/java/awt/List.java
@@ -1088,18 +1088,23 @@ paramString()
protected class AccessibleAWTList extends AccessibleAWTComponent
implements AccessibleSelection, ItemListener, ActionListener
{
+ private static final long serialVersionUID = 7924617370136012829L;
+
protected class AccessibleAWTListChild extends AccessibleAWTComponent
implements Accessible
{
- private int index;
+ private static final long serialVersionUID = 4412022926028300317L;
+
+ // Field names are fixed by serialization spec.
private List parent;
+ private int indexInParent;
public AccessibleAWTListChild(List parent, int indexInParent)
{
this.parent = parent;
- index = indexInParent;
+ this.indexInParent = indexInParent;
if (parent == null)
- index = -1;
+ this.indexInParent = -1;
}
/* (non-Javadoc)
@@ -1118,14 +1123,14 @@ paramString()
public AccessibleStateSet getAccessibleStateSet()
{
AccessibleStateSet states = super.getAccessibleStateSet();
- if (parent.isIndexSelected(index))
+ if (parent.isIndexSelected(indexInParent))
states.add(AccessibleState.SELECTED);
return states;
}
public int getAccessibleIndexInParent()
{
- return index;
+ return indexInParent;
}
}
diff --git a/libjava/classpath/java/awt/Menu.java b/libjava/classpath/java/awt/Menu.java
index 56ceccfc542..13ebb5211be 100644
--- a/libjava/classpath/java/awt/Menu.java
+++ b/libjava/classpath/java/awt/Menu.java
@@ -441,6 +441,8 @@ paramString()
*/
protected class AccessibleAWTMenu extends AccessibleAWTMenuItem
{
+ private static final long serialVersionUID = 5228160894980069094L;
+
protected AccessibleAWTMenu()
{
}
diff --git a/libjava/classpath/java/awt/MenuComponent.java b/libjava/classpath/java/awt/MenuComponent.java
index ec6980e10ca..375d08436e0 100644
--- a/libjava/classpath/java/awt/MenuComponent.java
+++ b/libjava/classpath/java/awt/MenuComponent.java
@@ -1157,7 +1157,7 @@ protected abstract class AccessibleAWTMenuComponent
* the appropriate information.
*
* @param color the new color to use for the background.
- * @see getBackground()
+ * @see #getBackground()
*/
public void setBackground(Color color)
{
@@ -1217,7 +1217,7 @@ protected abstract class AccessibleAWTMenuComponent
*
* @param enabled true if the component should be enabled,
* false otherwise.
- * @see #getEnabled()
+ * @see #isEnabled()
*/
public void setEnabled(boolean enabled)
{
diff --git a/libjava/classpath/java/awt/MenuItem.java b/libjava/classpath/java/awt/MenuItem.java
index 58dcb674146..3e39d118a05 100644
--- a/libjava/classpath/java/awt/MenuItem.java
+++ b/libjava/classpath/java/awt/MenuItem.java
@@ -108,6 +108,8 @@ private transient ActionListener action_listeners;
extends MenuComponent.AccessibleAWTMenuComponent
implements AccessibleAction, AccessibleValue
{
+ private static final long serialVersionUID = -217847831945965825L;
+
/** Constructor */
public AccessibleAWTMenuItem()
{
diff --git a/libjava/classpath/java/awt/Point.java b/libjava/classpath/java/awt/Point.java
index 492749b8dc3..31b72e2cc75 100644
--- a/libjava/classpath/java/awt/Point.java
+++ b/libjava/classpath/java/awt/Point.java
@@ -226,6 +226,10 @@ public class Point extends Point2D implements Serializable
*/
public boolean equals(Object obj)
{
+ // NOTE: No special hashCode() method is required for this class,
+ // as this equals() implementation is functionally equivalent to
+ // super.equals(), which does define a proper hashCode().
+
if (! (obj instanceof Point2D))
return false;
Point2D p = (Point2D) obj;
diff --git a/libjava/classpath/java/awt/Polygon.java b/libjava/classpath/java/awt/Polygon.java
index a72522cb089..403c336cde5 100644
--- a/libjava/classpath/java/awt/Polygon.java
+++ b/libjava/classpath/java/awt/Polygon.java
@@ -544,7 +544,6 @@ public class Polygon implements Shape, Serializable
* the positive X, or Y axis, within a given interval.
*
* @return the winding number.
- * @see #condensed
* @see #contains(double, double)
*/
private int evaluateCrossings(double x, double y, boolean useYaxis,
diff --git a/libjava/classpath/java/awt/PopupMenu.java b/libjava/classpath/java/awt/PopupMenu.java
index 90d48d903b9..540fffda718 100644
--- a/libjava/classpath/java/awt/PopupMenu.java
+++ b/libjava/classpath/java/awt/PopupMenu.java
@@ -140,6 +140,8 @@ show(Component component, int x, int y)
protected class AccessibleAWTPopupMenu extends AccessibleAWTMenu
{
+ private static final long serialVersionUID = -4282044795947239955L;
+
protected AccessibleAWTPopupMenu()
{
}
diff --git a/libjava/classpath/java/awt/Rectangle.java b/libjava/classpath/java/awt/Rectangle.java
index 0f21d495cd8..c4ba6ba1488 100644
--- a/libjava/classpath/java/awt/Rectangle.java
+++ b/libjava/classpath/java/awt/Rectangle.java
@@ -727,6 +727,10 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
*/
public boolean equals(Object obj)
{
+ // NOTE: No special hashCode() method is required for this class,
+ // as this equals() implementation is functionally equivalent to
+ // super.equals(), which does define a proper hashCode().
+
if (! (obj instanceof Rectangle2D))
return false;
Rectangle2D r = (Rectangle2D) obj;
diff --git a/libjava/classpath/java/awt/ScrollPane.java b/libjava/classpath/java/awt/ScrollPane.java
index b3ecc59fcd5..525d9d3e7da 100644
--- a/libjava/classpath/java/awt/ScrollPane.java
+++ b/libjava/classpath/java/awt/ScrollPane.java
@@ -401,7 +401,7 @@ setScrollPosition(int x, int y)
public void
addNotify()
{
- if (!isDisplayable ())
+ if (peer != null)
return;
setPeer((ComponentPeer)getToolkit().createScrollPane(this));
@@ -592,6 +592,8 @@ paramString()
protected class AccessibleAWTScrollPane extends AccessibleAWTContainer
{
+ private static final long serialVersionUID = 6100703663886637L;
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.SCROLL_PANE;
diff --git a/libjava/classpath/java/awt/ScrollPaneAdjustable.java b/libjava/classpath/java/awt/ScrollPaneAdjustable.java
index cfca19b4423..bec5b5106de 100644
--- a/libjava/classpath/java/awt/ScrollPaneAdjustable.java
+++ b/libjava/classpath/java/awt/ScrollPaneAdjustable.java
@@ -87,12 +87,16 @@ public class ScrollPaneAdjustable
public void addAdjustmentListener (AdjustmentListener listener)
{
- AWTEventMulticaster.add (adjustmentListener, listener);
+ if (listener == null)
+ return;
+ adjustmentListener = AWTEventMulticaster.add (adjustmentListener, listener);
}
public void removeAdjustmentListener (AdjustmentListener listener)
{
- AWTEventMulticaster.remove (adjustmentListener, listener);
+ if (listener == null)
+ return;
+ adjustmentListener = AWTEventMulticaster.remove (adjustmentListener, listener);
}
public AdjustmentListener[] getAdjustmentListeners ()
diff --git a/libjava/classpath/java/awt/TextArea.java b/libjava/classpath/java/awt/TextArea.java
index d422d3306d2..b04cdc89204 100644
--- a/libjava/classpath/java/awt/TextArea.java
+++ b/libjava/classpath/java/awt/TextArea.java
@@ -603,6 +603,8 @@ public class TextArea extends TextComponent implements java.io.Serializable
protected class AccessibleAWTTextArea extends AccessibleAWTTextComponent
{
+ private static final long serialVersionUID = 3472827823632144419L;
+
protected AccessibleAWTTextArea()
{
}
diff --git a/libjava/classpath/java/awt/TextComponent.java b/libjava/classpath/java/awt/TextComponent.java
index 60e72fcb5cb..f08e59c9fc9 100644
--- a/libjava/classpath/java/awt/TextComponent.java
+++ b/libjava/classpath/java/awt/TextComponent.java
@@ -107,6 +107,8 @@ protected transient TextListener textListener;
extends AccessibleAWTComponent
implements AccessibleText, TextListener
{
+ private static final long serialVersionUID = 3631432373506317811L;
+
// Constructor
// Adds a listener for tracking caret changes
public AccessibleAWTTextComponent()
diff --git a/libjava/classpath/java/awt/TextField.java b/libjava/classpath/java/awt/TextField.java
index 4d62d024aad..3302a2eff89 100644
--- a/libjava/classpath/java/awt/TextField.java
+++ b/libjava/classpath/java/awt/TextField.java
@@ -523,6 +523,8 @@ paramString()
protected class AccessibleAWTTextField extends AccessibleAWTTextComponent
{
+ private static final long serialVersionUID = 6219164359235943158L;
+
protected AccessibleAWTTextField()
{
}
diff --git a/libjava/classpath/java/awt/Window.java b/libjava/classpath/java/awt/Window.java
index 1689d03706b..f8a620daebd 100644
--- a/libjava/classpath/java/awt/Window.java
+++ b/libjava/classpath/java/awt/Window.java
@@ -101,6 +101,8 @@ public class Window extends Container implements Accessible
protected class AccessibleAWTWindow extends AccessibleAWTContainer
{
+ private static final long serialVersionUID = 4215068635060671780L;
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.WINDOW;
@@ -278,14 +280,14 @@ public class Window extends Container implements Accessible
*/
public void show()
{
+ synchronized (getTreeLock())
+ {
if (parent != null && !parent.isDisplayable())
parent.addNotify();
if (peer == null)
addNotify();
// Show visible owned windows.
- synchronized (getTreeLock())
- {
Iterator e = ownedWindows.iterator();
while(e.hasNext())
{
@@ -302,14 +304,13 @@ public class Window extends Container implements Accessible
// synchronous access to ownedWindows there.
e.remove();
}
- }
validate();
super.show();
toFront();
KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
manager.setGlobalFocusedWindow (this);
-
+
if (!shown)
{
FocusTraversalPolicy policy = getFocusTraversalPolicy ();
@@ -323,6 +324,7 @@ public class Window extends Container implements Accessible
shown = true;
}
+ }
}
public void hide()
@@ -346,13 +348,6 @@ public class Window extends Container implements Accessible
super.hide();
}
- public boolean isDisplayable()
- {
- if (super.isDisplayable())
- return true;
- return peer != null;
- }
-
/**
* Destroys any resources associated with this window. This includes
* all components in the window and all owned top-level windows.
@@ -808,20 +803,81 @@ public class Window extends Container implements Accessible
return isVisible();
}
- public void setLocationRelativeTo (Component c)
+ public void setLocationRelativeTo(Component c)
{
- if (c == null || !c.isShowing ())
+ int x = 0;
+ int y = 0;
+
+ if (c == null || !c.isShowing())
{
- int x = 0;
- int y = 0;
-
- GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment ();
- Point center = ge.getCenterPoint ();
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Point center = ge.getCenterPoint();
x = center.x - (width / 2);
y = center.y - (height / 2);
- setLocation (x, y);
}
- // FIXME: handle case where component is non-null.
+ else
+ {
+ int cWidth = c.getWidth();
+ int cHeight = c.getHeight();
+ Dimension screenSize = getToolkit().getScreenSize();
+
+ x = c.getLocationOnScreen().x;
+ y = c.getLocationOnScreen().y;
+
+ // If bottom of component is cut off, window placed
+ // on the left or the right side of component
+ if ((y + cHeight) > screenSize.height)
+ {
+ // If the right side of the component is closer to the center
+ if ((screenSize.width / 2 - x) <= 0)
+ {
+ if ((x - width) >= 0)
+ x -= width;
+ else
+ x = 0;
+ }
+ else
+ {
+ if ((x + cWidth + width) <= screenSize.width)
+ x += cWidth;
+ else
+ x = screenSize.width - width;
+ }
+
+ y = screenSize.height - height;
+ }
+ else if (cWidth > width || cHeight > height)
+ {
+ // If right side of component is cut off
+ if ((x + width) > screenSize.width)
+ x = screenSize.width - width;
+ // If left side of component is cut off
+ else if (x < 0)
+ x = 0;
+ else
+ x += (cWidth - width) / 2;
+
+ y += (cHeight - height) / 2;
+ }
+ else
+ {
+ // If right side of component is cut off
+ if ((x + width) > screenSize.width)
+ x = screenSize.width - width;
+ // If left side of component is cut off
+ else if (x < 0 || (x - (width - cWidth) / 2) < 0)
+ x = 0;
+ else
+ x -= (width - cWidth) / 2;
+
+ if ((y - (height - cHeight) / 2) > 0)
+ y -= (height - cHeight) / 2;
+ else
+ y = 0;
+ }
+ }
+
+ setLocation(x, y);
}
/**
@@ -938,8 +994,8 @@ public class Window extends Container implements Accessible
*
* @since 1.4
*/
- public void createBufferStrategy(int numBuffers,
- BufferCapabilities caps)
+ public void createBufferStrategy(int numBuffers, BufferCapabilities caps)
+ throws AWTException
{
if (numBuffers < 1)
throw new IllegalArgumentException("Window.createBufferStrategy: number"
@@ -951,15 +1007,7 @@ public class Window extends Container implements Accessible
// a flipping strategy was requested
if (caps.isPageFlipping())
- {
- try
- {
- bufferStrategy = new WindowFlipBufferStrategy(numBuffers);
- }
- catch (AWTException e)
- {
- }
- }
+ bufferStrategy = new WindowFlipBufferStrategy(numBuffers);
else
bufferStrategy = new WindowBltBufferStrategy(numBuffers, true);
}
diff --git a/libjava/classpath/java/awt/color/ICC_Profile.java b/libjava/classpath/java/awt/color/ICC_Profile.java
index 75f55a1dacb..1072cd694db 100644
--- a/libjava/classpath/java/awt/color/ICC_Profile.java
+++ b/libjava/classpath/java/awt/color/ICC_Profile.java
@@ -324,11 +324,11 @@ public class ICC_Profile implements Serializable
* An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
* may be returned if appropriate.
*
- * @throws IllegalArgumentException if the profile data is an invalid
- * v2 profile.
- *
* @param data - the profile data
* @return An ICC_Profile object
+ *
+ * @throws IllegalArgumentException if the profile data is an invalid
+ * v2 profile.
*/
public static ICC_Profile getInstance(byte[] data)
{
@@ -373,12 +373,12 @@ public class ICC_Profile implements Serializable
* An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
* may be returned if appropriate.
*
+ * @param filename - the file name of the profile file.
+ * @return An ICC_Profile object
+ *
* @throws IllegalArgumentException if the profile data is an invalid
* v2 profile.
* @throws IOException if the file could not be read.
- *
- * @param filename - the file name of the profile file.
- * @return An ICC_Profile object
*/
public static ICC_Profile getInstance(String filename)
throws IOException
@@ -400,12 +400,12 @@ public class ICC_Profile implements Serializable
* An instance of the specialized classes ICC_ProfileRGB or ICC_ProfileGray
* may be returned if appropriate.
*
+ * @param in - the input stream to read the profile from.
+ * @return An ICC_Profile object
+ *
* @throws IllegalArgumentException if the profile data is an invalid
* v2 profile.
* @throws IOException if the stream could not be read.
- *
- * @param in - the input stream to read the profile from.
- * @return An ICC_Profile object
*/
public static ICC_Profile getInstance(InputStream in)
throws IOException
diff --git a/libjava/classpath/java/awt/event/InputEvent.java b/libjava/classpath/java/awt/event/InputEvent.java
index 8f9aed611f8..28cd9018599 100644
--- a/libjava/classpath/java/awt/event/InputEvent.java
+++ b/libjava/classpath/java/awt/event/InputEvent.java
@@ -197,17 +197,28 @@ public abstract class InputEvent extends ComponentEvent
private final long when;
/**
- * The modifiers in effect for this event. Package visible for use by
- * subclasses. The old style (bitmask 0x3f) should not be mixed with the
- * new style (bitmasks 0xffffffc0).
+ * The old-style modifiers in effect for this event. Package visible
+ * for use by subclasses. The old style (bitmask 0x3f) should not be
+ * mixed with the new style (bitmasks 0xffffffc0).
*
* @see #getModifiers()
* @see MouseEvent
- * @serial the modifier state, stored in the new style
+ * @serial the modifier state, stored in the old style
*/
int modifiers;
/**
+ * The new-style modifiers in effect for this event. Package visible
+ * for use by subclasses. The old style (bitmask 0x3f) should not be
+ * mixed with the new style (bitmasks 0xffffffc0).
+ *
+ * @see #getModifiersEx()
+ * @see MouseEvent
+ * @serial the modifier state, stored in the new style
+ */
+ int modifiersEx;
+
+ /**
* Initializes a new instance of <code>InputEvent</code> with the specified
* source, id, timestamp, and modifiers. Note that an invalid id leads to
* unspecified results.
@@ -222,7 +233,8 @@ public abstract class InputEvent extends ComponentEvent
{
super(source, id);
this.when = when;
- this.modifiers = EventModifier.extend(modifiers);
+ this.modifiers = modifiers & EventModifier.OLD_MASK;
+ this.modifiersEx = modifiers & EventModifier.NEW_MASK;
}
/**
@@ -232,7 +244,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isShiftDown()
{
- return (modifiers & SHIFT_DOWN_MASK) != 0;
+ return ((modifiers & SHIFT_MASK) != 0)
+ || ((modifiersEx & SHIFT_DOWN_MASK) != 0);
}
/**
@@ -243,7 +256,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isControlDown()
{
- return (modifiers & CTRL_DOWN_MASK) != 0;
+ return ((modifiers & CTRL_MASK) != 0)
+ || ((modifiersEx & CTRL_DOWN_MASK) != 0);
}
/**
@@ -253,7 +267,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isMetaDown()
{
- return (modifiers & META_DOWN_MASK) != 0;
+ return ((modifiers & META_MASK) != 0)
+ || ((modifiersEx & META_DOWN_MASK) != 0);
}
/**
@@ -263,7 +278,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isAltDown()
{
- return (modifiers & ALT_DOWN_MASK) != 0;
+ return ((modifiers & ALT_MASK) != 0)
+ || ((modifiersEx & ALT_DOWN_MASK) != 0);
}
/**
@@ -274,7 +290,8 @@ public abstract class InputEvent extends ComponentEvent
*/
public boolean isAltGraphDown()
{
- return (modifiers & ALT_GRAPH_DOWN_MASK) != 0;
+ return ((modifiers & ALT_GRAPH_MASK) != 0)
+ || ((modifiersEx & ALT_GRAPH_DOWN_MASK) != 0);
}
/**
@@ -300,7 +317,7 @@ public abstract class InputEvent extends ComponentEvent
*/
public int getModifiers()
{
- return EventModifier.revert(modifiers);
+ return modifiers;
}
/**
@@ -321,7 +338,7 @@ public abstract class InputEvent extends ComponentEvent
*/
public int getModifiersEx()
{
- return modifiers;
+ return modifiersEx;
}
/**
diff --git a/libjava/classpath/java/awt/event/InvocationEvent.java b/libjava/classpath/java/awt/event/InvocationEvent.java
index 75feb62bd94..6f39d6b9130 100644
--- a/libjava/classpath/java/awt/event/InvocationEvent.java
+++ b/libjava/classpath/java/awt/event/InvocationEvent.java
@@ -107,6 +107,13 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
private Exception exception;
/**
+ * This is the caught Throwable thrown in the <code>run()</code> method.
+ * It is null if throwables are ignored, the run method hasn't completed,
+ * or there were no throwables thrown.
+ */
+ private Throwable throwable;
+
+ /**
* The timestamp when this event was created.
*
* @see #getWhen()
@@ -183,9 +190,11 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
{
runnable.run();
}
- catch (Exception e)
+ catch (Throwable t)
{
- exception = e;
+ throwable = t;
+ if (t instanceof Exception)
+ exception = (Exception)t;
}
else
runnable.run();
@@ -211,6 +220,18 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
}
/**
+ * Returns a throwable caught while executing the Runnable's run() method.
+ * Null if none was thrown or if this InvocationEvent doesn't catch
+ * throwables.
+ * @return the caught Throwable
+ * @since 1.5
+ */
+ public Throwable getThrowable()
+ {
+ return throwable;
+ }
+
+ /**
* Gets the timestamp of when this event was created.
*
* @return the timestamp of this event
diff --git a/libjava/classpath/java/awt/event/KeyEvent.java b/libjava/classpath/java/awt/event/KeyEvent.java
index a40a8e15c04..d4b93ba3e0b 100644
--- a/libjava/classpath/java/awt/event/KeyEvent.java
+++ b/libjava/classpath/java/awt/event/KeyEvent.java
@@ -1735,6 +1735,6 @@ public class KeyEvent extends InputEvent
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
- modifiers = EventModifier.extend(modifiers);
+ modifiersEx = EventModifier.extend(modifiers) & EventModifier.NEW_MASK;
}
} // class KeyEvent
diff --git a/libjava/classpath/java/awt/event/MouseEvent.java b/libjava/classpath/java/awt/event/MouseEvent.java
index 249c3d112e4..3e0fecacf94 100644
--- a/libjava/classpath/java/awt/event/MouseEvent.java
+++ b/libjava/classpath/java/awt/event/MouseEvent.java
@@ -42,6 +42,7 @@ import gnu.java.awt.EventModifier;
import java.awt.Component;
import java.awt.Point;
+import java.awt.PopupMenu;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -227,6 +228,12 @@ public class MouseEvent extends InputEvent
else if ((modifiers & BUTTON3_MASK) != 0)
this.button = BUTTON3;
}
+ // clear the mouse button modifier masks if this is a button
+ // release event.
+ if (id == MOUSE_RELEASED)
+ this.modifiersEx &= ~(BUTTON1_DOWN_MASK
+ | BUTTON2_DOWN_MASK
+ | BUTTON3_DOWN_MASK);
}
/**
@@ -392,17 +399,9 @@ public class MouseEvent extends InputEvent
s.append("unknown type,(");
}
s.append(x).append(',').append(y).append("),button=").append(button);
- if ((modifiers & EventModifier.NEW_MASK) != 0)
- {
- int mod = modifiers;
- if ((mod & (ALT_DOWN_MASK | BUTTON2_DOWN_MASK)) != 0)
- mod |= ALT_DOWN_MASK | BUTTON2_DOWN_MASK;
- if ((mod & (META_DOWN_MASK | BUTTON3_DOWN_MASK)) != 0)
- mod |= META_DOWN_MASK | BUTTON3_DOWN_MASK;
- s.append(",modifiers=").append(getModifiersExText(mod));
- }
- if (modifiers != 0)
- s.append(",extModifiers=").append(getModifiersExText(modifiers));
+ // FIXME: need a mauve test for this method
+ if (modifiersEx != 0)
+ s.append(",extModifiers=").append(getModifiersExText(modifiersEx));
return s.append(",clickCount=").append(clickCount).toString();
}
@@ -426,7 +425,7 @@ public class MouseEvent extends InputEvent
button = BUTTON2;
else if ((modifiers & BUTTON3_MASK) != 0)
button = BUTTON3;
- modifiers = EventModifier.extend(modifiers);
+ modifiersEx = EventModifier.extend(modifiers) & EventModifier.NEW_MASK;
}
}
} // class MouseEvent
diff --git a/libjava/classpath/java/awt/geom/Area.java b/libjava/classpath/java/awt/geom/Area.java
index 7a0fac43a34..ad20b535f68 100644
--- a/libjava/classpath/java/awt/geom/Area.java
+++ b/libjava/classpath/java/awt/geom/Area.java
@@ -1215,7 +1215,7 @@ public class Area implements Shape, Cloneable
* @param t1 - global parametric value of the first curve's starting point
* @param t2 - global parametric value of the second curve's starting point
* @param w1 - global parametric length of curve 1
- * @param c1 - global parametric length of curve 2
+ * @param w2 - global parametric length of curve 2
*
* The final four parameters are for keeping track of the parametric
* value of the curve. For a full curve t = 0, w = 1, w is halved with
diff --git a/libjava/classpath/java/awt/geom/GeneralPath.java b/libjava/classpath/java/awt/geom/GeneralPath.java
index f54855874dc..15fb8aba811 100644
--- a/libjava/classpath/java/awt/geom/GeneralPath.java
+++ b/libjava/classpath/java/awt/geom/GeneralPath.java
@@ -558,7 +558,8 @@ public final class GeneralPath implements Shape, Cloneable
* Constructs a new iterator for enumerating the segments of a
* GeneralPath.
*
- * @param at an affine transformation for projecting the returned
+ * @param path the path to enumerate
+ * @param transform an affine transformation for projecting the returned
* points, or <code>null</code> to return the original points
* without any mapping.
*/
diff --git a/libjava/classpath/java/awt/im/InputContext.java b/libjava/classpath/java/awt/im/InputContext.java
index c0505e7e98b..0bb107e36d1 100644
--- a/libjava/classpath/java/awt/im/InputContext.java
+++ b/libjava/classpath/java/awt/im/InputContext.java
@@ -49,6 +49,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
+import java.text.AttributedCharacterIterator.Attribute;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
@@ -334,7 +335,7 @@ public class InputContext
/**
* Starts a reconversion operation in the current input method. The input
- * method gets theh text to reconvert from the client component, using
+ * method gets the text to reconvert from the client component, using
* {@link InputMethodRequests#getSelectedText(Attribute[])}. Then the
* composed and committed text produced by the operation is sent back to
* the client using a sequence of InputMethodRequests.
diff --git a/libjava/classpath/java/awt/im/InputMethodHighlight.java b/libjava/classpath/java/awt/im/InputMethodHighlight.java
index 0d664b19366..6fbe42fe549 100644
--- a/libjava/classpath/java/awt/im/InputMethodHighlight.java
+++ b/libjava/classpath/java/awt/im/InputMethodHighlight.java
@@ -37,6 +37,9 @@ exception statement from your version. */
package java.awt.im;
+import java.awt.Toolkit;
+import java.text.Annotation;
+import java.text.AttributedCharacterIterator;
import java.util.Map;
/**
@@ -53,7 +56,7 @@ import java.util.Map;
* text segments.
*
* @author Eric Blake (ebb9@email.byu.edu)
- * @see AttributedCharacterIterators
+ * @see AttributedCharacterIterator
* @see Annotation
* @since 1.2
* @status updated to 1.4
diff --git a/libjava/classpath/java/awt/im/InputMethodRequests.java b/libjava/classpath/java/awt/im/InputMethodRequests.java
index d50ec33c5c8..0423358cc53 100644
--- a/libjava/classpath/java/awt/im/InputMethodRequests.java
+++ b/libjava/classpath/java/awt/im/InputMethodRequests.java
@@ -37,8 +37,10 @@ exception statement from your version. */
package java.awt.im;
+import java.awt.Component;
import java.awt.Rectangle;
import java.awt.font.TextHitInfo;
+import java.awt.event.InputMethodListener;
import java.text.AttributedCharacterIterator;
import java.text.AttributedCharacterIterator.Attribute;
diff --git a/libjava/classpath/java/awt/im/spi/InputMethod.java b/libjava/classpath/java/awt/im/spi/InputMethod.java
index 840d193a8d8..ebe4508418e 100644
--- a/libjava/classpath/java/awt/im/spi/InputMethod.java
+++ b/libjava/classpath/java/awt/im/spi/InputMethod.java
@@ -38,7 +38,11 @@ exception statement from your version. */
package java.awt.im.spi;
import java.awt.AWTEvent;
+import java.awt.Component;
import java.awt.Rectangle;
+import java.awt.im.InputContext;
+import java.awt.im.InputMethodRequests;
+import java.text.AttributedCharacterIterator.Attribute;
import java.util.Locale;
/**
@@ -152,8 +156,8 @@ public interface InputMethod
* Notify this input method of changes in the client window. This is called
* when notifications are enabled (see {@link
* InputMethodContext#enableClientWindowNotification(InputMethod, boolean)},
- * if {@link #removeNotify(Component)} has not been called. The following
- * situations trigger a notification:<ul>
+ * if {@link InputContext#removeNotify(Component)} has not been called.
+ * The following situations trigger a notification:<ul>
* <li>The client window changes in location, size, visibility,
* iconification, or is closed.</li>
* <li>When enabling client notification (or on the first activation after
@@ -202,7 +206,7 @@ public interface InputMethod
/**
* Notify the input method that a client component has been removed from its
* hierarchy, or that input method support has been disabled. This is
- * called by {@link InputContext#removeNotify()}, and only when the input
+ * called by {@link InputContext#removeNotify(Component)}, and only when the input
* method is inactive.
*/
void removeNotify();
diff --git a/libjava/classpath/java/awt/im/spi/InputMethodContext.java b/libjava/classpath/java/awt/im/spi/InputMethodContext.java
index 43bee8d8617..17ec4f8f7ee 100644
--- a/libjava/classpath/java/awt/im/spi/InputMethodContext.java
+++ b/libjava/classpath/java/awt/im/spi/InputMethodContext.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.awt.im.spi;
+import java.awt.HeadlessException;
+import java.awt.Rectangle;
import java.awt.Window;
import java.awt.font.TextHitInfo;
import java.awt.im.InputMethodRequests;
@@ -113,7 +115,7 @@ public interface InputMethodContext extends InputMethodRequests
/**
* Sets whether notification of the client window's location and state should
* be enabled for the input method. When enabled, the input method's
- * {@link #notifyClientWindowChange(Rectangle)} method is called.
+ * {@link InputMethod#notifyClientWindowChange(Rectangle)} method is called.
* Notification is automatically disabled when the input method is disposed.
*
* @param inputMethod the method to change status of
diff --git a/libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java b/libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java
index 093d7319217..d234e5c57f3 100644
--- a/libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java
+++ b/libjava/classpath/java/awt/im/spi/InputMethodDescriptor.java
@@ -39,6 +39,7 @@ package java.awt.im.spi;
import java.awt.AWTException;
import java.awt.Image;
+import java.awt.im.InputContext;
import java.util.Locale;
/**
@@ -57,7 +58,7 @@ public interface InputMethodDescriptor
* also by country and variant), via
* {@link InputContext#selectInputMethod(Locale)}. The returned list should
* ignore pass-through locales, so it is usually a subset of locales for
- * which {@link InputMethod#setContext(Locale)} returns true. If
+ * which {@link InputMethod#setLocale(Locale)} returns true. If
* {@link #hasDynamicLocaleList()} returns true, this is called each time
* information is needed, allowing dynamic addition or removal of supported
* locales.
diff --git a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java
index 194d483d962..6333ce9e7f9 100644
--- a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java
+++ b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java
@@ -45,7 +45,7 @@ package java.awt.image;
* points should give the desired results although Sun does not
* specify what the exact algorithm should be.
* <br>
- * Currently this filter does nothing and needs to be implemented.
+ * FIXME: Currently this filter does nothing and needs to be implemented.
*
* @author C. Brian Jones (cbj@gnu.org)
*/
diff --git a/libjava/classpath/java/awt/image/BufferedImage.java b/libjava/classpath/java/awt/image/BufferedImage.java
index 124b81368e2..3cabfbde692 100644
--- a/libjava/classpath/java/awt/image/BufferedImage.java
+++ b/libjava/classpath/java/awt/image/BufferedImage.java
@@ -1,5 +1,5 @@
/* BufferedImage.java --
- Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
+ Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -48,9 +48,7 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
-import java.util.HashSet;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.Vector;
/**
@@ -64,7 +62,7 @@ import java.util.Vector;
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class BufferedImage extends Image
- implements WritableRenderedImage
+ implements WritableRenderedImage, Transparency
{
public static final int TYPE_CUSTOM = 0,
TYPE_INT_RGB = 1,
@@ -690,4 +688,16 @@ public class BufferedImage extends Image
observers.remove (to);
}
+
+ /**
+ * Return the transparency type.
+ *
+ * @return One of {@link #OPAQUE}, {@link #BITMASK}, or {@link #TRANSLUCENT}.
+ * @see Transparency#getTransparency()
+ * @since 1.5
+ */
+ public int getTransparency()
+ {
+ return colorModel.getTransparency();
+ }
}
diff --git a/libjava/classpath/java/awt/image/ColorModel.java b/libjava/classpath/java/awt/image/ColorModel.java
index 1ebcb98a76b..1ced2a04366 100644
--- a/libjava/classpath/java/awt/image/ColorModel.java
+++ b/libjava/classpath/java/awt/image/ColorModel.java
@@ -609,7 +609,7 @@ public abstract class ColorModel implements Transparency
* @param obj Array of TransferType or null.
*
* @return pixel value encoded according to the color model.
- * @throws ArrayIndexOutOfBounds
+ * @throws ArrayIndexOutOfBoundsException
* @throws ClassCastException
* @since 1.4
*/
diff --git a/libjava/classpath/java/awt/image/ComponentSampleModel.java b/libjava/classpath/java/awt/image/ComponentSampleModel.java
index 953f63c1ea1..5cf06e4a17f 100644
--- a/libjava/classpath/java/awt/image/ComponentSampleModel.java
+++ b/libjava/classpath/java/awt/image/ComponentSampleModel.java
@@ -63,8 +63,11 @@ public class ComponentSampleModel extends SampleModel
protected int[] bandOffsets;
protected int[] bankIndices;
- // FIXME: Should we really shadow the numBands in the superclass?
- //protected int numBands;
+ /**
+ * Number of bands in the image described.
+ * @specnote This field shadows the protected numBands in SampleModel.
+ */
+ protected int numBands;
/** Used when creating data buffers. */
protected int numBanks;
@@ -100,6 +103,7 @@ public class ComponentSampleModel extends SampleModel
this.bandOffsets = bandOffsets;
this.bankIndices = bankIndices;
+ this.numBands = bandOffsets.length;
this.numBanks = 0;
for (int b=0; b<bankIndices.length; b++)
diff --git a/libjava/classpath/java/awt/image/ImageConsumer.java b/libjava/classpath/java/awt/image/ImageConsumer.java
index e1834c3978f..fc5ed11e5ca 100644
--- a/libjava/classpath/java/awt/image/ImageConsumer.java
+++ b/libjava/classpath/java/awt/image/ImageConsumer.java
@@ -75,7 +75,7 @@ public interface ImageConsumer
* most one call to <code>setPixels</code> for any single pixel.
*
* @see #setHints
- * @see #setPixels
+ * @see #setPixels(int, int, int, int, ColorModel, int[], int, int)
*/
int SINGLEPASS = 8;
diff --git a/libjava/classpath/java/awt/image/MemoryImageSource.java b/libjava/classpath/java/awt/image/MemoryImageSource.java
index c27e0bf7317..95cd4081922 100644
--- a/libjava/classpath/java/awt/image/MemoryImageSource.java
+++ b/libjava/classpath/java/awt/image/MemoryImageSource.java
@@ -187,7 +187,7 @@ public class MemoryImageSource implements ImageProducer
ic = (ImageConsumer) list.elementAt(i);
sendPicture(ic);
if (animated)
- ic.imageComplete(ImageConsumer.SINGLEFRAME);
+ ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
else
ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
}
diff --git a/libjava/classpath/java/awt/image/PackedColorModel.java b/libjava/classpath/java/awt/image/PackedColorModel.java
index 894e6e66fda..b60230fa70d 100644
--- a/libjava/classpath/java/awt/image/PackedColorModel.java
+++ b/libjava/classpath/java/awt/image/PackedColorModel.java
@@ -90,11 +90,7 @@ public abstract class PackedColorModel extends ColorModel
return bitsPerComponent;
}
- /** Initializes the masks.
- *
- * @return an array containing the number of bits per color
- * component.
- */
+ /** Initializes the masks. */
private void initMasks(int[] colorMaskArray, int alphaMask)
{
int numComponents = colorMaskArray.length;
diff --git a/libjava/classpath/java/awt/image/SampleModel.java b/libjava/classpath/java/awt/image/SampleModel.java
index 257e30a5bd5..1159662223c 100644
--- a/libjava/classpath/java/awt/image/SampleModel.java
+++ b/libjava/classpath/java/awt/image/SampleModel.java
@@ -47,7 +47,8 @@ public abstract class SampleModel
/** Height of image described. */
protected int height;
- /** Number of bands in the image described. */
+ /** Number of bands in the image described. Package-private here,
+ shadowed by ComponentSampleModel. */
protected int numBands;
/**
diff --git a/libjava/classpath/java/awt/print/PrinterJob.java b/libjava/classpath/java/awt/print/PrinterJob.java
index e61ab61bc77..e1aeabc3e62 100644
--- a/libjava/classpath/java/awt/print/PrinterJob.java
+++ b/libjava/classpath/java/awt/print/PrinterJob.java
@@ -169,8 +169,11 @@ public abstract class PrinterJob
/**
* Prints the page with given attributes.
*/
- public abstract void print (PrintRequestAttributeSet attributes)
- throws PrinterException;
+ public void print (PrintRequestAttributeSet attributes)
+ throws PrinterException
+ {
+ print ();
+ }
/**
* Displays a dialog box to the user which allows the print job
diff --git a/libjava/classpath/java/beans/IndexedPropertyDescriptor.java b/libjava/classpath/java/beans/IndexedPropertyDescriptor.java
index efdc7b40238..0ba2ed4f493 100644
--- a/libjava/classpath/java/beans/IndexedPropertyDescriptor.java
+++ b/libjava/classpath/java/beans/IndexedPropertyDescriptor.java
@@ -1,4 +1,4 @@
-/* java.beans.IndexedPropertyDescriptor
+/* IndexedPropertyDescriptor.java --
Copyright (C) 1998, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,266 +42,380 @@ import java.lang.reflect.Array;
import java.lang.reflect.Method;
/**
- ** IndexedPropertyDescriptor describes information about a JavaBean
- ** indexed property, by which we mean an array-like property that
- ** has been exposed via a pair of get and set methods and another
- ** pair that allows you to get to the property by an index.<P>
- **
- ** An example property would have four methods like this:<P>
- ** <CODE>FooBar[] getFoo()</CODE><BR>
- ** <CODE>void setFoo(FooBar[])</CODE><BR>
- ** <CODE>FooBar getFoo(int)</CODE><BR>
- ** <CODE>void setFoo(int,FooBar)</CODE><P>
- **
- ** The constraints put on get and set methods are:<P>
- ** <OL>
- ** <LI>There must be at least a get(int) or a set(int,...) method.
- ** Nothing else is required. <B>Spec note:</B>One nice restriction
- ** would be that if there is a get() there must be a get(int), same
- ** with set, but that is not in the spec and is fairly harmless.)</LI>
- ** <LI>A get array method must have signature
- ** <CODE>&lt;propertyType&gt;[] &lt;getMethodName&gt;()</CODE></LI>
- ** <LI>A set array method must have signature
- ** <CODE>void &lt;setMethodName&gt;(&lt;propertyType&gt;[])</CODE></LI>
- ** <LI>A get index method must have signature
- ** <CODE>&lt;propertyType&gt; &lt;getMethodName&gt;(int)</CODE></LI>
- ** <LI>A set index method must have signature
- ** <CODE>void &lt;setMethodName&gt;(int,&lt;propertyType&gt;)</CODE></LI>
- ** <LI>All these methods may throw any exception.</LI>
- ** <LI>All these methods must be public.</LI>
- ** </OL>
- **
- ** @author John Keiser
- ** @since JDK1.1
- ** @version 1.1.0, 26 Jul 1998
- **/
+ * IndexedPropertyDescriptor describes information about a JavaBean
+ * indexed property, by which we mean an array-like property that
+ * has been exposed via a pair of get and set methods and another
+ * pair that allows you to get to the property by an index.<P>
+ *
+ * An example property would have four methods like this:<P>
+ * <CODE>FooBar[] getFoo()</CODE><BR>
+ * <CODE>void setFoo(FooBar[])</CODE><BR>
+ * <CODE>FooBar getFoo(int)</CODE><BR>
+ * <CODE>void setFoo(int,FooBar)</CODE><P>
+ *
+ * The constraints put on get and set methods are:<P>
+ * <OL>
+ * <LI>There must be at least a get(int) or a set(int,...) method.
+ * Nothing else is required. <B>Spec note:</B>One nice restriction
+ * would be that if there is a get() there must be a get(int), same
+ * with set, but that is not in the spec and is fairly harmless.)</LI>
+ * <LI>A get array method must have signature
+ * <CODE>&lt;propertyType&gt;[] &lt;getMethodName&gt;()</CODE></LI>
+ * <LI>A set array method must have signature
+ * <CODE>void &lt;setMethodName&gt;(&lt;propertyType&gt;[])</CODE></LI>
+ * <LI>A get index method must have signature
+ * <CODE>&lt;propertyType&gt; &lt;getMethodName&gt;(int)</CODE></LI>
+ * <LI>A set index method must have signature
+ * <CODE>void &lt;setMethodName&gt;(int,&lt;propertyType&gt;)</CODE></LI>
+ * <LI>All these methods may throw any exception.</LI>
+ * <LI>All these methods must be public.</LI>
+ * </OL>
+ *
+ * @author John Keiser
+ * @since JDK1.1
+ */
+public class IndexedPropertyDescriptor extends PropertyDescriptor
+{
+ private Class indexedPropertyType;
+ private Method setIndex;
+ private Method getIndex;
-public class IndexedPropertyDescriptor extends PropertyDescriptor {
- private Class indexedPropertyType;
- private Method setIndex;
- private Method getIndex;
+ /**
+ * Create a new IndexedPropertyDescriptor by introspection.
+ * This form of constructor creates the PropertyDescriptor by
+ * looking for getter methods named <CODE>get&lt;name&gt;()</CODE>
+ * and setter methods named
+ * <CODE>set&lt;name&gt;()</CODE> in class
+ * <CODE>&lt;beanClass&gt;</CODE>, where &lt;name&gt; has its
+ * first letter capitalized by the constructor.<P>
+ *
+ * <B>Implementation note:</B> If there is a get(int) method,
+ * then the return type of that method is used to find the
+ * remaining methods. If there is no get method, then the
+ * set(int) method is searched for exhaustively and that type
+ * is used to find the others.<P>
+ *
+ * <B>Spec note:</B>
+ * If there is no get(int) method and multiple set(int) methods with
+ * the same name and the correct parameters (different type of course),
+ * then an IntrospectionException is thrown. While Sun's spec
+ * does not state this, it can make Bean behavior different on
+ * different systems (since method order is not guaranteed) and as
+ * such, can be treated as a bug in the spec. I am not aware of
+ * whether Sun's implementation catches this.
+ *
+ * @param name the programmatic name of the property, usually
+ * starting with a lowercase letter (e.g. fooManChu
+ * instead of FooManChu).
+ * @param beanClass the class the get and set methods live in.
+ *
+ * @exception IntrospectionException if the methods are not found or
+ * invalid.
+ */
+ public IndexedPropertyDescriptor(String name, Class beanClass)
+ throws IntrospectionException
+ {
+ super(name);
+ String capitalized;
+ try
+ {
+ capitalized = Character.toUpperCase(name.charAt(0))
+ + name.substring(1);
+ }
+ catch(StringIndexOutOfBoundsException e)
+ {
+ capitalized = "";
+ }
+ findMethods(beanClass, "get" + capitalized, "set" + capitalized,
+ "get" + capitalized, "set" + capitalized);
+ }
- /** Create a new IndexedPropertyDescriptor by introspection.
- ** This form of constructor creates the PropertyDescriptor by
- ** looking for getter methods named <CODE>get&lt;name&gt;()</CODE>
- ** and setter methods named
- ** <CODE>set&lt;name&gt;()</CODE> in class
- ** <CODE>&lt;beanClass&gt;</CODE>, where &lt;name&gt; has its
- ** first letter capitalized by the constructor.<P>
- **
- ** <B>Implementation note:</B> If there is a get(int) method,
- ** then the return type of that method is used to find the
- ** remaining methods. If there is no get method, then the
- ** set(int) method is searched for exhaustively and that type
- ** is used to find the others.<P>
- **
- ** <B>Spec note:</B>
- ** If there is no get(int) method and multiple set(int) methods with
- ** the same name and the correct parameters (different type of course),
- ** then an IntrospectionException is thrown. While Sun's spec
- ** does not state this, it can make Bean behavior different on
- ** different systems (since method order is not guaranteed) and as
- ** such, can be treated as a bug in the spec. I am not aware of
- ** whether Sun's implementation catches this.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public IndexedPropertyDescriptor(String name, Class beanClass) throws IntrospectionException {
- super(name);
- String capitalized;
- try {
- capitalized = Character.toUpperCase(name.charAt(0)) + name.substring(1);
- } catch(StringIndexOutOfBoundsException e) {
- capitalized = "";
- }
- findMethods(beanClass, "get" + capitalized, "set" + capitalized, "get" + capitalized, "set" + capitalized);
- }
+ /**
+ * Create a new IndexedPropertyDescriptor by introspection.
+ * This form of constructor allows you to specify the
+ * names of the get and set methods to search for.<P>
+ *
+ * <B>Implementation note:</B> If there is a get(int) method,
+ * then the return type of that method is used to find the
+ * remaining methods. If there is no get method, then the
+ * set(int) method is searched for exhaustively and that type
+ * is used to find the others.<P>
+ *
+ * <B>Spec note:</B>
+ * If there is no get(int) method and multiple set(int) methods with
+ * the same name and the correct parameters (different type of course),
+ * then an IntrospectionException is thrown. While Sun's spec
+ * does not state this, it can make Bean behavior different on
+ * different systems (since method order is not guaranteed) and as
+ * such, can be treated as a bug in the spec. I am not aware of
+ * whether Sun's implementation catches this.
+ *
+ * @param name the programmatic name of the property, usually
+ * starting with a lowercase letter (e.g. fooManChu
+ * instead of FooManChu).
+ * @param beanClass the class the get and set methods live in.
+ * @param getMethodName the name of the get array method.
+ * @param setMethodName the name of the set array method.
+ * @param getIndexName the name of the get index method.
+ * @param setIndexName the name of the set index method.
+ *
+ * @exception IntrospectionException if the methods are not found or invalid.
+ */
+ public IndexedPropertyDescriptor(String name, Class beanClass,
+ String getMethodName, String setMethodName,
+ String getIndexName, String setIndexName)
+ throws IntrospectionException
+ {
+ super(name);
+ findMethods(beanClass, getMethodName, setMethodName, getIndexName,
+ setIndexName);
+ }
- /** Create a new IndexedPropertyDescriptor by introspection.
- ** This form of constructor allows you to specify the
- ** names of the get and set methods to search for.<P>
- **
- ** <B>Implementation note:</B> If there is a get(int) method,
- ** then the return type of that method is used to find the
- ** remaining methods. If there is no get method, then the
- ** set(int) method is searched for exhaustively and that type
- ** is used to find the others.<P>
- **
- ** <B>Spec note:</B>
- ** If there is no get(int) method and multiple set(int) methods with
- ** the same name and the correct parameters (different type of course),
- ** then an IntrospectionException is thrown. While Sun's spec
- ** does not state this, it can make Bean behavior different on
- ** different systems (since method order is not guaranteed) and as
- ** such, can be treated as a bug in the spec. I am not aware of
- ** whether Sun's implementation catches this.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param beanClass the class the get and set methods live in.
- ** @param getMethodName the name of the get array method.
- ** @param setMethodName the name of the set array method.
- ** @param getIndexName the name of the get index method.
- ** @param setIndexName the name of the set index method.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public IndexedPropertyDescriptor(String name, Class beanClass, String getMethodName, String setMethodName, String getIndexName, String setIndexName) throws IntrospectionException {
- super(name);
- findMethods(beanClass, getMethodName, setMethodName, getIndexName, setIndexName);
- }
+ /**
+ * Create a new PropertyDescriptor using explicit Methods.
+ * Note that the methods will be checked for conformance to standard
+ * Property method rules, as described above at the top of this class.
+ *
+ * @param name the programmatic name of the property, usually
+ * starting with a lowercase letter (e.g. fooManChu
+ * instead of FooManChu).
+ * @param getMethod the get array method.
+ * @param setMethod the set array method.
+ * @param getIndex the get index method.
+ * @param setIndex the set index method.
+ *
+ * @exception IntrospectionException if the methods are not found or invalid.
+ */
+ public IndexedPropertyDescriptor(String name, Method getMethod,
+ Method setMethod, Method getIndex,
+ Method setIndex)
+ throws IntrospectionException
+ {
+ super(name);
+ if(getMethod != null && getMethod.getParameterTypes().length > 0)
+ throw new IntrospectionException("get method has parameters");
+ if(getMethod != null && setMethod.getParameterTypes().length != 1)
+ throw new IntrospectionException("set method does not have exactly one parameter");
+ if(getMethod != null && setMethod != null)
+ {
+ if(!getMethod.getReturnType().equals(setMethod.getParameterTypes()[0]))
+ {
+ throw new IntrospectionException("set and get methods do not "
+ + "share the same type");
+ }
+ if(!getMethod.getDeclaringClass().isAssignableFrom
+ (setMethod.getDeclaringClass())
+ && !setMethod.getDeclaringClass().isAssignableFrom
+ (getMethod.getDeclaringClass()))
+ {
+ throw new IntrospectionException("set and get methods are not in "
+ + "the same class.");
+ }
+ }
- /** Create a new PropertyDescriptor using explicit Methods.
- ** Note that the methods will be checked for conformance to standard
- ** Property method rules, as described above at the top of this class.
- **
- ** @param name the programmatic name of the property, usually
- ** starting with a lowercase letter (e.g. fooManChu
- ** instead of FooManChu).
- ** @param getMethod the get array method.
- ** @param setMethod the set array method.
- ** @param getIndex the get index method.
- ** @param setIndex the set index method.
- ** @exception IntrospectionException if the methods are not found or invalid.
- **/
- public IndexedPropertyDescriptor(String name, Method getMethod, Method setMethod, Method getIndex, Method setIndex) throws IntrospectionException {
- super(name);
- if(getMethod != null && getMethod.getParameterTypes().length > 0) {
- throw new IntrospectionException("get method has parameters");
- }
- if(getMethod != null && setMethod.getParameterTypes().length != 1) {
- throw new IntrospectionException("set method does not have exactly one parameter");
- }
- if(getMethod != null && setMethod != null) {
- if(!getMethod.getReturnType().equals(setMethod.getParameterTypes()[0])) {
- throw new IntrospectionException("set and get methods do not share the same type");
- }
- if(!getMethod.getDeclaringClass().isAssignableFrom(setMethod.getDeclaringClass())
- && !setMethod.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass())) {
- throw new IntrospectionException("set and get methods are not in the same class.");
- }
- }
+ if (getIndex != null
+ && (getIndex.getParameterTypes().length != 1
+ || !(getIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE)))
+ {
+ throw new IntrospectionException("get index method has wrong "
+ + "parameters");
+ }
+ if (setIndex != null
+ && (setIndex.getParameterTypes().length != 2
+ || !(setIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE)))
+ {
+ throw new IntrospectionException("set index method has wrong "
+ + "parameters");
+ }
+ if (getIndex != null && setIndex != null)
+ {
+ if(!getIndex.getReturnType().equals(setIndex.getParameterTypes()[1]))
+ {
+ throw new IntrospectionException("set index methods do not share "
+ + "the same type");
+ }
+ if(!getIndex.getDeclaringClass().isAssignableFrom
+ (setIndex.getDeclaringClass())
+ && !setIndex.getDeclaringClass().isAssignableFrom
+ (getIndex.getDeclaringClass()))
+ {
+ throw new IntrospectionException("get and set index methods are "
+ + "not in the same class.");
+ }
+ }
- if(getIndex != null && (getIndex.getParameterTypes().length != 1
- || !(getIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) {
- throw new IntrospectionException("get index method has wrong parameters");
- }
- if(setIndex != null && (setIndex.getParameterTypes().length != 2
- || !(setIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) {
- throw new IntrospectionException("set index method has wrong parameters");
- }
- if(getIndex != null && setIndex != null) {
- if(!getIndex.getReturnType().equals(setIndex.getParameterTypes()[1])) {
- throw new IntrospectionException("set index methods do not share the same type");
- }
- if(!getIndex.getDeclaringClass().isAssignableFrom(setIndex.getDeclaringClass())
- && !setIndex.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) {
- throw new IntrospectionException("get and set index methods are not in the same class.");
- }
- }
+ if (getIndex != null && getMethod != null
+ && !getIndex.getDeclaringClass().isAssignableFrom
+ (getMethod.getDeclaringClass())
+ && !getMethod.getDeclaringClass().isAssignableFrom
+ (getIndex.getDeclaringClass()))
+ {
+ throw new IntrospectionException("methods are not in the same class.");
+ }
- if(getIndex != null && getMethod != null && !getIndex.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass())
- && !getMethod.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) {
- throw new IntrospectionException("methods are not in the same class.");
- }
+ if (getIndex != null && getMethod != null
+ && !Array.newInstance(getIndex.getReturnType(),0)
+ .getClass().equals(getMethod.getReturnType()))
+ {
+ throw new IntrospectionException("array methods do not match index "
+ + "methods.");
+ }
- if(getIndex != null && getMethod != null && !Array.newInstance(getIndex.getReturnType(),0).getClass().equals(getMethod.getReturnType())) {
- throw new IntrospectionException("array methods do not match index methods.");
- }
+ this.getMethod = getMethod;
+ this.setMethod = setMethod;
+ this.getIndex = getIndex;
+ this.setIndex = setIndex;
+ this.indexedPropertyType = getIndex != null ? getIndex.getReturnType()
+ : setIndex.getParameterTypes()[1];
+ this.propertyType = getMethod != null ? getMethod.getReturnType()
+ : (setMethod != null ? setMethod.getParameterTypes()[0]
+ : Array.newInstance(this.indexedPropertyType,0).getClass());
+ }
- this.getMethod = getMethod;
- this.setMethod = setMethod;
- this.getIndex = getIndex;
- this.setIndex = setIndex;
- this.indexedPropertyType = getIndex != null ? getIndex.getReturnType() : setIndex.getParameterTypes()[1];
- this.propertyType = getMethod != null ? getMethod.getReturnType() : (setMethod != null ? setMethod.getParameterTypes()[0] : Array.newInstance(this.indexedPropertyType,0).getClass());
- }
+ public Class getIndexedPropertyType()
+ {
+ return indexedPropertyType;
+ }
- public Class getIndexedPropertyType() {
- return indexedPropertyType;
- }
+ public Method getIndexedReadMethod()
+ {
+ return getIndex;
+ }
- public Method getIndexedReadMethod() {
- return getIndex;
- }
+ /**
+ * Sets the method that is used to read an indexed property.
+ *
+ * @param m the method to set
+ */
+ public void setIndexedReadMethod(Method m) throws IntrospectionException
+ {
+ getIndex = m;
+ }
- public Method getIndexedWriteMethod() {
- return setIndex;
- }
+ public Method getIndexedWriteMethod()
+ {
+ return setIndex;
+ }
- private void findMethods(Class beanClass, String getMethodName, String setMethodName, String getIndexName, String setIndexName) throws IntrospectionException {
- try {
- if(getIndexName != null) {
- try {
- Class[] getArgs = new Class[1];
- getArgs[0] = java.lang.Integer.TYPE;
- getIndex = beanClass.getMethod(getIndexName,getArgs);
- indexedPropertyType = getIndex.getReturnType();
- } catch(NoSuchMethodException E) {
- }
- }
- if(getIndex != null) {
- if(setIndexName != null) {
- try {
- Class[] setArgs = new Class[2];
- setArgs[0] = java.lang.Integer.TYPE;
- setArgs[1] = indexedPropertyType;
- setIndex = beanClass.getMethod(setIndexName,setArgs);
- if(!setIndex.getReturnType().equals(java.lang.Void.TYPE)) {
- throw new IntrospectionException(setIndexName + " has non-void return type");
- }
- } catch(NoSuchMethodException E) {
- }
- }
- } else if(setIndexName != null) {
- Method[] m = beanClass.getMethods();
- for(int i=0;i<m.length;i++) {
- Method current = m[i];
- if(current.getName().equals(setIndexName)
- && current.getParameterTypes().length == 2
- && (current.getParameterTypes()[0]).equals(java.lang.Integer.TYPE)
- && current.getReturnType().equals(java.lang.Void.TYPE)) {
- if(setIndex != null) {
- throw new IntrospectionException("Multiple, different set methods found that fit the bill!");
- } else {
- setIndex = current;
- indexedPropertyType = current.getParameterTypes()[1];
- }
- }
- }
- if(setIndex == null) {
- throw new IntrospectionException("Cannot find get or set methods.");
- }
- } else {
- throw new IntrospectionException("Cannot find get or set methods.");
- }
+ /**
+ * Sets the method that is used to write an indexed property.
+ *
+ * @param m the method to set
+ */
+ public void setIndexedWriteMethod(Method m) throws IntrospectionException
+ {
+ setIndex = m;
+ }
- Class arrayType = Array.newInstance(indexedPropertyType,0).getClass();
+ private void findMethods(Class beanClass, String getMethodName,
+ String setMethodName, String getIndexName,
+ String setIndexName)
+ throws IntrospectionException
+ {
+ try
+ {
+ if(getIndexName != null)
+ {
+ try
+ {
+ Class[] getArgs = new Class[1];
+ getArgs[0] = java.lang.Integer.TYPE;
+ getIndex = beanClass.getMethod(getIndexName,getArgs);
+ indexedPropertyType = getIndex.getReturnType();
+ }
+ catch(NoSuchMethodException E)
+ {
+ }
+ }
+ if(getIndex != null)
+ {
+ if(setIndexName != null)
+ {
+ try
+ {
+ Class[] setArgs = new Class[2];
+ setArgs[0] = java.lang.Integer.TYPE;
+ setArgs[1] = indexedPropertyType;
+ setIndex = beanClass.getMethod(setIndexName,setArgs);
+ if(!setIndex.getReturnType().equals(java.lang.Void.TYPE))
+ {
+ throw new IntrospectionException(setIndexName
+ + " has non-void return type");
+ }
+ }
+ catch(NoSuchMethodException E)
+ {
+ }
+ }
+ }
+ else if(setIndexName != null)
+ {
+ Method[] m = beanClass.getMethods();
+ for(int i=0;i<m.length;i++)
+ {
+ Method current = m[i];
+ if(current.getName().equals(setIndexName)
+ && current.getParameterTypes().length == 2
+ && (current.getParameterTypes()[0])
+ .equals(java.lang.Integer.TYPE)
+ && current.getReturnType().equals(java.lang.Void.TYPE))
+ {
+ if(setIndex != null)
+ {
+ throw new IntrospectionException("Multiple, different "
+ + "set methods found that fit the bill!");
+ }
+ else
+ {
+ setIndex = current;
+ indexedPropertyType = current.getParameterTypes()[1];
+ }
+ }
+ }
+ if(setIndex == null)
+ {
+ throw new IntrospectionException("Cannot find get or set "
+ + "methods.");
+ }
+ }
+ else
+ {
+ throw new IntrospectionException("Cannot find get or set methods.");
+ }
- Class[] setArgs = new Class[1];
- setArgs[0] = arrayType;
- try {
- setMethod = beanClass.getMethod(setMethodName,setArgs);
- if(!setMethod.getReturnType().equals(java.lang.Void.TYPE)) {
- setMethod = null;
- }
- } catch(NoSuchMethodException E) {
- }
+ Class arrayType = Array.newInstance(indexedPropertyType,0).getClass();
- Class[] getArgs = new Class[0];
- try {
- getMethod = beanClass.getMethod(getMethodName,getArgs);
- if(!getMethod.getReturnType().equals(arrayType)) {
- getMethod = null;
- }
- } catch(NoSuchMethodException E) {
- }
- } catch(SecurityException E) {
- throw new IntrospectionException("SecurityException while trying to find methods.");
- }
- }
+ Class[] setArgs = new Class[1];
+ setArgs[0] = arrayType;
+ try
+ {
+ setMethod = beanClass.getMethod(setMethodName,setArgs);
+ if (!setMethod.getReturnType().equals(java.lang.Void.TYPE))
+ {
+ setMethod = null;
+ }
+ }
+ catch(NoSuchMethodException E)
+ {
+ }
+
+ Class[] getArgs = new Class[0];
+ try
+ {
+ getMethod = beanClass.getMethod(getMethodName,getArgs);
+ if (!getMethod.getReturnType().equals(arrayType))
+ {
+ getMethod = null;
+ }
+ }
+ catch(NoSuchMethodException E)
+ {
+ }
+ }
+ catch(SecurityException E)
+ {
+ throw new IntrospectionException("SecurityException while trying to "
+ + "find methods.");
+ }
+ }
}
diff --git a/libjava/classpath/java/beans/PropertyDescriptor.java b/libjava/classpath/java/beans/PropertyDescriptor.java
index 416d468576f..a22d6252e28 100644
--- a/libjava/classpath/java/beans/PropertyDescriptor.java
+++ b/libjava/classpath/java/beans/PropertyDescriptor.java
@@ -61,7 +61,6 @@ import java.lang.reflect.Method;
** @since 1.1
** @status updated to 1.4
**/
-
public class PropertyDescriptor extends FeatureDescriptor
{
Class propertyType;
@@ -521,6 +520,22 @@ public class PropertyDescriptor extends FeatureDescriptor
return newPropertyType;
}
+ /**
+ * Return a hash code for this object, conforming to the contract described
+ * in {@link Object#hashCode()}.
+ * @return the hash code
+ * @since 1.5
+ */
+ public int hashCode()
+ {
+ return ((propertyType == null ? 0 : propertyType.hashCode())
+ | (propertyEditorClass == null ? 0 : propertyEditorClass.hashCode())
+ | (bound ? Boolean.TRUE : Boolean.FALSE).hashCode()
+ | (constrained ? Boolean.TRUE : Boolean.FALSE).hashCode()
+ | (getMethod == null ? 0 : getMethod.hashCode())
+ | (setMethod == null ? 0 : setMethod.hashCode()));
+ }
+
/** Compares this <code>PropertyDescriptor</code> against the
* given object.
* Two PropertyDescriptors are equals if
diff --git a/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java b/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java
index b7c4a49d8a9..5455adbaec3 100644
--- a/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java
+++ b/libjava/classpath/java/beans/beancontext/BeanContextServicesSupport.java
@@ -61,7 +61,7 @@ public class BeanContextServicesSupport
protected class BCSSChild
extends BeanContextSupport.BCSChild
{
- private static final long serialVersionUID = -6848044915271367103L;
+ private static final long serialVersionUID = -3263851306889194873L;
}
protected class BCSSProxyServiceProvider
diff --git a/libjava/classpath/java/beans/beancontext/BeanContextSupport.java b/libjava/classpath/java/beans/beancontext/BeanContextSupport.java
index 7e024e23a13..60ccc3af3e4 100644
--- a/libjava/classpath/java/beans/beancontext/BeanContextSupport.java
+++ b/libjava/classpath/java/beans/beancontext/BeanContextSupport.java
@@ -79,7 +79,7 @@ public class BeanContextSupport extends BeanContextChildSupport
protected class BCSChild implements Serializable
{
- private static final long serialVersionUID = 3289144128843950629L;
+ private static final long serialVersionUID = -5815286101609939109L;
}
protected static final class BCSIterator implements Iterator
diff --git a/libjava/classpath/java/io/ByteArrayOutputStream.java b/libjava/classpath/java/io/ByteArrayOutputStream.java
index e996ebbc70f..4196523d28e 100644
--- a/libjava/classpath/java/io/ByteArrayOutputStream.java
+++ b/libjava/classpath/java/io/ByteArrayOutputStream.java
@@ -1,5 +1,6 @@
/* BufferedReader.java
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -192,7 +193,7 @@ public class ByteArrayOutputStream extends OutputStream
*/
public String toString (int hibyte)
{
- return new String (buf, 0, count, hibyte);
+ return new String (buf, hibyte, 0, count);
}
// Resize buffer to accommodate new bytes.
diff --git a/libjava/classpath/java/io/DataOutputStream.java b/libjava/classpath/java/io/DataOutputStream.java
index 39f7ed1ff24..25178160dc8 100644
--- a/libjava/classpath/java/io/DataOutputStream.java
+++ b/libjava/classpath/java/io/DataOutputStream.java
@@ -302,7 +302,7 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
*
* @exception IOException If an error occurs
*
- * @see writeInt
+ * @see #writeInt(int)
* @see DataInput#readFloat
* @see Float#floatToIntBits
*/
@@ -326,7 +326,7 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
*
* @exception IOException If an error occurs
*
- * @see writeLong
+ * @see #writeLong(long)
* @see DataInput#readDouble
* @see Double#doubleToLongBits
*/
@@ -363,7 +363,7 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
*
* @exception IOException If an error occurs
*
- * @see writeChar
+ * @see #writeChar(char)
*/
public final void writeChars (String value) throws IOException
{
diff --git a/libjava/classpath/java/io/File.java b/libjava/classpath/java/io/File.java
index 3b747e6bd03..3c7ac21301c 100644
--- a/libjava/classpath/java/io/File.java
+++ b/libjava/classpath/java/io/File.java
@@ -100,6 +100,17 @@ public class File implements Serializable, Comparable
* may be an absolute or relative path name.
*/
private String path;
+
+
+ /**
+ * The time (millisecond), when the last temporary file was created.
+ */
+ private static long last_tmp;
+
+ /**
+ * The number of files, created during the current millisecond.
+ */
+ private static int n_created;
/**
* This method tests whether or not the current thread is allowed to
@@ -446,6 +457,8 @@ public class File implements Serializable, Comparable
else
return drvDir;
}
+ else if (path.equals(""))
+ return System.getProperty ("user.dir");
else
return System.getProperty ("user.dir") + separatorChar + path;
}
@@ -532,6 +545,9 @@ public class File implements Serializable, Comparable
{
String prefix = null;
int nameSeqIndex = 0;
+
+ if (path.equals(""))
+ return null;
// The "prefix", if present, is the leading "/" on UNIX and
// either the drive specifier (e.g. "C:") or the leading "\\"
@@ -943,8 +959,8 @@ public class File implements Serializable, Comparable
public URI toURI()
{
String abspath = getAbsolutePath();
-
- if (isDirectory())
+
+ if (isDirectory() || path.equals(""))
abspath = abspath + separatorChar;
if (separatorChar == '\\')
@@ -1059,7 +1075,7 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
- public static File createTempFile(String prefix, String suffix,
+ public static synchronized File createTempFile(String prefix, String suffix,
File directory)
throws IOException
{
@@ -1091,10 +1107,23 @@ public class File implements Serializable, Comparable
// Now identify a file name and make sure it doesn't exist.
File file;
if (!VMFile.IS_DOS_8_3)
- {
+ {
do
{
- String filename = prefix + System.currentTimeMillis() + suffix;
+ long now = System.currentTimeMillis();
+ if (now > last_tmp)
+ {
+ // The last temporary file was created more than 1 ms ago.
+ last_tmp = now;
+ n_created = 0;
+ }
+ else
+ n_created++;
+
+ String name = Long.toHexString(now);
+ if (n_created > 0)
+ name += '_'+Integer.toHexString(n_created);
+ String filename = prefix + name + suffix;
file = new File(directory, filename);
}
while (VMFile.exists(file.path));
diff --git a/libjava/classpath/java/io/FilePermission.java b/libjava/classpath/java/io/FilePermission.java
index 356787bfa72..31802c631d6 100644
--- a/libjava/classpath/java/io/FilePermission.java
+++ b/libjava/classpath/java/io/FilePermission.java
@@ -278,13 +278,13 @@ public final class FilePermission extends Permission implements Serializable
break;
}
- if (readPerm && ! fp.readPerm)
+ if (fp.readPerm && ! readPerm)
return false;
- if (writePerm && ! fp.writePerm)
+ if (fp.writePerm && ! writePerm)
return false;
- if (executePerm && ! fp.executePerm)
+ if (fp.executePerm && ! executePerm)
return false;
- if (deletePerm && ! fp.deletePerm)
+ if (fp.deletePerm && ! deletePerm)
return false;
return true;
diff --git a/libjava/classpath/java/io/FileWriter.java b/libjava/classpath/java/io/FileWriter.java
index b34db83231e..ce18efe5e39 100644
--- a/libjava/classpath/java/io/FileWriter.java
+++ b/libjava/classpath/java/io/FileWriter.java
@@ -119,7 +119,7 @@ public class FileWriter extends OutputStreamWriter
* This method intializes a new <code>FileWriter</code> object to
* write to the
* specified named file. This form of the constructor allows the caller
- * to determin whether data should be written starting at the beginning or
+ * to determine whether data should be written starting at the beginning or
* the end of the file.
*
* @param name The name of the file to write to
diff --git a/libjava/classpath/java/io/FilterReader.java b/libjava/classpath/java/io/FilterReader.java
index 2bd040a7f72..1abaa8a4b68 100644
--- a/libjava/classpath/java/io/FilterReader.java
+++ b/libjava/classpath/java/io/FilterReader.java
@@ -131,7 +131,7 @@ public abstract class FilterReader extends Reader
/**
* Calls the <code>in.skip(long)</code> method
*
- * @param numBytes The requested number of chars to skip.
+ * @param num_chars The requested number of chars to skip.
*
* @return The value returned from <code>in.skip(long)</code>
*
diff --git a/libjava/classpath/java/io/InputStreamReader.java b/libjava/classpath/java/io/InputStreamReader.java
index 315af83e1a4..57cdc53ed22 100644
--- a/libjava/classpath/java/io/InputStreamReader.java
+++ b/libjava/classpath/java/io/InputStreamReader.java
@@ -38,16 +38,14 @@ exception statement from your version. */
package java.io;
-import java.nio.charset.UnsupportedCharsetException;
-import java.nio.charset.CharacterCodingException;
-import java.nio.charset.IllegalCharsetNameException;
-import java.nio.charset.CoderResult;
-import java.nio.charset.CodingErrorAction;
+import gnu.java.nio.charset.EncodingHelper;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
-import gnu.java.nio.charset.EncodingHelper;
+import java.nio.charset.CoderResult;
+import java.nio.charset.CodingErrorAction;
/**
* This class reads characters from a byte input stream. The characters
@@ -251,8 +249,12 @@ public class InputStreamReader extends Reader
this.in = in;
this.decoder = decoder;
+ Charset charset = decoder.charset();
try {
- maxBytesPerChar = decoder.charset().newEncoder().maxBytesPerChar();
+ if (charset == null)
+ maxBytesPerChar = 1f;
+ else
+ maxBytesPerChar = charset.newEncoder().maxBytesPerChar();
} catch(UnsupportedOperationException _){
maxBytesPerChar = 1f;
}
@@ -260,7 +262,10 @@ public class InputStreamReader extends Reader
decoder.onMalformedInput(CodingErrorAction.REPLACE);
decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
decoder.reset();
- encoding = EncodingHelper.getOldCanonical(decoder.charset().name());
+ if (charset == null)
+ encoding = "US-ASCII";
+ else
+ encoding = EncodingHelper.getOldCanonical(decoder.charset().name());
}
/**
diff --git a/libjava/classpath/java/io/LineNumberReader.java b/libjava/classpath/java/io/LineNumberReader.java
index ea418a5e4d6..5e263f76111 100644
--- a/libjava/classpath/java/io/LineNumberReader.java
+++ b/libjava/classpath/java/io/LineNumberReader.java
@@ -115,7 +115,7 @@ public class LineNumberReader extends BufferedReader
/**
* This method sets the current line number to the specified value.
*
- * @param line_number The new line number
+ * @param lineNumber The new line number
*/
public void setLineNumber(int lineNumber)
{
@@ -139,7 +139,7 @@ public class LineNumberReader extends BufferedReader
* is called, the line number will be restored to the saved line number in
* addition to the stream position.
*
- * @param readlimit The number of chars that can be read before the
+ * @param readLimit The number of chars that can be read before the
* mark becomes invalid
*
* @exception IOException If an error occurs
@@ -269,7 +269,7 @@ public class LineNumberReader extends BufferedReader
*
* @param buf The array into which the chars read should be stored
* @param offset The offset into the array to start storing chars
- * @param len The requested number of chars to read
+ * @param count The requested number of chars to read
*
* @return The actual number of chars read, or -1 if end of stream
*
diff --git a/libjava/classpath/java/io/ObjectInputStream.java b/libjava/classpath/java/io/ObjectInputStream.java
index 54d5eeafadd..98a11dae3e1 100644
--- a/libjava/classpath/java/io/ObjectInputStream.java
+++ b/libjava/classpath/java/io/ObjectInputStream.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.io;
-import gnu.classpath.Configuration;
import gnu.java.io.ObjectIdentityWrapper;
import java.lang.reflect.Array;
@@ -53,6 +52,8 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.TreeSet;
import java.util.Vector;
public class ObjectInputStream extends InputStream
@@ -91,7 +92,6 @@ public class ObjectInputStream extends InputStream
}
this.resolveEnabled = false;
- this.isDeserializing = false;
this.blockDataPosition = 0;
this.blockDataBytes = 0;
this.blockData = new byte[BUFFER_SIZE];
@@ -99,7 +99,6 @@ public class ObjectInputStream extends InputStream
this.realInputStream = new DataInputStream(in);
this.nextOID = baseWireHandle;
this.objectLookupTable = new Hashtable();
- this.validators = new Vector();
this.classLookupTable = new Hashtable();
setBlockDataMode(true);
readStreamHeader();
@@ -113,7 +112,10 @@ public class ObjectInputStream extends InputStream
* <code>private void readObject (ObjectInputStream)</code>.
*
* If an exception is thrown from this method, the stream is left in
- * an undefined state.
+ * an undefined state. This method can also throw Errors and
+ * RuntimeExceptions if caused by existing readResolve() user code.
+ *
+ * @return The object read from the underlying stream.
*
* @exception ClassNotFoundException The class that an object being
* read in belongs to cannot be found.
@@ -121,291 +123,312 @@ public class ObjectInputStream extends InputStream
* @exception IOException Exception from underlying
* <code>InputStream</code>.
*/
- public final Object readObject() throws ClassNotFoundException, IOException
+ public final Object readObject()
+ throws ClassNotFoundException, IOException
{
if (this.useSubclassMethod)
return readObjectOverride();
- boolean was_deserializing;
-
Object ret_val;
- was_deserializing = this.isDeserializing;
-
- boolean is_consumed = false;
boolean old_mode = setBlockDataMode(false);
-
- this.isDeserializing = true;
-
byte marker = this.realInputStream.readByte();
- depth += 2;
+ if (DEBUG)
+ depth += 2;
if(dump) dumpElement("MARKER: 0x" + Integer.toHexString(marker) + " ");
try
{
- switch (marker)
- {
- case TC_ENDBLOCKDATA:
- {
- ret_val = null;
- is_consumed = true;
- break;
- }
-
- case TC_BLOCKDATA:
- case TC_BLOCKDATALONG:
- {
- if (marker == TC_BLOCKDATALONG)
- { if(dump) dumpElementln("BLOCKDATALONG"); }
- else
- { if(dump) dumpElementln("BLOCKDATA"); }
- readNextBlock(marker);
- throw new StreamCorruptedException("Unexpected blockData");
- }
-
- case TC_NULL:
- {
- if(dump) dumpElementln("NULL");
- ret_val = null;
- break;
- }
-
- case TC_REFERENCE:
- {
- if(dump) dumpElement("REFERENCE ");
- Integer oid = new Integer(this.realInputStream.readInt());
- if(dump) dumpElementln(Integer.toHexString(oid.intValue()));
- ret_val = ((ObjectIdentityWrapper)
- this.objectLookupTable.get(oid)).object;
- break;
- }
-
- case TC_CLASS:
- {
- if(dump) dumpElementln("CLASS");
- ObjectStreamClass osc = (ObjectStreamClass)readObject();
- Class clazz = osc.forClass();
- assignNewHandle(clazz);
- ret_val = clazz;
- break;
- }
+ ret_val = parseContent(marker);
+ }
+ finally
+ {
+ setBlockDataMode(old_mode);
+ if (DEBUG)
+ depth -= 2;
+ }
+
+ return ret_val;
+ }
- case TC_PROXYCLASSDESC:
+ /**
+ * Handles a content block within the stream, which begins with a marker
+ * byte indicating its type.
+ *
+ * @param marker the byte marker.
+ * @return an object which represents the parsed content.
+ * @throws ClassNotFoundException if the class of an object being
+ * read in cannot be found.
+ * @throws IOException if invalid data occurs or one is thrown by the
+ * underlying <code>InputStream</code>.
+ */
+ private Object parseContent(byte marker)
+ throws ClassNotFoundException, IOException
+ {
+ Object ret_val;
+ boolean is_consumed = false;
+
+ switch (marker)
+ {
+ case TC_ENDBLOCKDATA:
+ {
+ ret_val = null;
+ is_consumed = true;
+ break;
+ }
+
+ case TC_BLOCKDATA:
+ case TC_BLOCKDATALONG:
+ {
+ if (marker == TC_BLOCKDATALONG)
+ { if(dump) dumpElementln("BLOCKDATALONG"); }
+ else
+ { if(dump) dumpElementln("BLOCKDATA"); }
+ readNextBlock(marker);
+ }
+
+ case TC_NULL:
+ {
+ if(dump) dumpElementln("NULL");
+ ret_val = null;
+ break;
+ }
+
+ case TC_REFERENCE:
+ {
+ if(dump) dumpElement("REFERENCE ");
+ Integer oid = new Integer(this.realInputStream.readInt());
+ if(dump) dumpElementln(Integer.toHexString(oid.intValue()));
+ ret_val = ((ObjectIdentityWrapper)
+ this.objectLookupTable.get(oid)).object;
+ break;
+ }
+
+ case TC_CLASS:
+ {
+ if(dump) dumpElementln("CLASS");
+ ObjectStreamClass osc = (ObjectStreamClass)readObject();
+ Class clazz = osc.forClass();
+ assignNewHandle(clazz);
+ ret_val = clazz;
+ break;
+ }
+
+ case TC_PROXYCLASSDESC:
+ {
+ if(dump) dumpElementln("PROXYCLASS");
+ int n_intf = this.realInputStream.readInt();
+ String[] intfs = new String[n_intf];
+ for (int i = 0; i < n_intf; i++)
+ {
+ intfs[i] = this.realInputStream.readUTF();
+ }
+
+ boolean oldmode = setBlockDataMode(true);
+ Class cl = resolveProxyClass(intfs);
+ setBlockDataMode(oldmode);
+
+ ObjectStreamClass osc = lookupClass(cl);
+ if (osc.firstNonSerializableParentConstructor == null)
+ {
+ osc.realClassIsSerializable = true;
+ osc.fields = osc.fieldMapping = new ObjectStreamField[0];
+ try
+ {
+ osc.firstNonSerializableParentConstructor =
+ Object.class.getConstructor(new Class[0]);
+ }
+ catch (NoSuchMethodException x)
+ {
+ throw (InternalError)
+ new InternalError("Object ctor missing").initCause(x);
+ }
+ }
+ assignNewHandle(osc);
+
+ if (!is_consumed)
+ {
+ byte b = this.realInputStream.readByte();
+ if (b != TC_ENDBLOCKDATA)
+ throw new IOException("Data annotated to class was not consumed." + b);
+ }
+ else
+ is_consumed = false;
+ ObjectStreamClass superosc = (ObjectStreamClass)readObject();
+ osc.setSuperclass(superosc);
+ ret_val = osc;
+ break;
+ }
+
+ case TC_CLASSDESC:
+ {
+ ObjectStreamClass osc = readClassDescriptor();
+
+ if (!is_consumed)
+ {
+ byte b = this.realInputStream.readByte();
+ if (b != TC_ENDBLOCKDATA)
+ throw new IOException("Data annotated to class was not consumed." + b);
+ }
+ else
+ is_consumed = false;
+
+ osc.setSuperclass ((ObjectStreamClass)readObject());
+ ret_val = osc;
+ break;
+ }
+
+ case TC_STRING:
+ case TC_LONGSTRING:
+ {
+ if(dump) dumpElement("STRING=");
+ String s = this.realInputStream.readUTF();
+ if(dump) dumpElementln(s);
+ ret_val = processResolution(null, s, assignNewHandle(s));
+ break;
+ }
+
+ case TC_ARRAY:
+ {
+ if(dump) dumpElementln("ARRAY");
+ ObjectStreamClass osc = (ObjectStreamClass)readObject();
+ Class componentType = osc.forClass().getComponentType();
+ if(dump) dumpElement("ARRAY LENGTH=");
+ int length = this.realInputStream.readInt();
+ if(dump) dumpElementln (length + "; COMPONENT TYPE=" + componentType);
+ Object array = Array.newInstance(componentType, length);
+ int handle = assignNewHandle(array);
+ readArrayElements(array, componentType);
+ if(dump)
+ for (int i = 0, len = Array.getLength(array); i < len; i++)
+ dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i));
+ ret_val = processResolution(null, array, handle);
+ break;
+ }
+
+ case TC_OBJECT:
+ {
+ if(dump) dumpElementln("OBJECT");
+ ObjectStreamClass osc = (ObjectStreamClass)readObject();
+ Class clazz = osc.forClass();
+
+ if (!osc.realClassIsSerializable)
+ throw new NotSerializableException
+ (clazz + " is not Serializable, and thus cannot be deserialized.");
+
+ if (osc.realClassIsExternalizable)
{
- if(dump) dumpElementln("PROXYCLASS");
- int n_intf = this.realInputStream.readInt();
- String[] intfs = new String[n_intf];
- for (int i = 0; i < n_intf; i++)
- {
- intfs[i] = this.realInputStream.readUTF();
- System.out.println(intfs[i]);
- }
+ Externalizable obj = osc.newInstance();
- boolean oldmode = setBlockDataMode(true);
- Class cl = resolveProxyClass(intfs);
- setBlockDataMode(oldmode);
+ int handle = assignNewHandle(obj);
- ObjectStreamClass osc = lookupClass(cl);
- assignNewHandle(osc);
+ boolean read_from_blocks = ((osc.getFlags() & SC_BLOCK_DATA) != 0);
- if (!is_consumed)
- {
- byte b = this.realInputStream.readByte();
- if (b != TC_ENDBLOCKDATA)
- throw new IOException("Data annotated to class was not consumed." + b);
- }
- else
- is_consumed = false;
- ObjectStreamClass superosc = (ObjectStreamClass)readObject();
- osc.setSuperclass(superosc);
- ret_val = osc;
- break;
- }
-
- case TC_CLASSDESC:
- {
- ObjectStreamClass osc = readClassDescriptor();
+ boolean oldmode = this.readDataFromBlock;
+ if (read_from_blocks)
+ setBlockDataMode(true);
- if (!is_consumed)
- {
- byte b = this.realInputStream.readByte();
- if (b != TC_ENDBLOCKDATA)
- throw new IOException("Data annotated to class was not consumed." + b);
+ obj.readExternal(this);
+
+ if (read_from_blocks)
+ {
+ setBlockDataMode(oldmode);
+ if (!oldmode)
+ if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
+ throw new IOException("No end of block data seen for class with readExternal (ObjectInputStream) method.");
}
- else
- is_consumed = false;
-
- osc.setSuperclass ((ObjectStreamClass)readObject());
- ret_val = osc;
- break;
- }
-
- case TC_STRING:
- case TC_LONGSTRING:
- {
- if(dump) dumpElement("STRING=");
- String s = this.realInputStream.readUTF();
- if(dump) dumpElementln(s);
- ret_val = processResolution(null, s, assignNewHandle(s));
- break;
- }
-
- case TC_ARRAY:
- {
- if(dump) dumpElementln("ARRAY");
- ObjectStreamClass osc = (ObjectStreamClass)readObject();
- Class componentType = osc.forClass().getComponentType();
- if(dump) dumpElement("ARRAY LENGTH=");
- int length = this.realInputStream.readInt();
- if(dump) dumpElementln (length + "; COMPONENT TYPE=" + componentType);
- Object array = Array.newInstance(componentType, length);
- int handle = assignNewHandle(array);
- readArrayElements(array, componentType);
- if(dump)
- for (int i = 0, len = Array.getLength(array); i < len; i++)
- dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i));
- ret_val = processResolution(null, array, handle);
- break;
- }
-
- case TC_OBJECT:
- {
- if(dump) dumpElementln("OBJECT");
- ObjectStreamClass osc = (ObjectStreamClass)readObject();
- Class clazz = osc.forClass();
-
- if (!osc.realClassIsSerializable)
- throw new NotSerializableException
- (clazz + " is not Serializable, and thus cannot be deserialized.");
-
- if (osc.realClassIsExternalizable)
- {
- Externalizable obj = osc.newInstance();
-
- int handle = assignNewHandle(obj);
-
- boolean read_from_blocks = ((osc.getFlags() & SC_BLOCK_DATA) != 0);
-
- boolean oldmode = this.readDataFromBlock;
- if (read_from_blocks)
- setBlockDataMode(true);
-
- obj.readExternal(this);
-
- if (read_from_blocks)
- {
- setBlockDataMode(oldmode);
- if (!oldmode)
- if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
- throw new IOException("No end of block data seen for class with readExternal (ObjectInputStream) method.");
- }
-
- ret_val = processResolution(osc, obj, handle);
- break;
- } // end if (osc.realClassIsExternalizable)
- Object obj = newObject(clazz, osc.firstNonSerializableParentConstructor);
-
- int handle = assignNewHandle(obj);
- Object prevObject = this.currentObject;
- ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
-
- this.currentObject = obj;
- ObjectStreamClass[] hierarchy =
- inputGetObjectStreamClasses(clazz);
+ ret_val = processResolution(osc, obj, handle);
+ break;
- for (int i = 0; i < hierarchy.length; i++)
- {
- this.currentObjectStreamClass = hierarchy[i];
-
- if(dump) dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
-
- // XXX: should initialize fields in classes in the hierarchy
- // that aren't in the stream
- // should skip over classes in the stream that aren't in the
- // real classes hierarchy
-
- Method readObjectMethod = this.currentObjectStreamClass.readObjectMethod;
- if (readObjectMethod != null)
- {
- fieldsAlreadyRead = false;
- boolean oldmode = setBlockDataMode(true);
- callReadMethod(readObjectMethod, this.currentObjectStreamClass.forClass(), obj);
- setBlockDataMode(oldmode);
- }
- else
- {
- readFields(obj, currentObjectStreamClass);
- }
-
- if (this.currentObjectStreamClass.hasWriteMethod())
- {
- if(dump) dumpElement("ENDBLOCKDATA? ");
- try
- {
- // FIXME: XXX: This try block is to
- // catch EOF which is thrown for some
- // objects. That indicates a bug in
- // the logic.
-
- if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
- throw new IOException
- ("No end of block data seen for class with readObject (ObjectInputStream) method.");
- if(dump) dumpElementln("yes");
- }
-// catch (EOFException e)
-// {
-// if(dump) dumpElementln("no, got EOFException");
-// }
- catch (IOException e)
- {
- if(dump) dumpElementln("no, got IOException");
+ } // end if (osc.realClassIsExternalizable)
+
+ Object obj = newObject(clazz, osc.firstNonSerializableParentConstructor);
+
+ int handle = assignNewHandle(obj);
+ Object prevObject = this.currentObject;
+ ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
+ TreeSet prevObjectValidators = this.currentObjectValidators;
+
+ this.currentObject = obj;
+ this.currentObjectValidators = null;
+ ObjectStreamClass[] hierarchy =
+ inputGetObjectStreamClasses(clazz);
+
+ for (int i = 0; i < hierarchy.length; i++)
+ {
+ this.currentObjectStreamClass = hierarchy[i];
+ if(dump) dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
+
+ // XXX: should initialize fields in classes in the hierarchy
+ // that aren't in the stream
+ // should skip over classes in the stream that aren't in the
+ // real classes hierarchy
+
+ Method readObjectMethod = this.currentObjectStreamClass.readObjectMethod;
+ if (readObjectMethod != null)
+ {
+ fieldsAlreadyRead = false;
+ boolean oldmode = setBlockDataMode(true);
+ callReadMethod(readObjectMethod, this.currentObjectStreamClass.forClass(), obj);
+ setBlockDataMode(oldmode);
+ }
+ else
+ {
+ readFields(obj, currentObjectStreamClass);
+ }
+
+ if (this.currentObjectStreamClass.hasWriteMethod())
+ {
+ if(dump) dumpElement("ENDBLOCKDATA? ");
+ try
+ {
+ /* Read blocks until an end marker */
+ byte writeMarker = this.realInputStream.readByte();
+ while (writeMarker != TC_ENDBLOCKDATA)
+ {
+ parseContent(writeMarker);
+ writeMarker = this.realInputStream.readByte();
}
+ if(dump) dumpElementln("yes");
+ }
+ catch (EOFException e)
+ {
+ throw (IOException) new IOException
+ ("No end of block data seen for class with readObject (ObjectInputStream) method.").initCause(e);
}
}
-
- this.currentObject = prevObject;
- this.currentObjectStreamClass = prevObjectStreamClass;
- ret_val = processResolution(osc, obj, handle);
-
- break;
- }
-
- case TC_RESET:
- if(dump) dumpElementln("RESET");
- clearHandles();
- ret_val = readObject();
- break;
-
- case TC_EXCEPTION:
- {
- if(dump) dumpElement("EXCEPTION=");
- Exception e = (Exception)readObject();
- if(dump) dumpElementln(e.toString());
- clearHandles();
- throw new WriteAbortedException("Exception thrown during writing of stream", e);
}
-
- default:
- throw new IOException("Unknown marker on stream: " + marker);
- }
- }
- finally
- {
- setBlockDataMode(old_mode);
+
+ this.currentObject = prevObject;
+ this.currentObjectStreamClass = prevObjectStreamClass;
+ ret_val = processResolution(osc, obj, handle);
+ if (currentObjectValidators != null)
+ invokeValidators();
+ this.currentObjectValidators = prevObjectValidators;
+
+ break;
+ }
- this.isDeserializing = was_deserializing;
+ case TC_RESET:
+ if(dump) dumpElementln("RESET");
+ clearHandles();
+ ret_val = readObject();
+ break;
- depth -= 2;
+ case TC_EXCEPTION:
+ {
+ if(dump) dumpElement("EXCEPTION=");
+ Exception e = (Exception)readObject();
+ if(dump) dumpElementln(e.toString());
+ clearHandles();
+ throw new WriteAbortedException("Exception thrown during writing of stream", e);
+ }
- if (! was_deserializing)
- {
- if (validators.size() > 0)
- invokeValidators();
- }
+ default:
+ throw new IOException("Unknown marker on stream: " + marker);
}
-
return ret_val;
}
@@ -716,8 +739,10 @@ public class ObjectInputStream extends InputStream
throw new InvalidObjectException("attempt to add a null "
+ "ObjectInputValidation object");
- this.validators.addElement(new ValidatorAndPriority (validator,
- priority));
+ if (currentObjectValidators == null)
+ currentObjectValidators = new TreeSet();
+
+ currentObjectValidators.add(new ValidatorAndPriority(validator, priority));
}
@@ -805,7 +830,7 @@ public class ObjectInputStream extends InputStream
/**
* Reconstruct class hierarchy the same way
- * {@link java.io.ObjectStreamClass.getObjectStreamClasses(java.lang.Class)} does
+ * {@link java.io.ObjectStreamClass#getObjectStreamClasses(Class)} does
* but using lookupClass instead of ObjectStreamClass.lookup. This
* dup is necessary localize the lookup table. Hopefully some future
* rewritings will be able to prevent this.
@@ -874,7 +899,7 @@ public class ObjectInputStream extends InputStream
}
else
for (int i = 0; i < intfs.length; i++)
- clss[i] = cl.loadClass(intfs[i]);
+ clss[i] = Class.forName(intfs[i], false, cl);
try
{
return Proxy.getProxyClass(cl, clss);
@@ -1195,7 +1220,7 @@ public class ObjectInputStream extends InputStream
* This method should be called by a method called 'readObject' in the
* deserializing class (if present). It cannot (and should not)be called
* outside of it. Its goal is to read all fields in the real input stream
- * and keep them accessible through the {@link #GetField} class. Calling
+ * and keep them accessible through the {@link GetField} class. Calling
* this method will not alter the deserializing object.
*
* @return A valid freshly created 'GetField' instance to get access to
@@ -1543,8 +1568,15 @@ public class ObjectInputStream extends InputStream
catch (IllegalAccessException ignore)
{
}
- catch (InvocationTargetException ignore)
+ catch (InvocationTargetException exception)
{
+ Throwable cause = exception.getCause();
+ if (cause instanceof ObjectStreamException)
+ throw (ObjectStreamException) cause;
+ else if (cause instanceof RuntimeException)
+ throw (RuntimeException) cause;
+ else if (cause instanceof Error)
+ throw (Error) cause;
}
}
@@ -1821,18 +1853,19 @@ public class ObjectInputStream extends InputStream
// on OBJ
private void invokeValidators() throws InvalidObjectException
{
- Object[] validators = new Object[this.validators.size()];
- this.validators.copyInto (validators);
- Arrays.sort (validators);
-
try
{
- for (int i=0; i < validators.length; i++)
- ((ObjectInputValidation)validators[i]).validateObject();
+ Iterator it = currentObjectValidators.iterator();
+ while(it.hasNext())
+ {
+ ValidatorAndPriority vap = (ValidatorAndPriority) it.next();
+ ObjectInputValidation validator = vap.validator;
+ validator.validateObject();
+ }
}
finally
{
- this.validators.removeAllElements();
+ currentObjectValidators = null;
}
}
@@ -1881,10 +1914,9 @@ public class ObjectInputStream extends InputStream
private Hashtable objectLookupTable;
private Object currentObject;
private ObjectStreamClass currentObjectStreamClass;
+ private TreeSet currentObjectValidators;
private boolean readDataFromBlock;
- private boolean isDeserializing;
private boolean fieldsAlreadyRead;
- private Vector validators;
private Hashtable classLookupTable;
private GetField prereadFields;
@@ -1908,14 +1940,6 @@ public class ObjectInputStream extends InputStream
System.out.print (Thread.currentThread() + ": ");
}
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary ("javaio");
- }
- }
-
// used to keep a prioritized list of object validators
private static final class ValidatorAndPriority implements Comparable
{
diff --git a/libjava/classpath/java/io/ObjectOutputStream.java b/libjava/classpath/java/io/ObjectOutputStream.java
index 5e754c5ec7a..573b9cfa1de 100644
--- a/libjava/classpath/java/io/ObjectOutputStream.java
+++ b/libjava/classpath/java/io/ObjectOutputStream.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.io;
-import gnu.classpath.Configuration;
import gnu.java.io.ObjectIdentityWrapper;
import gnu.java.lang.reflect.TypeSignature;
import gnu.java.security.action.SetAccessibleAction;
@@ -362,7 +361,9 @@ public class ObjectOutputStream extends OutputStream
break;
}
- throw new NotSerializableException(clazz.getName ());
+ throw new NotSerializableException(clazz.getName()
+ + " in "
+ + obj.getClass());
} // end pseudo-loop
}
catch (ObjectStreamException ose)
@@ -412,37 +413,53 @@ public class ObjectOutputStream extends OutputStream
protected void writeClassDescriptor(ObjectStreamClass osc) throws IOException
{
- realOutput.writeByte(TC_CLASSDESC);
- realOutput.writeUTF(osc.getName());
- realOutput.writeLong(osc.getSerialVersionUID());
- assignNewHandle(osc);
+ if (osc.isProxyClass)
+ {
+ realOutput.writeByte(TC_PROXYCLASSDESC);
+ Class[] intfs = osc.forClass().getInterfaces();
+ realOutput.writeInt(intfs.length);
+ for (int i = 0; i < intfs.length; i++)
+ realOutput.writeUTF(intfs[i].getName());
+
+ boolean oldmode = setBlockDataMode(true);
+ annotateProxyClass(osc.forClass());
+ setBlockDataMode(oldmode);
+ realOutput.writeByte(TC_ENDBLOCKDATA);
+ }
+ else
+ {
+ realOutput.writeByte(TC_CLASSDESC);
+ realOutput.writeUTF(osc.getName());
+ realOutput.writeLong(osc.getSerialVersionUID());
+ assignNewHandle(osc);
- int flags = osc.getFlags();
+ int flags = osc.getFlags();
- if (protocolVersion == PROTOCOL_VERSION_2
- && osc.isExternalizable())
- flags |= SC_BLOCK_DATA;
+ if (protocolVersion == PROTOCOL_VERSION_2
+ && osc.isExternalizable())
+ flags |= SC_BLOCK_DATA;
- realOutput.writeByte(flags);
+ realOutput.writeByte(flags);
- ObjectStreamField[] fields = osc.fields;
- realOutput.writeShort(fields.length);
+ ObjectStreamField[] fields = osc.fields;
+ realOutput.writeShort(fields.length);
- ObjectStreamField field;
- for (int i = 0; i < fields.length; i++)
- {
- field = fields[i];
- realOutput.writeByte(field.getTypeCode ());
- realOutput.writeUTF(field.getName ());
+ ObjectStreamField field;
+ for (int i = 0; i < fields.length; i++)
+ {
+ field = fields[i];
+ realOutput.writeByte(field.getTypeCode ());
+ realOutput.writeUTF(field.getName ());
- if (! field.isPrimitive())
- writeObject(field.getTypeString());
- }
+ if (! field.isPrimitive())
+ writeObject(field.getTypeString());
+ }
- boolean oldmode = setBlockDataMode(true);
- annotateClass(osc.forClass());
- setBlockDataMode(oldmode);
- realOutput.writeByte(TC_ENDBLOCKDATA);
+ boolean oldmode = setBlockDataMode(true);
+ annotateClass(osc.forClass());
+ setBlockDataMode(oldmode);
+ realOutput.writeByte(TC_ENDBLOCKDATA);
+ }
if (osc.isSerializable() || osc.isExternalizable())
writeObject(osc.getSuper());
@@ -531,7 +548,7 @@ public class ObjectOutputStream extends OutputStream
* version)</code> is provided to change the default protocol
* version.
*
- * For an explination of the differences beween the two protocols
+ * For an explanation of the differences between the two protocols
* see XXX: the Java ObjectSerialization Specification.
*
* @exception IOException if <code>version</code> is not a valid
@@ -1567,12 +1584,4 @@ public class ObjectOutputStream extends OutputStream
private boolean dump = false;
private static final boolean DEBUG = false;
-
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("javaio");
- }
- }
}
diff --git a/libjava/classpath/java/io/ObjectStreamClass.java b/libjava/classpath/java/io/ObjectStreamClass.java
index b7bd1271324..975dbfc66d0 100644
--- a/libjava/classpath/java/io/ObjectStreamClass.java
+++ b/libjava/classpath/java/io/ObjectStreamClass.java
@@ -514,14 +514,15 @@ outer:
{
Method res = c.getDeclaredMethod(name, noArgs);
int mods = res.getModifiers();
-
- if (c != from
- && (Modifier.isPrivate(mods)
- || ! Modifier.isPublic(mods) && ! inSamePackage(c, from)))
- continue;
-
- AccessController.doPrivileged(new SetAccessibleAction(res));
- return res;
+
+ if (c == from
+ || Modifier.isProtected(mods)
+ || Modifier.isPublic(mods)
+ || (! Modifier.isPrivate(mods) && inSamePackage(c, from)))
+ {
+ AccessController.doPrivileged(new SetAccessibleAction(res));
+ return res;
+ }
}
catch (NoSuchMethodException e)
{
diff --git a/libjava/classpath/java/io/ObjectStreamField.java b/libjava/classpath/java/io/ObjectStreamField.java
index 611457b3cfb..61ccdc7db76 100644
--- a/libjava/classpath/java/io/ObjectStreamField.java
+++ b/libjava/classpath/java/io/ObjectStreamField.java
@@ -208,7 +208,7 @@ public class ObjectStreamField implements Comparable
* This method sets the current offset of the field.
*
* @param off The offset of the field in bytes.
- * @see getOffset()
+ * @see #getOffset()
*/
protected void setOffset (int off)
{
diff --git a/libjava/classpath/java/io/OutputStreamWriter.java b/libjava/classpath/java/io/OutputStreamWriter.java
index ee229796cce..29fb631faf4 100644
--- a/libjava/classpath/java/io/OutputStreamWriter.java
+++ b/libjava/classpath/java/io/OutputStreamWriter.java
@@ -39,16 +39,14 @@ exception statement from your version. */
package java.io;
import gnu.java.nio.charset.EncodingHelper;
+
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
-import java.nio.charset.MalformedInputException;
-import java.nio.charset.UnsupportedCharsetException;
import java.nio.charset.CharacterCodingException;
-import java.nio.charset.IllegalCharsetNameException;
-import java.nio.charset.CoderResult;
-import java.nio.charset.CodingErrorAction;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CodingErrorAction;
+import java.nio.charset.MalformedInputException;
/**
* This class writes characters to an output stream that is byte oriented
@@ -124,52 +122,58 @@ public class OutputStreamWriter extends Writer
{
this.out = out;
try
- {
- // Don't use NIO if avoidable
- if(EncodingHelper.isISOLatin1(encoding_scheme))
{
- encodingName = "ISO8859_1";
- encoder = null;
- return;
- }
-
- /*
- * Workraround for encodings with a byte-order-mark.
- * We only want to write it once per stream.
- */
- try {
- if(encoding_scheme.equalsIgnoreCase("UnicodeBig") ||
- encoding_scheme.equalsIgnoreCase("UTF-16") ||
- encoding_scheme.equalsIgnoreCase("UTF16"))
- {
- encoding_scheme = "UTF-16BE";
- out.write((byte)0xFE);
- out.write((byte)0xFF);
- } else if(encoding_scheme.equalsIgnoreCase("UnicodeLittle")){
- encoding_scheme = "UTF-16LE";
- out.write((byte)0xFF);
- out.write((byte)0xFE);
- }
- } catch(IOException ioe){
- }
+ // Don't use NIO if avoidable
+ if(EncodingHelper.isISOLatin1(encoding_scheme))
+ {
+ encodingName = "ISO8859_1";
+ encoder = null;
+ return;
+ }
- outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
+ /*
+ * Workraround for encodings with a byte-order-mark.
+ * We only want to write it once per stream.
+ */
+ try
+ {
+ if(encoding_scheme.equalsIgnoreCase("UnicodeBig") ||
+ encoding_scheme.equalsIgnoreCase("UTF-16") ||
+ encoding_scheme.equalsIgnoreCase("UTF16"))
+ {
+ encoding_scheme = "UTF-16BE";
+ out.write((byte)0xFE);
+ out.write((byte)0xFF);
+ }
+ else if(encoding_scheme.equalsIgnoreCase("UnicodeLittle")){
+ encoding_scheme = "UTF-16LE";
+ out.write((byte)0xFF);
+ out.write((byte)0xFE);
+ }
+ }
+ catch(IOException ioe)
+ {
+ }
+
+ outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
- Charset cs = EncodingHelper.getCharset(encoding_scheme);
- if(cs == null)
- throw new UnsupportedEncodingException("Encoding "+encoding_scheme+
- " unknown");
- encoder = cs.newEncoder();
- encodingName = EncodingHelper.getOldCanonical(cs.name());
+ Charset cs = EncodingHelper.getCharset(encoding_scheme);
+ if(cs == null)
+ throw new UnsupportedEncodingException("Encoding "+encoding_scheme+
+ " unknown");
+ encoder = cs.newEncoder();
+ encodingName = EncodingHelper.getOldCanonical(cs.name());
- encoder.onMalformedInput(CodingErrorAction.REPLACE);
- encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
- } catch(RuntimeException e) {
- // Default to ISO Latin-1, will happen if this is called, for instance,
- // before the NIO provider is loadable.
- encoder = null;
- encodingName = "ISO8859_1";
- }
+ encoder.onMalformedInput(CodingErrorAction.REPLACE);
+ encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ }
+ catch(RuntimeException e)
+ {
+ // Default to ISO Latin-1, will happen if this is called, for instance,
+ // before the NIO provider is loadable.
+ encoder = null;
+ encodingName = "ISO8859_1";
+ }
}
/**
@@ -183,21 +187,55 @@ public class OutputStreamWriter extends Writer
this.out = out;
outputBuffer = null;
try
- {
- String encoding = System.getProperty("file.encoding");
- Charset cs = Charset.forName(encoding);
- encoder = cs.newEncoder();
- encodingName = EncodingHelper.getOldCanonical(cs.name());
- } catch(RuntimeException e) {
- encoder = null;
- encodingName = "ISO8859_1";
- }
+ {
+ String encoding = System.getProperty("file.encoding");
+ Charset cs = Charset.forName(encoding);
+ encoder = cs.newEncoder();
+ encodingName = EncodingHelper.getOldCanonical(cs.name());
+ }
+ catch(RuntimeException e)
+ {
+ encoder = null;
+ encodingName = "ISO8859_1";
+ }
+
if(encoder != null)
- {
- encoder.onMalformedInput(CodingErrorAction.REPLACE);
- encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
- outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
- }
+ {
+ encoder.onMalformedInput(CodingErrorAction.REPLACE);
+ encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
+ }
+ }
+
+ /**
+ * This method initializes a new instance of <code>OutputStreamWriter</code>
+ * to write to the specified stream using a given <code>Charset</code>.
+ *
+ * @param out The <code>OutputStream</code> to write to
+ * @param cs The <code>Charset</code> of the encoding to use
+ */
+ public OutputStreamWriter(OutputStream out, Charset cs)
+ {
+ this.out = out;
+ encoder = cs.newEncoder();
+ encoder.onMalformedInput(CodingErrorAction.REPLACE);
+ encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
+ }
+
+ /**
+ * This method initializes a new instance of <code>OutputStreamWriter</code>
+ * to write to the specified stream using a given
+ * <code>CharsetEncoder</code>.
+ *
+ * @param out The <code>OutputStream</code> to write to
+ * @param enc The <code>CharsetEncoder</code> to encode the output with
+ */
+ public OutputStreamWriter(OutputStream out, CharsetEncoder enc)
+ {
+ this.out = out;
+ encoder = enc;
+ outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
}
/**
diff --git a/libjava/classpath/java/io/PipedInputStream.java b/libjava/classpath/java/io/PipedInputStream.java
index beb310b4f0c..523ae2c70d3 100644
--- a/libjava/classpath/java/io/PipedInputStream.java
+++ b/libjava/classpath/java/io/PipedInputStream.java
@@ -130,7 +130,7 @@ public class PipedInputStream extends InputStream
* This stream is then ready for reading. If this stream is already
* connected or has been previously closed, then an exception is thrown
*
- * @param src The <code>PipedOutputStream</code> to connect this stream to
+ * @param source The <code>PipedOutputStream</code> to connect this stream to
*
* @exception IOException If this PipedInputStream or <code>source</code>
* has been connected already.
diff --git a/libjava/classpath/java/io/PrintWriter.java b/libjava/classpath/java/io/PrintWriter.java
index 5fd0b162f31..5667e705004 100644
--- a/libjava/classpath/java/io/PrintWriter.java
+++ b/libjava/classpath/java/io/PrintWriter.java
@@ -70,6 +70,11 @@ public class PrintWriter extends Writer
* on this stream.
*/
private boolean error;
+
+ /**
+ * Indicates whether or not the stream has been closed.
+ */
+ private boolean closed;
/**
* This is the underlying <code>Writer</code> we are sending output
@@ -139,6 +144,68 @@ public class PrintWriter extends Writer
}
/**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the default encoding.
+ * @param file name of the file to write to
+ * @throws FileNotFoundException if the file cannot be written or created
+ *
+ * @since 1.5
+ */
+ public PrintWriter(String file) throws FileNotFoundException
+ {
+ this(new FileOutputStream(file));
+ }
+
+ /**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the specified encoding.
+ * @param file name of the file to write to
+ * @param enc the encoding to use
+ * @throws FileNotFoundException if the file cannot be written or created
+ * @throws UnsupportedEncodingException if the encoding is not supported
+ *
+ * @since 1.5
+ */
+ public PrintWriter(String file, String enc)
+ throws FileNotFoundException, UnsupportedEncodingException
+ {
+ this(new OutputStreamWriter(new FileOutputStream(file), enc));
+ }
+
+ /**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the default encoding.
+ * @param file the file to write to
+ * @throws FileNotFoundException if the file cannot be written or created
+ *
+ * @since 1.5
+ */
+ public PrintWriter(File file) throws FileNotFoundException
+ {
+ this(new FileOutputStream(file));
+ }
+
+ /**
+ * This initializes a new PrintWriter object to write to the specified
+ * file. It creates a FileOutputStream object and wraps it in an
+ * OutputStreamWriter using the specified encoding.
+ * @param file the file to write to
+ * @param enc the encoding to use
+ * @throws FileNotFoundException if the file cannot be written or created
+ * @throws UnsupportedEncodingException if the encoding is not supported
+ *
+ * @since 1.5
+ */
+ public PrintWriter(File file, String enc)
+ throws FileNotFoundException, UnsupportedEncodingException
+ {
+ this(new OutputStreamWriter(new FileOutputStream(file), enc));
+ }
+
+ /**
* This method can be called by subclasses to indicate that an error
* has occurred and should be reported by <code>checkError</code>.
*/
@@ -158,7 +225,8 @@ public class PrintWriter extends Writer
*/
public boolean checkError()
{
- flush();
+ if (! closed)
+ flush();
return error;
}
@@ -185,7 +253,8 @@ public class PrintWriter extends Writer
{
try
{
- out.close();
+ out.close();
+ closed = true;
}
catch (IOException ex)
{
@@ -310,7 +379,7 @@ public class PrintWriter extends Writer
* This is the system dependent line separator
*/
private static final char[] line_separator
- = System.getProperty("line.separator").toCharArray();
+ = System.getProperty("line.separator", "\n").toCharArray();
/**
* This method prints a line separator sequence to the stream. The value
diff --git a/libjava/classpath/java/io/PushbackInputStream.java b/libjava/classpath/java/io/PushbackInputStream.java
index 71cf244274e..ff202c72df1 100644
--- a/libjava/classpath/java/io/PushbackInputStream.java
+++ b/libjava/classpath/java/io/PushbackInputStream.java
@@ -116,7 +116,14 @@ public class PushbackInputStream extends FilterInputStream
*/
public int available() throws IOException
{
- return (buf.length - pos) + super.available();
+ try
+ {
+ return (buf.length - pos) + super.available();
+ }
+ catch (NullPointerException npe)
+ {
+ throw new IOException ("Stream closed");
+ }
}
/**
diff --git a/libjava/classpath/java/lang/Boolean.java b/libjava/classpath/java/lang/Boolean.java
index b6910280e6b..902c93b3186 100644
--- a/libjava/classpath/java/lang/Boolean.java
+++ b/libjava/classpath/java/lang/Boolean.java
@@ -221,4 +221,36 @@ public final class Boolean implements Serializable
return false;
return "true".equalsIgnoreCase(System.getProperty(name));
}
+
+ /**
+ * If the String argument is "true", ignoring case, return true.
+ * Otherwise, return false.
+ *
+ * @param b String to parse
+ * @since 1.5
+ */
+ public static boolean parseBoolean(String b)
+ {
+ return "true".equalsIgnoreCase(b) ? true : false;
+ }
+
+ /**
+ * Compares this Boolean to another.
+ * @param b the Boolean to compare this Boolean to
+ * @return 0 if both Booleans represent the same value, a positive number
+ * if this Boolean represents true and b represents false, or a negative
+ * number otherwise.
+ * @since 1.5
+ */
+ public int compareTo (Boolean b)
+ {
+ if (b == null)
+ throw new NullPointerException("argument passed to compareTo(Boolean) cannot be null");
+
+ if (this.value == b.value)
+ return 0;
+ if (this.value == true)
+ return 1;
+ return -1;
+ }
}
diff --git a/libjava/classpath/java/lang/Byte.java b/libjava/classpath/java/lang/Byte.java
index 338e2167aa1..2560bfcffc3 100644
--- a/libjava/classpath/java/lang/Byte.java
+++ b/libjava/classpath/java/lang/Byte.java
@@ -50,7 +50,7 @@ package java.lang;
* @author Per Bothner
* @author Eric Blake (ebb9@email.byu.edu)
* @since 1.1
- * @status updated to 1.4
+ * @status updated to 1.5
*/
public final class Byte extends Number implements Comparable
{
@@ -78,6 +78,16 @@ public final class Byte extends Number implements Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass('B');
/**
+ * The number of bits needed to represent a <code>byte</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 8;
+
+ // This caches Byte values, and is used by boxing conversions via
+ // valueOf(). We're required to cache all possible values here.
+ private static Byte[] byteCache = new Byte[MAX_VALUE - MIN_VALUE + 1];
+
+ /**
* The immutable value of this Byte.
*
* @serial the wrapped byte
@@ -192,6 +202,26 @@ public final class Byte extends Number implements Comparable
}
/**
+ * Returns a <code>Byte</code> object wrapping the value.
+ * In contrast to the <code>Byte</code> constructor, this method
+ * will cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Byte</code>
+ *
+ * @since 1.5
+ */
+ public static Byte valueOf(byte val)
+ {
+ synchronized (byteCache)
+ {
+ if (byteCache[val - MIN_VALUE] == null)
+ byteCache[val - MIN_VALUE] = new Byte(val);
+ return byteCache[val - MIN_VALUE];
+ }
+ }
+
+ /**
* Convert the specified <code>String</code> into a <code>Byte</code>.
* The <code>String</code> may represent decimal, hexadecimal, or
* octal numbers.
diff --git a/libjava/classpath/java/lang/Character.java b/libjava/classpath/java/lang/Character.java
index 1e4f219a15f..78db41ef216 100644
--- a/libjava/classpath/java/lang/Character.java
+++ b/libjava/classpath/java/lang/Character.java
@@ -1,5 +1,5 @@
/* java.lang.Character -- Wrapper class for char, and Unicode subsets
- Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -1034,6 +1034,18 @@ public final class Character implements Serializable, Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass('C');
/**
+ * The number of bits needed to represent a <code>char</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 16;
+
+ // This caches some Character values, and is used by boxing
+ // conversions via valueOf(). We must cache at least 0..127;
+ // this constant controls how much we actually cache.
+ private static final int MAX_CACHE = 127;
+ private static Character[] charCache = new Character[MAX_CACHE + 1];
+
+ /**
* Lu = Letter, Uppercase (Informative).
*
* @since 1.1
@@ -1480,34 +1492,48 @@ public final class Character implements Serializable, Comparable
/**
- * Minimum high surrrogate code in UTF-16 encoding.
+ * Minimum high surrogate code in UTF-16 encoding.
*
* @since 1.5
*/
public static final char MIN_HIGH_SURROGATE = '\ud800';
/**
- * Maximum high surrrogate code in UTF-16 encoding.
+ * Maximum high surrogate code in UTF-16 encoding.
*
* @since 1.5
*/
public static final char MAX_HIGH_SURROGATE = '\udbff';
/**
- * Minimum low surrrogate code in UTF-16 encoding.
+ * Minimum low surrogate code in UTF-16 encoding.
*
* @since 1.5
*/
public static final char MIN_LOW_SURROGATE = '\udc00';
/**
- * Maximum low surrrogate code in UTF-16 encoding.
+ * Maximum low surrogate code in UTF-16 encoding.
*
* @since 1.5
*/
public static final char MAX_LOW_SURROGATE = '\udfff';
/**
+ * Minimum surrogate code in UTF-16 encoding.
+ *
+ * @since 1.5
+ */
+ public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE;
+
+ /**
+ * Maximum low surrogate code in UTF-16 encoding.
+ *
+ * @since 1.5
+ */
+ public static final char MAX_SURROGATE = MAX_LOW_SURROGATE;
+
+ /**
* Grabs an attribute offset from the Unicode attribute database. The lower
* 5 bits are the character type, the next 2 bits are flags, and the top
* 9 bits are the offset into the attribute tables.
@@ -2303,6 +2329,37 @@ public final class Character implements Serializable, Comparable
}
/**
+ * Returns an <code>Character</code> object wrapping the value.
+ * In contrast to the <code>Character</code> constructor, this method
+ * will cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Character</code>
+ *
+ * @since 1.5
+ */
+ public static Character valueOf(char val)
+ {
+ if (val > MAX_CACHE)
+ return new Character(val);
+ synchronized (charCache)
+ {
+ if (charCache[val - MIN_VALUE] == null)
+ charCache[val - MIN_VALUE] = new Character(val);
+ return charCache[val - MIN_VALUE];
+ }
+ }
+
+ /**
+ * Reverse the bytes in val.
+ * @since 1.5
+ */
+ public static char reverseBytes(char val)
+ {
+ return (char) (((val >> 8) & 0xff) | ((val << 8) & 0xff00));
+ }
+
+ /**
* Converts a unicode code point to a UTF-16 representation of that
* code point.
*
@@ -2370,7 +2427,7 @@ public final class Character implements Serializable, Comparable
* Return number of 16-bit characters required to represent the given
* code point.
*
- * @param codePoint a uncode code point
+ * @param codePoint a unicode code point
*
* @return 2 if codePoint >= 0x10000, 1 otherwise.
*
@@ -2415,4 +2472,210 @@ public final class Character implements Serializable, Comparable
{
return codePoint >= MIN_CODE_POINT && codePoint <= MAX_CODE_POINT;
}
+
+ /**
+ * Return true if the given character is a high surrogate.
+ * @param ch the character
+ * @return true if the character is a high surrogate character
+ *
+ * @since 1.5
+ */
+ public static boolean isHighSurrogate(char ch)
+ {
+ return ch >= MIN_HIGH_SURROGATE && ch <= MAX_HIGH_SURROGATE;
+ }
+
+ /**
+ * Return true if the given character is a low surrogate.
+ * @param ch the character
+ * @return true if the character is a low surrogate character
+ *
+ * @since 1.5
+ */
+ public static boolean isLowSurrogate(char ch)
+ {
+ return ch >= MIN_LOW_SURROGATE && ch <= MAX_LOW_SURROGATE;
+ }
+
+ /**
+ * Return true if the given characters compose a surrogate pair.
+ * This is true if the first character is a high surrogate and the
+ * second character is a low surrogate.
+ * @param ch1 the first character
+ * @param ch2 the first character
+ * @return true if the characters compose a surrogate pair
+ *
+ * @since 1.5
+ */
+ public static boolean isSurrogatePair(char ch1, char ch2)
+ {
+ return isHighSurrogate(ch1) && isLowSurrogate(ch2);
+ }
+
+ /**
+ * Given a valid surrogate pair, this returns the corresponding
+ * code point.
+ * @param high the high character of the pair
+ * @param low the low character of the pair
+ * @return the corresponding code point
+ *
+ * @since 1.5
+ */
+ public static int toCodePoint(char high, char low)
+ {
+ return ((high - MIN_HIGH_SURROGATE) << 10) + (low - MIN_LOW_SURROGATE);
+ }
+
+ /**
+ * Get the code point at the specified index in the CharSequence.
+ * This is like CharSequence#charAt(int), but if the character is
+ * the start of a surrogate pair, and there is a following
+ * character, and this character completes the pair, then the
+ * corresponding supplementary code point is returned. Otherwise,
+ * the character at the index is returned.
+ *
+ * @param sequence the CharSequence
+ * @param index the index of the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public static int codePointAt(CharSequence sequence, int index)
+ {
+ int len = sequence.length();
+ if (index < 0 || index >= len)
+ throw new IndexOutOfBoundsException();
+ char high = sequence.charAt(index);
+ if (! isHighSurrogate(high) || ++index >= len)
+ return high;
+ char low = sequence.charAt(index);
+ if (! isLowSurrogate(low))
+ return high;
+ return toCodePoint(high, low);
+ }
+
+ /**
+ * Get the code point at the specified index in the CharSequence.
+ * If the character is the start of a surrogate pair, and there is a
+ * following character, and this character completes the pair, then
+ * the corresponding supplementary code point is returned.
+ * Otherwise, the character at the index is returned.
+ *
+ * @param chars the character array in which to look
+ * @param index the index of the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public static int codePointAt(char[] chars, int index)
+ {
+ return codePointAt(chars, index, chars.length);
+ }
+
+ /**
+ * Get the code point at the specified index in the CharSequence.
+ * If the character is the start of a surrogate pair, and there is a
+ * following character within the specified range, and this
+ * character completes the pair, then the corresponding
+ * supplementary code point is returned. Otherwise, the character
+ * at the index is returned.
+ *
+ * @param chars the character array in which to look
+ * @param index the index of the codepoint to get, starting at 0
+ * @param limit the limit past which characters should not be examined
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;=
+ * limit, or if limit is negative or &gt;= the length of the array
+ * @since 1.5
+ */
+ public static int codePointAt(char[] chars, int index, int limit)
+ {
+ if (index < 0 || index >= limit || limit < 0 || limit >= chars.length)
+ throw new IndexOutOfBoundsException();
+ char high = chars[index];
+ if (! isHighSurrogate(high) || ++index >= limit)
+ return high;
+ char low = chars[index];
+ if (! isLowSurrogate(low))
+ return high;
+ return toCodePoint(high, low);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(char[], int), but checks the characters at
+ * <code>index-1</code> and <code>index-2</code> to see if they form
+ * a supplementary code point. If they do not, the character at
+ * <code>index-1</code> is returned.
+ *
+ * @param chars the character array
+ * @param index the index just past the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public static int codePointBefore(char[] chars, int index)
+ {
+ return codePointBefore(chars, index, 1);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(char[], int), but checks the characters at
+ * <code>index-1</code> and <code>index-2</code> to see if they form
+ * a supplementary code point. If they do not, the character at
+ * <code>index-1</code> is returned. The start parameter is used to
+ * limit the range of the array which may be examined.
+ *
+ * @param chars the character array
+ * @param index the index just past the codepoint to get, starting at 0
+ * @param start the index before which characters should not be examined
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is &gt; start or &gt;
+ * the length of the array, or if limit is negative or &gt;= the
+ * length of the array
+ * @since 1.5
+ */
+ public static int codePointBefore(char[] chars, int index, int start)
+ {
+ if (index < start || index > chars.length
+ || start < 0 || start >= chars.length)
+ throw new IndexOutOfBoundsException();
+ --index;
+ char low = chars[index];
+ if (! isLowSurrogate(low) || --index < start)
+ return low;
+ char high = chars[index];
+ if (! isHighSurrogate(high))
+ return low;
+ return toCodePoint(high, low);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(CharSequence, int), but checks the characters at
+ * <code>index-1</code> and <code>index-2</code> to see if they form
+ * a supplementary code point. If they do not, the character at
+ * <code>index-1</code> is returned.
+ *
+ * @param sequence the CharSequence
+ * @param index the index just past the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public static int codePointBefore(CharSequence sequence, int index)
+ {
+ int len = sequence.length();
+ if (index < 1 || index > len)
+ throw new IndexOutOfBoundsException();
+ --index;
+ char low = sequence.charAt(index);
+ if (! isLowSurrogate(low) || --index < 0)
+ return low;
+ char high = sequence.charAt(index);
+ if (! isHighSurrogate(high))
+ return low;
+ return toCodePoint(high, low);
+ }
} // class Character
diff --git a/libjava/classpath/java/lang/Class.java b/libjava/classpath/java/lang/Class.java
index 22f148e9136..726c794a413 100644
--- a/libjava/classpath/java/lang/Class.java
+++ b/libjava/classpath/java/lang/Class.java
@@ -41,7 +41,9 @@ package java.lang;
import gnu.classpath.VMStackWalker;
import java.io.InputStream;
+import java.io.ObjectStreamClass;
import java.io.Serializable;
+import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -99,7 +101,7 @@ public final class Class implements Serializable
/** The class signers. */
private Object[] signers = null;
/** The class protection domain. */
- private final ProtectionDomain pd;
+ private final transient ProtectionDomain pd;
/* We use an inner class, so that Class doesn't have a static initializer */
private static final class StaticData
@@ -592,7 +594,8 @@ public final class Class implements Serializable
ClassLoader cl = getClassLoader();
if (cl != null)
return cl.getPackage(getPackagePortion(getName()));
- return null;
+ else
+ return VMClassLoader.getPackage(getPackagePortion(getName()));
}
/**
@@ -721,7 +724,7 @@ public final class Class implements Serializable
* @param list List of methods to search
* @param name Name of method
* @param args Method parameter types
- * @see #getMethod()
+ * @see #getMethod(String, Class[])
*/
private static Method matchMethod(Method[] list, String name, Class[] args)
{
@@ -829,7 +832,7 @@ public final class Class implements Serializable
* public and final, but not an interface.
*
* @return the modifiers of this class
- * @see Modifer
+ * @see Modifier
* @since 1.1
*/
public int getModifiers()
diff --git a/libjava/classpath/java/lang/ClassLoader.java b/libjava/classpath/java/lang/ClassLoader.java
index 0d50a6e005d..9f586c4cffc 100644
--- a/libjava/classpath/java/lang/ClassLoader.java
+++ b/libjava/classpath/java/lang/ClassLoader.java
@@ -49,6 +49,7 @@ import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.ByteBuffer;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.Policy;
@@ -472,6 +473,35 @@ public abstract class ClassLoader
}
/**
+ * Helper to define a class using the contents of a byte buffer. If
+ * the domain is null, the default of
+ * <code>Policy.getPolicy().getPermissions(new CodeSource(null,
+ * null))</code> is used. Once a class has been defined in a
+ * package, all further classes in that package must have the same
+ * set of certificates or a SecurityException is thrown.
+ *
+ * @param name the name to give the class. null if unknown
+ * @param buf a byte buffer containing bytes that form a class.
+ * @param domain the ProtectionDomain to give to the class, null for the
+ * default protection domain
+ * @return the class that was defined
+ * @throws ClassFormatError if data is not in proper classfile format
+ * @throws NoClassDefFoundError if the supplied name is not the same as
+ * the one specified by the byte buffer.
+ * @throws SecurityException if name starts with "java.", or if certificates
+ * do not match up
+ * @since 1.5
+ */
+ protected final Class defineClass(String name, ByteBuffer buf,
+ ProtectionDomain domain)
+ throws ClassFormatError
+ {
+ byte[] data = new byte[buf.remaining()];
+ buf.get(data);
+ return defineClass(name, data, 0, data.length, domain);
+ }
+
+ /**
* Links the class, if that has not already been done. Linking basically
* resolves all references to other classes made by this class.
*
@@ -883,7 +913,7 @@ public abstract class ClassLoader
*
* @param name the (system specific) name of the requested library
* @return the full pathname to the requested library, or null
- * @see Runtime#loadLibrary()
+ * @see Runtime#loadLibrary(String)
* @since 1.2
*/
protected String findLibrary(String name)
@@ -913,7 +943,7 @@ public abstract class ClassLoader
*
* @param name the package (and subpackages) to affect
* @param enabled true to set the default to enabled
- * @see #setDefaultAssertionStatus(String, boolean)
+ * @see #setDefaultAssertionStatus(boolean)
* @see #setClassAssertionStatus(String, boolean)
* @see #clearAssertionStatus()
* @since 1.4
@@ -934,7 +964,7 @@ public abstract class ClassLoader
* @param name the class to affect
* @param enabled true to set the default to enabled
* @throws NullPointerException if name is null
- * @see #setDefaultAssertionStatus(String, boolean)
+ * @see #setDefaultAssertionStatus(boolean)
* @see #setPackageAssertionStatus(String, boolean)
* @see #clearAssertionStatus()
* @since 1.4
diff --git a/libjava/classpath/java/lang/Double.java b/libjava/classpath/java/lang/Double.java
index 4fa47f46ddd..26b398bb695 100644
--- a/libjava/classpath/java/lang/Double.java
+++ b/libjava/classpath/java/lang/Double.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.lang;
-import gnu.classpath.Configuration;
/**
* Instances of class <code>Double</code> represent primitive
@@ -89,6 +88,12 @@ public final class Double extends Number implements Comparable
public static final double NaN = 0.0 / 0.0;
/**
+ * The number of bits needed to represent a <code>double</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 64;
+
+ /**
* The primitive type <code>double</code> is represented by this
* <code>Class</code> object.
* @since 1.1
@@ -168,6 +173,22 @@ public final class Double extends Number implements Comparable
}
/**
+ * Returns a <code>Double</code> object wrapping the value.
+ * In contrast to the <code>Double</code> constructor, this method
+ * may cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Double</code>
+ *
+ * @since 1.5
+ */
+ public static Double valueOf(double val)
+ {
+ // We don't actually cache, but we could.
+ return new Double(val);
+ }
+
+ /**
* Create a new <code>Double</code> object using the <code>String</code>.
*
* @param s the <code>String</code> to convert
diff --git a/libjava/classpath/java/lang/EnumConstantNotPresentException.java b/libjava/classpath/java/lang/EnumConstantNotPresentException.java
new file mode 100644
index 00000000000..dbec9d658ef
--- /dev/null
+++ b/libjava/classpath/java/lang/EnumConstantNotPresentException.java
@@ -0,0 +1,93 @@
+/* EnumConstantNotPresentException.java -- thrown when enum constant
+ not available
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.lang;
+
+/**
+ * An exception of this type is thrown when a symbolic reference is
+ * made to an enum constant which does not exist.
+ *
+ * @author Tom Tromey (tromey@redhat.com)
+ * @since 1.5
+ */
+public class EnumConstantNotPresentException extends RuntimeException
+{
+ /**
+ * The enum's type. Note that the name is fixed by the
+ * serialization spec.
+ */
+ private Class enumType;
+
+ /**
+ * The name of the missing enum constant. Note that the name is
+ * fixed by the serialization spec.
+ */
+ private String constantName;
+
+ /**
+ * Create a new EnumConstantNotPresentException with the indicated
+ * enum type and enum constant name.
+ * @param theEnum the enum's class
+ * @param name the name of the missing enum constant
+ */
+ public EnumConstantNotPresentException(Class theEnum, String name)
+ {
+ super("enum " + theEnum + " is missing the constant " + name);
+ enumType = theEnum;
+ constantName = name;
+ }
+
+ /**
+ * Return the name of the missing constant.
+ * @return the name of the missing constant
+ */
+ public String constantName()
+ {
+ return constantName;
+ }
+
+ /**
+ * Return the enum type which is missing a constant.
+ * @return the enum type which is missing a constant
+ */
+ public Class enumType()
+ {
+ return enumType;
+ }
+}
diff --git a/libjava/classpath/java/lang/Float.java b/libjava/classpath/java/lang/Float.java
index e6200dabddc..eef34a0abeb 100644
--- a/libjava/classpath/java/lang/Float.java
+++ b/libjava/classpath/java/lang/Float.java
@@ -94,6 +94,12 @@ public final class Float extends Number implements Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass('F');
/**
+ * The number of bits needed to represent a <code>float</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 32;
+
+ /**
* The immutable value of this Float.
*
* @serial the wrapped float
@@ -192,6 +198,22 @@ public final class Float extends Number implements Comparable
}
/**
+ * Returns a <code>Float</code> object wrapping the value.
+ * In contrast to the <code>Float</code> constructor, this method
+ * may cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Float</code>
+ *
+ * @since 1.5
+ */
+ public static Float valueOf(float val)
+ {
+ // We don't actually cache, but we could.
+ return new Float(val);
+ }
+
+ /**
* Parse the specified <code>String</code> as a <code>float</code>. The
* extended BNF grammar is as follows:<br>
* <pre>
diff --git a/libjava/classpath/java/lang/Integer.java b/libjava/classpath/java/lang/Integer.java
index 53de9ab9667..f3fe85f5041 100644
--- a/libjava/classpath/java/lang/Integer.java
+++ b/libjava/classpath/java/lang/Integer.java
@@ -707,8 +707,8 @@ public final class Integer extends Number implements Comparable
* @throws NullPointerException if decode is true and str if null
* @see #parseInt(String, int)
* @see #decode(String)
- * @see Byte#parseInt(String, int)
- * @see Short#parseInt(String, int)
+ * @see Byte#parseByte(String, int)
+ * @see Short#parseShort(String, int)
*/
static int parseInt(String str, int radix, boolean decode)
{
diff --git a/libjava/classpath/java/lang/Long.java b/libjava/classpath/java/lang/Long.java
index 703eab8a0f3..74e2a52df7c 100644
--- a/libjava/classpath/java/lang/Long.java
+++ b/libjava/classpath/java/lang/Long.java
@@ -50,7 +50,7 @@ package java.lang;
* @author Warren Levy
* @author Eric Blake (ebb9@email.byu.edu)
* @since 1.0
- * @status updated to 1.4
+ * @status updated to 1.5
*/
public final class Long extends Number implements Comparable
{
@@ -79,6 +79,12 @@ public final class Long extends Number implements Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass ('J');
/**
+ * The number of bits needed to represent a <code>long</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 64;
+
+ /**
* The immutable value of this Long.
*
* @serial the wrapped long
@@ -282,6 +288,21 @@ public final class Long extends Number implements Comparable
}
/**
+ * Returns a <code>Long</code> object wrapping the value.
+ *
+ * @param val the value to wrap
+ * @return the <code>Long</code>
+ *
+ * @since 1.5
+ */
+ public static synchronized Long valueOf(long val)
+ {
+ // We aren't required to cache here. We could, though perhaps we
+ // ought to consider that as an empirical question.
+ return new Long(val);
+ }
+
+ /**
* Convert the specified <code>String</code> into a <code>Long</code>.
* The <code>String</code> may represent decimal, hexadecimal, or
* octal numbers.
@@ -512,6 +533,136 @@ public final class Long extends Number implements Comparable
}
/**
+ * Return the number of bits set in x.
+ * @param x value to examine
+ * @since 1.5
+ */
+ public static int bitCount(long x)
+ {
+ // Successively collapse alternating bit groups into a sum.
+ x = ((x >> 1) & 0x5555555555555555L) + (x & 0x5555555555555555L);
+ x = ((x >> 2) & 0x3333333333333333L) + (x & 0x3333333333333333L);
+ int v = (int) ((x >>> 32) + x);
+ v = ((v >> 4) & 0x0f0f0f0f) + (v & 0x0f0f0f0f);
+ v = ((v >> 8) & 0x00ff00ff) + (v & 0x00ff00ff);
+ return ((v >> 16) & 0x0000ffff) + (v & 0x0000ffff);
+ }
+
+ /**
+ * Rotate x to the left by distance bits.
+ * @param x the value to rotate
+ * @param distance the number of bits by which to rotate
+ * @since 1.5
+ */
+ public static long rotateLeft(long x, int distance)
+ {
+ // This trick works because the shift operators implicitly mask
+ // the shift count.
+ return (x << distance) | (x >>> - distance);
+ }
+
+ /**
+ * Rotate x to the right by distance bits.
+ * @param x the value to rotate
+ * @param distance the number of bits by which to rotate
+ * @since 1.5
+ */
+ public static long rotateRight(long x, int distance)
+ {
+ // This trick works because the shift operators implicitly mask
+ // the shift count.
+ return (x << - distance) | (x >>> distance);
+ }
+
+ /**
+ * Find the highest set bit in value, and return a new value
+ * with only that bit set.
+ * @param value the value to examine
+ * @since 1.5
+ */
+ public static long highestOneBit(long value)
+ {
+ value |= value >>> 1;
+ value |= value >>> 2;
+ value |= value >>> 4;
+ value |= value >>> 8;
+ value |= value >>> 16;
+ value |= value >>> 32;
+ return value ^ (value >>> 1);
+ }
+
+ /**
+ * Return the number of leading zeros in value.
+ * @param value the value to examine
+ * @since 1.5
+ */
+ public static int numberOfLeadingZeros(long value)
+ {
+ value |= value >>> 1;
+ value |= value >>> 2;
+ value |= value >>> 4;
+ value |= value >>> 8;
+ value |= value >>> 16;
+ value |= value >>> 32;
+ return bitCount(~value);
+ }
+
+ /**
+ * Find the lowest set bit in value, and return a new value
+ * with only that bit set.
+ * @param value the value to examine
+ * @since 1.5
+ */
+ public static long lowestOneBit(long value)
+ {
+ // Classic assembly trick.
+ return value & - value;
+ }
+
+ /**
+ * Find the number of trailing zeros in value.
+ * @param value the value to examine
+ * @since 1.5
+ */
+ public static int numberOfTrailingZeros(long value)
+ {
+ return bitCount((value & -value) - 1);
+ }
+
+ /**
+ * Return 1 if x is positive, -1 if it is negative, and 0 if it is
+ * zero.
+ * @param x the value to examine
+ * @since 1.5
+ */
+ public static int signum(long x)
+ {
+ return x < 0 ? -1 : (x > 0 ? 1 : 0);
+ }
+
+ /**
+ * Reverse the bytes in val.
+ * @since 1.5
+ */
+ public static long reverseBytes(long val)
+ {
+ int hi = Integer.reverseBytes((int) val);
+ int lo = Integer.reverseBytes((int) (val >>> 32));
+ return (((long) hi) << 32) | lo;
+ }
+
+ /**
+ * Reverse the bits in val.
+ * @since 1.5
+ */
+ public static long reverse(long val)
+ {
+ long hi = Integer.reverse((int) val) & 0xffffffffL;
+ long lo = Integer.reverse((int) (val >>> 32)) & 0xffffffffL;
+ return (hi << 32) | lo;
+ }
+
+ /**
* Helper for converting unsigned numbers to String.
*
* @param num the number
diff --git a/libjava/classpath/java/lang/Object.java b/libjava/classpath/java/lang/Object.java
index f8c389a57ee..6212d7dfe72 100644
--- a/libjava/classpath/java/lang/Object.java
+++ b/libjava/classpath/java/lang/Object.java
@@ -343,7 +343,7 @@ public class Object
*
* <p>This thread still holds a lock on the object, so it is
* typical to release the lock by exiting the synchronized
- * code, calling wait(), or calling {@link Thread#sleep()}, so
+ * code, calling wait(), or calling {@link Thread#sleep(long)}, so
* that the newly awakened thread can actually resume. The
* awakened thread will most likely be awakened with an
* {@link InterruptedException}, but that is not guaranteed.
@@ -372,7 +372,7 @@ public class Object
*
* <p>This thread still holds a lock on the object, so it is
* typical to release the lock by exiting the synchronized
- * code, calling wait(), or calling {@link Thread#sleep()}, so
+ * code, calling wait(), or calling {@link Thread#sleep(long)}, so
* that one of the newly awakened threads can actually resume.
* The resuming thread will most likely be awakened with an
* {@link InterruptedException}, but that is not guaranteed.
diff --git a/libjava/classpath/java/lang/Process.java b/libjava/classpath/java/lang/Process.java
index b6e18ca4df3..ccaa3f15358 100644
--- a/libjava/classpath/java/lang/Process.java
+++ b/libjava/classpath/java/lang/Process.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.lang;
+import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
diff --git a/libjava/classpath/java/lang/Readable.java b/libjava/classpath/java/lang/Readable.java
index efc1985d606..d8967652b70 100644
--- a/libjava/classpath/java/lang/Readable.java
+++ b/libjava/classpath/java/lang/Readable.java
@@ -39,6 +39,7 @@ package java.lang;
import java.io.IOException;
import java.nio.CharBuffer;
+import java.nio.ReadOnlyBufferException;
/**
* A <code>Readable</code> object is simply a source for Unicode character
diff --git a/libjava/classpath/java/lang/RuntimePermission.java b/libjava/classpath/java/lang/RuntimePermission.java
index ca33307d12b..2f80b91077f 100644
--- a/libjava/classpath/java/lang/RuntimePermission.java
+++ b/libjava/classpath/java/lang/RuntimePermission.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.lang;
import java.security.BasicPermission;
+import java.security.Permission;
/**
* A <code>RuntimePermission</code> contains a permission name, but no
diff --git a/libjava/classpath/java/lang/SecurityManager.java b/libjava/classpath/java/lang/SecurityManager.java
index ef9e7597ddc..26d56a64bf3 100644
--- a/libjava/classpath/java/lang/SecurityManager.java
+++ b/libjava/classpath/java/lang/SecurityManager.java
@@ -41,19 +41,35 @@ package java.lang;
import gnu.classpath.VMStackWalker;
import java.awt.AWTPermission;
+import java.awt.Frame;
+import java.awt.Toolkit;
+import java.awt.Window;
import java.io.File;
import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.FilePermission;
+import java.io.RandomAccessFile;
import java.lang.reflect.Member;
import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketImplFactory;
import java.net.SocketPermission;
+import java.net.URL;
+import java.net.URLStreamHandlerFactory;
import java.security.AccessControlContext;
+import java.security.AccessControlException;
import java.security.AccessController;
import java.security.AllPermission;
+import java.security.BasicPermission;
import java.security.Permission;
+import java.security.Policy;
import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
import java.security.Security;
import java.security.SecurityPermission;
+import java.util.Properties;
import java.util.PropertyPermission;
import java.util.StringTokenizer;
@@ -196,7 +212,7 @@ public class SecurityManager
* <ul>
* <li>All methods on the stack are from system classes</li>
* <li>All methods on the stack up to the first "privileged" caller, as
- * created by {@link AccessController.doPrivileged(PrivilegedAction)},
+ * created by {@link AccessController#doPrivileged(PrivilegedAction)},
* are from system classes</li>
* <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
* </ul>
@@ -219,7 +235,7 @@ public class SecurityManager
* <ul>
* <li>All methods on the stack are from system classes</li>
* <li>All methods on the stack up to the first "privileged" caller, as
- * created by {@link AccessController.doPrivileged(PrivilegedAction)},
+ * created by {@link AccessController#doPrivileged(PrivilegedAction)},
* are from system classes</li>
* <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
* </ul>
@@ -258,7 +274,7 @@ public class SecurityManager
* <ul>
* <li>All methods on the stack are from system classes</li>
* <li>All methods on the stack up to the first "privileged" caller, as
- * created by {@link AccessController.doPrivileged(PrivilegedAction)},
+ * created by {@link AccessController#doPrivileged(PrivilegedAction)},
* are from system classes</li>
* <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
* </ul>
@@ -431,7 +447,7 @@ public class SecurityManager
* @throws SecurityException if permission is denied
* @throws NullPointerException if g is null
* @see Thread#Thread()
- * @see ThreadGroup#ThreadGroup()
+ * @see ThreadGroup#ThreadGroup(String)
* @see ThreadGroup#stop()
* @see ThreadGroup#suspend()
* @see ThreadGroup#resume()
@@ -537,7 +553,7 @@ public class SecurityManager
* @throws NullPointerException if filename is null
* @see File
* @see FileInputStream#FileInputStream(String)
- * @see RandomAccessFile#RandomAccessFile(String)
+ * @see RandomAccessFile#RandomAccessFile(String, String)
*/
public void checkRead(String filename)
{
@@ -602,9 +618,9 @@ public class SecurityManager
* @see File
* @see File#canWrite()
* @see File#mkdir()
- * @see File#renameTo()
+ * @see File#renameTo(File)
* @see FileOutputStream#FileOutputStream(String)
- * @see RandomAccessFile#RandomAccessFile(String)
+ * @see RandomAccessFile#RandomAccessFile(String, String)
*/
public void checkWrite(String filename)
{
diff --git a/libjava/classpath/java/lang/Short.java b/libjava/classpath/java/lang/Short.java
index fbeea915bd3..eb40cd9e0e6 100644
--- a/libjava/classpath/java/lang/Short.java
+++ b/libjava/classpath/java/lang/Short.java
@@ -77,6 +77,19 @@ public final class Short extends Number implements Comparable
public static final Class TYPE = VMClassLoader.getPrimitiveClass('S');
/**
+ * The number of bits needed to represent a <code>short</code>.
+ * @since 1.5
+ */
+ public static final int SIZE = 16;
+
+ // This caches some Short values, and is used by boxing conversions
+ // via valueOf(). We must cache at least -128..127; these constants
+ // control how much we actually cache.
+ private static final int MIN_CACHE = -128;
+ private static final int MAX_CACHE = 127;
+ private static Short[] shortCache = new Short[MAX_CACHE - MIN_CACHE + 1];
+
+ /**
* The immutable value of this Short.
*
* @serial the wrapped short
@@ -189,6 +202,28 @@ public final class Short extends Number implements Comparable
}
/**
+ * Returns a <code>Short</code> object wrapping the value.
+ * In contrast to the <code>Short</code> constructor, this method
+ * will cache some values. It is used by boxing conversion.
+ *
+ * @param val the value to wrap
+ * @return the <code>Short</code>
+ *
+ * @since 1.5
+ */
+ public static Short valueOf(short val)
+ {
+ if (val < MIN_CACHE || val > MAX_CACHE)
+ return new Short(val);
+ synchronized (shortCache)
+ {
+ if (shortCache[val - MIN_CACHE] == null)
+ shortCache[val - MIN_CACHE] = new Short(val);
+ return shortCache[val - MIN_CACHE];
+ }
+ }
+
+ /**
* Convert the specified <code>String</code> into a <code>Short</code>.
* The <code>String</code> may represent decimal, hexadecimal, or
* octal numbers.
@@ -350,4 +385,13 @@ public final class Short extends Number implements Comparable
{
return compareTo((Short)o);
}
+
+ /**
+ * Reverse the bytes in val.
+ * @since 1.5
+ */
+ public static short reverseBytes(short val)
+ {
+ return (short) (((val >> 8) & 0xff) | ((val << 8) & 0xff00));
+ }
}
diff --git a/libjava/classpath/java/lang/StrictMath.java b/libjava/classpath/java/lang/StrictMath.java
index 32bd3540d80..2079cc11e41 100644
--- a/libjava/classpath/java/lang/StrictMath.java
+++ b/libjava/classpath/java/lang/StrictMath.java
@@ -1254,7 +1254,7 @@ public final strictfp class StrictMath
/**
* Super precision for 2/pi in 24-bit chunks, for use in
- * {@link #remPiOver2()}.
+ * {@link #remPiOver2(double, double[])}.
*/
private static final int TWO_OVER_PI[] = {
0xa2f983, 0x6e4e44, 0x1529fc, 0x2757d1, 0xf534dd, 0xc0db62,
@@ -1272,7 +1272,7 @@ public final strictfp class StrictMath
/**
* Super precision for pi/2 in 24-bit chunks, for use in
- * {@link #remPiOver2()}.
+ * {@link #remPiOver2(double, double[])}.
*/
private static final double PI_OVER_TWO[] = {
1.570796251296997, // Long bits 0x3ff921fb40000000L.
@@ -1286,8 +1286,8 @@ public final strictfp class StrictMath
};
/**
- * More constants related to pi, used in {@link #remPiOver2()} and
- * elsewhere.
+ * More constants related to pi, used in
+ * {@link #remPiOver2(double, double[])} and elsewhere.
*/
private static final double
PI_L = 1.2246467991473532e-16, // Long bits 0x3ca1a62633145c07L.
@@ -1301,7 +1301,7 @@ public final strictfp class StrictMath
/**
* Natural log and square root constants, for calculation of
* {@link #exp(double)}, {@link #log(double)} and
- * {@link #power(double, double)}. CP is 2/(3*ln(2)).
+ * {@link #pow(double, double)}. CP is 2/(3*ln(2)).
*/
private static final double
SQRT_1_5 = 1.224744871391589, // Long bits 0x3ff3988e1409212eL.
diff --git a/libjava/classpath/java/lang/String.java b/libjava/classpath/java/lang/String.java
index b4db8505051..369d8085a02 100644
--- a/libjava/classpath/java/lang/String.java
+++ b/libjava/classpath/java/lang/String.java
@@ -98,7 +98,7 @@ public final class String implements Serializable, Comparable, CharSequence
/**
* Stores unicode multi-character uppercase expansion table.
- * @see #toUpperCase(char)
+ * @see #toUpperCase(Locale)
* @see CharData#UPPER_EXPAND
*/
private static final char[] upperExpand
@@ -139,7 +139,7 @@ public final class String implements Serializable, Comparable, CharSequence
final int offset;
/**
- * An implementation for {@link CASE_INSENSITIVE_ORDER}.
+ * An implementation for {@link #CASE_INSENSITIVE_ORDER}.
* This must be {@link Serializable}. The class name is dictated by
* compatibility with Sun's JDK.
*/
@@ -233,6 +233,7 @@ public final class String implements Serializable, Comparable, CharSequence
* @param count the number of characters from data to copy
* @throws NullPointerException if data is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; data.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
*/
@@ -256,6 +257,7 @@ public final class String implements Serializable, Comparable, CharSequence
* @param count the number of characters from ascii to copy
* @throws NullPointerException if ascii is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; ascii.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
* @see #String(byte[])
@@ -267,8 +269,13 @@ public final class String implements Serializable, Comparable, CharSequence
*/
public String(byte[] ascii, int hibyte, int offset, int count)
{
- if (offset < 0 || count < 0 || offset + count > ascii.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > ascii.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
value = new char[count];
this.offset = 0;
this.count = count;
@@ -327,8 +334,13 @@ public final class String implements Serializable, Comparable, CharSequence
public String(byte[] data, int offset, int count, String encoding)
throws UnsupportedEncodingException
{
- if (offset < 0 || count < 0 || offset + count > data.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > data.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
try
{
CharsetDecoder csd = Charset.forName(encoding).newDecoder();
@@ -402,8 +414,13 @@ public final class String implements Serializable, Comparable, CharSequence
*/
public String(byte[] data, int offset, int count)
{
- if (offset < 0 || count < 0 || offset + count > data.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > data.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
int o, c;
char[] v;
String encoding;
@@ -512,8 +529,13 @@ public final class String implements Serializable, Comparable, CharSequence
*/
String(char[] data, int offset, int count, boolean dont_copy)
{
- if (offset < 0 || count < 0 || offset + count > data.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > data.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
if (dont_copy)
{
value = data;
@@ -554,6 +576,40 @@ public final class String implements Serializable, Comparable, CharSequence
}
/**
+ * Get the code point at the specified index. This is like #charAt(int),
+ * but if the character is the start of a surrogate pair, and the
+ * following character completes the pair, then the corresponding
+ * supplementary code point is returned.
+ * @param index the index of the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public synchronized int codePointAt(int index)
+ {
+ // Use the CharSequence overload as we get better range checking
+ // this way.
+ return Character.codePointAt(this, index);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(int), but checks the characters at <code>index-1</code> and
+ * <code>index-2</code> to see if they form a supplementary code point.
+ * @param index the index just past the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * (while unspecified, this is a StringIndexOutOfBoundsException)
+ * @since 1.5
+ */
+ public synchronized int codePointBefore(int index)
+ {
+ // Use the CharSequence overload as we get better range checking
+ // this way.
+ return Character.codePointBefore(this, index);
+ }
+
+ /**
* Copies characters from this String starting at a specified start index,
* ending at a specified stop index, to a character array starting at
* a specified destination begin index.
@@ -628,21 +684,26 @@ public final class String implements Serializable, Comparable, CharSequence
ByteBuffer bbuf = cse.encode(CharBuffer.wrap(value, offset, count));
if(bbuf.hasArray())
return bbuf.array();
-
+
// Doubt this will happen. But just in case.
byte[] bytes = new byte[bbuf.remaining()];
bbuf.get(bytes);
return bytes;
-
- } catch(IllegalCharsetNameException e){
- throw new UnsupportedEncodingException("Encoding: "+enc+
- " not found.");
- } catch(UnsupportedCharsetException e){
- throw new UnsupportedEncodingException("Encoding: "+enc+
- " not found.");
- } catch(CharacterCodingException e){
- // XXX - Ignore coding exceptions? They shouldn't really happen.
- return null;
+ }
+ catch(IllegalCharsetNameException e)
+ {
+ throw new UnsupportedEncodingException("Encoding: " + enc
+ + " not found.");
+ }
+ catch(UnsupportedCharsetException e)
+ {
+ throw new UnsupportedEncodingException("Encoding: " + enc
+ + " not found.");
+ }
+ catch(CharacterCodingException e)
+ {
+ // This shouldn't ever happen.
+ throw (InternalError) new InternalError().initCause(e);
}
}
@@ -726,6 +787,26 @@ public final class String implements Serializable, Comparable, CharSequence
}
/**
+ * Compares the given CharSequence to this String. This is true if
+ * the CharSequence has the same content as this String at this
+ * moment.
+ *
+ * @param seq the CharSequence to compare to
+ * @return true if CharSequence has the same character sequence
+ * @throws NullPointerException if the given CharSequence is null
+ * @since 1.5
+ */
+ public boolean contentEquals(CharSequence seq)
+ {
+ if (seq.length() != count)
+ return false;
+ for (int i = 0; i < count; ++i)
+ if (value[offset + i] != seq.charAt(i))
+ return false;
+ return true;
+ }
+
+ /**
* Compares a String to this String, ignoring case. This does not handle
* multi-character capitalization exceptions; instead the comparison is
* made on a character-by-character basis, and is true if:<br><ul>
@@ -1546,6 +1627,7 @@ public final class String implements Serializable, Comparable, CharSequence
* @return String containing the chars from data[offset..offset+count]
* @throws NullPointerException if data is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; data.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
* @see #String(char[], int, int)
@@ -1566,6 +1648,7 @@ public final class String implements Serializable, Comparable, CharSequence
* @return String containing the chars from data[offset..offset+count]
* @throws NullPointerException if data is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; data.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
* @see #String(char[], int, int)
@@ -1677,6 +1760,49 @@ public final class String implements Serializable, Comparable, CharSequence
}
/**
+ * Return the number of code points between two indices in the
+ * <code>StringBuffer</code>. An unpaired surrogate counts as a
+ * code point for this purpose. Characters outside the indicated
+ * range are not examined, even if the range ends in the middle of a
+ * surrogate pair.
+ *
+ * @param start the starting index
+ * @param end one past the ending index
+ * @return the number of code points
+ * @since 1.5
+ */
+ public synchronized int codePointCount(int start, int end)
+ {
+ if (start < 0 || end >= count || start > end)
+ throw new StringIndexOutOfBoundsException();
+
+ start += offset;
+ end += offset;
+ int count = 0;
+ while (start < end)
+ {
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == end
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ ++count;
+ }
+ return count;
+ }
+
+ /**
* Helper function used to detect which characters have a multi-character
* uppercase expansion. Note that this is only used in locations which
* track one-to-many capitalization (java.lang.Character does not do this).
@@ -1747,4 +1873,43 @@ public final class String implements Serializable, Comparable, CharSequence
return value;
}
+
+ /**
+ * Returns true iff this String contains the sequence of Characters
+ * described in s.
+ * @param s the CharSequence
+ * @return true iff this String contains s
+ */
+ public boolean contains (CharSequence s)
+ {
+ return this.indexOf(s.toString()) != -1;
+ }
+
+ /**
+ * Returns a string that is this string with all instances of the sequence
+ * represented by <code>target</code> replaced by the sequence in
+ * <code>replacement</code>.
+ * @param target the sequence to be replaced
+ * @param replacement the sequence used as the replacement
+ * @return the string constructed as above
+ */
+ public String replace (CharSequence target, CharSequence replacement)
+ {
+ String targetString = target.toString();
+ String replaceString = replacement.toString();
+ int targetLength = target.length();
+ int replaceLength = replacement.length();
+
+ int startPos = this.indexOf(targetString);
+ StringBuilder result = new StringBuilder(this);
+ while (startPos != -1)
+ {
+ // Replace the target with the replacement
+ result.replace(startPos, startPos + targetLength, replaceString);
+
+ // Search for a new occurrence of the target
+ startPos = result.indexOf(targetString, startPos + replaceLength);
+ }
+ return result.toString();
+ }
}
diff --git a/libjava/classpath/java/lang/StringBuffer.java b/libjava/classpath/java/lang/StringBuffer.java
index 94dec4878cb..caffd6e7050 100644
--- a/libjava/classpath/java/lang/StringBuffer.java
+++ b/libjava/classpath/java/lang/StringBuffer.java
@@ -148,6 +148,24 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Create a new <code>StringBuffer</code> with the characters from the
+ * specified <code>CharSequence</code>. Initial capacity will be the
+ * size of the CharSequence plus 16.
+ *
+ * @param sequence the <code>String</code> to convert
+ * @throws NullPointerException if str is null
+ *
+ * @since 1.5
+ */
+ public StringBuffer(CharSequence sequence)
+ {
+ count = Math.max(0, sequence.length());
+ value = new char[count + DEFAULT_CAPACITY];
+ for (int i = 0; i < count; ++i)
+ value[i] = sequence.charAt(i);
+ }
+
+ /**
* Get the length of the <code>String</code> this <code>StringBuffer</code>
* would create. Not to be confused with the <em>capacity</em> of the
* <code>StringBuffer</code>.
@@ -234,7 +252,6 @@ public final class StringBuffer implements Serializable, CharSequence
* @param index the index of the character to get, starting at 0
* @return the character at the specified index
* @throws IndexOutOfBoundsException if index is negative or &gt;= length()
- * (while unspecified, this is a StringIndexOutOfBoundsException)
*/
public synchronized char charAt(int index)
{
@@ -244,6 +261,39 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Get the code point at the specified index. This is like #charAt(int),
+ * but if the character is the start of a surrogate pair, and the
+ * following character completes the pair, then the corresponding
+ * supplementary code point is returned.
+ * @param index the index of the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public synchronized int codePointAt(int index)
+ {
+ return Character.codePointAt(value, index, count);
+ }
+
+ /**
+ * Get the code point before the specified index. This is like
+ * #codePointAt(int), but checks the characters at <code>index-1</code> and
+ * <code>index-2</code> to see if they form a supplementary code point.
+ * @param index the index just past the codepoint to get, starting at 0
+ * @return the codepoint at the specified index
+ * @throws IndexOutOfBoundsException if index is negative or &gt;= length()
+ * @since 1.5
+ */
+ public synchronized int codePointBefore(int index)
+ {
+ // Character.codePointBefore() doesn't perform this check. We
+ // could use the CharSequence overload, but this is just as easy.
+ if (index >= count)
+ throw new IndexOutOfBoundsException();
+ return Character.codePointBefore(value, index, 1);
+ }
+
+ /**
* Get the specified array of characters. <code>srcOffset - srcEnd</code>
* characters will be copied into the array you pass in.
*
@@ -341,6 +391,46 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Append the <code>CharSequence</code> value of the argument to this
+ * <code>StringBuffer</code>.
+ *
+ * @param sequence the <code>CharSequence</code> to append
+ * @return this <code>StringBuffer</code>
+ * @see #append(Object)
+ * @since 1.5
+ */
+ public synchronized StringBuffer append(CharSequence sequence)
+ {
+ if (sequence == null)
+ sequence = "null";
+ return append(sequence, 0, sequence.length());
+ }
+
+ /**
+ * Append the specified subsequence of the <code>CharSequence</code>
+ * argument to this <code>StringBuffer</code>.
+ *
+ * @param sequence the <code>CharSequence</code> to append
+ * @param start the starting index
+ * @param end one past the ending index
+ * @return this <code>StringBuffer</code>
+ * @see #append(Object)
+ * @since 1.5
+ */
+ public synchronized StringBuffer append(CharSequence sequence,
+ int start, int end)
+ {
+ if (sequence == null)
+ sequence = "null";
+ if (start < 0 || end < 0 || start > end || end > sequence.length())
+ throw new IndexOutOfBoundsException();
+ ensureCapacity_unsynchronized(this.count + end - start);
+ for (int i = start; i < end; ++i)
+ value[count++] = sequence.charAt(i);
+ return this;
+ }
+
+ /**
* Append the <code>char</code> array to this <code>StringBuffer</code>.
* This is similar (but more efficient) than
* <code>append(new String(data))</code>, except in the case of null.
@@ -407,6 +497,25 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Append the code point to this <code>StringBuffer</code>.
+ * This is like #append(char), but will append two characters
+ * if a supplementary code point is given.
+ *
+ * @param code the code point to append
+ * @return this <code>StringBuffer</code>
+ * @see Character#toChars(int, char[], int)
+ * @since 1.5
+ */
+ public synchronized StringBuffer appendCodePoint(int code)
+ {
+ int len = Character.charCount(code);
+ ensureCapacity_unsynchronized(count + len);
+ Character.toChars(code, value, count);
+ count += len;
+ return this;
+ }
+
+ /**
* Append the <code>String</code> value of the argument to this
* <code>StringBuffer</code>. Uses <code>String.valueOf()</code> to convert
* to <code>String</code>.
@@ -660,6 +769,54 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * Insert the <code>CharSequence</code> argument into this
+ * <code>StringBuffer</code>. If the sequence is null, the String
+ * "null" is used instead.
+ *
+ * @param offset the place to insert in this buffer
+ * @param sequence the <code>CharSequence</code> to insert
+ * @return this <code>StringBuffer</code>
+ * @throws IndexOutOfBoundsException if offset is out of bounds
+ * @since 1.5
+ */
+ public synchronized StringBuffer insert(int offset, CharSequence sequence)
+ {
+ if (sequence == null)
+ sequence = "null";
+ return insert(offset, sequence, 0, sequence.length());
+ }
+
+ /**
+ * Insert a subsequence of the <code>CharSequence</code> argument into this
+ * <code>StringBuffer</code>. If the sequence is null, the String
+ * "null" is used instead.
+ *
+ * @param offset the place to insert in this buffer
+ * @param sequence the <code>CharSequence</code> to insert
+ * @param start the starting index of the subsequence
+ * @param end one past the ending index of the subsequence
+ * @return this <code>StringBuffer</code>
+ * @throws IndexOutOfBoundsException if offset, start,
+ * or end are out of bounds
+ * @since 1.5
+ */
+ public synchronized StringBuffer insert(int offset, CharSequence sequence,
+ int start, int end)
+ {
+ if (sequence == null)
+ sequence = "null";
+ if (start < 0 || end < 0 || start > end || end > sequence.length())
+ throw new IndexOutOfBoundsException();
+ int len = end - start;
+ ensureCapacity_unsynchronized(count + len);
+ VMSystem.arraycopy(value, offset, value, offset + len, count - offset);
+ for (int i = start; i < end; ++i)
+ value[offset++] = sequence.charAt(i);
+ count += len;
+ return this;
+ }
+
+ /**
* Insert the <code>char[]</code> argument into this
* <code>StringBuffer</code>.
*
@@ -880,6 +1037,106 @@ public final class StringBuffer implements Serializable, CharSequence
}
/**
+ * This may reduce the amount of memory used by the StringBuffer,
+ * by resizing the internal array to remove unused space. However,
+ * this method is not required to resize, so this behavior cannot
+ * be relied upon.
+ * @since 1.5
+ */
+ public synchronized void trimToSize()
+ {
+ int wouldSave = value.length - count;
+ // Some random heuristics: if we save less than 20 characters, who
+ // cares.
+ if (wouldSave < 20)
+ return;
+ // If we save more than 200 characters, shrink.
+ // If we save more than 1/4 of the buffer, shrink.
+ if (wouldSave > 200 || wouldSave * 4 > value.length)
+ {
+ char[] newValue = new char[count];
+ VMSystem.arraycopy(value, 0, newValue, 0, count);
+ value = newValue;
+ }
+ }
+
+ /**
+ * Return the number of code points between two indices in the
+ * <code>StringBuffer</code>. An unpaired surrogate counts as a
+ * code point for this purpose. Characters outside the indicated
+ * range are not examined, even if the range ends in the middle of a
+ * surrogate pair.
+ *
+ * @param start the starting index
+ * @param end one past the ending index
+ * @return the number of code points
+ * @since 1.5
+ */
+ public synchronized int codePointCount(int start, int end)
+ {
+ if (start < 0 || end >= count || start > end)
+ throw new StringIndexOutOfBoundsException();
+
+ int count = 0;
+ while (start < end)
+ {
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == end
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ ++count;
+ }
+ return count;
+ }
+
+ /**
+ * Starting at the given index, this counts forward by the indicated
+ * number of code points, and then returns the resulting index. An
+ * unpaired surrogate counts as a single code point for this
+ * purpose.
+ *
+ * @param start the starting index
+ * @param codePoints the number of code points
+ * @return the resulting index
+ * @since 1.5
+ */
+ public synchronized int offsetByCodePoints(int start, int codePoints)
+ {
+ while (codePoints > 0)
+ {
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ --codePoints;
+ }
+ return start;
+ }
+
+ /**
* An unsynchronized version of ensureCapacity, used internally to avoid
* the cost of a second lock on the same object. This also has the side
* effect of duplicating the array, if it was shared (to form copy-on-write
diff --git a/libjava/classpath/java/lang/StringBuilder.java b/libjava/classpath/java/lang/StringBuilder.java
index b54c8ef7eb4..470f1ba9ad5 100644
--- a/libjava/classpath/java/lang/StringBuilder.java
+++ b/libjava/classpath/java/lang/StringBuilder.java
@@ -464,6 +464,25 @@ public final class StringBuilder
}
/**
+ * Append the code point to this <code>StringBuilder</code>.
+ * This is like #append(char), but will append two characters
+ * if a supplementary code point is given.
+ *
+ * @param code the code point to append
+ * @return this <code>StringBuilder</code>
+ * @see Character#toChars(int, char[], int)
+ * @since 1.5
+ */
+ public synchronized StringBuilder appendCodePoint(int code)
+ {
+ int len = Character.charCount(code);
+ ensureCapacity(count + len);
+ Character.toChars(code, value, count);
+ count += len;
+ return this;
+ }
+
+ /**
* Append the <code>String</code> value of the argument to this
* <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
* to <code>String</code>.
@@ -705,6 +724,52 @@ public final class StringBuilder
}
/**
+ * Insert the <code>CharSequence</code> argument into this
+ * <code>StringBuilder</code>. If the sequence is null, the String
+ * "null" is used instead.
+ *
+ * @param offset the place to insert in this buffer
+ * @param sequence the <code>CharSequence</code> to insert
+ * @return this <code>StringBuilder</code>
+ * @throws IndexOutOfBoundsException if offset is out of bounds
+ */
+ public synchronized StringBuilder insert(int offset, CharSequence sequence)
+ {
+ if (sequence == null)
+ sequence = "null";
+ return insert(offset, sequence, 0, sequence.length());
+ }
+
+ /**
+ * Insert a subsequence of the <code>CharSequence</code> argument into this
+ * <code>StringBuilder</code>. If the sequence is null, the String
+ * "null" is used instead.
+ *
+ * @param offset the place to insert in this buffer
+ * @param sequence the <code>CharSequence</code> to insert
+ * @param start the starting index of the subsequence
+ * @param end one past the ending index of the subsequence
+ * @return this <code>StringBuilder</code>
+ * @throws IndexOutOfBoundsException if offset, start,
+ * or end are out of bounds
+ */
+ public synchronized StringBuilder insert(int offset, CharSequence sequence,
+ int start, int end)
+ {
+ if (sequence == null)
+ sequence = "null";
+ if (start < 0 || end < 0 || start > end || end > sequence.length())
+ throw new IndexOutOfBoundsException();
+ int len = end - start;
+ ensureCapacity(count + len);
+ VMSystem.arraycopy(value, offset, value, offset + len, count - offset);
+ for (int i = start; i < end; ++i)
+ value[offset++] = sequence.charAt(i);
+ count += len;
+ return this;
+ }
+
+ /**
* Insert the <code>char[]</code> argument into this
* <code>StringBuilder</code>.
*
diff --git a/libjava/classpath/java/lang/System.java b/libjava/classpath/java/lang/System.java
index e466d3b8cfb..ea84dba47e2 100644
--- a/libjava/classpath/java/lang/System.java
+++ b/libjava/classpath/java/lang/System.java
@@ -464,7 +464,7 @@ public final class System
*
* @param finalizeOnExit whether to run finalizers on exit
* @throws SecurityException if permission is denied
- * @see Runtime#runFinalizersOnExit()
+ * @see Runtime#runFinalizersOnExit(boolean)
* @since 1.1
* @deprecated never rely on finalizers to do a clean, thread-safe,
* mop-up from your code
diff --git a/libjava/classpath/java/lang/Thread.java b/libjava/classpath/java/lang/Thread.java
index 37ca630b4ed..763228c16ef 100644
--- a/libjava/classpath/java/lang/Thread.java
+++ b/libjava/classpath/java/lang/Thread.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.lang;
+import java.security.Permission;
import java.util.Map;
import java.util.WeakHashMap;
@@ -704,7 +705,7 @@ public class Thread implements Runnable
*
* @return the context class loader
* @throws SecurityException when permission is denied
- * @see setContextClassLoader(ClassLoader)
+ * @see #setContextClassLoader(ClassLoader)
* @since 1.2
*/
public synchronized ClassLoader getContextClassLoader()
@@ -726,7 +727,7 @@ public class Thread implements Runnable
*
* @param classloader the new context class loader
* @throws SecurityException when permission is denied
- * @see getContextClassLoader()
+ * @see #getContextClassLoader()
* @since 1.2
*/
public synchronized void setContextClassLoader(ClassLoader classloader)
@@ -812,8 +813,11 @@ public class Thread implements Runnable
{
// Check parameters
- if (ms < 0 || ns < 0 || ns > 999999)
- throw new IllegalArgumentException();
+ if (ms < 0 )
+ throw new IllegalArgumentException("Negative milliseconds: " + ms);
+
+ if (ns < 0 || ns > 999999)
+ throw new IllegalArgumentException("Nanoseconds ouf of range: " + ns);
// Really sleep
VMThread.sleep(ms, ns);
diff --git a/libjava/classpath/java/lang/ThreadLocal.java b/libjava/classpath/java/lang/ThreadLocal.java
index 0b2b60867b9..bc839044574 100644
--- a/libjava/classpath/java/lang/ThreadLocal.java
+++ b/libjava/classpath/java/lang/ThreadLocal.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.lang;
import java.util.Map;
-import java.util.WeakHashMap;
/**
diff --git a/libjava/classpath/java/lang/ref/Reference.java b/libjava/classpath/java/lang/ref/Reference.java
index 1ec72438198..4b6a3adbcc1 100644
--- a/libjava/classpath/java/lang/ref/Reference.java
+++ b/libjava/classpath/java/lang/ref/Reference.java
@@ -68,7 +68,7 @@ package java.lang.ref;
* work. It is useful to keep track, when an object is finalized.
*
* @author Jochen Hoenicke
- * @see java.util.WeakHashtable
+ * @see java.util.WeakHashMap
*/
public abstract class Reference
{
@@ -104,7 +104,7 @@ public abstract class Reference
* Creates a new reference that is not registered to any queue.
* Since it is package private, it is not possible to overload this
* class in a different package.
- * @param referent the object we refer to.
+ * @param ref the object we refer to.
*/
Reference(Object ref)
{
@@ -115,7 +115,7 @@ public abstract class Reference
* Creates a reference that is registered to a queue. Since this is
* package private, it is not possible to overload this class in a
* different package.
- * @param referent the object we refer to.
+ * @param ref the object we refer to.
* @param q the reference queue to register on.
* @exception NullPointerException if q is null.
*/
diff --git a/libjava/classpath/java/lang/ref/WeakReference.java b/libjava/classpath/java/lang/ref/WeakReference.java
index 9f758ca1eab..b4018fbb55e 100644
--- a/libjava/classpath/java/lang/ref/WeakReference.java
+++ b/libjava/classpath/java/lang/ref/WeakReference.java
@@ -52,7 +52,7 @@ package java.lang.ref;
* automatically cleared, and you may remove it from the set. <br>
*
* @author Jochen Hoenicke
- * @see java.util.WeakHashtable
+ * @see java.util.WeakHashMap
*/
public class WeakReference
extends Reference
diff --git a/libjava/classpath/java/lang/reflect/Member.java b/libjava/classpath/java/lang/reflect/Member.java
index 9983b275a94..c39731f8487 100644
--- a/libjava/classpath/java/lang/reflect/Member.java
+++ b/libjava/classpath/java/lang/reflect/Member.java
@@ -60,7 +60,7 @@ public interface Member
* package-protected, but only which are declared in this class.
* Used in SecurityManager.checkMemberAccess() to determine the
* type of members to access.
- * @see SecurityManager#checkMemberAccess()
+ * @see SecurityManager#checkMemberAccess(Class, int)
*/
int DECLARED = 1;
@@ -68,7 +68,7 @@ public interface Member
* Represents public members only, but includes all inherited members.
* Used in SecurityManager.checkMemberAccess() to determine the type of
* members to access.
- * @see SecurityManager#checkMemberAccess()
+ * @see SecurityManager#checkMemberAccess(Class, int)
*/
int PUBLIC = 0;
diff --git a/libjava/classpath/java/lang/reflect/Proxy.java b/libjava/classpath/java/lang/reflect/Proxy.java
index 7a5fd30de16..137cb5a48a6 100644
--- a/libjava/classpath/java/lang/reflect/Proxy.java
+++ b/libjava/classpath/java/lang/reflect/Proxy.java
@@ -100,7 +100,7 @@ import java.util.Set;
* belongs to the classloader you designated.</li>
* <li>Reflection works as expected: {@link Class#getInterfaces()} and
* {@link Class#getMethods()} work as they do on normal classes.</li>
- * <li>The method {@link #isProxyClass()} will distinguish between
+ * <li>The method {@link #isProxyClass(Class)} will distinguish between
* true proxy classes and user extensions of this class. It only
* returns true for classes created by {@link #getProxyClass}.</li>
* <li>The {@link ProtectionDomain} of a proxy class is the same as for
@@ -111,8 +111,8 @@ import java.util.Set;
* the only way to create an instance of the proxy class.</li>
* <li>The proxy class contains a single constructor, which takes as
* its only argument an {@link InvocationHandler}. The method
- * {@link #newInstance} is shorthand to do the necessary
- * reflection.</li>
+ * {@link #newProxyInstance(ClassLoader, Class[], InvocationHandler)}
+ * is shorthand to do the necessary reflection.</li>
* </ul>
*
* <h3>Proxy Instances</h3>
@@ -126,7 +126,7 @@ import java.util.Set;
* a {@link ClassCastException}.</li>
* <li>Each proxy instance has an invocation handler, which can be
* accessed by {@link #getInvocationHandler(Object)}. Any call
- * to an interface method, including {@link Object#hashcode()},
+ * to an interface method, including {@link Object#hashCode()},
* {@link Object#equals(Object)}, or {@link Object#toString()},
* but excluding the public final methods of Object, will be
* encoded and passed to the {@link InvocationHandler#invoke}
@@ -413,8 +413,6 @@ public class Proxy implements Serializable
*/
ProxyType(ClassLoader loader, Class[] interfaces)
{
- if (loader == null)
- loader = ClassLoader.getSystemClassLoader();
this.loader = loader;
this.interfaces = interfaces;
}
@@ -426,8 +424,7 @@ public class Proxy implements Serializable
*/
public int hashCode()
{
- //loader is always not null
- int hash = loader.hashCode();
+ int hash = loader == null ? 0 : loader.hashCode();
for (int i = 0; i < interfaces.length; i++)
hash = hash * 31 + interfaces[i].hashCode();
return hash;
@@ -436,7 +433,7 @@ public class Proxy implements Serializable
/**
* Calculates equality.
*
- * @param the object to compare to
+ * @param other object to compare to
* @return true if it is a ProxyType with same data
*/
public boolean equals(Object other)
@@ -586,7 +583,7 @@ public class Proxy implements Serializable
/**
* Calculates equality.
*
- * @param the object to compare to
+ * @param other object to compare to
* @return true if it is a ProxySignature with same data
*/
public boolean equals(Object other)
@@ -617,7 +614,7 @@ public class Proxy implements Serializable
* The package this class is in <b>including the trailing dot</b>
* or an empty string for the unnamed (aka default) package.
*/
- String pack;
+ String pack = "";
/**
* The interfaces this class implements. Non-null, but possibly empty.
diff --git a/libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java b/libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java
index 6d5a8008459..ea574ad7c61 100644
--- a/libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java
+++ b/libjava/classpath/java/lang/reflect/UndeclaredThrowableException.java
@@ -65,7 +65,7 @@ public class UndeclaredThrowableException extends RuntimeException
/**
* The immutable exception that this wraps. This field is redundant
- * with {@link Throwable#cause}, but is necessary for serial compatibility.
+ * with {@link Throwable#getCause()}, but is necessary for serial compatibility.
*
* @serial the chained exception
*/
diff --git a/libjava/classpath/java/math/BigDecimal.java b/libjava/classpath/java/math/BigDecimal.java
index d99be0f56ba..693c399874e 100644
--- a/libjava/classpath/java/math/BigDecimal.java
+++ b/libjava/classpath/java/math/BigDecimal.java
@@ -43,12 +43,27 @@ public class BigDecimal extends Number implements Comparable
private int scale;
private static final long serialVersionUID = 6108874887143696463L;
- private static final BigDecimal ZERO =
+ /**
+ * The constant zero as a BigDecimal with scale zero.
+ * @since 1.5
+ */
+ public static final BigDecimal ZERO =
new BigDecimal (BigInteger.valueOf (0), 0);
- private static final BigDecimal ONE =
+ /**
+ * The constant one as a BigDecimal with scale zero.
+ * @since 1.5
+ */
+ public static final BigDecimal ONE =
new BigDecimal (BigInteger.valueOf (1), 0);
+ /**
+ * The constant ten as a BigDecimal with scale zero.
+ * @since 1.5
+ */
+ public static final BigDecimal TEN =
+ new BigDecimal (BigInteger.valueOf (10), 0);
+
public static final int ROUND_UP = 0;
public static final int ROUND_DOWN = 1;
public static final int ROUND_CEILING = 2;
diff --git a/libjava/classpath/java/math/BigInteger.java b/libjava/classpath/java/math/BigInteger.java
index 82f550d144c..5a336b87248 100644
--- a/libjava/classpath/java/math/BigInteger.java
+++ b/libjava/classpath/java/math/BigInteger.java
@@ -76,7 +76,8 @@ public class BigInteger extends Number implements Comparable
private static final long serialVersionUID = -8287574255936472291L;
- /** We pre-allocate integers in the range minFixNum..maxFixNum. */
+ /** We pre-allocate integers in the range minFixNum..maxFixNum.
+ * Note that we must at least preallocate 0, 1, and 10. */
private static final int minFixNum = -100;
private static final int maxFixNum = 1024;
private static final int numFixNum = maxFixNum-minFixNum+1;
@@ -87,11 +88,23 @@ public class BigInteger extends Number implements Comparable
smallFixNums[i] = new BigInteger(i + minFixNum);
}
- // JDK1.2
+ /**
+ * The constant zero as a BigInteger.
+ * @since 1.2
+ */
public static final BigInteger ZERO = smallFixNums[-minFixNum];
- // JDK1.2
+ /**
+ * The constant one as a BigInteger.
+ * @since 1.2
+ */
public static final BigInteger ONE = smallFixNums[1 - minFixNum];
+
+ /**
+ * The constant ten as a BigInteger.
+ * @since 1.5
+ */
+ public static final BigInteger TEN = smallFixNums[10 - minFixNum];
/* Rounding modes: */
private static final int FLOOR = 1;
diff --git a/libjava/classpath/java/net/DatagramSocket.java b/libjava/classpath/java/net/DatagramSocket.java
index 875ddc778e9..40bafbb34dd 100644
--- a/libjava/classpath/java/net/DatagramSocket.java
+++ b/libjava/classpath/java/net/DatagramSocket.java
@@ -484,7 +484,6 @@ public class DatagramSocket
* @param address The address to connect this socket to.
* @param port The port to connect this socket to.
*
- * @exception SocketException If an error occurs.
* @exception IllegalArgumentException If address or port are invalid.
* @exception SecurityException If the caller is not allowed to send
* datagrams to or receive from this address and port.
diff --git a/libjava/classpath/java/net/Inet4Address.java b/libjava/classpath/java/net/Inet4Address.java
index 74ce6efb828..c80f1f175a2 100644
--- a/libjava/classpath/java/net/Inet4Address.java
+++ b/libjava/classpath/java/net/Inet4Address.java
@@ -70,7 +70,7 @@ public final class Inet4Address extends InetAddress
* only by static methods in this class.
*
* @param addr The IP number of this address as an array of bytes
- * @param hostname The hostname of this IP address.
+ * @param host The hostname of this IP address.
*/
Inet4Address(byte[] addr, String host)
{
diff --git a/libjava/classpath/java/net/InetSocketAddress.java b/libjava/classpath/java/net/InetSocketAddress.java
index 30d34e7e808..edeaf27753c 100644
--- a/libjava/classpath/java/net/InetSocketAddress.java
+++ b/libjava/classpath/java/net/InetSocketAddress.java
@@ -216,6 +216,6 @@ public class InetSocketAddress extends SocketAddress
*/
public String toString()
{
- return (addr == null ? hostname : addr.getHostName()) + ":" + port;
+ return (addr == null ? hostname : addr.toString()) + ":" + port;
}
}
diff --git a/libjava/classpath/java/net/ServerSocket.java b/libjava/classpath/java/net/ServerSocket.java
index f73c7482aa5..afc861403a1 100644
--- a/libjava/classpath/java/net/ServerSocket.java
+++ b/libjava/classpath/java/net/ServerSocket.java
@@ -316,7 +316,8 @@ public class ServerSocket
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
- sm.checkListen(impl.getLocalPort());
+ sm.checkAccept(impl.getInetAddress().getHostAddress(),
+ impl.getLocalPort());
Socket socket = new Socket();
@@ -369,6 +370,7 @@ public class ServerSocket
impl.accept(socket.impl);
socket.implCreated = true;
+ socket.bound = true;
}
/**
diff --git a/libjava/classpath/java/net/Socket.java b/libjava/classpath/java/net/Socket.java
index 9432a6be1d8..0ff6e6ea032 100644
--- a/libjava/classpath/java/net/Socket.java
+++ b/libjava/classpath/java/net/Socket.java
@@ -91,8 +91,9 @@ public class Socket
/**
* True if the socket is bound.
+ * Package private so it can be set from ServerSocket when accept is called.
*/
- private boolean bound;
+ boolean bound;
/**
* True if input is shutdown.
@@ -324,7 +325,9 @@ public class Socket
}
catch (IOException e)
{
- throw new SocketException(e.getMessage());
+ SocketException se = new SocketException(e.toString());
+ se.initCause(e);
+ throw se;
}
return impl;
@@ -481,7 +484,7 @@ public class Socket
/**
* Returns the local address to which this socket is bound. If this socket
* is not connected, then a wildcard address, for which
- * @see isAnyLocalAddress() is <code>true</code>, is returned.
+ * @see InetAddress#isAnyLocalAddress() is <code>true</code>, is returned.
*
* @return The local address
*
diff --git a/libjava/classpath/java/net/URL.java b/libjava/classpath/java/net/URL.java
index 627dbc391e9..1d947a0b46a 100644
--- a/libjava/classpath/java/net/URL.java
+++ b/libjava/classpath/java/net/URL.java
@@ -408,10 +408,7 @@ public final class URL implements Serializable
// The 1.2 doc specifically says these are copied to the new URL.
host = context.host;
port = context.port;
- file = context.file;
userInfo = context.userInfo;
- if (file == null || file.length() == 0)
- file = "/";
authority = context.authority;
}
}
@@ -423,10 +420,13 @@ public final class URL implements Serializable
protocol = context.protocol;
host = context.host;
port = context.port;
- file = context.file;
userInfo = context.userInfo;
- if (file == null || file.length() == 0)
- file = "/";
+ if (spec.indexOf(":/", 1) < 0)
+ {
+ file = context.file;
+ if (file == null || file.length() == 0)
+ file = "/";
+ }
authority = context.authority;
}
else // Protocol NOT specified in spec. and no context available.
diff --git a/libjava/classpath/java/net/URLClassLoader.java b/libjava/classpath/java/net/URLClassLoader.java
index 85b38578169..9d0e5041006 100644
--- a/libjava/classpath/java/net/URLClassLoader.java
+++ b/libjava/classpath/java/net/URLClassLoader.java
@@ -235,12 +235,10 @@ public class URLClassLoader extends SecureClassLoader
abstract static class Resource
{
final URLLoader loader;
- final String name;
- Resource(URLLoader loader, String name)
+ Resource(URLLoader loader)
{
this.loader = loader;
- this.name = name;
}
/**
@@ -391,11 +389,13 @@ public class URLClassLoader extends SecureClassLoader
static final class JarURLResource extends Resource
{
private final JarEntry entry;
+ private final String name;
JarURLResource(JarURLLoader loader, String name, JarEntry entry)
{
- super(loader, name);
+ super(loader);
this.entry = entry;
+ this.name = name;
}
InputStream getInputStream() throws IOException
@@ -496,7 +496,7 @@ public class URLClassLoader extends SecureClassLoader
RemoteResource(RemoteURLLoader loader, String name, URL url,
InputStream stream, int length)
{
- super(loader, name);
+ super(loader);
this.url = url;
this.stream = stream;
this.length = length;
@@ -535,9 +535,16 @@ public class URLClassLoader extends SecureClassLoader
/** get resource with the name "name" in the file url */
Resource getResource(String name)
{
- File file = new File(dir, name);
- if (file.exists() && !file.isDirectory())
- return new FileResource(this, name, file);
+ try
+ {
+ File file = new File(dir, name).getCanonicalFile();
+ if (file.exists() && !file.isDirectory())
+ return new FileResource(this, file);
+ }
+ catch (IOException e)
+ {
+ // Fall through...
+ }
return null;
}
}
@@ -546,9 +553,9 @@ public class URLClassLoader extends SecureClassLoader
{
final File file;
- FileResource(FileURLLoader loader, String name, File file)
+ FileResource(FileURLLoader loader, File file)
{
- super(loader, name);
+ super(loader);
this.file = file;
}
@@ -566,8 +573,7 @@ public class URLClassLoader extends SecureClassLoader
{
try
{
- return new URL(loader.baseURL, name,
- loader.classloader.getURLStreamHandler("file"));
+ return file.toURL();
}
catch (MalformedURLException e)
{
@@ -701,7 +707,7 @@ public class URLClassLoader extends SecureClassLoader
private void addURLImpl(URL newUrl)
{
- synchronized (urlloaders)
+ synchronized (this)
{
if (newUrl == null)
return; // Silently ignore...
@@ -748,19 +754,42 @@ public class URLClassLoader extends SecureClassLoader
}
/**
- * Adds an array of new locations to the end of the internal URL store.
+ * Adds an array of new locations to the end of the internal URL
+ * store. Called from the the constructors. Should not call to the
+ * protected addURL() method since that can be overridden and
+ * subclasses are not yet in a good state at this point.
+ * jboss 4.0.3 for example depends on this.
+ *
* @param newUrls the locations to add
*/
private void addURLs(URL[] newUrls)
{
for (int i = 0; i < newUrls.length; i++)
- addURL(newUrls[i]);
+ {
+ urls.add(newUrls[i]);
+ addURLImpl(newUrls[i]);
+ }
+ }
+
+ /**
+ * Look in both Attributes for a given value. The first Attributes
+ * object, if not null, has precedence.
+ */
+ private String getAttributeValue(Attributes.Name name, Attributes first,
+ Attributes second)
+ {
+ String result = null;
+ if (first != null)
+ result = first.getValue(name);
+ if (result == null)
+ result = second.getValue(name);
+ return result;
}
/**
* Defines a Package based on the given name and the supplied manifest
- * information. The manifest indicates the tile, version and
- * vendor information of the specification and implementation and wheter the
+ * information. The manifest indicates the title, version and
+ * vendor information of the specification and implementation and whether the
* package is sealed. If the Manifest indicates that the package is sealed
* then the Package will be sealed with respect to the supplied URL.
*
@@ -768,20 +797,43 @@ public class URLClassLoader extends SecureClassLoader
* @param manifest The manifest describing the specification,
* implementation and sealing details of the package
* @param url the code source url to seal the package
- * @exception IllegalArgumentException If this package name already exists
- * in this class loader
* @return the defined Package
+ * @throws IllegalArgumentException If this package name already exists
+ * in this class loader
*/
protected Package definePackage(String name, Manifest manifest, URL url)
throws IllegalArgumentException
{
+ // Compute the name of the package as it may appear in the
+ // Manifest.
+ StringBuffer xform = new StringBuffer(name);
+ for (int i = xform.length () - 1; i >= 0; --i)
+ if (xform.charAt(i) == '.')
+ xform.setCharAt(i, '/');
+ xform.append('/');
+ String xformName = xform.toString();
+
+ Attributes entryAttr = manifest.getAttributes(xformName);
Attributes attr = manifest.getMainAttributes();
- String specTitle = attr.getValue(Attributes.Name.SPECIFICATION_TITLE);
- String specVersion = attr.getValue(Attributes.Name.SPECIFICATION_VERSION);
- String specVendor = attr.getValue(Attributes.Name.SPECIFICATION_VENDOR);
- String implTitle = attr.getValue(Attributes.Name.IMPLEMENTATION_TITLE);
- String implVersion = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
- String implVendor = attr.getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
+
+ String specTitle
+ = getAttributeValue(Attributes.Name.SPECIFICATION_TITLE,
+ entryAttr, attr);
+ String specVersion
+ = getAttributeValue(Attributes.Name.SPECIFICATION_VERSION,
+ entryAttr, attr);
+ String specVendor
+ = getAttributeValue(Attributes.Name.SPECIFICATION_VENDOR,
+ entryAttr, attr);
+ String implTitle
+ = getAttributeValue(Attributes.Name.IMPLEMENTATION_TITLE,
+ entryAttr, attr);
+ String implVersion
+ = getAttributeValue(Attributes.Name.IMPLEMENTATION_VERSION,
+ entryAttr, attr);
+ String implVendor
+ = getAttributeValue(Attributes.Name.IMPLEMENTATION_VENDOR,
+ entryAttr, attr);
// Look if the Manifest indicates that this package is sealed
// XXX - most likely not completely correct!
@@ -793,8 +845,10 @@ public class URLClassLoader extends SecureClassLoader
// make sure that the URL is null so the package is not sealed
url = null;
- return definePackage(name, specTitle, specVersion, specVendor, implTitle,
- implVersion, implVendor, url);
+ return definePackage(name,
+ specTitle, specVendor, specVersion,
+ implTitle, implVendor, implVersion,
+ url);
}
/**
@@ -819,47 +873,47 @@ public class URLClassLoader extends SecureClassLoader
// construct the class (and watch out for those nasty IOExceptions)
try
{
- byte[] data;
- InputStream in = resource.getInputStream();
- try
- {
- int length = resource.getLength();
- if (length != -1)
- {
- // We know the length of the data.
- // Just try to read it in all at once
- data = new byte[length];
- int pos = 0;
- while (length - pos > 0)
- {
- int len = in.read(data, pos, length - pos);
- if (len == -1)
- throw new EOFException("Not enough data reading from: "
- + in);
- pos += len;
- }
- }
- else
- {
- // We don't know the data length.
- // Have to read it in chunks.
- ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
- byte[] b = new byte[4096];
- int l = 0;
- while (l != -1)
- {
- l = in.read(b);
- if (l != -1)
- out.write(b, 0, l);
- }
- data = out.toByteArray();
- }
- }
- finally
- {
- in.close();
- }
- final byte[] classData = data;
+ byte[] data;
+ InputStream in = resource.getInputStream();
+ try
+ {
+ int length = resource.getLength();
+ if (length != -1)
+ {
+ // We know the length of the data.
+ // Just try to read it in all at once
+ data = new byte[length];
+ int pos = 0;
+ while (length - pos > 0)
+ {
+ int len = in.read(data, pos, length - pos);
+ if (len == -1)
+ throw new EOFException("Not enough data reading from: "
+ + in);
+ pos += len;
+ }
+ }
+ else
+ {
+ // We don't know the data length.
+ // Have to read it in chunks.
+ ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
+ byte[] b = new byte[4096];
+ int l = 0;
+ while (l != -1)
+ {
+ l = in.read(b);
+ if (l != -1)
+ out.write(b, 0, l);
+ }
+ data = out.toByteArray();
+ }
+ }
+ finally
+ {
+ in.close();
+ }
+ final byte[] classData = data;
// Now get the CodeSource
final CodeSource source = resource.getCodeSource();
@@ -926,7 +980,7 @@ public class URLClassLoader extends SecureClassLoader
*/
public String toString()
{
- synchronized (urlloaders)
+ synchronized (this)
{
if (thisString == null)
{
diff --git a/libjava/classpath/java/net/URLConnection.java b/libjava/classpath/java/net/URLConnection.java
index 0a12d588d9a..836f174dae6 100644
--- a/libjava/classpath/java/net/URLConnection.java
+++ b/libjava/classpath/java/net/URLConnection.java
@@ -530,7 +530,7 @@ public abstract class URLConnection
}
/**
- * Returns the value of a flag indicating whether or not input is going
+ * Sets the value of a flag indicating whether or not input is going
* to be done for this connection. This default to true unless the
* doOutput flag is set to false, in which case this defaults to false.
*
@@ -560,7 +560,7 @@ public abstract class URLConnection
}
/**
- * Returns a boolean flag indicating whether or not output will be done
+ * Sets a boolean flag indicating whether or not output will be done
* on this connection. The default value is false, so this method can
* be used to override the default
*
@@ -851,7 +851,7 @@ public abstract class URLConnection
}
/**
- * Set's the ContentHandlerFactory for an application. This can be called
+ * Sets the ContentHandlerFactory for an application. This can be called
* once and only once. If it is called again, then an Error is thrown.
* Unlike for other set factory methods, this one does not do a security
* check prior to setting the factory.
@@ -933,7 +933,7 @@ public abstract class URLConnection
}
/**
- * This method set the <code>FileNameMap</code> object being used
+ * This method sets the <code>FileNameMap</code> object being used
* to decode MIME types by file extension.
*
* @param map The <code>FileNameMap</code>.
diff --git a/libjava/classpath/java/net/URLStreamHandler.java b/libjava/classpath/java/net/URLStreamHandler.java
index 57ce2dfa290..ed95092219e 100644
--- a/libjava/classpath/java/net/URLStreamHandler.java
+++ b/libjava/classpath/java/net/URLStreamHandler.java
@@ -411,8 +411,6 @@ public abstract class URLStreamHandler
* @param url2 The second URL.
*
* @return True if both URLs contain the same host.
- *
- * @exception UnknownHostException If an unknown host is found
*/
protected boolean hostsEqual(URL url1, URL url2)
{
@@ -511,18 +509,24 @@ public abstract class URLStreamHandler
int size = protocol.length() + authority.length() + file.length() + 24;
StringBuffer sb = new StringBuffer(size);
- if (protocol != null && protocol.length() > 0)
+ if (protocol.length() > 0)
{
sb.append(protocol);
sb.append(":");
}
- if (authority.length() != 0)
- {
- sb.append("//").append(authority);
- }
-
- sb.append(file);
+ // If we have superfluous leading slashes (that means, at least 2)
+ // we always add the authority component ("//" + host) to
+ // avoid ambiguity. Otherwise we would generate an URL like
+ // proto://home/foo
+ // where we meant:
+ // host: <empty> - file: //home/foo
+ // but URL spec says it is:
+ // host: home - file: /foo
+ if (authority.length() != 0 || file.startsWith("//") )
+ sb.append("//").append(authority).append(file);
+ else
+ sb.append(file);
if (ref != null)
sb.append('#').append(ref);
diff --git a/libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java b/libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java
index 42ceab7e2c1..847c02cce06 100644
--- a/libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java
+++ b/libjava/classpath/java/nio/channels/spi/AbstractSelectableChannel.java
@@ -43,6 +43,7 @@ import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
+import java.nio.channels.IllegalBlockingModeException;
import java.util.LinkedList;
import java.util.ListIterator;
@@ -209,6 +210,8 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
* @return the registered selection key
*
* @exception ClosedChannelException If the channel is already closed.
+ * @exception IllegalBlockingModeException If the channel is configured in
+ * blocking mode.
*/
public final SelectionKey register(Selector selin, int ops, Object att)
throws ClosedChannelException
@@ -224,6 +227,9 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
synchronized (blockingLock())
{
+ if (blocking)
+ throw new IllegalBlockingModeException();
+
key = locate(selector);
if (key != null && key.isValid())
diff --git a/libjava/classpath/java/nio/charset/Charset.java b/libjava/classpath/java/nio/charset/Charset.java
index 0476b0daa2c..91801ddac87 100644
--- a/libjava/classpath/java/nio/charset/Charset.java
+++ b/libjava/classpath/java/nio/charset/Charset.java
@@ -38,19 +38,15 @@ exception statement from your version. */
package java.nio.charset;
+import gnu.classpath.ServiceFactory;
import gnu.classpath.SystemProperties;
-
import gnu.java.nio.charset.Provider;
import gnu.java.nio.charset.iconv.IconvProvider;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.spi.CharsetProvider;
import java.util.Collections;
-import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -174,7 +170,7 @@ public abstract class Charset implements Comparable
* Returns the Charset instance for the charset of the given name.
*
* @param charsetName
- * @return
+ * @return the Charset instance for the indicated charset
* @throws UnsupportedCharsetException if this VM does not support
* the charset of the given name.
* @throws IllegalCharsetNameException if the given charset name is
@@ -265,23 +261,10 @@ public abstract class Charset implements Comparable
{
try
{
- Enumeration en = ClassLoader.getSystemResources
- ("META-INF/services/java.nio.charset.spi.CharsetProvider");
+ Iterator i = ServiceFactory.lookupProviders(CharsetProvider.class);
LinkedHashSet set = new LinkedHashSet();
- while (en.hasMoreElements())
- {
- BufferedReader rdr = new BufferedReader(new InputStreamReader
- (((URL) (en.nextElement())).openStream()));
- while (true)
- {
- String s = rdr.readLine();
- if (s == null)
- break;
- CharsetProvider p =
- (CharsetProvider) ((Class.forName(s)).newInstance());
- set.add(p);
- }
- }
+ while (i.hasNext())
+ set.add(i.next());
providers = new CharsetProvider[set.size()];
set.toArray(providers);
diff --git a/libjava/classpath/java/rmi/activation/ActivationGroup_Stub.java b/libjava/classpath/java/rmi/activation/ActivationGroup_Stub.java
new file mode 100644
index 00000000000..249137b0863
--- /dev/null
+++ b/libjava/classpath/java/rmi/activation/ActivationGroup_Stub.java
@@ -0,0 +1,110 @@
+/* ActivationGroup_Stub.java -- Stub class for ActivationGroup impls.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.rmi.activation;
+
+import java.lang.reflect.Method;
+import java.rmi.MarshalledObject;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+import java.rmi.server.RemoteRef;
+import java.rmi.server.RemoteStub;
+
+/**
+ * A stub class for {@link ActivationGroup} implementations.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class ActivationGroup_Stub extends RemoteStub
+ implements ActivationInstantiator, Remote
+{
+ private static final long serialVersionUID = 2L;
+
+ /**
+ * Creates a new instance of ActivationGroup_Stub.
+ *
+ * @param ref the remote reference
+ */
+ public ActivationGroup_Stub(RemoteRef ref)
+ {
+ super(ref);
+ }
+
+ /**
+ * Stub method for <code>ActivationGroup.newInstance()</code>.
+ *
+ * @param id the activation ID
+ * @param desc the activation description
+ *
+ * @return the return value of the invocation
+ *
+ * @throws RemoteException if the invocation throws a RemoteException
+ * @throws ActivationException if the invocation throws an
+ * ActivationException
+ */
+ public MarshalledObject newInstance(ActivationID id, ActivationDesc desc)
+ throws RemoteException, ActivationException
+ {
+ try
+ {
+ Method method = ActivationGroup_Stub.class.getDeclaredMethod
+ ("newInstance", new Class[]{ ActivationID.class,
+ ActivationDesc.class });
+ return (MarshalledObject) ref.invoke(this, method,
+ new Object[]{id, desc},
+ -5274445189091581345L);
+ }
+ catch (RuntimeException ex)
+ {
+ throw ex;
+ }
+ catch (RemoteException ex)
+ {
+ throw ex;
+ }
+ catch (ActivationException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new UnexpectedException("Unexpected exception", ex);
+ }
+ }
+}
diff --git a/libjava/classpath/java/rmi/server/LoaderHandler.java b/libjava/classpath/java/rmi/server/LoaderHandler.java
index 189085710b4..0489cd16634 100644
--- a/libjava/classpath/java/rmi/server/LoaderHandler.java
+++ b/libjava/classpath/java/rmi/server/LoaderHandler.java
@@ -45,7 +45,11 @@ import java.net.URL;
*/
public interface LoaderHandler
{
- String packagePrefix = "";
+ /**
+ * For binary compatibility with the JDK, the string "sun.rmi.server".
+ * Not actually used for anything.
+ */
+ String packagePrefix = "sun.rmi.server";
/**
* @deprecated
diff --git a/libjava/classpath/java/rmi/server/RMIClassLoader.java b/libjava/classpath/java/rmi/server/RMIClassLoader.java
index a7a7cb84a58..f8997fd7e09 100644
--- a/libjava/classpath/java/rmi/server/RMIClassLoader.java
+++ b/libjava/classpath/java/rmi/server/RMIClassLoader.java
@@ -38,14 +38,10 @@ exception statement from your version. */
package java.rmi.server;
+import gnu.java.rmi.server.RMIClassLoaderImpl;
+
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.StringTokenizer;
-
/**
* This class provides a set of public static utility methods for supporting
@@ -60,221 +56,77 @@ public class RMIClassLoader
*/
private RMIClassLoader() {}
- private static class MyClassLoader extends URLClassLoader
- {
- // Package-private to avoid a trampoline constructor.
- MyClassLoader (URL[] urls, ClassLoader parent, String annotation)
- {
- super (urls, parent);
- this.annotation = annotation;
- }
-
- private MyClassLoader (URL[] urls, ClassLoader parent)
- {
- super (urls, parent);
- this.annotation = urlToAnnotation (urls);
- }
-
- public static String urlToAnnotation (URL[] urls)
- {
- if (urls.length == 0)
- return null;
-
- StringBuffer annotation = new StringBuffer (64 * urls.length);
-
- for (int i = 0; i < urls.length; i++)
- {
- annotation.append (urls [i].toExternalForm());
- annotation.append (' ');
- }
-
- return annotation.toString();
- }
-
- public final String getClassAnnotation()
- {
- return annotation;
- }
-
- private final String annotation;
- }
-
- /**
- * This class is used to identify a cached classloader by its codebase and
- * the context classloader that is its parent.
- */
- private static class CacheKey
- {
- private String mCodeBase;
- private ClassLoader mContextClassLoader;
-
- public CacheKey (String theCodebase, ClassLoader theContextClassLoader)
- {
- mCodeBase = theCodebase;
- mContextClassLoader = theContextClassLoader;
- }
-
- /**
- * @return true if the codebase and the context classloader are equal
- */
- public boolean equals (Object theOther)
- {
- if (theOther instanceof CacheKey)
- {
- CacheKey key = (CacheKey) theOther;
-
- return (equals (this.mCodeBase,key.mCodeBase)
- && equals (this.mContextClassLoader, key.mContextClassLoader));
- }
- return false;
- }
-
- /**
- * Test if the two objects are equal or both null.
- * @param theOne
- * @param theOther
- * @return
- */
- private boolean equals (Object theOne, Object theOther)
- {
- return theOne != null ? theOne.equals (theOther) : theOther == null;
- }
-
- /**
- * @return hashCode
- */
- public int hashCode()
- {
- return ((mCodeBase != null ? mCodeBase.hashCode() : 0)
- ^(mContextClassLoader != null ? mContextClassLoader.hashCode() : -1));
- }
-
- public String toString()
- {
- return "[" + mCodeBase + "," + mContextClassLoader + "]";
- }
-
- }
-
- private static Map cacheLoaders; //map annotations to loaders
- private static Map cacheAnnotations; //map loaders to annotations
-
- //defaultAnnotation is got from system property
- // "java.rmi.server.defaultAnnotation"
- private static String defaultAnnotation;
-
- //URL object for defaultAnnotation
- private static URL defaultCodebase;
-
- //class loader for defaultAnnotation
- private static MyClassLoader defaultLoader;
-
- static
- {
- // 89 is a nice prime number for Hashtable initial capacity
- cacheLoaders = new Hashtable (89);
- cacheAnnotations = new Hashtable (89);
-
- defaultAnnotation = System.getProperty ("java.rmi.server.defaultAnnotation");
-
- try
- {
- if (defaultAnnotation != null)
- defaultCodebase = new URL (defaultAnnotation);
- }
- catch (Exception _)
- {
- defaultCodebase = null;
- }
-
- if (defaultCodebase != null)
- {
- defaultLoader = new MyClassLoader (new URL[] { defaultCodebase }, null,
- defaultAnnotation);
- cacheLoaders.put (new CacheKey (defaultAnnotation,
- Thread.currentThread().getContextClassLoader()),
- defaultLoader);
- }
- }
-
/**
* @deprecated
*/
- public static Class loadClass (String name)
+ public static Class loadClass(String name)
throws MalformedURLException, ClassNotFoundException
{
- return loadClass ("", name);
+ return loadClass("", name);
}
- public static Class loadClass (String codebases, String name)
+ public static Class loadClass(String codebase, String name)
throws MalformedURLException, ClassNotFoundException
{
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
- //try context class loader first
- try
- {
- return Class.forName(name, false, loader);
- }
- catch (ClassNotFoundException e)
- {
- // class not found in the local classpath
- }
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.loadClass(codebase, name, null);
+ }
- if (codebases.length() == 0) //==""
- {
- loader = defaultLoader;
- }
- else
- {
- loader = getClassLoader(codebases);
- }
+ public static Class loadClass(String codebase, String name,
+ ClassLoader defaultLoader)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.loadClass(codebase, name, defaultLoader);
+ }
- if (loader == null)
- {
- //do not throw NullPointerException
- throw new ClassNotFoundException ("Could not find class (" + name +
- ") at codebase (" + codebases + ")");
- }
-
- return Class.forName(name, false, loader);
+ /**
+ * Loads a class from <code>codeBase</code>.
+ *
+ * This method delegates to
+ * {@link RMIClassLoaderSpi#loadClass(String, String, ClassLoader)} and
+ * passes <code>codeBase.toString()</code> as first argument,
+ * <code>name</code> as second argument and <code>null</code> as third
+ * argument.
+ *
+ * @param codeBase the code base from which to load the class
+ * @param name the name of the class
+ *
+ * @return the loaded class
+ *
+ * @throws MalformedURLException if the URL is not well formed
+ * @throws ClassNotFoundException if the requested class cannot be found
+ */
+ public static Class loadClass(URL codeBase, String name)
+ throws MalformedURLException, ClassNotFoundException
+ {
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.loadClass(codeBase.toString(), name, null);
}
/**
* Gets a classloader for the given codebase and with the current
* context classloader as parent.
*
- * @param codebases
+ * @param codebase
*
* @return a classloader for the given codebase
*
* @throws MalformedURLException if the codebase contains a malformed URL
*/
- public static ClassLoader getClassLoader (String codebases)
+ public static ClassLoader getClassLoader(String codebase)
throws MalformedURLException
{
- ClassLoader loader;
- CacheKey loaderKey = new CacheKey
- (codebases, Thread.currentThread().getContextClassLoader());
- loader = (ClassLoader) cacheLoaders.get (loaderKey);
-
- if (loader == null)
- {
- //create an entry in cacheLoaders mapping a loader to codebases.
- // codebases are separated by " "
- StringTokenizer tok = new StringTokenizer (codebases, " ");
- ArrayList urls = new ArrayList();
-
- while (tok.hasMoreTokens())
- urls.add (new URL (tok.nextToken()));
-
- loader = new MyClassLoader ((URL[]) urls.toArray (new URL [urls.size()]),
- Thread.currentThread().getContextClassLoader(),
- codebases);
- cacheLoaders.put (loaderKey, loader);
- }
-
- return loader;
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.getClassLoader(codebase);
}
/**
@@ -286,47 +138,12 @@ public class RMIClassLoader
* @return a space seperated list of URLs where the class-definition
* of cl may be found
*/
- public static String getClassAnnotation (Class cl)
+ public static String getClassAnnotation(Class cl)
{
- ClassLoader loader = cl.getClassLoader();
-
- if (loader == null
- || loader == ClassLoader.getSystemClassLoader())
- {
- return System.getProperty ("java.rmi.server.codebase");
- }
-
- if (loader instanceof MyClassLoader)
- {
- return ((MyClassLoader) loader).getClassAnnotation();
- }
-
- String s = (String) cacheAnnotations.get (loader);
-
- if (s != null)
- return s;
-
- if (loader instanceof URLClassLoader)
- {
- URL[] urls = ((URLClassLoader) loader).getURLs();
-
- if (urls.length == 0)
- return null;
-
- StringBuffer annotation = new StringBuffer (64 * urls.length);
-
- for (int i = 0; i < urls.length; i++)
- {
- annotation.append (urls [i].toExternalForm());
- annotation.append (' ');
- }
-
- s = annotation.toString();
- cacheAnnotations.put (loader, s);
- return s;
- }
-
- return System.getProperty ("java.rmi.server.codebase");
+ RMIClassLoaderSpi spi = getProviderInstance();
+ if (spi == null)
+ spi = getDefaultProviderInstance();
+ return spi.getClassAnnotation(cl);
}
/**
@@ -336,4 +153,25 @@ public class RMIClassLoader
{
throw new Error ("Not implemented");
}
+
+ /**
+ * Returns the default service provider for <code>RMIClassLoader</code>.
+ *
+ * @return the default provider for <code>RMIClassLoader</code>
+ */
+ public static RMIClassLoaderSpi getDefaultProviderInstance()
+ {
+ return RMIClassLoaderImpl.getInstance();
+ }
+
+ /**
+ * Chooses, instantiates and returns a service provider.
+ *
+ * @return a service provider
+ */
+ private static RMIClassLoaderSpi getProviderInstance()
+ {
+ // TODO: Do something more useful here.
+ return null;
+ }
}
diff --git a/libjava/classpath/java/rmi/server/RemoteObject.java b/libjava/classpath/java/rmi/server/RemoteObject.java
index 0b3c229c9d9..60e57dc2428 100644
--- a/libjava/classpath/java/rmi/server/RemoteObject.java
+++ b/libjava/classpath/java/rmi/server/RemoteObject.java
@@ -120,7 +120,9 @@ public boolean equals(Object obj) {
in.read (); //some unknown UnicastRef2 field
}
- cname = RemoteRef.packagePrefix + '.' + cname;
+ // It would be nice to use RemoteRef.packagePrefix here, but for binary
+ // compatibility with the JDK that has to contain "sun.rmi.server"...
+ cname = "gnu.java.rmi.server." + cname;
try
{
Class cls = Class.forName(cname);
diff --git a/libjava/classpath/java/rmi/server/RemoteRef.java b/libjava/classpath/java/rmi/server/RemoteRef.java
index 7e34db39e89..f33f9d374c3 100644
--- a/libjava/classpath/java/rmi/server/RemoteRef.java
+++ b/libjava/classpath/java/rmi/server/RemoteRef.java
@@ -48,7 +48,11 @@ public interface RemoteRef extends Externalizable
{
long serialVersionUID = 3632638527362204081L;
- String packagePrefix = "gnu.java.rmi.server";
+ /**
+ * For binary compatibility with the JDK, the string "sun.rmi.server".
+ * Not actually used for anything.
+ */
+ String packagePrefix = "sun.rmi.server";
/**
* @deprecated
diff --git a/libjava/classpath/java/security/AccessControlContext.java b/libjava/classpath/java/security/AccessControlContext.java
index 9a6ad208144..3b51e94125b 100644
--- a/libjava/classpath/java/security/AccessControlContext.java
+++ b/libjava/classpath/java/security/AccessControlContext.java
@@ -77,14 +77,23 @@ public final class AccessControlContext
/**
* Construct a new AccessControlContext with the specified
- * ProtectionDomains and DomainCombiner
+ * {@link ProtectionDomain}s and {@link DomainCombiner}.
*
+ * <p>Code calling this constructor must have a {@link
+ * SecurityPermission} of <i>createAccessControlContext</i>.</p>
+ *
+ * @throws SecurityException If the caller does not have permission
+ * to create an access control context.
* @since 1.3
*/
public AccessControlContext(AccessControlContext acc,
DomainCombiner combiner)
{
- // XXX check permission to call this.
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ {
+ sm.checkPermission (new SecurityPermission ("createAccessControlContext"));
+ }
AccessControlContext acc2 = AccessController.getContext();
protectionDomains = combiner.combine (acc2.protectionDomains,
acc.protectionDomains);
@@ -119,10 +128,20 @@ public final class AccessControlContext
public void checkPermission(Permission perm) throws AccessControlException
{
if (protectionDomains.length == 0)
- throw new AccessControlException ("permission not granted");
+ throw new AccessControlException ("permission "
+ + perm
+ + " not granted: no protection domains");
+
for (int i = 0; i < protectionDomains.length; i++)
- if (!protectionDomains[i].implies(perm))
- throw new AccessControlException ("permission not granted");
+ {
+ final ProtectionDomain domain = protectionDomains[i];
+ if (!domain.implies(perm))
+ throw new AccessControlException ("permission "
+ + perm
+ + " not granted: "
+ + domain
+ + " does not imply it.");
+ }
}
/**
@@ -173,4 +192,9 @@ public final class AccessControlContext
return h;
}
+
+ ProtectionDomain[] getProtectionDomains ()
+ {
+ return protectionDomains;
+ }
}
diff --git a/libjava/classpath/java/security/AccessController.java b/libjava/classpath/java/security/AccessController.java
index bc9c2deefbb..93e34b87c22 100644
--- a/libjava/classpath/java/security/AccessController.java
+++ b/libjava/classpath/java/security/AccessController.java
@@ -142,8 +142,8 @@ public final class AccessController
* @param action the <code>PrivilegedExceptionAction</code> whose
* <code>run()</code> should be be called.
* @return the result of the <code>action.run()</code> method.
- * @exception PrivilegedActionException wrapped around any exception that
- * is thrown in the <code>run()</code> method.
+ * @exception PrivilegedActionException wrapped around any checked exception
+ * that is thrown in the <code>run()</code> method.
*/
public static Object doPrivileged(PrivilegedExceptionAction action)
throws PrivilegedActionException
@@ -153,6 +153,10 @@ public final class AccessController
{
return action.run();
}
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
catch (Exception e)
{
throw new PrivilegedActionException(e);
@@ -178,8 +182,8 @@ public final class AccessController
* @param context the <code>AccessControlContext</code> whose protection
* domains should be added to the protection domain of the calling class.
* @return the result of the <code>action.run()</code> method.
- * @exception PrivilegedActionException wrapped around any exception that
- * is thrown in the <code>run()</code> method.
+ * @exception PrivilegedActionException wrapped around any checked exception
+ * that is thrown in the <code>run()</code> method.
*/
public static Object doPrivileged(PrivilegedExceptionAction action,
AccessControlContext context)
@@ -190,6 +194,10 @@ public final class AccessController
{
return action.run();
}
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
catch (Exception e)
{
throw new PrivilegedActionException(e);
diff --git a/libjava/classpath/java/security/Identity.java b/libjava/classpath/java/security/Identity.java
index 26b01a50a6b..7ef59cfe2de 100644
--- a/libjava/classpath/java/security/Identity.java
+++ b/libjava/classpath/java/security/Identity.java
@@ -297,8 +297,8 @@ public abstract class Identity implements Principal, Serializable
if (identity == this)
return true;
- if ((((Identity) identity).getName() == this.name) &&
- (((Identity) identity).getScope() == this.scope))
+ if ((((Identity) identity).getName().equals(this.name)) &&
+ (((Identity) identity).getScope().equals(this.scope)))
return true;
return identityEquals((Identity) identity);
@@ -319,8 +319,8 @@ public abstract class Identity implements Principal, Serializable
*/
protected boolean identityEquals(Identity identity)
{
- return ((identity.getName() == this.name) &&
- (identity.getPublicKey() == this.publicKey));
+ return ((identity.getName().equals(this.name)) &&
+ (identity.getPublicKey().equals(this.publicKey)));
}
/**
diff --git a/libjava/classpath/java/security/ProtectionDomain.java b/libjava/classpath/java/security/ProtectionDomain.java
index a5851b5adf4..a8a09392504 100644
--- a/libjava/classpath/java/security/ProtectionDomain.java
+++ b/libjava/classpath/java/security/ProtectionDomain.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package java.security;
+import gnu.classpath.SystemProperties;
+
/**
* <p>This <code>ProtectionDomain</code> class encapsulates the characteristics
* of a domain, which encloses a set of classes whose instances are granted a
@@ -222,7 +224,7 @@ public class ProtectionDomain
*/
public String toString()
{
- String linesep = System.getProperty("line.separator");
+ String linesep = SystemProperties.getProperty("line.separator");
StringBuffer sb = new StringBuffer("ProtectionDomain (").append(linesep);
if (code_source == null)
diff --git a/libjava/classpath/java/security/Security.java b/libjava/classpath/java/security/Security.java
index 54b97923efd..fd51d0535b3 100644
--- a/libjava/classpath/java/security/Security.java
+++ b/libjava/classpath/java/security/Security.java
@@ -1,5 +1,5 @@
/* Security.java --- Java base security class implementation
- Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -651,7 +651,7 @@ public final class Security
if (result.isEmpty())
return null;
- return (Provider[]) result.toArray(new Provider[0]);
+ return (Provider[]) result.toArray(new Provider[result.size()]);
}
private static void selectProviders(String svc, String algo, String attr,
diff --git a/libjava/classpath/java/text/AttributedString.java b/libjava/classpath/java/text/AttributedString.java
index 9f0d5af1c49..c751ab43cf8 100644
--- a/libjava/classpath/java/text/AttributedString.java
+++ b/libjava/classpath/java/text/AttributedString.java
@@ -49,7 +49,7 @@ import java.util.Set;
/**
* This class models a <code>String</code> with attributes over various
* subranges of the string. It allows applications to access this
- * information via the <code>AttributedCharcterIterator</code> interface.
+ * information via the <code>AttributedCharacterIterator</code> interface.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
@@ -166,16 +166,16 @@ public class AttributedString
*
* @param aci The <code>AttributedCharacterIterator</code> containing the
* text and attribute information.
- * @param begin_index The beginning index of the text subrange.
- * @param end_index The ending index of the text subrange.
+ * @param begin The beginning index of the text subrange.
+ * @param end The ending index of the text subrange.
* @param attributes A list of attributes to include from the iterator, or
* <code>null</code> to include all attributes.
*/
- public AttributedString(AttributedCharacterIterator aci, int begin_index,
- int end_index, AttributedCharacterIterator.Attribute[] attributes)
+ public AttributedString(AttributedCharacterIterator aci, int begin, int end,
+ AttributedCharacterIterator.Attribute[] attributes)
{
// Validate some arguments
- if ((begin_index < 0) || (end_index < begin_index))
+ if ((begin < 0) || (end < begin) || end > aci.getEndIndex())
throw new IllegalArgumentException("Bad index values");
StringBuffer sb = new StringBuffer("");
@@ -186,7 +186,7 @@ public class AttributedString
all_attribs.retainAll(Arrays.asList(attributes));
// Loop through and extract the attributes
- char c = aci.setIndex(begin_index);
+ char c = aci.setIndex(begin);
ArrayList accum = new ArrayList();
do
@@ -209,28 +209,28 @@ public class AttributedString
int rl = aci.getRunLimit(attrib);
if (rl == -1)
continue;
- if (rl > end_index)
- rl = end_index;
- rl -= begin_index;
+ if (rl > end)
+ rl = end;
+ rl -= begin;
// Check to see if we already processed this one
int rs = aci.getRunStart(attrib);
- if ((rs < aci.getIndex()) && (aci.getIndex() != begin_index))
+ if ((rs < aci.getIndex()) && (aci.getIndex() != begin))
continue;
// If the attribute run starts before the beginning index, we
// need to junk it if it is an Annotation.
Object attrib_obj = aci.getAttribute(attrib);
- if (rs < begin_index)
+ if (rs < begin)
{
if (attrib_obj instanceof Annotation)
continue;
- rs = begin_index;
+ rs = begin;
}
else
{
- rs -= begin_index;
+ rs -= begin;
}
// Create a map object. Yes this will only contain one attribute
@@ -269,22 +269,23 @@ public class AttributedString
*
* @param attrib The attribute to add.
* @param value The value of the attribute, which may be <code>null</code>.
- * @param begin_index The beginning index of the subrange.
- * @param end_index The ending index of the subrange.
+ * @param begin The beginning index of the subrange.
+ * @param end The ending index of the subrange.
*
* @exception IllegalArgumentException If attribute is <code>null</code> or
* the subrange is not valid.
*/
public void addAttribute(AttributedCharacterIterator.Attribute attrib,
- Object value, int begin_index, int end_index)
+ Object value, int begin, int end)
{
if (attrib == null)
throw new IllegalArgumentException("null attribute");
-
+ if (end <= begin)
+ throw new IllegalArgumentException("Requires end > begin");
HashMap hm = new HashMap();
hm.put(attrib, value);
- addAttributes(hm, begin_index, end_index);
+ addAttributes(hm, begin, end);
}
/**
@@ -295,16 +296,17 @@ public class AttributedString
* @param begin_index The beginning index.
* @param end_index The ending index
*
- * @throws IllegalArgumentException If the list is <code>null</code> or the
- * subrange is not valid.
+ * @throws NullPointerException if <code>attributes</code> is
+ * <code>null</code>.
+ * @throws IllegalArgumentException if the subrange is not valid.
*/
public void addAttributes(Map attributes, int begin_index, int end_index)
{
if (attributes == null)
- throw new IllegalArgumentException("null attribute");
+ throw new NullPointerException("null attribute");
if ((begin_index < 0) || (end_index > sci.getEndIndex()) ||
- (end_index < begin_index))
+ (end_index <= begin_index))
throw new IllegalArgumentException("bad range");
AttributeRange[] new_list = new AttributeRange[attribs.length + 1];
diff --git a/libjava/classpath/java/text/AttributedStringIterator.java b/libjava/classpath/java/text/AttributedStringIterator.java
index 7fba5d63c3a..f6b9b186831 100644
--- a/libjava/classpath/java/text/AttributedStringIterator.java
+++ b/libjava/classpath/java/text/AttributedStringIterator.java
@@ -188,30 +188,44 @@ class AttributedStringIterator implements AttributedCharacterIterator
return(getRunLimit(s));
}
- public synchronized int getRunLimit(Set attribute_set)
+ public synchronized int getRunLimit(Set attributeSet)
{
- boolean hit = false;
- int runLimit = ci.getEndIndex ();
- int pos = ci.getIndex ();
-
- for (int i = 0; i < attribs.length; ++i)
+ if (attributeSet == null)
+ return ci.getEndIndex();
+
+ int current = ci.getIndex();
+ int end = ci.getEndIndex();
+ int limit = current;
+ if (current == end)
+ return end;
+ Map runValues = getAttributes();
+ while (limit < end)
+ {
+ Iterator iterator = attributeSet.iterator();
+ while (iterator.hasNext())
{
- if (pos >= attribs[i].begin_index &&
- pos < attribs[i].end_index)
+ // Qualified name is a workaround for a gcj 4.0 bug.
+ AttributedCharacterIterator.Attribute attributeKey
+ = (AttributedCharacterIterator.Attribute) iterator.next();
+ Object v1 = runValues.get(attributeKey);
+ Object v2 = getAttribute(attributeKey, limit + 1);
+ boolean changed = false;
+ // check for equal or both null, if NO return start
+ if (v1 != null)
+ {
+ changed = !v1.equals(v2);
+ }
+ else
{
- Iterator iter = attribute_set.iterator();
- while(iter.hasNext())
- if (attribs[i].attribs.containsKey(iter.next()))
- {
- hit = true;
- runLimit = Math.min(runLimit, attribs[i].end_index);
- }
+ changed = (v2 != null);
}
+ if (changed)
+ return limit + 1;
}
- if (hit)
- return runLimit;
- else
- return ci.getEndIndex();
+ // no differences, so increment limit and next and loop again
+ limit++;
+ }
+ return end;
}
/*************************************************************************/
@@ -221,69 +235,128 @@ class AttributedStringIterator implements AttributedCharacterIterator
* attribute combinations.
*/
+ /**
+ * Returns the index of the first character in the run containing the current
+ * character and defined by all the attributes defined for that character
+ * position.
+ *
+ * @return The run start index.
+ */
public int getRunStart()
{
return(getRunStart(getAttributes().keySet()));
}
+ /**
+ * Returns the index of the first character in the run, defined by the
+ * specified attribute, that contains the current character.
+ *
+ * @param attrib the attribute (<code>null</code> permitted).
+ *
+ * return The index of the first character in the run.
+ */
public int getRunStart(AttributedCharacterIterator.Attribute attrib)
{
+ if (attrib == null)
+ return ci.getBeginIndex();
HashSet s = new HashSet();
s.add(attrib);
-
return(getRunStart(s));
}
- public int getRunStart(Set attribute_set)
+ /**
+ * Returns the index of the first character in the run, defined by the
+ * specified attribute set, that contains the current character.
+ *
+ * @param attributeSet the attribute set (<code>null</code> permitted).
+ *
+ * return The index of the first character in the run.
+ */
+ public int getRunStart(Set attributeSet)
{
- boolean hit = false;
- int runBegin = 0;
- int pos = ci.getIndex();
-
- for (int i = 0; i < attribs.length; ++i)
+ if (attributeSet == null)
+ return ci.getBeginIndex();
+
+ int current = ci.getIndex();
+ int begin = ci.getBeginIndex();
+ int start = current;
+ if (start == begin)
+ return begin;
+ Map runValues = getAttributes();
+ int prev = start - 1;
+ while (start > begin)
+ {
+ Iterator iterator = attributeSet.iterator();
+ while (iterator.hasNext())
{
- if (pos >= attribs[i].begin_index &&
- pos <= attribs[i].end_index)
+ // Qualified name is a workaround for a gcj 4.0 bug.
+ AttributedCharacterIterator.Attribute attributeKey
+ = (AttributedCharacterIterator.Attribute) iterator.next();
+ Object v1 = runValues.get(attributeKey);
+ Object v2 = getAttribute(attributeKey, prev);
+ boolean changed = false;
+ // check for equal or both null, if NO return start
+ if (v1 != null)
+ {
+ changed = !v1.equals(v2);
+ }
+ else
{
- Iterator iter = attribute_set.iterator();
- while(iter.hasNext())
- if (attribs[i].attribs.containsKey(iter.next()))
- {
- hit = true;
- runBegin = Math.max(runBegin, attribs[i].begin_index);
- }
+ changed = (v2 != null);
}
+ if (changed)
+ return start;
}
- if (hit)
- return runBegin;
- else
- return -1;
+ // no differences, so decrement start and prev and loop again
+ start--;
+ prev--;
+ }
+ return start;
}
/*************************************************************************/
- public Object getAttribute(AttributedCharacterIterator.Attribute attrib)
+ /**
+ * Returns the value for an attribute at the specified position. If the
+ * attribute key (<code>key</code>) is <code>null</code>, the method returns
+ * <code>null</code>.
+ *
+ * @param key the key (<code>null</code> permitted).
+ * @param pos the character position.
+ *
+ * @return The attribute value (possibly <code>null</code>).
+ */
+ private Object getAttribute(AttributedCharacterIterator.Attribute key,
+ int pos)
{
if (attribs == null)
- return(null);
-
- for (int i = 0; i < attribs.length; i++)
+ return null;
+ for (int i = attribs.length - 1; i >= 0; i--)
{
- Set key_set = attribs[i].attribs.keySet();
- Iterator iter = key_set.iterator();
- while (iter.hasNext())
+ if (pos >= attribs[i].begin_index && pos < attribs[i].end_index)
{
- Object obj = iter.next();
-
- // Check for attribute match and range match
- if (obj.equals(attrib))
- if ((ci.getIndex() >= attribs[i].begin_index) &&
- (ci.getIndex() < attribs[i].end_index))
- return(attribs[i].attribs.get(obj));
+ Set keys = attribs[i].attribs.keySet();
+ if (keys.contains(key))
+ {
+ return attribs[i].attribs.get(key);
+ }
}
}
-
- return(null);
+ return null;
+ }
+
+ /**
+ * Returns the value for an attribute at the current position. If the
+ * attribute key (<code>key</code>) is <code>null</code>, the method returns
+ * <code>null</code>.
+ *
+ * @param key the key (<code>null</code> permitted).
+ *
+ * @return The attribute value (possibly <code>null</code>).
+ */
+ public Object getAttribute(AttributedCharacterIterator.Attribute key)
+ {
+ return getAttribute(key, ci.getIndex());
}
/*************************************************************************/
diff --git a/libjava/classpath/java/text/CharacterIterator.java b/libjava/classpath/java/text/CharacterIterator.java
index 58d6ddc3951..42da33c432f 100644
--- a/libjava/classpath/java/text/CharacterIterator.java
+++ b/libjava/classpath/java/text/CharacterIterator.java
@@ -68,7 +68,7 @@ public interface CharacterIterator extends Cloneable
* <code>getEndIndex() - 1</code>, it will not be incremented.
*
* @return The character at the position of the incremented index value,
- * or <code>DONE</code> if the index has reached getEndIndex() - 1
+ * or {@link #DONE} if the index has reached getEndIndex() - 1
*/
char next();
diff --git a/libjava/classpath/java/text/DateFormat.java b/libjava/classpath/java/text/DateFormat.java
index 5d412aada52..73aa62d9805 100644
--- a/libjava/classpath/java/text/DateFormat.java
+++ b/libjava/classpath/java/text/DateFormat.java
@@ -58,6 +58,9 @@ import java.util.TimeZone;
public abstract class DateFormat extends Format implements Cloneable
{
+ private static final long serialVersionUID = 7218322306649953788L;
+
+ // Names fixed by serialization spec.
protected Calendar calendar;
protected NumberFormat numberFormat;
diff --git a/libjava/classpath/java/text/ParsePosition.java b/libjava/classpath/java/text/ParsePosition.java
index 782f5e0eda2..b0a8a4a0b36 100644
--- a/libjava/classpath/java/text/ParsePosition.java
+++ b/libjava/classpath/java/text/ParsePosition.java
@@ -136,6 +136,15 @@ public class ParsePosition
ParsePosition other = (ParsePosition) obj;
return index == other.index && error_index == other.error_index;
}
+
+ /**
+ * Return the hash code for this object.
+ * @return the hash code
+ */
+ public int hashCode()
+ {
+ return index ^ error_index;
+ }
/**
* This method returns a <code>String</code> representation of this
diff --git a/libjava/classpath/java/text/RuleBasedCollator.java b/libjava/classpath/java/text/RuleBasedCollator.java
index ae84a41032d..5756e9aa791 100644
--- a/libjava/classpath/java/text/RuleBasedCollator.java
+++ b/libjava/classpath/java/text/RuleBasedCollator.java
@@ -510,7 +510,7 @@ main_parse_loop:
int idx;
// Parse the subrules but do not iterate through all
- // sublist. This is the priviledge of the first call.
+ // sublist. This is the privilege of the first call.
idx = subParseString(true, sorted_rules, base_offset+i, subrules);
// Merge new parsed rules into the list.
diff --git a/libjava/classpath/java/text/StringCharacterIterator.java b/libjava/classpath/java/text/StringCharacterIterator.java
index e2674881333..85ca302cbe8 100644
--- a/libjava/classpath/java/text/StringCharacterIterator.java
+++ b/libjava/classpath/java/text/StringCharacterIterator.java
@@ -143,7 +143,7 @@ public final class StringCharacterIterator implements CharacterIterator
* an existing StringCharacterIterator and resets the beginning and
* ending index.
*
- * @param scci The StringCharacterIterator to copy the info from
+ * @param sci The StringCharacterIterator to copy the info from
* @param begin The beginning index of the range we are interested in.
* @param end The ending index of the range we are interested in.
*/
@@ -340,6 +340,16 @@ public final class StringCharacterIterator implements CharacterIterator
&& index == sci.index
&& text.equals (sci.text));
}
+
+ /**
+ * Return the hash code for this object.
+ * @return the hash code
+ */
+ public int hashCode()
+ {
+ // Incorporate all the data in a goofy way.
+ return begin ^ end ^ index ^ text.hashCode();
+ }
/*************************************************************************/
diff --git a/libjava/classpath/java/util/ArrayList.java b/libjava/classpath/java/util/ArrayList.java
index 82bcca8c3e0..752f9da4ee0 100644
--- a/libjava/classpath/java/util/ArrayList.java
+++ b/libjava/classpath/java/util/ArrayList.java
@@ -551,7 +551,7 @@ public class ArrayList extends AbstractList
/**
* Serializes this object to the given stream.
*
- * @param out the stream to write to
+ * @param s the stream to write to
* @throws IOException if the underlying stream fails
* @serialData the size field (int), the length of the backing array
* (int), followed by its elements (Objects) in proper order.
@@ -572,7 +572,7 @@ public class ArrayList extends AbstractList
/**
* Deserializes this object from the given stream.
*
- * @param in the stream to read from
+ * @param s the stream to read from
* @throws ClassNotFoundException if the underlying stream fails
* @throws IOException if the underlying stream fails
* @serialData the size field (int), the length of the backing array
diff --git a/libjava/classpath/java/util/Arrays.java b/libjava/classpath/java/util/Arrays.java
index 15c1a5f33bf..b28c156b46e 100644
--- a/libjava/classpath/java/util/Arrays.java
+++ b/libjava/classpath/java/util/Arrays.java
@@ -2353,6 +2353,186 @@ public class Arrays
}
/**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (long[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (int[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (short[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (char[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (byte[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (boolean[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (float[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (double[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (Object[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
* Inner class used by {@link #asList(Object[])} to provide a list interface
* to an array. The name, though it clashes with java.util.ArrayList, is
* Sun's choice for Serialization purposes. Element addition and removal
diff --git a/libjava/classpath/java/util/Calendar.java b/libjava/classpath/java/util/Calendar.java
index 88bd76bcadc..f94bed40dad 100644
--- a/libjava/classpath/java/util/Calendar.java
+++ b/libjava/classpath/java/util/Calendar.java
@@ -914,8 +914,19 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public boolean equals(Object o)
{
- return (o instanceof Calendar)
- && getTimeInMillis() == ((Calendar) o).getTimeInMillis();
+ if (! (o instanceof Calendar))
+ return false;
+ Calendar cal = (Calendar) o;
+ if (getTimeInMillis() == ((Calendar) o).getTimeInMillis()
+ && cal.getFirstDayOfWeek() == getFirstDayOfWeek()
+ && cal.isLenient() == isLenient()
+ && cal.getMinimalDaysInFirstWeek() == getMinimalDaysInFirstWeek())
+ {
+ TimeZone self = getTimeZone();
+ TimeZone oth = cal.getTimeZone();
+ return self == null ? oth == null : self.equals(oth);
+ }
+ return false;
}
/**
@@ -926,7 +937,13 @@ public abstract class Calendar implements Serializable, Cloneable
public int hashCode()
{
long time = getTimeInMillis();
- return (int) ((time & 0xffffffffL) ^ (time >> 32));
+ int val = (int) ((time & 0xffffffffL) ^ (time >> 32));
+ val += (getFirstDayOfWeek() + (isLenient() ? 1230 : 1237)
+ + getMinimalDaysInFirstWeek());
+ TimeZone self = getTimeZone();
+ if (self != null)
+ val ^= self.hashCode();
+ return val;
}
/**
diff --git a/libjava/classpath/java/util/Collections.java b/libjava/classpath/java/util/Collections.java
index ed8a00500c6..e650bf8bda9 100644
--- a/libjava/classpath/java/util/Collections.java
+++ b/libjava/classpath/java/util/Collections.java
@@ -1731,8 +1731,8 @@ public class Collections
}
/**
- * The implementation of {@link #singletonMap(Object)}. This class name
- * is required for compatibility with Sun's JDK serializability.
+ * The implementation of {@link #singletonMap(Object, Object)}. This class
+ * name is required for compatibility with Sun's JDK serializability.
*
* @author Eric Blake (ebb9@email.byu.edu)
*/
@@ -2518,12 +2518,13 @@ public class Collections
}
/**
- * Add an element to the end of the underlying list (optional operation).
- * If the list imposes restraints on what can be inserted, such as no null
- * elements, this should be documented. A lock is obtained on the mutex before
- * any of the elements are added.
+ * Add the contents of a collection to the underlying list at the given
+ * index (optional operation). If the list imposes restraints on what
+ * can be inserted, such as no null elements, this should be documented.
+ * A lock is obtained on the mutex before any of the elements are added.
*
- * @param o the object to add
+ * @param index the index at which to insert
+ * @param c the collection to add
* @return <code>true</code>, as defined by Collection for a modified list
* @throws UnsupportedOperationException if this list does not support the
* add operation
@@ -3858,7 +3859,7 @@ public class Collections
/**
* Called only by trusted code to specify the mutex as well as the set.
* @param sync the mutex
- * @param l the list
+ * @param ss the set
*/
SynchronizedSortedSet(Object sync, SortedSet ss)
{
diff --git a/libjava/classpath/java/util/GregorianCalendar.java b/libjava/classpath/java/util/GregorianCalendar.java
index b086a7d04a4..89b7c4dbd02 100644
--- a/libjava/classpath/java/util/GregorianCalendar.java
+++ b/libjava/classpath/java/util/GregorianCalendar.java
@@ -868,6 +868,17 @@ public class GregorianCalendar extends Calendar
areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true;
}
+
+ /**
+ * Return a hash code for this object, following the general contract
+ * specified by {@link Object#hashCode()}.
+ * @return the hash code
+ */
+ public int hashCode()
+ {
+ int val = (int) ((gregorianCutover >>> 32) ^ (gregorianCutover & 0xffffffff));
+ return super.hashCode() ^ val;
+ }
/**
* Compares the given calendar with this. An object, o, is
@@ -890,7 +901,8 @@ public class GregorianCalendar extends Calendar
return false;
GregorianCalendar cal = (GregorianCalendar) o;
- return (cal.getTimeInMillis() == getTimeInMillis());
+ return (cal.gregorianCutover == gregorianCutover
+ && super.equals(o));
}
/**
diff --git a/libjava/classpath/java/util/HashMap.java b/libjava/classpath/java/util/HashMap.java
index 5ca9cf6d500..7176db0d58e 100644
--- a/libjava/classpath/java/util/HashMap.java
+++ b/libjava/classpath/java/util/HashMap.java
@@ -449,7 +449,7 @@ public class HashMap extends AbstractMap
*
* @param value the value to search for in this HashMap
* @return true if at least one key maps to the value
- * @see containsKey(Object)
+ * @see #containsKey(Object)
*/
public boolean containsValue(Object value)
{
diff --git a/libjava/classpath/java/util/InvalidPropertiesFormatException.java b/libjava/classpath/java/util/InvalidPropertiesFormatException.java
new file mode 100644
index 00000000000..6540c2313f3
--- /dev/null
+++ b/libjava/classpath/java/util/InvalidPropertiesFormatException.java
@@ -0,0 +1,57 @@
+/* InvalidPropertiesFormatException.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util;
+
+import java.io.IOException;
+
+// FIXME: serialization methods should throw NotSerializableException
+/** @since 1.5 */
+public class InvalidPropertiesFormatException extends IOException
+{
+ public InvalidPropertiesFormatException(String message)
+ {
+ super(message);
+ }
+
+ public InvalidPropertiesFormatException(Throwable cause)
+ {
+ super();
+ initCause(cause);
+ }
+}
diff --git a/libjava/classpath/java/util/Locale.java b/libjava/classpath/java/util/Locale.java
index 6d3f8463252..9e7bbfea2b3 100644
--- a/libjava/classpath/java/util/Locale.java
+++ b/libjava/classpath/java/util/Locale.java
@@ -915,7 +915,7 @@ public final class Locale implements Serializable, Cloneable
/**
* Write the locale to an object stream.
*
- * @param output the stream to write to
+ * @param s the stream to write to
* @throws IOException if the write fails
* @serialData The first three fields are Strings representing language,
* country, and variant. The fourth field is a placeholder for
@@ -935,7 +935,7 @@ public final class Locale implements Serializable, Cloneable
/**
* Reads a locale from the input stream.
*
- * @param input the stream to read from
+ * @param s the stream to read from
* @throws IOException if reading fails
* @throws ClassNotFoundException if reading fails
* @serialData the hashCode is always invalid and must be recomputed
diff --git a/libjava/classpath/java/util/Map.java b/libjava/classpath/java/util/Map.java
index 256e98899f6..986ab9a84b4 100644
--- a/libjava/classpath/java/util/Map.java
+++ b/libjava/classpath/java/util/Map.java
@@ -324,10 +324,10 @@ public interface Map
* this must be:
*
<p><pre>(o instanceof Map.Entry)
-&& (getKey() == null ? ((HashMap) o).getKey() == null
- : getKey().equals(((HashMap) o).getKey()))
-&& (getValue() == null ? ((HashMap) o).getValue() == null
- : getValue().equals(((HashMap) o).getValue()))</pre>
+&& (getKey() == null ? ((Map.Entry) o).getKey() == null
+ : getKey().equals(((Map.Entry) o).getKey()))
+&& (getValue() == null ? ((Map.Entry) o).getValue() == null
+ : getValue().equals(((Map.Entry) o).getValue()))</pre>
*
* @param o the object to compare
*
diff --git a/libjava/classpath/java/util/Properties.java b/libjava/classpath/java/util/Properties.java
index f00615ba0bf..7c468da8b4f 100644
--- a/libjava/classpath/java/util/Properties.java
+++ b/libjava/classpath/java/util/Properties.java
@@ -47,6 +47,25 @@ import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DefaultHandler2;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Element;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSSerializer;
+
/**
* A set of persistent properties, which can be saved or loaded from a stream.
* A property list may also contain defaults, searched if the main list
@@ -200,12 +219,15 @@ label = Name:\\u0020</pre>
// The characters up to the next Whitespace, ':', or '='
// describe the key. But look for escape sequences.
- StringBuffer key = new StringBuffer();
+ // Try to short-circuit when there is no escape char.
+ int start = pos;
+ boolean needsEscape = line.indexOf('\\', pos) != -1;
+ StringBuilder key = needsEscape ? new StringBuilder() : null;
while (pos < line.length()
&& ! Character.isWhitespace(c = line.charAt(pos++))
&& c != '=' && c != ':')
{
- if (c == '\\')
+ if (needsEscape && c == '\\')
{
if (pos == line.length())
{
@@ -249,11 +271,20 @@ label = Name:\\u0020</pre>
}
}
}
- else
+ else if (needsEscape)
key.append(c);
}
boolean isDelim = (c == ':' || c == '=');
+
+ String keyString;
+ if (needsEscape)
+ keyString = key.toString();
+ else if (isDelim || Character.isWhitespace(c))
+ keyString = line.substring(start, pos - 1);
+ else
+ keyString = line.substring(start, pos);
+
while (pos < line.length()
&& Character.isWhitespace(c = line.charAt(pos)))
pos++;
@@ -266,7 +297,15 @@ label = Name:\\u0020</pre>
pos++;
}
- StringBuffer element = new StringBuffer(line.length() - pos);
+ // Short-circuit if no escape chars found.
+ if (!needsEscape)
+ {
+ put(keyString, line.substring(pos));
+ continue;
+ }
+
+ // Escape char found so iterate through the rest of the line.
+ StringBuilder element = new StringBuilder(line.length() - pos);
while (pos < line.length())
{
c = line.charAt(pos++);
@@ -322,7 +361,7 @@ label = Name:\\u0020</pre>
else
element.append(c);
}
- put(key.toString(), element.toString());
+ put(keyString, element.toString());
}
}
@@ -386,7 +425,7 @@ label = Name:\\u0020</pre>
Iterator iter = entrySet ().iterator ();
int i = size ();
- StringBuffer s = new StringBuffer (); // Reuse the same buffer.
+ StringBuilder s = new StringBuilder (); // Reuse the same buffer.
while (--i >= 0)
{
Map.Entry entry = (Map.Entry) iter.next ();
@@ -529,7 +568,7 @@ label = Name:\\u0020</pre>
* leading spaces must be escaped for the value
* @see #store(OutputStream, String)
*/
- private void formatForOutput(String str, StringBuffer buffer, boolean key)
+ private void formatForOutput(String str, StringBuilder buffer, boolean key)
{
if (key)
{
@@ -578,4 +617,299 @@ label = Name:\\u0020</pre>
head = key;
}
}
+
+ /**
+ * <p>
+ * Encodes the properties as an XML file using the UTF-8 encoding.
+ * The format of the XML file matches the DTD
+ * <a href="http://java.sun.com/dtd/properties.dtd">
+ * http://java.sun.com/dtd/properties.dtd</a>.
+ * </p>
+ * <p>
+ * Invoking this method provides the same behaviour as invoking
+ * <code>storeToXML(os, comment, "UTF-8")</code>.
+ * </p>
+ *
+ * @param os the stream to output to.
+ * @param comment a comment to include at the top of the XML file, or
+ * <code>null</code> if one is not required.
+ * @throws IOException if the serialization fails.
+ * @throws NullPointerException if <code>os</code> is null.
+ * @since 1.5
+ */
+ public void storeToXML(OutputStream os, String comment)
+ throws IOException
+ {
+ storeToXML(os, comment, "UTF-8");
+ }
+
+ /**
+ * <p>
+ * Encodes the properties as an XML file using the supplied encoding.
+ * The format of the XML file matches the DTD
+ * <a href="http://java.sun.com/dtd/properties.dtd">
+ * http://java.sun.com/dtd/properties.dtd</a>.
+ * </p>
+ *
+ * @param os the stream to output to.
+ * @param comment a comment to include at the top of the XML file, or
+ * <code>null</code> if one is not required.
+ * @param encoding the encoding to use for the XML output.
+ * @throws IOException if the serialization fails.
+ * @throws NullPointerException if <code>os</code> or <code>encoding</code>
+ * is null.
+ * @since 1.5
+ */
+ public void storeToXML(OutputStream os, String comment, String encoding)
+ throws IOException
+ {
+ if (os == null)
+ throw new NullPointerException("Null output stream supplied.");
+ if (encoding == null)
+ throw new NullPointerException("Null encoding supplied.");
+ try
+ {
+ DOMImplementationRegistry registry =
+ DOMImplementationRegistry.newInstance();
+ DOMImplementation domImpl = registry.getDOMImplementation("LS 3.0");
+ DocumentType doctype =
+ domImpl.createDocumentType("properties", null,
+ "http://java.sun.com/dtd/properties.dtd");
+ Document doc = domImpl.createDocument(null, "properties", doctype);
+ Element root = doc.getDocumentElement();
+ if (comment != null)
+ {
+ Element commentElement = doc.createElement("comment");
+ commentElement.appendChild(doc.createTextNode(comment));
+ root.appendChild(commentElement);
+ }
+ Iterator iterator = entrySet().iterator();
+ while (iterator.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ Element entryElement = doc.createElement("entry");
+ entryElement.setAttribute("key", (String) entry.getKey());
+ entryElement.appendChild(doc.createTextNode((String)
+ entry.getValue()));
+ root.appendChild(entryElement);
+ }
+ DOMImplementationLS loadAndSave = (DOMImplementationLS) domImpl;
+ LSSerializer serializer = loadAndSave.createLSSerializer();
+ LSOutput output = loadAndSave.createLSOutput();
+ output.setByteStream(os);
+ output.setEncoding(encoding);
+ serializer.write(doc, output);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw (IOException)
+ new IOException("The XML classes could not be found.").initCause(e);
+ }
+ catch (InstantiationException e)
+ {
+ throw (IOException)
+ new IOException("The XML classes could not be instantiated.")
+ .initCause(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw (IOException)
+ new IOException("The XML classes could not be accessed.")
+ .initCause(e);
+ }
+ }
+
+ /**
+ * <p>
+ * Decodes the contents of the supplied <code>InputStream</code> as
+ * an XML file, which represents a set of properties. The format of
+ * the XML file must match the DTD
+ * <a href="http://java.sun.com/dtd/properties.dtd">
+ * http://java.sun.com/dtd/properties.dtd</a>.
+ * </p>
+ *
+ * @param in the input stream from which to receive the XML data.
+ * @throws IOException if an I/O error occurs in reading the input data.
+ * @throws InvalidPropertiesFormatException if the input data does not
+ * constitute an XML properties
+ * file.
+ * @throws NullPointerException if <code>in</code> is null.
+ * @since 1.5
+ */
+ public void loadFromXML(InputStream in)
+ throws IOException, InvalidPropertiesFormatException
+ {
+ if (in == null)
+ throw new NullPointerException("Null input stream supplied.");
+ try
+ {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setValidating(false); /* Don't use the URI */
+ XMLReader parser = factory.newSAXParser().getXMLReader();
+ PropertiesHandler handler = new PropertiesHandler();
+ parser.setContentHandler(handler);
+ parser.setProperty("http://xml.org/sax/properties/lexical-handler",
+ handler);
+ parser.parse(new InputSource(in));
+ }
+ catch (SAXException e)
+ {
+ throw (InvalidPropertiesFormatException)
+ new InvalidPropertiesFormatException("Error in parsing XML.").
+ initCause(e);
+ }
+ catch (ParserConfigurationException e)
+ {
+ throw (IOException)
+ new IOException("An XML parser could not be found.").
+ initCause(e);
+ }
+ }
+
+ /**
+ * This class deals with the parsing of XML using
+ * <a href="http://java.sun.com/dtd/properties.dtd">
+ * http://java.sun.com/dtd/properties.dtd</a>.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+ private class PropertiesHandler
+ extends DefaultHandler2
+ {
+
+ /**
+ * The current key.
+ */
+ private String key;
+
+ /**
+ * The current value.
+ */
+ private String value;
+
+ /**
+ * A flag to check whether a valid DTD declaration has been seen.
+ */
+ private boolean dtdDeclSeen;
+
+ /**
+ * Constructs a new Properties handler.
+ */
+ public PropertiesHandler()
+ {
+ key = null;
+ value = null;
+ dtdDeclSeen = false;
+ }
+
+ /**
+ * <p>
+ * Captures the start of the DTD declarations, if they exist.
+ * A valid properties file must declare the following doctype:
+ * </p>
+ * <p>
+ * <code>!DOCTYPE properties SYSTEM
+ * "http://java.sun.com/dtd/properties.dtd"</code>
+ * </p>
+ *
+ * @param name the name of the document type.
+ * @param publicId the public identifier that was declared, or
+ * null if there wasn't one.
+ * @param systemId the system identifier that was declared, or
+ * null if there wasn't one.
+ * @throws SAXException if some error occurs in parsing.
+ */
+ public void startDTD(String name, String publicId, String systemId)
+ throws SAXException
+ {
+ if (name.equals("properties") &&
+ publicId == null &&
+ systemId.equals("http://java.sun.com/dtd/properties.dtd"))
+ {
+ dtdDeclSeen = true;
+ }
+ else
+ throw new SAXException("Invalid DTD declaration: " + name);
+ }
+
+ /**
+ * Captures the start of an XML element.
+ *
+ * @param uri the namespace URI.
+ * @param localName the local name of the element inside the namespace.
+ * @param qName the local name qualified with the namespace URI.
+ * @param attributes the attributes of this element.
+ * @throws SAXException if some error occurs in parsing.
+ */
+ public void startElement(String uri, String localName,
+ String qName, Attributes attributes)
+ throws SAXException
+ {
+ if (qName.equals("entry"))
+ {
+ int index = attributes.getIndex("key");
+ if (index != -1)
+ key = attributes.getValue(index);
+ }
+ else if (qName.equals("comment") || qName.equals("properties"))
+ {
+ /* Ignore it */
+ }
+ else
+ throw new SAXException("Invalid tag: " + qName);
+ }
+
+ /**
+ * Captures characters within an XML element.
+ *
+ * @param ch the array of characters.
+ * @param start the start index of the characters to use.
+ * @param length the number of characters to use from the start index on.
+ * @throws SAXException if some error occurs in parsing.
+ */
+ public void characters(char[] ch, int start, int length)
+ throws SAXException
+ {
+ if (key != null)
+ value = new String(ch,start,length);
+ }
+
+ /**
+ * Captures the end of an XML element.
+ *
+ * @param uri the namespace URI.
+ * @param localName the local name of the element inside the namespace.
+ * @param qName the local name qualified with the namespace URI.
+ * @throws SAXException if some error occurs in parsing.
+ */
+ public void endElement(String uri, String localName,
+ String qName)
+ throws SAXException
+ {
+ if (qName.equals("entry"))
+ {
+ if (value == null)
+ value = "";
+ setProperty(key, value);
+ key = null;
+ value = null;
+ }
+ }
+
+ /**
+ * Captures the end of the XML document. If a DTD declaration has
+ * not been seen, the document is erroneous and an exception is thrown.
+ *
+ * @throws SAXException if the correct DTD declaration didn't appear.
+ */
+ public void endDocument()
+ throws SAXException
+ {
+ if (!dtdDeclSeen)
+ throw new SAXException("No appropriate DTD declaration was seen.");
+ }
+
+ } // class PropertiesHandler
+
} // class Properties
diff --git a/libjava/classpath/java/util/Random.java b/libjava/classpath/java/util/Random.java
index bc005075140..b016f78d4a2 100644
--- a/libjava/classpath/java/util/Random.java
+++ b/libjava/classpath/java/util/Random.java
@@ -102,7 +102,7 @@ public class Random implements Serializable
* in next.
*
* @serial the internal state of this generator
- * @see #next()
+ * @see #next(int)
*/
private long seed;
diff --git a/libjava/classpath/java/util/ResourceBundle.java b/libjava/classpath/java/util/ResourceBundle.java
index 91007e9b1aa..6aea6731a5d 100644
--- a/libjava/classpath/java/util/ResourceBundle.java
+++ b/libjava/classpath/java/util/ResourceBundle.java
@@ -419,7 +419,11 @@ public abstract class ResourceBundle
}
}
- throw new MissingResourceException("Bundle " + baseName + " not found",
+ throw new MissingResourceException("Bundle " + baseName
+ + " not found for locale "
+ + locale
+ + " by classloader "
+ + classLoader,
baseName, "");
}
@@ -508,8 +512,7 @@ public abstract class ResourceBundle
*
* @param baseName the raw bundle name, without locale qualifiers
* @param locale the locale
- * @param classloader the classloader
- * @param bundle the backup (parent) bundle
+ * @param classLoader the classloader
* @param wantBase whether a resource bundle made only from the base name
* (with no locale information attached) should be returned.
* @return the resource bundle if it was loaded, otherwise the backup
diff --git a/libjava/classpath/java/util/SimpleTimeZone.java b/libjava/classpath/java/util/SimpleTimeZone.java
index 995ccea84ca..0bda44c3327 100644
--- a/libjava/classpath/java/util/SimpleTimeZone.java
+++ b/libjava/classpath/java/util/SimpleTimeZone.java
@@ -468,6 +468,7 @@ public class SimpleTimeZone extends TimeZone
* @param dayOfWeek The day of week where daylight savings start.
* @param time The time in milliseconds standard time where daylight
* savings start.
+ * @exception IllegalArgumentException if parameters are out of range.
* @see SimpleTimeZone
*/
public void setStartRule(int month, int day, int dayOfWeek, int time)
@@ -796,7 +797,7 @@ public class SimpleTimeZone extends TimeZone
* dst and standard time.
* @param calYear the year of the date to check (for leap day checking).
* @param calMonth the month of the date to check.
- * @param calDay the day of month of the date to check.
+ * @param calDayOfMonth the day of month of the date to check.
* @param calDayOfWeek the day of week of the date to check.
* @param calMillis the millis of day of the date to check (standard time).
* @param mode the change mode; same semantic as startMode.
diff --git a/libjava/classpath/java/util/Timer.java b/libjava/classpath/java/util/Timer.java
index 715f06cf641..01a6fe8eab3 100644
--- a/libjava/classpath/java/util/Timer.java
+++ b/libjava/classpath/java/util/Timer.java
@@ -1,5 +1,5 @@
/* Timer.java -- Timer that runs TimerTasks at a later time.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -297,12 +297,67 @@ public class Timer
this.notify();
}
+ /**
+ * Remove all canceled tasks from the queue.
+ */
+ public synchronized int purge()
+ {
+ int removed = 0;
+ // Null out any elements that are canceled. Skip element 0 as
+ // it is the sentinel.
+ for (int i = elements; i > 0; --i)
+ {
+ if (heap[i].scheduled < 0)
+ {
+ ++removed;
+
+ // Remove an element by pushing the appropriate child
+ // into place, and then iterating to the bottom of the
+ // tree.
+ int index = i;
+ while (heap[index] != null)
+ {
+ int child = 2 * index;
+ if (child >= heap.length)
+ {
+ // Off end; we're done.
+ heap[index] = null;
+ break;
+ }
+
+ if (child + 1 >= heap.length || heap[child + 1] == null)
+ {
+ // Nothing -- we're done.
+ }
+ else if (heap[child] == null
+ || (heap[child].scheduled
+ > heap[child + 1].scheduled))
+ ++child;
+ heap[index] = heap[child];
+ index = child;
+ }
+ }
+ }
+
+ // Make a new heap if we shrank enough.
+ int newLen = heap.length;
+ while (elements - removed + DEFAULT_SIZE / 2 <= newLen / 4)
+ newLen /= 2;
+ if (newLen != heap.length)
+ {
+ TimerTask[] newHeap = new TimerTask[newLen];
+ System.arraycopy(heap, 0, newHeap, 0, elements + 1);
+ heap = newHeap;
+ }
+
+ return removed;
+ }
} // TaskQueue
/**
* The scheduler that executes all the tasks on a particular TaskQueue,
* reschedules any repeating tasks and that waits when no task has to be
- * executed immediatly. Stops running when canceled or when the parent
+ * executed immediately. Stops running when canceled or when the parent
* Timer has been finalized and no more tasks have to be executed.
*/
private static final class Scheduler implements Runnable
@@ -420,6 +475,30 @@ public class Timer
}
/**
+ * Create a new Timer whose Thread has the indicated name. It will have
+ * normal priority and will not be a daemon thread.
+ * @param name the name of the Thread
+ * @since 1.5
+ */
+ public Timer(String name)
+ {
+ this(false, Thread.NORM_PRIORITY, name);
+ }
+
+ /**
+ * Create a new Timer whose Thread has the indicated name. It will have
+ * normal priority. The boolean argument controls whether or not it
+ * will be a daemon thread.
+ * @param name the name of the Thread
+ * @param daemon true if the Thread should be a daemon thread
+ * @since 1.5
+ */
+ public Timer(String name, boolean daemon)
+ {
+ this(daemon, Thread.NORM_PRIORITY, name);
+ }
+
+ /**
* Creates a new Timer with a daemon Thread as scheduler if daemon is true,
* with the priority given and a default name.
*/
@@ -612,4 +691,14 @@ public class Timer
{
queue.setNullOnEmpty(true);
}
+
+ /**
+ * Removes all cancelled tasks from the queue.
+ * @return the number of tasks removed
+ * @since 1.5
+ */
+ public int purge()
+ {
+ return queue.purge();
+ }
}
diff --git a/libjava/classpath/java/util/TreeMap.java b/libjava/classpath/java/util/TreeMap.java
index 1e8c805d908..a00f257aa8b 100644
--- a/libjava/classpath/java/util/TreeMap.java
+++ b/libjava/classpath/java/util/TreeMap.java
@@ -1146,7 +1146,7 @@ public class TreeMap extends AbstractMap
*
* @param s the stream to read from
* @param count the number of keys to read
- * @param readValue true to read values, false to insert "" as the value
+ * @param readValues true to read values, false to insert "" as the value
* @throws ClassNotFoundException if the underlying stream fails
* @throws IOException if the underlying stream fails
* @see #readObject(ObjectInputStream)
diff --git a/libjava/classpath/java/util/WeakHashMap.java b/libjava/classpath/java/util/WeakHashMap.java
index 7593f7e330e..514ad8cd29f 100644
--- a/libjava/classpath/java/util/WeakHashMap.java
+++ b/libjava/classpath/java/util/WeakHashMap.java
@@ -241,7 +241,8 @@ public class WeakHashMap extends AbstractMap implements Map
// This method will get inlined.
cleanQueue();
if (knownMod != modCount)
- throw new ConcurrentModificationException();
+ throw new ConcurrentModificationException(knownMod + " != "
+ + modCount);
}
/**
@@ -698,21 +699,20 @@ public class WeakHashMap extends AbstractMap implements Map
// bucket may be enqueued later by the garbage collection, and
// internalRemove will be called a second time.
bucket.slot = -1;
- if (buckets[slot] == bucket)
- buckets[slot] = bucket.next;
- else
+
+ WeakBucket prev = null;
+ WeakBucket next = buckets[slot];
+ while (next != bucket)
{
- WeakBucket prev = buckets[slot];
- /* This may throw a NullPointerException. It shouldn't but if
- * a race condition occurred (two threads removing the same
- * bucket at the same time) it may happen. <br>
- * But with race condition many much worse things may happen
- * anyway.
- */
- while (prev.next != bucket)
- prev = prev.next;
- prev.next = bucket.next;
+ if (next == null) throw new InternalError("WeakHashMap in incosistent state");
+ prev = next;
+ next = prev.next;
}
+ if (prev == null)
+ buckets[slot] = bucket.next;
+ else
+ prev.next = bucket.next;
+
size--;
}
diff --git a/libjava/classpath/java/util/jar/Manifest.java b/libjava/classpath/java/util/jar/Manifest.java
index fdc76ff97ee..ff82aa2db96 100644
--- a/libjava/classpath/java/util/jar/Manifest.java
+++ b/libjava/classpath/java/util/jar/Manifest.java
@@ -80,10 +80,10 @@ public class Manifest implements Cloneable
/**
* Creates a Manifest from the supplied input stream.
*
- * @see read(Inputstream)
- * @see write(OutputStream)
+ * @see #read(InputStream)
+ * @see #write(OutputStream)
*
- * @param InputStream the input stream to read the manifest from
+ * @param in the input stream to read the manifest from
* @exception IOException when an i/o exception occurs or the input stream
* does not describe a valid manifest
*/
@@ -102,7 +102,7 @@ public class Manifest implements Cloneable
* a particular entry also changes the attributes of that entry in the
* original manifest.
*
- * @see clone()
+ * @see #clone()
* @param man the Manifest to copy from
*/
public Manifest(Manifest man)
diff --git a/libjava/classpath/java/util/logging/FileHandler.java b/libjava/classpath/java/util/logging/FileHandler.java
index 3d958b7d760..b03df97ec60 100644
--- a/libjava/classpath/java/util/logging/FileHandler.java
+++ b/libjava/classpath/java/util/logging/FileHandler.java
@@ -43,10 +43,6 @@ import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
-
import java.util.LinkedList;
import java.util.ListIterator;
diff --git a/libjava/classpath/java/util/logging/Handler.java b/libjava/classpath/java/util/logging/Handler.java
index c3227d6f531..616b50234c4 100644
--- a/libjava/classpath/java/util/logging/Handler.java
+++ b/libjava/classpath/java/util/logging/Handler.java
@@ -191,8 +191,8 @@ h.setFormatter(h.getFormatter());</pre>
* Returns the character encoding which this handler uses for publishing
* log records.
*
- * @param encoding the name of a character encoding, or <code>null</code>
- * for the default platform encoding.
+ * @return the name of a character encoding, or <code>null</code>
+ * for the default platform encoding.
*/
public String getEncoding()
{
@@ -252,7 +252,7 @@ h.setFormatter(h.getFormatter());</pre>
* Sets the <code>Filter</code> for controlling which
* log records will be published by this <code>Handler</code>.
*
- * @return the <code>Filter</code> to use, or
+ * @param filter the <code>Filter</code> to use, or
* <code>null</code> to filter log records purely based
* on their severity level.
*/
diff --git a/libjava/classpath/java/util/logging/LogManager.java b/libjava/classpath/java/util/logging/LogManager.java
index 7e3fd97d01f..b62292f7978 100644
--- a/libjava/classpath/java/util/logging/LogManager.java
+++ b/libjava/classpath/java/util/logging/LogManager.java
@@ -664,7 +664,7 @@ public class LogManager
{
try
{
- return (new Boolean(getLogManager().getProperty(name))).booleanValue();
+ return (Boolean.valueOf(getLogManager().getProperty(name))).booleanValue();
}
catch (Exception ex)
{
@@ -682,7 +682,7 @@ public class LogManager
*
* @param defaultValue the value that will be returned if the
* property is not defined, or if
- * {@link Level.parse(java.lang.String)} does not like
+ * {@link Level#parse(java.lang.String)} does not like
* the property value.
*/
static Level getLevelProperty(String propertyName, Level defaultValue)
diff --git a/libjava/classpath/java/util/logging/LoggingPermission.java b/libjava/classpath/java/util/logging/LoggingPermission.java
index c7a2255ecea..1139a793a70 100644
--- a/libjava/classpath/java/util/logging/LoggingPermission.java
+++ b/libjava/classpath/java/util/logging/LoggingPermission.java
@@ -41,6 +41,8 @@ package java.util.logging;
public final class LoggingPermission
extends java.security.BasicPermission
{
+ private static final long serialVersionUID = 63564341580231582L;
+
/**
* Creates a new LoggingPermission.
*
diff --git a/libjava/classpath/java/util/logging/SimpleFormatter.java b/libjava/classpath/java/util/logging/SimpleFormatter.java
index f7a442792f9..ff53db8c055 100644
--- a/libjava/classpath/java/util/logging/SimpleFormatter.java
+++ b/libjava/classpath/java/util/logging/SimpleFormatter.java
@@ -85,7 +85,7 @@ public class SimpleFormatter
/**
* Formats a log record into a String.
*
- * @param the log record to be formatted.
+ * @param record the log record to be formatted.
*
* @return a short human-readable message, typically one or two
* lines. Lines are separated using the default platform line
diff --git a/libjava/classpath/java/util/logging/XMLFormatter.java b/libjava/classpath/java/util/logging/XMLFormatter.java
index 4dd63281727..8bd83ba3973 100644
--- a/libjava/classpath/java/util/logging/XMLFormatter.java
+++ b/libjava/classpath/java/util/logging/XMLFormatter.java
@@ -307,7 +307,7 @@ public class XMLFormatter
*
* @return a string for the header.
*
- * @param handler the handler which will prepend the returned
+ * @param h the handler which will prepend the returned
* string in front of the first log record. This method
* will inspect certain properties of the handler, for
* example its encoding, in order to construct the header.
diff --git a/libjava/classpath/java/util/prefs/Preferences.java b/libjava/classpath/java/util/prefs/Preferences.java
index c407ae6127a..3fee1c5da74 100644
--- a/libjava/classpath/java/util/prefs/Preferences.java
+++ b/libjava/classpath/java/util/prefs/Preferences.java
@@ -230,15 +230,15 @@ public abstract class Preferences {
}
/**
- * Returns the system preferences node for the package of an object.
- * The package node name of the object is determined by dropping the
- * class name of the object of the fully quallified class name and
- * replacing all '.' to '/' in the package name. If the class of the
+ * Returns the system preferences node for the package of a class.
+ * The package node name of the class is determined by dropping the
+ * final component of the fully qualified class name and
+ * changing all '.' to '/' in the package name. If the class of the
* object has no package then the package node name is "&lt;unnamed&gt;".
- * The returened node is <code>systemRoot().node(packageNodeName)</code>.
+ * The returned node is <code>systemRoot().node(packageNodeName)</code>.
*
- * @param o Object whose default system preference node is requested
- * @returns system preferences node that should be used by object o
+ * @param c Object whose default system preference node is requested
+ * @returns system preferences node that should be used by class c
* @exception SecurityException when a security manager is installed and
* the caller does not have <code>RuntimePermission("preferences")</code>.
*/
@@ -249,15 +249,15 @@ public abstract class Preferences {
}
/**
- * Returns the user preferences node for the package of an object.
- * The package node name of the object is determined by dropping the
- * class name of the object of the fully quallified class name and
- * replacing all '.' to '/' in the package name. If the class of the
+ * Returns the user preferences node for the package of a class.
+ * The package node name of the class is determined by dropping the
+ * final component of the fully qualified class name and
+ * changing all '.' to '/' in the package name. If the class of the
* object has no package then the package node name is "&lt;unnamed&gt;".
- * The returened node is <code>userRoot().node(packageNodeName)</code>.
+ * The returned node is <code>userRoot().node(packageNodeName)</code>.
*
- * @param o Object whose default user preference node is requested
- * @returns user preferences node that should be used by object o
+ * @param c Object whose default userpreference node is requested
+ * @returns userpreferences node that should be used by class c
* @exception SecurityException when a security manager is installed and
* the caller does not have <code>RuntimePermission("preferences")</code>.
*/
diff --git a/libjava/classpath/java/util/regex/Matcher.java b/libjava/classpath/java/util/regex/Matcher.java
index bd97ace54a8..5d04bdbfc2f 100644
--- a/libjava/classpath/java/util/regex/Matcher.java
+++ b/libjava/classpath/java/util/regex/Matcher.java
@@ -227,9 +227,9 @@ public final class Matcher
* If the match succeeds then more information can be obtained via the
* start, end, and group methods.
*
- * @see #start
- * @see #end
- * @see #group
+ * @see #start()
+ * @see #end()
+ * @see #group()
*/
public boolean matches ()
{
@@ -267,7 +267,7 @@ public final class Matcher
}
/**
- * @param group The index of a capturing group in this matcher's pattern
+ * @returns the index of a capturing group in this matcher's pattern
*
* @exception IllegalStateException If no match has yet been attempted,
* or if the previous match operation failed
diff --git a/libjava/classpath/java/util/zip/PendingBuffer.java b/libjava/classpath/java/util/zip/PendingBuffer.java
index dd7ed1008fb..9079b9804b7 100644
--- a/libjava/classpath/java/util/zip/PendingBuffer.java
+++ b/libjava/classpath/java/util/zip/PendingBuffer.java
@@ -183,7 +183,7 @@ class PendingBuffer
/**
* Flushes the pending buffer and returns that data in a new array
*
- * @param output the output stream
+ * @return the output stream
*/
public final byte[] toByteArray()
diff --git a/libjava/classpath/java/util/zip/ZipFile.java b/libjava/classpath/java/util/zip/ZipFile.java
index 0243abed1f8..4be845ea781 100644
--- a/libjava/classpath/java/util/zip/ZipFile.java
+++ b/libjava/classpath/java/util/zip/ZipFile.java
@@ -144,9 +144,18 @@ public class ZipFile implements ZipConstants
private void checkZipFile() throws IOException, ZipException
{
byte[] magicBuf = new byte[4];
- raf.read(magicBuf);
+ boolean validRead = true;
- if (readLeInt(magicBuf, 0) != LOCSIG)
+ try
+ {
+ raf.readFully(magicBuf);
+ }
+ catch (EOFException eof)
+ {
+ validRead = false;
+ }
+
+ if (validRead == false || readLeInt(magicBuf, 0) != LOCSIG)
{
raf.close();
throw new ZipException("Not a valid zip file");
@@ -377,7 +386,7 @@ public class ZipFile implements ZipConstants
* Checks that the ZipFile is still open and reads entries when necessary.
*
* @exception IllegalStateException when the ZipFile has already been closed.
- * @exception IOEexception when the entries could not be read.
+ * @exception IOException when the entries could not be read.
*/
private HashMap getEntries() throws IOException
{
@@ -395,7 +404,7 @@ public class ZipFile implements ZipConstants
/**
* Searches for a zip entry in this archive with the given name.
*
- * @param the name. May contain directory components separated by
+ * @param name the name. May contain directory components separated by
* slashes ('/').
* @return the zip entry, or null if no entry with that name exists.
*
diff --git a/libjava/classpath/javax/imageio/IIOException.java b/libjava/classpath/javax/imageio/IIOException.java
index 8f8dd03441c..b281db1b050 100644
--- a/libjava/classpath/javax/imageio/IIOException.java
+++ b/libjava/classpath/javax/imageio/IIOException.java
@@ -39,8 +39,9 @@ package javax.imageio;
import java.io.IOException;
-
/**
+ * A runtime exception to indicate image reading and writing failures.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class IIOException extends IOException
diff --git a/libjava/classpath/javax/imageio/IIOImage.java b/libjava/classpath/javax/imageio/IIOImage.java
index 651c9baaa21..0d987476239 100644
--- a/libjava/classpath/javax/imageio/IIOImage.java
+++ b/libjava/classpath/javax/imageio/IIOImage.java
@@ -45,13 +45,53 @@ import java.util.List;
import javax.imageio.metadata.IIOMetadata;
+/**
+ * IIOImage is a container class for components of an image file that
+ * stores image data, image metadata and thumbnails.
+ *
+ * The image data can be either a RenderedImage or a Raster but not
+ * both. Image readers that produce IIOImages will always produce
+ * BufferedImages from the RenderedImage field. Image writers that
+ * accept IIOImages will always accept RenderedImages and may
+ * optionally accept Rasters.
+ *
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
+ */
public class IIOImage
{
+ /**
+ * Image data as a RenderedImage. null if this IIOImage uses the
+ * Raster representation.
+ */
protected RenderedImage image;
+
+ /**
+ * Image metadata.
+ */
protected IIOMetadata metadata;
+
+ /**
+ * Image data as a Raster. null if this IIOImage uses the
+ * RenderedImage representation.
+ */
protected Raster raster;
+
+ /**
+ * A list of BufferedImage thumbnails of this image.
+ */
+ // for 1.5 these lists are List<? extends BufferedImage>
protected List thumbnails;
-
+
+ /**
+ * Construct an IIOImage containing raster image data, thumbnails
+ * and metadata.
+ *
+ * @param raster image data
+ * @param thumbnails a list of BufferedImage thumbnails or null
+ * @param metadata image metadata or null
+ *
+ * @exception IllegalArgumentException if raster is null
+ */
public IIOImage (Raster raster, List thumbnails, IIOMetadata metadata)
{
if (raster == null)
@@ -62,6 +102,16 @@ public class IIOImage
this.metadata = metadata;
}
+ /**
+ * Construct an IIOImage containing rendered image data, thumbnails
+ * and metadata.
+ *
+ * @param image rendered image data
+ * @param thumbnails a list of BufferedImage thumbnails or null
+ * @param metadata image metadata or null
+ *
+ * @exception IllegalArgumentException if image is null
+ */
public IIOImage (RenderedImage image, List thumbnails, IIOMetadata metadata)
{
if (image == null)
@@ -72,46 +122,111 @@ public class IIOImage
this.metadata = metadata;
}
+ /**
+ * Retrieve the image metadata or null if there is no metadata
+ * associated with this IIOImage.
+ *
+ * @return image metadata or null
+ */
public IIOMetadata getMetadata()
{
return metadata;
}
+ /**
+ * Retrieve the number of thumbnails in this IIOImage.
+ *
+ * @return the number of thumbnails
+ */
public int getNumThumbnails()
{
- return thumbnails.size();
+ return thumbnails == null ? 0 : thumbnails.size();
}
+ /**
+ * Retrieve the raster image data stored in this IIOImage or null if
+ * this image stores data using the RenderedImage representation.
+ *
+ * @return the raster image data or null
+ */
public Raster getRaster()
{
return raster;
}
+ /**
+ * Retrieve the rendered image data stored in this IIOImage or null
+ * if this image stores data using the Raster representation.
+ *
+ * @return the rendered image data or null
+ */
public RenderedImage getRenderedImage()
{
return image;
}
+ /**
+ * Retrieve the thumbnail stored at the specified index in the
+ * thumbnails list.
+ *
+ * @param index the index of the thumbnail to retrieve
+ *
+ * @return the buffered image thumbnail
+ *
+ * @exception IndexOutOfBoundsException if index is out-of-bounds
+ * @exception ClassCastException if the object returned from the
+ * thumbnails list is not a BufferedImage
+ */
public BufferedImage getThumbnail (int index)
{
+ // This throws a ClassCastException if the returned object is not
+ // a BufferedImage or an IndexOutOfBoundsException if index is
+ // out-of-bounds.
return (BufferedImage) thumbnails.get (index);
}
+ /**
+ * Retrieve the list of thumbnails or null if there are no
+ * thumbnails associated with this IIOImage. The returned reference
+ * can be used to update the thumbnails list.
+ *
+ * @return a list of thumbnails or null
+ */
public List getThumbnails()
{
return thumbnails;
}
+ /**
+ * Check whether this IIOImage stores its image data as a Raster or
+ * as a RenderedImage.
+ *
+ * @return true if this IIOImage uses the Raster representation,
+ * false if it uses the RenderedImage representation.
+ */
public boolean hasRaster()
{
return raster != null;
}
+ /**
+ * Set this IIOImage's metadata.
+ *
+ * @param metadata the image metadata
+ */
public void setMetadata (IIOMetadata metadata)
{
this.metadata = metadata;
}
+ /**
+ * Set the raster data for this image. This disposes of any
+ * existing rendered image data stored in this IIOImage.
+ *
+ * @param raster the image raster data
+ *
+ * @exception IllegalArgumentException if raster is null
+ */
public void setRaster (Raster raster)
{
if (raster == null)
@@ -121,6 +236,14 @@ public class IIOImage
this.raster = raster;
}
+ /**
+ * Set the rendered image data for this image. This disposes of any
+ * existing raster data stored in this IIOImage.
+ *
+ * @param image the rendered image data
+ *
+ * @exception IllegalArgumentException if image is null
+ */
public void setRenderedImage (RenderedImage image)
{
if (image == null)
@@ -130,9 +253,15 @@ public class IIOImage
this.raster = null;
}
+ /**
+ * Set the list of thumbnails for this IIOImage to a new list of
+ * BufferedImages or to null. Any existing thumbnails list is
+ * disposed.
+ *
+ * @param thumbnails a new list of thumbnails or null
+ */
public void setThumbnails (List thumbnails)
{
this.thumbnails = thumbnails;
}
-
-} // class IIOParam
+}
diff --git a/libjava/classpath/javax/imageio/IIOParam.java b/libjava/classpath/javax/imageio/IIOParam.java
index 01f6166059d..f6460b4e7ed 100644
--- a/libjava/classpath/javax/imageio/IIOParam.java
+++ b/libjava/classpath/javax/imageio/IIOParam.java
@@ -42,97 +42,317 @@ import java.awt.Point;
import java.awt.Rectangle;
/**
+ * An IIOParam stores parameters used when encoding or decoding image
+ * streams. ImageReadParam and ImageWriteParam extend this abstract
+ * base class.
+ *
+ * IIOParams allow control over how source pixels converted into
+ * destination pixels. This conversion can take place between a
+ * stream and in-memory image data, when an image reader is doing the
+ * conversion, or a writer can be doing the conversion from an
+ * in-memory source to a stream destination.
+ *
+ * An image reader can be restricted to only read from a given region;
+ * likewise a writer can be restricted to only write output to a given
+ * region.
+ *
+ * For image readers and writers, IIOParam supports image pixelation
+ * -- where the input image is approximated by the output image using
+ * larger-sized pixel blocks. For example: FIXME
+ *
+ * IIOParams can control how pixels are combined into larger blocks
+ * using sub-sampling matrices. For example: FIXME
+ *
+ * They can also control which source bands are read and written; this
+ * example reads the RGBA (red, green, blue, transparency) data from a
+ * PNG image and outputs just the red and transparency bands: FIXME
+ *
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
* @author Michael Koch (konqueror@gmx.de)
*/
public abstract class IIOParam
{
- protected IIOParamController controller;
- protected IIOParamController defaultController;
+ /**
+ * The controller called by this IIOParam to retrieve parameters.
+ */
+ protected IIOParamController controller = null;
+
+ /**
+ * The default controller called by this IIOParam to retrieve
+ * parameters.
+ */
+ protected IIOParamController defaultController = null;
+
+ /**
+ * The offset in the destination where the upper-left
+ * decoded/encoded pixel should be located.
+ */
protected Point destinationOffset = new Point(0, 0);
- protected ImageTypeSpecifier destinationType;
- protected int[] sourceBands;
- protected Rectangle sourceRegion;
- protected int sourceXSubsampling;
- protected int sourceYSubsampling;
- protected int subsamplingXOffset;
- protected int subsamplingYOffset;
/**
- * Initializes an <code>IIOParam</code> object.
+ * Sets the output colour type when writing or the destination image
+ * type when reading.
+ */
+ protected ImageTypeSpecifier destinationType = null;
+
+ /**
+ * An array indicating which source bands will be used or null.
+ */
+ protected int[] sourceBands = null;
+
+ /**
+ * The source pixel region or null.
+ */
+ protected Rectangle sourceRegion = null;
+
+ /**
+ * Sample every sourceXSubsampling'th pixel in the source image when
+ * pixelating the destination image in the horizontal direction.
+ */
+ protected int sourceXSubsampling = 1;
+
+ /**
+ * Sample every sourceYSubsampling'th pixel in the source image when
+ * pixelating the destination image in the vertical direction.
+ */
+ protected int sourceYSubsampling = 1;
+
+ /**
+ * Start sampling at this horizontal offset within the source region
+ * when pixelating the destination image in the horizontal
+ * direction.
+ */
+ protected int subsamplingXOffset = 0;
+
+ /**
+ * Start sampling at this vertical offset within the source region
+ * when pixelating the destination image in the vertical direction.
+ */
+ protected int subsamplingYOffset = 0;
+
+ /**
+ * Indicates whether or not the controller has been explicitly set
+ * to null.
+ */
+ private boolean no_controller = false;
+
+ /**
+ * Constructs an IIOParam object.
*/
protected IIOParam()
{
- // Do nothing here.
}
+ /**
+ * Activates the parameter controller by calling its activate method
+ * and passing it this IIOParam. A true return value indicates that
+ * this IIOParam's values are ready for the next read or write
+ * operation. A return value of false means that this IIOParam's
+ * values have not been affected because the controller operations
+ * were cancelled.
+ *
+ * @return true if parameters were successfully set, false if
+ * parameters were not changed
+ */
public boolean activateController()
{
if (controller == null)
- return false;
-
- return controller.activate(this);
+ {
+ if (defaultController == null || no_controller)
+ return false;
+ else
+ return defaultController.activate (this);
+ }
+ else
+ return controller.activate(this);
}
-
+
+ /**
+ * Retrieve the currently set controller if one has been set, or the
+ * default controller, or null if the controller has been explicitly
+ * set to null.
+ *
+ * @return the currently used controller or null
+ */
public IIOParamController getController()
{
- return controller;
+ return controller == null ?
+ (no_controller ? null : defaultController) : controller;
}
+ /**
+ * Retrieve the default controller regardless of whether or not a
+ * non-default controller has been set. The default controller may
+ * be null.
+ *
+ * @return the default controller or null
+ */
public IIOParamController getDefaultController()
{
return defaultController;
}
+ /**
+ * Retrieve the offset in the destination where the upper-left
+ * decoded/encoded pixel should be located. (0, 0) by default.
+ *
+ * @return the destination offset
+ */
public Point getDestinationOffset()
{
return destinationOffset;
}
+ /**
+ * Retrieve the currently set image-type specifier or null if none
+ * has been set.
+ *
+ * @return the current image-type specifier or null
+ */
public ImageTypeSpecifier getDestinationType()
{
return destinationType;
}
+ /**
+ * Retrieve the current source band values or null if source band
+ * values have not been set.
+ *
+ * The returned array is a copy of this IIOParam's source band
+ * array.
+ *
+ * @return the current set of source band values or null
+ */
public int[] getSourceBands()
{
- return sourceBands;
+ if (sourceBands == null)
+ return null;
+
+ int[] sourceBandsCopy = new int[sourceBands.length];
+ System.arraycopy (sourceBands, 0, sourceBandsCopy, 0, sourceBands.length);
+ return sourceBandsCopy;
}
+ /**
+ * Retrieve the source rectangle from which pixels should be read or
+ * null if no source region has been set.
+ *
+ * @return the current source region or null
+ */
public Rectangle getSourceRegion()
{
return sourceRegion;
}
+ /**
+ * Retrieve the number of pixel columns to advance before taking a
+ * pixel sample.
+ *
+ * @return the horizontal sub-sampling interval
+ */
public int getSourceXSubsampling()
{
return sourceXSubsampling;
}
+ /**
+ * Retrieve the number of pixel rows to advance before taking a
+ * pixel sample.
+ *
+ * @return the vertical sub-sampling interval
+ */
public int getSourceYSubsampling()
{
return sourceYSubsampling;
}
+ /**
+ * Retrieve the number of pixel columns to advance before taking any
+ * pixel samples.
+ *
+ * @return the horizontal sub-sampling offset
+ */
public int getSubsamplingXOffset()
{
return subsamplingXOffset;
}
-
+
+ /**
+ * Retrieve the number of pixel rows to advance before taking any
+ * pixel samples.
+ *
+ * @return the vertical sub-sampling offset
+ */
public int getSubsamplingYOffset()
{
return subsamplingYOffset;
}
+ /**
+ * Check if a non-null controller is currently available.
+ *
+ * @return true if getController returns a non-null value, false if
+ * getController returns null
+ */
public boolean hasController()
{
return getController() != null;
}
+ /**
+ * Sets the controller for this IIOParam. This is the controller
+ * that will be activated when activateController is called. The
+ * argument controller overrides this IIOParam's default controller.
+ * If the argument is null then no controller will be set, not even
+ * the default one. To reset the default controller call
+ * setController(getDefaultController()).
+ *
+ * @param controller the controller to set or null
+ */
public void setController(IIOParamController controller)
{
- this.controller = controller;
+ if (controller == defaultController)
+ {
+ this.controller = null;
+ no_controller = false;
+ }
+ else
+ {
+ no_controller = (controller == null);
+ this.controller = controller;
+ }
}
+ /**
+ * Set the destination image type.
+ *
+ * If this value is set on an image reader then its read method will
+ * return a new BufferedImage of the specified destination type. In
+ * this case any destination image set using setDestination() is
+ * ignored.
+ *
+ * If this is set on an image writer then the destination type
+ * affects only the colour model of the destination image. The
+ * destination type's SampleModel is ignored. The destination
+ * type's ColorModel will override the source image's colour model.
+ *
+ * @param destinationType the sample and colour models of the
+ * destination image
+ */
+ public void setDestinationType (ImageTypeSpecifier destinationType)
+ {
+ this.destinationType = destinationType;
+ }
+
+ /**
+ * Specify the destination pixel offset. Image writers are only
+ * affected by this setting when ImageWriter.replacePixels is called
+ * in which case the offset is into the region of pixels being
+ * changed.
+ *
+ * @param destinationOffset the offset where pixel writing should
+ * begin
+ */
public void setDestinationOffset(Point destinationOffset)
{
if (destinationOffset == null)
@@ -141,11 +361,43 @@ public abstract class IIOParam
this.destinationOffset = destinationOffset;
}
+ /**
+ * Set the indices of the source bands to be used. Duplicate
+ * indices are not allowed. A value of null means use all source
+ * bands. The argument array is copied and stored, so subsequent
+ * updates to it will not be reflected in this IIOParam.
+ *
+ * @param sourceBands the array of source bands to use
+ */
public void setSourceBands(int[] sourceBands)
{
- this.sourceBands = sourceBands;
+ int[] sourceBandsCopy = new int[sourceBands.length];
+ System.arraycopy (sourceBands, 0, sourceBandsCopy, 0, sourceBands.length);
+ this.sourceBands = sourceBandsCopy;
}
+ /**
+ * Set the source region from which to read. The number of pixels
+ * sampled from the source region depends on the source sub-sampling
+ * settings. If the combination of this sourceRegion and the
+ * current sub-sampling settings would result in no pixels being
+ * sampled then an IllegalStateException will be thrown.
+ *
+ * The source region is specified in the source image coordinate
+ * system which has point (0, 0) at the top-left and increases down
+ * and to the right. The argument source region is clipped to the
+ * image boundaries at read-time.
+ *
+ * A null argument sets the source region to null meaning that the
+ * whole image should be read.
+ *
+ * @param sourceRegion the rectangular source region
+ *
+ * @exception IllegalArgumentException if sourceRegion has width or
+ * height <= 0 or x or y < 0
+ * @exception IllegalStateException if the given sourceRegion and
+ * the current sampling settings would produce zero samples
+ */
public void setSourceRegion(Rectangle sourceRegion)
{
if (sourceRegion != null
@@ -154,15 +406,83 @@ public abstract class IIOParam
|| sourceRegion.width <= 0
|| sourceRegion.height <= 0))
throw new IllegalArgumentException("illegal source region");
-
- // FIXME: Throw IllegalStateException.
+
+ if (sourceRegion != null)
+ {
+ int num_rows =
+ (sourceRegion.height - subsamplingYOffset + sourceYSubsampling - 1)
+ / sourceYSubsampling;
+
+ int num_columns =
+ (sourceRegion.width - subsamplingXOffset + sourceXSubsampling - 1)
+ / sourceXSubsampling;
+
+ if (num_rows <= 0 || num_columns <= 0)
+ throw new IllegalStateException("zero pixels in source region");
+ }
this.sourceRegion = sourceRegion;
}
+ /**
+ * Set the source sampling intervals and offsets. Every
+ * sourceXSubsampling'th pixel horizontally and
+ * sourceYSubsampling'th pixel vertically will be sampled. Sampling
+ * will being a the subsamplingXOffset'th column and the
+ * subsamplingYOffset'th row.
+ *
+ * Horizontally, the number of sampled pixels will be:
+ *
+ * floor((width - subsamplingXOffset + sourceXSubsampling - 1) / sourceXSubsampling)
+ *
+ * Vertically:
+ *
+ * floor((height - subsamplingYOffset + sourceYSubsampling - 1) / sourceYSubsampling)
+ *
+ * If the current source region setting is such that the given
+ * sub-sampling arguments would produce zero pixel samples, an
+ * IllegalStateException is thrown.
+ *
+ * The offset parameters can be used to make source regions overlap
+ * when tiling across an image. This can eliminate seams and
+ * better-tile images whose width or height is not a multiple of the
+ * sampling interval.
+ *
+ * @param sourceXSubsampling the horizontal sampling interval
+ * @param sourceYSubsampling the vertical sampling interval
+ * @param subsamplingXOffset the horizontal offset of the initial
+ * sample
+ * @param subsamplingYOffset the vertical offset of the initial
+ * sample
+ *
+ * @exception IllegalArgumentException if either subsamplingXOffset
+ * or subsamplingYOffset is < 0
+ * @exception IllegalStateException if the current source region
+ * combined with the given sub-sampling parameters would produce
+ * zero pixel samples
+ */
public void setSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling,
int subsamplingXOffset, int subsamplingYOffset)
{
+ if (subsamplingXOffset < 0 || subsamplingYOffset < 0)
+ throw new IllegalArgumentException("subsampling offset < 0");
+
+ if (sourceRegion != null)
+ {
+ int num_rows =
+ (sourceRegion.height - subsamplingYOffset + sourceYSubsampling - 1)
+ / sourceYSubsampling;
+
+ int num_columns =
+ (sourceRegion.width - subsamplingXOffset + sourceXSubsampling - 1)
+ / sourceXSubsampling;
+
+ if (num_rows <= 0 || num_columns <= 0)
+ throw new IllegalStateException("subsampling parameters would"
+ + " produce zero pixel samples"
+ + " in source region");
+ }
+
this.sourceXSubsampling = sourceXSubsampling;
this.sourceYSubsampling = sourceYSubsampling;
this.subsamplingXOffset = subsamplingXOffset;
diff --git a/libjava/classpath/javax/imageio/IIOParamController.java b/libjava/classpath/javax/imageio/IIOParamController.java
index 125520e735b..0ee54df4071 100644
--- a/libjava/classpath/javax/imageio/IIOParamController.java
+++ b/libjava/classpath/javax/imageio/IIOParamController.java
@@ -39,12 +39,23 @@ exception statement from your version. */
package javax.imageio;
/**
+ * An interface to set image parameters. An IIOParamController may be
+ * a GUI component, a database reader, command-line parser or any
+ * other means of getting parameter settings. For exampe, a dialog
+ * box could implement IIOParamController to allow a user to adjust
+ * JPEG compression levels.
+ *
+ * The activate method should always behave modally; it should only
+ * return when the action has been either cancelled or completed.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public interface IIOParamController
{
/**
- * Activates the controller.
+ * Activates the controller. A return value of false should mean
+ * that no changes were made to param. A return value of true
+ * should mean that the image is ready to be read or written.
*
* @param param the <code>IIOParam</code> to be modified
*
diff --git a/libjava/classpath/javax/imageio/ImageIO.java b/libjava/classpath/javax/imageio/ImageIO.java
index 95c7c325121..3ea7e858544 100644
--- a/libjava/classpath/javax/imageio/ImageIO.java
+++ b/libjava/classpath/javax/imageio/ImageIO.java
@@ -52,7 +52,10 @@ import java.util.Collections;
import java.util.Iterator;
import javax.imageio.spi.IIORegistry;
+import javax.imageio.spi.ImageInputStreamSpi;
+import javax.imageio.spi.ImageOutputStreamSpi;
import javax.imageio.spi.ImageReaderSpi;
+import javax.imageio.spi.ImageTranscoderSpi;
import javax.imageio.spi.ImageWriterSpi;
import javax.imageio.spi.ServiceRegistry;
import javax.imageio.stream.ImageInputStream;
@@ -60,12 +63,18 @@ import javax.imageio.stream.ImageOutputStream;
import javax.imageio.stream.MemoryCacheImageInputStream;
import javax.imageio.stream.MemoryCacheImageOutputStream;
+/**
+ * An uninstantiable class that provides static methods for locating
+ * and using image readers and writers.
+ */
public final class ImageIO
{
/**
- * This class isn't intended to be instantiated.
+ * Construct an ImageIO. Private since ImageIO is not instantiable.
*/
- private ImageIO() {}
+ private ImageIO()
+ {
+ }
private static final class ReaderFormatFilter implements ServiceRegistry.Filter
{
@@ -117,6 +126,35 @@ public final class ImageIO
}
}
+ private static final class ReaderObjectFilter implements ServiceRegistry.Filter
+ {
+ private Object object;
+
+ public ReaderObjectFilter(Object object)
+ {
+ this.object = object;
+ }
+
+ public boolean filter(Object provider)
+ {
+ if (provider instanceof ImageReaderSpi)
+ {
+ ImageReaderSpi spi = (ImageReaderSpi) provider;
+
+ try
+ {
+ if (spi.canDecodeInput(object))
+ return true;
+ }
+ catch (IOException e)
+ {
+ // Return false in this case
+ }
+ }
+ return false;
+ }
+ }
+
private static final class ReaderSuffixFilter implements ServiceRegistry.Filter
{
private String fileSuffix;
@@ -217,6 +255,66 @@ public final class ImageIO
}
}
+ private static final class WriterObjectFilter implements ServiceRegistry.Filter
+ {
+ private ImageTypeSpecifier type;
+ private String formatName;
+
+ public WriterObjectFilter(ImageTypeSpecifier type,
+ String formatName)
+ {
+ this.type = type;
+ this.formatName = formatName;
+ }
+
+ public boolean filter(Object provider)
+ {
+ if (provider instanceof ImageWriterSpi)
+ {
+ ImageWriterSpi spi = (ImageWriterSpi) provider;
+
+ if (spi.canEncodeImage(type))
+ {
+ String[] formatNames = spi.getFormatNames();
+ for (int i = formatNames.length - 1; i >= 0; --i)
+ if (formatName.equals(formatNames[i]))
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+
+ private static final class TranscoderFilter implements ServiceRegistry.Filter
+ {
+ private ImageReader reader;
+ private ImageWriter writer;
+
+ public TranscoderFilter(ImageReader reader,
+ ImageWriter writer)
+ {
+ this.reader = reader;
+ this.writer = writer;
+ }
+
+ public boolean filter(Object provider)
+ {
+ if (provider instanceof ImageTranscoderSpi)
+ {
+ ImageTranscoderSpi spi = (ImageTranscoderSpi) provider;
+
+ if (spi.getReaderServiceProviderName().equals
+ (reader.getOriginatingProvider().getClass().getName())
+ && spi.getWriterServiceProviderName().equals
+ (writer.getOriginatingProvider().getClass().getName()))
+ return true;
+ }
+
+ return false;
+ }
+ }
+
private static final class ImageReaderIterator implements Iterator
{
Iterator it;
@@ -318,11 +416,26 @@ public final class ImageIO
}
}
+ /**
+ * Retrieve the current cache directory.
+ *
+ * @return the current cache directory or null if none is set.
+ */
public static File getCacheDirectory()
{
return cacheDirectory;
}
+ /**
+ * Retrieve an iterator over all registered readers for the given
+ * format.
+ *
+ * @param formatName an infomal format name (e.g. "jpeg" or "bmp")
+ *
+ * @return an iterator over a collection of image readers
+ *
+ * @exception IllegalArgumentException if formatName is null
+ */
public static Iterator getImageReadersByFormatName(String formatName)
{
if (formatName == null)
@@ -333,6 +446,17 @@ public final class ImageIO
formatName);
}
+ /**
+ * Retrieve an iterator over all registered readers for the given
+ * MIME type.
+ *
+ * @param MIMEType a MIME specification for an image type
+ * (e.g. "image/jpeg" or "image/x-bmp")
+ *
+ * @return an iterator over a collection of image readers
+ *
+ * @exception IllegalArgumentException if MIMEType is null
+ */
public static Iterator getImageReadersByMIMEType(String MIMEType)
{
if (MIMEType == null)
@@ -343,6 +467,16 @@ public final class ImageIO
MIMEType);
}
+ /**
+ * Retrieve an iterator over all registered readers for the given
+ * file suffix.
+ *
+ * @param fileSuffix an image file suffix (e.g. "jpg" or "bmp")
+ *
+ * @return an iterator over a collection of image readers
+ *
+ * @exception IllegalArgumentException if fileSuffix is null
+ */
public static Iterator getImageReadersBySuffix(String fileSuffix)
{
if (fileSuffix == null)
@@ -353,6 +487,16 @@ public final class ImageIO
fileSuffix);
}
+ /**
+ * Retrieve an iterator over all registered writers for the given
+ * format.
+ *
+ * @param formatName an infomal format name (e.g. "jpeg" or "bmp")
+ *
+ * @return an iterator over a collection of image writers
+ *
+ * @exception IllegalArgumentException if formatName is null
+ */
public static Iterator getImageWritersByFormatName(String formatName)
{
if (formatName == null)
@@ -363,6 +507,17 @@ public final class ImageIO
formatName);
}
+ /**
+ * Retrieve an iterator over all registered writers for the given
+ * MIME type.
+ *
+ * @param MIMEType a MIME specification for an image type
+ * (e.g. "image/jpeg" or "image/x-bmp")
+ *
+ * @return an iterator over a collection of image writers
+ *
+ * @exception IllegalArgumentException if MIMEType is null
+ */
public static Iterator getImageWritersByMIMEType(String MIMEType)
{
if (MIMEType == null)
@@ -373,6 +528,16 @@ public final class ImageIO
MIMEType);
}
+ /**
+ * Retrieve an iterator over all registered writers for the given
+ * file suffix.
+ *
+ * @param fileSuffix an image file suffix (e.g. "jpg" or "bmp")
+ *
+ * @return an iterator over a collection of image writers
+ *
+ * @exception IllegalArgumentException if fileSuffix is null
+ */
public static Iterator getImageWritersBySuffix(String fileSuffix)
{
if (fileSuffix == null)
@@ -383,6 +548,12 @@ public final class ImageIO
fileSuffix);
}
+ /**
+ * Retrieve all the informal format names supported by the
+ * collection of registered image readers.
+ *
+ * @return an array of format names
+ */
public static String[] getReaderFormatNames()
{
try
@@ -408,6 +579,12 @@ public final class ImageIO
}
}
+ /**
+ * Retrieve all the MIME types supported by the collection of
+ * registered image readers.
+ *
+ * @return an array of MIME types
+ */
public static String[] getReaderMIMETypes()
{
try
@@ -438,11 +615,23 @@ public final class ImageIO
return IIORegistry.getDefaultInstance();
}
+ /**
+ * Check whether or not an on-disk cache is used for image input and
+ * output streams.
+ *
+ * @return true if an on-disk cache is available, false otherwise
+ */
public static boolean getUseCache()
{
return useCache;
}
+ /**
+ * Retrieve all the informal format names supported by the
+ * collection of registered image writers.
+ *
+ * @return an array of format names
+ */
public static String[] getWriterFormatNames()
{
try
@@ -468,6 +657,12 @@ public final class ImageIO
}
}
+ /**
+ * Retrieve all the MIME types supported by the collection of
+ * registered image writers.
+ *
+ * @return an array of MIME types
+ */
public static String[] getWriterMIMETypes()
{
try
@@ -502,8 +697,20 @@ public final class ImageIO
IIORegistry.getDefaultInstance().registerApplicationClasspathSpis();
}
+ /**
+ * Set the directory to be used for caching image data. A null
+ * argument means to use the default system temporary directory.
+ * This cache directory is only used if getUseCache returns true.
+ *
+ * @param cacheDirectory the directory where image data should be
+ * cached
+ *
+ * @exception IllegalArgumentException if cacheDirectory is not a
+ * directory
+ */
public static void setCacheDirectory(File cacheDirectory)
{
+ // FIXME: add SecurityManager call
if (cacheDirectory != null)
{
if (!cacheDirectory.isDirectory())
@@ -515,37 +722,98 @@ public final class ImageIO
ImageIO.cacheDirectory = cacheDirectory;
}
+ /**
+ * Control whether or not an on-disk cache is used. This cache is
+ * used to store input or output data from an image data stream when
+ * data in the stream needs to be re-processed.
+ *
+ * If useCache is false the cache will be stored in memory. Doing
+ * so eliminates file creation and deletion overhead. The default
+ * is to use an on-disk cache.
+ *
+ * @param useCache true to use an on-disk cache, false otherwise
+ */
public static void setUseCache(boolean useCache)
{
ImageIO.useCache = useCache;
}
- /*
- * "Standard" simplified entry points.
+ /**
+ * Write an image to a file using a registered writer that supports
+ * the given format, overwriting the file if it already exists.
+ *
+ * @param im the image data to write
+ * @param formatName an informal description of the output format
+ * @param output the file to which the image will be written
+ *
+ * @return false if no registered writer supports the given format,
+ * true otherwise
+ *
+ * @exception IllegalArgumentException if any argument is null
+ * @exception IOException if a writing error occurs
*/
-
public static boolean write(RenderedImage im,
String formatName,
File output)
throws IOException
{
+ if (im == null || formatName == null || output == null)
+ throw new IllegalArgumentException ("null argument");
+
return write(im, formatName, new FileOutputStream(output));
}
+ /**
+ * Write an image to an output stream using a registered writer that
+ * supports the given format.
+ *
+ * @param im the image data to write
+ * @param formatName an informal description of the output format
+ * @param output the output stream to which the image will be
+ * written
+ *
+ * @return false if no registered writer supports the given format,
+ * true otherwise
+ *
+ * @exception IllegalArgumentException if any argument is null
+ * @exception IOException if a writing error occurs
+ */
public static boolean write(RenderedImage im,
String formatName,
OutputStream output)
throws IOException
{
+ if (im == null || formatName == null || output == null)
+ throw new IllegalArgumentException ("null argument");
+
return write(im, formatName, new MemoryCacheImageOutputStream(output));
}
-
-
+
+ /**
+ * Write an image to an ImageOutputStream using a registered writer
+ * that supports the given format. Image data is written starting
+ * at the ImageOutputStream's current stream pointer, overwriting
+ * any existing data.
+ *
+ * @param im the image data to write
+ * @param formatName an informal description of the output format
+ * @param output the image output stream to which the image will be
+ * written
+ *
+ * @return false if no registered writer supports the given format,
+ * true otherwise
+ *
+ * @exception IllegalArgumentException if any argument is null
+ * @exception IOException if a writing error occurs
+ */
public static boolean write(RenderedImage im,
String formatName,
ImageOutputStream output)
throws IOException
{
+ if (im == null || formatName == null || output == null)
+ throw new IllegalArgumentException ("null argument");
+
Iterator writers = getImageWritersByFormatName(formatName);
IIOImage img = new IIOImage(im, null, null);
while (writers.hasNext())
@@ -567,9 +835,27 @@ public final class ImageIO
return false;
}
+ /**
+ * Create a buffered image from an image input stream. An image
+ * reader that supports the given image data is automatically
+ * selected from the collection of registered readers. If no
+ * registered reader can handle the input format, null is returned.
+ *
+ * @param stream the image input stream from which to read image
+ * data
+ *
+ * @return a new buffered image created from the given image data,
+ * or null
+ *
+ * @exception IllegalArgumentException if stream is null
+ * @exception IOException if a reading error occurs
+ */
public static BufferedImage read(ImageInputStream stream)
throws IOException
{
+ if (stream == null)
+ throw new IllegalArgumentException("null argument");
+
Iterator providers = getRegistry().getServiceProviders(ImageReaderSpi.class, true);
while (providers.hasNext())
{
@@ -583,23 +869,330 @@ public final class ImageIO
}
return null;
}
-
+
+ /**
+ * Create a buffered image from a URL. An image reader that
+ * supports the given image data is automatically selected from the
+ * collection of registered readers. If no registered reader can
+ * handle the input format, null is returned.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * This method does not locate readers that read data directly from
+ * a URL. To locate such readers manually, use IIORegistry and
+ * ImageReaderSpi.
+ *
+ * @param input the URL from which to retrieve the image file
+ *
+ * @return a new buffered image created from the given image URL, or
+ * null
+ *
+ * @exception IllegalArgumentException if input is null
+ * @exception IOException if a reading error occurs
+ */
public static BufferedImage read(URL input)
throws IOException
{
+ if (input == null)
+ throw new IllegalArgumentException("null argument");
+
return read(input.openStream());
}
+ /**
+ * Create a buffered image from an input stream. An image reader
+ * that supports the given image data is automatically selected from
+ * the collection of registered readers. If no registered reader
+ * can handle the input format, null is returned.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * This method does not locate readers that read data directly from
+ * an input stream. To locate such readers manually, use
+ * IIORegistry and ImageReaderSpi.
+ *
+ * @param input the input stream from which to read the image data
+ *
+ * @return a new buffered image created from the given input stream,
+ * or null
+ *
+ * @exception IllegalArgumentException if input is null
+ * @exception IOException if a reading error occurs
+ */
public static BufferedImage read(InputStream input)
throws IOException
{
+ if (input == null)
+ throw new IllegalArgumentException("null argument");
+
return read(new MemoryCacheImageInputStream(input));
}
+ /**
+ * Create a buffered image from a file. An image reader that
+ * supports the given image data is automatically selected from the
+ * collection of registered readers. If no registered reader can
+ * handle the input format, null is returned.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * This method does not locate readers that read data directly from
+ * a file. To locate such readers manually, use IIORegistry and
+ * ImageReaderSpi.
+ *
+ * @param input the file from which to read image data
+ *
+ * @return a new buffered image created from the given image file,
+ * or null
+ *
+ * @exception IllegalArgumentException if input is null
+ * @exception IOException if a reading error occurs
+ */
public static BufferedImage read(File input)
throws IOException
{
+ if (input == null)
+ throw new IllegalArgumentException("null argument");
+
return read(new FileInputStream(input));
}
+ /**
+ * Create an image input stream from the given object. The
+ * collection of ImageInputStreamSpis registered with the
+ * IIORegistry is searched for an image input stream that can take
+ * input from the given object. null is returned if no such SPI is
+ * registered.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * @param input an object from which to read image data
+ *
+ * @return an ImageInputStream that can read data from input, or
+ * null
+ *
+ * @exception IllegalArgumentException if input is null
+ * @exception IOException if caching is required but not enabled
+ */
+ public static ImageInputStream createImageInputStream (Object input)
+ throws IOException
+ {
+ if (input == null)
+ throw new IllegalArgumentException ("null argument");
+
+ Iterator spis = getRegistry().getServiceProviders
+ (ImageInputStreamSpi.class, true);
+
+ ImageInputStreamSpi foundSpi = null;
+
+ while(spis.hasNext())
+ {
+ ImageInputStreamSpi spi = (ImageInputStreamSpi) spis.next();
+
+ if (input.getClass().equals(spi.getInputClass()))
+ {
+ foundSpi = spi;
+ break;
+ }
+ }
+
+ return foundSpi == null ? null :
+ foundSpi.createInputStreamInstance (input,
+ getUseCache(),
+ getCacheDirectory());
+ }
+
+ /**
+ * Create an image output stream from the given object. The
+ * collection of ImageOutputStreamSpis registered with the
+ * IIORegistry is searched for an image output stream that can send
+ * output to the given object. null is returned if no such SPI is
+ * registered.
+ *
+ * The image data will be cached in the current cache directory if
+ * caching is enabled.
+ *
+ * @param input an object to which to write image data
+ *
+ * @return an ImageOutputStream that can send data to output, or
+ * null
+ *
+ * @exception IllegalArgumentException if output is null
+ * @exception IOException if caching is required but not enabled
+ */
+ public static ImageOutputStream createImageOutputStream (Object output)
+ throws IOException
+ {
+ if (output == null)
+ throw new IllegalArgumentException ("null argument");
+
+ Iterator spis = getRegistry().getServiceProviders
+ (ImageOutputStreamSpi.class, true);
+
+ ImageOutputStreamSpi foundSpi = null;
+
+ while(spis.hasNext())
+ {
+ ImageOutputStreamSpi spi = (ImageOutputStreamSpi) spis.next();
+
+ if (output.getClass().equals(spi.getOutputClass()))
+ {
+ foundSpi = spi;
+ break;
+ }
+ }
+
+ return foundSpi == null ? null :
+ foundSpi.createOutputStreamInstance (output,
+ getUseCache(),
+ getCacheDirectory());
+ }
+
+ /**
+ * Retrieve an image reader corresponding to an image writer, or
+ * null if writer is not registered or if no corresponding reader is
+ * registered.
+ *
+ * @param writer a registered image writer
+ *
+ * @return an image reader corresponding to writer, or null
+ *
+ * @exception IllegalArgumentException if writer is null
+ */
+ public static ImageReader getImageReader (ImageWriter writer)
+ {
+ if (writer == null)
+ throw new IllegalArgumentException ("null argument");
+
+ ImageWriterSpi spi = (ImageWriterSpi) getRegistry()
+ .getServiceProviderByClass(writer.getClass());
+
+ String[] readerSpiNames = spi.getImageReaderSpiNames();
+
+ ImageReader r = null;
+
+ if (readerSpiNames != null)
+ {
+ try
+ {
+ Class readerClass = Class.forName (readerSpiNames[0]);
+ r = (ImageReader) readerClass.newInstance ();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Retrieve an iterator over the collection of registered image
+ * readers that support reading data from the given object.
+ *
+ * @param input the object for which to retrieve image readers
+ *
+ * @return an iterator over a collection of image readers
+ */
+ public static Iterator getImageReaders (Object input)
+ {
+ if (input == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getRegistry().getServiceProviders (ImageReaderSpi.class,
+ new ReaderObjectFilter(input),
+ true);
+ }
+
+ /**
+ * Retrieve an iterator over the collection of registered image
+ * writers that support writing images of the given type and in the
+ * given format.
+ *
+ * @param type the output image's colour and sample models
+ * @param formatName the output image format
+ *
+ * @return an iterator over a collection of image writers
+ */
+ public static Iterator getImageWriters (ImageTypeSpecifier type,
+ String formatName)
+ {
+ if (type == null || formatName == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getRegistry().getServiceProviders (ImageWriterSpi.class,
+ new WriterObjectFilter(type,
+ formatName),
+ true);
+ }
+
+ /**
+ * Retrieve an image writer corresponding to an image reader, or
+ * null if reader is not registered or if no corresponding writer is
+ * registered. This method is useful for preserving metadata
+ * without needing to understand its format, since the returned
+ * writer will be able to write, unchanged, the metadata passed to
+ * it by the reader.
+ *
+ * @param reader a registered image reader
+ *
+ * @return an image writer corresponding to reader, or null
+ *
+ * @exception IllegalArgumentException if reader is null
+ */
+ public static ImageWriter getImageWriter (ImageReader reader)
+ {
+ if (reader == null)
+ throw new IllegalArgumentException ("null argument");
+
+ ImageReaderSpi spi = (ImageReaderSpi) getRegistry()
+ .getServiceProviderByClass(reader.getClass());
+
+ String[] writerSpiNames = spi.getImageWriterSpiNames();
+
+ ImageWriter w = null;
+
+ if (writerSpiNames != null)
+ {
+ try
+ {
+ Class writerClass = Class.forName (writerSpiNames[0]);
+ w = (ImageWriter) writerClass.newInstance ();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+ return w;
+ }
+
+ /**
+ * Retrieve an iterator over a collection of image transcoders that
+ * support transcoding from the given image reader's metadata format
+ * to the given writer's metadata format.
+ *
+ * @param reader an image reader
+ * @param writer an image writer
+ *
+ * @return an iterator over a collection of image transcoders
+ *
+ * @exception IllegalArgumentException if either reader or writer is
+ * null
+ */
+ public static Iterator getImageTranscoders (ImageReader reader,
+ ImageWriter writer)
+ {
+ if (reader == null || writer == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getRegistry().getServiceProviders (ImageTranscoderSpi.class,
+ new TranscoderFilter (reader,
+ writer),
+ true);
+ }
}
diff --git a/libjava/classpath/javax/imageio/ImageReadParam.java b/libjava/classpath/javax/imageio/ImageReadParam.java
index 889fe6cc97d..b2680f6b14e 100644
--- a/libjava/classpath/javax/imageio/ImageReadParam.java
+++ b/libjava/classpath/javax/imageio/ImageReadParam.java
@@ -42,6 +42,8 @@ import java.awt.Dimension;
import java.awt.image.BufferedImage;
/**
+ * DOCUMENT ME
+ *
* @author Michel Koch (konqueror@gmx.de)
*/
public class ImageReadParam extends IIOParam
diff --git a/libjava/classpath/javax/imageio/ImageReader.java b/libjava/classpath/javax/imageio/ImageReader.java
index fdf692bd2aa..cdd77d52bad 100644
--- a/libjava/classpath/javax/imageio/ImageReader.java
+++ b/libjava/classpath/javax/imageio/ImageReader.java
@@ -1,5 +1,5 @@
/* ImageReader.java -- Decodes raster images.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,13 +38,19 @@ exception statement from your version. */
package javax.imageio;
+import java.awt.Point;
+import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
+import java.awt.image.RenderedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+import java.util.Set;
import javax.imageio.event.IIOReadProgressListener;
import javax.imageio.event.IIOReadUpdateListener;
@@ -53,82 +59,233 @@ import javax.imageio.metadata.IIOMetadata;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;
+/**
+ * A class for decoding images within the ImageIO framework.
+ *
+ * An ImageReader for a given format is instantiated by an
+ * ImageReaderSpi for that format. ImageReaderSpis are registered
+ * with the IIORegistry.
+ *
+ * The ImageReader API supports reading animated images that may have
+ * multiple frames; to support such images many methods take an index
+ * parameter.
+ *
+ * Images may also be read in multiple passes, where each successive
+ * pass increases the level of detail in the destination image.
+ */
public abstract class ImageReader
{
private boolean aborted;
-
- protected Locale[] availableLocales;
- protected boolean ignoreMetadata;
- protected Object input;
- protected Locale locale;
- protected int minIndex;
- protected ImageReaderSpi originatingProvider;
- protected List progressListeners = new ArrayList();
- protected boolean seekForwardOnly;
- protected List updateListeners = new ArrayList();
- protected List warningListeners = new ArrayList();
- protected List warningLocales = new ArrayList();
+ /**
+ * All locales available for localization of warning messages, or
+ * null if localization is not supported.
+ */
+ protected Locale[] availableLocales = null;
+
+ /**
+ * true if the input source does not require metadata to be read,
+ * false otherwise.
+ */
+ protected boolean ignoreMetadata = false;
+
+ /**
+ * An ImageInputStream from which image data is read.
+ */
+ protected Object input = null;
+
+ /**
+ * The current locale used to localize warning messages, or null if
+ * no locale has been set.
+ */
+ protected Locale locale = null;
+
+ /**
+ * The minimum index at which data can be read. Constantly 0 if
+ * seekForwardOnly is false, always increasing if seekForwardOnly is
+ * true.
+ */
+ protected int minIndex = 0;
+
+ /**
+ * The image reader SPI that instantiated this reader.
+ */
+ protected ImageReaderSpi originatingProvider = null;
+
+ /**
+ * A list of installed progress listeners. Initially null, meaning
+ * no installed listeners.
+ */
+ protected List progressListeners = null;
+
+ /**
+ * true if this reader should only read data further ahead in the
+ * stream than its current location. false if it can read backwards
+ * in the stream. If this is true then caching can be avoided.
+ */
+ protected boolean seekForwardOnly = false;
+
+ /**
+ * A list of installed update listeners. Initially null, meaning no
+ * installed listeners.
+ */
+ protected List updateListeners = null;
+
+ /**
+ * A list of installed warning listeners. Initially null, meaning
+ * no installed listeners.
+ */
+ protected List warningListeners = null;
+
+ /**
+ * A list of warning locales corresponding with the list of
+ * installed warning listeners. Initially null, meaning no locales.
+ */
+ protected List warningLocales = null;
+
+ /**
+ * Construct an image reader.
+ *
+ * @param originatingProvider the provider that is constructing this
+ * image reader, or null
+ */
protected ImageReader(ImageReaderSpi originatingProvider)
{
this.originatingProvider = originatingProvider;
}
+ /**
+ * Request that reading be aborted. The unread contents of the
+ * image will be undefined.
+ *
+ * Readers should clear the abort flag before starting a read
+ * operation, then poll it periodically during the read operation.
+ */
public void abort()
{
aborted = true;
}
+ /**
+ * Check if the abort flag is set.
+ *
+ * @return true if the current read operation should be aborted,
+ * false otherwise
+ */
protected boolean abortRequested()
{
return aborted;
}
+ /**
+ * Install a read progress listener. This method will return
+ * immediately if listener is null.
+ *
+ * @param listener a read progress listener or null
+ */
public void addIIOReadProgressListener(IIOReadProgressListener listener)
{
if (listener == null)
return;
-
- progressListeners.add(listener);
+ if (progressListeners == null)
+ progressListeners = new ArrayList ();
+ progressListeners.add(listener);
}
+ /**
+ * Install a read update listener. This method will return
+ * immediately if listener is null.
+ *
+ * @param listener a read update listener
+ */
public void addIIOReadUpdateListener(IIOReadUpdateListener listener)
{
if (listener == null)
return;
-
- updateListeners.add(listener);
+ if (updateListeners == null)
+ updateListeners = new ArrayList ();
+ updateListeners.add(listener);
}
-
+
+ /**
+ * Install a read warning listener. This method will return
+ * immediately if listener is null. Warning messages sent to this
+ * listener will be localized using the current locale. If the
+ * current locale is null then this reader will select a sensible
+ * default.
+ *
+ * @param listener a read warning listener
+ */
public void addIIOReadWarningListener(IIOReadWarningListener listener)
{
if (listener == null)
return;
-
- warningListeners.add(listener);
+ if (warningListeners == null)
+ warningListeners = new ArrayList ();
+ warningListeners.add(listener);
}
+ /**
+ * Check if this reader can handle raster data. Determines whether
+ * or not readRaster and readTileRaster throw
+ * UnsupportedOperationException.
+ *
+ * @return true if this reader supports raster data, false if not
+ */
public boolean canReadRaster()
{
return false;
}
+ /**
+ * Clear the abort flag.
+ */
protected void clearAbortRequest()
{
aborted = false;
}
-
+
+ /**
+ * Releases any resources allocated to this object. Subsequent
+ * calls to methods on this object will produce undefined results.
+ *
+ * The default implementation does nothing; subclasses should use
+ * this method ensure that native resources are released.
+ */
public void dispose()
{
// The default implementation does nothing.
}
-
+
+ /**
+ * Returns the aspect ratio of this image, the ration of its width
+ * to its height. The aspect ratio is useful when resizing an image
+ * while keeping its proportions constant.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the image's aspect ratio
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public float getAspectRatio(int imageIndex)
throws IOException
{
+ if (input == null)
+ throw new IllegalStateException("input is null");
+
return (float) (getWidth(imageIndex) / getHeight(imageIndex));
}
+ /**
+ * Retrieve the available locales. Return null if no locales are
+ * available or a clone of availableLocales.
+ *
+ * @return an array of locales or null
+ */
public Locale[] getAvailableLocales()
{
if (availableLocales == null)
@@ -137,26 +294,107 @@ public abstract class ImageReader
return (Locale[]) availableLocales.clone();
}
+ /**
+ * Retrieve the default read parameters for this reader's image
+ * format.
+ *
+ * The default implementation returns new ImageReadParam().
+ *
+ * @return image reading parameters
+ */
public ImageReadParam getDefaultReadParam()
{
return new ImageReadParam();
}
+ /**
+ * Retrieve the format of the input source.
+ *
+ * @return the input source format name
+ *
+ * @exception IOException if a read error occurs
+ */
public String getFormatName()
throws IOException
{
return originatingProvider.getFormatNames()[0];
}
+ /**
+ * Get the height of the input image in pixels. If the input image
+ * is resizable then a default height is returned.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the height of the input image
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract int getHeight(int imageIndex)
throws IOException;
+ /**
+ * Get the metadata associated with this image. If the reader is
+ * set to ignore metadata or does not support reading metadata, or
+ * if no metadata is available then null is returned.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return a metadata object, or null
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract IIOMetadata getImageMetadata(int imageIndex)
throws IOException;
+ /**
+ * Get an iterator over the collection of image types into which
+ * this reader can decode image data. This method is guaranteed to
+ * return at least one valid image type specifier.
+ *
+ * The elements of the iterator should be ordered; the first element
+ * should be the most appropriate image type for this decoder,
+ * followed by the second-most appropriate, and so on.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return an iterator over a collection of image type specifiers
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract Iterator getImageTypes(int imageIndex)
throws IOException;
+ /**
+ * Set the input source to the given object, specify whether this
+ * reader should be allowed to read input from the data stream more
+ * than once, and specify whether this reader should ignore metadata
+ * in the input stream. The input source must be set before many
+ * methods can be called on this reader. (see all ImageReader
+ * methods that throw IllegalStateException). If input is null then
+ * the current input source will be removed.
+ *
+ * Unless this reader has direct access with imaging hardware, input
+ * should be an ImageInputStream.
+ *
+ * @param input the input source object
+ * @param seekForwardOnly true if this reader should be allowed to
+ * read input from the data stream more than once, false otherwise
+ * @param ignoreMetadata true if this reader should ignore metadata
+ * associated with the input source, false otherwise
+ *
+ * @exception IllegalArgumentException if input is not a valid input
+ * source for this reader and is not an ImageInputStream
+ */
public void setInput(Object input,
boolean seekForwardOnly,
boolean ignoreMetadata)
@@ -183,358 +421,960 @@ public abstract class ImageReader
this.minIndex = 0;
}
+ /**
+ * Set the input source to the given object and specify whether this
+ * reader should be allowed to read input from the data stream more
+ * than once. The input source must be set before many methods can
+ * be called on this reader. (see all ImageReader methods that throw
+ * IllegalStateException). If input is null then the current input
+ * source will be removed.
+ *
+ * @param input the input source object
+ * @param seekForwardOnly true if this reader should be allowed to
+ * read input from the data stream more than once, false otherwise
+ *
+ * @exception IllegalArgumentException if input is not a valid input
+ * source for this reader and is not an ImageInputStream
+ */
public void setInput(Object in, boolean seekForwardOnly)
{
setInput(in, seekForwardOnly, false);
}
- public void setInput(Object in)
+ /**
+ * Set the input source to the given object. The input source must
+ * be set before many methods can be called on this reader. (see all
+ * ImageReader methods that throw IllegalStateException). If input
+ * is null then the current input source will be removed.
+ *
+ * @param input the input source object
+ *
+ * @exception IllegalArgumentException if input is not a valid input
+ * source for this reader and is not an ImageInputStream
+ */
+ public void setInput(Object input)
{
- setInput(in, false, false);
+ setInput(input, false, false);
}
+ /**
+ * Get this reader's image input source. null is returned if the
+ * image source has not been set.
+ *
+ * @return an image input source object, or null
+ */
public Object getInput()
{
return input;
}
+ /**
+ * Get this reader's locale. null is returned if the locale has not
+ * been set.
+ *
+ * @return this reader's locale, or null
+ */
public Locale getLocale()
{
return locale;
}
+ /**
+ * Return the number of images available from the image input
+ * source, not including thumbnails. This method will return 1
+ * unless this reader is reading an animated image.
+ *
+ * Certain multi-image formats do not encode the total number of
+ * images. When reading images in those formats it may be necessary
+ * to repeatedly call read, incrementing the image index at each
+ * call, until an IndexOutOfBoundsException is thrown.
+ *
+ * The allowSearch parameter determines whether all images must be
+ * available at all times. When allowSearch is false, getNumImages
+ * will return -1 if the total number of images is unknown.
+ * Otherwise this method returns the number of images.
+ *
+ * @param allowSearch true if all images should be available at
+ * once, false otherwise
+ *
+ * @return -1 if allowSearch is false and the total number of images
+ * is currently unknown, or the number of images
+ *
+ * @exception IllegalStateException if input has not been set, or if
+ * seekForwardOnly is true
+ * @exception IOException if a read error occurs
+ */
public abstract int getNumImages(boolean allowSearch)
throws IOException;
+ /**
+ * Get the number of thumbnails associated with an image.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the number of thumbnails associated with this image
+ */
public int getNumThumbnails(int imageIndex)
throws IOException
{
return 0;
}
+ /**
+ * Get the ImageReaderSpi that created this reader or null.
+ *
+ * @return an ImageReaderSpi, or null
+ */
public ImageReaderSpi getOriginatingProvider()
{
return originatingProvider;
}
+ /**
+ * Get the metadata associated with the image being read. If the
+ * reader is set to ignore metadata or does not support reading
+ * metadata, or if no metadata is available then null is returned.
+ * This method returns metadata associated with the entirety of the
+ * image data, whereas getImageMetadata(int) returns metadata
+ * associated with a frame within a multi-image data stream.
+ *
+ * @return metadata associated with the image being read, or null
+ *
+ * @exception IOException if a read error occurs
+ */
public abstract IIOMetadata getStreamMetadata()
throws IOException;
+ /**
+ * Get the height of a thumbnail image.
+ *
+ * @param imageIndex the frame index
+ * @param thumbnailIndex the thumbnail index
+ *
+ * @return the height of the thumbnail image
+ *
+ * @exception UnsupportedOperationException if this reader does not
+ * support thumbnails
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if either index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getThumbnailHeight(int imageIndex, int thumbnailIndex)
throws IOException
{
return readThumbnail(imageIndex, thumbnailIndex).getHeight();
}
+ /**
+ * Get the width of a thumbnail image.
+ *
+ * @param imageIndex the frame index
+ * @param thumbnailIndex the thumbnail index
+ *
+ * @return the width of the thumbnail image
+ *
+ * @exception UnsupportedOperationException if this reader does not
+ * support thumbnails
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if either index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getThumbnailWidth(int imageIndex, int thumbnailIndex)
throws IOException
{
return readThumbnail(imageIndex, thumbnailIndex).getWidth();
}
+ /**
+ * Get the X coordinate in pixels of the top-left corner of the
+ * first tile in this image.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the X coordinate of this image's first tile
+ *
+ * @exception IllegalStateException if input is needed but the input
+ * source is not set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getTileGridXOffset(int imageIndex)
throws IOException
{
return 0;
}
+ /**
+ * Get the Y coordinate in pixels of the top-left corner of the
+ * first tile in this image.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the Y coordinate of this image's first tile
+ *
+ * @exception IllegalStateException if input is needed but the input
+ * source is not set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getTileGridYOffset(int imageIndex)
throws IOException
{
return 0;
}
+ /**
+ * Get the height of an image tile.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the tile height for the given image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getTileHeight(int imageIndex)
throws IOException
{
return getHeight(imageIndex);
}
+ /**
+ * Get the width of an image tile.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return the tile width for the given image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public int getTileWidth(int imageIndex)
throws IOException
{
return getWidth(imageIndex);
}
+ /**
+ * Get the width of the input image in pixels. If the input image
+ * is resizable then a default width is returned.
+ *
+ * @param imageIndex the image's index
+ *
+ * @return the width of the input image
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract int getWidth(int imageIndex)
throws IOException;
+ /**
+ * Check whether or not the given image has thumbnails associated
+ * with it.
+ *
+ * @return true if the given image has thumbnails, false otherwise
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public boolean hasThumbnails(int imageIndex)
throws IOException
{
return getNumThumbnails(imageIndex) > 0;
}
+ /**
+ * Check if this image reader ignores metadata. This method simply
+ * returns the value of ignoreMetadata.
+ *
+ * @return true if metadata is being ignored, false otherwise
+ */
public boolean isIgnoringMetadata()
{
return ignoreMetadata;
}
+ /**
+ * Check if the given image is sub-divided into equal-sized
+ * non-overlapping pixel rectangles.
+ *
+ * A reader may expose tiling in the underlying format, hide it, or
+ * simulate tiling even if the underlying format is not tiled.
+ *
+ * @return true if the given image is tiled, false otherwise
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public boolean isImageTiled(int imageIndex)
throws IOException
{
return false;
}
+ /**
+ * Check if all pixels in this image are readily accessible. This
+ * method should return false for compressed formats. The return
+ * value is a hint as to the efficiency of certain image reader
+ * operations.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if random pixel access is fast, false otherwise
+ *
+ * @exception IllegalStateException if input is null and it is
+ * needed to determine the return value
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds but the frame data must be accessed to determine
+ * the return value
+ * @exception IOException if a read error occurs
+ */
public boolean isRandomAccessEasy(int imageIndex)
throws IOException
{
return false;
}
+ /**
+ * Check if this image reader may only seek forward within the input
+ * stream.
+ *
+ * @return true if this reader may only seek forward, false
+ * otherwise
+ */
public boolean isSeekForwardOnly()
{
return seekForwardOnly;
}
+ /**
+ * Notifies all installed read progress listeners that image loading
+ * has completed by calling their imageComplete methods.
+ */
protected void processImageComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.imageComplete (this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.imageComplete (this);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners that a certain
+ * percentage of the image has been loaded, by calling their
+ * imageProgress methods.
+ *
+ * @param percentageDone the percentage of image data that has been
+ * loaded
+ */
protected void processImageProgress(float percentageDone)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.imageProgress(this, percentageDone);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.imageProgress(this, percentageDone);
+ }
}
}
-
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * imageStarted methods, that image loading has started on the given
+ * image.
+ *
+ * @param imageIndex the frame index of the image that has started
+ * loading
+ */
protected void processImageStarted(int imageIndex)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.imageStarted(this, imageIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.imageStarted(this, imageIndex);
+ }
}
}
+ /**
+ * Notifies all installed read update listeners, by calling their
+ * imageUpdate methods, that the set of samples has changed.
+ *
+ * @param image the buffered image that is being updated
+ * @param minX the X coordinate of the top-left pixel in this pass
+ * @param minY the Y coordinate of the top-left pixel in this pass
+ * @param width the total width of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param height the total height of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param periodX the horizontal sample interval
+ * @param periodY the vertical sample interval
+ * @param bands the affected bands in the destination
+ */
protected void processImageUpdate(BufferedImage image, int minX, int minY,
int width, int height, int periodX,
int periodY, int[] bands)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.imageUpdate(this, image, minX, minY, width, height, periodX,
- periodY, bands);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.imageUpdate(this, image, minX, minY, width, height,
+ periodX, periodY, bands);
+ }
}
}
+ /**
+ * Notifies all installed update progress listeners, by calling
+ * their passComplete methods, that a progressive pass has
+ * completed.
+ *
+ * @param image the image that has being updated
+ */
protected void processPassComplete(BufferedImage image)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.passComplete(this, image);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.passComplete(this, image);
+ }
}
}
+ /**
+ * Notifies all installed read update listeners, by calling their
+ * passStarted methods, that a new pass has begun.
+ *
+ * @param image the buffered image that is being updated
+ * @param pass the current pass number
+ * @param minPass the pass at which decoding will begin
+ * @param maxPass the pass at which decoding will end
+ * @param minX the X coordinate of the top-left pixel in this pass
+ * @param minY the Y coordinate of the top-left pixel in this pass
+ * @param width the total width of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param height the total height of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param periodX the horizontal sample interval
+ * @param periodY the vertical sample interval
+ * @param bands the affected bands in the destination
+ */
protected void processPassStarted(BufferedImage image, int pass, int minPass,
int maxPass, int minX, int minY,
int periodX, int periodY, int[] bands)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.passStarted(this, image, pass, minPass, maxPass, minX, minY,
- periodX, periodY, bands);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.passStarted(this, image, pass, minPass, maxPass, minX,
+ minY, periodX, periodY, bands);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners that image loading
+ * has been aborted by calling their readAborted methods.
+ */
protected void processReadAborted()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.readAborted(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.readAborted(this);
+ }
}
}
-
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * sequenceComplete methods, that a sequence of images has completed
+ * loading.
+ */
protected void processSequenceComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.sequenceComplete(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.sequenceComplete(this);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * sequenceStarted methods, a sequence of images has started
+ * loading.
+ *
+ * @param minIndex the index of the first image in the sequence
+ */
protected void processSequenceStarted(int minIndex)
{
- Iterator it = progressListeners.iterator();
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.sequenceStarted(this, minIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.sequenceStarted(this, minIndex);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * thumbnailComplete methods, that a thumbnail has completed
+ * loading.
+ */
protected void processThumbnailComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.thumbnailComplete(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.thumbnailComplete(this);
+ }
}
}
+ /**
+ * Notifies all installed update progress listeners, by calling
+ * their thumbnailPassComplete methods, that a progressive pass has
+ * completed on a thumbnail.
+ *
+ * @param thumbnail the thumbnail that has being updated
+ */
protected void processThumbnailPassComplete(BufferedImage thumbnail)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.thumbnailPassComplete(this, thumbnail);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.thumbnailPassComplete(this, thumbnail);
+ }
}
}
+ /**
+ * Notifies all installed read update listeners, by calling their
+ * thumbnailPassStarted methods, that a new pass has begun.
+ *
+ * @param thumbnail the thumbnail that is being updated
+ * @param pass the current pass number
+ * @param minPass the pass at which decoding will begin
+ * @param maxPass the pass at which decoding will end
+ * @param minX the X coordinate of the top-left pixel in this pass
+ * @param minY the Y coordinate of the top-left pixel in this pass
+ * @param width the total width of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param height the total height of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param periodX the horizontal sample interval
+ * @param periodY the vertical sample interval
+ * @param bands the affected bands in the destination
+ */
protected void processThumbnailPassStarted(BufferedImage thumbnail, int pass,
int minPass, int maxPass, int minX,
int minY, int periodX, int periodY,
int[] bands)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.thumbnailPassStarted(this, thumbnail, pass, minPass, maxPass,
- minX, minY, periodX, periodY, bands);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.thumbnailPassStarted(this, thumbnail, pass, minPass,
+ maxPass, minX, minY, periodX,
+ periodY, bands);
+ }
}
}
-
+
+ /**
+ * Notifies all installed read progress listeners that a certain
+ * percentage of a thumbnail has been loaded, by calling their
+ * thumbnailProgress methods.
+ *
+ * @param percentageDone the percentage of thumbnail data that has
+ * been loaded
+ */
protected void processThumbnailProgress(float percentageDone)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.thumbnailProgress(this, percentageDone);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.thumbnailProgress(this, percentageDone);
+ }
}
}
+ /**
+ * Notifies all installed read progress listeners, by calling their
+ * imageStarted methods, that thumbnail loading has started on the
+ * given thumbnail of the given image.
+ *
+ * @param imageIndex the frame index of the image one of who's
+ * thumbnails has started loading
+ * @param thumbnailIndex the index of the thumbnail that has started
+ * loading
+ */
protected void processThumbnailStarted(int imageIndex, int thumbnailIndex)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOReadProgressListener listener = (IIOReadProgressListener) it.next();
- listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadProgressListener listener =
+ (IIOReadProgressListener) it.next();
+ listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
+ }
}
}
+ /**
+ * Notifies all installed read update listeners, by calling their
+ * thumbnailUpdate methods, that the set of samples has changed.
+ *
+ * @param image the buffered image that is being updated
+ * @param minX the X coordinate of the top-left pixel in this pass
+ * @param minY the Y coordinate of the top-left pixel in this pass
+ * @param width the total width of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param height the total height of the rectangle covered by this
+ * pass, including skipped pixels
+ * @param periodX the horizontal sample interval
+ * @param periodY the vertical sample interval
+ * @param bands the affected bands in the destination
+ */
protected void processThumbnailUpdate(BufferedImage image, int minX, int minY,
int width, int height, int periodX,
int periodY, int[] bands)
{
- Iterator it = updateListeners.iterator();
-
- while (it.hasNext())
+ if (updateListeners != null)
{
- IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
- listener.thumbnailUpdate(this, image, minX, minY, width, height,
- periodX, periodY, bands);
+ Iterator it = updateListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadUpdateListener listener = (IIOReadUpdateListener) it.next();
+ listener.thumbnailUpdate(this, image, minX, minY, width, height,
+ periodX, periodY, bands);
+ }
}
}
+ /**
+ * Notifies all installed warning listeners, by calling their
+ * warningOccurred methods, that a warning message has been raised.
+ *
+ * @param warning the warning message
+ *
+ * @exception IllegalArgumentException if warning is null
+ */
protected void processWarningOccurred(String warning)
{
- Iterator it = warningListeners.iterator();
+ if (warning == null)
+ throw new IllegalArgumentException ("null argument");
+ if (warningListeners != null)
+ {
+ Iterator it = warningListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadWarningListener listener =
+ (IIOReadWarningListener) it.next();
+ listener.warningOccurred(this, warning);
+ }
+ }
+ }
+
+ /**
+ * Notify all installed warning listeners, by calling their
+ * warningOccurred methods, that a warning message has been raised.
+ * The warning message is retrieved from a resource bundle, using
+ * the given basename and keyword.
+ *
+ * @param baseName the basename of the resource from which to
+ * retrieve the warning message
+ * @param keyword the keyword used to retrieve the warning from the
+ * resource bundle
+ *
+ * @exception IllegalArgumentException if either baseName or keyword
+ * is null
+ * @exception IllegalArgumentException if no resource bundle is
+ * found using baseName
+ * @exception IllegalArgumentException if the given keyword produces
+ * no results from the resource bundle
+ * @exception IllegalArgumentException if the retrieved object is
+ * not a String
+ */
+ protected void processWarningOccurred(String baseName,
+ String keyword)
+ {
+ if (baseName == null || keyword == null)
+ throw new IllegalArgumentException ("null argument");
+
+ ResourceBundle b = null;
+
+ try
+ {
+ b = ResourceBundle.getBundle(baseName, getLocale());
+ }
+ catch (MissingResourceException e)
+ {
+ throw new IllegalArgumentException ("no resource bundle found");
+ }
+
+ Object str = null;
- while (it.hasNext())
+ try
{
- IIOReadWarningListener listener = (IIOReadWarningListener) it.next();
- listener.warningOccurred(this, warning);
+ str = b.getObject(keyword);
+ }
+ catch (MissingResourceException e)
+ {
+ throw new IllegalArgumentException ("no results found for keyword");
+ }
+
+ if (! (str instanceof String))
+ throw new IllegalArgumentException ("retrieved object not a String");
+
+ String warning = (String) str;
+
+ if (warningListeners != null)
+ {
+ Iterator it = warningListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOReadWarningListener listener =
+ (IIOReadWarningListener) it.next();
+ listener.warningOccurred(this, warning);
+ }
}
}
+ /**
+ * Read the given frame into a buffered image using the given read
+ * parameters. Listeners will be notified of image loading progress
+ * and warnings.
+ *
+ * @param imageIndex the index of the frame to read
+ * @param param the image read parameters to use when reading
+ *
+ * @return a buffered image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public abstract BufferedImage read(int imageIndex, ImageReadParam param)
throws IOException;
+ /**
+ * Check if this reader supports reading thumbnails.
+ *
+ * @return true if this reader supports reading thumbnails, false
+ * otherwise
+ */
public boolean readerSupportsThumbnails()
{
return false;
}
+ /**
+ * Read raw raster data. The image type specifier in param is
+ * ignored but all other parameters are used. Offset parameters are
+ * translated into the raster's coordinate space. This method may
+ * be implemented by image readers that want to provide direct
+ * access to raw image data.
+ *
+ * @param imageIndex the frame index
+ * @param param the image read parameters
+ *
+ * @return a raster containing the read image data
+ *
+ * @exception UnsupportedOperationException if this reader doesn't
+ * support rasters
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
public Raster readRaster(int imageIndex, ImageReadParam param)
throws IOException
{
throw new UnsupportedOperationException();
}
+ /**
+ * Read a thumbnail.
+ *
+ * @param imageIndex the frame index
+ * @param thumbnailIndex the thumbnail index
+ *
+ * @return a buffered image of the thumbnail
+ *
+ * @exception UnsupportedOperationException if this reader doesn't
+ * support thumbnails
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if either the frame index or
+ * the thumbnail index is out-of-bounds
+ * @exception IOException if a read error occurs
+ *
+ */
public BufferedImage readThumbnail(int imageIndex, int thumbnailIndex)
throws IOException
{
throw new UnsupportedOperationException();
}
+ /**
+ * Uninstall all read progress listeners.
+ */
public void removeAllIIOReadProgressListeners()
{
- progressListeners.clear();
+ progressListeners = null;
}
+ /**
+ * Uninstall all read update listeners.
+ */
public void removeAllIIOReadUpdateListeners()
{
- updateListeners.clear();
+ updateListeners = null;
}
+ /**
+ * Uninstall all read warning listeners.
+ */
public void removeAllIIOReadWarningListeners()
{
- warningListeners.clear();
+ warningListeners = null;
}
-
+
+ /**
+ * Uninstall the given read progress listener.
+ *
+ * @param listener the listener to remove
+ */
public void removeIIOReadProgressListener(IIOReadProgressListener listener)
{
if (listener == null)
return;
-
- progressListeners.remove(listener);
+ if (progressListeners != null)
+ {
+ progressListeners.remove(listener);
+ }
}
-
+
+ /**
+ * Uninstall the given read update listener.
+ *
+ * @param listener the listener to remove
+ */
public void removeIIOReadUpdateListener(IIOReadUpdateListener listener)
{
if (listener == null)
return;
-
- updateListeners.remove(listener);
+
+ if (updateListeners != null)
+ {
+ updateListeners.remove(listener);
+ }
}
-
+
+ /**
+ * Uninstall the given read warning listener.
+ *
+ * @param listener the listener to remove
+ */
public void removeIIOReadWarningListener(IIOReadWarningListener listener)
{
if (listener == null)
return;
-
- warningListeners.remove(listener);
+ if (warningListeners != null)
+ {
+ warningListeners.remove(listener);
+ }
}
-
+
+ /**
+ * Set the current locale or use the default locale.
+ *
+ * @param locale the locale to set, or null
+ */
public void setLocale(Locale locale)
{
if (locale != null)
@@ -553,4 +1393,644 @@ public abstract class ImageReader
this.locale = locale;
}
+
+ /**
+ * Check that the given read parameters have valid source and
+ * destination band settings. If the param.getSourceBands() returns
+ * null, the array is assumed to include all band indices, 0 to
+ * numSrcBands - 1; likewise if param.getDestinationBands() returns
+ * null, it is assumed to be an array containing indices 0 to
+ * numDstBands - 1. A failure will cause this method to throw
+ * IllegalArgumentException.
+ *
+ * @param param the image parameters to check
+ * @param numSrcBands the number of input source bands
+ * @param numDstBands the number of ouput destination bands
+ *
+ * @exception IllegalArgumentException if either the given source or
+ * destination band indices are invalid
+ */
+ protected static void checkReadParamBandSettings(ImageReadParam param,
+ int numSrcBands,
+ int numDstBands)
+ {
+ int[] srcBands = param.getSourceBands();
+ int[] dstBands = param.getDestinationBands();
+ boolean lengthsDiffer = false;
+ boolean srcOOB = false;
+ boolean dstOOB = false;
+
+ if (srcBands == null)
+ {
+ if (dstBands == null)
+ {
+ if (numSrcBands != numDstBands)
+ lengthsDiffer = true;
+ }
+ else
+ {
+ if (numSrcBands != dstBands.length)
+ lengthsDiffer = true;
+
+ for (int i = 0; i < dstBands.length; i++)
+ if (dstBands[i] > numSrcBands - 1)
+ {
+ dstOOB = true;
+ break;
+ }
+ }
+ }
+ else
+ {
+ if (dstBands == null)
+ {
+ if (srcBands.length != numDstBands)
+ lengthsDiffer = true;
+
+ for (int i = 0; i < srcBands.length; i++)
+ if (srcBands[i] > numDstBands - 1)
+ {
+ srcOOB = true;
+ break;
+ }
+ }
+ else
+ {
+ if (srcBands.length != dstBands.length)
+ lengthsDiffer = true;
+
+ for (int i = 0; i < srcBands.length; i++)
+ if (srcBands[i] > numDstBands - 1)
+ {
+ srcOOB = true;
+ break;
+ }
+
+ for (int i = 0; i < dstBands.length; i++)
+ if (dstBands[i] > numSrcBands - 1)
+ {
+ dstOOB = true;
+ break;
+ }
+ }
+ }
+
+ if (lengthsDiffer)
+ throw new IllegalArgumentException ("array lengths differ");
+
+ if (srcOOB)
+ throw new IllegalArgumentException ("source band index"
+ + " out-of-bounds");
+
+ if (dstOOB)
+ throw new IllegalArgumentException ("destination band index"
+ + " out-of-bounds");
+ }
+
+ /**
+ * Calcluate the source and destination regions that will be read
+ * from and written to, given image parameters and/or a destination
+ * buffered image. The source region will be clipped if any of its
+ * bounds are outside the destination region. Clipping will account
+ * for subsampling and destination offsets. Likewise, the
+ * destination region is clipped to the given destination image, if
+ * it is not null, using the given image parameters, if they are not
+ * null. IllegalArgumentException is thrown if either region will
+ * contain 0 pixels after clipping.
+ *
+ * @param image read parameters, or null
+ * @param srcWidth the width of the source image
+ * @param srcHeight the height of the source image
+ * @param image the destination image, or null
+ * @param srcRegion a rectangle whose values will be set to the
+ * clipped source region
+ * @param destRegion a rectangle whose values will be set to the
+ * clipped destination region
+ *
+ * @exception IllegalArgumentException if either srcRegion or
+ * destRegion is null
+ * @exception IllegalArgumentException if either of the calculated
+ * regions is empty
+ */
+ protected static void computeRegions (ImageReadParam param,
+ int srcWidth,
+ int srcHeight,
+ BufferedImage image,
+ Rectangle srcRegion,
+ Rectangle destRegion)
+ {
+ if (srcRegion == null || destRegion == null)
+ throw new IllegalArgumentException ("null region");
+
+ if (srcWidth == 0 || srcHeight == 0)
+ throw new IllegalArgumentException ("zero-sized region");
+
+ srcRegion = getSourceRegion(param, srcWidth, srcHeight);
+ if (image != null)
+ destRegion = new Rectangle (0, 0, image.getWidth(), image.getHeight());
+ else
+ destRegion = new Rectangle (0, 0, srcWidth, srcHeight);
+
+ if (param != null)
+ {
+ Point offset = param.getDestinationOffset();
+
+ if (offset.x < 0)
+ {
+ srcRegion.x -= offset.x;
+ srcRegion.width += offset.x;
+ }
+ if (offset.y < 0)
+ {
+ srcRegion.y -= offset.y;
+ srcRegion.height += offset.y;
+ }
+
+ srcRegion.width = srcRegion.width > destRegion.width
+ ? destRegion.width : srcRegion.width;
+ srcRegion.height = srcRegion.height > destRegion.height
+ ? destRegion.height : srcRegion.height;
+
+ if (offset.x >= 0)
+ {
+ destRegion.x += offset.x;
+ destRegion.width -= offset.x;
+ }
+ if (offset.y >= 0)
+ {
+ destRegion.y += offset.y;
+ destRegion.height -= offset.y;
+ }
+ }
+
+ if (srcRegion.isEmpty() || destRegion.isEmpty())
+ throw new IllegalArgumentException ("zero-sized region");
+ }
+
+ /**
+ * Return a suitable destination buffered image. If
+ * param.getDestination() is non-null, then it is returned,
+ * otherwise a buffered image is created using
+ * param.getDestinationType() if it is non-null and also in the
+ * given imageTypes collection, or the first element of imageTypes
+ * otherwise.
+ *
+ * @param param image read parameters from which a destination image
+ * or image type is retrieved, or null
+ * @param imageTypes a collection of legal image types
+ * @param width the width of the source image
+ * @param height the height of the source image
+ *
+ * @return a suitable destination buffered image
+ *
+ * @exception IIOException if param.getDestinationType() does not
+ * return an image type in imageTypes
+ * @exception IllegalArgumentException if imageTypes is null or
+ * empty, or if a non-ImageTypeSpecifier object is retrieved from
+ * imageTypes
+ * @exception IllegalArgumentException if the resulting destination
+ * region is empty
+ * @exception IllegalArgumentException if the product of width and
+ * height is greater than Integer.MAX_VALUE
+ */
+ protected static BufferedImage getDestination (ImageReadParam param,
+ Iterator imageTypes,
+ int width,
+ int height)
+ throws IIOException
+ {
+ if (imageTypes == null || !imageTypes.hasNext())
+ throw new IllegalArgumentException ("imageTypes null or empty");
+
+ if (width < 0 || height < 0)
+ throw new IllegalArgumentException ("negative dimension");
+
+ // test for overflow
+ if (width * height < Math.min (width, height))
+ throw new IllegalArgumentException ("width * height > Integer.MAX_VALUE");
+
+ BufferedImage dest = null;
+ ImageTypeSpecifier destType = null;
+
+ if (param != null)
+ {
+ dest = param.getDestination ();
+ if (dest == null)
+ {
+ ImageTypeSpecifier type = param.getDestinationType();
+ if (type != null)
+ {
+ Iterator it = imageTypes;
+
+ while (it.hasNext())
+ {
+ Object o = it.next ();
+ if (! (o instanceof ImageTypeSpecifier))
+ throw new IllegalArgumentException ("non-ImageTypeSpecifier object");
+
+ ImageTypeSpecifier t = (ImageTypeSpecifier) o;
+ if (t.equals (type))
+ {
+ dest = t.createBufferedImage (width, height);
+ break;
+ }
+ if (destType == null)
+ throw new IIOException ("invalid destination type");
+
+ }
+ }
+ }
+ }
+ if (dest == null)
+ {
+ Rectangle srcRegion = new Rectangle ();
+ Rectangle destRegion = new Rectangle ();
+
+ computeRegions (param, width, height, null, srcRegion, destRegion);
+
+ if (destRegion.isEmpty())
+ throw new IllegalArgumentException ("destination region empty");
+
+ if (destType == null)
+ {
+ Object o = imageTypes.next();
+ if (! (o instanceof ImageTypeSpecifier))
+ throw new IllegalArgumentException ("non-ImageTypeSpecifier"
+ + " object");
+
+ dest = ((ImageTypeSpecifier) o).createBufferedImage
+ (destRegion.width, destRegion.height);
+ }
+ else
+ dest = destType.createBufferedImage
+ (destRegion.width, destRegion.height);
+ }
+ return dest;
+ }
+
+ /**
+ * Get the metadata associated with this image. If the reader is
+ * set to ignore metadata or does not support reading metadata, or
+ * if no metadata is available then null is returned.
+ *
+ * This more specific version of getImageMetadata(int) can be used
+ * to restrict metadata retrieval to specific formats and node
+ * names, which can limit the amount of data that needs to be
+ * processed.
+ *
+ * @param imageIndex the frame index
+ * @param formatName the format of metadata requested
+ * @param nodeNames a set of Strings specifiying node names to be
+ * retrieved
+ *
+ * @return a metadata object, or null
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if formatName is null
+ * @exception IllegalArgumentException if nodeNames is null
+ * @exception IOException if a read error occurs
+ */
+ public IIOMetadata getImageMetadata (int imageIndex,
+ String formatName,
+ Set nodeNames)
+ throws IOException
+ {
+ if (formatName == null || nodeNames == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getImageMetadata (imageIndex);
+ }
+
+ /**
+ * Get the index at which the next image will be read. If
+ * seekForwardOnly is true then the returned value will increase
+ * monotonically each time an image frame is read. If
+ * seekForwardOnly is false then the returned value will always be
+ * 0.
+ *
+ * @return the current frame index
+ */
+ public int getMinIndex()
+ {
+ return minIndex;
+ }
+
+ /**
+ * Get the image type specifier that most closely represents the
+ * internal data representation used by this reader. This value
+ * should be included in the return value of getImageTypes.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return an image type specifier
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
+ public ImageTypeSpecifier getRawImageType (int imageIndex)
+ throws IOException
+ {
+ return (ImageTypeSpecifier) getImageTypes(imageIndex).next();
+ }
+
+ /**
+ * Calculate a source region based on the given source image
+ * dimensions and parameters. Subsampling offsets and a source
+ * region are taken from the given image read parameters and used to
+ * clip the given image dimensions, returning a new rectangular
+ * region as a result.
+ *
+ * @param param image parameters, or null
+ * @param srcWidth the width of the source image
+ * @param srcHeight the height of the source image
+ *
+ * @return a clipped rectangle
+ */
+ protected static Rectangle getSourceRegion (ImageReadParam param,
+ int srcWidth,
+ int srcHeight)
+ {
+ Rectangle clippedRegion = new Rectangle (0, 0, srcWidth, srcHeight);
+
+ if (param != null)
+ {
+ Rectangle srcRegion = param.getSourceRegion();
+
+ if (srcRegion != null)
+ {
+ clippedRegion.x = srcRegion.x > clippedRegion.x
+ ? srcRegion.x : clippedRegion.x;
+ clippedRegion.y = srcRegion.y > clippedRegion.y
+ ? srcRegion.y : clippedRegion.y;
+ clippedRegion.width = srcRegion.width > clippedRegion.width
+ ? srcRegion.width : clippedRegion.width;
+ clippedRegion.height = srcRegion.height > clippedRegion.height
+ ? srcRegion.height : clippedRegion.height;
+ }
+
+ int xOffset = param.getSubsamplingXOffset();
+
+ clippedRegion.x += xOffset;
+ clippedRegion.width -= xOffset;
+
+ int yOffset = param.getSubsamplingYOffset();
+
+ clippedRegion.y += yOffset;
+ clippedRegion.height -= yOffset;
+ }
+ return clippedRegion;
+ }
+
+ /**
+ * Get the metadata associated with the image being read. If the
+ * reader is set to ignore metadata or does not support reading
+ * metadata, or if no metadata is available then null is returned.
+ * This method returns metadata associated with the entirety of the
+ * image data, whereas getStreamMetadata() returns metadata
+ * associated with a frame within a multi-image data stream.
+ *
+ * This more specific version of getStreamMetadata() can be used to
+ * restrict metadata retrieval to specific formats and node names,
+ * which can limit the amount of data that needs to be processed.
+ *
+ * @param formatName the format of metadata requested
+ * @param nodeNames a set of Strings specifiying node names to be
+ * retrieved
+ *
+ * @return metadata associated with the image being read, or null
+ *
+ * @exception IllegalArgumentException if formatName is null
+ * @exception IllegalArgumentException if nodeNames is null
+ * @exception IOException if a read error occurs
+ */
+ public IIOMetadata getStreamMetadata (String formatName,
+ Set nodeNames)
+ throws IOException
+ {
+ if (formatName == null || nodeNames == null)
+ throw new IllegalArgumentException ("null argument");
+
+ return getStreamMetadata();
+ }
+
+ /**
+ * Read the given frame all at once, using default image read
+ * parameters, and return a buffered image.
+ *
+ * The returned image will be formatted according to the
+ * currently-preferred image type specifier.
+ *
+ * Installed read progress listeners, update progress listeners and
+ * warning listeners will be notified of read progress, changes in
+ * sample sets and warnings respectively.
+ *
+ * @param the index of the image frame to read
+ *
+ * @return a buffered image
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
+ public BufferedImage read (int imageIndex)
+ throws IOException
+ {
+ return read (imageIndex, null);
+ }
+
+ /**
+ * Read the given frame all at once, using the given image read
+ * parameters, and return an IIOImage. The IIOImage will contain a
+ * buffered image as returned by getDestination.
+ *
+ * Installed read progress listeners, update progress listeners and
+ * warning listeners will be notified of read progress, changes in
+ * sample sets and warnings respectively.
+ *
+ * The source and destination band settings are checked with a call
+ * to checkReadParamBandSettings.
+ *
+ * @param the index of the image frame to read
+ * @param the image read parameters
+ *
+ * @return an IIOImage
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if param.getSourceBands() and
+ * param.getDestinationBands() are incompatible
+ * @exception IllegalArgumentException if either the source or
+ * destination image regions are empty
+ * @exception IOException if a read error occurs
+ */
+ public IIOImage readAll (int imageIndex,
+ ImageReadParam param)
+ throws IOException
+ {
+ checkReadParamBandSettings (param,
+ param.getSourceBands().length,
+ param.getDestinationBands().length);
+
+ List l = new ArrayList ();
+
+ for (int i = 0; i < getNumThumbnails (imageIndex); i++)
+ l.add (readThumbnail(imageIndex, i));
+
+ return new IIOImage (getDestination(param, getImageTypes(imageIndex),
+ getWidth(imageIndex),
+ getHeight(imageIndex)),
+ l,
+ getImageMetadata (imageIndex));
+ }
+
+ /**
+ * Read all image frames all at once, using the given image read
+ * parameters iterator, and return an iterator over a collection of
+ * IIOImages. Each IIOImage in the collection will contain a
+ * buffered image as returned by getDestination.
+ *
+ * Installed read progress listeners, update progress listeners and
+ * warning listeners will be notified of read progress, changes in
+ * sample sets and warnings respectively.
+ *
+ * Each set of source and destination band settings are checked with
+ * a call to checkReadParamBandSettings.
+ *
+ * @param an iterator over the image read parameters
+ *
+ * @return an IIOImage
+ *
+ * @exception IllegalStateException if input has not been set
+ * @exception IllegalArgumentException if a non-ImageReadParam is
+ * found in params
+ * @exception IllegalArgumentException if param.getSourceBands() and
+ * param.getDestinationBands() are incompatible
+ * @exception IllegalArgumentException if either the source or
+ * destination image regions are empty
+ * @exception IOException if a read error occurs
+ */
+ public Iterator readAll (Iterator params)
+ throws IOException
+ {
+ List l = new ArrayList ();
+ int index = 0;
+
+ while (params.hasNext())
+ {
+ if (params != null && ! (params instanceof ImageReadParam))
+ throw new IllegalArgumentException ("non-ImageReadParam found");
+
+ l.add (readAll(index++, (ImageReadParam) params.next ()));
+ }
+
+ return l.iterator();
+ }
+
+ /**
+ * Read a rendered image. This is a more general counterpart to
+ * read (int, ImageReadParam). All image data may not be read
+ * before this method returns and so listeners will not necessarily
+ * be notified.
+ *
+ * @param the index of the image frame to read
+ * @param the image read parameters
+ *
+ * @return a rendered image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if param.getSourceBands() and
+ * param.getDestinationBands() are incompatible
+ * @exception IllegalArgumentException if either the source or
+ * destination image regions are empty
+ * @exception IOException if a read error occurs
+ */
+ public RenderedImage readAsRenderedImage (int imageIndex,
+ ImageReadParam param)
+ throws IOException
+ {
+ return read (imageIndex, param);
+ }
+
+ /**
+ * Read the given tile into a buffered image. If the tile
+ * coordinates are out-of-bounds an exception is thrown. If the
+ * image is not tiled then the coordinates 0, 0 are expected and the
+ * entire image will be read.
+ *
+ * @param imageIndex the frame index
+ * @param tileX the horizontal tile coordinate
+ * @param tileY the vertical tile coordinate
+ *
+ * @return the contents of the tile as a buffered image
+ *
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if the tile coordinates are
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
+ public BufferedImage readTile (int imageIndex, int tileX, int tileY)
+ throws IOException
+ {
+ if (tileX != 0 || tileY != 0)
+ throw new IllegalArgumentException ("tileX not 0 or tileY not 0");
+
+ return read (imageIndex);
+ }
+
+ /**
+ * Read the given tile into a raster containing the raw image data.
+ * If the tile coordinates are out-of-bounds an exception is thrown.
+ * If the image is not tiled then the coordinates 0, 0 are expected
+ * and the entire image will be read.
+ *
+ * @param imageIndex the frame index
+ * @param tileX the horizontal tile coordinate
+ * @param tileY the vertical tile coordinate
+ *
+ * @return the contents of the tile as a raster
+ *
+ * @exception UnsupportedOperationException if rasters are not
+ * supported
+ * @exception IllegalStateException if input is null
+ * @exception IndexOutOfBoundsException if the frame index is
+ * out-of-bounds
+ * @exception IllegalArgumentException if the tile coordinates are
+ * out-of-bounds
+ * @exception IOException if a read error occurs
+ */
+ public Raster readTileRaster (int imageIndex, int tileX, int tileY)
+ throws IOException
+ {
+ if (!canReadRaster())
+ throw new UnsupportedOperationException ("cannot read rasters");
+
+ if (tileX != 0 || tileY != 0)
+ throw new IllegalArgumentException ("tileX not 0 or tileY not 0");
+
+ return readRaster (imageIndex, null);
+ }
+
+ /**
+ * Reset this reader's internal state.
+ */
+ public void reset ()
+ {
+ setInput (null, false);
+ setLocale (null);
+ removeAllIIOReadUpdateListeners ();
+ removeAllIIOReadWarningListeners ();
+ removeAllIIOReadProgressListeners ();
+ clearAbortRequest ();
+ }
}
+
diff --git a/libjava/classpath/javax/imageio/ImageTranscoder.java b/libjava/classpath/javax/imageio/ImageTranscoder.java
index ccc99316269..1f9195f5816 100644
--- a/libjava/classpath/javax/imageio/ImageTranscoder.java
+++ b/libjava/classpath/javax/imageio/ImageTranscoder.java
@@ -41,14 +41,62 @@ package javax.imageio;
import javax.imageio.metadata.IIOMetadata;
/**
+ * An ImageTranscoder translates IIOMetadata objects provided by an
+ * ImageReader into corresponding IIOMetadata objects that can be
+ * understood by a given ImageWriter.
+ *
+ * Usually an ImageWriter will implement ImageTranscoder directly in
+ * which case the conversion methods will return IIOMetadata objects
+ * appropriate for this ImageWriter.
+ *
+ * Independent transcoders are also allowed; they must have knowledge
+ * of both the source IIOMetadata provided by the reader and the
+ * returned IIOMetadata expected by the writer.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public interface ImageTranscoder
{
+ /**
+ * Converts IIOMetadata from an input reader format, returning an
+ * IIOMetadata suitable for use by an image writer.
+ *
+ * The ImageTypeSpecifier specifies the destination image type.
+ *
+ * An optional ImageWriteParam argument is available in case the
+ * image writing parameters affect the metadata conversion.
+ *
+ * @param inData the metadata coming from an image reader
+ * @param imageType the output image type of the writer
+ * @param param the image writing parameters or null
+ *
+ * @return the converted metadata that should be used by the image
+ * writer, or null if this ImageTranscoder has no knowledge of the
+ * input metadata
+ *
+ * @exception IllegalArgumentException if either inData or imageType
+ * is null
+ */
IIOMetadata convertImageMetadata(IIOMetadata inData,
ImageTypeSpecifier imageType,
ImageWriteParam param);
+ /**
+ * Converts IIOMetadata from an input stream format, returning an
+ * IIOMetadata suitable for use by an image writer.
+ *
+ * An optional ImageWriteParam argument is available in case the
+ * image writing parameters affect the metadata conversion.
+ *
+ * @param inData the metadata coming from an input image stream
+ * @param param the image writing parameters or null
+ *
+ * @return the converted metadata that should be used by the image
+ * writer, or null if this ImageTranscoder has no knowledge of the
+ * input metadata
+ *
+ * @exception IllegalArgumentException if inData is null
+ */
IIOMetadata convertStreamMetadata(IIOMetadata inData,
ImageWriteParam param);
}
diff --git a/libjava/classpath/javax/imageio/ImageTypeSpecifier.java b/libjava/classpath/javax/imageio/ImageTypeSpecifier.java
index 0751e376757..05b3a26d493 100644
--- a/libjava/classpath/javax/imageio/ImageTypeSpecifier.java
+++ b/libjava/classpath/javax/imageio/ImageTypeSpecifier.java
@@ -38,15 +38,47 @@ exception statement from your version. */
package javax.imageio;
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
+import java.awt.image.DataBuffer;
+import java.awt.image.BandedSampleModel;
+import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
+import java.awt.image.DirectColorModel;
+import java.awt.image.IndexColorModel;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.PixelInterleavedSampleModel;
import java.awt.image.RenderedImage;
import java.awt.image.SampleModel;
+/**
+ * ImageTypeSpecifier store the color and sample models associated
+ * with an IIOImage.
+ */
public class ImageTypeSpecifier
{
+ /**
+ * The image's color model.
+ */
protected ColorModel colorModel;
+
+ /**
+ * The image's sample model.
+ */
protected SampleModel sampleModel;
+ /**
+ * Construct an image type specifier with the given models.
+ *
+ * @param colorModel the color model
+ * @param sampleModel the sample model
+ *
+ * @exception IllegalArgumentException if either model argument is
+ * null
+ * @exception IllegalArgumentException if the models are
+ * incompatible with one another
+ */
public ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel)
{
if (colorModel == null)
@@ -63,6 +95,14 @@ public class ImageTypeSpecifier
this.sampleModel = sampleModel;
}
+ /**
+ * Construct an image type specifier that describes the given
+ * rendered image.
+ *
+ * @param image a rendered image
+ *
+ * @exception IllegalArgumentException if image is null
+ */
public ImageTypeSpecifier(RenderedImage image)
{
if (image == null)
@@ -72,21 +112,448 @@ public class ImageTypeSpecifier
this.sampleModel = image.getSampleModel();
}
+ /**
+ * Create an image type specifier for a banded image using a
+ * component color model and a banded sample model.
+ *
+ * @param colorSpace the color space
+ * @param bankIndices the bank indices at which each band will be
+ * stored
+ * @param bandOffsets the starting band offset for each band within
+ * its bank
+ * @param dataType the data type, a DataBuffer constant
+ * @param hasAlpha true if this image type specifier should have an
+ * alpha component, false otherwise
+ * @param isAlphaPremultiplied true if other color components should
+ * be premultiplied by the alpha component, false otherwise
+ *
+ * @return a banded image type specifier
+ *
+ * @exception IllegalArgumentException if any of colorSpace,
+ * bankIndices or bankOffsets is null
+ * @exception IllegalArgumentException if bankIndices and
+ * bankOffsets differ in length
+ * @excpetion IllegalArgumentException if the number of color space
+ * components, including the alpha component if requested, is
+ * different from bandOffsets.length
+ * @exception if dataType is not a valid DataBuffer constant
+ */
+ public static ImageTypeSpecifier createBanded (ColorSpace colorSpace,
+ int[] bankIndices,
+ int[] bankOffsets,
+ int dataType,
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied)
+ {
+ if (colorSpace == null || bankIndices == null || bankOffsets == null)
+ throw new IllegalArgumentException ("null argument");
+
+ if (bankIndices.length != bankOffsets.length)
+ throw new IllegalArgumentException ("array lengths differ");
+
+ if (bankOffsets.length != (colorSpace.getNumComponents() + (hasAlpha ? 1 : 0)))
+ throw new IllegalArgumentException ("invalid bankOffsets length");
+
+ return new ImageTypeSpecifier (new ComponentColorModel (colorSpace,
+ hasAlpha,
+ isAlphaPremultiplied,
+ hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE,
+ dataType),
+ new BandedSampleModel (dataType, 1, 1, 1,
+ bankIndices,
+ bankOffsets));
+ }
+
+ /**
+ * Create a buffered image with the given dimensions using that has
+ * the characteristics specified by this image type specifier.
+ *
+ * @param the width of the buffered image, in pixels
+ * @param the height of the buffered image, in pixels
+ *
+ * @return a buffered image
+ *
+ * @exception IllegalArgumentException if either width or height is
+ * less than or equal to zero
+ * @exception IllegalArgumentException if width * height is greater
+ * than Integer.MAX_VALUE or if the storage required is greater than
+ * Integer.MAX_VALUE
+ */
+ public BufferedImage createBufferedImage (int width, int height)
+ {
+ if (width <= 0 || height <= 0)
+ throw new IllegalArgumentException ("dimension <= 0");
+
+ // test for overflow
+ if (width * height < Math.min (width, height))
+ throw new IllegalArgumentException ("width * height > Integer.MAX_VALUE");
+
+ if (width * height * sampleModel.getNumBands() < Math.min (width, height))
+ throw new IllegalArgumentException ("storage required >"
+ + " Integer.MAX_VALUE");
+
+ // FIXME: this is probably wrong:
+ return new BufferedImage (width, height, BufferedImage.TYPE_INT_RGB);
+ }
+
+ /**
+ * Create an image type specifier that describes the given buffered
+ * image type.
+ *
+ * @param bufferedImageType the buffered image type to represent
+ * with the returned image type specifier
+ *
+ * @return a new image type specifier
+ *
+ * @exception IllegalArgumentException if bufferedImageType is not a
+ * BufferedImage constant or is BufferedImage.TYPE_CUSTOM
+ */
+ public static ImageTypeSpecifier createFromBufferedImageType (int bufferedImageType)
+ {
+ if (bufferedImageType <= BufferedImage.TYPE_CUSTOM
+ || bufferedImageType > BufferedImage.TYPE_BYTE_INDEXED)
+ throw new IllegalArgumentException ("invalid buffered image type");
+
+ return new ImageTypeSpecifier (new BufferedImage (1, 1, bufferedImageType));
+ }
+
+ /**
+ * Create an image type specifier that describes the given rendered
+ * image's type.
+ *
+ * @param image the rendered image
+ *
+ * @return a new image type specifier
+ *
+ * @exception IllegalArgumentException if image is null
+ */
+ public static ImageTypeSpecifier createFromRenderedImage (RenderedImage image)
+ {
+ if (image == null)
+ throw new IllegalArgumentException ("image null");
+
+ return new ImageTypeSpecifier (image);
+ }
+
+ /**
+ * Create a grayscale image type specifier, given the number of
+ * bits, data type and whether or not the data is signed.
+ *
+ * @param bits the number of bits used to specify a greyscale value
+ * @param dataType a DataBuffer type constant
+ * @param isSigned true if this type specifier should support
+ * negative values, false otherwise
+ *
+ * @return a greyscal image type specifier
+ *
+ * @exception IllegalArgumentException if bits is not 1, 2, 4, 8 or 16
+ * @exception IllegalArgumentException if dataType is not
+ * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
+ * DataBuffer.TYPE_USHORT
+ * @exception if bits is larger than the number of bits in the given
+ * data type
+ */
+ public static ImageTypeSpecifier createGrayscale (int bits, int dataType, boolean isSigned)
+ {
+ return createGrayscale (bits, dataType, isSigned, false);
+ }
+
+ /**
+ * Create a grayscale image type specifier, given the number of
+ * bits, data type and whether or not the data is signed.
+ *
+ * @param bits the number of bits used to specify a greyscale value
+ * @param dataType a DataBuffer type constant
+ * @param isSigned true if this type specifier should support
+ * negative values, false otherwise
+ *
+ * @return a greyscal image type specifier
+ *
+ * @exception IllegalArgumentException if bits is not 1, 2, 4, 8 or
+ * 16
+ * @exception IllegalArgumentException if dataType is not
+ * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
+ * DataBuffer.TYPE_USHORT
+ * @exception if bits is larger than the number of bits in the given
+ * data type
+ */
+ public static ImageTypeSpecifier createGrayscale (int bits, int dataType,
+ boolean isSigned,
+ boolean isAlphaPremultiplied)
+ {
+ if (bits != 1 && bits != 2 && bits != 4 && bits != 8 && bits != 16)
+ throw new IllegalArgumentException ("invalid bit size");
+
+ if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_SHORT
+ && dataType != DataBuffer.TYPE_USHORT)
+ throw new IllegalArgumentException ("invalid data type");
+
+ if (dataType == DataBuffer.TYPE_BYTE && bits > 8)
+ throw new IllegalArgumentException ("number of bits too large for data type");
+
+ // FIXME: this is probably wrong:
+ return new ImageTypeSpecifier (new DirectColorModel (bits, 0xff, 0x0,
+ 0x0, 0xff),
+ new MultiPixelPackedSampleModel (dataType,
+ 1, 1,
+ bits));
+ }
+
+ /**
+ * Return an image type specifier for an image that uses an indexed
+ * colour model where each colour value has the specified number of
+ * bits and type and where the colour tables are those given.
+ *
+ * @param redLUT the red index values
+ * @param greenLUT the green index values
+ * @param blueLUT the blue index values
+ * @param alphaLUT the alpha index values
+ * @param bits the number of bits per index value
+ * @param dataType the type of each index value
+ *
+ * @return an indexed image type specifier
+ *
+ * @exception IllegalArgumentException if any of the colour arrays,
+ * not including alphaLUT, is null
+ * @exception IllegalArgumentException if bits is not 1, 2, 4, 8 or
+ * 16
+ * @exception IllegalArgumentException if dataType is not
+ * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
+ * DataBuffer.TYPE_USHORT
+ * @exception if bits is larger than the number of bits in the given
+ * data type
+ */
+ public static ImageTypeSpecifier createIndexed (byte[] redLUT,
+ byte[] greenLUT,
+ byte[] blueLUT,
+ byte[] alphaLUT,
+ int bits,
+ int dataType)
+ {
+ if (redLUT == null || greenLUT == null || blueLUT == null)
+ throw new IllegalArgumentException ("null colour table");
+
+ if (bits != 1 && bits != 2 && bits != 4 && bits != 8 && bits != 16)
+ throw new IllegalArgumentException ("invalid bit size");
+
+ if (dataType != DataBuffer.TYPE_BYTE && dataType != DataBuffer.TYPE_SHORT
+ && dataType != DataBuffer.TYPE_USHORT)
+ throw new IllegalArgumentException ("invalid data type");
+
+ if (dataType == DataBuffer.TYPE_BYTE && bits > 8)
+ throw new IllegalArgumentException ("number of bits too large for data type");
+
+ // FIXME: this is probably wrong:
+ return new ImageTypeSpecifier (new IndexColorModel (bits, redLUT.length,
+ redLUT, greenLUT, blueLUT,
+ alphaLUT),
+ new MultiPixelPackedSampleModel (dataType,
+ 1, 1,
+ bits));
+ }
+
+ /**
+ * Create an image type specifier that uses a component colour model
+ * and a pixel interleaved sample model. Each pixel component will
+ * be stored in a separate value of the given data type.
+ *
+ * @param colorSpace the colour space used by the colour model
+ * @param bandOffsets the starting band offset for each band within
+ * its bank
+ * @param dataType the type of each pixel value
+ * @param hasAlpha true if an alpha channel should be specified,
+ * false otherwise
+ * @param isAlphaPremultiplied true if other colour channels should
+ * be premultiplied by the alpha value, false otherwise
+ *
+ * @return an interleaved image type specifier
+ *
+ * @exception IllegalArgumentException if either colorSpace or
+ * bandOffsets is null
+ * @excpetion IllegalArgumentException if the number of color space
+ * components, including the alpha component if requested, is
+ * different from bandOffsets.length
+ * @exception if dataType is not a valid DataBuffer constant
+ */
+ public static ImageTypeSpecifier createInterleaved (ColorSpace colorSpace,
+ int[] bandOffsets,
+ int dataType,
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied)
+ {
+ if (colorSpace == null || bandOffsets == null)
+ throw new IllegalArgumentException ("null argument");
+
+ if (bandOffsets.length != (colorSpace.getNumComponents() + (hasAlpha ? 1 : 0)))
+ throw new IllegalArgumentException ("invalid bankOffsets length");
+
+ return new ImageTypeSpecifier (new ComponentColorModel (colorSpace,
+ hasAlpha,
+ isAlphaPremultiplied,
+ hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE,
+ dataType),
+ new PixelInterleavedSampleModel (dataType, 1, 1, 1, 1,
+ bandOffsets));
+ }
+
+ /**
+ * Create an image type specifier using a direct color model and a
+ * packed sample model. All pixel components will be packed into
+ * one value of the given data type.
+ *
+ * @param colorSpace the color space to use in the color model
+ * @param redMask the bitmask for the red bits
+ * @param greenMask the bitmask for the green bits
+ * @param blueMask the bitmask for the blue bits
+ * @param alphaMask the bitmask for the alpha bits
+ * @param transferType the data type used to store pixel values
+ * @param isAlphaPremultiplied true if other colour channels should
+ * be premultiplied by the alpha value, false otherwise
+ *
+ * @return a packed image type specifier
+ *
+ * @exception IllegalArgumentException if colorSpace is null
+ * @exception IllegalArgumentException if colorSpace does not have
+ * type ColorSpace.TYPE_RGB
+ * @exception IllegalArgumentException if all masks are 0
+ * @exception IllegalArgumentException if dataType is not
+ * DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
+ * DataBuffer.TYPE_INT
+ */
+ public static ImageTypeSpecifier createPacked (ColorSpace colorSpace,
+ int redMask,
+ int greenMask,
+ int blueMask,
+ int alphaMask,
+ int transferType,
+ boolean isAlphaPremultiplied)
+ {
+ if (colorSpace == null)
+ throw new IllegalArgumentException ("null color space");
+
+ if (colorSpace.getType() != ColorSpace.TYPE_RGB)
+ throw new IllegalArgumentException ("invalid color space type");
+
+ if (redMask == 0 && greenMask == 0 && blueMask == 0 && alphaMask == 0)
+ throw new IllegalArgumentException ("no non-zero mask");
+
+ if (transferType != DataBuffer.TYPE_BYTE && transferType != DataBuffer.TYPE_USHORT
+ && transferType != DataBuffer.TYPE_INT)
+ throw new IllegalArgumentException ("invalid data type");
+
+ // Assume DataBuffer.TYPE_BYTE.
+ int numBits = 8;
+
+ if (transferType == DataBuffer.TYPE_SHORT)
+ numBits = 16;
+ else if (transferType == DataBuffer.TYPE_INT)
+ numBits = 32;
+
+ return new ImageTypeSpecifier (new DirectColorModel (colorSpace,
+ numBits,
+ redMask,
+ greenMask,
+ blueMask,
+ alphaMask,
+ isAlphaPremultiplied,
+ transferType),
+ new MultiPixelPackedSampleModel (transferType,
+ 1, 1, numBits));
+ }
+
+ /**
+ * Get the number of bits per sample in the given band.
+ *
+ * @param band the band from which to get the number of bits
+ *
+ * @return the number of bits in the given band
+ *
+ * @exception IllegalArgumentException if band is out-of-bounds
+ */
+ public int getBitsPerBand (int band)
+ {
+ if (band < 0 || band > sampleModel.getNumBands())
+ throw new IllegalArgumentException ("band out-of-bounds");
+
+ return sampleModel.getSampleSize (band);
+ }
+
+ /**
+ * Get the buffered image constant specified by this image type
+ * specifier.
+ *
+ * @return a buffered image constant
+ */
+ public int getBufferedImageType ()
+ {
+ // FIXME:
+ return BufferedImage.TYPE_INT_RGB;
+ }
+
+ /**
+ * Create a sample model that is compatible with the one specified
+ * by this image type specifier, with the given dimensions.
+ *
+ * @param width the width of the returned sample model
+ * @param height the height of the returned sample model
+ *
+ * @return a sample model compatible with the one in this image type
+ * specifier, with the given dimensions
+ *
+ * @exception IllegalArgumentException if either width or height is
+ * less than or equal to 0
+ * @exception IllegalArgumentException if width * height is greater
+ * than Intere.MAX_VALUE
+ */
+ public SampleModel getSampleModel (int width, int height)
+ {
+ if (width <= 0 || height <= 0)
+ throw new IllegalArgumentException ("invalid dimension");
+
+ // test for overflow
+ if (width * height < Math.min (width, height))
+ throw new IllegalArgumentException ("width * height > Integer.MAX_VALUE");
+
+ return sampleModel.createCompatibleSampleModel (width, height);
+ }
+
+ /**
+ * Get the color model specified by this image type specifier.
+ *
+ * @return the color model
+ */
public ColorModel getColorModel()
{
return colorModel;
}
+ /**
+ * Get the number of bands specified by this image type specifier's
+ * sample model.
+ *
+ * @return the number of bands in the sample model
+ */
public int getNumBands()
{
return sampleModel.getNumBands();
}
+ /**
+ * Get the number of components specified by this image type
+ * specifier's color model.
+ *
+ * @return the number of color components per pixel
+ */
public int getNumComponents()
{
return colorModel.getNumComponents();
}
+ /**
+ * Get the sample model specified by this image type specifier.
+ *
+ * @return the sample model
+ */
public SampleModel getSampleModel()
{
return sampleModel;
diff --git a/libjava/classpath/javax/imageio/ImageWriteParam.java b/libjava/classpath/javax/imageio/ImageWriteParam.java
index 08f4885a8d1..84b257e04eb 100644
--- a/libjava/classpath/javax/imageio/ImageWriteParam.java
+++ b/libjava/classpath/javax/imageio/ImageWriteParam.java
@@ -41,6 +41,9 @@ package javax.imageio;
import java.awt.Dimension;
import java.util.Locale;
+/**
+ * DOCUMENT ME
+ */
public class ImageWriteParam extends IIOParam
{
public static final int MODE_DISABLED = 0;
diff --git a/libjava/classpath/javax/imageio/ImageWriter.java b/libjava/classpath/javax/imageio/ImageWriter.java
index 7479c3074f7..ef352154164 100644
--- a/libjava/classpath/javax/imageio/ImageWriter.java
+++ b/libjava/classpath/javax/imageio/ImageWriter.java
@@ -1,5 +1,5 @@
/* ImageWriter.java -- Encodes raster images.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,11 +39,16 @@ exception statement from your version. */
package javax.imageio;
import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.image.Raster;
+import java.awt.image.RenderedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
import javax.imageio.event.IIOWriteProgressListener;
import javax.imageio.event.IIOWriteWarningListener;
@@ -51,56 +56,161 @@ import javax.imageio.metadata.IIOMetadata;
import javax.imageio.spi.ImageWriterSpi;
+/**
+ * A class for encoding images within the ImageIO framework.
+ *
+ * An ImageWriter for a given format is instantiated by an
+ * ImageWriterSpi for that format. ImageWriterSpis are registered
+ * with the IIORegistry.
+ *
+ * The ImageWriter API supports writing animated images that may have
+ * multiple frames; to support such images many methods take an index
+ * parameter.
+ *
+ * Images may also be written in multiple passes, where each
+ * successive pass increases the level of detail in the destination
+ * image.
+ */
public abstract class ImageWriter
implements ImageTranscoder
{
private boolean aborted;
- protected Locale[] availableLocales;
- protected Locale locale;
- protected ImageWriterSpi originatingProvider;
- protected Object output;
- protected List progressListeners = new ArrayList();
- protected List warningListeners = new ArrayList();
- protected List warningLocales = new ArrayList();
+ /**
+ * All locales available for localization of warning messages, or
+ * null if localization is not supported.
+ */
+ protected Locale[] availableLocales = null;
+ /**
+ * The current locale used to localize warning messages, or null if
+ * no locale has been set.
+ */
+ protected Locale locale = null;
+
+ /**
+ * The image writer SPI that instantiated this writer.
+ */
+ protected ImageWriterSpi originatingProvider = null;
+
+ /**
+ * An ImageInputStream to which image data is written.
+ */
+ protected Object output = null;
+
+ /**
+ * A list of installed progress listeners. Initially null, meaning
+ * no installed listeners.
+ */
+ protected List progressListeners = null;
+
+ /**
+ * A list of installed warning listeners. Initially null, meaning
+ * no installed listeners.
+ */
+ protected List warningListeners = null;
+
+ /**
+ * A list of warning locales corresponding with the list of
+ * installed warning listeners. Initially null, meaning no locales.
+ */
+ protected List warningLocales = null;
+
+ /**
+ * Construct an image writer.
+ *
+ * @param originatingProvider the provider that is constructing this
+ * image writer, or null
+ */
protected ImageWriter(ImageWriterSpi originatingProvider)
{
this.originatingProvider = originatingProvider;
}
+ /**
+ * Throw an IllegalStateException if output is null.
+ *
+ * @exception IllegalStateException if output is null
+ */
private void checkOutputSet()
{
if (output == null)
throw new IllegalStateException("no output set");
}
+ /**
+ * Request that writing be aborted. The unwritten portions of the
+ * destination image will be undefined.
+ *
+ * Writers should clear the abort flag before starting a write
+ * operation, then poll it periodically during the write operation.
+ */
public void abort()
{
aborted = true;
}
+ /**
+ * Check if the abort flag is set.
+ *
+ * @return true if the current write operation should be aborted,
+ * false otherwise
+ */
protected boolean abortRequested()
{
return aborted;
}
+ /**
+ * Install a write progress listener. This method will return
+ * immediately if listener is null.
+ *
+ * @param listener a write progress listener or null
+ */
public void addIIOWriteProgressListener(IIOWriteProgressListener listener)
{
if (listener == null)
return;
-
+ if (progressListeners == null)
+ progressListeners = new ArrayList ();
progressListeners.add(listener);
}
-
+
+ /**
+ * Install a write warning listener. This method will return
+ * immediately if listener is null. Warning messages sent to this
+ * listener will be localized using the current locale. If the
+ * current locale is null then this writer will select a sensible
+ * default.
+ *
+ * @param listener a write warning listener
+ */
public void addIIOWriteWarningListener (IIOWriteWarningListener listener)
{
if (listener == null)
return;
-
+ if (warningListeners == null)
+ warningListeners = new ArrayList ();
warningListeners.add(listener);
}
+ /**
+ * Check whether a new empty image can be inserted at the given
+ * frame index. Pixel values may be filled in later using the
+ * replacePixels methods. Indices greater than the insertion index
+ * will be incremented. If imageIndex is -1, the image will be
+ * appended at the end of the current image list.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if an empty image can be inserted at imageIndex,
+ * false otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canInsertEmpty(int imageIndex)
throws IOException
{
@@ -108,6 +218,22 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether an image can be inserted at the given frame index.
+ * Indices greater than the insertion index will be incremented. If
+ * imageIndex is -1, the image will be appended at the end of the
+ * current image list.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if an image can be inserted at imageIndex, false
+ * otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canInsertImage(int imageIndex)
throws IOException
{
@@ -115,6 +241,20 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether an image can be removed from the given frame index.
+ * Indices greater than the removal index will be decremented.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if an image can be removed from imageIndex, false
+ * otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canRemoveImage(int imageIndex)
throws IOException
{
@@ -122,6 +262,20 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether the metadata associated the image at the given
+ * frame index can be replaced.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if the metadata associated with the image at
+ * imageIndex can be replaced, false otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canReplaceImageMetadata(int imageIndex)
throws IOException
{
@@ -129,6 +283,20 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether the pixels within the image at the given index can
+ * be replaced.
+ *
+ * @param imageIndex the frame index
+ *
+ * @return true if the pixels in the image at imageIndex can be
+ * replaced, false otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
public boolean canReplacePixels(int imageIndex)
throws IOException
{
@@ -136,6 +304,16 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether the metadata associated the entire image stream can
+ * be replaced.
+ *
+ * @return true if the stream metadata can be replaced, false
+ * otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IOException if a write error occurs
+ */
public boolean canReplaceStreamMetadata()
throws IOException
{
@@ -143,6 +321,18 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check whether an entire empty image, including empty metadata and
+ * empty thumbnails, can be written to the output stream, leaving
+ * pixel values to be filled in later using the replacePixels
+ * methods.
+ *
+ * @return true if an entire empty image can be written before its
+ * contents are filled in, false otherwise
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IOException if a write error occurs
+ */
public boolean canWriteEmpty()
throws IOException
{
@@ -150,68 +340,217 @@ public abstract class ImageWriter
return false;
}
+ /**
+ * Check if IIOImages containing raster data are supported.
+ *
+ * @return true if raster IIOImages are supported, false otherwise
+ */
public boolean canWriteRasters()
{
return false;
}
+ /**
+ * Check if an image can be appended at the end of the current list
+ * of images even if prior images have already been written.
+ *
+ * @return true if sequences of images can be written, false
+ * otherwise
+ */
public boolean canWriteSequence()
{
return false;
}
+ /**
+ * Clear the abort flag.
+ */
protected void clearAbortRequest()
{
aborted = false;
}
-
+
+ /**
+ * Convert IIOMetadata from an input reader format, returning an
+ * IIOMetadata suitable for use by an image writer.
+ *
+ * The ImageTypeSpecifier specifies the destination image type.
+ *
+ * An optional ImageWriteParam argument is available in case the
+ * image writing parameters affect the metadata conversion.
+ *
+ * @param inData the metadata coming from an image reader
+ * @param imageType the output image type of the writer
+ * @param param the image writing parameters or null
+ *
+ * @return the converted metadata that should be used by the image
+ * writer, or null if this ImageTranscoder has no knowledge of the
+ * input metadata
+ *
+ * @exception IllegalArgumentException if either inData or imageType
+ * is null
+ */
public abstract IIOMetadata convertImageMetadata (IIOMetadata inData,
ImageTypeSpecifier imageType,
ImageWriteParam param);
+ /**
+ * Convert IIOMetadata from an input stream format, returning an
+ * IIOMetadata suitable for use by an image writer.
+ *
+ * An optional ImageWriteParam argument is available in case the
+ * image writing parameters affect the metadata conversion.
+ *
+ * @param inData the metadata coming from an input image stream
+ * @param param the image writing parameters or null
+ *
+ * @return the converted metadata that should be used by the image
+ * writer, or null if this ImageTranscoder has no knowledge of the
+ * input metadata
+ *
+ * @exception IllegalArgumentException if inData is null
+ */
public abstract IIOMetadata convertStreamMetadata (IIOMetadata inData,
ImageWriteParam param);
+ /**
+ * Releases any resources allocated to this object. Subsequent
+ * calls to methods on this object will produce undefined results.
+ *
+ * The default implementation does nothing; subclasses should use
+ * this method ensure that native resources are released.
+ */
public void dispose()
{
// The default implementation is empty. Subclasses have to overwrite it.
}
+ /**
+ * Retrieve the available locales. Return null if no locales are
+ * available or a clone of availableLocales.
+ *
+ * @return an array of locales or null
+ */
public Locale[] getAvailableLocales()
{
return availableLocales;
}
+ /**
+ * Get a metadata object appropriate for encoding an image specified
+ * by the given image type specifier and optional image write
+ * parameters.
+ *
+ * @param imageType an image type specifier
+ * @param param image writing parameters, or null
+ *
+ * @return a metadata object appropriate for encoding an image of
+ * the given type with the given parameters
+ */
public abstract IIOMetadata getDefaultImageMetadata (ImageTypeSpecifier imageType, ImageWriteParam param);
+ /**
+ * Get a metadata object appropriate for encoding the default image
+ * type handled by this writer, optionally considering image write
+ * parameters.
+ *
+ * @param param image writing parameters, or null
+ *
+ * @return a metadata object appropriate for encoding an image of
+ * the default type with the given parameters
+ */
public abstract IIOMetadata getDefaultStreamMetadata (ImageWriteParam param);
+ /**
+ * Retrieve the default write parameters for this writer's image
+ * format.
+ *
+ * The default implementation returns new ImageWriteParam().
+ *
+ * @return image writing parameters
+ */
public ImageWriteParam getDefaultWriteParam()
{
return new ImageWriteParam(getLocale());
}
+ /**
+ * Get this writer's locale. null is returned if the locale has not
+ * been set.
+ *
+ * @return this writer's locale, or null
+ */
public Locale getLocale()
{
return locale;
}
- public int getNumThumbnailsSupported (ImageTypeSpecifier imageType, ImageWriteParam param,
- IIOMetadata streamMetadata, IIOMetadata imageMetadata)
+ /**
+ * Get the number of thumbnails supported by this image writer,
+ * based on the given image type, image writing parameters, and
+ * stream and image metadata. The image writing parameters are
+ * optional, in case they affect the number of thumbnails supported.
+ *
+ * @param imageType an image type specifier, or null
+ * @param param image writing parameters, or null
+ * @param streamMetadata the metadata associated with this stream,
+ * or null
+ * @param imageMetadata the metadata associated with this image, or
+ * null
+ *
+ * @return the number of thumbnails that this writer supports
+ * writing or -1 if the given information is insufficient
+ */
+ public int getNumThumbnailsSupported (ImageTypeSpecifier imageType,
+ ImageWriteParam param,
+ IIOMetadata streamMetadata,
+ IIOMetadata imageMetadata)
{
return 0;
}
+ /**
+ * Get the ImageWriterSpi that created this writer or null.
+ *
+ * @return an ImageWriterSpi, or null
+ */
public ImageWriterSpi getOriginatingProvider()
{
return originatingProvider;
}
+ /**
+ * Get this reader's image output destination. null is returned if
+ * the image destination has not been set.
+ *
+ * @return an image output destination object, or null
+ */
public Object getOutput()
{
return output;
}
+ /**
+ * Get the preferred sizes for thumbnails based on the given image
+ * type, image writing parameters, and stream and image metadata.
+ * The preferred sizes are returned in pairs of dimension values;
+ * the first value in the array is a dimension object representing
+ * the minimum thumbnail size, the second value is a dimension
+ * object representing a maximum thumbnail size. The writer can
+ * select a size within the range given by each pair, or it can
+ * ignore these size hints.
+ *
+ * @param imageType an image type specifier, or null
+ * @param param image writing parameters, or null
+ * @param streamMetadata the metadata associated with this stream,
+ * or null
+ * @param imageMetadata the metadata associated with this image, or
+ * null
+ *
+ * @return an array of dimension pairs whose length is a multiple of
+ * 2, or null if there is no preferred size (any size is allowed) or
+ * if the size is unknown (insufficient information was provided)
+ */
public Dimension[] getPreferredThumbnailSizes (ImageTypeSpecifier imageType,
ImageWriteParam param,
IIOMetadata streamMetadata,
@@ -220,120 +559,305 @@ public abstract class ImageWriter
return null;
}
+ /**
+ * Notifies all installed write progress listeners that image
+ * loading has completed by calling their imageComplete methods.
+ */
protected void processImageComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.imageComplete(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.imageComplete(this);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners that a certain
+ * percentage of the image has been loaded, by calling their
+ * imageProgress methods.
+ *
+ * @param percentageDone the percentage of image data that has been
+ * loaded
+ */
protected void processImageProgress(float percentageDone)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.imageProgress(this, percentageDone);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.imageProgress(this, percentageDone);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners, by calling their
+ * imageStarted methods, that image loading has started on the given
+ * image.
+ *
+ * @param imageIndex the frame index of the image that has started
+ * loading
+ */
protected void processImageStarted(int imageIndex)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.imageStarted(this, imageIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.imageStarted(this, imageIndex);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners, by calling their
+ * thumbnailComplete methods, that a thumbnail has completed
+ * loading.
+ */
protected void processThumbnailComplete()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.thumbnailComplete(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.thumbnailComplete(this);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners that a certain
+ * percentage of a thumbnail has been loaded, by calling their
+ * thumbnailProgress methods.
+ *
+ * @param percentageDone the percentage of thumbnail data that has
+ * been loaded
+ */
protected void processThumbnailProgress(float percentageDone)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.thumbnailProgress(this, percentageDone);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.thumbnailProgress(this, percentageDone);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners, by calling their
+ * imageStarted methods, that thumbnail loading has started on the
+ * given thumbnail of the given image.
+ *
+ * @param imageIndex the frame index of the image one of who's
+ * thumbnails has started loading
+ * @param thumbnailIndex the index of the thumbnail that has started
+ * loading
+ */
protected void processThumbnailStarted(int imageIndex, int thumbnailIndex)
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
+ }
}
}
+ /**
+ * Notifies all installed warning listeners, by calling their
+ * warningOccurred methods, that a warning message has been raised.
+ *
+ * @param imageIndex the index of the image that was being written
+ * when the warning was raised
+ * @param warning the warning message
+ *
+ * @exception IllegalArgumentException if warning is null
+ */
protected void processWarningOccurred(int imageIndex, String warning)
{
- Iterator it = warningListeners.iterator();
+ if (warningListeners != null)
+ {
+ Iterator it = warningListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteWarningListener listener =
+ (IIOWriteWarningListener) it.next();
+ listener.warningOccurred(this, imageIndex, warning);
+ }
+ }
+ }
+
+ /**
+ * Notify all installed warning listeners, by calling their
+ * warningOccurred methods, that a warning message has been raised.
+ * The warning message is retrieved from a resource bundle, using
+ * the given basename and keyword.
+ *
+ * @param imageIndex the index of the image that was being written
+ * when the warning was raised
+ * @param baseName the basename of the resource from which to
+ * retrieve the warning message
+ * @param keyword the keyword used to retrieve the warning from the
+ * resource bundle
+ *
+ * @exception IllegalArgumentException if either baseName or keyword
+ * is null
+ * @exception IllegalArgumentException if no resource bundle is
+ * found using baseName
+ * @exception IllegalArgumentException if the given keyword produces
+ * no results from the resource bundle
+ * @exception IllegalArgumentException if the retrieved object is
+ * not a String
+ */
+ protected void processWarningOccurred(int imageIndex,
+ String baseName,
+ String keyword)
+ {
+ if (baseName == null || keyword == null)
+ throw new IllegalArgumentException ("null argument");
+
+ ResourceBundle b = null;
- while (it.hasNext())
+ try
{
- IIOWriteWarningListener listener = (IIOWriteWarningListener) it.next();
- listener.warningOccurred(this, imageIndex, warning);
+ b = ResourceBundle.getBundle(baseName, getLocale());
+ }
+ catch (MissingResourceException e)
+ {
+ throw new IllegalArgumentException ("no resource bundle found");
+ }
+
+ Object str = null;
+
+ try
+ {
+ str = b.getObject(keyword);
+ }
+ catch (MissingResourceException e)
+ {
+ throw new IllegalArgumentException ("no results found for keyword");
+ }
+
+ if (! (str instanceof String))
+ throw new IllegalArgumentException ("retrieved object not a String");
+
+ String warning = (String) str;
+
+ if (warningListeners != null)
+ {
+ Iterator it = warningListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteWarningListener listener =
+ (IIOWriteWarningListener) it.next();
+ listener.warningOccurred(this, imageIndex, warning);
+ }
}
}
+ /**
+ * Notifies all installed write progress listeners that image
+ * loading has been aborted by calling their writeAborted methods.
+ */
protected void processWriteAborted()
{
- Iterator it = progressListeners.iterator();
-
- while (it.hasNext())
+ if (progressListeners != null)
{
- IIOWriteProgressListener listener = (IIOWriteProgressListener) it.next();
- listener.writeAborted(this);
+ Iterator it = progressListeners.iterator();
+
+ while (it.hasNext())
+ {
+ IIOWriteProgressListener listener =
+ (IIOWriteProgressListener) it.next();
+ listener.writeAborted(this);
+ }
}
}
+ /**
+ * Uninstall all write progress listeners.
+ */
public void removeAllIIOWriteProgressListeners()
{
- progressListeners.clear();
+ if (progressListeners != null)
+ {
+ progressListeners.clear();
+ }
}
+ /**
+ * Uninstall all write warning listeners.
+ */
public void removeAllIIOWriteWarningListeners()
{
- progressListeners.clear();
+ if (progressListeners != null)
+ {
+ progressListeners.clear();
+ }
}
-
- public void removeIIOWriteProgressListener (IIOWriteProgressListener listener)
+
+ /**
+ * Uninstall the given write progress listener.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeIIOWriteProgressListener (IIOWriteProgressListener listener)
{
if (listener == null)
return;
-
- progressListeners.remove(listener);
+ if (progressListeners != null)
+ {
+ progressListeners.remove(listener);
+ }
}
-
+ /**
+ * Uninstall the given write warning listener.
+ *
+ * @param listener the listener to remove
+ */
public void removeIIOWriteWarningListener (IIOWriteWarningListener listener)
{
if (listener == null)
return;
-
- warningListeners.remove(listener);
+ if (warningListeners != null)
+ {
+ warningListeners.remove(listener);
+ }
}
-
+ /**
+ * Reset this writer's internal state.
+ */
public void reset()
{
setOutput(null);
@@ -343,6 +867,11 @@ public abstract class ImageWriter
clearAbortRequest();
}
+ /**
+ * Set the current locale or use the default locale.
+ *
+ * @param locale the locale to set, or null
+ */
public void setLocale(Locale locale)
{
if (locale != null)
@@ -362,6 +891,18 @@ public abstract class ImageWriter
this.locale = locale;
}
+ /**
+ * Set the output destination of the given object. The output
+ * destination must be set before many methods can be called on this
+ * writer. (see all ImageWriter methods that throw
+ * IllegalStateException). If input is null then the current input
+ * source will be removed.
+ *
+ * @param input the output destination object
+ *
+ * @exception IllegalArgumentException if input is not a valid input
+ * source for this writer and is not an ImageInputStream
+ */
public void setOutput(Object output)
{
if (output != null)
@@ -385,6 +926,464 @@ public abstract class ImageWriter
this.output = output;
}
+ /**
+ * Write an image stream, including thumbnails and metadata to the
+ * output stream. The output must have been set prior to this
+ * method being called. Metadata associated with the stream may be
+ * supplied, or it can be left null. IIOImage may contain raster
+ * data if this writer supports rasters, or it will contain a
+ * rendered image. Thumbnails are resized if need be. Image
+ * writing parameters may be specified to affect writing, or may be
+ * left null.
+ *
+ * @param streamMetadata metadata associated with this stream, or
+ * null
+ * @param image an IIOImage containing image data, metadata and
+ * thumbnails to be written
+ * @param param image writing parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if image contains raster
+ * data but this writer does not support rasters
+ * @exception IllegalArgumentException if image is null
+ * @exception IOException if a write error occurs
+ */
public abstract void write (IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param)
throws IOException;
+
+ /**
+ * Complete inserting an empty image in the output stream.
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if inserting empty
+ * images is not supported
+ * @exception IllegalArgumentException if a call to
+ * prepareInsertEmpty was not called previous to this method being
+ * called (a sequence of prepareInsertEmpty calls must be terminated
+ * by a call to endInsertEmpty)
+ * @exception IllegalArgumentException if prepareWriteEmpty was
+ * called before this method being called (without a terminating
+ * call to endWriteEmpty)
+ * @exception IllegalArgumentException if prepareReplacePixels was
+ * called before this method being called (without a terminating
+ * call to endReplacePixels)
+ * @exception IOException if a write error occurs
+ */
+ public void endInsertEmpty ()
+ throws IOException
+ {
+ if (!canInsertEmpty(0))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Complete replacing pixels in an image in the output stream.
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing pixels is
+ * not supported by this writer
+ * @exception IllegalArgumentException if prepareReplacePixels was
+ * not called before this method being called
+ * @exception IOException if a write error occurs
+ */
+ public void endReplacePixels ()
+ throws IOException
+ {
+ if (!canReplacePixels(0))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Complete writing an empty image to the image output stream.
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if writing empty images
+ * is not supported
+ * @exception IllegalArgumentException if a call to
+ * prepareWriteEmpty was not called previous to this method being
+ * called (a sequence of prepareWriteEmpty calls must be terminated
+ * by a call to endWriteEmpty)
+ * @exception IllegalArgumentException if prepareInsertEmpty was
+ * called before this method being called (without a terminating
+ * call to endInsertEmpty)
+ * @exception IllegalArgumentException if prepareReplacePixels was
+ * called before this method being called (without a terminating
+ * call to endReplacePixels)
+ * @exception IOException if a write error occurs
+ */
+ public void endWriteEmpty ()
+ throws IOException
+ {
+ if (!canWriteEmpty())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Complete writing a sequence of images to the output stream. This
+ * method may patch header data and write out footer data.
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IllegalStateException if prepareWriteSequence has not
+ * been called
+ * @exception UnsupportedOperationException if writing a sequence of
+ * images is not supported
+ * @exception IOException if a write error occurs
+ */
+ public void endWriteSequence ()
+ throws IOException
+ {
+ checkOutputSet();
+ if (!canWriteSequence())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Start inserting an empty image in the image output stream. All
+ * indices after the specified index are incremented. An index of
+ * -1 implies that the empty image should be appended to the end of
+ * the current image list.
+ *
+ * The insertion that this method call starts is not complete until
+ * endInsertEmpty is called. prepareInsertEmpty cannot be called
+ * again until endInsertEmpty is called and calls to
+ * prepareWriteEmpty and prepareInsertEmpty may not be intersperced.
+ *
+ * @param imageIndex the image index
+ * @param imageType the image type specifier
+ * @param width the image width
+ * @param height the image height
+ * @param imageMetadata the image metadata, or null
+ * @param thumbnails a list of thumbnails, or null
+ * @param param image write parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if inserting empty
+ * images is not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception IllegalStateException if a previous call to
+ * prepareInsertEmpty was made (without a terminating call to
+ * endInsertEmpty)
+ * @exception IllegalStateException if a previous call to
+ * prepareWriteEmpty was made (without a terminating call to
+ * endWriteEmpty)
+ * @exception IllegalArgumentException if imageType is null or
+ * thumbnails contain non-BufferedImage objects
+ * @exception IllegalArgumentException if either width or height is
+ * less than 1
+ * @exception IOException if a write error occurs
+ */
+ public void prepareInsertEmpty (int imageIndex, ImageTypeSpecifier imageType,
+ int width, int height,
+ IIOMetadata imageMetadata,
+ List thumbnails,
+ ImageWriteParam param)
+ throws IOException
+ {
+ if (!canInsertEmpty(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Start the replacement of pixels within an image in the output
+ * stream. Output pixels will be clipped to lie within region.
+ *
+ * @param imageIndex the index of the image in which pixels are
+ * being replaced
+ * @param region the rectangle to which to limit pixel replacement
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing pixels is
+ * not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IllegalStateException if a previous call to
+ * prepareReplacePixels was made (without a terminating call to
+ * endReplacePixels)
+ * @exception IllegalArgumentException if either region.width or
+ * region.height is less than 1, or if region is null
+ * @exception IOException if a write error occurs
+ */
+ public void prepareReplacePixels (int imageIndex, Rectangle region)
+ throws IOException
+ {
+ if (canReplacePixels(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Start writing an empty image to the end of the image output
+ * stream.
+ *
+ * The writing that this method call starts is not complete until
+ * endWriteEmpty is called. prepareWritetEmpty cannot be called
+ * again until endWriteEmpty is called and calls to
+ * prepareWriteEmpty and prepareInsertEmpty may not be intersperced.
+ *
+ * @param streamMetadata metadata associated with the stream, or null
+ * @param imageType the image type specifier
+ * @param width the image width
+ * @param height the image height
+ * @param imageMetadata the image metadata, or null
+ * @param thumbnails a list of thumbnails, or null
+ * @param param image write parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if writing empty images
+ * is not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception IllegalStateException if a previous call to
+ * prepareInsertEmpty was made (without a terminating call to
+ * endInsertEmpty)
+ * @exception IllegalStateException if a previous call to
+ * prepareWriteEmpty was made (without a terminating call to
+ * endWriteEmpty)
+ * @exception IllegalArgumentException if imageType is null or
+ * thumbnails contain non-BufferedImage objects
+ * @exception IllegalArgumentException if either width or height is
+ * less than 1
+ * @exception IOException if a write error occurs
+ */
+ public void prepareWriteEmpty (IIOMetadata streamMetadata,
+ ImageTypeSpecifier imageType,
+ int width, int height,
+ IIOMetadata imageMetadata,
+ List thumbnails,
+ ImageWriteParam param)
+ throws IOException
+ {
+ if (!canWriteEmpty())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Start the writing of a sequence of images.
+ *
+ * @param streamMetadata the stream metadata, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if writing sequences of
+ * images is not supported
+ * @exception IOException if a write error occurs
+ */
+ public void prepareWriteSequence (IIOMetadata streamMetadata)
+ throws IOException
+ {
+ checkOutputSet();
+ if (!canWriteSequence())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Remove the image at the specified index from the output stream.
+ *
+ * @param imageIndex the frame index from which to remove the image
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if removing this image
+ * is not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
+ public void removeImage (int imageIndex)
+ throws IOException
+ {
+ if (!canRemoveImage(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replace the metadata associated with the image at the given
+ * index.
+ *
+ * @param imageIndex the index of the image whose metadata should be
+ * replaced
+ * @param imageMetadata the metadata, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing this
+ * image's metadata is not supported
+ * @exception IndexOutOfBoundsException if imageIndex is less than 0
+ * or greater than the last index in the current image list
+ * @exception IOException if a write error occurs
+ */
+ public void replaceImageMetadata (int imageIndex, IIOMetadata imageMetadata)
+ throws IOException
+ {
+ if (!canReplaceImageMetadata(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replace a region of an image in the output stream with a portion
+ * of the given rendered image. The image data must be of the same
+ * type as that in the output stream. The destination region is
+ * given by the image writing parameters and the source region is
+ * the one given to prepareReplacePixels.
+ *
+ * @param image the rendered image with which to overwrite the image
+ * region in the stream
+ * @param param the image writing parameters
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing pixels is
+ * not supported
+ * @exception IllegalStateException if prepareReplacePixels was not
+ * called before this method was called
+ * @exception IllegalArgumentException if image is null or if param
+ * is null or if the overlap of the source and destination regions
+ * contains no pixels or if the image types differ and no conversion
+ * is possible
+ * @exception IOException if a write error occurs
+ */
+ public void replacePixels (RenderedImage image,
+ ImageWriteParam param)
+ throws IOException
+ {
+ if (!canReplacePixels(0))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replace a region of an image in the output stream with a portion
+ * of the given raster data. The image data must be of the same
+ * type as that in the output stream. The destination region is
+ * given by the image writing parameters and the source region is
+ * the one given to prepareReplacePixels.
+ *
+ * @param raster the raster data with which to overwrite the image
+ * region in the stream
+ * @param param the image writing parameters
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing pixels is
+ * not supported
+ * @exception IllegalStateException if prepareReplacePixels was not
+ * called before this method was called
+ * @exception UnsupportedOperationException if raster data is not
+ * supported
+ * @exception IllegalArgumentException if raster is null or if param
+ * is null or if the overlap of the source and destination regions
+ * contains no pixels or if the image types differ and no conversion
+ * is possible
+ * @exception IOException if a write error occurs
+ */
+ public void replacePixels (Raster raster, ImageWriteParam param)
+ throws IOException
+ {
+ if (!canReplacePixels(0))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Replace the metadata associated with this image stream.
+ *
+ * @param streamMetadata the stream metadata, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if replacing the stream
+ * metadata is not supported
+ * @exception IOException if a write error occurs
+ */
+ public void replaceStreamMetadata (IIOMetadata streamMetadata)
+ throws IOException
+ {
+ if (!canReplaceStreamMetadata())
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Write a rendered image to the output stream.
+ *
+ * @param image a rendered image containing image data to be written
+ *
+ * @exception IllegalStateException if output is null
+ * @exception IllegalArgumentException if image is null
+ * @exception IOException if a write error occurs
+ */
+ public void write (RenderedImage image)
+ throws IOException
+ {
+ checkOutputSet();
+ write (null, new IIOImage(image, null, null), null);
+ }
+
+ /**
+ * Write a image data, metadata and thumbnails to the output stream.
+ *
+ * @param image image data, metadata and thumbnails to be written
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if image contains raster
+ * data but this writer does not support rasters
+ * @exception IllegalArgumentException if image is null
+ * @exception IOException if a write error occurs
+ */
+ public void write (IIOImage image)
+ throws IOException
+ {
+ checkOutputSet();
+ write (null, image, null);
+ }
+
+ /**
+ * Insert an image into the output stream. Indices greater than the
+ * specified index are incremented accordingly. Specifying an index
+ * of -1 causes the image to be appended at the end of the current
+ * image list.
+ *
+ * @param imageIndex the frame index at which to insert the image
+ * @param image the image data, metadata and thumbnails to be
+ * inserted
+ * @param the image write parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if image insertion is
+ * not supported
+ * @exception IllegalArgumentException if image is null
+ * @exception IndexOutOfBoundsException if imageIndex is less than
+ * -1 or greater than the last index in the current image list
+ * @exception UnsupportedOperationException if image contains raster
+ * data but this writer does not support rasters
+ * @exception IOException if a write error occurs
+ */
+ public void writeInsert (int imageIndex, IIOImage image, ImageWriteParam param)
+ throws IOException
+ {
+ if (!canInsertImage(imageIndex))
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Write a sequence of images, including thumbnails and metadata, to
+ * the output stream. The output must have been set prior to this
+ * method being called. Metadata associated with the stream may be
+ * supplied, or it can be left null. IIOImage may contain raster
+ * data if this writer supports rasters, or it will contain a
+ * rendered image. Thumbnails are resized if need be. Image
+ * writing parameters may be specified to affect writing, or may be
+ * left null.
+ *
+ * @param streamMetadata metadata associated with this stream, or
+ * null
+ * @param image an IIOImage containing image data, metadata and
+ * thumbnails to be written
+ * @param param image writing parameters, or null
+ *
+ * @exception IllegalStateException if output is null
+ * @exception UnsupportedOperationException if writing sequences of
+ * images is not supported
+ * @exception IllegalArgumentException if image is null
+ * @exception UnsupportedOperationException if image contains raster
+ * data but this writer does not support rasters
+ * @exception IOException if a write error occurs
+ */
+ public void writeToSequence (IIOImage image, ImageWriteParam param)
+ throws IOException
+ {
+ if (!canWriteSequence())
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/libjava/classpath/javax/imageio/metadata/IIOAttr.java b/libjava/classpath/javax/imageio/metadata/IIOAttr.java
deleted file mode 100644
index 0c1d3d2ef3f..00000000000
--- a/libjava/classpath/javax/imageio/metadata/IIOAttr.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/* IIOAttr.java --
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package javax.imageio.metadata;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.TypeInfo;
-import org.w3c.dom.UserDataHandler;
-
-/**
- * Simple Attr node for metadata trees
- *
- * @author jlquinn
- */
-class IIOAttr implements Attr
-{
- String name;
- String value;
- IIOMetadataNode owner;
-
- public IIOAttr(String name, String value, IIOMetadataNode owner)
- {
- this.name = name;
- this.value = value;
- this.owner = owner;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#getName()
- */
- public String getName()
- {
- return name;
- }
-
- public TypeInfo getSchemaTypeInfo()
- {
- throw new Error("not implemented");
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#getSpecified()
- */
- public boolean getSpecified()
- {
- // I don't think there can be default attrs in metadata
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#getValue()
- */
- public String getValue()
- {
- return value;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#setValue(java.lang.String)
- */
- public void setValue(String value) throws DOMException
- {
- this.value = value;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Attr#getOwnerElement()
- */
- public Element getOwnerElement()
- {
- return owner;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNodeName()
- */
- public String getNodeName()
- {
- return name;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNodeValue()
- */
- public String getNodeValue() throws DOMException
- {
- return value;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#setNodeValue(java.lang.String)
- */
- public void setNodeValue(String nodeValue) throws DOMException
- {
- this.value = nodeValue;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNodeType()
- */
- public short getNodeType()
- {
- return ATTRIBUTE_NODE;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getParentNode()
- */
- public Node getParentNode()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getChildNodes()
- */
- public NodeList getChildNodes()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getFirstChild()
- */
- public Node getFirstChild()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getLastChild()
- */
- public Node getLastChild()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getPreviousSibling()
- */
- public Node getPreviousSibling()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNextSibling()
- */
- public Node getNextSibling()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getAttributes()
- */
- public NamedNodeMap getAttributes()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getOwnerDocument()
- */
- public Document getOwnerDocument()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
- */
- public Node insertBefore(Node newChild, Node refChild) throws DOMException
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
- */
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node)
- */
- public Node removeChild(Node oldChild) throws DOMException
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node)
- */
- public Node appendChild(Node newChild) throws DOMException
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#hasChildNodes()
- */
- public boolean hasChildNodes()
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#cloneNode(boolean)
- */
- public Node cloneNode(boolean deep)
- {
- return new IIOAttr(name, value, owner);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#normalize()
- */
- public void normalize()
- {
- }
-
- public boolean isDefaultNamespace(String namespaceURI)
- {
- throw new Error("not implemented");
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#isSupported(java.lang.String, java.lang.String)
- */
- public boolean isSupported(String feature, String version)
- {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getNamespaceURI()
- */
- public String getNamespaceURI()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getPrefix()
- */
- public String getPrefix()
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#setPrefix(java.lang.String)
- */
- public void setPrefix(String prefix) throws DOMException
- {
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#getLocalName()
- */
- public String getLocalName()
- {
- return name;
- }
-
- public Object getUserData(String key)
- {
- throw new Error("not implemented");
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.Node#hasAttributes()
- */
- public boolean hasAttributes()
- {
- return false;
- }
-
- public boolean isId()
- {
- throw new Error("not implemented");
- }
-
- public String lookupNamespaceURI(String prefix)
- {
- throw new Error("not implemented");
- }
-
- public String lookupPrefix(String namespaceURI)
- {
- throw new Error("not implemented");
- }
-
- public Object setUserData(String key, Object data, UserDataHandler handler)
- {
- throw new Error("not implemented");
- }
-
- public String getBaseURI()
- {
- throw new Error("not implemented");
- }
-
- public String getTextContent()
- {
- throw new Error("not implemented");
- }
-
- public void setTextContent(String textContent)
- {
- throw new Error("not implemented");
- }
-
- public short compareDocumentPosition(Node other)
- throws DOMException
- {
- throw new Error("not implemented");
- }
-
- public Object getFeature(String feature, String version)
- {
- throw new Error("not implemented");
- }
-
- public boolean isEqualNode(Node other)
- {
- throw new Error("not implemented");
- }
-
- public boolean isSameNode(Node other)
- {
- throw new Error("not implemented");
- }
-}
diff --git a/libjava/classpath/javax/imageio/metadata/IIOMetadata.java b/libjava/classpath/javax/imageio/metadata/IIOMetadata.java
index d727e1d1e51..e5105de2caf 100644
--- a/libjava/classpath/javax/imageio/metadata/IIOMetadata.java
+++ b/libjava/classpath/javax/imageio/metadata/IIOMetadata.java
@@ -38,8 +38,41 @@ exception statement from your version. */
package javax.imageio.metadata;
+import org.w3c.dom.Node;
+
/**
+ * Represents metadata that describe an image or an image stream.
+ * Each ImageIO plugin will represent image data using an opaque
+ * object but all such objects should expose their internal
+ * information as a tree of IIOMetadataNodes.
+ *
+ * There are three formats of metadata that a plugin can support:
+ *
+ * <ul>
+ * <li>a "native" format</li>
+ * <li>a custom format</li>
+ * <li>a standard plugin-neutral format</li>
+ * </ul>
+ *
+ * If a plugin supports more than one format of metadata, the other
+ * formats can be retrieved by calling getMetadataFormatNames.
+ *
+ * The native format is used to transfer metadata from one image to
+ * another image of the same type, losslessly.
+ *
+ * The custom format describes the image metadata and exposes a tree
+ * of IIOMetadataNodes but its internal representation is specific to
+ * this plugin.
+ *
+ * The plugin-neutral format uses a generic tree structure as its
+ * internal representation.
+ *
+ * ImageTranscoders may be used to convert metadata understood by one
+ * plugin to metadata understood by another, however the conversion
+ * may be lossy.
+ *
* @author Michael Koch (konqueror@gmx.de)
+ * @author Thomas Fitzsimmons (fitzsim@redhat.com)
*/
public abstract class IIOMetadata
{
@@ -52,7 +85,7 @@ public abstract class IIOMetadata
protected boolean standardFormatSupported;
/**
- * Creates a <code>IIOMetaData</code> object.
+ * Construct an IIOMetadata object.
*/
protected IIOMetadata()
{
@@ -60,7 +93,7 @@ public abstract class IIOMetadata
}
/**
- * Creates a <code>IIOMetaData</code> object with the given arguments.
+ * Construct an IIOMetadata object.
*
* @param standardMetadataFormatSupported
* @param nativeMetadataFormatName
@@ -210,4 +243,81 @@ public abstract class IIOMetadata
{
this.controller = controller;
}
+
+ public abstract Node getAsTree (String formatName);
+
+ protected IIOMetadataNode getStandardChromaNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardCompressionNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardDataNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardDimensionNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardDocumentNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardTextNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardTileNode ()
+ {
+ return null;
+ }
+
+ protected IIOMetadataNode getStandardTransparencyNode ()
+ {
+ return null;
+ }
+
+ private void appendChild (IIOMetadataNode node,
+ IIOMetadataNode child)
+ {
+ if (child != null)
+ node.appendChild(child);
+ }
+
+ protected final IIOMetadataNode getStandardTree ()
+ {
+ IIOMetadataNode node = new IIOMetadataNode();
+
+ appendChild (node, getStandardChromaNode());
+ appendChild (node, getStandardCompressionNode());
+ appendChild (node, getStandardDataNode());
+ appendChild (node, getStandardDimensionNode());
+ appendChild (node, getStandardDocumentNode());
+ appendChild (node, getStandardTextNode());
+ appendChild (node, getStandardTileNode());
+ appendChild (node, getStandardTransparencyNode());
+
+ return node;
+ }
+
+ public abstract void mergeTree (String formatName,
+ Node root)
+ throws IIOInvalidTreeException;
+
+ public void setFromTree (String formatName, Node root)
+ throws IIOInvalidTreeException
+ {
+ reset();
+
+ mergeTree (formatName, root);
+ }
}
diff --git a/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java b/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java
index 2ce8f9c3d4b..aad30447c2f 100644
--- a/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java
+++ b/libjava/classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java
@@ -38,6 +38,848 @@ exception statement from your version. */
package javax.imageio.metadata;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
+import org.w3c.dom.UserDataHandler;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+import javax.imageio.ImageTypeSpecifier;
+
public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat
{
+ /**
+ * The standard metadata format name constant set to
+ * "javax_imageio_1.0".
+ */
+ public static final String standardMetadataFormatName = "javax_imageio_1.0";
+
+ private String rootName;
+
+ // These maps assume that each element name is unique.
+
+ private Map nodes = new HashMap();
+
+ // A mapping from element name to child policy.
+ private Map childPolicies = new HashMap();
+
+ // A mapping from element name to the permissible number of
+ // children. Values in this map are length-two integer arrays; the
+ // first index is the minimum bound, the second index is the maximum
+ // bound.
+ private Map childRanges = new HashMap();
+
+ private String resourceBaseName;
+
+ // Package-private so that it may be used in IIOMetadataNode.
+ static class IIOMetadataNodeAttr extends IIOMetadataNode
+ implements Attr
+ {
+ protected Element owner;
+ protected String name;
+ protected int dataType;
+ protected boolean required;
+ protected String defaultValue;
+
+ public IIOMetadataNodeAttr (Element owner,
+ String name,
+ String defaultValue)
+ {
+ this (owner, name, IIOMetadataFormat.DATATYPE_STRING,
+ true, defaultValue);
+ }
+
+ public IIOMetadataNodeAttr (Element owner,
+ String name,
+ int dataType,
+ boolean required,
+ String defaultValue)
+ {
+ this.owner = owner;
+ this.name = name;
+ this.dataType = dataType;
+ this.required = required;
+ this.defaultValue = defaultValue;
+ }
+
+ public String getName ()
+ {
+ return name;
+ }
+
+ public Element getOwnerElement ()
+ {
+ return owner;
+ }
+
+ public int getDataType ()
+ {
+ return dataType;
+ }
+
+ public TypeInfo getSchemaTypeInfo ()
+ {
+ return null;
+ }
+
+ public boolean getSpecified ()
+ {
+ return false;
+ }
+
+ public String getValue ()
+ {
+ return defaultValue;
+ }
+
+ public boolean isId()
+ {
+ return false;
+ }
+
+ public void setValue (String value)
+ {
+ }
+
+ // new methods
+
+ public boolean isRequired ()
+ {
+ return required;
+ }
+ }
+
+ private class IIOMetadataNodeAttrEnumerated extends IIOMetadataNodeAttr
+ {
+ protected List enumeratedValues;
+
+ public IIOMetadataNodeAttrEnumerated (Element owner,
+ String name,
+ int dataType,
+ boolean required,
+ String defaultValue,
+ List enumeratedValues)
+ {
+ super (owner, name, dataType, required, defaultValue);
+ this.enumeratedValues = new ArrayList (enumeratedValues);
+ }
+
+ public Object[] getEnumerations ()
+ {
+ return enumeratedValues.toArray ();
+ }
+ }
+
+ private class IIOMetadataNodeAttrBounded extends IIOMetadataNodeAttr
+ {
+ protected String minValue;
+ protected String maxValue;
+ protected boolean minInclusive;
+ protected boolean maxInclusive;
+
+ public IIOMetadataNodeAttrBounded (Element owner,
+ String name,
+ int dataType,
+ boolean required,
+ String defaultValue,
+ String minValue,
+ String maxValue,
+ boolean minInclusive,
+ boolean maxInclusive)
+ {
+ super (owner, name, dataType, required, defaultValue);
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ this.minInclusive = minInclusive;
+ this.maxInclusive = maxInclusive;
+ }
+
+ public String getMinValue ()
+ {
+ return minValue;
+ }
+
+ public String getMaxValue ()
+ {
+ return maxValue;
+ }
+ }
+
+ private class IIOMetadataNodeAttrList extends IIOMetadataNodeAttr
+ {
+ protected int listMinLength;
+ protected int listMaxLength;
+
+ public IIOMetadataNodeAttrList (Element owner,
+ String name,
+ int dataType,
+ boolean required,
+ int listMinLength,
+ int listMaxLength)
+ {
+ super (owner, name, dataType, required, null);
+ this.listMinLength = listMinLength;
+ this.listMaxLength = listMaxLength;
+ }
+
+ public int getListMinLength ()
+ {
+ return listMinLength;
+ }
+
+ public int getListMaxLength ()
+ {
+ return listMaxLength;
+ }
+ }
+
+ private class NodeObject
+ {
+ protected Element owner;
+ protected Class classType;
+ protected boolean required;
+ protected Object defaultValue;
+ protected int valueType;
+
+ public NodeObject (Element owner,
+ Class classType,
+ boolean required,
+ Object defaultValue)
+ {
+ this.owner = owner;
+ this.classType = classType;
+ this.required = required;
+ this.defaultValue = defaultValue;
+ valueType = IIOMetadataFormat.VALUE_ARBITRARY;
+ }
+
+ public int getValueType ()
+ {
+ return valueType;
+ }
+
+ public Class getClassType ()
+ {
+ return classType;
+ }
+
+ public Element getOwnerElement ()
+ {
+ return owner;
+ }
+
+ public Object getDefaultValue ()
+ {
+ return defaultValue;
+ }
+
+ public boolean isRequired ()
+ {
+ return required;
+ }
+ }
+
+ private class NodeObjectEnumerated extends NodeObject
+ {
+ protected List enumeratedValues;
+
+ public NodeObjectEnumerated (Element owner,
+ Class classType,
+ boolean required,
+ Object defaultValue,
+ List enumeratedValues)
+ {
+ super (owner, classType, false, defaultValue);
+ this.enumeratedValues = enumeratedValues;
+ valueType = IIOMetadataFormat.VALUE_ENUMERATION;
+ }
+
+ public Object[] getEnumerations ()
+ {
+ return enumeratedValues.toArray();
+ }
+ }
+
+ private class NodeObjectBounded extends NodeObject
+ {
+ protected Comparable minValue;
+ protected Comparable maxValue;
+ protected boolean minInclusive;
+ protected boolean maxInclusive;
+
+ public NodeObjectBounded (Element owner,
+ Class classType,
+ Object defaultValue,
+ Comparable minValue,
+ Comparable maxValue,
+ boolean minInclusive,
+ boolean maxInclusive)
+ {
+ super (owner, classType, false, defaultValue);
+ this.minValue = minValue;
+ this.maxValue = maxValue;
+ this.minInclusive = minInclusive;
+ this.maxInclusive = maxInclusive;
+ if (minInclusive)
+ {
+ if (maxInclusive)
+ valueType = IIOMetadataFormat.VALUE_RANGE_MIN_MAX_INCLUSIVE;
+ else
+ valueType = IIOMetadataFormat.VALUE_RANGE_MIN_INCLUSIVE;
+ }
+ else
+ {
+ if (maxInclusive)
+ valueType = IIOMetadataFormat.VALUE_RANGE_MAX_INCLUSIVE;
+ else
+ valueType = IIOMetadataFormat.VALUE_RANGE;
+ }
+ }
+
+ public Comparable getMinValue ()
+ {
+ return minValue;
+ }
+
+ public Comparable getMaxValue ()
+ {
+ return maxValue;
+ }
+ }
+
+ private class NodeObjectArray extends NodeObject
+ {
+ protected Integer arrayMinLength;
+ protected Integer arrayMaxLength;
+
+ public NodeObjectArray (Element owner,
+ Class classType,
+ int arrayMinLength,
+ int arrayMaxLength)
+ {
+ super (owner, classType, false, null);
+ this.arrayMinLength = new Integer (arrayMinLength);
+ this.arrayMaxLength = new Integer (arrayMaxLength);
+ valueType = IIOMetadataFormat.VALUE_LIST;
+ }
+
+ public Comparable getArrayMinLength ()
+ {
+ return arrayMinLength;
+ }
+
+ public Comparable getArrayMaxLength ()
+ {
+ return arrayMaxLength;
+ }
+ }
+
+ /**
+ * Construct a blank IIOMetadataFormatImpl with the given root name
+ * and child policy.
+ *
+ * @param rootName the root element name
+ * @param childPolicy the child policy of the root element
+ *
+ * @exception IllegalArgumentException if rootName is null
+ * @exception IllegalArgumentException if childPolicy is
+ * CHILD_POLICY_REPEAT or if childPolicy is not a CHILD_POLICY
+ * constant
+ */
+ public IIOMetadataFormatImpl (String rootName, int childPolicy)
+ {
+ if (rootName == null)
+ throw new IllegalArgumentException ("null argument");
+
+ if (childPolicy < IIOMetadataFormat.CHILD_POLICY_ALL
+ || childPolicy > IIOMetadataFormat.CHILD_POLICY_SOME
+ || childPolicy == IIOMetadataFormat.CHILD_POLICY_REPEAT)
+ throw new IllegalArgumentException ("wrong child policy");
+
+ nodes.put (rootName, new IIOMetadataNode (rootName));
+ childPolicies.put (rootName, new Integer (childPolicy));
+ this.rootName = rootName;
+ }
+
+ /**
+ * Construct a blank IIOMetadataFormatImpl with the given root name,
+ * a child policy of CHILD_POLICY_REPEAT and the given minimum and
+ * maximum limits on the number of root element children.
+ *
+ * @param rootName the root element name
+ * @param minChildren the minimum number of children that this node
+ * can have
+ * @param maxChildren the maximum number of children that this node
+ * can have
+ *
+ * @exception IllegalArgumentException if rootName is null
+ * @exception IllegalArgumentException if minChildren is less than
+ * zero or greater than maxChildren
+ */
+ public IIOMetadataFormatImpl (String rootName,
+ int minChildren,
+ int maxChildren)
+ {
+ if (rootName == null)
+ throw new IllegalArgumentException ("null argument");
+
+ if (minChildren < 0 || maxChildren < minChildren)
+ throw new IllegalArgumentException ("invalid min or max children argument");
+
+ nodes.put (rootName, new IIOMetadataNode (rootName));
+ childPolicies.put (rootName, new Integer (IIOMetadataFormat.CHILD_POLICY_REPEAT));
+ childRanges.put (rootName, new int [] { minChildren, maxChildren });
+ this.rootName = rootName;
+ }
+
+ protected void addAttribute (String elementName,
+ String attrName,
+ int dataType,
+ boolean required,
+ String defaultValue)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.setAttributeNode (new IIOMetadataNodeAttr (node,
+ attrName,
+ dataType,
+ required,
+ defaultValue));
+ }
+
+ protected void addAttribute (String elementName,
+ String attrName,
+ int dataType,
+ boolean required,
+ String defaultValue,
+ List enumeratedValues)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.setAttributeNode (new IIOMetadataNodeAttrEnumerated (node,
+ attrName,
+ dataType,
+ required,
+ defaultValue,
+ enumeratedValues));
+ }
+
+ protected void addAttribute (String elementName,
+ String attrName,
+ int dataType,
+ boolean required,
+ String defaultValue,
+ String minValue,
+ String maxValue,
+ boolean minInclusive,
+ boolean maxInclusive)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.setAttributeNode (new IIOMetadataNodeAttrBounded (node,
+ attrName,
+ dataType,
+ required,
+ defaultValue,
+ minValue,
+ maxValue,
+ minInclusive,
+ maxInclusive));
+ }
+
+ protected void addAttribute (String elementName,
+ String attrName,
+ int dataType,
+ boolean required,
+ int listMinLength,
+ int listMaxLength)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.setAttributeNode (new IIOMetadataNodeAttrList (node,
+ attrName,
+ dataType,
+ required,
+ listMinLength,
+ listMaxLength));
+ }
+
+ protected void addBooleanAttribute (String elementName,
+ String attrName,
+ boolean hasDefaultValue,
+ boolean defaultValue)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+
+ List enumeratedValues = new ArrayList();
+ enumeratedValues.add ("TRUE");
+ enumeratedValues.add ("FALSE");
+
+ node.setAttributeNode (new IIOMetadataNodeAttrEnumerated (node,
+ attrName,
+ IIOMetadataFormat.DATATYPE_BOOLEAN,
+ hasDefaultValue,
+ defaultValue ? "TRUE" : "FALSE",
+ enumeratedValues));
+ }
+
+ protected void addChildElement (String elementName, String parentName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (parentName);
+
+ node.appendChild (new IIOMetadataNode (elementName));
+ childPolicies.put (elementName, new Integer (IIOMetadataFormat.CHILD_POLICY_REPEAT));
+ }
+
+ protected void addElement (String elementName, String parentName, int childPolicy)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (parentName);
+
+ node.appendChild (new IIOMetadataNode (elementName));
+ childPolicies.put (elementName, new Integer (childPolicy));
+ }
+
+ protected void addElement (String elementName, String parentName,
+ int minChildren, int maxChildren)
+ {
+ addChildElement (elementName, parentName);
+ childRanges.put (elementName, new int [] { minChildren, maxChildren });
+ }
+
+ private void addNodeObject (IIOMetadataNode node, NodeObject o)
+ {
+ node.setUserObject (o);
+ }
+
+ private NodeObject getNodeObject (IIOMetadataNode node)
+ {
+ return (NodeObject) node.getUserObject ();
+ }
+
+ private void removeNodeObject (IIOMetadataNode node)
+ {
+ node.setUserObject (null);
+ }
+
+ protected void addObjectValue (String elementName, Class classType,
+ boolean required, Object defaultValue)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ addNodeObject (node, new NodeObject (node,
+ classType,
+ required,
+ defaultValue));
+ }
+
+ protected void addObjectValue (String elementName, Class classType,
+ boolean required, Object defaultValue,
+ List enumeratedValues)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ addNodeObject (node, new NodeObjectEnumerated (node,
+ classType,
+ required,
+ defaultValue,
+ enumeratedValues));
+ }
+
+ protected void addObjectValue (String elementName, Class classType,
+ Object defaultValue,
+ Comparable minValue,
+ Comparable maxValue,
+ boolean minInclusive,
+ boolean maxInclusive)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ addNodeObject (node, new NodeObjectBounded (node,
+ classType,
+ defaultValue,
+ minValue,
+ maxValue,
+ minInclusive,
+ maxInclusive));
+ }
+
+ protected void addObjectValue (String elementName, Class classType,
+ int arrayMinLength, int arrayMaxLength)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ addNodeObject (node, new NodeObjectArray (node,
+ classType,
+ arrayMinLength,
+ arrayMaxLength));
+ }
+
+ public String getRootName ()
+ {
+ return rootName;
+ }
+
+ protected String getResourceBaseName ()
+ {
+ return resourceBaseName;
+ }
+
+ public static IIOMetadataFormat getStandardFormatInstance ()
+ {
+ // FIXME: populate this with the standard metadata format
+ return new IIOMetadataFormatImpl (standardMetadataFormatName,
+ IIOMetadataFormat.CHILD_POLICY_ALL)
+ {
+ public boolean canNodeAppear (String elementName,
+ ImageTypeSpecifier specifier)
+ {
+ return true;
+ }
+ };
+ }
+
+ public abstract boolean canNodeAppear (String elementName,
+ ImageTypeSpecifier specifier);
+
+ protected void removeAttribute (String elementName,
+ String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ node.removeAttribute (attrName);
+ }
+
+ protected void removeElement (String elementName)
+ {
+ nodes.remove (elementName);
+ }
+
+ protected void removeObjectValue (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ removeNodeObject (node);
+ }
+
+ protected void setResourceBaseName (String resourceBaseName)
+ {
+ this.resourceBaseName = resourceBaseName;
+ }
+
+ public int getAttributeDataType (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr) node.getAttributeNode (attrName);
+ return attr.getDataType ();
+ }
+
+ public String getAttributeDefaultValue (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr) node.getAttributeNode (attrName);
+ return attr.getValue();
+ }
+
+ public String getAttributeDescription (String elementName, String attrName, Locale locale)
+ {
+ return getDescription (elementName + "/" + attrName, locale);
+ }
+
+ public String[] getAttributeEnumerations (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrEnumerated attr =
+ (IIOMetadataNodeAttrEnumerated) node.getAttributeNode (attrName);
+
+ Object[] attrEnums = attr.getEnumerations();
+
+ String[] attrNames = new String[attrEnums.length];
+
+ for (int i = 0; i < attrEnums.length; i++)
+ {
+ attrNames[i] = (String) attrEnums[i];
+ }
+
+ return attrNames;
+ }
+
+ public int getAttributeListMaxLength (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrList attr =
+ (IIOMetadataNodeAttrList) node.getAttributeNode (attrName);
+ return attr.getListMaxLength();
+ }
+
+ public int getAttributeListMinLength (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrList attr =
+ (IIOMetadataNodeAttrList) node.getAttributeNode (attrName);
+ return attr.getListMinLength();
+ }
+
+ public String getAttributeMaxValue (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrBounded attr =
+ (IIOMetadataNodeAttrBounded) node.getAttributeNode (attrName);
+ return attr.getMaxValue();
+ }
+
+ public String getAttributeMinValue (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttrBounded attr =
+ (IIOMetadataNodeAttrBounded) node.getAttributeNode (attrName);
+ return attr.getMinValue();
+ }
+
+ public String[] getAttributeNames (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+
+ NamedNodeMap attrNodes = node.getAttributes();
+
+ String[] attrNames = new String[attrNodes.getLength()];
+
+ for (int i = 0; i < attrNodes.getLength(); i++)
+ {
+ attrNames[i] = attrNodes.item (i).getLocalName();
+ }
+
+ return attrNames;
+ }
+
+ public int getAttributeValueType (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr) node.getAttributeNode (attrName);
+ return attr.getDataType();
+ }
+
+ public String[] getChildNames (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+
+ NodeList childNodes = node.getChildNodes();
+
+ String[] childNames = new String[childNodes.getLength()];
+
+ for (int i = 0; i < childNodes.getLength(); i++)
+ {
+ childNames[i] = childNodes.item (i).getLocalName();
+ }
+
+ return childNames;
+ }
+
+ public int getChildPolicy (String elementName)
+ {
+ return ((Integer) childPolicies.get (elementName)).intValue();
+ }
+
+ private String getDescription (String resourceName, Locale locale)
+ {
+ if (resourceBaseName == null)
+ return null;
+
+ Locale l = locale;
+
+ if (l == null)
+ l = Locale.getDefault();
+
+ ResourceBundle bundle = ResourceBundle.getBundle (resourceBaseName, locale);
+
+ String desc = null;
+
+ if (bundle == null)
+ {
+ try
+ {
+ desc = bundle.getString (resourceName);
+ }
+ catch (MissingResourceException e)
+ {
+ desc = null;
+ }
+ }
+
+ return desc;
+ }
+
+ public String getElementDescription (String elementName, Locale locale)
+ {
+ return getDescription (elementName, locale);
+ }
+
+ public int getElementMaxChildren (String elementName)
+ {
+ return ((int[]) childRanges.get (elementName))[1];
+ }
+
+ public int getElementMinChildren (String elementName)
+ {
+ return ((int[]) childRanges.get (elementName))[0];
+ }
+
+ public int getObjectArrayMaxLength (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((Integer) ((NodeObjectArray) getNodeObject (node)).getArrayMaxLength ()).intValue();
+ }
+
+ public int getObjectArrayMinLength (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((Integer) ((NodeObjectArray) getNodeObject (node)).getArrayMinLength ()).intValue();
+ }
+
+ public Class getObjectClass (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return getNodeObject (node).getClassType ();
+ }
+
+ public Object getObjectDefaultValue (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return getNodeObject (node).getDefaultValue ();
+ }
+
+ public Object[] getObjectEnumerations (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((NodeObjectEnumerated) getNodeObject (node)).getEnumerations ();
+ }
+
+ public Comparable getObjectMaxValue (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((NodeObjectBounded) getNodeObject (node)).getMaxValue ();
+ }
+
+ public Comparable getObjectMinValue (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((NodeObjectBounded) getNodeObject (node)).getMinValue ();
+ }
+
+ public int getObjectValueType (String elementName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ NodeObject n = getNodeObject (node);
+
+ if (n == null)
+ return IIOMetadataFormat.VALUE_NONE;
+ else
+ return n.getValueType ();
+ }
+
+ public boolean isAttributeRequired (String elementName, String attrName)
+ {
+ IIOMetadataNode node = (IIOMetadataNode) nodes.get (elementName);
+ return ((IIOMetadataNodeAttr) node.getAttributeNode (attrName)).isRequired();
+ }
}
diff --git a/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java b/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java
index d9e0983e94a..2d52e467078 100644
--- a/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java
+++ b/libjava/classpath/javax/imageio/metadata/IIOMetadataNode.java
@@ -52,6 +52,7 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.TypeInfo;
import org.w3c.dom.UserDataHandler;
+import javax.imageio.metadata.IIOMetadataFormatImpl.IIOMetadataNodeAttr;
public class IIOMetadataNode
implements Element, NodeList
@@ -61,7 +62,127 @@ public class IIOMetadataNode
private List children = new ArrayList();
private IIOMetadataNode parent;
private Object obj;
+
+ /**
+ * Simple NamedNodeMap class for IIOMetadataNode.
+ *
+ * @author jlquinn
+ */
+ private class IIONamedNodeMap implements NamedNodeMap
+ {
+ HashMap attrs;
+
+ /**
+ * @param attrs
+ * @param node
+ */
+ public IIONamedNodeMap(HashMap attrs)
+ {
+ this.attrs = attrs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#getNamedItem(java.lang.String)
+ */
+ public Node getNamedItem(String name)
+ {
+ return (Node)attrs.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#setNamedItem(org.w3c.dom.Node)
+ */
+ public Node setNamedItem(Node arg) throws DOMException
+ {
+ if (arg instanceof IIOMetadataNodeAttr)
+ {
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr) arg;
+ // The only code that can successfully do this is in this package.
+ if (attr.owner != null)
+ throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, "");
+ return (Node)attrs.put(attr.name, attr);
+ }
+ // Anything else gets treated as an invalid op.
+ throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "");
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#removeNamedItem(java.lang.String)
+ */
+ public Node removeNamedItem(String name) throws DOMException
+ {
+ return (Node)attrs.remove(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#item(int)
+ */
+ public Node item(int index)
+ {
+ return (Node)attrs.values().toArray()[index];
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#getLength()
+ */
+ public int getLength()
+ {
+ return attrs.size();
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#getNamedItemNS(java.lang.String, java.lang.String)
+ */
+ public Node getNamedItemNS(String namespaceURI, String localName)
+ {
+ return getNamedItem(localName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#setNamedItemNS(org.w3c.dom.Node)
+ */
+ public Node setNamedItemNS(Node arg) throws DOMException
+ {
+ return setNamedItem(arg);
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NamedNodeMap#removeNamedItemNS(java.lang.String, java.lang.String)
+ */
+ public Node removeNamedItemNS(String namespaceURI, String localName)
+ throws DOMException
+ {
+ return removeNamedItem(localName);
+ }
+ }
+
+ /**
+ * Simple NodeList implementation for IIOMetadataNode.
+ *
+ * @author jlquinn
+ *
+ */
+ private class IIONodeList implements NodeList
+ {
+ List children = new ArrayList();
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NodeList#item(int)
+ */
+ public Node item(int index)
+ {
+ return (index < children.size()) ? (Node)children.get(index) : null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.NodeList#getLength()
+ */
+ public int getLength()
+ {
+ return children.size();
+ }
+ }
+
public IIOMetadataNode()
{
// Do nothing here.
@@ -71,12 +192,12 @@ public class IIOMetadataNode
{
name = nodename;
}
-
+
public Object getUserObject()
{
return obj;
}
-
+
public void setUserObject(Object o)
{
obj = o;
@@ -85,7 +206,7 @@ public class IIOMetadataNode
public short compareDocumentPosition(Node other)
throws DOMException
{
- throw new Error("not implemented");
+ return Element.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC;
}
/* (non-Javadoc)
@@ -104,7 +225,7 @@ public class IIOMetadataNode
{
String val = getAttribute(name);
if (val != null)
- return new IIOAttr(name, val, this);
+ return new IIOMetadataNodeAttr(this, name, val);
return null;
}
@@ -126,7 +247,7 @@ public class IIOMetadataNode
public String getBaseURI()
{
- throw new Error("not implemented");
+ return null;
}
// Recursive function for assembling a node list.
@@ -217,7 +338,7 @@ public class IIOMetadataNode
if (attr != null)
attr.setValue(value);
else
- attrs.put(name, new IIOAttr(name, value, this));
+ attrs.put(name, new IIOMetadataNodeAttr(this, name, value));
}
/* (non-Javadoc)
@@ -295,7 +416,7 @@ public class IIOMetadataNode
// clone attrs
for (Iterator it = attrs.values().iterator(); it.hasNext();)
{
- IIOAttr attr = (IIOAttr)it.next();
+ IIOMetadataNodeAttr attr = (IIOMetadataNodeAttr)it.next();
newnode.attrs.put(attr.name, attr.cloneNode(deep));
attr.owner = newnode;
}
@@ -321,7 +442,7 @@ public class IIOMetadataNode
public Object getFeature(String feature, String version)
{
- throw new Error("not implemented");
+ return null;
}
/* (non-Javadoc)
@@ -432,18 +553,18 @@ public class IIOMetadataNode
public TypeInfo getSchemaTypeInfo()
{
- throw new Error("not implemented");
+ return null;
}
public String getTextContent()
throws DOMException
{
- throw new Error("not implemented");
+ return null;
}
public Object getUserData(String key)
{
- throw new Error("not implemented");
+ return null;
}
/* (non-Javadoc)
@@ -482,12 +603,12 @@ public class IIOMetadataNode
public boolean isDefaultNamespace(String namespaceURI)
{
- throw new Error("not implemented");
+ return true;
}
public boolean isEqualNode(Node arg)
{
- throw new Error("not implemented");
+ return true;
}
public boolean isSameNode(Node other)
@@ -506,12 +627,12 @@ public class IIOMetadataNode
public String lookupNamespaceURI(String prefix)
{
- throw new Error("not implemented");
+ return null;
}
public String lookupPrefix(String namespaceURI)
{
- throw new Error("not implemented");
+ return null;
}
/* (non-Javadoc)
@@ -550,19 +671,16 @@ public class IIOMetadataNode
public void setIdAttribute(String name, boolean isId)
throws DOMException
{
- throw new Error("not implemented");
}
public void setIdAttributeNode(Attr idAttr, boolean isId)
throws DOMException
{
- throw new Error("not implemented");
}
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId)
throws DOMException
{
- throw new Error("not implemented");
}
/* (non-Javadoc)
@@ -582,11 +700,10 @@ public class IIOMetadataNode
public void setTextContent(String textContent)
throws DOMException
{
- throw new Error("not implemented");
}
public Object setUserData(String key, Object data, UserDataHandler handler)
{
- throw new Error("not implemented");
+ return null;
}
}
diff --git a/libjava/classpath/javax/imageio/metadata/IIONamedNodeMap.java b/libjava/classpath/javax/imageio/metadata/IIONamedNodeMap.java
deleted file mode 100644
index 92da28d5bb2..00000000000
--- a/libjava/classpath/javax/imageio/metadata/IIONamedNodeMap.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/* IIONamedNodeMap.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package javax.imageio.metadata;
-
-import java.util.HashMap;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Simple NamedNodeMap class for IIOMetadataNode.
- *
- * @author jlquinn
- */
-class IIONamedNodeMap implements NamedNodeMap
-{
- HashMap attrs;
-
- /**
- * @param attrs
- * @param node
- */
- public IIONamedNodeMap(HashMap attrs)
- {
- this.attrs = attrs;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#getNamedItem(java.lang.String)
- */
- public Node getNamedItem(String name)
- {
- return (Node)attrs.get(name);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#setNamedItem(org.w3c.dom.Node)
- */
- public Node setNamedItem(Node arg) throws DOMException
- {
- if (arg instanceof IIOAttr)
- {
- IIOAttr attr = (IIOAttr) arg;
- // The only code that can successfully do this is in this package.
- if (attr.owner != null)
- throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, "");
- return (Node)attrs.put(attr.name, attr);
- }
- // Anything else gets treated as an invalid op.
- throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "");
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#removeNamedItem(java.lang.String)
- */
- public Node removeNamedItem(String name) throws DOMException
- {
- return (Node)attrs.remove(name);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#item(int)
- */
- public Node item(int index)
- {
- return (Node)attrs.values().toArray()[index];
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#getLength()
- */
- public int getLength()
- {
- return attrs.size();
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#getNamedItemNS(java.lang.String, java.lang.String)
- */
- public Node getNamedItemNS(String namespaceURI, String localName)
- {
- return getNamedItem(localName);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#setNamedItemNS(org.w3c.dom.Node)
- */
- public Node setNamedItemNS(Node arg) throws DOMException
- {
- return setNamedItem(arg);
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NamedNodeMap#removeNamedItemNS(java.lang.String, java.lang.String)
- */
- public Node removeNamedItemNS(String namespaceURI, String localName)
- throws DOMException
- {
- return removeNamedItem(localName);
- }
-
-}
diff --git a/libjava/classpath/javax/imageio/metadata/IIONodeList.java b/libjava/classpath/javax/imageio/metadata/IIONodeList.java
deleted file mode 100644
index 395d261b6c6..00000000000
--- a/libjava/classpath/javax/imageio/metadata/IIONodeList.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/* IIOAttr.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package javax.imageio.metadata;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Simple NodeList implementation for IIOMetadataNode.
- *
- * @author jlquinn
- *
- */
-class IIONodeList implements NodeList
-{
- List children = new ArrayList();
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NodeList#item(int)
- */
- public Node item(int index)
- {
- return (index < children.size()) ? (Node)children.get(index) : null;
- }
-
- /* (non-Javadoc)
- * @see org.w3c.dom.NodeList#getLength()
- */
- public int getLength()
- {
- return children.size();
- }
-
-}
diff --git a/libjava/classpath/javax/imageio/package.html b/libjava/classpath/javax/imageio/package.html
index ce36a7b44bd..f6a604de8fc 100644
--- a/libjava/classpath/javax/imageio/package.html
+++ b/libjava/classpath/javax/imageio/package.html
@@ -40,7 +40,48 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.imageio</title></head>
<body>
-<p></p>
-
+<p>
+This package provides image input/output APIs.
+</p>
+<p>
+The standard class library provides other ways of loading images (@see
+java.awt.Toolkit, @see java.awt.Component)) but the ImageIO package is
+more powerful.
+</p>
+<p>
+The static ImageIO class supports reading and writing images in many
+different formats along with most other basic image I/O operations.
+</p>
+<p>
+Other classes provide finer control of image-related operations;
+reading is controlled by ImageReader, ImageReadParam and
+ImageTypeSpecifyer, writing by ImageWriter and ImageWriteParam.
+ImageTranscoder allows fine-grained control over how images are
+converted between formats and IIOException reports errors. IIOImage
+describes an image file in detail including metadata and thumbnails.
+</p>
+<h2>Supported Formats</h2>
+<p>
+The default GNU Classpath ImageIO backend uses ImageMagick and so
+supports the following formats:
+<table>
+<tr>
+<th></th> <th>Read</th> <th>Write</th>
+</tr>
+<tr><td>JPEG</td><td>yes</td><td>yes</td></tr>
+<tr><td>PNG</td><td>yes</td><td>yes</td></tr>
+<tr><td>BMP</td><td>yes</td><td>yes</td></tr>
+<tr><td>WBMP</td><td>yes</td><td>yes</td></tr>
+<tr><td>GIF</td><td>yes</td><td>yes</td></tr>
+<tr><td>TIFF</td><td>yes</td><td>yes</td></tr>
+<tr><td>XPM</td><td>yes</td><td>yes</td></tr>
+<tr><td>TGA</td><td>yes</td><td>yes</td></tr>
+<tr><td>PDF</td><td>yes</td><td>no</td></tr>
+<tr><td>SVG</td><td>yes</td><td>no</td></tr>
+<table>
+</p>
+<p>
+@since 1.4
+</p>
</body>
</html>
diff --git a/libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java b/libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java
index 4aa7fd41272..40d44e3d0e2 100644
--- a/libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java
+++ b/libjava/classpath/javax/imageio/spi/ImageReaderWriterSpi.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.imageio.spi;
+import javax.imageio.metadata.IIOMetadataFormat;
+import javax.imageio.metadata.IIOMetadataFormatImpl;
/**
* An abstract superclass that contains the common parts of {@link
@@ -422,4 +424,88 @@ public abstract class ImageReaderWriterSpi
{
return extraImageMetadataFormatNames;
}
+
+ /**
+ * Returns an IIOMetadataFormat object that represents the requested
+ * stream metadata format or null if the given format is supported
+ * but no IIOMetadataFormat can be created for it.
+ *
+ * @param formatName the requested stream metadata format name
+ *
+ * @return an IIOMetadataFormat object or null
+ *
+ * @throws IllegalArgumentException if formatName is null or is not
+ * one of the standard metadata format or this provider's native or
+ * extra stream metadata formats
+ */
+ public IIOMetadataFormat getStreamMetadataFormat (String formatName)
+ {
+ if (formatName == null)
+ throw new IllegalArgumentException ("null stream metadata format name");
+
+ if (!formatName.equals (getNativeStreamMetadataFormatName())
+ && !formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ {
+ String[] extraNames = getExtraStreamMetadataFormatNames ();
+ boolean foundName = false;
+ for (int i = 0; i < extraNames.length; i++)
+ {
+ if (formatName.equals(extraNames[i]))
+ {
+ foundName = true;
+ break;
+ }
+ }
+ if (!foundName)
+ throw new IllegalArgumentException ("unsupported stream metadata format name");
+ }
+
+ if (formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ return IIOMetadataFormatImpl.getStandardFormatInstance ();
+ else
+ // Default implementation returns null.
+ return null;
+ }
+
+ /**
+ * Returns an IIOMetadataFormat object that represents the requested
+ * image metadata format or null if the given format is supported
+ * but no IIOMetadataFormat can be created for it.
+ *
+ * @param formatName the requested image metadata format name
+ *
+ * @return an IIOMetadataFormat object or null
+ *
+ * @throws IllegalArgumentException if formatName is null or is not
+ * one of the standard metadata format or this provider's native or
+ * extra image metadata formats
+ */
+ public IIOMetadataFormat getImageMetadataFormat (String formatName)
+ {
+ if (formatName == null)
+ throw new IllegalArgumentException ("null image metadata format name");
+
+ if (!formatName.equals (getNativeImageMetadataFormatName())
+ && !formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ {
+ String[] extraNames = getExtraImageMetadataFormatNames ();
+ boolean foundName = false;
+ for (int i = 0; i < extraNames.length; i++)
+ {
+ if (formatName.equals(extraNames[i]))
+ {
+ foundName = true;
+ break;
+ }
+ }
+ if (!foundName)
+ throw new IllegalArgumentException ("unsupported image metadata format name");
+ }
+
+ if (formatName.equals (IIOMetadataFormatImpl.standardMetadataFormatName))
+ return IIOMetadataFormatImpl.getStandardFormatInstance ();
+ else
+ // Default implementation returns null.
+ return null;
+ }
}
diff --git a/libjava/classpath/javax/naming/CompoundName.java b/libjava/classpath/javax/naming/CompoundName.java
index 4b30557f8d3..b23736fa723 100644
--- a/libjava/classpath/javax/naming/CompoundName.java
+++ b/libjava/classpath/javax/naming/CompoundName.java
@@ -38,6 +38,9 @@ exception statement from your version. */
package javax.naming;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.NoSuchElementException;
@@ -48,9 +51,6 @@ import java.util.Vector;
* @author Tom Tromey (tromey@redhat.com)
* @date May 16, 2001
*
- * FIXME: must write readObject and writeObject to conform to
- * serialization spec.
- *
* FIXME: this class is underspecified. For instance, the `flat'
* direction is never described. If it means that the CompoundName
* can only have a single element, then the Enumeration-based
@@ -469,6 +469,25 @@ public class CompoundName implements Name, Cloneable, Serializable
"false")).booleanValue ();
}
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ mySyntax = (Properties) s.readObject();
+ int count = s.readInt();
+ elts = new Vector(count);
+ for (int i = 0; i < count; i++)
+ elts.addElement((String) s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s)
+ throws IOException
+ {
+ s.writeObject(mySyntax);
+ s.writeInt(elts.size());
+ for (int i = 0; i < elts.size(); i++)
+ s.writeObject(elts.elementAt(i));
+ }
+
// The spec specifies this but does not document it in any way (it
// is a package-private class). It is useless as far as I can tell.
// So we ignore it.
diff --git a/libjava/classpath/javax/naming/Name.java b/libjava/classpath/javax/naming/Name.java
index f8592d9ea3d..f0475766a97 100644
--- a/libjava/classpath/javax/naming/Name.java
+++ b/libjava/classpath/javax/naming/Name.java
@@ -1,5 +1,5 @@
/* Name.java -- Name build up from different components
- Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,7 +60,7 @@ import java.util.Enumeration;
* @author Anthony Green (green@redhat.com)
* @author Mark Wielaard (mark@klomp.org)
*/
-public interface Name extends Cloneable, Serializable
+public interface Name extends Cloneable, Serializable, Comparable
{
long serialVersionUID = -3617482732056931635L;
diff --git a/libjava/classpath/javax/print/DocFlavor.java b/libjava/classpath/javax/print/DocFlavor.java
index 732823fbeb2..1e96a70c024 100644
--- a/libjava/classpath/javax/print/DocFlavor.java
+++ b/libjava/classpath/javax/print/DocFlavor.java
@@ -54,6 +54,8 @@ public class DocFlavor implements Cloneable, Serializable
public static class BYTE_ARRAY
extends DocFlavor
{
+ private static final long serialVersionUID = -9065578006593857475L;
+
public static final BYTE_ARRAY AUTOSENSE = new BYTE_ARRAY("application/octet-stream");
public static final BYTE_ARRAY GIF = new BYTE_ARRAY("image/gif");
public static final BYTE_ARRAY JPEG = new BYTE_ARRAY("image/jpeg");
@@ -103,6 +105,8 @@ public class DocFlavor implements Cloneable, Serializable
public static class INPUT_STREAM
extends DocFlavor
{
+ private static final long serialVersionUID = -7045842700749194127L;
+
public static final INPUT_STREAM AUTOSENSE = new INPUT_STREAM("application/octet-stream");
public static final INPUT_STREAM GIF = new INPUT_STREAM("image/gif");
public static final INPUT_STREAM JPEG = new INPUT_STREAM("image/jpeg");
diff --git a/libjava/classpath/javax/print/attribute/Attribute.java b/libjava/classpath/javax/print/attribute/Attribute.java
index fcaa7d84cfe..7ce0247cea1 100644
--- a/libjava/classpath/javax/print/attribute/Attribute.java
+++ b/libjava/classpath/javax/print/attribute/Attribute.java
@@ -1,5 +1,5 @@
/* Attribute.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,11 +40,27 @@ package javax.print.attribute;
import java.io.Serializable;
/**
- * @author Michael Koch
+ * Base interface of every printing attribute of the Java Print Service API.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface Attribute extends Serializable
{
+ /**
+ * Returns the category of the printing attribute which is the specific
+ * attribute class implementing this interface.
+ *
+ * @return The concrete {@link Class} instance of the attribute class.
+ */
Class getCategory ();
+ /**
+ * Returns the descriptive name of the attribute category.
+ *
+ * Implementations of the <code>Attribute</code> interfaces providing equal
+ * category values have to return equal name values.
+ *
+ * @return The name of the attribute category.
+ */
String getName ();
}
diff --git a/libjava/classpath/javax/print/attribute/AttributeSet.java b/libjava/classpath/javax/print/attribute/AttributeSet.java
index cdc7a8e4876..b4bdecad254 100644
--- a/libjava/classpath/javax/print/attribute/AttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/AttributeSet.java
@@ -1,5 +1,5 @@
/* AttributeSet.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,40 +38,159 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>AttributeSet</code> is the top-level interface for sets of printing
+ * attributes in the Java Print Service API.
+ * <p>
+ * There are no duplicate values allowed in an attribute set and there is
+ * at most one attribute object contained per category type. Based on the
+ * {@link java.util.Map} interface the values of attribute sets are objects
+ * of type {@link javax.print.attribute.Attribute} and the entries are the
+ * categories as {@link java.lang.Class} instances.
+ * </p>
+ * <p>
+ * The following specialized types of <code>AttributeSet</code> are available:
+ * <ul>
+ * <li>{@link javax.print.attribute.DocAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintRequestAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintJobAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintServiceAttributeSet}</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Attribute sets may be unmodifiable depending on the context of usage. If
+ * used as read-only attribute set modifying operations throw an
+ * {@link javax.print.attribute.UnmodifiableSetException}.
+ * </p>
+ * <p>
+ * The Java Print Service API provides implementation classes for the existing
+ * attribute set interfaces but applications may use their own implementations.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute to the set.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
-
+
+ /**
+ * Removes all attributes from this attribute set.
+ *
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
void clear ();
-
+
+ /**
+ * Checks if this attributes set contains an attribute with the given
+ * category.
+ *
+ * @param category the category to test for.
+ * @return <code>true</code> if an attribute of the category is contained
+ * in the set, <code>false</code> otherwise.
+ */
boolean containsKey (Class category);
-
+
+ /**
+ * Checks if this attribute set contains the given attribute.
+ *
+ * @param attribute the attribute to test for.
+ * @return <code>true</code> if the attribute is contained in the set,
+ * <code>false</code> otherwise.
+ */
boolean containsValue (Attribute attribute);
+ /**
+ * Tests this set for equality with the given object. <code>true</code> is
+ * returned, if the given object is also of type <code>AttributeSet</code>
+ * and the contained attributes are the same as in this set.
+ *
+ * @param obj the Object to test.
+ * @return <code>true</code> if equal, false otherwise.
+ */
boolean equals (Object obj);
-
- Attribute get (Class Category);
-
+
+ /**
+ * Returns the attribute object contained in this set for the given attribute
+ * category.
+ *
+ * @param category the category of the attribute. A <code>Class</code>
+ * instance of a class implementing the <code>Attribute</code> interface.
+ * @return The attribute for this category or <code>null</code> if no
+ * attribute is contained for the given category.
+ * @throws NullPointerException if category is null.
+ * @throws ClassCastException if category is not implementing
+ * <code>Attribute</code>.
+ */
+ Attribute get (Class category);
+
+ /**
+ * Returns the hashcode value. The hashcode value is the sum of all hashcodes
+ * of the attributes contained in this set.
+ *
+ * @return The hashcode for this attribute set.
+ */
int hashCode ();
-
+
+ /**
+ * Checks if the attribute set is empty.
+ *
+ * @return <code>true</code> if the attribute set is empty, false otherwise.
+ */
boolean isEmpty ();
+ /**
+ * Removes the given attribute from the set. If the given attribute is <code>null</code>
+ * nothing is done and <code>false</code> is returned.
+ *
+ * @param attribute the attribute to remove.
+ * @return <code>true</code> if removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
boolean remove (Attribute attribute);
-
+
+ /**
+ * Removes the attribute entry of the given category from the set. If the given
+ * category is <code>null</code> nothing is done and <code>false</code> is returned.
+ *
+ * @param category the category of the entry to be removed.
+ * @return <code>true</code> if an attribute is removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
boolean remove (Class category);
-
+
+ /**
+ * Returns the number of elements in this attribute set.
+ *
+ * @return The number of elements.
+ */
int size ();
-
+
+ /**
+ * Returns the content of the attribute set as an array
+ *
+ * @return An array of attributes.
+ */
Attribute[] toArray ();
}
diff --git a/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java b/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
index 6f0ffc10d7f..5d97c66f21a 100644
--- a/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
+++ b/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
@@ -39,12 +39,41 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>AttributeSetUtilities</code> provides static methods for working
+ * with <code>AttributeSet</code>s.
+ * <p>
+ * For every type of an attribute set available in the Java Print Service API
+ * are methods provided to get an unmodifiable view of an attribute set.
+ * This unmodifiable view provides a read-only version of the attribute
+ * set which throws {@link javax.print.attribute.UnmodifiableSetException}s
+ * if state changing methods are invoked.
+ * </p>
+ * <p>
+ * Methods for getting a synchronized view of an attribute set are also
+ * available. This view provides synchronized (thread safe) access to the
+ * underlying wrapped attribute set.
+ * </P>
+ * <p>
+ * Three static methods for the implementation of own AttributeSets
+ * are provided, which verify that:
+ * <ul>
+ * <li>the given object is an attribute of the given interface.</li>
+ * <li>the category of given attribute is equals to a given category.</li>
+ * <li>the given object is a <code>Class</code> that implements the given
+ * interface name.</li>
+ * </ul>
+ *
+ */
public final class AttributeSetUtilities
{
/**
* This class isn't intended to be instantiated.
*/
- private AttributeSetUtilities() {}
+ private AttributeSetUtilities()
+ {
+ // only static methods
+ }
private static class UnmodifiableAttributeSet
implements AttributeSet, Serializable
@@ -287,7 +316,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static AttributeSet synchronizedView(AttributeSet attributeSet)
{
@@ -297,7 +327,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet)
{
@@ -307,7 +338,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet)
{
@@ -317,7 +349,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet)
{
@@ -327,7 +360,8 @@ public final class AttributeSetUtilities
/**
* Returns a synchronized view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
*/
public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet)
{
@@ -337,7 +371,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static AttributeSet unmodifiableView(AttributeSet attributeSet)
{
@@ -347,7 +382,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet)
{
@@ -357,7 +393,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet)
{
@@ -367,7 +404,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet)
{
@@ -377,7 +415,8 @@ public final class AttributeSetUtilities
/**
* Returns an unmodifiable view of the given attribute set.
*
- * @return the sychronized attribute set
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
*/
public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet)
{
@@ -386,8 +425,10 @@ public final class AttributeSetUtilities
/**
* Verifies that the given object is a <code>Class</code> that
- * implements the given interface name.
- *
+ * implements the given interface name and returns it casted.
+ *
+ * @param object the object to test.
+ * @param interfaceName the <code>Class</code> to verify against.
* @return object casted to <code>Class</code>
*
* @exception ClassCastException if object is not a <code>Class</code>
@@ -410,7 +451,10 @@ public final class AttributeSetUtilities
/**
* Verifies that the given object is an attribute of the given interface.
- *
+ * and returns it casted to the interface type.
+ *
+ * @param object the object to test.
+ * @param interfaceName the <code>Class</code> to verify against.
* @return the object casted to <code>Attribute</code>
*
* @exception ClassCastException if object is no instance of interfaceName.
@@ -429,10 +473,11 @@ public final class AttributeSetUtilities
}
/**
- * Verifies that the category of attribute is equals to category.
- *
- * @param category the category the atteribute should be
- * @param attribute the attribute to verify
+ * Verifies that the category of attribute is equals to the given category
+ * class.
+ *
+ * @param category the category to test.
+ * @param attribute the attribute to verify.
*
* @exception IllegalArgumentException if the categories are not equal
* @exception NullPointerException if category is null
@@ -440,10 +485,10 @@ public final class AttributeSetUtilities
public static void verifyCategoryForValue(Class category,
Attribute attribute)
{
- if (category == null)
- throw new NullPointerException("object may not be null");
+ if (category == null || attribute == null)
+ throw new NullPointerException("category or attribute may not be null");
- if (category.equals(attribute.getCategory()))
+ if (!category.equals(attribute.getCategory()))
throw new IllegalArgumentException
("category of attribute not equal to category");
}
diff --git a/libjava/classpath/javax/print/attribute/DateTimeSyntax.java b/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
index 0e583e0b990..d59193265e2 100644
--- a/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
+++ b/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
@@ -1,5 +1,5 @@
/* DateTimeSyntax.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,10 @@ import java.io.Serializable;
import java.util.Date;
/**
- * @author Michael Koch
+ * <code>DateTimeSyntax</code> is the abstract base class of all attribute
+ * classes having a date and a time as value.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class DateTimeSyntax implements Cloneable, Serializable
{
@@ -52,7 +55,7 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
/**
* Creates a <code>DateTimeSyntax</code> with a given value.
*
- * @param value the value for this syntax
+ * @param value the date for this syntax
*
* @exception NullPointerException if value is null
*/
@@ -67,7 +70,7 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
/**
* Returns the date value of this object.
*
- * @return the date value
+ * @return The date value.
*/
public Date getValue()
{
@@ -79,7 +82,8 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
*
* @param obj the object to test
*
- * @return True if both objects are equal, false otherwise.
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
@@ -92,7 +96,7 @@ public abstract class DateTimeSyntax implements Cloneable, Serializable
/**
* Returns the hashcode for this object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
diff --git a/libjava/classpath/javax/print/attribute/DocAttribute.java b/libjava/classpath/javax/print/attribute/DocAttribute.java
index 669d7d98251..9af3a7052af 100644
--- a/libjava/classpath/javax/print/attribute/DocAttribute.java
+++ b/libjava/classpath/javax/print/attribute/DocAttribute.java
@@ -1,5 +1,5 @@
/* DocAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,23 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes describing attributes of
+ * a {@link javax.print.Doc} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.DocAttributeSet}.
+ * </p><p>
+ * Attributes attached to a {@link javax.print.Doc} instance specify how the
+ * data should be printed.
+ * For example {@link javax.print.attribute.standard.Chromaticity} can be
+ * used to specify that a doc should be printed in color or monochrome.
+ * </p>
+ *
+ * @see javax.print.attribute.DocAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface DocAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/DocAttributeSet.java b/libjava/classpath/javax/print/attribute/DocAttributeSet.java
index 72cd6d88a00..d8d09eb4857 100644
--- a/libjava/classpath/javax/print/attribute/DocAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/DocAttributeSet.java
@@ -1,5 +1,5 @@
/* DocAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>DocAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.DocAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>DocAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface DocAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>DocAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>DocAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/EnumSyntax.java b/libjava/classpath/javax/print/attribute/EnumSyntax.java
index 3ed79fc5f68..9a5e62d458f 100644
--- a/libjava/classpath/javax/print/attribute/EnumSyntax.java
+++ b/libjava/classpath/javax/print/attribute/EnumSyntax.java
@@ -1,5 +1,5 @@
/* EnumSyntax.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,10 +37,69 @@ exception statement from your version. */
package javax.print.attribute;
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
import java.io.Serializable;
/**
- * @author Michael Koch
+ * <code>EnumSyntax</code> is the abstract base class of all enumeration
+ * classes in the Java Print Service API.
+ * <p>
+ * Every enumeration class which extends from EnumSyntax provides several
+ * enumeration objects as singletons of its class.
+ * </p>
+ * <p>
+ * Notes for implementing subclasses:
+ * <ul>
+ * <li>
+ * The values of all enumeration singelton instances have to be in a
+ * sequence which may start at any value. See: {@link #getOffset()}
+ * </li>
+ * <li>
+ * Subclasses have to override {@link #getEnumValueTable()} and should
+ * override {@link #getStringTable()} for correct serialization.
+ * </li>
+ * </ul>
+ * </p>
+ * Example:
+ * <pre>
+ * public class PrinterState extends EnumSyntax
+ * {
+ * public static final PrinterState IDLE = new PrinterState(1);
+ * public static final PrinterState PROCESSING = new PrinterState(2);
+ * public static final PrinterState STOPPED = new PrinterState(3);
+ *
+ * protected PrinterState(int value)
+ * {
+ * super(value);
+ * }
+ *
+ * // Overridden because values start not at zero !
+ * protected int getOffset()
+ * {
+ * return 1;
+ * }
+ *
+ * private static final String[] stringTable = { "idle", "processing",
+ * "stopped" };
+ *
+ * protected String[] getStringTable()
+ * {
+ * return stringTable;
+ * }
+ *
+ * private static final PrinterState[] enumValueTable = { IDLE,
+ * PROCESSING, STOPPED};
+ *
+ * protected EnumSyntax[] getEnumValueTable()
+ * {
+ * return enumValueTable;
+ * }
+ * }
+ * </pre>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
+ * @author Wolfgang Baer (WBaer@gmx.de)
*/
public abstract class EnumSyntax implements Cloneable, Serializable
{
@@ -51,7 +110,7 @@ public abstract class EnumSyntax implements Cloneable, Serializable
/**
* Creates a <code>EnumSyntax</code> object.
*
- * @param value the value to set
+ * @param value the value to set.
*/
protected EnumSyntax(int value)
{
@@ -59,9 +118,9 @@ public abstract class EnumSyntax implements Cloneable, Serializable
}
/**
- * Returns the value of this object.
+ * Returns the value of this enumeration object.
*
- * @return the value
+ * @return The value.
*/
public int getValue()
{
@@ -71,7 +130,7 @@ public abstract class EnumSyntax implements Cloneable, Serializable
/**
* Clones this object.
*
- * @return a clone of this object
+ * @return A clone of this object.
*/
public Object clone()
{
@@ -87,9 +146,10 @@ public abstract class EnumSyntax implements Cloneable, Serializable
}
/**
- * Returns the hashcode for this object.
+ * Returns the hashcode for this object.
+ * The hashcode is the value of this enumeration object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
@@ -98,8 +158,11 @@ public abstract class EnumSyntax implements Cloneable, Serializable
/**
* Returns the string representation for this object.
+ * The string value from <code>getStringTable()</code> method is returned
+ * if subclasses override this method. Otherwise the value of this object
+ * as a string is returned.
*
- * @return the string representation
+ * @return The string representation.
*/
public String toString()
{
@@ -118,9 +181,10 @@ public abstract class EnumSyntax implements Cloneable, Serializable
* Returns a table with the enumeration values represented as strings
* for this object.
*
- * The default implementation just returns null.
+ * The default implementation just returns null. Subclasses should
+ * override this method.
*
- * @return the enumeration values as strings
+ * @return The enumeration values as strings.
*/
protected String[] getStringTable()
{
@@ -128,17 +192,49 @@ public abstract class EnumSyntax implements Cloneable, Serializable
}
/**
+ * Needed for singelton semantics during deserialisation.
+ *
+ * Subclasses must not override this class. Subclasses have to override
+ * <code>getEnumValueTable()</code> and should override
+ * <code>getStringTable()</code> for correct serialization.
+ *
+ * @return The Object at index <code>value - getOffset()</code>
+ * in getEnumValueTable.
+ * @throws ObjectStreamException if getEnumValueTable() returns null.
+ */
+ protected Object readResolve() throws ObjectStreamException
+ {
+ EnumSyntax[] table = getEnumValueTable();
+ if (table == null)
+ throw new InvalidObjectException("Null enumeration value table "
+ + "for class "
+ + this.getClass().toString());
+
+ return table[value - getOffset()];
+ }
+
+ /**
* Returns a table with the enumeration values for this object.
*
- * The default implementation just returns null.
+ * The default implementation just returns null. Subclasses have to
+ * to override this method for serialization.
*
- * @return the enumeration values
+ * @return The enumeration values.
*/
protected EnumSyntax[] getEnumValueTable()
{
return null;
}
+ /**
+ * Returns the lowest used value by the enumerations of this class.
+ *
+ * The default implementation returns 0. This is enough if enumerations
+ * start with a zero value. Otherwise subclasses need to override this
+ * method for serialization and return the lowest value they use.
+ * .
+ * @return The lowest used value used.
+ */
protected int getOffset()
{
return 0;
diff --git a/libjava/classpath/javax/print/attribute/HashAttributeSet.java b/libjava/classpath/javax/print/attribute/HashAttributeSet.java
index c5fbe5ea88a..0db81bae540 100644
--- a/libjava/classpath/javax/print/attribute/HashAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashAttributeSet.java
@@ -1,5 +1,5 @@
/* HashAttributeSet.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,10 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
+/**
+ * <code>HashAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.AttributeSet}.
+ */
public class HashAttributeSet implements AttributeSet, Serializable
{
private static final long serialVersionUID = 5311560590283707917L;
@@ -73,9 +77,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
* Creates a <code>HashAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException If attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashAttributeSet(Attribute[] attributes)
{
@@ -83,12 +89,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Creates a <code>HashAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the set
+ * Creates a <code>HashAttributeSet</code> object with attributes
+ * of the given attributes set in it.
*
- * @exception NullPointerException If attributes is null
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
*/
public HashAttributeSet(AttributeSet attributes)
{
@@ -111,7 +116,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Creates an empty <code>HashAttributeSet</code> object.
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attribute in it.
+ *
+ * @param attribute the attribute to put into the set.
+ * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if attribute is not an interface of
* interfaceName
@@ -128,7 +137,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Creates an empty <code>HashAttributeSet</code> object.
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attributes in it.
+ *
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if any element of attributes is not an
* interface of interfaceName
@@ -138,15 +152,20 @@ public class HashAttributeSet implements AttributeSet, Serializable
{
this(interfaceName);
- if (attributes == null)
- throw new NullPointerException();
-
- for (int index = 0; index < attributes.length; index++)
- addInternal(attributes[index], interfaceName);
+ if (attributes != null)
+ {
+ for (int index = 0; index < attributes.length; index++)
+ addInternal(attributes[index], interfaceName);
+ }
}
/**
- * Creates an empty <code>HashAttributeSet</code> object.
+ * Creates a <code>HashAttributeSet</code> object with attributes
+ * of the given attributes set in it.
+ *
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @param interfaceName the interface that all members must implement.
*
* @exception ClassCastException if any element of attributes is not an
* interface of interfaceName
@@ -160,15 +179,16 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Adds the given attribute to the set.
- *
- * @param attribute the attribute to add
- *
- * @return true if the attribute set has changed, false otherwise
- *
- * @exception NullPointerException if attribute is null
- * @exception UnmodifiableSetException if this attribute set does not
- * support this action.
+ * Adds the specified attribute value to this attribute set
+ * if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute to the set.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public boolean add(Attribute attribute)
{
@@ -190,14 +210,13 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Adds the given attributes to the set.
- *
- * @param attributes the attributes to add
- *
- * @return true if the attribute set has changed, false otherwise
- *
- * @exception UnmodifiableSetException if this attribute set does not
- * support this action.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
public boolean addAll(AttributeSet attributes)
{
@@ -218,9 +237,8 @@ public class HashAttributeSet implements AttributeSet, Serializable
/**
* Removes all attributes from this attribute set.
- *
- * @exception UnmodifiableSetException if this attribute set does not
- * support this action.
+ *
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public void clear()
{
@@ -228,11 +246,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Checks if this attribute set contains an entry with the given category.
- *
- * @param category the category to test for
- *
- * @return true if the category exists in this attribute set, false otherwise.
+ * Checks if this attributes set contains an attribute with the given
+ * category.
+ *
+ * @param category the category to test for.
+ * @return <code>true</code> if an attribute of the category is contained
+ * in the set, <code>false</code> otherwise.
*/
public boolean containsKey(Class category)
{
@@ -240,12 +259,11 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Checks if this attribute set contains an entry with the given attribute.
- *
- * @param attribute the attribute to test for
- *
- * @return true if the attribute exists in this attribute set,
- * false otherwise.
+ * Checks if this attribute set contains the given attribute.
+ *
+ * @param attribute the attribute to test for.
+ * @return <code>true</code> if the attribute is contained in the set,
+ * <code>false</code> otherwise.
*/
public boolean containsValue(Attribute attribute)
{
@@ -253,11 +271,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Tests of obj is equal to this object.
- *
- * @param obj the object to test
- *
- * @return true if both objects are equal, false otherwise.
+ * Tests this set for equality with the given object. <code>true</code> is
+ * returned, if the given object is also of type <code>AttributeSet</code>
+ * and the contained attributes are the same as in this set.
+ *
+ * @param obj the Object to test.
+ * @return <code>true</code> if equal, false otherwise.
*/
public boolean equals(Object obj)
{
@@ -268,33 +287,45 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Returns the attribute value that is connected to the given attribute
- * category. If the attribute set does not contains the given category null
- * will be returned.
- *
- * @param category the attribute category to return the attribute value for
- *
- * @return the attribute associated to category, or null
+ * Returns the attribute object contained in this set for the given attribute
+ * category.
+ *
+ * @param category the category of the attribute. A <code>Class</code>
+ * instance of a class implementing the <code>Attribute</code> interface.
+ * @return The attribute for this category or <code>null</code> if no
+ * attribute is contained for the given category.
+ * @throws NullPointerException if category is null.
+ * @throws ClassCastException if category is not implementing
+ * <code>Attribute</code>.
*/
public Attribute get(Class category)
{
+ if (category == null)
+ throw new NullPointerException("category may not be null");
+
return (Attribute) attributeMap.get(category);
}
/**
- * Returns the hashcode for this object.
- *
- * @return the hashcode
+ * Returns the hashcode value. The hashcode value is the sum of all hashcodes
+ * of the attributes contained in this set.
+ *
+ * @return The hashcode for this attribute set.
*/
public int hashCode()
{
- return attributeMap.hashCode() + interfaceName.hashCode();
+ int hashcode = 0;
+ Iterator it = attributeMap.values().iterator();
+ while (it.hasNext())
+ hashcode = hashcode + it.next().hashCode();
+
+ return hashcode;
}
/**
* Checks if the attribute set is empty.
*
- * @return true if the attribute set is empty, false otherwise
+ * @return <code>true</code> if the attribute set is empty, false otherwise.
*/
public boolean isEmpty()
{
@@ -302,14 +333,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Removes the entry with the given attribute in it.
- *
- * @param attribute the attribute value of the entry to be removed
- *
- * @return true if the attribute set has changed, false otherwise.
- *
- * @exception UnmodifiableSetException if this attribute set does not
- * support this action.
+ * Removes the given attribute from the set. If the given attribute is <code>null</code>
+ * nothing is done and <code>false</code> is returned.
+ *
+ * @param attribute the attribute to remove.
+ * @return <code>true</code> if removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public boolean remove(Attribute attribute)
{
@@ -320,11 +349,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
}
/**
- * Removes the entry with the given category in it.
- *
- * @param category the category value of the entry to be removed
- *
- * @return true if the attribute set has changed, false otherwise.
+ * Removes the attribute entry of the given category from the set. If the given
+ * category is <code>null</code> nothing is done and <code>false</code> is returned.
+ *
+ * @param category the category of the entry to be removed.
+ * @return <code>true</code> if an attribute is removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
public boolean remove(Class category)
{
@@ -337,7 +367,7 @@ public class HashAttributeSet implements AttributeSet, Serializable
/**
* Returns the number of elements in this attribute set.
*
- * @return the number of elements.
+ * @return The number of elements.
*/
public int size()
{
@@ -347,12 +377,12 @@ public class HashAttributeSet implements AttributeSet, Serializable
/**
* Returns the content of the attribute set as an array
*
- * @return an array of attributes
+ * @return An array of attributes.
*/
public Attribute[] toArray()
{
int index = 0;
- Iterator it = attributeMap.entrySet().iterator();
+ Iterator it = attributeMap.values().iterator();
Attribute[] array = new Attribute[size()];
while (it.hasNext())
diff --git a/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java b/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
index 1647ae2f999..2317db3bc1e 100644
--- a/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
@@ -1,5 +1,5 @@
/* HashDocAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashDocAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.DocAttributeSet}.
+ */
public class HashDocAttributeSet extends HashAttributeSet
implements DocAttributeSet, Serializable
{
@@ -56,7 +60,7 @@ public class HashDocAttributeSet extends HashAttributeSet
* Creates a <code>HashDocAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashDocAttributeSet extends HashAttributeSet
* Creates a <code>HashDocAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashDocAttributeSet(DocAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashDocAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashDocAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashDocAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>DocAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
index 84fa7ec5d6a..ac4c902c332 100644
--- a/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
@@ -1,5 +1,5 @@
/* HashPrintJobAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashPrintJobAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintJobAttributeSet}.
+ */
public class HashPrintJobAttributeSet extends HashAttributeSet
implements Serializable, PrintJobAttributeSet
{
@@ -56,7 +60,7 @@ public class HashPrintJobAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintJobAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashPrintJobAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintJobAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashPrintJobAttributeSet(PrintJobAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashPrintJobAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashPrintJobAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashPrintJobAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>PrintJobAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
index 29a17861f7b..e74c0e00fbe 100644
--- a/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
@@ -1,5 +1,5 @@
/* HashPrintRequestAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashPrintRequestAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintRequestAttributeSet}.
+ */
public class HashPrintRequestAttributeSet extends HashAttributeSet
implements Serializable, PrintRequestAttributeSet
{
@@ -56,7 +60,7 @@ public class HashPrintRequestAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintRequestAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashPrintRequestAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintRequestAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashPrintRequestAttributeSet(PrintRequestAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashPrintRequestAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashPrintRequestAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashPrintRequestAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>PrintRequestAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
index 60e12bff0d1..155514f2b01 100644
--- a/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
@@ -1,5 +1,5 @@
/* HashPrintServiceAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.attribute;
import java.io.Serializable;
+/**
+ * <code>HashPrintServiceAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintServiceAttributeSet}.
+ */
public class HashPrintServiceAttributeSet extends HashAttributeSet
implements Serializable, PrintServiceAttributeSet
{
@@ -56,7 +60,7 @@ public class HashPrintServiceAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintServiceAttributeSet</code> object with the given
* attribute in it.
*
- * @param attribute the attriute tu put into the attribute set
+ * @param attribute the attribute to put into the attribute set
*
* @exception NullPointerException if attribute is null
*/
@@ -69,9 +73,11 @@ public class HashPrintServiceAttributeSet extends HashAttributeSet
* Creates a <code>HashPrintServiceAttributeSet</code> object with the given
* attributes in it.
*
- * @param attributes the attributes to put into the attribute set
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
*
- * @exception NullPointerException if attributes is null
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
*/
public HashPrintServiceAttributeSet(PrintServiceAttribute[] attributes)
{
@@ -79,11 +85,11 @@ public class HashPrintServiceAttributeSet extends HashAttributeSet
}
/**
- * Creates a <code>HashPrintServiceAttributeSet</code> object with the given
- * attributes in it.
- *
- * @param attributes the attributes to put into the attribute set
+ * Creates a <code>HashPrintServiceAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
*
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
* @exception ClassCastException if any element of attributes is not
* an instance of <code>PrintServiceAttribute</code>
*/
diff --git a/libjava/classpath/javax/print/attribute/IntegerSyntax.java b/libjava/classpath/javax/print/attribute/IntegerSyntax.java
index d5500b4ca8a..c2f9224a2a2 100644
--- a/libjava/classpath/javax/print/attribute/IntegerSyntax.java
+++ b/libjava/classpath/javax/print/attribute/IntegerSyntax.java
@@ -1,5 +1,5 @@
/* IntegerSyntax.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,10 @@ package javax.print.attribute;
import java.io.Serializable;
/**
- * @author Michael Koch
+ * <code>IntegerSyntax</code> is the abstract base class of all attribute
+ * classes having an integer as value.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class IntegerSyntax implements Cloneable, Serializable
{
@@ -49,7 +52,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Creates a <code>IntegerSyntax</code> with the given value.
*
- * @param value the value to set
+ * @param value the integer to set
*/
protected IntegerSyntax(int value)
{
@@ -57,9 +60,10 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
}
/**
- * Creates a <code>IntegerSyntax</code> with the given arguments.
+ * Creates a <code>IntegerSyntax</code> with the given integer value
+ * and checks if the value lies inside the given bounds..
*
- * @param value the value to set
+ * @param value the integer to set
* @param lowerBound the lower bound for the value
* @param upperBound the upper bound for the value
*
@@ -78,7 +82,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Returns the value of this object.
*
- * @return the value
+ * @return The integer value.
*/
public int getValue()
{
@@ -86,11 +90,12 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
}
/**
- * Tests of obj is equal to this object.
+ * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
- * @return true if both objects are equal, false otherwise.
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
@@ -103,7 +108,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Returns the hashcode for this object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
@@ -113,7 +118,7 @@ public abstract class IntegerSyntax implements Cloneable, Serializable
/**
* Returns the string representation for this object.
*
- * @return the string representation
+ * @return The string representation.
*/
public String toString()
{
diff --git a/libjava/classpath/javax/print/attribute/PrintJobAttribute.java b/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
index ba3a737b523..fd3663496c8 100644
--- a/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
+++ b/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
@@ -1,5 +1,5 @@
/* PrintJobAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,23 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes describing attributes or the
+ * status of a ({@link javax.print.DocPrintJob} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintJobAttributeSet}.
+ * </p><p>
+ * A print service uses attributes of this type to inform about the status
+ * of a print job.
+ * For example {@link javax.print.attribute.standard.DateTimeAtProcessing}
+ * is used to report at which date and time a job has started processing.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintJobAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintJobAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
index 905d53c2d71..6283ae14276 100644
--- a/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
@@ -1,5 +1,5 @@
/* PrintJobAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>PrintJobAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintJobAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintJobAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintJobAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintJobAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintJobAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java b/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
index 756350020d2..8a05b75d3cd 100644
--- a/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
+++ b/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
@@ -1,5 +1,5 @@
/* PrintRequestAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,18 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes which specify a requested
+ * attribute of {@link javax.print.DocPrintJob} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintRequestAttributeSet}.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintRequestAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintRequestAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
index d72d2d71c47..350d9a644da 100644
--- a/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
@@ -1,5 +1,5 @@
/* PrintRequestAttributeSet.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>PrintRequestAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintRequestAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintRequestAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintRequestAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintRequestAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintRequestAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java b/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
index 3cf8825f560..213f43796bb 100644
--- a/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
+++ b/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
@@ -1,5 +1,5 @@
/* PrintServiceAttribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,23 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes describing parameters
+ * or the status of a {@link javax.print.PrintService}.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintServiceAttributeSet}.
+ * </p><p>
+ * A print service uses attributes of this type to inform about the status
+ * or the specific capabilities of itself.
+ * For example {@link javax.print.attribute.standard.PagesPerMinute} is used
+ * to specify the average printable pages per minute of the print service.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintServiceAttributeSet
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintServiceAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
index d67c9af55f0..fa22ee0d922 100644
--- a/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
+++ b/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
@@ -1,5 +1,5 @@
/* PrintServiceAttributeSet.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,18 +38,45 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * <code>PrintServiceAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintServiceAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintServiceAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintServiceAttributeSet extends AttributeSet
{
/**
- * Adds the specified attribute value to this attribute set
+ * Adds the specified attribute value to this attribute set
* if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintServiceAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
*/
boolean add (Attribute attribute);
/**
- * Adds all of the elements in the specified set to this attribute.
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintServiceAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
*/
boolean addAll (AttributeSet attributes);
}
diff --git a/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java b/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
index d73b867d5f6..3990b66c50a 100644
--- a/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
+++ b/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
@@ -38,7 +38,11 @@ exception statement from your version. */
package javax.print.attribute;
import java.io.Serializable;
-import java.util.Vector;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
/**
* @author Michael Koch
@@ -50,33 +54,41 @@ public abstract class SetOfIntegerSyntax
private int[][] members;
- private static int[][] normalize(Vector vecMembers)
+ private static int[][] normalize(int[][] values, int size)
{
- // XXX: Perhaps we should merge ranges that overlap.
-
- int current = 0;
- int[][] members = new int[vecMembers.size()][];
+ // Sort into increasing order. First the first index is
+ // compared, then the second.
+ Arrays.sort(values, 0, size, new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ int[] v1 = (int[]) o1;
+ int[] v2 = (int[]) o2;
+ if (v1[0] == v2[0])
+ return v1[1] - v2[1];
+ return v1[0] - v2[0];
+ }
+ });
- while (vecMembers.size() > 0)
+ // Now coalesce overlapping ranges.
+ int outIndex = 0;
+ for (int i = 0; i < size; ++i)
{
- // Search the lowest range.
- int[] range = (int[]) vecMembers.elementAt(0);
-
- for (int index = 1; index < vecMembers.size(); index++)
+ // Note that we compare with values[i][1]+1, since
+ // we can coalesce {0,1} with {2,x}.
+ int save = i;
+ while (i + 1 < size && values[i + 1][0] <= values[i][1] + 1)
{
- int[] tmp = (int[]) vecMembers.elementAt(index);
-
- if (range[0] > tmp[0]
- || (range[0] == tmp[0]
- && range[0] > tmp[0]))
- range = tmp;
+ values[i][1] = Math.max(values[i][1], values[i + 1][1]);
+ ++i;
}
-
- members[current] = range;
- current++;
+ values[outIndex++] = values[save];
}
- return members;
+ int[][] result = new int[outIndex][];
+ System.arraycopy(values, 0, result, 0, outIndex);
+
+ return result;
}
/**
@@ -104,10 +116,13 @@ public abstract class SetOfIntegerSyntax
*/
protected SetOfIntegerSyntax(int[][] members)
{
- Vector vecMembers = new Vector();
-
- if (members != null)
+ int[][] newMembers;
+ int outIndex = 0;
+ if (members == null)
+ newMembers = new int[0][];
+ else
{
+ newMembers = new int[members.length][];
for (int index = 0; index < members.length; index++)
{
int lower;
@@ -126,6 +141,7 @@ public abstract class SetOfIntegerSyntax
else
throw new IllegalArgumentException("invalid member element");
+ // We only want to reject non-null ranges where lower<0.
if (lower <= upper && lower < 0)
throw new IllegalArgumentException("invalid member element");
@@ -134,12 +150,81 @@ public abstract class SetOfIntegerSyntax
int[] range = new int[2];
range[0] = lower;
range[1] = upper;
- vecMembers.add(range);
+ newMembers[outIndex++] = range;
}
}
}
- this.members = normalize(vecMembers);
+ this.members = normalize(newMembers, outIndex);
+ }
+
+ private boolean skipWhitespace(StringCharacterIterator i)
+ {
+ while (Character.isWhitespace(i.current()))
+ i.next();
+ return i.current() == CharacterIterator.DONE;
+ }
+
+ private boolean skipNumber(StringCharacterIterator i)
+ {
+ boolean readAny = false;
+ while (Character.isDigit(i.current()))
+ {
+ readAny = true;
+ i.next();
+ }
+ return readAny;
+ }
+
+ protected SetOfIntegerSyntax(String s)
+ {
+ ArrayList vals = new ArrayList();
+
+ StringCharacterIterator it = new StringCharacterIterator(s);
+
+ while (true)
+ {
+ // Skip whitespace.
+ if (skipWhitespace(it))
+ break;
+
+ // Parse integer.
+ int index = it.getIndex();
+ if (! skipNumber(it))
+ throw new IllegalArgumentException();
+ int[] item = new int[2];
+ item[0] = Integer.parseInt(s.substring(index, it.getIndex()));
+
+ if (! skipWhitespace(it))
+ {
+ char c = it.current();
+ if (c == ':' || c == '-')
+ {
+ it.next();
+ if (skipWhitespace(it))
+ throw new IllegalArgumentException();
+ index = it.getIndex();
+ if (! skipNumber(it))
+ throw new IllegalArgumentException();
+ item[1] = Integer.parseInt(s.substring(index, it.getIndex()));
+ }
+ else
+ item[1] = item[0];
+ }
+ else
+ item[1] = item[0];
+
+ if (item[0] <= item[1])
+ vals.add(item);
+
+ if (skipWhitespace(it))
+ break;
+ if (it.current() != ',')
+ throw new IllegalArgumentException();
+ it.next();
+ }
+
+ members = normalize((int[][]) vals.toArray(new int[0][]), vals.size());
}
/**
@@ -153,6 +238,7 @@ public abstract class SetOfIntegerSyntax
*/
protected SetOfIntegerSyntax(int lowerBound, int upperBound)
{
+ // We only want to reject non-null ranges where lower<0.
if (lowerBound <= upperBound
&& lowerBound < 0)
throw new IllegalArgumentException();
@@ -175,7 +261,7 @@ public abstract class SetOfIntegerSyntax
{
if (value < members[index][0])
return false;
- else if (value < members[index][1])
+ else if (value <= members[index][1])
return true;
}
@@ -205,8 +291,16 @@ public abstract class SetOfIntegerSyntax
{
if (! (obj instanceof SetOfIntegerSyntax))
return false;
-
- throw new Error("not implemented");
+ SetOfIntegerSyntax other = (SetOfIntegerSyntax) obj;
+ if (other.members.length != members.length)
+ return false;
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (members[i][0] != other.members[i][0]
+ || members[i][1] != other.members[i][1])
+ return false;
+ }
+ return true;
}
/**
@@ -216,7 +310,7 @@ public abstract class SetOfIntegerSyntax
*/
public int[][] getMembers()
{
- throw new Error("not implemented");
+ return (int[][]) members.clone();
}
/**
@@ -226,11 +320,14 @@ public abstract class SetOfIntegerSyntax
*/
public int hashCode()
{
- throw new Error("not implemented");
+ int result = 0;
+ for (int i = 0; i < members.length; ++i)
+ result += members[i][0] + members[i][1];
+ return result;
}
/**
- * Returns the smallest value that is greater then x.
+ * Returns the smallest value that is greater than x which is in this set.
*
* @param x an integer value
*
@@ -238,7 +335,16 @@ public abstract class SetOfIntegerSyntax
*/
public int next(int x)
{
- throw new Error("not implemented");
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (x >= members[i][1])
+ continue;
+ if (x < members[i][0])
+ return members[i][0];
+ // X is in this range.
+ return x + 1;
+ }
+ return -1;
}
/**
@@ -248,6 +354,18 @@ public abstract class SetOfIntegerSyntax
*/
public String toString()
{
- throw new Error("not implemented");
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (i > 0)
+ sb.append(',');
+ sb.append(members[i][0]);
+ if (members[i][0] != members[i][1])
+ {
+ sb.append('-');
+ sb.append(members[i][1]);
+ }
+ }
+ return sb.toString();
}
}
diff --git a/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java b/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
index d0f4b65c647..a001e7e91ce 100644
--- a/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
+++ b/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
@@ -1,5 +1,5 @@
-/* Attribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* SupportedValuesAttribute.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,22 @@ exception statement from your version. */
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Marker interface for all attribute classes specifying the
+ * supported/allowed values for another printing attribute class.
+ * <p>
+ * A {@link javax.print.PrintService} instance for example provides
+ * printing attribute classes implementing this interface to indicate
+ * that a specific attribute type is supported and if the supported values.
+ * </p><p>
+ * E.g. a {@link javax.print.attribute.standard.JobPrioritySupported}
+ * instance indicates that the attribute class
+ * {@link javax.print.attribute.standard.JobPriority} is supported and
+ * provides the number of the possible priority levels.
+ * </p>
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public interface SupportedValuesAttribute extends Attribute
{
+ // Marker interface
}
diff --git a/libjava/classpath/javax/print/attribute/URISyntax.java b/libjava/classpath/javax/print/attribute/URISyntax.java
index f0583f7e53c..07deb4b5741 100644
--- a/libjava/classpath/javax/print/attribute/URISyntax.java
+++ b/libjava/classpath/javax/print/attribute/URISyntax.java
@@ -1,5 +1,5 @@
/* URISyntax.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,10 @@ import java.io.Serializable;
import java.net.URI;
/**
- * @author Michael Koch
+ * <code>URISyntax</code> is the abstract base class of all attribute
+ * classes having an Uniform Resource Identifier URI as value.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*/
public abstract class URISyntax
implements Cloneable, Serializable
@@ -66,11 +69,12 @@ public abstract class URISyntax
}
/**
- * Tests of obj is equal to this object.
+ * Tests if the given object is equal to this object.
*
* @param obj the object to test
*
- * @returns true if both objects are equal, false otherwise.
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
@@ -83,7 +87,7 @@ public abstract class URISyntax
/**
* Returns the URI value of this syntax object.
*
- * @return the URI
+ * @return The URI.
*/
public URI getURI()
{
@@ -93,7 +97,7 @@ public abstract class URISyntax
/**
* Returns the hashcode for this object.
*
- * @return the hashcode
+ * @return The hashcode.
*/
public int hashCode()
{
@@ -103,7 +107,7 @@ public abstract class URISyntax
/**
* Returns the string representation for this object.
*
- * @return the string representation
+ * @return The string representation.
*/
public String toString()
{
diff --git a/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java b/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
index 678531769a5..ed1687c4cba 100644
--- a/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
+++ b/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
@@ -1,5 +1,5 @@
-/* Attribute.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+/* UnmodifiableSetException.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,14 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package javax.print.attribute;
/**
- * @author Michael Koch
+ * Exception which is thrown if an operation on an unmodifiable set
+ * is invoked.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
*
* @since 1.4
*/
@@ -56,7 +60,7 @@ public class UnmodifiableSetException extends RuntimeException
* Creates a <code>UnmodifiableSetException</code>
* with the given message.
*
- * @param message the message for the exception
+ * @param message the message of the exception
*/
public UnmodifiableSetException(String message)
{
diff --git a/libjava/classpath/javax/print/attribute/package.html b/libjava/classpath/javax/print/attribute/package.html
index ba67d1a79d6..37f24d56b47 100644
--- a/libjava/classpath/javax/print/attribute/package.html
+++ b/libjava/classpath/javax/print/attribute/package.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- package.html - describes classes in javax.print.attribute package.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,10 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.print.attribute</title></head>
<body>
-<p></p>
-
+<p>Provides classes and interfaces describing the roles and
+syntax of attribute objects in the Java Print Service API.</p>
+<p>
+<b>Since:</b> 1.4
+</p>
</body>
</html>
diff --git a/libjava/classpath/javax/print/event/PrintEvent.java b/libjava/classpath/javax/print/event/PrintEvent.java
index cbf93852cc5..d44c2066818 100644
--- a/libjava/classpath/javax/print/event/PrintEvent.java
+++ b/libjava/classpath/javax/print/event/PrintEvent.java
@@ -1,5 +1,5 @@
/* PrintEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ import java.util.EventObject;
/**
+ * Superclass of all events in the Java Print Service API.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class PrintEvent extends EventObject
@@ -58,7 +60,7 @@ public class PrintEvent extends EventObject
/**
* Returns a string representation of this object.
*
- * @return the string representation
+ * @return The string representation
*/
public String toString()
{
diff --git a/libjava/classpath/javax/print/event/PrintJobAdapter.java b/libjava/classpath/javax/print/event/PrintJobAdapter.java
index 3615108f93a..9229d195fe4 100644
--- a/libjava/classpath/javax/print/event/PrintJobAdapter.java
+++ b/libjava/classpath/javax/print/event/PrintJobAdapter.java
@@ -1,5 +1,5 @@
/* PrintJobAdapter.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,11 @@ package javax.print.event;
/**
+ * Adapter class for implementing {@link javax.print.event.PrintJobListener}
+ * classes. The methods in this class do nothing by default. Subclasses may
+ * only implement the methods for the {@link javax.print.event.PrintJobEvent}s
+ * they are interested in.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public abstract class PrintJobAdapter
@@ -53,10 +58,11 @@ public abstract class PrintJobAdapter
}
/**
- * Called to notify the client that all data has bin successfully transferred
+ * Called to notify the client that all data has been successfully transferred
* to the print service.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printDataTransferCompleted(PrintJobEvent event)
{
@@ -64,9 +70,10 @@ public abstract class PrintJobAdapter
}
/**
- * Called to notify the client that a print job was canceled.
+ * Called to notify the client that a print job was canceled.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobCanceled(PrintJobEvent event)
{
@@ -75,8 +82,9 @@ public abstract class PrintJobAdapter
/**
* Called to notify the client that a print job was successfully completed.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobCompleted(PrintJobEvent event)
{
@@ -86,8 +94,9 @@ public abstract class PrintJobAdapter
/**
* Called to notify the client that a print job failed to complete
* successfully.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobFailed(PrintJobEvent event)
{
@@ -96,8 +105,9 @@ public abstract class PrintJobAdapter
/**
* Called to notify the client that no more job events will be send.
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobNoMoreEvents(PrintJobEvent event)
{
@@ -105,10 +115,12 @@ public abstract class PrintJobAdapter
}
/**
- * Called to notify the client that a problem occured during printing
- * but the user may be able to fix it.
+ * Called to notify the client that a problem occured during printing.
+ * This event signals problems a user might be able to fix
+ * (e.g. out of paper or paper jam).
+ * <p>The default implementation does nothing.</p>
*
- * <p>The default implementation does nothing</p>
+ * @param event the event.
*/
public void printJobRequiresAttention(PrintJobEvent event)
{
diff --git a/libjava/classpath/javax/print/event/PrintJobAttributeEvent.java b/libjava/classpath/javax/print/event/PrintJobAttributeEvent.java
index 0914aea9f4b..d401ab15152 100644
--- a/libjava/classpath/javax/print/event/PrintJobAttributeEvent.java
+++ b/libjava/classpath/javax/print/event/PrintJobAttributeEvent.java
@@ -1,5 +1,5 @@
/* PrintJobAttributeEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,10 @@ import javax.print.attribute.PrintJobAttributeSet;
/**
+ * <code>PrintJobAttributeEvent</code>s are generated by a
+ * <code>PrintService</code> to inform registered listeners that attributes
+ * associated with a {@link javax.print.DocPrintJob} instance have changed.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class PrintJobAttributeEvent extends PrintEvent
@@ -66,7 +70,7 @@ public class PrintJobAttributeEvent extends PrintEvent
/**
* Returns the print job generating this event.
*
- * @return the print job
+ * @return The print job.
*/
public DocPrintJob getPrintJob()
{
@@ -76,7 +80,7 @@ public class PrintJobAttributeEvent extends PrintEvent
/**
* Returns the attributes that changed and their new values.
*
- * @return the changes attributes
+ * @return The changed attributes.
*/
public PrintJobAttributeSet getAttributes()
{
diff --git a/libjava/classpath/javax/print/event/PrintJobAttributeListener.java b/libjava/classpath/javax/print/event/PrintJobAttributeListener.java
index ee816d22a1c..9f96d267e9c 100644
--- a/libjava/classpath/javax/print/event/PrintJobAttributeListener.java
+++ b/libjava/classpath/javax/print/event/PrintJobAttributeListener.java
@@ -1,5 +1,5 @@
/* PrintJobAttributeListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.event;
/**
+ * Listener interface to receive attribute changes from a print job.
+ * Implementations of this interface can be registered with a
+ * {@link javax.print.DocPrintJob} instance.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintJobAttributeListener
diff --git a/libjava/classpath/javax/print/event/PrintJobEvent.java b/libjava/classpath/javax/print/event/PrintJobEvent.java
index c4b7cd6f942..cc15f97535b 100644
--- a/libjava/classpath/javax/print/event/PrintJobEvent.java
+++ b/libjava/classpath/javax/print/event/PrintJobEvent.java
@@ -1,5 +1,5 @@
/* PrintEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,19 +41,38 @@ import javax.print.DocPrintJob;
/**
+ * <code>PrintJobEvent</code>s are generated by a print job during
+ * print job processing to inform registered listeners about the state
+ * of processing.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class PrintJobEvent extends PrintEvent
{
private static final long serialVersionUID = -1711656903622072997L;
-
+
+ /** Indicates that the data transfer to the print service has completed. */
public static final int DATA_TRANSFER_COMPLETE = 106;
+
+ /** Indicates that the print job was canceled. */
public static final int JOB_CANCELED = 101;
+
+ /** Indicates that the print job was completed (=printed). */
public static final int JOB_COMPLETE = 102;
+
+ /** Indicates that the print job failed to complete. */
public static final int JOB_FAILED = 103;
+
+ /** Indicates that no more job events will be send.*/
public static final int NO_MORE_EVENTS = 105;
+
+ /**
+ * Indicates a situation where human intervention might be needed.
+ * E.g. the printer run out of paper or a paper jam occured.
+ */
public static final int REQUIRES_ATTENTION = 104;
+ /** The reason (one of the defined constants). */
private int reason;
/**
@@ -71,7 +90,7 @@ public class PrintJobEvent extends PrintEvent
/**
* Returns the reason for this event.
*
- * @return the reason
+ * @return The reason.
*/
public int getPrintEventType()
{
@@ -81,7 +100,7 @@ public class PrintJobEvent extends PrintEvent
/**
* Returns the print job that generated this event.
*
- * @return the print job
+ * @return The print job.
*/
public DocPrintJob getPrintJob()
{
diff --git a/libjava/classpath/javax/print/event/PrintJobListener.java b/libjava/classpath/javax/print/event/PrintJobListener.java
index d1dcf42be71..96c6d411d54 100644
--- a/libjava/classpath/javax/print/event/PrintJobListener.java
+++ b/libjava/classpath/javax/print/event/PrintJobListener.java
@@ -1,5 +1,5 @@
/* PrintJobListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,14 @@ package javax.print.event;
/**
- * @author Michael Koch (konqueror@gmx.de) */
+ * Listener interface to receive processing events from a print job.
+ * Implementations of this interface can be registered with a
+ * {@link javax.print.DocPrintJob} instance.
+ *
+ * @see javax.print.event.PrintJobAdapter
+ *
+ * @author Michael Koch (konqueror@gmx.de)
+ */
public interface PrintJobListener
{
/**
@@ -79,7 +86,9 @@ public interface PrintJobListener
void printJobNoMoreEvents(PrintJobEvent event);
/**
- * Notifies the listener that an error occured and the user might be able to fix it.
+ * Notifies the listener that a problem occured during printing.
+ * This event signals problems a user might be able to fix
+ * (e.g. out of paper or paper jam).
*
* @param event the event
*/
diff --git a/libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java b/libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java
index d3981747fa8..a41e213ff7b 100644
--- a/libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java
+++ b/libjava/classpath/javax/print/event/PrintServiceAttributeEvent.java
@@ -1,5 +1,5 @@
/* PrintServiceAttributeEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,6 +42,10 @@ import javax.print.attribute.PrintServiceAttributeSet;
/**
+ * <code>PrintServiceAttributeEvent</code>s are generated by a
+ * <code>PrintService</code> to inform registered listeners that
+ * its associated attributes have changed.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public class PrintServiceAttributeEvent extends PrintEvent
@@ -64,7 +68,7 @@ public class PrintServiceAttributeEvent extends PrintEvent
/**
* Returns the print service that generated this event.
*
- * @return the print service
+ * @return The print service.
*/
public PrintService getPrintService()
{
@@ -74,7 +78,7 @@ public class PrintServiceAttributeEvent extends PrintEvent
/**
* Returns the changed attributes this event reports.
*
- * @return the changed attributes
+ * @return The changed attributes.
*/
public PrintServiceAttributeSet getAttributes()
{
diff --git a/libjava/classpath/javax/print/event/PrintServiceAttributeListener.java b/libjava/classpath/javax/print/event/PrintServiceAttributeListener.java
index e43d9ad65ee..b46bf3b69d7 100644
--- a/libjava/classpath/javax/print/event/PrintServiceAttributeListener.java
+++ b/libjava/classpath/javax/print/event/PrintServiceAttributeListener.java
@@ -1,5 +1,5 @@
/* PrintServiceAttributeListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,10 @@ package javax.print.event;
/**
+ * Listener interface to receive attribute changes from a print service.
+ * Implementations of this interface can be registered with a
+ * {@link javax.print.PrintService} instance.
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public interface PrintServiceAttributeListener
diff --git a/libjava/classpath/javax/print/event/package.html b/libjava/classpath/javax/print/event/package.html
index 52a298a68da..f811013d10d 100644
--- a/libjava/classpath/javax/print/event/package.html
+++ b/libjava/classpath/javax/print/event/package.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- package.html - describes classes in javax.print.event package.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,9 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.print.event</title></head>
<body>
-<p></p>
-
+<p>Provides events and listeners to be used with the Java Print Service API.</p>
+<p>
+<b>Since:</b> 1.4
+</p>
</body>
</html>
diff --git a/libjava/classpath/javax/rmi/BAD_OPERATION.java b/libjava/classpath/javax/rmi/BAD_OPERATION.java
deleted file mode 100644
index 36081a47c57..00000000000
--- a/libjava/classpath/javax/rmi/BAD_OPERATION.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package javax.rmi;
-
-/** XXX - Stub till we have org.omg.CORBA */
-public class BAD_OPERATION extends Exception { }
diff --git a/libjava/classpath/javax/rmi/CORBA/ClassDesc.java b/libjava/classpath/javax/rmi/CORBA/ClassDesc.java
index 01befa49339..c8b38ead095 100644
--- a/libjava/classpath/javax/rmi/CORBA/ClassDesc.java
+++ b/libjava/classpath/javax/rmi/CORBA/ClassDesc.java
@@ -1,5 +1,5 @@
-/* ClassDesc.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* ClassDesc.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,16 +40,27 @@ package javax.rmi.CORBA;
import java.io.Serializable;
-public class ClassDesc
- implements Serializable
+/**
+ * This class is used to marshal java.lang.Class objects over IIOP.
+ * When used as a parameter type, return type, or data member, the Java Class
+ * is mapped to the OMG IDL type ::javax::rmi::CORBA::ClassDesc.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public class ClassDesc implements Serializable
{
- /*
- * The following is serialized form required by Java API Doc
+ /**
+ * Use serialVersionUID (V1.4) for interoperability.
*/
- private String repid;
- private String codebase;
+ private static final long serialVersionUID = -3477057297839810709L;
+
+ /**
+ * The class repository Id.
+ */
+ String repid;
- public ClassDesc()
- {
- }
+ /**
+ * Space separeted list of URL's from where the code can be downloaded.
+ */
+ String codebase;
}
diff --git a/libjava/classpath/javax/rmi/CORBA/ObjectImpl.java b/libjava/classpath/javax/rmi/CORBA/ObjectImpl.java
deleted file mode 100644
index d76d673cede..00000000000
--- a/libjava/classpath/javax/rmi/CORBA/ObjectImpl.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package javax.rmi.CORBA;
-
-/** XXX - Stub till we have org.omg.CORBA */
-public class ObjectImpl
-{
- public ObjectImpl _orb() { return null; }
- public String object_to_string(ObjectImpl o)
- throws javax.rmi.BAD_OPERATION { return null; }
-}
diff --git a/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java b/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
index 9ae45a33d04..2849707632b 100644
--- a/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
+++ b/libjava/classpath/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
@@ -1,5 +1,5 @@
/* PortableRemoteObjectDelegate.java -- Interface supporting PortableRemoteObject
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,23 +43,95 @@ import java.rmi.Remote;
import java.rmi.RemoteException;
/**
- * A delegate is a singleton class that support delegation for method
- * implementation in PortableRemoteObject.
+ * A delegate, implementing the functionality, provided by the
+ * {@link PortableRemoteObject}.
+ *
+ * The default delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.PortableRemoteObjectClass" to the name of the alternative
+ * class that must implement {@link PortableRemoteObjectDelegate}.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public interface PortableRemoteObjectDelegate
{
+ /**
+ * <p>
+ * Makes the remote object <code>target</code> ready for remote
+ * communication using the same communications runtime as for the passed
+ * <code>source</code> parameter. Connection normally happens implicitly
+ * when the object is sent or received as an argument on a remote method call.
+ * </p>
+ * <p>
+ * The target object is connected to the same ORB as source by calling the
+ * {@link Stub#connect} if it is a stub or by associating its tie with an ORB
+ * if it is an implementation object.
+ * </p>
+ *
+ * @param target the target object that may be either an RMI/IDL stub or an
+ * exported RMI/IDL implementation object
+ * @param source the source object may also be either an RMI/IDL stub or an
+ * exported RMI/IDL implementation object.
+ *
+ * @throws RemoteException if the target is already connected to another ORB.
+ */
void connect(Remote target, Remote source)
throws RemoteException;
-
+
+ /**
+ * Register the passed object with the ORB runtimes, making it remotely
+ * accessible. When called on jre with no objects exported, creates a
+ * non-daemon thread that prevents jre from terminating until all objects are
+ * unexported. Also, such object cannot be collected by garbage collector.
+ * This is usually impemented via {@link Util#unexportObject}
+ *
+ * @param object the object to export.
+ *
+ * @throws RemoteException
+ */
void exportObject(Remote obj)
throws RemoteException;
+ /**
+ * Narrows the passed object to conform to the given interface or IDL type.
+ * This method may return different instance and cannot be replaced by the
+ * direct cast.
+ *
+ * @param narrowFrom an object to narrow.
+ * @param narrowTo a type to that the object must be narrowed.
+ *
+ * @return On success, an object of type narrowTo or null, if narrowFrom =
+ * null.
+ *
+ * @throws ClassCastException if no narrowing is possible.
+ */
Object narrow(Object narrowFrom, Class narrowTo)
throws ClassCastException;
-
+
+ /**
+ * Takes a server implementation object and returns a stub object that can be
+ * used to access that server object (target). If the target is connected, the
+ * returned stub is also connected to the same ORB. If the target is
+ * unconnected, the returned stub is unconnected.
+ *
+ * @param target a server side object.
+ * @return a stub object that can be used to access that server object.
+ *
+ * @throws NoSuchObjectException if a stub cannot be located for the given
+ * target.
+ */
Remote toStub(Remote obj)
throws NoSuchObjectException;
-
+
+ /**
+ * Deregister a currently exported server object from the ORB runtimes. The
+ * object to becomes available for garbage collection. This is usually
+ * impemented via {@link Util#unexportObject}
+ *
+ * @param object the object to unexport.
+ *
+ * @throws NoSuchObjectException if the passed object is not currently
+ * exported.
+ */
void unexportObject(Remote obj)
throws NoSuchObjectException;
}
diff --git a/libjava/classpath/javax/rmi/CORBA/Stub.java b/libjava/classpath/javax/rmi/CORBA/Stub.java
index a35a08fa9d3..190b10dad57 100644
--- a/libjava/classpath/javax/rmi/CORBA/Stub.java
+++ b/libjava/classpath/javax/rmi/CORBA/Stub.java
@@ -1,5 +1,5 @@
-/* Stub.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* Stub.java --
+ Copyright (C) 2004, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,7 @@ exception statement from your version. */
package javax.rmi.CORBA;
import gnu.javax.rmi.CORBA.DelegateFactory;
-import gnu.javax.rmi.CORBA.GetDelegateInstanceException;
+import gnu.javax.rmi.CORBA.StubDelegateImpl;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -47,7 +47,27 @@ import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.rmi.RemoteException;
-public abstract class Stub extends ObjectImpl
+import javax.rmi.PortableRemoteObject;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA_2_3.portable.ObjectImpl;
+
+/**
+ * A Stub descendants provide access to the object on the client side. This base
+ * class implements methods, required for remote or local invocation using CORBA
+ * mechanisms. The most of the functionality is forwarded to the stub delegate.
+ * This delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.StubClass" to the name of the alternative class that must
+ * implement {@link StubDelegate}. Hence Stub contains two delegates, one for
+ * Stub-related operations and another inherited from the ObjectImpl.
+ *
+ * @specnote GNU Classpath uses separate delegate per each Stub. The delegate
+ * holds information about the ORB and other data, specific for the each Stub.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public abstract class Stub
+ extends ObjectImpl
implements Serializable
{
/**
@@ -55,69 +75,129 @@ public abstract class Stub extends ObjectImpl
*/
private static final long serialVersionUID = 1087775603798577179L;
- private transient StubDelegate delegate;
-
- protected Stub()
- {
- try
- {
- delegate = (StubDelegate)DelegateFactory.getInstance("Stub");
- }
- catch(GetDelegateInstanceException e)
- {
- delegate = null;
- }
- }
+ /**
+ * The hashcode, computed once (expensive operation).
+ */
+ transient int m_hash = Integer.MIN_VALUE;
+
+ /**
+ * The stringified reference, computed once (expensive operation).
+ */
+ transient String m_ior;
+
+ /**
+ * The ORB, where the stub is connected on the client side.
+ */
+ transient ORB m_orb;
+ /**
+ * The associated delegate, responsible for the major of the functionality of
+ * this stub.
+ */
+ static StubDelegate delegate = (StubDelegate) DelegateFactory.getInstance(DelegateFactory.STUB);
+
+ /**
+ * Returns the same hashcode for all stubs that point to the same remote
+ * object.
+ */
public int hashCode()
{
- if(delegate != null)
- return delegate.hashCode(this);
- else
- return 0;
+ if (m_hash == Integer.MIN_VALUE)
+ m_hash = delegate.hashCode(this);
+ // This should finally result to the IOR comparison.
+ return m_hash;
}
- public boolean equals(Object obj)
+ /**
+ * The stubs are equal if they point to the same remote object.
+ */
+ public boolean equals(java.lang.Object obj)
{
- if(delegate != null)
- return delegate.equals(this, obj);
- else
- return false;
+ return delegate.equals(this, obj);
}
+ /**
+ * Get the string representation of this Stub.
+ *
+ * @return the CORBA IOR reference.
+ */
public String toString()
{
- String s = null;
- if(delegate != null)
- s = delegate.toString(this);
- if(s == null)
- s = super.toString();
- return s;
+ if (m_ior == null)
+ m_ior = delegate.toString(this);
+ return m_ior;
}
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- public void connect(javax.rmi.ORB orb)
+ /**
+ * <p>
+ * Finds the suitable {@link Tie} for this Stub and connects it to the given
+ * ORB. The tie is found by the name pattern. If the found tie is derived from
+ * {@link org.omg.CORBA.PortableServer.Servant}, it is connected to the root
+ * POA, also activating it (if not already active).
+ * </p>
+ * <p>
+ * This method does not allow to specify, to which POA the found Tie must be
+ * connected and requires to use the deprecated method {@link ORB#connect}.
+ * Many useful POA features remain unaccessible. A better alternative it might
+ * be to generate a {@link org.omg.CORBA.PortableServer.Servant} - derived Tie
+ * (-poa key in rmic) and connect it to POA in one of the many ways, listed in
+ * the description of the {@link orb.omg.PortableServer} package). The
+ * obtained CORBA object can be narrowed into stub using
+ * {@link PortableRemoteObject#narrow}.
+ * </p>
+ * <p>
+ * It is frequently easier to call {@link PortableRemoteObject#connect} rather
+ * than this method.
+ * </p>
+ *
+ * @param orb the ORB where the Stub must be connected.
+ *
+ * @throws RemoteException if the stub is already connected to some other ORB.
+ * If the stub is already connected to the ORB that was passed as parameter,
+ * the method returns without action.
+ *
+ * @throws BAD_PARAM if the name of this stub does not match the stub name
+ * pattern, "_*_Stub" or if the Tie class, "_*Impl_Tie", does not exists or an
+ * instance of this class cannot be instantiated.
+ */
+ public void connect(ORB orb)
throws RemoteException
{
- if(delegate != null)
- delegate.connect(this, orb);
+ if (m_orb != null && orb != null)
+ {
+ if (m_orb.equals(orb))
+ throw new RemoteException("Stub " + this
+ + " is connected to another ORB, " + orb);
+ else
+ return;
+ }
+ m_orb = orb;
+ delegate.connect(this, orb);
}
/**
- * The following two routines are required by serialized form of Java API doc.
+ * Required by serialized form of Java API doc.
*/
- private void readObject(ObjectInputStream stream)
+ private void readObject(ObjectInputStream input)
throws IOException, ClassNotFoundException
{
- if(delegate != null)
- delegate.readObject(this, stream);
+ if (delegate instanceof StubDelegateImpl)
+ ((StubDelegateImpl) delegate).readObject(this, input, m_orb);
+ else
+ delegate.readObject(this, input);
}
- private void writeObject(ObjectOutputStream stream)
+ /**
+ * Required by serialized form of Java API doc.
+ */
+ private void writeObject(ObjectOutputStream output)
throws IOException
{
- if(delegate != null)
- delegate.writeObject(this, stream);
- }
+ // The m_orb in this case may be either known or not.
+ if (delegate instanceof StubDelegateImpl)
+ ((StubDelegateImpl) delegate).writeObject(this, output, m_orb);
+ else
-}
+ delegate.writeObject(this, output);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/StubDelegate.java b/libjava/classpath/javax/rmi/CORBA/StubDelegate.java
index 5c00a038f0c..cdf76e841c3 100644
--- a/libjava/classpath/javax/rmi/CORBA/StubDelegate.java
+++ b/libjava/classpath/javax/rmi/CORBA/StubDelegate.java
@@ -1,5 +1,5 @@
-/* StubDelegate.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* StubDelegate.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,28 +38,66 @@ exception statement from your version. */
package javax.rmi.CORBA;
+import org.omg.CORBA.ORB;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+
import java.rmi.RemoteException;
-//import org.omg.CORBA.ORB;
+/**
+ * A delegate, implementing the functionality, provided by the {@link Stub}.
+ * The default delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.StubClass" to the name of the alternative class that must
+ * implement StubDelegate.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public interface StubDelegate
{
-
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- void connect(Stub self, javax.rmi.ORB orb)
+ /**
+ * <p>
+ * Makes the stub ready for remote communication using the given ORB.
+ * </p>
+ * <p>
+ * It is frequently easier to call {@link PortableRemoteObject#connect} rather
+ * than this method.
+ * </p>
+ *
+ * @param orb the ORB where the Stub must be connected.
+ *
+ * @throws RemoteException if the stub is already connected to some other ORB.
+ * If the stub is already connected to the ORB that was passed as parameter,
+ * the method returns without action.
+ */
+ void connect(Stub self, ORB orb)
throws RemoteException;
+ /**
+ * The objects stubs are equal if they refer the same remote object.
+ */
boolean equals(Stub self, Object obj);
+ /**
+ * Get the hashcode fo this delegate.
+ */
int hashCode(Stub self);
+ /**
+ * Read this stub from the object input stream.
+ */
void readObject(Stub self, ObjectInputStream s)
throws IOException, ClassNotFoundException;
- String toString(Stub self);
-
+ /**
+ * Write this stub to the object output stream.
+ */
void writeObject(Stub self, ObjectOutputStream s)
throws IOException;
-}
+
+ /**
+ * Get the string representation of this stub.
+ */
+ String toString(Stub self);
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/SystemException.java b/libjava/classpath/javax/rmi/CORBA/SystemException.java
deleted file mode 100644
index f8afdc35e35..00000000000
--- a/libjava/classpath/javax/rmi/CORBA/SystemException.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package javax.rmi.CORBA;
-
-/** XXX - Stub till we have org.omg.CORBA */
-public class SystemException extends Exception { }
diff --git a/libjava/classpath/javax/rmi/CORBA/Tie.java b/libjava/classpath/javax/rmi/CORBA/Tie.java
index 4b1984c58e9..b8611838822 100644
--- a/libjava/classpath/javax/rmi/CORBA/Tie.java
+++ b/libjava/classpath/javax/rmi/CORBA/Tie.java
@@ -1,5 +1,5 @@
-/* Tie.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* Tie.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,28 +35,91 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.rmi.CORBA;
+import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
-//import org.omg.CORBA.ORB;
-//import org.omg.CORBA.portable.InvokeHandler;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.InvokeHandler;
-public interface Tie // XXX extends InvokeHandler
+/**
+ * <p>
+ * A Tie serves as a CORBA Servant or implementation base. It is connected to
+ * the ORB on a server side, providing the implementation of the required
+ * functionality. ORB access this implementation using {@link InvokeHandler}
+ * ._invoke(..). All such calls are finally delegated to the object, returned by
+ * {@link #getTarget()}.
+ * </p>
+ * <p>
+ * Ties are generated from implementations (name pattern *Impl) and have the
+ * name pattern _*Impl_Tie, for instance:<br>
+ * <code>rmic -keep -iiop -poa -always gnu.testlet.java.rmi.Remote.CalculatorImpl</code>
+ * </p>
+ * <p>
+ * Ties should normally be derived from the
+ * {@link org.omg.PortableServer.Servant}. Such ties are generated by
+ * <code>rmic</code> compiler using <code>-poa</code> key. Ties can be also
+ * derived from {@link org.omg.CORBA_2_3.portable.ObjectImpl}.
+ * </p>
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public interface Tie
+ extends InvokeHandler
{
-
- void deactivate();
-
+ /**
+ * Get the invocation target, where all method calls should be delegated.
+ *
+ * @return the object, implementing methods, defined in the interface being
+ * served by this Tie.
+ */
Remote getTarget();
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- javax.rmi.ORB orb();
-
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- void orb(javax.rmi.ORB orb);
-
+ /**
+ * Set the invocation target, where all method calls should be delegated.
+ *
+ * @param target the object, implementing methods, defined in the interface
+ * being served by this Tie. The code, produced by a typical rmic compiler
+ * usually requires the target to be an instance of the implementation from
+ * that the Tie was generated.
+ *
+ * @throws ClassCastException if the passed parameter is not an instance of
+ * the implementation from that the Tie was generated.
+ */
void setTarget(Remote target);
-
- // XXX Object -> org.omg.CORBA.Object
- Object thisObject();
-}
+
+ /**
+ * Get the ORB to that this Tie is connected.
+ *
+ * @see org.omg.PortableServer.Servant#_orb
+ */
+ ORB orb();
+
+ /**
+ * Connect this Tie to the given ORB.
+ */
+ void orb(ORB orb);
+
+ /**
+ * Get the object that delegates calls to this tie.
+ *
+ * @see org.omg.PortableServer.Servant#_this_object
+ */
+ org.omg.CORBA.Object thisObject();
+
+ /**
+ * Deactivate this Tie. The tie is normally deactivated using POA mechanisms.
+ * Depending on the POA policies, it may be possible to activate the Tie
+ * again. The ties that are not derived from
+ * {@link org.omg.PortableServer.Servant} deactivate themselves by
+ * {@link ORB.disconnect}.
+ *
+ * @throws NoSuchObjectException if there are no objects served by this Tie,
+ * or if the these objects are already deactivated.
+ *
+ * @see org.omg.PortableServer.POA#deactivate_object
+ */
+ void deactivate()
+ throws NoSuchObjectException;
+
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/Util.java b/libjava/classpath/javax/rmi/CORBA/Util.java
index 0370cce83a2..cfd3d7bd686 100644
--- a/libjava/classpath/javax/rmi/CORBA/Util.java
+++ b/libjava/classpath/javax/rmi/CORBA/Util.java
@@ -1,5 +1,5 @@
-/* Util.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* Util.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,148 +38,379 @@ exception statement from your version. */
package javax.rmi.CORBA;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.INV_OBJREF;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.OMGVMCID;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
import gnu.javax.rmi.CORBA.DelegateFactory;
-import gnu.javax.rmi.CORBA.GetDelegateInstanceException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.rmi.AccessException;
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
+import java.rmi.ServerError;
+import java.rmi.ServerException;
+import java.rmi.UnexpectedException;
+import java.rmi.server.RMIClassLoader;
+
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+/**
+ * Provides utility methods used by stubs and ties to perform common operations.
+ * The functionality is forwarded to the enclosed UtilDelegate. This delegate
+ * can be altered by setting the system property "javax.rmi.CORBA.UtilClass" to
+ * the name of the alternative class that must implement {@link UtilDelegate}.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public class Util
{
+ /**
+ * The delegate, responsible for all functionality.
+ */
+ static UtilDelegate delegate = (UtilDelegate) DelegateFactory.getInstance(DelegateFactory.UTIL);
- private static UtilDelegate delegate;
- static
- {
- try
- {
- delegate = (UtilDelegate)DelegateFactory.getInstance("Util");
- }
- catch(GetDelegateInstanceException e)
- {
- delegate = null;
- }
- }
-
+ /**
+ * Prevents this class from being instantiated.
+ */
private Util()
{
}
- // XXX - javax.rmi.ORB -> org.omg.CORBA.ORB
- public static Object copyObject(Object obj, javax.rmi.ORB orb)
+ /**
+ * Used by local stubs to create a copy of the object. The object must be
+ * Serializable for this operation to succeed. Strings are not copied and
+ * 1D-3D string arrays are only cloned.
+ */
+ public static java.lang.Object copyObject(java.lang.Object object, ORB orb)
throws RemoteException
{
- if(delegate != null)
- return delegate.copyObject(obj, orb);
- else
- return null;
+ return delegate.copyObject(object, orb);
}
- // XXX - javax.rmi.ORB -> org.omg.CORBA.ORB
- public static Object[] copyObjects(Object obj[], javax.rmi.ORB orb)
+ /**
+ * Used by local stubs to create a multiple copies of the object, preserving
+ * sharing accross the parameters if necessary.
+ */
+ public static java.lang.Object[] copyObjects(java.lang.Object[] object,
+ ORB orb)
throws RemoteException
{
- if(delegate != null)
- return delegate.copyObjects(obj, orb);
- else
- return null;
+ return delegate.copyObjects(object, orb);
}
-
+
+ /**
+ * Get the value handler that Serializes Java objects to and from CDR (GIOP)
+ * streams.
+ *
+ * When using the default Util implementation, the class of the returned
+ * handler can be altered by setting by setting the system property
+ * "javax.rmi.CORBA.ValueHandlerClass" to the name of the alternative class
+ * that must implement {@link ValueHandler}.
+ */
public static ValueHandler createValueHandler()
{
- if(delegate != null)
- return delegate.createValueHandler();
- else
- return null;
+ return delegate.createValueHandler();
}
-
+
+ /**
+ * This call is finally delegated to {@link RMIClassLoader#getClassAnnotation};
+ */
public static String getCodebase(Class clz)
{
- if(delegate != null)
- return delegate.getCodebase(clz);
- else
- return null;
+ return delegate.getCodebase(clz);
}
-
+
+ /**
+ * Get the Tie that handles invocations on the given target. If the target/Tie
+ * pair has not been previously registered using {@link #registerTarget},
+ * this method tries to locate a tie class by the name pattern. If this
+ * succeeds, the tie-target pair is also registered.
+ *
+ * @return the Tie.
+ */
public static Tie getTie(Remote target)
{
- if(delegate != null)
- return delegate.getTie(target);
- else
- return null;
+ return delegate.getTie(target);
}
+ /**
+ * Checks if the given stub is local. The implementation it delegates call to
+ * {@link ObjectImpl#_is_local().
+ *
+ * @param stub a stub to check.
+ * @return true if the stub is local, false otherwise.
+ *
+ * @throws RemoteException if the {@link ObjectImpl#_is_local()} throws a
+ * {@link org.omg.CORBA.SystemException}.
+ */
public static boolean isLocal(Stub stub)
throws RemoteException
{
- if(delegate != null)
- return delegate.isLocal(stub);
- else
- return false;
+ return delegate.isLocal(stub);
}
- public static Class loadClass(String className, String remoteCodebase, ClassLoader loader)
+ /**
+ * Load the class. The method uses class loaders from the call stact first. If
+ * this fails, the further behaviour depends on the System Property
+ * "java.rmi.server.useCodebaseOnly" with default value "false".
+ *
+ * <ul>
+ * <li>If remoteCodebase is non-null and useCodebaseOnly is "false" then call
+ * java.rmi.server.RMIClassLoader.loadClass (remoteCodebase, className)</li>
+ * <li> If remoteCodebase is null or useCodebaseOnly is true then call
+ * java.rmi.server.RMIClassLoader.loadClass(className)</li>
+ * <li>If a class is still not successfully loaded and the loader != null
+ * then try Class.forName(className, false, loader). </li>
+ * </ul>
+ *
+ * @param className the name of the class.
+ * @param remoteCodebase the codebase.
+ * @param loader the class loader.
+ * @return the loaded class.
+ *
+ * @throws ClassNotFoundException of the class cannot be loaded.
+ */
+ public static Class loadClass(String className, String remoteCodebase,
+ ClassLoader loader)
throws ClassNotFoundException
{
- if(delegate != null)
- return delegate.loadClass(className, remoteCodebase, loader);
- else
- throw new ClassNotFoundException(className + ": delegate == null");
- }
-
- public static RemoteException mapSystemException(SystemException ex)
- {
- if(delegate != null)
- return delegate.mapSystemException(ex);
- else
- return null;
+ return delegate.loadClass(className, remoteCodebase, loader);
}
- public static Object readAny(InputStream in)
+ /**
+ * Converts CORBA {@link SystemException} into RMI {@link RemoteException}.
+ * The exception is converted as defined in the following table:
+ * <p>
+ * <table border = "1">
+ * <tr>
+ * <th>CORBA Exception</th>
+ * <th>RMI Exception</th>
+ * </tr>
+ * <tr>
+ * <td>{@link COMM_FAILURE}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INV_OBJREF}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link NO_PERMISSION}</td>
+ * <td>{@link AccessException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link MARSHAL}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link BAD_PARAM} (all other cases)</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OBJECT_NOT_EXIST}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_REQUIRED}</td>
+ * <td>{@link TransactionRequiredException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_ROLLEDBACK}</td>
+ * <td>{@link TransactionRolledbackException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INVALID_TRANSACTION}</td>
+ * <td>{@link InvalidTransactionException}</td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="lightgray">Any other {@link SystemException}</td>
+ * <td bgcolor="lightgray">{@link RemoteException}</td>
+ * </tr>
+ * </table>
+ * </p>
+ * <p>
+ * The exception detailed message always consists of
+ * <ol>
+ * <li>the string "CORBA "</li>
+ * <li>the CORBA name of the system exception</li>
+ * <li>single space</li>
+ * <li>the hexadecimal value of the system exception's minor code, preceeded
+ * by 0x (higher bits contain {@link OMGVMCID}).</li>
+ * <li>single space</li>
+ * <li>the {@link CompletionStatus} of the exception: "Yes", "No" or "Maybe".</li>
+ * </ol>
+ * The subsequent content is not part of the official RMI-IIOP standart and is
+ * added for compatibility with Sun's implementation:
+ * <ol>
+ * <li>the phrase "<code>; nested exception is: <i>(line feed)(tab)</i></code>"</li>
+ * <li>the full name of the mapped SystemException, as returned by
+ * Class.getName().</li>
+ * <li>the ": ".
+ * <li>the value, returned by .getMessage() of the passed parameter.</li>
+ * </ol>
+ * <p>
+ * For instance, if the Internet connection was refused:
+ * </p><p>
+ * <code>CORBA COMM_FAILURE 0x535500C9 No</code>
+ * </p><p>
+ * The original CORBA exception is set as the cause of the RemoteException
+ * being created.
+ * </p>
+ */
+ public static RemoteException mapSystemException(SystemException ex)
{
- if(delegate != null)
- return delegate.readAny(in);
- else
- return null;
+ return delegate.mapSystemException(ex);
}
+ /**
+ * Register the Tie-target pair. As the Tie is a Servant, it can potentially
+ * be connected to several objects and hence may be registered with several
+ * targets.
+ */
public static void registerTarget(Tie tie, Remote target)
{
- if(delegate != null)
- delegate.registerTarget(tie, target);
+ delegate.registerTarget(tie, target);
}
-
+
+ /**
+ * Deactivate the associated Tie, if it is found and is not connected to other
+ * registered targets. Independing from the POA policies, the transparent
+ * reactivation will not be possible.
+ */
public static void unexportObject(Remote target)
+ throws NoSuchObjectException
{
- if(delegate != null)
- delegate.unexportObject(target);
+ delegate.unexportObject(target);
}
-
- public static RemoteException wrapException(Throwable orig)
+
+ /**
+ * Converts the exception that was thrown by the implementation method on a
+ * server side into RemoteException that can be transferred and re-thrown on a
+ * client side. The method converts exceptions as defined in the following
+ * table: <table border = "1">
+ * <tr>
+ * <th>Exception to map (or subclass)</th>
+ * <th>Maps into</th>
+ * </tr>
+ * <tr>
+ * <td>{@link Error}</td>
+ * <td>{@link ServerError}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RemoteException}</td>
+ * <td>{@link ServerException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link SystemException}</td>
+ * <td>wrapException({@link #mapSystemException})</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RuntimeException}</td>
+ * <td><b>rethrows</b></td>
+ * </tr>
+ * <tr>
+ * <td>Any other exception</td>
+ * <td>{@link UnexpectedException}</td>
+ * </tr>
+ * </table>
+ *
+ * @param ex an exception that was thrown on a server side implementation.
+ *
+ * @return the corresponding RemoteException unless it is a RuntimeException.
+ *
+ * @throws RuntimeException the passed exception if it is an instance of
+ * RuntimeException.
+ *
+ * @specnote It is the same behavior, as in Suns implementations 1.4.0-1.5.0.
+ */
+ public static RemoteException wrapException(Throwable exception)
{
- if(delegate != null)
- return delegate.wrapException(orig);
- else
- return null;
+ return delegate.wrapException(exception);
}
-
- public static void writeAbstractObject(OutputStream out, Object obj)
+
+ /**
+ * Write abstract interface to the CORBA output stream. The write format is
+ * matching CORBA abstract interface. Remotes and CORBA objects are written as
+ * objects, other classes are supposed to be value types and are written as
+ * such. {@link Remote}s are processed as defined in
+ * {@link #writeRemoteObject}. The written data contains discriminator,
+ * defining, that was written. Another method that writes the same content is
+ * {@link org.omg.CORBA_2_3.portable.OutputStream#write_abstract_interface(java.lang.Object)}.
+ *
+ * @param output a stream to write to, must be
+ * {@link org.omg.CORBA_2_3.portable.OutputStream}.
+ *
+ * @param object an object to write, must be CORBA object, Remote
+ */
+ public static void writeAbstractObject(OutputStream output,
+ java.lang.Object object)
{
- if(delegate != null)
- delegate.writeAbstractObject(out, obj);
+ delegate.writeAbstractObject(output, object);
}
-
- public static void writeAny(OutputStream out, Object obj)
+
+ /**
+ * Write the passed java object to the output stream in the form of the CORBA
+ * {@link Any}. This includes creating an writing the object {@link TypeCode}
+ * first. Such Any can be later read by a non-RMI-IIOP CORBA implementation
+ * and manipulated, for instance, by means, provided in
+ * {@link org.omg.DynamicAny.DynAny}. Depending from the passed value, this
+ * method writes CORBA object, value type or value box. For value types Null
+ * is written with the abstract interface, its typecode having repository id
+ * "IDL:omg.org/CORBA/AbstractBase:1.0" and the empty string name.
+ *
+ * @param output the object to write.
+ * @param object the java object that must be written in the form of the CORBA
+ * {@link Any}.
+ */
+ public static void writeAny(OutputStream output, java.lang.Object object)
{
- if(delegate != null)
- delegate.writeAny(out, obj);
+ delegate.writeAny(output, object);
}
-
- public static void writeRemoteObject(OutputStream out, Object obj)
+
+ /**
+ * Read Any from the input stream.
+ */
+ public static java.lang.Object readAny(InputStream input)
{
- if(delegate != null)
- delegate.writeRemoteObject(out, obj);
+ return delegate.readAny(input);
}
-}
+ /**
+ * Write the passed parameter to the output stream as CORBA object. If the
+ * parameter is an instance of Remote and not an instance of Stub, the method
+ * instantiates a suitable Tie, connects the parameter to this Tie and then
+ * connects that Tie to the ORB that is requested from the output stream. Then
+ * the object reference is written to the stream, making remote invocations
+ * possible (the ORB is started and activated, if required). This method is
+ * used in write_value(..) method group in
+ * {@link org.omg.CORBA_2_3.portable.OutputStream} and also may be called
+ * directly from generated Stubs and Ties.
+ *
+ * @param output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ public static void writeRemoteObject(OutputStream output,
+ java.lang.Object object)
+ {
+ delegate.writeRemoteObject(output, object);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java b/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
index deeb94f68b5..cacb925810b 100644
--- a/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
+++ b/libjava/classpath/javax/rmi/CORBA/UtilDelegate.java
@@ -1,5 +1,5 @@
-/* UtilDelegate.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+/* UtilDelegate.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,48 +38,273 @@ exception statement from your version. */
package javax.rmi.CORBA;
-import java.io.InputStream;
-import java.io.OutputStream;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.INV_OBJREF;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.OMGVMCID;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import java.rmi.AccessException;
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
-//import org.omg.CORBA.ORB;
-//import org.omg.CORBA.SystemException;
-//import org.omg.CORBA.portable.InputStream;
-//import org.omg.CORBA.portable.OutputStream;
+import java.rmi.ServerError;
+import java.rmi.ServerException;
+import java.rmi.UnexpectedException;
+
+import javax.transaction.InvalidTransactionException;
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+/**
+ * A delegate, implementing the functionality, provided by the {@link Util}.
+ *
+ * The default delegate can be altered by setting the system property
+ * "javax.rmi.CORBA.UtilClass" to the name of the alternative class that must
+ * implement this interface.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public interface UtilDelegate
{
+ /**
+ * Used by local stubs to create a copy of the object.
+ */
+ Object copyObject(Object obj, ORB orb)
+ throws RemoteException;
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- Object copyObject(Object obj, javax.rmi.ORB orb) throws RemoteException;
-
- // XXX javax.rmi.ORB -> org.omg.CORBA.ORB
- Object[] copyObjects(Object obj[], javax.rmi.ORB orb) throws RemoteException;
+ /**
+ * Used by local stubs to create a multiple copies of the object, preserving
+ * sharing accross the parameters if necessary.
+ */
+ Object[] copyObjects(Object[] obj, ORB orb)
+ throws RemoteException;
+ /**
+ * Get the value handler that Serializes Java objects to and from CDR (GIOP)
+ * streams.
+ */
ValueHandler createValueHandler();
-
+
String getCodebase(Class clz);
-
- Tie getTie(Remote target);
-
- boolean isLocal(Stub stub) throws RemoteException;
- Class loadClass(String className, String remoteCodebase,
- ClassLoader loader) throws ClassNotFoundException;
+ /**
+ * Checks if the given stub is local.
+ */
+ boolean isLocal(Stub stub)
+ throws RemoteException;
+
+ Class loadClass(String className, String remoteCodebase, ClassLoader loader)
+ throws ClassNotFoundException;
+ /**
+ * Converts CORBA {@link SystemException} into RMI {@link RemoteException}.
+ * The exception is converted as defined in the following table:
+ * <p>
+ * <table border = "1">
+ * <tr>
+ * <th>CORBA Exception</th>
+ * <th>RMI Exception</th>
+ * </tr>
+ * <tr>
+ * <td>{@link COMM_FAILURE}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INV_OBJREF}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link NO_PERMISSION}</td>
+ * <td>{@link AccessException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link MARSHAL}</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link BAD_PARAM} (all other cases)</td>
+ * <td>{@link MarshalException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link OBJECT_NOT_EXIST}</td>
+ * <td>{@link NoSuchObjectException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_REQUIRED}</td>
+ * <td>{@link TransactionRequiredException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link TRANSACTION_ROLLEDBACK}</td>
+ * <td>{@link TransactionRolledbackException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link INVALID_TRANSACTION}</td>
+ * <td>{@link InvalidTransactionException}</td>
+ * </tr>
+ * <tr>
+ * <td bgcolor="lightgray">Any other {@link SystemException}</td>
+ * <td bgcolor="lightgray">{@link RemoteException}</td>
+ * </tr>
+ * </table>
+ * </p>
+ * <p>
+ * The exception detailed message always consists of
+ * <ol>
+ * <li>the string "CORBA "</li>
+ * <li>the CORBA name of the system exception</li>
+ * <li>single space</li>
+ * <li>the hexadecimal value of the system exception's minor code, preceeded
+ * by 0x (higher bits contain {@link OMGVMCID}).</li>
+ * <li>single space</li>
+ * <li>the {@link CompletionStatus} of the exception: "Yes", "No" or "Maybe".</li>
+ * </ol>
+ * The subsequent content is not part of the official RMI-IIOP standart and is
+ * added for compatibility with Sun's implementation:
+ * <ol>
+ * <li>the phrase "<code>; nested exception is: <i>(line feed)(tab)</i></code>"</li>
+ * <li>the full name of the mapped SystemException, as returned by
+ * Class.getName().</li>
+ * <li>the ": ".
+ * <li>the value, returned by .getMessage() of the passed parameter.</li>
+ * </ol>
+ * <p>
+ * For instance, if the Internet connection was refused:
+ * </p><p>
+ * <code>CORBA COMM_FAILURE 0x535500C9 No</code>
+ * </p><p>
+ * The original CORBA exception is set as the cause of the RemoteException
+ * being created.
+ * </p>
+ */
RemoteException mapSystemException(SystemException ex);
- Object readAny(InputStream in);
+ /**
+ * Get the Tie that handles invocations on the given target. The target/Tie
+ * pair must be previously registered using {@link #registerTarget}.
+ *
+ * @return the Tie, or null if no such is known.
+ */
+ Tie getTie(Remote target);
+ /**
+ * Register the Tie-target pair.
+ */
void registerTarget(Tie tie, Remote target);
-
- void unexportObject(Remote target);
-
+
+ /**
+ * Deactivate the associated Tie, if it is found and is not connected to other
+ * registered targets.
+ */
+ void unexportObject(Remote target)
+ throws NoSuchObjectException;
+
+ /**
+ * Converts the exception that was thrown by the implementation method on a
+ * server side into RemoteException that can be transferred and re-thrown on a
+ * client side. The method converts exceptions as defined in the following
+ * table: <table border = "1">
+ * <tr>
+ * <th>Exception to map (or subclass)</th>
+ * <th>Maps into</th>
+ * </tr>
+ * <tr>
+ * <td>{@link Error}</td>
+ * <td>{@link ServerError}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RemoteException}</td>
+ * <td>{@link ServerException}</td>
+ * </tr>
+ * <tr>
+ * <td>{@link SystemException}</td>
+ * <td>wrapException({@link #mapSystemException})</td>
+ * </tr>
+ * <tr>
+ * <td>{@link RuntimeException}</td>
+ * <td><b>rethrows</b></td>
+ * </tr>
+ * <tr>
+ * <td>Any other exception</td>
+ * <td>{@link UnexpectedException}</td>
+ * </tr>
+ * </table>
+ *
+ * @param ex an exception that was thrown on a server side implementation.
+ *
+ * @return the corresponding RemoteException unless it is a RuntimeException.
+ *
+ * @throws RuntimeException the passed exception if it is an instance of
+ * RuntimeException.
+ *
+ * @specnote It is the same behavior, as in Suns implementations 1.4.0-1.5.0.
+ */
RemoteException wrapException(Throwable orig);
-
- void writeAbstractObject(OutputStream out, Object obj);
-
- void writeAny(OutputStream out, Object obj);
- void writeRemoteObject(OutputStream out, Object obj);
-}
+ /**
+ * Write the passed parameter to the output stream as CORBA object. If the
+ * parameter is an instance of Remote and not an instance of Stub, the method
+ * instantiates a suitable Tie, connects the parameter to this Tie and then
+ * connects that Tie to the ORB that is requested from the output stream. Then
+ * the object reference is written to the stream, making remote invocations
+ * possible. This method is used in write_value(..) method group in
+ * {@link org.omg.CORBA_2_3.portable.OutputStream} and also may be called
+ * directly from generated Stubs and Ties.
+ *
+ * @param output a stream to write to, must be
+ * org.omg.CORBA_2_3.portable.OutputStream
+ * @param object an object to write.
+ */
+ void writeRemoteObject(OutputStream output, Object obj);
+
+ /**
+ * Write abstract interface to the CORBA output stream. The write format is
+ * matching CORBA abstract interface. Remotes and CORBA objects are written as
+ * objects, other classes are supposed to be value types and are written as
+ * such. {@link Remote}s are processed as defined in
+ * {@link #writeRemoteObject}. The written data contains discriminator,
+ * defining, that was written. Another method that writes the same content is
+ * {@link org.omg.CORBA_2_3.portable.OutputStream#write_abstract_interface(java.lang.Object)}.
+ *
+ * @param output a stream to write to, must be
+ * {@link org.omg.CORBA_2_3.portable.OutputStream}.
+ *
+ * @param object an object to write, must be CORBA object, Remote
+ */
+ void writeAbstractObject(OutputStream output, Object object);
+
+ /**
+ * Write the passed java object to the output stream in the form of the CORBA
+ * {@link Any}. This includes creating an writing the object {@link TypeCode}
+ * first. Such Any can be later read by a non-RMI-IIOP CORBA implementation
+ * and manipulated, for instance, by means, provided in
+ * {@link org.omg.DynamicAny.DynAny}. Depending from the passed value, this
+ * method writes CORBA object, value type or value box. For value types Null
+ * is written with the abstract interface, its typecode having repository id
+ * "IDL:omg.org/CORBA/AbstractBase:1.0" and the empty string name.
+ *
+ * @param output the object to write.
+ * @param object the java object that must be written in the form of the CORBA
+ * {@link Any}.
+ */
+ void writeAny(OutputStream output, Object object);
+
+ /**
+ * Read Any from the input stream.
+ */
+ Object readAny(InputStream input);
+
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/ValueHandler.java b/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
index f26e75b2a86..c4213efdcfb 100644
--- a/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
+++ b/libjava/classpath/javax/rmi/CORBA/ValueHandler.java
@@ -1,5 +1,5 @@
-/* ValueHandler.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* ValueHandler.java --
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,28 +38,93 @@ exception statement from your version. */
package javax.rmi.CORBA;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.io.Serializable;
-//import org.omg.CORBA.portable.InputStream;
-//import org.omg.CORBA.portable.OutputStream;
-//import org.omg.SendingContext.RunTime;
+import org.omg.CORBA.CustomMarshal;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.SendingContext.RunTime;
+
+/**
+ * Serializes Java objects to and from CDR (GIOP) streams. The working instance
+ * of the value handler is returned by {@link Util#createValueHandler} and can
+ * be altered by setting the system property "javax.rmi.CORBA.ValueHandlerClass"
+ * to the name of the alternative class that must implement ValueHandler.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public interface ValueHandler
{
-
+ /**
+ * Get CORBA repository Id for the given java class.
+ *
+ * The syntax of the repository ID is the initial ?RMI:?, followed by the Java
+ * class name, followed by name, followed by a hash code string, followed
+ * optionally by a serialization version UID string.
+ *
+ * For Java identifiers that contain illegal OMG IDL identifier characters
+ * such as ?$?, any such illegal characters are replaced by ?\U? followed by
+ * the 4 hexadecimal characters (in upper case) representing the Unicode
+ * value.
+ *
+ * @param clz a class for that the repository Id is required.
+ *
+ * @return the class repository id.
+ */
String getRMIRepositoryID(Class clz);
-
- // XXX Runtime -> RunTime
- Runtime getRunTimeCodeBase();
-
+
+ /**
+ * Returns the CodeBase for this ValueHandler.
+ *
+ * @return the codebase.
+ */
+ RunTime getRunTimeCodeBase();
+
+ /**
+ * Indicates that the given class is responsible itself for writing its
+ * content to the stream. Such classes implement either {@link Streamable}
+ * (default marshalling, generated by IDL-to-java compiler) or
+ * {@link CustomMarshal} (the user-programmed marshalling).
+ *
+ * @param clz the class being checked.
+ * @return true if the class supports custom or default marshalling, false
+ * otherwise.
+ */
boolean isCustomMarshaled(Class clz);
-
- // XXX Runtime -> RunTime
+
+ /**
+ * Read value from the CORBA input stream in the case when the value is not
+ * Streamable or CustomMarshall'ed. The fields of the class being written will
+ * be accessed using reflection.
+ *
+ * @param in a CORBA stream to read.
+ * @param offset the current position in the input stream.
+ * @param clz the type of value being read.
+ * @param repositoryID the repository Id of the value being read.
+ * @param sender the sending context that should provide data about the
+ * message originator.
+ *
+ * @return the object, extracted from the stream.
+ */
Serializable readValue(InputStream in, int offset, Class clz,
- String repositoryID, Runtime sender);
-
+ String repositoryID, RunTime sender);
+
+ /**
+ * When the value provides the writeReplace method, the result of this method
+ * is written. Otherwise, the value itself is written.
+ *
+ * @param the value that should be written to the stream.
+ *
+ * @return the value that will be actually written to the stream.
+ */
Serializable writeReplace(Serializable value);
-
+
+ /**
+ * Write value to CORBA output stream using java senmatics.
+ *
+ * @param out a stream to write into.
+ * @param value a java object to write.
+ */
void writeValue(OutputStream out, Serializable value);
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java b/libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java
new file mode 100644
index 00000000000..4db65c1dbfd
--- /dev/null
+++ b/libjava/classpath/javax/rmi/CORBA/ValueHandlerMultiFormat.java
@@ -0,0 +1,94 @@
+/* ValueHandlerMultiFormat.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.rmi.CORBA;
+
+import org.omg.CORBA.portable.OutputStream;
+
+import java.io.Serializable;
+
+/**
+ * This interface extends the previous ValueHandler, supporting various stream
+ * format versions. The {@link ValueHandler} can be casted into this interface
+ * to access additional features.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ValueHandlerMultiFormat
+ extends ValueHandler
+{
+ /**
+ * Get the maximal supported version for the value types, supported by
+ * this value handler. The versions are integer numbers, the currently valid
+ * values being 1 and 2.
+ *
+ * These two versions differ in how the additional data, stored by the
+ * writeObject method, are encoded.
+ * <ul>
+ * <li> For version 1 (GNU Classpath default), that data (if present) are
+ * written "as is". </li>
+ * <li>For version 2, this data fragment is enclosed within a CDR custom
+ * valuetype with no codebase and repository Id "RMI:org.omg.custom.<class>"
+ * where <class> is the fully-qualified name of the class whose writeObject
+ * method is being invoked. If the object does not write any data via
+ * writeObject method, the null valuetype (0x0) must be written.</li>
+ * </ul>
+ * As the version number is part of the value type record, there is no need
+ * to the format control during the reading.
+ *
+ * @return the maximal supported version.
+ */
+ byte getMaximumStreamFormatVersion();
+
+ /**
+ * Write the value type to the output stream using the given format version.
+ * The older method {@link ValueHandler#writeValue} always uses the version 1.
+ *
+ * @param output the stream, where the value should be written, must implement
+ * {@link ValueOutputStream}.
+ * @param value the value that should be written.
+ * @param version the version of the format that must be used to write the
+ * value.
+ *
+ * @throws BAD_PARAM if the version number is less than 1 or greater than the
+ * maximal supported version.
+ */
+ void writeValue(OutputStream output, Serializable value, byte version);
+}
diff --git a/libjava/classpath/javax/rmi/CORBA/package.html b/libjava/classpath/javax/rmi/CORBA/package.html
index f5a5ac758f9..6014c8c8533 100644
--- a/libjava/classpath/javax/rmi/CORBA/package.html
+++ b/libjava/classpath/javax/rmi/CORBA/package.html
@@ -1,5 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- package.html - describes classes in javax.rmi.CORBA package.
+<!-- package.html - describes classes in javax.rmi package.
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,37 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.rmi.CORBA</title></head>
<body>
-<p></p>
-
+<p>
+Java RMI over IIOP combines RMI technology with CORBA technology. Like plain RMI,
+RMI over IIOP allows to work completely in the Java programming language
+(no IDL). When CORBA needs a separate helper class for each structure being
+passed, RMI over IIOP only needs stubs and ties for the objects that are remotely
+accessible. As a result, development with RMI-IIOP is easier. However the
+specialised pure CORBA helpers needs no reflection to transfer they structures
+and hence may be faster than methods, used by both RMI-IIOP and plain RMI.
+</p><p>
+Like RMI, RMI over IIOP provides flexibility by allowing to pass any serializable
+Java object (Objects By Value) between application components. A certain
+"imaginary IDL" is automatically supposed; this IDL can be explicitly generated
+and later used to interoperate with non-java application.
+</p><p>
+Like CORBA, RMI over IIOP is based on open standards defined with the
+participation of hundredsof vendors and users in the OMG. It uses IIOP
+communication protocol that provides much better interoperability with other
+programming languages.
+</p><p>
+With RMI/IIOP you can use advanced CORBA features: multiple objects per servant
+and servants per object, servant activators and locators, servant, client and
+ior interceptors, CORBA naming service, various ORB policies, stringified object
+references and so on. This functionality is based on CORBA value type standard.
+RMI/IIOP supports (and GNU Classpath implements) transferring of the arbitrary
+connected object graphs (graph flattenning).
+</p><p>
+GNU Classpath RMI-IIOP functionality is implemented as described in
+OMG formal/03-09-04 (IDL to Java mapping v1.3). Value types are written as
+described in formal/04-03-12 (CORBA 3.0.3).
+</p>
+@author Wu Gansha (gansha.wu@intel.com), headers.
+@author Audrius Meskauskas (AudriusA@Bioinformatics.org), implementation.
</body>
</html>
diff --git a/libjava/classpath/javax/rmi/ORB.java b/libjava/classpath/javax/rmi/ORB.java
deleted file mode 100644
index be7a894e65a..00000000000
--- a/libjava/classpath/javax/rmi/ORB.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package javax.rmi;
-
-/** XXX - Stub till we have org.omg.CORBA */
-public class ORB { }
diff --git a/libjava/classpath/javax/rmi/PortableRemoteObject.java b/libjava/classpath/javax/rmi/PortableRemoteObject.java
index 5e5d1fd29d7..5bb6b112613 100644
--- a/libjava/classpath/javax/rmi/PortableRemoteObject.java
+++ b/libjava/classpath/javax/rmi/PortableRemoteObject.java
@@ -1,5 +1,5 @@
-/* PortableRemoteObject.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* PortableRemoteObject.java --
+ Copyright (C) 2004, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,77 +39,190 @@ exception statement from your version. */
package javax.rmi;
import gnu.javax.rmi.CORBA.DelegateFactory;
-import gnu.javax.rmi.CORBA.GetDelegateInstanceException;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import javax.rmi.CORBA.PortableRemoteObjectDelegate;
-
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+
+/**
+ * <p>
+ * An utility class for RMI/IDL server side object implementations. Server side
+ * implementation objects may inherit from this class, but this is not
+ * mandatory, as the needed methds are static. Server side implementations may
+ * choose to inherit from {@link ObjectImpl} or {@link Servant} instead.
+ * </p>
+ * <p>
+ * The functionality of methods in this class is forwarded to the enclosed
+ * PortableRemoteObjectDelegate. This delegate can be altered by setting the
+ * system property "javax.rmi.CORBA.PortableRemoteObjectClass" to the name of
+ * the alternative class that must implement
+ * {@link PortableRemoteObjectDelegate}.
+ * </p>
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
public class PortableRemoteObject
- implements Remote /* why doc doesn't say should implement Remote */
{
-
- private static PortableRemoteObjectDelegate delegate;
- static
- {
- try
- {
- delegate = (PortableRemoteObjectDelegate)DelegateFactory.getInstance
- ("PortableRemoteObject");
- }
- catch(GetDelegateInstanceException e)
- {
- e.printStackTrace();
- delegate = null;
- }
- }
-
+ /**
+ * A delegate where the functionality is forwarded.
+ */
+ static PortableRemoteObjectDelegate delegate = (PortableRemoteObjectDelegate) DelegateFactory.getInstance(DelegateFactory.PORTABLE_REMOTE_OBJECT);
+
+ /**
+ * The protected constructor calls {@link exportObject} (this).
+ *
+ * @throws RemoteException if the exportObject(this) throws one.
+ */
protected PortableRemoteObject()
throws RemoteException
{
- if(delegate != null)
- exportObject((Remote)this);
+ exportObject((Remote) this);
}
+ /**
+ * <p>
+ * Makes the remote object <code>a_target</code> ready for remote
+ * communication using the same communications runtime as for the passed
+ * <code>a_source</code> parameter. The a_target is connected to the same
+ * ORB (and, if applicable, to the same {@link POA}) as the a_source.
+ *
+ * @param a_target the target to connect to ORB, must be an instance of either
+ * {@link ObjectImpl} (Stubs and old-style ties) or {@link Tie}.
+ *
+ * @param a_source the object, providing the connection information, must be
+ * an instance of either {@link ObjectImpl} (Stubs and old-style ties) or
+ * {@link Servant} (the next-generation Ties supporting {@link POA}).
+ *
+ * @throws RemoteException if the target is already connected to another ORB.
+ */
public static void connect(Remote target, Remote source)
throws RemoteException
{
- if(delegate != null)
- delegate.connect(target, source);
+ delegate.connect(target, source);
}
-
- public static void exportObject(Remote obj)
+
+ /**
+ * <p>
+ * Makes a server object ready for remote calls. The subclasses of
+ * PortableRemoteObject do not need to call this method, as it is called by
+ * the constructor.
+ * </p>
+ * <p>
+ * This method only creates a tie object and caches it for future usage. The
+ * created tie does not have a delegate or an ORB associated.
+ * </p>
+ *
+ * @param object the object to export.
+ *
+ * @throws RemoteException if export fails due any reason.
+ */
+ public static void exportObject(Remote object)
throws RemoteException
{
- if(delegate != null)
- delegate.exportObject(obj);
+ delegate.exportObject(object);
}
- public static Object narrow(Object narrowFrom, Class narrowTo)
+ /**
+ * Narrows the passed object to conform to the given interface or IDL type. In
+ * RMI-IIOP, this method replaces the narrow(org.omg.CORBA.Object) method that
+ * was present in the CORBA Helpers. This method frequently returns different
+ * instance and cannot be replaced by the direct cast. The typical narrowing
+ * cases (all supported by GNU Classpath) are:
+ * <ul>
+ * <li>A CORBA object (for instance, returned by the
+ * {@link ORB#string_to_object} or from the naming service) can be narrowed
+ * into interface, derived from Remote. The method will try to locate an
+ * appropriate {@link Stub} by the name pattern (_*_Stub). If the object being
+ * narrowed is connected to an ORB, the returned instance will inherit that
+ * connection, representing the same remote (or local) object, but now with
+ * the possibility to invoke remote methods. </li>
+ * <li>A CORBA object may be directly narrowed into the appropriate
+ * {@link Stub} class, if it is and passed as a second parameter. This allows
+ * to use non-standard stubs without parameterless constructors.</li>
+ * <li>Any two classes, derived from the {@link ObjectImpl} (may be Stub's)
+ * can be narrowed one into another (a delegate is transferred). </li>
+ * <li>An implementation of Remote can be narrowed into {@link Tie} that can
+ * later connected to an ORB, making the methods accessible remotely. The
+ * Remote being narrowed normally provides a local implementation, but you can
+ * also narrow remote Stub, creating "forwarding Tie".</li>
+ * <li>null is narrowed into null regardless of the second parameter.</li>
+ * <li>A {@link Tie} can be narrowed into Remote, representing the
+ * implementation for this Tie (if one is set).</li>
+ * </ul>
+ *
+ * @param object the object like CORBA Object, Stub or Remote that must be
+ * narrowed to the given interface.
+ *
+ * @param narrowToInstaceOf the class of the interface to that the object must
+ * be narrowed.
+ *
+ * @return On success, an object of type narrowTo or null, if narrowFrom =
+ * null.
+ *
+ * @throws ClassCastException if no narrowing is possible.
+ */
+ public static Object narrow(Object object, Class narrowToInstaceOf)
throws ClassCastException
{
- if(delegate != null)
- return delegate.narrow(narrowFrom, narrowTo);
- else
- return null;
+ return delegate.narrow(object, narrowToInstaceOf);
}
- public static Remote toStub(Remote obj)
+ /**
+ * <p>
+ * Takes a server implementation object (name pattern *imp) and returns a stub
+ * object that can be used to access that server object (target), name
+ * (pattern _*_Stub).
+ *
+ * The returned stub is not connected to any ORB and must be explicitly
+ * connected using {@link #connect}.
+ * </p>
+ * <p>
+ * The method signature prevents it from returning stubs that does not
+ * implement Remote (ClassCastException will be thrown).
+ * </p>
+ *
+ * @param target a server side object implementation.
+ * @return a stub object that can be used to access that server object.
+ *
+ * @throws NoSuchObjectException if a stub class cannot be located by supposed
+ * name pattern, or an instance of stub fails to be instantiated.
+ *
+ * @throws ClassCastException if the stub class can be located, but it does
+ * not inherit from Remote.
+ *
+ * @throws BAD_PARAM if the name of the passed class does not match the
+ * implementation name pattern (does not end by 'Impl').
+ */
+ public static Remote toStub(Remote targetImpl)
throws NoSuchObjectException
{
- if(delegate != null)
- return delegate.toStub(obj);
- else
- return null;
+ return delegate.toStub(targetImpl);
}
- public static void unexportObject(Remote obj)
+ /**
+ * Deregister a currently exported server object from the ORB runtimes. The
+ * object to becomes available for garbage collection. This is usually
+ * impemented via {@link Util#unexportObject}
+ *
+ * @param object the object to unexport.
+ *
+ * @throws NoSuchObjectException if the passed object is not currently
+ * exported.
+ */
+ public static void unexportObject(Remote object)
throws NoSuchObjectException
{
- if(delegate != null)
- delegate.unexportObject(obj);
+ delegate.unexportObject(object);
}
-
-}
+} \ No newline at end of file
diff --git a/libjava/classpath/javax/rmi/package.html b/libjava/classpath/javax/rmi/package.html
index febf59bd61c..6014c8c8533 100644
--- a/libjava/classpath/javax/rmi/package.html
+++ b/libjava/classpath/javax/rmi/package.html
@@ -37,10 +37,40 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. -->
<html>
-<head><title>GNU Classpath - javax.rmi</title></head>
+<head><title>GNU Classpath - javax.rmi.CORBA</title></head>
<body>
-<p></p>
-
+<p>
+Java RMI over IIOP combines RMI technology with CORBA technology. Like plain RMI,
+RMI over IIOP allows to work completely in the Java programming language
+(no IDL). When CORBA needs a separate helper class for each structure being
+passed, RMI over IIOP only needs stubs and ties for the objects that are remotely
+accessible. As a result, development with RMI-IIOP is easier. However the
+specialised pure CORBA helpers needs no reflection to transfer they structures
+and hence may be faster than methods, used by both RMI-IIOP and plain RMI.
+</p><p>
+Like RMI, RMI over IIOP provides flexibility by allowing to pass any serializable
+Java object (Objects By Value) between application components. A certain
+"imaginary IDL" is automatically supposed; this IDL can be explicitly generated
+and later used to interoperate with non-java application.
+</p><p>
+Like CORBA, RMI over IIOP is based on open standards defined with the
+participation of hundredsof vendors and users in the OMG. It uses IIOP
+communication protocol that provides much better interoperability with other
+programming languages.
+</p><p>
+With RMI/IIOP you can use advanced CORBA features: multiple objects per servant
+and servants per object, servant activators and locators, servant, client and
+ior interceptors, CORBA naming service, various ORB policies, stringified object
+references and so on. This functionality is based on CORBA value type standard.
+RMI/IIOP supports (and GNU Classpath implements) transferring of the arbitrary
+connected object graphs (graph flattenning).
+</p><p>
+GNU Classpath RMI-IIOP functionality is implemented as described in
+OMG formal/03-09-04 (IDL to Java mapping v1.3). Value types are written as
+described in formal/04-03-12 (CORBA 3.0.3).
+</p>
+@author Wu Gansha (gansha.wu@intel.com), headers.
+@author Audrius Meskauskas (AudriusA@Bioinformatics.org), implementation.
</body>
</html>
diff --git a/libjava/classpath/javax/security/auth/Subject.java b/libjava/classpath/javax/security/auth/Subject.java
index 4e35a645ddb..1659c6425fe 100644
--- a/libjava/classpath/javax/security/auth/Subject.java
+++ b/libjava/classpath/javax/security/auth/Subject.java
@@ -1,5 +1,5 @@
/* Subject.java -- a single entity in the system.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -385,19 +385,19 @@ public final class Subject implements Serializable
// Constructors.
// -----------------------------------------------------------------------
- SecureSet (final Subject subject, final int type, final Collection elements)
+ SecureSet (final Subject subject, final int type, final Collection inElements)
{
this (subject, type);
- for (Iterator it = elements.iterator(); it.hasNext(); )
+ for (Iterator it = inElements.iterator(); it.hasNext(); )
{
Object o = it.next();
if (type == PRINCIPALS && !(o instanceof Principal))
{
throw new IllegalArgumentException(o+" is not a Principal");
}
- if (!elements.contains (o))
+ if (!this.elements.contains (o))
{
- elements.add (o);
+ this.elements.add (o);
}
}
}
@@ -511,7 +511,7 @@ public final class Subject implements Serializable
public synchronized boolean contains (final Object element)
{
- return elements.remove (element);
+ return elements.contains (element);
}
public boolean removeAll (final Collection c)
diff --git a/libjava/classpath/javax/security/auth/SubjectDomainCombiner.java b/libjava/classpath/javax/security/auth/SubjectDomainCombiner.java
index 94a7160eb18..927e7479df6 100644
--- a/libjava/classpath/javax/security/auth/SubjectDomainCombiner.java
+++ b/libjava/classpath/javax/security/auth/SubjectDomainCombiner.java
@@ -1,5 +1,5 @@
/* SubjectDomainCombiner.java -- domain combiner for Subjects.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,8 +67,9 @@ public class SubjectDomainCombiner implements DomainCombiner
final ProtectionDomain[] assigned)
{
LinkedList domains = new LinkedList();
- Principal[] principals =
- (Principal[]) subject.getPrincipals().toArray (new Principal[0]);
+ Principal[] principals = null;
+ if (subject != null)
+ principals = (Principal[]) subject.getPrincipals().toArray (new Principal[0]);
if (current != null)
{
for (int i = 0; i < current.length; i++)
diff --git a/libjava/classpath/javax/security/auth/login/Configuration.java b/libjava/classpath/javax/security/auth/login/Configuration.java
index 1e0d272f19e..eb5e4a81979 100644
--- a/libjava/classpath/javax/security/auth/login/Configuration.java
+++ b/libjava/classpath/javax/security/auth/login/Configuration.java
@@ -67,29 +67,7 @@ public abstract class Configuration
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkPermission (new AuthPermission ("getLoginConfiguration"));
- if (config == null)
- {
- String conf = (String) AccessController.doPrivileged
- (new PrivilegedAction()
- {
- public Object run()
- {
- return Security.getProperty ("login.configuration.provider");
- }
- });
- try
- {
- if (conf != null)
- config = (Configuration) Class.forName (conf).newInstance();
- else
- config = new NullConfiguration();
- }
- catch (Exception x)
- {
- config = new NullConfiguration();
- }
- }
- return config;
+ return getConfig();
}
public static synchronized void setConfiguration (Configuration config)
@@ -115,6 +93,28 @@ public abstract class Configuration
*/
static Configuration getConfig()
{
+ if (config == null)
+ {
+ String conf = (String) AccessController.doPrivileged
+ (new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Security.getProperty ("login.configuration.provider");
+ }
+ });
+ try
+ {
+ if (conf != null)
+ config = (Configuration) Class.forName (conf).newInstance();
+ else
+ config = new NullConfiguration();
+ }
+ catch (Exception x)
+ {
+ config = new NullConfiguration();
+ }
+ }
return config;
}
}
diff --git a/libjava/classpath/javax/security/auth/login/LoginContext.java b/libjava/classpath/javax/security/auth/login/LoginContext.java
index 8fc2ca75983..a3cbf8f0651 100644
--- a/libjava/classpath/javax/security/auth/login/LoginContext.java
+++ b/libjava/classpath/javax/security/auth/login/LoginContext.java
@@ -220,7 +220,9 @@ public class LoginContext
Exception cause = null;
try
{
- module = (LoginModule) Class.forName (entry.getLoginModuleName()).newInstance();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Class c = Class.forName(entry.getLoginModuleName(), true, cl);
+ module = (LoginModule) c.newInstance();
}
catch (ClassNotFoundException cnfe)
{
diff --git a/libjava/classpath/javax/security/auth/x500/X500Principal.java b/libjava/classpath/javax/security/auth/x500/X500Principal.java
index 78c35ade157..fcbb4950a39 100644
--- a/libjava/classpath/javax/security/auth/x500/X500Principal.java
+++ b/libjava/classpath/javax/security/auth/x500/X500Principal.java
@@ -140,6 +140,22 @@ public final class X500Principal implements Principal, Serializable
// Instance methods.
// ------------------------------------------------------------------------
+ public int hashCode()
+ {
+ int result = size();
+ for (int i = 0; i < size(); ++i)
+ {
+ Map m = (Map) components.get(i);
+ for (Iterator it2 = m.entrySet().iterator(); it2.hasNext(); )
+ {
+ Map.Entry e = (Map.Entry) it2.next();
+ // We don't bother looking at the value of the entry.
+ result = result * 31 + ((OID) e.getKey()).hashCode();
+ }
+ }
+ return result;
+ }
+
public boolean equals(Object o)
{
if (!(o instanceof X500Principal))
diff --git a/libjava/classpath/javax/security/sasl/AuthenticationException.java b/libjava/classpath/javax/security/sasl/AuthenticationException.java
index 12a8fe0529b..0f674645dc0 100644
--- a/libjava/classpath/javax/security/sasl/AuthenticationException.java
+++ b/libjava/classpath/javax/security/sasl/AuthenticationException.java
@@ -1,5 +1,5 @@
/* AuthenticationException.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,6 +49,8 @@ package javax.security.sasl;
* instead of <code>AuthenticationException</code> if it is unable to determine
* the nature of the failure, or if does not want to disclose the nature of the
* failure, for example, due to security reasons.</p>
+ *
+ * @since 1.5
*/
public class AuthenticationException extends SaslException
{
diff --git a/libjava/classpath/javax/security/sasl/AuthorizeCallback.java b/libjava/classpath/javax/security/sasl/AuthorizeCallback.java
index bf1b8470d31..fa3b29a3d92 100644
--- a/libjava/classpath/javax/security/sasl/AuthorizeCallback.java
+++ b/libjava/classpath/javax/security/sasl/AuthorizeCallback.java
@@ -1,5 +1,5 @@
/* AuthorizeCallback.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,19 +38,23 @@ exception statement from your version. */
package javax.security.sasl;
+import java.io.Serializable;
import javax.security.auth.callback.Callback;
/**
* This callback is used by {@link SaslServer} to determine whether one entity
* (identified by an authenticated authentication ID) can act on behalf of
* another entity (identified by an authorization ID).
+ *
+ * @since 1.5
*/
-public class AuthorizeCallback implements Callback
+public class AuthorizeCallback implements Callback, Serializable
{
-
// Constants and variables
// -------------------------------------------------------------------------
+ private static final long serialVersionUID = -2353344186490470805L;
+
/** @serial The (authenticated) authentication id to check. */
private String authenticationID = null;
diff --git a/libjava/classpath/javax/security/sasl/RealmCallback.java b/libjava/classpath/javax/security/sasl/RealmCallback.java
index 12d834054a4..7cb36433fe6 100644
--- a/libjava/classpath/javax/security/sasl/RealmCallback.java
+++ b/libjava/classpath/javax/security/sasl/RealmCallback.java
@@ -1,5 +1,5 @@
/* RealmCallback.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,6 +43,8 @@ import javax.security.auth.callback.TextInputCallback;
/**
* This callback is used by {@link SaslClient} and {@link SaslServer} to
* retrieve realm information.
+ *
+ * @since 1.5
*/
public class RealmCallback extends TextInputCallback
{
diff --git a/libjava/classpath/javax/security/sasl/RealmChoiceCallback.java b/libjava/classpath/javax/security/sasl/RealmChoiceCallback.java
index d16e61f6afd..7068a504bce 100644
--- a/libjava/classpath/javax/security/sasl/RealmChoiceCallback.java
+++ b/libjava/classpath/javax/security/sasl/RealmChoiceCallback.java
@@ -1,5 +1,5 @@
/* RealmChoiceCallback.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,6 +43,8 @@ import javax.security.auth.callback.ChoiceCallback;
/**
* This callback is used by {@link SaslClient} and {@link SaslServer} to obtain
* a realm given a list of realm choices.
+ *
+ * @since 1.5
*/
public class RealmChoiceCallback extends ChoiceCallback
{
diff --git a/libjava/classpath/javax/security/sasl/Sasl.java b/libjava/classpath/javax/security/sasl/Sasl.java
index 058e4f6e1b6..dbe4cc8c2ae 100644
--- a/libjava/classpath/javax/security/sasl/Sasl.java
+++ b/libjava/classpath/javax/security/sasl/Sasl.java
@@ -74,6 +74,8 @@ import javax.security.auth.callback.CallbackHandler;
* Sasl.createSaslServer(mechanism, protocol, serverName, props,
* callbackHandler);
* </pre>
+ *
+ * @since 1.5
*/
public class Sasl
{
diff --git a/libjava/classpath/javax/security/sasl/SaslClient.java b/libjava/classpath/javax/security/sasl/SaslClient.java
index 544ab17d6a8..58eb5e298b6 100644
--- a/libjava/classpath/javax/security/sasl/SaslClient.java
+++ b/libjava/classpath/javax/security/sasl/SaslClient.java
@@ -1,5 +1,5 @@
/* SaslClient.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,6 +102,8 @@ package javax.security.sasl;
*
* @see Sasl
* @see SaslClientFactory
+ *
+ * @since 1.5
*/
public interface SaslClient
{
@@ -216,7 +218,7 @@ public interface SaslClient
* @throws IllegalStateException if this authentication exchange has not
* completed.
*/
- Object getNegotiatedProperty(String propName) throws SaslException;
+ Object getNegotiatedProperty(String propName);
/**
* Disposes of any system resources or security-sensitive information the
diff --git a/libjava/classpath/javax/security/sasl/SaslClientFactory.java b/libjava/classpath/javax/security/sasl/SaslClientFactory.java
index d6e8cd5ffd1..ae36171c56e 100644
--- a/libjava/classpath/javax/security/sasl/SaslClientFactory.java
+++ b/libjava/classpath/javax/security/sasl/SaslClientFactory.java
@@ -1,5 +1,5 @@
/* SaslClientFactory.java
- Copyright (C) 2003, Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,6 +55,8 @@ import javax.security.auth.callback.CallbackHandler;
*
* @see SaslClient
* @see Sasl
+ *
+ * @since 1.5
*/
public interface SaslClientFactory
{
diff --git a/libjava/classpath/javax/security/sasl/SaslException.java b/libjava/classpath/javax/security/sasl/SaslException.java
index 13113e6bcda..89764bb18f0 100644
--- a/libjava/classpath/javax/security/sasl/SaslException.java
+++ b/libjava/classpath/javax/security/sasl/SaslException.java
@@ -1,5 +1,5 @@
/* SaslException.java
- Copyright (C) 2003, Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,6 +45,8 @@ import java.io.Serializable;
/**
* This class represents an error that has occurred when using SASL.
+ *
+ * @since 1.5
*/
public class SaslException extends IOException implements Serializable
{
@@ -52,6 +54,8 @@ public class SaslException extends IOException implements Serializable
// Constants and variables
// -------------------------------------------------------------------------
+ private static final long serialVersionUID = 4579784287983423626L;
+
/**
* @serial The possibly null root cause exception.
*/
diff --git a/libjava/classpath/javax/security/sasl/SaslServer.java b/libjava/classpath/javax/security/sasl/SaslServer.java
index f5a04975d53..d30b8f6ba14 100644
--- a/libjava/classpath/javax/security/sasl/SaslServer.java
+++ b/libjava/classpath/javax/security/sasl/SaslServer.java
@@ -1,5 +1,5 @@
-/* SasServer.java
- Copyright (C) 2003, Free Software Foundation, Inc.
+/* SaslServer.java
+ Copyright (C) 2003, 2005, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -92,6 +92,8 @@ package javax.security.sasl;
*
* @see Sasl
* @see SaslServerFactory
+ *
+ * @since 1.5
*/
public interface SaslServer
{
@@ -211,7 +213,7 @@ public interface SaslServer
* @throws IllegalStateException if this authentication exchange has not
* completed.
*/
- Object getNegotiatedProperty(String propName) throws SaslException;
+ Object getNegotiatedProperty(String propName);
/**
* Disposes of any system resources or security-sensitive information the
diff --git a/libjava/classpath/javax/security/sasl/SaslServerFactory.java b/libjava/classpath/javax/security/sasl/SaslServerFactory.java
index 0fff32fa43b..fc43fb636e9 100644
--- a/libjava/classpath/javax/security/sasl/SaslServerFactory.java
+++ b/libjava/classpath/javax/security/sasl/SaslServerFactory.java
@@ -1,5 +1,5 @@
/* SaslServerFactory.java
- Copyright (C) 2003, Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,6 +55,8 @@ import javax.security.auth.callback.CallbackHandler;
*
* @see SaslServer
* @see Sasl
+ *
+ * @since 1.5
*/
public interface SaslServerFactory
{
diff --git a/libjava/classpath/javax/sound/midi/ControllerEventListener.java b/libjava/classpath/javax/sound/midi/ControllerEventListener.java
new file mode 100644
index 00000000000..eb075b32f8b
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/ControllerEventListener.java
@@ -0,0 +1,58 @@
+/* ControllerEventListener.java -- Listener for MIDI controller events
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import java.util.EventListener;
+
+/**
+ * The interface defines the methods to be implemented by classes wanting
+ * to be notified on MIDI controller events from a Sequencer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface ControllerEventListener extends EventListener
+{
+ /**
+ * Called on MIDI controller events.
+ * @param event the controller change event message
+ */
+ public void controlChange(ShortMessage event);
+}
diff --git a/libjava/classpath/javax/sound/midi/Instrument.java b/libjava/classpath/javax/sound/midi/Instrument.java
new file mode 100644
index 00000000000..3402e8289c9
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Instrument.java
@@ -0,0 +1,77 @@
+/* Instrument.java -- A MIDI Instrument
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * The abstract base class for all MIDI instruments.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class Instrument extends SoundbankResource
+{
+ // The instrument patch.
+ private Patch patch;
+
+ /**
+ * Create a new Instrument.
+ *
+ * @param soundbank the Soundbank containing the instrument.
+ * @param patch the patch for this instrument
+ * @param name the name of this instrument
+ * @param dataClass the class used to represent sample data for this instrument
+ */
+ protected Instrument(Soundbank soundbank, Patch patch,
+ String name, Class dataClass)
+ {
+ super(soundbank, name, dataClass);
+ this.patch = patch;
+ }
+
+ /**
+ * Get the patch for this instrument.
+ *
+ * @return the patch for this instrument
+ */
+ public Patch getPatch()
+ {
+ return patch;
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/InvalidMidiDataException.java b/libjava/classpath/javax/sound/midi/InvalidMidiDataException.java
new file mode 100644
index 00000000000..d7f770757a4
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/InvalidMidiDataException.java
@@ -0,0 +1,90 @@
+/* InvalidMidiDataException.java -- Thrown for invalid MIDI data.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * This exception is thrown when we encounter bad MIDI data.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class InvalidMidiDataException extends Exception
+{
+ private static final long serialVersionUID = 2780771756789932067L;
+
+ /**
+ * Create an InvalidMidiDataException object.
+ */
+ public InvalidMidiDataException()
+ {
+ super();
+ }
+
+ /**
+ * Create an InvalidMidiDataException object.
+ *
+ * @param s the exception message string
+ */
+ public InvalidMidiDataException(String s)
+ {
+ super(s);
+ }
+
+ /**
+ * Create an InvalidMidiDataException object.
+ *
+ * @param s the exception message string
+ * @param cause the root cause of the exception
+ */
+ public InvalidMidiDataException(String s, Throwable cause)
+ {
+ super(s, cause);
+ }
+
+ /**
+ * Create an InvalidMidiDataException object.
+ *
+ * @param cause the root cause of the exception
+ */
+ public InvalidMidiDataException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/libjava/classpath/gnu/java/awt/FocusManager.java b/libjava/classpath/javax/sound/midi/MetaEventListener.java
index 49b40bfc184..dd7b8a24be8 100644
--- a/libjava/classpath/gnu/java/awt/FocusManager.java
+++ b/libjava/classpath/javax/sound/midi/MetaEventListener.java
@@ -1,4 +1,4 @@
-/* FocusManager.java -- Provide Swing FocusManager API compatibility
+/* MetaEventListener.java -- Listener for MIDI meta events
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,18 +35,24 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.java.awt;
+
+package javax.sound.midi;
+
+import java.util.EventListener;
/**
- * This is a subclass of the otherwise abstract class
- * {@link javax.swing.FocusManager}. Its sole purpose is to make the Swing
- * FocusManager usable as a FocusManager in AWT, so that we can provide both
- * the new (1.4) KeyboardFocusManager API and still support the older
- * Swing FocusManager.
+ * The interface defines the methods to be implemented by classes wanting
+ * to be notified on MIDI meta events from a Sequencer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
*
- * @author Roman Kennke
*/
-public class FocusManager
- extends javax.swing.FocusManager
+public interface MetaEventListener extends EventListener
{
+ /**
+ * Called on MIDI meta events.
+ * @param meta the meta event message
+ */
+ public void meta(MetaMessage meta);
}
diff --git a/libjava/classpath/javax/sound/midi/MetaMessage.java b/libjava/classpath/javax/sound/midi/MetaMessage.java
new file mode 100644
index 00000000000..2ca93accd77
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MetaMessage.java
@@ -0,0 +1,176 @@
+/* MetaMessage.java -- A meta message for MIDI files.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A system exclusive MIDI message.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MetaMessage extends MidiMessage
+{
+ /**
+ * The META status code. Only valid for MIDI files, not the wire protocol.
+ */
+ public static final int META = 0xFF;
+
+ // The length of the variable length data length encoding.
+ private int lengthLength = 0;
+
+ /**
+ * Create a default valid meta message.
+ *
+ * The official specs don't specify what message is to be
+ * created. For now, we create a zero length meta message
+ * with a type code of 0.
+ */
+ public MetaMessage()
+ {
+ super(new byte[4]);
+ data[0] = (byte) META;
+ data[1] = (byte) 0; // Type
+ data[2] = (byte) 1; // Length length
+ data[3] = (byte) 0; // Length
+ lengthLength = 1;
+ }
+
+ /**
+ * Create a MetaMessage object.
+ * @param data a complete system exclusive message
+ */
+ public MetaMessage(byte[] data)
+ {
+ super(data);
+ int index = 2;
+ lengthLength = 1;
+ while ((data[index++] & 0x80) > 0)
+ lengthLength++;
+ }
+
+ /**
+ * Set the meta message.
+ *
+ * @param type the meta type byte (< 128)
+ * @param data the message data
+ * @param length the length of the message data
+ * @throws InvalidMidiDataException if this message is invalid
+ */
+ public void setMessage(int type, byte[] data, int length)
+ throws InvalidMidiDataException
+ {
+ if (type > 127)
+ throw new InvalidMidiDataException("Meta type 0x"
+ + Integer.toHexString(type)
+ + " must be less than 128");
+
+ // For a nice description of how variable length values are handled,
+ // see http://www.borg.com/~jglatt/tech/midifile.htm
+
+ // First compute the length of the length value
+ lengthLength = 0;
+ int lengthValue = length;
+ do {
+ lengthValue = lengthValue >> 7;
+ lengthLength++;
+ } while (lengthValue > 0);
+
+ // Now allocate our data array
+ this.length = 2 + lengthLength + length;
+ this.data = new byte[this.length];
+ this.data[0] = (byte) META;
+ this.data[1] = (byte) type;
+
+ // Now compute the length representation
+ long buffer = length & 0x7F;
+ while ((length >>= 7) > 0)
+ {
+ buffer <<= 8;
+ buffer |= ((length & 0x7F) | 0x80);
+ }
+
+ // Now store the variable length length value
+ int index = 2;
+ do
+ {
+ this.data[index++] = (byte) (buffer & 0xFF);
+ if ((buffer & 0x80) == 0)
+ break;
+ buffer >>= 8;
+ } while (true);
+
+ // Now copy the real data.
+ System.arraycopy(data, 0, this.data, index, length);
+ }
+
+ /**
+ * Get the meta message type.
+ *
+ * @return the meta message type
+ */
+ public int getType()
+ {
+ return data[1];
+ }
+
+ /**
+ * Get the data for this message, not including the status,
+ * type, or length information.
+ *
+ * @return the message data, not including status, type or lenght info
+ */
+ public byte[] getData()
+ {
+ int dataLength = length - 2 - lengthLength;
+ byte[] result = new byte[dataLength];
+ System.arraycopy(data, 2 + lengthLength, result, 0, dataLength);
+ return result;
+ }
+
+ /* Create a deep-copy clone of this object.
+ * @see java.lang.Object#clone()
+ */
+ public Object clone()
+ {
+ byte message[] = new byte[length];
+ System.arraycopy(data, 0, message, 0, length);
+ return new MetaMessage(message);
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiChannel.java b/libjava/classpath/javax/sound/midi/MidiChannel.java
new file mode 100644
index 00000000000..fe3b5111ab7
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiChannel.java
@@ -0,0 +1,236 @@
+/* MidiChannel.java -- A MIDI channel
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A MIDI channel.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface MidiChannel
+{
+
+ /**
+ * Start playing a note.
+ *
+ * @param noteNumber the MIDI note number
+ * @param velocity the velocity at which the key was pressed
+ */
+ public void noteOn(int noteNumber, int velocity);
+
+ /**
+ * Stop playing a note.
+ *
+ * @param noteNumber the MIDI note number
+ * @param velocity the volcity at which the ket was released
+ */
+ public void noteOff(int noteNumber, int velocity);
+
+ /**
+ * Stop playing a note.
+ *
+ * @param noteNumber the MIDI note number
+ */
+ public void noteOff(int noteNumber);
+
+ /**
+ * Change in a key pressure for a note.
+ *
+ * @param noteNumber the MIDI note number
+ * @param pressure the key pressure
+ */
+ public void setPolyPressure(int noteNumber, int pressure);
+
+ /**
+ * Get the key pressure for a note.
+ *
+ * @param noteNumber the MIDI note number
+ * @return the key pressure
+ */
+ public int getPolyPressure(int noteNumber);
+
+ /**
+ * Set the key pressure for the channel.
+ *
+ * @param pressure the key pressure
+ */
+ public void setChannelPressure(int pressure);
+
+ /**
+ * Get the key pressure for the channel.
+ *
+ * @return the key pressure
+ */
+ public int getChannelPressure();
+
+ /**
+ * Set a change in a controller's value.
+ *
+ * @param controller the MIDI controller number (0 to 127)
+ * @param value the new value (0 to 127)
+ */
+ public void controlChange(int controller, int value);
+
+ /**
+ * Get a controller's value.
+ *
+ * @param controller the MIDI controller number (0 to 127)
+ * @return the controller's value (0 to 127)
+ */
+ public int getController(int controller);
+
+ /**
+ * Change the patch for this channel.
+ *
+ * @param program the patch number to switch to (0 to 127)
+ */
+ public void programChange(int program);
+
+ /**
+ * Change the bank and patch for this channel.
+ *
+ * @param bank the bank to switch to (0 to 16383)
+ * @param program the patch to switch to (0 to 127)
+ */
+ public void programChange(int bank, int program);
+
+ /**
+ * Get the current patch for this channel.
+ *
+ * @return current patch (0 to 127)
+ */
+ public int getProgram();
+
+ /**
+ * Change the pitch bend for this channel using a positive 14-bit value.
+ *
+ * @param bend the new pitch bend value
+ */
+ public void setPitchBend(int bend);
+
+ /**
+ * Get the pitch bend for this channel as a positive 14-bit value.
+ *
+ * @return the current patch bend value
+ */
+ public int getPitchBend();
+
+ /**
+ * Reset all MIDI controllers to their default values.
+ */
+ public void resetAllControllers();
+
+ /**
+ * Stop playing all notes. Sound may not stop.
+ */
+ public void allNotesOff();
+
+ /**
+ * Stop all sound.
+ */
+ public void allSoundOff();
+
+ /**
+ * Set whether or not local controls are on or off. They are on by
+ * default.
+ *
+ * @param on true to enable local controls, false to disable
+ * @return the new value
+ */
+ public boolean localControl(boolean on);
+
+ /**
+ * Turns mono mode on or off.
+ *
+ * @param on true to enable mono mode, false to disable
+ */
+ public void setMono(boolean on);
+
+ /**
+ * Get the current mono mode.
+ *
+ * @return true if mono is enabled, false otherwise
+ */
+ public boolean getMono();
+
+ /**
+ * Turns omni mode on or off.
+ *
+ * @param on true to enable omni mode, false to disable
+ */
+ public void setOmni(boolean on);
+
+ /**
+ * Get the current omni mode.
+ *
+ * @return true if omni is enabled, false otherwise
+ */
+ public boolean getOmni();
+
+ /**
+ * Turns mute mode on or off.
+ *
+ * @param mute true to enable mute mode, false to disable
+ */
+ public void setMute(boolean mute);
+
+ /**
+ * Get the current mute mode.
+ *
+ * @return true if mute is enabled, false otherwise
+ */
+ public boolean getMute();
+
+ /**
+ * Turns solo mode on or off. If any channels are soloed, then only those
+ * channels make sounds, otherwise all channels will make sound.
+ *
+ * @param solo true to enable solo mode, false to disable
+ */
+ public void setSolo(boolean solo);
+
+ /**
+ * Get the current solo mode.
+ *
+ * @return true is solo is enabled, false otherwise.
+ */
+ public boolean getSolo();
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiDevice.java b/libjava/classpath/javax/sound/midi/MidiDevice.java
new file mode 100644
index 00000000000..6f43c25481d
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiDevice.java
@@ -0,0 +1,220 @@
+/* MidiDevice.java -- Interface for MIDI devices
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Interface for all MIDI devices.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface MidiDevice
+{
+ /**
+ * Get the Info object describing this device.
+ * @return the Info object describing this device
+ */
+ public Info getDeviceInfo();
+
+ /**
+ * Open this MIDI device and allocate any system resource we need.
+ *
+ * @throws MidiUnavailableException if we're not able to open for some reason
+ */
+ public void open() throws MidiUnavailableException;
+
+ /**
+ * Close this MIDI device, and release any system resources we're using.
+ */
+ public void close();
+
+ /**
+ * Returns true if this MIDI device is open and false otherwise.
+ *
+ * @return true if this is open, false otherwise
+ */
+ public boolean isOpen();
+
+ /**
+ * If this device supports time-stamps, then it will return the number
+ * of microseconds since this device has been open, and -1 otherwise.
+ *
+ * @return -1 or the number of microseconds since this was opened
+ */
+ public long getMicrosecondPosition();
+
+ /**
+ * The maximum number of MIDI IN connections we can get as Receivers,
+ * or -1 if there is no maximum.
+ *
+ * @return -1 or the maximum number of Receivers we can get
+ */
+ public int getMaxReceivers();
+
+ /**
+ * The maximum number of MIDI OUT connections we can get as Transmitters,
+ * or -1 if there is no maximum.
+ *
+ * @return -1 or the maximum number of Transmitters we can get
+ */
+ public int getMaxTransmitters();
+
+ /**
+ * Get a MIDI IN Receiver for this device.
+ *
+ * @return a MIDI IN Receiver for this device
+ * @throws MidiUnavailableException if we can't get a Receiver
+ */
+ public Receiver getReceiver() throws MidiUnavailableException;
+
+ /**
+ * Get a MIDI OUT Transmitter for this device.
+ *
+ * @return a MIDI OUT Transmitter for this device
+ * @throws MidiUnavailableException if we can't get a Transmitter
+ */
+ public Transmitter getTransmitter() throws MidiUnavailableException;
+
+ /**
+ * A MIDI device descriptor object.
+ *
+ * @author green@redhat.com
+ *
+ */
+ public static class Info
+ {
+ // Private data describing this device
+ private String name;
+ private String vendor;
+ private String description;
+ private String version;
+
+ /**
+ * Create an Info object for a MIDI device
+ *
+ * @param name the device name
+ * @param vendor the vendor name
+ * @param description the device description
+ * @param version the device version string
+ */
+ public Info(String name, String vendor, String description, String version)
+ {
+ this.name = name;
+ this.vendor = vendor;
+ this.description = description;
+ this.version = version;
+ }
+
+ /**
+ * This equals method only returns true if this object
+ * is the same as obj.
+ *
+ * @param obj the object we're comparing to
+ * @return true if this is the same object
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ return super.equals(obj);
+ }
+
+ /**
+ * A hash code for this object.
+ *
+ * @return the hash code for this object
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Get the device name.
+ *
+ * @return the device name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Get the device vendor.
+ *
+ * @return the device vendor
+ */
+ public String getVendor()
+ {
+ return vendor;
+ }
+
+ /**
+ * Get the device description
+ *
+ * @return the device description
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * get the device version
+ *
+ * @return the device version
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * Simple return the name of the device.
+ *
+ * @return the device name
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return name;
+ }
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiEvent.java b/libjava/classpath/javax/sound/midi/MidiEvent.java
new file mode 100644
index 00000000000..3ca5c21ea86
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiEvent.java
@@ -0,0 +1,95 @@
+/* MidiEvent.java -- A MIDI Event
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A MIDI event is the combination of a MIDI message and a timestamp specified
+ * in MIDI ticks.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MidiEvent
+{
+ private final MidiMessage message;
+ private long tick;
+
+ /**
+ * Create a MIDI event object from the given MIDI message and timestamp.
+ *
+ * @param message the MidiMessage for this event
+ * @param tick the timestamp for this event
+ */
+ public MidiEvent(MidiMessage message, long tick)
+ {
+ this.message = message;
+ this.tick = tick;
+ }
+
+ /**
+ * Get the MIDI message for this event.
+ *
+ * @return the MidiMessage for this event
+ */
+ public MidiMessage getMessage()
+ {
+ return message;
+ }
+
+ /**
+ * Set the timestemp for this event in MIDI ticks.
+ *
+ * @param tick the timestamp
+ */
+ public void setTick(long tick)
+ {
+ this.tick = tick;
+ }
+
+ /**
+ * Get the timestamp for this event in MIDI ticks.
+ *
+ * @return the timestamp for this even in MIDI ticks
+ */
+ public long getTick()
+ {
+ return tick;
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiFileFormat.java b/libjava/classpath/javax/sound/midi/MidiFileFormat.java
new file mode 100644
index 00000000000..79fa9fe2964
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiFileFormat.java
@@ -0,0 +1,158 @@
+/* MidiFileFormat.java -- Information about a MIDI file
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Describe a MIDI file, including specifics about its type, length and timing.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MidiFileFormat
+{
+ /**
+ * The MIDI file type. This is either 0, 1 or 2.
+ *
+ * Type 0 files contain a single track and represents a single song
+ * performance.
+ * Type 1 may contain multiple tracks for a single song performance.
+ * Type 2 may contain multiple tracks, each representing a
+ * separate song performance.
+ *
+ * See http://en.wikipedia.org/wiki/MIDI#MIDI_file_formats for more
+ * information.
+ */
+ protected int type;
+
+ /**
+ * The division type of the MIDI file.
+ */
+ protected float divisionType;
+
+ /**
+ * The timing resolution of the MIDI file.
+ */
+ protected int resolution;
+
+ /**
+ * The size of the MIDI file in bytes.
+ */
+ protected int byteLength = UNKNOWN_LENGTH;
+
+ /**
+ * The length of the MIDI file in microseconds.
+ */
+ protected long microsecondLength = UNKNOWN_LENGTH;
+
+ /**
+ * A special value indicating an unknown quantity.
+ */
+ public static final int UNKNOWN_LENGTH = -1; // FIXME is this really -1?
+
+ /**
+ * Create a MidiFileFormat object from the given parameters.
+ *
+ * @param type the MIDI file type (0, 1, or 2)
+ * @param divisionType the MIDI file division type
+ * @param resolution the MIDI file timing resolution
+ * @param bytes the MIDI file size in bytes
+ * @param microseconds the MIDI file length in microseconds
+ */
+ public MidiFileFormat(int type, float divisionType,
+ int resolution, int bytes, long microseconds)
+ {
+ this.type = type;
+ this.divisionType = divisionType;
+ this.resolution = resolution;
+ this.byteLength = bytes;
+ this.microsecondLength = microseconds;
+ }
+
+ /**
+ * Get the MIDI file type (0, 1, or 2).
+ *
+ * @return the MIDI file type (0, 1, or 2)
+ */
+ public int getType()
+ {
+ return type;
+ }
+
+ /**
+ * Get the file division type.
+ *
+ * @return the file divison type
+ */
+ public float getDivisionType()
+ {
+ return divisionType;
+ }
+
+ /**
+ * Get the file timing resolution. If the division type is PPQ, then this
+ * is value represents ticks per beat, otherwise it's ticks per frame (SMPTE).
+ *
+ * @return the timing resolution in ticks per beat or ticks per frame
+ */
+ public int getResolution()
+ {
+ return resolution;
+ }
+
+ /**
+ * Get the file length in bytes.
+ *
+ * @return the file length in bytes or UNKNOWN_LENGTH
+ */
+ public int getByteLength()
+ {
+ return byteLength;
+ }
+
+ /**
+ * Get the file length in microseconds.
+ *
+ * @return the file length in microseconds or UNKNOWN_LENGTH
+ */
+ public long getMicrosecondLength()
+ {
+ return microsecondLength;
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiMessage.java b/libjava/classpath/javax/sound/midi/MidiMessage.java
new file mode 100644
index 00000000000..e265b5eadcc
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiMessage.java
@@ -0,0 +1,126 @@
+/* MidiMessage.java -- base class for MIDI messages.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * The base class for all MIDI messages.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiMessage implements Cloneable
+{
+ /**
+ * MIDI message data.
+ */
+ protected byte data[];
+
+ /**
+ * The total length of the MIDI message.
+ */
+ protected int length;
+
+ /**
+ * MidiMessage contructor.
+ *
+ * @param data a valid MIDI message
+ */
+ protected MidiMessage(byte[] data)
+ {
+ this.data = data;
+ this.length = data.length;
+ }
+
+ /**
+ * Set the complete MIDI message.
+ *
+ * @param data The complete MIDI message.
+ * @param length The length of the MIDI message.
+ * @throws InvalidMidiDataException Thrown when the MIDI message is invalid.
+ */
+ protected void setMessage(byte[] data, int length)
+ throws InvalidMidiDataException
+ {
+ this.data = new byte[length];
+ System.arraycopy(data, 0, this.data, 0, length);
+ this.length = length;
+ }
+
+ /**
+ * Get the MIDI message data.
+ *
+ * @return an array containing the MIDI message data
+ */
+ public byte[] getMessage()
+ {
+ byte copy[] = new byte[length];
+ System.arraycopy(data, 0, copy, 0, length);
+ return copy;
+ }
+
+ /**
+ * Get the status byte of the MIDI message (as an int)
+ *
+ * @return the status byte of the MIDI message (as an int), or zero if the message length is zero.
+ */
+ public int getStatus()
+ {
+ if (length > 0)
+ return (data[0] & 0xff);
+ else
+ return 0;
+ }
+
+ /**
+ * Get the length of the MIDI message.
+ *
+ * @return the length of the MIDI messsage
+ */
+ public int getLength()
+ {
+ return length;
+ }
+
+ /* Create a clone of this object.
+ *
+ * @see java.lang.Object#clone()
+ */
+ public abstract Object clone();
+}
diff --git a/libjava/classpath/javax/sound/midi/MidiSystem.java b/libjava/classpath/javax/sound/midi/MidiSystem.java
new file mode 100644
index 00000000000..8ea12eb7002
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiSystem.java
@@ -0,0 +1,566 @@
+/* MidiSystem.java -- Access system MIDI resources
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import gnu.classpath.ServiceFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+
+import javax.sound.midi.spi.MidiDeviceProvider;
+import javax.sound.midi.spi.MidiFileReader;
+import javax.sound.midi.spi.MidiFileWriter;
+import javax.sound.midi.spi.SoundbankReader;
+
+/**
+ * MidiSystem provides access to the computer system's MIDI resources,
+ * as well as utility routines for reading MIDI files and more.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MidiSystem
+{
+ /**
+ * Get an array of all available MIDI devices.
+ *
+ * @return a possibly empty array of all available MIDI devices
+ */
+ public static MidiDevice.Info[] getMidiDeviceInfo()
+ {
+ Iterator deviceProviders =
+ ServiceFactory.lookupProviders(MidiDeviceProvider.class);
+ List infoList = new ArrayList();
+
+ while (deviceProviders.hasNext())
+ {
+ MidiDeviceProvider provider = (MidiDeviceProvider) deviceProviders.next();
+ MidiDevice.Info[] infos = provider.getDeviceInfo();
+ for (int i = infos.length; i > 0; )
+ infoList.add(infos[--i]);
+ }
+
+ return (MidiDevice.Info[])
+ infoList.toArray(new MidiDevice.Info[infoList.size()]);
+ }
+
+ /**
+ * Get the specified MIDI device.
+ *
+ * @param info a description of the device we're looking for
+ * @return the requested MIDI device
+ * @throws MidiUnavailableException if no MIDI devices are configured or found
+ * @throws IllegalArgumentException if the device described by info is not found
+ */
+ public static MidiDevice getMidiDevice(MidiDevice.Info info)
+ throws MidiUnavailableException
+ {
+ Iterator deviceProviders =
+ ServiceFactory.lookupProviders(MidiDeviceProvider.class);
+
+ if (! deviceProviders.hasNext())
+ throw new MidiUnavailableException("No MIDI device providers available.");
+
+ do
+ {
+ MidiDeviceProvider provider =
+ (MidiDeviceProvider) deviceProviders.next();
+ if (provider.isDeviceSupported(info))
+ return provider.getDevice(info);
+ } while (deviceProviders.hasNext());
+
+ throw new IllegalArgumentException("MIDI device "
+ + info + " not available.");
+ }
+
+ /**
+ * Get the default Receiver instance. This just picks the first one
+ * it finds for now.
+ *
+ * @return the default Receiver instance
+ * @throws MidiUnavailableException if no Receiver is found
+ */
+ public static Receiver getReceiver() throws MidiUnavailableException
+ {
+ // TODO: The 1.5 spec has a fancy mechanism to specify the default
+ // receiver device. For now, well just return the first one we find.
+ MidiDevice.Info[] infos = getMidiDeviceInfo();
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = getMidiDevice(infos[i]);
+ if (device instanceof Receiver)
+ return (Receiver) device;
+ }
+ throw new MidiUnavailableException("No Receiver device available");
+ }
+
+ /**
+ * Get the default Transmitter instance. This just picks the first one
+ * it finds for now.
+ *
+ * @return the default Transmitter instance
+ * @throws MidiUnavailableException if no Transmitter is found
+ */
+ public static Transmitter getTransmitter() throws MidiUnavailableException
+ {
+ // TODO: The 1.5 spec has a fancy mechanism to specify the default
+ // Transmitter device. For now, well just return the first one we find.
+ MidiDevice.Info[] infos = getMidiDeviceInfo();
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = getMidiDevice(infos[i]);
+ if (device instanceof Transmitter)
+ return (Transmitter) device;
+ }
+ throw new MidiUnavailableException("No Transmitter device available");
+ }
+
+ /**
+ * Get the default Synthesizer instance. This just picks the first one
+ * it finds for now.
+ *
+ * @return the default Synthesizer instance
+ * @throws MidiUnavailableException if no Synthesizer is found
+ */
+ public static Synthesizer getSynthesizer() throws MidiUnavailableException
+ {
+ // TODO: The 1.5 spec has a fancy mechanism to specify the default
+ // Synthesizer device. For now, well just return the first one we find.
+ MidiDevice.Info[] infos = getMidiDeviceInfo();
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = getMidiDevice(infos[i]);
+ if (device instanceof Synthesizer)
+ return (Synthesizer) device;
+ }
+ throw new MidiUnavailableException("No Synthesizer device available");
+ }
+
+ /**
+ * Get the default Sequencer instance. This just picks the first one
+ * it finds for now.
+ *
+ * @return the default Sequencer instance
+ * @throws MidiUnavailableException if no Sequencer is found
+ */
+ public static Sequencer getSequencer() throws MidiUnavailableException
+ {
+ // TODO: The 1.5 spec has a fancy mechanism to specify the default
+ // Sequencer device. For now, well just return the first one we find.
+ MidiDevice.Info[] infos = getMidiDeviceInfo();
+ for (int i = 0; i < infos.length; i++)
+ {
+ MidiDevice device = getMidiDevice(infos[i]);
+ if (device instanceof Sequencer)
+ return (Sequencer) device;
+ }
+ throw new MidiUnavailableException("No Sequencer device available");
+ }
+
+ /**
+ * Read a Soundbank object from the given stream.
+ *
+ * @param stream the stream from which to read the Soundbank
+ * @return the Soundbank object
+ * @throws InvalidMidiDataException if we were unable to read the soundbank
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Soundbank getSoundbank(InputStream stream)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class);
+ while (readers.hasNext())
+ {
+ SoundbankReader sr = (SoundbankReader) readers.next();
+ Soundbank sb = sr.getSoundbank(stream);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Cannot read soundbank from stream");
+ }
+
+ /**
+ * Read a Soundbank object from the given url.
+ *
+ * @param url the url from which to read the Soundbank
+ * @return the Soundbank object
+ * @throws InvalidMidiDataException if we were unable to read the soundbank
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Soundbank getSoundbank(URL url)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class);
+ while (readers.hasNext())
+ {
+ SoundbankReader sr = (SoundbankReader) readers.next();
+ Soundbank sb = sr.getSoundbank(url);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Cannot read from url " + url);
+ }
+
+ /**
+ * Read a Soundbank object from the given file.
+ *
+ * @param file the file from which to read the Soundbank
+ * @return the Soundbank object
+ * @throws InvalidMidiDataException if we were unable to read the soundbank
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Soundbank getSoundbank(File file)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class);
+ while (readers.hasNext())
+ {
+ SoundbankReader sr = (SoundbankReader) readers.next();
+ Soundbank sb = sr.getSoundbank(file);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Cannot read soundbank from file "
+ + file);
+ }
+
+ /**
+ * Read a MidiFileFormat object from the given stream.
+ *
+ * @param stream the stream from which to read the MidiFileFormat
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if we were unable to read the MidiFileFormat
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static MidiFileFormat getMidiFileFormat(InputStream stream)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ MidiFileFormat sb = sr.getMidiFileFormat(stream);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Can't read MidiFileFormat from stream");
+ }
+
+ /**
+ * Read a MidiFileFormat object from the given url.
+ *
+ * @param url the url from which to read the MidiFileFormat
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if we were unable to read the MidiFileFormat
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static MidiFileFormat getMidiFileFormat(URL url)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ MidiFileFormat sb = sr.getMidiFileFormat(url);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Cannot read from url " + url);
+ }
+
+ /**
+ * Read a MidiFileFormat object from the given file.
+ *
+ * @param file the file from which to read the MidiFileFormat
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if we were unable to read the MidiFileFormat
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static MidiFileFormat getMidiFileFormat(File file)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ MidiFileFormat sb = sr.getMidiFileFormat(file);
+ if (sb != null)
+ return sb;
+ }
+ throw new InvalidMidiDataException("Can't read MidiFileFormat from file "
+ + file);
+ }
+
+ /**
+ * Read a Sequence object from the given stream.
+ *
+ * @param stream the stream from which to read the Sequence
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if we were unable to read the Sequence
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Sequence getSequence(InputStream stream)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ Sequence sq = sr.getSequence(stream);
+ if (sq != null)
+ return sq;
+ }
+ throw new InvalidMidiDataException("Can't read Sequence from stream");
+ }
+
+ /**
+ * Read a Sequence object from the given url.
+ *
+ * @param url the url from which to read the Sequence
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if we were unable to read the Sequence
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Sequence getSequence(URL url)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ Sequence sq = sr.getSequence(url);
+ if (sq != null)
+ return sq;
+ }
+ throw new InvalidMidiDataException("Cannot read from url " + url);
+ }
+
+ /**
+ * Read a Sequence object from the given file.
+ *
+ * @param file the file from which to read the Sequence
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if we were unable to read the Sequence
+ * @throws IOException if an I/O error happened while reading
+ */
+ public static Sequence getSequence(File file)
+ throws InvalidMidiDataException, IOException
+ {
+ Iterator readers = ServiceFactory.lookupProviders(MidiFileReader.class);
+ while (readers.hasNext())
+ {
+ MidiFileReader sr = (MidiFileReader) readers.next();
+ Sequence sq = sr.getSequence(file);
+ if (sq != null)
+ return sq;
+ }
+ throw new InvalidMidiDataException("Can't read Sequence from file "
+ + file);
+ }
+
+ /**
+ * Return an array of supported MIDI file types on this system.
+ *
+ * @return the array of supported MIDI file types
+ */
+ public static int[] getMidiFileTypes()
+ {
+ // We only support a max of 3 MIDI file types.
+ boolean supported[] = new boolean[3];
+ // The number of supported formats.
+ int count = 0;
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+ int types[] = fw.getMidiFileTypes();
+ for (int i = types.length; i > 0;)
+ {
+ int type = types[--i];
+ if (supported[type] == false)
+ {
+ count++;
+ supported[type] = true;
+ }
+ }
+ }
+ int result[] = new int[count];
+ for (int i = supported.length; i > 0;)
+ {
+ if (supported[--i])
+ result[--count] = i;
+ }
+ return result;
+ }
+
+ /**
+ * Return true if the system supports writing files of type fileType.
+ *
+ * @param fileType the MIDI file type we want to write
+ * @return true if we can write fileType files, false otherwise
+ */
+ public static boolean isFileTypeSupported(int fileType)
+ {
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+
+ if (fw.isFileTypeSupported(fileType))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return an array of supported MIDI file types on this system
+ * for the given sequnce.
+ *
+ * @param sequence the sequnce to write
+ * @return the array of supported MIDI file types
+ */
+ public static int[] getMidiFileTypes(Sequence sequence)
+ {
+ // We only support a max of 3 MIDI file types.
+ boolean supported[] = new boolean[3];
+ // The number of supported formats.
+ int count = 0;
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+ int types[] = fw.getMidiFileTypes(sequence);
+ for (int i = types.length; i > 0;)
+ {
+ int type = types[--i];
+ if (supported[type] == false)
+ {
+ count++;
+ supported[type] = true;
+ }
+ }
+ }
+ int result[] = new int[count];
+ for (int i = supported.length; i > 0;)
+ {
+ if (supported[--i])
+ result[--count] = i;
+ }
+ return result;
+ }
+
+ /**
+ * Return true if the system supports writing files of type fileType
+ * for the given sequence.
+ *
+ * @param fileType the MIDI file type we want to write
+ * @param sequence the Sequence we want to write
+ * @return true if we can write fileType files for sequence, false otherwise
+ */
+ public static boolean isFileTypeSupported(int fileType, Sequence sequence)
+ {
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+
+ if (fw.isFileTypeSupported(fileType, sequence))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Write a sequence to an output stream using a specific MIDI file format.
+ *
+ * @param in the sequence to write
+ * @param fileType the MIDI file format to use
+ * @param out the output stream to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O exception happens
+ * @throws IllegalArgumentException if fileType is not supported for in
+ */
+ public static int write(Sequence in, int fileType, OutputStream out)
+ throws IOException
+ {
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+
+ if (fw.isFileTypeSupported(fileType, in))
+ return fw.write(in, fileType, out);
+ }
+ throw new IllegalArgumentException("File type "
+ + fileType + " is not supported");
+ }
+
+ /**
+ * Write a sequence to a file using a specific MIDI file format.
+ *
+ * @param in the sequence to write
+ * @param fileType the MIDI file format to use
+ * @param out the file to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O exception happens
+ * @throws IllegalArgumentException if fileType is not supported for in
+ */
+ public static int write(Sequence in, int fileType, File out)
+ throws IOException
+ {
+ Iterator writers = ServiceFactory.lookupProviders(MidiFileWriter.class);
+ while (writers.hasNext())
+ {
+ MidiFileWriter fw = (MidiFileWriter) writers.next();
+
+ if (fw.isFileTypeSupported(fileType, in))
+ return fw.write(in, fileType, out);
+ }
+ throw new IllegalArgumentException("File type "
+ + fileType + " is not supported");
+ }
+}
+
diff --git a/libjava/classpath/javax/sound/midi/MidiUnavailableException.java b/libjava/classpath/javax/sound/midi/MidiUnavailableException.java
new file mode 100644
index 00000000000..d4b85e810aa
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/MidiUnavailableException.java
@@ -0,0 +1,90 @@
+/* MidiUnavailableException.java -- MIDI resources are not available
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * This exception is thrown when MIDI resources are not available.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class MidiUnavailableException extends Exception
+{
+ private static final long serialVersionUID = 6093809578628944323L;
+
+ /**
+ * Create a MidiUnavailableException.
+ */
+ public MidiUnavailableException()
+ {
+ super();
+ }
+
+ /**
+ * Create an MidiUnavailableException object.
+ *
+ * @param s the exception message string
+ */
+ public MidiUnavailableException(String s)
+ {
+ super(s);
+ }
+
+ /**
+ * Create an MidiUnavailableException object.
+ *
+ * @param s the exception message string
+ * @param cause the root cause of the exception
+ */
+ public MidiUnavailableException(String s, Throwable cause)
+ {
+ super(s, cause);
+ }
+
+ /**
+ * Create an MidiUnavailableException object.
+ *
+ * @param cause the root cause of the exception
+ */
+ public MidiUnavailableException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/Patch.java b/libjava/classpath/javax/sound/midi/Patch.java
new file mode 100644
index 00000000000..eb9d8bc3b82
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Patch.java
@@ -0,0 +1,86 @@
+/* Patch.java -- A MIDI patch.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A Patch describes where an Instrument is loaded on a Synthesizer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class Patch
+{
+ // Private data describing the patch
+ private int bank = 0;
+ private int program = 0;
+
+ /**
+ * Create a Patch object, specifying the bank and program in which this Patch
+ * is located.
+ *
+ * @param bank the bank in which this Patch is located
+ * @param program the program in which this Patch is located
+ */
+ public Patch(int bank, int program)
+ {
+ this.bank = bank;
+ this.program = program;
+ }
+
+ /**
+ * Get the bank in which this Patch is located.
+ *
+ * @return the bank in which this Patch is located
+ */
+ public int getBank()
+ {
+ return bank;
+ }
+
+ /**
+ * Get the program in which this Patch is located.
+ *
+ * @return the program in which this Patch is located
+ */
+ public int getProgram()
+ {
+ return program;
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/Receiver.java b/libjava/classpath/javax/sound/midi/Receiver.java
new file mode 100644
index 00000000000..0e70b2809e9
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Receiver.java
@@ -0,0 +1,66 @@
+/* Receiver.java -- An interface for objects receiving MIDI data
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * This interface describes the methods required by objects receiving MIDI
+ * messages.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Receiver
+{
+ /**
+ * Send a MIDI message and timestamp. Some receivers don't support
+ * timestamps, in which case timeStamp should be -1.
+ *
+ * @param message the MIDI message to send
+ * @param timeStamp time timestamp for this message in microseconds (or -1)
+ * @throws IllegalStateException if the receiver is closed
+ */
+ public void send(MidiMessage message, long timeStamp)
+ throws IllegalStateException;
+
+ /**
+ * Close this receiver, possibly freeing system resources.
+ */
+ public void close();
+}
diff --git a/libjava/classpath/javax/sound/midi/Sequence.java b/libjava/classpath/javax/sound/midi/Sequence.java
new file mode 100644
index 00000000000..1a43d207ce6
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Sequence.java
@@ -0,0 +1,248 @@
+/* Sequence.java -- A sequence of MIDI events
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+/**
+ * Objects of this type represent sequences of MIDI messages that can be
+ * played back by a Sequencer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class Sequence
+{
+ /**
+ * The timing division type for this sequence (PPQ or SMPTE*)
+ */
+ protected float divisionType;
+
+ /**
+ * The timing resolution in ticks/beat or ticks/frame, depending on the
+ * division type.
+ */
+ protected int resolution;
+
+ /**
+ * The MIDI tracks used by this sequence.
+ */
+ protected Vector tracks;
+
+ /**
+ * Tempo-based timing. Resolution is specified in ticks per beat.
+ */
+ public static final float PPQ = 0.0f;
+
+ /**
+ * 24 frames/second timing. Resolution is specific in ticks per frame.
+ */
+ public static final float SMPTE_24 = 24.0f;
+
+ /**
+ * 25 frames/second timing. Resolution is specific in ticks per frame.
+ */
+ public static final float SMPTE_25 = 25.0f;
+
+ /**
+ * 30 frames/second timing. Resolution is specific in ticks per frame.
+ */
+ public static final float SMPTE_30 = 30.0f;
+
+ /**
+ * 29.97 frames/second timing. Resolution is specific in ticks per frame.
+ */
+ public static final float SMPTE_30DROP = 29.97f;
+
+ // Private helper class
+ private void init(float divisionType, int resolution, int numTracks)
+ throws InvalidMidiDataException
+ {
+ if (divisionType != PPQ
+ && divisionType != SMPTE_24
+ && divisionType != SMPTE_25
+ && divisionType != SMPTE_30
+ && divisionType != SMPTE_30DROP)
+ throw new InvalidMidiDataException("Invalid division type ("
+ + divisionType + ")");
+
+ this.divisionType = divisionType;
+ this.resolution = resolution;
+
+ tracks = new Vector(numTracks);
+ while (numTracks > 0)
+ tracks.set(--numTracks, new Track());
+ }
+
+ /**
+ * Create a MIDI sequence object with no initial tracks.
+ *
+ * @param divisionType the division type (must be one of PPQ or SMPTE_*)
+ * @param resolution the timing resolution
+ * @throws InvalidMidiDataException if the division type is invalid
+ */
+ public Sequence(float divisionType, int resolution)
+ throws InvalidMidiDataException
+ {
+ init(divisionType, resolution, 0);
+ }
+
+ /**
+ * Create a MIDI seqence object.
+ *
+ * @param divisionType the division type (must be one of PPQ or SMPTE_*)
+ * @param resolution the timing resolution
+ * @param numTracks the number of initial tracks
+ * @throws InvalidMidiDataException if the division type is invalid
+ */
+ public Sequence(float divisionType, int resolution, int numTracks)
+ throws InvalidMidiDataException
+ {
+ init(divisionType, resolution, 0);
+ }
+
+ /**
+ * The division type of this sequence.
+ *
+ * @return division type of this sequence
+ */
+ public float getDivisionType()
+ {
+ return divisionType;
+ }
+
+ /**
+ * The timing resolution for this sequence, relative to the division type.
+ *
+ * @return the timing resolution for this sequence
+ */
+ public int getResolution()
+ {
+ return resolution;
+ }
+
+ /**
+ * Create a new empty MIDI track and add it to this sequence.
+ *
+ * @return the newly create MIDI track
+ */
+ public Track createTrack()
+ {
+ Track track = new Track();
+ tracks.add(track);
+ return track;
+ }
+
+ /**
+ * Remove the specified MIDI track from this sequence.
+ *
+ * @param track the track to remove
+ * @return true if track was removed and false othewise
+ */
+ public boolean deleteTrack(Track track)
+ {
+ return tracks.remove(track);
+ }
+
+ /**
+ * Get an array of MIDI tracks used in this sequence.
+ *
+ * @return a possibly empty array of tracks
+ */
+ public Track[] getTracks()
+ {
+ return (Track[]) tracks.toArray(new Track[tracks.size()]);
+ }
+
+ /**
+ * The length of this sequence in microseconds.
+ *
+ * @return the length of this sequence in microseconds
+ */
+ public long getMicrosecondLength()
+ {
+ long tickLength = getTickLength();
+
+ if (divisionType == PPQ)
+ {
+ // FIXME
+ // How can this possible be computed? PPQ is pulses per quarter-note,
+ // which is dependent on the tempo of the Sequencer.
+ throw new
+ UnsupportedOperationException("Can't compute PPQ based lengths yet");
+ }
+ else
+ {
+ // This is a fixed tick per frame computation
+ return (long) ((tickLength * 1000000) / (divisionType * resolution));
+ }
+ }
+
+ /**
+ * The length of this sequence in MIDI ticks.
+ *
+ * @return the length of this sequence in MIDI ticks
+ */
+ public long getTickLength()
+ {
+ long length = 0;
+ Iterator itr = tracks.iterator();
+ while (itr.hasNext())
+ {
+ Track track = (Track) itr.next();
+ long trackTicks = track.ticks();
+ if (trackTicks > length)
+ length = trackTicks;
+ }
+ return length;
+ }
+
+ /**
+ * Get an array of patches used in this sequence.
+ *
+ * @return an array of patches used in this sequence
+ */
+ public Patch[] getPatchList()
+ {
+ // FIXE: not quite sure how to do this yet.
+ throw new UnsupportedOperationException("Can't get patch list yet");
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/Sequencer.java b/libjava/classpath/javax/sound/midi/Sequencer.java
new file mode 100644
index 00000000000..894d876e91f
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Sequencer.java
@@ -0,0 +1,402 @@
+/* Sequencer.java -- A MIDI sequencer object
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * A Sequencer object plays MIDI sequences described as Sequence objects.
+ * This class provides methods for loading and unloading sequences, as well
+ * as basic transport controls.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Sequencer extends MidiDevice
+{
+ /**
+ * Set the Sequence object for this sequencer.
+ *
+ * @param seq the Sequence to process
+ * @throws InvalidMidiDataException if the sequence is invalid for any reason
+ */
+ public void setSequence(Sequence seq) throws InvalidMidiDataException;
+
+ /**
+ * Set the sequence for this sequencer. istream reads on a valid MIDI file.
+ *
+ * @param istream an input stream for a valid MIDI file
+ * @throws IOException if an I/O exception happens
+ * @throws InvalidMidiDataException if the MIDI file contains bad data
+ */
+ public void setSequence(InputStream istream)
+ throws IOException, InvalidMidiDataException;
+
+ /**
+ * Get the current sequence object for this sequencer.
+ *
+ * @return the current sequence object. May be null.
+ */
+ public Sequence getSequence();
+
+ /**
+ * Start playback of the current sequence.
+ */
+ public void start();
+
+ /**
+ * Stop playback of the current sequence.
+ */
+ public void stop();
+
+ /**
+ * Returns true if the sequence is playing.
+ *
+ * @return true if the sequence is playing and false otherwise
+ */
+ public boolean isRunning();
+
+ /**
+ * Start playback and record of MIDI events.
+ * Any tracks enabled for recording will have their events replaced.
+ * Any newly recorded events, and all events from non-recording tracks
+ * will be sent to the sequencer's transmitter.
+ */
+ public void startRecording();
+
+ /**
+ * Stop recording, although continue playing.
+ */
+ public void stopRecording();
+
+ /**
+ * Returns true if sequence is recording.
+ *
+ * @return true if the sequence is recording and false otherwise
+ */
+ public boolean isRecording();
+
+ /**
+ * Enable recording for a specific track using data from a specific channel.
+ *
+ * @param track the track to enable for recording
+ * @param channel the channel from which to record
+ */
+ public void recordEnable(Track track, int channel);
+
+ /**
+ * Disable recording for a specific track.
+ *
+ * @param track the track to disable recording for
+ */
+ public void recordDisable(Track track);
+
+ /**
+ * Get the current tempo in beats per minute.
+ *
+ * @return the current tempo in beats per minute
+ */
+ public float getTempoInBPM();
+
+ /**
+ * Sets the current tempo in beats per minute.
+ *
+ * @param bpm the new tempo in bears per minutes
+ */
+ public void setTempoInBPM(float bpm);
+
+ /**
+ * Get the current tempo in microseconds per quarter note.
+ *
+ * @return the current tempo in microseconds per quarter note.
+ */
+ public float getTempoInMPQ();
+
+ /**
+ * Sets the current tempo in microseconds per quarter note.
+ *
+ * @param mpq the new tempo in microseconds per quarter note.
+ */
+ public void setTempoInMPQ(float mpq);
+
+ /**
+ * Set a scaling factor for the playback tempo, which is 1.0 by default.
+ *
+ * @param factor the new tempo scaling factor
+ */
+ public void setTempoFactor(float factor);
+
+ /**
+ * Get the current scaling factor for the playback tempo.
+ *
+ * @return the current tempo scaling factor
+ */
+ public float getTempoFactor();
+
+ /**
+ * Get the length of the current sequence in MIDI ticks.
+ *
+ * @return the length of the current sequence in MIDI ticks
+ */
+ public long getTickLength();
+
+ /**
+ * Get the current playback position of the sequencer in MIDI ticks.
+ *
+ * @return the current playback position of the sequencer in MIDI ticks
+ */
+ public long getTickPosition();
+
+ /**
+ * Set the current playback position of the sequencer in MIDI ticks.
+ *
+ * @param tick the new playback position of the sequencer in MIDI ticks
+ */
+ public void setTickPosition(long tick);
+
+ /**
+ * Get the length of the current sequence in microseconds.
+ *
+ * @return the length of the current sequence in microseconds
+ */
+ public long getMicrosecondLength();
+
+ /**
+ * Get the current playback position of the sequencer in microseconds.
+ *
+ * @return the current playback position of the sequencer in microseconds
+ */
+ public long getMicrosecondPosition();
+
+ /**
+ * Set the current playback position of the sequencer in microseconds.
+ *
+ * @param microsecond the new playback position of the sequencer in microseconds
+ */
+ public void setMicrosecondPosition(long microsecond);
+
+ /**
+ * Set the source of timing information. sync must be found in the array
+ * returned by getMasterSyncModes().
+ * FIXME: What happens if it isn't?
+ *
+ * @param sync the new source of timing information
+ */
+ public void setMasterSyncMode(SyncMode sync);
+
+ /**
+ * Get the source of timing information.
+ *
+ * @return the current source of timing information
+ */
+ public SyncMode getMasterSyncMode();
+
+ /**
+ * Get an array of timing sources supported by this sequencer.
+ *
+ * @return an array of timing sources supported by this sequencer
+ */
+ public SyncMode[] getMasterSyncModes();
+
+ /**
+ * Set the slave synchronization mode for this sequencer. sync must be
+ * found in the array returned by getSlaveSyncModes().
+ * FIXME: What happens if it isn't?
+ *
+ * @param sync the new slave sync mode for this sequencer
+ */
+ public void setSlaveSyncMode(SyncMode sync);
+
+ /**
+ * Get the current slave synchronization mode.
+ *
+ * @return the current slave synchronization mode
+ */
+ public SyncMode getSlaveSyncMode();
+
+ /**
+ * Get an array of slave sync modes supported by this sequencer.
+ *
+ * @return an array of slave sync modes supported by this sequencer
+ */
+ public SyncMode[] getSlaveSyncModes();
+
+ /**
+ * Sets the mute state for a specific track.
+ *
+ * @param track the track to modify
+ * @param mute the new mute state
+ */
+ public void setTrackMute(int track, boolean mute);
+
+ /**
+ * Get the mute state of a specific track.
+ *
+ * @param track the track to query
+ * @return the mute state for track
+ */
+ public boolean getTrackMute(int track);
+
+ /**
+ * Sets the solo state for a specific track.
+ *
+ * @param track the track to modify
+ * @param solo the new solo state
+ */
+ public void setTrackSolo(int track, boolean solo);
+
+ /**
+ * Get the solo state for a specific track.
+ *
+ * @param track the track to query
+ * @return the solo state for track
+ */
+ public boolean getTrackSolo(int track);
+
+ /**
+ * Add a meta event listening object to this sequencer. It will receive
+ * notification whenever the sequencer processes a meta event.
+ * A listener may fail to get added if this sequencer doesn't support
+ * meta events.
+ *
+ * @param listener the listener to add
+ * @return true if listener was added, false othewise
+ */
+ public boolean addMetaEventListener(MetaEventListener listener);
+
+ /**
+ * Remove a meta event listener from this sequencer.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeMetaEventListener(MetaEventListener listener);
+
+ /**
+ * Add a controller event listening object to this sequencer. It will
+ * receive notification whenever the sequencer processes a controller
+ * event for a specified controller number..
+ *
+ * @param listener the listener to add
+ * @param controllers the conroller numbers to listen to
+ * @return the controller numbers being listened to
+ */
+ public int[] addControllerEventListener(ControllerEventListener listener,
+ int controllers[]);
+
+ /**
+ * Remove a controller listener from this sequencer for the specified
+ * controller numbers.
+ *
+ * @param listener the listener to remove
+ * @param controllers the controllers to unlisten
+ * @return the controller numbers being unlistened
+ */
+ public int[] removeControllerEventListener(ControllerEventListener listener,
+ int controllers[]);
+
+ /**
+ * A SyncMode object represents the mechanism by which a MIDI sequencer
+ * synchronizes time with a master or slave device.
+ *
+ * @author green@redhat.com
+ *
+ */
+ public static class SyncMode
+ {
+ /**
+ * A master sync mode indicating the use of an internal sequencer clock.
+ */
+ public static final SyncMode INTERNAL_CLOCK = new SyncMode("Internal Clock");
+
+ /**
+ * A master or slave sync mode indicating the use of MIDI clock messages.
+ */
+ public static final SyncMode MIDI_SYNC = new SyncMode("MIDI Sync");
+
+ /**
+ * A master or slave sync mode indicating the use of MIDI Time Code
+ * messages.
+ */
+ public static final SyncMode MIDI_TIME_CODE = new SyncMode("MIDI Time Code");
+
+ /**
+ * A slave sync mode indicating that no timing info will be transmitted.
+ */
+ public static final SyncMode NO_SYNC = new SyncMode("No Timing");
+
+ // The name
+ private String name;
+
+ /**
+ * Create a new SyncMode object
+ * @param name the SyncMode name
+ */
+ protected SyncMode(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * SyncMode objects are only equal when identical.
+ */
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ /**
+ * SyncMode objects use the Object hashCode.
+ */
+ public int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Use the SyncMode name as the string representation.
+ * @see java.lang.Object#toString()
+ */
+ public final String toString()
+ {
+ return name;
+ }
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/ShortMessage.java b/libjava/classpath/javax/sound/midi/ShortMessage.java
new file mode 100644
index 00000000000..43c0e25fe72
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/ShortMessage.java
@@ -0,0 +1,344 @@
+/* ShortMessage.java -- A MIDI message no longer than 3 bytes
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A short MIDI message that is no longer than 3 bytes long.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class ShortMessage extends MidiMessage
+{
+ /**
+ * Status byte for System Exclusive message.
+ */
+ public static final int SYSTEM_EXCLUSIVE = 0xF0;
+
+ /**
+ * Status byte for Time Code message.
+ */
+ public static final int MIDI_TIME_CODE = 0xF1;
+
+ /**
+ * Status byte for Song Position Pointer message.
+ */
+ public static final int SONG_POSITION_POINTER = 0xF2;
+
+ /**
+ * Status byte for Song Select message.
+ */
+ public static final int SONG_SELECT = 0xF3;
+
+ /**
+ * Status byte for Tune Request message.
+ */
+ public static final int TUNE_REQUEST = 0xF6;
+
+ /**
+ * Status byte for End Of Exclusive message.
+ */
+ public static final int END_OF_EXCLUSIVE = 0xF7;
+
+ /**
+ * Status byte for Timing Clock message.
+ */
+ public static final int TIMING_CLOCK = 0xF8;
+
+ /**
+ * Status byte for Start message.
+ */
+ public static final int START = 0xFA;
+
+ /**
+ * Status byte for Continue message.
+ */
+ public static final int CONTINUE = 0xFB;
+
+ /**
+ * Status byte for Stop message.
+ */
+ public static final int STOP = 0xFC;
+
+ /**
+ * Status byte for Active Sensing message.
+ */
+ public static final int ACTIVE_SENSING = 0xFE;
+
+ /**
+ * Status byte for System Reset message.
+ */
+ public static final int SYSTEM_RESET = 0xFF;
+
+ /**
+ * Status nibble for Note Off message.
+ */
+ public static final int NOTE_OFF = 0x80;
+
+ /**
+ * Status nibble for Note On message.
+ */
+ public static final int NOTE_ON = 0x90;
+
+ /**
+ * Status nibble for Poly Pressure message.
+ */
+ public static final int POLY_PRESSURE = 0xA0;
+
+ /**
+ * Status nibble for Control Change message.
+ */
+ public static final int CONTROL_CHANGE = 0xB0;
+
+ /**
+ * Status nibble for Program Change message.
+ */
+ public static final int PROGRAM_CHANGE = 0xC0;
+
+ /**
+ * Statue nibble for Channel Pressure message.
+ */
+ public static final int CHANNEL_PRESSURE = 0xD0;
+
+ /**
+ * Status nibble for Pitch Bend message.
+ */
+ public static final int PITCH_BEND = 0xE0;
+
+ // Create and initialize a default, arbitrary message.
+ private static byte[] defaultMessage;
+ static
+ {
+ defaultMessage = new byte[1];
+ defaultMessage[0] = (byte) STOP;
+ }
+
+ /**
+ * Create a short MIDI message.
+ *
+ * The spec requires that this represent a valid MIDI message, but doesn't
+ * specify what it should be. We've chosen the STOP message for our
+ * implementation.
+ */
+ public ShortMessage()
+ {
+ this(defaultMessage);
+ }
+
+ /**
+ * Create a short MIDI message.
+ *
+ * The data argument should be a valid MIDI message. Unfortunately the spec
+ * does not allow us to throw an InvalidMidiDataException if data is invalid.
+ *
+ * @param data the message data
+ */
+ public ShortMessage(byte[] data)
+ {
+ super(data);
+ }
+
+ /**
+ * Set the MIDI message.
+ *
+ * @param status the status byte for this message
+ * @param data1 the first data byte for this message
+ * @param data2 the second data byte for this message
+ * @throws InvalidMidiDataException if status is bad, or data is out of range
+ */
+ public void setMessage(int status, int data1, int data2)
+ throws InvalidMidiDataException
+ {
+ length = getDataLength(status);
+ length++;
+ if (data == null || data.length < length)
+ data = new byte[length];
+ data[0] = (byte) status;
+ if (length > 1)
+ {
+ if (data1 < 0 || data1 > 127)
+ throw new InvalidMidiDataException("data1 (" + data1
+ + ") must be between 0 and 127.");
+ data[1] = (byte) data1;
+ if (length > 2)
+ {
+ if (data2 < 0 || data2 > 127)
+ throw new InvalidMidiDataException("data2 (" + data2
+ + ") must be between 0 and 127.");
+ data[2] = (byte) data2;
+ }
+ }
+ }
+
+ public void setMessage(int command, int channel, int data1, int data2)
+ throws InvalidMidiDataException
+ {
+ // TODO: This could probably stand some error checking.
+ // It currently assumes command and channel are valid values.
+ setMessage(command + channel, data1, data2);
+ }
+
+ /**
+ * Set the MIDI message to one that requires no data bytes.
+ *
+ * @param status the status byte for this message
+ * @throws InvalidMidiDataException if status is bad, or requires data
+ */
+ public void setMessage(int status) throws InvalidMidiDataException
+ {
+ int length = getDataLength(status);
+ if (length != 0)
+ throw new InvalidMidiDataException("Status byte 0x"
+ + Integer.toHexString(status)
+ + " requires "
+ + length + " bytes of data.");
+ setMessage(status, 0, 0);
+ }
+
+
+ /**
+ * Return the number of data bytes needed for a given MIDI status byte.
+ *
+ * @param status the status byte for a short MIDI message
+ * @return the number of data bytes needed for this status byte
+ * @throws InvalidMidiDataException if status is an invalid status byte
+ */
+ protected final int getDataLength(int status) throws InvalidMidiDataException
+ {
+ int originalStatus = status;
+
+ if ((status & 0xF0) != 0xF0)
+ status &= 0xF0;
+
+ switch (status)
+ {
+ case NOTE_OFF:
+ case NOTE_ON:
+ case POLY_PRESSURE:
+ case CONTROL_CHANGE:
+ case PITCH_BEND:
+ case SONG_POSITION_POINTER:
+ return 2;
+
+ case PROGRAM_CHANGE:
+ case CHANNEL_PRESSURE:
+ case SONG_SELECT:
+ case 0xF5: // FIXME: unofficial bus select. Not in spec??
+ return 1;
+
+ case SYSTEM_EXCLUSIVE:
+ return 0; // FIXME: is this correct?
+
+ case TUNE_REQUEST:
+ case END_OF_EXCLUSIVE:
+ case TIMING_CLOCK:
+ case START:
+ case CONTINUE:
+ case STOP:
+ case ACTIVE_SENSING:
+ case SYSTEM_RESET:
+ return 0;
+
+ default:
+ throw new InvalidMidiDataException("Invalid status: 0x"
+ + Integer.toHexString(originalStatus));
+ }
+ }
+
+ /**
+ * Get the channel information from this MIDI message, assuming it is a
+ * MIDI channel message.
+ *
+ * @return the MIDI channel for this message
+ */
+ public int getChannel()
+ {
+ return data[0] & 0x0F;
+ }
+
+ /**
+ * Get the command nibble from this MIDI message, assuming it is a MIDI
+ * channel message.
+ *
+ * @return the MIDI command for this message
+ */
+ public int getCommand()
+ {
+ return data[0] & 0xF0;
+ }
+
+ /**
+ * Get the first data byte from this message, assuming it exists, and
+ * zero otherwise.
+ *
+ * @return the first data byte or zero if none exists.
+ */
+ public int getData1()
+ {
+ if (length > 1)
+ return data[1];
+ else
+ return 0;
+ }
+
+ /**
+ * Get the second data byte from this message, assuming it exists, and
+ * zero otherwise.
+ *
+ * @return the second date byte or zero if none exists.
+ */
+ public int getData2()
+ {
+ if (length > 2)
+ return data[2];
+ else
+ return 0;
+ }
+
+ /* Create a deep-copy clone of this object.
+ * @see java.lang.Object#clone()
+ */
+ public Object clone()
+ {
+ byte message[] = new byte[length];
+ System.arraycopy(data, 0, message, 0, length);
+ return new ShortMessage(message);
+ }
+}
diff --git a/libjava/classpath/javax/sound/midi/Soundbank.java b/libjava/classpath/javax/sound/midi/Soundbank.java
new file mode 100644
index 00000000000..16d9d79eaa6
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Soundbank.java
@@ -0,0 +1,101 @@
+/* Soundbank.java -- Container of Instruments to be loaded into a Synthesizer
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A Soundbank is a container for instruments which may be loaded into
+ * a Synthesizer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Soundbank
+{
+ /**
+ * Get the sound bank name.
+ *
+ * @return the sound bank name
+ */
+ String getName();
+
+ /**
+ * Get the sound bank version.
+ *
+ * @return the sound bank version
+ */
+ String getVersion();
+
+ /**
+ * Get the sound bank vendor.
+ *
+ * @return the sound bank vendor
+ */
+ String getVendor();
+
+
+ /**
+ * Get the sound bank description.
+ *
+ * @return the sound bank description
+ */
+ String getDescription();
+
+ /**
+ * Get an array of non-Instrument resources in this sound bank.
+ *
+ * @return an array of non-instrument resources in this sound bank
+ */
+ SoundbankResource[] getResources();
+
+ /**
+ * Get an array of Instruments in this sound bank.
+ *
+ * @return an array of instruments in this sound bank
+ */
+ Instrument[] getInstruments();
+
+ /**
+ * Get the Instrument for the given Patch.
+ *
+ * @param patch the Patch to search for
+ * @return the Instrument corresponding to patch
+ */
+ Instrument getInstrument(Patch patch);
+}
diff --git a/libjava/classpath/javax/sound/midi/SoundbankResource.java b/libjava/classpath/javax/sound/midi/SoundbankResource.java
new file mode 100644
index 00000000000..435017e4cf2
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/SoundbankResource.java
@@ -0,0 +1,104 @@
+/* SoundbankResource.java -- An audio resource from a sound bank
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * SoundbankResource objects represent audio data stored in a sound bank.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class SoundbankResource
+{
+ private final Soundbank soundbank;
+ private final String name;
+ private final Class dataClass;
+
+ /**
+ * Create a SoundbankResource object.
+ *
+ * @param soundbank the soundbank object containing this resource
+ * @param name the name of the resource
+ * @param dataClass the class used to represent the audio data
+ */
+ protected SoundbankResource(Soundbank soundbank, String name, Class dataClass)
+ {
+ this.soundbank = soundbank;
+ this.name = name;
+ this.dataClass = dataClass;
+ }
+
+ /**
+ * Get the sound bank containing this resource.
+ *
+ * @return the sound bank in which this resource resides
+ */
+ public Soundbank getSoundbank()
+ {
+ return soundbank;
+ }
+
+ /**
+ * Get the name of this resource.
+ *
+ * @return the name of this resource
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Get the class used to represent the audio data for this resource.
+ *
+ * @return the class used to represent the audio data for this resource
+ */
+ public Class getDataClass()
+ {
+ return dataClass;
+ }
+
+ /**
+ * Get the audio data for this resource.
+ *
+ * @return the audio data object for this resource
+ */
+ public abstract Object getData();
+}
diff --git a/libjava/classpath/javax/sound/midi/Synthesizer.java b/libjava/classpath/javax/sound/midi/Synthesizer.java
new file mode 100644
index 00000000000..22e5e9256f4
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Synthesizer.java
@@ -0,0 +1,173 @@
+/* Synthesizer.java -- A MIDI audio synthesizer interface
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Interface for MIDI audio synthesizer devices.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Synthesizer extends MidiDevice
+{
+ /**
+ * Get the maximum number of notes that the synth can play at once.
+ *
+ * @return the maximum number of notes that the synth can play at once
+ */
+ public int getMaxPolyphony();
+
+ /**
+ * The processing latency for this synth in microseconds.
+ *
+ * @return the processing latency for this synth in microseconds
+ */
+ public long getLatency();
+
+ /**
+ * Get the set of MIDI channels controlled by this synth.
+ *
+ * @return an array of MIDI channels controlled by this synth
+ */
+ public MidiChannel[] getChannels();
+
+ /**
+ * Get the current status for the voices produced by this synth.
+ *
+ * @return an array of VoiceStatus objects, getMaxPolyphony() in length
+ */
+ public VoiceStatus[] getVoiceStatus();
+
+ /**
+ * Returns true is this synth is capable of loading soundbank.
+ *
+ * @param soundbank the Soundbank to examine
+ * @return true if soundbank can be loaded, false otherwise
+ */
+ public boolean isSoundbankSupported(Soundbank soundbank);
+
+ /**
+ * Load an instrument into this synth. The instrument must be part of a
+ * supported soundbank.
+ *
+ * @param instrument the Instrument to load
+ * @return true if the instrument was loaded and false otherwise
+ * @throws IllegalArgumentException if this synth doesn't support instrument
+ */
+ public boolean loadInstrument(Instrument instrument);
+
+ /**
+ * Unload an instrument from this synth.
+ *
+ * @param instrument the Instrument to unload
+ * @throws IllegalArgumentException if this synth doesn't support instrument
+ */
+ public void unloadInstrument(Instrument instrument);
+
+ /**
+ * Move an intrument from one place to another. The instrument at the
+ * target location is unloaded.
+ *
+ * @param from the instrument source
+ * @param to the instrument target
+ * @return if from was remapped
+ * @throws IllegalArgumentException
+ */
+ public boolean remapInstrument(Instrument from, Instrument to);
+
+ /**
+ * Get the default Soundbank for this synth. Return null if there is no
+ * default.
+ *
+ * @return the default Soundbank for this synth, possibly null.
+ */
+ public Soundbank getDefaultSoundbank();
+
+ /**
+ * Get an array containing all instruments in this synthesizer.
+ *
+ * @return an array containing all instruments in this synthesizer
+ */
+ public Instrument[] getAvailableInstruments();
+
+ /**
+ * Get an array containing all instruments loaded in this synthesizer.
+ *
+ * @return an array containing all instruments loaded in this synthesizer
+ */
+ public Instrument[] getLoadedInstruments();
+
+ /**
+ * Load all soundbank instruments into this synthesizer.
+ *
+ * @param soundbank the Soundbank from which to load instruments
+ * @return true if all instruments were loaded, false othewise
+ * @throws IllegalArgumentException if the soundbank isn't supported by this
+ */
+ public boolean loadAllInstruments(Soundbank soundbank);
+
+ /**
+ * Unload all soundbank instruments from this synthesizer.
+ *
+ * @param soundbank the Soundbank containing the instruments to unload
+ * @throws IllegalArgumentException if the soundbank isn't supported by this
+ */
+ public void unloadAllInstruments(Soundbank soundbank);
+
+ /**
+ * Load a subset of soundbank instruments into this synthesizer. The
+ * subset is defined by an array of Patch objects.
+ *
+ * @param soundbank the Soundbank from which to load instruments
+ * @param patchList the array of patches identifying instruments to load
+ * @return true if instruments were loaded, false otherwise
+ * @throws IllegalArgumentException if the soundbank isn't supported by this
+ */
+ public boolean loadInstruments(Soundbank soundbank, Patch[] patchList);
+
+ /**
+ * Unload a subset of soundbank instruments from this synthesizer.
+ *
+ * @param soundbank the Soundbank containing the instruments to unload
+ * @param patchList the array of patches identifying instruments to unload
+ * @throws IllegalArgumentException if the soundbank isn't supported by this
+ */
+ public void unloadInstruments(Soundbank soundbank, Patch[] patchList);
+}
diff --git a/libjava/classpath/javax/sound/midi/SysexMessage.java b/libjava/classpath/javax/sound/midi/SysexMessage.java
new file mode 100644
index 00000000000..7ab60f4b6af
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/SysexMessage.java
@@ -0,0 +1,139 @@
+/* SysexMessage.java -- System Exclusive MIDI message.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A system exclusive MIDI message.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class SysexMessage extends MidiMessage
+{
+ public static final int SYSTEM_EXCLUSIVE = 0xF0;
+
+ public static final int SPECIAL_SYSTEM_EXCLUSIVE = 0xF7;
+
+ /**
+ * Create a default valid system exclusive message.
+ *
+ * The official specs don't specify what message is to be
+ * created. Our implementation creates an empty
+ * system exclusive message.
+ */
+ public SysexMessage()
+ {
+ super(new byte[2]);
+ data[0] = (byte) SYSTEM_EXCLUSIVE;
+ data[1] = (byte) ShortMessage.END_OF_EXCLUSIVE;
+ }
+
+ /**
+ * Create a SysexMessage object.
+ * @param data a complete system exclusive message
+ */
+ public SysexMessage(byte[] data)
+ {
+ super(data);
+ }
+
+ /**
+ * Set the sysex message. The first data byte (status) must be
+ * 0xF0 or 0xF7.
+ *
+ * @param data the message data
+ * @param length the length of the message data
+ * @throws InvalidMidiDataException if the status byte is not 0xF0 or 0xF7
+ */
+ public void setMessage(byte[] data, int length)
+ throws InvalidMidiDataException
+ {
+ if (data[0] != SYSTEM_EXCLUSIVE
+ || data[0] != SPECIAL_SYSTEM_EXCLUSIVE)
+ throw new InvalidMidiDataException("Sysex message starts with 0x"
+ + Integer.toHexString(data[0])
+ + " instead of 0xF0 or 0xF7");
+ super.setMessage(data, length);
+ }
+
+ /**
+ * Set the sysex message. status must be either 0xF0 or 0xF7.
+ *
+ * @param status the sysex statys byte (0xF0 or 0xF7)
+ * @param data the message data
+ * @param length the length of the message data
+ * @throws InvalidMidiDataException if status is not 0xF0 or 0xF7
+ */
+ public void setMessage(int status, byte[] data, int length)
+ throws InvalidMidiDataException
+ {
+ if (status != SYSTEM_EXCLUSIVE
+ || status != SPECIAL_SYSTEM_EXCLUSIVE)
+ throw new InvalidMidiDataException("Sysex message starts with 0x"
+ + Integer.toHexString(status)
+ + " instead of 0xF0 or 0xF7");
+ this.data = new byte[length+1];
+ this.data[0] = (byte) status;
+ System.arraycopy(data, 0, this.data, 1, length);
+ this.length = length+1;
+ }
+
+ /**
+ * Get the data for this message, not including the status byte.
+ * @return the message data, not including the status byte
+ */
+ public byte[] getData()
+ {
+ byte[] result = new byte[length - 1];
+ System.arraycopy(data, 1, result, 0, length - 1);
+ return result;
+ }
+
+ /* Create a deep-copy clone of this object.
+ * @see java.lang.Object#clone()
+ */
+ public Object clone()
+ {
+ byte message[] = new byte[length];
+ System.arraycopy(data, 0, message, 0, length);
+ return new SysexMessage(message);
+ }
+}
+
diff --git a/libjava/classpath/javax/sound/midi/Track.java b/libjava/classpath/javax/sound/midi/Track.java
new file mode 100644
index 00000000000..da7ef2ef3b9
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Track.java
@@ -0,0 +1,160 @@
+/* Track.java -- A track of MIDI events
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import java.util.HashSet;
+import java.util.Vector;
+
+/**
+ * A Track contains a list of timecoded MIDI events for processing
+ * by a Sequencer.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class Track
+{
+ /**
+ * The list of MidiEvents for this track.
+ */
+ protected Vector events;
+
+ // A HashSet to speed processing
+ private HashSet eventSet;
+
+ /**
+ * Add a new event to this track. Specific events may only be added once.
+ * The event will be inserted into the appropriate spot in the event list
+ * based on its timecode.
+ *
+ * @param event the event to add
+ * @return true if the event was added, false otherwise
+ */
+ public boolean add(MidiEvent event)
+ {
+ synchronized (events)
+ {
+ if (eventSet.contains(event))
+ return false;
+
+ eventSet.add(event);
+
+ long targetTick = event.getTick();
+ int i = events.size() - 1;
+ while (i >= 0 && (((MidiEvent)events.get(i)).getTick() > targetTick))
+ i--;
+ events.add(i+1, event);
+ return true;
+ }
+ }
+
+ /**
+ * Remove an event from this track.
+ *
+ * @param event the event to remove
+ * @return true if the event was removed, false otherwise
+ */
+ public boolean remove(MidiEvent event)
+ {
+ synchronized (events)
+ {
+ if (! eventSet.remove(event))
+ return false;
+
+ int i = events.indexOf(event);
+ if (i >= 0)
+ {
+ events.remove(i);
+ return true;
+ }
+
+ throw new InternalError("event in set but not list");
+ }
+ }
+
+ /**
+ * Get an event idetified by its order index
+ *
+ * @param index the location of the event to get
+ * @return the event at index
+ * @throws ArrayIndexOutOfBoundsException if index is out of bounds
+ */
+ public MidiEvent get(int index) throws ArrayIndexOutOfBoundsException
+ {
+ synchronized (events)
+ {
+ try
+ {
+ return (MidiEvent) events.get(index);
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ throw (ArrayIndexOutOfBoundsException)
+ new ArrayIndexOutOfBoundsException().initCause(e);
+ }
+ }
+ }
+
+
+ /**
+ * Get the number events in this track.
+ *
+ * @return the number of events in this track
+ */
+ public int size()
+ {
+ return events.size();
+ }
+
+ /**
+ * Get the length of the track in MIDI ticks.
+ *
+ * @return the length of the track in MIDI ticks
+ */
+ public long ticks()
+ {
+ synchronized (events)
+ {
+ int size = events.size();
+ return ((MidiEvent) events.get(size - 1)).getTick();
+ }
+ }
+ }
+
diff --git a/libjava/classpath/javax/sound/midi/Transmitter.java b/libjava/classpath/javax/sound/midi/Transmitter.java
new file mode 100644
index 00000000000..d788725e065
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/Transmitter.java
@@ -0,0 +1,70 @@
+/* Transmitter.java -- A interface for objects sending MIDI events
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * This interface specifies the methods required by objects which send
+ * MIDI events to Receivers, including MIDI IN ports and Sequencers.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Transmitter
+{
+ /**
+ * Set the Receiver to which MIDI events will be sent.
+ *
+ * @param receiver the Receiver to which MIDI events will be sent
+ */
+ public void setReceiver(Receiver receiver);
+
+ /**
+ * Get the Receiver to which MIDI events will be sent (possibly null)
+ *
+ * @return the Receiver to which MIDI events will be sent (possibly null)
+ */
+ public Receiver getReceiver();
+
+ /**
+ * Close this Transmitter, possibly releasing system resources.
+ * FIXME: Does this mean the Receiver is closed? I think it must.
+ */
+ public void close();
+}
diff --git a/libjava/classpath/javax/sound/midi/VoiceStatus.java b/libjava/classpath/javax/sound/midi/VoiceStatus.java
new file mode 100644
index 00000000000..a6a9c3f87c8
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/VoiceStatus.java
@@ -0,0 +1,79 @@
+/* VoiceStatus.java -- the current status of a Synthesizer voice
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Objects of this type define the status of a Synthesizer voice.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public class VoiceStatus
+{
+ /**
+ * True if this voice is processing a MIDI note.
+ */
+ public boolean active = false;
+
+ /**
+ * The channel for this voice when active.
+ */
+ public int channel = 0;
+
+ /**
+ * The bank of the voice when active.
+ */
+ public int bank = 0;
+
+ /**
+ * The program for this voice when active.
+ */
+ public int program = 0;
+
+ /**
+ * The note for this voice when active.
+ */
+ public int note = 0;
+
+ /**
+ * The volume for this voice when active.
+ */
+ public int volume = 0;
+}
diff --git a/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java b/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java
new file mode 100644
index 00000000000..537edb2b3d0
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java
@@ -0,0 +1,90 @@
+/* MidiDeviceProvider.java -- Abstract parent for a MIDI device provider.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import javax.sound.midi.*;
+
+/**
+ * The abstract base class for all MidiDeviceProvider types.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiDeviceProvider
+{
+ /**
+ * Returns true if this provider supports a specific MIDI device.
+ *
+ * @param info the MIDI device descriptor
+ * @return true if this provider supports info
+ */
+ public boolean isDeviceSupported(MidiDevice.Info info)
+ {
+ MidiDevice.Info infos[] = getDeviceInfo();
+
+ int i = infos.length;
+
+ while (i > 0)
+ {
+ if (info.equals(infos[--i]))
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Get the list descriptors for all MIDI devices supported by
+ * this provider.
+ *
+ * @return an array of descriptors for all supported MIDI devices.
+ */
+ public abstract MidiDevice.Info[] getDeviceInfo();
+
+ /**
+ * Get the MidiDevice for the MIDI device described by info
+ *
+ * @param info the descriptor for the MIDI device we want
+ * @return the MidiDevice we're looking for
+ * @throws IllegalArgumentException is this provider doesn't support info
+ */
+ public abstract MidiDevice getDevice(MidiDevice.Info info)
+ throws IllegalArgumentException;
+}
diff --git a/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java b/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java
new file mode 100644
index 00000000000..4342ebf5e2b
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java
@@ -0,0 +1,125 @@
+/* MidiFilerReader.java -- MIDI file reading services
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MidiFileFormat;
+import javax.sound.midi.Sequence;
+
+/**
+ * The MidiFileReader abstract class defines the methods to be provided
+ * by a MIDI file reader.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiFileReader
+{
+ /**
+ * Read a MidiFileFormat from the given stream.
+ *
+ * @param stream the stream from which to read the MIDI data
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if the stream refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract MidiFileFormat getMidiFileFormat(InputStream stream)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a MidiFileFormat from the given stream.
+ *
+ * @param url the url from which to read the MIDI data
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if the url refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract MidiFileFormat getMidiFileFormat(URL url)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a MidiFileFormat from the given stream.
+ *
+ * @param file the file from which to read the MIDI data
+ * @return the MidiFileFormat object
+ * @throws InvalidMidiDataException if the file refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract MidiFileFormat getMidiFileFormat(File file)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a Sequence from the given stream.
+ *
+ * @param stream the stream from which to read the MIDI data
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if the stream refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract Sequence getSequence(InputStream stream)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a Sequence from the given stream.
+ *
+ * @param url the url from which to read the MIDI data
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if the url refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract Sequence getSequence(URL url)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Read a Sequence from the given stream.
+ *
+ * @param file the file from which to read the MIDI data
+ * @return the Sequence object
+ * @throws InvalidMidiDataException if the file refers to invalid data
+ * @throws IOException if an I/O exception occurs while reading
+ */
+ public abstract Sequence getSequence(File file)
+ throws InvalidMidiDataException, IOException;
+}
diff --git a/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java b/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java
new file mode 100644
index 00000000000..e2a1f55c6e0
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java
@@ -0,0 +1,143 @@
+/* MidiFileWriter.java -- MIDI file writing services
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.sound.midi.Sequence;
+
+/**
+ * MidiFileWriter provides MIDI file writing services.
+ *
+ * There are three types of Standard MIDI File (SMF) formats,
+ * represented by integers 0, 1, and 2.
+ *
+ * Type 0 files contain a single track and represents a single song
+ * performance.
+ * Type 1 may contain multiple tracks for a single song performance.
+ * Type 2 may contain multiple tracks, each representing a
+ * separate song performance.
+ *
+ * See http://en.wikipedia.org/wiki/MIDI#MIDI_file_formats for more
+ * information.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiFileWriter
+{
+ /**
+ * Return the MIDI file types supported by this writer.
+ *
+ * @return the MIDI file types, or an empty array
+ */
+ public abstract int[] getMidiFileTypes();
+
+ /**
+ * Return the MIDI file types supported by this writer for the
+ * given sequence.
+ *
+ * @param sequence the sequence we'd like to write
+ * @return the MIDI file types, or an empty array
+ */
+ public abstract int[] getMidiFileTypes(Sequence sequence);
+
+ /**
+ * Returns true if this writer supports the given file type.
+ *
+ * @param fileType the file type we're asking about
+ * @return true if this writer supports fileType, false otherwise
+ */
+ public boolean isFileTypeSupported(int fileType)
+ {
+ int types[] = getMidiFileTypes();
+ for (int i = types.length; i > 0;)
+ {
+ if (types[--i] == fileType)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this writer supports the given file type for the
+ * given sequence.
+ *
+ * @param fileType the file type we're asking about
+ * @param sequence the sequence we'd like to write
+ * @return true if this writer supports fileType, false otherwise
+ */
+ public boolean isFileTypeSupported(int fileType, Sequence sequence)
+ {
+ int types[] = getMidiFileTypes(sequence);
+ for (int i = types.length; i > 0;)
+ {
+ if (types[--i] == fileType)
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Write a sequence to a stream using the specified MIDI file type.
+ *
+ * @param in the sequence to write
+ * @param fileType the MIDI file type to use
+ * @param out the output stream to write to
+ * @return the number of byte written
+ * @throws IOException if an I/O exception happens
+ */
+ public abstract int write(Sequence in, int fileType, OutputStream out)
+ throws IOException;
+
+ /**
+ * Write a sequence to a file using the specified MIDI file type.
+ *
+ * @param in the sequence to write
+ * @param fileType the MIDI file type to use
+ * @param out the file to write to
+ * @return the number of byte written
+ * @throws IOException if an I/O exception happens
+ */
+ public abstract int write(Sequence in, int fileType, File out)
+ throws IOException;
+}
diff --git a/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java b/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java
new file mode 100644
index 00000000000..dbf2bb0183a
--- /dev/null
+++ b/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java
@@ -0,0 +1,97 @@
+/* SoundbankReader.java -- Soundbank file reading services
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.Soundbank;
+
+/**
+ * The SoundbankReader abstract class defines the methods to be provided
+ * by a soundbank file reader.
+ *
+ * @author Anthony Green (green@redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class SoundbankReader
+{
+ /**
+ * Get a Soundbank from the given URL.
+ *
+ * @param url from which to read the Soundbank
+ *
+ * @return the Soundbank object
+ *
+ * @throws InvalidMidiDataException if the data provided by url cannot be recognized
+ * @throws IOException if the data provided by url cannot be read
+ */
+ public abstract Soundbank getSoundbank(URL url)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Get a Soundbank from the given InputStream.
+ *
+ * @param stream from which to read the Soundbank
+ *
+ * @return the Soundbank object
+ *
+ * @throws InvalidMidiDataException if the data provided by InputStream cannot be recognized
+ * @throws IOException if the data provided by InputStream cannot be read
+ */
+ public abstract Soundbank getSoundbank(InputStream stream)
+ throws InvalidMidiDataException, IOException;
+
+ /**
+ * Get a Soundbank from the given File.
+ *
+ * @param file from which to read the Soundbank
+ *
+ * @return the Soundbank object
+ *
+ * @throws InvalidMidiDataException if the data provided by File cannot be recognized
+ * @throws IOException if the data provided by File cannot be read
+ */
+ public abstract Soundbank getSoundbank(File file)
+ throws InvalidMidiDataException, IOException;
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioFileFormat.java b/libjava/classpath/javax/sound/sampled/AudioFileFormat.java
new file mode 100644
index 00000000000..81bbe4ecf10
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioFileFormat.java
@@ -0,0 +1,242 @@
+/* Audio file format
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This describes an audio file, including information about its length,
+ * the format of the audio data, and other things.
+ * @since 1.3
+ */
+public class AudioFileFormat
+{
+ /**
+ * An instance of this type describes a standard audio file format.
+ * @since 1.3
+ */
+ public static class Type
+ {
+ // This is kind of goofy since there are multiple extensions for
+ // some of these.
+
+ /** The AIFC format. */
+ public static final Type AIFC = new Type("AIFC", "aifc");
+
+ /** The AIFF format. */
+ public static final Type AIFF = new Type("AIFF", "aiff");
+
+ /** The AU format. */
+ public static final Type AU = new Type("AU", "au");
+
+ /** The SND format. */
+ public static final Type SND = new Type("SND", "snd");
+
+ /** The WAVE format. */
+ public static final Type WAVE = new Type ("WAVE", "wav");
+
+ private String name;
+ private String extension;
+
+ /**
+ * Create a new Type given its name and file extension.
+ * The file extension does not include the ".".
+ * @param name the type's name
+ * @param extension the file extension
+ */
+ public Type(String name, String extension)
+ {
+ this.name = name;
+ this.extension = extension;
+ }
+
+ public final boolean equals(Object o)
+ {
+ if (! (o instanceof Type))
+ return false;
+ Type other = (Type) o;
+ return name.equals(other.name) && extension.equals(other.extension);
+ }
+
+ public final int hashCode()
+ {
+ return name.hashCode() + extension.hashCode();
+ }
+
+ /**
+ * Return the extension associated with this Type.
+ */
+ public String getExtension()
+ {
+ return extension;
+ }
+
+ /**
+ * Return the name of this Type.
+ */
+ public final String toString()
+ {
+ return name;
+ }
+ }
+
+ private int byteLength;
+ private AudioFormat format;
+ private Type type;
+ private int frameLength;
+ private Map properties;
+
+ /**
+ * Create a new AudioFileFormat given the type, the format, and the
+ * frame length. The new object will have an unspecified byte length,
+ * and an empty properties map.
+ * @param type the type
+ * @param fmt the format
+ * @param frameLen the frame length
+ */
+ public AudioFileFormat(Type type, AudioFormat fmt, int frameLen)
+ {
+ this.byteLength = AudioSystem.NOT_SPECIFIED;
+ this.format = fmt;
+ this.type = type;
+ this.frameLength = frameLen;
+ this.properties = Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Create a new AudioFileFormat given the type, the format, the
+ * frame length, and some properties. The new object will have an
+ * unspecified byte length. A copy of the properties argument will
+ * be made, so changes to the map passed in will not affect the
+ * new AudioFileFormat.
+ * @param type the type
+ * @param fmt the format
+ * @param frameLen the frame length
+ * @param properties the properties
+ */
+ public AudioFileFormat(Type type, AudioFormat fmt, int frameLen,
+ Map properties)
+ {
+ this.byteLength = AudioSystem.NOT_SPECIFIED;
+ this.format = fmt;
+ this.type = type;
+ this.frameLength = frameLen;
+ this.properties = Collections.unmodifiableMap(new HashMap(properties));
+ }
+
+ /**
+ * Create a new AudioFileFormat given the type, the byte length, the format,
+ * and the frame length. The new object will have an empty properties map.
+ * @param type the type
+ * @param byteLen the byte length
+ * @param fmt the format
+ * @param frameLen the frame length
+ */
+ protected AudioFileFormat(Type type, int byteLen, AudioFormat fmt,
+ int frameLen)
+ {
+ this.byteLength = byteLen;
+ this.format = fmt;
+ this.type = type;
+ this.frameLength = frameLen;
+ this.properties = Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Return the byte length of this file format.
+ */
+ public int getByteLength()
+ {
+ return byteLength;
+ }
+
+ /**
+ * Return the AudioFormat associated with this file format.
+ */
+ public AudioFormat getFormat()
+ {
+ return format;
+ }
+
+ /**
+ * Return the frame length of this file format.
+ */
+ public int getFrameLength()
+ {
+ return frameLength;
+ }
+
+ /**
+ * Return the value of a property defined in this format.
+ * @param key the property name
+ * @return the value of the property, or null if the property is not defined
+ */
+ public Object getProperty(String key)
+ {
+ return properties.get(key);
+ }
+
+ /**
+ * Return the Type associated with this file format.
+ */
+ public Type getType()
+ {
+ return type;
+ }
+
+ /**
+ * Return the properties associated with this format, as a Map.
+ * The returned Map is unmodifiable.
+ */
+ public Map properties()
+ {
+ return properties;
+ }
+
+ /**
+ * Return a description of this AudioFileFormat.
+ */
+ public String toString()
+ {
+ return ("byteLength=" + byteLength + "; format=" + format
+ + "; type=" + type + "; frameLength=" + frameLength);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioFormat.java b/libjava/classpath/javax/sound/sampled/AudioFormat.java
new file mode 100644
index 00000000000..5199d71c3a3
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioFormat.java
@@ -0,0 +1,345 @@
+/* An audio format
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This class describes an audio format, including its encoding,
+ * the number of channels, its frame rate, etc.
+ * @since 1.3
+ */
+public class AudioFormat
+{
+ /**
+ * This describes a given audio format encoding.
+ * @since 1.3
+ */
+ public static class Encoding
+ {
+ /** The ALAW encoding. */
+ public static final Encoding ALAW = new Encoding("alaw");
+
+ /** The signed PCM encoding. */
+ public static final Encoding PCM_SIGNED = new Encoding("pcm_signed");
+
+ /** The unsigned PCM encoding. */
+ public static final Encoding PCM_UNSIGNED = new Encoding("pcm_unsigned");
+
+ /** The ULAW encoding. */
+ public static final Encoding ULAW = new Encoding("ulaw");
+
+ private String name;
+
+ /**
+ * Create a new encoding descriptor, given its name.
+ * @param name the name
+ */
+ public Encoding(String name)
+ {
+ this.name = name;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of this encoding.
+ */
+ public final String toString()
+ {
+ return name;
+ }
+ }
+
+ /**
+ * True if the audio data is stored big-endian.
+ */
+ protected boolean bigEndian;
+
+ /**
+ * The number of channels of data in this format.
+ */
+ protected int channels;
+
+ /**
+ * The encoding of this format.
+ */
+ protected Encoding encoding;
+
+ /**
+ * The frame rate of this format. This is the number of frames
+ * per second.
+ */
+ protected float frameRate;
+
+ /**
+ * The number of bytes per frame in this format.
+ */
+ protected int frameSize;
+
+ /**
+ * The number of samples per second.
+ */
+ protected float sampleRate;
+
+ /**
+ * The number of bits in each sample.
+ */
+ protected int sampleSizeInBits;
+
+ private Map properties;
+
+ /**
+ * Create a new audio format, given various attributes of it.
+ * The properties map for this format will be empty.
+ *
+ * @param encoding the encoding for this format
+ * @param sampleRate the sample rate
+ * @param sampleSizeInBits the sample size, in bits
+ * @param channels the number of channels
+ * @param frameSize the frame size, in bytes
+ * @param frameRate the frame rate, in frames per second
+ * @param bigEndian true if the data is stored big-endian
+ */
+ public AudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits,
+ int channels, int frameSize, float frameRate,
+ boolean bigEndian)
+ {
+ this.encoding = encoding;
+ this.sampleRate = sampleRate;
+ this.sampleSizeInBits = sampleSizeInBits;
+ this.channels = channels;
+ this.frameSize = frameSize;
+ this.frameRate = frameRate;
+ this.bigEndian = bigEndian;
+ this.properties = Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Create a new audio format, given various attributes of it.
+ * The properties map is copied by this constructor, so changes
+ * to the argument Map will not affect the new object.
+ *
+ * @param encoding the encoding for this format
+ * @param sampleRate the sample rate
+ * @param sampleSizeInBits the sample size, in bits
+ * @param channels the number of channels
+ * @param frameSize the frame size, in bytes
+ * @param frameRate the frame rate, in frames per second
+ * @param bigEndian true if the data is stored big-endian
+ * @param properties a map describing properties of this format
+ */
+ public AudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits,
+ int channels, int frameSize, float frameRate,
+ boolean bigEndian, Map properties)
+ {
+ this.encoding = encoding;
+ this.sampleRate = sampleRate;
+ this.sampleSizeInBits = sampleSizeInBits;
+ this.channels = channels;
+ this.frameSize = frameSize;
+ this.frameRate = frameRate;
+ this.bigEndian = bigEndian;
+ this.properties = Collections.unmodifiableMap(new HashMap(properties));
+ }
+
+ /**
+ * Create a new PCM-based audio format, given various attributes of it.
+ * The encoding will either be Encoding#PCM_SIGNED or Encoding#PCM_UNSIGNED.
+ * The frame size for this format will be derived from the sample size in
+ * bits and the number of channels, unless one of those is
+ * AudioSystem#NOT_SPECIFIED. The frame rate will be the same as the sample
+ * rate, and the properties map will be empty.
+ *
+ * @param sampleRate the sample rate
+ * @param sampleSizeInBits the sample size, in bits
+ * @param channels the number of channels
+ * @param signed true if this is a signed encoding
+ * @param bigEndian true if the data is stored big-endian
+ */
+ public AudioFormat(float sampleRate, int sampleSizeInBits,
+ int channels, boolean signed, boolean bigEndian)
+ {
+ this.encoding = signed ? Encoding.PCM_SIGNED : Encoding.PCM_UNSIGNED;
+ this.sampleRate = sampleRate;
+ this.sampleSizeInBits = sampleSizeInBits;
+ this.channels = channels;
+ // It isn't clear whether channels can be NOT_SPECIFIED.
+ if (sampleSizeInBits == AudioSystem.NOT_SPECIFIED
+ || channels == AudioSystem.NOT_SPECIFIED)
+ this.frameSize = AudioSystem.NOT_SPECIFIED;
+ else
+ this.frameSize = (sampleSizeInBits + 7) / 8 * channels;
+ this.frameRate = sampleRate;
+ this.bigEndian = bigEndian;
+ this.properties = Collections.EMPTY_MAP;
+ }
+
+ /**
+ * Return the number of channels in this format.
+ */
+ public int getChannels()
+ {
+ return channels;
+ }
+
+ /**
+ * Return the encoding of this format.
+ */
+ public Encoding getEncoding()
+ {
+ return encoding;
+ }
+
+ /**
+ * Return the frame rate of this format.
+ */
+ public float getFrameRate()
+ {
+ return frameRate;
+ }
+
+ /**
+ * Return the frame size of this format.
+ */
+ public int getFrameSize()
+ {
+ return frameSize;
+ }
+
+ /**
+ * Given a key, return a property associated with this format;
+ * or null if this property is not set.
+ * @param key the name of the property
+ * @return the value of the property, or null if the property is not set
+ */
+ public Object getProperty(String key)
+ {
+ return properties.get(key);
+ }
+
+ /**
+ * Return the sample rate of this format.
+ */
+ public float getSampleRate()
+ {
+ return sampleRate;
+ }
+
+ /**
+ * Return the sample size of this format, in bits.
+ */
+ public int getSampleSizeInBits()
+ {
+ return sampleSizeInBits;
+ }
+
+ /**
+ * Return true if this format is big endian, false otherwise.
+ * This only matters for formats whose sample size is greater than
+ * one byte.
+ */
+ public boolean isBigEndian()
+ {
+ return bigEndian;
+ }
+
+ /**
+ * Return true if this audio format matches another.
+ * @param fmt the format to match against
+ * @return true if they match, false otherwise
+ */
+ public boolean matches(AudioFormat fmt)
+ {
+ if (! encoding.equals(fmt.encoding)
+ || channels != fmt.channels
+ || sampleSizeInBits != fmt.sampleSizeInBits
+ || frameSize != fmt.frameSize)
+ return false;
+ if (sampleRate != AudioSystem.NOT_SPECIFIED
+ && fmt.sampleRate != AudioSystem.NOT_SPECIFIED
+ && sampleRate != fmt.sampleRate)
+ return false;
+ if (frameRate != AudioSystem.NOT_SPECIFIED
+ && fmt.frameRate != AudioSystem.NOT_SPECIFIED
+ && frameRate != fmt.frameRate)
+ return false;
+ if (sampleSizeInBits > 8)
+ return bigEndian == fmt.bigEndian;
+ return true;
+ }
+
+ /**
+ * Return a read-only Map holding the properties associated with
+ * this format.
+ */
+ public Map properties()
+ {
+ return properties;
+ }
+
+ /**
+ * Return a description of this format.
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append(encoding);
+ result.append(" ");
+ result.append(sampleRate);
+ result.append(" Hz ");
+ result.append(sampleSizeInBits);
+ result.append(" bits ");
+ result.append(channels);
+ result.append(" channels");
+ if (sampleSizeInBits > 8)
+ result.append(bigEndian ? " big endian" : " little endian");
+ return result.toString();
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioInputStream.java b/libjava/classpath/javax/sound/sampled/AudioInputStream.java
new file mode 100644
index 00000000000..863578b0b6d
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioInputStream.java
@@ -0,0 +1,258 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * This is an InputStream which is specialized for reading audio files.
+ * In particular it only allows operations to act on a multiple of
+ * the audio stream's frame size.
+ * @since 1.3
+ */
+public class AudioInputStream extends InputStream
+{
+ /** The format of the audio stream. */
+ protected AudioFormat format;
+
+ /** The length of the audio stream in frames. */
+ protected long frameLength;
+
+ /** The current frame position, starting from frame zero. */
+ protected long framePos;
+
+ /** The size of a frame in bytes. */
+ protected int frameSize;
+
+ // I wonder why this class doesn't inherit from FilterInputStream.
+ private InputStream input;
+
+ // The saved frame position, used for mark/reset.
+ private long markedFramePos;
+
+ /**
+ * Create a new AudioInputStream given an underlying InputStream,
+ * the audio format, and the length of the data in frames. The
+ * frame size is taken from the format.
+ * @param is the underlying input stream
+ * @param fmt the format of the data
+ * @param length the length of the data in frames
+ */
+ public AudioInputStream(InputStream is, AudioFormat fmt, long length)
+ {
+ this.format = fmt;
+ this.frameLength = length;
+ this.framePos = 0;
+ this.frameSize = fmt.getFrameSize();
+ this.input = is;
+ }
+
+ /**
+ * Create a new AudioInputStream given a TargetDataLine. The audio
+ * format and the frame size are taken from the line.
+ * @param line the TargetDataLine
+ */
+ public AudioInputStream(TargetDataLine line)
+ {
+ this(new TargetInputStream(line), line.getFormat(),
+ AudioSystem.NOT_SPECIFIED);
+ }
+
+ /**
+ * Return the number of bytes available to be read from the
+ * underlying stream. This wrapper method ensures that the result
+ * is always a multiple of the frame size.
+ */
+ public int available() throws IOException
+ {
+ int result = input.available();
+ // Ensure result is a multiple of the frame size.
+ if (frameSize != AudioSystem.NOT_SPECIFIED)
+ result -= result % frameSize;
+ return result;
+ }
+
+ /**
+ * Close the stream.
+ */
+ public void close() throws IOException
+ {
+ input.close();
+ }
+
+ /**
+ * Get the format associated with this stream.
+ * @return the AudioFormat
+ */
+ public AudioFormat getFormat()
+ {
+ return format;
+ }
+
+ /**
+ * Get the length of this stream in frames. Note that this
+ * may be AudioSystem#NOT_SPECIFIED.
+ * @return the length of the stream in frames
+ */
+ public long getFrameLength()
+ {
+ return frameLength;
+ }
+
+ public void mark(int limit)
+ {
+ input.mark(limit);
+ markedFramePos = framePos;
+ }
+
+ /**
+ * Return true if the underlying stream supports mark and reset,
+ * false otherwise.
+ */
+ public boolean markSupported()
+ {
+ return input.markSupported();
+ }
+
+ /**
+ * Read a single byte from the underlying stream. If the frame
+ * size is set, and is not one byte, an IOException will be thrown.
+ */
+ public int read() throws IOException
+ {
+ if (frameSize != 1)
+ throw new IOException("frame size must be 1 for read()");
+ int result;
+ if (framePos == frameLength)
+ result = -1;
+ else
+ result = input.read();
+ if (result != -1)
+ ++framePos;
+ return result;
+ }
+
+ public int read(byte[] buf) throws IOException
+ {
+ return read(buf, 0, buf.length);
+ }
+
+ public int read(byte[] buf, int offset, int length) throws IOException
+ {
+ int result;
+ if (framePos == frameLength)
+ result = -1;
+ else
+ {
+ int myFrameSize = (frameSize == AudioSystem.NOT_SPECIFIED
+ ? 1 : frameSize);
+ // Ensure length is a multiple of frame size.
+ length -= length % myFrameSize;
+
+ result = 0;
+ while (result == 0 || result % myFrameSize != 0)
+ {
+ int val = input.read(buf, offset, length);
+ if (val < 0)
+ {
+ // This is a weird situation as we might have read a
+ // frame already. It isn't clear at all what to do if
+ // we only found a partial frame. For now we just
+ // return whatever we did find.
+ if (result == 0)
+ return -1;
+ result -= result % myFrameSize;
+ break;
+ }
+ result += val;
+ }
+ // assert result % myFrameSize == 0;
+ framePos += result / myFrameSize;
+ }
+ return result;
+ }
+
+ public void reset() throws IOException
+ {
+ input.reset();
+ framePos = markedFramePos;
+ }
+
+ public long skip(long n) throws IOException
+ {
+ if (frameSize != AudioSystem.NOT_SPECIFIED)
+ n -= n % frameSize;
+ long actual = input.skip(n);
+ if (frameSize != AudioSystem.NOT_SPECIFIED)
+ framePos += actual / frameSize;
+ return actual;
+ }
+
+ private static class TargetInputStream extends InputStream
+ {
+ private TargetDataLine line;
+ private byte[] buf;
+
+ /**
+ * Create a new TargetInputStream.
+ * @param line the line to wrap
+ */
+ public TargetInputStream(TargetDataLine line)
+ {
+ this.line = line;
+ // FIXME: do we have to call line.open()?
+ }
+
+ public synchronized int read() throws IOException
+ {
+ if (buf == null)
+ buf = new byte[1];
+ int count = read(buf, 0, 1);
+ if (count < 0)
+ return -1;
+ return buf[0];
+ }
+
+ public int read(byte[] buf, int offset, int length) throws IOException
+ {
+ return line.read(buf, offset, length);
+ }
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioPermission.java b/libjava/classpath/javax/sound/sampled/AudioPermission.java
new file mode 100644
index 00000000000..6698e35ced2
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioPermission.java
@@ -0,0 +1,70 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.security.BasicPermission;
+
+/**
+ * This represents the permission to use an audio device.
+ * The only predefined permission names are "play" and "record".
+ * @since 1.3
+ */
+public class AudioPermission extends BasicPermission
+{
+ private static final long serialVersionUID = -5518053473477801126L;
+
+ /**
+ * Construct an AudioPermission with the given name.
+ * @param name the name of the permission, like "play" or "record"
+ */
+ public AudioPermission(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Construct an AudioPermission with the given name.
+ * @param name the name of the permission, like "play" or "record"
+ * @param actions the actions; should be null
+ */
+ public AudioPermission(String name, String actions)
+ {
+ super(name, actions);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/AudioSystem.java b/libjava/classpath/javax/sound/sampled/AudioSystem.java
new file mode 100644
index 00000000000..0b0b754b59e
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/AudioSystem.java
@@ -0,0 +1,744 @@
+/* Main interface to audio system
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import gnu.classpath.ServiceFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.sound.sampled.spi.AudioFileReader;
+import javax.sound.sampled.spi.AudioFileWriter;
+import javax.sound.sampled.spi.FormatConversionProvider;
+import javax.sound.sampled.spi.MixerProvider;
+
+/**
+ * This clas is the primary interface to the audio system. It contains
+ * a number of static methods which can be used to access this package's
+ * functionality.
+ *
+ * @since 1.3
+ */
+public class AudioSystem
+{
+ /**
+ * A constant which can be passed to a number of methods in this package,
+ * to indicate an unspecified value.
+ */
+ public static final int NOT_SPECIFIED = -1;
+
+ /**
+ * Return the file format of a given File.
+ * @param f the file to check
+ * @return the format of the file
+ * @throws UnsupportedAudioFileException if the file's format is not
+ * recognized
+ * @throws IOException if there is an I/O error reading the file
+ */
+ public static AudioFileFormat getAudioFileFormat(File f)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioFileFormat(f);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("file type not recognized");
+ }
+
+ /**
+ * Return the file format of a given input stream.
+ * @param is the input stream to check
+ * @return the format of the stream
+ * @throws UnsupportedAudioFileException if the stream's format is not
+ * recognized
+ * @throws IOException if there is an I/O error reading the stream
+ */
+ public static AudioFileFormat getAudioFileFormat(InputStream is)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioFileFormat(is);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("input stream type not recognized");
+ }
+
+ /**
+ * Return the file format of a given URL.
+ * @param url the URL to check
+ * @return the format of the URL
+ * @throws UnsupportedAudioFileException if the URL's format is not
+ * recognized
+ * @throws IOException if there is an I/O error reading the URL
+ */
+ public static AudioFileFormat getAudioFileFormat(URL url)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioFileFormat(url);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("URL type not recognized");
+ }
+
+ /**
+ * Return an array of all the supported AudioFileFormat types.
+ * @return an array of unique types
+ */
+ public static AudioFileFormat.Type[] getAudioFileTypes()
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+ while (i.hasNext())
+ {
+ AudioFileWriter writer = (AudioFileWriter) i.next();
+ AudioFileFormat.Type[] types = writer.getAudioFileTypes();
+ for (int j = 0; j < types.length; ++j)
+ result.add(types[j]);
+ }
+ return (AudioFileFormat.Type[]) result.toArray(new AudioFileFormat.Type[result.size()]);
+ }
+
+ /**
+ * Return an array of all the supported AudioFileFormat types which match the
+ * given audio input stream
+ * @param ais the audio input stream
+ * @return an array of unique types
+ */
+ public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream ais)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+ while (i.hasNext())
+ {
+ AudioFileWriter writer = (AudioFileWriter) i.next();
+ AudioFileFormat.Type[] types = writer.getAudioFileTypes(ais);
+ for (int j = 0; j < types.length; ++j)
+ result.add(types[j]);
+ }
+ return (AudioFileFormat.Type[]) result.toArray(new AudioFileFormat.Type[result.size()]);
+ }
+
+ /**
+ * Given an audio input stream, this will try to create a new audio input
+ * stream whose encoding matches the given target encoding. If no provider
+ * offers this conversion, an exception is thrown.
+ * @param targ the target encoding
+ * @param ais the original audio stream
+ * @return a new audio stream
+ * @throws IllegalArgumentException if the conversion cannot be made
+ */
+ public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targ,
+ AudioInputStream ais)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (! prov.isConversionSupported(targ, ais.getFormat()))
+ continue;
+ return prov.getAudioInputStream(targ, ais);
+ }
+ throw new IllegalArgumentException("encoding not supported for stream");
+ }
+
+ /**
+ * Given an audio input stream, this will try to create a new audio input
+ * stream whose format matches the given target format. If no provider
+ * offers this conversion, an exception is thrown.
+ * @param targ the target format
+ * @param ais the original audio stream
+ * @return a new audio stream
+ * @throws IllegalArgumentException if the conversion cannot be made
+ */
+ public static AudioInputStream getAudioInputStream(AudioFormat targ,
+ AudioInputStream ais)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (! prov.isConversionSupported(targ, ais.getFormat()))
+ continue;
+ return prov.getAudioInputStream(targ, ais);
+ }
+ throw new IllegalArgumentException("format not supported for stream");
+ }
+
+ /**
+ * Return an audio input stream for the file.
+ * @param f the file to read
+ * @return an audio input stream for the file
+ * @throws UnsupportedAudioFileException if the file's audio format is not
+ * recognized
+ * @throws IOException if there is an error while reading the file
+ */
+ public static AudioInputStream getAudioInputStream(File f)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioInputStream(f);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("file type not recognized");
+ }
+
+ /**
+ * Return an audio input stream given an input stream.
+ * @param is the input stream
+ * @return an audio input stream
+ * @throws UnsupportedAudioFileException if the input stream's audio format
+ * is not supported by any of the installed providers
+ * @throws IOException if there is an error while reading the input stream
+ */
+ public static AudioInputStream getAudioInputStream(InputStream is)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioInputStream(is);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("input stream type not recognized");
+ }
+
+ /**
+ * Return an audio input stream for the given URL.
+ * @param url the URL
+ * @return an audio input stream
+ * @throws UnsupportedAudioFileException if the URL's audio format is not
+ * supported by any of the installed providers
+ * @throws IOException if there is an error while reading the URL
+ */
+ public static AudioInputStream getAudioInputStream(URL url)
+ throws UnsupportedAudioFileException, IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+ while (i.hasNext())
+ {
+ AudioFileReader reader = (AudioFileReader) i.next();
+ try
+ {
+ return reader.getAudioInputStream(url);
+ }
+ catch (UnsupportedAudioFileException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new UnsupportedAudioFileException("URL type not recognized");
+ }
+
+ /**
+ * Return a new clip which can be used for playing back an audio stream.
+ * @throws LineUnavailableException if a clip is not available for some
+ * reason
+ * @throws SecurityException if a clip cannot be made for security reasons
+ * @since 1.5
+ */
+ public static Clip getClip()
+ throws LineUnavailableException
+ {
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ Mixer mix = getMixer(infos[i]);
+ Line[] lines = mix.getSourceLines();
+ for (int j = 0; j < lines.length; ++j)
+ {
+ if (lines[j] instanceof Clip)
+ return (Clip) lines[j];
+ }
+ }
+ throw new LineUnavailableException("no Clip available");
+ }
+
+ /**
+ * Return a new clip which can be used for playing back an audio stream.
+ * The clip is obtained from the indicated mixer.
+ * @param info the mixer to use
+ * @throws LineUnavailableException if a clip is not available for some
+ * reason
+ * @throws SecurityException if a clip cannot be made for security reasons
+ * @since 1.5
+ */
+ public static Clip getClip(Mixer.Info info)
+ throws LineUnavailableException
+ {
+ Mixer mix = getMixer(info);
+ Line[] lines = mix.getSourceLines();
+ for (int j = 0; j < lines.length; ++j)
+ {
+ if (lines[j] instanceof Clip)
+ return (Clip) lines[j];
+ }
+ throw new LineUnavailableException("no Clip available");
+ }
+
+ /**
+ * Return a line matching the provided description. All the providers
+ * on the system are searched for a matching line.
+ * @param info description of the line
+ * @return the matching line
+ * @throws LineUnavailableException if no provider supplies a matching line
+ */
+ public static Line getLine(Line.Info info) throws LineUnavailableException
+ {
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ Mixer mix = getMixer(infos[i]);
+ try
+ {
+ return mix.getLine(info);
+ }
+ catch (LineUnavailableException _)
+ {
+ // Try the next provider.
+ }
+ }
+ throw new LineUnavailableException("no Clip available");
+ }
+
+ /**
+ * Return a mixer matching the provided description. All the providers
+ * on the system are searched for a matching mixer.
+ * @param info description of the mixer
+ * @return the matching mixer
+ * @throws IllegalArgumentException if no provider supplies a matching mixer
+ */
+ public static Mixer getMixer(Mixer.Info info)
+ {
+ Iterator i = ServiceFactory.lookupProviders(MixerProvider.class);
+ while (i.hasNext())
+ {
+ MixerProvider prov = (MixerProvider) i.next();
+ if (prov.isMixerSupported(info))
+ return prov.getMixer(info);
+ }
+ throw new IllegalArgumentException("mixer not found");
+ }
+
+ /**
+ * Return an array of descriptions of all the mixers provided on the system.
+ */
+ public static Mixer.Info[] getMixerInfo()
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(MixerProvider.class);
+ while (i.hasNext())
+ {
+ MixerProvider prov = (MixerProvider) i.next();
+ Mixer.Info[] is = prov.getMixerInfo();
+ for (int j = 0; j < is.length; ++j)
+ result.add(is[j]);
+ }
+ return (Mixer.Info[]) result.toArray(new Mixer.Info[result.size()]);
+ }
+
+ /**
+ * Return a source data line matching the given audio format.
+ * @param fmt the audio format
+ * @throws LineUnavailableException if no source data line matching
+ * this format is available
+ * @since 1.5
+ */
+ public static SourceDataLine getSourceDataLine(AudioFormat fmt)
+ throws LineUnavailableException
+ {
+ DataLine.Info info = new DataLine.Info(SourceDataLine.class, fmt);
+ Mixer.Info[] mixers = getMixerInfo();
+ for (int i = 0; i < mixers.length; ++i)
+ {
+ Mixer mix = getMixer(mixers[i]);
+ if (mix.isLineSupported(info))
+ return (SourceDataLine) mix.getLine(info);
+ }
+ throw new LineUnavailableException("source data line not found");
+ }
+
+ /**
+ * Return a target data line matching the given audio format.
+ * @param fmt the audio format
+ * @throws LineUnavailableException if no target data line matching
+ * this format is available
+ * @since 1.5
+ */
+ public static SourceDataLine getSourceDataLine(AudioFormat fmt,
+ Mixer.Info mixer)
+ throws LineUnavailableException
+ {
+ DataLine.Info info = new DataLine.Info(SourceDataLine.class, fmt);
+ Mixer mix = getMixer(mixer);
+ if (mix.isLineSupported(info))
+ return (SourceDataLine) mix.getLine(info);
+ throw new LineUnavailableException("source data line not found");
+ }
+
+ /**
+ * Return an array of descriptions of all the source lines matching
+ * the given line description.
+ * @param info description of the lines to match
+ */
+ public static Line.Info[] getSourceLineInfo(Line.Info info)
+ {
+ HashSet result = new HashSet();
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ Mixer mix = getMixer(infos[i]);
+ Line.Info[] srcs = mix.getSourceLineInfo(info);
+ for (int j = 0; j < srcs.length; ++j)
+ result.add(srcs[j]);
+ }
+ return (Line.Info[]) result.toArray(new Line.Info[result.size()]);
+ }
+
+ /**
+ * Find and return a target data line matching the given audio format.
+ * @param fmt the format to match
+ * @throws LineUnavailableException if no matching line was found
+ * @since 1.5
+ */
+ public static TargetDataLine getTargetDataLine(AudioFormat fmt)
+ throws LineUnavailableException
+ {
+ DataLine.Info info = new DataLine.Info(TargetDataLine.class, fmt);
+ Mixer.Info[] mixers = getMixerInfo();
+ for (int i = 0; i < mixers.length; ++i)
+ {
+ Mixer mix = getMixer(mixers[i]);
+ if (mix.isLineSupported(info))
+ return (TargetDataLine) mix.getLine(info);
+ }
+ throw new LineUnavailableException("target data line not found");
+ }
+
+ /**
+ * Return a target data line matching the given audio format and
+ * mixer.
+ * @param fmt the audio format
+ * @param mixer the mixer description
+ * @return a target data line
+ * @throws LineUnavailableException if no matching target data line was
+ * found
+ * @since 1.5
+ */
+ public static TargetDataLine getTargetDataLine(AudioFormat fmt,
+ Mixer.Info mixer)
+ throws LineUnavailableException
+ {
+ DataLine.Info info = new DataLine.Info(TargetDataLine.class, fmt);
+ Mixer mix = getMixer(mixer);
+ if (mix.isLineSupported(info))
+ return (TargetDataLine) mix.getLine(info);
+ throw new LineUnavailableException("target data line not found");
+ }
+
+ /**
+ * Given a source encoding, return an array of all target encodings to which
+ * data in this form can be converted.
+ * @param source the source encoding
+ */
+ public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding source)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (! prov.isSourceEncodingSupported(source))
+ continue;
+ AudioFormat.Encoding[] es = prov.getTargetEncodings();
+ for (int j = 0; j < es.length; ++j)
+ result.add(es[j]);
+ }
+ return (AudioFormat.Encoding[]) result.toArray(new AudioFormat.Encoding[result.size()]);
+ }
+
+ /**
+ * Given a source format, return an array of all the target encodings to
+ * which data in this format can be converted.
+ * @param source the source format
+ */
+ public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat source)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ AudioFormat.Encoding[] es = prov.getTargetEncodings(source);
+ for (int j = 0; j < es.length; ++j)
+ result.add(es[j]);
+ }
+ return (AudioFormat.Encoding[]) result.toArray(new AudioFormat.Encoding[result.size()]);
+ }
+
+ /**
+ * Given a target encoding and a source audio format, return an array of all
+ * matching audio formats to which data in this source format can be converted.
+ * @param encoding the target encoding
+ * @param sourceFmt the source format
+ */
+ public static AudioFormat[] getTargetFormats(AudioFormat.Encoding encoding,
+ AudioFormat sourceFmt)
+ {
+ HashSet result = new HashSet();
+ Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ AudioFormat[] es = prov.getTargetFormats(encoding, sourceFmt);
+ for (int j = 0; j < es.length; ++j)
+ result.add(es[j]);
+ }
+ return (AudioFormat[]) result.toArray(new AudioFormat[result.size()]);
+ }
+
+ /**
+ * Given a line description, return an array of descriptions of all
+ * the matching target lines.
+ * @param info the line description
+ */
+ public static Line.Info[] getTargetLineInfo(Line.Info info)
+ {
+ HashSet result = new HashSet();
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ Mixer mix = getMixer(infos[i]);
+ Line.Info[] targs = mix.getTargetLineInfo(info);
+ for (int j = 0; j < targs.length; ++j)
+ result.add(targs[j]);
+ }
+ return (Line.Info[]) result.toArray(new Line.Info[result.size()]);
+ }
+
+ /**
+ * Return true if the currently installed providers are able to
+ * convert data from the given source format to the given target encoding.
+ * @param targ the target encoding
+ * @param source the source format
+ */
+ public static boolean isConversionSupported(AudioFormat.Encoding targ,
+ AudioFormat source)
+ {
+ Iterator i
+ = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (prov.isConversionSupported(targ, source))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if the currently installed providers are able to convert
+ * the given source format to the given target format.
+ * @param targ the target format
+ * @param source the source format
+ */
+ public static boolean isConversionSupported(AudioFormat targ,
+ AudioFormat source)
+ {
+ Iterator i
+ = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+ while (i.hasNext())
+ {
+ FormatConversionProvider prov = (FormatConversionProvider) i.next();
+ if (prov.isConversionSupported(targ, source))
+ return true;
+ }
+ return false;
+ }
+
+ private static boolean isFileTypeSupported(AudioFileFormat.Type[] types,
+ AudioFileFormat.Type type)
+ {
+ for (int i = 0; i < types.length; ++i)
+ {
+ if (types[i].equals(type))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if the given audio file format is supported by one of
+ * the providers installed on the system.
+ * @param type the audio file format type
+ */
+ public static boolean isFileTypeSupported(AudioFileFormat.Type type)
+ {
+ return isFileTypeSupported(getAudioFileTypes(), type);
+ }
+
+ /**
+ * Return true if the given audio file format is supported for the
+ * given audio input stream by one of the providers installed on the
+ * system.
+ * @param type the audio file format type
+ * @param ais the audio input stream
+ */
+ public static boolean isFileTypeSupported(AudioFileFormat.Type type,
+ AudioInputStream ais)
+ {
+ return isFileTypeSupported(getAudioFileTypes(ais), type);
+ }
+
+ /**
+ * Return true if some provider on the system supplies a line
+ * matching the argument.
+ * @param info the line to match
+ */
+ public static boolean isLineSupported(Line.Info info)
+ {
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ if (getMixer(infos[i]).isLineSupported(info))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Write an audio input stream to the given file, using the specified
+ * audio file format. All the providers installed on the system will
+ * be searched to find one that supports this operation.
+ * @param ais the audio input stream to write
+ * @param type the desired audio file format type
+ * @param out the file to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O error occurs while writing
+ * @throws IllegalArgumentException if the file type is not supported
+ */
+ public static int write(AudioInputStream ais, AudioFileFormat.Type type,
+ File out)
+ throws IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+ while (i.hasNext())
+ {
+ AudioFileWriter w = (AudioFileWriter) i.next();
+ if (w.isFileTypeSupported(type, ais))
+ return w.write(ais, type, out);
+ }
+ throw new IllegalArgumentException("file type not supported by system");
+ }
+
+ /**
+ * Write an audio input stream to the given output stream, using the
+ * specified audio file format. All the providers installed on the
+ * system will be searched to find one that supports this operation.
+ * @param ais the audio input stream to write
+ * @param type the desired audio file format type
+ * @param os the output stream to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O error occurs while writing
+ * @throws IllegalArgumentException if the file type is not supported
+ */
+ public static int write(AudioInputStream ais, AudioFileFormat.Type type,
+ OutputStream os)
+ throws IOException
+ {
+ Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+ while (i.hasNext())
+ {
+ AudioFileWriter w = (AudioFileWriter) i.next();
+ if (w.isFileTypeSupported(type, ais))
+ return w.write(ais, type, os);
+ }
+ throw new IllegalArgumentException("file type not supported by system");
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/BooleanControl.java b/libjava/classpath/javax/sound/sampled/BooleanControl.java
new file mode 100644
index 00000000000..aae1e23a298
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/BooleanControl.java
@@ -0,0 +1,145 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A BooleanControl is a Control which has two states.
+ * @since 1.3
+ */
+public class BooleanControl extends Control
+{
+ /**
+ * A Type specialized to represent a boolean control.
+ * @since 1.3
+ */
+ public static class Type extends Control.Type
+ {
+ // FIXME: correct constructions?
+
+ /**
+ * A control for applying reverb.
+ */
+ public final static Type APPLY_REVERB = new Type("Apply reverb");
+
+ /**
+ * A control for muting.
+ */
+ public final static Type MUTE = new Type("Mute");
+
+ /**
+ * Create a new Type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ super(name);
+ }
+ }
+
+ private Type type;
+ private boolean value;
+ private String trueLabel;
+ private String falseLabel;
+
+ /**
+ * Create a new boolean control, with the indicated Type and initial
+ * value. The description strings will default to "true" and "false".
+ * @param type the type
+ * @param init the initial value
+ */
+ protected BooleanControl(Type type, boolean init)
+ {
+ super(type);
+ this.value = init;
+ this.trueLabel = "true";
+ this.falseLabel = "false";
+ }
+
+ /**
+ * Create a new boolean control, with the indicated Type, initial
+ * value, and labels.
+ * @param type the type
+ * @param init the initial value
+ * @param trueLabel the label for the true state
+ * @param falseLabel the label for the false state
+ */
+ protected BooleanControl(Type type, boolean init, String trueLabel,
+ String falseLabel)
+ {
+ super(type);
+ this.value = init;
+ this.trueLabel = trueLabel;
+ this.falseLabel = falseLabel;
+ }
+
+ /**
+ * Return the label corresponding to the indicated state.
+ * @param state the state
+ * @return the true label or the false label, as appropriate
+ */
+ public String getStateLabel(boolean state)
+ {
+ return state ? trueLabel : falseLabel;
+ }
+
+ /**
+ * Return the current value of thhe control.
+ */
+ public boolean getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Set the value of the control as indicated.
+ * @param value the new value
+ */
+ public void setValue(boolean value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * Return a string describing this control.
+ */
+ public String toString()
+ {
+ return super.toString() + ": " + getStateLabel(value);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/Clip.java b/libjava/classpath/javax/sound/sampled/Clip.java
new file mode 100644
index 00000000000..1fa769470a2
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/Clip.java
@@ -0,0 +1,115 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.io.IOException;
+
+/**
+ * A Clip represents some pre-loaded audio data.
+ * @since 1.3
+ */
+public interface Clip extends DataLine
+{
+ /**
+ * This can be passed to {@link #loop(int)} to indicate that looping
+ * should be done continuously.
+ */
+ int LOOP_CONTINUOUSLY = -1;
+
+ /**
+ * Return the frame length of this clip.
+ */
+ int getFrameLength();
+
+ /**
+ * Return the length of the clip in microseconds.
+ */
+ long getMicrosecondLength();
+
+ /**
+ * Start looping the clip. Looping will occur count times, or, if count
+ * is LOOP_CONTINUOUSLY, will be done continuously. A count of 0 indicates
+ * that any current looping should stop.
+ * @param count the number of times to loop
+ */
+ void loop(int count);
+
+ /**
+ * Open a clip, given an audio format and some data.
+ * @param fmt the format of the data
+ * @param data a byte array containing the audio data
+ * @param offset the offset of the first byte of data in the array
+ * @param len the length of the audio data in the array, in bytes
+ * @throws LineUnavailableException if the line cannot be opened
+ * @throws SecurityException if the line cannot be opened for security
+ * reasons
+ */
+ void open(AudioFormat fmt, byte[] data, int offset, int len)
+ throws LineUnavailableException;
+
+ /**
+ * Open a clip, given an audio input stream.
+ * @param ais the input stream
+ * @throws LineUnavailableException if the line cannot be opened
+ * @throws SecurityException if the line cannot be opened for security
+ * reasons
+ * @throws IOException if there is an I/O error while reading the stream
+ */
+ void open(AudioInputStream ais)
+ throws LineUnavailableException, IOException;
+
+ /**
+ * Set the position to the indicated frame.
+ * @param where new frame position
+ */
+ void setFramePosition(int where);
+
+ /**
+ * Set the loop begin and end points. These are used by loop(int).
+ * @param begin the starting point
+ * @param end the ending point
+ */
+ void setLoopPoints(int begin, int end);
+
+ /**
+ * Set the position to the indicated microsecond.
+ * @param ms the new position in microseconds
+ */
+ void setMicrosecondPosition(long ms);
+}
diff --git a/libjava/classpath/javax/sound/sampled/CompoundControl.java b/libjava/classpath/javax/sound/sampled/CompoundControl.java
new file mode 100644
index 00000000000..8664abca808
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/CompoundControl.java
@@ -0,0 +1,102 @@
+/* Control consisting of several other controls
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A compound control provides control over several other controls.
+ * @since 1.3
+ */
+public class CompoundControl extends Control
+{
+ /**
+ * This describes a single compound control.
+ * @since 1.3
+ */
+ public static class Type extends Control.Type
+ {
+ /**
+ * Create a new Type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ super(name);
+ }
+ }
+
+ private Control[] memberControls;
+
+ /**
+ * Create a new compound control given its type and members.
+ * @param type the type of the compound control
+ * @param members the members of the compound control
+ */
+ protected CompoundControl(Type type, Control[] members)
+ {
+ super(type);
+ // FIXME: clone?
+ this.memberControls = members;
+ }
+
+ /**
+ * Return the members of this compound control.
+ */
+ public Control[] getMemberControls()
+ {
+ // FIXME: clone?
+ return memberControls;
+ }
+
+ /**
+ * Return a string description of this compound control.
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append(super.toString());
+ result.append(": ");
+ for (int i = 0; i < memberControls.length; ++i)
+ {
+ if (i > 0)
+ result.append(", ");
+ result.append(memberControls[i].toString());
+ }
+ return result.toString();
+ }
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/RequestEvent.java b/libjava/classpath/javax/sound/sampled/Control.java
index 281c621f33f..810c2edd54d 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/event/RequestEvent.java
+++ b/libjava/classpath/javax/sound/sampled/Control.java
@@ -1,5 +1,5 @@
-/* RequestEvent.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+/* Control over an attribute of a line
+ Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath 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, or (at your option)
any later version.
-
+
GNU Classpath 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
@@ -36,72 +36,76 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.java.net.protocol.http.event;
-
-import gnu.java.net.protocol.http.Request;
-
-import java.util.EventObject;
+package javax.sound.sampled;
/**
- * A request event.
- *
- * @author Chris Burdess (dog@gnu.org)
+ * A control provides the ability to affect some attribute of a line,
+ * for instance its volume.
+ * @since 1.3
*/
-public class RequestEvent
- extends EventObject
+public class Control
{
-
- /**
- * The request created event type.
- */
- public static final int REQUEST_CREATED = 0;
-
- /**
- * The request sending event type.
- */
- public static final int REQUEST_SENDING = 1;
-
/**
- * The request sent event type.
+ * This describes a single control.
+ * @since 1.3
*/
- public static final int REQUEST_SENT = 2;
-
- /**
- * The type of this event.
- */
- protected int type;
+ public static class Type
+ {
+ private String name;
+
+ /**
+ * Create a new Type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ this.name = name;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of this Type.
+ */
+ public String toString()
+ {
+ return name;
+ }
+ }
- /**
- * The request associated with this event.
- */
- protected Request request;
+ private Type type;
/**
- * Constructs a request event with the specified source, type, and request.
+ * Create a new Control given its Type.
+ * @param type the type
*/
- public RequestEvent(Object source, int type, Request request)
+ protected Control(Type type)
{
- super(source);
this.type = type;
- this.request = request;
}
/**
- * Returns the type of this event.
- * @see #type
+ * Return the Type of this Control.
*/
- public int getType()
+ public Type getType()
{
return type;
}
/**
- * Returns the request associated with this event.
+ * Return a String descrsibing this control. In particular the
+ * value will include the name of the associated Type.
*/
- public Request getRequest()
+ public String toString()
{
- return request;
+ return type.toString();
}
-
}
-
diff --git a/libjava/classpath/javax/sound/sampled/DataLine.java b/libjava/classpath/javax/sound/sampled/DataLine.java
new file mode 100644
index 00000000000..f755958fe87
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/DataLine.java
@@ -0,0 +1,265 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * The DataLine interface adds data-related functionality to the Line
+ * interface. For example, it adds methods to start and stop the data
+ * on the line.
+ * @since 1.3
+ */
+public interface DataLine extends Line
+{
+ /**
+ * This class extends Line.Info with information specific to DataLine.
+ * In particular it adds information about buffer sizes, and about supported
+ * audio formats.
+ * @since 1.3
+ */
+ class Info extends Line.Info
+ {
+ private int minBufferSize;
+ private int maxBufferSize;
+ private AudioFormat[] formats;
+
+ /**
+ * Create a new Info given the line's class and a supported
+ * audio format. The buffer sizes default to AudioSystem.NOT_SPECIFIED.
+ * @param klass the class of the line
+ * @param fmt the supported format
+ */
+ public Info(Class klass, AudioFormat fmt)
+ {
+ super(klass);
+ this.minBufferSize = AudioSystem.NOT_SPECIFIED;
+ this.maxBufferSize = AudioSystem.NOT_SPECIFIED;
+ this.formats = new AudioFormat[] { fmt };
+ }
+
+ /**
+ * Create a new Info given the line's class, the supported audio formats,
+ * the minimum buffer size, and the maximum buffer size.
+ * @param klass the class of the linee
+ * @param fmts the supported audio formats
+ * @param minSize the minimum buffer size
+ * @param maxSize the maximum buffer size
+ */
+ public Info(Class klass, AudioFormat[] fmts, int minSize, int maxSize)
+ {
+ super(klass);
+ this.minBufferSize = minSize;
+ this.maxBufferSize = maxSize;
+ this.formats = fmts;
+ }
+
+ /**
+ * Create a new Info given the line's class, a supported
+ * audio format, and a buffer size. Both the minimum and maximum
+ * sizes are set from this size.
+ * @param klass the class of the line
+ * @param fmt the supported format
+ * @param size the buffer size
+ */
+ public Info(Class klass, AudioFormat fmt, int size)
+ {
+ super(klass);
+ this.minBufferSize = size;
+ this.maxBufferSize = size;
+ this.formats = new AudioFormat[] { fmt };
+ }
+
+ /**
+ * Return the supported audio formats.
+ */
+ public AudioFormat[] getFormats()
+ {
+ // FIXME: clone?
+ return formats;
+ }
+
+ /**
+ * Return the maximum buffer size.
+ */
+ public int getMaxBufferSize()
+ {
+ return maxBufferSize;
+ }
+
+ /**
+ * Return the minimum buffer size.
+ */
+ public int getMinBufferSize()
+ {
+ return minBufferSize;
+ }
+
+ /**
+ * Return true if the indicated audio format is supported by this
+ * Info, false otherwise.
+ * @param fmt the audio format
+ * @return true if the format is supported
+ */
+ public boolean isFormatSupported(AudioFormat fmt)
+ {
+ for (int i = 0; i < formats.length; ++i)
+ {
+ if (fmt.matches(formats[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if this Info matches another Info object.
+ */
+ public boolean matches(Line.Info o)
+ {
+ if (! super.matches(o) || ! (o instanceof Info))
+ return false;
+ Info other = (Info) o;
+ if (minBufferSize < other.minBufferSize
+ || maxBufferSize > other.maxBufferSize)
+ return false;
+ for (int i = 0; i < formats.length; ++i)
+ {
+ boolean ok = false;
+ for (int j = 0; j < other.formats.length; ++j)
+ {
+ if (formats[i].matches(other.formats[j]))
+ {
+ ok = true;
+ break;
+ }
+ }
+ if (! ok)
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Return a description of this Info object.
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append("formats: [");
+ for (int i = 0; i < formats.length; ++i)
+ {
+ if (i > 0)
+ result.append(", ");
+ result.append(formats[i].toString());
+ }
+ result.append("]; minBufferSize: ");
+ result.append(minBufferSize);
+ result.append("; maxBufferSize: ");
+ result.append(maxBufferSize);
+ return result.toString();
+ }
+ }
+
+ /**
+ * Return the number of bytes currently available on this DataLine.
+ */
+ int available();
+
+ /**
+ * This method blocks until whatever data is buffered in the
+ * DataLine's internal buffer has been drained.
+ */
+ void drain();
+
+ /**
+ * This flushes the DataLine by discarding any buffered data.
+ */
+ void flush();
+
+ /**
+ * Returns the size of the DataLine's internal buffer, in bytes.
+ */
+ int getBufferSize();
+
+ /**
+ * Return the current format of the data associated with this DataLine.
+ */
+ AudioFormat getFormat();
+
+ /**
+ * Return the current frame position.
+ */
+ int getFramePosition();
+
+ /**
+ * Return the volume level for this DataLine.
+ */
+ float getLevel();
+
+ /**
+ * Return the current frame position.
+ * @since 1.5
+ */
+ long getLongFramePosition();
+
+ /**
+ * Return the number of microseconds this DataLine has been playing.
+ */
+ long getMicrosecondPosition();
+
+ /**
+ * Return true if this line is active, meaning that it is actively
+ * performing audio I/O.
+ */
+ boolean isActive();
+
+ /**
+ * Return true if this line is running, meaning that it has been
+ * started. When the line is stopped, this method will return false.
+ */
+ boolean isRunning();
+
+ /**
+ * Start processing data. This will emit a START event.
+ */
+ void start();
+
+ /**
+ * Stop processing data. This will emit a STOP event.
+ */
+ void stop();
+}
diff --git a/libjava/classpath/javax/sound/sampled/EnumControl.java b/libjava/classpath/javax/sound/sampled/EnumControl.java
new file mode 100644
index 00000000000..798f3a91c96
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/EnumControl.java
@@ -0,0 +1,126 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * An EnumControl is a Control which can take one of a specified set of
+ * values.
+ * @since 1.3
+ */
+public class EnumControl extends Control
+{
+ /**
+ * This Type describes an EnumControl.
+ * @since 1.3
+ */
+ public static class Type extends Control.Type
+ {
+ /** This describes an enum control used for reverb. */
+ public static final Type REVERB = new Type("Reverb");
+
+ /**
+ * Create a new Type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ super(name);
+ }
+ }
+
+ private Object[] values;
+ private Object value;
+
+ /**
+ * Create a new enumerated control given its Type, the range of valid
+ * values, and its initial value.
+ * @param type the type
+ * @param values the valid values
+ * @param val the initial value
+ */
+ protected EnumControl(Type type, Object[] values, Object val)
+ {
+ super(type);
+ // FIXME: error checking: values.length>0, val in values... ?
+ // FIXME: clone here?
+ this.values = values;
+ this.value = val;
+ }
+
+ /**
+ * Return the current value of this control.
+ */
+ public Object getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Return the valid values for this control.
+ */
+ public Object[] getValues()
+ {
+ // FIXME: clone here?
+ return values;
+ }
+
+ /**
+ * Set the value of this control. If the indicated value is not among
+ * the valid values, this method will throw an IllegalArgumentException.
+ * @param value the new value
+ * @throws IllegalArgumentException if the new value is invalid
+ */
+ public void setValue(Object value)
+ {
+ for (int i = 0; i < values.length; ++i)
+ {
+ if (! values[i].equals(value))
+ throw new IllegalArgumentException("value not supported");
+ }
+ this.value = value;
+ }
+
+ /**
+ * Return a string describing this control.
+ */
+ public String toString()
+ {
+ return super.toString() + ": " + value;
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/FloatControl.java b/libjava/classpath/javax/sound/sampled/FloatControl.java
new file mode 100644
index 00000000000..409c90de2cd
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/FloatControl.java
@@ -0,0 +1,267 @@
+/* Floating point control
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/** @since 1.3 */
+public class FloatControl extends Control
+{
+ /**
+ * An instance of this class describes a particular floating point control.
+ * @since 1.3
+ */
+ public static class Type extends Control.Type
+ {
+ /** Auxiliary return gain. */
+ public static final Type AUX_RETURN = new Type("AUX return");
+
+ /** Auxiliary send gain. */
+ public static final Type AUX_SEND = new Type("AUX send");
+
+ /** Balance. */
+ public static final Type BALANCE = new Type("Balance");
+
+ /** Master gain control. */
+ public static final Type MASTER_GAIN = new Type("Master gain");
+
+ /** Control for panning. */
+ public static final Type PAN = new Type("Pan");
+
+ /** Post-reverb gain. */
+ public static final Type REVERB_RETURN = new Type("Reverb return");
+
+ /** Pre-reverb gain. */
+ public static final Type REVERB_SEND = new Type("Reverb send");
+
+ /** Control the sample rate. */
+ public static final Type SAMPLE_RATE = new Type("Sample rate");
+
+ /** Volume control. */
+ public static final Type VOLUME = new Type("Volume");
+
+ /**
+ * Create a new type given its name.
+ * @param name the name of the type
+ */
+ protected Type(String name)
+ {
+ super(name);
+ }
+ }
+
+ private float minimum;
+ private float maximum;
+ private float precision;
+ private int updatePeriod;
+ private float value;
+ private String units;
+ private String minLabel;
+ private String maxLabel;
+ private String midLabel;
+
+ /**
+ * Create a new FloatControl given its type and various parameters.
+ * The minimum, maximum, and midpoint labels will all be the empty string.
+ *
+ * @param type the type
+ * @param min the minimum valuee
+ * @param max the maximum value
+ * @param prec the precision
+ * @param update the update period
+ * @param init the initial value
+ * @param units the description of the units
+ */
+ protected FloatControl(Type type, float min, float max, float prec,
+ int update, float init, String units)
+ {
+ super(type);
+ this.minimum = min;
+ this.maximum = max;
+ this.precision = prec;
+ this.updatePeriod = update;
+ this.value = init;
+ this.units = units;
+ this.minLabel = "";
+ this.maxLabel = "";
+ this.midLabel = "";
+ }
+
+ /**
+ * Create a new FloatControl given its type and various parameters.
+ *
+ * @param type the type
+ * @param min the minimum valuee
+ * @param max the maximum value
+ * @param prec the precision
+ * @param update the update period
+ * @param init the initial value
+ * @param units the description of the units
+ * @param minLabel the label for the minimum value
+ * @param midLabel the label for the midpoint
+ * @param maxLabel the label for the maximum value
+ */
+ protected FloatControl(Type type, float min, float max, float prec,
+ int update, float init, String units,
+ String minLabel, String midLabel, String maxLabel)
+ {
+ super(type);
+ this.minimum = min;
+ this.maximum = max;
+ this.precision = prec;
+ this.updatePeriod = update;
+ this.value = init;
+ this.units = units;
+ this.minLabel = minLabel;
+ this.maxLabel = maxLabel;
+ this.midLabel = midLabel;
+ }
+
+ /**
+ * Return the maximum value of this control.
+ */
+ public float getMaximum()
+ {
+ return maximum;
+ }
+
+ /**
+ * Return the label for the minimum value of this control.
+ */
+ public String getMaxLabel()
+ {
+ return maxLabel;
+ }
+
+ /**
+ * Return the label for the midpoint of this control.
+ */
+ public String getMidLabel()
+ {
+ return midLabel;
+ }
+
+ /**
+ * Return the minimum value of this control.
+ */
+ public float getMinimum()
+ {
+ return minimum;
+ }
+
+ /**
+ * Return the label for the minimum value of this control.
+ */
+ public String getMinLabel()
+ {
+ return minLabel;
+ }
+
+ /**
+ * Return the precision of this control.
+ */
+ public float getPrecision()
+ {
+ return precision;
+ }
+
+ /**
+ * Return the name of the units for this control.
+ */
+ public String getUnits()
+ {
+ return units;
+ }
+
+ /**
+ * Return the update period of this control.
+ */
+ public int getUpdatePeriod()
+ {
+ return updatePeriod;
+ }
+
+ /**
+ * Return the current value of this control.
+ */
+ public float getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Set the new value of this control.
+ * @param value the new value
+ * @throws IllegalArgumentException if the new value is greater than the
+ * maximum or less than the minimum.
+ */
+ public void setValue(float value)
+ {
+ if (value < minimum || value > maximum)
+ throw new IllegalArgumentException("value out of range");
+ this.value = value;
+ }
+
+ /**
+ * This tells the control to start at the starting value
+ * and to shift its value incrementally to the final value
+ * over the given time interval, specified in microseconds.
+ * The default implementation does not do this, but instead
+ * simply sets the value to the final value immediately.
+ *
+ * @param from the starting value
+ * @param to the final value
+ * @param ms the number of microseconds
+ */
+ public void shift(float from, float to, int ms)
+ {
+ if (from < minimum || from > maximum
+ || to < minimum || to > maximum
+ || ms < 0)
+ throw new IllegalArgumentException("argument out of range");
+ // The default just sets the value to TO.
+ this.value = to;
+ }
+
+ /**
+ * Return a string describing this control.
+ */
+ public String toString()
+ {
+ return super.toString() + ": " + value;
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/Line.java b/libjava/classpath/javax/sound/sampled/Line.java
new file mode 100644
index 00000000000..69bb9084f10
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/Line.java
@@ -0,0 +1,150 @@
+/* An input or output line
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A Line represents a single input or output audio line.
+ * @since 1.3
+ */
+public interface Line
+{
+ /**
+ * An object of this type holds information about a Line.
+ * @since 1.3
+ */
+ class Info
+ {
+ private Class klass;
+
+ /**
+ * Create a new Info object. The argument is the class of the line,
+ * for instance TargetDataLine.class.
+ * @param klass the class of the line
+ */
+ public Info(Class klass)
+ {
+ this.klass = klass;
+ }
+
+ /**
+ * Return the line's class.
+ */
+ public Class getLineClass()
+ {
+ return klass;
+ }
+
+ /**
+ * Return true if this Info object matches the given object.
+ * @param other the object to match
+ * @return true if they match, false otherwise
+ */
+ public boolean matches(Info other)
+ {
+ return klass.equals(other.klass);
+ }
+
+ /**
+ * Return a description of this Info object.
+ */
+ public String toString()
+ {
+ return klass.toString();
+ }
+ }
+
+ /**
+ * Add a listener which will be notified whenever this Line changes state.
+ * @param listener the listener to notify
+ */
+ void addLineListener(LineListener listener);
+
+ /**
+ * Close this line.
+ */
+ void close();
+
+ /**
+ * Return the control associated with this Line that matches the
+ * argument.
+ * @param what the type of the control to match
+ * @return the associated control
+ * @throws IllegalArgumentException if a control of this type is not
+ * available for this line
+ */
+ Control getControl(Control.Type what);
+
+ /**
+ * Return an array of controls associated with this Line. Note that
+ * this method will not return null -- if there are no controls, it
+ * will return a zero-length array.
+ */
+ Control[] getControls();
+
+ /**
+ * Return the Info object associated with this Line.
+ */
+ Info getLineInfo();
+
+ /**
+ * Return true if a Control matching the argument is available for this
+ * Line, false otherwise.
+ * @param what the type of the control to match
+ */
+ boolean isControlSupported(Control.Type what);
+
+ /**
+ * Return true if this line is open, false otherwise.
+ */
+ boolean isOpen();
+
+ /**
+ * Open this line.
+ * @throws LineUnavailableException if the line is unavailable for some
+ * reason
+ */
+ void open() throws LineUnavailableException;
+
+ /**
+ * Remove the listener from this Line; after this call the listener will
+ * no longer be notified when this Line changes state.
+ * @param listener the listener to remove
+ */
+ void removeLineListener(LineListener listener);
+}
diff --git a/libjava/classpath/javax/sound/sampled/LineEvent.java b/libjava/classpath/javax/sound/sampled/LineEvent.java
new file mode 100644
index 00000000000..7bba2cd1d96
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/LineEvent.java
@@ -0,0 +1,150 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.util.EventObject;
+
+// FIXME: attempts to serialize this should fail
+
+/**
+ * This class holds information about a state change of a Line.
+ * @since 1.3
+ */
+public class LineEvent extends EventObject
+{
+ /**
+ * This class represents the kinds of state changes that can occur
+ * to a Line. The standard states are availabe as static instances.
+ * @since 1.3
+ */
+ public static class Type
+ {
+ /** An event of this type is posted when a Line closes. */
+ public static final Type CLOSE = new Type("close");
+
+ /** An event of this type is posted when a Line opens. */
+ public static final Type OPEN = new Type("open");
+
+ /** An event of this type is posted when a Line starts. */
+ public static final Type START = new Type("start");
+
+ /** An event of this type is posted when a Line stops. */
+ public static final Type STOP = new Type("stop");
+
+ private String name;
+
+ /**
+ * Create a new type with the indicated name.
+ * @param name the name
+ */
+ protected Type(String name)
+ {
+ this.name = name;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of this Type.
+ */
+ public String toString()
+ {
+ return name;
+ }
+ }
+
+ private Type type;
+ private long framePosition;
+ private Line line;
+
+ /**
+ * Create a new LineEvent with the indicated line, type, and frame position.
+ * @param line the line
+ * @param type the type of the event
+ * @param pos the frame position
+ */
+ public LineEvent(Line line, Type type, long pos)
+ {
+ super(line);
+ this.line = line;
+ this.type = type;
+ this.framePosition = pos;
+ }
+
+ /**
+ * Return the frame position associated with this event.
+ */
+ public long getFramePosition()
+ {
+ return framePosition;
+ }
+
+ /**
+ * Return the Line associated with this event.
+ */
+ public Line getLine()
+ {
+ return line;
+ }
+
+ /**
+ * Return the Type associated with this event.
+ */
+ public Type getType()
+ {
+ return type;
+ }
+
+ /**
+ * Return a description of this event.
+ */
+ public String toString()
+ {
+ return ("type=" + type + "; framePosition=" + framePosition
+ + "line=" + line);
+ }
+}
diff --git a/libjava/classpath/gnu/java/net/protocol/http/event/ConnectionListener.java b/libjava/classpath/javax/sound/sampled/LineListener.java
index 073e89d4407..1b87c027902 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/event/ConnectionListener.java
+++ b/libjava/classpath/javax/sound/sampled/LineListener.java
@@ -1,5 +1,5 @@
-/* ConnectionListener.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+/* Listener for Lines
+ Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath 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, or (at your option)
any later version.
-
+
GNU Classpath 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
@@ -36,23 +36,20 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.java.net.protocol.http.event;
+package javax.sound.sampled;
import java.util.EventListener;
/**
- * A connection listener.
- *
- * @author Chris Burdess (dog@gnu.org)
+ * This interface is used by classes which wish to be notified
+ * when the state of a Line changes.
+ * @since 1.3
*/
-public interface ConnectionListener
- extends EventListener
+public interface LineListener extends EventListener
{
-
/**
- * Callback invoked when the associated connection is closed.
+ * This is called when the line's status changes.
+ * @param ev the event describing the change
*/
- void connectionClosed(ConnectionEvent event);
-
+ void update(LineEvent ev);
}
-
diff --git a/libjava/classpath/javax/sound/sampled/LineUnavailableException.java b/libjava/classpath/javax/sound/sampled/LineUnavailableException.java
new file mode 100644
index 00000000000..b203d7be213
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/LineUnavailableException.java
@@ -0,0 +1,61 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/** @since 1.3 */
+public class LineUnavailableException extends Exception
+{
+ private static final long serialVersionUID = -2046718279487432130L;
+
+ /**
+ * Create a new LineUnavailableException.
+ */
+ public LineUnavailableException()
+ {
+ }
+
+ /**
+ * Create a new LineUnavailableException with the given message.
+ * @param msg the message
+ */
+ public LineUnavailableException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/Mixer.java b/libjava/classpath/javax/sound/sampled/Mixer.java
new file mode 100644
index 00000000000..b9afba3fe87
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/Mixer.java
@@ -0,0 +1,206 @@
+/* Mixers
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A Mixer is a Line which itself holds multiple lines.
+ * @since 1.3
+ */
+public interface Mixer extends Line
+{
+ /**
+ * An Info object describes a mixer.
+ * @since 1.3
+ */
+ class Info
+ {
+ private String name;
+ private String description;
+ private String vendor;
+ private String version;
+
+ /**
+ * Create a new mixer description.
+ * @param name the name of the mixer
+ * @param vendor the vendor
+ * @param desc a descriptive string
+ * @param vers the mixer's version
+ */
+ public Info(String name, String vendor, String desc, String vers)
+ {
+ this.name = name;
+ this.description = desc;
+ this.vendor = vendor;
+ this.version = vers;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of the mixer.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Return the mixer's description.
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Return the mixer's vendor.
+ */
+ public String getVendor()
+ {
+ return vendor;
+ }
+
+ /**
+ * Return the mixer's version.
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public String toString()
+ {
+ return ("name=" + name + "; description=" + description
+ + "; vendor=" + vendor + "; version=" + version);
+ }
+ }
+
+ /**
+ * Return a Line associated with this Mixer, given its description.
+ * @param info the description of the line to find
+ * @return the corresponding Line
+ * @throws LineUnavailableException if no Line matching the description
+ * exists in this Mixer
+ */
+ Line getLine(Line.Info info) throws LineUnavailableException;
+
+ /**
+ * Return the number of lines matching this description.
+ * @param info the description of the lines to find.
+ */
+ int getMaxLines(Line.Info info);
+
+ /**
+ * Return an Info object describing this Mixer.
+ */
+ Info getMixerInfo();
+
+ /**
+ * Return an array of Info objects describing all the source lines
+ * available in this Mixer.
+ */
+ Line.Info[] getSourceLineInfo();
+
+ /**
+ * Return an array of Info objects describing all the source lines
+ * available in this Mixer, which match the provided decsription.
+ * @param info the description of the source lines to find
+ */
+ Line.Info[] getSourceLineInfo(Line.Info info);
+
+ /**
+ * Return an array of all the source lines available in this Mixer.
+ */
+ Line[] getSourceLines();
+
+ /**
+ * Return an array of Info objects describing all the target lines
+ * available in this Mixer.
+ */
+ Line.Info[] getTargetLineInfo();
+
+ /**
+ * Return an array of Info objects describing all the target lines
+ * available in this Mixer, which match the provided decsription.
+ * @param info the description of the target lines to find
+ */
+ Line.Info[] getTargetLineInfo(Line.Info info);
+
+ /**
+ * Return an array of all the target lines available in this Mixer.
+ */
+ Line[] getTargetLines();
+
+ /**
+ * Return true if a Line matching the given description is supported
+ * by this Mixer, false otherwise.
+ * @param info the description of the line to find
+ */
+ boolean isLineSupported(Line.Info info);
+
+ /**
+ * Return true if this Mixer supports synchronization of the given set
+ * of lines.
+ * @param lines the lines to check
+ * @param sync true if the synchronization must be accurate at all times
+ */
+ boolean isSynchronizationSupported(Line[] lines, boolean sync);
+
+ /**
+ * Start synchronization on the given set of lines.
+ * @param lines the lines to synchronize, or null for all the lines
+ * @param sync true if the synchronization must be accurate at all times
+ * @throws IllegalArgumentException if the lines cannot be synchronized
+ */
+ void synchronize(Line[] lines, boolean sync);
+
+ /**
+ * Stop synchronization for the given set of lines.
+ * @param lines the lines to unsynchronize, or null for all the lines
+ */
+ void unsynchronize(Line[] lines);
+}
diff --git a/libjava/classpath/javax/sound/sampled/Port.java b/libjava/classpath/javax/sound/sampled/Port.java
new file mode 100644
index 00000000000..7b3daafd3aa
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/Port.java
@@ -0,0 +1,135 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A Port is a Line which represents an audio device, for instance
+ * a microphone.
+ *
+ * @since 1.3
+ */
+public interface Port extends Line
+{
+ /**
+ * This describes a single port.
+ * @since 1.3
+ */
+ class Info extends Line.Info
+ {
+ // FIXME names?
+
+ /** A CD player. */
+ public static final Info COMPACT_DISC = new Info(Port.class,
+ "Compact Disc",
+ true);
+
+ /** Headphones. */
+ public static final Info HEADPHONE = new Info(Port.class, "Headphone",
+ false);
+
+ /** Generic input line. */
+ public static final Info LINE_IN = new Info(Port.class, "Line in",
+ true);
+
+ /** Generic output line. */
+ public static final Info LINE_OUT = new Info(Port.class, "Line out",
+ false);
+
+ /** A microphone. */
+ public static final Info MICROPHONE = new Info(Port.class, "Microphone",
+ true);
+
+ /** A speaker. */
+ public static final Info SPEAKER = new Info(Port.class, "Speaker",
+ false);
+
+ private String name;
+ private boolean isSource;
+
+ /**
+ * Create a new Info object, given the line's class, the name,
+ * and an argument indicating whether this is an input or an output.
+ * @param klass the class of the line
+ * @param name the name of the line
+ * @param isSource true if this is an input source
+ */
+ public Info(Class klass, String name, boolean isSource)
+ {
+ super(klass);
+ this.name = name;
+ this.isSource = isSource;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the name of this object.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Return true if this describes an input line.
+ */
+ public boolean isSource()
+ {
+ return isSource;
+ }
+
+ public boolean matches(Line.Info other)
+ {
+ return super.matches(other) && equals(other);
+ }
+
+ public String toString()
+ {
+ return super.toString() + "; name=" + name + "; isSource=" + isSource;
+ }
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/ReverbType.java b/libjava/classpath/javax/sound/sampled/ReverbType.java
new file mode 100644
index 00000000000..a089593777d
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/ReverbType.java
@@ -0,0 +1,144 @@
+/* Reverb attributes
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * This represents a reverb effect which can be applied to an audio signal.
+ * @since 1.3
+ */
+public class ReverbType
+{
+ private String name;
+ private int earlyReflectionDelay;
+ private float earlyReflectionIntensity;
+ private int lateReflectionDelay;
+ private float lateReflectionIntensity;
+ private int decayTime;
+
+ /**
+ * Create a new ReverbType given its attributes.
+ * @param name the name of this type
+ * @param earlyDelay the early delay time in microseconds
+ * @param earlyInten the early intensity in decibels
+ * @param lateDelay the late delay time in microseconds
+ * @param lateInten the late intensity in decibels
+ * @param decay the decay time in microseconds
+ */
+ protected ReverbType(String name, int earlyDelay, float earlyInten,
+ int lateDelay, float lateInten, int decay)
+ {
+ this.name = name;
+ this.earlyReflectionDelay = earlyDelay;
+ this.earlyReflectionIntensity = earlyInten;
+ this.lateReflectionDelay = lateDelay;
+ this.lateReflectionIntensity = lateInten;
+ this.decayTime = decay;
+ }
+
+ public final boolean equals(Object o)
+ {
+ return super.equals(o);
+ }
+
+ public final int hashCode()
+ {
+ return super.hashCode();
+ }
+
+ /**
+ * Return the decay time.
+ */
+ public int getDecayTime()
+ {
+ return decayTime;
+ }
+
+ /**
+ * Return the early reflection delay.
+ */
+ public int getEarlyReflectionDelay()
+ {
+ return earlyReflectionDelay;
+ }
+
+ /**
+ * Return the early reflection intensity.
+ */
+ public float getEarlyReflectionIntensity()
+ {
+ return earlyReflectionIntensity;
+ }
+
+ /**
+ * Return the late reflection delay.
+ */
+ public int getLateReflectionDelay()
+ {
+ return lateReflectionDelay;
+ }
+
+ /**
+ * Return the late reflection intensity.
+ */
+ public float getLateReflectionIntensity()
+ {
+ return lateReflectionIntensity;
+ }
+
+ /**
+ * Return the name of this ReverbType.
+ * @since 1.5
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Return a description of this ReverbType.
+ */
+ public String toString()
+ {
+ return ("name=" + name + "; earlyReflectionDelay=" + earlyReflectionDelay
+ + "; earlyReflectionIntensity=" + earlyReflectionIntensity
+ + "; lateReflectionDelay=" + lateReflectionDelay
+ + "; lateReflectionIntensity=" + lateReflectionIntensity
+ + "; decayTime=" + decayTime);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/SourceDataLine.java b/libjava/classpath/javax/sound/sampled/SourceDataLine.java
new file mode 100644
index 00000000000..6e73d6d9c4e
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/SourceDataLine.java
@@ -0,0 +1,77 @@
+/* Output data line.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * This is a DataLine to which data may be written.
+ * @since 1.3
+ */
+public interface SourceDataLine extends DataLine
+{
+ /**
+ * Open the line, given the desired audio format.
+ * @param fmt the format to use
+ * @throws LineUnavailableException if the line is not available for
+ * some reason
+ * @throws SecurityException if this is prevented by the security manager
+ */
+ void open(AudioFormat fmt)
+ throws LineUnavailableException;
+
+ /**
+ * Open the line, given the desired audio format and the buffer size.
+ * @param fmt the format to use
+ * @param size the buffer size
+ * @throws LineUnavailableException if the line is not available for
+ * some reason
+ * @throws SecurityException if this is prevented by the security manager
+ */
+ void open(AudioFormat fmt, int size)
+ throws LineUnavailableException;
+
+ /**
+ * Write audio data to this line. The data must be an integral number
+ * of frames, as determined by the audio format.
+ * @param buf a byte array of audio data
+ * @param offset index of the first byte in the array to use
+ * @param length the number of bytes to write
+ * @return the number of bytes written
+ */
+ int write(byte[] buf, int offset, int length);
+}
diff --git a/libjava/classpath/javax/sound/sampled/TargetDataLine.java b/libjava/classpath/javax/sound/sampled/TargetDataLine.java
new file mode 100644
index 00000000000..61ad344efc2
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/TargetDataLine.java
@@ -0,0 +1,79 @@
+/* Input data line.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * This is a DataLine from which data may be read.
+ * @since 1.3
+ */
+public interface TargetDataLine extends DataLine
+{
+ /**
+ * Open the line using the indicated audio format.
+ * @param fmt the format to use
+ * @throws LineUnavailableException if the line is not available for
+ * some reason
+ * @throws SecurityException if this operation is prevented by the
+ * security manager
+ */
+ void open(AudioFormat fmt)
+ throws LineUnavailableException;
+
+ /**
+ * Open the line using the indicated audio format and buffer size.
+ * @param fmt the format to use
+ * @throws LineUnavailableException if the line is not available for
+ * some reason
+ * @throws SecurityException if this operation is prevented by the
+ * security manager
+ */
+ void open(AudioFormat fmt, int size)
+ throws LineUnavailableException;
+
+ /**
+ * Read data from the line into the given buffer. The requested data
+ * should be an integral number of framaes, as determined by the audio
+ * format.
+ * @param buf the buffer into which the data is put
+ * @param offset the initial offset at which to write
+ * @param length the maximum number of bytes to read
+ * @return the actual number of bytes read
+ */
+ int read(byte[] buf, int offset, int length);
+}
diff --git a/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java b/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java
new file mode 100644
index 00000000000..bced9c18f19
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java
@@ -0,0 +1,65 @@
+/*
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * An exception of this type is thrown when an operation is attempted
+ * on a file whose format is unrecognized.
+ * @since 1.3
+ */
+public class UnsupportedAudioFileException extends Exception
+{
+ private static final long serialVersionUID = -139127412623160368L;
+
+ /**
+ * Create a new UnsupportedAudioFileException.
+ */
+ public UnsupportedAudioFileException()
+ {
+ }
+
+ /**
+ * Create a new UnsupportedAudioFileException with the indicated message.
+ * @param msg the message
+ */
+ public UnsupportedAudioFileException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java b/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java
new file mode 100644
index 00000000000..6df4cc22d43
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java
@@ -0,0 +1,146 @@
+/* Audio file reader API
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.UnsupportedAudioFileException;
+
+/**
+ * This abstract class defines the interface to audio file readers.
+ * A concrete provider subclass will implement the methods declared
+ * here. These methods can be used to determine the format of
+ * files, and to retrieve an AudioInputStream for a file.
+ * @since 1.3
+ */
+public abstract class AudioFileReader
+{
+ /**
+ * The default constructor. Note that this class is abstract and
+ * thus not directly instantiable.
+ */
+ public AudioFileReader()
+ {
+ }
+
+ /**
+ * Return the format of the given file as deduced by this provider.
+ * If the format of the file is not recognized, throws an exception.
+ * This will also throw an exception if there is an I/O error when
+ * reading the file.
+ * @param file the file to examine
+ * @return the audio file format
+ * @throws UnsupportedAudioFileException if the file's format is not
+ * recognized
+ * @throws IOException if there is an I/O error while reading the file
+ */
+ public abstract AudioFileFormat getAudioFileFormat(File file)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return the format of the given input stream as deduced by this provider.
+ * If the format of the stream is not recognized, throws an exception.
+ * This will also throw an exception if there is an I/O error when
+ * reading the stream. Note that providers typically use mark and reset
+ * on the stream when examining the data, and as a result an IOException
+ * may be thrown if the stream does not support these.
+ * @param is the stream to examine
+ * @return the audio file format
+ * @throws UnsupportedAudioFileException if the stream's format is not
+ * recognized
+ * @throws IOException if there is an I/O error while reading the stream
+ */
+ public abstract AudioFileFormat getAudioFileFormat(InputStream is)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return the format of the given URL as deduced by this provider.
+ * If the format of the URL is not recognized, throws an exception.
+ * This will also throw an exception if there is an I/O error when
+ * reading the URL.
+ * @param url the URL to examine
+ * @return the audio file format
+ * @throws UnsupportedAudioFileException if the URL's format is not
+ * recognized
+ * @throws IOException if there is an I/O error while reading the URL
+ */
+ public abstract AudioFileFormat getAudioFileFormat(URL url)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return an AudioInputStream for the given file. The file is assumed
+ * to hold valid audio data.
+ * @param file the file to read
+ * @return an AudioInputStream for the file
+ * @throws UnsupportedAudioFileException if the file's type is not
+ * recognized
+ * @throws IOException if there is an error while reading the file
+ */
+ public abstract AudioInputStream getAudioInputStream(File file)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return an AudioInputStream wrapping the given input stream. The stream
+ * is assumed to hold valid audio data.
+ * @param is the input stream to wrap
+ * @return an AudioInputStream for the stream
+ * @throws UnsupportedAudioFileException if the stream's type is not
+ * recognized
+ * @throws IOException if there is an error while reading the stream
+ */
+ public abstract AudioInputStream getAudioInputStream(InputStream is)
+ throws UnsupportedAudioFileException, IOException;
+
+ /**
+ * Return an AudioInputStream for the given URL. The URL is assumed
+ * to hold valid audio data.
+ * @param url the URL to read
+ * @return an AudioInputStream for the URL
+ * @throws UnsupportedAudioFileException if the URL's type is not
+ * recognized
+ * @throws IOException if there is an error while reading the URL
+ */
+ public abstract AudioInputStream getAudioInputStream(URL url)
+ throws UnsupportedAudioFileException, IOException;
+}
diff --git a/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java b/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java
new file mode 100644
index 00000000000..955bb051715
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java
@@ -0,0 +1,131 @@
+/* Audio file writer API
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioInputStream;
+
+/**
+ * This abstract class provides an API for writing audio files. Concrete
+ * subclasses implement the methods declared here.
+ * @since 1.3
+ */
+public abstract class AudioFileWriter
+{
+ /**
+ * Creat a new audio file writer.
+ */
+ public AudioFileWriter()
+ {
+ }
+
+ /**
+ * Return an array of all audio file format types supported by this
+ * provider.
+ */
+ public abstract AudioFileFormat.Type[] getAudioFileTypes();
+
+ /**
+ * Return an array of all the audio file format types supported by this
+ * provider, which can be written given the input stream.
+ * @param ais the audio input stream
+ */
+ public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream ais);
+
+ /**
+ * Return true if the indicated type is supported by this provider.
+ * @param type the audio file format type
+ */
+ public boolean isFileTypeSupported(AudioFileFormat.Type type)
+ {
+ AudioFileFormat.Type[] types = getAudioFileTypes();
+ for (int i = 0; i < types.length; ++i)
+ {
+ if (type.equals(types[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if the indicated type is supported by this provider,
+ * and can be written from the given audio input stream.
+ * @param type the audio file format type
+ * @param ais the audio input stream to write
+ */
+ public boolean isFileTypeSupported(AudioFileFormat.Type type,
+ AudioInputStream ais)
+ {
+ AudioFileFormat.Type[] types = getAudioFileTypes(ais);
+ for (int i = 0; i < types.length; ++i)
+ {
+ if (type.equals(types[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Write audio data to a file.
+ * @param ais the audio input stream to write
+ * @param type the desired audio file format type
+ * @param out the file to write to
+ * @return the number of bytes written
+ * @throws IOException if an I/O error occurs when writing
+ */
+ public abstract int write(AudioInputStream ais, AudioFileFormat.Type type,
+ File out)
+ throws IOException;
+
+ /**
+ * Write audio data to an output stream.
+ * @param ais the audio input stream to write
+ * @param type the desired audio file format type
+ * @param os the output stream
+ * @return the number of bytes written
+ * @throws IOException if an I/O error occurs when writing
+ */
+ public abstract int write(AudioInputStream ais, AudioFileFormat.Type type,
+ OutputStream os)
+ throws IOException;
+}
diff --git a/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java b/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java
new file mode 100644
index 00000000000..e96cc0454d1
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java
@@ -0,0 +1,179 @@
+/* Format conversion API
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+
+/**
+ * A format conversion provider supplies methods for converting between
+ * different audio formats. This abstract class defines the interface
+ * to this functionality; concrete subclasses will implement the methods
+ * declared here.
+ * @since 1.3
+ */
+public abstract class FormatConversionProvider
+{
+ /**
+ * Create a new format conversion provider.
+ */
+ public FormatConversionProvider()
+ {
+ }
+
+ /**
+ * Return an audio input stream given the desired target encoding and
+ * another audio input stream. The data in the given stream will be
+ * converted to the desired encoding.
+ * @param encoding the encoding
+ * @param source the source audio input stream
+ * @return a new audio input stream
+ * @throws IllegalArgumentException if the conversion is not supported
+ */
+ public abstract AudioInputStream getAudioInputStream(AudioFormat.Encoding encoding,
+ AudioInputStream source);
+
+ /**
+ * Return an audio input stream given the desired target format and
+ * another audio input stream. The data in the given stream will be
+ * converted to the desired format.
+ * @param format the format
+ * @param source the source audio input stream
+ * @return a new audio input stream
+ * @throws IllegalArgumentException if the conversion is not supported
+ */
+ public abstract AudioInputStream getAudioInputStream(AudioFormat format,
+ AudioInputStream source);
+
+ /**
+ * Return an array of all the source encodings supported by this conversion
+ * provider.
+ */
+ public abstract AudioFormat.Encoding[] getSourceEncodings();
+
+ /**
+ * Return an array of all the target encodings supported by this conversion
+ * provider.
+ */
+ public abstract AudioFormat.Encoding[] getTargetEncodings();
+
+ /**
+ * Return an array of all the target encodings that are available for a given
+ * source format.
+ * @param fmt the source format
+ * @return an array of supported target encodings
+ */
+ public abstract AudioFormat.Encoding[] getTargetEncodings(AudioFormat fmt);
+
+ /**
+ * Return a array of all the target formats that match given target encoding,
+ * and to which this provider can convert the source format.
+ * @param targ the target encoding to match
+ * @param src the source format
+ * @return an array of supported target formats
+ */
+ public abstract AudioFormat[] getTargetFormats(AudioFormat.Encoding targ,
+ AudioFormat src);
+
+ /**
+ * Return true if this provider supports conversion from the given
+ * source format to the given target encoding.
+ * @param targ the target encoding
+ * @param src the source format
+ * @return true if the conversion is supported
+ */
+ public boolean isConversionSupported(AudioFormat.Encoding targ,
+ AudioFormat src)
+ {
+ AudioFormat.Encoding[] encodings = getTargetEncodings(src);
+ for (int i = 0; i < encodings.length; ++i)
+ {
+ if (targ.equals(encodings[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if this provider supports conversions from the given
+ * source format to the given target format.
+ * @param targ the source format
+ * @param src the target format
+ * @return true if the conversion is supported
+ */
+ public boolean isConversionSupported(AudioFormat targ, AudioFormat src)
+ {
+ AudioFormat[] encodings = getTargetFormats(targ.getEncoding(), src);
+ return encodings.length > 0;
+ }
+
+ /**
+ * Return true if an encoding matching the argument is supported as a
+ * source encoding by this provider.
+ * @param src the source encoding
+ * @return true if it is supported
+ */
+ public boolean isSourceEncodingSupported(AudioFormat.Encoding src)
+ {
+ AudioFormat.Encoding[] srcs = getSourceEncodings();
+ for (int i = 0; i < srcs.length; ++i)
+ {
+ if (src.equals(srcs[i]))
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return true if an encoding matching the argument is supported as a
+ * target encoding by this provider.
+ * @param targ the target encoding
+ * @return true if it is supported
+ */
+ public boolean isTargetEncodingSupported(AudioFormat.Encoding targ)
+ {
+ AudioFormat.Encoding[] encodings = getTargetEncodings();
+ for (int i = 0; i < encodings.length; ++i)
+ {
+ if (targ.equals(encodings[i]))
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java b/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java
new file mode 100644
index 00000000000..1ae7b3bb7d8
--- /dev/null
+++ b/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java
@@ -0,0 +1,86 @@
+/* Mixer API
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import javax.sound.sampled.Mixer;
+
+/**
+ * This abstract class defines an interface to mixer providers.
+ * Concrete subclasses will implement the methods in this class.
+ * @since 1.3
+ */
+public abstract class MixerProvider
+{
+ /**
+ * Create a new mixer provider.
+ */
+ public MixerProvider()
+ {
+ }
+
+ /**
+ * Return a mixer that matches the given info object.
+ * @param info description of the mixer to match
+ * @return the mixer
+ * @throws IllegalArgumentException if no mixer matches the description
+ */
+ public abstract Mixer getMixer(Mixer.Info info);
+
+ /**
+ * Return an array of info objects describing all the mixers provided by
+ * this provider.
+ */
+ public abstract Mixer.Info[] getMixerInfo();
+
+ /**
+ * Return true if a mixer matching the provided description is supported.
+ * @param info description of the mixer to match
+ * @return true if it is supported by this provider
+ */
+ public boolean isMixerSupported(Mixer.Info info)
+ {
+ Mixer.Info[] infos = getMixerInfo();
+ for (int i = 0; i < infos.length; ++i)
+ {
+ if (info.equals(infos[i]))
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/libjava/classpath/javax/swing/AbstractButton.java b/libjava/classpath/javax/swing/AbstractButton.java
index 21c4fc0a26c..376b3a056ae 100644
--- a/libjava/classpath/javax/swing/AbstractButton.java
+++ b/libjava/classpath/javax/swing/AbstractButton.java
@@ -165,6 +165,8 @@ public abstract class AbstractButton extends JComponent
*/
public void stateChanged(ChangeEvent ev)
{
+ AbstractButton.this.fireStateChanged();
+ repaint();
}
}
@@ -375,6 +377,7 @@ public abstract class AbstractButton extends JComponent
protected AccessibleAbstractButton()
{
+ // Nothing to do here yet.
}
public AccessibleStateSet getAccessibleStateSet()
@@ -509,11 +512,37 @@ public abstract class AbstractButton extends JComponent
}
/**
- * Creates a new AbstractButton object.
+ * Creates a new AbstractButton object. Subclasses should call the following
+ * sequence in their constructor in order to initialize the button correctly:
+ * <pre>
+ * super();
+ * init(text, icon);
+ * </pre>
+ *
+ * The {@link #init(String, Icon)} method is not called automatically by this
+ * constructor.
+ *
+ * @see #init(String, Icon)
*/
public AbstractButton()
{
- init("", null);
+ actionListener = createActionListener();
+ changeListener = createChangeListener();
+ itemListener = createItemListener();
+
+ horizontalAlignment = CENTER;
+ horizontalTextPosition = TRAILING;
+ verticalAlignment = CENTER;
+ verticalTextPosition = CENTER;
+ borderPainted = true;
+ contentAreaFilled = true;
+ focusPainted = true;
+ setFocusable(true);
+ setAlignmentX(CENTER_ALIGNMENT);
+ setAlignmentY(CENTER_ALIGNMENT);
+ setDisplayedMnemonicIndex(-1);
+ setOpaque(true);
+ text = "";
updateUI();
}
@@ -524,7 +553,7 @@ public abstract class AbstractButton extends JComponent
*/
public ButtonModel getModel()
{
- return model;
+ return model;
}
/**
@@ -569,25 +598,6 @@ public abstract class AbstractButton extends JComponent
if (icon != null)
default_icon = icon;
-
- actionListener = createActionListener();
- changeListener = createChangeListener();
- itemListener = createItemListener();
-
- horizontalAlignment = CENTER;
- horizontalTextPosition = TRAILING;
- verticalAlignment = CENTER;
- verticalTextPosition = CENTER;
- borderPainted = true;
- contentAreaFilled = true;
-
- focusPainted = true;
- setFocusable(true);
-
- setAlignmentX(LEFT_ALIGNMENT);
- setAlignmentY(CENTER_ALIGNMENT);
-
- setDisplayedMnemonicIndex(-1);
}
/**
@@ -615,7 +625,8 @@ public abstract class AbstractButton extends JComponent
*/
public void setActionCommand(String actionCommand)
{
- model.setActionCommand(actionCommand);
+ if (model != null)
+ model.setActionCommand(actionCommand);
}
/**
@@ -782,7 +793,10 @@ public abstract class AbstractButton extends JComponent
*/
public int getMnemonic()
{
- return getModel().getMnemonic();
+ ButtonModel mod = getModel();
+ if (mod != null)
+ return mod.getMnemonic();
+ return -1;
}
/**
@@ -810,11 +824,15 @@ public abstract class AbstractButton extends JComponent
*/
public void setMnemonic(int mne)
{
- int old = getModel().getMnemonic();
+ ButtonModel mod = getModel();
+ int old = -1;
+ if (mod != null)
+ old = mod.getMnemonic();
if (old != mne)
{
- getModel().setMnemonic(mne);
+ if (mod != null)
+ mod.setMnemonic(mne);
if (text != null && !text.equals(""))
{
@@ -907,7 +925,9 @@ public abstract class AbstractButton extends JComponent
*/
public void setSelected(boolean s)
{
- getModel().setSelected(s);
+ ButtonModel mod = getModel();
+ if (mod != null)
+ mod.setSelected(s);
}
/**
@@ -918,7 +938,10 @@ public abstract class AbstractButton extends JComponent
*/
public boolean isSelected()
{
- return getModel().isSelected();
+ ButtonModel mod = getModel();
+ if (mod != null)
+ return mod.isSelected();
+ return false;
}
/**
@@ -929,8 +952,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setEnabled(boolean b)
{
+ // Do nothing if state does not change.
+ if (b == isEnabled())
+ return;
super.setEnabled(b);
- getModel().setEnabled(b);
+ setFocusable(b);
+ ButtonModel mod = getModel();
+ if (mod != null)
+ mod.setEnabled(b);
}
/**
@@ -1608,16 +1637,9 @@ public abstract class AbstractButton extends JComponent
*
* @return The new ChangeListener
*/
- protected ChangeListener createChangeListener()
+ protected ChangeListener createChangeListener()
{
- return new ChangeListener()
- {
- public void stateChanged(ChangeEvent e)
- {
- AbstractButton.this.fireStateChanged();
- AbstractButton.this.repaint();
- }
- };
+ return new ButtonChangeListener();
}
/**
@@ -1669,18 +1691,22 @@ public abstract class AbstractButton extends JComponent
*/
public void doClick(int pressTime)
{
- getModel().setArmed(true);
- getModel().setPressed(true);
- try
+ ButtonModel mod = getModel();
+ if (mod != null)
{
- java.lang.Thread.sleep(pressTime);
- }
- catch (java.lang.InterruptedException e)
- {
- // probably harmless
+ mod.setArmed(true);
+ mod.setPressed(true);
+ try
+ {
+ java.lang.Thread.sleep(pressTime);
+ }
+ catch (java.lang.InterruptedException e)
+ {
+ // probably harmless
+ }
+ mod.setPressed(false);
+ mod.setArmed(false);
}
- getModel().setPressed(false);
- getModel().setArmed(false);
}
/**
@@ -1979,6 +2005,7 @@ public abstract class AbstractButton extends JComponent
*/
public void updateUI()
{
+ // TODO: What to do here?
}
/**
diff --git a/libjava/classpath/javax/swing/AbstractSpinnerModel.java b/libjava/classpath/javax/swing/AbstractSpinnerModel.java
index d61113b0827..1a82f0a359d 100644
--- a/libjava/classpath/javax/swing/AbstractSpinnerModel.java
+++ b/libjava/classpath/javax/swing/AbstractSpinnerModel.java
@@ -61,6 +61,7 @@ public abstract class AbstractSpinnerModel implements SpinnerModel
*/
public AbstractSpinnerModel()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/ActionMap.java b/libjava/classpath/javax/swing/ActionMap.java
index c14bafdb4be..65e193d2e79 100644
--- a/libjava/classpath/javax/swing/ActionMap.java
+++ b/libjava/classpath/javax/swing/ActionMap.java
@@ -80,6 +80,7 @@ public class ActionMap
*/
public ActionMap()
{
+ // Nothing to do here.
}
/**
@@ -170,7 +171,9 @@ public class ActionMap
*/
public Object[] keys()
{
- return actionMap.keySet().toArray();
+ if (size() != 0)
+ return actionMap.keySet().toArray();
+ return null;
}
/**
@@ -187,7 +190,9 @@ public class ActionMap
set.addAll(Arrays.asList(parent.allKeys()));
set.addAll(actionMap.keySet());
- return set.toArray();
+ if (set.size() != 0)
+ return set.toArray();
+ return null;
}
/**
diff --git a/libjava/classpath/javax/swing/BorderFactory.java b/libjava/classpath/javax/swing/BorderFactory.java
index 45cf3bbe074..ca78deb1290 100644
--- a/libjava/classpath/javax/swing/BorderFactory.java
+++ b/libjava/classpath/javax/swing/BorderFactory.java
@@ -71,7 +71,7 @@ public class BorderFactory
*/
public static Border createLineBorder(Color color)
{
- return null;
+ return createLineBorder(color, 1);
}
/**
diff --git a/libjava/classpath/javax/swing/BoundedRangeModel.java b/libjava/classpath/javax/swing/BoundedRangeModel.java
index 5ca5a7e043e..54446acd5ea 100644
--- a/libjava/classpath/javax/swing/BoundedRangeModel.java
+++ b/libjava/classpath/javax/swing/BoundedRangeModel.java
@@ -165,13 +165,13 @@ public interface BoundedRangeModel
*
* @param value the value
* @param extent the extent
- * @param minnimum the minimum value
+ * @param minimum the minimum value
* @param maximum the maximum value
* @param adjusting a flag that indicates the model is being adjusted
* continuously.
*/
void setRangeProperties(int value, int extent, int minimum, int maximum,
- boolean adjusting);
+ boolean adjusting);
/**
* Adds a <code>ChangeListener</code> to this object.
diff --git a/libjava/classpath/javax/swing/Box.java b/libjava/classpath/javax/swing/Box.java
index b2cb44aceb5..57519f6fcbd 100644
--- a/libjava/classpath/javax/swing/Box.java
+++ b/libjava/classpath/javax/swing/Box.java
@@ -40,6 +40,7 @@ package javax.swing;
import java.awt.AWTError;
import java.awt.Component;
+import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;
@@ -63,13 +64,13 @@ public class Box extends JComponent implements Accessible
/**
* Provides accessibility support for <code>Box</code>es.
*/
- // FIXME: disable to make libjava compile; visibility rules are broken
- protected class AccessibleBox // extends Container.AccessibleAWTContainer
+ protected class AccessibleBox extends Container.AccessibleAWTContainer
{
private static final long serialVersionUID = -7775079816389931944L;
protected AccessibleBox()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
@@ -88,13 +89,14 @@ public class Box extends JComponent implements Accessible
/**
* Provides accessibility support for <code>Box.Filler</code>.
*/
- // FIXME: disable to make libjava compile; visibility rules are broken
- protected class AccessibleBoxFiller // extends Component.AccessibleAWTComponent
+ protected class AccessibleBoxFiller
+ extends Component.AccessibleAWTComponent
{
private static final long serialVersionUID = 164963348357479321L;
protected AccessibleBoxFiller()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
@@ -103,8 +105,6 @@ public class Box extends JComponent implements Accessible
}
}
- protected AccessibleContext accessibleContext;
-
private transient Dimension min, pref, max;
/**
@@ -135,9 +135,8 @@ public class Box extends JComponent implements Accessible
public AccessibleContext getAccessibleContext()
{
- // FIXME: disable to make libjava compile; visibility rules are broken
- // if (accessibleContext == null)
- // accessibleContext = new AccessibleBoxFiller();
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleBoxFiller();
return accessibleContext;
}
@@ -284,8 +283,8 @@ public class Box extends JComponent implements Accessible
public AccessibleContext getAccessibleContext()
{
- // if (accessibleContext == null)
- // accessibleContext = new AccessibleBox();
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleBox();
return accessibleContext;
}
diff --git a/libjava/classpath/javax/swing/BoxLayout.java b/libjava/classpath/javax/swing/BoxLayout.java
index 28bb53928ef..ebc0b4c211c 100644
--- a/libjava/classpath/javax/swing/BoxLayout.java
+++ b/libjava/classpath/javax/swing/BoxLayout.java
@@ -45,12 +45,6 @@ import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager2;
import java.io.Serializable;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import gnu.java.awt.AWTUtilities;
/**
* A layout that stacks the children of a container in a Box, either
@@ -63,248 +57,6 @@ public class BoxLayout implements LayoutManager2, Serializable
{
/**
- * This is an abstraction that allows the BoxLayout algorithm to
- * be applied to both direction (X and Y) without duplicating the
- * algorithm. It defines several methods that access properties of
- * a component for a specific direction.
- */
- static interface Direction
- {
- /**
- * Returns the correct part of <code>d</code> for this direction. This will
- * be <code>d.width</code> for horizontal and <code>d.height</code> for
- * vertical direction.
- *
- * @param d the size as Dimension object
- *
- * @return the correct part of <code>d</code> for this direction
- */
- int size(Dimension d);
-
- /**
- * Returns the lower bounds of the {@link Insets} object according to this
- * direction. This will be <code>insets.top</code> for vertical direction
- * and <code>insets.left</code> for horizontal direction.
- *
- * @param the {@link Insets} object from which to return the lower bounds
- *
- * @return the lower bounds of the {@link Insets} object according to this
- * direction
- */
- int lower(Insets insets);
-
- /**
- * Returns the alignment property according to this direction.
- *
- * @param comp the Component for which to return the alignment property
- *
- * @return the alignment property according to this direction
- */
- float alignment(Component comp);
-
- /**
- * Sets the location for Component <code>c</code>. <code>coord1</code>
- * specifies the coordinate of the location in this direction,
- * <code>coord2</code> the coordinate of the location in the opposite
- * direction.
- *
- * @param c the Component for which to set the location
- * @param coord1 the coordinate in this direction
- * @param coord2 the coordinate in the opposite direction
- */
- void setLocation(Component c, int coord1, int coord2);
-
- /**
- * Sets the size for Component <code>c</code>. <code>coord1</code>
- * specifies the size in this direction,
- * <code>coord2</code> the size in the opposite
- * direction.
- *
- * @param c the Component for which to set the size
- * @param size1 the size in this direction
- * @param size2 the size in the opposite direction
- */
- void setSize(Component c, int size1, int size2);
- }
-
- /**
- * The horizontal direction.
- */
- static class Horizontal implements Direction
- {
- /**
- * Returns the correct part of <code>d</code> for this direction. This will
- * be <code>d.width</code> for horizontal and <code>d.height</code> for
- * vertical direction.
- *
- * @param d the size as Dimension object
- *
- * @return the correct part of <code>d</code> for this direction
- */
- public int size(Dimension d)
- {
- return d.width;
- }
-
- /**
- * Returns the lower bounds of the {@link Insets} object according to this
- * direction. This will be <code>insets.top</code> for vertical direction
- * and <code>insets.left</code> for horizontal direction.
- *
- * @param insets the {@link Insets} object from which to return the lower
- * bounds
- *
- * @return the lower bounds of the {@link Insets} object according to this
- * direction
- */
- public int lower(Insets insets)
- {
- return insets.left;
- }
-
- /**
- * Returns the alignment property according to this direction.
- *
- * @param comp the Component for which to return the alignment property
- *
- * @return the alignment property according to this direction
- */
- public float alignment(Component comp)
- {
- return comp.getAlignmentX();
- }
-
- /**
- * Sets the location for Component <code>c</code>. <code>coord1</code>
- * specifies the coordinate of the location in this direction,
- * <code>coord2</code> the coordinate of the location in the opposite
- * direction.
- *
- * @param c the Component for which to set the location
- * @param coord1 the coordinate in this direction
- * @param coord2 the coordinate in the opposite direction
- */
- public void setLocation(Component c, int coord1, int coord2)
- {
- c.setLocation(coord1, coord2);
- }
-
- /**
- * Sets the size for Component <code>c</code>. <code>coord1</code>
- * specifies the size in this direction,
- * <code>coord2</code> the size in the opposite
- * direction.
- *
- * @param c the Component for which to set the size
- * @param size1 the size in this direction
- * @param size2 the size in the opposite direction
- */
- public void setSize(Component c, int size1, int size2)
- {
- c.setSize(size1, size2);
- }
- }
- /**
- * The vertical direction.
- */
- static class Vertical implements Direction
- {
- /**
- * Returns the correct part of <code>d</code> for this direction. This will
- * be <code>d.width</code> for horizontal and <code>d.height</code> for
- * vertical direction.
- *
- * @param d the size as Dimension object
- *
- * @return the correct part of <code>d</code> for this direction
- */
- public int size(Dimension d)
- {
- return d.height;
- }
-
- /**
- * Returns the lower bounds of the {@link Insets} object according to this
- * direction. This will be <code>insets.top</code> for vertical direction
- * and <code>insets.left</code> for horizontal direction.
- *
- * @param insets the {@link Insets} object from which to return the lower
- * bounds
- *
- * @return the lower bounds of the {@link Insets} object according to this
- * direction
- */
- public int lower(Insets insets)
- {
- return insets.top;
- }
-
- /**
- * Returns the alignment property according to this direction.
- *
- * @param comp the Component for which to return the alignment property
- *
- * @return the alignment property according to this direction
- */
- public float alignment(Component comp)
- {
- return comp.getAlignmentY();
- }
-
- /**
- * Sets the location for Component <code>c</code>. <code>coord1</code>
- * specifies the coordinate of the location in this direction,
- * <code>coord2</code> the coordinate of the location in the opposite
- * direction.
- *
- * @param c the Component for which to set the location
- * @param coord1 the coordinate in this direction
- * @param coord2 the coordinate in the opposite direction
- */
- public void setLocation(Component c, int coord1, int coord2)
- {
- c.setLocation(coord2, coord1);
- }
-
- /**
- * Sets the size for Component <code>c</code>. <code>coord1</code>
- * specifies the size in this direction,
- * <code>coord2</code> the size in the opposite
- * direction.
- *
- * @param c the Component for which to set the size
- * @param size1 the size in this direction
- * @param size2 the size in the opposite direction
- */
- public void setSize(Component c, int size1, int size2)
- {
- c.setSize(size2, size1);
- }
- }
-
- /**
- * A helper class that temporarily stores the size specs of a component.
- */
- static class SizeReq
- {
- int size;
- int min;
- int pref;
- int max;
- float align;
- Component comp;
- SizeReq(Component comp, Direction dir)
- {
- this.min = dir.size(comp.getMinimumSize());
- this.pref = dir.size(comp.getPreferredSize());
- this.max = dir.size(comp.getMaximumSize());
- this.size = dir.size(comp.getSize());
- this.align = dir.alignment(comp);
- this.comp = comp;
- }
- }
-
- /**
* Specifies that components are laid out left to right.
*/
public static final int X_AXIS = 0;
@@ -334,16 +86,50 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
private Container container;
- /*
+ /**
* Current type of component layouting. Defaults to X_AXIS.
*/
private int way = X_AXIS;
- /** Constant for the horizontal direction. */
- private static final Direction HORIZONTAL = new Horizontal();
+ /**
+ * The size requirements of the containers children for the X direction.
+ */
+ private SizeRequirements[] xChildren;
+
+ /**
+ * The size requirements of the containers children for the Y direction.
+ */
+ private SizeRequirements[] yChildren;
+
+ /**
+ * The size requirements of the container to be laid out for the X direction.
+ */
+ private SizeRequirements xTotal;
+
+ /**
+ * The size requirements of the container to be laid out for the Y direction.
+ */
+ private SizeRequirements yTotal;
+
+ /**
+ * The offsets of the child components in the X direction.
+ */
+ private int[] offsetsX;
+
+ /**
+ * The offsets of the child components in the Y direction.
+ */
+ private int[] offsetsY;
+
+ /**
+ * The spans of the child components in the X direction.
+ */
+ private int[] spansX;
- /** Constant for the vertical direction. */
- private static final Direction VERTICAL = new Vertical();
+ /**
+ * The spans of the child components in the Y direction.
+ */
+ private int[] spansY;
/**
* Constructs a <code>BoxLayout</code> object.
@@ -355,6 +141,9 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public BoxLayout(Container container, int way)
{
+ if (way != X_AXIS && way != Y_AXIS && way != LINE_AXIS && way != PAGE_AXIS)
+ throw new AWTError("Invalid axis");
+
int width = 0;
int height = 0;
this.container = container;
@@ -369,6 +158,7 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void addLayoutComponent(String name, Component component)
{
+ // Nothing to do here.
}
/**
@@ -378,6 +168,7 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void removeLayoutComponent(Component component)
{
+ // Nothing to do here.
}
private boolean isHorizontalIn(Container parent)
@@ -401,45 +192,16 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public Dimension preferredLayoutSize(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- Insets insets = parent.getInsets();
- int x = 0;
- int y = 0;
-
- List children = AWTUtilities.getVisibleChildren(parent);
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
- if (isHorizontalIn(parent))
- {
- x = insets.left + insets.right;
- // sum up preferred widths of components, find maximum of preferred
- // heights
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component comp = (Component) i.next();
- Dimension sz = comp.getPreferredSize();
- x += sz.width;
- y = Math.max(y, sz.height);
- }
- y += insets.bottom + insets.top;
- }
- else
- {
- y = insets.top + insets.bottom;
- // sum up preferred heights of components, find maximum of
- // preferred widths
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component comp = (Component) i.next();
- Dimension sz = comp.getPreferredSize();
- y += sz.height;
- x = Math.max(x, sz.width);
- }
- x += insets.left + insets.right;
+ checkTotalRequirements();
+ Insets i = container.getInsets();
+ return new Dimension(xTotal.preferred + i.left + i.right,
+ yTotal.preferred + i.top + i.bottom);
}
-
- return new Dimension(x, y);
}
/**
@@ -451,41 +213,16 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public Dimension minimumLayoutSize(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- Insets insets = parent.getInsets();
- int x = insets.left + insets.right;
- int y = insets.bottom + insets.top;
-
- List children = AWTUtilities.getVisibleChildren(parent);
-
- if (isHorizontalIn(parent))
+ synchronized (container.getTreeLock())
{
- // sum up preferred widths of components, find maximum of preferred
- // heights
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component comp = (Component) i.next();
- Dimension sz = comp.getMinimumSize();
- x += sz.width;
- y = Math.max(y, sz.height);
- }
- }
- else
- {
- // sum up preferred heights of components, find maximum of
- // preferred widths
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component comp = (Component) i.next();
- Dimension sz = comp.getMinimumSize();
- y += sz.height;
- x = Math.max(x, sz.width);
- }
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ checkTotalRequirements();
+ Insets i = container.getInsets();
+ return new Dimension(xTotal.minimum + i.left + i.right,
+ yTotal.minimum + i.top + i.bottom);
}
-
- return new Dimension(x, y);
}
/**
@@ -495,12 +232,20 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void layoutContainer(Container parent)
{
- if (isHorizontalIn(parent))
- layoutAlgorithm(parent, HORIZONTAL, VERTICAL);
- else
- layoutAlgorithm(parent, VERTICAL, HORIZONTAL);
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ checkLayout();
+ Component[] children = container.getComponents();
+ Insets in = container.getInsets();
+ for (int i = 0; i < children.length; i++)
+ children[i].setBounds(offsetsX[i] + in.left, offsetsY[i] + in.top,
+ spansX[i], spansY[i]);
+ }
}
-
+
/**
* Adds a component to the layout. Not used in BoxLayout
*
@@ -509,6 +254,7 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void addLayoutComponent(Component child, Object constraints)
{
+ // Nothing to do here.
}
/**
@@ -520,10 +266,14 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public float getLayoutAlignmentX(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- return 0;
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ checkTotalRequirements();
+ return xTotal.alignment;
+ }
}
/**
@@ -535,10 +285,14 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public float getLayoutAlignmentY(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- return 0;
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ checkTotalRequirements();
+ return yTotal.alignment;
+ }
}
/**
@@ -548,8 +302,20 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void invalidateLayout(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
+ synchronized (container.getTreeLock())
+ {
+ xChildren = null;
+ yChildren = null;
+ xTotal = null;
+ yTotal = null;
+ offsetsX = null;
+ offsetsY = null;
+ spansX = null;
+ spansY = null;
+ }
}
/**
@@ -562,188 +328,117 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public Dimension maximumLayoutSize(Container parent)
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- Insets insets = parent.getInsets();
- int x = insets.left + insets.right;
- int y = insets.top + insets.bottom;
+ synchronized (container.getTreeLock())
+ {
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
- List children = AWTUtilities.getVisibleChildren(parent);
+ checkTotalRequirements();
+ Insets i = container.getInsets();
+ return new Dimension(xTotal.maximum + i.left + i.right,
+ yTotal.maximum + i.top + i.bottom);
+ }
+ }
- if (isHorizontalIn(parent))
+ /**
+ * Makes sure that the xTotal and yTotal fields are set up correctly. A call
+ * to {@link #invalidateLayout} sets these fields to null and they have to be
+ * recomputed.
+ */
+ private void checkTotalRequirements()
+ {
+ if (xTotal == null || yTotal == null)
{
-
- // sum up preferred widths of components, find maximum of preferred
- // heights
- for (Iterator i = children.iterator(); i.hasNext();)
+ checkRequirements();
+ if (isHorizontalIn(container))
{
- Component comp = (Component) i.next();
- Dimension sz = comp.getMaximumSize();
- x += sz.width;
- // Check for overflow.
- if (x < 0)
- x = Integer.MAX_VALUE;
- y = Math.max(y, sz.height);
+ xTotal = SizeRequirements.getTiledSizeRequirements(xChildren);
+ yTotal = SizeRequirements.getAlignedSizeRequirements(yChildren);
}
- }
- else
- {
- // sum up preferred heights of components, find maximum of
- // preferred widths
- for (Iterator i = children.iterator(); i.hasNext();)
+ else
{
- Component comp = (Component) i.next();
- Dimension sz = comp.getMaximumSize();
- y += sz.height;
- // Check for overflow
- if (y < 0)
- y = Integer.MAX_VALUE;
- x = Math.max(x, sz.width);
+ xTotal = SizeRequirements.getAlignedSizeRequirements(xChildren);
+ yTotal = SizeRequirements.getTiledSizeRequirements(yChildren);
}
- }
- return new Dimension(x, y);
+ }
}
/**
- * Lays out the Container <code>c</code> in the layout direction
- * <code>layoutDir</code>. The direction that is crossing the layout
- * direction is specified in <code>crossDir</code>.
- *
- * @param parent
- * @param layoutDir
- * @param crossDir
+ * Makes sure that the xChildren and yChildren fields are correctly set up.
+ * A call to {@link #invalidateLayout(Container)} sets these fields to null,
+ * so they have to be set up again.
*/
- void layoutAlgorithm(Container parent, Direction layoutDir, Direction crossDir)
+ private void checkRequirements()
{
- if (parent != container)
- throw new AWTError("invalid parent");
-
- Dimension parentSize = parent.getSize();
- Insets insets = parent.getInsets();
- Dimension innerSize = new Dimension(parentSize.width - insets.left
- - insets.right, parentSize.height
- - insets.bottom - insets.top);
-
- // Set all components to their preferredSizes and sum up the allocated
- // space. Create SizeReqs for each component and store them in
- // sizeReqs. Find the maximum size in the crossing direction.
- List children = AWTUtilities.getVisibleChildren(parent);
- Vector sizeReqs = new Vector();
- int allocated = 0;
- for (Iterator i = children.iterator(); i.hasNext();)
- {
- Component c = (Component) i.next();
- SizeReq sizeReq = new SizeReq(c, layoutDir);
- int preferred = layoutDir.size(c.getPreferredSize());
- sizeReq.size = preferred;
- allocated += preferred;
- sizeReqs.add(sizeReq);
- }
-
- // Distribute remaining space (may be positive or negative) over components
- int remainder = layoutDir.size(innerSize) - allocated;
- distributeSpace(sizeReqs, remainder, layoutDir);
-
- // Resize and relocate components. If the component can be sized to
- // take the full space in the crossing direction, then do so, otherwise
- // align according to its alingnmentX or alignmentY property.
- int loc = 0;
- int offset1 = layoutDir.lower(insets);
- int offset2 = crossDir.lower(insets);
- for (Iterator i = sizeReqs.iterator(); i.hasNext();)
+ if (xChildren == null || yChildren == null)
{
- SizeReq sizeReq = (SizeReq) i.next();
- Component c = sizeReq.comp;
- int availCrossSize = crossDir.size(innerSize);
- int maxCross = crossDir.size(c.getMaximumSize());
- int crossSize = Math.min(availCrossSize, maxCross);
- int crossRemainder = availCrossSize - crossSize;
- int crossLoc = (int) (crossDir.alignment(c) * crossRemainder);
- layoutDir.setSize(c, sizeReq.size, crossSize);
- layoutDir.setLocation(c, offset1 + loc, offset2 + crossLoc);
- loc += sizeReq.size;
+ Component[] children = container.getComponents();
+ xChildren = new SizeRequirements[children.length];
+ yChildren = new SizeRequirements[children.length];
+ for (int i = 0; i < children.length; i++)
+ {
+ if (! children[i].isVisible())
+ {
+ xChildren[i] = new SizeRequirements();
+ yChildren[i] = new SizeRequirements();
+ }
+ else
+ {
+ xChildren[i] =
+ new SizeRequirements(children[i].getMinimumSize().width,
+ children[i].getPreferredSize().width,
+ children[i].getMaximumSize().width,
+ children[i].getAlignmentX());
+ yChildren[i] =
+ new SizeRequirements(children[i].getMinimumSize().height,
+ children[i].getPreferredSize().height,
+ children[i].getMaximumSize().height,
+ children[i].getAlignmentY());
+ }
+ }
}
}
/**
- * Distributes some space over a set of components. This implementation
- * tries to set the components as close as possible to their
- * <code>preferredSize</code>s, and respects the components
- * <code>minimumSize</code> and <code>maximumSize</code>.
- *
- * The algorithm is implemented as follows:
- *
- * <ul>
- * <li>The <code>remainder</code> is divided by the number of components
- * in <code>freeComponents</code>.</li>
- * <li>The result is added to (or substracted from) the size of each
- * component.</li>
- * <li>If the <code>minimumSize</code> or <code>maximumSize</code> of a
- * component is exceeded, then this component is set to its
- * <code>minimumSize</code> or <code>maximumSize</code>, it is removed from
- * <code>freeComponents</code> and the difference is added to a new
- * remainder.</li>
- * <li>Finally, if there is a new remainer != 0 and the
- * <code>freeComponents.size() != 0</code>, then this method is called
- * recursivly to distribute the newly allocated remaining space.</li>
- * </ul>
- *
- * @param freeComponents a SizeReq collection for components that have space
- * left so that they can be moved freely
- * @param remainder the space that should be distributed between the
- * components
- * @param dir the direction in which we operate
+ * Makes sure that the offsetsX, offsetsY, spansX and spansY fields are set
+ * up correctly. A call to {@link #invalidateLayout} sets these fields
+ * to null and they have to be recomputed.
*/
- void distributeSpace(Collection freeComponents, int remainder, Direction dir)
+ private void checkLayout()
{
- // Sum up total available space in components. If the remainder is negative
- // then we sum up the difference between minSize and size. If remainder
- // is positive we sum up the difference between maxSize and size.
- double totalAvailable = 0;
- for (Iterator i = freeComponents.iterator(); i.hasNext();)
- {
- SizeReq sizeReq = (SizeReq) i.next();
- if (remainder >= 0)
- totalAvailable += sizeReq.max - sizeReq.size;
- else
- totalAvailable += sizeReq.min - sizeReq.size;
- }
- if (totalAvailable == 0)
- if (remainder >= 0)
- totalAvailable = 1;
- else
- totalAvailable = -1;
-
- int newRemainder = 0;
- Vector stillFree = new Vector();
- for (Iterator i = freeComponents.iterator(); i.hasNext();)
+ if (offsetsX == null || offsetsY == null || spansX == null
+ || spansY == null)
{
- // Add/substract share to component.
- SizeReq sizeReq = (SizeReq) i.next();
- double available = 0;
- if (remainder >= 0)
- available = sizeReq.max - sizeReq.size;
+ checkRequirements();
+ checkTotalRequirements();
+ int len = container.getComponents().length;
+ offsetsX = new int[len];
+ offsetsY = new int[len];
+ spansX = new int[len];
+ spansY = new int[len];
+
+ Insets in = container.getInsets();
+ int width = container.getWidth() - in.left - in.right;
+ int height = container.getHeight() - in.top -in.bottom;
+
+ if (isHorizontalIn(container))
+ {
+ SizeRequirements.calculateTiledPositions(width,
+ xTotal, xChildren,
+ offsetsX, spansX);
+ SizeRequirements.calculateAlignedPositions(height,
+ yTotal, yChildren,
+ offsetsY, spansY);
+ }
else
- available = sizeReq.min - sizeReq.size;
- int share = (int) ((available / totalAvailable) * remainder);
- sizeReq.size += share;
- // check for min/maximumSize
- if (sizeReq.size < sizeReq.min)
- {
- newRemainder += sizeReq.size - sizeReq.min;
- sizeReq.size = sizeReq.min;
- }
- else if (sizeReq.size > sizeReq.max)
- {
- newRemainder += sizeReq.size - sizeReq.max;
- sizeReq.size = sizeReq.max;
- }
- else
- stillFree.add(sizeReq);
+ {
+ SizeRequirements.calculateAlignedPositions(width,
+ xTotal, xChildren,
+ offsetsX, spansX);
+ SizeRequirements.calculateTiledPositions(height,
+ yTotal, yChildren,
+ offsetsY, spansY);
+ }
}
- // recursivly call this method if necessary
- if (newRemainder != 0 && stillFree.size() > 0)
- distributeSpace(stillFree, newRemainder, dir);
}
}
diff --git a/libjava/classpath/javax/swing/ButtonGroup.java b/libjava/classpath/javax/swing/ButtonGroup.java
index 3de1d4b9f16..94f0109e634 100644
--- a/libjava/classpath/javax/swing/ButtonGroup.java
+++ b/libjava/classpath/javax/swing/ButtonGroup.java
@@ -79,6 +79,7 @@ public class ButtonGroup implements Serializable
*/
public ButtonGroup()
{
+ // Nothing to do here.
}
/**
@@ -89,6 +90,8 @@ public class ButtonGroup implements Serializable
public void add(AbstractButton b)
{
b.getModel().setGroup(this);
+ if (b.isSelected())
+ sel = b.getModel();
buttons.addElement(b);
}
@@ -158,7 +161,7 @@ public class ButtonGroup implements Serializable
{
ButtonModel old = sel;
sel = m;
-
+
if (old != null)
old.setSelected(false);
AbstractButton button = FindButton(old);
diff --git a/libjava/classpath/javax/swing/ButtonModel.java b/libjava/classpath/javax/swing/ButtonModel.java
index 1bdc5d1850d..03fac13d2fa 100644
--- a/libjava/classpath/javax/swing/ButtonModel.java
+++ b/libjava/classpath/javax/swing/ButtonModel.java
@@ -49,37 +49,253 @@ import javax.swing.event.ChangeListener;
*/
public interface ButtonModel extends ItemSelectable
{
- boolean isArmed();
- void setArmed(boolean b);
+ /**
+ * Returns <code>true</code> if the button is armed, <code>false</code>
+ * otherwise.
+ *
+ * A button is armed, when the user has pressed the mouse over it, but has
+ * not yet released the mouse.
+ *
+ * @return <code>true</code> if the button is armed, <code>false</code>
+ * otherwise
+ *
+ * @see #setArmed(boolean)
+ */
+ boolean isArmed();
- boolean isEnabled();
- void setEnabled(boolean b);
+ /**
+ * Sets the armed flag of the button.
+ *
+ * A button is armed, when the user has pressed the mouse over it, but has
+ * not yet released the mouse.
+ *
+ * @param b <code>true</code> if the button is armed, <code>false</code>
+ * otherwise
+ *
+ * @see #isArmed()
+ */
+ void setArmed(boolean b);
- void setPressed(boolean b);
- boolean isPressed();
+ /**
+ * Returns <code>true</code> if the button is enabled, <code>false</code>
+ * otherwise.
+ *
+ * When a button is disabled, it is usually grayed out and the user cannot
+ * change its state.
+ *
+ * @return <code>true</code> if the button is enabled, <code>false</code>
+ * otherwise
+ *
+ * @see #setEnabled(boolean)
+ */
+ boolean isEnabled();
+ /**
+ * Sets the enabled flag of the button.
+ *
+ * When a button is disabled, it is usually grayed out and the user cannot
+ * change its state.
+ *
+ * @param b <code>true</code> if the button is enabled, <code>false</code>
+ * otherwise
+ *
+ * @see #isEnabled()
+ */
+ void setEnabled(boolean b);
- void removeActionListener(ActionListener l);
- void addActionListener(ActionListener l);
+ /**
+ * Sets the pressed flag of the button.
+ *
+ * The button usually gets pressed when the user clicks on a button, it will
+ * be un-pressed when the user releases the mouse.
+ *
+ * @param b <code>true</code> if the button is pressed, <code>false</code>
+ * otherwise
+ *
+ * @see #isPressed()
+ */
+ void setPressed(boolean b);
- void addItemListener(ItemListener l);
- void removeItemListener(ItemListener l);
-
- void addChangeListener(ChangeListener l);
- void removeChangeListener(ChangeListener l);
+ /**
+ * Returns <code>true</code> if the button is pressed, <code>false</code>
+ * otherwise.
+ *
+ * The button usually gets pressed when the user clicks on a button, it will
+ * be un-pressed when the user releases the mouse.
+ *
+ * @return <code>true</code> if the button is pressed, <code>false</code>
+ * otherwise
+ *
+ * @see #setPressed(boolean)
+ */
+ boolean isPressed();
- void setRollover(boolean b);
- boolean isRollover();
+ /**
+ * Removes an {@link ActionListener} from the list of registered listeners.
+ *
+ * @param l the action listener to remove
+ *
+ * @see #addActionListener(ActionListener)
+ */
+ void removeActionListener(ActionListener l);
- int getMnemonic();
- void setMnemonic(int key);
+ /**
+ * Adds an {@link ActionListener} to the list of registered listeners.
+ *
+ * An <code>ActionEvent</code> is usually fired when the user clicks on a
+ * button.
+ *
+ * @param l the action listener to add
+ *
+ * @see #removeActionListener(ActionListener)
+ */
+ void addActionListener(ActionListener l);
- void setActionCommand(String s);
- String getActionCommand();
+ /**
+ * Adds an {@link ItemListener} to the list of registered listeners.
+ *
+ * An <code>ItemEvent</code> is usually fired when a button's selected
+ * state changes. This applies only to buttons that support the selected
+ * flag.
+ *
+ * @param l the item listener to add
+ *
+ * @see #removeItemListener(ItemListener)
+ */
+ void addItemListener(ItemListener l);
- void setGroup(ButtonGroup group);
+ /**
+ * Adds an {@link ItemListener} to the list of registered listeners.
+ *
+ * @param l the item listener to add
+ *
+ * @see #removeItemListener(ItemListener)
+ */
+ void removeItemListener(ItemListener l);
- void setSelected(boolean b);
- boolean isSelected();
+ /**
+ * Adds an {@link ChangeListener} to the list of registered listeners.
+ *
+ * A <code>ChangeEvent</code> is fired when any one of the button's flags
+ * changes.
+ *
+ * @param l the change listener to add
+ *
+ * @see #removeChangeListener(ChangeListener)
+ */
+ void addChangeListener(ChangeListener l);
+
+ /**
+ * Adds an {@link ChangeListener} to the list of registered listeners.
+ *
+ * @param l the change listener to add
+ *
+ * @see #removeChangeListener(ChangeListener)
+ */
+ void removeChangeListener(ChangeListener l);
+
+ /**
+ * Sets the rollover flag of the button.
+ *
+ * A button is rollover-ed, when the user has moved the mouse over it, but has
+ * not yet pressed the mouse.
+ *
+ * @param b <code>true</code> if the button is rollover, <code>false</code>
+ * otherwise
+ *
+ * @see #isRollover()
+ */
+ void setRollover(boolean b);
+
+ /**
+ * Returns <code>true</code> if the button is rollover-ed, <code>false</code>
+ * otherwise.
+ *
+ * A button is rollover-ed, when the user has moved the mouse over it, but has
+ * not yet pressed the mouse.
+ *
+ * @return <code>true</code> if the button is rollover, <code>false</code>
+ * otherwise
+ *
+ * @see #setRollover(boolean)
+ */
+ boolean isRollover();
+
+ /**
+ * Returns the keyboard mnemonic for the button. This specifies a shortcut
+ * or accelerator key that can be used to activate the button.
+ *
+ * @return the keyboard mnemonic for the button
+ *
+ * @see #setMnemonic(int)
+ */
+ int getMnemonic();
+
+ /**
+ * Sets the keyboard mnemonic for the button. This specifies a shortcut
+ * or accelerator key that can be used to activate the button.
+ *
+ * @param key the keyboard mnemonic for the button
+ *
+ * @see #getMnemonic()
+ */
+ void setMnemonic(int key);
+
+ /**
+ * Sets the action command for the button. This will be used in
+ * <code>ActionEvents</code> fired by the button.
+ *
+ * @param s the action command to set
+ *
+ * @see #getActionCommand()
+ */
+ void setActionCommand(String s);
+
+ /**
+ * Returns the action command of the button.
+ *
+ * @return the action command of the button
+ *
+ * @see #setActionCommand(String)
+ */
+ String getActionCommand();
+
+ /**
+ * Sets the button group for the button. Some kinds of button (e.g. radio
+ * buttons) allow only one button within a button group selected at any one
+ * time.
+ *
+ * @param group the button group to set
+ */
+ void setGroup(ButtonGroup group);
+
+ /**
+ * Sets the selected flag of the button.
+ *
+ * Some kinds of buttons (e.g. toggle buttons, check boxes, radio buttons)
+ * can be in one of two states: selected or unselected. The selected state
+ * is usually toggled by clicking on the button.
+ *
+ * @param b <code>true</code> if the button is selected, <code>false</code>
+ * otherwise
+ *
+ * @see #isSelected()
+ */
+ void setSelected(boolean b);
+
+ /**
+ * Returns <code>true</code> if the button is selected, <code>false</code>
+ * otherwise.
+ *
+ * Some kinds of buttons (e.g. toggle buttons, check boxes, radio buttons)
+ * can be in one of two states: selected or unselected. The selected state
+ * is usually toggled by clicking on the button.
+ *
+ * @return <code>true</code> if the button is selected, <code>false</code>
+ * otherwise
+ *
+ * @see #setSelected(boolean)
+ */
+ boolean isSelected();
}
diff --git a/libjava/classpath/javax/swing/CellEditor.java b/libjava/classpath/javax/swing/CellEditor.java
index bdb1665750d..3d229b26675 100644
--- a/libjava/classpath/javax/swing/CellEditor.java
+++ b/libjava/classpath/javax/swing/CellEditor.java
@@ -83,7 +83,7 @@ public interface CellEditor
/**
* addCellEditorListener
- * @param value0 TODO
+ * @param listener TODO
*/
void addCellEditorListener(CellEditorListener listener);
diff --git a/libjava/classpath/javax/swing/CellRendererPane.java b/libjava/classpath/javax/swing/CellRendererPane.java
index 886d5c5f2a8..c59afd3188a 100644
--- a/libjava/classpath/javax/swing/CellRendererPane.java
+++ b/libjava/classpath/javax/swing/CellRendererPane.java
@@ -54,9 +54,7 @@ import javax.accessibility.AccessibleRole;
*
* @author Andrew Selkirk
*/
-public class CellRendererPane
- extends Container
- implements Accessible
+public class CellRendererPane extends Container implements Accessible
{
private static final long serialVersionUID = -7642183829532984273L;
@@ -72,6 +70,7 @@ public class CellRendererPane
*/
protected AccessibleCellRendererPane()
{
+ // Nothing to do here.
}
/**
@@ -89,22 +88,13 @@ public class CellRendererPane
*/
protected AccessibleContext accessibleContext = null;
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
/**
* Constructs a new CellRendererPane.
*/
public CellRendererPane()
{
- } // CellRendererPane()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
+ // Nothing to do here.
+ }
/**
* Should not be called.
@@ -113,7 +103,8 @@ public class CellRendererPane
*/
public void update(Graphics graphics)
{
- } // update()
+ //Nothing to do here.
+ }
/**
* Despite normal behaviour this does <em>not</em> cause the container
@@ -121,7 +112,8 @@ public class CellRendererPane
*/
public void invalidate()
{
- } // invalidate()
+ // Overridden to do nothing.
+ }
/**
* Should not be called.
@@ -130,6 +122,7 @@ public class CellRendererPane
*/
public void paint(Graphics graphics)
{
+ // Overridden to do nothing.
}
/**
@@ -147,7 +140,7 @@ public class CellRendererPane
{
super.addImpl(c, constraints, index);
}
- } // addImpl()
+ }
/**
* Paints the specified component <code>c</code> on the {@link Graphics}
@@ -175,9 +168,10 @@ public class CellRendererPane
// reparent c
addImpl(c, null, 0);
+ Rectangle oldClip = graphics.getClipBounds();
// translate to (x,y)
graphics.translate(x, y);
-
+ graphics.clipRect(0, 0, w, h);
// set bounds of c
c.setBounds(0, 0, w, h);
@@ -192,8 +186,8 @@ public class CellRendererPane
// untranslate g
graphics.translate(-x, -y);
-
- } // paintComponent()
+ graphics.setClip(oldClip);
+ }
/**
* Paints the specified component <code>c</code> on the {@link Graphics}
@@ -215,7 +209,7 @@ public class CellRendererPane
Container p, int x, int y, int w, int h)
{
paintComponent(graphics, c, p, x, y, w, h, false);
- } // paintComponent()
+ }
/**
* Paints the specified component <code>c</code> on the {@link Graphics}
@@ -233,7 +227,7 @@ public class CellRendererPane
Container p, Rectangle r)
{
paintComponent(graphics, c, p, r.x, r.y, r.width, r.height);
- } // paintComponent()
+ }
/**
* getAccessibleContext <em>TODO</em>
diff --git a/libjava/classpath/javax/swing/ComboBoxEditor.java b/libjava/classpath/javax/swing/ComboBoxEditor.java
index 4eb5fc56206..8e914e4b9fe 100644
--- a/libjava/classpath/javax/swing/ComboBoxEditor.java
+++ b/libjava/classpath/javax/swing/ComboBoxEditor.java
@@ -64,7 +64,7 @@ public interface ComboBoxEditor
* combo box list then this method should be called to change editting item
* to the new selected item.
*
- * @param selectedItem item that is currently selected in the combo box
+ * @param item item that is currently selected in the combo box
*/
void setItem(Object item);
diff --git a/libjava/classpath/javax/swing/ComponentInputMap.java b/libjava/classpath/javax/swing/ComponentInputMap.java
index f95c3104535..28aa8e22cf6 100644
--- a/libjava/classpath/javax/swing/ComponentInputMap.java
+++ b/libjava/classpath/javax/swing/ComponentInputMap.java
@@ -78,7 +78,8 @@ public class ComponentInputMap extends InputMap
public void put(KeyStroke keystroke, Object value)
{
super.put(keystroke, value);
- // FIXME: Notify component.
+ if (component != null)
+ component.updateComponentInputMap(this);
}
/**
@@ -87,7 +88,8 @@ public class ComponentInputMap extends InputMap
public void clear()
{
super.clear();
- // FIXME: Notify component.
+ if (component != null)
+ component.updateComponentInputMap(this);
}
/**
@@ -98,7 +100,8 @@ public class ComponentInputMap extends InputMap
public void remove(KeyStroke keystroke)
{
super.remove(keystroke);
- // FIXME: Notify component.
+ if (component != null)
+ component.updateComponentInputMap(this);
}
/**
@@ -111,14 +114,19 @@ public class ComponentInputMap extends InputMap
*/
public void setParent(InputMap parentMap)
{
- if (! (parentMap instanceof ComponentInputMap))
- throw new IllegalArgumentException();
-
- if (((ComponentInputMap) parentMap).getComponent() != component)
- throw new IllegalArgumentException();
+ if (parentMap != null && !(parentMap instanceof ComponentInputMap))
+ throw new IllegalArgumentException("ComponentInputMaps can only have " +
+ "ComponentInputMaps for parents");
+
+ if (parentMap != null &&
+ ((ComponentInputMap) parentMap).getComponent() != component)
+ throw new
+ IllegalArgumentException("ComponentInputMaps' parents must " +
+ "be associated with the same JComponents");
super.setParent(parentMap);
- // FIXME: Notify component.
+ if (component != null)
+ component.updateComponentInputMap(this);
}
/**
diff --git a/libjava/classpath/javax/swing/DebugGraphics.java b/libjava/classpath/javax/swing/DebugGraphics.java
index 137b82337af..126309a5844 100644
--- a/libjava/classpath/javax/swing/DebugGraphics.java
+++ b/libjava/classpath/javax/swing/DebugGraphics.java
@@ -42,6 +42,7 @@ import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Image;
+import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.image.ImageObserver;
@@ -84,15 +85,16 @@ public class DebugGraphics extends Graphics
static PrintStream debugLogStream = System.out;
/**
- * graphics
+ * Counts the created DebugGraphics objects. This is used by the
+ * logging facility.
*/
- Graphics graphics;
+ static int counter = 0;
/**
- * color
+ * graphics
*/
- Color color = Color.BLACK;
-
+ Graphics graphics;
+
/**
* buffer
*/
@@ -123,7 +125,7 @@ public class DebugGraphics extends Graphics
*/
public DebugGraphics()
{
- // TODO
+ counter++;
}
/**
@@ -134,7 +136,7 @@ public class DebugGraphics extends Graphics
*/
public DebugGraphics(Graphics graphics, JComponent component)
{
- this.graphics = graphics;
+ this(graphics);
// FIXME: What shall we do with component ?
}
@@ -145,6 +147,7 @@ public class DebugGraphics extends Graphics
*/
public DebugGraphics(Graphics graphics)
{
+ this();
this.graphics = graphics;
}
@@ -155,7 +158,10 @@ public class DebugGraphics extends Graphics
*/
public void setColor(Color color)
{
- this.color = color;
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting color: " + color);
+
+ graphics.setColor(color);
}
/**
@@ -166,7 +172,9 @@ public class DebugGraphics extends Graphics
*/
public Graphics create()
{
- return new DebugGraphics(graphics.create());
+ DebugGraphics copy = new DebugGraphics(graphics.create());
+ copy.debugOptions = debugOptions;
+ return copy;
}
/**
@@ -182,7 +190,10 @@ public class DebugGraphics extends Graphics
*/
public Graphics create(int x, int y, int width, int height)
{
- return new DebugGraphics(graphics.create(x, y, width, height));
+ DebugGraphics copy = new DebugGraphics(graphics.create(x, y, width,
+ height));
+ copy.debugOptions = debugOptions;
+ return copy;
}
/**
@@ -282,6 +293,9 @@ public class DebugGraphics extends Graphics
*/
public void setFont(Font font)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting font: " + font);
+
graphics.setFont(font);
}
@@ -292,7 +306,7 @@ public class DebugGraphics extends Graphics
*/
public Color getColor()
{
- return color;
+ return graphics.getColor();
}
/**
@@ -325,6 +339,9 @@ public class DebugGraphics extends Graphics
*/
public void translate(int x, int y)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Translating by: " + new Point(x, y));
+
graphics.translate(x, y);
}
@@ -333,6 +350,9 @@ public class DebugGraphics extends Graphics
*/
public void setPaintMode()
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting paint mode");
+
graphics.setPaintMode();
}
@@ -343,6 +363,9 @@ public class DebugGraphics extends Graphics
*/
public void setXORMode(Color color)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting XOR mode: " + color);
+
graphics.setXORMode(color);
}
@@ -366,7 +389,16 @@ public class DebugGraphics extends Graphics
*/
public void clipRect(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().print(prefix() + " Setting clipRect: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.clipRect(x, y, width, height);
+
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(" Netting clipRect: " + graphics.getClipBounds());
}
/**
@@ -379,6 +411,12 @@ public class DebugGraphics extends Graphics
*/
public void setClip(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Setting new clipRect: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.setClip(x, y, width, height);
}
@@ -399,6 +437,9 @@ public class DebugGraphics extends Graphics
*/
public void setClip(Shape shape)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Setting new clipRect: " + shape);
+
graphics.setClip(shape);
}
@@ -424,18 +465,27 @@ public class DebugGraphics extends Graphics
*/
public void drawRect(int x, int y, int width, int height)
{
- for (int index = 0; index < (debugFlashCount - 1); ++index)
+ if ((debugOptions & LOG_OPTION) != 0)
{
- graphics.setColor(color);
- graphics.drawRect(x, y, width, height);
- sleep(debugFlashTime);
+ logStream().println(prefix() + " Drawing rect: "
+ + new Rectangle(x, y, width, height));
+ }
- graphics.setColor(debugFlashColor);
- graphics.drawRect(x, y, width, height);
- sleep(debugFlashTime);
+ if ((debugOptions & FLASH_OPTION) != 0)
+ {
+ Color color = graphics.getColor();
+ for (int index = 0; index < (debugFlashCount - 1); ++index)
+ {
+ graphics.setColor(color);
+ graphics.drawRect(x, y, width, height);
+ sleep(debugFlashTime);
+ graphics.setColor(debugFlashColor);
+ graphics.drawRect(x, y, width, height);
+ sleep(debugFlashTime);
+ }
+ graphics.setColor(color);
}
- graphics.setColor(color);
graphics.drawRect(x, y, width, height);
}
@@ -449,18 +499,27 @@ public class DebugGraphics extends Graphics
*/
public void fillRect(int x, int y, int width, int height)
{
- for (int index = 0; index < (debugFlashCount - 1); ++index)
+ if ((debugOptions & LOG_OPTION) != 0)
{
- graphics.setColor(color);
- graphics.fillRect(x, y, width, height);
- sleep(debugFlashTime);
+ logStream().println(prefix() + " Filling rect: "
+ + new Rectangle(x, y, width, height));
+ }
- graphics.setColor(debugFlashColor);
- graphics.fillRect(x, y, width, height);
- sleep(debugFlashTime);
+ if ((debugOptions & FLASH_OPTION) != 0)
+ {
+ Color color = graphics.getColor();
+ for (int index = 0; index < (debugFlashCount - 1); ++index)
+ {
+ graphics.setColor(color);
+ graphics.fillRect(x, y, width, height);
+ sleep(debugFlashTime);
+ graphics.setColor(debugFlashColor);
+ graphics.fillRect(x, y, width, height);
+ sleep(debugFlashTime);
+ }
+ graphics.setColor(color);
}
- graphics.setColor(color);
graphics.fillRect(x, y, width, height);
}
@@ -474,6 +533,12 @@ public class DebugGraphics extends Graphics
*/
public void clearRect(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Clearing rect: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.clearRect(x, y, width, height);
}
@@ -490,6 +555,14 @@ public class DebugGraphics extends Graphics
public void drawRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing round rect: "
+ + new Rectangle(x, y, width, height)
+ + " arcWidth: " + arcWidth
+ + " arcHeight: " + arcHeight);
+ }
+
graphics.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
}
@@ -506,6 +579,14 @@ public class DebugGraphics extends Graphics
public void fillRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Filling round rect: "
+ + new Rectangle(x, y, width, height)
+ + " arcWidth: " + arcWidth
+ + " arcHeight: " + arcHeight);
+ }
+
graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
}
@@ -519,6 +600,12 @@ public class DebugGraphics extends Graphics
*/
public void drawLine(int x1, int y1, int x2, int y2)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing line: from (" + x1 + ", "
+ + y1 + ") to (" + x2 + ", " + y2 + ")");
+ }
+
graphics.drawLine(x1, y1, x2, y2);
}
@@ -533,6 +620,13 @@ public class DebugGraphics extends Graphics
*/
public void draw3DRect(int x, int y, int width, int height, boolean raised)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing 3D rect: "
+ + new Rectangle(x, y, width, height)
+ + "Raised bezel: " + raised);
+ }
+
graphics.draw3DRect(x, y, width, height, raised);
}
@@ -547,6 +641,13 @@ public class DebugGraphics extends Graphics
*/
public void fill3DRect(int x, int y, int width, int height, boolean raised)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Filling 3D rect: "
+ + new Rectangle(x, y, width, height)
+ + "Raised bezel: " + raised);
+ }
+
graphics.fill3DRect(x, y, width, height, raised);
}
@@ -560,6 +661,12 @@ public class DebugGraphics extends Graphics
*/
public void drawOval(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing oval: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.drawOval(x, y, width, height);
}
@@ -573,6 +680,12 @@ public class DebugGraphics extends Graphics
*/
public void fillOval(int x, int y, int width, int height)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Filling oval: "
+ + new Rectangle(x, y, width, height));
+ }
+
graphics.fillOval(x, y, width, height);
}
@@ -589,6 +702,14 @@ public class DebugGraphics extends Graphics
public void drawArc(int x, int y, int width, int height,
int startAngle, int arcAngle)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing arc: "
+ + new Rectangle(x, y, width, height)
+ + " startAngle: " + startAngle
+ + " arcAngle: " + arcAngle);
+ }
+
graphics.drawArc(x, y, width, height, startAngle, arcAngle);
}
@@ -605,6 +726,14 @@ public class DebugGraphics extends Graphics
public void fillArc(int x, int y, int width, int height,
int startAngle, int arcAngle)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Filling arc: "
+ + new Rectangle(x, y, width, height)
+ + " startAngle: " + startAngle
+ + " arcAngle: " + arcAngle);
+ }
+
graphics.fillArc(x, y, width, height, startAngle, arcAngle);
}
@@ -617,6 +746,12 @@ public class DebugGraphics extends Graphics
*/
public void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing polyline: nPoints: " + npoints
+ + " X's: " + xpoints + " Y's: " + ypoints);
+ }
+
graphics.drawPolyline(xpoints, ypoints, npoints);
}
@@ -629,6 +764,12 @@ public class DebugGraphics extends Graphics
*/
public void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints
+ + " X's: " + xpoints + " Y's: " + ypoints);
+ }
+
graphics.drawPolygon(xpoints, ypoints, npoints);
}
@@ -641,6 +782,12 @@ public class DebugGraphics extends Graphics
*/
public void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints
+ + " X's: " + xpoints + " Y's: " + ypoints);
+ }
+
graphics.fillPolygon(xpoints, ypoints, npoints);
}
@@ -653,6 +800,12 @@ public class DebugGraphics extends Graphics
*/
public void drawString(String string, int x, int y)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing string: \"" + string
+ + "\" at: " + new Point(x, y));
+ }
+
graphics.drawString(string, x, y);
}
@@ -666,6 +819,12 @@ public class DebugGraphics extends Graphics
public void drawString(AttributedCharacterIterator iterator,
int x, int y)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing string: \"" + iterator
+ + "\" at: " + new Point(x, y));
+ }
+
graphics.drawString(iterator, x, y);
}
@@ -681,6 +840,9 @@ public class DebugGraphics extends Graphics
public void drawBytes(byte[] data, int offset, int length,
int x, int y)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Drawing bytes at: " + new Point(x, y));
+
graphics.drawBytes(data, offset, length, x, y);
}
@@ -696,18 +858,24 @@ public class DebugGraphics extends Graphics
public void drawChars(char[] data, int offset, int length,
int x, int y)
{
- for (int index = 0; index < (debugFlashCount - 1); ++index)
+ if ((debugOptions & LOG_OPTION) != 0)
+ logStream().println(prefix() + " Drawing chars at: " + new Point(x, y));
+
+ if ((debugOptions & FLASH_OPTION) != 0)
{
+ Color color = graphics.getColor();
+ for (int index = 0; index < (debugFlashCount - 1); ++index)
+ {
+ graphics.setColor(color);
+ graphics.drawChars(data, offset, length, x, y);
+ sleep(debugFlashTime);
+ graphics.setColor(debugFlashColor);
+ graphics.drawChars(data, offset, length, x, y);
+ sleep(debugFlashTime);
+ }
graphics.setColor(color);
- graphics.drawChars(data, offset, length, x, y);
- sleep(debugFlashTime);
-
- graphics.setColor(debugFlashColor);
- graphics.drawChars(data, offset, length, x, y);
- sleep(debugFlashTime);
}
- graphics.setColor(color);
graphics.drawChars(data, offset, length, x, y);
}
@@ -723,6 +891,12 @@ public class DebugGraphics extends Graphics
public boolean drawImage(Image image, int x, int y,
ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image + " at: "
+ + new Point(x, y));
+ }
+
return graphics.drawImage(image, x, y, observer);
}
@@ -741,6 +915,12 @@ public class DebugGraphics extends Graphics
public boolean drawImage(Image image, int x, int y, int width,
int height, ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " at: " + new Rectangle(x, y, width, height));
+ }
+
return graphics.drawImage(image, x, y, width, height, observer);
}
@@ -759,6 +939,13 @@ public class DebugGraphics extends Graphics
public boolean drawImage(Image image, int x, int y,
Color background, ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " at: " + new Point(x, y)
+ + ", bgcolor: " + background);
+ }
+
return graphics.drawImage(image, x, y, background, observer);
}
@@ -779,6 +966,13 @@ public class DebugGraphics extends Graphics
public boolean drawImage(Image image, int x, int y, int width, int height,
Color background, ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " at: " + new Rectangle(x, y, width, height)
+ + ", bgcolor: " + background);
+ }
+
return graphics.drawImage(image, x, y, width, height, background, observer);
}
@@ -802,6 +996,13 @@ public class DebugGraphics extends Graphics
int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " destination: " + new Rectangle(dx1, dy1, dx2, dy2)
+ + " source: " + new Rectangle(sx1, sy1, sx2, sy2));
+ }
+
return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
}
@@ -827,6 +1028,14 @@ public class DebugGraphics extends Graphics
int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
Color background, ImageObserver observer)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Drawing image: " + image
+ + " destination: " + new Rectangle(dx1, dy1, dx2, dy2)
+ + " source: " + new Rectangle(sx1, sy1, sx2, sy2)
+ + ", bgcolor: " + background);
+ }
+
return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, background, observer);
}
@@ -843,6 +1052,13 @@ public class DebugGraphics extends Graphics
public void copyArea(int x, int y, int width, int height,
int destx, int desty)
{
+ if ((debugOptions & LOG_OPTION) != 0)
+ {
+ logStream().println(prefix() + " Copying area from: "
+ + new Rectangle(x, y, width, height)
+ + " to: " + new Point(destx, desty));
+ }
+
graphics.copyArea(x, y, width, height, destx, desty);
}
@@ -873,6 +1089,11 @@ public class DebugGraphics extends Graphics
public void setDebugOptions(int options)
{
debugOptions = options;
+ if ((debugOptions & LOG_OPTION) != 0)
+ if (options == NONE_OPTION)
+ logStream().println(prefix() + "Disabling debug");
+ else
+ logStream().println(prefix() + "Enabling debug");
}
/**
@@ -884,4 +1105,21 @@ public class DebugGraphics extends Graphics
{
return debugOptions;
}
+
+ /**
+ * Creates and returns the prefix that should be prepended to all logging
+ * messages. The prefix is made up like this:
+ *
+ * <code>Graphics(<counter>-1)</code> where counter is an integer number
+ * saying how many DebugGraphics objects have been created so far. The second
+ * number always seem to be 1 on Sun's JDK, this has to be investigated a
+ * little more.
+ *
+ * @return the prefix that should be prepended to all logging
+ * messages
+ */
+ private String prefix()
+ {
+ return "Graphics(" + counter + "-1)";
+ }
}
diff --git a/libjava/classpath/javax/swing/DefaultButtonModel.java b/libjava/classpath/javax/swing/DefaultButtonModel.java
index f7d09d5780d..7ecf3b85fc6 100644
--- a/libjava/classpath/javax/swing/DefaultButtonModel.java
+++ b/libjava/classpath/javax/swing/DefaultButtonModel.java
@@ -145,6 +145,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
*/
public DefaultButtonModel()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/DefaultCellEditor.java b/libjava/classpath/javax/swing/DefaultCellEditor.java
index 00e00864432..39e48551efb 100644
--- a/libjava/classpath/javax/swing/DefaultCellEditor.java
+++ b/libjava/classpath/javax/swing/DefaultCellEditor.java
@@ -69,7 +69,7 @@ public class DefaultCellEditor
private static final long serialVersionUID = 3564035141373880027L;
/**
- * Delegates a couple of method calls (such as {@link #isCellEditable)
+ * Delegates a couple of method calls (such as {@link #isCellEditable}
* to the component it contains and listens for events that indicate
* that editing has stopped.
*/
@@ -88,12 +88,13 @@ public class DefaultCellEditor
*/
protected EditorDelegate()
{
+ // Nothing to do here.
}
/**
* setValue
*
- * @param event TODO
+ * @param value TODO
*/
public void setValue(Object value)
{
@@ -387,7 +388,7 @@ public class DefaultCellEditor
/**
* getTableCellEditorComponent
*
- * @param tree TODO
+ * @param table TODO
* @param value TODO
* @param isSelected TODO
* @param row TODO
diff --git a/libjava/classpath/javax/swing/DefaultComboBoxModel.java b/libjava/classpath/javax/swing/DefaultComboBoxModel.java
index b48b968d697..ea261a33bbf 100644
--- a/libjava/classpath/javax/swing/DefaultComboBoxModel.java
+++ b/libjava/classpath/javax/swing/DefaultComboBoxModel.java
@@ -1,5 +1,5 @@
/* DefaultComboBoxModel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,13 +41,14 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Vector;
+import javax.swing.event.ListDataEvent;
+
/**
- * The default implementation of {@link MutableComboBoxModel}.
- * This model keeps track
- * of elements contained in the JComboBox as well as the current combo box
- * selection. Whenever selection in the JComboBox changes, the ComboBoxModel
- * will fire ListDataEvents to ComboBox's ListDataListeners.
+ * A model that stores a list of elements and a selected item (which may be
+ * <code>null</code>). Changes to the model are signalled to listeners using
+ * {@link ListDataEvent}. This model is designed for use by the
+ * {@link JComboBox} component.
*
* @author Andrew Selkirk
* @author Olga Rodimina
@@ -59,17 +60,17 @@ public class DefaultComboBoxModel extends AbstractListModel
private static final long serialVersionUID = 6698657703676921904L;
/**
- * List containing items in the combo box
+ * Storage for the elements in the model's list.
*/
private Vector list;
/**
- * Currently selected item in the combo box list
+ * The selected item (<code>null</code> indicates no selection).
*/
private Object selectedItem = null;
/**
- * Constructor DefaultComboBoxModel. Create empty JComboBox.
+ * Creates a new model, initially empty.
*/
public DefaultComboBoxModel()
{
@@ -77,64 +78,92 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Constructs new DefaultComboBoxModel object and initializes its item list
- * to values in the given array.
+ * Creates a new model and initializes its item list to the values in the
+ * given array. The selected item is set to the first item in the array, or
+ * <code>null</code> if the array length is zero.
*
- * @param items array containing items of the combo box.
+ * @param items an array containing items for the model (<code>null</code>
+ * not permitted).
+ *
+ * @throws NullPointerException if <code>items</code> is <code>null</code>.
*/
public DefaultComboBoxModel(Object[] items)
{
list = new Vector(Arrays.asList(items));
+ if (list.size() > 0)
+ selectedItem = list.get(0);
}
/**
- * Consturcts new DefaultComboBoxModel object and initializes its item list
- * to values in the given vector.
+ * Creates a new model and initializes its item list to the values in the
+ * given vector. The selected item is set to the first item in the vector,
+ * or <code>null</code> if the vector length is zero.
*
- * @param vector Vector containing items for this combo box.
+ * @param vector a vector containing items for the model (<code>null</code>
+ * not permitted).
+ *
+ * @throws NullPointerException if <code>vector</code> is <code>null</code>.
*/
public DefaultComboBoxModel(Vector vector)
{
this.list = vector;
+ if (vector.size() > 0)
+ selectedItem = vector.get(0);
}
/**
- * This method adds element to the combo box list. It fires ListDataEvent
- * indicating that component was added to the combo box to all of the
- * JComboBox's registered ListDataListeners.
+ * Adds an element to the model's item list and sends a {@link ListDataEvent}
+ * to all registered listeners. If the new element is the first item added
+ * to the list, it is set as the selected item.
*
- * @param object item to add to the combo box list
+ * @param object item to add to the model's item list.
*/
public void addElement(Object object)
{
list.add(object);
- fireIntervalAdded(this, list.size() - 1, list.size());
+ fireIntervalAdded(this, list.size() - 1, list.size() - 1);
+ if (list.size() == 1)
+ setSelectedItem(object);
}
/**
- * This method removes element at the specified index from the combo box
- * list. It fires ListDataEvent indicating that component was removed from
- * the combo box list to all of the JComboBox's registered
- * ListDataListeners.
+ * Removes the element at the specified index from the model's item list
+ * and sends a {@link ListDataEvent} to all registered listeners. If the
+ * element removed was the selected item, then the preceding element becomes
+ * the new selected item (or the next element, if there is no preceding
+ * element).
*
- * @param index index specifying location of the element to remove in the
- * combo box list.
+ * @param index the index of the item to remove.
+ *
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds.
*/
public void removeElementAt(int index)
{
+ int selected = getIndexOf(selectedItem);
list.remove(index);
+ if (selected == index) // choose a new selected item
+ {
+ if (selected > 0)
+ selectedItem = getElementAt(selected - 1);
+ else
+ selectedItem = getElementAt(selected);
+ }
fireIntervalRemoved(this, index, index);
}
/**
- * This method inserts given object to the combo box list at the specified
- * index. It fires ListDataEvent indicating that component was inserted to
- * the combo box list to all of the JComboBox's registered
- * ListDataListeners.
+ * Adds an element at the specified index in the model's item list
+ * and sends a {@link ListDataEvent} to all registered listeners.
*
* @param object element to insert
* @param index index specifing position in the list where given element
* should be inserted.
+ *
+ * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+ * bounds.
+ *
+ * @see #addElement(Object)
*/
public void insertElementAt(Object object, int index)
{
@@ -143,11 +172,13 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Removes given object from the combo box list. It fires ListDataEvent
- * indicating that component was removed from the combo box list to all of
- * the JComboBox's registered ListDataListeners.
+ * Removes an element from the model's item list and sends a
+ * {@link ListDataEvent} to all registered listeners. If the item to be
+ * removed is the current selected item, a new selected item will be set.
+ * If the element is not found in the model's item list, this method does
+ * nothing.
*
- * @param object Element that will be removed from the combo box list
+ * @param object the element to remove.
*/
public void removeElement(Object object)
{
@@ -157,21 +188,25 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Removes all the items from the JComboBox's item list. It fires
- * ListDataEvent indicating that all the elements were removed from the
- * combo box list to all of the JComboBox's registered ListDataListeners.
+ * Removes all the items from the model's item list, resets and selected item
+ * to <code>null</code>, and sends a {@link ListDataEvent} to all registered
+ * listeners.
*/
public void removeAllElements()
{
- list.clear();
- int listSize = getSize();
- fireIntervalAdded(this, 0, listSize);
+ selectedItem = null;
+ int size = getSize();
+ if (size > 0)
+ {
+ list.clear();
+ fireIntervalRemoved(this, 0, size - 1);
+ }
}
/**
- * Returns number of items in the combo box list
+ * Returns the number of items in the model's item list.
*
- * @return number of items in the combo box list
+ * @return The number of items in the model's item list.
*/
public int getSize()
{
@@ -179,32 +214,32 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Selects given object in the combo box list. This method fires
- * ListDataEvent to all registered ListDataListeners of the JComboBox. The
- * start and end index of the event is set to -1 to indicate combo box's
- * selection has changed, and not its contents.
- *
- * <p>If the given object is not contained in the combo box list then nothing
- * happens.</p>
+ * Sets the selected item for the model and sends a {@link ListDataEvent} to
+ * all registered listeners. The start and end index of the event is set to
+ * -1 to indicate the model's selection has changed, and not its contents.
*
- * @param object item to select in the JComboBox
+ * @param object the new selected item (<code>null</code> permitted).
*/
public void setSelectedItem(Object object)
{
-
- // Updates the selected item only if the given object
- // is null or in the list (this is how the JDK behaves).
- if(object == null || list.contains(object)) {
- selectedItem = object;
- fireContentsChanged(this, -1, -1);
- }
-
+ if (selectedItem == null)
+ {
+ if (object == null)
+ return;
+ }
+ else
+ {
+ if (selectedItem.equals(object))
+ return;
+ }
+ selectedItem = object;
+ fireContentsChanged(this, -1, -1);
}
/**
- * Returns currently selected item in the combo box list
+ * Returns the selected item.
*
- * @return currently selected item in the combo box list
+ * @return The selected item (possibly <code>null</code>).
*/
public Object getSelectedItem()
{
@@ -212,24 +247,27 @@ public class DefaultComboBoxModel extends AbstractListModel
}
/**
- * Returns element in the combo box list located at the given index
+ * Returns the element at the specified index in the model's item list.
*
- * @param index specifying location of the element in the list
+ * @param index the element index.
*
- * @return return element in the combo box list located at the given index
+ * @return The element at the specified index in the model's item list, or
+ * <code>null</code> if the <code>index</code> is outside the bounds
+ * of the list.
*/
public Object getElementAt(int index)
{
+ if (index < 0 || index >= list.size())
+ return null;
return list.elementAt(index);
}
/**
- * Returns index of the specified object in the combo box list.
+ * Returns the index of the specified element in the model's item list.
*
- * @param object element to look for in the combo box list .
+ * @param object the element.
*
- * @return Index specifying position of the specified element in combo box
- * list.
+ * @return The index of the specified element in the model's item list.
*/
public int getIndexOf(Object object)
{
diff --git a/libjava/classpath/javax/swing/DefaultDesktopManager.java b/libjava/classpath/javax/swing/DefaultDesktopManager.java
index 2b8977e9d6d..7f62c948625 100644
--- a/libjava/classpath/javax/swing/DefaultDesktopManager.java
+++ b/libjava/classpath/javax/swing/DefaultDesktopManager.java
@@ -91,6 +91,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
*/
public DefaultDesktopManager()
{
+ // Nothing to do here.
}
/**
@@ -223,6 +224,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
}
catch (PropertyVetoException e)
{
+ // Do nothing if attempt is vetoed.
}
}
@@ -302,6 +304,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
}
catch (PropertyVetoException e)
{
+ // Do nothing if attempt is vetoed.
}
}
@@ -329,6 +332,7 @@ public class DefaultDesktopManager implements DesktopManager, Serializable
}
catch (PropertyVetoException e)
{
+ // Do nothing if attempt is vetoed.
}
}
}
diff --git a/libjava/classpath/javax/swing/DefaultListCellRenderer.java b/libjava/classpath/javax/swing/DefaultListCellRenderer.java
index 5a34ba7aa18..9a8e07071b5 100644
--- a/libjava/classpath/javax/swing/DefaultListCellRenderer.java
+++ b/libjava/classpath/javax/swing/DefaultListCellRenderer.java
@@ -68,6 +68,7 @@ public class DefaultListCellRenderer extends JLabel
{
public UIResource()
{
+ super();
}
}
@@ -124,62 +125,75 @@ public class DefaultListCellRenderer extends JLabel
public void validate()
{
+ // Overridden to do nothing.
}
public void revalidate()
{
+ // Overridden to do nothing.
}
public void repaint(long tm, int x, int y, int w, int h)
{
+ // Overridden to do nothing.
}
public void repaint(Rectangle rect)
{
+ // Overridden to do nothing.
}
protected void firePropertyChange(String propertyName, Object oldValue,
Object newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, byte oldValue,
byte newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, char oldValue,
char newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, short oldValue,
short newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, int oldValue,
int newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, long oldValue,
long newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, float oldValue,
float newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, double oldValue,
double newValue)
{
+ // Overridden to do nothing.
}
public void firePropertyChange(String propertyName, boolean oldValue,
boolean newValue)
{
+ // Overridden to do nothing.
}
}
diff --git a/libjava/classpath/javax/swing/DefaultListSelectionModel.java b/libjava/classpath/javax/swing/DefaultListSelectionModel.java
index f8d544d9b20..ce1dfdd79c5 100644
--- a/libjava/classpath/javax/swing/DefaultListSelectionModel.java
+++ b/libjava/classpath/javax/swing/DefaultListSelectionModel.java
@@ -238,14 +238,32 @@ public class DefaultListSelectionModel implements Cloneable,
*/
public void setLeadSelectionIndex(int leadIndex)
{
+ // Only set the lead selection index to < 0 if anchorSelectionIndex < 0.
+ if (leadIndex < 0)
+ {
+ if (anchorSelectionIndex < 0)
+ leadSelectionIndex = -1;
+ else
+ return;
+ }
+
+ // Only touch the lead selection index if the anchor is >= 0.
+ if (anchorSelectionIndex < 0)
+ return;
+
+ if (selectionMode == SINGLE_SELECTION)
+ setSelectionInterval (leadIndex, leadIndex);
+
int oldLeadIndex = leadSelectionIndex;
+ if (oldLeadIndex == -1)
+ oldLeadIndex = leadIndex;
if (setLeadCalledFromAdd == false)
oldSel = sel.clone();
leadSelectionIndex = leadIndex;
if (anchorSelectionIndex == -1)
- return;
-
+ return;
+
int R1 = Math.min(anchorSelectionIndex, oldLeadIndex);
int R2 = Math.max(anchorSelectionIndex, oldLeadIndex);
int S1 = Math.min(anchorSelectionIndex, leadIndex);
@@ -254,8 +272,6 @@ public class DefaultListSelectionModel implements Cloneable,
int lo = Math.min(R1, S1);
int hi = Math.max(R2, S2);
- BitSet oldRange = sel.get(lo, hi+1);
-
if (isSelectedIndex(anchorSelectionIndex))
{
sel.clear(R1, R2+1);
@@ -265,10 +281,7 @@ public class DefaultListSelectionModel implements Cloneable,
{
sel.set(R1, R2+1);
sel.clear(S1, S2+1);
- }
-
- BitSet newRange = sel.get(lo, hi+1);
- newRange.xor(oldRange);
+ }
int beg = sel.nextSetBit(0), end = -1;
for(int i=beg; i >= 0; i=sel.nextSetBit(i+1))
@@ -278,6 +291,27 @@ public class DefaultListSelectionModel implements Cloneable,
}
/**
+ * Moves the lead selection index to <code>leadIndex</code> without
+ * changing the selection values.
+ *
+ * If leadAnchorNotificationEnabled is true, send a notification covering the
+ * old and new lead cells.
+ *
+ * @param leadIndex the new lead selection index
+ * @since 1.5
+ */
+ public void moveLeadSelectionIndex (int leadIndex)
+ {
+ if (leadSelectionIndex == leadIndex)
+ return;
+
+ leadSelectionIndex = leadIndex;
+ if (isLeadAnchorNotificationEnabled())
+ fireValueChanged(Math.min(leadSelectionIndex, leadIndex),
+ Math.max(leadSelectionIndex, leadIndex));
+ }
+
+ /**
* Gets the value of the {@link #leadAnchorNotificationEnabled} property.
*
* @return The current property value
@@ -388,6 +422,9 @@ public class DefaultListSelectionModel implements Cloneable,
*/
public boolean isSelectedIndex(int a)
{
+ // TODO: Probably throw an exception here?
+ if (a >= sel.length() || a < 0)
+ return false;
return sel.get(a);
}
@@ -415,7 +452,7 @@ public class DefaultListSelectionModel implements Cloneable,
oldSel = sel.clone();
if (selectionMode == SINGLE_SELECTION)
- sel.clear();
+ setSelectionInterval(index0, index1);
// COMPAT: Like Sun (but not like IBM), we allow calls to
// addSelectionInterval when selectionMode is
@@ -426,10 +463,7 @@ public class DefaultListSelectionModel implements Cloneable,
isSelectedIndex(index1) ||
isSelectedIndex(Math.max(lo-1,0)) ||
isSelectedIndex(Math.min(hi+1,sel.size()))))
- sel.clear();
-
- if (selectionMode == SINGLE_SELECTION)
- index0 = index1;
+ sel.clear();
// We have to update the anchorSelectionIndex and leadSelectionIndex
// variables
diff --git a/libjava/classpath/javax/swing/DesktopManager.java b/libjava/classpath/javax/swing/DesktopManager.java
index 300d66517ba..620c7ffb857 100644
--- a/libjava/classpath/javax/swing/DesktopManager.java
+++ b/libjava/classpath/javax/swing/DesktopManager.java
@@ -95,7 +95,7 @@ public interface DesktopManager
* This method should give focus to the JInternalFrame and its default focus
* owner.
*
- * @param frame The JInternalFrame to activate.
+ * @param vframe The JInternalFrame to activate.
*/
void activateFrame(JInternalFrame vframe);
diff --git a/libjava/classpath/javax/swing/FocusManager.java b/libjava/classpath/javax/swing/FocusManager.java
index 179fa6f82d2..a2109ee06c6 100644
--- a/libjava/classpath/javax/swing/FocusManager.java
+++ b/libjava/classpath/javax/swing/FocusManager.java
@@ -38,10 +38,19 @@ exception statement from your version. */
package javax.swing;
+import java.awt.AWTEvent;
import java.awt.Component;
+import java.awt.Container;
import java.awt.DefaultKeyboardFocusManager;
+import java.awt.FocusTraversalPolicy;
+import java.awt.KeyEventDispatcher;
+import java.awt.KeyEventPostProcessor;
import java.awt.KeyboardFocusManager;
+import java.awt.Window;
import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.VetoableChangeListener;
+import java.util.Set;
/**
* This class has been obsoleted by the new
@@ -54,46 +63,409 @@ public abstract class FocusManager
extends DefaultKeyboardFocusManager
{
/**
- * DisabledFocusManager
+ * A FocusManager that wraps an AWT KeyboardFocusManager and forwards all
+ * method calls to it. This is used for compatibility with the new focus
+ * system.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
*/
- static class DisabledFocusManager
+ private static class WrappingFocusManager
extends FocusManager
{
+ /**
+ * The wrapped KeyboardFocusManager.
+ */
+ private KeyboardFocusManager wrapped;
+
+ /**
+ * Creates a new instance of WrappedFocusManager.
+ *
+ * @param fm the focus manager to wrap
+ */
+ WrappingFocusManager(KeyboardFocusManager fm)
+ {
+ wrapped = fm;
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#dispatchEvent(AWTEvent)}.
+ *
+ * @param ev the event to dispatch
+ *
+ * @return <code>true</code> if the event has been dispatched,
+ * <code>false</code> otherwise
+ */
+ public boolean dispatchEvent(AWTEvent ev)
+ {
+ return wrapped.dispatchEvent(ev);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#dispatchKeyEvent(KeyEvent)}.
+ *
+ * @param ev the event to dispatch
+ *
+ * @return <code>true</code> if the event has been dispatched,
+ * <code>false</code> otherwise
+ */
+ public boolean dispatchKeyEvent(KeyEvent ev)
+ {
+ return wrapped.dispatchKeyEvent(ev);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#downFocusCycle(Container)}.
+ *
+ * @param c the container
+ */
+ public void downFocusCycle(Container c)
+ {
+ wrapped.downFocusCycle(c);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#upFocusCycle(Container)}.
+ *
+ * @param c the container
+ */
+ public void upFocusCycle(Container c)
+ {
+ wrapped.upFocusCycle(c);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#focusNextComponent(Component)}.
+ *
+ * @param c the component
+ */
+ public void focusNextComponent(Component c)
+ {
+ wrapped.focusNextComponent(c);
+ }
+
+ /**
+ * Wraps
+ * {@link DefaultKeyboardFocusManager#focusPreviousComponent(Component)}.
+ *
+ * @param c the component
+ */
+ public void focusPreviousComponent(Component c)
+ {
+ wrapped.focusPreviousComponent(c);
+ }
+
+ /**
+ * Wraps {@link DefaultKeyboardFocusManager#postProcessKeyEvent(KeyEvent)}.
+ *
+ * @param e the key event
+ *
+ * @return a boolead
+ */
+ public boolean postProcessKeyEvent(KeyEvent e)
+ {
+ return wrapped.postProcessKeyEvent(e);
+ }
+
+ /**
+ * Wraps
+ * {@link DefaultKeyboardFocusManager#processKeyEvent(Component, KeyEvent)}.
+ *
+ * @param c the component
+ * @param e the key event
+ */
+ public void processKeyEvent(Component c, KeyEvent e)
+ {
+ wrapped.processKeyEvent(c, e);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#addKeyEventDispatcher(KeyEventDispatcher)}.
+ *
+ * @param d the dispatcher
+ */
+ public void addKeyEventDispatcher(KeyEventDispatcher d)
+ {
+ wrapped.addKeyEventDispatcher(d);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)}.
+ *
+ * @param p the post processor
+ */
+ public void addKeyEventPostProcessor(KeyEventPostProcessor p)
+ {
+ wrapped.addKeyEventPostProcessor(p);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#addPropertyChangeListener(PropertyChangeListener)}.
+ *
+ * @param l the property change listener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener l)
+ {
+ wrapped.addPropertyChangeListener(l);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#addPropertyChangeListener(String, PropertyChangeListener)}.
+ *
+ * @param p the property name
+ * @param l the property change listener
+ */
+ public void addPropertyChangeListener(String p, PropertyChangeListener l)
+ {
+ wrapped.addPropertyChangeListener(p, l);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#addVetoableChangeListener(String, VetoableChangeListener)}.
+ *
+ * @param p the property name
+ * @param l the vetoable change listener
+ */
+ public void addVetoableChangeListener(String p, VetoableChangeListener l)
+ {
+ wrapped.addVetoableChangeListener(p, l);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#addVetoableChangeListener(VetoableChangeListener)}.
+ *
+ * @param l the vetoable change listener
+ */
+ public void addVetoableChangeListener(VetoableChangeListener l)
+ {
+ wrapped.addVetoableChangeListener(l);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#clearGlobalFocusOwner()}.
+ */
+ public void clearGlobalFocusOwner()
+ {
+ wrapped.clearGlobalFocusOwner();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getActiveWindow()}.
+ *
+ * @return the active window
+ */
+ public Window getActiveWindow()
+ {
+ return wrapped.getActiveWindow();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getCurrentFocusCycleRoot()}.
+ *
+ * @return the focus cycle root
+ */
+ public Container getCurrentFocusCycleRoot()
+ {
+ return wrapped.getCurrentFocusCycleRoot();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getDefaultFocusTraversalKeys(int)}.
+ *
+ * @param i the ID
+ *
+ * @return the focus traversal keys
+ */
+ public Set getDefaultFocusTraversalKeys(int i)
+ {
+ return wrapped.getDefaultFocusTraversalKeys(i);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getDefaultFocusTraversalPolicy()}.
+ *
+ * @return the focus traversal policy
+ */
+ public FocusTraversalPolicy getDefaultFocusTraversalPolicy()
+ {
+ return wrapped.getDefaultFocusTraversalPolicy();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getFocusedWindow()}.
+ *
+ * @return the focused window
+ */
+ public Window getFocusedWindow()
+ {
+ return wrapped.getFocusedWindow();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getFocusOwner()}.
+ *
+ * @return the focus owner
+ */
+ public Component getFocusOwner()
+ {
+ return wrapped.getFocusOwner();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getPermanentFocusOwner()}.
+ *
+ * @return the focus owner
+ */
+ public Component getPermanentFocusOwner()
+ {
+ return wrapped.getPermanentFocusOwner();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getPropertyChangeListeners()}.
+ *
+ * @return the property change listeners
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners()
+ {
+ return wrapped.getPropertyChangeListeners();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getPropertyChangeListeners(String)}.
+ *
+ * @param n the property name
+ *
+ * @return the property change listeners
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners(String n)
+ {
+ return wrapped.getPropertyChangeListeners(n);
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getVetoableChangeListeners()}.
+ *
+ * @return the vetoable change listeners
+ */
+ public VetoableChangeListener[] getVetoableChangeListeners()
+ {
+ return wrapped.getVetoableChangeListeners();
+ }
+
+ /**
+ * Wraps {@link KeyboardFocusManager#getVetoableChangeListeners(String)}.
+ *
+ * @param n the property name
+ *
+ * @return the vetoable change listeners
+ */
+ public VetoableChangeListener[] getVetoableChangeListeners(String n)
+ {
+ return wrapped.getVetoableChangeListeners(n);
+ }
+
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removeKeyEventDispatcher(KeyEventDispatcher)}.
+ *
+ * @param d the key event dispatcher to remove
+ */
+ public void removeKeyEventDispatcher(KeyEventDispatcher d)
+ {
+ wrapped.removeKeyEventDispatcher(d);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)}.
+ *
+ * @param p the post processor
+ */
+ public void removeKeyEventPostProcessor(KeyEventPostProcessor p)
+ {
+ wrapped.removeKeyEventPostProcessor(p);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removePropertyChangeListener(PropertyChangeListener)}.
+ *
+ * @param l the listener
+ */
+ public void removePropertyChangeListener(PropertyChangeListener l)
+ {
+ wrapped.removePropertyChangeListener(l);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removePropertyChangeListener(String, PropertyChangeListener)}.
+ *
+ * @param n the property name
+ * @param l the listener
+ */
+ public void removePropertyChangeListener(String n, PropertyChangeListener l)
+ {
+ wrapped.removePropertyChangeListener(n, l);
+ }
+
+ /**
+ * Wraps
+ * {@link KeyboardFocusManager#removeVetoableChangeListener(VetoableChangeListener)}.
+ *
+ * @param l the listener
+ */
+ public void removeVetoableChangeListener(VetoableChangeListener l)
+ {
+ wrapped.removeVetoableChangeListener(l);
+ }
/**
- * Constructor DisabledFocusManager
+ * Wraps
+ * {@link KeyboardFocusManager#removeVetoableChangeListener(String, VetoableChangeListener)}.
+ *
+ * @param n the property name
+ * @param l the listener
*/
- DisabledFocusManager()
+ public void removeVetoableChangeListener(String n, VetoableChangeListener l)
{
- // TODO
+ wrapped.removeVetoableChangeListener(n, l);
}
/**
- * processKeyEvent
- * @param component TODO
- * @param event TODO
+ * Wraps
+ * {@link KeyboardFocusManager#setDefaultFocusTraversalKeys(int, Set)}.
+ *
+ * @param id the ID
+ * @param k the keystrokes
*/
- public void processKeyEvent(Component component, KeyEvent event)
+ public void setDefaultFocusTraversalKeys(int id, Set k)
{
- // TODO
+ wrapped.setDefaultFocusTraversalKeys(id, k);
}
/**
- * focusNextComponent
- * @param component TODO
+ * Wraps {@link KeyboardFocusManager#setDefaultFocusTraversalPolicy(FocusTraversalPolicy)}.
+ *
+ * @param p the focus traversal policy
*/
- public void focusNextComponent(Component component)
+ public void setDefaultFocusTraversalPolicy(FocusTraversalPolicy p)
{
- // TODO
+ wrapped.setDefaultFocusTraversalPolicy(p);
}
/**
- * focusPreviousComponent
- * @param value0 TODO
+ * Wraps
+ * {@link KeyboardFocusManager#setGlobalCurrentFocusCycleRoot(Container)}.
+ *
+ * @param r the focus cycle root
*/
- public void focusPreviousComponent(Component value0)
+ public void setGlobalCurrentFocusCycleRoot(Container r)
{
- // TODO
+ wrapped.setGlobalCurrentFocusCycleRoot(r);
}
}
@@ -117,20 +489,9 @@ public abstract class FocusManager
*/
public static FocusManager getCurrentManager()
{
- KeyboardFocusManager fm =
- KeyboardFocusManager.getCurrentKeyboardFocusManager();
- if (fm instanceof FocusManager)
- return (FocusManager) fm;
- else
- {
- System.err.println("The Swing FocusManager API has been obsoleted by");
- System.err.println("the new KeyboardFocusManager system.");
- System.err.println("You should either not use the Swing FocusManager");
- System.err.println("API or set the system property");
- System.err.println
- ("gnu.java.awt.FocusManager=javax.swing.FocusManager");
- }
- return null;
+ KeyboardFocusManager m =
+ KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ return new WrappingFocusManager(m);
}
/**
diff --git a/libjava/classpath/javax/swing/ImageIcon.java b/libjava/classpath/javax/swing/ImageIcon.java
index b650cd81f23..b6ed949d8dc 100644
--- a/libjava/classpath/javax/swing/ImageIcon.java
+++ b/libjava/classpath/javax/swing/ImageIcon.java
@@ -73,6 +73,7 @@ public class ImageIcon
*/
protected AccessibleImageIcon()
{
+ // Nothing to do here.
}
/**
@@ -204,7 +205,10 @@ public class ImageIcon
private static final long serialVersionUID = 532615968316031794L;
/** A dummy Component that is used in the MediaTracker. */
- protected static Component component = new Component(){};
+ protected static Component component = new Component()
+ {
+ // No need to implement this.
+ };
/** The MediaTracker used to monitor the loading of images. */
protected static MediaTracker tracker = new MediaTracker(component);
@@ -227,6 +231,7 @@ public class ImageIcon
*/
public ImageIcon()
{
+ // Nothing to do here.
}
/**
@@ -417,7 +422,7 @@ public class ImageIcon
}
catch (InterruptedException ex)
{
- ; // ignore this for now
+ // Ignore this for now.
}
finally
{
diff --git a/libjava/classpath/javax/swing/InputMap.java b/libjava/classpath/javax/swing/InputMap.java
index a7ec38c4117..cc65dfeed3e 100644
--- a/libjava/classpath/javax/swing/InputMap.java
+++ b/libjava/classpath/javax/swing/InputMap.java
@@ -171,8 +171,12 @@ public class InputMap
*/
public KeyStroke[] keys()
{
- KeyStroke[] array = new KeyStroke[size()];
- return (KeyStroke[]) inputMap.keySet().toArray(array);
+ if (size() != 0)
+ {
+ KeyStroke[] array = new KeyStroke[size()];
+ return (KeyStroke[]) inputMap.keySet().toArray(array);
+ }
+ return null;
}
/**
@@ -189,7 +193,9 @@ public class InputMap
set.addAll(Arrays.asList(parent.allKeys()));
set.addAll(inputMap.keySet());
- KeyStroke[] array = new KeyStroke[size()];
+ if (set.size() == 0)
+ return null;
+ KeyStroke[] array = new KeyStroke[set.size()];
return (KeyStroke[]) set.toArray(array);
}
diff --git a/libjava/classpath/javax/swing/InputVerifier.java b/libjava/classpath/javax/swing/InputVerifier.java
index 8e02ab813a3..eeb81b5d503 100644
--- a/libjava/classpath/javax/swing/InputVerifier.java
+++ b/libjava/classpath/javax/swing/InputVerifier.java
@@ -53,6 +53,7 @@ public abstract class InputVerifier
*/
public InputVerifier()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/JApplet.java b/libjava/classpath/javax/swing/JApplet.java
index cafb2dabbb8..e90c451891e 100644
--- a/libjava/classpath/javax/swing/JApplet.java
+++ b/libjava/classpath/javax/swing/JApplet.java
@@ -47,6 +47,7 @@ import java.awt.Graphics;
import java.awt.LayoutManager;
import java.awt.event.KeyEvent;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
/**
@@ -55,8 +56,28 @@ import javax.accessibility.AccessibleContext;
* @author original author unknown
*/
public class JApplet extends Applet
- implements RootPaneContainer
+ implements RootPaneContainer, Accessible
{
+ /**
+ * Provides accessibility support for <code>JApplet</code>.
+ */
+ protected class AccessibleJApplet extends Applet.AccessibleApplet
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJApplet</code>.
+ */
+ public AccessibleJApplet()
+ {
+ super();
+ // Nothing to do here.
+ }
+ }
+
+ /**
+ * The accessible context for this <code>JApplet</code>.
+ */
+ protected AccessibleContext accessibleContext;
+
private static final long serialVersionUID = 7269359214497372587L;
protected JRootPane rootPane;
@@ -64,20 +85,13 @@ public class JApplet extends Applet
/**
* @specnote rootPaneCheckingEnabled is false to comply with J2SE 5.0
*/
- protected boolean rootPaneCheckingEnabled=false;
-
- /**
- * Tells us if we're in the initialization stage.
- * If so, adds go to top-level Container, otherwise they go
- * to the content pane for this container
- */
- private boolean initStageDone = false;
+ protected boolean rootPaneCheckingEnabled = false;
public JApplet()
{
super.setLayout(new BorderLayout(1, 1));
getRootPane(); // Will do set/create.
- initStageDone = true; // Init stage is now over.
+ setRootPaneCheckingEnabled(true); // Init stage is now over.
}
public Dimension getPreferredSize()
@@ -89,13 +103,8 @@ public class JApplet extends Applet
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set layout. Use getContentPane().setLayout()"
- + "instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -155,20 +164,17 @@ public class JApplet extends Applet
{
// If we're adding in the initialization stage use super.add.
// Otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp, constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp, constraints, index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Do not use add() on JApplet directly. Use "
- + "getContentPane().add() instead");
- getContentPane().add(comp, constraints, index);
- }
+ super.addImpl(comp, constraints, index);
}
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJApplet();
+ return accessibleContext;
}
public JMenuBar getJMenuBar()
@@ -183,7 +189,7 @@ public class JApplet extends Applet
protected String paramString()
{
- return "JFrame";
+ return super.paramString();
}
protected void processKeyEvent(KeyEvent e)
diff --git a/libjava/classpath/javax/swing/JButton.java b/libjava/classpath/javax/swing/JButton.java
index 5653fbf42f1..ff0ecfccfd4 100644
--- a/libjava/classpath/javax/swing/JButton.java
+++ b/libjava/classpath/javax/swing/JButton.java
@@ -75,9 +75,6 @@ public class JButton extends AbstractButton
boolean def;
boolean is_def;
- /** The AccessibleContext for this JButton. */
- AccessibleJButton accessibleContext;
-
public JButton()
{
this(null, null);
@@ -166,6 +163,10 @@ public class JButton extends AbstractButton
*/
public void removeNotify()
{
+ JRootPane root = SwingUtilities.getRootPane(this);
+ if (root != null && root.getDefaultButton() == this)
+ root.setDefaultButton(null);
+ super.removeNotify();
}
public void setDefaultCapable(boolean defaultCapable)
diff --git a/libjava/classpath/javax/swing/JCheckBox.java b/libjava/classpath/javax/swing/JCheckBox.java
index a743308dcca..74fda8f6dbe 100644
--- a/libjava/classpath/javax/swing/JCheckBox.java
+++ b/libjava/classpath/javax/swing/JCheckBox.java
@@ -38,7 +38,9 @@ exception statement from your version. */
package javax.swing;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
/**
* A small box that displays a check or not, depending on it's
@@ -54,8 +56,32 @@ import javax.accessibility.AccessibleContext;
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class JCheckBox extends JToggleButton
+public class JCheckBox extends JToggleButton implements Accessible
{
+
+ /**
+ * Provides accessibility support for <code>JCheckBox</code>.
+ */
+ protected class AccessibleJCheckBox extends AccessibleJToggleButton
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJCheckBox</code>.
+ */
+ public AccessibleJCheckBox()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the accessble role of <code>JCheckBox</code>,
+ * {@link AccessibleRole#CHECK_BOX}.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.CHECK_BOX;
+ }
+ }
+
private static final long serialVersionUID = -5246739313864538930L;
public static final String BORDER_PAINTED_FLAT_CHANGED_PROPERTY =
@@ -71,61 +97,47 @@ public class JCheckBox extends JToggleButton
public JCheckBox()
{
- super();
- init();
+ this(null, null, false);
}
public JCheckBox(Action action)
{
super(action);
- init();
}
public JCheckBox(Icon icon)
{
- super(icon);
- init();
+ this(null, icon, false);
}
public JCheckBox(Icon icon, boolean selected)
{
- super(icon, selected);
- init();
+ this(null, icon, selected);
}
public JCheckBox(String text)
{
- super(text);
- init();
+ this(text, null, false);
}
public JCheckBox(String text, boolean selected)
{
- super(text, selected);
- init();
+ this(text, null, selected);
}
public JCheckBox(String text, Icon icon)
{
- super(text, icon);
- init();
+ this(text, icon, false);
}
public JCheckBox(String text, Icon icon, boolean selected)
{
super(text, icon, selected);
- init();
+ setHorizontalAlignment(LEADING);
+ setBorderPainted(false);
}
/**
- * Gets the AccessibleContext associated with this JCheckBox.
- */
- public AccessibleContext getAccessibleContext()
- {
- return null;
- }
-
- /**
* Returns a string that specifies the name of the Look and Feel class
* that renders this component.
*/
@@ -149,4 +161,16 @@ public class JCheckBox extends JToggleButton
firePropertyChange("borderPaintedFlat", borderPaintedFlat, newValue);
borderPaintedFlat = newValue;
}
+
+ /**
+ * Returns the accessible context for this <code>JCheckBox</code>.
+ *
+ * @return the accessible context for this <code>JCheckBox</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJCheckBox();
+ return accessibleContext;
+ }
}
diff --git a/libjava/classpath/javax/swing/JCheckBoxMenuItem.java b/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
index f9dd56500fe..815244259be 100644
--- a/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
+++ b/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
@@ -38,9 +38,6 @@ exception statement from your version. */
package javax.swing;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -48,8 +45,9 @@ import javax.accessibility.AccessibleRole;
/**
* A menu item that displays a checkbox. Its behaviour is very similar
* to {@link JCheckBox}. Just like the <code>JCheckBox</code>, user can check
- * and uncheck this menu item by clicking on it. Also {@link #setSelected()}
- * and {@link #setState()} can be use used for the same purpose.
+ * and uncheck this menu item by clicking on it. Also
+ * {@link AbstractButton#setSelected} and {@link #setState} can be use used
+ * for the same purpose.
* <code>JCheckBoxMenuItem</code> uses
* <code>ToggleButtonModel</code> to keep track of its selection.
*
@@ -152,10 +150,6 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
this.setVisible(true);
}
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* This method returns a name to identify which look and feel class will be
* the UI delegate for the menuItem.
@@ -248,6 +242,7 @@ public class JCheckBoxMenuItem extends JMenuItem implements SwingConstants,
*/
protected AccessibleJCheckBoxMenuItem()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
diff --git a/libjava/classpath/javax/swing/JColorChooser.java b/libjava/classpath/javax/swing/JColorChooser.java
index 4016b82f3fd..a9650ffb7e0 100644
--- a/libjava/classpath/javax/swing/JColorChooser.java
+++ b/libjava/classpath/javax/swing/JColorChooser.java
@@ -87,6 +87,7 @@ public class JColorChooser extends JComponent implements Accessible
*/
protected AccessibleJColorChooser()
{
+ // Nothing to do here.
}
/**
@@ -247,6 +248,7 @@ public class JColorChooser extends JComponent implements Accessible
}
catch (InterruptedException e)
{
+ // TODO: Should this be handled?
}
}
diff --git a/libjava/classpath/javax/swing/JComboBox.java b/libjava/classpath/javax/swing/JComboBox.java
index 47d18323a25..cd30840a6aa 100644
--- a/libjava/classpath/javax/swing/JComboBox.java
+++ b/libjava/classpath/javax/swing/JComboBox.java
@@ -46,8 +46,6 @@ import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
import java.util.Vector;
import javax.accessibility.Accessible;
@@ -58,6 +56,7 @@ import javax.accessibility.AccessibleSelection;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.PopupMenuListener;
+import javax.swing.event.PopupMenuEvent;
import javax.swing.plaf.ComboBoxUI;
/**
@@ -212,10 +211,6 @@ public class JComboBox extends JComponent implements ItemSelectable,
this(new DefaultComboBoxModel());
}
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* This method returns true JComboBox is editable and false otherwise
*
@@ -310,7 +305,8 @@ public class JComboBox extends JComponent implements ItemSelectable,
// Stores old data model for event notification.
ComboBoxModel oldDataModel = dataModel;
dataModel = newDataModel;
-
+ selectedItemReminder = newDataModel.getSelectedItem();
+
// Notifies the listeners of the model change.
firePropertyChange("model", oldDataModel, dataModel);
}
@@ -551,14 +547,37 @@ public class JComboBox extends JComponent implements ItemSelectable,
return -1;
}
+ /**
+ * Returns an object that is used as the display value when calculating the
+ * preferred size for the combo box. This value is, of course, never
+ * displayed anywhere.
+ *
+ * @return The prototype display value (possibly <code>null</code>).
+ *
+ * @since 1.4
+ * @see #setPrototypeDisplayValue(Object)
+ */
public Object getPrototypeDisplayValue()
{
return prototypeDisplayValue;
}
- public void setPrototypeDisplayValue(Object newPrototypeDisplayValue)
+ /**
+ * Sets the object that is assumed to be the displayed item when calculating
+ * the preferred size for the combo box. A {@link PropertyChangeEvent} (with
+ * the name <code>prototypeDisplayValue</code>) is sent to all registered
+ * listeners.
+ *
+ * @param value the new value (<code>null</code> permitted).
+ *
+ * @since 1.4
+ * @see #getPrototypeDisplayValue()
+ */
+ public void setPrototypeDisplayValue(Object value)
{
- prototypeDisplayValue = newPrototypeDisplayValue;
+ Object oldValue = prototypeDisplayValue;
+ prototypeDisplayValue = value;
+ firePropertyChange("prototypeDisplayValue", oldValue, value);
}
/**
@@ -820,6 +839,47 @@ public class JComboBox extends JComponent implements ItemSelectable,
}
/**
+ * Fires a popupMenuCanceled() event to all <code>PopupMenuListeners</code>.
+ *
+ * Note: This method is intended for use by plaf classes only.
+ */
+ public void firePopupMenuCanceled()
+ {
+ PopupMenuListener[] listeners = getPopupMenuListeners();
+ PopupMenuEvent e = new PopupMenuEvent(this);
+ for(int i = 0; i < listeners.length; i++)
+ listeners[i].popupMenuCanceled(e);
+ }
+
+ /**
+ * Fires a popupMenuWillBecomeInvisible() event to all
+ * <code>PopupMenuListeners</code>.
+ *
+ * Note: This method is intended for use by plaf classes only.
+ */
+ public void firePopupMenuWillBecomeInvisible()
+ {
+ PopupMenuListener[] listeners = getPopupMenuListeners();
+ PopupMenuEvent e = new PopupMenuEvent(this);
+ for(int i = 0; i < listeners.length; i++)
+ listeners[i].popupMenuWillBecomeInvisible(e);
+ }
+
+ /**
+ * Fires a popupMenuWillBecomeVisible() event to all
+ * <code>PopupMenuListeners</code>.
+ *
+ * Note: This method is intended for use by plaf classes only.
+ */
+ public void firePopupMenuWillBecomeVisible()
+ {
+ PopupMenuListener[] listeners = getPopupMenuListeners();
+ PopupMenuEvent e = new PopupMenuEvent(this);
+ for(int i = 0; i < listeners.length; i++)
+ listeners[i].popupMenuWillBecomeVisible(e);
+ }
+
+ /**
* This method is invoked whenever selected item changes in the combo box's
* data model. It fires ItemEvent and ActionEvent to all registered
* ComboBox's ItemListeners and ActionListeners respectively, indicating
@@ -836,8 +896,9 @@ public class JComboBox extends JComponent implements ItemSelectable,
// Fire ItemEvent to indicate that new item is selected
Object newSelection = getSelectedItem();
- fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
- newSelection, ItemEvent.SELECTED));
+ if (newSelection != null)
+ fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+ newSelection, ItemEvent.SELECTED));
// Fire Action Event to JComboBox's registered listeners
fireActionEvent();
@@ -961,19 +1022,19 @@ public class JComboBox extends JComponent implements ItemSelectable,
*/
public void processKeyEvent(KeyEvent e)
{
- }
-
- /**
- * This method always returns false to indicate that JComboBox itself is
- * not focus traversable.
- *
- * @return false to indicate that JComboBox itself is not focus traversable.
- *
- * @deprecated
- */
- public boolean isFocusTraversable()
- {
- return false;
+ if (e.getKeyCode() == KeyEvent.VK_TAB)
+ setPopupVisible(false);
+ else if (keySelectionManager != null)
+ {
+ int i = keySelectionManager.selectionForKey(e.getKeyChar(),
+ getModel());
+ if (i >= 0)
+ setSelectedIndex(i);
+ else
+ super.processKeyEvent(e);
+ }
+ else
+ super.processKeyEvent(e);
}
/**
@@ -983,6 +1044,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
*/
public void setKeySelectionManager(KeySelectionManager aManager)
{
+ keySelectionManager = aManager;
}
/**
@@ -1147,6 +1209,7 @@ public class JComboBox extends JComponent implements ItemSelectable,
protected AccessibleJComboBox()
{
+ // Nothing to do here.
}
public int getAccessibleChildrenCount()
@@ -1206,18 +1269,22 @@ public class JComboBox extends JComponent implements ItemSelectable,
public void addAccessibleSelection(int value0)
{
+ // TODO: Implement this properly.
}
public void removeAccessibleSelection(int value0)
{
+ // TODO: Implement this properly.
}
public void clearAccessibleSelection()
{
+ // TODO: Implement this properly.
}
public void selectAllAccessibleSelection()
{
+ // TODO: Implement this properly.
}
}
}
diff --git a/libjava/classpath/javax/swing/JComponent.java b/libjava/classpath/javax/swing/JComponent.java
index dc7689b0930..deb08c5db59 100644
--- a/libjava/classpath/javax/swing/JComponent.java
+++ b/libjava/classpath/javax/swing/JComponent.java
@@ -44,6 +44,7 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.FocusTraversalPolicy;
import java.awt.Font;
@@ -53,6 +54,7 @@ import java.awt.Image;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.Shape;
import java.awt.Window;
import java.awt.dnd.DropTarget;
import java.awt.event.ActionEvent;
@@ -64,7 +66,6 @@ import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
-import java.awt.image.ImageObserver;
import java.awt.peer.LightweightPeer;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -83,6 +84,8 @@ import javax.accessibility.AccessibleKeyBinding;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleStateSet;
import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.TitledBorder;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.event.EventListenerList;
@@ -121,9 +124,18 @@ public abstract class JComponent extends Container implements Serializable
protected class AccessibleFocusHandler
implements FocusListener
{
- protected AccessibleFocusHandler(){}
- public void focusGained(FocusEvent event){}
- public void focusLost(FocusEvent valevent){}
+ protected AccessibleFocusHandler()
+ {
+ // TODO: Implement this properly.
+ }
+ public void focusGained(FocusEvent event)
+ {
+ // TODO: Implement this properly.
+ }
+ public void focusLost(FocusEvent valevent)
+ {
+ // TODO: Implement this properly.
+ }
}
/**
@@ -132,9 +144,18 @@ public abstract class JComponent extends Container implements Serializable
protected class AccessibleContainerHandler
implements ContainerListener
{
- protected AccessibleContainerHandler() {}
- public void componentAdded(ContainerEvent event) {}
- public void componentRemoved(ContainerEvent valevent) {}
+ protected AccessibleContainerHandler()
+ {
+ // TODO: Implement this properly.
+ }
+ public void componentAdded(ContainerEvent event)
+ {
+ // TODO: Implement this properly.
+ }
+ public void componentRemoved(ContainerEvent valevent)
+ {
+ // TODO: Implement this properly.
+ }
}
private static final long serialVersionUID = -7047089700479897799L;
@@ -142,39 +163,217 @@ public abstract class JComponent extends Container implements Serializable
protected ContainerListener accessibleContainerHandler;
protected FocusListener accessibleFocusHandler;
- protected AccessibleJComponent() {}
- public void addPropertyChangeListener(PropertyChangeListener listener) {}
- public void removePropertyChangeListener(PropertyChangeListener listener) {}
- public int getAccessibleChildrenCount() { return 0; }
- public Accessible getAccessibleChild(int value0) { return null; }
- public AccessibleStateSet getAccessibleStateSet() { return null; }
- public String getAccessibleName() { return null; }
- public String getAccessibleDescription() { return null; }
- public AccessibleRole getAccessibleRole() { return null; }
- protected String getBorderTitle(Border value0) { return null; }
- public String getToolTipText() { return null; }
- public String getTitledBorderText() { return null; }
- public AccessibleKeyBinding getAccessibleKeyBinding() { return null; }
+ /**
+ * Manages the property change listeners;
+ */
+ private SwingPropertyChangeSupport changeSupport;
+
+ protected AccessibleJComponent()
+ {
+ changeSupport = new SwingPropertyChangeSupport(this);
+ }
+
+ /**
+ * Adds a property change listener to the list of registered listeners.
+ *
+ * @param listener the listener to add
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Removes a propery change listener from the list of registered listeners.
+ *
+ * @param listener the listener to remove
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Returns the number of accessible children of this object.
+ *
+ * @return the number of accessible children of this object
+ */
+ public int getAccessibleChildrenCount()
+ {
+ int count = 0;
+ Component[] children = getComponents();
+ for (int i = 0; i < children.length; ++i)
+ {
+ if (children[i] instanceof Accessible)
+ count++;
+ }
+ return count;
+ }
+
+ /**
+ * Returns the accessible child component at index <code>i</code>.
+ *
+ * @param i the index of the accessible child to return
+ *
+ * @return the accessible child component at index <code>i</code>
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ int index = 0;
+ Component[] children = getComponents();
+ Accessible found = null;
+ for (int j = 0; index != i; j++)
+ {
+ if (children[j] instanceof Accessible)
+ index++;
+ if (index == i)
+ found = (Accessible) children[index];
+ }
+ // TODO: Figure out what to do when i is not a valid index.
+ return found;
+ }
+
+ /**
+ * Returns the accessible state set of this component.
+ *
+ * @return the accessible state set of this component
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ // FIXME: Figure out which states should be set here, and which are
+ // inherited from the super class.
+ return super.getAccessibleStateSet();
+ }
+
+ /**
+ * Returns the localized name for this object. Generally this should
+ * almost never return {@link Component#getName()} since that is not
+ * a localized name. If the object is some kind of text component (like
+ * a menu item), then the value of the object may be returned. Also, if
+ * the object has a tooltip, the value of the tooltip may also be
+ * appropriate.
+ *
+ * @return the localized name for this object or <code>null</code> if this
+ * object has no name
+ */
+ public String getAccessibleName()
+ {
+ // TODO: Figure out what exactly to return here. It's possible that this
+ // method simply should return null.
+ return null;
+ }
+
+ /**
+ * Returns the localized description of this object.
+ *
+ * @return the localized description of this object or <code>null</code>
+ * if this object has no description
+ */
+ public String getAccessibleDescription()
+ {
+ // TODO: Figure out what exactly to return here. It's possible that this
+ // method simply should return null.
+ return null;
+ }
+
+ /**
+ * Returns the accessible role of this component.
+ *
+ * @return the accessible role of this component
+ *
+ * @see AccessibleRole
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ // TODO: Check if this is correct.
+ return AccessibleRole.SWING_COMPONENT;
+ }
+
+ /**
+ * Recursivly searches a border hierarchy (starting at <code>border) for
+ * a titled border and returns the title if one is found, <code>null</code>
+ * otherwise.
+ *
+ * @param border the border to start search from
+ *
+ * @return the border title of a possibly found titled border
+ */
+ protected String getBorderTitle(Border border)
+ {
+ String title = null;
+ if (border instanceof CompoundBorder)
+ {
+ CompoundBorder compound = (CompoundBorder) border;
+ Border inner = compound.getInsideBorder();
+ title = getBorderTitle(inner);
+ if (title == null)
+ {
+ Border outer = compound.getOutsideBorder();
+ title = getBorderTitle(outer);
+ }
+ }
+ else if (border instanceof TitledBorder)
+ {
+ TitledBorder titled = (TitledBorder) border;
+ title = titled.getTitle();
+ }
+ return title;
+ }
+
+ /**
+ * Returns the tooltip text for this accessible component.
+ *
+ * @return the tooltip text for this accessible component
+ */
+ public String getToolTipText()
+ {
+ return JComponent.this.getToolTipText();
+ }
+
+ /**
+ * Returns the title of the border of this accessible component if
+ * this component has a titled border, otherwise returns <code>null</code>.
+ *
+ * @return the title of the border of this accessible component if
+ * this component has a titled border, otherwise returns
+ * <code>null</code>
+ */
+ public String getTitledBorderText()
+ {
+ return getBorderTitle(getBorder());
+ }
+
+ /**
+ * Returns the keybindings associated with this accessible component or
+ * <code>null</code> if the component does not support key bindings.
+ *
+ * @return the keybindings associated with this accessible component
+ */
+ public AccessibleKeyBinding getAccessibleKeyBinding()
+ {
+ // TODO: Implement this properly.
+ return null;
+ }
}
/**
* An explicit value for the component's preferred size; if not set by a
* user, this is calculated on the fly by delegating to the {@link
- * ComponentUI.getPreferredSize} method on the {@link #ui} property.
+ * ComponentUI#getPreferredSize} method on the {@link #ui} property.
*/
Dimension preferredSize;
/**
* An explicit value for the component's minimum size; if not set by a
* user, this is calculated on the fly by delegating to the {@link
- * ComponentUI.getMinimumSize} method on the {@link #ui} property.
+ * ComponentUI#getMinimumSize} method on the {@link #ui} property.
*/
Dimension minimumSize;
/**
* An explicit value for the component's maximum size; if not set by a
* user, this is calculated on the fly by delegating to the {@link
- * ComponentUI.getMaximumSize} method on the {@link #ui} property.
+ * ComponentUI#getMaximumSize} method on the {@link #ui} property.
*/
Dimension maximumSize;
@@ -191,7 +390,7 @@ public abstract class JComponent extends Container implements Serializable
* @see javax.swing.OverlayLayout
* @see javax.swing.BoxLayout
*/
- float alignmentX = 0.5f;
+ float alignmentX = -1.0F;
/**
* A value between 0.0 and 1.0 indicating the preferred vertical
@@ -206,7 +405,7 @@ public abstract class JComponent extends Container implements Serializable
* @see javax.swing.OverlayLayout
* @see javax.swing.BoxLayout
*/
- float alignmentY = 0.5f;
+ float alignmentY = -1.0F;
/**
* The border painted around this component.
@@ -219,14 +418,14 @@ public abstract class JComponent extends Container implements Serializable
* The text to show in the tooltip associated with this component.
*
* @see #setToolTipText
- * @see #getToolTipText
+ * @see #getToolTipText()
*/
String toolTipText;
/**
* <p>Whether to double buffer this component when painting. This flag
- * should generally be <code>false</code>, except for top level
- * components such as {@link JFrame} or {@link JApplet}.</p>
+ * should generally be <code>true</code>, to ensure good painting
+ * performance.</p>
*
* <p>All children of a double buffered component are painted into the
* double buffer automatically, so only the top widget in a window needs
@@ -234,22 +433,21 @@ public abstract class JComponent extends Container implements Serializable
*
* @see #setDoubleBuffered
* @see #isDoubleBuffered
- * @see #paintLock
* @see #paint
*/
- boolean doubleBuffered = false;
+ boolean doubleBuffered = true;
/**
* A set of flags indicating which debugging graphics facilities should
* be enabled on this component. The values should be a combination of
- * {@link DebugGraphics.NONE_OPTION}, {@link DebugGraphics.LOG_OPTION},
- * {@link DebugGraphics.FLASH_OPTION}, or {@link
- * DebugGraphics.BUFFERED_OPTION}.
+ * {@link DebugGraphics#NONE_OPTION}, {@link DebugGraphics#LOG_OPTION},
+ * {@link DebugGraphics#FLASH_OPTION}, or {@link
+ * DebugGraphics#BUFFERED_OPTION}.
*
- * @see setDebugGraphicsOptions
- * @see getDebugGraphicsOptions
+ * @see #setDebugGraphicsOptions
+ * @see #getDebugGraphicsOptions
* @see DebugGraphics
- * @see getComponentGraphics
+ * @see #getComponentGraphics
*/
int debugGraphicsOptions;
@@ -299,7 +497,7 @@ public abstract class JComponent extends Container implements Serializable
* try to request focus, but the request might fail. Thus it is only
* a hint guiding swing's behavior.
*
- * @see #requestFocus
+ * @see #requestFocus()
* @see #isRequestFocusEnabled
* @see #setRequestFocusEnabled
*/
@@ -312,12 +510,18 @@ public abstract class JComponent extends Container implements Serializable
* timed intervals, continuing off in the direction the mouse exited the
* component, until the mouse is released or re-enters the component.
*
- * @see setAutoscrolls
- * @see getAutoscrolls
+ * @see #setAutoscrolls
+ * @see #getAutoscrolls
*/
boolean autoscrolls = false;
/**
+ * Indicates whether the current paint call is already double buffered or
+ * not.
+ */
+ static boolean isPaintingDoubleBuffered = false;
+
+ /**
* Listeners for events other than {@link PropertyChangeEvent} are
* handled by this listener list. PropertyChangeEvents are handled in
* {@link #changeSupport}.
@@ -342,7 +546,7 @@ public abstract class JComponent extends Container implements Serializable
private InputMap inputMap_whenFocused;
private InputMap inputMap_whenAncestorOfFocused;
- private InputMap inputMap_whenInFocusedWindow;
+ private ComponentInputMap inputMap_whenInFocusedWindow;
private ActionMap actionMap;
/** @since 1.3 */
private boolean verifyInputWhenFocusTarget;
@@ -350,16 +554,17 @@ public abstract class JComponent extends Container implements Serializable
private TransferHandler transferHandler;
- /**
- * A lock held during recursive painting; this is used to serialize
- * access to the double buffer, and also to select the "top level"
- * object which should acquire the double buffer in a given widget
- * tree (which may have multiple double buffered children).
- *
- * @see #doubleBuffered
- * @see #paint
+ /**
+ * Indicates if this component is currently painting a tile or not.
*/
- private static final Object paintLock = new Object();
+ private boolean paintingTile;
+
+ /**
+ * A cached Rectangle object to be reused. Be careful when you use that,
+ * so that it doesn't get modified in another context within the same
+ * method call chain.
+ */
+ private static transient Rectangle rectCache;
/**
* The default locale of the component.
@@ -404,6 +609,13 @@ public abstract class JComponent extends Container implements Serializable
public static final int WHEN_IN_FOCUSED_WINDOW = 2;
/**
+ * Indicates if this component is completely dirty or not. This is used
+ * by the RepaintManager's
+ * {@link RepaintManager#isCompletelyDirty(JComponent)} method.
+ */
+ boolean isCompletelyDirty = false;
+
+ /**
* Creates a new <code>JComponent</code> instance.
*/
public JComponent()
@@ -452,7 +664,9 @@ public abstract class JComponent extends Container implements Serializable
/**
* Add a client property <code>value</code> to this component, associated
* with <code>key</code>. If there is an existing client property
- * associated with <code>key</code>, it will be replaced.
+ * associated with <code>key</code>, it will be replaced. A
+ * {@link PropertyChangeEvent} is sent to registered listeners (with the
+ * name of the property being <code>key.toString()</code>).
*
* @param key The key of the client property association to add
* @param value The value of the client property association to add
@@ -463,10 +677,13 @@ public abstract class JComponent extends Container implements Serializable
*/
public final void putClientProperty(Object key, Object value)
{
+ Hashtable t = getClientProperties();
+ Object old = t.get(key);
if (value != null)
- getClientProperties().put(key, value);
+ t.put(key, value);
else
- getClientProperties().remove(key);
+ t.remove(key);
+ firePropertyChange(key.toString(), old, value);
}
/**
@@ -771,7 +988,8 @@ public abstract class JComponent extends Container implements Serializable
{
VetoableChangeListener[] listeners = getVetoableChangeListeners();
- PropertyChangeEvent evt = new PropertyChangeEvent(this, propertyName, oldValue, newValue);
+ PropertyChangeEvent evt =
+ new PropertyChangeEvent(this, propertyName, oldValue, newValue);
for (int i = 0; i < listeners.length; i++)
listeners[i].vetoableChange(evt);
@@ -797,7 +1015,12 @@ public abstract class JComponent extends Container implements Serializable
*/
public float getAlignmentX()
{
- return alignmentX;
+ float ret = alignmentX;
+ if (alignmentX < 0)
+ // alignment has not been set explicitly.
+ ret = super.getAlignmentX();
+
+ return ret;
}
/**
@@ -810,7 +1033,12 @@ public abstract class JComponent extends Container implements Serializable
*/
public float getAlignmentY()
{
- return alignmentY;
+ float ret = alignmentY;
+ if (alignmentY < 0)
+ // alignment has not been set explicitly.
+ ret = super.getAlignmentY();
+
+ return ret;
}
/**
@@ -832,9 +1060,13 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setBorder(Border newBorder)
{
- Border oldBorder = border;
+ Border oldBorder = getBorder();
+ if (oldBorder == newBorder)
+ return;
+
border = newBorder;
firePropertyChange("border", oldBorder, newBorder);
+ repaint();
}
/**
@@ -885,10 +1117,19 @@ public abstract class JComponent extends Container implements Serializable
* @see #paint
*/
protected Graphics getComponentGraphics(Graphics g)
- {
- g.setFont (this.getFont());
- g.setColor (this.getForeground());
- return g;
+ {
+ Graphics g2 = g;
+ int options = getDebugGraphicsOptions();
+ if (options != DebugGraphics.NONE_OPTION)
+ {
+ if (!(g2 instanceof DebugGraphics))
+ g2 = new DebugGraphics(g);
+ DebugGraphics dg = (DebugGraphics) g2;
+ dg.setDebugOptions(dg.getDebugOptions() | options);
+ }
+ g2.setFont(this.getFont());
+ g2.setColor(this.getForeground());
+ return g2;
}
/**
@@ -901,7 +1142,19 @@ public abstract class JComponent extends Container implements Serializable
*/
public int getDebugGraphicsOptions()
{
- return 0;
+ String option = System.getProperty("gnu.javax.swing.DebugGraphics");
+ int options = debugGraphicsOptions;
+ if (option != null && option.length() != 0)
+ {
+ if (options < 0)
+ options = 0;
+
+ if (option.equals("LOG"))
+ options |= DebugGraphics.LOG_OPTION;
+ else if (option.equals("FLASH"))
+ options |= DebugGraphics.FLASH_OPTION;
+ }
+ return options;
}
/**
@@ -1298,6 +1551,7 @@ public abstract class JComponent extends Container implements Serializable
*/
public void grabFocus()
{
+ // TODO: Implement this properly.
}
/**
@@ -1366,13 +1620,16 @@ public abstract class JComponent extends Container implements Serializable
}
/**
- * Return <code>true</code> if this component is currently painting a tile.
+ * Return <code>true</code> if this component is currently painting a tile,
+ * this means that paint() is called again on another child component. This
+ * method returns <code>false</code> if this component does not paint a tile
+ * or if the last tile is currently painted.
*
- * @return Whether the component is painting a tile
+ * @return whether the component is painting a tile
*/
public boolean isPaintingTile()
{
- return false;
+ return paintingTile;
}
/**
@@ -1406,16 +1663,6 @@ public abstract class JComponent extends Container implements Serializable
* RepaintManager}. Client code should usually call {@link #repaint()} to
* trigger painting.</p>
*
- * <p>This method will acquire a double buffer from the {@link
- * RepaintManager} if the component's {@link #doubleBuffered} property is
- * <code>true</code> and the <code>paint</code> call is the
- * <em>first</em> recursive <code>paint</code> call inside swing.</p>
- *
- * <p>The method will also modify the provided {@link Graphics} context
- * via the {@link #getComponentGraphics} method. If you want to customize
- * the graphics object used for painting, you should override that method
- * rather than <code>paint</code>.</p>
- *
* <p>The body of the <code>paint</code> call involves calling {@link
* #paintComponent}, {@link #paintBorder}, and {@link #paintChildren} in
* order. If you want to customize painting behavior, you should override
@@ -1431,32 +1678,30 @@ public abstract class JComponent extends Container implements Serializable
*/
public void paint(Graphics g)
{
- Graphics g2 = g;
- Image doubleBuffer = null;
RepaintManager rm = RepaintManager.currentManager(this);
-
- if (isDoubleBuffered()
- && (rm.isDoubleBufferingEnabled())
- && (! Thread.holdsLock(paintLock)))
- {
- doubleBuffer = rm.getOffscreenBuffer(this, getWidth(), getHeight());
- }
-
- synchronized (paintLock)
+ // We do a little stunt act here to switch on double buffering if it's
+ // not already on. If we are not already doublebuffered, then we jump
+ // into the method paintDoubleBuffered, which turns on the double buffer
+ // and then calls paint(g) again. In the second call we go into the else
+ // branch of this if statement and actually paint things to the double
+ // buffer. When this method completes, the call stack unwinds back to
+ // paintDoubleBuffered, where the buffer contents is finally drawn to the
+ // screen.
+ if (!isPaintingDoubleBuffered && isDoubleBuffered()
+ && rm.isDoubleBufferingEnabled())
+ paintDoubleBuffered(g);
+ else
{
- if (doubleBuffer != null)
- {
- g2 = doubleBuffer.getGraphics();
- g2.setClip(g.getClipBounds());
- }
-
- g2 = getComponentGraphics(g2);
+ if (g.getClip() == null)
+ g.setClip(0, 0, getWidth(), getHeight());
+ Graphics g2 = getComponentGraphics(g);
paintComponent(g2);
paintBorder(g2);
paintChildren(g2);
-
- if (doubleBuffer != null)
- g.drawImage(doubleBuffer, 0, 0, (ImageObserver) null);
+ Rectangle clip = g2.getClipBounds();
+ if (clip.x == 0 && clip.y == 0 && clip.width == getWidth()
+ && clip.height == getHeight())
+ RepaintManager.currentManager(this).markCompletelyClean(this);
}
}
@@ -1495,7 +1740,69 @@ public abstract class JComponent extends Container implements Serializable
*/
protected void paintChildren(Graphics g)
{
- super.paint(g);
+ Shape originalClip = g.getClip();
+ Rectangle inner = SwingUtilities.calculateInnerArea(this, rectCache);
+ g.clipRect(inner.x, inner.y, inner.width, inner.height);
+ Component[] children = getComponents();
+
+ // Find the bottommost component that needs to be painted. This is a
+ // component that completely covers the current clip and is opaque. In
+ // this case we don't need to paint the components below it.
+ int startIndex = children.length - 1;
+ // No need to check for overlapping components when this component is
+ // optimizedDrawingEnabled (== it tiles its children).
+ if (! isOptimizedDrawingEnabled())
+ {
+ Rectangle clip = g.getClipBounds();
+ for (int i = 0; i < children.length; i++)
+ {
+ Rectangle childBounds = children[i].getBounds();
+ if (children[i].isOpaque()
+ && SwingUtilities.isRectangleContainingRectangle(childBounds,
+ g.getClipBounds()))
+ {
+ startIndex = i;
+ break;
+ }
+ }
+ }
+ // paintingTile becomes true just before we start painting the component's
+ // children.
+ paintingTile = true;
+ for (int i = startIndex; i >= 0; --i)
+ {
+ // paintingTile must be set to false before we begin to start painting
+ // the last tile.
+ if (i == 0)
+ paintingTile = false;
+
+ if (!children[i].isVisible())
+ continue;
+
+ Rectangle bounds = children[i].getBounds(rectCache);
+ Rectangle oldClip = g.getClipBounds();
+ if (oldClip == null)
+ oldClip = bounds;
+
+ if (!g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height))
+ continue;
+
+ boolean translated = false;
+ try
+ {
+ g.clipRect(bounds.x, bounds.y, bounds.width, bounds.height);
+ g.translate(bounds.x, bounds.y);
+ translated = true;
+ children[i].paint(g);
+ }
+ finally
+ {
+ if (translated)
+ g.translate(-bounds.x, -bounds.y);
+ g.setClip(oldClip);
+ }
+ }
+ g.setClip(originalClip);
}
/**
@@ -1518,7 +1825,7 @@ public abstract class JComponent extends Container implements Serializable
Graphics g2 = g;
if (!(g instanceof Graphics2D))
g2 = g.create();
- ui.update(getComponentGraphics(g2), this);
+ ui.update(g2, this);
if (!(g instanceof Graphics2D))
g2.dispose();
}
@@ -1544,24 +1851,99 @@ public abstract class JComponent extends Container implements Serializable
* that root pane. This method is called from the {@link RepaintManager}
* and should always be called within the painting thread.
*
+ * <p>This method will acquire a double buffer from the {@link
+ * RepaintManager} if the component's {@link #doubleBuffered} property is
+ * <code>true</code> and the <code>paint</code> call is the
+ * <em>first</em> recursive <code>paint</code> call inside swing.</p>
+ *
+ * <p>The method will also modify the provided {@link Graphics} context
+ * via the {@link #getComponentGraphics} method. If you want to customize
+ * the graphics object used for painting, you should override that method
+ * rather than <code>paint</code>.</p>
+ *
* @param r The dirty rectangle to paint
*/
public void paintImmediately(Rectangle r)
{
- Component root = SwingUtilities.getRoot(this);
- if (root == null || ! root.isShowing())
+ // Try to find a root pane for this component.
+ //Component root = findPaintRoot(r);
+ Component root = findPaintRoot(r);
+ // If no paint root is found, then this component is completely overlapped
+ // by another component and we don't need repainting.
+ if (root == null)
return;
- Graphics g = root.getGraphics();
- if (g == null)
+ if (root == null || !root.isShowing())
return;
- Rectangle clip = SwingUtilities.convertRectangle(this, r, root);
- g.setClip(clip);
- root.paint(g);
+ Rectangle rootClip = SwingUtilities.convertRectangle(this, r, root);
+ if (root instanceof JComponent)
+ ((JComponent) root).paintImmediately2(rootClip);
+ else
+ root.repaint(rootClip.x, rootClip.y, rootClip.width, rootClip.height);
+ }
+
+ /**
+ * Performs the actual work of paintImmediatly on the repaint root.
+ *
+ * @param r the area to be repainted
+ */
+ void paintImmediately2(Rectangle r)
+ {
+ RepaintManager rm = RepaintManager.currentManager(this);
+ Graphics g = getGraphics();
+ g.setClip(r.x, r.y, r.width, r.height);
+ if (rm.isDoubleBufferingEnabled() && isDoubleBuffered())
+ paintDoubleBuffered(g);
+ else
+ paintSimple(g);
g.dispose();
}
/**
+ * Performs double buffered repainting.
+ *
+ * @param g the graphics context to paint to
+ */
+ void paintDoubleBuffered(Graphics g)
+ {
+
+ Rectangle r = g.getClipBounds();
+ if (r == null)
+ r = new Rectangle(0, 0, getWidth(), getHeight());
+ RepaintManager rm = RepaintManager.currentManager(this);
+
+ // Paint on the offscreen buffer.
+ Image buffer = rm.getOffscreenBuffer(this, getWidth(), getHeight());
+ Graphics g2 = buffer.getGraphics();
+ g2 = getComponentGraphics(g2);
+ g2.setClip(r.x, r.y, r.width, r.height);
+ isPaintingDoubleBuffered = true;
+ try
+ {
+ paint(g2);
+ }
+ finally
+ {
+ isPaintingDoubleBuffered = false;
+ g2.dispose();
+ }
+
+ // Paint the buffer contents on screen.
+ g.drawImage(buffer, 0, 0, this);
+ }
+
+ /**
+ * Performs normal painting without double buffering.
+ *
+ * @param g the graphics context to use
+ */
+ void paintSimple(Graphics g)
+ {
+ Graphics g2 = getComponentGraphics(g);
+ paint(g2);
+ }
+
+ /**
* Return a string representation for this component, for use in
* debugging.
*
@@ -1685,7 +2067,11 @@ public abstract class JComponent extends Container implements Serializable
break;
case WHEN_IN_FOCUSED_WINDOW:
- inputMap_whenInFocusedWindow = map;
+ if (map != null && !(map instanceof ComponentInputMap))
+ throw new
+ IllegalArgumentException("WHEN_IN_FOCUSED_WINDOW " +
+ "InputMap must be a ComponentInputMap");
+ inputMap_whenInFocusedWindow = (ComponentInputMap)map;
break;
case UNDEFINED_CONDITION:
@@ -1711,7 +2097,7 @@ public abstract class JComponent extends Container implements Serializable
case WHEN_IN_FOCUSED_WINDOW:
if (inputMap_whenInFocusedWindow == null)
- inputMap_whenInFocusedWindow = new InputMap();
+ inputMap_whenInFocusedWindow = new ComponentInputMap(this);
return inputMap_whenInFocusedWindow;
case UNDEFINED_CONDITION:
@@ -1797,6 +2183,7 @@ public abstract class JComponent extends Container implements Serializable
*/
protected void processComponentKeyEvent(KeyEvent e)
{
+ // This method does nothing, it is meant to be overridden by subclasses.
}
/**
@@ -1825,40 +2212,56 @@ public abstract class JComponent extends Container implements Serializable
// 4. The WHEN_IN_FOCUSED_WINDOW maps of all the enabled components in
// the focused window are searched.
- if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
- e, WHEN_FOCUSED, e.getID() == KeyEvent.KEY_PRESSED))
- // This is step 1 from above comment.
- e.consume();
- else if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
- e, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
- e.getID() == KeyEvent.KEY_PRESSED))
- // This is step 2 from above comment.
- e.consume();
- else
+ KeyStroke keyStroke = KeyStroke.getKeyStrokeForEvent(e);
+ boolean pressed = e.getID() == KeyEvent.KEY_PRESSED;
+
+ if (processKeyBinding(keyStroke, e, WHEN_FOCUSED, pressed))
+ {
+ // This is step 1 from above comment.
+ e.consume();
+ return;
+ }
+ else if (processKeyBinding
+ (keyStroke, e, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, pressed))
{
- // This is step 3 from above comment.
- Container current = this;
- while ((current = current.getParent()) instanceof JComponent)
+ // This is step 2 from above comment.
+ e.consume();
+ return;
+ }
+
+ // This is step 3 from above comment.
+ Container current = getParent();
+ while (current != null)
+ {
+ // If current is a JComponent, see if it handles the event in its
+ // WHEN_ANCESTOR_OF_FOCUSED_COMPONENT maps.
+ if ((current instanceof JComponent) &&
+ ((JComponent)current).processKeyBinding
+ (keyStroke, e,WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, pressed))
{
- if (((JComponent)current).processKeyBinding
- (KeyStroke.getKeyStrokeForEvent(e), e,
- WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
- e.getID() == KeyEvent.KEY_PRESSED))
- {
- e.consume();
- break;
- }
- if (current instanceof Window || current instanceof Applet
- || current instanceof JInternalFrame)
- break;
- }
- if (e.isConsumed())
- return;
+ e.consume();
+ return;
+ }
- // This is step 4 from above comment.
- // FIXME: Implement. Note, should use ComponentInputMaps rather
- // than walking the entire containment hierarchy.
+ // Stop when we've tried a top-level container and it didn't handle it
+ if (current instanceof Window || current instanceof Applet)
+ break;
+
+ // Move up the hierarchy
+ current = current.getParent();
}
+
+ // Current being null means the JComponent does not currently have a
+ // top-level ancestor, in which case we don't need to check
+ // WHEN_IN_FOCUSED_WINDOW bindings.
+ if (current == null || e.isConsumed())
+ return;
+
+ // This is step 4 from above comment. KeyboardManager maintains mappings
+ // related to WHEN_IN_FOCUSED_WINDOW bindings so that we don't have to
+ // traverse the containment hierarchy each time.
+ if (KeyboardManager.getManager().processKeyStroke(current, keyStroke, e))
+ e.consume();
}
protected boolean processKeyBinding(KeyStroke ks,
@@ -1975,8 +2378,19 @@ public abstract class JComponent extends Container implements Serializable
*/
public void revalidate()
{
- invalidate();
- RepaintManager.currentManager(this).addInvalidComponent(this);
+ if (! EventQueue.isDispatchThread())
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ revalidate();
+ }
+ });
+ else
+ {
+ invalidate();
+ RepaintManager.currentManager(this).addInvalidComponent(this);
+ }
}
/**
@@ -1999,7 +2413,12 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setAlignmentX(float a)
{
- alignmentX = a;
+ if (a < 0.0F)
+ alignmentX = 0.0F;
+ else if (a > 1.0)
+ alignmentX = 1.0F;
+ else
+ alignmentX = a;
}
/**
@@ -2009,7 +2428,12 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setAlignmentY(float a)
{
- alignmentY = a;
+ if (a < 0.0F)
+ alignmentY = 0.0F;
+ else if (a > 1.0)
+ alignmentY = 1.0F;
+ else
+ alignmentY = a;
}
/**
@@ -2049,9 +2473,11 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setEnabled(boolean enable)
{
- boolean oldEnabled = isEnabled();
+ if (enable == isEnabled())
+ return;
super.setEnabled(enable);
- firePropertyChange("enabled", oldEnabled, enable);
+ firePropertyChange("enabled", !enable, enable);
+ repaint();
}
/**
@@ -2061,7 +2487,11 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setFont(Font f)
{
+ if (f == getFont())
+ return;
super.setFont(f);
+ revalidate();
+ repaint();
}
/**
@@ -2071,7 +2501,10 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setBackground(Color bg)
{
+ if (bg == getBackground())
+ return;
super.setBackground(bg);
+ repaint();
}
/**
@@ -2081,42 +2514,51 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setForeground(Color fg)
{
+ if (fg == getForeground())
+ return;
super.setForeground(fg);
+ repaint();
}
/**
- * Set the value of the {@link #maximumSize} property.
+ * Set the value of the {@link #maximumSize} property. The passed value is
+ * copied, the later direct changes on the argument have no effect on the
+ * property value.
*
* @param max The new value of the property
*/
public void setMaximumSize(Dimension max)
{
Dimension oldMaximumSize = maximumSize;
- maximumSize = max;
+ maximumSize = new Dimension(max);
firePropertyChange("maximumSize", oldMaximumSize, maximumSize);
}
/**
- * Set the value of the {@link #minimumSize} property.
+ * Set the value of the {@link #minimumSize} property. The passed value is
+ * copied, the later direct changes on the argument have no effect on the
+ * property value.
*
* @param min The new value of the property
*/
public void setMinimumSize(Dimension min)
{
Dimension oldMinimumSize = minimumSize;
- minimumSize = min;
+ minimumSize = new Dimension(min);
firePropertyChange("minimumSize", oldMinimumSize, minimumSize);
}
/**
- * Set the value of the {@link #preferredSize} property.
+ * Set the value of the {@link #preferredSize} property. The passed value is
+ * copied, the later direct changes on the argument have no effect on the
+ * property value.
*
* @param pref The new value of the property
*/
public void setPreferredSize(Dimension pref)
{
Dimension oldPreferredSize = preferredSize;
- preferredSize = pref;
+ preferredSize = new Dimension(pref);
firePropertyChange("preferredSize", oldPreferredSize, preferredSize);
}
@@ -2131,6 +2573,7 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setNextFocusableComponent(Component aComponent)
{
+ // TODO: Implement this properly.
}
/**
@@ -2191,11 +2634,29 @@ public abstract class JComponent extends Container implements Serializable
/**
* Set the value of the visible property.
*
+ * If the value is changed, then the AncestorListeners of this component
+ * and all its children (recursivly) are notified.
+ *
* @param v The new value of the property
*/
public void setVisible(boolean v)
{
+ // No need to do anything if the actual value doesn't change.
+ if (isVisible() == v)
+ return;
+
super.setVisible(v);
+
+ // Notify AncestorListeners.
+ if (v == true)
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED);
+ else
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_REMOVED);
+
+ Container parent = getParent();
+ if (parent != null)
+ parent.repaint(getX(), getY(), getWidth(), getHeight());
+ revalidate();
}
/**
@@ -2248,7 +2709,8 @@ public abstract class JComponent extends Container implements Serializable
ui.installUI(this);
firePropertyChange("UI", oldUI, newUI);
-
+ revalidate();
+ repaint();
}
/**
@@ -2427,47 +2889,22 @@ public abstract class JComponent extends Container implements Serializable
*/
public void addNotify()
{
+ // Register the WHEN_IN_FOCUSED_WINDOW keyboard bindings
+ // Note that here we unregister all bindings associated with
+ // this component and then re-register them. This may be more than
+ // necessary if the top-level ancestor hasn't changed. Should
+ // maybe improve this.
+ KeyboardManager km = KeyboardManager.getManager();
+ km.clearBindingsForComp(this);
+ km.registerEntireMap((ComponentInputMap)
+ this.getInputMap(WHEN_IN_FOCUSED_WINDOW));
super.addNotify();
- // let parents inherit the keybord mapping
- InputMap input = getInputMap();
- ActionMap actions = getActionMap();
-
- Container parent = getParent();
- while ((parent != null) && (parent instanceof JComponent))
- {
- JComponent jParent = (JComponent) parent;
- InputMap parentInput = jParent.getInputMap();
- ActionMap parentAction = jParent.getActionMap();
-
- KeyStroke[] ikeys = input.keys();
- for (int i = 0; i < ikeys.length; i++)
- {
- Object o = input.get(ikeys[i]);
- parentInput.put(ikeys[i], o);
- }
-
- Object[] akeys = actions.keys();
- for (int i = 0; i < akeys.length; i++)
- {
- Action a = actions.get(akeys[i]);
- parentAction.put(akeys[i], a);
- }
-
- parent = jParent.getParent();
- }
-
- // notify ancestor listeners
- AncestorListener[] ls = getAncestorListeners();
- AncestorEvent ev = new AncestorEvent(this, AncestorEvent.ANCESTOR_ADDED,
- this, parent);
- for (int i = 0; i < ls.length; i++)
- {
- ls[i].ancestorAdded(ev);
- }
+ // Notify AncestorListeners.
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED);
// fire property change event for 'ancestor'
- firePropertyChange("ancestor", null, parent);
+ firePropertyChange("ancestor", null, getParent());
}
/**
@@ -2490,43 +2927,13 @@ public abstract class JComponent extends Container implements Serializable
{
super.removeNotify();
- // let parents inherit the keybord mapping
- InputMap input = getInputMap();
- ActionMap actions = getActionMap();
-
- Container parent = getParent();
- while ((parent != null) && (parent instanceof JComponent))
- {
- JComponent jParent = (JComponent) parent;
- InputMap parentInput = jParent.getInputMap();
- ActionMap parentAction = jParent.getActionMap();
-
- KeyStroke[] ikeys = input.allKeys();
- for (int i = 0; i < ikeys.length; i++)
- {
- parentInput.remove(ikeys[i]);
- }
-
- Object[] akeys = actions.allKeys();
- for (int i = 0; i < akeys.length; i++)
- {
- parentAction.remove(akeys[i]);
- }
-
- parent = jParent.getParent();
- }
-
- // notify ancestor listeners
- AncestorListener[] ls = getAncestorListeners();
- AncestorEvent ev = new AncestorEvent(this, AncestorEvent.ANCESTOR_ADDED,
- this, parent);
- for (int i = 0; i < ls.length; i++)
- {
- ls[i].ancestorAdded(ev);
- }
+ KeyboardManager.getManager().clearBindingsForComp(this);
+
+ // Notify ancestor listeners.
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_REMOVED);
// fire property change event for 'ancestor'
- firePropertyChange("ancestor", parent, null);
+ firePropertyChange("ancestor", getParent(), null);
}
/**
@@ -2733,6 +3140,215 @@ public abstract class JComponent extends Container implements Serializable
*/
public void reshape(int x, int y, int w, int h)
{
+ int oldX = getX();
+ int oldY = getY();
super.reshape(x, y, w, h);
+ // Notify AncestorListeners.
+ if (oldX != getX() || oldY != getY())
+ fireAncestorEvent(this, AncestorEvent.ANCESTOR_MOVED);
+ }
+
+ /**
+ * Fires an AncestorEvent to this component's and all of its child
+ * component's AncestorListeners.
+ *
+ * @param ancestor the component that triggered the event
+ * @param id the kind of ancestor event that should be fired
+ */
+ void fireAncestorEvent(JComponent ancestor, int id)
+ {
+ // Fire event for registered ancestor listeners of this component.
+ AncestorListener[] listeners = getAncestorListeners();
+ if (listeners.length > 0)
+ {
+ AncestorEvent ev = new AncestorEvent(this, id,
+ ancestor, ancestor.getParent());
+ for (int i = 0; i < listeners.length; i++)
+ {
+ switch (id)
+ {
+ case AncestorEvent.ANCESTOR_MOVED:
+ listeners[i].ancestorMoved(ev);
+ break;
+ case AncestorEvent.ANCESTOR_ADDED:
+ listeners[i].ancestorAdded(ev);
+ break;
+ case AncestorEvent.ANCESTOR_REMOVED:
+ listeners[i].ancestorRemoved(ev);
+ break;
+ }
+ }
+ }
+ // Dispatch event to all children.
+ Component[] children = getComponents();
+ for (int i = 0; i < children.length; i++)
+ {
+ if (!(children[i] instanceof JComponent))
+ continue;
+ JComponent jc = (JComponent) children[i];
+ jc.fireAncestorEvent(ancestor, id);
+ }
+ }
+
+ /**
+ * Finds a suitable paint root for painting this component. This method first
+ * checks if this component is overlapped using
+ * {@link #findOverlapFreeParent(Rectangle)}. The returned paint root is then
+ * feeded to {@link #findOpaqueParent(Component)} to find the nearest opaque
+ * component for this paint root. If no paint is necessary, then we return
+ * <code>null</code>.
+ *
+ * @param c the clip of this component
+ *
+ * @return the paint root or <code>null</code> if no painting is necessary
+ */
+ private Component findPaintRoot(Rectangle c)
+ {
+ Component p = findOverlapFreeParent(c);
+ if (p == null)
+ return null;
+ Component root = findOpaqueParent(p);
+ return root;
+ }
+
+ /**
+ * Scans the containment hierarchy upwards for components that overlap the
+ * this component in the specified clip. This method returns
+ * <code>this</code>, if no component overlaps this component. It returns
+ * <code>null</code> if another component completely covers this component
+ * in the specified clip (no repaint necessary). If another component partly
+ * overlaps this component in the specified clip, then the parent of this
+ * component is returned (this is the component that must be used as repaint
+ * root). For efficient lookup, the method
+ * {@link #isOptimizedDrawingEnabled()} is used.
+ *
+ * @param clip the clip of this component
+ *
+ * @return the paint root, or <code>null</code> if no paint is necessary
+ */
+ private Component findOverlapFreeParent(Rectangle clip)
+ {
+ Rectangle currentClip = clip;
+ Component found = this;
+ Container parent = this;
+ while (parent != null && !(parent instanceof Window))
+ {
+ Container newParent = parent.getParent();
+ if (newParent == null)
+ break;
+ // If the parent is optimizedDrawingEnabled, then its children are
+ // tiled and cannot have an overlapping child. Go directly to next
+ // parent.
+ if (newParent instanceof JComponent
+ && ((JComponent) newParent).isOptimizedDrawingEnabled())
+ {
+ parent = newParent;
+ continue;
+ }
+
+ // First we must check if the new parent itself somehow clips the
+ // target rectangle. This can happen in JViewports.
+ Rectangle parRect = new Rectangle(0, 0, newParent.getWidth(),
+ newParent.getHeight());
+ Rectangle target = SwingUtilities.convertRectangle(found,
+ currentClip,
+ newParent);
+ if (target.contains(parRect) || target.intersects(parRect))
+ {
+ found = newParent;
+ currentClip = target;
+ parent = newParent;
+ continue;
+ }
+
+ // Otherwise we must check if one of the children of this parent
+ // overlaps with the current component.
+ Component[] children = newParent.getComponents();
+ // This flag is used to skip components that are 'below' the component
+ // in question.
+ boolean skip = true;
+ for (int i = children.length - 1; i >= 0; i--)
+ {
+ if (children[i] == parent)
+ skip = false;
+ if (skip)
+ continue;
+ Component c = children[i];
+ Rectangle compBounds = c.getBounds();
+ // If the component completely overlaps the clip in question, we
+ // don't need to repaint. Return null.
+ if (compBounds.contains(target))
+ return null;
+ if (compBounds.intersects(target))
+ {
+ // We found a parent whose children overlap with our current
+ // component. Make this the current component.
+ found = newParent;
+ currentClip = target;
+ break;
+ }
+ }
+ parent = newParent;
+ }
+ return found;
+ }
+
+ /**
+ * Finds the nearest component to <code>c</code> (upwards in the containment
+ * hierarchy), that is opaque. If <code>c</code> itself is opaque,
+ * this returns <code>c</code> itself.
+ *
+ * @param c the start component for the search
+ * @return the nearest component to <code>c</code> (upwards in the containment
+ * hierarchy), that is opaque; If <code>c</code> itself is opaque,
+ * this returns <code>c</code> itself
+ */
+ private Component findOpaqueParent(Component c)
+ {
+ Component found = c;
+ while (true)
+ {
+ if ((found instanceof JComponent) && ((JComponent) found).isOpaque())
+ break;
+ else if (!(found instanceof JComponent))
+ break;
+ Container p = found.getParent();
+ if (p == null)
+ break;
+ else
+ found = p;
+ }
+ return found;
+ }
+
+ /**
+ * This is the method that gets called when the WHEN_IN_FOCUSED_WINDOW map
+ * is changed.
+ *
+ * @param changed the JComponent associated with the WHEN_IN_FOCUSED_WINDOW
+ * map
+ */
+ void updateComponentInputMap(ComponentInputMap changed)
+ {
+ // Since you can change a component's input map via
+ // setInputMap, we have to check if <code>changed</code>
+ // is still in our WHEN_IN_FOCUSED_WINDOW map hierarchy
+ InputMap curr = getInputMap(WHEN_IN_FOCUSED_WINDOW);
+ while (curr != null && curr != changed)
+ curr = curr.getParent();
+
+ // If curr is null then changed is not in the hierarchy
+ if (curr == null)
+ return;
+
+ // Now we have to update the keyboard manager's hashtable
+ KeyboardManager km = KeyboardManager.getManager();
+
+ // This is a poor strategy, should be improved. We currently
+ // delete all the old bindings for the component and then register
+ // the current bindings.
+ km.clearBindingsForComp(changed.getComponent());
+ km.registerEntireMap((ComponentInputMap)
+ getInputMap(WHEN_IN_FOCUSED_WINDOW));
}
}
diff --git a/libjava/classpath/javax/swing/JDesktopPane.java b/libjava/classpath/javax/swing/JDesktopPane.java
index f4c80eca7d6..43ab71e7e9f 100644
--- a/libjava/classpath/javax/swing/JDesktopPane.java
+++ b/libjava/classpath/javax/swing/JDesktopPane.java
@@ -97,6 +97,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible
*/
protected AccessibleJDesktopPane()
{
+ // Nothing to do here.
}
/**
@@ -246,6 +247,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible
}
catch (PropertyVetoException e)
{
+ // We do nothing when the attempt is vetoed.
}
}
selectedFrame = null;
@@ -259,6 +261,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible
}
catch (PropertyVetoException e)
{
+ // We do nothing when the attempt is vetoed.
}
}
diff --git a/libjava/classpath/javax/swing/JDialog.java b/libjava/classpath/javax/swing/JDialog.java
index 0f528ab1b45..b3f7c011f68 100644
--- a/libjava/classpath/javax/swing/JDialog.java
+++ b/libjava/classpath/javax/swing/JDialog.java
@@ -66,6 +66,21 @@ import javax.accessibility.AccessibleContext;
public class JDialog extends Dialog implements Accessible, WindowConstants,
RootPaneContainer
{
+ /**
+ * Provides accessibility support for <code>JDialog</code>s.
+ */
+ protected class AccessibleJDialog extends Dialog.AccessibleAWTDialog
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJDialog</code>.
+ */
+ public AccessibleJDialog()
+ {
+ super();
+ // Nothing to do here.
+ }
+ }
+
private static final long serialVersionUID = -864070866424508218L;
/** DOCUMENT ME! */
@@ -87,13 +102,6 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
/** Whether JDialogs are decorated by the Look and Feel. */
private static boolean decorated;
- /**
- * Whether we're in the init stage or not.
- * If so, adds and layouts are for top-level, otherwise they're for the
- * content pane
- */
- private boolean initStageDone = false;
-
/* Creates a new non-modal JDialog with no title
* using a shared Frame as the owner.
*/
@@ -244,7 +252,7 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
invalidate();
// Now that initStageDone is true, adds and layouts apply to contentPane,
// not top-level.
- initStageDone = true;
+ setRootPaneCheckingEnabled(true);
}
/**
@@ -315,13 +323,8 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane.
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set top-level layout. Use"
- + " getConentPane().setLayout instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -445,15 +448,10 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
{
// If we're adding in the initialization stage use super.add.
// Otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp, constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp, constraints, index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Do not add directly to JDialog."
- + " Use getContentPane().add instead.");
- getContentPane().add(comp, constraints, index);
- }
+ super.addImpl(comp, constraints, index);
}
/**
@@ -588,6 +586,8 @@ public class JDialog extends Dialog implements Accessible, WindowConstants,
*/
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJDialog();
+ return accessibleContext;
}
}
diff --git a/libjava/classpath/javax/swing/JEditorPane.java b/libjava/classpath/javax/swing/JEditorPane.java
index e2f1319a2a7..39f7c1f142f 100644
--- a/libjava/classpath/javax/swing/JEditorPane.java
+++ b/libjava/classpath/javax/swing/JEditorPane.java
@@ -41,15 +41,30 @@ package javax.swing;
import java.awt.Dimension;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
import java.net.URL;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleHyperlink;
+import javax.accessibility.AccessibleHypertext;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleText;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultEditorKit;
+import javax.swing.text.Document;
import javax.swing.text.EditorKit;
+import javax.swing.text.Element;
import javax.swing.text.JTextComponent;
+import javax.swing.text.View;
+import javax.swing.text.ViewFactory;
+import javax.swing.text.WrappedPlainView;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
/**
* A powerful text editor component that can handle different types of
@@ -76,6 +91,408 @@ import javax.swing.text.JTextComponent;
*/
public class JEditorPane extends JTextComponent
{
+ /**
+ * Provides accessibility support for <code>JEditorPane</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJEditorPane extends AccessibleJTextComponent
+ {
+
+ /**
+ * Creates a new <code>AccessibleJEditorPane</code> object.
+ */
+ protected AccessibleJEditorPane()
+ {
+ super();
+ }
+
+ /**
+ * Returns a description of this <code>AccessibleJEditorPane</code>. If
+ * this property is not set, then this returns the content-type of the
+ * editor pane.
+ *
+ * @return a description of this AccessibleJEditorPane
+ */
+ public String getAccessibleDescription()
+ {
+ String descr = super.getAccessibleDescription();
+ if (descr == null)
+ return getContentType();
+ else
+ return descr;
+ }
+
+ /**
+ * Returns the accessible state of this <code>AccessibleJEditorPane</code>.
+ *
+ * @return the accessible state of this <code>AccessibleJEditorPane</code>
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet state = super.getAccessibleStateSet();
+ // TODO: Figure out what state must be added here to the super's state.
+ return state;
+ }
+ }
+
+ /**
+ * Provides accessibility support for <code>JEditorPane</code>s, when the
+ * editor kit is an instance of {@link HTMLEditorKit}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJEditorPaneHTML extends AccessibleJEditorPane
+ {
+ /**
+ * Returns the accessible text of the <code>JEditorPane</code>. This will
+ * be an instance of
+ * {@link JEditorPaneAccessibleHypertextSupport}.
+ *
+ * @return the accessible text of the <code>JEditorPane</code>
+ */
+ public AccessibleText getAccessibleText()
+ {
+ return new JEditorPaneAccessibleHypertextSupport();
+ }
+ }
+
+ /**
+ * This is the accessible text that is returned by
+ * {@link AccessibleJEditorPaneHTML#getAccessibleText()}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class JEditorPaneAccessibleHypertextSupport
+ extends AccessibleJEditorPane implements AccessibleHypertext
+ {
+
+ /**
+ * The accessible representation of a HTML link.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class HTMLLink extends AccessibleHyperlink
+ {
+
+ /**
+ * The element in the document that represents the link.
+ */
+ Element element;
+
+ /**
+ * Creates a new <code>HTMLLink</code>.
+ *
+ * @param el the link element
+ */
+ public HTMLLink(Element el)
+ {
+ this.element = el;
+ }
+
+ /**
+ * Returns <code>true</code> if this <code>HTMLLink</code> is still
+ * valid. A <code>HTMLLink</code> can become invalid when the document
+ * changes.
+ *
+ * @return <code>true</code> if this <code>HTMLLink</code> is still
+ * valid
+ */
+ public boolean isValid()
+ {
+ // I test here if the element at our element's start offset is the
+ // same as the element in the document at this offset. If this is true,
+ // I consider the link valid, if not, then this link no longer
+ // represented by this HTMLLink and therefor invalid.
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ return doc.getCharacterElement(element.getStartOffset()) == element;
+ }
+
+ /**
+ * Returns the number of AccessibleActions in this link object. In
+ * general, link have 1 AccessibleAction associated with them. There are
+ * special cases where links can have multiple actions associated, like
+ * in image maps.
+ *
+ * @return the number of AccessibleActions in this link object
+ */
+ public int getAccessibleActionCount()
+ {
+ // TODO: Implement the special cases.
+ return 1;
+ }
+
+ /**
+ * Performs the specified action on the link object. This ususally means
+ * activating the link.
+ *
+ * @return <code>true</code> if the action has been performed
+ * successfully, <code>false</code> otherwise
+ */
+ public boolean doAccessibleAction(int i)
+ {
+ String href = (String) element.getAttributes().getAttribute("href");
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ try
+ {
+ URL url = new URL(doc.getBase(), href);
+ setPage(url);
+ String desc = doc.getText(element.getStartOffset(),
+ element.getEndOffset() - element.getStartOffset());
+ HyperlinkEvent ev =
+ new HyperlinkEvent(JEditorPane.this,
+ HyperlinkEvent.EventType.ACTIVATED, url, desc,
+ element);
+ fireHyperlinkUpdate(ev);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the description of the action at action index <code>i</code>.
+ * This method returns the text within the element associated with this
+ * link.
+ *
+ * @param i the action index
+ *
+ * @return the description of the action at action index <code>i</code>
+ */
+ public String getAccessibleActionDescription(int i)
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ try
+ {
+ return doc.getText(element.getStartOffset(),
+ element.getEndOffset() - element.getStartOffset());
+ }
+ catch (BadLocationException ex)
+ {
+ throw (AssertionError)
+ new AssertionError("BadLocationException must not be thrown "
+ + "here.")
+ .initCause(ex);
+ }
+ }
+
+ /**
+ * Returns an {@link URL} object, that represents the action at action
+ * index <code>i</code>.
+ *
+ * @param i the action index
+ *
+ * @return an {@link URL} object, that represents the action at action
+ * index <code>i</code>
+ */
+ public Object getAccessibleActionObject(int i)
+ {
+ String href = (String) element.getAttributes().getAttribute("href");
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ try
+ {
+ URL url = new URL(doc.getBase(), href);
+ return url;
+ }
+ catch (MalformedURLException ex)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Returns an object that represents the link anchor. For examples, if
+ * the link encloses a string, then a <code>String</code> object is
+ * returned, if the link encloses an &lt;img&gt; tag, then an
+ * <code>ImageIcon</code> object is returned.
+ *
+ * @return an object that represents the link anchor
+ */
+ public Object getAccessibleActionAnchor(int i)
+ {
+ // TODO: This is only the String case. Implement all cases.
+ return getAccessibleActionDescription(i);
+ }
+
+ /**
+ * Returns the start index of the hyperlink element.
+ *
+ * @return the start index of the hyperlink element
+ */
+ public int getStartIndex()
+ {
+ return element.getStartOffset();
+ }
+
+ /**
+ * Returns the end index of the hyperlink element.
+ *
+ * @return the end index of the hyperlink element
+ */
+ public int getEndIndex()
+ {
+ return element.getEndOffset();
+ }
+
+ }
+
+ /**
+ * Returns the number of hyperlinks in the document.
+ *
+ * @return the number of hyperlinks in the document
+ */
+ public int getLinkCount()
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+ int count = 0;
+ while (linkIter.isValid())
+ {
+ count++;
+ linkIter.next();
+ }
+ return count;
+ }
+
+ /**
+ * Returns the <code>i</code>-th hyperlink in the document or
+ * <code>null</code> if there is no hyperlink with the specified index.
+ *
+ * @param i the index of the hyperlink to return
+ *
+ * @return the <code>i</code>-th hyperlink in the document or
+ * <code>null</code> if there is no hyperlink with the specified
+ * index
+ */
+ public AccessibleHyperlink getLink(int i)
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+ int count = 0;
+ while (linkIter.isValid())
+ {
+ count++;
+ if (count == i)
+ break;
+ linkIter.next();
+ }
+ if (linkIter.isValid())
+ {
+ int offset = linkIter.getStartOffset();
+ // TODO: I fetch the element for the link via getCharacterElement().
+ // I am not sure that this is correct, maybe we must use
+ // getParagraphElement()?
+ Element el = doc.getCharacterElement(offset);
+ HTMLLink link = new HTMLLink(el);
+ return link;
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Returns the index of the link element at the character position
+ * <code>c</code> within the document, or <code>-1</code> if there is no
+ * link at the specified position.
+ *
+ * @param c the character index from which to fetch the link index
+ *
+ * @return the index of the link element at the character position
+ * <code>c</code> within the document, or <code>-1</code> if there
+ * is no link at the specified position
+ */
+ public int getLinkIndex(int c)
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+ int count = 0;
+ while (linkIter.isValid())
+ {
+ if (linkIter.getStartOffset() <= c && linkIter.getEndOffset() > c)
+ break;
+ count++;
+ linkIter.next();
+ }
+ if (linkIter.isValid())
+ return count;
+ else
+ return -1;
+ }
+
+ /**
+ * Returns the link text of the link at index <code>i</code>, or
+ * <code>null</code>, if there is no link at the specified position.
+ *
+ * @param i the index of the link
+ *
+ * @return the link text of the link at index <code>i</code>, or
+ * <code>null</code>, if there is no link at the specified
+ * position
+ */
+ public String getLinkText(int i)
+ {
+ HTMLDocument doc = (HTMLDocument) getDocument();
+ HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+ int count = 0;
+ while (linkIter.isValid())
+ {
+ count++;
+ if (count == i)
+ break;
+ linkIter.next();
+ }
+ if (linkIter.isValid())
+ {
+ int offset = linkIter.getStartOffset();
+ // TODO: I fetch the element for the link via getCharacterElement().
+ // I am not sure that this is correct, maybe we must use
+ // getParagraphElement()?
+ Element el = doc.getCharacterElement(offset);
+ try
+ {
+ String text = doc.getText(el.getStartOffset(),
+ el.getEndOffset() - el.getStartOffset());
+ return text;
+ }
+ catch (BadLocationException ex)
+ {
+ throw (AssertionError)
+ new AssertionError("BadLocationException must not be thrown "
+ + "here.")
+ .initCause(ex);
+ }
+ }
+ else
+ return null;
+ }
+ }
+
+ /**
+ * An EditorKit used for plain text. This is the default editor kit for
+ * JEditorPanes.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private static class PlainEditorKit extends DefaultEditorKit
+ {
+
+ /**
+ * Returns a ViewFactory that supplies WrappedPlainViews.
+ */
+ public ViewFactory getViewFactory()
+ {
+ return new ViewFactory()
+ {
+ public View create(Element el)
+ {
+ return new WrappedPlainView(el);
+ }
+ };
+ }
+ }
+
private static final long serialVersionUID = 3140472492599046285L;
private URL page;
@@ -107,12 +524,12 @@ public class JEditorPane extends JTextComponent
protected EditorKit createDefaultEditorKit()
{
- return new DefaultEditorKit();
+ return new PlainEditorKit();
}
public static EditorKit createEditorKitForContentType(String type)
{
- return new DefaultEditorKit();
+ return new PlainEditorKit();
}
/**
@@ -128,9 +545,21 @@ public class JEditorPane extends JTextComponent
listeners[index].hyperlinkUpdate(event);
}
+ /**
+ * Returns the accessible context associated with this editor pane.
+ *
+ * @return the accessible context associated with this editor pane
+ */
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ {
+ if (getEditorKit() instanceof HTMLEditorKit)
+ accessibleContext = new AccessibleJEditorPaneHTML();
+ else
+ accessibleContext = new AccessibleJEditorPane();
+ }
+ return accessibleContext;
}
public final String getContentType()
@@ -169,12 +598,18 @@ public class JEditorPane extends JTextComponent
public boolean getScrollableTracksViewportHeight()
{
- return false;
+ /* Container parent = getParent();
+ return (parent instanceof JViewport &&
+ parent.isValid());*/
+ return isValid();
}
public boolean getScrollableTracksViewportWidth()
{
- return false;
+ /*Container parent = getParent();
+ return (parent instanceof JViewport &&
+ parent.isValid());*/
+ return isValid();
}
public URL getPage()
@@ -211,9 +646,26 @@ public class JEditorPane extends JTextComponent
/**
* This method initializes from a stream.
*/
- public void read(InputStream in, Object desc)
- throws IOException
+ public void read(InputStream in, Object desc) throws IOException
{
+ EditorKit kit = getEditorKit();
+ if (kit instanceof HTMLEditorKit && desc instanceof HTMLDocument)
+ {
+ Document doc = (Document) desc;
+ try
+ {
+ kit.read(in, doc, 0);
+ }
+ catch (BadLocationException ex)
+ {
+ assert false : "BadLocationException must not be thrown here.";
+ }
+ }
+ else
+ {
+ Reader inRead = new InputStreamReader(in);
+ super.read(inRead, desc);
+ }
}
/**
@@ -222,6 +674,7 @@ public class JEditorPane extends JTextComponent
public static void registerEditorKitForContentType(String type,
String classname)
{
+ // TODO: Implement this properly.
}
/**
@@ -231,6 +684,7 @@ public class JEditorPane extends JTextComponent
String classname,
ClassLoader loader)
{
+ // TODO: Implement this properly.
}
/**
@@ -239,6 +693,7 @@ public class JEditorPane extends JTextComponent
*/
public void replaceSelection(String content)
{
+ // TODO: Implement this properly.
}
/**
@@ -247,6 +702,7 @@ public class JEditorPane extends JTextComponent
*/
public void scrollToReference(String reference)
{
+ // TODO: Implement this properly.
}
public final void setContentType(String type)
@@ -281,6 +737,8 @@ public class JEditorPane extends JTextComponent
firePropertyChange("editorKit", oldValue, newValue);
invalidate();
repaint();
+ // Reset the accessibleContext since this depends on the editorKit.
+ accessibleContext = null;
}
public void setEditorKitForContentType(String type, EditorKit k)
diff --git a/libjava/classpath/javax/swing/JFileChooser.java b/libjava/classpath/javax/swing/JFileChooser.java
index 7569061ab2e..1598641f1b9 100644
--- a/libjava/classpath/javax/swing/JFileChooser.java
+++ b/libjava/classpath/javax/swing/JFileChooser.java
@@ -42,10 +42,13 @@ import java.awt.Frame;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
import java.io.File;
import java.util.ArrayList;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.swing.JDialog;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileSystemView;
@@ -70,171 +73,324 @@ public class JFileChooser extends JComponent implements Accessible
{
private static final long serialVersionUID = 3162921138695327837L;
- /** DOCUMENT ME! */
+ /**
+ * A dialog type for selecting a file to open.
+ * @see #setDialogType(int)
+ */
public static final int OPEN_DIALOG = 0;
- /** DOCUMENT ME! */
+ /**
+ * A dialog type for selecting a file to save.
+ * @see #setDialogType(int)
+ */
public static final int SAVE_DIALOG = 1;
- /** DOCUMENT ME! */
+ /**
+ * A dialog type for some custom purpose.
+ * @see #setDialogType(int)
+ */
public static final int CUSTOM_DIALOG = 2;
- /** DOCUMENT ME! */
+ /**
+ * A return value indicating the file chooser has been closed by cancelling.
+ *
+ * @see #showOpenDialog(Component)
+ * @see #showSaveDialog(Component)
+ */
public static final int CANCEL_OPTION = 1;
- /** DOCUMENT ME! */
+ /**
+ * A return value indicating the file chooser has been closed by approving
+ * the selection.
+ * @see #showOpenDialog(Component)
+ * @see #showSaveDialog(Component)
+ */
public static final int APPROVE_OPTION = 0;
- /** DOCUMENT ME! */
+ /**
+ * A return value indicating the file chooser has been closed by some error.
+ * @see #showOpenDialog(Component)
+ * @see #showSaveDialog(Component)
+ */
public static final int ERROR_OPTION = -1;
- /** DOCUMENT ME! */
+ /**
+ * A selection mode constant indicating acceptance of files only.
+ * @see #setFileSelectionMode(int)
+ */
public static final int FILES_ONLY = 0;
- /** DOCUMENT ME! */
+ /**
+ * A selection mode constant indicating acceptance of directories only.
+ * @see #setFileSelectionMode(int)
+ */
public static final int DIRECTORIES_ONLY = 1;
- /** DOCUMENT ME! */
+ /**
+ * A selection mode constant indicating acceptance of files and directories.
+ * @see #setFileSelectionMode(int)
+ */
public static final int FILES_AND_DIRECTORIES = 2;
- /** DOCUMENT ME! */
+ /**
+ * Action command string for cancelling the current selection.
+ * @see #cancelSelection()
+ */
public static final String CANCEL_SELECTION = "CancelSelection";
- /** DOCUMENT ME! */
+ /**
+ * Action command string for approving the current selection.
+ * @see #cancelSelection()
+ */
public static final String APPROVE_SELECTION = "ApproveSelection";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the approve button text.
+ * @see #setApproveButtonText(String)
+ */
public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY =
"ApproveButtonTextChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the approve button tool tip text.
+ * @see #setApproveButtonToolTipText(String)
+ */
public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY =
"ApproveButtonToolTipTextChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the approve button mnemonic.
+ * @see #setApproveButtonMnemonic(int)
+ */
public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY =
"ApproveButtonMnemonicChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for control button visibility.
+ * @see #setControlButtonsAreShown(boolean)
+ */
public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY =
"ControlButtonsAreShownChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the current directory.
+ * @see #setCurrentDirectory(File)
+ */
public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the selected file.
+ * @see #setSelectedFile(File)
+ */
public static final String SELECTED_FILE_CHANGED_PROPERTY =
"SelectedFileChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for the selected files.
+ * @see #setSelectedFiles(File[])
+ */
public static final String SELECTED_FILES_CHANGED_PROPERTY =
"SelectedFilesChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the property for multi-selection.
+ * @see #setMultiSelectionEnabled(boolean)
+ */
public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY =
"MultiSelectionEnabledChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file system view' property.
+ * @see #setFileSystemView(FileSystemView)
+ */
public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY =
"FileSystemViewChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file view' property.
+ * @see #setFileView(FileView)
+ */
public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file hiding enabled' property.
+ * @see #setFileHidingEnabled(boolean)
+ */
public static final String FILE_HIDING_CHANGED_PROPERTY =
"FileHidingChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file filter' property.
+ * @see #setFileFilter(FileFilter)
+ */
public static final String FILE_FILTER_CHANGED_PROPERTY =
"fileFilterChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'file selection mode' property.
+ * @see #setFileSelectionMode(int)
+ */
public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY =
"fileSelectionChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'accessory' property.
+ * @see #setAccessory(JComponent)
+ */
public static final String ACCESSORY_CHANGED_PROPERTY =
"AccessoryChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'accept all file filter used' property.
+ * @see #setAcceptAllFileFilterUsed(boolean)
+ */
public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY =
"acceptAllFileFilterUsedChanged";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'dialog title' property.
+ * @see #setDialogTitle(String)
+ */
public static final String DIALOG_TITLE_CHANGED_PROPERTY =
"DialogTitleChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'dialog type' property.
+ * @see #setDialogType(int)
+ */
public static final String DIALOG_TYPE_CHANGED_PROPERTY =
"DialogTypeChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The name of the 'choosable file filters' property.
+ * @see #addChoosableFileFilter(FileFilter)
+ */
public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY =
"ChoosableFileFilterChangedProperty";
- /** DOCUMENT ME! */
+ /**
+ * The accessible context.
+ * @see #getAccessibleContext()
+ */
protected AccessibleContext accessibleContext;
- /** DOCUMENT ME! */
+ /**
+ * The file system view.
+ * @see #setFileSystemView(FileSystemView)
+ */
private FileSystemView fsv;
- /** DOCUMENT ME! */
+ /**
+ * The accessory component.
+ * @see #setAccessory(JComponent)
+ */
private JComponent accessory;
- /** DOCUMENT ME! */
+ /**
+ * The approve button mnemonic.
+ * @see #setApproveButtonMnemonic(int)
+ */
private int approveButtonMnemonic = 0;
- /** DOCUMENT ME! */
+ /**
+ * The approve button text.
+ * @see #setApproveButtonText(String)
+ */
private String approveButtonText;
- /** DOCUMENT ME! */
+ /**
+ * The approve button tool tip text.
+ * @see #setApproveButtonToolTipText(String)
+ */
private String approveButtonToolTipText;
- /** DOCUMENT ME! */
+ /**
+ * The choosable file filters.
+ * @see #addChoosableFileFilter(FileFilter)
+ */
private ArrayList choosableFilters = new ArrayList();
- /** DOCUMENT ME! */
+ /**
+ * A flag controlling whether the accept all file filter is used.
+ * @see #setAcceptAllFileFilterUsed(boolean)
+ */
private boolean isAcceptAll = true;
- /** DOCUMENT ME! */
+ /**
+ * The dialog title.
+ * @see #setDialogTitle(String)
+ */
private String dialogTitle;
- /** DOCUMENT ME! */
+ /**
+ * The dialog type.
+ * @see #setDialogType(int)
+ */
private int dialogType = OPEN_DIALOG;
- /** DOCUMENT ME! */
+ /**
+ * The return value for the dialog.
+ * @see #showOpenDialog(Component)
+ * @see #showSaveDialog(Component)
+ */
private int retval = ERROR_OPTION;
- /** DOCUMENT ME! */
+ /**
+ * A flag indicating whether the file chooser allows multiple selection.
+ * @see #isMultiSelectionEnabled()
+ */
private boolean multiSelection = false;
- /** DOCUMENT ME! */
+ /**
+ * A flag indicating whether file hiding is enabled.
+ * @see #isFileHidingEnabled()
+ */
private boolean fileHiding = true;
- /** DOCUMENT ME! */
+ /**
+ * The file selection mode.
+ * @see #setFileSelectionMode(int)
+ */
private int fileSelectionMode = FILES_AND_DIRECTORIES;
- /** DOCUMENT ME! */
+ /**
+ * The file view.
+ * @see #setFileView(FileView)
+ */
private FileView fv = null;
- /** DOCUMENT ME! */
+ /**
+ * A flag controlling whether or not the control buttons are visible.
+ * @see #setControlButtonsAreShown(boolean)
+ */
private boolean controlButtonsShown = true;
- /** DOCUMENT ME! */
+ /**
+ * The current directory.
+ * @see #setCurrentDirectory(File)
+ */
private File currentDir = null;
- /** DOCUMENT ME! */
+ /**
+ * The current file filter.
+ * @see #setFileFilter(FileFilter)
+ */
private FileFilter currentFilter = null;
- /** DOCUMENT ME! */
+ /**
+ * An array of selected files.
+ * @see #setSelectedFiles(File[])
+ */
private File[] selectedFiles;
- /** DOCUMENT ME! */
+ /**
+ * The selected file.
+ * @see #setSelectedFile(File)
+ */
private File selectedFile;
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*/
public JFileChooser()
{
@@ -243,9 +399,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*
- * @param currentDirectoryPath DOCUMENT ME!
+ * @param currentDirectoryPath the directory that should initially be
+ * shown in the filechooser (if <code>null</code>, the user's home
+ * directory is used).
*/
public JFileChooser(String currentDirectoryPath)
{
@@ -254,12 +412,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object with the specified directory and
- * FileSystemView.
+ * Creates a new <code>JFileChooser</code> object with the specified
+ * directory and {@link FileSystemView}.
*
- * @param currentDirectoryPath the directory that should initially be
- * shown the filechooser
- * @param fsv the FileSystemView object to use
+ * @param currentDirectoryPath the directory that should initially be
+ * shown in the filechooser (if <code>null</code>, the user's home
+ * directory is used).
+ * @param fsv the file system view (if <code>null</code>, the default file
+ * system view is used).
*/
public JFileChooser(String currentDirectoryPath, FileSystemView fsv)
{
@@ -268,9 +428,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*
- * @param currentDirectory DOCUMENT ME!
+ * @param currentDirectory the directory that should initially be
+ * shown in the filechooser (if <code>null</code>, the user's home
+ * directory is used).
*/
public JFileChooser(File currentDirectory)
{
@@ -279,9 +441,10 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*
- * @param fsv DOCUMENT ME!
+ * @param fsv the file system view (if <code>null</code>, the default file
+ * system view is used).
*/
public JFileChooser(FileSystemView fsv)
{
@@ -290,10 +453,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * Creates a new JFileChooser object.
+ * Creates a new <code>JFileChooser</code> object.
*
- * @param currentDirectory DOCUMENT ME!
- * @param fsv DOCUMENT ME!
+ * @param currentDirectory the directory that should initially be
+ * shown in the filechooser (if <code>null</code>, the user's home
+ * directory is used).
+ * @param fsv the file system view (if <code>null</code>, the default file
+ * system view is used).
*/
public JFileChooser(File currentDirectory, FileSystemView fsv)
{
@@ -302,9 +468,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets up the file chooser. This method is called by all the constructors.
*
- * @param view DOCUMENT ME!
+ * @param view the file system view (if <code>null</code>, the default file
+ * system view is used).
+ *
+ * @see FileSystemView#getFileSystemView()
*/
protected void setup(FileSystemView view)
{
@@ -336,9 +505,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the selected file, if there is one.
*
- * @return DOCUMENT ME!
+ * @return The selected file (possibly <code>null</code>).
+ *
+ * @see #setSelectedFile(File)
*/
public File getSelectedFile()
{
@@ -346,9 +517,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the selected file and sends a {@link PropertyChangeEvent} to all
+ * registered listeners. The property name is
+ * {@link #SELECTED_FILE_CHANGED_PROPERTY}.
*
- * @param file DOCUMENT ME!
+ * @param file the file (<code>null</code> permitted).
*/
public void setSelectedFile(File file)
{
@@ -361,9 +534,10 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the selected file or files.
*
- * @return DOCUMENT ME!
+ * @return An array of the selected files, or <code>null</code> if there are
+ * no selected files.
*/
public File[] getSelectedFiles()
{
@@ -375,9 +549,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the selected files and sends a {@link PropertyChangeEvent} (with the
+ * name {@link #SELECTED_FILES_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param selectedFiles DOCUMENT ME!
+ * @param selectedFiles the selected files (<code>null</code> permitted).
*/
public void setSelectedFiles(File[] selectedFiles)
{
@@ -393,9 +569,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the current directory.
*
- * @return DOCUMENT ME!
+ * @return The current directory.
*/
public File getCurrentDirectory()
{
@@ -403,9 +579,15 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the current directory and fires a {@link PropertyChangeEvent} (with
+ * the property name {@link #DIRECTORY_CHANGED_PROPERTY}) to all registered
+ * listeners. If <code>dir</code> is <code>null</code>, the current
+ * directory is set to the default directory returned by the file system
+ * view.
*
- * @param dir DOCUMENT ME!
+ * @param dir the new directory (<code>null</code> permitted).
+ *
+ * @see FileSystemView#getDefaultDirectory()
*/
public void setCurrentDirectory(File dir)
{
@@ -421,7 +603,7 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Called by the UI delegate when the parent directory is changed.
*/
public void changeToParentDirectory()
{
@@ -430,7 +612,7 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Rescans the current directory (this is handled by the UI delegate).
*/
public void rescanCurrentDirectory()
{
@@ -438,9 +620,10 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Ensures the the specified file is visible (this is handled by the
+ * UI delegate).
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*/
public void ensureFileIsVisible(File f)
{
@@ -448,11 +631,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Displays the file chooser in a modal dialog using the
+ * {@link #OPEN_DIALOG} type.
*
- * @param parent DOCUMENT ME!
+ * @param parent the parent component.
*
- * @return DOCUMENT ME!
+ * @return A return value indicating how the dialog was closed (one of
+ * {@link #APPROVE_OPTION}, {@link #CANCEL_OPTION} and
+ * {@link #ERROR_OPTION}).
*
* @throws HeadlessException DOCUMENT ME!
*/
@@ -472,11 +658,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Displays the file chooser in a modal dialog using the
+ * {@link #SAVE_DIALOG} type.
*
- * @param parent DOCUMENT ME!
+ * @param parent the parent component.
*
- * @return DOCUMENT ME!
+ * @return A return value indicating how the dialog was closed (one of
+ * {@link #APPROVE_OPTION}, {@link #CANCEL_OPTION} and
+ * {@link #ERROR_OPTION}).
*
* @throws HeadlessException DOCUMENT ME!
*/
@@ -493,12 +682,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Displays the file chooser in a modal dialog using the
+ * {@link #CUSTOM_DIALOG} type.
*
- * @param parent DOCUMENT ME!
- * @param approveButtonText DOCUMENT ME!
+ * @param parent the parent component.
*
- * @return DOCUMENT ME!
+ * @return A return value indicating how the dialog was closed (one of
+ * {@link #APPROVE_OPTION}, {@link #CANCEL_OPTION} and
+ * {@link #ERROR_OPTION}).
*
* @throws HeadlessException DOCUMENT ME!
*/
@@ -517,11 +708,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Creates a modal dialog in which to display the file chooser.
*
- * @param parent DOCUMENT ME!
+ * @param parent the parent component.
*
- * @return DOCUMENT ME!
+ * @return The dialog.
*
* @throws HeadlessException DOCUMENT ME!
*/
@@ -542,9 +733,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the flag that controls whether or not the control buttons are
+ * shown on the file chooser.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
+ *
+ * @see #setControlButtonsAreShown(boolean)
*/
public boolean getControlButtonsAreShown()
{
@@ -552,9 +746,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the flag that controls whether or not the control buttons are
+ * shown and, if it changes, sends a {@link PropertyChangeEvent} (with the
+ * property name {@link #CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY}) to
+ * all registered listeners.
*
- * @param b DOCUMENT ME!
+ * @param b the new value for the flag.
*/
public void setControlButtonsAreShown(boolean b)
{
@@ -567,9 +764,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the type of file chooser.
*
- * @return DOCUMENT ME!
+ * @return {@link #OPEN_DIALOG}, {@link #SAVE_DIALOG} or
+ * {@link #CUSTOM_DIALOG}.
+ *
+ * @see #setDialogType(int)
*/
public int getDialogType()
{
@@ -577,9 +777,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the dialog type and fires a {@link PropertyChangeEvent} (with the
+ * property name {@link #DIALOG_TYPE_CHANGED_PROPERTY}) to all
+ * registered listeners.
*
- * @param dialogType DOCUMENT ME!
+ * @param dialogType the dialog type (one of: {@link #OPEN_DIALOG},
+ * {@link #SAVE_DIALOG}, {@link #CUSTOM_DIALOG}).
+ *
+ * @throws IllegalArgumentException if <code>dialogType</code> is not valid.
*/
public void setDialogType(int dialogType)
{
@@ -596,9 +801,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the dialog title and sends a {@link PropertyChangeEvent} (with the
+ * property name {@link #DIALOG_TITLE_CHANGED_PROPERTY}) to all
+ * registered listeners.
*
- * @param dialogTitle DOCUMENT ME!
+ * @param dialogTitle the dialog title (<code>null</code> permitted).
+ *
+ * @see #getDialogTitle()
*/
public void setDialogTitle(String dialogTitle)
{
@@ -611,9 +820,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the dialog title.
*
- * @return DOCUMENT ME!
+ * @return The dialog title (possibly <code>null</code>).
+ *
+ * @see #setDialogTitle(String)
*/
public String getDialogTitle()
{
@@ -621,9 +832,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the tool tip text for the approve button and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY}) to all
+ * registered listeners.
*
- * @param toolTipText DOCUMENT ME!
+ * @param toolTipText the text.
*/
public void setApproveButtonToolTipText(String toolTipText)
{
@@ -637,9 +851,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the tool tip text for the approve button.
*
- * @return DOCUMENT ME!
+ * @return The tool tip text for the approve button.
+ *
+ * @see #setApproveButtonToolTipText(String)
*/
public String getApproveButtonToolTipText()
{
@@ -647,9 +863,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the approve button mnemonic, or zero if no mnemonic has been set.
*
- * @return DOCUMENT ME!
+ * @return The approve button mnemonic.
+ *
+ * @see #setApproveButtonMnemonic(int)
*/
public int getApproveButtonMnemonic()
{
@@ -657,9 +875,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the mnemonic for the approve button and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param mnemonic DOCUMENT ME!
+ * @param mnemonic the mnemonic.
+ *
+ * @see #setApproveButtonMnemonic(char)
*/
public void setApproveButtonMnemonic(int mnemonic)
{
@@ -673,9 +896,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the mnemonic for the approve button and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param mnemonic DOCUMENT ME!
+ * @param mnemonic the mnemonic.
+ *
+ * @see #setApproveButtonMnemonic(int)
*/
public void setApproveButtonMnemonic(char mnemonic)
{
@@ -683,9 +911,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the approve button text and fires a {@link PropertyChangeEvent}
+ * (with the property name {@link #APPROVE_BUTTON_TEXT_CHANGED_PROPERTY}) to
+ * all registered listeners.
*
- * @param approveButtonText DOCUMENT ME!
+ * @param approveButtonText the text (<code>null</code> permitted).
+ *
+ * @see #getApproveButtonText()
*/
public void setApproveButtonText(String approveButtonText)
{
@@ -699,9 +931,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the approve button text.
*
- * @return DOCUMENT ME!
+ * @return The approve button text (possibly <code>null</code>).
+ *
+ * @see #setApproveButtonText(String)
*/
public String getApproveButtonText()
{
@@ -709,19 +943,22 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the available file filters for this file chooser.
*
- * @return DOCUMENT ME!
+ * @return The available file filters.
*/
public FileFilter[] getChoosableFileFilters()
{
- return (FileFilter[]) choosableFilters.toArray(new FileFilter[0]);
+ return (FileFilter[]) choosableFilters.toArray(new FileFilter[choosableFilters.size()]);
}
/**
- * DOCUMENT ME!
+ * Adds a file filter to the list of available filters and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param filter DOCUMENT ME!
+ * @param filter the filter.
*/
public void addChoosableFileFilter(FileFilter filter)
{
@@ -732,11 +969,15 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Removes a file filter from the list of available filters and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param f DOCUMENT ME!
+ * @param f the file filter.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the filter was removed and
+ * <code>false</code> otherwise.
*/
public boolean removeChoosableFileFilter(FileFilter f)
{
@@ -749,7 +990,8 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Clears the list of choosable file filters and installs the 'accept all'
+ * filter from the UI delegate.
*/
public void resetChoosableFileFilters()
{
@@ -759,9 +1001,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the 'accept all' file filter from the UI delegate.
*
- * @return DOCUMENT ME!
+ * @return The 'accept all' file filter.
*/
public FileFilter getAcceptAllFileFilter()
{
@@ -769,9 +1011,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the flag that controls whether or not the 'accept all' file
+ * filter is included in the list of filters.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
+ *
+ * @see #setAcceptAllFileFilterUsed(boolean)
*/
public boolean isAcceptAllFileFilterUsed()
{
@@ -779,9 +1024,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the flag that controls whether or not the 'accept all' file filter
+ * is included in the list of filters, and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link #ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param b DOCUMENT ME!
+ * @param b the new value of the flag.
*/
public void setAcceptAllFileFilterUsed(boolean b)
{
@@ -794,9 +1043,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the accessory component for the file chooser. The default
+ * value is <code>null</code>.
*
- * @return DOCUMENT ME!
+ * @return The accessory component (possibly <code>null</code>).
+ *
+ * @see #setAccessory(JComponent)
*/
public JComponent getAccessory()
{
@@ -804,9 +1056,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the accessory component for the file chooser and sends a
+ * {@link PropertyChangeEvent} to all registered listeners. The property
+ * name is {@link #ACCESSORY_CHANGED_PROPERTY}.
*
- * @param newAccessory DOCUMENT ME!
+ * @param newAccessory the accessory component.
*/
public void setAccessory(JComponent newAccessory)
{
@@ -819,9 +1073,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the file selection mode and sends a {@link PropertyChangeEvent}
+ * to all registered listeners. The property name is
+ * {@link #FILE_SELECTION_MODE_CHANGED_PROPERTY}.
*
- * @param mode DOCUMENT ME!
+ * @param mode the mode ({@link #FILES_ONLY}, {@link #DIRECTORIES_ONLY} or
+ * {@link #FILES_AND_DIRECTORIES}).
+ *
+ * @throws IllegalArgumentException if the mode is invalid.
*/
public void setFileSelectionMode(int mode)
{
@@ -838,9 +1097,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the file selection mode, one of: {@link #FILES_ONLY},
+ * {@link #DIRECTORIES_ONLY} or {@link #FILES_AND_DIRECTORIES}. The
+ * default is {@link #FILES_ONLY}.
*
- * @return DOCUMENT ME!
+ * @return The file selection mode.
+ *
+ * @see #setFileSelectionMode(int)
*/
public int getFileSelectionMode()
{
@@ -848,9 +1111,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if file selection is enabled, and
+ * <code>false</code> otherwise. File selection is enabled when the
+ * file selection mode is {@link #FILES_ONLY} or
+ * {@link #FILES_AND_DIRECTORIES}.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if file selection is enabled.
+ *
+ * @see #getFileSelectionMode()
*/
public boolean isFileSelectionEnabled()
{
@@ -859,9 +1127,14 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if directory selection is enabled, and
+ * <code>false</code> otherwise. Directory selection is enabled when the
+ * file selection mode is {@link #DIRECTORIES_ONLY} or
+ * {@link #FILES_AND_DIRECTORIES}.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if file selection is enabled.
+ *
+ * @see #getFileSelectionMode()
*/
public boolean isDirectorySelectionEnabled()
{
@@ -870,9 +1143,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the flag that controls whether multiple selections are allowed in
+ * this filechooser and sends a {@link PropertyChangeEvent} (with the
+ * property name {@link #MULTI_SELECTION_ENABLED_CHANGED_PROPERTY}) to all
+ * registered listeners.
*
- * @param b DOCUMENT ME!
+ * @param b the new value of the flag.
*/
public void setMultiSelectionEnabled(boolean b)
{
@@ -885,9 +1161,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if multiple selections are allowed within this
+ * file chooser, and <code>false</code> otherwise.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
+ *
+ * @see #setMultiSelectionEnabled(boolean)
*/
public boolean isMultiSelectionEnabled()
{
@@ -895,9 +1174,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if hidden files are to be hidden, and
+ * <code>false</code> otherwise.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
+ *
+ * @see #setFileHidingEnabled(boolean)
*/
public boolean isFileHidingEnabled()
{
@@ -905,9 +1187,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the flag that controls whether or not hidden files are displayed,
+ * and sends a {@link PropertyChangeEvent} (with the property name
+ * {@link #FILE_HIDING_CHANGED_PROPERTY}) to all registered listeners.
*
- * @param b DOCUMENT ME!
+ * @param b the new value of the flag.
*/
public void setFileHidingEnabled(boolean b)
{
@@ -920,9 +1204,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the file filter and sends a {@link PropertyChangeEvent} (with the
+ * property name {@link #FILE_FILTER_CHANGED_PROPERTY}) to all registered
+ * listeners.
*
- * @param filter DOCUMENT ME!
+ * @param filter the filter.
*/
public void setFileFilter(FileFilter filter)
{
@@ -935,9 +1221,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the file filter.
*
- * @return DOCUMENT ME!
+ * @return The file filter.
+ *
+ * @see #setFileFilter(FileFilter)
*/
public FileFilter getFileFilter()
{
@@ -945,9 +1233,13 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets a custom {@link FileView} for the file chooser and sends a
+ * {@link PropertyChangeEvent} to all registered listeners. The property
+ * name is {@link #FILE_VIEW_CHANGED_PROPERTY}.
+ *
+ * @param fileView the file view (<code>null</code> permitted).
*
- * @param fileView DOCUMENT ME!
+ * @see #getFileView()
*/
public void setFileView(FileView fileView)
{
@@ -960,9 +1252,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the custom {@link FileView} for the file chooser.
*
- * @return DOCUMENT ME!
+ * @return The file view (possibly <code>null</code>).
*/
public FileView getFileView()
{
@@ -970,71 +1262,83 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the name of the file, generated by the current (or default)
+ * {@link FileView}.
*
- * @return DOCUMENT ME!
- */
- private FileView getInternalFileView()
- {
- if (fv == null)
- return getUI().getFileView(this);
- return fv;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return The file name.
*/
public String getName(File f)
{
- return getInternalFileView().getName(f);
+ String name = null;
+ if (fv != null)
+ name = fv.getName(f);
+ if (name == null)
+ name = getUI().getFileView(this).getName(f);
+ return name;
}
/**
- * DOCUMENT ME!
+ * Returns the description of the file, generated by the current (or default)
+ * {@link FileView}.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return The file description.
*/
public String getDescription(File f)
{
- return getInternalFileView().getDescription(f);
+ String result = null;
+ if (fv != null)
+ result = fv.getDescription(f);
+ if (result == null)
+ result = getUI().getFileView(this).getDescription(f);
+ return result;
}
/**
- * DOCUMENT ME!
+ * Returns the type description for the file, generated by the current (or
+ * default) {@link FileView}.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return The file type description.
*/
public String getTypeDescription(File f)
{
- return getInternalFileView().getTypeDescription(f);
+ String result = null;
+ if (fv != null)
+ result = getFileView().getTypeDescription(f);
+ if (result == null)
+ result = getUI().getFileView(this).getTypeDescription(f);
+ return result;
}
/**
- * DOCUMENT ME!
+ * Returns the icon provided by the current (or default) {@link FileView}.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return An icon representing the file.
*/
public Icon getIcon(File f)
{
- return getInternalFileView().getIcon(f);
+ Icon result = null;
+ if (fv != null)
+ result = fv.getIcon(f);
+ if (result == null)
+ result = getUI().getFileView(this).getIcon(f);
+ return result;
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the file is traversable, and
+ * <code>false</code> otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file or directory.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
*/
public boolean isTraversable(File f)
{
@@ -1042,11 +1346,12 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the file is accepted by the current
+ * file filter.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
*/
public boolean accept(File f)
{
@@ -1056,9 +1361,10 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sets the file system view for the file chooser and sends a
+ * {@link PropertyChangeEvent} to all registered listeners.
*
- * @param fsv DOCUMENT ME!
+ * @param fsv the file system view.
*/
public void setFileSystemView(FileSystemView fsv)
{
@@ -1071,9 +1377,11 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the file system view being used by this file chooser.
*
- * @return DOCUMENT ME!
+ * @return The file system view.
+ *
+ * @see #setFileSystemView(FileSystemView)
*/
public FileSystemView getFileSystemView()
{
@@ -1081,7 +1389,8 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Approves the selection. An {@link ActionEvent} is sent to all registered
+ * listeners.
*/
public void approveSelection()
{
@@ -1090,7 +1399,8 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Cancels the selection. An {@link ActionEvent} is sent to all registered
+ * listeners.
*/
public void cancelSelection()
{
@@ -1099,9 +1409,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Adds an {@link ActionListener} to the file chooser.
*
- * @param l DOCUMENT ME!
+ * @param l the listener.
*/
public void addActionListener(ActionListener l)
{
@@ -1109,9 +1419,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Removes an {@link ActionListener} from this file chooser.
*
- * @param l DOCUMENT ME!
+ * @param l the listener.
*/
public void removeActionListener(ActionListener l)
{
@@ -1126,9 +1436,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the action listeners registered with this file chooser.
*
- * @return DOCUMENT ME!
+ * @return An array of listeners.
*/
public ActionListener[] getActionListeners()
{
@@ -1136,9 +1446,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Sends an @link {ActionEvent} to all registered listeners.
*
- * @param command DOCUMENT ME!
+ * @param command the action command.
*/
protected void fireActionPerformed(String command)
{
@@ -1151,7 +1461,7 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Installs the UI delegate for the current look and feel.
*/
public void updateUI()
{
@@ -1160,9 +1470,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the UI delegate class identifier.
*
- * @return DOCUMENT ME!
+ * @return <code>FileChooserUI</code>.
*/
public String getUIClassID()
{
@@ -1170,9 +1480,9 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the UI delegate for the component.
*
- * @return DOCUMENT ME!
+ * @return The UI delegate.
*/
public FileChooserUI getUI()
{
@@ -1190,12 +1500,29 @@ public class JFileChooser extends JComponent implements Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the accessible context.
*
- * @return DOCUMENT ME!
+ * @return The accessible context.
*/
public AccessibleContext getAccessibleContext()
{
- return null;
+ return new AccessibleJFileChooser();
+ }
+
+ /**
+ * Accessibility support for JFileChooser
+ */
+ protected class AccessibleJFileChooser
+ extends JComponent.AccessibleJComponent
+ {
+ protected AccessibleJFileChooser()
+ {
+ // Nothing to do here.
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.FILE_CHOOSER;
+ }
}
}
diff --git a/libjava/classpath/javax/swing/JFrame.java b/libjava/classpath/javax/swing/JFrame.java
index 7081f5980e4..8d4dcb53b3c 100644
--- a/libjava/classpath/javax/swing/JFrame.java
+++ b/libjava/classpath/javax/swing/JFrame.java
@@ -50,6 +50,7 @@ import java.awt.LayoutManager;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
/**
@@ -65,8 +66,31 @@ import javax.accessibility.AccessibleContext;
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
public class JFrame extends Frame
- implements WindowConstants, RootPaneContainer
+ implements WindowConstants, RootPaneContainer, Accessible
{
+ /**
+ * Provides accessibility support for <code>JFrame</code>s.
+ */
+ protected class AccessibleJFrame extends Frame.AccessibleAWTFrame
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJFrame</code>.
+ */
+ public AccessibleJFrame()
+ {
+ super();
+ // Nothing to do here.
+ }
+ }
+
+ /**
+ * A flag for {@link #setDefaultCloseOperation(int)}, indicating that the
+ * application should be exited, when this <code>JFrame</code> is closed.
+ *
+ * @since 1.3
+ */
+ public static final int EXIT_ON_CLOSE = 3;
+
private static final long serialVersionUID = -3362141868504252139L;
private static boolean defaultLookAndFeelDecorated;
private int close_action = HIDE_ON_CLOSE;
@@ -78,13 +102,6 @@ public class JFrame extends Frame
*/
protected boolean rootPaneCheckingEnabled = false;
- /**
- * Tells us if we're in the initialization stage.
- * If so, adds go to top-level Container, otherwise they go
- * to the content pane for this container.
- */
- private boolean initStageDone = false;
-
public JFrame()
{
super("JFrame");
@@ -134,7 +151,7 @@ public class JFrame extends Frame
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
getRootPane(); // will do set/create
// We're now done the init stage.
- initStageDone = true;
+ setRootPaneCheckingEnabled(true);
}
public Dimension getPreferredSize()
@@ -156,13 +173,8 @@ public class JFrame extends Frame
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane.
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set layout. Use getContentPane().setLayout()"
- + " instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -222,15 +234,10 @@ public class JFrame extends Frame
{
// If we're adding in the initialization stage use super.add.
// Otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp, constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp,constraints,index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("rootPaneChecking is enabled - adding components "
- + "disallowed.");
- getContentPane().add(comp,constraints,index);
- }
+ super.addImpl(comp, constraints, index);
}
public void remove(Component comp)
@@ -275,6 +282,8 @@ public class JFrame extends Frame
public AccessibleContext getAccessibleContext()
{
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJFrame();
return accessibleContext;
}
diff --git a/libjava/classpath/javax/swing/JInternalFrame.java b/libjava/classpath/javax/swing/JInternalFrame.java
index b504aaaa5e3..479294b1377 100644
--- a/libjava/classpath/javax/swing/JInternalFrame.java
+++ b/libjava/classpath/javax/swing/JInternalFrame.java
@@ -437,13 +437,6 @@ public class JInternalFrame extends JComponent implements Accessible,
*/
protected boolean rootPaneCheckingEnabled = false;
- /**
- * Tells us if we're in the initialization stage.
- * If so, adds go to top-level Container, otherwise they go
- * to the content pane for this container.
- */
- private boolean initStageDone = false;
-
/** Whether the JInternalFrame is resizable. */
protected boolean resizable;
@@ -567,7 +560,7 @@ public class JInternalFrame extends JComponent implements Accessible,
storedBounds = new Rectangle();
setRootPane(createRootPane());
updateUI();
- initStageDone = true; // Done the init stage, now adds go to content pane.
+ setRootPaneCheckingEnabled(true); // Done the init stage, now adds go to content pane.
}
/**
@@ -587,15 +580,10 @@ public class JInternalFrame extends JComponent implements Accessible,
// If we're in the initialization stage use super.add. Here we add the
// rootPane as well as the title bar and other stuff.
// Otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp,constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp, constraints, index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Do not use add() on JInternalFrame directly. Use "
- + "getContentPane().add() instead");
- getContentPane().add(comp, constraints, index);
- }
+ super.addImpl(comp,constraints, index);
}
/**
@@ -1187,7 +1175,7 @@ public class JInternalFrame extends JComponent implements Accessible,
*/
protected String paramString()
{
- return "JInternalFrame";
+ return super.paramString();
}
/**
@@ -1227,8 +1215,7 @@ public class JInternalFrame extends JComponent implements Accessible,
public void reshape(int x, int y, int width, int height)
{
super.reshape(x, y, width, height);
- invalidate();
- doLayout();
+ revalidate();
}
/**
@@ -1489,13 +1476,8 @@ public class JInternalFrame extends JComponent implements Accessible,
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane.
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set layout. Use getContentPane().setLayout()"
- + " instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -1678,7 +1660,12 @@ public class JInternalFrame extends JComponent implements Accessible,
*/
public void setUI(InternalFrameUI ui)
{
+ // We must temporarily go into init mode so that the UI can directly
+ // manipulate the JInternalFrame.
+ boolean old = isRootPaneCheckingEnabled();
+ setRootPaneCheckingEnabled(false);
super.setUI(ui);
+ setRootPaneCheckingEnabled(old);
}
/**
@@ -1704,7 +1691,13 @@ public class JInternalFrame extends JComponent implements Accessible,
*/
public void updateUI()
{
+ // We must go into the init stage when updating the UI, so the UI can
+ // set layout and components directly on the internal frame, not its
+ // content pane.
+ boolean old = isRootPaneCheckingEnabled();
+ setRootPaneCheckingEnabled(false);
setUI((InternalFrameUI) UIManager.getUI(this));
+ setRootPaneCheckingEnabled(old);
}
/**
diff --git a/libjava/classpath/javax/swing/JLabel.java b/libjava/classpath/javax/swing/JLabel.java
index 2e7ad98ddae..a9adc96b2f4 100644
--- a/libjava/classpath/javax/swing/JLabel.java
+++ b/libjava/classpath/javax/swing/JLabel.java
@@ -331,9 +331,6 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
/** The gap between the icon and the text. */
private transient int iconTextGap = 4;
- /** The accessible context for this JLabel. */
- private AccessibleJLabel accessibleContext;
-
/**
* Creates a new vertically centered, horizontally on the leading edge
* JLabel object with text and no icon.
@@ -403,6 +400,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
this.text = text;
this.icon = icon;
this.horizontalAlignment = horizontalAlignment;
+ setAlignmentX(0.0F);
updateUI();
}
@@ -477,12 +475,14 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
{
if (text != newText)
{
- String oldText = text;
- text = newText;
- firePropertyChange("text", oldText, newText);
-
- if (text != null && text.length() <= displayedMnemonicIndex)
- setDisplayedMnemonicIndex(text.length() - 1);
+ String oldText = text;
+ text = newText;
+ firePropertyChange("text", oldText, newText);
+
+ if (text != null && text.length() <= displayedMnemonicIndex)
+ setDisplayedMnemonicIndex(text.length() - 1);
+ revalidate();
+ repaint();
}
}
diff --git a/libjava/classpath/javax/swing/JLayeredPane.java b/libjava/classpath/javax/swing/JLayeredPane.java
index 1ea39dc5007..346570d95b1 100644
--- a/libjava/classpath/javax/swing/JLayeredPane.java
+++ b/libjava/classpath/javax/swing/JLayeredPane.java
@@ -38,14 +38,20 @@ exception statement from your version. */
package javax.swing;
+import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
/**
* A container that adds depth to the usual <code>Container</code> semantics.
@@ -116,6 +122,30 @@ import javax.accessibility.Accessible;
*/
public class JLayeredPane extends JComponent implements Accessible
{
+
+ /**
+ * Provides accessibility support for <code>JLayeredPane</code>.
+ */
+ protected class AccessibleJLayeredPane extends AccessibleJComponent
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJLayeredPane</code>.
+ */
+ public AccessibleJLayeredPane()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the accessble role of <code>JLayeredPane</code>,
+ * {@link AccessibleRole#LAYERED_PANE}.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LAYERED_PANE;
+ }
+ }
+
private static final long serialVersionUID = 5534920399324590459L;
public static final String LAYER_PROPERTY = "layeredContainerLayer";
@@ -131,13 +161,15 @@ public class JLayeredPane extends JComponent implements Accessible
TreeMap layers; // Layer Number (Integer) -> Layer Size (Integer)
Hashtable componentToLayer; // Component -> Layer Number (Integer)
+ private transient Rectangle rectCache;
+
public JLayeredPane()
{
layers = new TreeMap ();
componentToLayer = new Hashtable ();
+ setLayout(null);
}
-
/**
* Looks up the layer a child component is currently assigned to.
*
@@ -223,29 +255,37 @@ public class JLayeredPane extends JComponent implements Accessible
ret[1] = getComponents ().length;
Iterator i = layers.entrySet ().iterator ();
while (i.hasNext())
- {
+ {
Map.Entry pair = (Map.Entry) i.next();
Integer layerNum = (Integer) pair.getKey ();
Integer layerSz = (Integer) pair.getValue ();
- if (layerNum.intValue() == layer.intValue())
+ int layerInt = layerNum.intValue();
+ if (layerInt == layer.intValue())
{
ret[0] = ret[1] - layerSz.intValue ();
- return ret;
+ break;
+ }
+ // In the following case there exists no layer with the specified
+ // number, so we return an empty interval here with the index at which
+ // such a layer would be inserted
+ else if (layerInt > layer.intValue())
+ {
+ ret[1] = ret[0];
+ break;
}
else
{
ret[1] -= layerSz.intValue ();
}
- }
- // should have found the layer during iteration
- throw new IllegalArgumentException ();
+ }
+ return ret;
}
/**
* Increments the recorded size of a given layer.
*
* @param layer the layer number to increment.
- * @see #incrLayer()
+ * @see #incrLayer
*/
private void incrLayer(Integer layer)
{
@@ -259,7 +299,7 @@ public class JLayeredPane extends JComponent implements Accessible
* Decrements the recorded size of a given layer.
*
* @param layer the layer number to decrement.
- * @see #decrLayer()
+ * @see #incrLayer
*/
private void decrLayer(Integer layer)
{
@@ -546,26 +586,15 @@ public class JLayeredPane extends JComponent implements Accessible
*
* @param index the index of the child component to remove.
*/
- public void remove (int index)
+ public void remove(int index)
{
- Component c = getComponent (index);
- int layer = getLayer (c);
- decrLayer (new Integer(layer));
- componentToLayer.remove (c);
- super.remove (index);
+ Component c = getComponent(index);
+ int layer = getLayer(c);
+ decrLayer(new Integer(layer));
+ componentToLayer.remove(c);
+ super.remove(index);
+ // FIXME: Figure out if this call is correct.
revalidate();
- repaint();
- }
-
- /**
- * Removes a child from this container. The child is specified directly.
- * After removal, the child no longer occupies a layer.
- *
- * @param comp the child to remove.
- */
- public void remove (Component comp)
- {
- remove (getIndexOf (comp));
}
/**
@@ -613,7 +642,7 @@ public class JLayeredPane extends JComponent implements Accessible
* @param index an ignored parameter, for compatibility.
*/
protected void addImpl(Component comp, Object layerConstraint, int index)
- {
+ {
Integer layer;
if (layerConstraint != null && layerConstraint instanceof Integer)
layer = (Integer) layerConstraint;
@@ -627,10 +656,8 @@ public class JLayeredPane extends JComponent implements Accessible
componentToLayer.put (comp, layer);
incrLayer (layer);
- super.addImpl(comp, null, newIdx);
- revalidate();
- repaint();
- }
+ super.addImpl(comp, null, newIdx);
+ }
/**
* Sets the layer property for a JComponent.
@@ -642,4 +669,50 @@ public class JLayeredPane extends JComponent implements Accessible
{
getLayeredPaneAbove(component).setLayer(component, layer);
}
+
+ /**
+ * Returns the accessible context for this <code>JLayeredPane</code>.
+ *
+ * @return the accessible context for this <code>JLayeredPane</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJLayeredPane();
+ return accessibleContext;
+ }
+
+ /**
+ * This method is overridden order to provide a reasonable painting
+ * mechanism for <code>JLayeredPane</code>. This is necessary since
+ * <code>JLayeredPane</code>'s do not have an own UI delegate.
+ *
+ * Basically this method clears the background for the
+ * <code>JLayeredPane</code> and then calls <code>super.paint(g)</code>.
+ *
+ * @param g the graphics context to use
+ */
+ public void paint(Graphics g)
+ {
+ if (isOpaque())
+ {
+ Color oldColor = g.getColor();
+ Rectangle clip = g.getClipBounds();
+ g.setColor(getBackground());
+ g.fillRect(clip.x, clip.y, clip.width, clip.height);
+ g.setColor(oldColor);
+ }
+ super.paint(g);
+ }
+
+ /**
+ * Overridden to return <code>false</code>, since <code>JLayeredPane</code>
+ * cannot guarantee that its children don't overlap.
+ *
+ * @return <code>false</code>
+ */
+ public boolean isOptimizedDrawingEnabled()
+ {
+ return false;
+ }
}
diff --git a/libjava/classpath/javax/swing/JList.java b/libjava/classpath/javax/swing/JList.java
index 92fe1ccfa67..caa7f310ea8 100644
--- a/libjava/classpath/javax/swing/JList.java
+++ b/libjava/classpath/javax/swing/JList.java
@@ -41,13 +41,25 @@ package javax.swing;
import java.awt.Color;
import java.awt.Component;
import java.awt.ComponentOrientation;
+import java.awt.Cursor;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.FocusListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Locale;
import java.util.Vector;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
@@ -108,6 +120,736 @@ import javax.swing.text.Position;
public class JList extends JComponent implements Accessible, Scrollable
{
+
+ /**
+ * Provides accessibility support for <code>JList</code>.
+ */
+ protected class AccessibleJList extends AccessibleJComponent
+ implements AccessibleSelection, PropertyChangeListener,
+ ListSelectionListener, ListDataListener
+ {
+
+ /**
+ * Provides accessibility support for list elements in <code>JList</code>s.
+ */
+ protected class AccessibleJListChild extends AccessibleContext
+ implements Accessible, AccessibleComponent
+ {
+
+ /**
+ * The parent list.
+ */
+ JList parent;
+
+ /**
+ * The index in the list for that child.
+ */
+ int listIndex;
+
+ /**
+ * The cursor for this list child.
+ */
+ // TODO: Testcases show that this class somehow stores state about the
+ // cursor. I cannot make up though how that could affect
+ // the actual list.
+ Cursor cursor = Cursor.getDefaultCursor();
+
+ /**
+ * Creates a new instance of <code>AccessibleJListChild</code>.
+ *
+ * @param list the list of which this is an accessible child
+ * @param index the list index for this child
+ */
+ public AccessibleJListChild(JList list, int index)
+ {
+ parent = list;
+ listIndex = index;
+ }
+
+ /**
+ * Returns the accessible context of this object. Returns
+ * <code>this</code> since <code>AccessibleJListChild</code>s are their
+ * own accessible contexts.
+ *
+ * @return the accessible context of this object, <code>this</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the background color for this list child. This returns the
+ * background of the <code>JList</code> itself since the background
+ * cannot be set on list children individually
+ *
+ * @return the background color for this list child
+ */
+ public Color getBackground()
+ {
+ return parent.getBackground();
+ }
+
+ /**
+ * Calling this method has no effect, since the background color cannot be
+ * set on list children individually.
+ *
+ * @param color not used here.
+ */
+ public void setBackground(Color color)
+ {
+ // Calling this method has no effect, since the background color cannot
+ // be set on list children individually.
+ }
+
+ /**
+ * Returns the foreground color for this list child. This returns the
+ * background of the <code>JList</code> itself since the foreground
+ * cannot be set on list children individually.
+ *
+ * @return the background color for this list child
+ */
+ public Color getForeground()
+ {
+ return parent.getForeground();
+ }
+
+ /**
+ * Calling this method has no effect, since the foreground color cannot be
+ * set on list children individually.
+ *
+ * @param color not used here.
+ */
+ public void setForeground(Color color)
+ {
+ // Calling this method has no effect, since the foreground color cannot
+ // be set on list children individually.
+ }
+
+ /**
+ * Returns the cursor for this list child.
+ *
+ * @return the cursor for this list child
+ */
+ public Cursor getCursor()
+ {
+ // TODO: Testcases show that this method returns the cursor that has
+ // been set by setCursor. I cannot make up though how that could affect
+ // the actual list.
+ return cursor;
+ }
+
+ /**
+ * Sets the cursor for this list child.
+ */
+ public void setCursor(Cursor cursor)
+ {
+ this.cursor = cursor;
+ // TODO: Testcases show that this method returns the cursor that has
+ // been set by setCursor. I cannot make up though how that could affect
+ // the actual list.
+ }
+
+ /**
+ * Returns the font of the <code>JList</code> since it is not possible to
+ * set fonts for list children individually.
+ *
+ * @return the font of the <code>JList</code>
+ */
+ public Font getFont()
+ {
+ return parent.getFont();
+ }
+
+ /**
+ * Does nothing since it is not possible to set the font on list children
+ * individually.
+ *
+ * @param font not used here
+ */
+ public void setFont(Font font)
+ {
+ // Does nothing since it is not possible to set the font on list
+ // children individually.
+ }
+
+ /**
+ * Returns the font metrics for the specified font. This method forwards
+ * to the parent <code>JList</code>.
+ *
+ * @param font the font for which the font metrics is queried
+ *
+ * @return the font metrics for the specified font
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ return parent.getFontMetrics(font);
+ }
+
+ /**
+ * Returns <code>true</code> if the parent <code>JList</code> is enabled,
+ * <code>false</code> otherwise. The list children cannot have an enabled
+ * flag set individually.
+ *
+ * @return <code>true</code> if the parent <code>JList</code> is enabled,
+ * <code>false</code> otherwise
+ */
+ public boolean isEnabled()
+ {
+ return parent.isEnabled();
+ }
+
+ /**
+ * Does nothing since the enabled flag cannot be set for list children
+ * individually.
+ *
+ * @param b not used here
+ */
+ public void setEnabled(boolean b)
+ {
+ // Does nothing since the enabled flag cannot be set for list children
+ // individually.
+ }
+
+ /**
+ * Returns <code>true</code> if this list child is visible,
+ * <code>false</code> otherwise. The value of this property depends
+ * on {@link JList#getFirstVisibleIndex()} and
+ * {@link JList#getLastVisibleIndex()}.
+ *
+ * @return <code>true</code> if this list child is visible,
+ * <code>false</code> otherwise
+ */
+ public boolean isVisible()
+ {
+ return listIndex >= parent.getFirstVisibleIndex()
+ && listIndex <= parent.getLastVisibleIndex();
+ }
+
+ /**
+ * The value of the visible property cannot be modified, so this method
+ * does nothing.
+ *
+ * @param b not used here
+ */
+ public void setVisible(boolean b)
+ {
+ // The value of the visible property cannot be modified, so this method
+ // does nothing.
+ }
+
+ /**
+ * Returns <code>true</code> if this list child is currently showing on
+ * screen and <code>false</code> otherwise. The list child is showing if
+ * it is visible and if it's parent JList is currently showing.
+ *
+ * @return <code>true</code> if this list child is currently showing on
+ * screen and <code>false</code> otherwise
+ */
+ public boolean isShowing()
+ {
+ return isVisible() && parent.isShowing();
+ }
+
+ /**
+ * Returns <code>true</code> if this list child covers the screen location
+ * <code>point</code> (relative to the <code>JList</code> coordinate
+ * system, <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this list child covers the screen location
+ * <code>point</code> , <code>false</code> otherwise
+ */
+ public boolean contains(Point point)
+ {
+ return getBounds().contains(point);
+ }
+
+ /**
+ * Returns the absolute screen location of this list child.
+ *
+ * @return the absolute screen location of this list child
+ */
+ public Point getLocationOnScreen()
+ {
+ Point loc = getLocation();
+ SwingUtilities.convertPointToScreen(loc, parent);
+ return loc;
+ }
+
+ /**
+ * Returns the screen location of this list child relative to it's parent.
+ *
+ * @return the location of this list child relative to it's parent
+ *
+ * @see JList#indexToLocation(int)
+ */
+ public Point getLocation()
+ {
+ return parent.indexToLocation(listIndex);
+ }
+
+ /**
+ * Does nothing since the screen location cannot be set on list children
+ * explictitly.
+ *
+ * @param point not used here
+ */
+ public void setLocation(Point point)
+ {
+ // Does nothing since the screen location cannot be set on list children
+ // explictitly.
+ }
+
+ /**
+ * Returns the bounds of this list child.
+ *
+ * @return the bounds of this list child
+ *
+ * @see JList#getCellBounds(int, int)
+ */
+ public Rectangle getBounds()
+ {
+ return parent.getCellBounds(listIndex, listIndex);
+ }
+
+ /**
+ * Does nothing since the bounds cannot be set on list children
+ * individually.
+ *
+ * @param rectangle not used here
+ */
+ public void setBounds(Rectangle rectangle)
+ {
+ // Does nothing since the bounds cannot be set on list children
+ // individually.
+ }
+
+ /**
+ * Returns the size of this list child.
+ *
+ * @return the size of this list child
+ */
+ public Dimension getSize()
+ {
+ Rectangle b = getBounds();
+ return b.getSize();
+ }
+
+ /**
+ * Does nothing since the size cannot be set on list children
+ * individually.
+ *
+ * @param dimension not used here
+ */
+ public void setSize(Dimension dimension)
+ {
+ // Does nothing since the size cannot be set on list children
+ // individually.
+ }
+
+ /**
+ * Returns <code>null</code> because list children do not have children
+ * themselves
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleAt(Point point)
+ {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> since list children are focus traversable.
+ *
+ * @return true
+ */
+ public boolean isFocusTraversable()
+ {
+ // TODO: Is this 100% ok?
+ return true;
+ }
+
+ /**
+ * Requests focus on the parent list. List children cannot request focus
+ * individually.
+ */
+ public void requestFocus()
+ {
+ // TODO: Is this 100% ok?
+ parent.requestFocus();
+ }
+
+ /**
+ * Adds a focus listener to the parent list. List children do not have
+ * their own focus management.
+ *
+ * @param listener the focus listener to add
+ */
+ public void addFocusListener(FocusListener listener)
+ {
+ // TODO: Is this 100% ok?
+ parent.addFocusListener(listener);
+ }
+
+ /**
+ * Removes a focus listener from the parent list. List children do not
+ * have their own focus management.
+ *
+ * @param listener the focus listener to remove
+ */
+ public void removeFocusListener(FocusListener listener)
+ {
+ // TODO: Is this 100%
+ parent.removeFocusListener(listener);
+ }
+
+ /**
+ * Returns the accessible role of this list item, which is
+ * {@link AccessibleRole#LABEL}.
+ *
+ * @return {@link AccessibleRole#LABEL}
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LABEL;
+ }
+
+ /**
+ * Returns the accessible state set of this list item.
+ *
+ * @return the accessible state set of this list item
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet states = new AccessibleStateSet();
+ if (isVisible())
+ states.add(AccessibleState.VISIBLE);
+ if (isShowing())
+ states.add(AccessibleState.SHOWING);
+ if (isFocusTraversable())
+ states.add(AccessibleState.FOCUSABLE);
+ // TODO: How should the active state be handled? The API docs
+ // suggest that this state is set on the activated list child,
+ // that is the one that is drawn with a box. However, I don't know how
+ // to implement this.
+
+ // TODO: We set the selectable state here because list children are
+ // selectable. Is there a way to disable single children?
+ if (parent.isEnabled())
+ states.add(AccessibleState.SELECTABLE);
+
+ if (parent.isSelectedIndex(listIndex))
+ states.add(AccessibleState.SELECTED);
+
+ // TODO: Handle more states here?
+ return states;
+ }
+
+ /**
+ * Returns the index of this list child within it's parent list.
+ *
+ * @return the index of this list child within it's parent list
+ */
+ public int getAccessibleIndexInParent()
+ {
+ return listIndex;
+ }
+
+ /**
+ * Returns <code>0</code> since list children don't have children
+ * themselves.
+ *
+ * @return <code>0</code>
+ */
+ public int getAccessibleChildrenCount()
+ {
+ return 0;
+ }
+
+ /**
+ * Returns <code>null</code> since list children don't have children
+ * themselves.
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the locale of this component. This call is forwarded to the
+ * parent list since list children don't have a separate locale setting.
+ *
+ * @return the locale of this component
+ */
+ public Locale getLocale()
+ {
+ return parent.getLocale();
+ }
+
+ /**
+ * This method does
+ * nothing, list children are transient accessible objects which means
+ * that they don't fire property change events.
+ *
+ * @param l not used here
+ */
+ public void addPropertyChangeListener(PropertyChangeListener l)
+ {
+ // Do nothing here.
+ }
+
+ /**
+ * This method does
+ * nothing, list children are transient accessible objects which means
+ * that they don't fire property change events.
+ *
+ * @param l not used here
+ */
+ public void removePropertyChangeListener(PropertyChangeListener l)
+ {
+ // Do nothing here.
+ }
+
+ // TODO: Implement the remaining methods of this class.
+ }
+
+ /**
+ * Create a new AccessibleJList.
+ */
+ public AccessibleJList()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the number of selected accessible children.
+ *
+ * @return the number of selected accessible children
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return getSelectedIndices().length;
+ }
+
+ /**
+ * Returns the n-th selected accessible child.
+ *
+ * @param n the index of the selected child to return
+ *
+ * @return the n-th selected accessible child
+ */
+ public Accessible getAccessibleSelection(int n)
+ {
+ return new AccessibleJListChild(JList.this, getSelectedIndices()[n]);
+ }
+
+ /**
+ * Returns <code>true</code> if the n-th child is selected,
+ * <code>false</code> otherwise.
+ *
+ * @param n the index of the child of which the selected state is queried
+ *
+ * @return <code>true</code> if the n-th child is selected,
+ * <code>false</code> otherwise
+ */
+ public boolean isAccessibleChildSelected(int n)
+ {
+ return isSelectedIndex(n);
+ }
+
+ /**
+ * Adds the accessible item with the specified index to the selected items.
+ * If multiple selections are supported, the item is added to the selection,
+ * otherwise the item replaces the current selection.
+ *
+ * @param i the index of the item to add to the selection
+ */
+ public void addAccessibleSelection(int i)
+ {
+ addSelectionInterval(i, i);
+ }
+
+ /**
+ * Removes the accessible item with the specified index to the selection.
+ *
+ * @param i the index of the item to be removed from the selection
+ */
+ public void removeAccessibleSelection(int i)
+ {
+ removeSelectionInterval(i, i);
+ }
+
+ /**
+ * Remove all selection items from the selection.
+ */
+ public void clearAccessibleSelection()
+ {
+ clearSelection();
+ }
+
+ /**
+ * Selects all items if multiple selections are supported.
+ * Otherwise do nothing.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ addSelectionInterval(0, getModel().getSize());
+ }
+
+ /**
+ * Receices notification when the list selection is changed. This method
+ * fires two property change events, the first with
+ * {@link AccessibleContext#ACCESSIBLE_VISIBLE_DATA_PROPERTY} and the second
+ * with {@link AccessibleContext#ACCESSIBLE_SELECTION_PROPERTY}.
+ *
+ * @param event the list selection event
+ */
+ public void valueChanged(ListSelectionEvent event)
+ {
+ firePropertyChange(ACCESSIBLE_VISIBLE_DATA_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ firePropertyChange(ACCESSIBLE_SELECTION_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ }
+
+ /**
+ * Receives notification when items have changed in the
+ * <code>JList</code>. This method fires a property change event with
+ * {@link AccessibleContext#ACCESSIBLE_VISIBLE_DATA_PROPERTY}.
+ *
+ * @param event the list data event
+ */
+ public void contentsChanged(ListDataEvent event)
+ {
+ firePropertyChange(ACCESSIBLE_VISIBLE_DATA_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ }
+
+ /**
+ * Receives notification when items are inserted into the
+ * <code>JList</code>. This method fires a property change event with
+ * {@link AccessibleContext#ACCESSIBLE_VISIBLE_DATA_PROPERTY}.
+ *
+ * @param event the list data event
+ */
+ public void intervalAdded(ListDataEvent event)
+ {
+ firePropertyChange(ACCESSIBLE_VISIBLE_DATA_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ }
+
+ /**
+ * Receives notification when items are removed from the
+ * <code>JList</code>. This method fires a property change event with
+ * {@link AccessibleContext#ACCESSIBLE_VISIBLE_DATA_PROPERTY}.
+ *
+ * @param event the list data event
+ */
+ public void intervalRemoved(ListDataEvent event)
+ {
+ firePropertyChange(ACCESSIBLE_VISIBLE_DATA_PROPERTY, Boolean.FALSE,
+ Boolean.TRUE);
+ }
+
+
+ /**
+ * Receives notification about changes of the <code>JList</code>'s
+ * properties. This is used to re-register this object as listener to
+ * the data model and selection model when the data model or selection model
+ * changes.
+ *
+ * @param e the property change event
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ String propertyName = e.getPropertyName();
+ if (propertyName.equals("model"))
+ {
+ ListModel oldModel = (ListModel) e.getOldValue();
+ oldModel.removeListDataListener(this);
+ ListModel newModel = (ListModel) e.getNewValue();
+ newModel.addListDataListener(this);
+ }
+ else if (propertyName.equals("selectionModel"))
+ {
+ ListSelectionModel oldModel = (ListSelectionModel) e.getOldValue();
+ oldModel.removeListSelectionListener(this);
+ ListSelectionModel newModel = (ListSelectionModel) e.getNewValue();
+ oldModel.addListSelectionListener(this);
+ }
+ }
+
+ /**
+ * Return the state set of the <code>JList</code>.
+ *
+ * @return the state set of the <code>JList</code>
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ // TODO: Figure out if there is possibly more state that must be
+ // handled here.
+ AccessibleStateSet s = super.getAccessibleStateSet();
+ if (getSelectionMode() != ListSelectionModel.SINGLE_SELECTION)
+ s.add(AccessibleState.MULTISELECTABLE);
+ return s;
+ }
+
+ /**
+ * Returns the accessible role for <code>JList</code>,
+ * {@link AccessibleRole#LIST}.
+ *
+ * @return the accessible role for <code>JList</code>
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LIST;
+ }
+
+ /**
+ * Returns the accessible child at the visual location <code>p</code>
+ * (relative to the upper left corner of the <code>JList</code>). If there
+ * is no child at that location, this returns <code>null</code>.
+ *
+ * @param p the screen location for which to return the accessible child
+ *
+ * @return the accessible child at the specified location, or
+ * <code>null</code> if there is no child at that location
+ */
+ public Accessible getAccessibleAt(Point p)
+ {
+ int childIndex = locationToIndex(p);
+ return getAccessibleChild(childIndex);
+ }
+
+ /**
+ * Returns the number of accessible children in the <code>JList</code>.
+ *
+ * @return the number of accessible children in the <code>JList</code>
+ */
+ public int getAccessibleChildrenCount()
+ {
+ return getModel().getSize();
+ }
+
+ /**
+ * Returns the n-th accessible child of this <code>JList</code>. This will
+ * be an instance of {@link AccessibleJListChild}. If there is no child
+ * at that index, <code>null</code> is returned.
+ *
+ * @param n the index of the child to return
+ *
+ * @return the n-th accessible child of this <code>JList</code>
+ */
+ public Accessible getAccessibleChild(int n)
+ {
+ if (getModel().getSize() <= n)
+ return null;
+ return new AccessibleJListChild(JList.this, n);
+ }
+ }
+
private static final long serialVersionUID = 4406629526391098046L;
/**
@@ -181,7 +923,7 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* This property specifies a foreground color for the selected cells in
- * the list. When {@link ListCellRenderer.getListCellRendererComponent}
+ * the list. When {@link ListCellRenderer#getListCellRendererComponent}
* is called with a selected cell object, the component returned will
* have its "foreground" set to this color.
*/
@@ -189,7 +931,7 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* This property specifies a background color for the selected cells in
- * the list. When {@link ListCellRenderer.getListCellRendererComponent}
+ * the list. When {@link ListCellRenderer#getListCellRendererComponent}
* is called with a selected cell object, the component returned will
* have its "background" property set to this color.
*/
@@ -216,9 +958,9 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* This property indicates a <em>preference</em> for the number of rows
* displayed in the list, and will scale the
- * {@link #preferredScrollableViewportSize} property accordingly. The actual
+ * {@link #getPreferredScrollableViewportSize} property accordingly. The actual
* number of displayed rows, when the list is placed in a real {@link
- * Viewport} or other component, may be greater or less than this number.
+ * JViewport} or other component, may be greater or less than this number.
*/
int visibleRowCount;
@@ -270,7 +1012,7 @@ public class JList extends JComponent implements Accessible, Scrollable
event.getValueIsAdjusting());
JList.this.repaint();
}
- };
+ }
/**
* Shared ListListener instance, subscribed to both the current {@link
@@ -437,7 +1179,7 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* Sets the value of the {@link #visibleRowCount} property.
*
- * @param visibleRowCount The new property value
+ * @param vc The new property value
*/
public void setVisibleRowCount(int vc)
{
@@ -563,8 +1305,8 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
* Returns the list index of the upper left or upper right corner of the
- * {@link #visibleRect} property, depending on the {@link
- * #componentOrientation} property.
+ * visible rectangle of this list, depending on the {@link
+ * Component#getComponentOrientation} property.
*
* @return The index of the first visible list cell, or <code>-1</code>
* if none is visible.
@@ -580,12 +1322,17 @@ public class JList extends JComponent implements Accessible, Scrollable
/**
- * Returns index of the cell to which specified location is closest to
+ * Returns index of the cell to which specified location is closest to. If
+ * the location is outside the bounds of the list, then the greatest index
+ * in the list model is returned. If the list model is empty, then
+ * <code>-1</code> is returned.
+ *
* @param location for which to look for in the list
*
* @return index of the cell to which specified location is closest to.
*/
- public int locationToIndex(Point location) {
+ public int locationToIndex(Point location)
+ {
return getUI().locationToIndex(this, location);
}
@@ -595,14 +1342,15 @@ public class JList extends JComponent implements Accessible, Scrollable
*
* @return location of the cell located at the specified index in the list.
*/
- public Point indexToLocation(int index){
- return getCellBounds(index, index).getLocation();
+ public Point indexToLocation(int index)
+ {
+ return getUI().indexToLocation(this, index);
}
/**
* Returns the list index of the lower right or lower left corner of the
- * {@link #visibleRect} property, depending on the {@link
- * #componentOrientation} property.
+ * visible rectangle of this list, depending on the {@link
+ * Component#getComponentOrientation} property.
*
* @return The index of the last visible list cell, or <code>-1</code>
* if none is visible.
@@ -625,7 +1373,7 @@ public class JList extends JComponent implements Accessible, Scrollable
* selected.
*
* @return An array of model indices, each of which is selected according
- * to the {@link #selection} property
+ * to the {@link #getSelectedValues} property
*/
public int[] getSelectedIndices()
{
@@ -640,7 +1388,7 @@ public class JList extends JComponent implements Accessible, Scrollable
n++;
int [] v = new int[n];
j = 0;
- for (i = lo; i < hi; ++i)
+ for (i = lo; i <= hi; ++i)
if (selectionModel.isSelectedIndex(i))
v[j++] = i;
return v;
@@ -670,7 +1418,7 @@ public class JList extends JComponent implements Accessible, Scrollable
* @return The first selected element, or <code>null</code> if no element
* is selected.
*
- * @see getSelectedValues
+ * @see #getSelectedValues
*/
public Object getSelectedValue()
{
@@ -686,7 +1434,7 @@ public class JList extends JComponent implements Accessible, Scrollable
*
* @return An array containing all the selected values
*
- * @see getSelectedValue
+ * @see #setSelectedValue
*/
public Object[] getSelectedValues()
{
@@ -845,7 +1593,7 @@ public class JList extends JComponent implements Accessible, Scrollable
}
/**
- * Sets the value of the {@link #celLRenderer} property.
+ * Sets the value of the {@link #getCellRenderer} property.
*
* @param renderer The new property value
*/
@@ -876,10 +1624,15 @@ public class JList extends JComponent implements Accessible, Scrollable
* #listListener} is unsubscribed from the existing model, if it exists,
* and re-subscribed to the new model.
*
- * @param model The new property value
+ * @param model the new model (<code>null</code> not permitted).
+ *
+ * @throws IllegalArgumentException if <code>model</code> is
+ * <code>null</code>.
*/
public void setModel(ListModel model)
{
+ if (model == null)
+ throw new IllegalArgumentException("Null 'model' argument.");
if (this.model == model)
return;
@@ -1019,14 +1772,14 @@ public class JList extends JComponent implements Accessible, Scrollable
public AccessibleContext getAccessibleContext()
{
- return null;
+ return new AccessibleJList();
}
/**
* Returns a size indicating how much space this list would like to
* consume, when contained in a scrollable viewport. This is part of the
* {@link Scrollable} interface, which interacts with {@link
- * ScrollPaneLayout} and {@link Viewport} to define scrollable objects.
+ * ScrollPaneLayout} and {@link JViewport} to define scrollable objects.
*
* @return The preferred size
*/
@@ -1036,36 +1789,43 @@ public class JList extends JComponent implements Accessible, Scrollable
//return the value from getPreferredSize. The current ListUI is
//expected to override getPreferredSize to return an appropriate value.
if (getLayoutOrientation() != VERTICAL)
- return getPreferredSize();
+ return getPreferredSize();
+
+ int size = getModel().getSize();
+ // Trivial case: if fixedCellWidth and fixedCellHeight were set
+ // just use them
if (fixedCellHeight != -1 && fixedCellWidth != -1)
- return new Dimension(fixedCellWidth, getModel().getSize() *
- fixedCellHeight);
+ return new Dimension(fixedCellWidth, size * fixedCellHeight);
+
+ // If the model is empty we use 16 * the number of visible rows
+ // for the height and either fixedCellWidth (if set) or 256
+ // for the width
+ if (size == 0)
+ {
+ if (fixedCellWidth == -1)
+ return new Dimension(256, 16 * getVisibleRowCount());
+ else
+ return new Dimension(fixedCellWidth, 16 * getVisibleRowCount());
+ }
- int prefWidth, prefHeight;
+ // Calculate the width: if fixedCellWidth was set use that, otherwise
+ // use the preferredWidth
+ int prefWidth;
if (fixedCellWidth != -1)
prefWidth = fixedCellWidth;
else
- {
- prefWidth = 0;
- int size = getModel().getSize();
- for (int i = 0; i < size; i++)
- if (getCellBounds(i, i).width > prefWidth)
- prefWidth = getCellBounds(i, i).width;
- }
-
- if (getModel().getSize() == 0 && fixedCellWidth == -1)
- return new Dimension(256, 16 * getVisibleRowCount());
- else if (getModel().getSize() == 0)
- return new Dimension (fixedCellWidth, 16 * getVisibleRowCount());
-
+ prefWidth = getPreferredSize().width;
+
+ // Calculate the height: if fixedCellHeight was set use that, otherwise
+ // use the height of the first row multiplied by the number of visible
+ // rows
+ int prefHeight;
if (fixedCellHeight != -1)
prefHeight = fixedCellHeight;
else
- {
- prefHeight = getVisibleRowCount() * getCellBounds
- (getFirstVisibleIndex(), getFirstVisibleIndex()).height;
- }
+ prefHeight = getVisibleRowCount() * getCellBounds(0, 0).height;
+
return new Dimension (prefWidth, prefHeight);
}
@@ -1196,7 +1956,7 @@ public class JList extends JComponent implements Accessible, Scrollable
}
/**
- * Gets the value of the {@link #scrollableTracksViewportWidth} property.
+ * Gets the value of the <code>scrollableTracksViewportWidth</code> property.
*
* @return <code>true</code> if the viewport is larger (horizontally)
* than the list and the list should be expanded to fit the viewport;
@@ -1221,7 +1981,7 @@ public class JList extends JComponent implements Accessible, Scrollable
}
/**
- * Gets the value of the {@link #scrollableTracksViewportWidth} property.
+ * Gets the value of the </code>scrollableTracksViewportWidth</code> property.
*
* @return <code>true</code> if the viewport is larger (vertically)
* than the list and the list should be expanded to fit the viewport;
@@ -1373,7 +2133,7 @@ public class JList extends JComponent implements Accessible, Scrollable
*/
public Rectangle getCellBounds(int index0, int index1)
{
- return ((ListUI) ui).getCellBounds(this, index0, index1);
+ return getUI().getCellBounds(this, index0, index1);
}
/**
@@ -1383,8 +2143,8 @@ public class JList extends JComponent implements Accessible, Scrollable
*
* @param prefix the prefix to search for in the cell values
* @param startIndex the index where to start searching from
- * @param bias the search direction, either {@link Position.Bias.Forward}
- * or {@link Position.Bias.Backward}
+ * @param bias the search direction, either {@link Position.Bias#Forward}
+ * or {@link Position.Bias#Backward}
*
* @return the index of the found element or -1 if no such element has
* been found
diff --git a/libjava/classpath/javax/swing/JMenu.java b/libjava/classpath/javax/swing/JMenu.java
index 8dcad8b77cd..369c44d40c6 100644
--- a/libjava/classpath/javax/swing/JMenu.java
+++ b/libjava/classpath/javax/swing/JMenu.java
@@ -45,8 +45,6 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.EventListener;
@@ -98,6 +96,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
public JMenu()
{
super();
+ setOpaque(false);
}
/**
@@ -109,6 +108,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
{
super(text);
popupMenu.setInvoker(this);
+ setOpaque(false);
}
/**
@@ -122,6 +122,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
super(action);
createActionChangeListener(this);
popupMenu.setInvoker(this);
+ setOpaque(false);
}
/**
@@ -137,10 +138,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
this(text);
}
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* Adds specified menu item to this menu
*
@@ -768,6 +765,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
*/
protected void processKeyEvent(KeyEvent event)
{
+ // TODO: Implement this properly.
}
/**
@@ -812,6 +810,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
return accessibleContext;
}
+ // FIXME: This inner class is a complete stub and needs to be implemented.
protected class AccessibleJMenu extends AccessibleJMenuItem
implements AccessibleSelection
{
@@ -819,6 +818,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
protected AccessibleJMenu()
{
+ // Nothing to do here.
}
public int getAccessibleChildrenCount()
@@ -858,32 +858,48 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
public void addAccessibleSelection(int value0)
{
+ // TODO: Implement this properly.
}
public void removeAccessibleSelection(int value0)
{
+ // TODO: Implement this properly.
}
public void clearAccessibleSelection()
{
+ // TODO: Implement this properly.
}
public void selectAllAccessibleSelection()
{
+ // TODO: Implement this properly.
}
}
protected class WinListener extends WindowAdapter implements Serializable
{
- JPopupMenu popupMenu;
private static final long serialVersionUID = -6415815570638474823L;
+ /**
+ * Creates a new <code>WinListener</code>.
+ *
+ * @param popup the popup menu which is observed
+ */
public WinListener(JPopupMenu popup)
{
+ // TODO: What should we do with the popup argument?
}
+ /**
+ * Receives notification when the popup menu is closing and deselects
+ * the menu.
+ *
+ * @param event the window event
+ */
public void windowClosing(WindowEvent event)
{
+ setSelected(false);
}
}
diff --git a/libjava/classpath/javax/swing/JMenuBar.java b/libjava/classpath/javax/swing/JMenuBar.java
index eebb1a050be..f018daabf80 100644
--- a/libjava/classpath/javax/swing/JMenuBar.java
+++ b/libjava/classpath/javax/swing/JMenuBar.java
@@ -46,6 +46,9 @@ import java.awt.event.MouseEvent;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleStateSet;
import javax.swing.plaf.MenuBarUI;
/**
@@ -59,6 +62,137 @@ import javax.swing.plaf.MenuBarUI;
*/
public class JMenuBar extends JComponent implements Accessible, MenuElement
{
+ /**
+ * Provides accessibility support for <code>JMenuBar</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJMenuBar extends AccessibleJComponent
+ implements AccessibleSelection
+ {
+
+ /**
+ * Returns the number of selected items in the menu bar. Possible values
+ * are <code>0</code> if nothing is selected, or <code>1</code> if one
+ * item is selected.
+ *
+ * @return the number of selected items in the menu bar
+ */
+ public int getAccessibleSelectionCount()
+ {
+ int count = 0;
+ if (getSelectionModel().getSelectedIndex() != -1)
+ count = 1;
+ return count;
+ }
+
+ /**
+ * Returns the selected with index <code>i</code> menu, or
+ * <code>null</code> if the specified menu is not selected.
+ *
+ * @param i the index of the menu to return
+ *
+ * @return the selected with index <code>i</code> menu, or
+ * <code>null</code> if the specified menu is not selected
+ */
+ public Accessible getAccessibleSelection(int i)
+ {
+ if (getSelectionModel().getSelectedIndex() != i)
+ return null;
+ return getMenu(i);
+ }
+
+ /**
+ * Returns <code>true</code> if the specified menu is selected,
+ * <code>false</code> otherwise.
+ *
+ * @param i the index of the menu to check
+ *
+ *@return <code>true</code> if the specified menu is selected,
+ * <code>false</code> otherwise
+ */
+ public boolean isAccessibleChildSelected(int i)
+ {
+ return getSelectionModel().getSelectedIndex() == i;
+ }
+
+ /**
+ * Selects the menu with index <code>i</code>. If another menu is already
+ * selected, this will be deselected.
+ *
+ * @param i the menu to be selected
+ */
+ public void addAccessibleSelection(int i)
+ {
+ getSelectionModel().setSelectedIndex(i);
+ }
+
+ /**
+ * Deselects the menu with index <code>i</code>.
+ *
+ * @param i the menu index to be deselected
+ */
+ public void removeAccessibleSelection(int i)
+ {
+ if (getSelectionModel().getSelectedIndex() == i)
+ getSelectionModel().clearSelection();
+ }
+
+ /**
+ * Deselects all possibly selected menus.
+ */
+ public void clearAccessibleSelection()
+ {
+ getSelectionModel().clearSelection();
+ }
+
+ /**
+ * In menu bars it is not possible to select all items, so this method
+ * does nothing.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ // In menu bars it is not possible to select all items, so this method
+ // does nothing.
+ }
+
+ /**
+ * Returns the accessible role of <code>JMenuBar</code>, which is
+ * {@link AccessibleRole#MENU_BAR}.
+ *
+ * @return the accessible role of <code>JMenuBar</code>, which is
+ * {@link AccessibleRole#MENU_BAR}
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.MENU_BAR;
+ }
+
+ /**
+ * Returns the <code>AccessibleSelection</code> for this object. This
+ * method returns <code>this</code>, since the
+ * <code>AccessibleJMenuBar</code> manages its selection itself.
+ *
+ * @return the <code>AccessibleSelection</code> for this object
+ */
+ public AccessibleSelection getAccessibleSelection()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the state of this <code>AccessibleJMenuBar</code>.
+ *
+ * @return the state of this <code>AccessibleJMenuBar</code>.
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet stateSet = super.getAccessibleStateSet();
+ // TODO: Figure out what state must be added to the super state set.
+ return stateSet;
+ }
+ }
+
private static final long serialVersionUID = -8191026883931977036L;
/** JMenuBar's model. It keeps track of selected menu's index */
@@ -100,13 +234,15 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
*/
public void addNotify()
{
- // FIXME: Should register this menu bar with the keyboard manager
super.addNotify();
+ KeyboardManager.getManager().registerJMenuBar(this);
}
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJMenuBar();
+ return accessibleContext;
}
/**
@@ -253,7 +389,7 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
* This method returns a name to identify which look and feel class will be
* the UI delegate for the menu bar.
*
- * @return The Look and Feel classID. "MenuItemUI"
+ * @return The Look and Feel classID. "MenuBarUI"
*/
public String getUIClassID()
{
@@ -338,6 +474,63 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
}
/**
+ * This method overrides JComponent.processKeyBinding to allow the
+ * JMenuBar to check all the child components (recursiveley) to see
+ * if they'll consume the event.
+ *
+ * @param ks the KeyStroke for the event
+ * @param e the KeyEvent for the event
+ * @param condition the focus condition for the binding
+ * @param pressed true if the key is pressed
+ */
+ protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition,
+ boolean pressed)
+ {
+ // See if the regular JComponent behavior consumes the event
+ if (super.processKeyBinding(ks, e, condition, pressed))
+ return true;
+
+ // If not, have to recursively check all the child menu elements to see
+ // if they want it
+ MenuElement[] children = getSubElements();
+ for (int i = 0; i < children.length; i++)
+ if (processKeyBindingHelper(children[i], ks, e, condition, pressed))
+ return true;
+ return false;
+ }
+
+ /**
+ * This is a helper method to recursively check the children of this
+ * JMenuBar to see if they will consume a key event via key bindings.
+ * This is used for menu accelerators.
+ * @param menuElement the menuElement to check (and check all its children)
+ * @param ks the KeyStroke for the event
+ * @param e the KeyEvent that may be consumed
+ * @param condition the focus condition for the binding
+ * @param pressed true if the key was pressed
+ * @return true <code>menuElement</code> or one of its children consume
+ * the event (processKeyBinding returns true for menuElement or one of
+ * its children).
+ */
+ static boolean processKeyBindingHelper(MenuElement menuElement, KeyStroke ks,
+ KeyEvent e, int condition,
+ boolean pressed)
+ {
+ // First check the menuElement itself, if it's a JComponent
+ if (menuElement instanceof JComponent
+ && ((JComponent) menuElement).processKeyBinding(ks, e, condition,
+ pressed))
+ return true;
+
+ // If that didn't consume it, check all the children recursively
+ MenuElement[] children = menuElement.getSubElements();
+ for (int i = 0; i < children.length; i++)
+ if (processKeyBindingHelper(children[i], ks, e, condition, pressed))
+ return true;
+ return false;
+ }
+
+ /**
* Process mouse events forwarded from MenuSelectionManager. This method
* doesn't do anything. It is here to conform to the MenuElement interface.
*
@@ -358,7 +551,7 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
*/
public void removeNotify()
{
- // Must unregister this menu bar with the current keyboard manager.
+ KeyboardManager.getManager().unregisterJMenuBar(this);
super.removeNotify();
}
@@ -384,9 +577,14 @@ public class JMenuBar extends JComponent implements Accessible, MenuElement
* Sets help menu for this menu bar
*
* @param menu help menu
+ *
+ * @specnote The specification states that this method is not yet implemented
+ * and should throw an exception.
*/
public void setHelpMenu(JMenu menu)
{
+ // We throw an Error here, just as Sun's JDK does.
+ throw new Error("setHelpMenu() not yet implemented.");
}
/**
diff --git a/libjava/classpath/javax/swing/JMenuItem.java b/libjava/classpath/javax/swing/JMenuItem.java
index 069b7bc86f8..c87a4dc2b20 100644
--- a/libjava/classpath/javax/swing/JMenuItem.java
+++ b/libjava/classpath/javax/swing/JMenuItem.java
@@ -44,9 +44,6 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.util.EventListener;
import javax.accessibility.Accessible;
@@ -84,6 +81,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
public JMenuItem()
{
super();
+ init(null, null);
}
/**
@@ -118,6 +116,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
{
super();
super.setAction(action);
+ init(null, null);
}
/**
@@ -147,15 +146,6 @@ public class JMenuItem extends AbstractButton implements Accessible,
setMnemonic(mnemonic);
}
- private void readObject(ObjectInputStream stream)
- throws IOException, ClassNotFoundException
- {
- }
-
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* Initializes this menu item
*
@@ -176,7 +166,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
//borderPainted = false;
focusPainted = false;
horizontalAlignment = JButton.LEFT;
- horizontalTextPosition = JButton.LEFT;
+ horizontalTextPosition = JButton.TRAILING;
}
/**
@@ -189,7 +179,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
{
super.setUI(ui);
}
-
+
/**
* This method sets this menuItem's UI to the UIManager's default for the
* current look and feel.
@@ -255,13 +245,18 @@ public class JMenuItem extends AbstractButton implements Accessible,
}
/**
- * Sets accelerator for this menu item.
- *
+ * Sets the key combination which invokes the menu item's action
+ * listeners without navigating the menu hierarchy. Note that when the
+ * keyboard accelerator is typed, it will work whether or not the
+ * menu is currently displayed.
+ *
* @param keystroke accelerator for this menu item.
*/
public void setAccelerator(KeyStroke keystroke)
{
+ KeyStroke old = this.accelerator;
this.accelerator = keystroke;
+ firePropertyChange ("accelerator", old, keystroke);
}
/**
@@ -276,7 +271,11 @@ public class JMenuItem extends AbstractButton implements Accessible,
super.configurePropertiesFromAction(action);
if (! (this instanceof JMenu) && action != null)
- setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY)));
+ {
+ setAccelerator((KeyStroke) (action.getValue(Action.ACCELERATOR_KEY)));
+ super.registerKeyboardAction(action, accelerator,
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+ }
}
/**
@@ -667,6 +666,7 @@ public class JMenuItem extends AbstractButton implements Accessible,
public void stateChanged(ChangeEvent event)
{
+ // TODO: What should be done here, if anything?
}
public AccessibleRole getAccessibleRole()
diff --git a/libjava/classpath/javax/swing/JOptionPane.java b/libjava/classpath/javax/swing/JOptionPane.java
index ad0772ab8d3..057326cd209 100644
--- a/libjava/classpath/javax/swing/JOptionPane.java
+++ b/libjava/classpath/javax/swing/JOptionPane.java
@@ -1,5 +1,5 @@
/* JOptionPane.java
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,6 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
-import java.awt.Dimension;
import java.awt.Frame;
import javax.accessibility.Accessible;
@@ -60,16 +59,19 @@ public class JOptionPane extends JComponent implements Accessible
/**
* DOCUMENT ME!
*/
+ // FIXME: This inner class is a complete stub and needs to be implemented
+ // properly.
protected class AccessibleJOptionPane extends JComponent.AccessibleJComponent
{
/** DOCUMENT ME! */
private static final long serialVersionUID = 686071432213084821L;
-
+
/**
* Creates a new AccessibleJOptionPane object.
*/
protected AccessibleJOptionPane()
{
+ // Nothing to do here.
}
/**
@@ -343,8 +345,6 @@ public class JOptionPane extends JComponent implements Accessible
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
updateUI();
- invalidate();
- repaint();
}
/**
@@ -369,17 +369,12 @@ public class JOptionPane extends JComponent implements Accessible
inputValue = UNINITIALIZED_VALUE;
value = UNINITIALIZED_VALUE;
- // FIXME: This dialog should be centered on the parent
- // or at the center of the screen (if the parent is null)
- // Need getGraphicsConfiguration to return non-null in
- // order for that to work so we know how large the
- // screen is.
dialog.getContentPane().add(this);
dialog.setModal(true);
dialog.setResizable(false);
- dialog.invalidate();
- dialog.repaint();
-
+ dialog.pack();
+ dialog.setLocationRelativeTo(parentComponent);
+
return dialog;
}
@@ -513,6 +508,8 @@ public class JOptionPane extends JComponent implements Accessible
*/
public Object getInputValue()
{
+ if (getValue().equals(new Integer(CANCEL_OPTION)))
+ setInputValue(null);
return inputValue;
}
@@ -858,13 +855,13 @@ public class JOptionPane extends JComponent implements Accessible
*/
public static int showConfirmDialog(Component parentComponent, Object message)
{
- JOptionPane pane = new JOptionPane(message);
+ JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);
JDialog dialog = pane.createDialog(parentComponent, "Select an Option");
-
- dialog.pack();
dialog.show();
-
- return ((Integer) pane.getValue()).intValue();
+
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -886,10 +883,11 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, PLAIN_MESSAGE, optionType);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -912,10 +910,11 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, messageType, optionType);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -940,10 +939,11 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, messageType, optionType, icon);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -964,9 +964,8 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(parentComponent, null);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -991,9 +990,8 @@ public class JOptionPane extends JComponent implements Accessible
pane.setInitialSelectionValue(initialSelectionValue);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(parentComponent, null);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -1017,9 +1015,8 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, messageType);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -1050,10 +1047,9 @@ public class JOptionPane extends JComponent implements Accessible
pane.setSelectionValues(selectionValues);
pane.setInitialSelectionValue(initialSelectionValue);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
-
- return (String) pane.getInputValue();
+
+ return pane.getInputValue();
}
/**
@@ -1071,9 +1067,8 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE);
pane.setWantsInput(true);
JDialog dialog = pane.createDialog(null, null);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -1096,9 +1091,8 @@ public class JOptionPane extends JComponent implements Accessible
pane.setWantsInput(true);
pane.setInitialSelectionValue(initialSelectionValue);
JDialog dialog = pane.createDialog(null, null);
- dialog.pack();
dialog.show();
-
+
return (String) pane.getInputValue();
}
@@ -1120,8 +1114,10 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, null);
startModal(frame);
-
- return ((Integer) pane.getValue()).intValue();
+
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1146,7 +1142,9 @@ public class JOptionPane extends JComponent implements Accessible
startModal(frame);
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1172,7 +1170,9 @@ public class JOptionPane extends JComponent implements Accessible
startModal(frame);
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1200,7 +1200,9 @@ public class JOptionPane extends JComponent implements Accessible
startModal(frame);
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1222,7 +1224,7 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, null);
startModal(frame);
-
+
return (String) pane.getInputValue();
}
@@ -1248,7 +1250,7 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
startModal(frame);
-
+
return (String) pane.getInputValue();
}
@@ -1283,8 +1285,8 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
startModal(frame);
-
- return (String) pane.getInputValue();
+
+ return pane.getInputValue();
}
/**
@@ -1376,8 +1378,10 @@ public class JOptionPane extends JComponent implements Accessible
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
startModal(frame);
-
- return ((Integer) pane.getValue()).intValue();
+
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1391,8 +1395,7 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, INFORMATION_MESSAGE);
JDialog dialog = pane.createDialog(parentComponent, null);
- dialog.pack();
- dialog.show();
+ dialog.show();
}
/**
@@ -1410,7 +1413,6 @@ public class JOptionPane extends JComponent implements Accessible
{
JOptionPane pane = new JOptionPane(message, messageType);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
}
@@ -1431,7 +1433,6 @@ public class JOptionPane extends JComponent implements Accessible
JOptionPane pane = new JOptionPane(message, messageType);
pane.setIcon(icon);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
}
@@ -1461,10 +1462,11 @@ public class JOptionPane extends JComponent implements Accessible
options, initialValue);
JDialog dialog = pane.createDialog(parentComponent, title);
- dialog.pack();
dialog.show();
- return ((Integer) pane.getValue()).intValue();
+ if (pane.getValue() instanceof Integer)
+ return ((Integer) pane.getValue()).intValue();
+ return -1;
}
/**
@@ -1524,34 +1526,34 @@ public class JOptionPane extends JComponent implements Accessible
* JInternalFrame's preferred size.
*
* @param f The JInternalFrame to make modal.
- * @param pane The JOptionPane to add to the JInternalFrame.
*/
private static void startModal(JInternalFrame f)
{
synchronized (f)
- {
- final JInternalFrame tmp = f;
- tmp.toFront();
-
- f.addInternalFrameListener(new InternalFrameAdapter()
- {
- public void internalFrameClosed(InternalFrameEvent e)
- {
- synchronized (tmp)
- {
- tmp.removeInternalFrameListener(this);
- tmp.notifyAll();
- }
- }
- });
- try
- {
- while (! f.isClosed())
- f.wait();
- }
- catch (InterruptedException ignored)
- {
- }
- }
+ {
+ final JInternalFrame tmp = f;
+ tmp.toFront();
+
+ f.addInternalFrameListener(new InternalFrameAdapter()
+ {
+ public void internalFrameClosed(InternalFrameEvent e)
+ {
+ synchronized (tmp)
+ {
+ tmp.removeInternalFrameListener(this);
+ tmp.notifyAll();
+ }
+ }
+ });
+ try
+ {
+ while (! f.isClosed())
+ f.wait();
+ }
+ catch (InterruptedException ignored)
+ {
+ // Ignore this Exception.
+ }
+ }
}
}
diff --git a/libjava/classpath/javax/swing/JPanel.java b/libjava/classpath/javax/swing/JPanel.java
index c7f7c448331..c02a9cfad6f 100644
--- a/libjava/classpath/javax/swing/JPanel.java
+++ b/libjava/classpath/javax/swing/JPanel.java
@@ -43,6 +43,7 @@ import java.awt.LayoutManager;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.swing.plaf.PanelUI;
/**
@@ -52,63 +53,90 @@ import javax.swing.plaf.PanelUI;
*/
public class JPanel extends JComponent implements Accessible
{
- public JPanel()
+ /**
+ * Provides accessibility support for <code>JPanel</code>.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+ protected class AccessibleJPanel extends AccessibleJComponent
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJPanel</code>.
+ */
+ public AccessibleJPanel()
{
- this(new FlowLayout(),
- true);
+ // Nothing to do here.
}
-
- public JPanel(boolean double_buffered)
- {
- this(new FlowLayout(),
- double_buffered);
- }
-
- public JPanel(LayoutManager layout)
- {
- this(layout,
- true);
- }
-
-
- public JPanel(LayoutManager layout,
- boolean isDoubleBuffered)
- {
- if (layout == null)
- {
- System.err.println("NO LAYOUT SET !!!");
- layout = new FlowLayout();
- }
- setLayout(layout);
- setOpaque(true);
-
- updateUI();
- }
-
- public String getUIClassID()
- { return "PanelUI"; }
-
- public void setUI(PanelUI ui) {
- super.setUI(ui);
- }
-
- public PanelUI getUI() {
- return (PanelUI)ui;
- }
-
- public void updateUI() {
- setUI((PanelUI)UIManager.getUI(this));
- }
-
-
- public AccessibleContext getAccessibleContext()
+ /**
+ * Returns the accessible role for <code>JPanel</code>, which is
+ * {@link AccessibleRole#PANEL}.
+ *
+ * @return the accessible role for <code>JPanel</code>
+ */
+ public AccessibleRole getAccessibleRole()
{
- return null;
+ return AccessibleRole.PANEL;
}
+ }
+
+ public JPanel()
+ {
+ this(new FlowLayout(), true);
+ }
+
+ public JPanel(boolean double_buffered)
+ {
+ this(new FlowLayout(), double_buffered);
+ }
+
+ public JPanel(LayoutManager layout)
+ {
+ this(layout, true);
+ }
+
+ public JPanel(LayoutManager layout, boolean isDoubleBuffered)
+ {
+ if (layout == null)
+ {
+ // TODO: Is this correct? Or should we throw a NPE?
+ layout = new FlowLayout();
+ }
+ setLayout(layout);
+ setOpaque(true);
+
+ updateUI();
+ }
+
+ public String getUIClassID()
+ {
+ return "PanelUI";
+ }
+
+ public void setUI(PanelUI ui)
+ {
+ super.setUI(ui);
+ }
+
+ public PanelUI getUI()
+ {
+ return (PanelUI) ui;
+ }
+
+ public void updateUI()
+ {
+ setUI((PanelUI) UIManager.getUI(this));
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJPanel();
+ return accessibleContext;
+ }
- protected String paramString()
- {
- return "JPanel";
- }
+ protected String paramString()
+ {
+ return super.paramString();
+ }
}
diff --git a/libjava/classpath/javax/swing/JPasswordField.java b/libjava/classpath/javax/swing/JPasswordField.java
index 151d2484a82..11e45e8a58a 100644
--- a/libjava/classpath/javax/swing/JPasswordField.java
+++ b/libjava/classpath/javax/swing/JPasswordField.java
@@ -67,6 +67,7 @@ public class JPasswordField extends JTextField
*/
protected AccessibleJPasswordField()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/JPopupMenu.java b/libjava/classpath/javax/swing/JPopupMenu.java
index c4ee5fe7346..1f2282e2326 100644
--- a/libjava/classpath/javax/swing/JPopupMenu.java
+++ b/libjava/classpath/javax/swing/JPopupMenu.java
@@ -39,19 +39,13 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
-import java.awt.Container;
import java.awt.Dimension;
-import java.awt.GridBagConstraints;
import java.awt.Insets;
-import java.awt.Panel;
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.EventListener;
@@ -102,11 +96,11 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
1. if DefaultLightWeightPopupEnabled true
(i) use lightweight container if popup feets inside top-level window
- (ii) only use heavyweight container (JWindow) if popup doesn't fit.
+ (ii) only use heavyweight container (JDialog) if popup doesn't fit.
2. if DefaultLightWeightPopupEnabled false
(i) if popup fits, use awt.Panel (mediumWeight)
- (ii) if popup doesn't fit, use JWindow (heavyWeight)
+ (ii) if popup doesn't fit, use JDialog (heavyWeight)
*/
private static boolean DefaultLightWeightPopupEnabled = true;
@@ -130,8 +124,15 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
/* Popup that is used to display JPopupMenu */
private transient Popup popup;
- /* Location of the popup */
- private Point popupLocation;
+ /**
+ * Location of the popup, X coordinate.
+ */
+ private int popupLocationX;
+
+ /**
+ * Location of the popup, Y coordinate.
+ */
+ private int popupLocationY;
/* Field indicating if popup menu is visible or not */
private boolean visible = false;
@@ -158,15 +159,6 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
updateUI();
}
- private void readObject(ObjectInputStream stream)
- throws IOException, ClassNotFoundException
- {
- }
-
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* Adds given menu item to the popup menu
*
@@ -220,19 +212,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
public void remove(int index)
{
super.remove(index);
-
- GridBagConstraints constraints = new GridBagConstraints();
- constraints.fill = GridBagConstraints.BOTH;
- constraints.weightx = 100.0;
- constraints.weighty = 100.0;
-
- Component[] items = getComponents();
- for (int i = index; i < items.length; i++)
- {
- constraints.gridy = i;
- super.add(items[i], constraints, i);
- }
- this.setSize(this.getPreferredSize());
+ revalidate();
}
/**
@@ -257,27 +237,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
public void insert(Component component, int index)
{
- GridBagConstraints constraints = new GridBagConstraints();
- constraints.fill = GridBagConstraints.BOTH;
- constraints.weightx = 100.0;
- constraints.weighty = 100.0;
-
- constraints.gridy = index;
- super.add(component, constraints, index);
-
- // need to change constraints for the components that were moved by 1
- // due to the insertion
- if (index != -1)
- {
- Component[] items = getComponents();
-
- for (int i = index + 1; i < items.length; i++)
- {
- constraints.gridy = i;
- super.add(items[i], constraints, i);
- }
- }
- this.setSize(this.getPreferredSize());
+ super.add(component, index);
}
/**
@@ -527,7 +487,20 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
public void pack()
{
- super.setSize(null);
+ // Hook up this call so that it gets executed on the event thread in order
+ // to avoid synchronization problems when calling the layout manager.
+ if (! SwingUtilities.isEventDispatchThread())
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ show();
+ }
+ });
+ }
+
+ setSize(getPreferredSize());
}
/**
@@ -547,8 +520,21 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*
* @param visible true if popup menu will become visible and false otherwise.
*/
- public void setVisible(boolean visible)
+ public void setVisible(final boolean visible)
{
+ // Hook up this call so that it gets executed on the event thread in order
+ // to avoid synchronization problems when calling the layout manager.
+ if (! SwingUtilities.isEventDispatchThread())
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ setVisible(visible);
+ }
+ });
+ }
+
if (visible == isVisible())
return;
@@ -556,58 +542,21 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
this.visible = visible;
if (old != isVisible())
{
- firePropertyChange("visible", old, isVisible());
- if (visible)
- {
- firePopupMenuWillBecomeVisible();
- Container rootContainer = (Container) SwingUtilities.getRoot(invoker);
-
- boolean fit = true;
- Dimension size;
-
- // Determine the size of the popup menu
- if (this.getSize().width == 0 && this.getSize().width == 0)
- size = this.getPreferredSize();
- else
- size = this.getSize();
-
- if ((size.width > (rootContainer.getWidth() - popupLocation.x))
- || (size.height > (rootContainer.getHeight() - popupLocation.y)))
- fit = false;
- if (lightWeightPopupEnabled && fit)
- popup = new LightWeightPopup(this);
- else
- {
- if (fit)
- popup = new MediumWeightPopup(this);
- else
- popup = new HeavyWeightPopup(this);
- }
- if (popup instanceof LightWeightPopup
- || popup instanceof MediumWeightPopup)
- {
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker)
- .getLayeredPane();
- Point p = new Point(popupLocation.x, popupLocation.y);
- SwingUtilities.convertPointFromScreen(p, layeredPane);
- popup.show(p.x, p.y, size.width, size.height);
- }
- else
- {
- // Subtract insets of the top-level container if popup menu's
- // top-left corner is inside it.
- Insets insets = rootContainer.getInsets();
- popup.show(popupLocation.x - insets.left,
- popupLocation.y - insets.top, size.width,
- size.height);
- }
- }
- else
- {
- firePopupMenuWillBecomeInvisible();
- popup.hide();
- }
+ firePropertyChange("visible", old, isVisible());
+ if (visible)
+ {
+ firePopupMenuWillBecomeVisible();
+
+ PopupFactory pf = PopupFactory.getSharedInstance();
+ pack();
+ popup = pf.getPopup(invoker, this, popupLocationX, popupLocationY);
+ popup.show();
+ }
+ else
+ {
+ firePopupMenuWillBecomeInvisible();
+ popup.hide();
+ }
}
}
@@ -619,11 +568,11 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
public void setLocation(int x, int y)
{
- if (popupLocation == null)
- popupLocation = new Point();
-
- popupLocation.x = x;
- popupLocation.y = y;
+ popupLocationX = x;
+ popupLocationY = y;
+ // Handle the case when the popup is already showing. In this case we need
+ // to fetch a new popup from PopupFactory and use this. See the general
+ // contract of the PopupFactory.
}
/**
@@ -657,11 +606,14 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
public void show(Component component, int x, int y)
{
- setInvoker(component);
- Point p = new Point(x, y);
- SwingUtilities.convertPointToScreen(p, component);
- setLocation(p.x, p.y);
- setVisible(true);
+ if (component.isShowing())
+ {
+ setInvoker(component);
+ Point p = new Point(x, y);
+ SwingUtilities.convertPointToScreen(p, component);
+ setLocation(p.x, p.y);
+ setVisible(true);
+ }
}
/**
@@ -882,162 +834,13 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
}
/**
- * This interface is used to display menu items of the JPopupMenu
- */
- private interface Popup
- {
- /**
- * Displays container on the screen
- *
- * @param x x-coordinate of popup menu's location on the screen
- * @param y y-coordinate of popup menu's location on the screen
- * @param width width of the container that is used to display menu
- * item's for popup menu
- * @param height height of the container that is used to display menu
- * item's for popup menu
- */
- void show(int x, int y, int width, int height);
-
- /**
- * Hides container used to display popup menu item's from the screen
- */
- void hide();
- }
-
- /**
- * This class represents Popup menu that uses light weight container
- * to display its contents.
- */
- private class LightWeightPopup extends Container implements Popup
- {
- private Component c;
-
- /**
- * Creates a new LightWeightPopup menu
- *
- * @param c Container containing menu items
- */
- public LightWeightPopup(Container c)
- {
- this.c = c;
- }
-
- /**
- * Displayes lightweight container with menu items to the screen
- *
- * @param x x-coordinate of lightweight container on the screen
- * @param y y-coordinate of lightweight container on the screen
- * @param width width of the lightweight container
- * @param height height of the lightweight container
- */
- public void show(int x, int y, int width, int height)
- {
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane();
- c.setBounds(x, y, width, height);
- layeredPane.add(c, JLayeredPane.POPUP_LAYER, 0);
- }
-
- /**
- * Hides lightweight container from the screen
- */
- public void hide()
- {
- // FIXME: Right now the lightweight container is removed from JLayered
- // pane. It is probably would be better in order to improve performance
- // to make the container invisible instead of removing it everytime.
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane();
- int index = layeredPane.getIndexOf(c);
- layeredPane.remove(index);
- }
- }
-
- /**
- * MediumWeightPopup is an AWT Panel with JPopupMenu's menu items.
- * It is used to display JPopupMenu's menu items on the screen
- */
- private class MediumWeightPopup extends Panel implements Popup
- {
- /**
- * Creates a new MediumWeightPopup object.
- *
- * @param c Container with JPopupMenu's menu items
- */
- public MediumWeightPopup(Container c)
- {
- this.add(c);
- }
-
- /**
- * Displays AWT Panel with its components on the screen
- *
- * @param x x-coordinate of the upper-left corner of the panel's
- * @param y y-coordinate of the upper-left corner of the panel's
- * @param width width of the panel
- * @param height height of the panel
- */
- public void show(int x, int y, int width, int height)
- {
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane();
- layeredPane.add(this, JLayeredPane.POPUP_LAYER, 0);
- this.setBounds(x, y, width, height);
- }
-
- /**
- * Hides This panel from the screen
- */
- public void hide()
- {
- // FIXME: Right now the lightweight container is removed from JLayered
- // pane. It is probably would be better in order to improve performance
- // to make the container invisible instead of removing it everytime.
- JLayeredPane layeredPane;
- layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane();
- int index = layeredPane.getIndexOf(this);
- layeredPane.remove(index);
- }
- }
-
- /**
- * HeavyWeightPopup is JWindow that is used to display JPopupMenu menu item's
- * on the screen
- */
- private class HeavyWeightPopup extends JWindow implements Popup
- {
- /**
- * Creates a new HeavyWeightPopup object.
- *
- * @param c Container containing menu items
- */
- public HeavyWeightPopup(Container c)
- {
- this.setContentPane(c);
- }
-
- /**
- * Displays JWindow container JPopupMenu's menu items to the screen
- *
- * @param x x-coordinate of JWindow containing menu items
- * @param y y-coordinate of JWindow containing menu items
- * @param width width of the JWindow
- * @param height height of the JWindow
- */
- public void show(int x, int y, int width, int height)
- {
- this.setBounds(x, y, width, height);
- this.show();
- }
- }
-
- /**
* This is the separator that can be used in popup menu.
*/
public static class Separator extends JSeparator
{
public Separator()
{
+ super();
}
public String getUIClassID()
@@ -1052,6 +855,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
protected AccessibleJPopupMenu()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
@@ -1066,8 +870,9 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
{
public void propertyChange(PropertyChangeEvent evt)
{
- JPopupMenu.this.revalidate();
- JPopupMenu.this.repaint();
+ // We used to have a revalidate() and repaint() call here. However I think
+ // this is not needed. Instead, a new Popup has to be fetched from the
+ // PopupFactory and used here.
}
}
}
diff --git a/libjava/classpath/javax/swing/JProgressBar.java b/libjava/classpath/javax/swing/JProgressBar.java
index 1b8fcea4672..0de9115dc7d 100644
--- a/libjava/classpath/javax/swing/JProgressBar.java
+++ b/libjava/classpath/javax/swing/JProgressBar.java
@@ -81,6 +81,8 @@ public class JProgressBar extends JComponent implements SwingConstants,
/**
* AccessibleJProgressBar
*/
+ // FIXME: This inner class is a complete stub and needs to be implemented
+ // properly.
protected class AccessibleJProgressBar extends AccessibleJComponent
implements AccessibleValue
{
@@ -91,6 +93,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
*/
protected AccessibleJProgressBar()
{
+ // Nothing to do here.
}
/**
@@ -243,7 +246,7 @@ public class JProgressBar extends JComponent implements SwingConstants,
model = new DefaultBoundedRangeModel(minimum, 0, minimum, maximum);
if (orientation != HORIZONTAL && orientation != VERTICAL)
throw new IllegalArgumentException(orientation + " is not a legal orientation");
- this.orientation = orientation;
+ setOrientation(orientation);
changeListener = createChangeListener();
model.addChangeListener(changeListener);
updateUI();
diff --git a/libjava/classpath/javax/swing/JRadioButton.java b/libjava/classpath/javax/swing/JRadioButton.java
index 66f5902e899..e0593f3a501 100644
--- a/libjava/classpath/javax/swing/JRadioButton.java
+++ b/libjava/classpath/javax/swing/JRadioButton.java
@@ -192,8 +192,8 @@ public class JRadioButton extends JToggleButton
public JRadioButton(String text, Icon icon, boolean selected)
{
super(text, icon, selected);
- borderPainted = false;
- contentAreaFilled = false;
+ setBorderPainted(false);
+ setHorizontalAlignment(LEADING);
}
/**
diff --git a/libjava/classpath/javax/swing/JRadioButtonMenuItem.java b/libjava/classpath/javax/swing/JRadioButtonMenuItem.java
index 76a8fef640a..61a8dbab300 100644
--- a/libjava/classpath/javax/swing/JRadioButtonMenuItem.java
+++ b/libjava/classpath/javax/swing/JRadioButtonMenuItem.java
@@ -38,9 +38,6 @@ exception statement from your version. */
package javax.swing;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -149,10 +146,6 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
model.setSelected(selected);
}
- private void writeObject(ObjectOutputStream stream) throws IOException
- {
- }
-
/**
* This method returns a name to identify which look and feel class will be
* the UI delegate for the menuItem.
@@ -202,6 +195,7 @@ public class JRadioButtonMenuItem extends JMenuItem implements Accessible
*/
protected AccessibleJRadioButtonMenuItem()
{
+ // Nothing to do here.
}
public AccessibleRole getAccessibleRole()
diff --git a/libjava/classpath/javax/swing/JRootPane.java b/libjava/classpath/javax/swing/JRootPane.java
index cb0bafd84e0..dea4ee4b195 100644
--- a/libjava/classpath/javax/swing/JRootPane.java
+++ b/libjava/classpath/javax/swing/JRootPane.java
@@ -42,10 +42,14 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.IllegalComponentStateException;
+import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.LayoutManager2;
+import java.awt.Rectangle;
import java.io.Serializable;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleRole;
import javax.swing.plaf.RootPaneUI;
@@ -59,10 +63,10 @@ import javax.swing.plaf.RootPaneUI;
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class JRootPane extends JComponent
+public class JRootPane extends JComponent implements Accessible
{
// The class used to obtain the accessible role for this object.
- protected static class AccessibleJRootPane
+ protected class AccessibleJRootPane extends AccessibleJComponent
{
/**
* For compatability with Sun's JDK
@@ -74,6 +78,7 @@ public class JRootPane extends JComponent
*/
protected AccessibleJRootPane()
{
+ // Nothing to do here.
}
/**
@@ -95,10 +100,36 @@ public class JRootPane extends JComponent
private static final long serialVersionUID = -4100116998559815027L;
/**
+ * The cached layout info for the glass pane.
+ */
+ private Rectangle glassPaneBounds;
+
+ /**
+ * The cached layout info for the layered pane.
+ */
+ private Rectangle layeredPaneBounds;
+
+ /**
+ * The cached layout info for the content pane.
+ */
+ private Rectangle contentPaneBounds;
+
+ /**
+ * The cached layout info for the menu bar.
+ */
+ private Rectangle menuBarBounds;
+
+ /**
+ * The cached preferred size.
+ */
+ private Dimension prefSize;
+
+ /**
* Creates a new <code>RootLayout</code> object.
*/
protected RootLayout()
{
+ // Nothing to do here.
}
/**
@@ -109,6 +140,7 @@ public class JRootPane extends JComponent
*/
public void addLayoutComponent(Component comp, Object constraints)
{
+ // Nothing to do here.
}
/**
@@ -119,6 +151,7 @@ public class JRootPane extends JComponent
*/
public void addLayoutComponent(String name, Component comp)
{
+ // Nothing to do here.
}
/**
@@ -130,7 +163,7 @@ public class JRootPane extends JComponent
*/
public float getLayoutAlignmentX(Container target)
{
- return target.getAlignmentX();
+ return 0.0F;
}
/**
@@ -142,7 +175,7 @@ public class JRootPane extends JComponent
*/
public float getLayoutAlignmentY(Container target)
{
- return target.getAlignmentY();
+ return 0.0F;
}
/**
@@ -152,6 +185,14 @@ public class JRootPane extends JComponent
*/
public void invalidateLayout(Container target)
{
+ synchronized (this)
+ {
+ glassPaneBounds = null;
+ layeredPaneBounds = null;
+ contentPaneBounds = null;
+ menuBarBounds = null;
+ prefSize = null;
+ }
}
/**
@@ -161,81 +202,56 @@ public class JRootPane extends JComponent
*/
public void layoutContainer(Container c)
{
- Dimension menuBarSize;
- Dimension containerSize = c.getSize(null);
- Dimension contentPaneSize = contentPane.getPreferredSize();
-
- /*
- if size of top-level window wasn't set then just set
- contentPane and menuBar to its preferred sizes.
- Otherwise, if the size of top-level window was specified then
- set menuBar to its preferred size and make content pane
- to fit into the remaining space
-
-
- +-------------------------------+
- | JLayeredPane |
- | +--------------------------+ |
- | | menuBar | |
- | +--------------------------+ |
- | +--------------------------+ |
- | |contentPane | |
- | | | |
- | | | |
- | | | |
- | +--------------------------+ |
- +-------------------------------+
-
- */
- if (containerSize.width == 0 && containerSize.height == 0)
+ if (glassPaneBounds == null || layeredPaneBounds == null
+ || contentPaneBounds == null || menuBarBounds == null)
{
+ Insets i = getInsets();
+ int containerWidth = c.getBounds().width - i.left - i.right;
+ int containerHeight = c.getBounds().height - i.top - i.bottom;
+
+ // 1. the glassPane fills entire viewable region (bounds - insets).
+ // 2. the layeredPane filles entire viewable region.
+ // 3. the menuBar is positioned at the upper edge of layeredPane.
+ // 4. the contentPane fills viewable region minus menuBar, if present.
+
+
+ // +-------------------------------+
+ // | JLayeredPane |
+ // | +--------------------------+ |
+ // | | menuBar | |
+ // | +--------------------------+ |
+ // | +--------------------------+ |
+ // | |contentPane | |
+ // | | | |
+ // | | | |
+ // | | | |
+ // | +--------------------------+ |
+ // +-------------------------------+
+
if (menuBar != null)
{
- int maxWidth;
- menuBarSize = menuBar.getPreferredSize();
- maxWidth = Math.max(menuBarSize.width, contentPaneSize.width);
- menuBar.setBounds(0, 0, maxWidth, menuBarSize.height);
- glassPane.setBounds(0, menuBarSize.height, maxWidth,
- contentPaneSize.height);
- contentPane.setBounds(0, menuBarSize.height, maxWidth,
- contentPaneSize.height);
- layeredPane.setSize(maxWidth,
- menuBarSize.height + contentPaneSize.height);
+ Dimension menuBarSize = menuBar.getPreferredSize();
+ if (menuBarSize.height > containerHeight)
+ menuBarSize.height = containerHeight;
+ menuBarBounds = new Rectangle(0, 0, containerWidth,
+ menuBarSize.height);
+ contentPaneBounds = new Rectangle(0, menuBarSize.height,
+ containerWidth,
+ containerHeight - menuBarSize.height);
}
else
- {
- glassPane.setBounds(0, 0, contentPaneSize.width,
- contentPaneSize.height);
- contentPane.setBounds(0, 0, contentPaneSize.width,
- contentPaneSize.height);
- layeredPane.setSize(contentPaneSize.width, contentPaneSize.height);
- }
+ contentPaneBounds = new Rectangle(0, 0, containerWidth,
+ containerHeight);
+
+ glassPaneBounds = new Rectangle(i.left, i.top, containerWidth, containerHeight);
+ layeredPaneBounds = new Rectangle(i.left, i.top, containerWidth, containerHeight);
}
- else
- {
- if (menuBar != null)
- {
- menuBarSize = menuBar.getPreferredSize();
- if (menuBarSize.height > containerSize.height)
- menuBarSize.height = containerSize.height;
- menuBar.setBounds(0, 0, containerSize.width, menuBarSize.height);
- int remainingHeight = containerSize.height - menuBarSize.height;
- glassPane.setBounds(0, menuBarSize.height, containerSize.width,
- containerSize.height - menuBarSize.height);
- contentPane.setBounds(0, menuBarSize.height,
- containerSize.width,
- (containerSize.height - menuBarSize.height));
- }
- else
- {
- glassPane.setBounds(0, 0, containerSize.width,
- containerSize.height);
- contentPane.setBounds(0, 0, containerSize.width,
- containerSize.height);
- }
- layeredPane.setSize(containerSize.width, containerSize.height);
- }
+ glassPane.setBounds(glassPaneBounds);
+ layeredPane.setBounds(layeredPaneBounds);
+ if (menuBar != null)
+ menuBar.setBounds(menuBarBounds);
+ contentPane.setBounds(contentPaneBounds);
}
/**
@@ -271,30 +287,29 @@ public class JRootPane extends JComponent
*/
public Dimension preferredLayoutSize(Container c)
{
- Dimension menuBarSize;
- Dimension prefSize;
-
- Dimension containerSize = c.getSize();
- Dimension contentPaneSize = contentPane.getPreferredSize();
-
- if (containerSize.width == 0 && containerSize.height == 0)
+ // We must synchronize here, otherwise we cannot guarantee that the
+ // prefSize is still non-null when returning.
+ synchronized (this)
{
- if (menuBar != null)
+ if (prefSize == null)
{
- int maxWidth;
- menuBarSize = menuBar.getPreferredSize();
- maxWidth = Math.max(menuBarSize.width, contentPaneSize.width);
- prefSize = new Dimension(maxWidth,
- contentPaneSize.height
- + menuBarSize.height);
+ Insets i = getInsets();
+ prefSize = new Dimension(i.left + i.right, i.top + i.bottom);
+ Dimension contentPrefSize = contentPane.getPreferredSize();
+ prefSize.width += contentPrefSize.width;
+ prefSize.height += contentPrefSize.height;
+ if (menuBar != null)
+ {
+ Dimension menuBarSize = menuBar.getPreferredSize();
+ if (menuBarSize.width > contentPrefSize.width)
+ prefSize.width += menuBarSize.width - contentPrefSize.width;
+ prefSize.height += menuBarSize.height;
+ }
}
- else
- prefSize = contentPaneSize;
- }
- else
- prefSize = c.getSize();
-
- return prefSize;
+ // Return a copy here so the cached value won't get trashed by some
+ // other component.
+ return new Dimension(prefSize);
+ }
}
/**
@@ -304,6 +319,7 @@ public class JRootPane extends JComponent
*/
public void removeLayoutComponent(Component comp)
{
+ // Nothing to do here.
}
}
@@ -335,6 +351,32 @@ public class JRootPane extends JComponent
protected JButton defaultButton;
/**
+ * This field is unused since JDK1.3. To override the default action you
+ * should modify the JRootPane's ActionMap.
+ *
+ * @deprecated since JDK1.3
+ *
+ * @specnote the specs indicate that the type of this field is
+ * a package private inner class
+ * javax.swing.JRootPane.DefaultAction. I assume that the closest
+ * public superclass is javax.swing.Action.
+ */
+ protected Action defaultPressAction;
+
+ /**
+ * This field is unused since JDK1.3. To override the default action you
+ * should modify the JRootPane's ActionMap.
+ *
+ * @deprecated since JDK1.3
+ *
+ * @specnote the specs indicate that the type of this field is
+ * a package private inner class
+ * javax.swing.JRootPane.DefaultAction. I assume that the closest
+ * public superclass is javax.swing.Action.
+ */
+ protected Action defaultReleaseAction;
+
+ /**
* @since 1.4
*/
private int windowDecorationStyle = NONE;
@@ -403,14 +445,25 @@ public class JRootPane extends JComponent
}
/**
- * DOCUMENT ME!
+ * Sets the JRootPane's content pane. The content pane should typically be
+ * opaque for painting to work properly. This method also
+ * removes the old content pane from the layered pane.
*
- * @param p DOCUMENT ME!
+ * @param p the Container that will be the content pane
+ * @throws IllegalComponentStateException if p is null
*/
public void setContentPane(Container p)
{
- contentPane = p;
- getLayeredPane().add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
+ if (p == null)
+ throw new IllegalComponentStateException ("cannot " +
+ "have a null content pane");
+ else
+ {
+ if (contentPane != null && contentPane.getParent() == layeredPane)
+ layeredPane.remove(contentPane);
+ contentPane = p;
+ getLayeredPane().add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
+ }
}
/**
@@ -488,7 +541,6 @@ public class JRootPane extends JComponent
getGlassPane();
getLayeredPane();
getContentPane();
- setDoubleBuffered(true);
updateUI();
}
@@ -524,7 +576,6 @@ public class JRootPane extends JComponent
{
JPanel p = new JPanel();
p.setName(this.getName() + ".glassPane");
- p.setLayout(new BorderLayout());
p.setVisible(false);
p.setOpaque(false);
return p;
@@ -615,7 +666,8 @@ public class JRootPane extends JComponent
&& style != COLOR_CHOOSER_DIALOG
&& style != FILE_CHOOSER_DIALOG
&& style != QUESTION_DIALOG
- && style != WARNING_DIALOG)
+ && style != WARNING_DIALOG
+ && style != PLAIN_DIALOG)
throw new IllegalArgumentException("invalid style");
int oldStyle = windowDecorationStyle;
diff --git a/libjava/classpath/javax/swing/JScrollPane.java b/libjava/classpath/javax/swing/JScrollPane.java
index e83513f07de..45dfbf50619 100644
--- a/libjava/classpath/javax/swing/JScrollPane.java
+++ b/libjava/classpath/javax/swing/JScrollPane.java
@@ -40,13 +40,14 @@ package javax.swing;
import java.awt.Component;
import java.awt.ComponentOrientation;
-import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
-import java.awt.Point;
import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -77,10 +78,73 @@ import javax.swing.plaf.UIResource;
* <tr><td>wheelScrollingEnabled </td><td>scrollPane </td><td>yes </td></tr>
* </table>
*/
-public class JScrollPane
- extends JComponent
+public class JScrollPane extends JComponent
implements Accessible, ScrollPaneConstants
{
+ /**
+ * Provides accessibility support for the <code>JScrollPane</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJScrollPane extends AccessibleJComponent
+ implements ChangeListener, PropertyChangeListener
+ {
+
+ /**
+ * The viewport of the underlying scrollpane.
+ */
+ protected JViewport viewPort;
+
+ /**
+ * Creates a new <code>AccessibleJScrollPane</code> object. This
+ * initializes the <code>viewport</code> field with the current viewport
+ * from the scrollpane associated with this
+ * <code>AccessibleJScrollPane</code>.
+ */
+ public AccessibleJScrollPane()
+ {
+ viewPort = getViewport();
+ viewPort.addChangeListener(this);
+ viewPort.addPropertyChangeListener(this);
+ }
+
+ /**
+ * Receives notification when the state of the viewport changes.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ // TODO: Figure out what should be done here, if anything.
+ }
+
+ /**
+ * Receives notification if any of the viewport's bound properties changes.
+ *
+ * @param e the propery change event
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ // TODO: Figure out what should be done here, if anything.
+ }
+
+ /**
+ * Resets the <code>viewPort</code> field when the scrollpane's viewport
+ * changes. This method is called by
+ * {@link JScrollPane#setViewport(JViewport)} in order to update the
+ * <code>viewPort</code> field and set up the listeners on this viewport
+ * correctly.
+ */
+ public void resetViewPort()
+ {
+ viewPort.removeChangeListener(this);
+ viewPort.removePropertyChangeListener(this);
+ viewPort = getViewport();
+ viewPort.addChangeListener(this);
+ viewPort.addPropertyChangeListener(this);
+ }
+ }
+
private static final long serialVersionUID = 5203525440012340014L;
protected JViewport columnHeader;
@@ -100,7 +164,6 @@ public class JScrollPane
Border viewportBorder;
boolean wheelScrollingEnabled;
- ChangeListener scrollListener;
public JViewport getColumnHeader()
{
@@ -228,10 +291,10 @@ public class JScrollPane
remove(c);
}
- private void addNonNull(Component c)
+ private void addNonNull(Component c, Object constraints)
{
if (c != null)
- add(c);
+ add(c, constraints);
}
public void setComponentOrientation(ComponentOrientation co)
@@ -250,7 +313,7 @@ public class JScrollPane
JViewport old = columnHeader;
removeNonNull(old);
columnHeader = h;
- addNonNull(h);
+ addNonNull(h, JScrollPane.COLUMN_HEADER);
firePropertyChange("columnHeader", old, h);
sync();
}
@@ -294,25 +357,25 @@ public class JScrollPane
{
removeNonNull(lowerRight);
lowerRight = c;
- addNonNull(c);
+ addNonNull(c, JScrollPane.LOWER_RIGHT_CORNER);
}
else if (key == UPPER_RIGHT_CORNER)
{
removeNonNull(upperRight);
upperRight = c;
- addNonNull(c);
+ addNonNull(c, JScrollPane.UPPER_RIGHT_CORNER);
}
else if (key == LOWER_LEFT_CORNER)
{
removeNonNull(lowerLeft);
lowerLeft = c;
- addNonNull(c);
+ addNonNull(c, JScrollPane.LOWER_LEFT_CORNER);
}
else if (key == UPPER_LEFT_CORNER)
{
removeNonNull(upperLeft);
upperLeft = c;
- addNonNull(c);
+ addNonNull(c, JScrollPane.UPPER_LEFT_CORNER);
}
else
throw new IllegalArgumentException("unknown corner " + key);
@@ -327,22 +390,10 @@ public class JScrollPane
JScrollBar old = horizontalScrollBar;
removeNonNull(old);
horizontalScrollBar = h;
- addNonNull(h);
+ addNonNull(h, JScrollPane.HORIZONTAL_SCROLLBAR);
firePropertyChange("horizontalScrollBar", old, h);
sync();
- if (old != null)
- {
- BoundedRangeModel model = old.getModel();
- if (model != null)
- model.removeChangeListener(scrollListener);
- }
- if (h != null)
- {
- BoundedRangeModel model = h.getModel();
- if (model != null)
- model.addChangeListener(scrollListener);
- }
}
public void setHorizontalScrollBarPolicy(int h)
@@ -359,6 +410,7 @@ public class JScrollPane
horizontalScrollBarPolicy = h;
firePropertyChange("horizontalScrollBarPolicy", old, h);
sync();
+ revalidate();
}
public void setLayout(LayoutManager l)
@@ -379,7 +431,7 @@ public class JScrollPane
JViewport old = rowHeader;
removeNonNull(old);
rowHeader = v;
- addNonNull(v);
+ addNonNull(v, JScrollPane.ROW_HEADER);
firePropertyChange("rowHeader", old, v);
sync();
}
@@ -400,22 +452,9 @@ public class JScrollPane
JScrollBar old = verticalScrollBar;
removeNonNull(old);
verticalScrollBar = v;
- addNonNull(v);
+ addNonNull(v, JScrollPane.VERTICAL_SCROLLBAR);
firePropertyChange("verticalScrollBar", old, v);
sync();
-
- if (old != null)
- {
- BoundedRangeModel model = old.getModel();
- if (model != null)
- model.removeChangeListener(scrollListener);
- }
- if (v != null)
- {
- BoundedRangeModel model = v.getModel();
- if (model != null)
- model.addChangeListener(scrollListener);
- }
}
public void setVerticalScrollBarPolicy(int v)
@@ -432,6 +471,7 @@ public class JScrollPane
verticalScrollBarPolicy = v;
firePropertyChange("verticalScrollBarPolicy", old, v);
sync();
+ revalidate();
}
public void setWheelScrollingEnabled(boolean b)
@@ -452,16 +492,17 @@ public class JScrollPane
JViewport old = viewport;
removeNonNull(old);
- if (old != null)
- old.removeChangeListener(scrollListener);
viewport = v;
- if (v != null)
- v.addChangeListener(scrollListener);
- addNonNull(v);
+ addNonNull(v, JScrollPane.VIEWPORT);
revalidate();
repaint();
firePropertyChange("viewport", old, v);
sync();
+ if (accessibleContext != null)
+ {
+ AccessibleJScrollPane asp = (AccessibleJScrollPane) accessibleContext;
+ asp.resetViewPort();
+ }
}
public void setViewportBorder(Border b)
@@ -494,79 +535,6 @@ public class JScrollPane
return true;
}
- ChangeListener createScrollListener()
- {
- return new ChangeListener()
- {
-
- public void stateChanged(ChangeEvent event)
- {
- JScrollBar vsb = JScrollPane.this.getVerticalScrollBar();
- JScrollBar hsb = JScrollPane.this.getHorizontalScrollBar();
- JViewport vp = JScrollPane.this.getViewport();
-
- if (vp != null && event.getSource() == vp)
- {
- // if the viewport changed, we should update the VSB / HSB
- // models according to the new vertical and horizontal sizes
-
- Rectangle vr = vp.getViewRect();
- Dimension vs = vp.getViewSize();
- if (vsb != null
- && (vsb.getMinimum() != 0
- || vsb.getMaximum() != vs.height
- || vsb.getValue() != vr.y
- || vsb.getVisibleAmount() != vr.height))
- vsb.setValues(vr.y, vr.height, 0, vs.height);
-
- if (hsb != null
- && (hsb.getMinimum() != 0
- || hsb.getMaximum() != vs.width
- || hsb.getValue() != vr.width
- || hsb.getVisibleAmount() != vr.height))
- hsb.setValues(vr.x, vr.width, 0, vs.width);
- }
- else
- {
- // otherwise we got a change update from either the VSB or
- // HSB model, and we need to update the viewport positions of
- // both the main viewport and any row or column headers to
- // match.
-
- int xpos = 0;
- int ypos = 0;
-
- if (vsb != null)
- ypos = vsb.getValue();
-
- if (hsb != null)
- xpos = hsb.getValue();
-
- Point pt = new Point(xpos, ypos);
-
- if (vp != null
- && vp.getViewPosition() != pt)
- vp.setViewPosition(pt);
-
- pt.x = 0;
-
- if (rowHeader != null
- && rowHeader.getViewPosition() != pt)
- rowHeader.setViewPosition(pt);
-
- pt.x = xpos;
- pt.y = 0;
-
- if (columnHeader != null
- && columnHeader.getViewPosition() != pt)
- columnHeader.setViewPosition(pt);
-
- }
- }
- };
- }
-
-
/**
* Creates a new <code>JScrollPane</code> without a view. The scrollbar
* policy is set to {@link #VERTICAL_SCROLLBAR_AS_NEEDED} and
@@ -627,7 +595,6 @@ public class JScrollPane
*/
public JScrollPane(Component view, int vsbPolicy, int hsbPolicy)
{
- scrollListener = createScrollListener();
setVerticalScrollBarPolicy(vsbPolicy);
setVerticalScrollBar(createVerticalScrollBar());
setHorizontalScrollBarPolicy(hsbPolicy);
@@ -635,7 +602,6 @@ public class JScrollPane
viewport = createViewport();
if (view != null)
getViewport().setView(view);
- viewport.addChangeListener(scrollListener);
add(viewport,0);
setLayout(new ScrollPaneLayout());
setOpaque(false);
@@ -728,4 +694,18 @@ public class JScrollPane
}
}
}
+
+ /**
+ * Returns the accessible context associated with this
+ * <code>JScrollPane</code>.
+ *
+ * @return the accessible context associated with this
+ * <code>JScrollPane</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJScrollPane();
+ return accessibleContext;
+ }
}
diff --git a/libjava/classpath/javax/swing/JSeparator.java b/libjava/classpath/javax/swing/JSeparator.java
index 6a3b97d35c6..602af6a380c 100644
--- a/libjava/classpath/javax/swing/JSeparator.java
+++ b/libjava/classpath/javax/swing/JSeparator.java
@@ -62,6 +62,7 @@ public class JSeparator extends JComponent implements SwingConstants,
*/
protected AccessibleJSeparator()
{
+ // Nothing to do here.
}
/**
@@ -131,7 +132,6 @@ public class JSeparator extends JComponent implements SwingConstants,
public void updateUI()
{
setUI((SeparatorUI) UIManager.getUI(this));
- invalidate();
}
/**
diff --git a/libjava/classpath/javax/swing/JSlider.java b/libjava/classpath/javax/swing/JSlider.java
index 2caf509a1bb..b28b06abad7 100644
--- a/libjava/classpath/javax/swing/JSlider.java
+++ b/libjava/classpath/javax/swing/JSlider.java
@@ -118,6 +118,8 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
/**
* DOCUMENT ME!
*/
+ // FIXME: This inner class is a complete stub and needs to be implemented
+ // properly.
protected class AccessibleJSlider extends JComponent.AccessibleJComponent
implements AccessibleValue
{
@@ -128,6 +130,7 @@ public class JSlider extends JComponent implements SwingConstants, Accessible,
*/
protected AccessibleJSlider()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/JSpinner.java b/libjava/classpath/javax/swing/JSpinner.java
index fc2b13e81a9..af34d9cf67d 100644
--- a/libjava/classpath/javax/swing/JSpinner.java
+++ b/libjava/classpath/javax/swing/JSpinner.java
@@ -108,10 +108,10 @@ public class JSpinner extends JComponent
/**
* DOCUMENT ME!
*/
- public void commitEdit()
- throws ParseException
+ public void commitEdit() throws ParseException
{
- } /* TODO */
+ // TODO: Implement this properly.
+ }
/**
* DOCUMENT ME!
@@ -184,7 +184,8 @@ public class JSpinner extends JComponent
*/
public void propertyChange(PropertyChangeEvent event)
{
- } /* TODO */
+ // TODO: Implement this properly.
+ }
/**
* DOCUMENT ME!
@@ -193,11 +194,12 @@ public class JSpinner extends JComponent
*/
public void stateChanged(ChangeEvent event)
{
- } /* TODO */
+ // TODO: Implement this properly.
+ }
- /* no-ops */
public void removeLayoutComponent(Component child)
{
+ // Nothing to do here.
}
/**
@@ -208,6 +210,7 @@ public class JSpinner extends JComponent
*/
public void addLayoutComponent(String name, Component child)
{
+ // Nothing to do here.
}
}
@@ -258,6 +261,31 @@ public class JSpinner extends JComponent
}
/**
+ * A <code>JSpinner</code> editor used for the {@link SpinnerListModel}.
+ * This editor uses a <code>JFormattedTextField</code> to edit the values
+ * of the spinner.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public static class ListEditor extends DefaultEditor
+ {
+ /**
+ * Creates a new instance of <code>ListEditor</code>.
+ *
+ * @param spinner the spinner for which this editor is used
+ */
+ public ListEditor(JSpinner spinner)
+ {
+ super(spinner);
+ }
+
+ public SpinnerListModel getModel()
+ {
+ return (SpinnerListModel) getSpinner().getModel();
+ }
+ }
+
+ /**
* An editor class for a <code>JSpinner</code> that is used
* for displaying and editing dates (e.g. that uses
* <code>SpinnerDateModel</code> as model).
@@ -307,7 +335,7 @@ public class JSpinner extends JComponent
/**
* Initializes the JFormattedTextField for this editor.
*
- * @param the date format to use in the formatted text field
+ * @param format the date format to use in the formatted text field
*/
private void init(SimpleDateFormat format)
{
diff --git a/libjava/classpath/javax/swing/JSplitPane.java b/libjava/classpath/javax/swing/JSplitPane.java
index cea5afef20a..70feefab26e 100644
--- a/libjava/classpath/javax/swing/JSplitPane.java
+++ b/libjava/classpath/javax/swing/JSplitPane.java
@@ -59,6 +59,8 @@ public class JSplitPane extends JComponent implements Accessible
/**
* DOCUMENT ME!
*/
+ // FIXME: This inner class is a complete stub and must be implemented
+ // properly.
protected class AccessibleJSplitPane extends JComponent.AccessibleJComponent
implements AccessibleValue
{
@@ -69,6 +71,7 @@ public class JSplitPane extends JComponent implements Accessible
*/
protected AccessibleJSplitPane()
{
+ // Nothing to do here.
}
/**
@@ -167,13 +170,15 @@ public class JSplitPane extends JComponent implements Accessible
public static final int HORIZONTAL_SPLIT = 1;
/** The property fired when the last divider location property changes. */
- public static final String LAST_DIVIDER_LOCATION_PROPERTY = "lastDividerLocation";
+ public static final String LAST_DIVIDER_LOCATION_PROPERTY =
+ "lastDividerLocation";
/** The constraints string used to add components to the left. */
public static final String LEFT = "left";
/** The property fired when the one touch expandable property changes. */
- public static final String ONE_TOUCH_EXPANDABLE_PROPERTY = "oneTouchExpandable";
+ public static final String ONE_TOUCH_EXPANDABLE_PROPERTY =
+ "oneTouchExpandable";
/** The property fired when the orientation property changes. */
public static final String ORIENTATION_PROPERTY = "orientation";
@@ -196,7 +201,8 @@ public class JSplitPane extends JComponent implements Accessible
/** Whether the JSplitPane uses one touch expandable buttons. */
protected boolean oneTouchExpandable = false;
- // This is the master dividerSize variable and sets the BasicSplitPaneDivider one accordingly
+ // This is the master dividerSize variable and sets the
+ // BasicSplitPaneDivider one accordingly
/** The size of the divider. */
protected int dividerSize = 10;
@@ -283,7 +289,8 @@ public class JSplitPane extends JComponent implements Accessible
*/
public JSplitPane()
{
- this(HORIZONTAL_SPLIT, false, null, null);
+ this(HORIZONTAL_SPLIT, false, new JButton("left button"),
+ new JButton("right button"));
}
/**
@@ -297,7 +304,8 @@ public class JSplitPane extends JComponent implements Accessible
* @param constraints The constraints string to use.
* @param index Where to place to component in the list of components.
*
- * @throws IllegalArgumentException When the constraints is not a known identifier.
+ * @throws IllegalArgumentException When the constraints is not a known
+ * identifier.
*/
protected void addImpl(Component comp, Object constraints, int index)
{
@@ -307,34 +315,35 @@ public class JSplitPane extends JComponent implements Accessible
int place;
if (constraints == null)
{
- if (leftComponent == null)
- constraints = LEFT;
- else if (rightComponent == null)
- constraints = RIGHT;
+ if (leftComponent == null)
+ constraints = LEFT;
+ else if (rightComponent == null)
+ constraints = RIGHT;
}
if (constraints instanceof String)
{
- String placement = (String) constraints;
-
- if (placement.equals(BOTTOM) || placement.equals(RIGHT))
- {
- if (rightComponent != null)
- remove(rightComponent);
- rightComponent = comp;
- }
- else if (placement.equals(LEFT) || placement.equals(TOP))
- {
- if (leftComponent != null)
- remove(leftComponent);
- leftComponent = comp;
- }
- else if (placement.equals(DIVIDER))
- constraints = null;
- else
- throw new IllegalArgumentException("Constraints is not a known identifier.");
-
- super.addImpl(comp, constraints, index);
+ String placement = (String) constraints;
+
+ if (placement.equals(BOTTOM) || placement.equals(RIGHT))
+ {
+ if (rightComponent != null)
+ remove(rightComponent);
+ rightComponent = comp;
+ }
+ else if (placement.equals(LEFT) || placement.equals(TOP))
+ {
+ if (leftComponent != null)
+ remove(leftComponent);
+ leftComponent = comp;
+ }
+ else if (placement.equals(DIVIDER))
+ constraints = null;
+ else
+ throw new
+ IllegalArgumentException("Constraints is not a known identifier.");
+
+ super.addImpl(comp, constraints, index);
}
invalidate();
layout();
@@ -611,10 +620,10 @@ public class JSplitPane extends JComponent implements Accessible
{
if (newContinuousLayout != continuousLayout)
{
- boolean oldValue = continuousLayout;
- continuousLayout = newContinuousLayout;
- firePropertyChange(CONTINUOUS_LAYOUT_PROPERTY, oldValue,
- continuousLayout);
+ boolean oldValue = continuousLayout;
+ continuousLayout = newContinuousLayout;
+ firePropertyChange(CONTINUOUS_LAYOUT_PROPERTY, oldValue,
+ continuousLayout);
}
}
@@ -631,7 +640,8 @@ public class JSplitPane extends JComponent implements Accessible
public void setDividerLocation(double proportionalLocation)
{
if (proportionalLocation > 1 || proportionalLocation < 0)
- throw new IllegalArgumentException("proportion has to be between 0 and 1.");
+ throw new IllegalArgumentException
+ ("proportion has to be between 0 and 1.");
int max = (orientation == HORIZONTAL_SPLIT) ? getWidth() : getHeight();
setDividerLocation((int) (proportionalLocation * max));
@@ -646,9 +656,9 @@ public class JSplitPane extends JComponent implements Accessible
{
if (ui != null && location != getDividerLocation())
{
- int oldLocation = getDividerLocation();
- ((SplitPaneUI) ui).setDividerLocation(this, location);
- firePropertyChange(DIVIDER_LOCATION_PROPERTY, oldLocation, location);
+ int oldLocation = getDividerLocation();
+ ((SplitPaneUI) ui).setDividerLocation(this, location);
+ firePropertyChange(DIVIDER_LOCATION_PROPERTY, oldLocation, location);
}
}
@@ -661,9 +671,9 @@ public class JSplitPane extends JComponent implements Accessible
{
if (newSize != dividerSize)
{
- int oldSize = dividerSize;
- dividerSize = newSize;
- firePropertyChange(DIVIDER_SIZE_PROPERTY, oldSize, dividerSize);
+ int oldSize = dividerSize;
+ dividerSize = newSize;
+ firePropertyChange(DIVIDER_SIZE_PROPERTY, oldSize, dividerSize);
}
}
@@ -680,10 +690,10 @@ public class JSplitPane extends JComponent implements Accessible
{
if (newLastLocation != lastDividerLocation)
{
- int oldValue = lastDividerLocation;
- lastDividerLocation = newLastLocation;
- firePropertyChange(LAST_DIVIDER_LOCATION_PROPERTY, oldValue,
- lastDividerLocation);
+ int oldValue = lastDividerLocation;
+ lastDividerLocation = newLastLocation;
+ firePropertyChange(LAST_DIVIDER_LOCATION_PROPERTY, oldValue,
+ lastDividerLocation);
}
}
@@ -693,11 +703,11 @@ public class JSplitPane extends JComponent implements Accessible
* @param comp The left component.
*/
public void setLeftComponent(Component comp)
- {
+ {
if (comp != null)
add(comp, LEFT);
else
- add(new JButton("left button"), LEFT);
+ remove (leftComponent);
}
/**
@@ -712,10 +722,10 @@ public class JSplitPane extends JComponent implements Accessible
{
if (newValue != oneTouchExpandable)
{
- boolean oldValue = oneTouchExpandable;
- oneTouchExpandable = newValue;
- firePropertyChange(ONE_TOUCH_EXPANDABLE_PROPERTY, oldValue,
- oneTouchExpandable);
+ boolean oldValue = oneTouchExpandable;
+ oneTouchExpandable = newValue;
+ firePropertyChange(ONE_TOUCH_EXPANDABLE_PROPERTY, oldValue,
+ oneTouchExpandable);
}
}
@@ -729,13 +739,14 @@ public class JSplitPane extends JComponent implements Accessible
public void setOrientation(int orientation)
{
if (orientation != HORIZONTAL_SPLIT && orientation != VERTICAL_SPLIT)
- throw new IllegalArgumentException("orientation must be one of VERTICAL_SPLIT, HORIZONTAL_SPLIT");
+ throw new IllegalArgumentException
+ ("orientation must be one of VERTICAL_SPLIT, HORIZONTAL_SPLIT");
if (orientation != this.orientation)
{
- int oldOrientation = this.orientation;
- this.orientation = orientation;
- firePropertyChange(ORIENTATION_PROPERTY, oldOrientation,
- this.orientation);
+ int oldOrientation = this.orientation;
+ this.orientation = orientation;
+ firePropertyChange(ORIENTATION_PROPERTY, oldOrientation,
+ this.orientation);
}
}
@@ -763,7 +774,7 @@ public class JSplitPane extends JComponent implements Accessible
if (comp != null)
add(comp, RIGHT);
else
- add(new JButton("right button"), RIGHT);
+ remove (rightComponent);
}
/**
diff --git a/libjava/classpath/javax/swing/JTabbedPane.java b/libjava/classpath/javax/swing/JTabbedPane.java
index 828a69a24dc..27ba7bb82fc 100644
--- a/libjava/classpath/javax/swing/JTabbedPane.java
+++ b/libjava/classpath/javax/swing/JTabbedPane.java
@@ -56,8 +56,9 @@ import javax.swing.plaf.TabbedPaneUI;
import javax.swing.plaf.UIResource;
/**
- * This is a container for components. One component is displayed at a time.
- * Users can switch between components by clicking on tabs.
+ * This is a container for components where only one component is displayed at
+ * a given time and the displayed component can be switched by clicking on
+ * tabs.
*
* <p>
* Tabs can be oriented in several ways. They can be above, below, left and
@@ -72,12 +73,16 @@ public class JTabbedPane extends JComponent implements Serializable,
SwingConstants
{
/**
- * DOCUMENT ME!
+ * Accessibility support for <code>JTabbedPane</code>.
*/
+ // FIXME: This inner class is a complete stub and must be implemented
+ // properly.
protected class AccessibleJTabbedPane extends JComponent.AccessibleJComponent
implements AccessibleSelection, ChangeListener
{
- /** DOCUMENT ME! */
+ /**
+ * The serialization UID.
+ */
private static final long serialVersionUID = 7610530885966830483L;
/**
@@ -89,18 +94,21 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Receives notification when the selection state of the
+ * <code>JTabbedPane</code> changes.
*
- * @param e DOCUMENT ME!
+ * @param e the change event describing the change
*/
public void stateChanged(ChangeEvent e)
{
+ // Implement this properly.
}
/**
- * DOCUMENT ME!
+ * Returns the accessible role of the <code>JTabbedPane</code>, which is
+ * {@link AccessibleRole#PAGE_TAB_LIST}.
*
- * @return DOCUMENT ME!
+ * @return the accessible role of the <code>JTabbedPane</code>
*/
public AccessibleRole getAccessibleRole()
{
@@ -108,9 +116,11 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Returns the number of accessible child components of the
+ * <code>JTabbedPane</code>.
*
- * @return DOCUMENT ME!
+ * @return the number of accessible child components of the
+ * <code>JTabbedPane</code>
*/
public int getAccessibleChildrenCount()
{
@@ -118,11 +128,11 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Returns the accessible child component at the specified index.
*
- * @param i DOCUMENT ME!
+ * @param i the index of the child component to fetch
*
- * @return DOCUMENT ME!
+ * @return the accessible child component at the specified index
*/
public Accessible getAccessibleChild(int i)
{
@@ -130,9 +140,10 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Returns the current selection state of the <code>JTabbedPane</code>
+ * as AccessibleSelection object.
*
- * @return DOCUMENT ME!
+ * @return the current selection state of the <code>JTabbedPane</code>
*/
public AccessibleSelection getAccessibleSelection()
{
@@ -140,11 +151,15 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * Returns the accessible child component at the specified coordinates.
+ * If there is no child component at this location, then return the
+ * currently selected tab.
*
- * @param p DOCUMENT ME!
+ * @param p the coordinates at which to look up the child component
*
- * @return DOCUMENT ME!
+ * @return the accessible child component at the specified coordinates or
+ * the currently selected tab if there is no child component at
+ * this location
*/
public Accessible getAccessibleAt(Point p)
{
@@ -152,9 +167,13 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * DOCUMENT ME!
+ * The number of selected child components of the
+ * <code>JTabbedPane</code>. This will be <code>0</code> if the
+ * <code>JTabbedPane</code> has no children, or <code>1</code> otherwise,
+ * since there is always exactly one tab selected.
*
- * @return DOCUMENT ME!
+ * @return number of selected child components of the
+ * <code>JTabbedPane</code>
*/
public int getAccessibleSelectionCount()
{
@@ -192,6 +211,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void addAccessibleSelection(int i)
{
+ // TODO: Implement this properly.
}
/**
@@ -201,6 +221,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void removeAccessibleSelection(int i)
{
+ // TODO: Implement this properly.
}
/**
@@ -208,6 +229,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void clearAccessibleSelection()
{
+ // TODO: Implement this properly.
}
/**
@@ -215,6 +237,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void selectAllAccessibleSelection()
{
+ // TODO: Implement this properly.
}
}
@@ -231,6 +254,7 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
protected ModelListener()
{
+ // Nothing to do here.
}
/**
@@ -313,9 +337,10 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
public void setComponent(Component c)
{
- remove(component);
- this.component = c;
- add(c);
+ int i = indexOfComponent(component);
+ insertTab(title, icon, c, tip, i);
+ component = c;
+ removeTabAt(i);
}
/**
@@ -596,7 +621,7 @@ public class JTabbedPane extends JComponent implements Serializable,
throw new IllegalArgumentException("tabLayoutPolicy is not valid.");
this.tabPlacement = tabPlacement;
layoutPolicy = tabLayoutPolicy;
-
+
changeEvent = new ChangeEvent(this);
changeListener = createChangeListener();
@@ -863,15 +888,17 @@ public class JTabbedPane extends JComponent implements Serializable,
* This method inserts tabs into JTabbedPane. This includes adding the
* component to the JTabbedPane and hiding it.
*
- * @param title The title of the tab.
- * @param icon The tab's icon.
- * @param component The component associated with the tab.
- * @param tip The tooltip for the tab.
- * @param index The index to insert the tab at.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param icon the tab's icon; may be <code>null</code>
+ * @param component the component associated with the tab
+ * @param tip the tooltip for the tab
+ * @param index the index to insert the tab at
*/
public void insertTab(String title, Icon icon, Component component,
String tip, int index)
{
+ if (title == null)
+ title = "";
Page p = new Page(title, icon, component, tip);
tabs.insertElementAt(p, index);
@@ -893,10 +920,10 @@ public class JTabbedPane extends JComponent implements Serializable,
/**
* This method adds a tab to the JTabbedPane.
*
- * @param title The title of the tab.
- * @param icon The icon for the tab.
- * @param component The associated component.
- * @param tip The associated tooltip.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param icon the icon for the tab; may be <code>null</code>
+ * @param component the associated component
+ * @param tip the associated tooltip
*/
public void addTab(String title, Icon icon, Component component, String tip)
{
@@ -906,9 +933,9 @@ public class JTabbedPane extends JComponent implements Serializable,
/**
* This method adds a tab to the JTabbedPane.
*
- * @param title The title of the tab.
- * @param icon The icon for the tab.
- * @param component The associated component.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param icon the icon for the tab; may be <code>null</code>
+ * @param component the associated component
*/
public void addTab(String title, Icon icon, Component component)
{
@@ -918,8 +945,8 @@ public class JTabbedPane extends JComponent implements Serializable,
/**
* This method adds a tab to the JTabbedPane.
*
- * @param title The title of the tab.
- * @param component The associated component.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param component the associated component
*/
public void addTab(String title, Component component)
{
@@ -942,6 +969,7 @@ public class JTabbedPane extends JComponent implements Serializable,
super.add(component);
else
insertTab(component.getName(), null, component, null, tabs.size());
+
return component;
}
@@ -950,8 +978,8 @@ public class JTabbedPane extends JComponent implements Serializable,
* instance of UIResource, it doesn't add the tab and instead add the
* component directly to the JTabbedPane.
*
- * @param title The title of the tab.
- * @param component The associated component.
+ * @param title the title of the tab; may be <code>null</code>
+ * @param component the associated component
*
* @return The Component that was added.
*/
@@ -1025,45 +1053,37 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * The tab and it's associated component are removed. After the component
- * has been removed from the JTabbedPane, it's set visible to ensure that
- * it can be seen.
+ * Removes the tab at index. After the component associated with
+ * index is removed, its visibility is reset to true to ensure it
+ * will be visible if added to other containers.
*
* @param index The index of the tab to remove.
*/
public void removeTabAt(int index)
{
checkIndex(index, 0, tabs.size());
- Component c = getComponentAt(index);
- super.remove(index);
- c.show();
tabs.remove(index);
+ getComponentAt(index).show();
}
/**
- * This method removes the component from the JTabbedPane. After the
- * component has been removed from the JTabbedPane, it's set visible to
- * ensure that it can be seen.
+ * Removes the specified Component from the JTabbedPane.
*
* @param component The Component to remove.
*/
public void remove(Component component)
{
- // This simply removes the component.
- int index = indexOfComponent(component);
super.remove(component);
- component.show();
- setComponentAt(index, null);
}
/**
- * This method removes the tab and component from the JTabbedPane. It simply
- * calls removeTabAt(int index).
+ * Removes the tab and component which corresponds to the specified index.
*
* @param index The index of the tab to remove.
*/
public void remove(int index)
{
+ remove(getComponentAt(index));
removeTabAt(index);
}
diff --git a/libjava/classpath/javax/swing/JTable.java b/libjava/classpath/javax/swing/JTable.java
index 21680d567e2..69a865df9c0 100644
--- a/libjava/classpath/javax/swing/JTable.java
+++ b/libjava/classpath/javax/swing/JTable.java
@@ -40,22 +40,34 @@ package javax.swing;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Cursor;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
+import java.awt.event.FocusListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Date;
import java.util.EventObject;
import java.util.Hashtable;
+import java.util.Locale;
import java.util.Vector;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleExtendedTable;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleTable;
+import javax.accessibility.AccessibleTableModelChange;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ListSelectionEvent;
@@ -76,10 +88,874 @@ import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import javax.swing.text.Caret;
-public class JTable extends JComponent
+public class JTable
+ extends JComponent
implements TableModelListener, Scrollable, TableColumnModelListener,
ListSelectionListener, CellEditorListener, Accessible
{
+ /**
+ * Provides accessibility support for <code>JTable</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJTable
+ extends AccessibleJComponent
+ implements AccessibleSelection, ListSelectionListener, TableModelListener,
+ TableColumnModelListener, CellEditorListener, PropertyChangeListener,
+ AccessibleExtendedTable
+ {
+
+ /**
+ * Provides accessibility support for table cells.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJTableCell
+ extends AccessibleContext
+ implements Accessible, AccessibleComponent
+ {
+
+ /**
+ * The table of this cell.
+ */
+ private JTable table;
+
+ /**
+ * The row index of this cell.
+ */
+ private int row;
+
+ /**
+ * The column index of this cell.
+ */
+ private int column;
+
+ /**
+ * The index of this cell inside the AccessibleJTable parent.
+ */
+ private int index;
+
+ /**
+ * Creates a new <code>AccessibleJTableCell</code>.
+ *
+ * @param t the table
+ * @param r the row
+ * @param c the column
+ * @param i the index of this cell inside the accessible table parent
+ */
+ public AccessibleJTableCell(JTable t, int r, int c, int i)
+ {
+ table = t;
+ row = r;
+ column = c;
+ index = i;
+ }
+
+ /**
+ * Returns the accessible row for the table cell.
+ *
+ * @return the accessible row for the table cell
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ // TODO: What is the role of the table cell?
+ return AccessibleRole.UNKNOWN;
+ }
+
+ /**
+ * Returns the accessible state set of this accessible table cell.
+ *
+ * @return the accessible state set of this accessible table cell
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ // TODO: What state shoiuld be returned here?
+ return new AccessibleStateSet();
+ }
+
+ /**
+ * Returns the index of this cell in the parent object.
+ *
+ * @return the index of this cell in the parent object
+ */
+ public int getAccessibleIndexInParent()
+ {
+ return index;
+ }
+
+ /**
+ * Returns the number of children of this object. Table cells cannot have
+ * children, so we return <code>0</code> here.
+ *
+ * @return <code>0</code>
+ */
+ public int getAccessibleChildrenCount()
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the accessible child at index <code>i</code>. Table cells
+ * don't have children, so we return <code>null</code> here.
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the locale setting for this accessible table cell.
+ *
+ * @return the locale setting for this accessible table cell
+ */
+ public Locale getLocale()
+ {
+ // TODO: For now, we return english here. This must be fixed as soon
+ // as we have a localized Swing.
+ return Locale.ENGLISH;
+ }
+
+ /**
+ * Returns the accessible context of this table cell. Since accessible
+ * table cells are their own accessible context, we return
+ * <code>this</code>.
+ *
+ * @return the accessible context of this table cell
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the background color of this cell.
+ *
+ * @return the background color of this cell
+ */
+ public Color getBackground()
+ {
+ return table.getBackground();
+ }
+
+ /**
+ * Sets the background of the cell. Since table cells cannot have
+ * individual background colors, this method does nothing. Set the
+ * background directly on the table instead.
+ *
+ * @param color not used
+ */
+ public void setBackground(Color color)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the foreground color of the table cell.
+ *
+ * @return the foreground color of the table cell
+ */
+ public Color getForeground()
+ {
+ return table.getForeground();
+ }
+
+ /**
+ * Sets the foreground of the cell. Since table cells cannot have
+ * individual foreground colors, this method does nothing. Set the
+ * foreground directly on the table instead.
+ *
+ * @param color not used
+ */
+ public void setForeground(Color color)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the cursor for this table cell.
+ *
+ * @return the cursor for this table cell
+ */
+ public Cursor getCursor()
+ {
+ return table.getCursor();
+ }
+
+ /**
+ * Sets the cursor of the cell. Since table cells cannot have
+ * individual cursors, this method does nothing. Set the
+ * cursor directly on the table instead.
+ *
+ * @param cursor not used
+ */
+ public void setCursor(Cursor cursor)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the font of the table cell.
+ *
+ * @return the font of the table cell
+ */
+ public Font getFont()
+ {
+ return table.getFont();
+ }
+
+ /**
+ * Sets the font of the cell. Since table cells cannot have
+ * individual fonts, this method does nothing. Set the
+ * font directly on the table instead.
+ *
+ * @param font not used
+ */
+ public void setFont(Font font)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the font metrics for a specified font.
+ *
+ * @param font the font for which we return the metrics
+ *
+ * @return the font metrics for a specified font
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ return table.getFontMetrics(font);
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell is enabled,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this table cell is enabled,
+ * <code>false</code> otherwise
+ */
+ public boolean isEnabled()
+ {
+ return table.isEnabled();
+ }
+
+ /**
+ * Table cells cannot be disabled or enabled individually, so this method
+ * does nothing. Set the enabled flag on the table itself.
+ *
+ * @param b not used here
+ */
+ public void setEnabled(boolean b)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns <code>true</code> if this cell is visible, <code>false</code>
+ * otherwise.
+ *
+ * @return <code>true</code> if this cell is visible, <code>false</code>
+ * otherwise
+ */
+ public boolean isVisible()
+ {
+ return table.isVisible();
+ }
+
+ /**
+ * The visibility cannot be set on individual table cells, so this method
+ * does nothing. Set the visibility on the table itself.
+ *
+ * @param b not used
+ */
+ public void setVisible(boolean b)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell is currently showing on
+ * screen.
+ *
+ * @return <code>true</code> if this table cell is currently showing on
+ * screen
+ */
+ public boolean isShowing()
+ {
+ return table.isShowing();
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell contains the location
+ * at <code>point</code>, <code>false</code> otherwise.
+ * <code>point</code> is interpreted as relative to the coordinate system
+ * of the table cell.
+ *
+ * @return <code>true</code> if this table cell contains the location
+ * at <code>point</code>, <code>false</code> otherwise
+ */
+ public boolean contains(Point point)
+ {
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ cellRect.x = 0;
+ cellRect.y = 0;
+ return cellRect.contains(point);
+ }
+
+ /**
+ * Returns the screen location of the table cell.
+ *
+ * @return the screen location of the table cell
+ */
+ public Point getLocationOnScreen()
+ {
+ Point tableLoc = table.getLocationOnScreen();
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ tableLoc.x += cellRect.x;
+ tableLoc.y += cellRect.y;
+ return tableLoc;
+ }
+
+ /**
+ * Returns the location of this cell relative to the table's bounds.
+ *
+ * @return the location of this cell relative to the table's bounds
+ */
+ public Point getLocation()
+ {
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ return new Point(cellRect.x, cellRect.y);
+ }
+
+ /**
+ * The location of the table cells cannot be manipulated directly, so
+ * this method does nothing.
+ *
+ * @param point not used
+ */
+ public void setLocation(Point point)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the bounds of the cell relative to its table.
+ *
+ * @return the bounds of the cell relative to its table
+ */
+ public Rectangle getBounds()
+ {
+ return table.getCellRect(row, column, true);
+ }
+
+ /**
+ * The bounds of the table cells cannot be manipulated directly, so
+ * this method does nothing.
+ *
+ * @param rectangle not used
+ */
+ public void setBounds(Rectangle rectangle)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the size of the table cell.
+ *
+ * @return the size of the table cell
+ */
+ public Dimension getSize()
+ {
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ return new Dimension(cellRect.width, cellRect.height);
+ }
+
+ /**
+ * The size cannot be set on table cells directly, so this method does
+ * nothing.
+ *
+ * @param dimension not used
+ */
+ public void setSize(Dimension dimension)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Table cells have no children, so we return <code>null</code> here.
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleAt(Point point)
+ {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell is focus traversable,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this table cell is focus traversable,
+ * <code>false</code> otherwise
+ */
+ public boolean isFocusTraversable()
+ {
+ return table.isFocusable();
+ }
+
+ /**
+ * Requests that this table cell gets the keyboard focus.
+ */
+ public void requestFocus()
+ {
+ // We first set the selection models' lead selection to this cell.
+ table.getColumnModel().getSelectionModel()
+ .setLeadSelectionIndex(column);
+ table.getSelectionModel().setLeadSelectionIndex(row);
+ // Now we request that the table receives focus.
+ table.requestFocus();
+ }
+
+ /**
+ * Adds a focus listener to this cell. The focus listener is really
+ * added to the table, so there is no way to find out when an individual
+ * cell changes the focus.
+ *
+ * @param listener the focus listener to add
+ */
+ public void addFocusListener(FocusListener listener)
+ {
+ table.addFocusListener(listener);
+ }
+
+ /**
+ * Removes a focus listener from the cell. The focus listener is really
+ * removed from the table.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeFocusListener(FocusListener listener)
+ {
+ table.removeFocusListener(listener);
+ }
+
+ }
+
+ protected class AccessibleJTableModelChange
+ implements AccessibleTableModelChange
+ {
+ protected int type;
+ protected int firstRow;
+ protected int lastRow;
+ protected int firstColumn;
+ protected int lastColumn;
+
+ protected AccessibleJTableModelChange(int type, int firstRow,
+ int lastRow, int firstColumn,
+ int lastColumn)
+ {
+ this.type = type;
+ this.firstRow = firstRow;
+ this.lastRow = lastRow;
+ this.firstColumn = firstColumn;
+ this.lastColumn = lastColumn;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+
+ public int getFirstRow()
+ {
+ return firstRow;
+ }
+
+ public int getLastRow()
+ {
+ return lastRow;
+ }
+
+ public int getFirstColumn()
+ {
+ return firstColumn;
+ }
+
+ public int getLastColumn()
+ {
+ return lastColumn;
+ }
+ }
+
+ /**
+ * Creates a new <code>AccessibleJTable</code>.
+ *
+ * @since JDK1.5
+ */
+ protected AccessibleJTable()
+ {
+ getModel().addTableModelListener(this);
+ getSelectionModel().addListSelectionListener(this);
+ getColumnModel().addColumnModelListener(this);
+ getCellEditor().addCellEditorListener(this);
+ }
+
+ /**
+ * Returns the number of selected items in this table.
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return getSelectedColumnCount();
+ }
+
+ public Accessible getAccessibleSelection(int i)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isAccessibleChildSelected(int i)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void addAccessibleSelection(int i)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeAccessibleSelection(int i)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void clearAccessibleSelection()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void selectAllAccessibleSelection()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void valueChanged(ListSelectionEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Receives notification when the table model changes. Depending on the
+ * type of change, this method calls {@link #tableRowsInserted} or
+ * {@link #tableRowsDeleted}.
+ *
+ * @param event the table model event
+ */
+ public void tableChanged(TableModelEvent event)
+ {
+ switch (event.getType())
+ {
+ case TableModelEvent.INSERT:
+ tableRowsInserted(event);
+ break;
+ case TableModelEvent.DELETE:
+ tableRowsDeleted(event);
+ break;
+ }
+ }
+
+ /**
+ * Receives notification when one or more rows have been inserted into the
+ * table.
+ *
+ * @param event the table model event
+ */
+ public void tableRowsInserted(TableModelEvent event)
+ {
+ // TODO: What to do here, if anything? This might be a hook method for
+ // subclasses...
+ }
+
+ /**
+ * Receives notification when one or more rows have been deleted from the
+ * table.
+ *
+ * @param event the table model event
+ */
+ public void tableRowsDeleted(TableModelEvent event)
+ {
+ // TODO: What to do here, if anything? This might be a hook method for
+ // subclasses...
+ }
+
+ public void columnAdded(TableColumnModelEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void columnMarginChanged(ChangeEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void columnMoved(TableColumnModelEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void columnRemoved(TableColumnModelEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void columnSelectionChanged(ListSelectionEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void editingCanceled(ChangeEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void editingStopped(ChangeEvent event)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Receives notification when any of the JTable's properties changes. This
+ * is used to replace the listeners on the table's model, selection model,
+ * column model and cell editor.
+ *
+ * @param e the property change event
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ String propName = e.getPropertyName();
+ if (propName.equals("tableModel"))
+ {
+ TableModel oldModel = (TableModel) e.getOldValue();
+ oldModel.removeTableModelListener(this);
+ TableModel newModel = (TableModel) e.getNewValue();
+ newModel.addTableModelListener(this);
+ }
+ else if (propName.equals("columnModel"))
+ {
+ TableColumnModel oldModel = (TableColumnModel) e.getOldValue();
+ oldModel.removeColumnModelListener(this);
+ TableColumnModel newModel = (TableColumnModel) e.getNewValue();
+ newModel.addColumnModelListener(this);
+ }
+ else if (propName.equals("selectionModel"))
+ {
+ ListSelectionModel oldModel = (ListSelectionModel) e.getOldValue();
+ oldModel.removeListSelectionListener(this);
+ ListSelectionModel newModel = (ListSelectionModel) e.getNewValue();
+ newModel.addListSelectionListener(this);
+ }
+ else if (propName.equals("cellEditor"))
+ {
+ CellEditor oldEd = (CellEditor) e.getOldValue();
+ oldEd.removeCellEditorListener(this);
+ CellEditor newEd = (CellEditor) e.getNewValue();
+ newEd.addCellEditorListener(this);
+ }
+ }
+
+ public int getAccessibleRow(int index)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getAccessibleColumn(int index)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getAccessibleIndex(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Accessible getAccessibleCaption()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleCaption(Accessible caption)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Accessible getAccessibleSummary()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleSummary(Accessible summary)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public int getAccessibleRowCount()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getAccessibleColumnCount()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Accessible getAccessibleAt(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getAccessibleRowExtentAt(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getAccessibleColumnExtentAt(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public AccessibleTable getAccessibleRowHeader()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleRowHeader(AccessibleTable header)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public AccessibleTable getAccessibleColumnHeader()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleColumnHeader(AccessibleTable header)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Accessible getAccessibleRowDescription(int r)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleRowDescription(int r, Accessible description)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Accessible getAccessibleColumnDescription(int c)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setAccessibleColumnDescription(int c, Accessible description)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean isAccessibleSelected(int r, int c)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isAccessibleRowSelected(int r)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean isAccessibleColumnSelected(int c)
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public int[] getSelectedAccessibleRows()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int[] getSelectedAccessibleColumns()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+ /**
+ * Handles property changes from the <code>TableColumn</code>s of this
+ * <code>JTable</code>.
+ *
+ * More specifically, this triggers a {@link #revalidate()} call if the
+ * preferredWidth of one of the observed columns changes.
+ */
+ class TableColumnPropertyChangeHandler implements PropertyChangeListener
+ {
+ /**
+ * Receives notification that a property of the observed TableColumns
+ * has changed.
+ *
+ * @param ev the property change event
+ */
+ public void propertyChange(PropertyChangeEvent ev)
+ {
+ if (ev.getPropertyName().equals("preferredWidth"))
+ {
+ JTableHeader header = getTableHeader();
+ TableColumn col = (TableColumn) ev.getSource();
+ header.setResizingColumn(col);
+ doLayout();
+ header.setResizingColumn(null);
+ }
+ }
+ }
/**
* A cell renderer for boolean values.
@@ -364,7 +1240,7 @@ public class JTable extends JComponent
* property when the {@link #dataModel} property is changed.
*
* @see #setModel(TableModel)
- * @see #createColumnsFromModel()
+ * @see #createDefaultColumnsFromModel()
* @see #setColumnModel(TableColumnModel)
* @see #setAutoCreateColumnsFromModel(boolean)
* @see #getAutoCreateColumnsFromModel()
@@ -480,11 +1356,6 @@ public class JTable extends JComponent
protected ListSelectionModel selectionModel;
/**
- * The accessibleContext property.
- */
- protected AccessibleContext accessibleContext;
-
- /**
* The current cell editor.
*/
protected TableCellEditor cellEditor;
@@ -492,7 +1363,7 @@ public class JTable extends JComponent
/**
* Whether or not drag-and-drop is enabled on this table.
*
- * @see #setDragEnabled()
+ * @see #setDragEnabled(boolean)
* @see #getDragEnabled()
*/
private boolean dragEnabled;
@@ -584,6 +1455,12 @@ public class JTable extends JComponent
Object oldCellValue;
/**
+ * The property handler for this table's columns.
+ */
+ TableColumnPropertyChangeHandler tableColumnPropertyChangeHandler =
+ new TableColumnPropertyChangeHandler();
+
+ /**
* Creates a new <code>JTable</code> instance.
*/
public JTable ()
@@ -643,15 +1520,28 @@ public class JTable extends JComponent
*/
public JTable (TableModel dm, TableColumnModel cm, ListSelectionModel sm)
{
- setModel(dm == null ? createDefaultDataModel() : dm);
+ boolean autoCreate = false;
+ if (cm != null)
+ setColumnModel(cm);
+ else
+ {
+ setColumnModel(createDefaultColumnModel());
+ autoCreate = true;
+ }
setSelectionModel(sm == null ? createDefaultSelectionModel() : sm);
-
- this.columnModel = cm;
+ setModel(dm == null ? createDefaultDataModel() : dm);
+ setAutoCreateColumnsFromModel(autoCreate);
initializeLocalVars();
- // The next two lines are for compliance with the JDK which starts
- // the JLists associated with a JTable with both lead selection
- // indices at 0, rather than -1 as in regular JLists
+ // The following four lines properly set the lead selection indices.
+ // After this, the UI will handle the lead selection indices.
+ // FIXME: this should probably not be necessary, if the UI is installed
+ // before the TableModel is set then the UI will handle things on its
+ // own, but certain variables need to be set before the UI can be installed
+ // so we must get the correct order for all the method calls in this
+ // constructor.
+ selectionModel.setAnchorSelectionIndex(0);
selectionModel.setLeadSelectionIndex(0);
+ columnModel.getSelectionModel().setAnchorSelectionIndex(0);
columnModel.getSelectionModel().setLeadSelectionIndex(0);
updateUI();
}
@@ -659,12 +1549,8 @@ public class JTable extends JComponent
protected void initializeLocalVars()
{
setTableHeader(createDefaultTableHeader());
- this.autoCreateColumnsFromModel = false;
- if (columnModel == null)
- {
- this.autoCreateColumnsFromModel = true;
- createColumnsFromModel();
- }
+ if (autoCreateColumnsFromModel)
+ createDefaultColumnsFromModel();
this.columnModel.addColumnModelListener(this);
this.defaultRenderersByColumnClass = new Hashtable();
@@ -754,6 +1640,7 @@ public class JTable extends JComponent
}
columnModel.addColumn(column);
+ column.addPropertyChangeListener(tableColumnPropertyChangeHandler);
}
protected void createDefaultEditors()
@@ -799,20 +1686,6 @@ public class JTable extends JComponent
return new JTableHeader(columnModel);
}
- private void createColumnsFromModel()
- {
- if (dataModel == null)
- return;
-
- TableColumnModel cm = createDefaultColumnModel();
-
- for (int i = 0; i < dataModel.getColumnCount(); ++i)
- {
- cm.addColumn(new TableColumn(i));
- }
- this.setColumnModel(cm);
- }
-
// listener support
public void columnAdded (TableColumnModelEvent event)
@@ -890,8 +1763,19 @@ public class JTable extends JComponent
if ((event.getFirstRow() ==TableModelEvent.HEADER_ROW)
&& autoCreateColumnsFromModel)
- createColumnsFromModel();
+ createDefaultColumnsFromModel();
+ // If the structure changes, we need to revalidate, since that might
+ // affect the size parameters of the JTable. Otherwise we only need
+ // to perform a repaint to update the view.
+ if (event.getType() == TableModelEvent.INSERT)
+ revalidate();
+ else if (event.getType() == TableModelEvent.DELETE)
+ {
+ if (dataModel.getRowCount() == 0)
+ clearSelection();
+ revalidate();
+ }
repaint();
}
@@ -944,8 +1828,7 @@ public class JTable extends JComponent
{
int y0 = getLocation().y;
int nrows = getRowCount();
- Dimension gap = getIntercellSpacing();
- int height = getRowHeight() + (gap == null ? 0 : gap.height);
+ int height = getRowHeight();
int y = point.y;
for (int i = 0; i < nrows; ++i)
@@ -990,10 +1873,7 @@ public class JTable extends JComponent
int y = (height + y_gap) * row;
for (int i = 0; i < column; ++i)
- {
- x += columnModel.getColumn(i).getWidth();
- x += x_gap;
- }
+ x += columnModel.getColumn(i).getWidth();
if (includeSpacing)
return new Rectangle(x, y, width, height);
@@ -1015,7 +1895,7 @@ public class JTable extends JComponent
* @return The current value of the selectedRow property
*/
public int getSelectedRow ()
- {
+ {
return selectionModel.getMinSelectionIndex();
}
@@ -1069,13 +1949,14 @@ public class JTable extends JComponent
// scroll direction.
if (orientation == SwingConstants.VERTICAL)
- return rowHeight;
+ return direction * rowHeight;
else
{
int sum = 0;
for (int i = 0; i < getColumnCount(); ++i)
sum += columnModel.getColumn(0).getWidth();
- return getColumnCount() == 0 ? 10 : sum / getColumnCount();
+ int inc = getColumnCount() == 0 ? 10 : sum / getColumnCount();
+ return direction * inc;
}
}
@@ -1656,24 +2537,29 @@ public class JTable extends JComponent
// Don't do anything if setting the current model again.
if (dataModel == m)
return;
-
+
+ TableModel oldModel = dataModel;
+
// Remove table as TableModelListener from old model.
if (dataModel != null)
dataModel.removeTableModelListener(this);
if (m != null)
{
- // Set property.
+ // Set property.
dataModel = m;
- // Add table as TableModelListener to new model.
- dataModel.addTableModelListener(this);
+ // Add table as TableModelListener to new model.
+ dataModel.addTableModelListener(this);
- // Automatically create columns.
- if (autoCreateColumnsFromModel)
- createColumnsFromModel();
+ // Automatically create columns.
+ if (autoCreateColumnsFromModel)
+ createDefaultColumnsFromModel();
}
-
+
+ // This property is bound, so we fire a property change event.
+ firePropertyChange("model", oldModel, dataModel);
+
// Repaint table.
revalidate();
repaint();
@@ -1959,7 +2845,8 @@ public class JTable extends JComponent
int average = spill / cols.length;
for (int i = 0; i < cols.length; i++)
{
- cols[i].setWidth(cols[i].getWidth() + average);
+ if (cols[i] != null)
+ cols[i].setWidth(cols[i].getWidth() + average);
}
}
@@ -2023,6 +2910,8 @@ public class JTable extends JComponent
case AUTO_RESIZE_OFF:
default:
+ int prefWidth = resizingColumn.getPreferredWidth();
+ resizingColumn.setWidth(prefWidth);
}
}
else
@@ -2258,6 +3147,8 @@ public class JTable extends JComponent
*/
public void createDefaultColumnsFromModel()
{
+ assert columnModel != null : "The columnModel must not be null.";
+
// remove existing columns
int columnIndex = columnModel.getColumnCount() - 1;
while (columnIndex >= 0)
@@ -2272,7 +3163,9 @@ public class JTable extends JComponent
{
TableColumn column = new TableColumn(c);
column.setIdentifier(dataModel.getColumnName(c));
+ column.setHeaderValue(dataModel.getColumnName(c));
columnModel.addColumn(column);
+ column.addPropertyChangeListener(tableColumnPropertyChangeHandler);
}
}
@@ -2372,4 +3265,13 @@ public class JTable extends JComponent
return editor.getTableCellEditorComponent
(this, getValueAt(row, column), isCellSelected(row, column), row, column);
}
+
+ /**
+ * This revalidates the <code>JTable</code> and queues a repaint.
+ */
+ protected void resizeAndRepaint()
+ {
+ revalidate();
+ repaint();
+ }
}
diff --git a/libjava/classpath/javax/swing/JTextArea.java b/libjava/classpath/javax/swing/JTextArea.java
index 53591ffcc3a..2fa185b6207 100644
--- a/libjava/classpath/javax/swing/JTextArea.java
+++ b/libjava/classpath/javax/swing/JTextArea.java
@@ -42,6 +42,8 @@ import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Rectangle;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleStateSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Element;
@@ -92,6 +94,35 @@ import javax.swing.text.View;
public class JTextArea extends JTextComponent
{
/**
+ * Provides accessibility support for <code>JTextArea</code>.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJTextArea extends AccessibleJTextComponent
+ {
+
+ /**
+ * Creates a new <code>AccessibleJTextArea</code> object.
+ */
+ protected AccessibleJTextArea()
+ {
+ super();
+ }
+
+ /**
+ * Returns the accessible state of this <code>AccessibleJTextArea</code>.
+ *
+ * @return the accessible state of this <code>AccessibleJTextArea</code>
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ AccessibleStateSet state = super.getAccessibleStateSet();
+ // TODO: Figure out what state must be added here to the super's state.
+ return state;
+ }
+ }
+
+ /**
* Compatible with Sun's JDK
*/
private static final long serialVersionUID = -6141680179310439825L;
@@ -208,6 +239,8 @@ public class JTextArea extends JTextComponent
/* This shouldn't happen in theory -- but, if it does... */
throw new RuntimeException("Unexpected exception occurred.", exception);
}
+ if (toAppend != null && toAppend.length() > 0)
+ revalidate();
}
/**
@@ -312,8 +345,12 @@ public class JTextArea extends JTextComponent
{
if (columns < 0)
throw new IllegalArgumentException();
-
- this.columns = columns;
+
+ if (columns != this.columns)
+ {
+ this.columns = columns;
+ revalidate();
+ }
}
/**
@@ -337,8 +374,12 @@ public class JTextArea extends JTextComponent
{
if (rows < 0)
throw new IllegalArgumentException();
-
- this.rows = rows;
+
+ if (rows != this.rows)
+ {
+ this.rows = rows;
+ revalidate();
+ }
}
/**
@@ -547,4 +588,16 @@ public class JTextArea extends JTextComponent
return new Dimension(Math.max(reqWidth, neededWidth),
Math.max(reqHeight, neededHeight));
}
+
+ /**
+ * Returns the accessible context associated with the <code>JTextArea</code>.
+ *
+ * @return the accessible context associated with the <code>JTextArea</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJTextArea();
+ return accessibleContext;
+ }
}
diff --git a/libjava/classpath/javax/swing/JTextField.java b/libjava/classpath/javax/swing/JTextField.java
index 5ae9c9f1a82..8dc2f256914 100644
--- a/libjava/classpath/javax/swing/JTextField.java
+++ b/libjava/classpath/javax/swing/JTextField.java
@@ -46,9 +46,8 @@ import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleStateSet;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.JTextComponent;
import javax.swing.text.PlainDocument;
@@ -69,15 +68,19 @@ public class JTextField extends JTextComponent
*/
protected AccessibleJTextField()
{
+ super();
}
/**
- * getAccessibleStateSet
- * @return AccessibleStateSet
+ * Returns the accessible state of this <code>AccessibleJTextField</code>.
+ *
+ * @return the accessible state of this <code>AccessibleJTextField</code>
*/
public AccessibleStateSet getAccessibleStateSet()
{
- return null;
+ AccessibleStateSet state = super.getAccessibleStateSet();
+ // TODO: Figure out what state must be added here to the super's state.
+ return state;
}
}
@@ -92,17 +95,17 @@ public class JTextField extends JTextComponent
public static final String notifyAction = "notify-field-accept";
static
- {
- actions = new Action[1];
- actions[0] = new TextAction(notifyAction)
+ {
+ actions = new Action[1];
+ actions[0] = new TextAction(notifyAction)
{
- public void actionPerformed(ActionEvent event)
- {
- JTextField textField = (JTextField) event.getSource();
- textField.fireActionPerformed();
- }
+ public void actionPerformed(ActionEvent event)
+ {
+ JTextField textField = (JTextField) event.getSource();
+ textField.fireActionPerformed();
+ }
};
- }
+ }
private int columns;
private int align;
@@ -117,6 +120,11 @@ public class JTextField extends JTextComponent
private PropertyChangeListener actionPropertyChangeListener;
/**
+ * The horizontal visibility of the textfield.
+ */
+ private BoundedRangeModel horizontalVisibility;
+
+ /**
* Creates a new instance of <code>JTextField</code>.
*/
public JTextField()
@@ -172,9 +180,9 @@ public class JTextField extends JTextComponent
{
if (columns < 0)
throw new IllegalArgumentException();
-
+
this.columns = columns;
-
+
setDocument(doc == null ? createDefaultModel() : doc);
if (text != null)
@@ -182,6 +190,9 @@ public class JTextField extends JTextComponent
// default value for alignment
align = LEADING;
+
+ // Initialize the horizontal visibility model.
+ horizontalVisibility = new DefaultBoundedRangeModel();
}
/**
@@ -192,15 +203,9 @@ public class JTextField extends JTextComponent
*/
protected Document createDefaultModel()
{
- // subclassed to swallow newlines
- return new PlainDocument() {
- public void insertString(int offset, String str, AttributeSet a)
- throws BadLocationException
- {
- if (str != null && str.indexOf('\n') == -1)
- super.insertString(offset, str, a);
- }
- };
+ PlainDocument doc = new PlainDocument();
+ doc.putProperty("filterNewlines", Boolean.TRUE);
+ return doc;
}
/**
@@ -268,6 +273,11 @@ public class JTextField extends JTextComponent
return columns;
}
+ /**
+ * Sets the number of columns and then invalidates the layout.
+ * @param columns the number of columns
+ * @throws IllegalArgumentException if columns < 0
+ */
public void setColumns(int columns)
{
if (columns < 0)
@@ -275,16 +285,31 @@ public class JTextField extends JTextComponent
this.columns = columns;
invalidate();
+ //FIXME: do we need this repaint call?
repaint();
}
+ /**
+ * Returns the horizontal alignment, which is one of: JTextField.LEFT,
+ * JTextField.CENTER, JTextField.RIGHT, JTextField.LEADING,
+ * JTextField.TRAILING.
+ * @return the horizontal alignment
+ */
public int getHorizontalAlignment()
{
return align;
}
+ /**
+ * Sets the horizontal alignment of the text. Calls invalidate and repaint
+ * and fires a property change event.
+ * @param newAlign must be one of: JTextField.LEFT, JTextField.CENTER,
+ * JTextField.RIGHT, JTextField.LEADING, JTextField.TRAILING.
+ * @throws IllegalArgumentException if newAlign is not one of the above.
+ */
public void setHorizontalAlignment(int newAlign)
{
+ //FIXME: should throw an IllegalArgumentException if newAlign is invalid
if (align == newAlign)
return;
@@ -295,12 +320,20 @@ public class JTextField extends JTextComponent
repaint();
}
+ /**
+ * Sets the current font and revalidates so the font will take effect.
+ */
public void setFont(Font newFont)
{
super.setFont(newFont);
revalidate();
}
+ /**
+ * Returns the preferred size. If there is a non-zero number of columns,
+ * this is the number of columns multiplied by the column width, otherwise
+ * it returns super.getPreferredSize().
+ */
public Dimension getPreferredSize()
{
Dimension size = super.getPreferredSize();
@@ -318,6 +351,7 @@ public class JTextField extends JTextComponent
*/
public int getScrollOffset()
{
+ //FIXME: this should return horizontalVisibility's value
return scrollOffset;
}
@@ -328,9 +362,15 @@ public class JTextField extends JTextComponent
*/
public void setScrollOffset(int offset)
{
+ //FIXME: this should actualy scroll the field if needed
scrollOffset = offset;
}
+ /**
+ * Returns the set of Actions that are commands for the editor.
+ * This is the actions supported by this editor plus the actions
+ * of the UI (returned by JTextComponent.getActions()).
+ */
public Action[] getActions()
{
return TextAction.augmentList(super.getActions(), actions);
@@ -364,26 +404,27 @@ public class JTextField extends JTextComponent
if (action != null)
{
- removeActionListener(action);
- action.removePropertyChangeListener(actionPropertyChangeListener);
- actionPropertyChangeListener = null;
+ removeActionListener(action);
+ action.removePropertyChangeListener(actionPropertyChangeListener);
+ actionPropertyChangeListener = null;
}
-
+
Action oldAction = action;
action = newAction;
if (action != null)
{
- addActionListener(action);
- actionPropertyChangeListener =
- createActionPropertyChangeListener(action);
- action.addPropertyChangeListener(actionPropertyChangeListener);
+ addActionListener(action);
+ actionPropertyChangeListener = createActionPropertyChangeListener(action);
+ action.addPropertyChangeListener(actionPropertyChangeListener);
}
-
+
+ //FIXME: is this a hack? The horizontal alignment hasn't changed
firePropertyChange("horizontalAlignment", oldAction, newAction);
}
/**
+ * Sets the command string used in action events.
* @since 1.3
*/
public void setActionCommand(String command)
@@ -397,45 +438,79 @@ public class JTextField extends JTextComponent
protected PropertyChangeListener createActionPropertyChangeListener(Action action)
{
return new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent event)
{
- public void propertyChange(PropertyChangeEvent event)
- {
- // Update properties "action" and "horizontalAlignment".
- String name = event.getPropertyName();
-
- if (name.equals("enabled"))
- {
- boolean enabled = ((Boolean) event.getNewValue()).booleanValue();
- JTextField.this.setEnabled(enabled);
- }
- else if (name.equals(Action.SHORT_DESCRIPTION))
- {
- JTextField.this.setToolTipText((String) event.getNewValue());
- }
- }
- };
+ // Update properties "action" and "horizontalAlignment".
+ String name = event.getPropertyName();
+
+ if (name.equals("enabled"))
+ {
+ boolean enabled = ((Boolean) event.getNewValue()).booleanValue();
+ JTextField.this.setEnabled(enabled);
+ }
+ else if (name.equals(Action.SHORT_DESCRIPTION))
+ {
+ JTextField.this.setToolTipText((String) event.getNewValue());
+ }
+ }
+ };
}
/**
+ *
* @since 1.3
*/
protected void configurePropertiesFromAction(Action action)
{
if (action != null)
{
- setEnabled(action.isEnabled());
- setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
+ setEnabled(action.isEnabled());
+ setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
}
else
{
- setEnabled(true);
- setToolTipText(null);
+ setEnabled(true);
+ setToolTipText(null);
}
}
+ /**
+ * Returns the column width, which is the width of the character m
+ * for the font in use.
+ * @return the width of the character m for the font in use.
+ */
protected int getColumnWidth()
{
FontMetrics metrics = getToolkit().getFontMetrics(getFont());
return metrics.charWidth('m');
}
+
+ /**
+ * Returns the accessible context associated with the <code>JTextField</code>.
+ *
+ * @return the accessible context associated with the <code>JTextField</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJTextField();
+ return accessibleContext;
+ }
+
+ /**
+ * Returns the bounded range model that describes the horizontal visibility
+ * of the text field in the case when the text does not fit into the
+ * available space. The actual values of this model are managed by the look
+ * and feel implementation.
+ *
+ * @return the bounded range model that describes the horizontal visibility
+ */
+ public BoundedRangeModel getHorizontalVisibility()
+ {
+ // TODO: The real implementation of this property is still missing.
+ // However, this is not done in JTextField but must instead be handled in
+ // javax.swing.text.FieldView.
+ return horizontalVisibility;
+ }
}
diff --git a/libjava/classpath/javax/swing/JTextPane.java b/libjava/classpath/javax/swing/JTextPane.java
index 80632fff38e..a2aebd4ca68 100644
--- a/libjava/classpath/javax/swing/JTextPane.java
+++ b/libjava/classpath/javax/swing/JTextPane.java
@@ -39,8 +39,6 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
@@ -51,6 +49,7 @@ import javax.swing.text.Element;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.Style;
+import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
import javax.swing.text.StyledEditorKit;
@@ -106,7 +105,7 @@ public class JTextPane
* @throws IllegalArgumentException if <code>document</code> is not an
* instance of <code>StyledDocument</code>
*
- * @see {@link #setStyledDocument}
+ * @see #setStyledDocument
*/
public void setDocument(Document document)
{
@@ -120,7 +119,7 @@ public class JTextPane
/**
* Returns the {@link StyledDocument} that is the content model for
* this <code>JTextPane</code>. This is a typed wrapper for
- * {@link #getDocument}.
+ * {@link #getDocument()}.
*
* @return the content model of this <code>JTextPane</code>
*/
@@ -179,8 +178,6 @@ public class JTextPane
doc.setCharacterAttributes(start, contentLength, getInputAttributes(),
true);
- // Set dot to new position.
- setCaretPosition(start + contentLength);
}
catch (BadLocationException e)
{
@@ -197,9 +194,20 @@ public class JTextPane
*/
public void insertComponent(Component component)
{
- // TODO: One space must be inserted here with attributes set to indicate
- // that the component must be displayed here. Have to figure out the
- // attributes.
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ atts.addAttribute(StyleConstants.ComponentAttribute, component);
+ atts.addAttribute(StyleConstants.NameAttribute,
+ StyleConstants.ComponentElementName);
+ try
+ {
+ getDocument().insertString(getCaret().getDot(), " ", atts);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("Unexpected bad location");
+ err.initCause(ex);
+ throw err;
+ }
}
/**
@@ -209,9 +217,20 @@ public class JTextPane
*/
public void insertIcon(Icon icon)
{
- // TODO: One space must be inserted here with attributes set to indicate
- // that the icon must be displayed here. Have to figure out the
- // attributes.
+ SimpleAttributeSet atts = new SimpleAttributeSet();
+ atts.addAttribute(StyleConstants.IconAttribute, icon);
+ atts.addAttribute(StyleConstants.NameAttribute,
+ StyleConstants.IconElementName);
+ try
+ {
+ getDocument().insertString(getCaret().getDot(), " ", atts);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("Unexpected bad location");
+ err.initCause(ex);
+ throw err;
+ }
}
/**
@@ -300,7 +319,7 @@ public class JTextPane
* @param replace if <code>true</code>, the attributes of the current
* selection are overridden, otherwise they are merged
*
- * @see {@link #getInputAttributes}
+ * @see #getInputAttributes
*/
public void setCharacterAttributes(AttributeSet attribute,
boolean replace)
diff --git a/libjava/classpath/javax/swing/JToggleButton.java b/libjava/classpath/javax/swing/JToggleButton.java
index 25d67f59e4f..077e5adb887 100644
--- a/libjava/classpath/javax/swing/JToggleButton.java
+++ b/libjava/classpath/javax/swing/JToggleButton.java
@@ -129,7 +129,7 @@ public class JToggleButton extends AbstractButton implements Accessible
* Compatible with Sun's JDK.
*/
private static final long serialVersionUID = -1589950750899943974L;
-
+
/**
* Sets the pressed state of the button. The selected state
* of the button also changes follwing the button being pressed.
@@ -174,8 +174,27 @@ public class JToggleButton extends AbstractButton implements Accessible
ActionEvent.ACTION_PERFORMED,
actionCommand));
}
-
}
+
+ /**
+ * Checks if the button is selected.
+ *
+ * @returns true if the button is selected
+ */
+ public boolean isSelected()
+ {
+ return super.isSelected();
+ }
+
+ /**
+ * Sets the selected state of the button.
+ *
+ * @param b true if button is selected
+ */
+ public void setSelected(boolean b)
+ {
+ super.setSelected(b);
+ }
}
/**
@@ -276,6 +295,7 @@ public class JToggleButton extends AbstractButton implements Accessible
setModel(new ToggleButtonModel());
model.setSelected(selected);
+ setAlignmentX(LEFT_ALIGNMENT);
}
/**
diff --git a/libjava/classpath/javax/swing/JToolBar.java b/libjava/classpath/javax/swing/JToolBar.java
index 649919e0618..a508ee6d8e7 100644
--- a/libjava/classpath/javax/swing/JToolBar.java
+++ b/libjava/classpath/javax/swing/JToolBar.java
@@ -68,6 +68,8 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
/**
* AccessibleJToolBar
*/
+ // FIXME: This inner class is a complete stub and must be implemented
+ // properly.
protected class AccessibleJToolBar extends AccessibleJComponent
{
/** DOCUMENT ME! */
@@ -78,6 +80,7 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
*/
protected AccessibleJToolBar()
{
+ // Nothing to do here.
}
/**
@@ -749,7 +752,6 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
{
AbstractButton b = (AbstractButton) component;
b.setRolloverEnabled(rollover);
- b.updateUI();
}
} // addImpl()
diff --git a/libjava/classpath/javax/swing/JToolTip.java b/libjava/classpath/javax/swing/JToolTip.java
index 8d774782780..6bc3e3fa287 100644
--- a/libjava/classpath/javax/swing/JToolTip.java
+++ b/libjava/classpath/javax/swing/JToolTip.java
@@ -58,6 +58,8 @@ public class JToolTip extends JComponent implements Accessible
/**
* DOCUMENT ME!
*/
+ // FIXME: This inner class is a complete stub and must be implemented
+ // properly.
protected class AccessibleJToolTip extends AccessibleJComponent
{
private static final long serialVersionUID = -6222548177795408476L;
@@ -67,6 +69,7 @@ public class JToolTip extends JComponent implements Accessible
*/
protected AccessibleJToolTip()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/JTree.java b/libjava/classpath/javax/swing/JTree.java
index bb24c7a459d..4422a193396 100644
--- a/libjava/classpath/javax/swing/JTree.java
+++ b/libjava/classpath/javax/swing/JTree.java
@@ -37,16 +37,32 @@ exception statement from your version. */
package javax.swing;
+import java.awt.Color;
+import java.awt.Cursor;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.FocusListener;
+import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Vector;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleText;
+import javax.accessibility.AccessibleValue;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeModelEvent;
@@ -57,7 +73,6 @@ import javax.swing.event.TreeWillExpandListener;
import javax.swing.plaf.TreeUI;
import javax.swing.text.Position;
import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.DefaultTreeSelectionModel;
import javax.swing.tree.ExpandVetoException;
@@ -68,1754 +83,2830 @@ import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
-public class JTree
- extends JComponent
- implements Scrollable, Accessible
+public class JTree extends JComponent implements Scrollable, Accessible
{
- /**
- * Listens to the model of the JTree and updates the property
- * <code>expandedState</code> if nodes are removed or changed.
- */
- protected class TreeModelHandler
- implements
- TreeModelListener
- {
-
- /**
- * Creates a new instance of TreeModelHandler.
- */
- protected TreeModelHandler()
- {
- }
-
- /**
- * Notifies when a node has changed in some ways. This does not include
- * that a node has changed its location or changed it's children. It
- * only means that some attributes of the node have changed that might
- * affect its presentation.
- *
- * This method is called after the actual change occured.
- *
- * @param ev the TreeModelEvent describing the change
- */
- public void treeNodesChanged(TreeModelEvent ev)
- {
- // nothing to do here
- }
-
- /**
- * Notifies when a node is inserted into the tree.
- *
- * This method is called after the actual change occured.
- *
- * @param ev the TreeModelEvent describing the change
- */
- public void treeNodesInserted(TreeModelEvent ev)
- {
- // nothing to do here
- }
-
- /**
- * Notifies when a node is removed from the tree.
- *
- * This method is called after the actual change occured.
- *
- * @param ev the TreeModelEvent describing the change
- */
- public void treeNodesRemoved(TreeModelEvent ev)
- {
- // TODO: The API docs suggest that this method should do something
- // but I cannot really see what has to be done here ...
- }
-
- /**
- * Notifies when the structure of the tree is changed.
- *
- * This method is called after the actual change occured.
- *
- * @param ev the TreeModelEvent describing the change
- */
- public void treeStructureChanged(TreeModelEvent ev)
- {
- // set state of new path
- TreePath path = ev.getTreePath();
- setExpandedState(path, isExpanded(path));
- }
- } // TreeModelHandler
-
- /**
- * This redirects TreeSelectionEvents and rewrites the source of it to be
- * this JTree. This is typically done when the tree model generates an
- * event, but the JTree object associated with that model should be listed
- * as the actual source of the event.
- */
- protected class TreeSelectionRedirector
- implements
- TreeSelectionListener,
- Serializable
- {
- /** The serial version UID. */
- private static final long serialVersionUID = -3505069663646241664L;
-
- /**
- * Creates a new instance of TreeSelectionRedirector
- */
- protected TreeSelectionRedirector()
- {
- }
-
- /**
- * Notifies when the tree selection changes.
- *
- * @param ev the TreeSelectionEvent that describes the change
- */
- public void valueChanged(TreeSelectionEvent ev)
- {
- TreeSelectionEvent rewritten = (TreeSelectionEvent) ev
- .cloneWithSource(JTree.this);
- fireValueChanged(rewritten);
- JTree.this.repaint();
- }
- } // TreeSelectionRedirector
-
- /**
- * A TreeModel that does not allow anything to be selected.
+
+ /**
+ * This class implements accessibility support for the JTree class. It
+ * provides an implementation of the Java Accessibility API appropriate
+ * to tree user-interface elements.
+ */
+ protected class AccessibleJTree extends JComponent.AccessibleJComponent
+ implements AccessibleSelection, TreeSelectionListener, TreeModelListener,
+ TreeExpansionListener
+ {
+
+ /**
+ * This class implements accessibility support for the JTree child. It provides
+ * an implementation of the Java Accessibility API appropriate to tree nodes.
+ */
+ protected class AccessibleJTreeNode extends AccessibleContext
+ implements Accessible, AccessibleComponent, AccessibleSelection,
+ AccessibleAction
+ {
+
+ private JTree tree;
+ private TreePath tp;
+ private Accessible acc;
+ private AccessibleStateSet states;
+ private Vector selectionList;
+ private Vector actionList;
+ private TreeModel mod;
+ private Cursor cursor;
+
+ /**
+ * Constructs an AccessibleJTreeNode
+ *
+ * @param t - the current tree
+ * @param p - the current path to be dealt with
+ * @param ap - the accessible object to use
+ */
+ public AccessibleJTreeNode(JTree t, TreePath p, Accessible ap)
+ {
+ states = new AccessibleStateSet();
+ selectionList = new Vector();
+ actionList = new Vector();
+ mod = tree.getModel();
+ cursor = JTree.this.getCursor();
+
+ tree = t;
+ tp = p;
+ acc = ap;
+
+ // Add all the children of this path that may already be
+ // selected to the selection list.
+ TreePath[] selected = tree.getSelectionPaths();
+ for (int i = 0; i < selected.length; i++)
+ {
+ TreePath sel = selected[i];
+ if ((sel.getParentPath()).equals(tp))
+ selectionList.add(sel);
+ }
+
+ // Add all the actions available for a node to
+ // the action list.
+ actionList.add("EXPAND");
+ actionList.add("COLLAPSE");
+ actionList.add("EDIT");
+ actionList.add("SELECT");
+ actionList.add("DESELECT");
+ }
+
+ /**
+ * Adds the specified selected item in the object to the object's
+ * selection.
+ *
+ * @param i - the i-th child of this node.
+ */
+ public void addAccessibleSelection(int i)
+ {
+ if (mod != null)
+ {
+ Object child = mod.getChild(tp.getLastPathComponent(), i);
+ if (child != null)
+ {
+ if (!states.contains(AccessibleState.MULTISELECTABLE))
+ clearAccessibleSelection();
+ selectionList.add(child);
+ tree.addSelectionPath(tp.pathByAddingChild(child));
+ }
+ }
+ }
+
+ /**
+ * Adds the specified focus listener to receive focus events
+ * from this component.
+ *
+ * @param l - the new focus listener
+ */
+ public void addFocusListener(FocusListener l)
+ {
+ tree.addFocusListener(l);
+ }
+
+ /**
+ * Add a PropertyChangeListener to the listener list.
+ *
+ * @param l - the new property change listener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener l)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Clears the selection in the object, so that nothing in the
+ * object is selected.
+ */
+ public void clearAccessibleSelection()
+ {
+ selectionList.clear();
+ }
+
+ /**
+ * Checks whether the specified point is within this object's
+ * bounds, where the point's x and y coordinates are defined to be
+ * relative to the coordinate system of the object.
+ *
+ * @param p - the point to check
+ * @return true if p is in the bounds
+ */
+ public boolean contains(Point p)
+ {
+ return getBounds().contains(p);
+ }
+
+ /**
+ * Perform the specified Action on the tree node.
+ *
+ * @param i - the i-th action to perform
+ * @return true if the the action was performed; else false.
+ */
+ public boolean doAccessibleAction(int i)
+ {
+ if (i >= actionList.size() || i < 0)
+ return false;
+
+ if (actionList.get(i).equals("EXPAND"))
+ tree.expandPath(tp);
+ else if (actionList.get(i).equals("COLLAPSE"))
+ tree.collapsePath(tp);
+ else if (actionList.get(i).equals("SELECT"))
+ tree.addSelectionPath(tp);
+ else if (actionList.get(i).equals("DESELECT"))
+ tree.removeSelectionPath(tp);
+ else if (actionList.get(i).equals("EDIT"))
+ tree.startEditingAtPath(tp);
+ else
+ return false;
+ return true;
+ }
+
+ /**
+ * Get the AccessibleAction associated with this object.
+ *
+ * @return the action
+ */
+ public AccessibleAction getAccessibleAction()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the number of accessible actions available in this tree node.
+ *
+ * @return the number of actions
+ */
+ public int getAccessibleActionCount()
+ {
+ return actionList.size();
+ }
+
+ /**
+ * Return a description of the specified action of the tree node.
+ *
+ * @param i - the i-th action's description
+ * @return a description of the action
+ */
+ public String getAccessibleActionDescription(int i)
+ {
+ if (i < 0 || i >= actionList.size())
+ return (actionList.get(i)).toString();
+ return super.getAccessibleDescription();
+ }
+
+ /**
+ * Returns the Accessible child, if one exists, contained at the
+ * local coordinate Point.
+ *
+ * @param p - the point of the accessible
+ * @return the accessible at point p if it exists
+ */
+ public Accessible getAccessibleAt(Point p)
+ {
+ TreePath acc = tree.getClosestPathForLocation(p.x, p.y);
+ if (acc != null)
+ return new AccessibleJTreeNode(tree, acc, this);
+ return null;
+ }
+
+ /**
+ * Return the specified Accessible child of the object.
+ *
+ * @param i - the i-th child of the current path
+ * @return the child if it exists
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ if (mod != null)
+ {
+ Object child = mod.getChild(tp.getLastPathComponent(), i);
+ if (child != null)
+ return new AccessibleJTreeNode(tree, tp.pathByAddingChild(child),
+ acc);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the number of accessible children in the object.
+ *
+ * @return the number of children the current node has
+ */
+ public int getAccessibleChildrenCount()
+ {
+ TreeModel mod = getModel();
+ if (mod != null)
+ return mod.getChildCount(tp.getLastPathComponent());
+ return 0;
+ }
+
+ /**
+ * Get the AccessibleComponent associated with this object.
+ *
+ * @return the accessible component if it is supported.
+ */
+ public AccessibleComponent getAccessibleComponent()
+ {
+ return this;
+ }
+
+ /**
+ * Get the AccessibleContext associated with this tree node.
+ *
+ * @return an instance of this class
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return this;
+ }
+
+ /**
+ * Get the accessible description of this object.
+ *
+ * @return the accessible description
+ */
+ public String getAccessibleDescription()
+ {
+ return super.getAccessibleDescription();
+ }
+
+ /**
+ * Get the index of this object in its accessible parent.
+ *
+ * @return the index of this in the parent.
+ */
+ public int getAccessibleIndexInParent()
+ {
+ AccessibleContext parent = getAccessibleParent().getAccessibleContext();
+ if (parent != null)
+ for (int i = 0; i < parent.getAccessibleChildrenCount(); i++)
+ {
+ if ((parent.getAccessibleChild(i)).equals(this))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Get the accessible name of this object.
+ *
+ * @return the accessible name
+ */
+ public String getAccessibleName()
+ {
+ return super.getAccessibleName();
+ }
+
+ /**
+ * Get the Accessible parent of this object.
+ *
+ * @return the accessible parent if it exists.
+ */
+ public Accessible getAccessibleParent()
+ {
+ return super.getAccessibleParent();
+ }
+
+ /**
+ * Get the role of this object.
+ *
+ * @return the accessible role
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleJTree.this.getAccessibleRole();
+ }
+
+ /**
+ * Get the AccessibleSelection associated with this object if one exists.
+ *
+ * @return the accessible selection for this.
+ */
+ public AccessibleSelection getAccessibleSelection()
+ {
+ return this;
+ }
+
+ /**
+ * Returns an Accessible representing the specified selected item
+ * in the object.
+ *
+ * @return the accessible representing a certain selected item.
+ */
+ public Accessible getAccessibleSelection(int i)
+ {
+ if (i > 0 && i < getAccessibleSelectionCount())
+ return new AccessibleJTreeNode(tree,
+ tp.pathByAddingChild(selectionList.get(i)), acc);
+ return null;
+ }
+
+ /**
+ * Returns the number of items currently selected.
+ *
+ * @return the number of items selected.
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return selectionList.size();
+ }
+
+ /**
+ * Get the state set of this object.
+ *
+ * @return the state set for this object
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ if (isVisible())
+ states.add(AccessibleState.VISIBLE);
+ if (tree.isCollapsed(tp))
+ states.add(AccessibleState.COLLAPSED);
+ if (tree.isEditable())
+ states.add(AccessibleState.EDITABLE);
+ if (mod != null &&
+ !mod.isLeaf(tp.getLastPathComponent()))
+ states.add(AccessibleState.EXPANDABLE);
+ if (tree.isExpanded(tp))
+ states.add(AccessibleState.EXPANDED);
+ if (isFocusable())
+ states.add(AccessibleState.FOCUSABLE);
+ if (hasFocus())
+ states.add(AccessibleState.FOCUSED);
+ if (tree.getSelectionModel().getSelectionMode() !=
+ TreeSelectionModel.SINGLE_TREE_SELECTION)
+ states.add(AccessibleState.MULTISELECTABLE);
+ if (tree.isOpaque())
+ states.add(AccessibleState.OPAQUE);
+ if (tree.isPathSelected(tp))
+ states.add(AccessibleState.SELECTED);
+ if (isShowing())
+ states.add(AccessibleState.SHOWING);
+
+ states.add(AccessibleState.SELECTABLE);
+ return states;
+ }
+
+ /**
+ * Get the AccessibleText associated with this object if one exists.
+ *
+ * @return the accessible text
+ */
+ public AccessibleText getAccessibleText()
+ {
+ return super.getAccessibleText();
+ }
+
+ /**
+ * Get the AccessibleValue associated with this object if one exists.
+ *
+ * @return the accessible value if it exists
+ */
+ public AccessibleValue getAccessibleValue()
+ {
+ return super.getAccessibleValue();
+ }
+
+ /**
+ * Get the background color of this object.
+ *
+ * @return the color of the background.
+ */
+ public Color getBackground()
+ {
+ return tree.getBackground();
+ }
+
+ /**
+ * Gets the bounds of this object in the form of a Rectangle object.
+ *
+ * @return the bounds of the current node.
+ */
+ public Rectangle getBounds()
+ {
+ return tree.getPathBounds(tp);
+ }
+
+ /**
+ * Gets the Cursor of this object.
+ *
+ * @return the cursor for the current node
+ */
+ public Cursor getCursor()
+ {
+ return cursor;
+ }
+
+ /**
+ * Gets the Font of this object.
+ *
+ * @return the font for the current node
+ */
+ public Font getFont()
+ {
+ return tree.getFont();
+ }
+
+ /**
+ * Gets the FontMetrics of this object.
+ *
+ * @param f - the current font.
+ * @return the font metrics for the given font.
+ */
+ public FontMetrics getFontMetrics(Font f)
+ {
+ return tree.getFontMetrics(f);
+ }
+
+ /**
+ * Get the foreground color of this object.
+ *
+ * @return the foreground for this object.
+ */
+ public Color getForeground()
+ {
+ return tree.getForeground();
+ }
+
+ /**
+ * Gets the locale of the component.
+ *
+ * @return the locale of the component.
+ */
+ public Locale getLocale()
+ {
+ return tree.getLocale();
+ }
+
+ /**
+ * Gets the location of the object relative to the
+ * parent in the form of a point specifying the object's
+ * top-left corner in the screen's coordinate space.
+ *
+ * @return the location of the current node.
+ */
+ public Point getLocation()
+ {
+ return getLocationInJTree();
+ }
+
+ /**
+ * Returns the location in the tree.
+ *
+ * @return the location in the JTree.
+ */
+ protected Point getLocationInJTree()
+ {
+ Rectangle bounds = tree.getPathBounds(tp);
+ return new Point(bounds.x, bounds.y);
+ }
+
+ /**
+ * Returns the location of the object on the screen.
+ *
+ * @return the location of the object on the screen.
+ */
+ public Point getLocationOnScreen()
+ {
+ Point loc = getLocation();
+ SwingUtilities.convertPointToScreen(loc, tree);
+ return loc;
+ }
+
+ /**
+ * Returns the size of this object in the form of a Dimension object.
+ *
+ * @return the size of the object
+ */
+ public Dimension getSize()
+ {
+ Rectangle b = getBounds();
+ return b.getSize();
+ }
+
+ /**
+ * Returns true if the current child of this object is selected.
+ *
+ * @param i - the child of the current node
+ * @return true if the child is selected.
+ */
+ public boolean isAccessibleChildSelected(int i)
+ {
+ Object child = mod.getChild(tp.getLastPathComponent(), i);
+ if (child != null)
+ return tree.isPathSelected(tp.pathByAddingChild(child));
+ return false;
+ }
+
+ /**
+ * Determines if the object is enabled.
+ *
+ * @return true if the tree is enabled
+ */
+ public boolean isEnabled()
+ {
+ return tree.isEnabled();
+ }
+
+ /**
+ * Returns whether this object can accept focus or not.
+ *
+ * @return true, it is always focus traversable
+ */
+ public boolean isFocusTraversable()
+ {
+ return true;
+ }
+
+ /**
+ * Determines if the object is showing.
+ *
+ * @return true if the object is visible and the
+ * parent is visible.
+ */
+ public boolean isShowing()
+ {
+ return isVisible() && tree.isShowing();
+ }
+
+ /**
+ * Determines if the object is visible.
+ *
+ * @return true if the object is visible.
+ */
+ public boolean isVisible()
+ {
+ return tree.isVisible(tp);
+ }
+
+ /**
+ * Removes the specified selected item in the object from the
+ * object's selection.
+ *
+ * @param i - the specified item to remove
+ */
+ public void removeAccessibleSelection(int i)
+ {
+ if (mod != null)
+ {
+ Object child = mod.getChild(tp.getLastPathComponent(), i);
+ if (child != null)
+ {
+ if (!states.contains(AccessibleState.MULTISELECTABLE))
+ clearAccessibleSelection();
+ if (selectionList.contains(child))
+ {
+ selectionList.remove(child);
+ tree.removeSelectionPath(tp.pathByAddingChild(child));
+ }
+ }
+ }
+ }
+
+ /**
+ * Removes the specified focus listener so it no longer receives focus
+ * events from this component.
+ *
+ * @param l - the focus listener to remove
+ */
+ public void removeFocusListener(FocusListener l)
+ {
+ tree.removeFocusListener(l);
+ }
+
+ /**
+ * Remove a PropertyChangeListener from the listener list.
+ *
+ * @param l - the property change listener to remove.
+ */
+ public void removePropertyChangeListener(PropertyChangeListener l)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Requests focus for this object.
+ */
+ public void requestFocus()
+ {
+ tree.requestFocus();
+ }
+
+ /**
+ * Causes every selected item in the object to be selected if the object
+ * supports multiple selections.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ Object parent = tp.getLastPathComponent();
+ if (mod != null)
+ {
+ for (int i = 0; i < mod.getChildCount(parent); i++)
+ {
+ Object child = mod.getChild(parent, i);
+ if (child != null)
+ {
+ if (!states.contains(AccessibleState.MULTISELECTABLE))
+ clearAccessibleSelection();
+ if (selectionList.contains(child))
+ {
+ selectionList.add(child);
+ tree.addSelectionPath(tp.pathByAddingChild(child));
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set the accessible description of this object.
+ *
+ * @param s - the string to set the accessible description to.
+ */
+ public void setAccessibleDescription(String s)
+ {
+ super.setAccessibleDescription(s);
+ }
+
+ /**
+ * Set the localized accessible name of this object.
+ *
+ * @param s - the string to set the accessible name to.
+ */
+ public void setAccessibleName(String s)
+ {
+ super.setAccessibleName(s);
+ }
+
+ /**
+ * Set the background color of this object.
+ *
+ * @param c - the color to set the background to.
+ */
+ public void setBackground(Color c)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the bounds of this object in the form of a Rectangle object.
+ *
+ * @param r - the bounds to set the object o
+ */
+ public void setBounds(Rectangle r)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the Cursor of this object.
+ *
+ * @param c - the new cursor
+ */
+ public void setCursor(Cursor c)
+ {
+ cursor = c;
+ }
+
+ /**
+ * Sets the enabled state of the object.
+ *
+ * @param b - boolean to enable or disable object
+ */
+ public void setEnabled(boolean b)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the Font of this object.
+ *
+ * @param f - the new font.
+ */
+ public void setFont(Font f)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the foreground color of this object.
+ *
+ * @param c - the new foreground color.
+ */
+ public void setForeground(Color c)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the location of the object relative to the parent.
+ *
+ * @param p - the new location for the object.
+ */
+ public void setLocation(Point p)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Resizes this object so that it has width and height.
+ *
+ * @param d - the new size for the object.
+ */
+ public void setSize(Dimension d)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the visible state of the object.
+ *
+ * @param b - sets the objects visibility.
+ */
+ public void setVisible(boolean b)
+ {
+ // Nothing to do here.
+ }
+ }
+
+ /**
+ * Constructor
+ */
+ public AccessibleJTree()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Adds the specified selected item in the object to the object's selection.
+ *
+ * @param i - the row to add to the tree's selection
+ */
+ public void addAccessibleSelection(int i)
+ {
+ addSelectionInterval(i, i);
+ }
+
+ /**
+ * Clears the selection in the object, so that nothing in the object is selected.
+ */
+ public void clearAccessibleSelection()
+ {
+ clearSelection();
+ }
+
+ /**
+ * Fire a visible data property change notification.
+ */
+ public void fireVisibleDataPropertyChange()
+ {
+ treeDidChange();
+ }
+
+ /**
+ * Returns the Accessible child, if one exists, contained at the local
+ * coordinate Point.
+ *
+ * @param p - the point of the accessible to get.
+ * @return the accessible at point p.
+ */
+ public Accessible getAccessibleAt(Point p)
+ {
+ TreePath tp = getClosestPathForLocation(p.x, p.y);
+ if (tp != null)
+ return new AccessibleJTreeNode(JTree.this, tp, null);
+ return null;
+ }
+
+ /**
+ * Return the nth Accessible child of the object.
+ *
+ * @param i - the accessible child to get
+ * @return the i-th child
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the number of top-level children nodes of this JTree.
+ *
+ * @return the number of top-level children
+ */
+ public int getAccessibleChildrenCount()
+ {
+ TreeModel model = getModel();
+ if (model != null)
+ return model.getChildCount(model.getRoot());
+ return 0;
+ }
+
+ /**
+ * Get the index of this object in its accessible parent.
+ *
+ * @return the index of this object.
+ */
+ public int getAccessibleIndexInParent()
+ {
+ return 0;
+ }
+
+ /**
+ * Get the role of this object.
+ *
+ * @return the role of this object
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.TREE;
+ }
+
+ /**
+ * Get the AccessibleSelection associated with this object.
+ *
+ * @return the accessible selection of the tree
+ */
+ public AccessibleSelection getAccessibleSelection()
+ {
+ TreeModel mod = getModel();
+ if (mod != null)
+ return (new AccessibleJTreeNode(JTree.this,
+ new TreePath(mod.getRoot()), null)).getAccessibleSelection();
+ return null;
+ }
+
+ /**
+ * Returns an Accessible representing the specified selected item in the object.
+ *
+ * @return the i-th accessible in the selection
+ */
+ public Accessible getAccessibleSelection(int i)
+ {
+ TreeModel mod = getModel();
+ if (mod != null)
+ return (new AccessibleJTreeNode(JTree.this,
+ new TreePath(mod.getRoot()), null)).getAccessibleSelection(i);
+ return null;
+ }
+
+ /**
+ * Returns the number of items currently selected.
+ *
+ * @return the number of selected accessibles.
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return getSelectionCount();
+ }
+
+ /**
+ * Returns true if the current child of this object is selected.
+ *
+ * @param i - the child of this object
+ * @return true if the i-th child is selected.
+ */
+ public boolean isAccessibleChildSelected(int i)
+ {
+ // Nothing to do here.
+ return false;
+ }
+
+ /**
+ * Removes the specified selected item in the object from the object's
+ * selection.
+ *
+ * @param i - the i-th selected item to remove
+ */
+ public void removeAccessibleSelection(int i)
+ {
+ removeSelectionInterval(i, i);
+ }
+
+ /**
+ * Causes every selected item in the object to be selected if the object
+ * supports multiple selections.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ if (getSelectionModel().getSelectionMode() !=
+ TreeSelectionModel.SINGLE_TREE_SELECTION)
+ addSelectionInterval(0, getVisibleRowCount());
+ }
+
+ /**
+ * Tree Collapsed notification
+ *
+ * @param e - the event
+ */
+ public void treeCollapsed(TreeExpansionEvent e)
+ {
+ fireTreeCollapsed(e.getPath());
+ }
+
+ /**
+ * Tree Model Expansion notification.
+ *
+ * @param e - the event
+ */
+ public void treeExpanded(TreeExpansionEvent e)
+ {
+ fireTreeExpanded(e.getPath());
+ }
+
+ /**
+ * Tree Model Node change notification.
+ *
+ * @param e - the event
+ */
+ public void treeNodesChanged(TreeModelEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Tree Model Node change notification.
+ *
+ * @param e - the event
+ */
+ public void treeNodesInserted(TreeModelEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Tree Model Node change notification.
+ *
+ * @param e - the event
+ */
+ public void treeNodesRemoved(TreeModelEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Tree Model structure change change notification.
+ *
+ * @param e - the event
+ */
+ public void treeStructureChanged(TreeModelEvent e)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Tree Selection Listener value change method.
+ *
+ * @param e - the event
+ */
+ public void valueChanged(TreeSelectionEvent e)
+ {
+ fireValueChanged(e);
+ }
+ }
+
+ public static class DynamicUtilTreeNode extends DefaultMutableTreeNode
+ {
+ protected Object childValue;
+
+ protected boolean loadedChildren;
+
+ /**
+ * Currently not set or used by this class. It might be set and used in
+ * later versions of this class.
+ */
+ protected boolean hasChildren;
+
+ public DynamicUtilTreeNode(Object value, Object children)
+ {
+ super(value);
+ childValue = children;
+ loadedChildren = false;
+ }
+
+ public int getChildCount()
+ {
+ loadChildren();
+ return super.getChildCount();
+ }
+
+ protected void loadChildren()
+ {
+ if (!loadedChildren)
+ {
+ createChildren(this, childValue);
+ loadedChildren = true;
+ }
+ }
+
+ public Enumeration children()
+ {
+ loadChildren();
+ return super.children();
+ }
+
+ /**
+ * Returns the child node at position <code>pos</code>. Subclassed
+ * here to load the children if necessary.
+ *
+ * @param pos the position of the child node to fetch
+ *
+ * @return the childnode at the specified position
+ */
+ public TreeNode getChildAt(int pos)
+ {
+ loadChildren();
+ return super.getChildAt(pos);
+ }
+
+ public boolean isLeaf()
+ {
+ return (childValue == null || !(childValue instanceof Hashtable
+ || childValue instanceof Vector || childValue.getClass()
+ .isArray()));
+ }
+
+ public static void createChildren(DefaultMutableTreeNode parent,
+ Object children)
+ {
+ if (children instanceof Hashtable)
+ {
+ Hashtable tab = (Hashtable) children;
+ Enumeration e = tab.keys();
+ while (e.hasMoreElements())
+ {
+ Object key = e.nextElement();
+ Object val = tab.get(key);
+ parent.add(new DynamicUtilTreeNode(key, val));
+ }
+ }
+ else if (children instanceof Vector)
+ {
+ Iterator i = ((Vector) children).iterator();
+ while (i.hasNext())
+ {
+ Object n = i.next();
+ parent.add(new DynamicUtilTreeNode(n, n));
+ }
+ }
+ else if (children != null && children.getClass().isArray())
+ {
+ Object[] arr = (Object[]) children;
+ for (int i = 0; i < arr.length; ++i)
+ parent.add(new DynamicUtilTreeNode(arr[i], arr[i]));
+ }
+ }
+ }
+
+ /**
+ * Listens to the model of the JTree and updates the property
+ * <code>expandedState</code> if nodes are removed or changed.
+ */
+ protected class TreeModelHandler implements TreeModelListener
+ {
+
+ /**
+ * Creates a new instance of TreeModelHandler.
+ */
+ protected TreeModelHandler()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Notifies when a node has changed in some ways. This does not include
+ * that a node has changed its location or changed it's children. It
+ * only means that some attributes of the node have changed that might
+ * affect its presentation.
+ *
+ * This method is called after the actual change occured.
+ *
+ * @param ev the TreeModelEvent describing the change
+ */
+ public void treeNodesChanged(TreeModelEvent ev)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Notifies when a node is inserted into the tree.
+ *
+ * This method is called after the actual change occured.
+ *
+ * @param ev the TreeModelEvent describing the change
+ */
+ public void treeNodesInserted(TreeModelEvent ev)
+ {
+ // nothing to do here
+ }
+
+ /**
+ * Notifies when a node is removed from the tree.
+ *
+ * This method is called after the actual change occured.
+ *
+ * @param ev the TreeModelEvent describing the change
*/
- protected static class EmptySelectionModel
- extends
- DefaultTreeSelectionModel
- {
- /** The serial version UID. */
- private static final long serialVersionUID = -5815023306225701477L;
-
- /**
- * The shared instance of this model.
- */
- protected static final EmptySelectionModel sharedInstance = new EmptySelectionModel();
-
- /**
- * Creates a new instance of EmptySelectionModel.
- */
- protected EmptySelectionModel()
- {
- }
-
- /**
- * Returns the shared instance of EmptySelectionModel.
- *
- * @return the shared instance of EmptySelectionModel
- */
- public static EmptySelectionModel sharedInstance()
- {
- return sharedInstance;
- }
-
- /**
- * This catches attempts to set a selection and sets nothing instead.
- *
- * @param paths not used here
- */
- public void setSelectionPaths(TreePath[] paths)
- {
- // we don't allow selections in this class
- }
-
- /**
- * This catches attempts to add something to the selection.
- *
- * @param paths not used here
- */
- public void addSelectionPaths(TreePath[] paths)
- {
- // we don't allow selections in this class
- }
-
- /**
- * This catches attempts to remove something from the selection.
- *
- * @param paths not used here
- */
- public void removeSelectionPaths(TreePath[] paths)
- {
- // we don't allow selections in this class
- }
- }// EmptySelectionModel
-
- private static final long serialVersionUID = 7559816092864483649L;
- public static final String CELL_EDITOR_PROPERTY = "cellEditor";
- public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
- public static final String EDITABLE_PROPERTY = "editable";
- public static final String INVOKES_STOP_CELL_EDITING_PROPERTY = "invokesStopCellEditing";
- public static final String LARGE_MODEL_PROPERTY = "largeModel";
- public static final String ROOT_VISIBLE_PROPERTY = "rootVisible";
- public static final String ROW_HEIGHT_PROPERTY = "rowHeight";
- public static final String SCROLLS_ON_EXPAND_PROPERTY = "scrollsOnExpand";
- public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
- public static final String SHOWS_ROOT_HANDLES_PROPERTY = "showsRootHandles";
- public static final String TOGGLE_CLICK_COUNT_PROPERTY = "toggleClickCount";
- public static final String TREE_MODEL_PROPERTY = "model";
- public static final String VISIBLE_ROW_COUNT_PROPERTY = "visibleRowCount";
+ public void treeNodesRemoved(TreeModelEvent ev)
+ {
+ // TODO: The API docs suggest that this method should do something
+ // but I cannot really see what has to be done here ...
+ }
- /** @since 1.3 */
- public static final String ANCHOR_SELECTION_PATH_PROPERTY = "anchorSelectionPath";
+ /**
+ * Notifies when the structure of the tree is changed.
+ *
+ * This method is called after the actual change occured.
+ *
+ * @param ev the TreeModelEvent describing the change
+ */
+ public void treeStructureChanged(TreeModelEvent ev)
+ {
+ // Set state of new path.
+ TreePath path = ev.getTreePath();
+ setExpandedState(path, isExpanded(path));
+ }
+ }
- /** @since 1.3 */
- public static final String LEAD_SELECTION_PATH_PROPERTY = "leadSelectionPath";
+ /**
+ * This redirects TreeSelectionEvents and rewrites the source of it to be
+ * this JTree. This is typically done when the tree model generates an
+ * event, but the JTree object associated with that model should be listed
+ * as the actual source of the event.
+ */
+ protected class TreeSelectionRedirector implements TreeSelectionListener,
+ Serializable
+ {
+ /** The serial version UID. */
+ private static final long serialVersionUID = -3505069663646241664L;
+
+ /**
+ * Creates a new instance of TreeSelectionRedirector
+ */
+ protected TreeSelectionRedirector()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Notifies when the tree selection changes.
+ *
+ * @param ev the TreeSelectionEvent that describes the change
+ */
+ public void valueChanged(TreeSelectionEvent ev)
+ {
+ TreeSelectionEvent rewritten =
+ (TreeSelectionEvent) ev.cloneWithSource(JTree.this);
+ fireValueChanged(rewritten);
+ JTree.this.repaint();
+ }
+ }
+
+ /**
+ * A TreeModel that does not allow anything to be selected.
+ */
+ protected static class EmptySelectionModel extends DefaultTreeSelectionModel
+ {
+ /** The serial version UID. */
+ private static final long serialVersionUID = -5815023306225701477L;
+
+ /**
+ * The shared instance of this model.
+ */
+ protected static final EmptySelectionModel sharedInstance =
+ new EmptySelectionModel();
+
+ /**
+ * Creates a new instance of EmptySelectionModel.
+ */
+ protected EmptySelectionModel()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the shared instance of EmptySelectionModel.
+ *
+ * @return the shared instance of EmptySelectionModel
+ */
+ public static EmptySelectionModel sharedInstance()
+ {
+ return sharedInstance;
+ }
+
+ /**
+ * This catches attempts to set a selection and sets nothing instead.
+ *
+ * @param paths not used here
+ */
+ public void setSelectionPaths(TreePath[] paths)
+ {
+ // We don't allow selections in this class.
+ }
+
+ /**
+ * This catches attempts to add something to the selection.
+ *
+ * @param paths not used here
+ */
+ public void addSelectionPaths(TreePath[] paths)
+ {
+ // We don't allow selections in this class.
+ }
+
+ /**
+ * This catches attempts to remove something from the selection.
+ *
+ * @param paths not used here
+ */
+ public void removeSelectionPaths(TreePath[] paths)
+ {
+ // We don't allow selections in this class.
+ }
+ }
+
+ private static final long serialVersionUID = 7559816092864483649L;
+
+ public static final String CELL_EDITOR_PROPERTY = "cellEditor";
+
+ public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
+
+ public static final String EDITABLE_PROPERTY = "editable";
+
+ public static final String INVOKES_STOP_CELL_EDITING_PROPERTY =
+ "invokesStopCellEditing";
+
+ public static final String LARGE_MODEL_PROPERTY = "largeModel";
+
+ public static final String ROOT_VISIBLE_PROPERTY = "rootVisible";
+
+ public static final String ROW_HEIGHT_PROPERTY = "rowHeight";
+
+ public static final String SCROLLS_ON_EXPAND_PROPERTY = "scrollsOnExpand";
+
+ public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
+
+ public static final String SHOWS_ROOT_HANDLES_PROPERTY = "showsRootHandles";
+
+ public static final String TOGGLE_CLICK_COUNT_PROPERTY = "toggleClickCount";
+
+ public static final String TREE_MODEL_PROPERTY = "model";
+
+ public static final String VISIBLE_ROW_COUNT_PROPERTY = "visibleRowCount";
+
+ /** @since 1.3 */
+ public static final String ANCHOR_SELECTION_PATH_PROPERTY =
+ "anchorSelectionPath";
/** @since 1.3 */
- public static final String EXPANDS_SELECTED_PATHS_PROPERTY = "expandsSelectedPaths";
- private static final Object EXPANDED = new Object();
- private static final Object COLLAPSED = new Object();
- private boolean dragEnabled;
- private boolean expandsSelectedPaths;
- private TreePath anchorSelectionPath;
- private TreePath leadSelectionPath;
-
- /*
- * This contains the state of all nodes in the tree. Al/ entries map the
- * TreePath of a note to to its state. Valid states are EXPANDED and
- * COLLAPSED. Nodes not in this Hashtable are assumed state COLLAPSED.
- */
- private Hashtable nodeStates = new Hashtable();
- protected transient TreeCellEditor cellEditor;
- protected transient TreeCellRenderer cellRenderer;
- protected boolean editable;
- protected boolean invokesStopCellEditing;
- protected boolean largeModel;
- protected boolean rootVisible;
- protected int rowHeight;
- protected boolean scrollsOnExpand;
- protected transient TreeSelectionModel selectionModel;
- protected boolean showsRootHandles;
- protected int toggleClickCount;
- protected transient TreeModel treeModel;
- protected int visibleRowCount;
-
- /**
- * Handles TreeModelEvents to update the expandedState.
- */
- protected transient TreeModelListener treeModelListener;
+ public static final String LEAD_SELECTION_PATH_PROPERTY = "leadSelectionPath";
- /**
- * Redirects TreeSelectionEvents so that the source is this JTree.
- */
- protected TreeSelectionRedirector selectionRedirector =
- new TreeSelectionRedirector();
+ /** @since 1.3 */
+ public static final String EXPANDS_SELECTED_PATHS_PROPERTY =
+ "expandsSelectedPaths";
- /**
- * Creates a new <code>JTree</code> object.
- */
- public JTree()
- {
- this(createTreeModel(null));
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param value the initial nodes in the tree
- */
- public JTree(Hashtable value)
- {
- this(createTreeModel(value));
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param value the initial nodes in the tree
- */
- public JTree(Object[] value)
- {
- this(createTreeModel(value));
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param model the model to use
- */
- public JTree(TreeModel model)
- {
- setModel(model);
- setSelectionModel(EmptySelectionModel.sharedInstance());
- setCellRenderer(new DefaultTreeCellRenderer());
- updateUI();
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param root the root node
- */
- public JTree(TreeNode root)
- {
- this(root, false);
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param root the root node
- * @param asksAllowChildren if false, all nodes without children are leaf
- * nodes. If true, only nodes that do not allow children are leaf
- * nodes.
- */
- public JTree(TreeNode root, boolean asksAllowChildren)
- {
- this(new DefaultTreeModel(root, asksAllowChildren));
- }
-
- /**
- * Creates a new <code>JTree</code> object.
- *
- * @param value the initial nodes in the tree
- */
- public JTree(Vector value)
- {
- this(createTreeModel(value));
- }
-
- public static class DynamicUtilTreeNode
- extends
- DefaultMutableTreeNode
- {
- protected Object childValue;
- protected boolean loadedChildren;
-
- /**
- * Currently not set or used by this class. It might be set and used in
- * later versions of this class.
- */
- protected boolean hasChildren;
-
- public DynamicUtilTreeNode(Object value, Object children)
- {
- super(value);
- childValue = children;
- loadedChildren = false;
- }
-
- public int getChildCount()
- {
- loadChildren();
- return super.getChildCount();
- }
-
- protected void loadChildren()
- {
- if (!loadedChildren)
- {
- createChildren(this, childValue);
- loadedChildren = true;
- }
- }
-
- public Enumeration children()
- {
- loadChildren();
- return super.children();
- }
-
- /**
- * Returns the child node at position <code>pos</code>. Subclassed
- * here to load the children if necessary.
- *
- * @param pos the position of the child node to fetch
- *
- * @return the childnode at the specified position
- */
- public TreeNode getChildAt(int pos)
- {
- loadChildren();
- return super.getChildAt(pos);
- }
-
- public boolean isLeaf()
- {
- return (childValue == null || !(childValue instanceof Hashtable
- || childValue instanceof Vector || childValue.getClass()
- .isArray()));
- }
-
- public static void createChildren(DefaultMutableTreeNode parent,
- Object children)
- {
- if (children instanceof Hashtable)
- {
- Hashtable tab = (Hashtable) children;
- Enumeration e = tab.keys();
- while (e.hasMoreElements())
- {
- Object key = e.nextElement();
- Object val = tab.get(key);
- parent.add(new DynamicUtilTreeNode(key, val));
- }
- } else if (children instanceof Vector)
- {
- Iterator i = ((Vector) children).iterator();
- while (i.hasNext())
- {
- Object n = i.next();
- parent.add(new DynamicUtilTreeNode(n, n));
- }
- } else if (children != null && children.getClass().isArray())
- {
- Object[] arr = (Object[]) children;
- for (int i = 0; i < arr.length; ++i)
- parent.add(new DynamicUtilTreeNode(arr[i], arr[i]));
- }
- }
- }
-
- public int getRowForPath(TreePath path)
- {
- TreeUI ui = getUI();
-
- if (ui != null)
- return ui.getRowForPath(this, path);
-
- return -1;
- }
-
- public TreePath getPathForRow(int row)
- {
- TreeUI ui = getUI();
- return ui != null ? ui.getPathForRow(this, row) : null;
- }
-
- protected TreePath[] getPathBetweenRows(int index0, int index1)
- {
- TreeUI ui = getUI();
-
- if (ui == null)
- return null;
-
- int minIndex = Math.min(index0, index1);
- int maxIndex = Math.max(index0, index1);
- TreePath[] paths = new TreePath[maxIndex - minIndex + 1];
-
- for (int i = minIndex; i <= maxIndex; ++i)
- paths[i - minIndex] = ui.getPathForRow(this, i);
-
- return paths;
- }
-
- /**
- * Creates a new <code>TreeModel</code> object.
- *
- * @param value the values stored in the model
- */
- protected static TreeModel createTreeModel(Object value)
- {
- return new DefaultTreeModel(new DynamicUtilTreeNode(value, value));
- }
-
- /**
- * Return the UI associated with this <code>JTree</code> object.
- *
- * @return the associated <code>TreeUI</code> object
- */
- public TreeUI getUI()
- {
- return (TreeUI) ui;
- }
-
- /**
- * Sets the UI associated with this <code>JTree</code> object.
- *
- * @param ui the <code>TreeUI</code> to associate
- */
- public void setUI(TreeUI ui)
- {
- super.setUI(ui);
- }
+ private static final Object EXPANDED = new Object();
- /**
- * This method resets the UI used to the Look and Feel defaults..
- */
- public void updateUI()
- {
- setUI((TreeUI) UIManager.getUI(this));
- revalidate();
- repaint();
- }
-
- /**
- * This method returns the String ID of the UI class of Separator.
- *
- * @return The UI class' String ID.
- */
- public String getUIClassID()
- {
- return "TreeUI";
- }
-
- /**
- * Gets the AccessibleContext associated with this
- * <code>JToggleButton</code>.
- *
- * @return the associated context
- */
- public AccessibleContext getAccessibleContext()
- {
- return null;
- }
-
- /**
- * Returns the preferred viewport size.
- *
- * @return the preferred size
- */
- public Dimension getPreferredScrollableViewportSize()
- {
- return new Dimension (getPreferredSize().width, getVisibleRowCount()*getRowHeight());
- }
-
- public int getScrollableUnitIncrement(Rectangle visibleRect,
- int orientation, int direction)
- {
- return 1;
- }
-
- public int getScrollableBlockIncrement(Rectangle visibleRect,
- int orientation, int direction)
- {
- return 1;
- }
+ private static final Object COLLAPSED = new Object();
- public boolean getScrollableTracksViewportWidth()
+ private boolean dragEnabled;
+
+ private boolean expandsSelectedPaths;
+
+ private TreePath anchorSelectionPath;
+
+ private TreePath leadSelectionPath;
+
+ /**
+ * This contains the state of all nodes in the tree. Al/ entries map the
+ * TreePath of a note to to its state. Valid states are EXPANDED and
+ * COLLAPSED. Nodes not in this Hashtable are assumed state COLLAPSED.
+ */
+ private Hashtable nodeStates = new Hashtable();
+
+ protected transient TreeCellEditor cellEditor;
+
+ protected transient TreeCellRenderer cellRenderer;
+
+ protected boolean editable;
+
+ protected boolean invokesStopCellEditing;
+
+ protected boolean largeModel;
+
+ protected boolean rootVisible;
+
+ protected int rowHeight;
+
+ protected boolean scrollsOnExpand;
+
+ protected transient TreeSelectionModel selectionModel;
+
+ protected boolean showsRootHandles;
+
+ protected int toggleClickCount;
+
+ protected transient TreeModel treeModel;
+
+ protected int visibleRowCount;
+
+ /**
+ * Handles TreeModelEvents to update the expandedState.
+ */
+ protected transient TreeModelListener treeModelListener;
+
+ /**
+ * Redirects TreeSelectionEvents so that the source is this JTree.
+ */
+ protected TreeSelectionRedirector selectionRedirector =
+ new TreeSelectionRedirector();
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ */
+ public JTree()
+ {
+ this(createTreeModel(null));
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param value the initial nodes in the tree
+ */
+ public JTree(Hashtable value)
+ {
+ this(createTreeModel(value));
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param value the initial nodes in the tree
+ */
+ public JTree(Object[] value)
+ {
+ this(createTreeModel(value));
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param model the model to use
+ */
+ public JTree(TreeModel model)
+ {
+ updateUI();
+ setRootVisible(true);
+ setModel(model);
+ setSelectionModel(new EmptySelectionModel());
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param root the root node
+ */
+ public JTree(TreeNode root)
+ {
+ this(root, false);
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param root the root node
+ * @param asksAllowChildren if false, all nodes without children are leaf
+ * nodes. If true, only nodes that do not allow children are leaf
+ * nodes.
+ */
+ public JTree(TreeNode root, boolean asksAllowChildren)
+ {
+ this(new DefaultTreeModel(root, asksAllowChildren));
+ }
+
+ /**
+ * Creates a new <code>JTree</code> object.
+ *
+ * @param value the initial nodes in the tree
+ */
+ public JTree(Vector value)
+ {
+ this(createTreeModel(value));
+ }
+
+ public int getRowForPath(TreePath path)
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.getRowForPath(this, path);
+
+ return -1;
+ }
+
+ public TreePath getPathForRow(int row)
+ {
+ TreeUI ui = getUI();
+ return ui != null ? ui.getPathForRow(this, row) : null;
+ }
+
+ protected TreePath[] getPathBetweenRows(int index0, int index1)
+ {
+ TreeUI ui = getUI();
+
+ if (ui == null)
+ return null;
+
+ int minIndex = Math.min(index0, index1);
+ int maxIndex = Math.max(index0, index1);
+ TreePath[] paths = new TreePath[maxIndex - minIndex + 1];
+
+ for (int i = minIndex; i <= maxIndex; ++i)
+ paths[i - minIndex] = ui.getPathForRow(this, i);
+
+ return paths;
+ }
+
+ /**
+ * Creates a new <code>TreeModel</code> object.
+ *
+ * @param value the values stored in the model
+ */
+ protected static TreeModel createTreeModel(Object value)
+ {
+ return new DefaultTreeModel(new DynamicUtilTreeNode(value, value));
+ }
+
+ /**
+ * Return the UI associated with this <code>JTree</code> object.
+ *
+ * @return the associated <code>TreeUI</code> object
+ */
+ public TreeUI getUI()
+ {
+ return (TreeUI) ui;
+ }
+
+ /**
+ * Sets the UI associated with this <code>JTree</code> object.
+ *
+ * @param ui the <code>TreeUI</code> to associate
+ */
+ public void setUI(TreeUI ui)
+ {
+ super.setUI(ui);
+ }
+
+ /**
+ * This method resets the UI used to the Look and Feel defaults..
+ */
+ public void updateUI()
+ {
+ setUI((TreeUI) UIManager.getUI(this));
+ }
+
+ /**
+ * This method returns the String ID of the UI class of Separator.
+ *
+ * @return The UI class' String ID.
+ */
+ public String getUIClassID()
+ {
+ return "TreeUI";
+ }
+
+ /**
+ * Gets the AccessibleContext associated with this
+ * <code>JTree</code>.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return new AccessibleJTree();
+ }
+
+ /**
+ * Returns the preferred viewport size.
+ *
+ * @return the preferred size
+ */
+ public Dimension getPreferredScrollableViewportSize()
+ {
+ return new Dimension (getPreferredSize().width, getVisibleRowCount()*getRowHeight());
+ }
+
+ public int getScrollableUnitIncrement(Rectangle visibleRect,
+ int orientation, int direction)
+ {
+ return 1;
+ }
+
+ public int getScrollableBlockIncrement(Rectangle visibleRect,
+ int orientation, int direction)
+ {
+ return 1;
+ }
+
+ public boolean getScrollableTracksViewportHeight()
{
if (getParent() instanceof JViewport)
return ((JViewport) getParent()).getHeight() > getPreferredSize().height;
return false;
}
-
- public boolean getScrollableTracksViewportHeight()
+
+ public boolean getScrollableTracksViewportWidth()
{
if (getParent() instanceof JViewport)
return ((JViewport) getParent()).getWidth() > getPreferredSize().width;
return false;
}
- /**
- * Adds a <code>TreeExpansionListener</code> object to the tree.
- *
- * @param listener the listener to add
- */
- public void addTreeExpansionListener(TreeExpansionListener listener)
- {
- listenerList.add(TreeExpansionListener.class, listener);
- }
-
- /**
- * Removes a <code>TreeExpansionListener</code> object from the tree.
- *
- * @param listener the listener to remove
- */
- public void removeTreeExpansionListener(TreeExpansionListener listener)
- {
- listenerList.remove(TreeExpansionListener.class, listener);
- }
-
- /**
- * Returns all added <code>TreeExpansionListener</code> objects.
- *
- * @return an array of listeners
- */
- public TreeExpansionListener[] getTreeExpansionListeners()
- {
- return (TreeExpansionListener[]) getListeners(TreeExpansionListener.class);
- }
-
- /**
- * Notifies all listeners that the tree was collapsed.
- *
- * @param path the path to the node that was collapsed
- */
- public void fireTreeCollapsed(TreePath path)
- {
- TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- TreeExpansionListener[] listeners = getTreeExpansionListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].treeCollapsed(event);
- }
-
- /**
- * Notifies all listeners that the tree was expanded.
- *
- * @param path the path to the node that was expanded
- */
- public void fireTreeExpanded(TreePath path)
- {
- TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- TreeExpansionListener[] listeners = getTreeExpansionListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].treeExpanded(event);
- }
-
- /**
- * Adds a <code>TreeSelctionListener</code> object to the tree.
- *
- * @param listener the listener to add
- */
- public void addTreeSelectionListener(TreeSelectionListener listener)
- {
- listenerList.add(TreeSelectionListener.class, listener);
- }
-
- /**
- * Removes a <code>TreeSelectionListener</code> object from the tree.
- *
- * @param listener the listener to remove
- */
- public void removeTreeSelectionListener(TreeSelectionListener listener)
- {
- listenerList.remove(TreeSelectionListener.class, listener);
- }
-
- /**
- * Returns all added <code>TreeSelectionListener</code> objects.
- *
- * @return an array of listeners
- */
- public TreeSelectionListener[] getTreeSelectionListeners()
- {
- return (TreeSelectionListener[])
- getListeners(TreeSelectionListener.class);
- }
-
- /**
- * Notifies all listeners when the selection of the tree changed.
- *
- * @param event the event to send
- */
- protected void fireValueChanged(TreeSelectionEvent event)
- {
- TreeSelectionListener[] listeners = getTreeSelectionListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].valueChanged(event);
- }
-
- /**
- * Adds a <code>TreeWillExpandListener</code> object to the tree.
- *
- * @param listener the listener to add
- */
- public void addTreeWillExpandListener(TreeWillExpandListener listener)
- {
- listenerList.add(TreeWillExpandListener.class, listener);
- }
-
- /**
- * Removes a <code>TreeWillExpandListener</code> object from the tree.
- *
- * @param listener the listener to remove
- */
- public void removeTreeWillExpandListener(TreeWillExpandListener listener)
- {
- listenerList.remove(TreeWillExpandListener.class, listener);
- }
-
- /**
- * Returns all added <code>TreeWillExpandListener</code> objects.
- *
- * @return an array of listeners
- */
- public TreeWillExpandListener[] getTreeWillExpandListeners()
- {
- return (TreeWillExpandListener[])
- getListeners(TreeWillExpandListener.class);
- }
-
- /**
- * Notifies all listeners that the tree will collapse.
- *
- * @param path the path to the node that will collapse
- */
- public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
- {
- TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].treeWillCollapse(event);
- }
-
- /**
- * Notifies all listeners that the tree will expand.
- *
- * @param path the path to the node that will expand
- */
- public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
- {
- TreeExpansionEvent event = new TreeExpansionEvent(this, path);
- TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
-
- for (int index = 0; index < listeners.length; ++index)
- listeners[index].treeWillExpand(event);
- }
-
- /**
- * Returns the model of this <code>JTree</code> object.
- *
- * @return the associated <code>TreeModel</code>
- */
- public TreeModel getModel()
- {
- return treeModel;
- }
-
- /**
- * Sets the model to use in <code>JTree</code>.
- *
- * @param model the <code>TreeModel</code> to use
- */
- public void setModel(TreeModel model)
- {
- if (treeModel == model)
- return;
-
- // add treeModelListener to the new model
- if (treeModelListener == null)
- treeModelListener = createTreeModelListener();
- if (model != null) // as setModel(null) is allowed
- model.addTreeModelListener(treeModelListener);
-
+ /**
+ * Adds a <code>TreeExpansionListener</code> object to the tree.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeExpansionListener(TreeExpansionListener listener)
+ {
+ listenerList.add(TreeExpansionListener.class, listener);
+ }
+
+ /**
+ * Removes a <code>TreeExpansionListener</code> object from the tree.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeExpansionListener(TreeExpansionListener listener)
+ {
+ listenerList.remove(TreeExpansionListener.class, listener);
+ }
+
+ /**
+ * Returns all added <code>TreeExpansionListener</code> objects.
+ *
+ * @return an array of listeners
+ */
+ public TreeExpansionListener[] getTreeExpansionListeners()
+ {
+ return (TreeExpansionListener[]) getListeners(TreeExpansionListener.class);
+ }
+
+ /**
+ * Notifies all listeners that the tree was collapsed.
+ *
+ * @param path the path to the node that was collapsed
+ */
+ public void fireTreeCollapsed(TreePath path)
+ {
+ TreeExpansionEvent event = new TreeExpansionEvent(this, path);
+ TreeExpansionListener[] listeners = getTreeExpansionListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].treeCollapsed(event);
+ }
+
+ /**
+ * Notifies all listeners that the tree was expanded.
+ *
+ * @param path the path to the node that was expanded
+ */
+ public void fireTreeExpanded(TreePath path)
+ {
+ TreeExpansionEvent event = new TreeExpansionEvent(this, path);
+ TreeExpansionListener[] listeners = getTreeExpansionListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].treeExpanded(event);
+ }
+
+ /**
+ * Adds a <code>TreeSelctionListener</code> object to the tree.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeSelectionListener(TreeSelectionListener listener)
+ {
+ listenerList.add(TreeSelectionListener.class, listener);
+ }
+
+ /**
+ * Removes a <code>TreeSelectionListener</code> object from the tree.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeSelectionListener(TreeSelectionListener listener)
+ {
+ listenerList.remove(TreeSelectionListener.class, listener);
+ }
+
+ /**
+ * Returns all added <code>TreeSelectionListener</code> objects.
+ *
+ * @return an array of listeners
+ */
+ public TreeSelectionListener[] getTreeSelectionListeners()
+ {
+ return (TreeSelectionListener[])
+ getListeners(TreeSelectionListener.class);
+ }
+
+ /**
+ * Notifies all listeners when the selection of the tree changed.
+ *
+ * @param event the event to send
+ */
+ protected void fireValueChanged(TreeSelectionEvent event)
+ {
+ TreeSelectionListener[] listeners = getTreeSelectionListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].valueChanged(event);
+ }
+
+ /**
+ * Adds a <code>TreeWillExpandListener</code> object to the tree.
+ *
+ * @param listener the listener to add
+ */
+ public void addTreeWillExpandListener(TreeWillExpandListener listener)
+ {
+ listenerList.add(TreeWillExpandListener.class, listener);
+ }
+
+ /**
+ * Removes a <code>TreeWillExpandListener</code> object from the tree.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeTreeWillExpandListener(TreeWillExpandListener listener)
+ {
+ listenerList.remove(TreeWillExpandListener.class, listener);
+ }
+
+ /**
+ * Returns all added <code>TreeWillExpandListener</code> objects.
+ *
+ * @return an array of listeners
+ */
+ public TreeWillExpandListener[] getTreeWillExpandListeners()
+ {
+ return (TreeWillExpandListener[])
+ getListeners(TreeWillExpandListener.class);
+ }
+
+ /**
+ * Notifies all listeners that the tree will collapse.
+ *
+ * @param path the path to the node that will collapse
+ */
+ public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
+ {
+ TreeExpansionEvent event = new TreeExpansionEvent(this, path);
+ TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].treeWillCollapse(event);
+ }
+
+ /**
+ * Notifies all listeners that the tree will expand.
+ *
+ * @param path the path to the node that will expand
+ */
+ public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
+ {
+ TreeExpansionEvent event = new TreeExpansionEvent(this, path);
+ TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].treeWillExpand(event);
+ }
+
+ /**
+ * Returns the model of this <code>JTree</code> object.
+ *
+ * @return the associated <code>TreeModel</code>
+ */
+ public TreeModel getModel()
+ {
+ return treeModel;
+ }
+
+ /**
+ * Sets the model to use in <code>JTree</code>.
+ *
+ * @param model the <code>TreeModel</code> to use
+ */
+ public void setModel(TreeModel model)
+ {
+ if (treeModel == model)
+ return;
+
+ // add treeModelListener to the new model
+ if (treeModelListener == null)
+ treeModelListener = createTreeModelListener();
+ if (model != null) // as setModel(null) is allowed
+ model.addTreeModelListener(treeModelListener);
+
TreeModel oldValue = treeModel;
treeModel = model;
firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model);
- }
+ updateUI();
+ }
- /**
- * Checks if this <code>JTree</code> object is editable.
- *
- * @return <code>true</code> if this tree object is editable,
- * <code>false</code> otherwise
- */
- public boolean isEditable()
- {
- return editable;
- }
-
- /**
- * Sets the <code>editable</code> property.
- *
- * @param flag <code>true</code> to make this tree object editable,
- * <code>false</code> otherwise
- */
- public void setEditable(boolean flag)
- {
- if (editable == flag)
- return;
-
- boolean oldValue = editable;
- editable = flag;
- firePropertyChange(EDITABLE_PROPERTY, oldValue, editable);
- }
-
- /**
- * Checks if the root element is visible.
- *
- * @return <code>true</code> if the root element is visible,
- * <code>false</code> otherwise
- */
- public boolean isRootVisible()
- {
- return rootVisible;
- }
-
- public void setRootVisible(boolean flag)
- {
- if (rootVisible == flag)
- return;
-
- boolean oldValue = rootVisible;
- rootVisible = flag;
- firePropertyChange(ROOT_VISIBLE_PROPERTY, oldValue, flag);
- }
-
- public boolean getShowsRootHandles()
- {
- return showsRootHandles;
- }
-
- public void setShowsRootHandles(boolean flag)
- {
- if (showsRootHandles == flag)
- return;
-
- boolean oldValue = showsRootHandles;
- showsRootHandles = flag;
- firePropertyChange(SHOWS_ROOT_HANDLES_PROPERTY, oldValue, flag);
- }
-
- public TreeCellEditor getCellEditor()
- {
-
- return cellEditor;
- }
-
- public void setCellEditor(TreeCellEditor editor)
- {
- if (cellEditor == editor)
- return;
-
- TreeCellEditor oldValue = cellEditor;
- cellEditor = editor;
- firePropertyChange(CELL_EDITOR_PROPERTY, oldValue, editor);
- }
-
- public TreeCellRenderer getCellRenderer()
- {
- return cellRenderer;
- }
-
- public void setCellRenderer(TreeCellRenderer newRenderer)
- {
- if (cellRenderer == newRenderer)
- return;
-
- TreeCellRenderer oldValue = cellRenderer;
- cellRenderer = newRenderer;
- firePropertyChange(CELL_RENDERER_PROPERTY, oldValue, newRenderer);
- }
-
- public TreeSelectionModel getSelectionModel()
- {
- return selectionModel;
- }
-
- public void setSelectionModel(TreeSelectionModel model)
- {
- if (selectionModel == model)
- return;
-
- if (selectionModel != null)
- selectionModel.removeTreeSelectionListener(selectionRedirector);
-
- TreeSelectionModel oldValue = selectionModel;
- selectionModel = model;
-
- if (selectionModel != null)
- selectionModel.addTreeSelectionListener(selectionRedirector);
-
- firePropertyChange(SELECTION_MODEL_PROPERTY, oldValue, model);
- revalidate();
- repaint();
- }
-
- public int getVisibleRowCount()
- {
- return visibleRowCount;
- }
-
- public void setVisibleRowCount(int rows)
- {
- if (visibleRowCount == rows)
- return;
-
- int oldValue = visibleRowCount;
- visibleRowCount = rows;
- firePropertyChange(VISIBLE_ROW_COUNT_PROPERTY, oldValue, rows);
- }
-
- public boolean isLargeModel()
- {
- return largeModel;
- }
-
- public void setLargeModel(boolean large)
- {
- if (largeModel == large)
- return;
-
- boolean oldValue = largeModel;
- largeModel = large;
- firePropertyChange(LARGE_MODEL_PROPERTY, oldValue, large);
- }
-
- public int getRowHeight()
- {
-
- return rowHeight;
- }
-
- public void setRowHeight(int height)
- {
- if (rowHeight == height)
- return;
-
- int oldValue = rowHeight;
- rowHeight = height;
- firePropertyChange(ROW_HEIGHT_PROPERTY, oldValue, height);
- }
-
- public boolean isFixedRowHeight()
- {
- return rowHeight > 0;
- }
-
- public boolean getInvokesStopCellEditing()
- {
- return invokesStopCellEditing;
- }
-
- public void setInvokesStopCellEditing(boolean invoke)
- {
- if (invokesStopCellEditing == invoke)
- return;
-
- boolean oldValue = invokesStopCellEditing;
- invokesStopCellEditing = invoke;
- firePropertyChange(INVOKES_STOP_CELL_EDITING_PROPERTY,
- oldValue, invoke);
- }
-
- /**
- * @since 1.3
- */
- public int getToggleClickCount()
- {
- return toggleClickCount;
- }
+ /**
+ * Checks if this <code>JTree</code> object is editable.
+ *
+ * @return <code>true</code> if this tree object is editable,
+ * <code>false</code> otherwise
+ */
+ public boolean isEditable()
+ {
+ return editable;
+ }
- /**
- * @since 1.3
- */
- public void setToggleClickCount(int count)
- {
- if (toggleClickCount == count)
- return;
-
- int oldValue = toggleClickCount;
- toggleClickCount = count;
- firePropertyChange(TOGGLE_CLICK_COUNT_PROPERTY, oldValue, count);
- }
-
- public void scrollPathToVisible(TreePath path)
- {
- if (path == null)
- return;
+ /**
+ * Sets the <code>editable</code> property.
+ *
+ * @param flag <code>true</code> to make this tree object editable,
+ * <code>false</code> otherwise
+ */
+ public void setEditable(boolean flag)
+ {
+ if (editable == flag)
+ return;
- Rectangle rect = getPathBounds(path);
-
- if (rect == null)
- return;
-
- scrollRectToVisible(rect);
- }
+ boolean oldValue = editable;
+ editable = flag;
+ firePropertyChange(EDITABLE_PROPERTY, oldValue, editable);
+ }
- public void scrollRowToVisible(int row)
- {
- scrollPathToVisible(getPathForRow(row));
- }
-
- public boolean getScrollsOnExpand()
- {
- return scrollsOnExpand;
- }
-
- public void setScrollsOnExpand(boolean scroll)
- {
- if (scrollsOnExpand == scroll)
- return;
-
- boolean oldValue = scrollsOnExpand;
- scrollsOnExpand = scroll;
- firePropertyChange(SCROLLS_ON_EXPAND_PROPERTY, oldValue, scroll);
- }
-
- public void setSelectionPath(TreePath path)
- {
- selectionModel.setSelectionPath(path);
- }
-
- public void setSelectionPaths(TreePath[] paths)
- {
- selectionModel.setSelectionPaths(paths);
- }
-
- public void setSelectionRow(int row)
- {
- TreePath path = getPathForRow(row);
-
- if (path != null)
- selectionModel.setSelectionPath(path);
- }
-
- public void setSelectionRows(int[] rows)
- {
- // Make sure we have an UI so getPathForRow() does not return null.
- if (rows == null || getUI() == null)
- return;
-
- TreePath[] paths = new TreePath[rows.length];
-
- for (int i = rows.length - 1; i >= 0; --i)
- paths[i] = getPathForRow(rows[i]);
-
- setSelectionPaths(paths);
- }
-
- public void setSelectionInterval(int index0, int index1)
- {
- TreePath[] paths = getPathBetweenRows(index0, index1);
-
- if (paths != null)
- setSelectionPaths(paths);
- }
-
- public void addSelectionPath(TreePath path)
- {
- selectionModel.addSelectionPath(path);
- }
-
- public void addSelectionPaths(TreePath[] paths)
- {
- selectionModel.addSelectionPaths(paths);
- }
-
- public void addSelectionRow(int row)
- {
- TreePath path = getPathForRow(row);
-
- if (path != null)
- selectionModel.addSelectionPath(path);
- }
-
- public void addSelectionRows(int[] rows)
- {
- // Make sure we have an UI so getPathForRow() does not return null.
- if (rows == null || getUI() == null)
- return;
-
- TreePath[] paths = new TreePath[rows.length];
+ /**
+ * Checks if the root element is visible.
+ *
+ * @return <code>true</code> if the root element is visible,
+ * <code>false</code> otherwise
+ */
+ public boolean isRootVisible()
+ {
+ return rootVisible;
+ }
- for (int i = rows.length - 1; i >= 0; --i)
- paths[i] = getPathForRow(rows[i]);
-
- addSelectionPaths(paths);
- }
+ public void setRootVisible(boolean flag)
+ {
+ if (rootVisible == flag)
+ return;
- public void addSelectionInterval(int index0, int index1)
- {
- TreePath[] paths = getPathBetweenRows(index0, index1);
-
- if (paths != null)
- addSelectionPaths(paths);
- }
-
- public void removeSelectionPath(TreePath path)
- {
- selectionModel.removeSelectionPath(path);
- }
-
- public void removeSelectionPaths(TreePath[] paths)
- {
- selectionModel.removeSelectionPaths(paths);
- }
+ boolean oldValue = rootVisible;
+ rootVisible = flag;
+ firePropertyChange(ROOT_VISIBLE_PROPERTY, oldValue, flag);
+ }
- public void removeSelectionRow(int row)
- {
- TreePath path = getPathForRow(row);
+ public boolean getShowsRootHandles()
+ {
+ return showsRootHandles;
+ }
- if (path != null)
- selectionModel.removeSelectionPath(path);
- }
+ public void setShowsRootHandles(boolean flag)
+ {
+ if (showsRootHandles == flag)
+ return;
+
+ boolean oldValue = showsRootHandles;
+ showsRootHandles = flag;
+ firePropertyChange(SHOWS_ROOT_HANDLES_PROPERTY, oldValue, flag);
+ }
- public void removeSelectionRows(int[] rows)
- {
- if (rows == null || getUI() == null)
- return;
+ public TreeCellEditor getCellEditor()
+ {
+ return cellEditor;
+ }
- TreePath[] paths = new TreePath[rows.length];
+ public void setCellEditor(TreeCellEditor editor)
+ {
+ if (cellEditor == editor)
+ return;
- for (int i = rows.length - 1; i >= 0; --i)
- paths[i] = getPathForRow(rows[i]);
+ TreeCellEditor oldValue = cellEditor;
+ cellEditor = editor;
+ firePropertyChange(CELL_EDITOR_PROPERTY, oldValue, editor);
+ }
- removeSelectionPaths(paths);
- }
+ public TreeCellRenderer getCellRenderer()
+ {
+ return cellRenderer;
+ }
- public void removeSelectionInterval(int index0, int index1)
- {
- TreePath[] paths = getPathBetweenRows(index0, index1);
+ public void setCellRenderer(TreeCellRenderer newRenderer)
+ {
+ if (cellRenderer == newRenderer)
+ return;
- if (paths != null)
- removeSelectionPaths(paths);
- }
+ TreeCellRenderer oldValue = cellRenderer;
+ cellRenderer = newRenderer;
+ firePropertyChange(CELL_RENDERER_PROPERTY, oldValue, newRenderer);
+ }
- public void clearSelection()
- {
- selectionModel.clearSelection();
- setLeadSelectionPath(null);
- }
+ public TreeSelectionModel getSelectionModel()
+ {
+ return selectionModel;
+ }
- public TreePath getLeadSelectionPath()
- {
- return leadSelectionPath;
- }
+ public void setSelectionModel(TreeSelectionModel model)
+ {
+ if (selectionModel == model)
+ return;
- /**
- * @since 1.3
- */
- public void setLeadSelectionPath(TreePath path)
- {
- if (leadSelectionPath == path)
- return;
-
- TreePath oldValue = leadSelectionPath;
- leadSelectionPath = path;
- firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, path);
- }
-
- /**
- * @since 1.3
- */
- public TreePath getAnchorSelectionPath()
- {
- return anchorSelectionPath;
- }
+ if (selectionModel != null)
+ selectionModel.removeTreeSelectionListener(selectionRedirector);
- /**
- * @since 1.3
- */
- public void setAnchorSelectionPath(TreePath path)
- {
- if (anchorSelectionPath == path)
- return;
-
- TreePath oldValue = anchorSelectionPath;
- anchorSelectionPath = path;
- firePropertyChange(ANCHOR_SELECTION_PATH_PROPERTY, oldValue, path);
- }
-
- public int getLeadSelectionRow()
- {
- return selectionModel.getLeadSelectionRow();
- }
-
- public int getMaxSelectionRow()
- {
- return selectionModel.getMaxSelectionRow();
- }
-
- public int getMinSelectionRow()
- {
- return selectionModel.getMinSelectionRow();
- }
-
- public int getSelectionCount()
- {
- return selectionModel.getSelectionCount();
- }
-
- public TreePath getSelectionPath()
- {
- return selectionModel.getSelectionPath();
- }
-
- public TreePath[] getSelectionPaths()
- {
- return selectionModel.getSelectionPaths();
- }
-
- public int[] getSelectionRows()
- {
- return selectionModel.getSelectionRows();
- }
-
- public boolean isPathSelected(TreePath path)
- {
- return selectionModel.isPathSelected(path);
- }
-
- public boolean isRowSelected(int row)
- {
- return selectionModel.isPathSelected(getPathForRow(row));
- }
-
- public boolean isSelectionEmpty()
- {
- return selectionModel.isSelectionEmpty();
- }
-
- /**
- * Return the value of the <code>dragEnabled</code> property.
- *
- * @return the value
- *
- * @since 1.4
- */
- public boolean getDragEnabled()
- {
- return dragEnabled;
- }
-
- /**
- * Set the <code>dragEnabled</code> property.
- *
- * @param enabled new value
- *
- * @since 1.4
- */
- public void setDragEnabled(boolean enabled)
- {
+ TreeSelectionModel oldValue = selectionModel;
+ selectionModel = model;
- dragEnabled = enabled;
- }
+ if (selectionModel != null)
+ selectionModel.addTreeSelectionListener(selectionRedirector);
- public int getRowCount()
- {
- TreeUI ui = getUI();
+ firePropertyChange(SELECTION_MODEL_PROPERTY, oldValue, model);
+ revalidate();
+ repaint();
+ }
- if (ui != null)
- return ui.getRowCount(this);
+ public int getVisibleRowCount()
+ {
+ return visibleRowCount;
+ }
- return 0;
- }
+ public void setVisibleRowCount(int rows)
+ {
+ if (visibleRowCount == rows)
+ return;
- public void collapsePath(TreePath path)
- {
- try
- {
- fireTreeWillCollapse(path);
- }
- catch (ExpandVetoException ev)
- {
- }
- setExpandedState(path, false);
- fireTreeCollapsed(path);
- }
+ int oldValue = visibleRowCount;
+ visibleRowCount = rows;
+ firePropertyChange(VISIBLE_ROW_COUNT_PROPERTY, oldValue, rows);
+ }
- public void collapseRow(int row)
- {
- if (row < 0 || row >= getRowCount())
- return;
+ public boolean isLargeModel()
+ {
+ return largeModel;
+ }
- TreePath path = getPathForRow(row);
+ public void setLargeModel(boolean large)
+ {
+ if (largeModel == large)
+ return;
- if (path != null)
- collapsePath(path);
- }
+ boolean oldValue = largeModel;
+ largeModel = large;
+ firePropertyChange(LARGE_MODEL_PROPERTY, oldValue, large);
+ }
- public void expandPath(TreePath path)
- {
- // Don't expand if last path component is a leaf node.
- if ((path == null) || (treeModel.isLeaf(path.getLastPathComponent())))
- return;
-
- try
- {
- fireTreeWillExpand(path);
- }
- catch (ExpandVetoException ev)
- {
- }
-
- setExpandedState(path, true);
- fireTreeExpanded(path);
- }
+ public int getRowHeight()
+ {
+ return rowHeight;
+ }
- public void expandRow(int row)
- {
- if (row < 0 || row >= getRowCount())
- return;
+ public void setRowHeight(int height)
+ {
+ if (rowHeight == height)
+ return;
- TreePath path = getPathForRow(row);
+ int oldValue = rowHeight;
+ rowHeight = height;
+ firePropertyChange(ROW_HEIGHT_PROPERTY, oldValue, height);
+ }
- if (path != null)
- expandPath(path);
- }
+ public boolean isFixedRowHeight()
+ {
+ return rowHeight > 0;
+ }
- public boolean isCollapsed(TreePath path)
- {
- return !isExpanded(path);
- }
+ public boolean getInvokesStopCellEditing()
+ {
+ return invokesStopCellEditing;
+ }
- public boolean isCollapsed(int row)
- {
- if (row < 0 || row >= getRowCount())
- return false;
+ public void setInvokesStopCellEditing(boolean invoke)
+ {
+ if (invokesStopCellEditing == invoke)
+ return;
- TreePath path = getPathForRow(row);
+ boolean oldValue = invokesStopCellEditing;
+ invokesStopCellEditing = invoke;
+ firePropertyChange(INVOKES_STOP_CELL_EDITING_PROPERTY,
+ oldValue, invoke);
+ }
- if (path != null)
- return isCollapsed(path);
+ /**
+ * @since 1.3
+ */
+ public int getToggleClickCount()
+ {
+ return toggleClickCount;
+ }
- return false;
- }
+ /**
+ * @since 1.3
+ */
+ public void setToggleClickCount(int count)
+ {
+ if (toggleClickCount == count)
+ return;
- public boolean isExpanded(TreePath path)
- {
- if (path == null)
- return false;
+ int oldValue = toggleClickCount;
+ toggleClickCount = count;
+ firePropertyChange(TOGGLE_CLICK_COUNT_PROPERTY, oldValue, count);
+ }
- Object state = nodeStates.get(path);
+ public void scrollPathToVisible(TreePath path)
+ {
+ if (path == null)
+ return;
+
+ Object[] oPath = path.getPath();
+ TreePath temp = new TreePath(oPath[0]);
+ boolean stop = false;
+ int i = 1;
+ while (!stop)
+ {
+ while (isVisible(temp))
+ if (i < oPath.length)
+ temp = temp.pathByAddingChild(oPath[i++]);
+ else
+ {
+ stop = true;
+ break;
+ }
+ makeVisible(temp);
+ }
+ Rectangle rect = getPathBounds(path);
+ scrollRectToVisible(rect);
+ revalidate();
+ repaint();
+ }
- if ((state == null) || (state != EXPANDED))
- return false;
+ public void scrollRowToVisible(int row)
+ {
+ scrollPathToVisible(getPathForRow(row));
+ }
- TreePath parent = path.getParentPath();
+ public boolean getScrollsOnExpand()
+ {
+ return scrollsOnExpand;
+ }
- if (parent != null)
- return isExpanded(parent);
+ public void setScrollsOnExpand(boolean scroll)
+ {
+ if (scrollsOnExpand == scroll)
+ return;
- return true;
- }
+ boolean oldValue = scrollsOnExpand;
+ scrollsOnExpand = scroll;
+ firePropertyChange(SCROLLS_ON_EXPAND_PROPERTY, oldValue, scroll);
+ }
- public boolean isExpanded(int row)
- {
- if (row < 0 || row >= getRowCount())
- return false;
+ public void setSelectionPath(TreePath path)
+ {
+ selectionModel.setSelectionPath(path);
+ }
- TreePath path = getPathForRow(row);
+ public void setSelectionPaths(TreePath[] paths)
+ {
+ selectionModel.setSelectionPaths(paths);
+ }
- if (path != null)
- return isExpanded(path);
+ public void setSelectionRow(int row)
+ {
+ TreePath path = getPathForRow(row);
- return false;
- }
+ if (path != null)
+ selectionModel.setSelectionPath(path);
+ }
- /**
- * @since 1.3
- */
- public boolean getExpandsSelectedPaths()
- {
- return expandsSelectedPaths;
- }
+ public void setSelectionRows(int[] rows)
+ {
+ // Make sure we have an UI so getPathForRow() does not return null.
+ if (rows == null || getUI() == null)
+ return;
- /**
- * @since 1.3
- */
- public void setExpandsSelectedPaths(boolean flag)
- {
- if (expandsSelectedPaths == flag)
- return;
+ TreePath[] paths = new TreePath[rows.length];
- boolean oldValue = expandsSelectedPaths;
- expandsSelectedPaths = flag;
- firePropertyChange(EXPANDS_SELECTED_PATHS_PROPERTY, oldValue, flag);
- }
+ for (int i = rows.length - 1; i >= 0; --i)
+ paths[i] = getPathForRow(rows[i]);
- public Rectangle getPathBounds(TreePath path)
- {
- TreeUI ui = getUI();
+ setSelectionPaths(paths);
+ }
- if (ui == null)
- return null;
+ public void setSelectionInterval(int index0, int index1)
+ {
+ TreePath[] paths = getPathBetweenRows(index0, index1);
- return ui.getPathBounds(this, path);
- }
+ if (paths != null)
+ setSelectionPaths(paths);
+ }
- public Rectangle getRowBounds(int row)
- {
- TreePath path = getPathForRow(row);
+ public void addSelectionPath(TreePath path)
+ {
+ selectionModel.addSelectionPath(path);
+ }
- if (path != null)
- return getPathBounds(path);
+ public void addSelectionPaths(TreePath[] paths)
+ {
+ selectionModel.addSelectionPaths(paths);
+ }
- return null;
- }
+ public void addSelectionRow(int row)
+ {
+ TreePath path = getPathForRow(row);
- public boolean isEditing()
- {
- TreeUI ui = getUI();
+ if (path != null)
+ selectionModel.addSelectionPath(path);
+ }
- if (ui != null)
- return ui.isEditing(this);
+ public void addSelectionRows(int[] rows)
+ {
+ // Make sure we have an UI so getPathForRow() does not return null.
+ if (rows == null || getUI() == null)
+ return;
- return false;
- }
+ TreePath[] paths = new TreePath[rows.length];
- public boolean stopEditing()
- {
- TreeUI ui = getUI();
+ for (int i = rows.length - 1; i >= 0; --i)
+ paths[i] = getPathForRow(rows[i]);
- if (ui != null)
- return ui.stopEditing(this);
+ addSelectionPaths(paths);
+ }
- return false;
- }
+ public void addSelectionInterval(int index0, int index1)
+ {
+ TreePath[] paths = getPathBetweenRows(index0, index1);
- public void cancelEditing()
- {
- TreeUI ui = getUI();
+ if (paths != null)
+ addSelectionPaths(paths);
+ }
- if (ui != null)
- ui.cancelEditing(this);
- }
+ public void removeSelectionPath(TreePath path)
+ {
+ selectionModel.removeSelectionPath(path);
+ }
- public void startEditingAtPath(TreePath path)
- {
- TreeUI ui = getUI();
+ public void removeSelectionPaths(TreePath[] paths)
+ {
+ selectionModel.removeSelectionPaths(paths);
+ }
- if (ui != null)
- ui.startEditingAtPath(this, path);
- }
+ public void removeSelectionRow(int row)
+ {
+ TreePath path = getPathForRow(row);
- public TreePath getEditingPath()
- {
- TreeUI ui = getUI();
+ if (path != null)
+ selectionModel.removeSelectionPath(path);
+ }
- if (ui != null)
- return ui.getEditingPath(this);
+ public void removeSelectionRows(int[] rows)
+ {
+ if (rows == null || getUI() == null)
+ return;
- return null;
- }
+ TreePath[] paths = new TreePath[rows.length];
- public TreePath getPathForLocation(int x, int y)
- {
- TreePath path = getClosestPathForLocation(x, y);
+ for (int i = rows.length - 1; i >= 0; --i)
+ paths[i] = getPathForRow(rows[i]);
- if (path != null)
- {
- Rectangle rect = getPathBounds(path);
+ removeSelectionPaths(paths);
+ }
- if ((rect != null) && rect.contains(x, y))
- return path;
- }
+ public void removeSelectionInterval(int index0, int index1)
+ {
+ TreePath[] paths = getPathBetweenRows(index0, index1);
- return null;
- }
+ if (paths != null)
+ removeSelectionPaths(paths);
+ }
- public int getRowForLocation(int x, int y)
- {
- TreePath path = getPathForLocation(x, y);
+ public void clearSelection()
+ {
+ selectionModel.clearSelection();
+ setLeadSelectionPath(null);
+ }
- if (path != null)
- return getRowForPath(path);
+ public TreePath getLeadSelectionPath()
+ {
+ return leadSelectionPath;
+ }
- return -1;
- }
+ /**
+ * @since 1.3
+ */
+ public void setLeadSelectionPath(TreePath path)
+ {
+ if (leadSelectionPath == path)
+ return;
+
+ TreePath oldValue = leadSelectionPath;
+ leadSelectionPath = path;
+ firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, path);
+ }
- public TreePath getClosestPathForLocation(int x, int y)
- {
- TreeUI ui = getUI();
+ /**
+ * @since 1.3
+ */
+ public TreePath getAnchorSelectionPath()
+ {
+ return anchorSelectionPath;
+ }
- if (ui != null)
- return ui.getClosestPathForLocation(this, x, y);
+ /**
+ * @since 1.3
+ */
+ public void setAnchorSelectionPath(TreePath path)
+ {
+ if (anchorSelectionPath == path)
+ return;
- return null;
- }
+ TreePath oldValue = anchorSelectionPath;
+ anchorSelectionPath = path;
+ firePropertyChange(ANCHOR_SELECTION_PATH_PROPERTY, oldValue, path);
+ }
- public int getClosestRowForLocation(int x, int y)
- {
- TreePath path = getClosestPathForLocation(x, y);
+ public int getLeadSelectionRow()
+ {
+ return selectionModel.getLeadSelectionRow();
+ }
- if (path != null)
- return getRowForPath(path);
+ public int getMaxSelectionRow()
+ {
+ return selectionModel.getMaxSelectionRow();
+ }
- return -1;
- }
+ public int getMinSelectionRow()
+ {
+ return selectionModel.getMinSelectionRow();
+ }
- public Object getLastSelectedPathComponent()
- {
- TreePath path = getSelectionPath();
+ public int getSelectionCount()
+ {
+ return selectionModel.getSelectionCount();
+ }
- if (path != null)
- return path.getLastPathComponent();
+ public TreePath getSelectionPath()
+ {
+ return selectionModel.getSelectionPath();
+ }
- return null;
- }
+ public TreePath[] getSelectionPaths()
+ {
+ return selectionModel.getSelectionPaths();
+ }
- private void doExpandParents(TreePath path, boolean state)
- {
- TreePath parent = path.getParentPath();
-
- if (!isExpanded(parent) && parent != null)
- doExpandParents(parent, false);
+ public int[] getSelectionRows()
+ {
+ return selectionModel.getSelectionRows();
+ }
- nodeStates.put(path, state ? EXPANDED : COLLAPSED);
- }
+ public boolean isPathSelected(TreePath path)
+ {
+ return selectionModel.isPathSelected(path);
+ }
- protected void setExpandedState(TreePath path, boolean state)
- {
- if (path == null)
- return;
- TreePath parent = path.getParentPath();
+ public boolean isRowSelected(int row)
+ {
+ return selectionModel.isPathSelected(getPathForRow(row));
+ }
- doExpandParents(path, state);
- }
+ public boolean isSelectionEmpty()
+ {
+ return selectionModel.isSelectionEmpty();
+ }
- protected void clearToggledPaths()
- {
- nodeStates.clear();
- }
+ /**
+ * Return the value of the <code>dragEnabled</code> property.
+ *
+ * @return the value
+ *
+ * @since 1.4
+ */
+ public boolean getDragEnabled()
+ {
+ return dragEnabled;
+ }
- protected Enumeration getDescendantToggledPaths(TreePath parent)
- {
- if (parent == null)
- return null;
+ /**
+ * Set the <code>dragEnabled</code> property.
+ *
+ * @param enabled new value
+ *
+ * @since 1.4
+ */
+ public void setDragEnabled(boolean enabled)
+ {
+ dragEnabled = enabled;
+ }
- Enumeration nodes = nodeStates.keys();
- Vector result = new Vector();
+ public int getRowCount()
+ {
+ TreeUI ui = getUI();
- while (nodes.hasMoreElements())
- {
- TreePath path = (TreePath) nodes.nextElement();
+ if (ui != null)
+ return ui.getRowCount(this);
- if (path.isDescendant(parent))
- result.addElement(path);
- }
+ return 0;
+ }
- return result.elements();
- }
+ public void collapsePath(TreePath path)
+ {
+ try
+ {
+ fireTreeWillCollapse(path);
+ }
+ catch (ExpandVetoException ev)
+ {
+ // We do nothing if attempt has been vetoed.
+ }
+ setExpandedState(path, false);
+ fireTreeCollapsed(path);
+ }
- public boolean hasBeenExpanded(TreePath path)
- {
- if (path == null)
- return false;
+ public void collapseRow(int row)
+ {
+ if (row < 0 || row >= getRowCount())
+ return;
- return nodeStates.get(path) != null;
- }
+ TreePath path = getPathForRow(row);
- public boolean isVisible(TreePath path)
- {
- if (path == null)
- return false;
+ if (path != null)
+ collapsePath(path);
+ }
- TreePath parent = path.getParentPath();
+ public void expandPath(TreePath path)
+ {
+ // Don't expand if path is null
+ if (path == null)
+ return;
+
+ try
+ {
+ fireTreeWillExpand(path);
+ }
+ catch (ExpandVetoException ev)
+ {
+ // We do nothing if attempt has been vetoed.
+ }
+
+ setExpandedState(path, true);
+ fireTreeExpanded(path);
+ }
- if (parent == null)
- return true; // Is root node.
+ public void expandRow(int row)
+ {
+ if (row < 0 || row >= getRowCount())
+ return;
- return isExpanded(parent);
- }
+ TreePath path = getPathForRow(row);
- public void makeVisible(TreePath path)
- {
- if (path == null)
- return;
+ if (path != null)
+ expandPath(path);
+ }
- expandPath(path.getParentPath());
- }
+ public boolean isCollapsed(TreePath path)
+ {
+ return !isExpanded(path);
+ }
- public boolean isPathEditable(TreePath path)
- {
- return isEditable();
- }
+ public boolean isCollapsed(int row)
+ {
+ if (row < 0 || row >= getRowCount())
+ return false;
- /**
- * Creates and returns an instance of {@link TreeModelHandler}.
- *
- * @returns an instance of {@link TreeModelHandler}
- */
- protected TreeModelListener createTreeModelListener()
- {
- return new TreeModelHandler();
- }
-
- /**
- * Returns a sample TreeModel that can be used in a JTree. This can be used
- * in Bean- or GUI-Builders to show something interesting.
- *
- * @return a sample TreeModel that can be used in a JTree
- */
- protected static TreeModel getDefaultTreeModel()
- {
- DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root node");
- DefaultMutableTreeNode child1 = new DefaultMutableTreeNode(
- "Child node 1");
- DefaultMutableTreeNode child11 = new DefaultMutableTreeNode(
- "Child node 1.1");
- DefaultMutableTreeNode child12 = new DefaultMutableTreeNode(
- "Child node 1.2");
- DefaultMutableTreeNode child13 = new DefaultMutableTreeNode(
- "Child node 1.3");
- DefaultMutableTreeNode child2 = new DefaultMutableTreeNode(
- "Child node 2");
- DefaultMutableTreeNode child21 = new DefaultMutableTreeNode(
- "Child node 2.1");
- DefaultMutableTreeNode child22 = new DefaultMutableTreeNode(
- "Child node 2.2");
- DefaultMutableTreeNode child23 = new DefaultMutableTreeNode(
- "Child node 2.3");
- DefaultMutableTreeNode child24 = new DefaultMutableTreeNode(
- "Child node 2.4");
-
- DefaultMutableTreeNode child3 = new DefaultMutableTreeNode(
- "Child node 3");
- root.add(child1);
- root.add(child2);
- root.add(child3);
- child1.add(child11);
- child1.add(child12);
- child1.add(child13);
- child2.add(child21);
- child2.add(child22);
- child2.add(child23);
- child2.add(child24);
- return new DefaultTreeModel(root);
- }
-
- /**
- * Converts the specified value to a String. This is used by the renderers
- * of this JTree and its nodes.
- *
- * This implementation simply returns <code>value.toString()</code> and
- * ignores all other parameters. Subclass this method to control the
- * conversion.
- *
- * @param value the value that is converted to a String
- * @param selected indicates if that value is selected or not
- * @param expanded indicates if that value is expanded or not
- * @param leaf indicates if that value is a leaf node or not
- * @param row the row of the node
- * @param hasFocus indicates if that node has focus or not
- */
- public String convertValueToText(Object value, boolean selected,
- boolean expanded, boolean leaf, int row, boolean hasFocus)
- {
- return value.toString();
- }
-
- /**
- * A String representation of this JTree. This is intended to be used for
- * debugging. The returned string may be empty but may not be
- * <code>null</code>.
- *
- * @return a String representation of this JTree
- */
- public String paramString()
- {
- // TODO: this is completely legal, but it would possibly be nice
- // to return some more content, like the tree structure, some properties
- // etc ...
- return "";
- }
-
- /**
- * Returns all TreePath objects which are a descendants of the given path
- * and are exapanded at the moment of the execution of this method. If the
- * state of any node is beeing toggled while this method is executing this
- * change may be left unaccounted.
- *
- * @param path The parent of this request
- * @return An Enumeration containing TreePath objects
- */
- public Enumeration getExpandedDescendants(TreePath path)
- {
- Enumeration paths = nodeStates.keys();
- Vector relevantPaths = new Vector();
- while (paths.hasMoreElements())
- {
- TreePath nextPath = (TreePath) paths.nextElement();
- if (nodeStates.get(nextPath) == EXPANDED
- && path.isDescendant(nextPath))
- {
- relevantPaths.add(nextPath);
- }
- }
- return relevantPaths.elements();
- }
-
- /**
- * Returns the next table element (beginning from the row
- * <code>startingRow</code> that starts with <code>prefix</code>.
- * Searching is done in the direction specified by <code>bias</code>.
- *
- * @param prefix the prefix to search for in the cell values
- * @param startingRow the index of the row where to start searching from
- * @param bias the search direction, either {@link Position.Bias#Forward} or
- * {@link Position.Bias#Backward}
- *
- * @return the path to the found element or -1 if no such element has been
- * found
- *
- * @throws IllegalArgumentException if prefix is <code>null</code> or
- * startingRow is not valid
- *
- * @since 1.4
- */
- public TreePath getNextMatch(String prefix, int startingRow,
- Position.Bias bias)
- {
- if (prefix == null)
- throw new IllegalArgumentException(
- "The argument 'prefix' must not be" + " null.");
- if (startingRow < 0)
- throw new IllegalArgumentException(
- "The argument 'startingRow' must not"
- + " be less than zero.");
-
- int size = getRowCount();
- if (startingRow > size)
- throw new IllegalArgumentException(
- "The argument 'startingRow' must not"
- + " be greater than the number of"
- + " elements in the TreeModel.");
-
- TreePath foundPath = null;
- if (bias == Position.Bias.Forward)
- {
- for (int i = startingRow; i < size; i++)
- {
- TreePath path = getPathForRow(i);
- Object o = path.getLastPathComponent();
- // FIXME: in the following call to convertValueToText the
- // last argument (hasFocus) should be done right.
- String item = convertValueToText(o, isRowSelected(i),
- isExpanded(i), treeModel.isLeaf(o), i, false);
- if (item.startsWith(prefix))
- {
- foundPath = path;
- break;
- }
- }
- } else
- {
- for (int i = startingRow; i >= 0; i--)
- {
- TreePath path = getPathForRow(i);
- Object o = path.getLastPathComponent();
- // FIXME: in the following call to convertValueToText the
- // last argument (hasFocus) should be done right.
- String item = convertValueToText(o, isRowSelected(i),
- isExpanded(i), treeModel.isLeaf(o), i, false);
- if (item.startsWith(prefix))
- {
- foundPath = path;
- break;
- }
- }
- }
- return foundPath;
- }
-
- /**
- * Removes any paths in the current set of selected paths that are
- * descendants of <code>path</code>. If <code>includePath</code> is set
- * to <code>true</code> and <code>path</code> itself is selected, then
- * it will be removed too.
- *
- * @param path the path from which selected descendants are to be removed
- * @param includeSelected if <code>true</code> then <code>path</code> itself
- * will also be remove if it's selected
- *
- * @return <code>true</code> if something has been removed,
- * <code>false</code> otherwise
- *
- * @since 1.3
- */
- protected boolean removeDescendantSelectedPaths(TreePath path,
- boolean includeSelected)
- {
- boolean removedSomething = false;
- TreePath[] selected = getSelectionPaths();
- for (int index = 0; index < selected.length; index++)
- {
- if ((selected[index] == path && includeSelected)
- || (selected[index].isDescendant(path)))
- {
- removeSelectionPath(selected[index]);
- removedSomething = true;
- }
- }
- return removedSomething;
- }
+ TreePath path = getPathForRow(row);
+
+ if (path != null)
+ return isCollapsed(path);
+
+ return false;
+ }
+
+ public boolean isExpanded(TreePath path)
+ {
+ if (path == null)
+ return false;
+
+ Object state = nodeStates.get(path);
+
+ if ((state == null) || (state != EXPANDED))
+ return false;
+
+ TreePath parent = path.getParentPath();
+
+ if (parent != null)
+ return isExpanded(parent);
+
+ return true;
+ }
+
+ public boolean isExpanded(int row)
+ {
+ if (row < 0 || row >= getRowCount())
+ return false;
+
+ TreePath path = getPathForRow(row);
+
+ if (path != null)
+ return isExpanded(path);
+
+ return false;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public boolean getExpandsSelectedPaths()
+ {
+ return expandsSelectedPaths;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public void setExpandsSelectedPaths(boolean flag)
+ {
+ if (expandsSelectedPaths == flag)
+ return;
+
+ boolean oldValue = expandsSelectedPaths;
+ expandsSelectedPaths = flag;
+ firePropertyChange(EXPANDS_SELECTED_PATHS_PROPERTY, oldValue, flag);
+ }
+
+ public Rectangle getPathBounds(TreePath path)
+ {
+ TreeUI ui = getUI();
+
+ if (ui == null)
+ return null;
+
+ return ui.getPathBounds(this, path);
+ }
+
+ public Rectangle getRowBounds(int row)
+ {
+ TreePath path = getPathForRow(row);
+
+ if (path != null)
+ return getPathBounds(path);
+
+ return null;
+ }
+
+ public boolean isEditing()
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.isEditing(this);
+
+ return false;
+ }
+
+ public boolean stopEditing()
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.stopEditing(this);
+
+ return false;
+ }
+
+ public void cancelEditing()
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ ui.cancelEditing(this);
+ }
+
+ public void startEditingAtPath(TreePath path)
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ ui.startEditingAtPath(this, path);
+ }
+
+ public TreePath getEditingPath()
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.getEditingPath(this);
+
+ return null;
+ }
+
+ public TreePath getPathForLocation(int x, int y)
+ {
+ TreePath path = getClosestPathForLocation(x, y);
+
+ if (path != null)
+ {
+ Rectangle rect = getPathBounds(path);
+
+ if ((rect != null) && rect.contains(x, y))
+ return path;
+ }
+
+ return null;
+ }
+
+ public int getRowForLocation(int x, int y)
+ {
+ TreePath path = getPathForLocation(x, y);
+
+ if (path != null)
+ return getRowForPath(path);
+
+ return -1;
+ }
+
+ public TreePath getClosestPathForLocation(int x, int y)
+ {
+ TreeUI ui = getUI();
+
+ if (ui != null)
+ return ui.getClosestPathForLocation(this, x, y);
+
+ return null;
+ }
+
+ public int getClosestRowForLocation(int x, int y)
+ {
+ TreePath path = getClosestPathForLocation(x, y);
+
+ if (path != null)
+ return getRowForPath(path);
+
+ return -1;
+ }
+
+ public Object getLastSelectedPathComponent()
+ {
+ TreePath path = getSelectionPath();
+
+ if (path != null)
+ return path.getLastPathComponent();
+
+ return null;
+ }
+
+ private void doExpandParents(TreePath path, boolean state)
+ {
+ TreePath parent = path.getParentPath();
+
+ if (!isExpanded(parent) && parent != null)
+ doExpandParents(parent, false);
+
+ nodeStates.put(path, state ? EXPANDED : COLLAPSED);
+ }
+
+ protected void setExpandedState(TreePath path, boolean state)
+ {
+ if (path == null)
+ return;
+
+ doExpandParents(path, state);
+ }
+
+ protected void clearToggledPaths()
+ {
+ nodeStates.clear();
+ }
+
+ protected Enumeration getDescendantToggledPaths(TreePath parent)
+ {
+ if (parent == null)
+ return null;
+
+ Enumeration nodes = nodeStates.keys();
+ Vector result = new Vector();
+
+ while (nodes.hasMoreElements())
+ {
+ TreePath path = (TreePath) nodes.nextElement();
+
+ if (path.isDescendant(parent))
+ result.addElement(path);
+ }
+
+ return result.elements();
+ }
+
+ public boolean hasBeenExpanded(TreePath path)
+ {
+ if (path == null)
+ return false;
+
+ return nodeStates.get(path) != null;
+ }
+
+ public boolean isVisible(TreePath path)
+ {
+ if (path == null)
+ return false;
+
+ TreePath parent = path.getParentPath();
+
+ if (parent == null)
+ return true; // Is root node.
+
+ return isExpanded(parent);
+ }
+
+ public void makeVisible(TreePath path)
+ {
+ if (path == null)
+ return;
+
+ expandPath(path.getParentPath());
+ }
+
+ public boolean isPathEditable(TreePath path)
+ {
+ return isEditable();
+ }
+
+ /**
+ * Creates and returns an instance of {@link TreeModelHandler}.
+ *
+ * @return an instance of {@link TreeModelHandler}
+ */
+ protected TreeModelListener createTreeModelListener()
+ {
+ return new TreeModelHandler();
+ }
+
+ /**
+ * Returns a sample TreeModel that can be used in a JTree. This can be used
+ * in Bean- or GUI-Builders to show something interesting.
+ *
+ * @return a sample TreeModel that can be used in a JTree
+ */
+ protected static TreeModel getDefaultTreeModel()
+ {
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root node");
+ DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Child node 1");
+ DefaultMutableTreeNode child11 =
+ new DefaultMutableTreeNode("Child node 1.1");
+ DefaultMutableTreeNode child12 =
+ new DefaultMutableTreeNode("Child node 1.2");
+ DefaultMutableTreeNode child13 =
+ new DefaultMutableTreeNode("Child node 1.3");
+ DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Child node 2");
+ DefaultMutableTreeNode child21 =
+ new DefaultMutableTreeNode("Child node 2.1");
+ DefaultMutableTreeNode child22 =
+ new DefaultMutableTreeNode("Child node 2.2");
+ DefaultMutableTreeNode child23 =
+ new DefaultMutableTreeNode("Child node 2.3");
+ DefaultMutableTreeNode child24 =
+ new DefaultMutableTreeNode("Child node 2.4");
+
+ DefaultMutableTreeNode child3 = new DefaultMutableTreeNode("Child node 3");
+ root.add(child1);
+ root.add(child2);
+ root.add(child3);
+ child1.add(child11);
+ child1.add(child12);
+ child1.add(child13);
+ child2.add(child21);
+ child2.add(child22);
+ child2.add(child23);
+ child2.add(child24);
+ return new DefaultTreeModel(root);
+ }
+
+ /**
+ * Converts the specified value to a String. This is used by the renderers
+ * of this JTree and its nodes.
+ *
+ * This implementation simply returns <code>value.toString()</code> and
+ * ignores all other parameters. Subclass this method to control the
+ * conversion.
+ *
+ * @param value the value that is converted to a String
+ * @param selected indicates if that value is selected or not
+ * @param expanded indicates if that value is expanded or not
+ * @param leaf indicates if that value is a leaf node or not
+ * @param row the row of the node
+ * @param hasFocus indicates if that node has focus or not
+ */
+ public String convertValueToText(Object value, boolean selected,
+ boolean expanded, boolean leaf, int row, boolean hasFocus)
+ {
+ return value.toString();
+ }
+
+ /**
+ * A String representation of this JTree. This is intended to be used for
+ * debugging. The returned string may be empty but may not be
+ * <code>null</code>.
+ *
+ * @return a String representation of this JTree
+ */
+ public String paramString()
+ {
+ // TODO: this is completely legal, but it would possibly be nice
+ // to return some more content, like the tree structure, some properties
+ // etc ...
+ return "";
+ }
+
+ /**
+ * Returns all TreePath objects which are a descendants of the given path
+ * and are exapanded at the moment of the execution of this method. If the
+ * state of any node is beeing toggled while this method is executing this
+ * change may be left unaccounted.
+ *
+ * @param path The parent of this request
+ *
+ * @return An Enumeration containing TreePath objects
+ */
+ public Enumeration getExpandedDescendants(TreePath path)
+ {
+ Enumeration paths = nodeStates.keys();
+ Vector relevantPaths = new Vector();
+ while (paths.hasMoreElements())
+ {
+ TreePath nextPath = (TreePath) paths.nextElement();
+ if (nodeStates.get(nextPath) == EXPANDED
+ && path.isDescendant(nextPath))
+ {
+ relevantPaths.add(nextPath);
+ }
+ }
+ return relevantPaths.elements();
+ }
+
+ /**
+ * Returns the next table element (beginning from the row
+ * <code>startingRow</code> that starts with <code>prefix</code>.
+ * Searching is done in the direction specified by <code>bias</code>.
+ *
+ * @param prefix the prefix to search for in the cell values
+ * @param startingRow the index of the row where to start searching from
+ * @param bias the search direction, either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward}
+ *
+ * @return the path to the found element or -1 if no such element has been
+ * found
+ *
+ * @throws IllegalArgumentException if prefix is <code>null</code> or
+ * startingRow is not valid
+ *
+ * @since 1.4
+ */
+ public TreePath getNextMatch(String prefix, int startingRow,
+ Position.Bias bias)
+ {
+ if (prefix == null)
+ throw new IllegalArgumentException("The argument 'prefix' must not be"
+ + " null.");
+ if (startingRow < 0)
+ throw new IllegalArgumentException("The argument 'startingRow' must not"
+ + " be less than zero.");
+
+ int size = getRowCount();
+ if (startingRow > size)
+ throw new IllegalArgumentException("The argument 'startingRow' must not"
+ + " be greater than the number of"
+ + " elements in the TreeModel.");
+
+ TreePath foundPath = null;
+ if (bias == Position.Bias.Forward)
+ {
+ for (int i = startingRow; i < size; i++)
+ {
+ TreePath path = getPathForRow(i);
+ Object o = path.getLastPathComponent();
+ // FIXME: in the following call to convertValueToText the
+ // last argument (hasFocus) should be done right.
+ String item = convertValueToText(o, isRowSelected(i),
+ isExpanded(i), treeModel.isLeaf(o),
+ i, false);
+ if (item.startsWith(prefix))
+ {
+ foundPath = path;
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (int i = startingRow; i >= 0; i--)
+ {
+ TreePath path = getPathForRow(i);
+ Object o = path.getLastPathComponent();
+ // FIXME: in the following call to convertValueToText the
+ // last argument (hasFocus) should be done right.
+ String item = convertValueToText(o, isRowSelected(i),
+ isExpanded(i), treeModel.isLeaf(o), i, false);
+ if (item.startsWith(prefix))
+ {
+ foundPath = path;
+ break;
+ }
+ }
+ }
+ return foundPath;
+ }
+
+ /**
+ * Removes any paths in the current set of selected paths that are
+ * descendants of <code>path</code>. If <code>includePath</code> is set
+ * to <code>true</code> and <code>path</code> itself is selected, then
+ * it will be removed too.
+ *
+ * @param path the path from which selected descendants are to be removed
+ * @param includeSelected if <code>true</code> then <code>path</code> itself
+ * will also be remove if it's selected
+ *
+ * @return <code>true</code> if something has been removed,
+ * <code>false</code> otherwise
+ *
+ * @since 1.3
+ */
+ protected boolean removeDescendantSelectedPaths(TreePath path,
+ boolean includeSelected)
+ {
+ boolean removedSomething = false;
+ TreePath[] selected = getSelectionPaths();
+ for (int index = 0; index < selected.length; index++)
+ {
+ if ((selected[index] == path && includeSelected)
+ || (selected[index].isDescendant(path)))
+ {
+ removeSelectionPath(selected[index]);
+ removedSomething = true;
+ }
+ }
+ return removedSomething;
+ }
+
+ /**
+ * Removes any descendants of the TreePaths in toRemove that have been
+ * expanded.
+ *
+ * @param toRemove - Enumeration of TreePaths that need to be removed from
+ * cache of toggled tree paths.
+ */
+ protected void removeDescendantToggledPaths(Enumeration toRemove)
+ {
+ while (toRemove.hasMoreElements())
+ {
+ TreePath current = (TreePath) toRemove.nextElement();
+ Enumeration descendants = getDescendantToggledPaths(current);
+
+ while (descendants.hasMoreElements())
+ {
+ TreePath currentDes = (TreePath) descendants.nextElement();
+ if (isExpanded(currentDes))
+ nodeStates.remove(currentDes);
+ }
+ }
+ }
+
+ /**
+ * Sent when the tree has changed enough that we need to resize the bounds,
+ * but not enough that we need to remove the expanded node set (e.g nodes
+ * were expanded or collapsed, or nodes were inserted into the tree). You
+ * should never have to invoke this, the UI will invoke this as it needs to.
+ */
+ public void treeDidChange()
+ {
+ repaint();
+ }
}
diff --git a/libjava/classpath/javax/swing/JViewport.java b/libjava/classpath/javax/swing/JViewport.java
index d750bad29cc..5f20f0aa60a 100644
--- a/libjava/classpath/javax/swing/JViewport.java
+++ b/libjava/classpath/javax/swing/JViewport.java
@@ -41,6 +41,7 @@ package javax.swing;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Image;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Point;
@@ -49,6 +50,9 @@ import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.io.Serializable;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -95,17 +99,41 @@ import javax.swing.plaf.ViewportUI;
* the underlying child at position <code>(-VX,-VY)</code></p>
*
*/
-public class JViewport extends JComponent
+public class JViewport extends JComponent implements Accessible
{
+ /**
+ * Provides accessibility support for <code>JViewport</code>.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+ protected class AccessibleJViewport extends AccessibleJComponent
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJViewport</code>.
+ */
+ public AccessibleJViewport()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the accessible role of <code>JViewport</code>, which is
+ * {@link AccessibleRole#VIEWPORT}.
+ *
+ * @return the accessible role of <code>JViewport</code>
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.VIEWPORT;
+ }
+ }
/**
* A {@link java.awt.event.ComponentListener} that listens for
- * changes of the view's size. This class forbids changes of the view
- * component's size that would exceed the viewport's size.
+ * changes of the view's size. This triggers a revalidate() call on the
+ * viewport.
*/
- protected class ViewListener
- extends ComponentAdapter
- implements Serializable
+ protected class ViewListener extends ComponentAdapter implements Serializable
{
private static final long serialVersionUID = -2812489404285958070L;
@@ -114,57 +142,53 @@ public class JViewport extends JComponent
*/
protected ViewListener()
{
+ // Nothing to do here.
}
/**
* Receives notification when a component (in this case: the view
- * component) changes it's size.
+ * component) changes it's size. This simply triggers a revalidate() on the
+ * viewport.
*
* @param ev the ComponentEvent describing the change
*/
public void componentResized(ComponentEvent ev)
{
- // According to some tests that I did with Sun's implementation
- // this class is supposed to make sure that the view component
- // is not resized to a larger size than the viewport.
- // This is not documented anywhere. What I did is: I subclassed JViewport
- // and ViewListener and 'disabled' the componentResized method by
- // overriding it and not calling super.componentResized().
- // When this method is disabled I can set the size on the view component
- // normally, when it is enabled, it gets immediatly resized back,
- // after a resize attempt that would exceed the Viewport's size.
- Component comp = ev.getComponent();
- Dimension newSize = comp.getSize();
- Dimension viewportSize = getSize();
- boolean revert = false;
- if (newSize.width > viewportSize.width)
- {
- newSize.width = viewportSize.width;
- revert = true;
- }
- if (newSize.height > viewportSize.height)
- {
- newSize.height = viewportSize.height;
- revert = true;
- }
- if (revert == true)
- comp.setSize(newSize);
+ revalidate();
}
}
- private static final long serialVersionUID = -6925142919680527970L;
-
public static final int SIMPLE_SCROLL_MODE = 0;
public static final int BLIT_SCROLL_MODE = 1;
public static final int BACKINGSTORE_SCROLL_MODE = 2;
+ private static final long serialVersionUID = -6925142919680527970L;
+
+ protected boolean scrollUnderway;
+ protected boolean isViewSizeSet;
+
+ /**
+ * This flag indicates whether we use a backing store for drawing.
+ *
+ * @deprecated since JDK 1.3
+ */
+ protected boolean backingStore;
+
+ /**
+ * The backingstore image used for the backingstore and blit scroll methods.
+ */
+ protected Image backingStoreImage;
+
+ /**
+ * The position at which the view has been drawn the last time. This is used
+ * to determine the bittable area.
+ */
+ protected Point lastPaintPosition;
+
ChangeEvent changeEvent = new ChangeEvent(this);
int scrollMode;
- protected boolean scrollUnderway;
- protected boolean isViewSizeSet;
-
/**
* The width and height of the Viewport's area in terms of view
* coordinates. Typically this will be the same as the width and height
@@ -172,29 +196,75 @@ public class JViewport extends JComponent
* width and height, which it may do, for example if it magnifies or
* rotates its view.
*
- * @see #toViewCoordinates
+ * @see #toViewCoordinates(Dimension)
*/
Dimension extentSize;
/**
* The width and height of the view in its own coordinate space.
*/
-
Dimension viewSize;
- Point lastPaintPosition;
-
/**
* The ViewListener instance.
*/
ViewListener viewListener;
+ /**
+ * Stores the location from where to blit. This is a cached Point object used
+ * in blitting calculations.
+ */
+ Point cachedBlitFrom;
+
+ /**
+ * Stores the location where to blit to. This is a cached Point object used
+ * in blitting calculations.
+ */
+ Point cachedBlitTo;
+
+ /**
+ * Stores the width of the blitted area. This is a cached Dimension object
+ * used in blitting calculations.
+ */
+ Dimension cachedBlitSize;
+
+ /**
+ * Stores the bounds of the area that needs to be repainted. This is a cached
+ * Rectangle object used in blitting calculations.
+ */
+ Rectangle cachedBlitPaint;
+
+ boolean damaged = true;
+
+ /**
+ * A flag indicating if the size of the viewport has changed since the
+ * last repaint. This is used in double buffered painting to check if we
+ * need a new double buffer, or can reuse the old one.
+ */
+ boolean sizeChanged = true;
+
public JViewport()
{
setOpaque(true);
- setScrollMode(BLIT_SCROLL_MODE);
- setLayout(createLayoutManager());
+ String scrollModeProp =
+ System.getProperty("gnu.javax.swing.JViewport.scrollMode",
+ "BLIT");
+ int myScrollMode;
+ if (scrollModeProp.equalsIgnoreCase("simple"))
+ myScrollMode = SIMPLE_SCROLL_MODE;
+ else if (scrollModeProp.equalsIgnoreCase("backingstore"))
+ myScrollMode = BACKINGSTORE_SCROLL_MODE;
+ else
+ myScrollMode = BLIT_SCROLL_MODE;
+ setScrollMode(myScrollMode);
+
updateUI();
+ setLayout(createLayoutManager());
+ lastPaintPosition = new Point();
+ cachedBlitFrom = new Point();
+ cachedBlitTo = new Point();
+ cachedBlitSize = new Dimension();
+ cachedBlitPaint = new Rectangle();
}
public Dimension getExtentSize()
@@ -248,9 +318,14 @@ public class JViewport extends JComponent
viewSize = newSize;
Component view = getView();
if (view != null)
- view.setSize(viewSize);
+ {
+ if (newSize != view.getSize())
+ {
+ view.setSize(viewSize);
+ fireStateChanged();
+ }
+ }
isViewSizeSet = true;
- fireStateChanged();
}
/**
@@ -275,13 +350,17 @@ public class JViewport extends JComponent
public void setViewPosition(Point p)
{
+ if (getViewPosition().equals(p))
+ return;
Component view = getView();
if (view != null)
{
Point q = new Point(-p.x, -p.y);
view.setLocation(q);
+ isViewSizeSet = false;
fireStateChanged();
}
+ repaint();
}
public Rectangle getViewRect()
@@ -331,12 +410,8 @@ public class JViewport extends JComponent
public void setView(Component v)
{
- while (getComponentCount() > 0)
- {
- if (viewListener != null)
- getView().removeComponentListener(viewListener);
- remove(0);
- }
+ if (viewListener != null)
+ getView().removeComponentListener(viewListener);
if (v != null)
{
@@ -346,37 +421,25 @@ public class JViewport extends JComponent
add(v);
fireStateChanged();
}
- }
-
- public void revalidate()
- {
- fireStateChanged();
- super.revalidate();
+ revalidate();
+ repaint();
}
public void reshape(int x, int y, int w, int h)
{
- boolean changed =
- (x != getX())
- || (y != getY())
- || (w != getWidth())
- || (h != getHeight());
+ if (w != getWidth() || h != getHeight())
+ sizeChanged = true;
super.reshape(x, y, w, h);
- if (changed)
- fireStateChanged();
- }
-
- protected void addImpl(Component comp, Object constraints, int index)
- {
- if (getComponentCount() > 0)
- remove(getComponents()[0]);
-
- super.addImpl(comp, constraints, index);
+ if (sizeChanged)
+ {
+ damaged = true;
+ fireStateChanged();
+ }
}
- public final Insets getInsets()
+ public final Insets getInsets()
{
- return new Insets(0,0,0,0);
+ return new Insets(0, 0, 0, 0);
}
public final Insets getInsets(Insets insets)
@@ -390,6 +453,14 @@ public class JViewport extends JComponent
return insets;
}
+
+ /**
+ * Overridden to return <code>false</code>, so the JViewport's paint method
+ * gets called instead of directly calling the children. This is necessary
+ * in order to get a useful clipping and translation on the children.
+ *
+ * @return <code>false</code>
+ */
public boolean isOptimizedDrawingEnabled()
{
return false;
@@ -397,7 +468,36 @@ public class JViewport extends JComponent
public void paint(Graphics g)
{
- paintComponent(g);
+ Component view = getView();
+
+ if (view == null)
+ return;
+
+ Point pos = getViewPosition();
+ Rectangle viewBounds = view.getBounds();
+ Rectangle portBounds = getBounds();
+
+ if (viewBounds.width == 0
+ || viewBounds.height == 0
+ || portBounds.width == 0
+ || portBounds.height == 0)
+ return;
+
+ switch (getScrollMode())
+ {
+
+ case JViewport.BACKINGSTORE_SCROLL_MODE:
+ paintBackingStore(g);
+ break;
+ case JViewport.BLIT_SCROLL_MODE:
+ paintBlit(g);
+ break;
+ case JViewport.SIMPLE_SCROLL_MODE:
+ default:
+ paintSimple(g);
+ break;
+ }
+ damaged = false;
}
public void addChangeListener(ChangeListener listener)
@@ -415,13 +515,6 @@ public class JViewport extends JComponent
return (ChangeListener[]) getListeners(ChangeListener.class);
}
- protected void fireStateChanged()
- {
- ChangeListener[] listeners = getChangeListeners();
- for (int i = 0; i < listeners.length; ++i)
- listeners[i].stateChanged(changeEvent);
- }
-
/**
* This method returns the String ID of the UI class of Separator.
*
@@ -467,6 +560,90 @@ public class JViewport extends JComponent
}
/**
+ * Scrolls the view so that contentRect becomes visible.
+ *
+ * @param contentRect the rectangle to make visible within the view
+ */
+ public void scrollRectToVisible(Rectangle contentRect)
+ {
+ Component view = getView();
+ if (view == null)
+ return;
+
+ Point pos = getViewPosition();
+ Rectangle viewBounds = getView().getBounds();
+ Rectangle portBounds = getBounds();
+
+ if (isShowing())
+ getView().validate();
+
+ // If the bottom boundary of contentRect is below the port
+ // boundaries, scroll up as necessary.
+ if (contentRect.y + contentRect.height + viewBounds.y > portBounds.height)
+ pos.y = contentRect.y + contentRect.height - portBounds.height;
+ // If contentRect.y is above the port boundaries, scroll down to
+ // contentRect.y.
+ if (contentRect.y + viewBounds.y < 0)
+ pos.y = contentRect.y;
+ // If the right boundary of contentRect is right from the port
+ // boundaries, scroll left as necessary.
+ if (contentRect.x + contentRect.width + viewBounds.x > portBounds.width)
+ pos.x = contentRect.x + contentRect.width - portBounds.width;
+ // If contentRect.x is left from the port boundaries, scroll right to
+ // contentRect.x.
+ if (contentRect.x + viewBounds.x < 0)
+ pos.x = contentRect.x;
+ setViewPosition(pos);
+ }
+
+ /**
+ * Returns the accessible context for this <code>JViewport</code>. This
+ * will be an instance of {@link AccessibleJViewport}.
+ *
+ * @return the accessible context for this <code>JViewport</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJViewport();
+ return accessibleContext;
+ }
+
+ /**
+ * Forward repaint to parent to make sure only one paint is performed by the
+ * RepaintManager.
+ *
+ * @param tm number of milliseconds to defer the repaint request
+ * @param x the X coordinate of the upper left corner of the dirty area
+ * @param y the Y coordinate of the upper left corner of the dirty area
+ * @param w the width of the dirty area
+ * @param h the height of the dirty area
+ */
+ public void repaint(long tm, int x, int y, int w, int h)
+ {
+ Component parent = getParent();
+ if (parent != null)
+ {
+ parent.repaint(tm, x + getX(), y + getY(), w, h);
+ }
+ }
+
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ if (getComponentCount() > 0)
+ remove(getComponents()[0]);
+
+ super.addImpl(comp, constraints, index);
+ }
+
+ protected void fireStateChanged()
+ {
+ ChangeListener[] listeners = getChangeListeners();
+ for (int i = 0; i < listeners.length; ++i)
+ listeners[i].stateChanged(changeEvent);
+ }
+
+ /**
* Creates a {@link ViewListener} that is supposed to listen for
* size changes on the view component.
*
@@ -489,43 +666,217 @@ public class JViewport extends JComponent
}
/**
- * Scrolls the view so that contentRect becomes visible.
+ * Computes the parameters for the blitting scroll method. <code>dx</code>
+ * and <code>dy</code> specifiy the X and Y offset by which the viewport
+ * is scrolled. All other arguments are output parameters and are filled by
+ * this method.
*
- * @param contentRect the rectangle to make visible within the view
+ * <code>blitFrom</code> holds the position of the blit rectangle in the
+ * viewport rectangle before scrolling, <code>blitTo</code> where the blitArea
+ * is copied to.
+ *
+ * <code>blitSize</code> holds the size of the blit area and
+ * <code>blitPaint</code> is the area of the view that needs to be painted.
+ *
+ * This method returns <code>true</code> if blitting is possible and
+ * <code>false</code> if the viewport has to be repainted completetly without
+ * blitting.
+ *
+ * @param dx the horizontal delta
+ * @param dy the vertical delta
+ * @param blitFrom the position from where to blit; set by this method
+ * @param blitTo the position where to blit area is copied to; set by this
+ * method
+ * @param blitSize the size of the blitted area; set by this method
+ * @param blitPaint the area that needs repainting; set by this method
+ *
+ * @return <code>true</code> if blitting is possible,
+ * <code>false</code> otherwise
*/
- public void scrollRectToVisible(Rectangle contentRect)
+ protected boolean computeBlit(int dx, int dy, Point blitFrom, Point blitTo,
+ Dimension blitSize, Rectangle blitPaint)
+ {
+ if ((dx != 0 && dy != 0) || damaged)
+ // We cannot blit if the viewport is scrolled in both directions at
+ // once.
+ return false;
+
+ Rectangle portBounds = SwingUtilities.calculateInnerArea(this, getBounds());
+
+ // Compute the blitFrom and blitTo parameters.
+ blitFrom.x = portBounds.x;
+ blitFrom.y = portBounds.y;
+ blitTo.x = portBounds.x;
+ blitTo.y = portBounds.y;
+
+ if (dy > 0)
+ {
+ blitFrom.y = portBounds.y + dy;
+ }
+ else if (dy < 0)
+ {
+ blitTo.y = portBounds.y - dy;
+ }
+ else if (dx > 0)
+ {
+ blitFrom.x = portBounds.x + dx;
+ }
+ else if (dx < 0)
+ {
+ blitTo.x = portBounds.x - dx;
+ }
+
+ // Compute size of the blit area.
+ if (dx != 0)
+ {
+ blitSize.width = portBounds.width - Math.abs(dx);
+ blitSize.height = portBounds.height;
+ }
+ else if (dy != 0)
+ {
+ blitSize.width = portBounds.width;
+ blitSize.height = portBounds.height - Math.abs(dy);
+ }
+
+ // Compute the blitPaint parameter.
+ blitPaint.setBounds(portBounds);
+ if (dy > 0)
+ {
+ blitPaint.y = portBounds.y + portBounds.height - dy;
+ blitPaint.height = dy;
+ }
+ else if (dy < 0)
+ {
+ blitPaint.height = -dy;
+ }
+ if (dx > 0)
+ {
+ blitPaint.x = portBounds.x + portBounds.width - dx;
+ blitPaint.width = dx;
+ }
+ else if (dx < 0)
+ {
+ blitPaint.width = -dx;
+ }
+
+ return true;
+ }
+
+ /**
+ * Paints the viewport in case we have a scrollmode of
+ * {@link #SIMPLE_SCROLL_MODE}.
+ *
+ * This simply paints the view directly on the surface of the viewport.
+ *
+ * @param g the graphics context to use
+ */
+ void paintSimple(Graphics g)
{
Point pos = getViewPosition();
- Rectangle viewBounds = getView().getBounds();
- Rectangle portBounds = getBounds();
-
- // FIXME: should validate the view if it is not valid, however
- // this may cause excessive validation when the containment
- // hierarchy is being created.
-
- // if contentRect is larger than the portBounds, center the view
- if (contentRect.height > portBounds.height ||
- contentRect.width > portBounds.width)
+ Component view = getView();
+ boolean translated = false;
+ try
+ {
+ g.translate(-pos.x, -pos.y);
+ translated = true;
+ view.paint(g);
+ }
+ finally
{
- setViewPosition(new Point(contentRect.x, contentRect.y));
- return;
+ if (translated)
+ g.translate (pos.x, pos.y);
}
-
- // Y-DIRECTION
- if (contentRect.y < -viewBounds.y)
- setViewPosition(new Point(pos.x, contentRect.y));
- else if (contentRect.y + contentRect.height >
- -viewBounds.y + portBounds.height)
- setViewPosition (new Point(pos.x, contentRect.y -
- (portBounds.height - contentRect.height)));
-
- // X-DIRECTION
- pos = getViewPosition();
- if (contentRect.x < -viewBounds.x)
- setViewPosition(new Point(contentRect.x, pos.y));
- else if (contentRect.x + contentRect.width >
- -viewBounds.x + portBounds.width)
- setViewPosition (new Point(contentRect.x -
- (portBounds.width - contentRect.width), pos.y));
+ }
+
+ /**
+ * Paints the viewport in case we have a scroll mode of
+ * {@link #BACKINGSTORE_SCROLL_MODE}.
+ *
+ * This method uses a backing store image to paint the view to, which is then
+ * subsequently painted on the screen. This should make scrolling more
+ * smooth.
+ *
+ * @param g the graphics context to use
+ */
+ void paintBackingStore(Graphics g)
+ {
+ // If we have no backing store image yet or the size of the component has
+ // changed, we need to rebuild the backing store.
+ if (backingStoreImage == null || sizeChanged)
+ {
+ backingStoreImage = createImage(getWidth(), getHeight());
+ sizeChanged = false;
+ Graphics g2 = backingStoreImage.getGraphics();
+ paintSimple(g2);
+ g2.dispose();
+ }
+ // Otherwise we can perform the blitting on the backing store image:
+ // First we move the part that remains visible after scrolling, then
+ // we only need to paint the bit that becomes newly visible.
+ else
+ {
+ Graphics g2 = backingStoreImage.getGraphics();
+ Point viewPosition = getViewPosition();
+ int dx = viewPosition.x - lastPaintPosition.x;
+ int dy = viewPosition.y - lastPaintPosition.y;
+ boolean canBlit = computeBlit(dx, dy, cachedBlitFrom, cachedBlitTo,
+ cachedBlitSize, cachedBlitPaint);
+ if (canBlit)
+ {
+ // Copy the part that remains visible during scrolling.
+ g2.copyArea(cachedBlitFrom.x, cachedBlitFrom.y,
+ cachedBlitSize.width, cachedBlitSize.height,
+ cachedBlitTo.x - cachedBlitFrom.x,
+ cachedBlitTo.y - cachedBlitFrom.y);
+ // Now paint the part that becomes newly visible.
+ g2.setClip(cachedBlitPaint.x, cachedBlitPaint.y,
+ cachedBlitPaint.width, cachedBlitPaint.height);
+ paintSimple(g2);
+ }
+ // If blitting is not possible for some reason, fall back to repainting
+ // everything.
+ else
+ {
+ paintSimple(g2);
+ }
+ g2.dispose();
+ }
+ // Actually draw the backingstore image to the graphics context.
+ g.drawImage(backingStoreImage, 0, 0, this);
+ // Update the lastPaintPosition so that we know what is already drawn when
+ // we paint the next time.
+ lastPaintPosition.setLocation(getViewPosition());
+ }
+
+ /**
+ * Paints the viewport in case we have a scrollmode of
+ * {@link #BLIT_SCROLL_MODE}.
+ *
+ * This paints the viewport using a backingstore and a blitting algorithm.
+ * Only the newly exposed area of the view is painted from the view painting
+ * methods, the remainder is copied from the backing store.
+ *
+ * @param g the graphics context to use
+ */
+ void paintBlit(Graphics g)
+ {
+ // We cannot perform blitted painting as it is described in Sun's API docs.
+ // There it is suggested that this painting method should blit directly
+ // on the parent window's surface. This is not possible because when using
+ // Swing's double buffering (at least our implementation), it would
+ // immediatly be painted when the buffer is painted on the screen. For this
+ // to work we would need a kind of hole in the buffer image. And honestly
+ // I find this method not very elegant.
+ // The alternative, blitting directly on the buffer image, is also not
+ // possible because the buffer image gets cleared everytime when an opaque
+ // parent component is drawn on it.
+
+ // What we do instead is falling back to the backing store approach which
+ // is in fact a mixed blitting/backing store approach where the blitting
+ // is performed on the backing store image and this is then drawn to the
+ // graphics context. This is very robust and works independent of the
+ // painting mechanism that is used by Swing. And it should have comparable
+ // performance characteristics as the blitting method.
+ paintBackingStore(g);
}
}
diff --git a/libjava/classpath/javax/swing/JWindow.java b/libjava/classpath/javax/swing/JWindow.java
index 449900370c6..cc0ac7fd95a 100644
--- a/libjava/classpath/javax/swing/JWindow.java
+++ b/libjava/classpath/javax/swing/JWindow.java
@@ -60,6 +60,21 @@ import javax.accessibility.AccessibleContext;
*/
public class JWindow extends Window implements Accessible, RootPaneContainer
{
+ /**
+ * Provides accessibility support for <code>JWindow</code>.
+ */
+ protected class AccessibleJWindow extends Window.AccessibleAWTWindow
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJWindow</code>.
+ */
+ public AccessibleJWindow()
+ {
+ super();
+ // Nothing to do here.
+ }
+ }
+
private static final long serialVersionUID = 5420698392125238833L;
protected JRootPane rootPane;
@@ -71,13 +86,6 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
protected AccessibleContext accessibleContext;
- /**
- * Tells us if we're in the initialization stage.
- * If so, adds go to top-level Container, otherwise they go
- * to the content pane for this container.
- */
- private boolean initStageDone = false;
-
public JWindow()
{
super(SwingUtilities.getOwnerFrame());
@@ -113,7 +121,7 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
super.setLayout(new BorderLayout(1, 1));
getRootPane(); // will do set/create
// Now we're done init stage, adds and layouts go to content pane.
- initStageDone = true;
+ setRootPaneCheckingEnabled(true);
}
public Dimension getPreferredSize()
@@ -125,13 +133,8 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
{
// Check if we're in initialization stage. If so, call super.setLayout
// otherwise, valid calls go to the content pane.
- if (initStageDone)
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Cannot set layout. Use getContentPane().setLayout()"
- + " instead.");
- getContentPane().setLayout(manager);
- }
+ if (isRootPaneCheckingEnabled())
+ getContentPane().setLayout(manager);
else
super.setLayout(manager);
}
@@ -192,15 +195,10 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
{
// If we're adding in the initialization stage use super.add.
// otherwise pass the add onto the content pane.
- if (!initStageDone)
- super.addImpl(comp, constraints, index);
+ if (isRootPaneCheckingEnabled())
+ getContentPane().add(comp, constraints, index);
else
- {
- if (isRootPaneCheckingEnabled())
- throw new Error("Do not use add() on JWindow directly. Use "
- + "getContentPane().add() instead");
- getContentPane().add(comp, constraints, index);
- }
+ super.addImpl(comp, constraints, index);
}
public void remove(Component comp)
@@ -235,7 +233,9 @@ public class JWindow extends Window implements Accessible, RootPaneContainer
public AccessibleContext getAccessibleContext()
{
- return null;
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJWindow();
+ return accessibleContext;
}
protected String paramString()
diff --git a/libjava/classpath/javax/swing/KeyStroke.java b/libjava/classpath/javax/swing/KeyStroke.java
index 12a280c217a..b57a7119207 100644
--- a/libjava/classpath/javax/swing/KeyStroke.java
+++ b/libjava/classpath/javax/swing/KeyStroke.java
@@ -51,6 +51,7 @@ public class KeyStroke
// Called by java.awt.AWTKeyStroke.registerSubclass via reflection.
private KeyStroke()
{
+ // Nothing to do here.
}
private KeyStroke(char keyChar, int keyCode, int modifiers,
diff --git a/libjava/classpath/javax/swing/KeyboardManager.java b/libjava/classpath/javax/swing/KeyboardManager.java
new file mode 100644
index 00000000000..aa9524cfe57
--- /dev/null
+++ b/libjava/classpath/javax/swing/KeyboardManager.java
@@ -0,0 +1,280 @@
+/* KeyboardManager.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.applet.Applet;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Window;
+import java.awt.event.KeyEvent;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This class maintains a mapping from top-level containers to a
+ * Hashtable. The Hashtable maps KeyStrokes to Components to be used when
+ * Components register keyboard actions with the condition
+ * JComponent.WHEN_IN_FOCUSED_WINDOW.
+ *
+ * @author Anthony Balkissoon abalkiss at redhat dot com
+ *
+ */
+class KeyboardManager
+{
+ /** Shared instance of KeyboardManager **/
+ static KeyboardManager manager = new KeyboardManager();
+
+ /**
+ * A mapping between top level containers and Hashtables that
+ * map KeyStrokes to Components.
+ */
+ Hashtable topLevelLookup = new Hashtable();
+
+ /**
+ * A mapping between top level containers and Vectors of JMenuBars
+ * used to allow all the JMenuBars within a top level container
+ * a chance to consume key events.
+ */
+ Hashtable menuBarLookup = new Hashtable();
+ /**
+ * Returns the shared instance of KeyboardManager.
+ * @return the shared instance of KeybaordManager.
+ */
+ public static KeyboardManager getManager()
+ {
+ return manager;
+ }
+ /**
+ * Returns the top-level ancestor for the given JComponent.
+ * @param c the JComponent whose top-level ancestor we want
+ * @return the top-level ancestor for the given JComponent.
+ */
+ static Container findTopLevel (Component c)
+ {
+ Container topLevel = (c instanceof Container) ? (Container) c
+ : c.getParent();
+ while (topLevel != null &&
+ !(topLevel instanceof Window) &&
+ !(topLevel instanceof Applet) &&
+ !(topLevel instanceof JInternalFrame))
+ topLevel = topLevel.getParent();
+ return topLevel;
+ }
+
+ /**
+ * Returns the Hashtable that maps KeyStrokes to Components, for
+ * the specified top-level container c. If no Hashtable exists
+ * we create and register it here and return the newly created
+ * Hashtable.
+ *
+ * @param c the top-level container whose Hashtable we want
+ * @return the Hashtable mapping KeyStrokes to Components for the
+ * specified top-level container
+ */
+ Hashtable getHashtableForTopLevel (Container c)
+ {
+ Hashtable keyToComponent = (Hashtable)topLevelLookup.get(c);
+ if (keyToComponent == null)
+ {
+ keyToComponent = new Hashtable();
+ topLevelLookup.put(c, keyToComponent);
+ }
+ return keyToComponent;
+ }
+
+ /**
+ * Registers a KeyStroke with a Component. This does not register
+ * the KeyStroke to a specific Action. When searching for a
+ * WHEN_IN_FOCUSED_WINDOW binding we will first go up to the focused
+ * top-level Container, then get the Hashtable that maps KeyStrokes
+ * to components for that particular top-level Container, then
+ * call processKeyBindings on that component with the condition
+ * JComponent.WHEN_IN_FOCUSED_WINDOW.
+ * @param comp the JComponent associated with the KeyStroke
+ * @param key the KeyStroke
+ */
+ public void registerBinding(JComponent comp, KeyStroke key)
+ {
+ // This method associates a KeyStroke with a particular JComponent
+ // When the KeyStroke occurs, if this component's top-level ancestor
+ // has focus (one of its children is the focused Component) then
+ // comp.processKeyBindings will be called with condition
+ // JComponent.WHEN_IN_FOCUSED_WINDOW.
+
+ // Look for the JComponent's top-level parent and return if it is null
+ Container topLevel = findTopLevel(comp);
+ if (topLevel == null)
+ return;
+
+ // Now get the Hashtable for this top-level container
+ Hashtable keyToComponent = getHashtableForTopLevel(topLevel);
+
+ // And add the new binding to this Hashtable
+ // FIXME: should allow more than one JComponent to be associated
+ // with a KeyStroke, in case one of them is disabled
+ keyToComponent.put(key, comp);
+ }
+
+ public void clearBindingsForComp(JComponent comp)
+ {
+ // This method clears all the WHEN_IN_FOCUSED_WINDOW bindings associated
+ // with <code>comp</code>. This is used for a terribly ineffcient
+ // strategy in which JComponent.updateComponentInputMap simply clears
+ // all bindings associated with its component and then reloads all the
+ // bindings from the updated ComponentInputMap. This is only a preliminary
+ // strategy and should be improved upon once the WHEN_IN_FOCUSED_WINDOW
+ // bindings work.
+
+ // Find the top-level ancestor
+
+ Container topLevel = findTopLevel(comp);
+ if (topLevel == null)
+ return;
+ // And now get its Hashtable
+ Hashtable keyToComponent = getHashtableForTopLevel(topLevel);
+
+ Enumeration keys = keyToComponent.keys();
+ Object temp;
+
+ // Iterate through the keys and remove any key whose value is comp
+ while (keys.hasMoreElements())
+ {
+ temp = keys.nextElement();
+ if (comp == (JComponent)keyToComponent.get(temp))
+ keyToComponent.remove(temp);
+ }
+ }
+
+ /**
+ * This method registers all the bindings in the given ComponentInputMap.
+ * Rather than call registerBinding on all the keys, we do the work here
+ * so that we don't duplicate finding the top-level container and
+ * getting its Hashtable.
+ *
+ * @param map the ComponentInputMap whose bindings we want to register
+ */
+ public void registerEntireMap (ComponentInputMap map)
+ {
+ if (map == null)
+ return;
+ JComponent comp = map.getComponent();
+ KeyStroke[] keys = map.keys();
+ if (keys == null)
+ return;
+ // Find the top-level container associated with this ComponentInputMap
+ Container topLevel = findTopLevel(comp);
+ if (topLevel == null)
+ return;
+
+ // Register the KeyStrokes in the top-level container's Hashtable
+ Hashtable keyToComponent = getHashtableForTopLevel(topLevel);
+ for (int i = 0; i < keys.length; i++)
+ keyToComponent.put(keys[i], comp);
+ }
+
+ public boolean processKeyStroke (Component comp, KeyStroke key, KeyEvent e)
+ {
+ boolean pressed = e.getID() == KeyEvent.KEY_PRESSED;
+
+ // Look for the top-level ancestor
+ Container topLevel = findTopLevel(comp);
+ if (topLevel == null)
+ return false;
+ // Now get the Hashtable for that top-level container
+ Hashtable keyToComponent = getHashtableForTopLevel(topLevel);
+ Enumeration keys = keyToComponent.keys();
+ JComponent target = (JComponent)keyToComponent.get(key);
+ if (target != null && target.processKeyBinding
+ (key, e, JComponent.WHEN_IN_FOCUSED_WINDOW, pressed))
+ return true;
+
+ // Have to give all the JMenuBars a chance to consume the event
+ Vector menuBars = getVectorForTopLevel(topLevel);
+ for (int i = 0; i < menuBars.size(); i++)
+ if (((JMenuBar)menuBars.elementAt(i)).processKeyBinding(key, e, JComponent.WHEN_IN_FOCUSED_WINDOW, pressed))
+ return true;
+ return false;
+ }
+
+ /**
+ * Returns the Vector of JMenuBars associated with the top-level
+ * @param c the top-level container whose JMenuBar Vector we want
+ * @return the Vector of JMenuBars for this top level container
+ */
+ Vector getVectorForTopLevel(Container c)
+ {
+ Vector result = (Vector) menuBarLookup.get(c);
+ if (result == null)
+ {
+ result = new Vector();
+ menuBarLookup.put (c, result);
+ }
+ return result;
+ }
+
+ /**
+ * In processKeyStroke, KeyManager must give all JMenuBars in the
+ * focused top-level container a chance to process the event. So,
+ * JMenuBars must be registered in KeyManager and associated with a
+ * top-level container. That's what this method is for.
+ * @param menuBar the JMenuBar to register
+ */
+ public void registerJMenuBar (JMenuBar menuBar)
+ {
+ Container topLevel = findTopLevel(menuBar);
+ Vector menuBars = getVectorForTopLevel(topLevel);
+ if (!menuBars.contains(menuBar))
+ menuBars.add(menuBar);
+ }
+
+ /**
+ * Unregisters a JMenuBar from its top-level container. This is
+ * called before the JMenuBar is actually removed from the container
+ * so findTopLevel will still find us the correct top-level container.
+ * @param menuBar the JMenuBar to unregister.
+ */
+ public void unregisterJMenuBar (JMenuBar menuBar)
+ {
+ Container topLevel = findTopLevel(menuBar);
+ Vector menuBars = getVectorForTopLevel(topLevel);
+ if (menuBars.contains(menuBar))
+ menuBars.remove(menuBar);
+ }
+}
diff --git a/libjava/classpath/javax/swing/ListCellRenderer.java b/libjava/classpath/javax/swing/ListCellRenderer.java
index 6ce115ea70c..e234d184dfd 100644
--- a/libjava/classpath/javax/swing/ListCellRenderer.java
+++ b/libjava/classpath/javax/swing/ListCellRenderer.java
@@ -44,9 +44,7 @@ import java.awt.Component;
*/
public interface ListCellRenderer
{
- Component getListCellRendererComponent(JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus);
+ Component getListCellRendererComponent(JList list, Object value, int index,
+ boolean isSelected,
+ boolean cellHasFocus);
}
diff --git a/libjava/classpath/javax/swing/ListSelectionModel.java b/libjava/classpath/javax/swing/ListSelectionModel.java
index f4680d737fb..324c056431b 100644
--- a/libjava/classpath/javax/swing/ListSelectionModel.java
+++ b/libjava/classpath/javax/swing/ListSelectionModel.java
@@ -46,41 +46,51 @@ import javax.swing.event.ListSelectionListener;
*/
public interface ListSelectionModel
{
+
int SINGLE_SELECTION = 0;
+
int SINGLE_INTERVAL_SELECTION = 1;
+
int MULTIPLE_INTERVAL_SELECTION = 2;
void setSelectionMode(int a);
+
int getSelectionMode();
-
+
void clearSelection();
-
+
int getMinSelectionIndex();
+
int getMaxSelectionIndex();
boolean isSelectedIndex(int a);
boolean isSelectionEmpty();
+
void setSelectionInterval(int index0, int index1);
- void addSelectionInterval(int index0,
- int index1);
- void removeSelectionInterval(int index0,
- int index1);
- void insertIndexInterval(int index,
- int length,
- boolean before);
- void removeIndexInterval(int index0,
- int index1);
+
+ void addSelectionInterval(int index0, int index1);
+
+ void removeSelectionInterval(int index0, int index1);
+
+ void insertIndexInterval(int index, int length, boolean before);
+
+ void removeIndexInterval(int index0, int index1);
int getAnchorSelectionIndex();
+
void setAnchorSelectionIndex(int index);
+
int getLeadSelectionIndex();
+
void setLeadSelectionIndex(int index);
void setValueIsAdjusting(boolean valueIsAdjusting);
+
boolean getValueIsAdjusting();
void addListSelectionListener(ListSelectionListener listener);
- void removeListSelectionListener(ListSelectionListener listener);
+
+ void removeListSelectionListener(ListSelectionListener listener);
}
diff --git a/libjava/classpath/javax/swing/LookAndFeel.java b/libjava/classpath/javax/swing/LookAndFeel.java
index 8858742711d..1a67e849735 100644
--- a/libjava/classpath/javax/swing/LookAndFeel.java
+++ b/libjava/classpath/javax/swing/LookAndFeel.java
@@ -38,9 +38,17 @@ exception statement from your version. */
package javax.swing;
+import java.awt.Color;
import java.awt.Component;
+import java.awt.Font;
import java.awt.Toolkit;
+import java.net.URL;
+import javax.swing.border.Border;
+import javax.swing.plaf.ComponentInputMapUIResource;
+import javax.swing.plaf.IconUIResource;
+import javax.swing.plaf.InputMapUIResource;
+import javax.swing.plaf.UIResource;
import javax.swing.text.JTextComponent;
public abstract class LookAndFeel
@@ -104,6 +112,8 @@ public abstract class LookAndFeel
*/
public void initialize()
{
+ // We do nothing here. This method is meant to be overridden by
+ // LookAndFeel implementations.
}
/**
@@ -113,14 +123,27 @@ public abstract class LookAndFeel
*/
public static void installBorder(JComponent c, String defaultBorderName)
{
+ Border b = c.getBorder();
+ if (b == null || b instanceof UIResource)
+ c.setBorder(UIManager.getBorder(defaultBorderName));
}
/**
* Convenience method for initializing a component's foreground and
* background color properties with values from the current defaults table.
*/
- public static void installColors(JComponent c, String defaultBgName, String defaultFgName)
+ public static void installColors(JComponent c, String defaultBgName,
+ String defaultFgName)
{
+ // Install background.
+ Color bg = c.getBackground();
+ if (bg == null || bg instanceof UIResource)
+ c.setBackground(UIManager.getColor(defaultBgName));
+
+ // Install foreground.
+ Color fg = c.getForeground();
+ if (fg == null || fg instanceof UIResource)
+ c.setForeground(UIManager.getColor(defaultFgName));
}
/**
@@ -128,10 +151,16 @@ public abstract class LookAndFeel
* and font properties with values from the current defaults table.
*/
public static void installColorsAndFont(JComponent component,
- String defaultBgName,
- String defaultFgName,
- String defaultFontName)
+ String defaultBgName,
+ String defaultFgName,
+ String defaultFontName)
{
+ // Install colors.
+ installColors(component, defaultBgName, defaultFgName);
+ // Install font.
+ Font f = component.getFont();
+ if (f == null || f instanceof UIResource)
+ component.setFont(UIManager.getFont(defaultFontName));
}
/**
@@ -156,19 +185,47 @@ public abstract class LookAndFeel
public abstract boolean isSupportedLookAndFeel();
/**
- * Loads the bindings in keys into retMap.
+ * Loads the bindings in keys into retMap. Does not remove existing entries
+ * from retMap. <code>keys</code> describes the InputMap, every even indexed
+ * item is either a KeyStroke or a String representing a KeyStroke and every
+ * odd indexed item is the Object associated with that KeyStroke in an
+ * ActionMap.
+ *
+ * @param retMap the InputMap into which we load bindings
+ * @param keys the Object array describing the InputMap as above
*/
public static void loadKeyBindings(InputMap retMap, Object[] keys)
{
+ if (keys == null)
+ return;
+ for (int i = 0; i < keys.length - 1; i+= 2)
+ {
+ Object key = keys[i];
+ KeyStroke keyStroke;
+ if (key instanceof KeyStroke)
+ keyStroke = (KeyStroke)key;
+ else
+ keyStroke = KeyStroke.getKeyStroke((String)key);
+ retMap.put(keyStroke, keys[i+1]);
+ }
}
/**
- * Creates a ComponentInputMap from keys.
+ * Creates a ComponentInputMap from keys.
+ * <code>keys</code> describes the InputMap, every even indexed
+ * item is either a KeyStroke or a String representing a KeyStroke and every
+ * odd indexed item is the Object associated with that KeyStroke in an
+ * ActionMap.
+ *
+ * @param c the JComponent associated with the ComponentInputMap
+ * @param keys the Object array describing the InputMap as above
*/
public static ComponentInputMap makeComponentInputMap(JComponent c,
Object[] keys)
{
- return null;
+ ComponentInputMap retMap = new ComponentInputMapUIResource(c);
+ loadKeyBindings(retMap, keys);
+ return retMap;
}
/**
@@ -177,23 +234,55 @@ public abstract class LookAndFeel
*/
public static Object makeIcon(Class baseClass, String gifFile)
{
- return null;
+ final URL file = baseClass.getResource(gifFile);
+ return new UIDefaults.LazyValue()
+ {
+ public Object createValue(UIDefaults table)
+ {
+ return new IconUIResource(new ImageIcon(file));
+ }
+ };
}
/**
* Creates a InputMap from keys.
+ * <code>keys</code> describes the InputMap, every even indexed
+ * item is either a KeyStroke or a String representing a KeyStroke and every
+ * odd indexed item is the Object associated with that KeyStroke in an
+ * ActionMap.
+ *
+ * @param keys the Object array describing the InputMap as above
*/
public static InputMap makeInputMap(Object[] keys)
{
- return null;
+ InputMap retMap = new InputMapUIResource();
+ loadKeyBindings(retMap, keys);
+ return retMap;
}
/**
- * Convenience method for building lists of KeyBindings.
+ * Convenience method for building lists of KeyBindings.
+ * <code>keyBindingList</code> is an array of KeyStroke-Action pairs where
+ * even indexed elements are KeyStrokes or Strings representing KeyStrokes
+ * and odd indexed elements are the associated Actions.
+ *
+ * @param keyBindingList the array of KeyStroke-Action pairs
+ * @return a JTextComponent.KeyBinding array
*/
public static JTextComponent.KeyBinding[] makeKeyBindings(Object[] keyBindingList)
{
- return null;
+ JTextComponent.KeyBinding[] retBindings =
+ new JTextComponent.KeyBinding[keyBindingList.length / 2];
+ for (int i = 0; i < keyBindingList.length - 1; i+= 2)
+ {
+ KeyStroke stroke;
+ if (keyBindingList[i] instanceof KeyStroke)
+ stroke = (KeyStroke)keyBindingList[i];
+ else
+ stroke = KeyStroke.getKeyStroke((String)keyBindingList[i]);
+ retBindings[i/2] = new JTextComponent.KeyBinding(stroke, (String)keyBindingList[i+1]);
+ }
+ return retBindings;
}
/**
@@ -224,6 +313,8 @@ public abstract class LookAndFeel
*/
public void uninitialize()
{
+ // We do nothing here. This method is meant to be overridden by
+ // LookAndFeel implementations.
}
/**
@@ -232,5 +323,7 @@ public abstract class LookAndFeel
*/
public static void uninstallBorder(JComponent c)
{
+ if (c.getBorder() instanceof UIResource)
+ c.setBorder(null);
}
}
diff --git a/libjava/classpath/javax/swing/MenuElement.java b/libjava/classpath/javax/swing/MenuElement.java
index 46eb8c2a5fe..dab7b9cf1ad 100644
--- a/libjava/classpath/javax/swing/MenuElement.java
+++ b/libjava/classpath/javax/swing/MenuElement.java
@@ -47,47 +47,43 @@ import java.awt.event.MouseEvent;
*
* @author Andrew Selkirk
*/
-public interface MenuElement {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * processMouseEvent
- * @param event TODO
- * @param path TODO
- * @param manager TODO
- */
- void processMouseEvent(MouseEvent event,
- MenuElement[] path, MenuSelectionManager manager);
-
- /**
- * processKeyEvent
- * @param event TODO
- * @param path TODO
- * @param manager TODO
- */
- void processKeyEvent(KeyEvent event,
- MenuElement[] path, MenuSelectionManager manager);
-
- /**
- * menuSelectionChanged
- * @param included TODO
- */
- void menuSelectionChanged(boolean included);
-
- /**
- * getSubElements
- * @returns MenuElement[]
- */
- MenuElement[] getSubElements();
-
- /**
- * getComponent
- * @returns Component
- */
- Component getComponent();
-
-
-} // MenuElement
+public interface MenuElement
+{
+
+ /**
+ * processMouseEvent
+ * @param event TODO
+ * @param path TODO
+ * @param manager TODO
+ */
+ void processMouseEvent(MouseEvent event, MenuElement[] path,
+ MenuSelectionManager manager);
+
+ /**
+ * processKeyEvent
+ * @param event TODO
+ * @param path TODO
+ * @param manager TODO
+ */
+ void processKeyEvent(KeyEvent event, MenuElement[] path,
+ MenuSelectionManager manager);
+
+ /**
+ * menuSelectionChanged
+ * @param included TODO
+ */
+ void menuSelectionChanged(boolean included);
+
+ /**
+ * getSubElements
+ * @returns MenuElement[]
+ */
+ MenuElement[] getSubElements();
+
+ /**
+ * getComponent
+ * @returns Component
+ */
+ Component getComponent();
+
+}
diff --git a/libjava/classpath/javax/swing/MenuSelectionManager.java b/libjava/classpath/javax/swing/MenuSelectionManager.java
index 32d56b958a1..4e52751065a 100644
--- a/libjava/classpath/javax/swing/MenuSelectionManager.java
+++ b/libjava/classpath/javax/swing/MenuSelectionManager.java
@@ -146,7 +146,9 @@ public class MenuSelectionManager
{
// Convert sourcePoint to screen coordinates.
Point sourcePointOnScreen = sourcePoint;
- SwingUtilities.convertPointToScreen(sourcePointOnScreen, source);
+
+ if (source.isShowing())
+ SwingUtilities.convertPointToScreen(sourcePointOnScreen, source);
Point compPointOnScreen;
Component resultComp = null;
@@ -168,7 +170,10 @@ public class MenuSelectionManager
&& sourcePointOnScreen.y < compPointOnScreen.y + size.height)
{
Point p = sourcePointOnScreen;
- SwingUtilities.convertPointFromScreen(p, comp);
+
+ if (comp.isShowing())
+ SwingUtilities.convertPointFromScreen(p, comp);
+
resultComp = SwingUtilities.getDeepestComponentAt(comp, p.x, p.y);
break;
}
diff --git a/libjava/classpath/javax/swing/MutableComboBoxModel.java b/libjava/classpath/javax/swing/MutableComboBoxModel.java
index ee79dac03a5..93091786e53 100644
--- a/libjava/classpath/javax/swing/MutableComboBoxModel.java
+++ b/libjava/classpath/javax/swing/MutableComboBoxModel.java
@@ -76,7 +76,7 @@ public interface MutableComboBoxModel extends ComboBoxModel
/**
* This method removes given element from the data model
*
- * @param element to remove.
+ * @param object element to remove.
*/
void removeElement(Object object);
-} // MutableComboBoxModel
+}
diff --git a/libjava/classpath/javax/swing/OverlayLayout.java b/libjava/classpath/javax/swing/OverlayLayout.java
index e8aef98a521..56b8c8bb67a 100644
--- a/libjava/classpath/javax/swing/OverlayLayout.java
+++ b/libjava/classpath/javax/swing/OverlayLayout.java
@@ -1,5 +1,5 @@
-/* OverlayLayout.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* OverlayLayout.java -- A layout manager
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,155 +37,376 @@ exception statement from your version. */
package javax.swing;
+import java.awt.AWTError;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.Insets;
import java.awt.LayoutManager2;
import java.io.Serializable;
/**
- * OverlayLayout
- * @author Andrew Selkirk
- * @version 1.0
+ * A layout manager that lays out the components of a container one over
+ * another.
+ *
+ * The components take as much space as is available in the container, but not
+ * more than specified by their maximum size.
+ *
+ * The overall layout is mainly affected by the components
+ * <code>alignmentX</code> and <code>alignmentY</code> properties. All
+ * components are aligned, so that their alignment points (for either
+ * direction) are placed in one line (the baseline for this direction).
+ *
+ * For example: An X alignment of 0.0 means that the component's alignment
+ * point is at it's left edge, an X alignment of 0.5 means that the alignment
+ * point is in the middle, an X alignment of 1.0 means, the aligment point is
+ * at the right edge. So if you have three components, the first with 0.0, the
+ * second with 0.5 and the third with 1.0, then they are laid out like this:
+ *
+ * <pre>
+ * +-------+
+ * | 1 |
+ * +-------+
+ * +-------+
+ * | 2 |
+ * +-------+
+ * +---------+
+ * | 3 +
+ * +---------+
+ * </pre>
+ * The above picture shows the X alignment between the components. An Y
+ * alignment like shown above cannot be achieved with this layout manager. The
+ * components are place on top of each other, with the X alignment shown above.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ * @author Andrew Selkirk
*/
-public class OverlayLayout
- implements LayoutManager2, Serializable
+public class OverlayLayout implements LayoutManager2, Serializable
{
private static final long serialVersionUID = 18082829169631543L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * target
- */
- private Container target;
-
- /**
- * xChildren
- */
- private SizeRequirements[] xChildren;
-
- /**
- * yChildren
- */
- private SizeRequirements[] yChildren;
-
- /**
- * xTotal
- */
- private SizeRequirements xTotal;
-
- /**
- * yTotal
- */
- private SizeRequirements yTotal;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor OverlayLayout
- * @param target TODO
- */
- public OverlayLayout(Container target) {
- // TODO
- } // OverlayLayout()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * invalidateLayout
- * @param target TODO
- */
- public void invalidateLayout(Container target) {
- // TODO
- } // invalidateLayout()
-
- /**
- * addLayoutComponent
- * @param string TODO
- * @param component TODO
- */
- public void addLayoutComponent(String string, Component component) {
- // TODO
- } // addLayoutComponent()
-
- /**
- * addLayoutComponent
- * @param component TODO
- * @param constraints TODO
- */
- public void addLayoutComponent(Component component, Object constraints) {
- // TODO
- } // addLayoutComponent()
-
- /**
- * removeLayoutComponent
- * @param component TODO
- */
- public void removeLayoutComponent(Component component) {
- // TODO
- } // removeLayoutComponent()
-
- /**
- * preferredLayoutSize
- * @param target TODO
- * @returns Dimension
- */
- public Dimension preferredLayoutSize(Container target) {
- return null; // TODO
- } // preferredLayoutSize()
-
- /**
- * minimumLayoutSize
- * @param target TODO
- * @returns Dimension
- */
- public Dimension minimumLayoutSize(Container target) {
- return null; // TODO
- } // minimumLayoutSize()
-
- /**
- * maximumLayoutSize
- * @param target TODO
- * @returns Dimension
- */
- public Dimension maximumLayoutSize(Container target) {
- return null; // TODO
- } // maximumLayoutSize()
-
- /**
- * getLayoutAlignmentX
- * @param target TODO
- * @returns float
- */
- public float getLayoutAlignmentX(Container target) {
- return (float) 0.0; // TODO
- } // getLayoutAlignmentX()
-
- /**
- * getLayoutAlignmentY
- * @param target TODO
- * @returns float
- */
- public float getLayoutAlignmentY(Container target) {
- return (float) 0.0; // TODO
- } // getLayoutAlignmentY()
-
- /**
- * layoutContainer
- * @param target TODO
- */
- public void layoutContainer(Container target) {
- // TODO
- } // layoutContainer()
-
-
-} // OverlayLayout
+ /**
+ * The container to be laid out.
+ */
+ private Container target;
+
+ /**
+ * The size requirements of the containers children for the X direction.
+ */
+ private SizeRequirements[] xChildren;
+
+ /**
+ * The size requirements of the containers children for the Y direction.
+ */
+ private SizeRequirements[] yChildren;
+
+ /**
+ * The size requirements of the container to be laid out for the X direction.
+ */
+ private SizeRequirements xTotal;
+
+ /**
+ * The size requirements of the container to be laid out for the Y direction.
+ */
+ private SizeRequirements yTotal;
+
+ /**
+ * The offsets of the child components in the X direction.
+ */
+ private int[] offsetsX;
+
+ /**
+ * The offsets of the child components in the Y direction.
+ */
+ private int[] offsetsY;
+
+ /**
+ * The spans of the child components in the X direction.
+ */
+ private int[] spansX;
+
+ /**
+ * The spans of the child components in the Y direction.
+ */
+ private int[] spansY;
+
+ /**
+ * Creates a new OverlayLayout for the specified container.
+ *
+ * @param target the container to be laid out
+ */
+ public OverlayLayout(Container target)
+ {
+ this.target = target;
+ }
+
+ /**
+ * Notifies the layout manager that the layout has become invalid. It throws
+ * away cached layout information and recomputes it the next time it is
+ * requested.
+ *
+ * @param target not used here
+ */
+ public void invalidateLayout(Container target)
+ {
+ xChildren = null;
+ yChildren = null;
+ xTotal = null;
+ yTotal = null;
+ offsetsX = null;
+ offsetsY = null;
+ spansX = null;
+ spansY = null;
+ }
+
+ /**
+ * This method is not used in this layout manager.
+ *
+ * @param string not used here
+ * @param component not used here
+ */
+ public void addLayoutComponent(String string, Component component)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * This method is not used in this layout manager.
+ *
+ * @param component not used here
+ * @param constraints not used here
+ */
+ public void addLayoutComponent(Component component, Object constraints)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * This method is not used in this layout manager.
+ *
+ * @param component not used here
+ */
+ public void removeLayoutComponent(Component component)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the preferred size of the container that is laid out. This is
+ * computed by the children's preferred sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the preferred size of the container that is laid out
+ */
+ public Dimension preferredLayoutSize(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return new Dimension(xTotal.preferred, yTotal.preferred);
+ }
+
+ /**
+ * Returns the minimum size of the container that is laid out. This is
+ * computed by the children's minimum sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the minimum size of the container that is laid out
+ */
+ public Dimension minimumLayoutSize(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return new Dimension(xTotal.minimum, yTotal.minimum);
+ }
+
+ /**
+ * Returns the maximum size of the container that is laid out. This is
+ * computed by the children's maximum sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the maximum size of the container that is laid out
+ */
+ public Dimension maximumLayoutSize(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return new Dimension(xTotal.maximum, yTotal.maximum);
+ }
+
+ /**
+ * Returns the X alignment of the container that is laid out. This is
+ * computed by the children's preferred sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the X alignment of the container that is laid out
+ */
+ public float getLayoutAlignmentX(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return xTotal.alignment;
+ }
+
+ /**
+ * Returns the Y alignment of the container that is laid out. This is
+ * computed by the children's preferred sizes, taking their alignments into
+ * account.
+ *
+ * @param target not used here
+ *
+ * @returns the X alignment of the container that is laid out
+ */
+ public float getLayoutAlignmentY(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkTotalRequirements();
+ return yTotal.alignment;
+ }
+
+ /**
+ * Lays out the container and it's children.
+ *
+ * The children are laid out one over another.
+ *
+ * The components take as much space as is available in the container, but
+ * not more than specified by their maximum size.
+ *
+ * The overall layout is mainly affected by the components
+ * <code>alignmentX</code> and <code>alignmentY</code> properties. All
+ * components are aligned, so that their alignment points (for either
+ * direction) are placed in one line (the baseline for this direction).
+ *
+ * For example: An X alignment of 0.0 means that the component's alignment
+ * point is at it's left edge, an X alignment of 0.5 means that the alignment
+ * point is in the middle, an X alignment of 1.0 means, the aligment point is
+ * at the right edge. So if you have three components, the first with 0.0,
+ * the second with 0.5 and the third with 1.0, then they are laid out like
+ * this:
+ *
+ * <pre>
+ * +-------+
+ * | 1 |
+ * +-------+
+ * +-------+
+ * | 2 |
+ * +-------+
+ * +---------+
+ * | 3 +
+ * +---------+
+ * </pre>
+ * The above picture shows the X alignment between the components. An Y
+ * alignment like shown above cannot be achieved with this layout manager.
+ * The components are place on top of each other, with the X alignment shown
+ * above.
+ *
+ * @param target not used here
+ */
+ public void layoutContainer(Container target)
+ {
+ if (target != this.target)
+ throw new AWTError("OverlayLayout can't be shared");
+
+ checkLayout();
+ Component[] children = target.getComponents();
+ for (int i = 0; i < children.length; i++)
+ children[i].setBounds(offsetsX[i], offsetsY[i], spansX[i], spansY[i]);
+ }
+
+ /**
+ * Makes sure that the xChildren and yChildren fields are correctly set up.
+ * A call to {@link #invalidateLayout(Container)} sets these fields to null,
+ * so they have to be set up again.
+ */
+ private void checkRequirements()
+ {
+ if (xChildren == null || yChildren == null)
+ {
+ Component[] children = target.getComponents();
+ xChildren = new SizeRequirements[children.length];
+ yChildren = new SizeRequirements[children.length];
+ for (int i = 0; i < children.length; i++)
+ {
+ if (! children[i].isVisible())
+ {
+ xChildren[i] = new SizeRequirements();
+ yChildren[i] = new SizeRequirements();
+ }
+ else
+ {
+ xChildren[i] =
+ new SizeRequirements(children[i].getMinimumSize().width,
+ children[i].getPreferredSize().width,
+ children[i].getMaximumSize().width,
+ children[i].getAlignmentX());
+ yChildren[i] =
+ new SizeRequirements(children[i].getMinimumSize().height,
+ children[i].getPreferredSize().height,
+ children[i].getMaximumSize().height,
+ children[i].getAlignmentY());
+ }
+ }
+ }
+ }
+
+ /**
+ * Makes sure that the xTotal and yTotal fields are set up correctly. A call
+ * to {@link #invalidateLayout} sets these fields to null and they have to be
+ * recomputed.
+ */
+ private void checkTotalRequirements()
+ {
+ if (xTotal == null || yTotal == null)
+ {
+ checkRequirements();
+ xTotal = SizeRequirements.getAlignedSizeRequirements(xChildren);
+ yTotal = SizeRequirements.getAlignedSizeRequirements(yChildren);
+ }
+ }
+
+ /**
+ * Makes sure that the offsetsX, offsetsY, spansX and spansY fields are set
+ * up correctly. A call to {@link #invalidateLayout} sets these fields
+ * to null and they have to be recomputed.
+ */
+ private void checkLayout()
+ {
+ if (offsetsX == null || offsetsY == null || spansX == null
+ || spansY == null)
+ {
+ checkRequirements();
+ checkTotalRequirements();
+ int len = target.getComponents().length;
+ offsetsX = new int[len];
+ offsetsY = new int[len];
+ spansX = new int[len];
+ spansY = new int[len];
+
+ Insets in = target.getInsets();
+ int width = target.getWidth() - in.left - in.right;
+ int height = target.getHeight() - in.top - in.bottom;
+
+ SizeRequirements.calculateAlignedPositions(width, xTotal,
+ xChildren, offsetsX, spansX);
+ SizeRequirements.calculateAlignedPositions(height, yTotal,
+ yChildren, offsetsY, spansY);
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/Popup.java b/libjava/classpath/javax/swing/Popup.java
index 69e1f516802..cbb243e285a 100644
--- a/libjava/classpath/javax/swing/Popup.java
+++ b/libjava/classpath/javax/swing/Popup.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.Point;
/**
@@ -89,6 +91,7 @@ public class Popup
*/
protected Popup()
{
+ // Nothing to do here.
}
@@ -129,6 +132,7 @@ public class Popup
*/
JWindow window;
+ private Component contents;
/**
* Constructs a new <code>JWindowPopup</code> given its owner,
@@ -155,10 +159,11 @@ public class Popup
/* Checks whether contents is null. */
super(owner, contents, x, y);
+ this.contents = contents;
window = new JWindow();
- window.getRootPane().add(contents);
+ window.getContentPane().add(contents);
window.setLocation(x, y);
- window.pack();
+ window.setFocusableWindowState(false);
}
@@ -168,6 +173,7 @@ public class Popup
*/
public void show()
{
+ window.setSize(contents.getSize());
window.show();
}
@@ -186,4 +192,106 @@ public class Popup
window.dispose();
}
}
+
+ /**
+ * A popup that displays itself within the JLayeredPane of a JRootPane of
+ * the containment hierarchy of the owner component.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ static class LightweightPopup extends Popup
+ {
+ /**
+ * The owner component for this popup.
+ */
+ Component owner;
+
+ /**
+ * The contents that should be shown.
+ */
+ Component contents;
+
+ /**
+ * The X location in screen coordinates.
+ */
+ int x;
+
+ /**
+ * The Y location in screen coordinates.
+ */
+ int y;
+
+ /**
+ * The panel that holds the content.
+ */
+ private JPanel panel;
+
+ /**
+ * The layered pane of the owner.
+ */
+ private JLayeredPane layeredPane;
+
+ /**
+ * Constructs a new <code>LightweightPopup</code> given its owner,
+ * contents and the screen position where the popup
+ * will appear.
+ *
+ * @param owner the component that should own the popup window; this
+ * provides the JRootPane in which we place the popup window
+ *
+ * @param contents the contents that will be displayed inside
+ * the <code>Popup</code>.
+ *
+ * @param x the horizontal position where the Popup will appear in screen
+ * coordinates
+ *
+ * @param y the vertical position where the Popup will appear in screen
+ * coordinates
+ *
+ * @throws IllegalArgumentException if <code>contents</code>
+ * is <code>null</code>.
+ */
+ public LightweightPopup(Component owner, Component contents, int x, int y)
+ {
+ super(owner, contents, x, y);
+ this.owner = owner;
+ this.contents = contents;
+ this.x = x;
+ this.y = y;
+
+ JRootPane rootPane = SwingUtilities.getRootPane(owner);
+ JLayeredPane layeredPane = rootPane.getLayeredPane();
+ this.layeredPane = layeredPane;
+ }
+
+ /**
+ * Places the popup within the JLayeredPane of the owner component and
+ * makes it visible.
+ */
+ public void show()
+ {
+ // We insert a JPanel between the layered pane and the contents so we
+ // can fiddle with the setLocation() method without disturbing a
+ // JPopupMenu (which overrides setLocation in an unusual manner).
+ if (panel == null)
+ {
+ panel = new JPanel();
+ panel.setLayout(new FlowLayout(0, 0, 0));
+ }
+
+ panel.add(contents);
+ panel.setSize(contents.getSize());
+ Point layeredPaneLoc = layeredPane.getLocationOnScreen();
+ panel.setLocation(x - layeredPaneLoc.x, y - layeredPaneLoc.y);
+ layeredPane.add(panel, JLayeredPane.POPUP_LAYER);
+ }
+
+ /**
+ * Removes the popup from the JLayeredPane thus making it invisible.
+ */
+ public void hide()
+ {
+ layeredPane.remove(panel);
+ }
+ }
}
diff --git a/libjava/classpath/javax/swing/PopupFactory.java b/libjava/classpath/javax/swing/PopupFactory.java
index 29cf86d5530..7bb2529cd54 100644
--- a/libjava/classpath/javax/swing/PopupFactory.java
+++ b/libjava/classpath/javax/swing/PopupFactory.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Point;
/**
@@ -55,8 +57,8 @@ public class PopupFactory
/**
* The shared factory object.
*
- * @see #getSharedFactory
- * @see #setSharedFactory
+ * @see #getSharedInstance
+ * @see #setSharedInstance
*/
private static PopupFactory sharedFactory;
@@ -69,6 +71,7 @@ public class PopupFactory
*/
public PopupFactory()
{
+ // Nothing to do here.
}
@@ -134,6 +137,30 @@ public class PopupFactory
public Popup getPopup(Component owner, Component contents,
int x, int y)
{
- return new Popup.JWindowPopup(owner, contents, x, y);
+ Popup popup = null;
+ // By default we enable lightweight popups since they are more efficient
+ // than heavyweight popups.
+ boolean lightweightEnabled = true;
+ // Special case JPopupMenu here, since it supports a lightweightEnabled
+ // flag that we must respect.
+ if (contents instanceof JPopupMenu)
+ {
+ JPopupMenu menu = (JPopupMenu) contents;
+ lightweightEnabled = menu.isLightWeightPopupEnabled();
+ }
+
+ // If we have a root pane and the contents fits within the root pane and
+ // lightweight popups are enabled, than we can use a lightweight popup.
+ JRootPane root = SwingUtilities.getRootPane(owner);
+ Point rootLoc = root.getLocationOnScreen();
+ Dimension contentsSize = contents.getSize();
+ Dimension rootSize = root.getSize();
+ if (x >= rootLoc.x && y > rootLoc.y
+ && (x - rootLoc.x) + contentsSize.width < rootSize.width
+ && (y - rootLoc.y) + contentsSize.height < rootSize.height)
+ popup = new Popup.LightweightPopup(owner, contents, x, y);
+ else
+ popup = new Popup.JWindowPopup(owner, contents, x, y);
+ return popup;
}
}
diff --git a/libjava/classpath/javax/swing/ProgressMonitor.java b/libjava/classpath/javax/swing/ProgressMonitor.java
index 844258f1b90..60f1c7145c0 100644
--- a/libjava/classpath/javax/swing/ProgressMonitor.java
+++ b/libjava/classpath/javax/swing/ProgressMonitor.java
@@ -1,5 +1,5 @@
/* ProgressMonitor.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,191 +38,386 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
/**
- * ProgressMonitor
- * @author Andrew Selkirk
- * @version 1.0
+ * <p>Using this class you can easily monitor tasks where you cannot
+ * estimate the duration exactly.</p>
+ *
+ * <p>A ProgressMonitor instance waits until the first time setProgress
+ * is called. When <code>millisToDecideToPopup</code> time elapsed the
+ * instance estimates the duration until the whole operation is completed.
+ * If this duration exceeds <code>millisToPopup</code> a non-modal dialog
+ * with a message and a progress bar is shown.</p>
+ *
+ * <p>The value of <code>millisToDecideToPopup</code> defaults to
+ * <code>500</code> and <code>millisToPopup</code> to
+ * <code>2000</code>.</p>
+ *
+ * @author Andrew Selkirk
+ * @author Robert Schuster (robertschuster@fsfe.org)
+ * @since 1.2
+ * @status updated to 1.2
*/
-public class ProgressMonitor {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * parentComponent
- */
- private Component component;
-
- /**
- * note
- */
- private String note;
-
- /**
- * message
- */
- private Object message;
-
- /**
- * millisToDecideToPopup
- */
- private int millisToDecideToPopup;
-
- /**
- * millisToPopup
- */
- private int millisToPopup;
-
- /**
- * min
- */
- private int minimum;
-
- /**
- * max
- */
- private int maximum;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ProgressMonitor
- * @param component TODO
- * @param message TODO
- * @param note TODO
- * @param minimum TODO
- * @param maximum TODO
- */
- public ProgressMonitor(Component component, Object message,
- String note, int minimum, int maximum) {
-
- // Set Data
- this.component = component;
- this.message = message;
- this.note = note;
- this.minimum = minimum;
- this.maximum = maximum;
-
- // TODO
- } // ProgressMonitor()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * close
- */
- public void close() {
- // TODO
- } // close()
-
- /**
- * setProgress
- * @param progress TODO
- */
- public void setProgress(int progress) {
- // TODO
- } // setProgress()
-
- /**
- * getMinimum
- * @returns int
- */
- public int getMinimum() {
- return minimum; // TODO
- } // getMinimum()
-
- /**
- * setMinimum
- * @param minimum TODO
- */
- public void setMinimum(int minimum) {
- this.minimum = minimum;
- // TODO
- } // setMinimum()
-
- /**
- * getMaximum
- * @returns int
- */
- public int getMaximum() {
- return maximum; // TODO
- } // getMaximum()
-
- /**
- * setMaximum
- * @param maximum TODO
- */
- public void setMaximum(int maximum) {
- this.maximum = maximum;
- // TODO
- } // setMaximum()
-
- /**
- * isCanceled
- * @returns boolean
- */
- public boolean isCanceled() {
- return false; // TODO
- } // isCanceled()
-
- /**
- * getMillisToDecideToPopup
- * @returns int
- */
- public int getMillisToDecideToPopup() {
- return millisToDecideToPopup; // TODO
- } // getMillisToDecideToPopup()
-
- /**
- * setMillisToDecideToPopup
- * @param time TODO
- */
- public void setMillisToDecideToPopup(int time) {
- millisToDecideToPopup = time;
- // TODO
- } // setMillisToDecideToPopup()
-
- /**
- * getMillisToPopup
- * @returns int
- */
- public int getMillisToPopup() {
- return millisToPopup; // TODO
- } // getMillisToPopup()
-
- /**
- * setMillisToPopup
- * @param time TODO
- */
- public void setMillisToPopup(int time) {
- millisToPopup = time;
- // TODO
- } // setMillisToPopup()
-
- /**
- * getNote
- * @returns String
- */
- public String getNote() {
- return note; // TODO
- } // getNote()
-
- /**
- * setNote
- * @param note TODO
- */
- public void setNote(String note) {
- this.note = note;
- // TODO
- } // setNote()
-
-
-} // ProgressMonitor
+public class ProgressMonitor
+{
+ /**
+ * parentComponent
+ */
+ Component component;
+
+ /**
+ * note
+ */
+ String note;
+
+ /**
+ * message
+ */
+ Object message;
+
+ /**
+ * millisToDecideToPopup
+ */
+ int millisToDecideToPopup = 500;
+
+ /**
+ * millisToPopup
+ */
+ int millisToPopup = 2000;
+
+ int min, max, progress;
+
+ JProgressBar progressBar;
+
+ JLabel noteLabel;
+
+ JDialog progressDialog;
+
+ Timer timer;
+
+ boolean canceled;
+
+ /**
+ * Constructor ProgressMonitor
+ * @param component The parent component of the progress dialog or <code>null</code>.
+ * @param message A constant message object which works in the way it does in <code>JOptionPane</code>.
+ * @param note A string message which can be changed while the operation goes on.
+ * @param minimum The minimum value for the operation (start value).
+ * @param maximum The maximum value for the operation (end value).
+ */
+ public ProgressMonitor(Component component, Object message,
+ String note, int minimum, int maximum)
+ {
+
+ // Set data.
+ this.component = component;
+ this.message = message;
+ this.note = note;
+
+ min = minimum;
+ max = maximum;
+ }
+
+ /**
+ * <p>Hides the dialog and stops any measurements.</p>
+ *
+ * <p>Has no effect when <code>setProgress</code> is not at least
+ * called once.</p>
+ */
+ public void close()
+ {
+ if ( progressDialog != null )
+ {
+ progressDialog.setVisible(false);
+ }
+
+ if ( timer != null )
+ {
+ timer.stop();
+ timer = null;
+ }
+ }
+
+ /**
+ * <p>Updates the progress value.</p>
+ *
+ * <p>When called for the first time this initializes a timer
+ * which decides after <code>millisToDecideToPopup</code> time
+ * whether to show a progress dialog or not.</p>
+ *
+ * <p>If the progress value equals or exceeds the maximum
+ * value the progress dialog is closed automatically.</p>
+ *
+ * @param progress New progress value.
+ */
+ public void setProgress(int progress)
+ {
+ this.progress = progress;
+
+ // Initializes and starts a timer with a task
+ // which measures the duration and displays
+ // a progress dialog if neccessary.
+ if ( timer == null && progressDialog == null )
+ {
+ timer = new Timer(25, null);
+ timer.addActionListener(new TimerListener());
+ timer.start();
+ }
+
+ // Cancels timer and hides progress dialog if the
+ // maximum value is reached.
+ if ( progressBar != null && this.progress >= progressBar.getMaximum() )
+ {
+ // The reason for using progressBar.getMaximum() instead of max is that
+ // we want to prevent that changes to the value have any effect after the
+ // progress dialog is visible (This is how the JDK behaves.).
+ close();
+ }
+
+ }
+
+ /** Returns the minimum or start value of the operation.
+ *
+ * @returns Minimum or start value of the operation.
+ */
+ public int getMinimum()
+ {
+ return min;
+ }
+
+ /**
+ * <p>Use this method to set the minimum or start value of
+ * your operation.</p>
+ *
+ * <p>For typical application like copy operation this will be
+ * zero.</p>
+ *
+ * <p>Keep in mind that changing this value after the progress
+ * dialog is made visible has no effect upon the progress bar.</p>
+ *
+ * @param minimum The new minimum value.
+ */
+ public void setMinimum(int minimum)
+ {
+ min = minimum;
+ }
+
+ /**
+ * Return the maximum or end value of your operation.
+ *
+ * @returns Maximum or end value.
+ */
+ public int getMaximum()
+ {
+ return max;
+ }
+
+ /**
+ * <p>Sets the maximum or end value of the operation to the
+ * given integer.</p>
+ *
+ * @param maximum
+ */
+ public void setMaximum(int maximum)
+ {
+ max = maximum;
+ }
+
+ /**
+ * Returns whether the user canceled the operation.
+ *
+ * @returns Whether the operation was canceled.
+ */
+ public boolean isCanceled()
+ {
+ // The value is predefined to false
+ // and changes only when the user clicks
+ // the cancel button in the progress dialog.
+ return canceled;
+ }
+
+ /**
+ * Returns the amount of milliseconds to wait
+ * until the ProgressMonitor should decide whether
+ * a progress dialog is to be shown or not.
+ *
+ * @returns The duration in milliseconds.
+ */
+ public int getMillisToDecideToPopup()
+ {
+ return millisToDecideToPopup;
+ }
+
+ /**
+ * Sets the amount of milliseconds to wait until the
+ * ProgressMonitor should decide whether a progress dialog
+ * is to be shown or not.
+ *
+ * <p>This method has no effect when the progress dialog
+ * is already visible.</p>
+ *
+ * @param time The duration in milliseconds.
+ */
+ public void setMillisToDecideToPopup(int time)
+ {
+ millisToDecideToPopup = time;
+ }
+
+ /**
+ * getMillisToPopup
+ * @returns int
+ */
+ public int getMillisToPopup()
+ {
+ return millisToPopup;
+ }
+
+ /**
+ * setMillisToPopup
+ * @param time TODO
+ */
+ public void setMillisToPopup(int time)
+ {
+ millisToPopup = time;
+ }
+
+ /**
+ * Returns a message which is shown in the progress dialog.
+ *
+ * @returns The changeable message visible in the progress dialog.
+ */
+ public String getNote()
+ {
+ return note;
+ }
+
+ /**
+ * <p>Set the message shown in the progess dialog.</p>
+ *
+ * <p>Changing the note while the progress dialog is visible
+ * is possible.</p>
+ *
+ * @param note A message shown in the progress dialog.
+ */
+ public void setNote(String note)
+ {
+ if ( noteLabel != null )
+ {
+ noteLabel.setText(note);
+ }
+ else
+ {
+ this.note = note;
+ }
+ }
+
+ /** Internal method that creates the progress dialog.
+ */
+ void createDialog()
+ {
+ // If there is no note we suppress the generation of the
+ // label.
+ Object[] tmp = (note == null) ?
+ new Object[]
+ {
+ message,
+ progressBar = new JProgressBar(min, max)
+ }
+ :
+ new Object[]
+ {
+ message,
+ noteLabel = new JLabel(note),
+ progressBar = new JProgressBar(min, max)
+ };
+
+ JOptionPane pane = new JOptionPane(tmp, JOptionPane.INFORMATION_MESSAGE);
+
+ // FIXME: Internationalize the button
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ae)
+ {
+ canceled = true;
+ }
+ });
+
+ pane.setOptions(new Object[] { cancelButton });
+
+ // FIXME: Internationalize the title
+ progressDialog = pane.createDialog(component, "Progress ...");
+ progressDialog.setModal(false);
+ progressDialog.setResizable(true);
+
+ progressDialog.pack();
+ progressDialog.setVisible(true);
+
+ }
+
+ /** An ActionListener implementation which does the measurements
+ * and estimations of the ProgressMonitor.
+ */
+ class TimerListener implements ActionListener
+ {
+ long timestamp;
+
+ int lastProgress;
+
+ boolean first = true;
+
+ TimerListener()
+ {
+ timestamp = System.currentTimeMillis();
+ }
+
+ public void actionPerformed(ActionEvent ae)
+ {
+ long now = System.currentTimeMillis();
+
+ if ( first )
+ {
+ if (( now - timestamp ) > millisToDecideToPopup )
+ {
+ first = false;
+ long expected = ( now - timestamp ) * ( max - min ) / ( progress - min );
+
+ if ( expected > millisToPopup )
+ {
+ createDialog();
+ }
+ }
+ else
+ {
+ // We have not waited long enough to make a decision,
+ // so return and try again when the timer is invoked.
+ return;
+ }
+ }
+ else if ( progressDialog != null )
+ {
+ // The progress dialog is being displayed. We now calculate
+ // whether setting the progress bar to the current progress
+ // value would result in a visual difference.
+ int delta = progress - progressBar.getValue();
+
+ if ( ( delta * progressBar.getWidth() / (max - min) ) > 0 )
+ {
+ // At least one pixel would change.
+ progressBar.setValue(progress);
+ }
+ }
+ else
+ {
+ // No dialog necessary
+ timer.stop();
+ timer = null;
+ }
+
+ timestamp = now;
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/ProgressMonitorInputStream.java b/libjava/classpath/javax/swing/ProgressMonitorInputStream.java
index 2022a1c24a3..02ac597b3a4 100644
--- a/libjava/classpath/javax/swing/ProgressMonitorInputStream.java
+++ b/libjava/classpath/javax/swing/ProgressMonitorInputStream.java
@@ -1,5 +1,5 @@
/* ProgressMonitorInputStream.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,122 +39,187 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
+
import java.io.FilterInputStream;
-import java.io.IOException;
import java.io.InputStream;
+import java.io.InterruptedIOException;
+import java.io.IOException;
/**
* ProgressMonitorInputStream
* @author Andrew Selkirk
- * @version 1.0
+ * @author Robert Schuster (robertschuster@fsfe.org)
+ * @status updated to 1.2
+ * @since 1.2
*/
-public class ProgressMonitorInputStream extends FilterInputStream {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * monitor
- */
- private ProgressMonitor monitor;
-
- /**
- * nread
- */
- private int nread;
-
- /**
- * size
- */
- private int size;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ProgressMonitorInputStream
- * @param component TODO
- * @param message TODO
- * @param stream TODO
- */
- public ProgressMonitorInputStream(Component component, Object message,
- InputStream stream) {
- super(stream);
- // TODO
- } // ProgressMonitorInputStream()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * reset
- * @exception IOException TODO
- */
- public synchronized void reset() throws IOException {
- // TODO
- } // reset()
-
- /**
- * read
- * @exception IOException TODO
- * @returns int
- */
- public int read() throws IOException {
- return 0; // TODO
- } // read()
-
- /**
- * read
- * @param data TODO
- * @exception IOException TODO
- * @returns int
- */
- public int read(byte[] data) throws IOException {
- return 0; // TODO
- } // read()
-
- /**
- * read
- * @param data TODO
- * @param offset TODO
- * @param length TODO
- * @exception IOException TODO
- * @returns int
- */
- public int read(byte[] data, int offset, int length) throws IOException {
- return 0; // TODO
- } // read()
-
- /**
- * skip
- * @param length TODO
- * @exception IOException TODO
- * @returns long
- */
- public long skip(long length) throws IOException {
- return 0; // TODO
- } // skip()
-
- /**
- * close
- * @exception IOException TODO
- */
- public void close() throws IOException {
- // TODO
- } // close()
-
- /**
- * getProgressMonitor
- * @returns ProgressMonitor
- */
- public ProgressMonitor getProgressMonitor() {
- return null; // TODO
- } // getProgressMonitor()
-
-
-} // ProgressMonitorInputStream
+public class ProgressMonitorInputStream extends FilterInputStream
+{
+
+ /**
+ * monitor
+ */
+ private ProgressMonitor monitor;
+
+ /**
+ * read
+ */
+ private int read;
+
+ /**
+ * Constructor ProgressMonitorInputStream
+ * @param component TODO
+ * @param message TODO
+ * @param stream TODO
+ */
+ public ProgressMonitorInputStream(Component component, Object message,
+ InputStream stream)
+ {
+ super(stream);
+
+ int max = 0;
+
+ try
+ {
+ max = stream.available();
+ }
+ catch ( IOException ioe )
+ {
+ // Behave like the JDK here.
+ }
+
+ monitor = new ProgressMonitor(
+ component, message, null, 0, max );
+ }
+
+ /**
+ * reset
+ * @exception IOException TODO
+ */
+ public void reset() throws IOException
+ {
+ super.reset();
+
+ checkMonitorCanceled();
+
+ // TODO: The docs says the monitor should be resetted. But to which
+ // value? (mark is not overridden)
+ }
+
+ /**
+ * read
+ * @exception IOException TODO
+ * @returns int
+ */
+ public int read() throws IOException
+ {
+ int t = super.read();
+
+ monitor.setProgress(++read);
+
+ checkMonitorCanceled();
+
+ return t;
+ }
+
+ /**
+ * read
+ * @param data TODO
+ * @exception IOException TODO
+ * @returns int
+ */
+ public int read(byte[] data) throws IOException
+ {
+ int t = super.read(data);
+
+ if ( t > 0 )
+ {
+ read += t;
+ monitor.setProgress(read);
+
+ checkMonitorCanceled();
+ }
+ else
+ {
+ monitor.close();
+ }
+
+ return t;
+ }
+
+ /**
+ * read
+ * @param data TODO
+ * @param offset TODO
+ * @param length TODO
+ * @exception IOException TODO
+ * @returns int
+ */
+ public int read(byte[] data, int offset, int length) throws IOException
+ {
+ int t = super.read(data, offset, length);
+
+ if ( t > 0 )
+ {
+ read += t;
+ monitor.setProgress(read);
+
+ checkMonitorCanceled();
+ }
+ else
+ {
+ monitor.close();
+ }
+
+ return t;
+ }
+
+ /**
+ * skip
+ * @param length TODO
+ * @exception IOException TODO
+ * @returns long
+ */
+ public long skip(long length) throws IOException
+ {
+ long t = super.skip(length);
+
+ // 'read' may overflow here in rare situations.
+ assert ( (long) read + t <= (long) Integer.MAX_VALUE );
+
+ read += (int) t;
+
+ monitor.setProgress(read);
+
+ checkMonitorCanceled();
+
+ return t;
+ }
+
+ /**
+ * close
+ * @exception IOException TODO
+ */
+ public void close() throws IOException
+ {
+ super.close();
+ monitor.close();
+ }
+
+ /**
+ * getProgressMonitor
+ * @returns ProgressMonitor
+ */
+ public ProgressMonitor getProgressMonitor()
+ {
+ return monitor;
+ }
+
+ private void checkMonitorCanceled() throws InterruptedIOException
+ {
+ if ( monitor.isCanceled() )
+ {
+ throw new InterruptedIOException("ProgressMonitor was canceled");
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/Renderer.java b/libjava/classpath/javax/swing/Renderer.java
index c803e38fcc0..9a0e81a9f36 100644
--- a/libjava/classpath/javax/swing/Renderer.java
+++ b/libjava/classpath/javax/swing/Renderer.java
@@ -49,24 +49,20 @@ import java.awt.Component;
*
* @author Andrew Selkirk
*/
-public interface Renderer {
+public interface Renderer
+{
+ /**
+ * setValue
+ * @param value TODO
+ * @param selected TODO
+ */
+ void setValue(Object value, boolean selected);
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
+ /**
+ * getComponent
+ * @returns Component
+ */
+ Component getComponent();
- /**
- * setValue
- * @param value TODO
- * @param selected TODO
- */
- void setValue(Object value, boolean selected);
- /**
- * getComponent
- * @returns Component
- */
- Component getComponent();
-
-
-} // Renderer
+}
diff --git a/libjava/classpath/javax/swing/RepaintManager.java b/libjava/classpath/javax/swing/RepaintManager.java
index 698dbe8e898..b857b126180 100644
--- a/libjava/classpath/javax/swing/RepaintManager.java
+++ b/libjava/classpath/javax/swing/RepaintManager.java
@@ -1,5 +1,5 @@
/* RepaintManager.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,12 +43,11 @@ import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.VolatileImage;
-import java.util.Enumeration;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
/**
* <p>The repaint manager holds a set of dirty regions, invalid components,
@@ -66,7 +65,11 @@ import java.util.Vector;
*/
public class RepaintManager
{
-
+ /**
+ * The current repaint managers, indexed by their ThreadGroups.
+ */
+ static HashMap currentRepaintManagers;
+
/**
* <p>A helper class which is placed into the system event queue at
* various times in order to facilitate repainting and layout. There is
@@ -80,33 +83,95 @@ public class RepaintManager
* swing paint thread, which revalidates all invalid components and
* repaints any damage in the swing scene.</p>
*/
-
protected class RepaintWorker
implements Runnable
{
+
boolean live;
+
public RepaintWorker()
{
live = false;
}
+
public synchronized void setLive(boolean b)
{
live = b;
}
+
public synchronized boolean isLive()
{
return live;
}
+
public void run()
{
- RepaintManager rm = RepaintManager.globalManager;
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ RepaintManager rm =
+ (RepaintManager) currentRepaintManagers.get(threadGroup);
setLive(false);
rm.validateInvalidComponents();
rm.paintDirtyRegions();
}
+
+ }
+
+ /**
+ * Compares two components using their depths in the component hierarchy.
+ * A component with a lesser depth (higher level components) are sorted
+ * before components with a deeper depth (low level components). This is used
+ * to order paint requests, so that the higher level components are painted
+ * before the low level components get painted.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class ComponentComparator implements Comparator
+ {
+
+ /**
+ * Compares two components.
+ *
+ * @param o1 the first component
+ * @param o2 the second component
+ *
+ * @return a negative integer, if <code>o1</code> is higher in the
+ * hierarchy than <code>o2</code>, zero, if both are at the same
+ * level and a positive integer, if <code>o1</code> is deeper in
+ * the hierarchy than <code>o2</code>
+ */
+ public int compare(Object o1, Object o2)
+ {
+ if (o1 instanceof JComponent && o2 instanceof JComponent)
+ {
+ JComponent c1 = (JComponent) o1;
+ JComponent c2 = (JComponent) o2;
+ return getDepth(c1) - getDepth(c2);
+ }
+ else
+ throw new ClassCastException("This comparator can only be used with "
+ + "JComponents");
+ }
+
+ /**
+ * Computes the depth for a given JComponent.
+ *
+ * @param c the component to compute the depth for
+ *
+ * @return the depth of the component
+ */
+ private int getDepth(JComponent c)
+ {
+ Component comp = c;
+ int depth = 0;
+ while (comp != null)
+ {
+ comp = comp.getParent();
+ depth++;
+ }
+ return depth;
+ }
}
-
/**
* A table storing the dirty regions of components. The keys of this
* table are components, the values are rectangles. Each component maps
@@ -119,7 +184,20 @@ public class RepaintManager
* @see #markCompletelyClean
* @see #markCompletelyDirty
*/
- Hashtable dirtyComponents;
+ HashMap dirtyComponents;
+
+ HashMap workDirtyComponents;
+
+ /**
+ * Stores the order in which the components get repainted.
+ */
+ ArrayList repaintOrder;
+ ArrayList workRepaintOrder;
+
+ /**
+ * The comparator used for ordered inserting into the repaintOrder list.
+ */
+ Comparator comparator;
/**
* A single, shared instance of the helper class. Any methods which mark
@@ -142,14 +220,15 @@ public class RepaintManager
* @see #removeInvalidComponent
* @see #validateInvalidComponents
*/
- Vector invalidComponents;
+ ArrayList invalidComponents;
+ ArrayList workInvalidComponents;
/**
* Whether or not double buffering is enabled on this repaint
* manager. This is merely a hint to clients; the RepaintManager will
* always return an offscreen buffer when one is requested.
*
- * @see #getDoubleBufferingEnabled
+ * @see #isDoubleBufferingEnabled
* @see #setDoubleBufferingEnabled
*/
boolean doubleBufferingEnabled;
@@ -176,53 +255,62 @@ public class RepaintManager
/**
- * The global, shared RepaintManager instance. This is reused for all
- * components in all windows. This is package-private to avoid an accessor
- * method.
- *
- * @see #currentManager
- * @see #setCurrentManager
- */
- static RepaintManager globalManager;
-
- /**
* Create a new RepaintManager object.
*/
public RepaintManager()
{
- dirtyComponents = new Hashtable();
- invalidComponents = new Vector();
+ dirtyComponents = new HashMap();
+ workDirtyComponents = new HashMap();
+ repaintOrder = new ArrayList();
+ workRepaintOrder = new ArrayList();
+ invalidComponents = new ArrayList();
+ workInvalidComponents = new ArrayList();
repaintWorker = new RepaintWorker();
doubleBufferMaximumSize = new Dimension(2000,2000);
doubleBufferingEnabled = true;
}
/**
- * Get the value of the shared {@link #globalManager} instance, possibly
- * returning a special manager associated with the specified
- * component. The default implementaiton ignores the component parameter.
+ * Returns the <code>RepaintManager</code> for the current thread's
+ * thread group. The default implementation ignores the
+ * <code>component</code> parameter and returns the same repaint manager
+ * for all components.
*
- * @param component A component to look up the manager of
+ * @param component a component to look up the manager of
*
- * @return The current repaint manager
+ * @return the current repaint manager for the calling thread's thread group
+ * and the specified component
*
* @see #setCurrentManager
*/
public static RepaintManager currentManager(Component component)
{
- if (globalManager == null)
- globalManager = new RepaintManager();
- return globalManager;
+ if (currentRepaintManagers == null)
+ currentRepaintManagers = new HashMap();
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ RepaintManager currentManager =
+ (RepaintManager) currentRepaintManagers.get(threadGroup);
+ if (currentManager == null)
+ {
+ currentManager = new RepaintManager();
+ currentRepaintManagers.put(threadGroup, currentManager);
+ }
+ return currentManager;
}
/**
- * Get the value of the shared {@link #globalManager} instance, possibly
- * returning a special manager associated with the specified
- * component. The default implementaiton ignores the component parameter.
+ * Returns the <code>RepaintManager</code> for the current thread's
+ * thread group. The default implementation ignores the
+ * <code>component</code> parameter and returns the same repaint manager
+ * for all components.
*
- * @param component A component to look up the manager of
+ * This method is only here for backwards compatibility with older versions
+ * of Swing and simply forwards to {@link #currentManager(Component)}.
*
- * @return The current repaint manager
+ * @param component a component to look up the manager of
+ *
+ * @return the current repaint manager for the calling thread's thread group
+ * and the specified component
*
* @see #setCurrentManager
*/
@@ -232,15 +320,20 @@ public class RepaintManager
}
/**
- * Set the value of the shared {@link #globalManager} instance.
+ * Sets the repaint manager for the calling thread's thread group.
*
- * @param manager The new value of the shared instance
+ * @param manager the repaint manager to set for the current thread's thread
+ * group
*
- * @see #currentManager(JComponent)
+ * @see #currentManager(Component)
*/
public static void setCurrentManager(RepaintManager manager)
{
- globalManager = manager;
+ if (currentRepaintManagers == null)
+ currentRepaintManagers = new HashMap();
+
+ ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+ currentRepaintManagers.put(threadGroup, manager);
}
/**
@@ -287,7 +380,7 @@ public class RepaintManager
*/
public synchronized void removeInvalidComponent(JComponent component)
{
- invalidComponents.removeElement(component);
+ invalidComponents.remove(component);
}
/**
@@ -311,12 +404,13 @@ public class RepaintManager
public synchronized void addDirtyRegion(JComponent component, int x, int y,
int w, int h)
{
- if (w == 0 || h == 0)
+ if (w == 0 || h == 0 || !component.isShowing())
return;
-
Rectangle r = new Rectangle(x, y, w, h);
if (dirtyComponents.containsKey(component))
r = r.union((Rectangle)dirtyComponents.get(component));
+ else
+ insertInRepaintOrder(component);
dirtyComponents.put(component, r);
if (! repaintWorker.isLive())
{
@@ -324,7 +418,23 @@ public class RepaintManager
SwingUtilities.invokeLater(repaintWorker);
}
}
-
+
+ /**
+ * Inserts a component into the repaintOrder list in an ordered fashion,
+ * using a binary search.
+ *
+ * @param c the component to be inserted
+ */
+ private void insertInRepaintOrder(JComponent c)
+ {
+ if (comparator == null)
+ comparator = new ComponentComparator();
+ int insertIndex = Collections.binarySearch(repaintOrder, c, comparator);
+ if (insertIndex < 0)
+ insertIndex = -(insertIndex + 1);
+ repaintOrder.add(insertIndex, c);
+ }
+
/**
* Get the dirty region associated with a component, or <code>null</code>
* if the component has no dirty region.
@@ -341,7 +451,10 @@ public class RepaintManager
*/
public Rectangle getDirtyRegion(JComponent component)
{
- return (Rectangle) dirtyComponents.get(component);
+ Rectangle dirty = (Rectangle) dirtyComponents.get(component);
+ if (dirty == null)
+ dirty = new Rectangle();
+ return dirty;
}
/**
@@ -359,6 +472,7 @@ public class RepaintManager
{
Rectangle r = component.getBounds();
addDirtyRegion(component, r.x, r.y, r.width, r.height);
+ component.isCompletelyDirty = true;
}
/**
@@ -374,7 +488,11 @@ public class RepaintManager
*/
public void markCompletelyClean(JComponent component)
{
- dirtyComponents.remove(component);
+ synchronized (this)
+ {
+ dirtyComponents.remove(component);
+ }
+ component.isCompletelyDirty = false;
}
/**
@@ -393,13 +511,9 @@ public class RepaintManager
*/
public boolean isCompletelyDirty(JComponent component)
{
- Rectangle dirty = (Rectangle) dirtyComponents.get(component);
- if (dirty == null)
+ if (! dirtyComponents.containsKey(component))
return false;
- Rectangle r = component.getBounds();
- if (r == null)
- return true;
- return dirty.contains(r);
+ return component.isCompletelyDirty;
}
/**
@@ -408,58 +522,56 @@ public class RepaintManager
*/
public void validateInvalidComponents()
{
- for (Enumeration e = invalidComponents.elements(); e.hasMoreElements(); )
+ // In order to keep the blocking of application threads minimal, we switch
+ // the invalidComponents field with the workInvalidComponents field and
+ // work with the workInvalidComponents field.
+ synchronized(this)
+ {
+ ArrayList swap = invalidComponents;
+ invalidComponents = workInvalidComponents;
+ workInvalidComponents = swap;
+ }
+ for (Iterator i = workInvalidComponents.iterator(); i.hasNext(); )
{
- JComponent comp = (JComponent) e.nextElement();
+ JComponent comp = (JComponent) i.next();
if (! (comp.isVisible() && comp.isShowing()))
continue;
comp.validate();
}
- invalidComponents.clear();
+ workInvalidComponents.clear();
}
/**
* Repaint all regions of all components which have been marked dirty in
* the {@link #dirtyComponents} table.
*/
- public void paintDirtyRegions()
+ public synchronized void paintDirtyRegions()
{
- // step 1: pull out roots and calculate spanning damage
-
- HashMap roots = new HashMap();
- for (Enumeration e = dirtyComponents.keys(); e.hasMoreElements(); )
+ // In order to keep the blocking of application threads minimal, we switch
+ // the dirtyComponents field with the workdirtyComponents field and the
+ // repaintOrder field with the workRepaintOrder field and work with the
+ // work* fields.
+ synchronized(this)
+ {
+ ArrayList swap = workRepaintOrder;
+ workRepaintOrder = repaintOrder;
+ repaintOrder = swap;
+ HashMap swap2 = workDirtyComponents;
+ workDirtyComponents = dirtyComponents;
+ dirtyComponents = swap2;
+ }
+ for (Iterator i = workRepaintOrder.iterator(); i.hasNext();)
{
- JComponent comp = (JComponent) e.nextElement();
- if (! (comp.isVisible() && comp.isShowing()))
- continue;
- Rectangle damaged = getDirtyRegion(comp);
- if (damaged.width == 0 || damaged.height == 0)
+ JComponent comp = (JComponent) i.next();
+ // If a component is marked completely clean in the meantime, then skip
+ // it.
+ Rectangle damaged = (Rectangle) workDirtyComponents.get(comp);
+ if (damaged == null || damaged.isEmpty())
continue;
- JRootPane root = comp.getRootPane();
- // If the component has no root, no repainting will occur.
- if (root == null)
- continue;
- Rectangle rootDamage = SwingUtilities.convertRectangle(comp, damaged, root);
- if (! roots.containsKey(root))
- {
- roots.put(root, rootDamage);
- }
- else
- {
- roots.put(root, ((Rectangle)roots.get(root)).union(rootDamage));
- }
- }
- dirtyComponents.clear();
-
- // step 2: paint those roots
- Iterator i = roots.entrySet().iterator();
- while(i.hasNext())
- {
- Map.Entry ent = (Map.Entry) i.next();
- JRootPane root = (JRootPane) ent.getKey();
- Rectangle rect = (Rectangle) ent.getValue();
- root.paintImmediately(rect);
+ comp.paintImmediately(damaged);
}
+ workRepaintOrder.clear();
+ workDirtyComponents.clear();
}
/**
diff --git a/libjava/classpath/javax/swing/RootPaneContainer.java b/libjava/classpath/javax/swing/RootPaneContainer.java
index b121f958a92..4b1bece214d 100644
--- a/libjava/classpath/javax/swing/RootPaneContainer.java
+++ b/libjava/classpath/javax/swing/RootPaneContainer.java
@@ -48,53 +48,49 @@ import java.awt.Container;
*
* @author Andrew Selkirk
*/
-public interface RootPaneContainer {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getRootPane
- * @returns JRootPane
- */
- JRootPane getRootPane();
-
- /**
- * setContentPane
- * @param contentPane TODO
- */
- void setContentPane(Container contentPane);
-
- /**
- * getContentPane
- * @returns Container
- */
- Container getContentPane();
-
- /**
- * setLayeredPane
- * @param layeredPane TODO
- */
- void setLayeredPane(JLayeredPane layeredPane);
-
- /**
- * getLayeredPane
- * @returns JLayeredPane
- */
- JLayeredPane getLayeredPane();
-
- /**
- * setGlassPane
- * @param glassPane TODO
- */
- void setGlassPane(Component glassPane);
-
- /**
- * getGlassPane
- * @returns Component
- */
- Component getGlassPane();
-
-
-} // RootPaneContainer
+public interface RootPaneContainer
+{
+
+ /**
+ * getRootPane
+ * @returns JRootPane
+ */
+ JRootPane getRootPane();
+
+ /**
+ * setContentPane
+ * @param contentPane TODO
+ */
+ void setContentPane(Container contentPane);
+
+ /**
+ * getContentPane
+ * @returns Container
+ */
+ Container getContentPane();
+
+ /**
+ * setLayeredPane
+ * @param layeredPane TODO
+ */
+ void setLayeredPane(JLayeredPane layeredPane);
+
+ /**
+ * getLayeredPane
+ * @returns JLayeredPane
+ */
+ JLayeredPane getLayeredPane();
+
+ /**
+ * setGlassPane
+ * @param glassPane TODO
+ */
+ void setGlassPane(Component glassPane);
+
+ /**
+ * getGlassPane
+ * @returns Component
+ */
+ Component getGlassPane();
+
+}
diff --git a/libjava/classpath/javax/swing/ScrollPaneLayout.java b/libjava/classpath/javax/swing/ScrollPaneLayout.java
index 75a6f9aa208..edf1f1f4292 100644
--- a/libjava/classpath/javax/swing/ScrollPaneLayout.java
+++ b/libjava/classpath/javax/swing/ScrollPaneLayout.java
@@ -43,12 +43,9 @@ import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager;
-import java.awt.Point;
import java.awt.Rectangle;
import java.io.Serializable;
-import javax.swing.border.Border;
-
/**
* ScrollPaneLayout
* @author Andrew Selkirk
@@ -60,8 +57,11 @@ public class ScrollPaneLayout
private static final long serialVersionUID = -4480022884523193743L;
public static class UIResource extends ScrollPaneLayout
- implements javax.swing.plaf.UIResource {
- public UIResource() {
+ implements javax.swing.plaf.UIResource
+ {
+ public UIResource()
+ {
+ super();
}
}
@@ -77,8 +77,9 @@ public class ScrollPaneLayout
protected int vsbPolicy;
protected int hsbPolicy;
- public ScrollPaneLayout() {
-
+ public ScrollPaneLayout()
+ {
+ // Nothing to do here.
}
public void syncWithScrollPane(JScrollPane scrollPane) {
@@ -95,11 +96,31 @@ public class ScrollPaneLayout
upperRight = scrollPane.getCorner(UPPER_RIGHT_CORNER);
}
+ /**
+ * Removes an existing component. If oldComponent is not null
+ * and is not equal to newComponent, oldComponent must be removed
+ * from its parent.
+ * @param oldComponent the old Component that may need to be removed.
+ * @param newComponent the Component to add.
+ * @return the newComponent
+ */
protected Component addSingletonComponent(Component oldComponent,
- Component newComponent) {
- return null;
+ Component newComponent)
+ {
+ if (oldComponent != null && oldComponent != newComponent)
+ oldComponent.getParent().remove(oldComponent);
+ return newComponent;
}
+ /**
+ * Add the specified component to the layout.
+ * @param key must be one of VIEWPORT, VERTICAL_SCROLLBAR,
+ * HORIZONTAL_SCROLLBAR, ROW_HEADER, COLUMN_HEADER,
+ * LOWER_RIGHT_CORNER, LOWER_LEFT_CORNER, UPPER_RIGHT_CORNER,
+ * UPPER_LEFT_CORNER.
+ * @param component the Component to add
+ * @throws IllegalArgumentException if key is not as above
+ */
public void addLayoutComponent(String key, Component component)
{
if (key == VIEWPORT)
@@ -120,6 +141,8 @@ public class ScrollPaneLayout
lowerLeft = component;
else if (key == UPPER_LEFT_CORNER)
upperLeft = component;
+ else
+ throw new IllegalArgumentException();
}
public void removeLayoutComponent(Component component) {
@@ -147,9 +170,20 @@ public class ScrollPaneLayout
{
return vsbPolicy;
}
-
+
+ /**
+ * Sets the vertical scrollbar policy.
+ * @param policy must be one of VERTICAL_SCROLLBAR_AS_NEEDED,
+ * VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_ALWAYS.
+ * @throws IllegalArgumentException if policy is not one of the valid
+ * JScrollBar policies.
+ */
public void setVerticalScrollBarPolicy(int policy)
{
+ if (policy != VERTICAL_SCROLLBAR_AS_NEEDED &&
+ policy != VERTICAL_SCROLLBAR_NEVER &&
+ policy != VERTICAL_SCROLLBAR_ALWAYS)
+ throw new IllegalArgumentException("Illegal Scrollbar Policy");
vsbPolicy = policy;
}
@@ -158,8 +192,19 @@ public class ScrollPaneLayout
return hsbPolicy;
}
+ /**
+ * Sets the horizontal scrollbar policy.
+ * @param policy must be one of HORIZONTAL_SCROLLBAR_AS_NEEDED,
+ * HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_ALWAYS.
+ * @throws IllegalArgumentException if policy is not one of the valid
+ * JScrollbar policies.
+ */
public void setHorizontalScrollBarPolicy(int policy)
{
+ if (policy != HORIZONTAL_SCROLLBAR_AS_NEEDED &&
+ policy != HORIZONTAL_SCROLLBAR_NEVER &&
+ policy != HORIZONTAL_SCROLLBAR_ALWAYS)
+ throw new IllegalArgumentException("Illegal Scrollbar Policy");
hsbPolicy = policy;
}
@@ -188,6 +233,12 @@ public class ScrollPaneLayout
return colHead;
}
+ /**
+ * Returns the Component at the specified corner.
+ * @param key the corner.
+ * @return the Component at the specified corner, or null if
+ * key is not one of the four valid corners.
+ */
public Component getCorner(String key)
{
if (key == LOWER_RIGHT_CORNER)
@@ -201,151 +252,53 @@ public class ScrollPaneLayout
return null;
}
- private static void maybeSetPreferredSize(JComponent src, Dimension dim)
- {
- Dimension tmp = null;
- if (src != null)
- tmp = src.getPreferredSize();
- if (tmp != null)
- dim.setSize(tmp);
- }
-
- private static void maybeSetMinimumSize(JComponent src, Dimension dim)
- {
- Dimension tmp = null;
- if (src != null)
- tmp = src.getMinimumSize();
- if (tmp != null)
- dim.setSize(tmp);
- }
-
public Dimension preferredLayoutSize(Container parent)
{
- if (parent != null && parent instanceof JScrollPane)
- {
- JScrollPane sc = (JScrollPane) parent;
- synchronized (sc.getTreeLock ())
- {
- Dimension insetsSize = new Dimension(0,0);
- Dimension viewportSize = new Dimension(0,0);
- Dimension viewportInsetsSize = new Dimension(0,0);
- Dimension columnHeaderSize = new Dimension(0,0);
- Dimension rowHeaderSize = new Dimension(0,0);
- Dimension verticalScrollBarSize = new Dimension(0,0);
- Dimension horizontalScrollBarSize = new Dimension(0,0);
-
- Insets insets = sc.getInsets();
- Border viewportBorder = sc.getViewportBorder();
- Insets viewportInsets = null;
-
- if (viewportBorder != null)
- {
- viewportInsets = viewportBorder.getBorderInsets(parent);
- if (viewportInsets != null)
- viewportInsetsSize.setSize(viewportInsets.left + viewportInsets.right,
- viewportInsets.top + viewportInsets.bottom);
- }
-
- if (insets != null)
- insetsSize.setSize(insets.left + insets.right,
- insets.top + insets.bottom);
-
- if (viewport != null)
- {
- Component view = null;
- Scrollable scr = null;
- Dimension pref = null;
-
- view = viewport.getView();
- if (view != null && view instanceof Scrollable)
- scr = (Scrollable) view;
- if (scr != null)
- pref = scr.getPreferredScrollableViewportSize();
- if (pref == null)
- pref = viewport.getPreferredSize();
- if (pref != null)
- viewportSize.setSize(pref);
- }
-
- maybeSetPreferredSize(colHead, columnHeaderSize);
- maybeSetPreferredSize(rowHead, rowHeaderSize);
- maybeSetPreferredSize(vsb, verticalScrollBarSize);
- maybeSetPreferredSize(hsb, horizontalScrollBarSize);
-
- return new Dimension(insetsSize.width
- + viewportSize.width
- + viewportInsetsSize.width
- + rowHeaderSize.width
- + verticalScrollBarSize.width,
- insetsSize.height
- + viewportSize.height
- + viewportInsetsSize.height
- + columnHeaderSize.height
- + horizontalScrollBarSize.height);
- }
- }
- else
- {
- return new Dimension(0,0);
- }
+ // Sun's implementation simply throws a ClassCastException if
+ // parent is no JScrollPane, so do we.
+ JScrollPane sc = (JScrollPane) parent;
+ Dimension viewportSize = viewport.getPreferredSize();
+ Dimension viewSize = viewport.getViewSize();
+ int width = viewportSize.width;
+ int height = viewportSize.height;
+
+ // horizontal scrollbar needed if the view's preferred width
+ // is larger than the viewport's preferred width
+ if (hsb != null && viewSize.width > viewportSize.width)
+ height += hsb.getPreferredSize().height;
+
+ // vertical scrollbar needed if the view's preferred height
+ // is larger than the viewport's preferred height
+ if (vsb != null && viewSize.height > viewportSize.height)
+ width += vsb.getPreferredSize().width;
+ if (rowHead != null && rowHead.isVisible())
+ width += rowHead.getPreferredSize().width;
+ if (colHead != null && colHead.isVisible())
+ height += colHead.getPreferredSize().height;
+ Insets i = sc.getInsets();
+ return new Dimension(width + i.left + i.right,
+ height + i.left + i.right);
}
public Dimension minimumLayoutSize(Container parent)
{
- if (parent instanceof JScrollPane)
- {
- JScrollPane sc = (JScrollPane) parent;
- synchronized (sc.getTreeLock ())
- {
- Dimension insetsSize = new Dimension(0,0);
- Dimension viewportSize = new Dimension(0,0);
- Dimension viewportInsetsSize = new Dimension(0,0);
- Dimension columnHeaderSize = new Dimension(0,0);
- Dimension rowHeaderSize = new Dimension(0,0);
- Dimension verticalScrollBarSize = new Dimension(0,0);
- Dimension horizontalScrollBarSize = new Dimension(0,0);
-
- Insets insets = sc.getInsets();
- Border viewportBorder = sc.getViewportBorder();
- Insets viewportInsets = null;
-
- if (viewportBorder != null)
- {
- viewportInsets = viewportBorder.getBorderInsets(parent);
- if (viewportInsets != null)
- viewportInsetsSize.setSize(viewportInsets.left + viewportInsets.right,
- viewportInsets.top + viewportInsets.bottom);
- }
-
- if (insets != null)
- insetsSize.setSize(insets.left + insets.right,
- insets.top + insets.bottom);
-
- maybeSetMinimumSize(colHead, columnHeaderSize);
- maybeSetMinimumSize(rowHead, rowHeaderSize);
-
- if (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)
- maybeSetMinimumSize(vsb, verticalScrollBarSize);
-
- if (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)
- maybeSetMinimumSize(hsb, horizontalScrollBarSize);
-
- return new Dimension(insetsSize.width
- + viewportSize.width
- + viewportInsetsSize.width
- + rowHeaderSize.width
- + verticalScrollBarSize.width,
- insetsSize.height
- + viewportSize.height
- + viewportInsetsSize.height
- + columnHeaderSize.height
- + horizontalScrollBarSize.height);
- }
- }
- else
- {
- return new Dimension(0,0);
- }
+ // Sun's implementation simply throws a ClassCastException if
+ // parent is no JScrollPane, so do we.
+ JScrollPane sc = (JScrollPane) parent;
+ Dimension viewportSize = viewport.getMinimumSize();
+ int width = viewportSize.width;
+ int height = viewportSize.height;
+ if (hsb != null && hsb.isVisible())
+ height += hsb.getMinimumSize().height;
+ if (vsb != null && vsb.isVisible())
+ width += vsb.getMinimumSize().width;
+ if (rowHead != null && rowHead.isVisible())
+ width += rowHead.getMinimumSize().width;
+ if (colHead != null && colHead.isVisible())
+ height += colHead.getMinimumSize().height;
+ Insets i = sc.getInsets();
+ return new Dimension(width + i.left + i.right,
+ height + i.top + i.bottom);
}
/**
@@ -371,100 +324,91 @@ public class ScrollPaneLayout
*/
public void layoutContainer(Container parent)
{
- if (parent instanceof JScrollPane)
+ // Sun's implementation simply throws a ClassCastException if
+ // parent is no JScrollPane, so do we.
+ JScrollPane sc = (JScrollPane) parent;
+ JViewport viewport = sc.getViewport();
+ Dimension viewSize = viewport.getViewSize();
+
+ int x1 = 0, x2 = 0, x3 = 0, x4 = 0;
+ int y1 = 0, y2 = 0, y3 = 0, y4 = 0;
+ Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null);
+
+ x1 = scrollPaneBounds.x;
+ y1 = scrollPaneBounds.y;
+ x4 = scrollPaneBounds.x + scrollPaneBounds.width;
+ y4 = scrollPaneBounds.y + scrollPaneBounds.height;
+ if (colHead != null)
+ y2 = y1 + colHead.getPreferredSize().height;
+ else
+ y2 = y1;
+
+ if (rowHead != null)
+ x2 = x1 + rowHead.getPreferredSize().width;
+ else
+ x2 = x1;
+
+ int vsbPolicy = sc.getVerticalScrollBarPolicy();
+ int hsbPolicy = sc.getHorizontalScrollBarPolicy();
+
+ boolean showVsb =
+ (vsb != null)
+ && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS)
+ || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED
+ && viewSize.height > (y4 - y2)));
+ boolean showHsb =
+ (hsb != null)
+ && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS)
+ || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED
+ && viewSize.width > (x4 - x2)));
+
+ if (!showVsb)
+ x3 = x4;
+ else
+ x3 = x4 - vsb.getPreferredSize().width;
+
+ if (!showHsb)
+ y3 = y4;
+ else
+ y3 = y4 - hsb.getPreferredSize().height;
+
+ // now set the layout
+ if (viewport != null)
+ viewport.setBounds(new Rectangle(x2, y2, x3 - x2, y3 - y2));
+
+ if (colHead != null)
+ colHead.setBounds(new Rectangle(x2, y1, x3 - x2, y2 - y1));
+
+ if (rowHead != null)
+ rowHead.setBounds(new Rectangle(x1, y2, x2 - x1, y3 - y2));
+
+ if (showVsb)
+ {
+ vsb.setVisible(true);
+ vsb.setBounds(new Rectangle(x3, y2, x4 - x3, y3 - y2));
+ }
+ else if (vsb != null)
+ vsb.setVisible(false);
+
+ if (showHsb)
{
- JScrollPane sc = (JScrollPane) parent;
- synchronized (sc.getTreeLock ())
- {
- JViewport viewport = sc.getViewport();
- Dimension viewSize = viewport.getViewSize();
- Point viewPos = viewport.getViewPosition();
-
- int x1 = 0, x2 = 0, x3 = 0, x4 = 0;
- int y1 = 0, y2 = 0, y3 = 0, y4 = 0;
-
- Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null);
-
- x1 = scrollPaneBounds.x;
- y1 = scrollPaneBounds.y;
- x4 = scrollPaneBounds.x + scrollPaneBounds.width;
- y4 = scrollPaneBounds.y + scrollPaneBounds.height;
-
- if (colHead != null)
- y2 = y1 + colHead.getPreferredSize().height;
- else
- y2 = y1;
-
- if (rowHead != null)
- x2 = x1 + rowHead.getPreferredSize().width;
- else
- x2 = x1;
-
- int vsbPolicy = sc.getVerticalScrollBarPolicy();
- int hsbPolicy = sc.getHorizontalScrollBarPolicy();
-
- x3 = x4 - vsb.getPreferredSize().width;
- y3 = y4 - hsb.getPreferredSize().height;
-
- boolean showVsb =
- (vsb != null)
- && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS)
- || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED
- && viewSize.height > (y3 - y2)));
-
- boolean showHsb =
- (hsb != null)
- && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS)
- || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED
- && viewSize.width > (x3 - x2)));
-
- if (!showVsb)
- x3 = x4;
-
- if (!showHsb)
- y3 = y4;
-
- // now set the layout
-
- if (viewport != null)
- viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2));
-
- if (colHead != null)
- colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1));
-
- if (rowHead != null)
- rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2));
-
- if (showVsb)
- {
- vsb.setVisible(true);
- vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2));
- }
- else if (vsb != null)
- vsb.setVisible(false);
-
- if (showHsb)
- {
- hsb.setVisible(true);
- hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3));
- }
- else if (hsb != null)
- hsb.setVisible(false);
-
- if (upperLeft != null)
- upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1));
-
- if (upperRight != null)
- upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1));
-
- if (lowerLeft != null)
- lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3));
-
- if (lowerRight != null)
- lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3));
-
- }
+ hsb.setVisible(true);
+ hsb.setBounds(new Rectangle(x2, y3, x3 - x2, y4 - y3));
}
+ else if (hsb != null)
+ hsb.setVisible(false);
+
+ if (upperLeft != null)
+ upperLeft.setBounds(new Rectangle(x1, y1, x2 - x1, y2 - y1));
+
+ if (upperRight != null)
+ upperRight.setBounds(new Rectangle(x3, y1, x4 - x3, y2 - y1));
+
+ if (lowerLeft != null)
+ lowerLeft.setBounds(new Rectangle(x1, y3, x2 - x1, y4 - y3));
+
+ if (lowerRight != null)
+ lowerRight.setBounds(new Rectangle(x3, y3, x4 - x3, y4 - y3));
}
/**
diff --git a/libjava/classpath/javax/swing/Scrollable.java b/libjava/classpath/javax/swing/Scrollable.java
index 19732192330..9dce665d626 100644
--- a/libjava/classpath/javax/swing/Scrollable.java
+++ b/libjava/classpath/javax/swing/Scrollable.java
@@ -48,9 +48,16 @@ import java.awt.Rectangle;
*/
public interface Scrollable
{
- Dimension getPreferredScrollableViewportSize();
- int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction);
- int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction);
- boolean getScrollableTracksViewportWidth();
- boolean getScrollableTracksViewportHeight();
+ Dimension getPreferredScrollableViewportSize();
+
+ int getScrollableUnitIncrement(Rectangle visibleRect, int orientation,
+ int direction);
+
+ int getScrollableBlockIncrement(Rectangle visibleRect, int orientation,
+ int direction);
+
+ boolean getScrollableTracksViewportWidth();
+
+ boolean getScrollableTracksViewportHeight();
+
}
diff --git a/libjava/classpath/javax/swing/SingleSelectionModel.java b/libjava/classpath/javax/swing/SingleSelectionModel.java
index b5380c857a3..d57443b56bb 100644
--- a/libjava/classpath/javax/swing/SingleSelectionModel.java
+++ b/libjava/classpath/javax/swing/SingleSelectionModel.java
@@ -46,46 +46,41 @@ import javax.swing.event.ChangeListener;
*
* @author Andrew Selkirk
*/
-public interface SingleSelectionModel {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getSelectedIndex
- * @returns int
- */
- int getSelectedIndex();
-
- /**
- * setSelectedIndex
- * @param index TODO
- */
- void setSelectedIndex(int index);
-
- /**
- * clearSelection
- */
- void clearSelection();
-
- /**
- * isSelected
- * @returns boolean
- */
- boolean isSelected();
-
- /**
- * addChangeListener
- * @param listener TODO
- */
- void addChangeListener(ChangeListener listener);
-
- /**
- * removeChangeListener
- * @param listener TODO
- */
- void removeChangeListener(ChangeListener listener);
-
-
-} // SingleSelectionModel
+public interface SingleSelectionModel
+{
+ /**
+ * getSelectedIndex
+ * @returns int
+ */
+ int getSelectedIndex();
+
+ /**
+ * setSelectedIndex
+ * @param index TODO
+ */
+ void setSelectedIndex(int index);
+
+ /**
+ * clearSelection
+ */
+ void clearSelection();
+
+ /**
+ * isSelected
+ * @returns boolean
+ */
+ boolean isSelected();
+
+ /**
+ * addChangeListener
+ * @param listener TODO
+ */
+ void addChangeListener(ChangeListener listener);
+
+ /**
+ * removeChangeListener
+ * @param listener TODO
+ */
+ void removeChangeListener(ChangeListener listener);
+
+}
diff --git a/libjava/classpath/javax/swing/SizeRequirements.java b/libjava/classpath/javax/swing/SizeRequirements.java
index 77b42db1ce9..b9b5c322379 100644
--- a/libjava/classpath/javax/swing/SizeRequirements.java
+++ b/libjava/classpath/javax/swing/SizeRequirements.java
@@ -116,7 +116,17 @@ public class SizeRequirements implements Serializable
*/
public String toString()
{
- return null; // TODO
+ StringBuilder b = new StringBuilder();
+ b.append("<[");
+ b.append(minimum);
+ b.append(',');
+ b.append(preferred);
+ b.append(',');
+ b.append(maximum);
+ b.append("]@");
+ b.append(alignment);
+ b.append('>');
+ return b.toString();
}
/**
@@ -132,13 +142,26 @@ public class SizeRequirements implements Serializable
public static SizeRequirements
getTiledSizeRequirements(SizeRequirements[] children)
{
- SizeRequirements result = new SizeRequirements();
+ long minimum = 0;
+ long preferred = 0;
+ long maximum = 0;
for (int i = 0; i < children.length; i++)
{
- result.minimum += children[i].minimum;
- result.preferred += children[i].preferred;
- result.maximum += children[i].maximum;
+ minimum += children[i].minimum;
+ preferred += children[i].preferred;
+ maximum += children[i].maximum;
}
+ // Overflow check.
+ if (minimum > Integer.MAX_VALUE)
+ minimum = Integer.MAX_VALUE;
+ if (preferred > Integer.MAX_VALUE)
+ preferred = Integer.MAX_VALUE;
+ if (maximum > Integer.MAX_VALUE)
+ maximum = Integer.MAX_VALUE;
+ SizeRequirements result = new SizeRequirements((int) minimum,
+ (int) preferred,
+ (int) maximum,
+ 0.5F);
return result;
}
@@ -156,7 +179,34 @@ public class SizeRequirements implements Serializable
public static SizeRequirements
getAlignedSizeRequirements(SizeRequirements[] children)
{
- return null; // TODO
+ float minLeft = 0;
+ float minRight = 0;
+ float prefLeft = 0;
+ float prefRight = 0;
+ float maxLeft = 0;
+ float maxRight = 0;
+ for (int i = 0; i < children.length; i++)
+ {
+ float myMinLeft = children[i].minimum * children[i].alignment;
+ float myMinRight = children[i].minimum - myMinLeft;
+ minLeft = Math.max(myMinLeft, minLeft);
+ minRight = Math.max(myMinRight, minRight);
+ float myPrefLeft = children[i].preferred * children[i].alignment;
+ float myPrefRight = children[i].preferred - myPrefLeft;
+ prefLeft = Math.max(myPrefLeft, prefLeft);
+ prefRight = Math.max(myPrefRight, prefRight);
+ float myMaxLeft = children[i].maximum * children[i].alignment;
+ float myMaxRight = children[i].maximum - myMaxLeft;
+ maxLeft = Math.max(myMaxLeft, maxLeft);
+ maxRight = Math.max(myMaxRight, maxRight);
+ }
+ int minSize = (int) (minLeft + minRight);
+ int prefSize = (int) (prefLeft + prefRight);
+ int maxSize = (int) (maxLeft + maxRight);
+ float align = prefLeft / (prefRight + prefLeft);
+ if (Float.isNaN(align))
+ align = 0;
+ return new SizeRequirements(minSize, prefSize, maxSize, align);
}
/**
@@ -222,6 +272,7 @@ public class SizeRequirements implements Serializable
int[] offsets, int[] spans,
boolean forward)
{
+ int span = 0;
if (forward)
{
int offset = 0;
@@ -229,6 +280,7 @@ public class SizeRequirements implements Serializable
{
offsets[i] = offset;
spans[i] = children[i].preferred;
+ span += spans[i];
offset += children[i].preferred;
}
}
@@ -239,9 +291,84 @@ public class SizeRequirements implements Serializable
{
offset -= children[i].preferred;
offsets[i] = offset;
+ span += spans[i];
spans[i] = children[i].preferred;
}
}
+ // Adjust spans so that we exactly fill the allocated region. If
+ if (span > allocated)
+ adjustSmaller(allocated, children, spans, span);
+ else if (span < allocated)
+ adjustGreater(allocated, children, spans, span);
+
+ // Adjust offsets.
+ if (forward)
+ {
+ int offset = 0;
+ for (int i = 0; i < children.length; i++)
+ {
+ offsets[i] = offset;
+ offset += spans[i];
+ }
+ }
+ else
+ {
+ int offset = allocated;
+ for (int i = 0; i < children.length; i++)
+ {
+ offset -= spans[i];
+ offsets[i] = offset;
+ }
+ }
+ }
+
+ private static void adjustSmaller(int allocated, SizeRequirements[] children,
+ int[] spans, int span)
+ {
+ // Sum up (prefSize - minSize) over all children
+ int sumDelta = 0;
+ for (int i = 0; i < children.length; i++)
+ sumDelta += children[i].preferred - children[i].minimum;
+
+ // If we have sumDelta == 0, then all components have prefSize == maxSize
+ // and we can't do anything about it.
+ if (sumDelta == 0)
+ return;
+
+ // Adjust all sizes according to their preferred and minimum sizes.
+ for (int i = 0; i < children.length; i++)
+ {
+ double factor = ((double) (children[i].preferred - children[i].minimum))
+ / ((double) sumDelta);
+ // In case we have a sumDelta of 0, the factor should also be 0.
+ if (Double.isNaN(factor))
+ factor = 0;
+ spans[i] -= factor * (span - allocated);
+ }
+ }
+
+ private static void adjustGreater(int allocated, SizeRequirements[] children,
+ int[] spans, int span)
+ {
+ // Sum up (maxSize - prefSize) over all children
+ long sumDelta = 0;
+ for (int i = 0; i < children.length; i++)
+ {
+ sumDelta += children[i].maximum - children[i].preferred;
+ }
+
+ // If we have sumDelta == 0, then all components have prefSize == maxSize
+ // and we can't do anything about it.
+ if (sumDelta == 0)
+ return;
+
+ // Adjust all sizes according to their preferred and minimum sizes.
+ for (int i = 0; i < children.length; i++)
+ {
+ double factor = ((double) (children[i].maximum - children[i].preferred))
+ / ((double) sumDelta);
+ spans[i] += factor * (allocated - span);
+ }
}
/**
@@ -271,7 +398,8 @@ public class SizeRequirements implements Serializable
SizeRequirements[] children,
int[] offsets, int[] spans)
{
- calculateTiledPositions(allocated, total, children, offsets, spans, true);
+ calculateAlignedPositions(allocated, total, children, offsets, spans,
+ true);
}
/**
@@ -306,7 +434,74 @@ public class SizeRequirements implements Serializable
int[] offset, int[] spans,
boolean forward)
{
- // TODO
+ // First we compute the position of the baseline.
+ float baseline = allocated * total.alignment;
+
+ // Now we can layout the components along the baseline.
+ for (int i = 0; i < children.length; i++)
+ {
+ float align = children[i].alignment;
+ // Try to fit the component into the available space.
+ int[] spanAndOffset = new int[2];
+ if (align < .5F || baseline == 0)
+ adjustFromRight(children[i], baseline, allocated, spanAndOffset);
+ else
+ adjustFromLeft(children[i], baseline, allocated, spanAndOffset);
+ spans[i] = spanAndOffset[0];
+ offset[i] = spanAndOffset[1];
+ }
+ }
+
+ /**
+ * Adjusts the span and offset of a component for the aligned layout.
+ *
+ * @param reqs
+ * @param baseline
+ * @param allocated
+ * @param spanAndOffset
+ */
+ private static void adjustFromRight(SizeRequirements reqs, float baseline,
+ int allocated, int[] spanAndOffset)
+ {
+ float right = allocated - baseline;
+ // If the resulting span exceeds the maximum of the component, then adjust
+ // accordingly.
+ float maxRight = ((float) reqs.maximum) * (1.F - reqs.alignment);
+ if (right / (1.F - reqs.alignment) > reqs.maximum)
+ right = maxRight;
+ // If we have not enough space on the left side, then adjust accordingly.
+ if (right / (1.F - reqs.alignment) * reqs.alignment > allocated - baseline)
+ right = ((float) (allocated - baseline))
+ / reqs.alignment * (1.F - reqs.alignment);
+
+ spanAndOffset[0] = (int) (right / (1.F - reqs.alignment));
+ spanAndOffset[1] = (int) (baseline - spanAndOffset[0] * reqs.alignment);
+ }
+
+ /**
+ * Adjusts the span and offset of a component for the aligned layout.
+ *
+ * @param reqs
+ * @param baseline
+ * @param allocated
+ * @param spanAndOffset
+ */
+ private static void adjustFromLeft(SizeRequirements reqs, float baseline,
+ int allocated, int[] spanAndOffset)
+ {
+ float left = baseline;
+ // If the resulting span exceeds the maximum of the component, then adjust
+ // accordingly.
+ float maxLeft = ((float) reqs.maximum) * reqs.alignment;
+ if (left / reqs.alignment > reqs.maximum)
+ left = maxLeft;
+ // If we have not enough space on the right side, then adjust accordingly.
+ if (left / reqs.alignment * (1.F - reqs.alignment) > allocated - baseline)
+ left = ((float) (allocated - baseline))
+ / (1.F - reqs.alignment) * reqs.alignment;
+
+ spanAndOffset[0] = (int) (left / reqs.alignment);
+ spanAndOffset[1] = (int) (baseline - spanAndOffset[0] * reqs.alignment);
}
/**
diff --git a/libjava/classpath/javax/swing/SizeSequence.java b/libjava/classpath/javax/swing/SizeSequence.java
index cf6e5f042a1..dff966b3e35 100644
--- a/libjava/classpath/javax/swing/SizeSequence.java
+++ b/libjava/classpath/javax/swing/SizeSequence.java
@@ -42,208 +42,197 @@ package javax.swing;
* @author Andrew Selkirk
* @version 1.0
*/
-public class SizeSequence {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * sizes
- */
- private int[] sizes = new int[0];
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor SizeSequence
- */
- public SizeSequence() {
- sizes = new int[0];
- } // SizeSequence()
-
- /**
- * Constructor SizeSequence
- * @param numEntries TODO
- */
- public SizeSequence(int numEntries) {
- this(numEntries, 0);
- } // SizeSequence()
-
- /**
- * Constructor SizeSequence
- * @param numEntries TODO
- * @param value TODO
- */
- public SizeSequence(int numEntries, int value) {
- insertEntries(0, numEntries, value);
- } // SizeSequence()
-
- /**
- * Constructor SizeSequence
- * @param sizes TODO
- */
- public SizeSequence(int[] sizes) {
- setSizes(sizes);
- } // SizeSequence()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * setSize
- * @param index TODO
- * @param size TODO
- */
- public void setSize(int index, int size) {
- sizes[index] = size;
- } // setSize()
-
- /**
- * getIndex
- * @param position TODO
- * @returns int
- */
- public int getIndex(int position) {
- return 0; // TODO
- } // getIndex()
-
- /**
- * getSize
- * @param index TODO
- * @returns int
- */
- public int getSize(int index) {
- return sizes[index];
- } // getSize()
-
- /**
- * setSizes
- * @param sizes TODO
- */
- public void setSizes(int[] sizes) {
-
- // Variables
- int index;
-
- // Initialize Sizes
- this.sizes = new int[sizes.length];
- for (index = 0; index < sizes.length; index++) {
- this.sizes[index] = sizes[index];
- } // for
-
- } // setSizes()
-
- /**
- * getSizes
- * @returns int[]
- */
- public int[] getSizes() {
-
- // Variables
- int[] array;
- int index;
-
- // Create New Array
- array = new int[sizes.length];
- for (index = 0; index < sizes.length; index++) {
- array[index] = sizes[index];
- } // for
-
- // Return Newly created array
- return array;
-
- } // getSizes()
-
- /**
- * getPosition
- * @param index TODO
- * @returns int
- */
- public int getPosition(int index) {
-
- // Variables
- int position;
- int loop;
-
- // Process Sizes
- position = 0;
- for (loop = 0; loop < index; loop++) {
- position += sizes[loop];
- } // for
-
- // Return Position
- return position;
-
- } // getPosition()
-
- /**
- * insertEntries
- * @param start TODO
- * @param length TODO
- * @param value TODO
- */
- public void insertEntries(int start, int length, int value) {
-
- // Variables
- int[] array;
- int index;
- int arrayIndex;
- int loop;
-
- // Create New Array
- array = new int[sizes.length + length];
- arrayIndex = 0;
- for (index = 0; index < sizes.length; index++) {
- if (index == start) {
- for (loop = 0; loop < length; loop++) {
- array[arrayIndex] = value;
- arrayIndex++;
- } // for
- } else {
- array[arrayIndex] = sizes[index];
- arrayIndex++;
- } // if
- } // for
-
- } // insertEntries()
-
- /**
- * removeEntries
- * @param start TODO
- * @param length TODO
- */
- public void removeEntries(int start, int length) {
-
- // Variables
- int[] array;
- int index;
- int arrayIndex;
-
- // Sanity Check
- if ((start + length) > sizes.length) {
- throw new IllegalArgumentException("Specified start/length that " +
- "is greater than available sizes");
- } // if
-
- // Create New Array
- array = new int[sizes.length - length];
- arrayIndex = 0;
- for (index = 0; index < sizes.length; index++) {
- if (index == start) {
- index += length - 1;
- } else {
- array[arrayIndex] = sizes[index];
- arrayIndex++;
- } // if
- } // for
-
- } // removeEntries()
-
-
-} // SizeSequence
+public class SizeSequence
+{
+
+ /**
+ * sizes
+ */
+ private int[] sizes = new int[0];
+
+ /**
+ * Constructor SizeSequence
+ */
+ public SizeSequence()
+ {
+ sizes = new int[0];
+ }
+
+ /**
+ * Constructor SizeSequence
+ * @param numEntries TODO
+ */
+ public SizeSequence(int numEntries)
+ {
+ this(numEntries, 0);
+ }
+
+ /**
+ * Constructor SizeSequence
+ * @param numEntries TODO
+ * @param value TODO
+ */
+ public SizeSequence(int numEntries, int value)
+ {
+ insertEntries(0, numEntries, value);
+ }
+
+ /**
+ * Constructor SizeSequence
+ * @param sizes TODO
+ */
+ public SizeSequence(int[] sizes)
+ {
+ setSizes(sizes);
+ }
+
+ /**
+ * setSize
+ * @param index TODO
+ * @param size TODO
+ */
+ public void setSize(int index, int size)
+ {
+ sizes[index] = size;
+ }
+
+ /**
+ * getIndex
+ * @param position TODO
+ * @returns int
+ */
+ public int getIndex(int position)
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * getSize
+ * @param index TODO
+ * @returns int
+ */
+ public int getSize(int index)
+ {
+ return sizes[index];
+ }
+
+ /**
+ * setSizes
+ * @param sizes TODO
+ */
+ public void setSizes(int[] sizes)
+ {
+ int index;
+ // Initialize sizes.
+ this.sizes = new int[sizes.length];
+ for (index = 0; index < sizes.length; index++)
+ this.sizes[index] = sizes[index];
+
+ }
+
+ /**
+ * getSizes
+ * @returns int[]
+ */
+ public int[] getSizes()
+ {
+ int[] array;
+ int index;
+
+ // Create new array.
+ array = new int[sizes.length];
+ for (index = 0; index < sizes.length; index++)
+ array[index] = sizes[index];
+
+ // Return newly created array.
+ return array;
+
+ }
+
+ /**
+ * getPosition
+ * @param index TODO
+ * @returns int
+ */
+ public int getPosition(int index)
+ {
+ int position;
+ int loop;
+
+ // Process sizes.
+ position = 0;
+ for (loop = 0; loop < index; loop++)
+ position += sizes[loop];
+
+ // Return position.
+ return position;
+
+ }
+
+ /**
+ * insertEntries
+ * @param start TODO
+ * @param length TODO
+ * @param value TODO
+ */
+ public void insertEntries(int start, int length, int value)
+ {
+ int[] array;
+ int index;
+ int arrayIndex;
+ int loop;
+
+ // Create new array.
+ array = new int[sizes.length + length];
+ arrayIndex = 0;
+ for (index = 0; index < sizes.length; index++)
+ {
+ if (index == start)
+ {
+ for (loop = 0; loop < length; loop++)
+ {
+ array[arrayIndex] = value;
+ arrayIndex++;
+ }
+ }
+ else
+ {
+ array[arrayIndex] = sizes[index];
+ arrayIndex++;
+ }
+ }
+
+ }
+
+ /**
+ * removeEntries
+ * @param start TODO
+ * @param length TODO
+ */
+ public void removeEntries(int start, int length)
+ {
+ int[] array;
+ int index;
+ int arrayIndex;
+
+ // Sanity check.
+ if ((start + length) > sizes.length)
+ throw new IllegalArgumentException("Specified start/length that "
+ + "is greater than available sizes");
+
+ // Create new array.
+ array = new int[sizes.length - length];
+ arrayIndex = 0;
+ for (index = 0; index < sizes.length; index++)
+ {
+ if (index == start)
+ index += length - 1;
+ else
+ {
+ array[arrayIndex] = sizes[index];
+ arrayIndex++;
+ }
+ }
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java b/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java
index fada17c6339..96ef3832955 100644
--- a/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java
+++ b/libjava/classpath/javax/swing/SortingFocusTraversalPolicy.java
@@ -72,7 +72,7 @@ public class SortingFocusTraversalPolicy
* simply advance within the containing focus cycle, subject to the
* {@link #comparator} order and the {@link #accept} judgment.</p>
*
- * @see #getNextFocusableComponent
+ * @see #getImplicitDownCycleTraversal()
*/
boolean implicitDownCycleTraversal = true;
diff --git a/libjava/classpath/javax/swing/SpinnerListModel.java b/libjava/classpath/javax/swing/SpinnerListModel.java
index 85dc4efa6f1..d8e2f22d585 100644
--- a/libjava/classpath/javax/swing/SpinnerListModel.java
+++ b/libjava/classpath/javax/swing/SpinnerListModel.java
@@ -68,231 +68,228 @@ import javax.swing.event.ChangeEvent;
* @since 1.4
*/
-public class SpinnerListModel
- extends AbstractSpinnerModel
- implements Serializable
+public class SpinnerListModel extends AbstractSpinnerModel
+ implements Serializable
{
- /**
- * For compatability with Sun's JDK
- */
- private static final long serialVersionUID = 3358804052191994516L;
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 3358804052191994516L;
- /**
- * The backing list for this model.
- */
- private List list;
+ /**
+ * The backing list for this model.
+ */
+ private List list;
- /**
- * The current index in the list.
- */
- private transient int index;
+ /**
+ * The current index in the list.
+ */
+ private transient int index;
- /**
- * Constructs a default <code>SpinnerListModel</code>. This
- * is a model backed by a list containing only the single
- * <code>String</code> element, "empty".
- */
- public SpinnerListModel()
- {
- List defaultList;
+ /**
+ * Constructs a default <code>SpinnerListModel</code>. This
+ * is a model backed by a list containing only the single
+ * <code>String</code> element, "empty".
+ */
+ public SpinnerListModel()
+ {
+ List defaultList;
- /* Create an empty list */
- defaultList = new ArrayList();
- /* Add the string "empty" */
- defaultList.add("empty");
- /* Set the list */
- setList(defaultList);
- }
+ // Create an empty list.
+ defaultList = new ArrayList();
+ // Add the string "empty".
+ defaultList.add("empty");
+ // Set the list.
+ setList(defaultList);
+ }
- /**
- * Constructs a <code>SpinnerListModel</code> using the supplied list.
- * The model maintains a reference to this list, and returns
- * consecutive elements in response to calls to <code>getNextValue()</code>.
- * The initial value is that at position 0, so an initial call
- * to <code>getValue()</code> returns the same as <code>list.get(0)</code>.
- *
- * @param list The list to use for this model.
- * @throws IllegalArgumentException if the list is null or contains no
- * elements.
- * @see SpinnerListModel#getNextValue()
- * @see SpinnerListModel#getValue()
- */
- public SpinnerListModel(List list)
- {
- /* Retain a reference to the valid list */
- setList(list);
- }
+ /**
+ * Constructs a <code>SpinnerListModel</code> using the supplied list.
+ * The model maintains a reference to this list, and returns
+ * consecutive elements in response to calls to <code>getNextValue()</code>.
+ * The initial value is that at position 0, so an initial call
+ * to <code>getValue()</code> returns the same as <code>list.get(0)</code>.
+ *
+ * @param list The list to use for this model.
+ *
+ * @throws IllegalArgumentException if the list is null or contains no
+ * elements.
+ *
+ * @see SpinnerListModel#getNextValue()
+ * @see SpinnerListModel#getValue()
+ */
+ public SpinnerListModel(List list)
+ {
+ // Retain a reference to the valid list.
+ setList(list);
+ }
- /**
- * Constructs a <code>SpinnerListModel</code> using the supplied array.
- * The model stores a reference to the wrapper list returned by
- * <code>Arrays.asList()</code>. The wrapper list reflects modifications
- * in the underlying array, so these changes will also be reflected
- * by the model. The model produces consecutive elements from the array
- * in response to calls to <code>getNextValue()</code>. The initial
- * value returned by <code>getValue()</code> is the same as
- * <code>array[0]</code>.
- *
- * @param array The array to use for this model.
- * @throws IllegalArgumentException if the array is null or contains
- * no elements.
- * @see Arrays#asList(Object[])
- * @see SpinnerListModel#getNextValue()
- * @see SpinnerListModel#getValue()
- */
- public SpinnerListModel(Object[] array)
- {
- /* Check for a null or zero-sized array */
- if (array == null || array.length == 0)
- {
- throw new IllegalArgumentException("The supplied array was invalid.");
- }
- /*
- Retain a reference to a wrapper around the valid array
- The array, in list form, will be tested again here, but we can't really
- avoid this -- a null value to Arrays.asList will throw a NullPointerException
- */
- setList(Arrays.asList(array));
- }
+ /**
+ * Constructs a <code>SpinnerListModel</code> using the supplied array.
+ * The model stores a reference to the wrapper list returned by
+ * <code>Arrays.asList()</code>. The wrapper list reflects modifications
+ * in the underlying array, so these changes will also be reflected
+ * by the model. The model produces consecutive elements from the array
+ * in response to calls to <code>getNextValue()</code>. The initial
+ * value returned by <code>getValue()</code> is the same as
+ * <code>array[0]</code>.
+ *
+ * @param array The array to use for this model.
+ *
+ * @throws IllegalArgumentException if the array is null or contains
+ * no elements.
+ *
+ * @see Arrays#asList(Object[])
+ * @see SpinnerListModel#getNextValue()
+ * @see SpinnerListModel#getValue()
+ */
+ public SpinnerListModel(Object[] array)
+ {
+ // Check for a null or zero-sized array.
+ if (array == null || array.length == 0)
+ {
+ throw new IllegalArgumentException("The supplied array was invalid.");
+ }
- /**
- * Returns the backing list for this model.
- *
- * @return The backing list.
- */
- public List getList()
- {
- return list;
- }
+ // Retain a reference to a wrapper around the valid array.
+ // The array, in list form, will be tested again here, but we can't really
+ // avoid this -- a null value to Arrays.asList will throw a
+ // NullPointerException.
+ setList(Arrays.asList(array));
+ }
+
+ /**
+ * Returns the backing list for this model.
+ *
+ * @return The backing list.
+ */
+ public List getList()
+ {
+ return list;
+ }
- /**
- * Returns the next value from the list, which is the same as the element
- * stored at the current index + 1. Null is returned if there are no more
- * values to be returned (the end of the list has been reached). An
- * ambiguity can occur here, as null may also be returned as a valid list
- * element. This operation does not change the current value.
- *
- * @return The next value from the list or null.
- */
- public Object getNextValue()
- {
- /* Check for a next value */
- if (index < (list.size() - 1))
- {
- /* Return the element at the next index */
- return list.get(index + 1);
- }
- else
- {
- /* Return null as this is the end of the list */
- return null;
- }
+ /**
+ * Returns the next value from the list, which is the same as the element
+ * stored at the current index + 1. Null is returned if there are no more
+ * values to be returned (the end of the list has been reached). An
+ * ambiguity can occur here, as null may also be returned as a valid list
+ * element. This operation does not change the current value.
+ *
+ * @return The next value from the list or null.
+ */
+ public Object getNextValue()
+ {
+ // Check for a next value.
+ if (index < (list.size() - 1))
+ // Return the element at the next index.
+ return list.get(index + 1);
+ else
+ // Return null as this is the end of the list.
+ return null;
}
- /**
- * Returns the previous value from the list, which is the same as the element
- * stored at the current index - 1. Null is returned if there are no more
- * values to be returned (the start of the list has been reached). An
- * ambiguity can occur here, as null may also be returned as a valid list
- * element. This operation does not change the current value.
- *
- * @return The previous value from the list or null.
- */
- public Object getPreviousValue()
- {
- /* Check for a previous value. */
- if (index > 0)
- {
- /* Return the element at the previous position */
- return list.get(index - 1);
- }
+ /**
+ * Returns the previous value from the list, which is the same as the element
+ * stored at the current index - 1. Null is returned if there are no more
+ * values to be returned (the start of the list has been reached). An
+ * ambiguity can occur here, as null may also be returned as a valid list
+ * element. This operation does not change the current value.
+ *
+ * @return The previous value from the list or null.
+ */
+ public Object getPreviousValue()
+ {
+ // Check for a previous value.
+ if (index > 0)
+ // Return the element at the previous position.
+ return list.get(index - 1);
else
- {
- /* Return null as this is the start of the list */
- return null;
- }
+ // Return null as this is the start of the list.
+ return null;
}
- /**
- * Returns the current value of the model. Initially, this will
- * be the element at position 0. On later invocations, this will
- * be the last element returned by <code>getNextValue()</code>
- * or <code>getPreviousValue()</code>.
- *
- * @return The current value.
- * @see SpinnerListModel#getPreviousValue()
- * @see SpinnerListModel#getNextValue()
- */
- public Object getValue()
- {
- return list.get(index);
- }
+ /**
+ * Returns the current value of the model. Initially, this will
+ * be the element at position 0. On later invocations, this will
+ * be the last element returned by <code>getNextValue()</code>
+ * or <code>getPreviousValue()</code>.
+ *
+ * @return The current value.
+ *
+ * @see SpinnerListModel#getPreviousValue()
+ * @see SpinnerListModel#getNextValue()
+ */
+ public Object getValue()
+ {
+ return list.get(index);
+ }
- /**
- * Changes the backing list for this model. The model only stores
- * a reference to the list, so any changes made to the list elsewhere
- * will be reflected in the values returned by the model. A
- * <code>ChangeEvent</code> is fired if the list being used actually
- * changes (i.e. the new list is not referentially equal (!=) to the
- * old one).
- *
- * @param list The new list to use.
- * @throws IllegalArgumentException if the list is null or contains
- * no elements.
- * @see ChangeEvent
- */
- public void setList(List list)
- {
- /* Check for null or zero size list */
- if (list == null || list.size() == 0)
- {
- throw new IllegalArgumentException("The supplied list was invalid.");
- }
- /* Check for a change of referenced list */
- if (this.list != list)
- {
- /* Store the new list */
- this.list = list;
- /* Notify listeners of a change */
- fireStateChanged();
- }
- /* We reset the other values in either case */
- /* Set the index to 0 */
- index = 0;
- }
+ /**
+ * Changes the backing list for this model. The model only stores
+ * a reference to the list, so any changes made to the list elsewhere
+ * will be reflected in the values returned by the model. A
+ * <code>ChangeEvent</code> is fired if the list being used actually
+ * changes (i.e. the new list is not referentially equal (!=) to the
+ * old one).
+ *
+ * @param list The new list to use.
+ *
+ * @throws IllegalArgumentException if the list is null or contains
+ * no elements.
+ *
+ * @see ChangeEvent
+ */
+ public void setList(List list)
+ {
+ // Check for null or zero size list.
+ if (list == null || list.size() == 0)
+ throw new IllegalArgumentException("The supplied list was invalid.");
- /**
- * Sets the current value of the model to be the one supplied.
- * The value must exist within the backing list in order for
- * the change to take place. Otherwise, an exception is thrown.
- * The value used is the first occurrence of the value within
- * the backing list. Listeners are notified of this change.
- * Following the change, <code>getNextValue()</code> and
- * <code>getPreviousValue()</code> return the objects following
- * and prior to the supplied value, respectively.
- *
- * @param value The requested new value of the list.
- * @throws IllegalArgumentException if the supplied value does
- * not exist in the backing list.
- * @see SpinnerListModel#getPreviousValue()
- * @see SpinnerListModel#getNextValue()
- */
- public void setValue(Object value)
- {
- int valueIndex;
+ // Check for a change of referenced list.
+ if (this.list != list)
+ {
+ // Store the new list.
+ this.list = list;
+ // Notify listeners of a change.
+ fireStateChanged();
+ }
+ // We reset the other values in either case.
+ // Set the index to 0.
+ index = 0;
+ }
- /* Search for the value in the list */
- valueIndex = list.indexOf(value);
- /* Check for the value being found */
- if (valueIndex == -1)
- {
- throw new IllegalArgumentException("The supplied value does not "
- + "exist in this list");
- }
- /* Make the indices match */
- index = valueIndex;
- /* Notify the listeners */
- fireStateChanged();
- }
+ /**
+ * Sets the current value of the model to be the one supplied.
+ * The value must exist within the backing list in order for
+ * the change to take place. Otherwise, an exception is thrown.
+ * The value used is the first occurrence of the value within
+ * the backing list. Listeners are notified of this change.
+ * Following the change, <code>getNextValue()</code> and
+ * <code>getPreviousValue()</code> return the objects following
+ * and prior to the supplied value, respectively.
+ *
+ * @param value The requested new value of the list.
+ *
+ * @throws IllegalArgumentException if the supplied value does
+ * not exist in the backing list.
+ *
+ * @see SpinnerListModel#getPreviousValue()
+ * @see SpinnerListModel#getNextValue()
+ */
+ public void setValue(Object value)
+ {
+ int valueIndex;
+
+ // Search for the value in the list.
+ valueIndex = list.indexOf(value);
+ // Check for the value being found.
+ if (valueIndex == -1)
+ throw new IllegalArgumentException("The supplied value does not "
+ + "exist in this list");
+ // Make the indices match.
+ index = valueIndex;
+ // Notify the listeners.
+ fireStateChanged();
+ }
}
diff --git a/libjava/classpath/javax/swing/Spring.java b/libjava/classpath/javax/swing/Spring.java
index 69c88c77d96..8f7105d496d 100644
--- a/libjava/classpath/javax/swing/Spring.java
+++ b/libjava/classpath/javax/swing/Spring.java
@@ -65,6 +65,7 @@ public abstract class Spring
*/
protected Spring()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/SpringLayout.java b/libjava/classpath/javax/swing/SpringLayout.java
index df9ddffb654..592cc0e02a9 100644
--- a/libjava/classpath/javax/swing/SpringLayout.java
+++ b/libjava/classpath/javax/swing/SpringLayout.java
@@ -395,46 +395,40 @@ public class SpringLayout implements LayoutManager2
public SpringLayout.Constraints getConstraints(Component c)
{
Constraints constraints = (Constraints) constraintsMap.get(c);
+
if (constraints == null)
{
Container parent = c.getParent();
constraints = new Constraints();
+
if (parent != null)
{
- constraints.setX
- (Spring.constant(parent.getInsets().left));
- constraints.setY
- (Spring.constant(parent.getInsets().top));
+ constraints.setX(Spring.constant(parent.getInsets().left));
+ constraints.setY(Spring.constant(parent.getInsets().top));
}
else
{
- constraints.setX
- (Spring.constant(0));
- constraints.setY
- (Spring.constant(0));
-
+ constraints.setX(Spring.constant(0));
+ constraints.setY(Spring.constant(0));
}
- constraints.setWidth
- (Spring.constant(c.getMinimumSize().width,
- c.getPreferredSize().width,
- c.getMaximumSize().width));
- constraints.setHeight
- (Spring.constant(c.getMinimumSize().height,
- c.getPreferredSize().height,
- c.getMaximumSize().height));
-
- constraintsMap.put(c, constraints);
-
}
+ constraints.setWidth(Spring.constant(c.getMinimumSize().width,
+ c.getPreferredSize().width,
+ c.getMaximumSize().width));
+ constraints.setHeight(Spring.constant(c.getMinimumSize().height,
+ c.getPreferredSize().height,
+ c.getMaximumSize().height));
+ constraintsMap.put(c, constraints);
return constraints;
}
/**
* Returns the X alignment of the Container <code>p</code>.
- *
- * @param p the {@link java.awt.Container} for which to determine the X
- * alignment.
+ *
+ * @param p
+ * the {@link java.awt.Container} for which to determine the X
+ * alignment.
* @return always 0.0
*/
public float getLayoutAlignmentX(Container p)
@@ -480,6 +474,7 @@ public class SpringLayout implements LayoutManager2
for (int index = 0; index < components.length; index++)
{
Component c = components[index];
+
Constraints constraints = getConstraints(c);
int x = constraints.getX().getValue();
int y = constraints.getY().getValue();
@@ -597,7 +592,6 @@ public class SpringLayout implements LayoutManager2
if (bottomEdge > maxY)
maxY = bottomEdge;
}
-
return new Dimension(maxX, maxY);
}
@@ -621,7 +615,6 @@ public class SpringLayout implements LayoutManager2
Spring strut = Spring.constant(pad);
Spring otherEdge = constraints2.getConstraint(e2);
constraints1.setConstraint(e1, Spring.sum(strut, otherEdge));
-
}
/**
diff --git a/libjava/classpath/javax/swing/SwingUtilities.java b/libjava/classpath/javax/swing/SwingUtilities.java
index ee5fa74d47a..58b3a78d7aa 100644
--- a/libjava/classpath/javax/swing/SwingUtilities.java
+++ b/libjava/classpath/javax/swing/SwingUtilities.java
@@ -840,7 +840,7 @@ public class SwingUtilities
iconR.width = icon.getIconWidth();
iconR.height = icon.getIconHeight();
}
- if (text == null)
+ if (text == null || text.equals(""))
{
textIconGap = 0;
textR.width = 0;
@@ -890,7 +890,7 @@ public class SwingUtilities
iconR.y = 0;
textR.y = (horizontalTextPosition == CENTER
? iconR.height + textIconGap
- : iconR.height - textR.height);
+ : Math.max(iconR.height - textR.height, 0));
break;
case CENTER:
int centerLine = Math.max(textR.height, iconR.height) / 2;
@@ -1116,7 +1116,7 @@ public class SwingUtilities
* <pre>
* [{@link javax.swing.JComponent#getActionMap()}]
* --&gt; [{@link javax.swing.ActionMap}]
- * parent --&gt; [{@link javax.swing.text.KeymapActionMap}]
+ * parent --&gt; [{@link javax.swing.text.JTextComponent.KeymapActionMap}]
* parent --&gt; [{@link javax.swing.plaf.ActionMapUIResource}]
* </pre>
*
@@ -1138,14 +1138,12 @@ public class SwingUtilities
else
{
ActionMap parent = child.getParent();
- while(parent != null)
+ while (parent != null && !(parent instanceof ActionMapUIResource))
{
child = parent;
parent = child.getParent();
}
-
- if (child != null)
- child.setParent(uiActionMap);
+ child.setParent(uiActionMap);
}
}
@@ -1159,7 +1157,7 @@ public class SwingUtilities
* <pre>
* [{@link javax.swing.JComponent#getInputMap()}]
* --&gt; [{@link javax.swing.InputMap}]
- * parent --&gt; [{@link javax.swing.text.KeymapWrapper}]
+ * parent --&gt; [{@link javax.swing.text.JTextComponent.KeymapWrapper}]
* parent --&gt; [{@link javax.swing.plaf.InputMapUIResource}]
* </pre>
*
@@ -1181,11 +1179,13 @@ public class SwingUtilities
component.setInputMap(condition, uiInputMap);
else
{
- while(child.getParent() != null
- && !(child.getParent() instanceof InputMapUIResource))
- child = child.getParent();
- if (child != null)
- child.setParent(uiInputMap);
+ InputMap parent = child.getParent();
+ while (parent != null && !(parent instanceof InputMapUIResource))
+ {
+ child = parent;
+ parent = parent.getParent();
+ }
+ child.setParent(uiInputMap);
}
}
diff --git a/libjava/classpath/javax/swing/Timer.java b/libjava/classpath/javax/swing/Timer.java
index 87f420a4367..cf91c23e8ec 100644
--- a/libjava/classpath/javax/swing/Timer.java
+++ b/libjava/classpath/javax/swing/Timer.java
@@ -46,7 +46,12 @@ import java.util.EventListener;
import javax.swing.event.EventListenerList;
/**
- * Fires one or more action events after the specified delay.
+ * Fires one or more action events after the specified delay. This is
+ * a specialised version of <code>java.util.Timer</code> just for
+ * firing <code>ActionEvent</code>s. All Timers share one (daemon)
+ * Thread (or java.util.Timer). All events are fired from the event
+ * queue.
+ *
* @author Ronald Veldema
* @author Audrius Meskauskas (audriusa@Bionformatics.org) - bug fixes
* and documentation comments
@@ -55,48 +60,19 @@ public class Timer
implements Serializable
{
/**
- * The timer thread
+ * Given to the shared java.util.Timer to (possibly repeatedly) call
+ * queueEvent().
*/
- private class Waker
- extends Thread
+ private class Task extends java.util.TimerTask
{
- /**
- * Fires events, pausing for required intervals.
- */
public void run()
{
- running = true;
- try
- {
- sleep(initialDelay);
-
- queueEvent();
-
- while (running)
- {
- try
- {
- sleep(delay);
- }
- catch (InterruptedException e)
- {
- return;
- }
- queueEvent();
-
- if (logTimers)
- System.out.println("javax.swing.Timer -> clocktick");
-
- if ( ! repeats)
- break;
- }
- running = false;
- }
- catch (Exception e)
- {
- // The timer is no longer running.
- running = false;
- }
+ if (logTimers)
+ System.out.println("javax.swing.Timer -> queueEvent()");
+ queueEvent();
+
+ if (!repeats)
+ task = null;
}
}
@@ -118,6 +94,14 @@ public class Timer
};
/**
+ * The static java.util.Timer daemon which will be used to schedule
+ * all javax.swing.Timer.Task objects. The daemon will always be
+ * running, even if there's no task scheduled in it.
+ */
+ private static java.util.Timer timer = new java.util.Timer("swing.Timer",
+ true);
+
+ /**
* If <code>true</code>, the timer prints a message to
* {@link System#out} when firing each event.
*/
@@ -139,12 +123,6 @@ public class Timer
boolean repeats = true;
/**
- * <code>true</code> if the timer is currently active, firing events
- * as scheduled.
- */
- boolean running;
-
- /**
* The delay between subsequent repetetive events.
*/
int delay;
@@ -162,10 +140,9 @@ public class Timer
int ticks;
/**
- * Stores the thread that posts events to the queue at required time
- * intervals.
+ * The task that calls queueEvent(). When null this Timer is stopped.
*/
- private Waker waker;
+ private Task task;
/**
* This object manages a "queue" of virtual actionEvents, maintained as a
@@ -360,7 +337,7 @@ public class Timer
*/
public boolean isRunning()
{
- return running;
+ return task != null;
}
/**
@@ -398,10 +375,16 @@ public class Timer
*/
public void start()
{
- if (isRunning())
- return;
- waker = new Waker();
- waker.start();
+ Task t = task;
+ if (t == null)
+ {
+ t = new Task();
+ if (isRepeats())
+ timer.schedule(t, getInitialDelay(), getDelay());
+ else
+ timer.schedule(t, getInitialDelay());
+ task = t;
+ }
}
/**
@@ -409,12 +392,11 @@ public class Timer
*/
public void stop()
{
- running = false;
- if (waker != null)
- waker.interrupt();
- synchronized (queueLock)
+ Task t = task;
+ if (t != null)
{
- queue = 0;
+ t.cancel();
+ task = null;
}
}
@@ -475,11 +457,11 @@ public class Timer
*/
void queueEvent()
{
- synchronized (queueLock)
+ synchronized(queueLock)
{
- queue++;
- if (queue == 1)
- SwingUtilities.invokeLater(drainer);
+ queue++;
+ if (queue == 1)
+ SwingUtilities.invokeLater(drainer);
}
}
}
diff --git a/libjava/classpath/javax/swing/ToolTipManager.java b/libjava/classpath/javax/swing/ToolTipManager.java
index 61693763898..289149fb603 100644
--- a/libjava/classpath/javax/swing/ToolTipManager.java
+++ b/libjava/classpath/javax/swing/ToolTipManager.java
@@ -44,7 +44,6 @@ import java.awt.FlowLayout;
import java.awt.LayoutManager;
import java.awt.Panel;
import java.awt.Point;
-import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@@ -68,6 +67,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
protected stillInsideTimerAction()
{
+ // Nothing to do here.
}
/**
@@ -93,6 +93,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
protected outsideTimerAction()
{
+ // Nothing to do here.
}
/**
@@ -103,6 +104,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
public void actionPerformed(ActionEvent event)
{
+ // TODO: What should be done here, if anything?
}
}
@@ -118,6 +120,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
protected insideTimerAction()
{
+ // Nothing to do here.
}
/**
@@ -129,8 +132,6 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
public void actionPerformed(ActionEvent event)
{
showTip();
- if (insideTimer != null)
- insideTimer.start();
}
}
@@ -172,18 +173,9 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
/** The last known position of the mouse cursor. */
private static Point currentPoint;
-
- /**
- * The panel that holds the tooltip when the tooltip is displayed fully
- * inside the current container.
- */
- private static Container containerPanel;
-
- /**
- * The window used when the tooltip doesn't fit inside the current
- * container.
- */
- private static JWindow tooltipWindow;
+
+ /** */
+ private static Popup popup;
/**
* Creates a new ToolTipManager and sets up the timers.
@@ -368,27 +360,27 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
&& getContentPaneDeepestComponent(event) == currentComponent)
return;
currentPoint = event.getPoint();
+
currentComponent = (Component) event.getSource();
if (exitTimer.isRunning())
{
- exitTimer.stop();
- showTip();
- insideTimer.start();
- return;
+ exitTimer.stop();
+ showTip();
+ return;
}
-
// This should always be stopped unless we have just fake-exited.
- if (! enterTimer.isRunning())
+ if (!enterTimer.isRunning())
enterTimer.start();
}
/**
- * This method is called when the mouse exits a JComponent registered with
- * the ToolTipManager. When the mouse exits, the tooltip should be hidden
+ * This method is called when the mouse exits a JComponent registered with the
+ * ToolTipManager. When the mouse exits, the tooltip should be hidden
* immediately.
- *
- * @param event The MouseEvent.
+ *
+ * @param event
+ * The MouseEvent.
*/
public void mouseExited(MouseEvent event)
{
@@ -399,7 +391,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
currentComponent = null;
hideTip();
- if (! enterTimer.isRunning() && insideTimer.isRunning())
+ if (! enterTimer.isRunning())
exitTimer.start();
if (enterTimer.isRunning())
enterTimer.stop();
@@ -424,13 +416,6 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
insideTimer.stop();
hideTip();
}
-
- if (currentComponent == null)
- currentComponent = (Component) event.getSource();
-
- currentComponent.invalidate();
- currentComponent.validate();
- currentComponent.repaint();
}
/**
@@ -455,16 +440,8 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
public void mouseMoved(MouseEvent event)
{
currentPoint = event.getPoint();
- if (currentTip != null)
- {
- if (currentComponent == null)
- currentComponent = (Component) event.getSource();
-
- String text = ((JComponent) currentComponent).getToolTipText(event);
- currentTip.setTipText(text);
- }
if (enterTimer.isRunning())
- enterTimer.restart();
+ enterTimer.restart();
}
/**
@@ -474,130 +451,69 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
void showTip()
{
- if (! enabled || currentComponent == null)
- return;
+ if (!enabled || currentComponent == null || !currentComponent.isEnabled()
+ || !currentComponent.isShowing())
+ {
+ popup = null;
+ return;
+ }
- if (currentTip == null
- || currentTip.getComponent() != currentComponent
+ if (currentTip == null || currentTip.getComponent() != currentComponent
&& currentComponent instanceof JComponent)
currentTip = ((JComponent) currentComponent).createToolTip();
+
Point p = currentPoint;
+ Point cP = currentComponent.getLocationOnScreen();
Dimension dims = currentTip.getPreferredSize();
- if (canToolTipFit(currentTip))
- {
- JLayeredPane pane = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class,
- currentComponent))
- .getLayeredPane();
-
- // This should never happen, but just in case.
- if (pane == null)
- return;
-
- if (containerPanel != null)
- hideTip();
- if (isLightWeightPopupEnabled())
- {
- containerPanel = new Panel();
- JRootPane root = new JRootPane();
- root.getContentPane().add(currentTip);
- containerPanel.add(root);
- }
- else
- {
- containerPanel = new JPanel();
- containerPanel.add(currentTip);
- }
- LayoutManager lm = containerPanel.getLayout();
- if (lm instanceof FlowLayout)
- {
- FlowLayout fm = (FlowLayout) lm;
- fm.setVgap(0);
- fm.setHgap(0);
- }
-
- p = getGoodPoint(p, pane, currentTip, dims);
-
- pane.add(containerPanel);
- containerPanel.setBounds(p.x, p.y, dims.width, dims.height);
- currentTip.setBounds(0, 0, dims.width, dims.height);
-
- pane.revalidate();
- pane.repaint();
- }
- else
- {
- SwingUtilities.convertPointToScreen(p, currentComponent);
- tooltipWindow = new JWindow();
- tooltipWindow.getContentPane().add(currentTip);
- tooltipWindow.setFocusable(false);
- tooltipWindow.pack();
- tooltipWindow.setBounds(p.x, p.y, dims.width, dims.height);
- tooltipWindow.show();
- }
- currentTip.setVisible(true);
+
+ JLayeredPane pane = null;
+ JRootPane r = ((JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class,
+ currentComponent));
+ if (r != null)
+ pane = r.getLayeredPane();
+ if (pane == null)
+ return;
+
+ p.translate(cP.x, cP.y);
+ adjustLocation(p, pane, dims);
+
+ currentTip.setBounds(0, 0, dims.width, dims.height);
+
+ PopupFactory factory = PopupFactory.getSharedInstance();
+ popup = factory.getPopup(currentComponent, currentTip, p.x, p.y);
+ popup.show();
}
/**
- * This method hides the ToolTip.
- * This is package-private to avoid an accessor method.
+ * Adjusts the point to a new location on the component,
+ * using the currentTip's dimensions.
+ *
+ * @param p - the point to convert.
+ * @param c - the component the point is on.
+ * @param d - the dimensions of the currentTip.
*/
- void hideTip()
+ private Point adjustLocation(Point p, Component c, Dimension d)
{
- if (currentTip == null || ! currentTip.isVisible() || ! enabled)
- return;
- currentTip.setVisible(false);
- if (containerPanel != null)
- {
- Container parent = containerPanel.getParent();
- if (parent == null)
- return;
- parent.remove(containerPanel);
- parent.invalidate();
- parent.validate();
- parent.repaint();
-
- parent = currentTip.getParent();
- if (parent == null)
- return;
- parent.remove(currentTip);
-
- containerPanel = null;
- }
- if (tooltipWindow != null)
- {
- tooltipWindow.hide();
- tooltipWindow.dispose();
- tooltipWindow = null;
- }
+ if (p.x + d.width > c.getWidth())
+ p.x -= d.width;
+ if (p.x < 0)
+ p.x = 0;
+ if (p.y + d.height < c.getHeight())
+ p.y += d.height;
+ if (p.y + d.height > c.getHeight())
+ p.y -= d.height;
+
+ return p;
}
-
+
/**
- * This method returns a point in the LayeredPane where the ToolTip can be
- * shown. The point returned (if the ToolTip is to be displayed at the
- * preferred dimensions) will always place the ToolTip inside the
- * currentComponent if possible.
- *
- * @param p The last known good point for the mouse.
- * @param c The JLayeredPane in the first RootPaneContainer up from the
- * currentComponent.
- * @param tip The ToolTip to display.
- * @param dims The ToolTip preferred dimensions (can be null).
- *
- * @return A good point to place the ToolTip.
+ * This method hides the ToolTip.
+ * This is package-private to avoid an accessor method.
*/
- private Point getGoodPoint(Point p, JLayeredPane c, JToolTip tip,
- Dimension dims)
+ void hideTip()
{
- if (dims == null)
- dims = tip.getPreferredSize();
- Rectangle bounds = currentComponent.getBounds();
- if (p.x + dims.width > bounds.width)
- p.x = bounds.width - dims.width;
- if (p.y + dims.height > bounds.height)
- p.y = bounds.height - dims.height;
-
- p = SwingUtilities.convertPoint(currentComponent, p, c);
- return p;
+ if (popup != null)
+ popup.hide();
}
/**
@@ -622,25 +538,4 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
Component target = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y);
return target;
}
-
- /**
- * This method returns whether the ToolTip can fit in the first
- * RootPaneContainer up from the currentComponent.
- *
- * @param tip The ToolTip.
- *
- * @return Whether the ToolTip can fit.
- */
- private boolean canToolTipFit(JToolTip tip)
- {
- JRootPane root = (JRootPane) SwingUtilities.getAncestorOfClass(JRootPane.class,
- currentComponent);
- if (root == null)
- return false;
- Dimension pref = tip.getPreferredSize();
- Dimension rootSize = root.getSize();
- if (rootSize.width > pref.width && rootSize.height > pref.height)
- return true;
- return false;
- }
}
diff --git a/libjava/classpath/javax/swing/TransferHandler.java b/libjava/classpath/javax/swing/TransferHandler.java
index 96cb9d42abf..4828fdbfa98 100644
--- a/libjava/classpath/javax/swing/TransferHandler.java
+++ b/libjava/classpath/javax/swing/TransferHandler.java
@@ -75,30 +75,38 @@ public class TransferHandler implements Serializable
}
}
+ /**
+ * Get the system cliboard. If not available, create and return the VM-local
+ * clipboard.
+ *
+ * @param component a component, used to get the toolkit.
+ * @return the clipboard
+ */
private static Clipboard getClipboard(JComponent component)
{
- SecurityManager sm = System.getSecurityManager();
-
- if (sm != null)
- {
- try
- {
- sm.checkSystemClipboardAccess();
-
- // We may access system clipboard.
- return component.getToolkit().getSystemClipboard();
- }
- catch (SecurityException e)
- {
- // We may not access system clipboard.
- }
- }
-
- // Create VM-local clipboard if non exists yet.
- if (clipboard == null)
- clipboard = new Clipboard("Clipboard");
-
- return clipboard;
+ // Avoid throwing exception if the system clipboard access failed
+ // in the past.
+ if (clipboard != null)
+ return clipboard;
+ else
+ {
+ try
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkSystemClipboardAccess();
+
+ // We may access system clipboard.
+ return component.getToolkit().getSystemClipboard();
+ }
+ catch (Exception e)
+ {
+ // We may not access system clipboard.
+ // Create VM-local clipboard if none exists yet.
+ clipboard = new Clipboard("Clipboard");
+ return clipboard;
+ }
+ }
}
}
@@ -162,15 +170,18 @@ public class TransferHandler implements Serializable
}
public void exportAsDrag (JComponent c, InputEvent e, int action)
- {
+ {
+ // TODO: Implement this properly
}
protected void exportDone (JComponent c, Transferable data, int action)
{
+ // TODO: Implement this properly
}
public void exportToClipboard(JComponent c, Clipboard clip, int action)
{
+ // TODO: Implement this properly
}
public int getSourceActions (JComponent c)
diff --git a/libjava/classpath/javax/swing/UIDefaults.java b/libjava/classpath/javax/swing/UIDefaults.java
index ab78ca6442f..f6aee1b944c 100644
--- a/libjava/classpath/javax/swing/UIDefaults.java
+++ b/libjava/classpath/javax/swing/UIDefaults.java
@@ -577,8 +577,8 @@ public class UIDefaults extends Hashtable
*
* @param key the key to the requested entry
*
- * @return the boolean entry for <code>key</code> or null if no such entry
- * exists
+ * @return The boolean entry for <code>key</code> or <code>false</code> if no
+ * such entry exists.
*/
public boolean getBoolean(Object key)
{
@@ -674,9 +674,9 @@ public class UIDefaults extends Hashtable
return null;
try
{
- if (loader != null)
- return loader.loadClass (className);
- return Class.forName (className);
+ if (loader == null)
+ loader = ClassLoader.getSystemClassLoader();
+ return loader.loadClass (className);
}
catch (Exception e)
{
diff --git a/libjava/classpath/javax/swing/UIManager.java b/libjava/classpath/javax/swing/UIManager.java
index f4648f1e219..fbf1c7c79cb 100644
--- a/libjava/classpath/javax/swing/UIManager.java
+++ b/libjava/classpath/javax/swing/UIManager.java
@@ -132,6 +132,11 @@ public class UIManager implements Serializable
static UIDefaults currentUIDefaults;
+ /**
+ * UIDefaults set by the user.
+ */
+ static UIDefaults userUIDefaults;
+
/** Property change listener mechanism. */
static SwingPropertyChangeSupport listeners
= new SwingPropertyChangeSupport(UIManager.class);
@@ -146,19 +151,29 @@ public class UIManager implements Serializable
LookAndFeel laf = (LookAndFeel) lafClass.newInstance();
setLookAndFeel(laf);
}
+ else
+ {
+ setLookAndFeel(new MetalLookAndFeel());
+ }
}
catch (Exception ex)
{
System.err.println("cannot initialize Look and Feel: " + defaultlaf);
- System.err.println("error: " + ex.getMessage());
+ System.err.println("error: " + ex.toString());
System.err.println("falling back to Metal Look and Feel");
+ try
+ {
+ setLookAndFeel(new MetalLookAndFeel());
+ }
+ catch (Exception ex2)
+ {
+ throw (Error) new AssertionError("There must be no problem installing"
+ + " the MetalLookAndFeel.")
+ .initCause(ex2);
+ }
}
- currentLookAndFeel = new MetalLookAndFeel();
- currentLookAndFeel.initialize();
- currentUIDefaults = currentLookAndFeel.getDefaults();
-
}
-
+
/**
* Creates a new instance of the <code>UIManager</code>. There is no need
* to construct an instance of this class, since all methods are static.
@@ -295,7 +310,12 @@ public class UIManager implements Serializable
*/
public static Object get(Object key)
{
- return getLookAndFeelDefaults().get(key);
+ Object val = null;
+ if (userUIDefaults != null)
+ val = userUIDefaults.get(key);
+ if (val == null)
+ val = getLookAndFeelDefaults().get(key);
+ return val;
}
/**
@@ -308,7 +328,12 @@ public class UIManager implements Serializable
*/
public static Object get(Object key, Locale locale)
{
- return getLookAndFeelDefaults().get(key ,locale);
+ Object val = null;
+ if (userUIDefaults != null)
+ val = userUIDefaults.get(key, locale);
+ if (val == null)
+ val = getLookAndFeelDefaults().get(key, locale);
+ return val;
}
/**
@@ -319,7 +344,7 @@ public class UIManager implements Serializable
*/
public static boolean getBoolean(Object key)
{
- Boolean value = (Boolean) getLookAndFeelDefaults().get(key);
+ Boolean value = (Boolean) get(key);
return value != null ? value.booleanValue() : false;
}
@@ -331,7 +356,7 @@ public class UIManager implements Serializable
*/
public static boolean getBoolean(Object key, Locale locale)
{
- Boolean value = (Boolean) getLookAndFeelDefaults().get(key, locale);
+ Boolean value = (Boolean) get(key, locale);
return value != null ? value.booleanValue() : false;
}
@@ -340,7 +365,7 @@ public class UIManager implements Serializable
*/
public static Border getBorder(Object key)
{
- return (Border) getLookAndFeelDefaults().get(key);
+ return (Border) get(key);
}
/**
@@ -350,7 +375,7 @@ public class UIManager implements Serializable
*/
public static Border getBorder(Object key, Locale locale)
{
- return (Border) getLookAndFeelDefaults().get(key, locale);
+ return (Border) get(key, locale);
}
/**
@@ -358,7 +383,7 @@ public class UIManager implements Serializable
*/
public static Color getColor(Object key)
{
- return (Color) getLookAndFeelDefaults().get(key);
+ return (Color) get(key);
}
/**
@@ -366,7 +391,7 @@ public class UIManager implements Serializable
*/
public static Color getColor(Object key, Locale locale)
{
- return (Color) getLookAndFeelDefaults().get(key);
+ return (Color) get(key);
}
/**
@@ -395,7 +420,7 @@ public class UIManager implements Serializable
*/
public static Dimension getDimension(Object key)
{
- return (Dimension) getLookAndFeelDefaults().get(key);
+ return (Dimension) get(key);
}
/**
@@ -403,7 +428,7 @@ public class UIManager implements Serializable
*/
public static Dimension getDimension(Object key, Locale locale)
{
- return (Dimension) getLookAndFeelDefaults().get(key, locale);
+ return (Dimension) get(key, locale);
}
/**
@@ -416,7 +441,7 @@ public class UIManager implements Serializable
*/
public static Font getFont(Object key)
{
- return (Font) getLookAndFeelDefaults().get(key);
+ return (Font) get(key);
}
/**
@@ -429,7 +454,7 @@ public class UIManager implements Serializable
*/
public static Font getFont(Object key, Locale locale)
{
- return (Font) getLookAndFeelDefaults().get(key ,locale);
+ return (Font) get(key ,locale);
}
/**
@@ -437,7 +462,7 @@ public class UIManager implements Serializable
*/
public static Icon getIcon(Object key)
{
- return (Icon) getLookAndFeelDefaults().get(key);
+ return (Icon) get(key);
}
/**
@@ -445,7 +470,7 @@ public class UIManager implements Serializable
*/
public static Icon getIcon(Object key, Locale locale)
{
- return (Icon) getLookAndFeelDefaults().get(key, locale);
+ return (Icon) get(key, locale);
}
/**
@@ -453,7 +478,11 @@ public class UIManager implements Serializable
*/
public static Insets getInsets(Object key)
{
- return getLookAndFeelDefaults().getInsets(key);
+ Object o = get(key);
+ if (o instanceof Insets)
+ return (Insets) o;
+ else
+ return null;
}
/**
@@ -461,7 +490,11 @@ public class UIManager implements Serializable
*/
public static Insets getInsets(Object key, Locale locale)
{
- return getLookAndFeelDefaults().getInsets(key, locale);
+ Object o = get(key, locale);
+ if (o instanceof Insets)
+ return (Insets) o;
+ else
+ return null;
}
/**
@@ -477,7 +510,7 @@ public class UIManager implements Serializable
public static int getInt(Object key)
{
- Integer x = (Integer) getLookAndFeelDefaults().get(key);
+ Integer x = (Integer) get(key);
if (x == null)
return 0;
return x.intValue();
@@ -485,7 +518,7 @@ public class UIManager implements Serializable
public static int getInt(Object key, Locale locale)
{
- Integer x = (Integer) getLookAndFeelDefaults().get(key, locale);
+ Integer x = (Integer) get(key, locale);
if (x == null)
return 0;
return x.intValue();
@@ -519,7 +552,7 @@ public class UIManager implements Serializable
*/
public static String getString(Object key)
{
- return (String) getLookAndFeelDefaults().get(key);
+ return (String) get(key);
}
/**
@@ -527,7 +560,7 @@ public class UIManager implements Serializable
*/
public static String getString(Object key, Locale locale)
{
- return (String) getLookAndFeelDefaults().get(key, locale);
+ return (String) get(key, locale);
}
/**
@@ -552,7 +585,13 @@ public class UIManager implements Serializable
*/
public static ComponentUI getUI(JComponent target)
{
- return getLookAndFeelDefaults().getUI(target);
+ ComponentUI ui = null;
+ if (userUIDefaults != null
+ && userUIDefaults.get(target.getUIClassID()) != null)
+ ui = userUIDefaults.getUI(target);
+ if (ui == null)
+ ui = currentUIDefaults.getUI(target);
+ return ui;
}
/**
@@ -581,7 +620,11 @@ public class UIManager implements Serializable
*/
public static Object put(Object key, Object value)
{
- return getLookAndFeelDefaults().put(key,value);
+ Object old = get(key);
+ if (userUIDefaults == null)
+ userUIDefaults = new UIDefaults();
+ userUIDefaults.put(key, value);
+ return old;
}
/**
@@ -607,7 +650,6 @@ public class UIManager implements Serializable
{
if (newLookAndFeel != null && ! newLookAndFeel.isSupportedLookAndFeel())
throw new UnsupportedLookAndFeelException(newLookAndFeel.getName());
-
LookAndFeel oldLookAndFeel = currentLookAndFeel;
if (oldLookAndFeel != null)
oldLookAndFeel.uninitialize();
diff --git a/libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java b/libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java
index 5abe45fe117..f99c0ac19f7 100644
--- a/libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java
+++ b/libjava/classpath/javax/swing/UnsupportedLookAndFeelException.java
@@ -40,8 +40,8 @@ package javax.swing;
public class UnsupportedLookAndFeelException extends Exception
{
- public UnsupportedLookAndFeelException(String a)
- {
- super(a);
- }
+ public UnsupportedLookAndFeelException(String a)
+ {
+ super(a);
+ }
}
diff --git a/libjava/classpath/javax/swing/ViewportLayout.java b/libjava/classpath/javax/swing/ViewportLayout.java
index 19735839387..884f7cb27a8 100644
--- a/libjava/classpath/javax/swing/ViewportLayout.java
+++ b/libjava/classpath/javax/swing/ViewportLayout.java
@@ -56,12 +56,17 @@ public class ViewportLayout implements LayoutManager, Serializable
public ViewportLayout()
{
+ // Nothing to do here.
}
+
public void addLayoutComponent(String name, Component c)
{
+ // Nothing to do here.
}
+
public void removeLayoutComponent(Component c)
{
+ // Nothing to do here.
}
public Dimension preferredLayoutSize(Container parent)
diff --git a/libjava/classpath/javax/swing/WindowConstants.java b/libjava/classpath/javax/swing/WindowConstants.java
index 5e364434484..aaa0cb9a3ab 100644
--- a/libjava/classpath/javax/swing/WindowConstants.java
+++ b/libjava/classpath/javax/swing/WindowConstants.java
@@ -43,31 +43,26 @@ package javax.swing;
*
* @author Andrew Selkirk
*/
-public interface WindowConstants {
+public interface WindowConstants
+{
+ /**
+ * DO_NOTHING_ON_CLOSE
+ */
+ int DO_NOTHING_ON_CLOSE = 0;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
+ /**
+ * HIDE_ON_CLOSE
+ */
+ int HIDE_ON_CLOSE = 1;
- /**
- * DO_NOTHING_ON_CLOSE
- */
- int DO_NOTHING_ON_CLOSE = 0;
+ /**
+ * DISPOSE_ON_CLOSE
+ */
+ int DISPOSE_ON_CLOSE = 2;
- /**
- * HIDE_ON_CLOSE
- */
- int HIDE_ON_CLOSE = 1;
+ /**
+ * EXIT_ON_CLOSE
+ */
+ int EXIT_ON_CLOSE =3;
- /**
- * DISPOSE_ON_CLOSE
- */
- int DISPOSE_ON_CLOSE = 2;
-
- /**
- * EXIT_ON_CLOSE
- */
- int EXIT_ON_CLOSE =3;
-
-
-} // WindowConstants
+}
diff --git a/libjava/classpath/javax/swing/border/AbstractBorder.java b/libjava/classpath/javax/swing/border/AbstractBorder.java
index 951debd5207..7cbbcdaa83b 100644
--- a/libjava/classpath/javax/swing/border/AbstractBorder.java
+++ b/libjava/classpath/javax/swing/border/AbstractBorder.java
@@ -52,20 +52,18 @@ import java.io.Serializable;
* @author Sascha Brawer (brawer@dandelis.ch)
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public abstract class AbstractBorder
- implements Border, Serializable
+public abstract class AbstractBorder implements Border, Serializable
{
static final long serialVersionUID = -545885975315191844L;
-
/**
* Constructs a new AbstractBorder.
*/
- public AbstractBorder ()
+ public AbstractBorder()
{
+ // Nothing to do here.
}
-
/**
* Performs nothing, because the default implementation provided by
* this class is an invisible, zero-width border. Subclasses will
@@ -79,17 +77,15 @@ public abstract class AbstractBorder
* @param width the width of the available area for painting the border.
* @param height the height of the available area for painting the border.
*/
- public void paintBorder (Component c, Graphics g,
- int x, int y, int width, int height)
+ public void paintBorder(Component c, Graphics g, int x, int y, int width,
+ int height)
{
- /* A previous version of Classpath had emitted a warning when
- * this method was called. The warning was removed because it is
- * perfectly legal for a subclass to not override the paintBorder
- * method. An example would be EmptyBorder.
- */
+ // A previous version of Classpath had emitted a warning when
+ // this method was called. The warning was removed because it is
+ // perfectly legal for a subclass to not override the paintBorder
+ // method. An example would be EmptyBorder.
}
-
/**
* Measures the width of this border.
*
@@ -102,31 +98,29 @@ public abstract class AbstractBorder
*
* @see #getBorderInsets(java.awt.Component, java.awt.Insets)
*/
- public Insets getBorderInsets (Component c)
+ public Insets getBorderInsets(Component c)
{
- return new Insets (0, 0, 0, 0);
+ return new Insets(0, 0, 0, 0);
}
-
/**
* Determines the insets of this border. The implementation provided
* by AbstractButton sets the <code>left</code>, <code>right</code>,
* <code>top</code> and <code>bottom</code> fields of the passed
* <code>insets</code> parameter to zero.
*
- * @param c the component whose border is to be measured.
+ * @param c the component whose border is to be measured
*
- * @return the same object that was passed for <code>insets</code>.
+ * @return the same object that was passed for <code>insets</code>
*
* @see #getBorderInsets(Component)
*/
- public Insets getBorderInsets (Component c, Insets insets)
+ public Insets getBorderInsets(Component c, Insets insets)
{
insets.left = insets.right = insets.top = insets.bottom = 0;
return insets;
}
-
/**
* Determines whether or not this border is opaque. An opaque border
* fills every pixel in its area when painting. Partially
@@ -136,12 +130,11 @@ public abstract class AbstractBorder
*
* @return <code>false</code>.
*/
- public boolean isBorderOpaque ()
+ public boolean isBorderOpaque()
{
return false;
}
-
/**
* Returns a rectangle that covers the specified area minus this
* border. Components that wish to determine an area into which
@@ -154,12 +147,11 @@ public abstract class AbstractBorder
* @param width the width of the available area for the border.
* @param height the height of the available area for the border.
*/
- public Rectangle getInteriorRectangle (Component c,
- int x, int y, int width, int height)
+ public Rectangle getInteriorRectangle(Component c, int x, int y, int width,
+ int height)
{
return getInteriorRectangle (c, this, x, y, width, height);
}
-
/**
* Returns a rectangle that covers the specified area minus a
@@ -173,8 +165,8 @@ public abstract class AbstractBorder
* @param width the width of the available area for the border.
* @param height the height of the available area for the border.
*/
- public static Rectangle getInteriorRectangle (Component c, Border b,
- int x, int y, int width, int height)
+ public static Rectangle getInteriorRectangle(Component c, Border b, int x,
+ int y, int width, int height)
{
Insets borderInsets;
diff --git a/libjava/classpath/javax/swing/border/BevelBorder.java b/libjava/classpath/javax/swing/border/BevelBorder.java
index fcdc1c64675..45b758cae41 100644
--- a/libjava/classpath/javax/swing/border/BevelBorder.java
+++ b/libjava/classpath/javax/swing/border/BevelBorder.java
@@ -55,8 +55,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class BevelBorder
- extends AbstractBorder
+public class BevelBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -508,11 +507,11 @@ public class BevelBorder
* Paints a two-pixel bevel in four colors.
*
* <pre>
- * @@@@@@@@@@@@
- * @..........# @ = color a
- * @. X# . = color b
- * @. X# X = color c
- * @.XXXXXXXXX# # = color d
+ * ++++++++++++
+ * +..........# + = color a
+ * +. X# . = color b
+ * +. X# X = color c
+ * +.XXXXXXXXX# # = color d
* ############</pre>
*
* @param g the graphics for painting.
diff --git a/libjava/classpath/javax/swing/border/Border.java b/libjava/classpath/javax/swing/border/Border.java
index 11bddfe78b3..f4af3fb38bb 100644
--- a/libjava/classpath/javax/swing/border/Border.java
+++ b/libjava/classpath/javax/swing/border/Border.java
@@ -77,9 +77,8 @@ public interface Border
* @param width the width of the available area for painting the border.
* @param height the height of the available area for painting the border.
*/
- void paintBorder(Component c, Graphics g,
- int x, int y, int width, int height);
-
+ void paintBorder(Component c, Graphics g, int x, int y, int width,
+ int height);
/**
* Measures the width of this border.
@@ -92,7 +91,6 @@ public interface Border
*/
Insets getBorderInsets(Component c);
-
/**
* Determines whether this border fills every pixel in its area
* when painting.
diff --git a/libjava/classpath/javax/swing/border/CompoundBorder.java b/libjava/classpath/javax/swing/border/CompoundBorder.java
index 2130a0e3447..998a9bab3bd 100644
--- a/libjava/classpath/javax/swing/border/CompoundBorder.java
+++ b/libjava/classpath/javax/swing/border/CompoundBorder.java
@@ -48,8 +48,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class CompoundBorder
- extends AbstractBorder
+public class CompoundBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -57,7 +56,6 @@ public class CompoundBorder
*/
static final long serialVersionUID = 9054540377030555103L;
-
/**
* The inside border, which is painted between the bordered
* Component and the outside border. It is valid for
@@ -65,7 +63,6 @@ public class CompoundBorder
*/
protected Border insideBorder;
-
/**
* The outside border, which is painted outside both the
* bordered Component and the inside border. It is valid for
@@ -73,7 +70,6 @@ public class CompoundBorder
*/
protected Border outsideBorder;
-
/**
* Constructs a CompoundBorder whose inside and outside borders
* are both <code>null</code>. While this does not really make
@@ -83,12 +79,11 @@ public class CompoundBorder
*
* @see EmptyBorder
*/
- public CompoundBorder ()
+ public CompoundBorder()
{
this (null, null);
}
-
/**
* Constructs a CompoundBorder with the specified inside and
* outside borders.
@@ -103,13 +98,12 @@ public class CompoundBorder
* component. It is acceptable to pass <code>null</code>, in
* which case no inside border is painted.
*/
- public CompoundBorder (Border outsideBorder, Border insideBorder)
+ public CompoundBorder(Border outsideBorder, Border insideBorder)
{
this.outsideBorder = outsideBorder;
this.insideBorder = insideBorder;
}
-
/**
* Determines whether or not this border is opaque. An opaque
* border fills every pixel in its area when painting. Partially
@@ -119,20 +113,18 @@ public class CompoundBorder
* @return <code>true</code> if both the inside and outside borders
* are opaque, or <code>false</code> otherwise.
*/
- public boolean isBorderOpaque ()
+ public boolean isBorderOpaque()
{
- /* While it would be safe to assume true for the opacity of
- * a null border, this behavior would not be according to
- * the API specification. Also, it is pathological to have
- * null borders anyway.
- */
+ // While it would be safe to assume true for the opacity of
+ // a null border, this behavior would not be according to
+ // the API specification. Also, it is pathological to have
+ // null borders anyway.
if ((insideBorder == null) || (outsideBorder == null))
return false;
return insideBorder.isBorderOpaque()
&& outsideBorder.isBorderOpaque();
}
-
/**
* Paints the compound border by first painting the outside border,
@@ -148,9 +140,9 @@ public class CompoundBorder
public void paintBorder(Component c, Graphics g,
int x, int y, int width, int height)
{
- /* If there is an outside border, paint it and reduce the
- * bounding box by its insets.
- */
+ // If there is an outside border, paint it and reduce the
+ // bounding box by its insets.
+ //
if (outsideBorder != null)
{
Insets outsideInsets;
@@ -161,9 +153,8 @@ public class CompoundBorder
x += outsideInsets.left;
y += outsideInsets.top;
- /* Reduce width and height by the respective extent of the
- * outside border.
- */
+ // Reduce width and height by the respective extent of the
+ // outside border.
width -= outsideInsets.left + outsideInsets.right;
height -= outsideInsets.top + outsideInsets.bottom;
}
@@ -172,7 +163,6 @@ public class CompoundBorder
insideBorder.paintBorder(c, g, x, y, width, height);
}
-
/**
* Changes the specified insets to the insets of this border,
* which is the sum of the insets of the inside and the outside
@@ -192,7 +182,7 @@ public class CompoundBorder
else
insets.left = insets.right = insets.top = insets.bottom = 0;
- /* If there is an outside border, add it to insets. */
+ // If there is an outside border, add it to insets.
if (outsideBorder != null)
{
borderInsets = outsideBorder.getBorderInsets(c);
@@ -202,7 +192,7 @@ public class CompoundBorder
insets.bottom += borderInsets.bottom;
}
- /* If there is an inside border, add it to insets. */
+ // If there is an inside border, add it to insets.
if (insideBorder != null)
{
borderInsets = insideBorder.getBorderInsets(c);
@@ -215,35 +205,31 @@ public class CompoundBorder
return insets;
}
-
/**
* Determines the insets of this border, which is the sum of the
* insets of the inside and the outside border.
*
* @param c the component in the center of this border.
*/
- public Insets getBorderInsets (Component c)
+ public Insets getBorderInsets(Component c)
{
- /* It is not clear why CompoundBorder does not simply inherit
- * the implementation from AbstractBorder. However, we want
- * to be compatible with the API specification, which overrides
- * the getBorderInsets(Component) method.
- */
+ // It is not clear why CompoundBorder does not simply inherit
+ // the implementation from AbstractBorder. However, we want
+ // to be compatible with the API specification, which overrides
+ // the getBorderInsets(Component) method.
return getBorderInsets (c, null);
}
-
/**
* Returns the outside border, which is painted outside both the
* bordered Component and the inside border. It is valid for the
* result to be <code>null</code>.
*/
- public Border getOutsideBorder ()
+ public Border getOutsideBorder()
{
return outsideBorder;
}
-
/**
* Returns the inside border, which is painted between the bordered
* Component and the outside border. It is valid for the result to
@@ -254,4 +240,3 @@ public class CompoundBorder
return insideBorder;
}
}
-
diff --git a/libjava/classpath/javax/swing/border/EmptyBorder.java b/libjava/classpath/javax/swing/border/EmptyBorder.java
index 0f3b7b6931c..c8e9c604469 100644
--- a/libjava/classpath/javax/swing/border/EmptyBorder.java
+++ b/libjava/classpath/javax/swing/border/EmptyBorder.java
@@ -53,8 +53,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class EmptyBorder
- extends AbstractBorder
+public class EmptyBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -142,6 +141,7 @@ public class EmptyBorder
public void paintBorder(Component c, Graphics g,
int x, int y, int width, int height)
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/border/EtchedBorder.java b/libjava/classpath/javax/swing/border/EtchedBorder.java
index 0bd76ff0fb6..22882b78cb1 100644
--- a/libjava/classpath/javax/swing/border/EtchedBorder.java
+++ b/libjava/classpath/javax/swing/border/EtchedBorder.java
@@ -56,8 +56,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class EtchedBorder
- extends AbstractBorder
+public class EtchedBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -199,8 +198,8 @@ public class EtchedBorder
* @param width the width of the available area for painting the border.
* @param height the height of the available area for painting the border.
*/
- public void paintBorder(Component c, Graphics g,
- int x, int y, int width, int height)
+ public void paintBorder(Component c, Graphics g, int x, int y, int width,
+ int height)
{
switch (etchType)
{
@@ -270,16 +269,14 @@ public class EtchedBorder
*/
public boolean isBorderOpaque()
{
- /* If the colors are to be drived from the enclosed Component's
- * background color, the border is guaranteed to be fully opaque
- * because Color.brighten() and Color.darken() always return an
- * opaque color.
- */
+ // If the colors are to be derived from the enclosed Component's
+ // background color, the border is guaranteed to be fully opaque
+ // because Color.brighten() and Color.darken() always return an
+ // opaque color.
return
((highlight == null) || (highlight.getAlpha() == 255))
&& ((shadow == null) || (shadow.getAlpha() == 255));
}
-
/**
* Returns the appearance of this EtchedBorder, which is either
@@ -310,8 +307,7 @@ public class EtchedBorder
else
return c.getBackground().brighter();
}
-
-
+
/**
* Returns the color that will be used for highlighted parts when
* painting the border, or <code>null</code> if that color will be
@@ -359,11 +355,11 @@ public class EtchedBorder
* Paints a two-pixel etching in two colors.
*
* <pre>
- * @@@@@@@@@@@.
- * @.........@. @ = color a
- * @. @. . = color b
- * @. @.
- * @@@@@@@@@@@.
+ * +++++++++++.
+ * +.........+. + = color a
+ * +. +. . = color b
+ * +. +.
+ * +++++++++++.
* ............</pre>
*
* @param g the graphics for painting.
@@ -374,9 +370,8 @@ public class EtchedBorder
* @param a one of the two colors.
* @param b the second of the two colors.
*/
- private static void paintEtchedBorder(Graphics g,
- int x, int y, int width, int height,
- Color a, Color b)
+ private static void paintEtchedBorder(Graphics g, int x, int y, int width,
+ int height, Color a, Color b)
{
Color oldColor;
@@ -387,11 +382,10 @@ public class EtchedBorder
try
{
- /* To understand this code, it might be helpful to look at the
- * images that are included with the JavaDoc. They are located
- * in the "doc-files" subdirectory. EtchedBorder-2.png might
- * be especially informative.
- */
+ // To understand this code, it might be helpful to look at the
+ // images that are included with the JavaDoc. They are located
+ // in the "doc-files" subdirectory. EtchedBorder-2.png might
+ // be especially informative.
g.setColor(a);
g.drawRect(0, 0, width - 1, height - 1);
@@ -408,4 +402,3 @@ public class EtchedBorder
}
}
}
-
diff --git a/libjava/classpath/javax/swing/border/LineBorder.java b/libjava/classpath/javax/swing/border/LineBorder.java
index c34e38c5789..36abddd915d 100644
--- a/libjava/classpath/javax/swing/border/LineBorder.java
+++ b/libjava/classpath/javax/swing/border/LineBorder.java
@@ -50,8 +50,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class LineBorder
- extends AbstractBorder
+public class LineBorder extends AbstractBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -71,7 +70,7 @@ public class LineBorder
/**
* A shared instance of a gray, one pixel thick, plain LineBorder.
* The singleton object is lazily created by {@link
- * #createBlackGrayBorder()} upon its first invocation.
+ * #createGrayLineBorder()} upon its first invocation.
*/
private static LineBorder grayLineBorder;
@@ -213,29 +212,27 @@ public class LineBorder
{
g.setColor(lineColor);
- /* If width and height were not adjusted, the border would
- * appear one pixel too large in both directions.
- */
+ // If width and height were not adjusted, the border would
+ // appear one pixel too large in both directions.
width -= 1;
height -= 1;
- /* Blurred, too large appearance
- * -----------------------------
- * While Java 2D has introduced line strokes of arbitrary width,
- * it seems desirable to keep this code independent of Java 2D.
- * Therefore, multiple nested rectangles (or rounded rectangles)
- * are drawn in order to simulate a line whose thickness is
- * greater than one pixel.
- *
- * This hack causes a blurred appearance when anti-aliasing is
- * on. Interestingly enough, though, the Sun JDK 1.3.1 (at least
- * on MacOS X 10.1.5) shows exactly the same appearance under
- * this condition. It thus seems likely that Sun does the same
- * hack for simulating thick lines. For this reason, the
- * blurred appearance seems acceptable -- especially since GNU
- * Classpath tries to be compatible with the Sun reference
- * implementation.
- */
+ // Blurred, too large appearance
+ // -----------------------------
+ // While Java 2D has introduced line strokes of arbitrary width,
+ // it seems desirable to keep this code independent of Java 2D.
+ // Therefore, multiple nested rectangles (or rounded rectangles)
+ // are drawn in order to simulate a line whose thickness is
+ // greater than one pixel.
+ //
+ // This hack causes a blurred appearance when anti-aliasing is
+ // on. Interestingly enough, though, the Sun JDK 1.3.1 (at least
+ // on MacOS X 10.1.5) shows exactly the same appearance under
+ // this condition. It thus seems likely that Sun does the same
+ // hack for simulating thick lines. For this reason, the
+ // blurred appearance seems acceptable -- especially since GNU
+ // Classpath tries to be compatible with the Sun reference
+ // implementation.
for (int i = 0; i < thickness; i++)
{
if (roundedCorners)
@@ -340,4 +337,3 @@ public class LineBorder
return (!roundedCorners) && (lineColor.getAlpha() == 255);
}
}
-
diff --git a/libjava/classpath/javax/swing/border/MatteBorder.java b/libjava/classpath/javax/swing/border/MatteBorder.java
index f7ff1ca01c3..4d5b8c25360 100644
--- a/libjava/classpath/javax/swing/border/MatteBorder.java
+++ b/libjava/classpath/javax/swing/border/MatteBorder.java
@@ -54,8 +54,7 @@ import javax.swing.Icon;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class MatteBorder
- extends EmptyBorder
+public class MatteBorder extends EmptyBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -401,4 +400,3 @@ public class MatteBorder
}
}
}
-
diff --git a/libjava/classpath/javax/swing/border/SoftBevelBorder.java b/libjava/classpath/javax/swing/border/SoftBevelBorder.java
index 379ecb65a35..028fd00e021 100644
--- a/libjava/classpath/javax/swing/border/SoftBevelBorder.java
+++ b/libjava/classpath/javax/swing/border/SoftBevelBorder.java
@@ -55,8 +55,7 @@ import java.awt.Insets;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class SoftBevelBorder
- extends BevelBorder
+public class SoftBevelBorder extends BevelBorder
{
/**
* Determined using the <code>serialver</code> tool
@@ -264,10 +263,10 @@ public class SoftBevelBorder
* Paints a soft bevel in four colors.
*
* <pre>
- * @@@@@@@@@@@.
- * @@.........# @ = color a
- * @.. # . = color b
- * @. # X = color c
+ * +++++++++++.
+ * ++.........# + = color a
+ * +.. # . = color b
+ * +. # X = color c
* .. X# # = color d
* . ##########</pre>
*
@@ -326,4 +325,3 @@ public class SoftBevelBorder
}
}
}
-
diff --git a/libjava/classpath/javax/swing/border/TitledBorder.java b/libjava/classpath/javax/swing/border/TitledBorder.java
index ceae2b1c9e3..8d3ee13d4bb 100644
--- a/libjava/classpath/javax/swing/border/TitledBorder.java
+++ b/libjava/classpath/javax/swing/border/TitledBorder.java
@@ -1,5 +1,5 @@
/* TitledBorder.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,6 +46,9 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Shape;
+import java.awt.font.FontRenderContext;
+import java.awt.font.LineMetrics;
+import java.awt.geom.AffineTransform;
import javax.swing.UIManager;
@@ -55,8 +58,7 @@ import javax.swing.UIManager;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class TitledBorder
- extends AbstractBorder
+public class TitledBorder extends AbstractBorder
{
/**
* A value for the <code>titlePosition</code> property that vertically
@@ -301,7 +303,7 @@ public class TitledBorder
public TitledBorder(String title)
{
this(/* border */ null,
- title, DEFAULT_JUSTIFICATION, DEFAULT_POSITION,
+ title, LEADING, TOP,
/* titleFont */ null, /* titleColor */ null);
}
@@ -314,7 +316,7 @@ public class TitledBorder
*/
public TitledBorder(Border border)
{
- this(border, /* title */ "", DEFAULT_JUSTIFICATION, DEFAULT_POSITION,
+ this(border, /* title */ "", LEADING, TOP,
/* titleFont */ null, /* titleColor */ null);
}
@@ -330,7 +332,7 @@ public class TitledBorder
*/
public TitledBorder(Border border, String title)
{
- this(border, title, DEFAULT_JUSTIFICATION, DEFAULT_POSITION,
+ this(border, title, LEADING, TOP,
/* titleFont */ null, /* titleColor */ null);
}
@@ -504,7 +506,7 @@ public class TitledBorder
public void paint(Graphics g)
{
if (b != null)
- b.paintBorder(c, g, x, y, width - 1, height - 1);
+ b.paintBorder(c, g, x, y, width, height);
}
@@ -562,7 +564,7 @@ public class TitledBorder
if (stripeHeight > 0)
{
paint(g, x, holeY, holeX - x, stripeHeight); // patches #2 and #3
- paint(g, holeX + holeWidth, holeY, width - (holeX + holeWidth), stripeHeight);
+ paint(g, holeX + holeWidth, holeY, x + width - (holeX + holeWidth), stripeHeight);
}
stripeHeight = height - (holeY - y + holeHeight);
@@ -574,16 +576,16 @@ public class TitledBorder
BorderPainter bp;
int textX, textY, borderWidth, borderHeight;
- borderWidth = width - (mes.borderSpacing.left + mes.borderSpacing.right);
- borderHeight = height - (mes.borderSpacing.top + mes.borderSpacing.bottom);
+ borderWidth = width - (mes.outerSpacing.left + mes.outerSpacing.right);
+ borderHeight = height - (mes.outerSpacing.top + mes.outerSpacing.bottom);
bp = new BorderPainter(c, getBorder(),
- x + mes.borderSpacing.left, y + mes.borderSpacing.top,
+ x + mes.outerSpacing.left, y + mes.outerSpacing.top,
borderWidth, borderHeight);
switch (getRealTitleJustification(c))
{
case LEFT:
- textX = x + TEXT_INSET_H;
+ textX = x + EDGE_SPACING + TEXT_INSET_H;
break;
case CENTER:
@@ -601,21 +603,22 @@ public class TitledBorder
switch (titlePosition)
{
case ABOVE_TOP:
- textY = y;
+ textY = y + EDGE_SPACING;
break;
case TOP:
case DEFAULT_POSITION:
default:
- textY = y + mes.borderSpacing.top + mes.borderInsets.top - mes.textAscent;
+ textY = y + mes.outerSpacing.top + mes.borderInsets.top - mes.textAscent
+ + mes.lineHeight;
break;
case BELOW_TOP:
- textY = y + mes.borderSpacing.top + mes.borderInsets.top + TEXT_SPACING;
+ textY = y + mes.outerSpacing.top + mes.borderInsets.top + TEXT_SPACING;
break;
case ABOVE_BOTTOM:
- textY = y + height - mes.borderSpacing.bottom - mes.borderInsets.bottom
+ textY = y + height - mes.outerSpacing.bottom - mes.borderInsets.bottom
- TEXT_SPACING - (mes.textAscent + mes.textDescent);
break;
@@ -640,8 +643,8 @@ public class TitledBorder
g.setFont(oldFont);
g.setColor(oldColor);
}
- bp.paintExcept(g, textX - 2, textY,
- mes.textWidth + 2, mes.textAscent + mes.textDescent);
+ bp.paintExcept(g, textX, textY,
+ mes.textWidth, mes.textAscent + mes.textDescent);
}
}
@@ -998,39 +1001,63 @@ public class TitledBorder
m.trimmedText = null;
}
- m.textAscent = fmet.getAscent();
- m.textDescent = fmet.getDescent();
if (m.trimmedText != null)
- m.textWidth = fmet.stringWidth(m.trimmedText) + 3;
+ {
+ m.textAscent = fmet.getAscent();
+ m.textDescent = fmet.getDescent() + fmet.getLeading();
+
+ FontRenderContext frc = new FontRenderContext(new AffineTransform(),
+ false, false);
+ LineMetrics lmet = m.font.getLineMetrics(m.trimmedText, 0,
+ m.trimmedText.length(), frc);
+ m.lineHeight = (int) lmet.getStrikethroughOffset();
+
+ // Fallback in case that LineMetrics is not available/working.
+ if (m.lineHeight == 0)
+ m.lineHeight = (int) (0.3333 * (double) m.textAscent);
+ m.textWidth = fmet.stringWidth(m.trimmedText) + 3;
+ }
+ else
+ {
+ m.textAscent = 0;
+ m.textDescent = 0;
+ }
- m.edgeSpacing = new Insets(EDGE_SPACING, EDGE_SPACING, EDGE_SPACING, EDGE_SPACING);
- m.borderSpacing = new Insets(0, 0, 0, 0);
+ m.innerSpacing = new Insets(EDGE_SPACING, EDGE_SPACING, EDGE_SPACING,
+ EDGE_SPACING);
+ m.outerSpacing = new Insets(EDGE_SPACING, EDGE_SPACING, EDGE_SPACING,
+ EDGE_SPACING);
switch (titlePosition)
{
case ABOVE_TOP:
- m.borderSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
+ m.outerSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
break;
+ case TOP:
+ m.outerSpacing.top += m.textDescent + m.lineHeight;
+ m.innerSpacing.top += m.textAscent - m.lineHeight;
+ break;
+
case BELOW_TOP:
- m.edgeSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
+ m.innerSpacing.top += m.textAscent + m.textDescent + TEXT_SPACING;
break;
case ABOVE_BOTTOM:
- m.edgeSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;
+ m.innerSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;
break;
case BOTTOM:
- m.edgeSpacing.bottom += Math.max(m.textAscent - m.borderInsets.bottom, 0);
- m.borderSpacing.bottom += m.textDescent;
+ m.innerSpacing.bottom += Math.max(m.textAscent - m.lineHeight, 0);
+ m.outerSpacing.bottom += m.textDescent + m.lineHeight;
break;
case BELOW_BOTTOM:
- m.borderSpacing.bottom += m.textAscent + m.textDescent + TEXT_SPACING;
+ m.outerSpacing.bottom += m.textAscent + m.textDescent;
break;
default:
- m.borderSpacing.top += m.textAscent;
+ m.outerSpacing.top += m.textAscent;
}
return m;
@@ -1053,7 +1080,7 @@ public class TitledBorder
* which means that the font is to be retrieved from the current
* LookAndFeel. In this case, this <code>font</code> field will
* contain the result of the retrieval. Therefore, it is safe
- * to assume that his <code>font</code> field will never have
+ * to assume that this <code>font</code> field will never have
* a <code>null</code> value.
*/
Font font;
@@ -1072,6 +1099,11 @@ public class TitledBorder
*/
int textDescent;
+ /**
+ * The number of pixels between the base line and the height where
+ * a strike-through would be drawn.
+ */
+ int lineHeight;
/**
* The title text after removing leading and trailing white space
@@ -1088,7 +1120,7 @@ public class TitledBorder
/**
- * The border that constitues the interior border
+ * The border that constitutes the interior border
* underneath the title text.
*/
Border border;
@@ -1097,8 +1129,7 @@ public class TitledBorder
/**
* The distance between the TitledBorder and the interior border.
*/
- Insets borderSpacing;
-
+ Insets outerSpacing;
/**
* The width of the interior border, as returned by
@@ -1111,7 +1142,7 @@ public class TitledBorder
* The distance between the interior border and the nested
* Component for which this TitledBorder is a border.
*/
- Insets edgeSpacing;
+ Insets innerSpacing;
/**
@@ -1130,10 +1161,10 @@ public class TitledBorder
{
if (i == null)
i = new Insets(0, 0, 0, 0);
- i.left = borderSpacing.left + borderInsets.left + edgeSpacing.left;
- i.right = borderSpacing.right + borderInsets.right + edgeSpacing.right;
- i.top = borderSpacing.top + borderInsets.top + edgeSpacing.top;
- i.bottom = borderSpacing.bottom + borderInsets.bottom + edgeSpacing.bottom;
+ i.left = outerSpacing.left + borderInsets.left + innerSpacing.left;
+ i.right = outerSpacing.right + borderInsets.right + innerSpacing.right;
+ i.top = outerSpacing.top + borderInsets.top + innerSpacing.top;
+ i.bottom = outerSpacing.bottom + borderInsets.bottom + innerSpacing.bottom;
return i;
}
@@ -1148,7 +1179,8 @@ public class TitledBorder
Insets insets;
insets = getContentInsets(null);
- width = Math.max(insets.left + insets.right, textWidth + 2 * TEXT_INSET_H);
+ width = Math.max(insets.left + insets.right, textWidth + 2
+ * TEXT_INSET_H);
return new Dimension(width, insets.top + insets.bottom);
}
}
diff --git a/libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java b/libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java
index d55346aaf2c..efb527725fa 100644
--- a/libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java
+++ b/libjava/classpath/javax/swing/colorchooser/AbstractColorChooserPanel.java
@@ -1,5 +1,5 @@
/* AbstractColorChooserPanel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,7 +64,8 @@ public abstract class AbstractColorChooserPanel extends JPanel
*/
public AbstractColorChooserPanel()
{
- } // AbstractColorChooserPanel()
+ // Nothing to do here.
+ }
/**
* This method returns the name displayed in the tab for this chooser panel.
@@ -74,6 +75,36 @@ public abstract class AbstractColorChooserPanel extends JPanel
public abstract String getDisplayName();
/**
+ * Returns the key code for the mnemonic for this panel. This method returns
+ * zero to indicate no mnemonic, subclasses can override this.
+ *
+ * @return <code>0</code>, to indicate no mnemonic key code.
+ *
+ * @see #getDisplayedMnemonicIndex()
+ * @since 1.4
+ */
+ public int getMnemonic()
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the index of the character in the display name that is the
+ * mnemonic. This method returns <code>-1</code> to indicate no mnemonic,
+ * subclasses can override.
+ *
+ * @return <code>-1</code>, to indicate no mnemonic.
+ *
+ * @see #getDisplayName()
+ * @see #getMnemonic()
+ * @since 1.4
+ */
+ public int getDisplayedMnemonicIndex()
+ {
+ return -1;
+ }
+
+ /**
* This method updates the chooser panel when the JColorChooser's color has
* changed.
*/
diff --git a/libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java b/libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java
index 77e319c70e4..923ea531ffb 100644
--- a/libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java
+++ b/libjava/classpath/javax/swing/colorchooser/ColorChooserComponentFactory.java
@@ -53,7 +53,8 @@ public class ColorChooserComponentFactory
*/
private ColorChooserComponentFactory()
{
- } // ColorChooserComponentFactory()
+ // Nothing to do here.
+ }
/**
* This method returns the three default chooser panels to be used in
diff --git a/libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java b/libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
index f28af4cac7c..ff3436808ec 100644
--- a/libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
+++ b/libjava/classpath/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
@@ -587,6 +587,7 @@ class DefaultSwatchChooserPanel extends AbstractColorChooserPanel
*/
public void addLayoutComponent(String name, Component comp)
{
+ // Nothing to do here.
}
/**
@@ -634,6 +635,7 @@ class DefaultSwatchChooserPanel extends AbstractColorChooserPanel
*/
public void removeLayoutComponent(Component comp)
{
+ // Nothing to do here.
}
/**
@@ -786,6 +788,7 @@ class DefaultSwatchChooserPanel extends AbstractColorChooserPanel
*/
public void updateChooser()
{
+ // Nothing to do here yet.
}
/**
diff --git a/libjava/classpath/javax/swing/event/EventListenerList.java b/libjava/classpath/javax/swing/event/EventListenerList.java
index 3b9f4c807de..ee3f220f4d5 100644
--- a/libjava/classpath/javax/swing/event/EventListenerList.java
+++ b/libjava/classpath/javax/swing/event/EventListenerList.java
@@ -119,6 +119,7 @@ public class EventListenerList
*/
public EventListenerList()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/event/InternalFrameAdapter.java b/libjava/classpath/javax/swing/event/InternalFrameAdapter.java
index a2878e76e79..dfa88c3d4fd 100644
--- a/libjava/classpath/javax/swing/event/InternalFrameAdapter.java
+++ b/libjava/classpath/javax/swing/event/InternalFrameAdapter.java
@@ -39,75 +39,88 @@ exception statement from your version. */
package javax.swing.event;
/**
- * InternalFrameAdapter
+ * InternalFrameAdapter.
+ *
* @author Andrew Selkirk
*/
public abstract class InternalFrameAdapter implements InternalFrameListener
{
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * InternalFrameAdapter constructor
- */
- public InternalFrameAdapter() {
- } // InternalFrameAdapter()
-
-
- //-------------------------------------------------------------
- // Interface: InternalFrameListener ---------------------------
- //-------------------------------------------------------------
+ /**
+ * InternalFrameAdapter constructor.
+ */
+ public InternalFrameAdapter()
+ {
+ // Nothing to do here.
+ }
- /**
- * Internal frame activated
- * @param event Internal frame event
- */
- public void internalFrameActivated(InternalFrameEvent event) {
- } // internalFrameActivated()
-
- /**
- * Internal frame closed
- * @param event Internal frame event
- */
- public void internalFrameClosed(InternalFrameEvent event) {
- } // internalFrameClosed()
-
- /**
- * Internal frame closing
- * @param event Internal frame event
- */
- public void internalFrameClosing(InternalFrameEvent event) {
- } // internalFrameClosing()
-
- /**
- * Internal frame deactivated
- * @param event Internal frame event
- */
- public void internalFrameDeactivated(InternalFrameEvent event) {
- } // internalFrameDeactivated()
-
- /**
- * Internal frame deiconified
- * @param event Internal frame event
- */
- public void internalFrameDeiconified(InternalFrameEvent event) {
- } // internalFrameDeiconified()
-
- /**
- * Internal frame iconified
- * @param event Internal frame event
- */
- public void internalFrameIconified(InternalFrameEvent event) {
- } // internalFrameIconified()
-
- /**
- * Internal frame opened
- * @param event Internal frame event
- */
- public void internalFrameOpened(InternalFrameEvent event) {
- } // internalFrameOpened()
-
-
-} // InternalFrameAdapter
+ /**
+ * Internal frame activated.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameActivated(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame closed.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameClosed(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame closing.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameClosing(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame deactivated.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameDeactivated(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame deiconified.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameDeiconified(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame iconified.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameIconified(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Internal frame opened.
+ *
+ * @param event internal frame event
+ */
+ public void internalFrameOpened(InternalFrameEvent event)
+ {
+ // Nothing to do here.
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/event/ListDataListener.java b/libjava/classpath/javax/swing/event/ListDataListener.java
index 7ce17d86fa6..f42777d09d6 100644
--- a/libjava/classpath/javax/swing/event/ListDataListener.java
+++ b/libjava/classpath/javax/swing/event/ListDataListener.java
@@ -1,5 +1,5 @@
/* ListDataListener.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,33 +37,46 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.util.EventListener;
+import javax.swing.ListModel;
+
/**
- * ListDataListener public interface
+ * A <code>ListDataListener</code> can register with a {@link ListModel} and
+ * receive notification of updates to the model.
+ *
* @author Andrew Selkirk
* @author Ronald Veldema
*/
-public interface ListDataListener extends EventListener {
-
- /**
- * Contents Changed
- * @param event ListDataEvent Event
- */
- void contentsChanged(ListDataEvent event);
+public interface ListDataListener extends EventListener
+{
- /**
- * Interval Added
- * @param event ListDataEvent Event
- */
- void intervalAdded(ListDataEvent event);
+ /**
+ * Notifies the listener that the contents of the list have changed
+ * in some way. This method will be called if the change cannot be
+ * notified via the {@link #intervalAdded(ListDataEvent)} or the
+ * {@link #intervalRemoved(ListDataEvent)} methods.
+ *
+ * @param event the event.
+ */
+ void contentsChanged(ListDataEvent event);
- /**
- * Interval Removed
- * @param event ListDataEvent Event
- */
- void intervalRemoved(ListDataEvent event);
+ /**
+ * Notifies the listener that one or more items have been added to the
+ * list. The <code>event</code> argument can supply the indices for the
+ * range of items added.
+ *
+ * @param event the event.
+ */
+ void intervalAdded(ListDataEvent event);
+ /**
+ * Notifies the listener that one or more items have been removed from
+ * the list. The <code>event</code> argument can supply the indices for
+ * the range of items removed.
+ *
+ * @param event the event.
+ */
+ void intervalRemoved(ListDataEvent event);
-} // ListDataListener
+}
diff --git a/libjava/classpath/javax/swing/event/MouseInputListener.java b/libjava/classpath/javax/swing/event/MouseInputListener.java
index 3c3ca2347fe..3d879b9e746 100644
--- a/libjava/classpath/javax/swing/event/MouseInputListener.java
+++ b/libjava/classpath/javax/swing/event/MouseInputListener.java
@@ -37,16 +37,17 @@ exception statement from your version. */
package javax.swing.event;
-// Imports
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
/**
- * MouseInputListener public interface
+ * MouseInputListener public interface.
+ *
* @author Andrew Selkirk
*/
public interface MouseInputListener extends MouseListener,
- MouseMotionListener {
-
-} // MouseInputListener
-
+ MouseMotionListener
+{
+ // This interface only pulls together MouseListener and MouseMotionListener
+ // without adding any methods on its own.
+}
diff --git a/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java b/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java
index 408ca957e95..7e8ff0dc2e9 100644
--- a/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java
+++ b/libjava/classpath/javax/swing/event/SwingPropertyChangeSupport.java
@@ -289,10 +289,9 @@ public final class SwingPropertyChangeSupport
int index;
PropertyChangeListener listener;
- // Check Values if they are equal
- if (event.getOldValue() == null && event.getNewValue() == null ||
- (event.getOldValue() != null && event.getNewValue() != null &&
- event.getOldValue().equals(event.getNewValue())))
+ // if the old and new values are non-null and equal, don't notify listeners
+ if (event.getOldValue() != null && event.getNewValue() != null &&
+ event.getOldValue().equals(event.getNewValue()))
return;
// Process Main Listener List
diff --git a/libjava/classpath/javax/swing/event/TreeModelEvent.java b/libjava/classpath/javax/swing/event/TreeModelEvent.java
index a217e3b4053..8fa28a7eadb 100644
--- a/libjava/classpath/javax/swing/event/TreeModelEvent.java
+++ b/libjava/classpath/javax/swing/event/TreeModelEvent.java
@@ -55,12 +55,12 @@ public class TreeModelEvent extends EventObject {
/**
* childIndices
*/
- protected int[] childIndices = new int[0];
+ protected int[] childIndices = null;
/**
* children
*/
- protected Object[] children = new Object[0];
+ protected Object[] children = null;
/**
* path
@@ -164,7 +164,9 @@ public class TreeModelEvent extends EventObject {
* @returns String representation
*/
public String toString() {
- return null; // TODO
+ return getClass() + " [Source: " + getSource() + ", TreePath: " + getTreePath() +
+ ", Child Indicies: " + getChildIndices() + ", Children: " + getChildren() +
+ ", Path: " + getPath() +"]";
} // toString()
diff --git a/libjava/classpath/javax/swing/filechooser/FileFilter.java b/libjava/classpath/javax/swing/filechooser/FileFilter.java
index 42770d98186..ecfa54b5814 100644
--- a/libjava/classpath/javax/swing/filechooser/FileFilter.java
+++ b/libjava/classpath/javax/swing/filechooser/FileFilter.java
@@ -1,5 +1,5 @@
/* FileFilter.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,41 +40,46 @@ package javax.swing.filechooser;
import java.io.File;
+import javax.swing.JFileChooser;
+
/**
- * FileFilter
+ * The base class for filters that control the visibility of files in the
+ * {@link JFileChooser} component.
+ *
+ * @see JFileChooser#addChoosableFileFilter(FileFilter)
+ *
* @author Andrew Selkirk
- * @version 1.0
*/
-public abstract class FileFilter {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor FileFilter
- */
- public FileFilter() {
- // TODO
- } // FileFilter()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * accept
- * @param file TODO
- * @returns boolean
- */
- public abstract boolean accept(File file);
-
- /**
- * getDescription
- * @returns String
- */
- public abstract String getDescription();
-
-
-} // FileFilter
+public abstract class FileFilter
+{
+
+ /**
+ * Default constructor.
+ */
+ public FileFilter()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns <code>true</code> if the specified file matches the filter, and
+ * <code>false</code> otherwise.
+ *
+ * @param file the file.
+ *
+ * @returns A boolean.
+ */
+ public abstract boolean accept(File file);
+
+ /**
+ * Returns a description of the files that will be selected by the filter
+ * (for example, "Java source files"). This description will usually be
+ * displayed on the {@link JFileChooser} component, often in a combo box that
+ * is used to select the appropriate filter (in cases where more than one
+ * filter is available).
+ *
+ * @returns A description of the filter.
+ */
+ public abstract String getDescription();
+
+}
diff --git a/libjava/classpath/javax/swing/filechooser/FileSystemView.java b/libjava/classpath/javax/swing/filechooser/FileSystemView.java
index ffa41ca07de..f51b745c892 100644
--- a/libjava/classpath/javax/swing/filechooser/FileSystemView.java
+++ b/libjava/classpath/javax/swing/filechooser/FileSystemView.java
@@ -40,21 +40,27 @@ package javax.swing.filechooser;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+
import javax.swing.Icon;
+import javax.swing.JFileChooser;
/**
- * DOCUMENT ME!
+ * The base class providing a view of the file system for use by the
+ * {@link JFileChooser} component.
*/
public abstract class FileSystemView
{
+ /** The instance returned by {@link #getFileSystemView()}. */
+ private static FileSystemView defaultFileSystemView;
+
/**
- * DOCUMENT ME!
+ * Creates a new file object with the given name in the specified directory.
*
- * @param dir DOCUMENT ME!
- * @param filename DOCUMENT ME!
+ * @param dir the directory (<code>null</code> permitted).
+ * @param filename the file name.
*
- * @return DOCUMENT ME!
+ * @return A new file object.
*/
public File createFileObject(File dir, String filename)
{
@@ -62,11 +68,11 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Creates a new file object from the specified path.
*
- * @param path DOCUMENT ME!
+ * @param path the path.
*
- * @return DOCUMENT ME!
+ * @return A new file object.
*/
public File createFileObject(String path)
{
@@ -89,13 +95,16 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Creates a new folder with a unique name in the specified directory and
+ * returns a {@link File} object representing the new directory.
*
- * @param containingDir DOCUMENT ME!
+ * @param containingDir the directory to contain the new folder
+ * (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return A {@link File} object representing the new directory.
*
- * @throws IOException DOCUMENT ME!
+ * @throws IOException if an exception occurs while creating the new
+ * directory.
*/
public abstract File createNewFolder(File containingDir)
throws IOException;
@@ -115,9 +124,9 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the default directory.
*
- * @return DOCUMENT ME!
+ * @return The default directory.
*/
public File getDefaultDirectory()
{
@@ -125,12 +134,16 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns an array containing the files in the given directory. The
+ * <code>useFileHiding</code> controls whether or not hidden files are
+ * included in the result.
*
- * @param dir DOCUMENT ME!
- * @param useFileHiding DOCUMENT ME!
+ * @param dir the directory (if <code>null</code>
+ * @param useFileHiding a flag that controls whether or not hidden files are
+ * included in the result (pass in <code>true</code> to
+ * exclude hidden files).
*
- * @return DOCUMENT ME!
+ * @return The files in the given directory (possibly <code>null</code>).
*/
public File[] getFiles(File dir, boolean useFileHiding)
{
@@ -143,31 +156,34 @@ public abstract class FileSystemView
for (int i = 0; i < files.length; i++)
if (! files[i].isHidden())
trim.add(files[i]);
- File[] value = (File[]) trim.toArray(new File[0]);
+ File[] value = (File[]) trim.toArray(new File[trim.size()]);
return value;
}
/**
- * DOCUMENT ME!
+ * Returns a default {@link FileSystemView} appropriate for the platform.
*
- * @return DOCUMENT ME!
+ * @return A default {@link FileSystemView} appropriate for the platform.
*/
public static FileSystemView getFileSystemView()
{
- if (File.separator.equals("/"))
- return new UnixFileSystemView();
-
- // else if (File.Separator.equals("\"))
- // return new Win32FileSystemView();
- // else
- // return new GenericFileSystemView();
- return null;
+ if (defaultFileSystemView == null)
+ {
+ if (File.separator.equals("/"))
+ defaultFileSystemView = new UnixFileSystemView();
+ // FIXME: need to implement additional views
+ // else if (File.Separator.equals("\"))
+ // return new Win32FileSystemView();
+ // else
+ // return new GenericFileSystemView();
+ }
+ return defaultFileSystemView;
}
/**
- * DOCUMENT ME!
+ * Returns the home directory for the current user.
*
- * @return DOCUMENT ME!
+ * @return The home directory for the current user.
*/
public File getHomeDirectory()
{
@@ -175,11 +191,12 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the parent directory for the given file/directory.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return The parent directory (or <code>null</code> if there is no parent
+ * directory).
*/
public File getParentDirectory(File f)
{
@@ -189,9 +206,14 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns an array containing the file system roots. On Unix-like platforms,
+ * this array will contain just a single item ("/"), while other platforms
+ * may return multiple roots.
+ * <p>
+ * This method is implemented to return <code>null</code>, subclasses must
+ * override this method.
+ *
+ * @return An array containing the file system roots.
*/
public File[] getRoots()
{
@@ -200,11 +222,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the name of a file as it would be displayed by the underlying
+ * system. This implementation returns <code>null</code>, subclasses must
+ * override.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemDisplayName(File f)
{
@@ -212,11 +236,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the icon that would be displayed for the given file by the
+ * underlying system. This implementation returns <code>null</code>,
+ * subclasses must override.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public Icon getSystemIcon(File f)
{
@@ -224,11 +250,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the type description of a file that would be displayed by the
+ * underlying system. This implementation returns <code>null</code>,
+ * subclasses must override.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemTypeDescription(File f)
{
@@ -248,11 +276,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given directory represents a disk
+ * drive, and <code>false</code> otherwise. This default implementation
+ * always returns <code>false</code>.
*
- * @param dir DOCUMENT ME!
+ * @param dir the directory.
*
- * @return DOCUMENT ME!
+ * @return <code>false</code>.
*/
public boolean isDrive(File dir)
{
@@ -260,11 +290,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if <code>f</code> is a file or directory, and
+ * <code>false</code> otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if <code>f</code> is a file or directory, and
+ * <code>false</code> otherwise.
*/
public boolean isFileSystem(File f)
{
@@ -272,11 +304,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given directory is a file system root,
+ * and <code>false</code> otherwise.
*
- * @param dir DOCUMENT ME!
+ * @param dir the directory.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the given directory is a file system root,
+ * and <code>false</code> otherwise.
*/
public boolean isFileSystemRoot(File dir)
{
@@ -291,11 +325,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given directory represents a floppy
+ * drive, and <code>false</code> otherwise. This default implementation
+ * always returns <code>false</code>.
*
- * @param dir DOCUMENT ME!
+ * @param dir the directory.
*
- * @return DOCUMENT ME!
+ * @return <code>false</code>.
*/
public boolean isFloppyDrive(File dir)
{
@@ -303,11 +339,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given file is hidden, and
+ * <code>false</code> otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the given file is hidden, and
+ * <code>false</code> otherwise.
*/
public boolean isHiddenFile(File f)
{
@@ -315,12 +353,14 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if <code>folder</code> is the parent of
+ * <code>file</code>, and <code>false</code> otherwise.
*
- * @param folder DOCUMENT ME!
- * @param file DOCUMENT ME!
+ * @param folder the folder (<code>null</code> not permitted).
+ * @param file the file (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if <code>folder</code> is the parent of
+ * <code>file</code>, and <code>false</code> otherwise.
*/
public boolean isParent(File folder, File file)
{
@@ -344,11 +384,14 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the file is traversable, and
+ * <code>false</code> otherwise. Here, all directories are considered
+ * traversable, and files are considered non-traversable.
*
- * @param f DOCUMENT ME!
+ * @param f the file or directory (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the file is traversable, and
+ * <code>false</code> otherwise.
*/
public Boolean isTraversable(File f)
{
@@ -356,6 +399,6 @@ public abstract class FileSystemView
// traversable. (No files are listed when you traverse the directory)
// My best guess is that as long as it's a directory, the file is
// traversable.
- return new Boolean(f.isDirectory());
+ return Boolean.valueOf(f.isDirectory());
}
}
diff --git a/libjava/classpath/javax/swing/filechooser/FileView.java b/libjava/classpath/javax/swing/filechooser/FileView.java
index c431fd46127..ea1989f9353 100644
--- a/libjava/classpath/javax/swing/filechooser/FileView.java
+++ b/libjava/classpath/javax/swing/filechooser/FileView.java
@@ -1,5 +1,5 @@
/* FileView.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,72 +43,86 @@ import java.io.File;
import javax.swing.Icon;
/**
- * FileView
- * @author Andrew Selkirk
- * @version 1.0
+ * An abstract class that provides presentation information about files and
+ * directories. .
+ *
+ * @author Andrew Selkirk
*/
-public abstract class FileView {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor FileView
- */
- public FileView() {
- // TODO
- } // FileView()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getName
- * @param file TODO
- * @returns String
- */
- public String getName(File file) {
- return null; // TODO
- } // getName()
-
- /**
- * getDescription
- * @param value0 TODO
- * @returns String
- */
- public String getDescription(File value0) {
- return null; // TODO
- } // getDescription()
-
- /**
- * getTypeDescription
- * @param value0 TODO
- * @returns String
- */
- public String getTypeDescription(File value0) {
- return null; // TODO
- } // getTypeDescription()
-
- /**
- * getIcon
- * @param value0 TODO
- * @returns Icon
- */
- public Icon getIcon(File value0) {
- return null; // TODO
- } // getIcon()
-
- /**
- * isTraversable
- * @param value0 TODO
- * @returns Boolean
- */
- public Boolean isTraversable(File value0) {
- return null; // TODO
- } // isTraversable()
-
-
-} // FileView
+public abstract class FileView
+{
+
+ /**
+ * Creates a new <code>FileView</code> instance.
+ */
+ public FileView()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the name for the specified file. This method always returns
+ * <code>null</code> and should be overridden by subclasses.
+ *
+ * @param file the file.
+ *
+ * @return Always <code>null</code>.
+ */
+ public String getName(File file)
+ {
+ return null;
+ }
+
+ /**
+ * Returns a description for the specified file. This method always returns
+ * <code>null</code> and should be overridden by subclasses.
+ *
+ * @param file the file.
+ *
+ * @return Always <code>null</code>.
+ */
+ public String getDescription(File file)
+ {
+ return null;
+ }
+
+ /**
+ * Returns a description for the type of the specified file. This method
+ * always returns <code>null</code> and should be overridden by subclasses.
+ *
+ * @param file the file.
+ *
+ * @return Always <code>null</code>.
+ */
+ public String getTypeDescription(File file)
+ {
+ return null;
+ }
+
+ /**
+ * Returns an {@link Icon} to represent the specified file. This method
+ * always returns <code>null</code> and should be overridden by subclasses.
+ *
+ * @param file the file.
+ *
+ * @return Always <code>null</code>.
+ */
+ public Icon getIcon(File file)
+ {
+ return null;
+ }
+
+ /**
+ * Returns {@link Boolean#TRUE} if the given directory is traversable, and
+ * {@link Boolean#FALSE} if it is not. This method always returns
+ * <code>null</code> and should be overridden by subclasses.
+ *
+ * @param directory the directory.
+ *
+ * @returns Always <code>null</code>.
+ */
+ public Boolean isTraversable(File directory)
+ {
+ return null;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java b/libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java
index f2360ec52f8..c2f65965e09 100644
--- a/libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java
+++ b/libjava/classpath/javax/swing/filechooser/UnixFileSystemView.java
@@ -43,21 +43,31 @@ import javax.swing.Icon;
/**
- * DOCUMENT ME!
+ * A concrete implementation of {@link FileSystemView} that is appropriate for
+ * Unix-like systems.
+ *
+ * @see FileSystemView#getFileSystemView()
*/
class UnixFileSystemView extends FileSystemView
{
- /** DOCUMENT ME! */
+ /** The default name for new folders. */
private static final String NEW_FOLDER_NAME = "NewFolder";
/**
- * DOCUMENT ME!
+ * Creates a new folder with a unique name in the specified directory and
+ * returns a {@link File} object representing the new directory. The name
+ * of the new folder is <code>NewFolder</code> or, if a directory or file
+ * with that name already exists, <code>NewFolder.n</code> where
+ * <code>n</code> is the lowest integer greater than zero that results in
+ * a unique directory name.
*
- * @param containingDir DOCUMENT ME!
+ * @param containingDir the directory to contain the new folder
+ * (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return A {@link File} object representing the new directory.
*
- * @throws IOException DOCUMENT ME!
+ * @throws IOException if an exception occurs while creating the new
+ * directory.
*/
public File createNewFolder(File containingDir) throws IOException
{
@@ -82,9 +92,9 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns an array containing the file system root.
*
- * @return DOCUMENT ME!
+ * @return An array containing the file system root.
*/
public File[] getRoots()
{
@@ -92,11 +102,12 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the name of a file as it would be displayed by the underlying
+ * system. This method is NOT YET IMPLEMENTED.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemDisplayName(File f)
{
@@ -105,11 +116,12 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the icon that would be displayed for the given file by the
+ * underlying system. This method is NOT YET IMPLEMENTED.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public Icon getSystemIcon(File f)
{
@@ -118,11 +130,12 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the description of a file that would be displayed by the
+ * underlying system. This method is NOT YET IMPLEMENTED.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemTypeDescription(File f)
{
diff --git a/libjava/classpath/javax/swing/plaf/ActionMapUIResource.java b/libjava/classpath/javax/swing/plaf/ActionMapUIResource.java
index f6af0880ddb..07292fe24a4 100644
--- a/libjava/classpath/javax/swing/plaf/ActionMapUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/ActionMapUIResource.java
@@ -50,9 +50,7 @@ import javax.swing.ActionMap;
* @author Andrew Selkirk
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class ActionMapUIResource
- extends ActionMap
- implements UIResource
+public class ActionMapUIResource extends ActionMap implements UIResource
{
/**
* Constructs a new ActionMapUIResource.
diff --git a/libjava/classpath/javax/swing/plaf/BorderUIResource.java b/libjava/classpath/javax/swing/plaf/BorderUIResource.java
index 4402bbb48b6..317cb09ac57 100644
--- a/libjava/classpath/javax/swing/plaf/BorderUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/BorderUIResource.java
@@ -71,9 +71,7 @@ import javax.swing.border.TitledBorder;
* @author Brian Jones (cbj@gnu.org)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class BorderUIResource
- extends Object
- implements Border, UIResource, Serializable
+public class BorderUIResource implements Border, UIResource, Serializable
{
/**
* Verified using the <code>serialver</code> tool
diff --git a/libjava/classpath/javax/swing/plaf/ButtonUI.java b/libjava/classpath/javax/swing/plaf/ButtonUI.java
index 197299e0c95..6910e42989d 100644
--- a/libjava/classpath/javax/swing/plaf/ButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/ButtonUI.java
@@ -46,7 +46,7 @@ package javax.swing.plaf;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ButtonUI
- extends ComponentUI
+public abstract class ButtonUI extends ComponentUI
{
+ // This abstract class does not define any methods of its own.
}
diff --git a/libjava/classpath/javax/swing/plaf/ColorChooserUI.java b/libjava/classpath/javax/swing/plaf/ColorChooserUI.java
index 68ffd916d21..16091416a32 100644
--- a/libjava/classpath/javax/swing/plaf/ColorChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/ColorChooserUI.java
@@ -46,8 +46,7 @@ package javax.swing.plaf;
* @author Andrew Selkirk
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ColorChooserUI
- extends ComponentUI
+public abstract class ColorChooserUI extends ComponentUI
{
/**
* Constructs a ColorChooserUI.
diff --git a/libjava/classpath/javax/swing/plaf/ColorUIResource.java b/libjava/classpath/javax/swing/plaf/ColorUIResource.java
index 33b1676e0fd..36e10f2d186 100644
--- a/libjava/classpath/javax/swing/plaf/ColorUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/ColorUIResource.java
@@ -50,9 +50,7 @@ import java.awt.Color;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class ColorUIResource
- extends Color
- implements UIResource
+public class ColorUIResource extends Color implements UIResource
{
/**
* Constructs a <code>ColorUIResource</code> using the specified
diff --git a/libjava/classpath/javax/swing/plaf/ComboBoxUI.java b/libjava/classpath/javax/swing/plaf/ComboBoxUI.java
index 9498a48153a..3e81ed75a6b 100644
--- a/libjava/classpath/javax/swing/plaf/ComboBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/ComboBoxUI.java
@@ -48,14 +48,14 @@ import javax.swing.JComboBox;
* @author Andrew Selkirk
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ComboBoxUI
- extends ComponentUI
+public abstract class ComboBoxUI extends ComponentUI
{
/**
* Constructs a new <code>ComboBoxUI</code>.
*/
public ComboBoxUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java b/libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java
index e1418710fb2..cfc43e4fc78 100644
--- a/libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/ComponentInputMapUIResource.java
@@ -52,8 +52,7 @@ import javax.swing.JComponent;
* @author Andrew Selkirk
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class ComponentInputMapUIResource
- extends ComponentInputMap
+public class ComponentInputMapUIResource extends ComponentInputMap
implements UIResource
{
/**
diff --git a/libjava/classpath/javax/swing/plaf/ComponentUI.java b/libjava/classpath/javax/swing/plaf/ComponentUI.java
index 0e7680542f7..6a736f258a2 100644
--- a/libjava/classpath/javax/swing/plaf/ComponentUI.java
+++ b/libjava/classpath/javax/swing/plaf/ComponentUI.java
@@ -38,8 +38,10 @@ exception statement from your version. */
package javax.swing.plaf;
+import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Rectangle;
import javax.accessibility.Accessible;
import javax.swing.JComponent;
@@ -86,6 +88,7 @@ public abstract class ComponentUI
*/
public ComponentUI()
{
+ // Nothing to do here.
}
@@ -157,6 +160,8 @@ public abstract class ComponentUI
*/
public void paint(Graphics g, JComponent c)
{
+ // Nothing is done here. This method is meant to be overridden by
+ // subclasses.
}
@@ -181,13 +186,14 @@ public abstract class ComponentUI
{
if (c.isOpaque())
{
+ Color oldColor = g.getColor();
g.setColor(c.getBackground());
g.fillRect(0, 0, c.getWidth(), c.getHeight());
+ g.setColor(oldColor);
}
paint(g, c);
}
-
-
+
/**
* Determines the preferred size of a component. The default
* implementation returns <code>null</code>, which means that
diff --git a/libjava/classpath/javax/swing/plaf/DesktopIconUI.java b/libjava/classpath/javax/swing/plaf/DesktopIconUI.java
index 2e44088cadd..676233ec2cf 100644
--- a/libjava/classpath/javax/swing/plaf/DesktopIconUI.java
+++ b/libjava/classpath/javax/swing/plaf/DesktopIconUI.java
@@ -44,13 +44,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class DesktopIconUI
- extends ComponentUI
+public abstract class DesktopIconUI extends ComponentUI
{
/**
* Constructs a new <code>DesktopIconUI</code>.
*/
public DesktopIconUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/DesktopPaneUI.java b/libjava/classpath/javax/swing/plaf/DesktopPaneUI.java
index de553eaf4de..3d4cfc830f5 100644
--- a/libjava/classpath/javax/swing/plaf/DesktopPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/DesktopPaneUI.java
@@ -46,14 +46,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class DesktopPaneUI
- extends ComponentUI
+public abstract class DesktopPaneUI extends ComponentUI
{
/**
* Constructs a new <code>DesktopPaneUI</code>.
*/
public DesktopPaneUI()
{
+ // Nothing to do here.
}
}
-
diff --git a/libjava/classpath/javax/swing/plaf/DimensionUIResource.java b/libjava/classpath/javax/swing/plaf/DimensionUIResource.java
index 63c6838c4d1..618c220369e 100644
--- a/libjava/classpath/javax/swing/plaf/DimensionUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/DimensionUIResource.java
@@ -51,9 +51,7 @@ import java.awt.Dimension;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class DimensionUIResource
- extends Dimension
- implements UIResource
+public class DimensionUIResource extends Dimension implements UIResource
{
/**
* Constructs a new DimensionUIResource, given its width and height.
diff --git a/libjava/classpath/javax/swing/plaf/FileChooserUI.java b/libjava/classpath/javax/swing/plaf/FileChooserUI.java
index 8b661e399a5..e9be8f2ba49 100644
--- a/libjava/classpath/javax/swing/plaf/FileChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/FileChooserUI.java
@@ -53,14 +53,14 @@ import javax.swing.filechooser.FileView;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class FileChooserUI
- extends ComponentUI
+public abstract class FileChooserUI extends ComponentUI
{
/**
* Constructs a new <code>FileChooserUI</code>.
*/
public FileChooserUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/FontUIResource.java b/libjava/classpath/javax/swing/plaf/FontUIResource.java
index 1c1731048e8..c54f987fdb7 100644
--- a/libjava/classpath/javax/swing/plaf/FontUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/FontUIResource.java
@@ -50,9 +50,7 @@ import java.awt.Font;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class FontUIResource
- extends Font
- implements UIResource
+public class FontUIResource extends Font implements UIResource
{
/**
* Constructs a new <code>FontUIResource</code> given
diff --git a/libjava/classpath/javax/swing/plaf/IconUIResource.java b/libjava/classpath/javax/swing/plaf/IconUIResource.java
index 1b09ed31f39..659c8e7bab7 100644
--- a/libjava/classpath/javax/swing/plaf/IconUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/IconUIResource.java
@@ -53,8 +53,7 @@ import javax.swing.Icon;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class IconUIResource
- implements Icon, UIResource, Serializable
+public class IconUIResource implements Icon, UIResource, Serializable
{
/**
* Verified using the <code>serialver</code> tool of Sun JDK 1.4.1_01
diff --git a/libjava/classpath/javax/swing/plaf/InputMapUIResource.java b/libjava/classpath/javax/swing/plaf/InputMapUIResource.java
index ae032e51fa8..0c5f6f9e97e 100644
--- a/libjava/classpath/javax/swing/plaf/InputMapUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/InputMapUIResource.java
@@ -49,15 +49,13 @@ import javax.swing.InputMap;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class InputMapUIResource
- extends InputMap
- implements UIResource
+public class InputMapUIResource extends InputMap implements UIResource
{
/**
* Constructs a new <code>InputMapUIResource</code>.
*/
public InputMapUIResource()
{
+ // Nothing to do here.
}
}
-
diff --git a/libjava/classpath/javax/swing/plaf/InsetsUIResource.java b/libjava/classpath/javax/swing/plaf/InsetsUIResource.java
index 755d8add1b2..d64feb44c1a 100644
--- a/libjava/classpath/javax/swing/plaf/InsetsUIResource.java
+++ b/libjava/classpath/javax/swing/plaf/InsetsUIResource.java
@@ -50,8 +50,7 @@ import java.io.Serializable;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class InsetsUIResource
- extends Insets
+public class InsetsUIResource extends Insets
implements Cloneable, UIResource, Serializable
{
/**
diff --git a/libjava/classpath/javax/swing/plaf/InternalFrameUI.java b/libjava/classpath/javax/swing/plaf/InternalFrameUI.java
index fd1e3374c13..0b2f77caa15 100644
--- a/libjava/classpath/javax/swing/plaf/InternalFrameUI.java
+++ b/libjava/classpath/javax/swing/plaf/InternalFrameUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class InternalFrameUI
- extends ComponentUI
+public abstract class InternalFrameUI extends ComponentUI
{
/**
* Constructs a new <code>InternalFrameUI</code>.
*/
public InternalFrameUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/LabelUI.java b/libjava/classpath/javax/swing/plaf/LabelUI.java
index 8fc1d711b0e..f4b74d59e81 100644
--- a/libjava/classpath/javax/swing/plaf/LabelUI.java
+++ b/libjava/classpath/javax/swing/plaf/LabelUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class LabelUI
- extends ComponentUI
+public abstract class LabelUI extends ComponentUI
{
/**
* Constructs a new <code>LabelUI</code>.
*/
public LabelUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/ListUI.java b/libjava/classpath/javax/swing/plaf/ListUI.java
index 66d5cf588bb..bdfe4b3078f 100644
--- a/libjava/classpath/javax/swing/plaf/ListUI.java
+++ b/libjava/classpath/javax/swing/plaf/ListUI.java
@@ -49,14 +49,14 @@ import javax.swing.JList;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ListUI
- extends ComponentUI
+public abstract class ListUI extends ComponentUI
{
/**
* Constructs a new <code>ListUI</code>.
*/
public ListUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/MenuBarUI.java b/libjava/classpath/javax/swing/plaf/MenuBarUI.java
index 8835571ac75..2c82adfa0a0 100644
--- a/libjava/classpath/javax/swing/plaf/MenuBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/MenuBarUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class MenuBarUI
- extends ComponentUI
+public abstract class MenuBarUI extends ComponentUI
{
/**
* Constructs a new <code>MenuBarUI</code>.
*/
public MenuBarUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/MenuItemUI.java b/libjava/classpath/javax/swing/plaf/MenuItemUI.java
index 31d73194a18..83ad52fb103 100644
--- a/libjava/classpath/javax/swing/plaf/MenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/MenuItemUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class MenuItemUI
- extends ButtonUI
+public abstract class MenuItemUI extends ButtonUI
{
/**
* Constructs a new <code>MenuItemUI</code>.
*/
public MenuItemUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/PanelUI.java b/libjava/classpath/javax/swing/plaf/PanelUI.java
index b1171b80d30..12a6f52cfa8 100644
--- a/libjava/classpath/javax/swing/plaf/PanelUI.java
+++ b/libjava/classpath/javax/swing/plaf/PanelUI.java
@@ -46,13 +46,13 @@ package javax.swing.plaf;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class PanelUI
- extends ComponentUI
+public abstract class PanelUI extends ComponentUI
{
/**
* Constructs a new <code>PanelUI</code>.
*/
public PanelUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/PopupMenuUI.java b/libjava/classpath/javax/swing/plaf/PopupMenuUI.java
index c70ad2a4e9b..de351f2ef79 100644
--- a/libjava/classpath/javax/swing/plaf/PopupMenuUI.java
+++ b/libjava/classpath/javax/swing/plaf/PopupMenuUI.java
@@ -53,14 +53,14 @@ import javax.swing.PopupFactory;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class PopupMenuUI
- extends ComponentUI
+public abstract class PopupMenuUI extends ComponentUI
{
/**
* Constructs a new <code>PopupMenuUI</code>.
*/
public PopupMenuUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/ProgressBarUI.java b/libjava/classpath/javax/swing/plaf/ProgressBarUI.java
index 79c1b95a34a..013b8c5c2e7 100644
--- a/libjava/classpath/javax/swing/plaf/ProgressBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/ProgressBarUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ProgressBarUI
- extends ComponentUI
+public abstract class ProgressBarUI extends ComponentUI
{
/**
* Constructs a new <code>ProgressBarUI</code>.
*/
public ProgressBarUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/RootPaneUI.java b/libjava/classpath/javax/swing/plaf/RootPaneUI.java
index ff7d0a6e78a..9637c9cf218 100644
--- a/libjava/classpath/javax/swing/plaf/RootPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/RootPaneUI.java
@@ -46,13 +46,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class RootPaneUI
- extends ComponentUI
+public abstract class RootPaneUI extends ComponentUI
{
/**
* Constructs a new <code>RootPaneUI</code>.
*/
public RootPaneUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/ScrollBarUI.java b/libjava/classpath/javax/swing/plaf/ScrollBarUI.java
index 3cad3932720..51b4bf2d853 100644
--- a/libjava/classpath/javax/swing/plaf/ScrollBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/ScrollBarUI.java
@@ -46,13 +46,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ScrollBarUI
- extends ComponentUI
+public abstract class ScrollBarUI extends ComponentUI
{
/**
* Constructs a new <code>ScrollBarUI</code>.
*/
public ScrollBarUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/ScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/ScrollPaneUI.java
index 14d2ac61ef2..8b37fed2246 100644
--- a/libjava/classpath/javax/swing/plaf/ScrollPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/ScrollPaneUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ScrollPaneUI
- extends ComponentUI
+public abstract class ScrollPaneUI extends ComponentUI
{
/**
* Constructs a new <code>ScrollPaneUI</code>.
*/
public ScrollPaneUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/SeparatorUI.java b/libjava/classpath/javax/swing/plaf/SeparatorUI.java
index 6855bd0357e..8a9f8cf4d49 100644
--- a/libjava/classpath/javax/swing/plaf/SeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/SeparatorUI.java
@@ -54,5 +54,6 @@ public abstract class SeparatorUI
*/
public SeparatorUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/SliderUI.java b/libjava/classpath/javax/swing/plaf/SliderUI.java
index 775f19620a8..570e962aa3e 100644
--- a/libjava/classpath/javax/swing/plaf/SliderUI.java
+++ b/libjava/classpath/javax/swing/plaf/SliderUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class SliderUI
- extends ComponentUI
+public abstract class SliderUI extends ComponentUI
{
/**
* Constructs a new <code>SliderUI</code>.
*/
public SliderUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/SpinnerUI.java b/libjava/classpath/javax/swing/plaf/SpinnerUI.java
index fb4a3b13a93..ca29ddb8e4f 100644
--- a/libjava/classpath/javax/swing/plaf/SpinnerUI.java
+++ b/libjava/classpath/javax/swing/plaf/SpinnerUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class SpinnerUI
- extends ComponentUI
+public abstract class SpinnerUI extends ComponentUI
{
/**
* Constructs a new <code>SpinnerUI</code>.
*/
public SpinnerUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/SplitPaneUI.java b/libjava/classpath/javax/swing/plaf/SplitPaneUI.java
index ea9af2b1716..59ededf5847 100644
--- a/libjava/classpath/javax/swing/plaf/SplitPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/SplitPaneUI.java
@@ -51,14 +51,14 @@ import javax.swing.JSplitPane;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class SplitPaneUI
- extends ComponentUI
+public abstract class SplitPaneUI extends ComponentUI
{
/**
* Constructs a new <code>SplitPaneUI</code>.
*/
public SplitPaneUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/TabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/TabbedPaneUI.java
index 6ab823b50a8..01a7720148f 100644
--- a/libjava/classpath/javax/swing/plaf/TabbedPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/TabbedPaneUI.java
@@ -51,14 +51,14 @@ import javax.swing.JTabbedPane;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TabbedPaneUI
- extends ComponentUI
+public abstract class TabbedPaneUI extends ComponentUI
{
/**
* Constructs a new <code>TabbedPaneUI</code>.
*/
public TabbedPaneUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/TableHeaderUI.java b/libjava/classpath/javax/swing/plaf/TableHeaderUI.java
index f23ca74d7ed..34ac0e0fc55 100644
--- a/libjava/classpath/javax/swing/plaf/TableHeaderUI.java
+++ b/libjava/classpath/javax/swing/plaf/TableHeaderUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TableHeaderUI
- extends ComponentUI
+public abstract class TableHeaderUI extends ComponentUI
{
/**
* Constructs a new <code>TableHeaderUI</code>.
*/
public TableHeaderUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/TableUI.java b/libjava/classpath/javax/swing/plaf/TableUI.java
index e56bcd13160..a8c6bf909d9 100644
--- a/libjava/classpath/javax/swing/plaf/TableUI.java
+++ b/libjava/classpath/javax/swing/plaf/TableUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TableUI
- extends ComponentUI
+public abstract class TableUI extends ComponentUI
{
/**
* Constructs a new <code>TableUI</code>.
*/
public TableUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/TextUI.java b/libjava/classpath/javax/swing/plaf/TextUI.java
index dcabdfcdbf3..9f2737cc26f 100644
--- a/libjava/classpath/javax/swing/plaf/TextUI.java
+++ b/libjava/classpath/javax/swing/plaf/TextUI.java
@@ -57,14 +57,14 @@ import javax.swing.text.View;
* @author Ronald Veldema (rveldema@cs.vu.nl)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TextUI
- extends ComponentUI
+public abstract class TextUI extends ComponentUI
{
/**
* Constructs a new <code>TextUI</code>.
*/
public TextUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/ToolBarUI.java b/libjava/classpath/javax/swing/plaf/ToolBarUI.java
index 730cf4887db..9a26e7b59d5 100644
--- a/libjava/classpath/javax/swing/plaf/ToolBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/ToolBarUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ToolBarUI
- extends ComponentUI
+public abstract class ToolBarUI extends ComponentUI
{
/**
* Constructs a new <code>ToolBarUI</code>.
*/
public ToolBarUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/ToolTipUI.java b/libjava/classpath/javax/swing/plaf/ToolTipUI.java
index 4383d0edd11..ae2d465e51c 100644
--- a/libjava/classpath/javax/swing/plaf/ToolTipUI.java
+++ b/libjava/classpath/javax/swing/plaf/ToolTipUI.java
@@ -47,13 +47,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ToolTipUI
- extends ComponentUI
+public abstract class ToolTipUI extends ComponentUI
{
/**
* Constructs a new <code>ToolTipUI</code>.
*/
public ToolTipUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/TreeUI.java b/libjava/classpath/javax/swing/plaf/TreeUI.java
index e32952de70f..308ec63e2a8 100644
--- a/libjava/classpath/javax/swing/plaf/TreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/TreeUI.java
@@ -51,14 +51,14 @@ import javax.swing.tree.TreePath;
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class TreeUI
- extends ComponentUI
+public abstract class TreeUI extends ComponentUI
{
/**
* Constructs a new <code>TreeUI</code>.
*/
public TreeUI()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/UIResource.java b/libjava/classpath/javax/swing/plaf/UIResource.java
index 59edf566605..fe398fe5474 100644
--- a/libjava/classpath/javax/swing/plaf/UIResource.java
+++ b/libjava/classpath/javax/swing/plaf/UIResource.java
@@ -50,6 +50,10 @@ package javax.swing.plaf;
* they are initialized or set to <code>null</code>.
*
* @author Brian Jones
+ *
* @see ComponentUI
*/
-public interface UIResource { }
+public interface UIResource
+{
+ // This is a marker interface and declares no methods.
+}
diff --git a/libjava/classpath/javax/swing/plaf/ViewportUI.java b/libjava/classpath/javax/swing/plaf/ViewportUI.java
index 087938f1ed2..db514de1a4e 100644
--- a/libjava/classpath/javax/swing/plaf/ViewportUI.java
+++ b/libjava/classpath/javax/swing/plaf/ViewportUI.java
@@ -48,13 +48,13 @@ package javax.swing.plaf;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public abstract class ViewportUI
- extends ComponentUI
+public abstract class ViewportUI extends ComponentUI
{
/**
* Constructs a new <code>ViewportUI</code>.
*/
public ViewportUI()
{
+ // Nothing to do here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
index 836ef223494..69d4415371f 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicArrowButton.java
@@ -39,42 +39,30 @@ exception statement from your version. */
package javax.swing.plaf.basic;
import java.awt.Color;
-import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.Insets;
import java.awt.Polygon;
import java.awt.Rectangle;
+import javax.swing.ButtonModel;
import javax.swing.JButton;
import javax.swing.SwingConstants;
-import javax.swing.border.Border;
/**
- * This class draws simple arrow buttons for the Basic Look and Feel.
+ * A button that displays an arrow (triangle) that points {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} or {@link #WEST}. This button is used by
+ * the {@link BasicComboBoxUI} class.
+ *
+ * @see BasicComboBoxUI#createArrowButton
*/
public class BasicArrowButton extends JButton implements SwingConstants
{
- /** The default size of the Arrow buttons. */
- private static int defaultSize = 12;
- /** The Polygon that points up. */
- private static Polygon upIcon = new Polygon(new int[] { 0, 5, 9 },
- new int[] { 7, 2, 7 }, 3);
-
- /** The Polygon that points down. */
- private static Polygon downIcon = new Polygon(new int[] { 1, 5, 9 },
- new int[] { 3, 7, 3 }, 3);
-
- /** The Polygon that points left. */
- private static Polygon leftIcon = new Polygon(new int[] { 7, 3, 7 },
- new int[] { 1, 5, 9 }, 3);
-
- /** The Polygon that points right. */
- private static Polygon rightIcon = new Polygon(new int[] { 3, 7, 3 },
- new int[] { 1, 5, 9 }, 3);
-
- /** The direction to point in. */
+ /**
+ * The direction that the arrow points.
+ *
+ * @see #getDirection()
+ */
protected int direction;
/**
@@ -89,7 +77,7 @@ public class BasicArrowButton extends JButton implements SwingConstants
* edges of the button.
* This is package-private to avoid an accessor method.
*/
- transient Color darkShadow = Color.DARK_GRAY;
+ transient Color darkShadow = new Color(102, 102, 102);
/**
* The top and left edges of the button.
@@ -97,51 +85,15 @@ public class BasicArrowButton extends JButton implements SwingConstants
*/
transient Color highlight = Color.WHITE;
- /** The border around the ArrowButton. */
- private transient Border buttonBorder = new Border()
- {
- public Insets getBorderInsets(Component c)
- {
- return new Insets(2, 2, 2, 2);
- }
-
- public boolean isBorderOpaque()
- {
- return true;
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int w,
- int h)
- {
- Color saved = g.getColor();
- g.setColor(highlight);
-
- g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
- g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
-
- g.setColor(shadow);
-
- g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
- g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
-
- g.setColor(darkShadow);
-
- g.drawLine(x, y + h, x + w, y + h);
- g.drawLine(x + w, y, x + w, y + h);
-
- g.setColor(saved);
- }
- };
-
/**
- * Creates a new BasicArrowButton object.
+ * Creates a new <code>BasicArrowButton</code> object.
*
- * @param direction The direction the arrow points in.
+ * @param direction The direction the arrow points in (one of:
+ * {@link #NORTH}, {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
*/
public BasicArrowButton(int direction)
{
super();
- setBorder(buttonBorder);
setDirection(direction);
}
@@ -149,7 +101,8 @@ public class BasicArrowButton extends JButton implements SwingConstants
* Creates a new BasicArrowButton object with the given colors and
* direction.
*
- * @param direction The direction to point in.
+ * @param direction The direction to point in (one of:
+ * {@link #NORTH}, {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
* @param background The background color.
* @param shadow The shadow color.
* @param darkShadow The dark shadow color.
@@ -166,9 +119,10 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * This method returns whether the focus can traverse to this component.
+ * Returns whether the focus can traverse to this component. This method
+ * always returns <code>false</code>.
*
- * @return Whether the focus can traverse to this component.
+ * @return <code>false</code>.
*/
public boolean isFocusTraversable()
{
@@ -176,7 +130,8 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * This method returns the direction of the arrow.
+ * Returns the direction of the arrow (one of: {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
*
* @return The direction of the arrow.
*/
@@ -186,9 +141,10 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * This method changes the direction of the arrow.
+ * Sets the direction of the arrow.
*
- * @param dir The new direction of the arrow.
+ * @param dir The new direction of the arrow (one of: {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
*/
public void setDirection(int dir)
{
@@ -196,7 +152,7 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * This method paints the arrow button. The painting is delegated to the
+ * Paints the arrow button. The painting is delegated to the
* paintTriangle method.
*
* @param g The Graphics object to paint with.
@@ -204,147 +160,257 @@ public class BasicArrowButton extends JButton implements SwingConstants
public void paint(Graphics g)
{
super.paint(g);
- Insets insets = getInsets();
Rectangle bounds = getBounds();
- int x = insets.left
- + (bounds.width - insets.left - insets.right - defaultSize) / 2;
- int y = insets.top
- + (bounds.height - insets.left - insets.right - defaultSize) / 2;
- paintTriangle(g, x, y, defaultSize, direction, isEnabled());
+ int size = bounds.height / 4;
+ int x = (bounds.width - size) / 2;
+ int y = (bounds.height - size) / 2;
+ ButtonModel m = getModel();
+ if (m.isArmed())
+ {
+ x++;
+ y++;
+ }
+ paintTriangle(g, x, y, size, direction, isEnabled());
}
+ /** The preferred size for the button. */
+ private static final Dimension PREFERRED_SIZE = new Dimension(16, 16);
+
+ /** The minimum size for the button. */
+ private static final Dimension MINIMUM_SIZE = new Dimension(5, 5);
+
+ /** The maximum size for the button. */
+ private static final Dimension MAXIMUM_SIZE
+ = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+
/**
- * This method returns the preferred size of the arrow button.
+ * Returns the preferred size of the arrow button.
*
- * @return The preferred size.
+ * @return The preferred size (always 16 x 16).
*/
public Dimension getPreferredSize()
{
- Insets insets = getInsets();
- int w = defaultSize + insets.left + insets.right;
- int h = defaultSize + insets.top + insets.bottom;
-
- return new Dimension(w, h);
+ return PREFERRED_SIZE;
}
/**
- * This method returns the minimum size of the arrow button.
+ * Returns the minimum size of the arrow button.
*
- * @return The minimum size.
+ * @return The minimum size (always 5 x 5).
*/
public Dimension getMinimumSize()
{
- return getPreferredSize();
+ return MINIMUM_SIZE;
}
/**
- * This method returns the maximum size of the arrow button.
+ * Returns the maximum size of the arrow button.
*
* @return The maximum size.
*/
public Dimension getMaximumSize()
{
- return getPreferredSize();
+ return MAXIMUM_SIZE;
}
/**
- * The method paints a triangle with the given size and direction at the
- * given x and y coordinates.
+ * Paints a triangle with the given size, location and direction. It is
+ * difficult to explain the rationale behind the positioning of the triangle
+ * relative to the given (x, y) position - by trial and error we seem to
+ * match the behaviour of the reference implementation (which is missing a
+ * specification for this method).
*
- * @param g The Graphics object to paint with.
- * @param x The x coordinate to paint at.
- * @param y The y coordinate to paint at.
- * @param size The size of the icon.
- * @param direction The direction of the icon.
- * @param isEnabled Whether it is enabled.
+ * @param g the graphics device.
+ * @param x the x-coordinate for the triangle's location.
+ * @param y the y-coordinate for the triangle's location.
+ * @param size the arrow size (depth).
+ * @param direction the direction of the arrow (one of: {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} and {@link #WEST}).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
*/
public void paintTriangle(Graphics g, int x, int y, int size, int direction,
boolean isEnabled)
{
- Polygon arrow = null;
- switch (direction)
- {
- case NORTH:
- arrow = upIcon;
- break;
- case SOUTH:
- arrow = downIcon;
- break;
- case EAST:
- case RIGHT:
- arrow = rightIcon;
- break;
- case WEST:
- case LEFT:
- arrow = leftIcon;
- break;
- }
-
- int[] xPoints = arrow.xpoints;
- int[] yPoints = arrow.ypoints;
- int x1;
- int y1;
- int x2;
- int y2;
- x1 = y1 = x2 = y2 = 0;
-
- if (size != defaultSize)
- {
- float scale = size * 1f / defaultSize;
- for (int i = 0; i < 3; i++)
- {
- xPoints[i] *= scale;
- yPoints[i] *= scale;
- }
- }
- g.translate(x, y);
-
+ Color savedColor = g.getColor();
switch (direction)
{
case NORTH:
- x1 = xPoints[0] + 2;
- y1 = yPoints[0];
- y2 = y1;
- x2 = xPoints[2] - 1;
- break;
+ paintTriangleNorth(g, x, y, size, isEnabled);
+ break;
case SOUTH:
- x1 = xPoints[1];
- y1 = yPoints[1] + 1;
- x2 = xPoints[2] - 1;
- y2 = yPoints[2];
- break;
+ paintTriangleSouth(g, x, y, size, isEnabled);
+ break;
case LEFT:
case WEST:
- x1 = xPoints[0] + 1;
- y1 = yPoints[0] + 1;
- x2 = x1;
- y2 = yPoints[2] + 1;
- break;
+ paintTriangleWest(g, x, y, size, isEnabled);
+ break;
case RIGHT:
case EAST:
- x1 = xPoints[2];
- y1 = yPoints[2] + 1;
- x2 = xPoints[1] - 1;
- y2 = yPoints[1] + 1;
- break;
+ paintTriangleEast(g, x, y, size, isEnabled);
+ break;
}
- Color saved = g.getColor();
-
+ g.setColor(savedColor);
+ }
+
+ /**
+ * Paints an upward-pointing triangle. This method is called by the
+ * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method.
+ *
+ * @param g the graphics device.
+ * @param x the x-coordinate for the anchor point.
+ * @param y the y-coordinate for the anchor point.
+ * @param size the arrow size (depth).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
+ */
+ private void paintTriangleNorth(Graphics g, int x, int y, int size,
+ boolean isEnabled)
+ {
+ int tipX = x + (size - 2) / 2;
+ int tipY = y;
+ int baseX1 = tipX - (size - 1);
+ int baseX2 = tipX + (size - 1);
+ int baseY = y + (size - 1);
+ Polygon triangle = new Polygon();
+ triangle.addPoint(tipX, tipY);
+ triangle.addPoint(baseX1, baseY);
+ triangle.addPoint(baseX2, baseY);
if (isEnabled)
- {
- g.setColor(Color.DARK_GRAY);
-
- if (arrow != null)
- g.fillPolygon(xPoints, yPoints, 3);
- }
+ {
+ g.setColor(Color.DARK_GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ }
else
- {
- g.setColor(Color.GRAY);
- g.fillPolygon(xPoints, yPoints, 3);
- g.setColor(Color.WHITE);
- g.drawLine(x1, y1, x2, y2);
- }
- g.setColor(saved);
- g.translate(-x, -y);
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ g.setColor(Color.WHITE);
+ g.drawLine(baseX1 + 1, baseY + 1, baseX2 + 1, baseY + 1);
+ }
+ }
+
+ /**
+ * Paints an downward-pointing triangle. This method is called by the
+ * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method.
+ *
+ * @param g the graphics device.
+ * @param x the x-coordinate for the anchor point.
+ * @param y the y-coordinate for the anchor point.
+ * @param size the arrow size (depth).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
+ */
+ private void paintTriangleSouth(Graphics g, int x, int y, int size,
+ boolean isEnabled)
+ {
+ int tipX = x + (size - 2) / 2;
+ int tipY = y + (size - 1);
+ int baseX1 = tipX - (size - 1);
+ int baseX2 = tipX + (size - 1);
+ int baseY = y;
+ Polygon triangle = new Polygon();
+ triangle.addPoint(tipX, tipY);
+ triangle.addPoint(baseX1, baseY);
+ triangle.addPoint(baseX2, baseY);
+ if (isEnabled)
+ {
+ g.setColor(Color.DARK_GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ }
+ else
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ g.setColor(Color.WHITE);
+ g.drawLine(tipX + 1, tipY, baseX2, baseY + 1);
+ g.drawLine(tipX + 1, tipY + 1, baseX2 + 1, baseY + 1);
+ }
+ }
+
+ /**
+ * Paints a right-pointing triangle. This method is called by the
+ * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method.
+ *
+ * @param g the graphics device.
+ * @param x the x-coordinate for the anchor point.
+ * @param y the y-coordinate for the anchor point.
+ * @param size the arrow size (depth).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
+ */
+ private void paintTriangleEast(Graphics g, int x, int y, int size,
+ boolean isEnabled)
+ {
+ int tipX = x + (size - 1);
+ int tipY = y + (size - 2) / 2;
+ int baseX = x;
+ int baseY1 = tipY - (size - 1);
+ int baseY2 = tipY + (size - 1);
+
+ Polygon triangle = new Polygon();
+ triangle.addPoint(tipX, tipY);
+ triangle.addPoint(baseX, baseY1);
+ triangle.addPoint(baseX, baseY2);
+ if (isEnabled)
+ {
+ g.setColor(Color.DARK_GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ }
+ else
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ g.setColor(Color.WHITE);
+ g.drawLine(baseX + 1, baseY2, tipX, tipY + 1);
+ g.drawLine(baseX + 1, baseY2 + 1, tipX + 1, tipY + 1);
+ }
+ }
+
+ /**
+ * Paints a left-pointing triangle. This method is called by the
+ * {@link #paintTriangle(Graphics, int, int, int, int, boolean)} method.
+ *
+ * @param g the graphics device.
+ * @param x the x-coordinate for the anchor point.
+ * @param y the y-coordinate for the anchor point.
+ * @param size the arrow size (depth).
+ * @param isEnabled if <code>true</code> the arrow is drawn in the enabled
+ * state, otherwise it is drawn in the disabled state.
+ */
+ private void paintTriangleWest(Graphics g, int x, int y, int size,
+ boolean isEnabled)
+ {
+ int tipX = x;
+ int tipY = y + (size - 2) / 2;
+ int baseX = x + (size - 1);
+ int baseY1 = tipY - (size - 1);
+ int baseY2 = tipY + (size - 1);
+
+ Polygon triangle = new Polygon();
+ triangle.addPoint(tipX, tipY);
+ triangle.addPoint(baseX, baseY1);
+ triangle.addPoint(baseX, baseY2);
+ if (isEnabled)
+ {
+ g.setColor(Color.DARK_GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ }
+ else
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(triangle);
+ g.drawPolygon(triangle);
+ g.setColor(Color.WHITE);
+ g.drawLine(baseX + 1, baseY1 + 1, baseX + 1, baseY2 + 1);
+ }
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java b/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java
index e7d6e433877..5d4ce18932b 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicBorders.java
@@ -51,7 +51,6 @@ import javax.swing.JButton;
import javax.swing.JPopupMenu;
import javax.swing.JSplitPane;
import javax.swing.JToolBar;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.AbstractBorder;
import javax.swing.border.BevelBorder;
@@ -95,21 +94,18 @@ public class BasicBorders
*/
public static Border getButtonBorder()
{
- UIDefaults defaults;
Border outer;
- defaults = UIManager.getLookAndFeelDefaults();
-
/* The keys for UIDefaults have been determined by writing a
* test program that dumps the UIDefaults to stdout; that program
* was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API,
* the key "light" is usually called "highlight", and "highlight"
* is usually called "lightHighlight".
*/
- outer = new ButtonBorder(defaults.getColor("Button.shadow"),
- defaults.getColor("Button.darkShadow"),
- defaults.getColor("Button.light"),
- defaults.getColor("Button.highlight"));
+ outer = new ButtonBorder(UIManager.getColor("Button.shadow"),
+ UIManager.getColor("Button.darkShadow"),
+ UIManager.getColor("Button.light"),
+ UIManager.getColor("Button.highlight"));
/* While the inner border is shared between multiple buttons,
* we do not share the outer border because ButtonBorders store
@@ -145,11 +141,8 @@ public class BasicBorders
*/
public static Border getRadioButtonBorder()
{
- UIDefaults defaults;
Border outer;
- defaults = UIManager.getLookAndFeelDefaults();
-
/* The keys for UIDefaults have been determined by writing a
* test program that dumps the UIDefaults to stdout; that program
* was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API,
@@ -157,10 +150,10 @@ public class BasicBorders
* is usually called "lightHighlight".
*/
outer = new RadioButtonBorder(
- defaults.getColor("RadioButton.shadow"),
- defaults.getColor("RadioButton.darkShadow"),
- defaults.getColor("RadioButton.light"),
- defaults.getColor("RadioButton.highlight"));
+ UIManager.getColor("RadioButton.shadow"),
+ UIManager.getColor("RadioButton.darkShadow"),
+ UIManager.getColor("RadioButton.light"),
+ UIManager.getColor("RadioButton.highlight"));
/* While the inner border is shared between multiple buttons, we
* do not share the outer border because RadioButtonBorders, being
@@ -197,11 +190,8 @@ public class BasicBorders
*/
public static Border getToggleButtonBorder()
{
- UIDefaults defaults;
Border outer;
- defaults = UIManager.getLookAndFeelDefaults();
-
/* The keys for UIDefaults have been determined by writing a
* test program that dumps the UIDefaults to stdout; that program
* was run on a JDK 1.4.1_01 for GNU/Linux. Note that in the API,
@@ -209,10 +199,10 @@ public class BasicBorders
* is usually called "lightHighlight".
*/
outer = new ToggleButtonBorder(
- defaults.getColor("ToggleButton.shadow"),
- defaults.getColor("ToggleButton.darkShadow"),
- defaults.getColor("ToggleButton.light"),
- defaults.getColor("ToggleButton.highlight"));
+ UIManager.getColor("ToggleButton.shadow"),
+ UIManager.getColor("ToggleButton.darkShadow"),
+ UIManager.getColor("ToggleButton.light"),
+ UIManager.getColor("ToggleButton.highlight"));
/* While the inner border is shared between multiple buttons, we
* do not share the outer border because ToggleButtonBorders, being
@@ -247,12 +237,9 @@ public class BasicBorders
*/
public static Border getMenuBarBorder()
{
- UIDefaults defaults;
-
/* See comment in methods above for why this border is not shared. */
- defaults = UIManager.getLookAndFeelDefaults();
- return new MenuBarBorder(defaults.getColor("MenuBar.shadow"),
- defaults.getColor("MenuBar.highlight"));
+ return new MenuBarBorder(UIManager.getColor("MenuBar.shadow"),
+ UIManager.getColor("MenuBar.highlight"));
}
@@ -279,12 +266,9 @@ public class BasicBorders
*/
public static Border getSplitPaneBorder()
{
- UIDefaults defaults;
-
/* See comment in methods above for why this border is not shared. */
- defaults = UIManager.getLookAndFeelDefaults();
- return new SplitPaneBorder(defaults.getColor("SplitPane.highlight"),
- defaults.getColor("SplitPane.darkShadow"));
+ return new SplitPaneBorder(UIManager.getColor("SplitPane.highlight"),
+ UIManager.getColor("SplitPane.darkShadow"));
}
@@ -314,13 +298,10 @@ public class BasicBorders
*/
public static Border getSplitPaneDividerBorder()
{
- UIDefaults defaults;
-
/* See comment in methods above for why this border is not shared. */
- defaults = UIManager.getLookAndFeelDefaults();
return new SplitPaneDividerBorder(
- defaults.getColor("SplitPane.highlight"),
- defaults.getColor("SplitPane.darkShadow"));
+ UIManager.getColor("SplitPane.highlight"),
+ UIManager.getColor("SplitPane.darkShadow"));
}
@@ -346,15 +327,12 @@ public class BasicBorders
*/
public static Border getTextFieldBorder()
{
- UIDefaults defaults;
-
/* See comment in methods above for why this border is not shared. */
- defaults = UIManager.getLookAndFeelDefaults();
return new FieldBorder(
- defaults.getColor("TextField.shadow"),
- defaults.getColor("TextField.darkShadow"),
- defaults.getColor("TextField.light"),
- defaults.getColor("TextField.highlight"));
+ UIManager.getColor("TextField.shadow"),
+ UIManager.getColor("TextField.darkShadow"),
+ UIManager.getColor("TextField.light"),
+ UIManager.getColor("TextField.highlight"));
}
@@ -394,17 +372,14 @@ public class BasicBorders
*/
public static Border getInternalFrameBorder()
{
- UIDefaults defaults;
Color shadow, darkShadow, highlight, lightHighlight, line;
/* See comment in methods above for why this border is not shared. */
- defaults = UIManager.getLookAndFeelDefaults();
-
- shadow = defaults.getColor("InternalFrame.borderShadow");
- darkShadow = defaults.getColor("InternalFrame.borderDarkShadow");
- highlight = defaults.getColor("InternalFrame.borderLight");
- lightHighlight = defaults.getColor("InternalFrame.borderHighlight");
- line = defaults.getColor("InternalFrame.borderColor");
+ shadow = UIManager.getColor("InternalFrame.borderShadow");
+ darkShadow = UIManager.getColor("InternalFrame.borderDarkShadow");
+ highlight = UIManager.getColor("InternalFrame.borderLight");
+ lightHighlight = UIManager.getColor("InternalFrame.borderHighlight");
+ line = UIManager.getColor("InternalFrame.borderColor");
return new BorderUIResource.CompoundBorderUIResource(
/* outer border */
@@ -806,9 +781,9 @@ public class BasicBorders
*/
public MarginBorder()
{
+ // Nothing to do here.
}
-
/**
* Measures the width of this border.
*
@@ -1313,33 +1288,32 @@ public class BasicBorders
*
* @author Sascha Brawer (brawer@dandelis.ch)
*/
- public static class SplitPaneBorder
- implements Border, UIResource
+ public static class SplitPaneBorder implements Border, UIResource
{
/**
* Indicates that the top edge shall be not be painted
- * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ * by {@link #paintRect}.
*/
private static final int SUPPRESS_TOP = 1;
/**
* Indicates that the left edge shall be not be painted
- * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ * by {@link #paintRect}.
*/
private static final int SUPPRESS_LEFT = 2;
/**
* Indicates that the bottom edge shall be not be painted
- * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ * by {@link #paintRect}.
*/
private static final int SUPPRESS_BOTTOM = 4;
/**
* Indicates that the right edge shall be not be painted
- * by {@link #paintRect(java.awt.Graphics, int, int, int, int, int)}.
+ * by {@link #paintRect}.
*/
private static final int SUPPRESS_RIGHT = 8;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java b/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java
index 5349f524049..1fca694519f 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicButtonListener.java
@@ -55,9 +55,8 @@ import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
-public class BasicButtonListener
- implements MouseListener, MouseMotionListener, FocusListener,
- ChangeListener, PropertyChangeListener
+public class BasicButtonListener implements MouseListener, MouseMotionListener,
+ FocusListener, ChangeListener, PropertyChangeListener
{
public BasicButtonListener(AbstractButton b)
{
@@ -66,10 +65,12 @@ public class BasicButtonListener
public void propertyChange(PropertyChangeEvent e)
{
+ // TODO: What should be done here, if anything?
}
protected void checkOpacity(AbstractButton b)
{
+ // TODO: What should be done here?
}
public void focusGained(FocusEvent e)
@@ -129,18 +130,22 @@ public class BasicButtonListener
public void stateChanged(ChangeEvent e)
{
+ // TODO: What should be done here, if anything?
}
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
public void mouseDragged(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
public void mouseClicked(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java
index 6c80f14b6fc..7a63331b9c8 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicButtonUI.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
@@ -49,13 +48,18 @@ import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.InputMap;
+import javax.swing.JButton;
import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ButtonUI;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
+/**
+ * A UI delegate for the {@link JButton} component.
+ */
public class BasicButtonUI extends ButtonUI
{
/**
@@ -72,13 +76,11 @@ public class BasicButtonUI extends ButtonUI
private int textShiftOffset;
- private Color focusColor;
-
/**
* Factory method to create an instance of BasicButtonUI for a given
* {@link JComponent}, which should be an {@link AbstractButton}.
*
- * @param c The component to create a UI got
+ * @param c The component.
*
* @return A new UI capable of drawing the component
*/
@@ -87,21 +89,46 @@ public class BasicButtonUI extends ButtonUI
return new BasicButtonUI();
}
+ /**
+ * Returns the default gap between the button's text and icon (in pixels).
+ *
+ * @param b the button (ignored).
+ *
+ * @return The gap.
+ */
public int getDefaultTextIconGap(AbstractButton b)
{
return defaultTextIconGap;
}
+ /**
+ * Sets the text shift offset to zero.
+ *
+ * @see #setTextShiftOffset()
+ */
protected void clearTextShiftOffset()
{
textShiftOffset = 0;
}
+ /**
+ * Returns the text shift offset.
+ *
+ * @return The text shift offset.
+ *
+ * @see #clearTextShiftOffset()
+ * @see #setTextShiftOffset()
+ */
protected int getTextShiftOffset()
{
return textShiftOffset;
}
+ /**
+ * Sets the text shift offset to the value in {@link #defaultTextShiftOffset}.
+ *
+ * @see #clearTextShiftOffset()
+ */
protected void setTextShiftOffset()
{
textShiftOffset = defaultTextShiftOffset;
@@ -118,23 +145,32 @@ public class BasicButtonUI extends ButtonUI
return "Button.";
}
+ /**
+ * Installs the default settings.
+ *
+ * @param b the button (<code>null</code> not permitted).
+ */
protected void installDefaults(AbstractButton b)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
String prefix = getPropertyPrefix();
- focusColor = defaults.getColor(prefix + "focus");
- b.setForeground(defaults.getColor(prefix + "foreground"));
- b.setBackground(defaults.getColor(prefix + "background"));
- b.setMargin(defaults.getInsets(prefix + "margin"));
- b.setBorder(defaults.getBorder(prefix + "border"));
- b.setIconTextGap(defaults.getInt(prefix + "textIconGap"));
+ LookAndFeel.installColorsAndFont(b, prefix + "background",
+ prefix + "foreground", prefix + "font");
+ LookAndFeel.installBorder(b, prefix + "border");
+ b.setMargin(UIManager.getInsets(prefix + "margin"));
+ b.setIconTextGap(UIManager.getInt(prefix + "textIconGap"));
b.setInputMap(JComponent.WHEN_FOCUSED,
- (InputMap) defaults.get(prefix + "focusInputMap"));
- b.setOpaque(true);
+ (InputMap) UIManager.get(prefix + "focusInputMap"));
}
+ /**
+ * Removes the defaults added by {@link #installDefaults(AbstractButton)}.
+ *
+ * @param b the button (<code>null</code> not permitted).
+ */
protected void uninstallDefaults(AbstractButton b)
{
+ if (b.getFont() instanceof UIResource)
+ b.setFont(null);
b.setForeground(null);
b.setBackground(null);
b.setBorder(null);
@@ -144,11 +180,25 @@ public class BasicButtonUI extends ButtonUI
protected BasicButtonListener listener;
+ /**
+ * Creates and returns a new instance of {@link BasicButtonListener}. This
+ * method provides a hook to make it easy for subclasses to install a
+ * different listener.
+ *
+ * @param b the button.
+ *
+ * @return A new listener.
+ */
protected BasicButtonListener createButtonListener(AbstractButton b)
{
return new BasicButtonListener(b);
}
+ /**
+ * Installs listeners for the button.
+ *
+ * @param b the button (<code>null</code> not permitted).
+ */
protected void installListeners(AbstractButton b)
{
listener = createButtonListener(b);
@@ -159,6 +209,11 @@ public class BasicButtonUI extends ButtonUI
b.addMouseMotionListener(listener);
}
+ /**
+ * Uninstalls listeners for the button.
+ *
+ * @param b the button (<code>null</code> not permitted).
+ */
protected void uninstallListeners(AbstractButton b)
{
b.removeChangeListener(listener);
@@ -215,12 +270,12 @@ public class BasicButtonUI extends ButtonUI
return d;
}
- private static Icon currentIcon(AbstractButton b)
+ static Icon currentIcon(AbstractButton b)
{
Icon i = b.getIcon();
ButtonModel model = b.getModel();
- if (model.isPressed() && b.getPressedIcon() != null)
+ if (model.isPressed() && b.getPressedIcon() != null && b.isEnabled())
i = b.getPressedIcon();
else if (model.isRollover())
@@ -231,7 +286,7 @@ public class BasicButtonUI extends ButtonUI
i = b.getRolloverIcon();
}
- else if (b.isSelected())
+ else if (b.isSelected() && b.isEnabled())
{
if (b.isEnabled() && b.getSelectedIcon() != null)
i = b.getSelectedIcon();
@@ -264,7 +319,10 @@ public class BasicButtonUI extends ButtonUI
g.setFont(f);
- SwingUtilities.calculateInnerArea(b, vr);
+ if (b.isBorderPainted())
+ SwingUtilities.calculateInnerArea(b, vr);
+ else
+ vr = SwingUtilities.getLocalBounds(b);
String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f),
b.getText(),
currentIcon(b),
@@ -279,13 +337,11 @@ public class BasicButtonUI extends ButtonUI
if ((b.getModel().isArmed() && b.getModel().isPressed())
|| b.isSelected())
paintButtonPressed(g, b);
- else
- paintButtonNormal(g, vr, c);
paintIcon(g, c, ir);
if (text != null)
paintText(g, b, tr, text);
- if (b.isFocusOwner())
+ if (b.isFocusOwner() && b.isFocusPainted())
paintFocus(g, b, vr, tr, ir);
}
@@ -331,44 +387,25 @@ public class BasicButtonUI extends ButtonUI
/**
* Paints the background area of an {@link AbstractButton} in the pressed
- * state. This means filling the supplied area with the {@link
- * pressedBackgroundColor}.
+ * state. This means filling the supplied area with a darker than normal
+ * background.
*
* @param g The graphics context to paint with
* @param b The button to paint the state of
*/
protected void paintButtonPressed(Graphics g, AbstractButton b)
{
- if (b.isContentAreaFilled())
- {
- Rectangle area = new Rectangle();
- SwingUtilities.calculateInnerArea(b, area);
- g.setColor(b.getBackground().darker());
- g.fillRect(area.x, area.y, area.width, area.height);
- }
- }
-
- /**
- * Paints the background area of an {@link AbstractButton} in the normal,
- * non-pressed state. This means filling the supplied area with the
- * {@link normalBackgroundColor}.
- *
- * @param g The graphics context to paint with
- * @param area The area in which to paint
- * @param b The component to paint the state of
- */
- private void paintButtonNormal(Graphics g, Rectangle area, JComponent b)
- {
- if (((AbstractButton)b).isContentAreaFilled() && b.isOpaque())
+ if (b.isContentAreaFilled() && b.isOpaque())
{
- g.setColor(b.getBackground());
+ Rectangle area = new Rectangle();
+ SwingUtilities.calculateInnerArea(b, area);
+ g.setColor(UIManager.getColor(getPropertyPrefix() + "shadow"));
g.fillRect(area.x, area.y, area.width, area.height);
}
}
/**
- * Paints the "text" property of an {@link AbstractButton}, using the
- * {@link textColor} color.
+ * Paints the "text" property of an {@link AbstractButton}.
*
* @param g The graphics context to paint with
* @param c The component to paint the state of
@@ -382,8 +419,7 @@ public class BasicButtonUI extends ButtonUI
}
/**
- * Paints the "text" property of an {@link AbstractButton}, using the
- * {@link textColor} color.
+ * Paints the "text" property of an {@link AbstractButton}.
*
* @param g The graphics context to paint with
* @param b The button to paint the state of
@@ -401,15 +437,14 @@ public class BasicButtonUI extends ButtonUI
if (b.isEnabled())
{
- g.setColor(b.getForeground());
- g.drawString(text, textRect.x, textRect.y + fm.getAscent());
+ g.setColor(b.getForeground());
+ g.drawString(text, textRect.x, textRect.y + fm.getAscent());
}
else
{
- g.setColor(b.getBackground().brighter());
- g.drawString(text, textRect.x, textRect.y + fm.getAscent());
- g.setColor(b.getBackground().darker());
- g.drawString(text, textRect.x + 1, textRect.y + fm.getAscent() + 1);
+ String prefix = getPropertyPrefix();
+ g.setColor(UIManager.getColor(prefix + "disabledText"));
+ g.drawString(text, textRect.x, textRect.y + fm.getAscent());
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
index 945aea53dc3..95e0dc98257 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
@@ -53,6 +53,15 @@ import javax.swing.plaf.ComponentUI;
*/
public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
{
+
+ /**
+ * Creates a new BasicCheckBoxMenuItemUI object.
+ */
+ public BasicCheckBoxMenuItemUI()
+ {
+ super();
+ }
+
/**
* Factory method to create a BasicCheckBoxMenuItemUI for the given {@link
* JComponent}, which should be a JCheckBoxMenuItem
@@ -77,18 +86,6 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
}
/**
- * This method installs the defaults that are defined in the Basic look and
- * feel for this JRadioButtonMenuItem
- */
- protected void installDefaults()
- {
- super.installDefaults();
-
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- checkIcon = defaults.getIcon("CheckBoxMenuItem.checkIcon");
- }
-
- /**
* DOCUMENT ME!
*
* @param item DOCUMENT ME!
@@ -100,5 +97,7 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI
MenuElement[] path,
MenuSelectionManager manager)
{
+ // TODO: May not be implemented properly.
+ item.processMouseEvent(e, path, manager);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java
index 3cf02a00156..14dadb85cf9 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java
@@ -40,7 +40,6 @@ package javax.swing.plaf.basic;
import javax.swing.Icon;
import javax.swing.JComponent;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
@@ -53,12 +52,11 @@ public class BasicCheckBoxUI extends BasicRadioButtonUI
public Icon getDefaultIcon()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- return defaults.getIcon("CheckBox.icon");
+ return UIManager.getIcon("CheckBox.icon");
}
/**
- * Returns the prefix for entries in the {@link UIDefaults} table.
+ * Returns the prefix for entries in the {@link UIManager} defaults table.
*
* @return "CheckBox."
*/
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java
index 4e6d3815453..5a872ae6368 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicColorChooserUI.java
@@ -47,8 +47,7 @@ import javax.swing.JColorChooser;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.LookAndFeel;
import javax.swing.colorchooser.AbstractColorChooserPanel;
import javax.swing.colorchooser.ColorChooserComponentFactory;
import javax.swing.event.ChangeEvent;
@@ -243,12 +242,21 @@ public class BasicColorChooserUI extends ColorChooserUI
{
uninstallListeners();
uninstallDefaults();
+ uninstallDefaultChoosers();
pane = null;
chooser = null;
}
/**
+ * Uninstalls the default color choosers that have been installed by this UI.
+ */
+ protected void uninstallDefaultChoosers()
+ {
+ defaultChoosers = null;
+ }
+
+ /**
* This method installs the preview panel for the JColorChooser.
*/
protected void installPreviewPanel()
@@ -281,11 +289,9 @@ public class BasicColorChooserUI extends ColorChooserUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- chooser.setFont(defaults.getFont("ColorChooser.font"));
- chooser.setForeground(defaults.getColor("ColorChooser.foreground"));
- chooser.setBackground(defaults.getColor("ColorChooser.background"));
+ LookAndFeel.installColorsAndFont(chooser, "ColorChooser.background",
+ "ColorChooser.foreground",
+ "ColorChooser.font");
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
index dd867f0dc55..831dde8c336 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxEditor.java
@@ -45,35 +45,34 @@ import java.awt.event.FocusListener;
import javax.swing.ComboBoxEditor;
import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
/**
- * This is a component that is responsible for displaying/editting selected
- * item in comboBox. By default, the JTextField is returned as
- * BasicComboBoxEditor.
+ * An editor used by the {@link BasicComboBoxUI} class. This editor uses a
+ * {@link JTextField} as the editor component.
*
* @author Olga Rodimina
*/
public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
FocusListener
{
+ /** The editor component. */
protected JTextField editor;
/**
- * Creates a new BasicComboBoxEditor object.
+ * Creates a new <code>BasicComboBoxEditor</code> instance.
*/
public BasicComboBoxEditor()
{
editor = new JTextField();
- editor.setBorder(new EmptyBorder(1, 1, 1, 1));
+ editor.setBorder(null);
+ editor.setColumns(9);
}
/**
- * This method returns textfield that will be used by the combo box to
- * display/edit currently selected item in the combo box.
+ * Returns the component that will be used by the combo box to display and
+ * edit the currently selected item in the combo box.
*
- * @return textfield that will be used by the combo box to display/edit
- * currently selected item
+ * @return The editor component, which is a {@link JTextField} in this case.
*/
public Component getEditorComponent()
{
@@ -98,15 +97,18 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
}
/**
- * This method returns item that is currently editable.
+ * Returns the text from the editor component.
*
- * @return item in the combo box that is currently editable
+ * @return The text from the editor component.
*/
public Object getItem()
{
return editor.getText();
}
+ /**
+ * Selects all the text in the editor component.
+ */
public void selectAll()
{
editor.selectAll();
@@ -136,8 +138,8 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
}
/**
- * This method adds actionListener to the editor. If the user will edit
- * currently selected item in the textfield and pressEnter, then action
+ * Adds an {@link ActionListener} to the editor component. If the user will
+ * edit currently selected item in the textfield and pressEnter, then action
* will be performed. The actionPerformed of this ActionListener should
* change the selected item of the comboBox to the newly editted selected
* item.
@@ -147,27 +149,32 @@ public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
*/
public void addActionListener(ActionListener l)
{
- // FIXME: Need to implement
+ editor.addActionListener(l);
}
/**
- * This method removes actionListener from the textfield.
+ * Removes the {@link ActionListener} from the editor component.
*
- * @param l the ActionListener to remove from the textfield.
+ * @param l the listener to remove.
*/
public void removeActionListener(ActionListener l)
{
- // FIXME: Need to implement
+ editor.removeActionListener(l);
}
+ /**
+ * A subclass of {@link BasicComboBoxEditor} that implements the
+ * {@link UIResource} interface.
+ */
public static class UIResource extends BasicComboBoxEditor
implements javax.swing.plaf.UIResource
{
/**
- * Creates a new UIResource object.
+ * Creates a new <code>BasicComboBoxEditor.UIResource</code> instance.
*/
public UIResource()
{
+ // Nothing to do here.
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java
index e4fbb8352a9..8115605b77a 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java
@@ -1,5 +1,5 @@
/* BasicComboBoxRenderer.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,36 +40,39 @@ package javax.swing.plaf.basic;
import java.awt.Component;
import java.awt.Dimension;
+import java.awt.FontMetrics;
import java.io.Serializable;
+import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.SwingConstants;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
/**
- * This class is renderer for the combo box.
+ * A renderer for a {@link JComboBox}.
*
* @author Olga Rodimina
*/
-public class BasicComboBoxRenderer extends JLabel implements ListCellRenderer,
- Serializable
+public class BasicComboBoxRenderer
+ extends JLabel
+ implements ListCellRenderer, Serializable
{
/**
- * This border is used whenever renderer doesn't have a focus.
+ * A shared border instance for all renderers.
*/
protected static Border noFocusBorder = new EmptyBorder(0, 0, 0, 0);
/**
- * Creates a new BasicComboBoxRenderer object.
+ * Creates a new <code>BasicComboBoxRenderer</code> object.
*/
public BasicComboBoxRenderer()
{
setHorizontalAlignment(SwingConstants.LEFT);
+ setBorder(noFocusBorder);
}
/**
@@ -83,7 +86,8 @@ public class BasicComboBoxRenderer extends JLabel implements ListCellRenderer,
}
/**
- * getListCellRendererComponent
+ * Returns a component that has been configured to display the given
+ * <code>value</code>.
*
* @param list List of items for which to the background and foreground
* colors
@@ -100,43 +104,59 @@ public class BasicComboBoxRenderer extends JLabel implements ListCellRenderer,
boolean cellHasFocus)
{
String s = value.toString();
- setText(s);
+
+ // String maybe larger than comboBox.
+ FontMetrics fm = getToolkit().getFontMetrics(list.getFont());
+ int strWidth = SwingUtilities.computeStringWidth(fm, s);
+ int cbWidth = getSize().width;
+ if (cbWidth != 0 && strWidth > cbWidth)
+ {
+ char[] str = s.toCharArray();
+ int currWidth = 0;
+ int i = 0;
+ String postStr = "... ";
+ cbWidth -= SwingUtilities.computeStringWidth(fm, postStr);
+ while (i < str.length && currWidth < cbWidth)
+ {
+ ++i;
+ currWidth = SwingUtilities.computeStringWidth(fm, new String(str, 0, i));
+ }
+ setText(new String(str, 0, i) + postStr);
+ }
+ else
+ setText(s);
+
setOpaque(true);
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- if (isSelected)
+ if (isSelected || cellHasFocus)
{
- setBackground(list.getSelectionBackground());
- setForeground(list.getSelectionForeground());
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
}
else
{
- setBackground(list.getBackground());
- setForeground(list.getForeground());
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
}
setEnabled(list.isEnabled());
setFont(list.getFont());
-
- // Use focusCellHighlightBorder when renderer has focus and
- // noFocusBorder otherwise
- if (cellHasFocus)
- setBorder(UIManager.getBorder("List.focusCellHighlightBorder"));
- else
- setBorder(noFocusBorder);
-
return this;
}
+ /**
+ * A subclass of {@link BasicComboBoxRenderer} that implements the
+ * {@link javax.swing.plaf.UIResource} interface.
+ */
public static class UIResource extends BasicComboBoxRenderer
implements javax.swing.plaf.UIResource
{
/**
- * Creates a new UIResource object.
+ * Creates a new <code>UIResource</code> object.
*/
public UIResource()
{
+ // Nothing to do here.
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
index 68e18a6ab01..b22aa15f901 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboBoxUI.java
@@ -42,6 +42,8 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.LayoutManager;
@@ -69,15 +71,17 @@ import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
-import javax.swing.UIDefaults;
+import javax.swing.LookAndFeel;
+import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
/**
- * UI Delegate for JComboBox
+ * A UI delegate for the {@link JComboBox} component.
*
* @author Olga Rodimina
* @author Robert Schuster
@@ -85,52 +89,54 @@ import javax.swing.plaf.ComponentUI;
public class BasicComboBoxUI extends ComboBoxUI
{
/**
- * This arrow button that is displayed in the rigth side of JComboBox. This
- * button is used to hide and show combo box's list of items
+ * The arrow button that is displayed in the right side of JComboBox. This
+ * button is used to hide and show combo box's list of items.
*/
protected JButton arrowButton;
/**
- * The combo box for which this UI delegate is for
+ * The combo box represented by this UI delegate.
*/
protected JComboBox comboBox;
/**
- * Component that is responsible for displaying/editting selected item of
- * the combo box. By default JTextField is used as an editor for the
- * JComboBox
+ * The component that is responsible for displaying/editing the selected
+ * item of the combo box.
+ *
+ * @see BasicComboBoxEditor#getEditorComponent()
*/
protected Component editor;
/**
- * Listener listening to focus events occuring in the JComboBox
+ * A listener listening to focus events occurring in the {@link JComboBox}.
*/
protected FocusListener focusListener;
/**
- * tells whether JComboBox currently has focus
+ * A flag indicating whether JComboBox currently has the focus.
*/
protected boolean hasFocus;
/**
- * Listener listening to item events fired by the JComboBox
+ * A listener listening to item events fired by the {@link JComboBox}.
*/
protected ItemListener itemListener;
/**
- * KeyListener listening to key events that occur while JComboBox has focus
+ * A listener listening to key events that occur while {@link JComboBox} has
+ * the focus.
*/
protected KeyListener keyListener;
/**
- * MouseListener listening to mouse events occuring in the combo box
+ * A listener listening to mouse events occuring in the {@link JComboBox}.
*/
private MouseListener mouseListener;
/**
* List used when rendering selected item of the combo box. The selection
- * and foreground colors for combo box renderer are configured from this
- * list
+ * and foreground colors for combo box renderer are configured from this
+ * list.
*/
protected JList listBox;
@@ -140,11 +146,14 @@ public class BasicComboBoxUI extends ComboBoxUI
protected ListDataListener listDataListener;
/**
- * Popup list containing combo box's menu items
+ * Popup list containing the combo box's menu items.
*/
protected ComboPopup popup;
+
protected KeyListener popupKeyListener;
+
protected MouseListener popupMouseListener;
+
protected MouseMotionListener popupMouseMotionListener;
/**
@@ -152,30 +161,34 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
protected PropertyChangeListener propertyChangeListener;
+ /**
+ * The button background.
+ * @see #installDefaults()
+ */
+ private Color buttonBackground;
+
+ /**
+ * The button shadow.
+ * @see #installDefaults()
+ */
+ private Color buttonShadow;
+
/**
- * Colors that are used to render selected item in the combo box.
+ * The button dark shadow.
+ * @see #installDefaults()
*/
- private Color shadow;
- private Color darkShadow;
- private Color highlight;
- private Color lightHighlight;
+ private Color buttonDarkShadow;
+
+ /**
+ * The button highlight.
+ * @see #installDefaults()
+ */
+ private Color buttonHighlight;
/* Size of the largest item in the comboBox
* This is package-private to avoid an accessor method.
*/
- Dimension largestItemSize;
-
- // It seems that JComboBox doesn't have a border set explicitely. So we just
- // paint the border everytime combo box is displayed.
-
- /* border insets for this JComboBox
- * This is package-private to avoid an accessor method. */
- static final Insets borderInsets = new Insets(2, 2, 2, 2);
-
- // Width of the arrow button
- // This is package-private to avoid an accessor method.
- // FIXME: has wrong name for a constant.
- static final int arrowButtonWidth = 15;
+ Dimension displaySize;
// FIXME: This fields aren't used anywhere at this moment.
protected Dimension cachedMinimumSize;
@@ -183,19 +196,20 @@ public class BasicComboBoxUI extends ComboBoxUI
protected boolean isMinimumSizeDirty;
/**
- * Creates a new BasicComboBoxUI object.
+ * Creates a new <code>BasicComboBoxUI</code> object.
*/
public BasicComboBoxUI()
{
+ // Nothing to do here.
}
/**
- * Factory method to create a BasicComboBoxUI for the given {@link
- * JComponent}, which should be a {@link JComboBox}.
+ * A factory method to create a UI delegate for the given
+ * {@link JComponent}, which should be a {@link JComboBox}.
*
* @param c The {@link JComponent} a UI is being created for.
*
- * @return A BasicComboBoxUI for the {@link JComponent}.
+ * @return A UI delegate for the {@link JComponent}.
*/
public static ComponentUI createUI(JComponent c)
{
@@ -203,9 +217,11 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method installs the UI for the given JComponent.
+ * Installs the UI for the given {@link JComponent}.
*
- * @param c The JComponent to install a UI for.
+ * @param c the JComponent to install a UI for.
+ *
+ * @see #uninstallUI(JComponent)
*/
public void installUI(JComponent c)
{
@@ -213,20 +229,22 @@ public class BasicComboBoxUI extends ComboBoxUI
if (c instanceof JComboBox)
{
- comboBox = (JComboBox) c;
- comboBox.setOpaque(true);
- comboBox.setLayout(createLayoutManager());
- installDefaults();
- installComponents();
- installListeners();
- installKeyboardActions();
+ comboBox = (JComboBox) c;
+ comboBox.setOpaque(true);
+ comboBox.setLayout(createLayoutManager());
+ installDefaults();
+ installComponents();
+ installListeners();
+ installKeyboardActions();
}
}
/**
- * This method uninstalls the UI.
+ * Uninstalls the UI for the given {@link JComponent}.
*
* @param c The JComponent that is having this UI removed.
+ *
+ * @see #installUI(JComponent)
*/
public void uninstallUI(JComponent c)
{
@@ -238,27 +256,27 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method installs the defaults that are defined in the Basic look and
- * feel for this {@link JComboBox}.
+ * Installs the defaults that are defined in the {@link BasicLookAndFeel}
+ * for this {@link JComboBox}.
+ *
+ * @see #uninstallDefaults()
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- comboBox.setBackground(defaults.getColor("ComboBox.background"));
- comboBox.setFont(defaults.getFont("ComboBox.font"));
- comboBox.setForeground(defaults.getColor("ComboBox.foreground"));
-
- // Set default color that should be used to to render selected item
- // of the combo box.
- shadow = defaults.getColor("Button.shadow");
- darkShadow = defaults.getColor("Button.darkShadow");
- lightHighlight = defaults.getColor("Button.light");
- highlight = defaults.getColor("Button.highlight");
+ LookAndFeel.installColorsAndFont(comboBox, "ComboBox.background",
+ "ComboBox.foreground", "ComboBox.font");
+
+ // fetch the button color scheme
+ buttonBackground = UIManager.getColor("ComboBox.buttonBackground");
+ buttonShadow = UIManager.getColor("ComboBox.buttonShadow");
+ buttonDarkShadow = UIManager.getColor("ComboBox.buttonDarkShadow");
+ buttonHighlight = UIManager.getColor("ComboBox.buttonHighlight");
}
/**
- * This method creates and installs the listeners for this UI.
+ * Creates and installs the listeners for this UI.
+ *
+ * @see #uninstallListeners()
*/
protected void installListeners()
{
@@ -268,6 +286,7 @@ public class BasicComboBoxUI extends ComboBoxUI
focusListener = createFocusListener();
comboBox.addFocusListener(focusListener);
+ listBox.addFocusListener(focusListener);
itemListener = createItemListener();
comboBox.addItemListener(itemListener);
@@ -276,35 +295,40 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.addKeyListener(keyListener);
mouseListener = createMouseListener();
- comboBox.addMouseListener(mouseListener);
+ arrowButton.addMouseListener(mouseListener);
// install listeners that listen to combo box model
listDataListener = createListDataListener();
comboBox.getModel().addListDataListener(listDataListener);
-
- configureArrowButton();
}
/**
- * This method uninstalls the defaults and sets any objects created during
- * install to null
+ * Uninstalls the defaults and sets any objects created during
+ * install to <code>null</code>.
+ *
+ * @see #installDefaults()
*/
protected void uninstallDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- comboBox.setBackground(null);
- comboBox.setFont(null);
- comboBox.setForeground(null);
-
- shadow = null;
- darkShadow = null;
- lightHighlight = null;
- highlight = null;
+ if (comboBox.getFont() instanceof UIResource)
+ comboBox.setFont(null);
+
+ if (comboBox.getForeground() instanceof UIResource)
+ comboBox.setForeground(null);
+
+ if (comboBox.getBackground() instanceof UIResource)
+ comboBox.setBackground(null);
+
+ buttonBackground = null;
+ buttonShadow = null;
+ buttonDarkShadow = null;
+ buttonHighlight = null;
}
/**
* Detaches all the listeners we attached in {@link #installListeners}.
+ *
+ * @see #installListeners()
*/
protected void uninstallListeners()
{
@@ -312,6 +336,7 @@ public class BasicComboBoxUI extends ComboBoxUI
propertyChangeListener = null;
comboBox.removeFocusListener(focusListener);
+ listBox.removeFocusListener(focusListener);
focusListener = null;
comboBox.removeItemListener(itemListener);
@@ -320,17 +345,15 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.removeKeyListener(keyListener);
keyListener = null;
- comboBox.removeMouseListener(mouseListener);
+ arrowButton.removeMouseListener(mouseListener);
mouseListener = null;
comboBox.getModel().removeListDataListener(listDataListener);
listDataListener = null;
-
- unconfigureArrowButton();
}
/**
- * This method creates popup that will contain list of combo box's items
+ * Creates the popup that will contain list of combo box's items.
*
* @return popup containing list of combo box's items
*/
@@ -340,7 +363,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * Creates KeyListener to listen to key events.
+ * Creates a {@link KeyListener} to listen to key events.
*
* @return KeyListener that listens to key events.
*/
@@ -350,8 +373,8 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method create MouseListener that will listen to mouse event occuring
- * in combo box.
+ * Creates a {@link MouseListener} that will listen to mouse events occurring
+ * in the combo box.
*
* @return the MouseListener
*/
@@ -361,10 +384,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method create FocusListener that will listen to changes in this
+ * Creates the {@link FocusListener} that will listen to changes in this
* JComboBox's focus.
*
- * @return theFocusListener
+ * @return the FocusListener.
*/
protected FocusListener createFocusListener()
{
@@ -372,9 +395,9 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method create ListDataListener to listen to ComboBox's data model
+ * Creates a {@link ListDataListener} to listen to the combo box's data model.
*
- * @return ListDataListener
+ * @return The new listener.
*/
protected ListDataListener createListDataListener()
{
@@ -382,10 +405,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method creates ItemListener that will listen to to the changes in
+ * Creates an {@link ItemListener} that will listen to the changes in
* the JComboBox's selection.
*
- * @return the ItemListener
+ * @return The ItemListener
*/
protected ItemListener createItemListener()
{
@@ -393,10 +416,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method creates PropertyChangeListener to listen to the changes in
+ * Creates a {@link PropertyChangeListener} to listen to the changes in
* the JComboBox's bound properties.
*
- * @return the PropertyChangeListener
+ * @return The PropertyChangeListener
*/
protected PropertyChangeListener createPropertyChangeListener()
{
@@ -404,9 +427,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method returns layout manager for the combo box.
+ * Creates and returns a layout manager for the combo box. Subclasses can
+ * override this method to provide a different layout.
*
- * @return layout manager for the combo box
+ * @return a layout manager for the combo box.
*/
protected LayoutManager createLayoutManager()
{
@@ -414,10 +438,10 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method creates component that will be responsible for rendering the
+ * Creates a component that will be responsible for rendering the
* selected component in the combo box.
*
- * @return render for the combo box
+ * @return A renderer for the combo box.
*/
protected ListCellRenderer createRenderer()
{
@@ -425,58 +449,54 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * Creates component that will be responsible for displaying/editting
- * selected item in the combo box. This editor is used only when combo box
- * is editable.
+ * Creates the component that will be responsible for displaying/editing
+ * the selected item in the combo box. This editor is used only when combo
+ * box is editable.
*
- * @return component that will be responsible for displaying/editting
- * selected item in the combo box.
+ * @return A new component that will be responsible for displaying/editing
+ * the selected item in the combo box.
*/
protected ComboBoxEditor createEditor()
{
- return new BasicComboBoxEditor();
+ return new BasicComboBoxEditor.UIResource();
}
/**
- * This method installs components for this JComboBox. ArrowButton, main
- * part of combo box (upper part) and popup list of items are created and
+ * Installs the components for this JComboBox. ArrowButton, main
+ * part of combo box (upper part) and popup list of items are created and
* configured here.
*/
protected void installComponents()
{
- // create and install arrow button
- arrowButton = createArrowButton();
-
- comboBox.add(arrowButton);
-
- // Set list that will be used by BasicComboBoxRender
- // in order to determine the right colors when rendering
- listBox = new JList();
-
- Color background = arrowButton.getBackground();
- listBox.setBackground(background);
- listBox.setSelectionBackground(background.darker());
-
- Color foreground = arrowButton.getForeground();
- listBox.setForeground(foreground);
- listBox.setSelectionForeground(foreground);
+ // create drop down list of items
+ popup = createPopup();
+ listBox = popup.getList();
// set editor and renderer for the combo box. Editor is used
// only if combo box becomes editable, otherwise renderer is used
// to paint the selected item; combobox is not editable by default.
comboBox.setRenderer(createRenderer());
- comboBox.setEditor(createEditor());
- editor = comboBox.getEditor().getEditorComponent();
+ // create and install arrow button
+ arrowButton = createArrowButton();
+ configureArrowButton();
+ comboBox.add(arrowButton);
- // create drop down list of items
- popup = createPopup();
+ ComboBoxEditor currentEditor = comboBox.getEditor();
+ if (currentEditor == null || currentEditor instanceof UIResource)
+ {
+ currentEditor = createEditor();
+ comboBox.setEditor(currentEditor);
+ }
+ editor = currentEditor.getEditorComponent();
comboBox.revalidate();
}
/**
- * This method uninstalls components from this JComboBox
+ * Uninstalls components from this {@link JComboBox}.
+ *
+ * @see #installComponents()
*/
protected void uninstallComponents()
{
@@ -490,12 +510,18 @@ public class BasicComboBoxUI extends ComboBoxUI
comboBox.setRenderer(null);
- comboBox.setEditor(null);
- editor = null;
+ // if the editor is not an instanceof UIResource, it was not set by the
+ // UI delegate, so don't clear it...
+ ComboBoxEditor currentEditor = comboBox.getEditor();
+ if (currentEditor instanceof UIResource)
+ {
+ comboBox.setEditor(null);
+ editor = null;
+ }
}
/**
- * This method adds editor to the combo box
+ * Adds the current editor to the combo box.
*/
public void addEditor()
{
@@ -503,7 +529,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method removes editor from the combo box
+ * Removes the current editor from the combo box.
*/
public void removeEditor()
{
@@ -511,15 +537,17 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method configures editor for this combo box.
+ * Configures the editor for this combo box.
*/
protected void configureEditor()
{
+ editor.setFont(comboBox.getFont());
+ comboBox.getEditor().setItem(comboBox.getSelectedItem());
// FIXME: Need to implement. Set font and add listeners.
}
/**
- * This method removes all the listeners for the editor.
+ * Unconfigures the editor for this combo nox. This method is not implemented.
*/
protected void unconfigureEditor()
{
@@ -527,42 +555,50 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method adds listeners to the arrow button part of the combo box.
+ * Configures the arrow button.
+ *
+ * @see #configureArrowButton()
*/
public void configureArrowButton()
{
- arrowButton.addMouseListener(mouseListener);
+ arrowButton.setEnabled(comboBox.isEnabled());
+ arrowButton.setFont(comboBox.getFont());
}
/**
- * This method removes listeners from the arrow button part of the combo
- * box.
+ * Unconfigures the arrow button.
+ *
+ * @see #configureArrowButton()
+ *
+ * @specnote The specification says this method is implementation specific
+ * and should not be used or overridden.
*/
public void unconfigureArrowButton()
{
- arrowButton.removeMouseListener(mouseListener);
+ // Nothing to do here yet.
}
/**
- * This method create arrow button for this JComboBox. Arrow button is
- * responsible for displaying / hiding drop down list of items when it is
- * clicked.
+ * Creates an arrow button for this {@link JComboBox}. The arrow button is
+ * displayed at the right end of the combo box and is used to display/hide
+ * the drop down list of items.
*
- * @return JButton arrow button for this JComboBox.
+ * @return A new button.
*/
protected JButton createArrowButton()
{
- return new BasicArrowButton(BasicArrowButton.SOUTH);
+ return new BasicArrowButton(BasicArrowButton.SOUTH, buttonBackground,
+ buttonShadow, buttonDarkShadow, buttonHighlight);
}
/**
- * This method checks if popup part of the combo box is visible on the
- * screen
+ * Returns <code>true</code> if the popup is visible, and <code>false</code>
+ * otherwise.
*
* @param c The JComboBox to check
*
- * @return true if popup part of the JComboBox is visible and false
- * otherwise.
+ * @return <code>true</code> if popup part of the JComboBox is visible and
+ * <code>false</code> otherwise.
*/
public boolean isPopupVisible(JComboBox c)
{
@@ -570,7 +606,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * Displays/Hides JComboBox's list of items on the screen.
+ * Displays/hides the {@link JComboBox}'s list of items on the screen.
*
* @param c The combo box, for which list of items should be
* displayed/hidden
@@ -579,7 +615,10 @@ public class BasicComboBoxUI extends ComboBoxUI
public void setPopupVisible(JComboBox c, boolean v)
{
if (v)
- popup.show();
+ {
+ popup.show();
+ popup.getList().requestFocus();
+ }
else
popup.hide();
}
@@ -593,7 +632,7 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public boolean isFocusTraversable(JComboBox c)
{
- if (comboBox.isEditable())
+ if (!comboBox.isEditable())
return true;
return false;
@@ -607,56 +646,28 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public void paint(Graphics g, JComponent c)
{
- if (c instanceof JComboBox)
- {
- JComboBox cb = (JComboBox) c;
-
- paintBorder(g, comboBox.getBounds(), hasFocus);
-
- Rectangle rect = rectangleForCurrentValue();
- paintCurrentValueBackground(g, rect, hasFocus);
- paintCurrentValue(g, rect, hasFocus);
- }
- }
-
- private void paintBorder(Graphics g, Rectangle bounds, boolean hasFocus)
- {
- int x = 0;
- int y = 0;
- int width = bounds.width;
- int height = bounds.height;
-
- Color oldColor = g.getColor();
-
- if (! arrowButton.getModel().isPressed())
- BasicGraphicsUtils.drawEtchedRect(g, x, y, width, height, Color.gray,
- Color.white, Color.gray, Color.white);
- else
- {
- g.setColor(darkShadow);
- g.drawRect(x, y, width, height);
- g.setColor(shadow);
- g.drawRect(x + 1, y + 1, width - 3, height - 3);
- }
- g.setColor(oldColor);
+ Rectangle rect = rectangleForCurrentValue();
+ paintCurrentValueBackground(g, rect, hasFocus);
+ paintCurrentValue(g, rect, hasFocus);
}
/**
- * Returns preferred size for the given menu item.
+ * Returns preferred size for the combo box.
*
* @param c comboBox for which to get preferred size
*
- * @return $Dimension$ preferred size for the given combo box
+ * @return The preferred size for the given combo box
*/
public Dimension getPreferredSize(JComponent c)
{
- // return null to indicate that combo box's layout will determin its
- // preferred size
- return null;
+ // note: overriding getMinimumSize() (for example in the MetalComboBoxUI
+ // class) affects the getPreferredSize() result, so it seems logical that
+ // this method is implemented by delegating to the getMinimumSize() method
+ return getMinimumSize(c);
}
/**
- * This method returns the minimum size for this {@link JComboBox} for this
+ * Returns the minimum size for this {@link JComboBox} for this
* look and feel.
*
* @param c The {@link JComponent} to find the minimum size for.
@@ -665,20 +676,26 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public Dimension getMinimumSize(JComponent c)
{
- return null;
+ Dimension d = getDisplaySize();
+ int arrowButtonWidth = d.height;
+ Dimension result = new Dimension(d.width + arrowButtonWidth, d.height);
+ return result;
}
+ /** The value returned by the getMaximumSize() method. */
+ private static final Dimension MAXIMUM_SIZE = new Dimension(32767, 32767);
+
/**
- * This method returns the maximum size for this {@link JComboBox} for this
+ * Returns the maximum size for this {@link JComboBox} for this
* look and feel.
*
* @param c The {@link JComponent} to find the maximum size for
*
- * @return The dimensions of the minimum size.
+ * @return The maximum size (<code>Dimension(32767, 32767)</code>).
*/
public Dimension getMaximumSize(JComponent c)
{
- return null;
+ return MAXIMUM_SIZE;
}
public int getAccessibleChildrenCount(JComponent c)
@@ -707,7 +724,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method selects next possible item relative to the current selection
+ * Selects next possible item relative to the current selection
* to be next selected item in the combo box.
*/
protected void selectNextPossibleValue()
@@ -718,7 +735,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method selects previous item relative to current selection to be
+ * Selects previous item relative to current selection to be
* next selected item.
*/
protected void selectPreviousPossibleValue()
@@ -729,8 +746,8 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method displays combo box popup if the popup is not currently shown
- * on the screen and hides it if it is currently shown
+ * Displays combo box popup if the popup is not currently shown
+ * on the screen and hides it if it is currently shown
*/
protected void toggleOpenClose()
{
@@ -738,34 +755,23 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method returns bounds in which comboBox's selected Item will be
- * displayed
+ * Returns the bounds in which comboBox's selected item will be
+ * displayed.
*
* @return rectangle bounds in which comboBox's selected Item will be
* displayed
*/
protected Rectangle rectangleForCurrentValue()
{
- Rectangle cbBounds = comboBox.getBounds();
-
- // Subtract width or the arrow button and border insets
- Rectangle rectForCurrentValue = new Rectangle(cbBounds.x
- + borderInsets.left,
- cbBounds.y
- + borderInsets.top,
- cbBounds.width
- - arrowButtonWidth
- - borderInsets.left
- - borderInsets.right,
- cbBounds.height
- - borderInsets.top
- - borderInsets.bottom);
-
+ Rectangle cbBounds = SwingUtilities.getLocalBounds(comboBox);
+ Rectangle abBounds = arrowButton.getBounds();
+ Rectangle rectForCurrentValue = new Rectangle(cbBounds.x, cbBounds.y,
+ cbBounds.width - abBounds.width, cbBounds.height);
return rectForCurrentValue;
}
/**
- * This method returns insets of the current border.
+ * Returns the insets of the current border.
*
* @return Insets representing space between combo box and its border
*/
@@ -775,7 +781,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method paints currently selected value in the main part of the combo
+ * Paints currently selected value in the main part of the combo
* box (part without popup).
*
* @param g graphics context
@@ -794,28 +800,29 @@ public class BasicComboBoxUI extends ComboBoxUI
* If there is currently no selected item we will take an empty
* String as replacement.
*/
- Component comp = comboBox.getRenderer()
- .getListCellRendererComponent(listBox,
- (currentValue != null ? currentValue : ""),
- -1,
- isPressed,
- hasFocus);
- if (! comboBox.isEnabled())
- comp.setEnabled(false);
-
- g.translate(borderInsets.left, borderInsets.top);
- comp.setBounds(0, 0, bounds.width, bounds.height);
- comp.paint(g);
- g.translate(-borderInsets.left, -borderInsets.top);
-
- comboBox.revalidate();
+ Component comp = comboBox.getRenderer().getListCellRendererComponent(
+ listBox, (currentValue != null ? currentValue : ""), -1,
+ isPressed, hasFocus);
+ if (! comboBox.isEnabled())
+ {
+ comp.setBackground(UIManager.getColor(
+ "ComboBox.disabledBackground"));
+ comp.setForeground(UIManager.getColor(
+ "ComboBox.disabledForeground"));
+ comp.setEnabled(false);
+ }
+ comp.setBounds(0, 0, bounds.width, bounds.height);
+ comp.setFont(comboBox.getFont());
+ comp.paint(g);
+
+ comboBox.revalidate();
}
else
comboBox.getEditor().setItem(comboBox.getSelectedItem());
}
/**
- * This method paints background of part of the combo box, where currently
+ * Paints the background of part of the combo box, where currently
* selected value is displayed. If the combo box has focus this method
* should also paint focus rectangle around the combo box.
*
@@ -832,58 +839,102 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * Returns default size for the combo box that doesn't contain any elements
- * in it
+ * Returns the default size for the display area of a combo box that does
+ * not contain any elements. This method returns the width and height of
+ * a single space in the current font, plus a margin of 1 pixel.
*
- * @return Default size of the combo box with no elements in it.
+ * @return The default display size.
+ *
+ * @see #getDisplaySize()
*/
protected Dimension getDefaultSize()
{
- return new Dimension(6, 17);
+ // There is nothing in the spec to say how this method should be
+ // implemented...so I've done some guessing, written some Mauve tests,
+ // and written something that gives dimensions that are close to the
+ // reference implementation.
+ FontMetrics fm = comboBox.getFontMetrics(comboBox.getFont());
+ int w = fm.charWidth(' ') + 2;
+ int h = fm.getHeight() + 2;
+ return new Dimension(w, h);
}
/**
- * Returns size of the largest item in the combo box. This size will be the
- * size of the combo box, not including the arrowButton.
+ * Returns the size of the display area for the combo box. This size will be
+ * the size of the combo box, not including the arrowButton.
*
- * @return dimensions of the largest item in the combo box.
+ * @return The size of the display area for the combo box.
*/
- protected Dimension getLargestItemSize()
+ protected Dimension getDisplaySize()
{
- ComboBoxModel model = comboBox.getModel();
- int numItems = model.getSize();
-
- // if combo box doesn't have any items then simply
- // return its default size
- if (numItems == 0)
+ if (!comboBox.isEditable())
{
- largestItemSize = getDefaultSize();
- return largestItemSize;
+ Object prototype = comboBox.getPrototypeDisplayValue();
+ if (prototype != null)
+ {
+ // calculate result based on prototype
+ ListCellRenderer renderer = comboBox.getRenderer();
+ Component comp = renderer.getListCellRendererComponent(listBox,
+ prototype, -1, false, false);
+ Dimension compSize = comp.getPreferredSize();
+ compSize.width += 2; // add 1 pixel margin around area
+ compSize.height += 2;
+ return compSize;
+ }
+ else
+ {
+ ComboBoxModel model = comboBox.getModel();
+ int numItems = model.getSize();
+
+ // if combo box doesn't have any items then simply
+ // return its default size
+ if (numItems == 0)
+ {
+ displaySize = getDefaultSize();
+ return displaySize;
+ }
+
+ Dimension size = new Dimension(0, 0);
+
+ // ComboBox's display size should be equal to the
+ // size of the largest item in the combo box.
+ ListCellRenderer renderer = comboBox.getRenderer();
+
+ for (int i = 0; i < numItems; i++)
+ {
+ Object item = model.getElementAt(i);
+ Component comp = renderer.getListCellRendererComponent(listBox,
+ item, -1, false, false);
+
+ Dimension compSize = comp.getPreferredSize();
+ if (compSize.width + 2 > size.width)
+ size.width = compSize.width + 2;
+ if (compSize.height + 2 > size.height)
+ size.height = compSize.height + 2;
+ }
+ displaySize = size;
+ return displaySize;
+ }
}
-
- Dimension size = new Dimension(0, 0);
-
- // ComboBox's display size should be equal to the
- // size of the largest item in the combo box.
- ListCellRenderer renderer = comboBox.getRenderer();
-
- for (int i = 0; i < numItems; i++)
+ else // an editable combo,
{
- Object item = model.getElementAt(i);
- String s = item.toString();
- Component comp = renderer.getListCellRendererComponent(listBox, item,
- -1, false, false);
-
- if (comp.getPreferredSize().getWidth() > size.getWidth())
- size = comp.getPreferredSize();
+ Component comp = comboBox.getEditor().getEditorComponent();
+ Dimension prefSize = comp.getPreferredSize();
+ int width = prefSize.width;
+ int height = prefSize.height + 2;
+ Object prototype = comboBox.getPrototypeDisplayValue();
+ if (prototype != null)
+ {
+ FontMetrics fm = comboBox.getFontMetrics(comboBox.getFont());
+ width = Math.max(width, fm.stringWidth(prototype.toString()) + 2);
+ }
+ displaySize = new Dimension(width, height);
+ return displaySize;
}
-
- largestItemSize = size;
- return largestItemSize;
}
/**
- * This method installs the keyboard actions for the JComboBox as specified
+ * Installs the keyboard actions for the {@link JComboBox} as specified
* by the look and feel.
*/
protected void installKeyboardActions()
@@ -892,7 +943,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method uninstalls the keyboard actions for the JComboBox there were
+ * Uninstalls the keyboard actions for the {@link JComboBox} there were
* installed by in {@link #installListeners}.
*/
protected void uninstallKeyboardActions()
@@ -901,22 +952,39 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This class is Layout Manager for this combo box.
+ * A {@link LayoutManager} used to position the sub-components of the
+ * {@link JComboBox}.
+ *
+ * @see BasicComboBoxUI#createLayoutManager()
*/
- public class ComboBoxLayoutManager extends Object implements LayoutManager
+ public class ComboBoxLayoutManager implements LayoutManager
{
/**
* Creates a new ComboBoxLayoutManager object.
*/
public ComboBoxLayoutManager()
{
+ // Nothing to do here.
}
+ /**
+ * Adds a component to the layout. This method does nothing, since the
+ * layout manager doesn't need to track the components.
+ *
+ * @param name the name to associate the component with (ignored).
+ * @param comp the component (ignored).
+ */
public void addLayoutComponent(String name, Component comp)
{
// Do nothing
}
+ /**
+ * Removes a component from the layout. This method does nothing, since
+ * the layout manager doesn't need to track the components.
+ *
+ * @param comp the component.
+ */
public void removeLayoutComponent(Component comp)
{
// Do nothing
@@ -925,43 +993,30 @@ public class BasicComboBoxUI extends ComboBoxUI
/**
* Returns preferred layout size of the JComboBox.
*
- * @param parent Container for which preferred size should be calculated
+ * @param parent the Container for which the preferred size should be
+ * calculated.
*
- * @return preferred size for the given container
+ * @return The preferred size for the given container
*/
public Dimension preferredLayoutSize(Container parent)
{
- Dimension d = new Dimension(0, 0);
-
- if (largestItemSize == null)
- largestItemSize = getLargestItemSize();
-
- // add size for the area that will display selected item
- d.width += largestItemSize.getWidth();
- d.height += largestItemSize.getHeight();
-
- // add size of the arrow button
- d.width += arrowButtonWidth;
-
- // add width and height of the border
- d.width += borderInsets.left + borderInsets.right;
- d.height += borderInsets.left + borderInsets.right;
-
- // Add combo box's insets
- Insets insets = parent.getInsets();
- d.width += insets.left + insets.right;
- d.width += insets.left + insets.right;
-
- return d;
+ return getPreferredSize((JComponent) parent);
}
+ /**
+ * Returns the minimum layout size.
+ *
+ * @param parent the container.
+ *
+ * @return The minimum size.
+ */
public Dimension minimumLayoutSize(Container parent)
{
return preferredLayoutSize(parent);
}
/**
- * This method layouts out the components in the container. It puts arrow
+ * Arranges the components in the container. It puts arrow
* button right end part of the comboBox. If the comboBox is editable
* then editor is placed to the left of arrow button, starting from the
* beginning.
@@ -972,21 +1027,19 @@ public class BasicComboBoxUI extends ComboBoxUI
{
// Position editor component to the left of arrow button if combo box is
// editable
- int editorWidth = comboBox.getBounds().width - arrowButtonWidth - 2;
+ int arrowSize = comboBox.getHeight();
+ int editorWidth = comboBox.getBounds().width - arrowSize;
if (comboBox.isEditable())
- editor.setBounds(borderInsets.left, borderInsets.top, editorWidth,
- comboBox.getBounds().height - borderInsets.left
- - borderInsets.top);
-
- arrowButton.setBounds(editorWidth, 2, arrowButtonWidth,
- comboBox.getBounds().height - 4);
+ editor.setBounds(0, 0, editorWidth, comboBox.getBounds().height);
+
+ arrowButton.setBounds(editorWidth, 0, arrowSize, arrowSize);
comboBox.revalidate();
}
}
/**
- * This class handles focus changes occuring in the combo box. This class is
+ * Handles focus changes occuring in the combo box. This class is
* responsible for repainting combo box whenever focus is gained or lost
* and also for hiding popup list of items whenever combo box loses its
* focus.
@@ -998,11 +1051,12 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public FocusHandler()
{
+ // Nothing to do here.
}
/**
- * This mehtod is invoked when combo box gains focus. It repaints main
- * part of combo box accordingally.
+ * Invoked when combo box gains focus. It repaints main
+ * part of combo box accordingly.
*
* @param e the FocusEvent
*/
@@ -1013,22 +1067,22 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method is invoked when combo box loses focus It repaint main part
- * of combo box accordingally and hides popup list of items.
+ * Invoked when the combo box loses focus. It repaints the main part
+ * of the combo box accordingly and hides the popup list of items.
*
* @param e the FocusEvent
*/
public void focusLost(FocusEvent e)
{
hasFocus = false;
+ setPopupVisible(comboBox, false);
comboBox.repaint();
- popup.hide();
}
}
/**
- * This class handles ItemEvent fired by the JComboBox when its selected
- * item changes.
+ * Handles {@link ItemEvent}s fired by the {@link JComboBox} when its
+ * selected item changes.
*/
public class ItemHandler extends Object implements ItemListener
{
@@ -1037,16 +1091,19 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public ItemHandler()
{
+ // Nothing to do here.
}
/**
- * This method is invoked when selected item becomes deselected or when
+ * Invoked when selected item becomes deselected or when
* new item becomes selected.
*
* @param e the ItemEvent representing item's state change.
*/
public void itemStateChanged(ItemEvent e)
{
+ if (e.getStateChange() == ItemEvent.SELECTED && comboBox.isEditable())
+ comboBox.getEditor().setItem(e.getItem());
comboBox.repaint();
}
}
@@ -1058,11 +1115,11 @@ public class BasicComboBoxUI extends ComboBoxUI
{
public KeyHandler()
{
+ // Nothing to do here.
}
- /*
- * This method is invoked whenever key is pressed while JComboBox is in
- * focus.
+ /**
+ * Invoked whenever key is pressed while JComboBox is in focus.
*/
public void keyPressed(KeyEvent e)
{
@@ -1072,7 +1129,7 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This class handles to the changes occuring in the JComboBox's data model
+ * Handles the changes occurring in the JComboBox's data model.
*/
public class ListDataHandler extends Object implements ListDataListener
{
@@ -1081,10 +1138,11 @@ public class BasicComboBoxUI extends ComboBoxUI
*/
public ListDataHandler()
{
+ // Nothing to do here.
}
/**
- * This method is invoked content's of JComboBox's data model are changed
+ * Invoked if the content's of JComboBox's data model are changed.
*
* @param e ListDataEvent describing the change.
*/
@@ -1094,36 +1152,27 @@ public class BasicComboBoxUI extends ComboBoxUI
}
/**
- * This method is invoked when items were added to the JComboBox's data
- * model.
+ * Invoked when items are added to the JComboBox's data model.
*
* @param e ListDataEvent describing the change.
*/
public void intervalAdded(ListDataEvent e)
{
- // must determine if the size of the combo box should change
- int start = e.getIndex0();
- int end = e.getIndex1();
-
ComboBoxModel model = comboBox.getModel();
ListCellRenderer renderer = comboBox.getRenderer();
- if (largestItemSize == null)
- largestItemSize = new Dimension(0, 0);
+ if (displaySize == null)
+ displaySize = getDisplaySize();
+ if (displaySize.width < getDefaultSize().width)
+ displaySize.width = getDefaultSize().width;
+ if (displaySize.height < getDefaultSize().height)
+ displaySize.height = getDefaultSize().height;
- for (int i = start; i < end; i++)
- {
- Object item = model.getElementAt(i);
- Component comp = renderer.getListCellRendererComponent(new JList(),
- item, -1,
- false, false);
- if (comp.getPreferredSize().getWidth() > largestItemSize.getWidth())
- largestItemSize = comp.getPreferredSize();
- }
+ comboBox.repaint();
}
/**
- * This method is invoked when items were removed from the JComboBox's
+ * Invoked when items are removed from the JComboBox's
* data model.
*
* @param e ListDataEvent describing the change.
@@ -1131,23 +1180,29 @@ public class BasicComboBoxUI extends ComboBoxUI
public void intervalRemoved(ListDataEvent e)
{
// recalculate display size of the JComboBox.
- largestItemSize = getLargestItemSize();
+ displaySize = getDisplaySize();
comboBox.repaint();
}
}
/**
- * This class handles PropertyChangeEvents fired by JComboBox.
+ * Handles {@link PropertyChangeEvent}s fired by the {@link JComboBox}.
*/
public class PropertyChangeHandler extends Object
implements PropertyChangeListener
{
+ /**
+ * Creates a new instance.
+ */
public PropertyChangeHandler()
{
+ // Nothing to do here.
}
/**
- * This method is invoked whenever bound property of JComboBox changes.
+ * Invoked whenever bound property of JComboBox changes.
+ *
+ * @param e the event.
*/
public void propertyChange(PropertyChangeEvent e)
{
@@ -1185,59 +1240,36 @@ public class BasicComboBoxUI extends ComboBoxUI
if ((ComboBoxModel) e.getNewValue() != null)
comboBox.getModel().addListDataListener(listDataListener);
}
+ else if (e.getPropertyName().equals("font"))
+ {
+ Font font = (Font) e.getNewValue();
+ editor.setFont(font);
+ listBox.setFont(font);
+ arrowButton.setFont(font);
+ comboBox.revalidate();
+ comboBox.repaint();
+ }
// FIXME: Need to handle changes in other bound properties.
}
}
/**
- * MouseHandler listens to mouse events occuring in the combo box. This
- * class is responsible for repainting this JComboBox whenever the mouse is
- * being pressed or released over it.
+ * A handler for mouse events occurring in the combo box. An instance of
+ * this class is returned by the <code>createMouseListener()</code> method.
*/
private class MouseHandler extends MouseAdapter
{
/**
- * This method is invoked when mouse is pressed over the combo box. It
- * repaints the combo box accordinglly
+ * Invoked when mouse is pressed over the combo box. It toggles the
+ * visibility of the popup list.
*
- * @param e the MouseEvent
+ * @param e the event
*/
public void mousePressed(MouseEvent e)
{
if (comboBox.isEnabled())
- {
- if (e.getSource() instanceof JComboBox)
- {
- arrowButton.getModel().setPressed(true);
- arrowButton.getModel().setArmed(true);
- }
-
- comboBox.repaint();
-
- if (e.getSource() instanceof BasicArrowButton)
- toggleOpenClose();
- }
- }
-
- /**
- * This method is invoked when mouse is released over the combo box. It
- * repaints the combo box accordinglly
- *
- * @param e the MouseEvent
- */
- public void mouseReleased(MouseEvent e)
- {
- if (comboBox.isEnabled())
- {
- if (e.getSource() instanceof JComboBox)
- {
- arrowButton.getModel().setPressed(false);
- arrowButton.getModel().setArmed(false);
- }
-
- comboBox.repaint();
- }
+ toggleOpenClose();
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java
index 73aac8d4e65..73979bb89c1 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicComboPopup.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Point;
@@ -55,6 +56,7 @@ import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
@@ -178,8 +180,8 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
// to display number of rows equal to 'maximumRowCount' property
int popupHeight = getPopupHeightForRowCount(comboBox.getMaximumRowCount());
- list.setPreferredSize(new Dimension(cbBounds.width, popupHeight));
- super.setPopupSize(cbBounds.width, popupHeight);
+ scroller.setPreferredSize(new Dimension(cbBounds.width, popupHeight));
+ pack();
// Highlight selected item in the combo box's drop down list
if (comboBox.getSelectedIndex() != -1)
@@ -478,6 +480,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected void configureScroller()
{
+ scroller.setBorder(null);
scroller.getViewport().setView(list);
scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
@@ -488,6 +491,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected void configurePopup()
{
+ setBorder(BorderFactory.createLineBorder(Color.BLACK));
// initialize list that will be used to display combo box's items
this.list = createList();
((JLabel) list.getCellRenderer()).setHorizontalAlignment(SwingConstants.LEFT);
@@ -714,7 +718,11 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
protected void updateListBoxSelectionForEvent(MouseEvent anEvent,
boolean shouldScroll)
{
- // FIXME: Need to implement
+ // TODO: We need to handle the shouldScroll parameter somehow.
+ int index = list.locationToIndex(anEvent.getPoint());
+ // Check for valid index.
+ if (index >= 0)
+ list.setSelectedIndex(index);
}
/**
@@ -732,6 +740,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected InvocationMouseHandler()
{
+ // Nothing to do here.
}
/**
@@ -744,7 +753,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
public void mousePressed(MouseEvent e)
{
if (comboBox.isEnabled())
- togglePopup();
+ togglePopup();
}
/**
@@ -768,15 +777,15 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
// then change selection and close popup
if (! (releasedComponent instanceof JComboBox))
{
- // List model contains the item over which mouse is released,
- // since it is updated every time the mouse is moved over a different
- // item in the list. Now that the mouse is released we need to
- // update model of the combo box as well.
- comboBox.setSelectedIndex(list.getSelectedIndex());
-
- if (isAutoScrolling)
- stopAutoScrolling();
- hide();
+ // List model contains the item over which mouse is released,
+ // since it is updated every time the mouse is moved over a different
+ // item in the list. Now that the mouse is released we need to
+ // update model of the combo box as well.
+ comboBox.setSelectedIndex(list.getSelectedIndex());
+
+ if (isAutoScrolling)
+ stopAutoScrolling();
+ hide();
}
}
}
@@ -792,6 +801,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected InvocationMouseMotionHandler()
{
+ // Nothing to do here.
}
/**
@@ -868,6 +878,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
protected ItemHandler()
{
+ // Nothing to do here.
}
/**
@@ -877,6 +888,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
*/
public void itemStateChanged(ItemEvent e)
{
+ // TODO: What should be done here?
}
}
@@ -890,16 +902,20 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
protected ListMouseHandler()
{
+ // Nothing to do here.
}
public void mousePressed(MouseEvent e)
{
+ // TODO: What should be do here?
}
public void mouseReleased(MouseEvent anEvent)
{
int index = list.locationToIndex(anEvent.getPoint());
- comboBox.setSelectedIndex(index);
+ // Check for valid index.
+ if (index >= 0)
+ comboBox.setSelectedIndex(index);
hide();
}
}
@@ -913,15 +929,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
protected ListMouseMotionHandler()
{
+ // Nothing to do here.
}
public void mouseMoved(MouseEvent anEvent)
{
- // Highlight list cells over which the mouse is located.
- // This changes list model, but has no effect on combo box's data model
- int index = list.locationToIndex(anEvent.getPoint());
- list.setSelectedIndex(index);
- list.repaint();
+ updateListBoxSelectionForEvent(anEvent, false);
}
}
@@ -934,6 +947,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
protected PropertyChangeHandler()
{
+ // Nothing to do here.
}
public void propertyChange(PropertyChangeEvent e)
@@ -1009,18 +1023,22 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
public ListDataHandler()
{
+ // Nothing to do here.
}
public void contentsChanged(ListDataEvent e)
{
+ // Nothing to do here.
}
public void intervalAdded(ListDataEvent e)
{
+ // Nothing to do here.
}
public void intervalRemoved(ListDataEvent e)
{
+ // Nothing to do here.
}
}
@@ -1032,10 +1050,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
protected ListSelectionHandler()
{
+ // Nothing to do here.
}
public void valueChanged(ListSelectionEvent e)
{
+ // Nothing to do here.
}
}
@@ -1046,10 +1066,12 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup
{
public InvocationKeyHandler()
{
+ // Nothing to do here.
}
public void keyReleased(KeyEvent e)
{
+ // Nothing to do here.
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java
index 561b497f1c3..3f8730249da 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopIconUI.java
@@ -365,6 +365,7 @@ public class BasicDesktopIconUI extends DesktopIconUI
*/
public BasicDesktopIconUI()
{
+ // Nothing to do here.
}
/**
@@ -585,6 +586,7 @@ public class BasicDesktopIconUI extends DesktopIconUI
}
catch (PropertyVetoException pve)
{
+ // We do nothing if the attempt has been vetoed.
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java
index b59261b17f3..4116858da9d 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicDesktopPaneUI.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.beans.PropertyVetoException;
@@ -49,10 +50,10 @@ import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.KeyStroke;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.DesktopPaneUI;
+import javax.swing.plaf.UIResource;
/**
* This class is the UI delegate for JDesktopPane for the Basic look and feel.
@@ -74,13 +75,14 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
{
if (desktop.getSelectedFrame() != null)
{
- try
- {
- desktop.getSelectedFrame().setClosed(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ desktop.getSelectedFrame().setClosed(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempts has been vetoed.
+ }
}
}
@@ -112,13 +114,14 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
{
if (desktop.getSelectedFrame() != null)
{
- try
- {
- desktop.getSelectedFrame().setMaximum(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ desktop.getSelectedFrame().setMaximum(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempts has been vetoed.
+ }
}
}
@@ -150,13 +153,14 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
{
if (desktop.getSelectedFrame() != null)
{
- try
- {
- desktop.getSelectedFrame().setIcon(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ desktop.getSelectedFrame().setIcon(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
@@ -236,16 +240,17 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
JInternalFrame frame = desktop.getSelectedFrame();
if (frame != null)
{
- try
- {
- if (frame.isIcon())
- frame.setIcon(false);
- else if (frame.isMaximum())
- frame.setMaximum(false);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ if (frame.isIcon())
+ frame.setIcon(false);
+ else if (frame.isMaximum())
+ frame.setMaximum(false);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
@@ -304,6 +309,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
*/
public BasicDesktopPaneUI()
{
+ // Nothing to do here.
}
/**
@@ -361,9 +367,9 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- desktop.setBackground(defaults.getColor("desktop"));
+ Color bg = desktop.getBackground();
+ if (bg == null || bg instanceof UIResource)
+ desktop.setBackground(UIManager.getColor("desktop"));
}
/**
@@ -381,7 +387,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
protected void installKeyboardActions()
{
// FIXME: create actions and keystrokes.
- registerKeyboardAction();
+ registerKeyboardActions();
}
/**
@@ -405,7 +411,7 @@ public class BasicDesktopPaneUI extends DesktopPaneUI
* This method registers the actions to the appropriate Action and Input
* maps.
*/
- protected void registerKeyboardAction()
+ protected void registerKeyboardActions()
{
// FIXME: Do the binding.
// XXX: the gtk windows tend to intercept a lot of the
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java
index d5b34d9eef6..d514a87c8ee 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicEditorPaneUI.java
@@ -42,10 +42,7 @@ import javax.swing.JComponent;
import javax.swing.JEditorPane;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.EditorKit;
-import javax.swing.text.Element;
import javax.swing.text.JTextComponent;
-import javax.swing.text.PlainView;
-import javax.swing.text.View;
/**
* The UI class for {@link JEditorPane}s.
@@ -76,14 +73,6 @@ public class BasicEditorPaneUI extends BasicTextUI
// Do nothing here.
}
- // FIXME: Should not be overridden here but instead be handled by the
- // JEditorPane's EditorKit. However, as long as we don't have styles in
- // place this doesn't make much sense.
- public View create(Element elem)
- {
- return new PlainView(elem);
- }
-
/**
* Returns the property prefix to be used by this UI class. This is
* <code>EditorPane</code> in this case.
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
index f74e9229893..60179dc0706 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
@@ -48,7 +48,6 @@ import java.awt.Point;
import java.awt.Polygon;
import java.awt.Window;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
@@ -60,9 +59,9 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Hashtable;
+
import javax.swing.AbstractAction;
import javax.swing.Action;
-import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.Icon;
import javax.swing.JButton;
@@ -80,7 +79,6 @@ import javax.swing.ListCellRenderer;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
@@ -92,25 +90,31 @@ import javax.swing.plaf.FileChooserUI;
/**
- * DOCUMENT ME!
+ * A UI delegate for the {@link JFileChooser} component under the
+ * {@link BasicLookAndFeel}.
*/
public class BasicFileChooserUI extends FileChooserUI
{
/**
- * DOCUMENT ME!
+ * A file filter that accepts all files.
*/
protected class AcceptAllFileFilter extends FileFilter
{
+ /**
+ * Creates a new instance.
+ */
public AcceptAllFileFilter()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> always, as all files are accepted by this
+ * filter.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return Always <code>true</code>.
*/
public boolean accept(File f)
{
@@ -118,9 +122,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns a description for this filter.
*
- * @return DOCUMENT ME!
+ * @return A description for the file filter.
*/
public String getDescription()
{
@@ -129,7 +133,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Handles a user action to approve the dialog selection.
+ *
+ * @see BasicFileChooserUI#getApproveSelectionAction()
*/
protected class ApproveSelectionAction extends AbstractAction
{
@@ -138,50 +144,55 @@ public class BasicFileChooserUI extends FileChooserUI
*/
protected ApproveSelectionAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ * Sets the current selection and closes the dialog.
+ *
+ * @param e the action event.
*/
public void actionPerformed(ActionEvent e)
{
- Object obj = filelist.getSelectedValue();
+ Object obj = new String(parentPath + entry.getText());
if (obj != null)
{
- File f = filechooser.getFileSystemView().createFileObject(obj
- .toString());
- if (filechooser.isTraversable(f) &&
- filechooser.getFileSelectionMode() == JFileChooser.FILES_ONLY)
+ File f = filechooser.getFileSystemView().createFileObject(
+ obj.toString());
+ if (filechooser.isTraversable(f)
+ && filechooser.isDirectorySelectionEnabled())
filechooser.setCurrentDirectory(f);
- else
- {
- filechooser.setSelectedFile(f);
- filechooser.approveSelection();
- closeDialog();
- }
+ else
+ {
+ filechooser.setSelectedFile(f);
+ filechooser.approveSelection();
+ closeDialog();
+ }
}
}
}
/**
- * DOCUMENT ME!
+ * Provides presentation information about files and directories.
*/
protected class BasicFileView extends FileView
{
- /** DOCUMENT ME! */
+ /** Storage for cached icons. */
protected Hashtable iconCache = new Hashtable();
+ /**
+ * Creates a new instance.
+ */
public BasicFileView()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Adds an icon to the cache, associating it with the given file/directory.
*
- * @param f DOCUMENT ME!
- * @param i DOCUMENT ME!
+ * @param f the file/directory.
+ * @param i the icon.
*/
public void cacheIcon(File f, Icon i)
{
@@ -189,7 +200,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Clears the icon cache.
*/
public void clearIconCache()
{
@@ -197,11 +208,12 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Retrieves the icon associated with the specified file/directory, if
+ * there is one.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return The cached icon (or <code>null</code>).
*/
public Icon getCachedIcon(File f)
{
@@ -209,11 +221,13 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns a description of the given file/directory. In this
+ * implementation, the description is the same as the name returned by
+ * {@link #getName(File)}.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return A description of the given file/directory.
*/
public String getDescription(File f)
{
@@ -221,11 +235,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns an icon appropriate for the given file or directory.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return An icon.
*/
public Icon getIcon(File f)
{
@@ -241,11 +255,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the name for the given file/directory.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return The name of the file/directory.
*/
public String getName(File f)
{
@@ -253,11 +267,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns a localised description for the type of file/directory.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return A type description for the given file/directory.
*/
public String getTypeDescription(File f)
{
@@ -268,34 +282,38 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns {@link Boolean#TRUE} if the given file/directory is hidden,
+ * and {@link Boolean#FALSE} otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*/
public Boolean isHidden(File f)
{
- return new Boolean(filechooser.getFileSystemView().isHiddenFile(f));
+ return Boolean.valueOf(filechooser.getFileSystemView().isHiddenFile(f));
}
}
/**
- * DOCUMENT ME!
+ * Handles an action to cancel the file chooser.
+ *
+ * @see BasicFileChooserUI#getCancelSelectionAction()
*/
protected class CancelSelectionAction extends AbstractAction
{
/**
- * Creates a new CancelSelectionAction object.
+ * Creates a new <code>CancelSelectionAction</code> object.
*/
protected CancelSelectionAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Cancels the selection and closes the dialog.
*
- * @param e DOCUMENT ME!
+ * @param e the action event (ignored).
*/
public void actionPerformed(ActionEvent e)
{
@@ -305,21 +323,25 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * An action to handle changes to the parent directory (for example, via
+ * a click on the "up folder" button).
+ *
+ * @see BasicFileChooserUI#getChangeToParentDirectoryAction()
*/
protected class ChangeToParentDirectoryAction extends AbstractAction
{
/**
- * Creates a new ChangeToParentDirectoryAction object.
+ * Creates a new <code>ChangeToParentDirectoryAction</code> object.
*/
protected ChangeToParentDirectoryAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Handles the action event.
*
- * @param e DOCUMENT ME!
+ * @param e the action event.
*/
public void actionPerformed(ActionEvent e)
{
@@ -330,11 +352,13 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * A mouse listener that handles double-click events.
+ *
+ * @see BasicFileChooserUI#createDoubleClickListener(JFileChooser, JList)
*/
protected class DoubleClickListener extends MouseAdapter
{
- /** DOCUMENT ME! */
+ /** A timer. */
private Timer timer = null;
/** DOCUMENT ME! */
@@ -358,54 +382,57 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ * Handles a mouse click event.
+ *
+ * @param e the event.
*/
public void mouseClicked(MouseEvent e)
{
if (list.getSelectedValue() == null)
- return;
+ return;
FileSystemView fsv = filechooser.getFileSystemView();
if (timer.isRunning()
&& list.getSelectedValue().toString().equals(lastSelected.toString()))
{
- File f = fsv.createFileObject(lastSelected.toString());
- timer.stop();
- if (filechooser.isTraversable(f))
- {
- filechooser.setCurrentDirectory(f);
- filechooser.rescanCurrentDirectory();
- }
- else
- {
- filechooser.setSelectedFile(f);
- filechooser.approveSelection();
- closeDialog();
- }
+ File f = fsv.createFileObject(lastSelected.toString());
+ timer.stop();
+ if (filechooser.isTraversable(f))
+ {
+ filechooser.setCurrentDirectory(f);
+ filechooser.rescanCurrentDirectory();
+ }
+ else
+ {
+ filechooser.setSelectedFile(f);
+ filechooser.approveSelection();
+ closeDialog();
+ }
}
else
{
- File f = fsv.createFileObject(list.getSelectedValue().toString());
- if (filechooser.isTraversable(f))
- {
- setDirectorySelected(true);
- setDirectory(f);
- }
- else
- {
- setDirectorySelected(false);
- setDirectory(null);
- }
- lastSelected = list.getSelectedValue().toString();
- timer.restart();
+ String path = list.getSelectedValue().toString();
+ File f = fsv.createFileObject(path);
+ if (filechooser.isTraversable(f))
+ {
+ setDirectorySelected(true);
+ setDirectory(f);
+ }
+ else
+ {
+ setDirectorySelected(false);
+ setDirectory(null);
+ }
+ lastSelected = path;
+ parentPath = path.substring(0, path.lastIndexOf("/") + 1);
+ entry.setText(path.substring(path.lastIndexOf("/") + 1));
+ timer.restart();
}
}
/**
- * DOCUMENT ME!
- *
- * @param e DOCUMENT ME!
+ * Handles a mouse entered event (NOT IMPLEMENTED).
+ *
+ * @param e the mouse event.
*/
public void mouseEntered(MouseEvent e)
{
@@ -414,21 +441,26 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * An action that changes the file chooser to display the user's home
+ * directory.
+ *
+ * @see BasicFileChooserUI#getGoHomeAction()
*/
protected class GoHomeAction extends AbstractAction
{
/**
- * Creates a new GoHomeAction object.
+ * Creates a new <code>GoHomeAction</code> object.
*/
protected GoHomeAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Sets the directory to the user's home directory, and repaints the
+ * file chooser component.
*
- * @param e DOCUMENT ME!
+ * @param e the action event (ignored).
*/
public void actionPerformed(ActionEvent e)
{
@@ -440,21 +472,24 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * An action that handles the creation of a new folder/directory.
+ *
+ * @see BasicFileChooserUI#getNewFolderAction()
*/
protected class NewFolderAction extends AbstractAction
{
/**
- * Creates a new NewFolderAction object.
+ * Creates a new <code>NewFolderAction</code> object.
*/
protected NewFolderAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * Handles the event by creating a new folder.
*
- * @param e DOCUMENT ME!
+ * @param e the action event (ignored).
*/
public void actionPerformed(ActionEvent e)
{
@@ -473,15 +508,18 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * A listener for selection events in the file list.
+ *
+ * @see BasicFileChooserUI#createListSelectionListener(JFileChooser)
*/
protected class SelectionListener implements ListSelectionListener
{
/**
- * Creates a new SelectionListener object.
+ * Creates a new <code>SelectionListener</code> object.
*/
protected SelectionListener()
{
+ // Nothing to do here.
}
/**
@@ -504,6 +542,8 @@ public class BasicFileChooserUI extends FileChooserUI
/**
* DOCUMENT ME!
+ *
+ * @see BasicFileChooserUI#getUpdateAction()
*/
protected class UpdateAction extends AbstractAction
{
@@ -512,28 +552,30 @@ public class BasicFileChooserUI extends FileChooserUI
*/
protected UpdateAction()
{
+ // Nothing to do here.
}
/**
- * DOCUMENT ME!
+ * NOT YET IMPLEMENTED.
*
- * @param e DOCUMENT ME!
+ * @param e the action event.
*/
public void actionPerformed(ActionEvent e)
{
+ // FIXME: implement this
}
}
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the cancel button. */
protected int cancelButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the cancel button. */
protected String cancelButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the cancel button. */
protected String cancelButtonToolTipText;
- /** DOCUMENT ME! */
+ /** An icon representing a computer. */
protected Icon computerIcon = new Icon()
{
public int getIconHeight()
@@ -548,10 +590,11 @@ public class BasicFileChooserUI extends FileChooserUI
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ // FIXME: is this not implemented, or is the icon intentionally blank?
}
};
- /** DOCUMENT ME! */
+ /** An icon for the "details view" button. */
protected Icon detailsViewIcon = new Icon()
{
public int getIconHeight()
@@ -580,7 +623,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** An icon representing a directory. */
protected Icon directoryIcon = new Icon()
{
public int getIconHeight()
@@ -619,16 +662,16 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** The localised Mnemonic for the open button. */
protected int directoryOpenButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the open button. */
protected String directoryOpenButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the open button. */
protected String directoryOpenButtonToolTipText;
- /** DOCUMENT ME! */
+ /** An icon representing a file. */
protected Icon fileIcon = new Icon()
{
public int getIconHeight()
@@ -668,7 +711,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** An icon representing a floppy drive. */
protected Icon floppyDriveIcon = new Icon()
{
public int getIconHeight()
@@ -683,10 +726,11 @@ public class BasicFileChooserUI extends FileChooserUI
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ // FIXME: is this not implemented, or is the icon intentionally blank?
}
};
- /** DOCUMENT ME! */
+ /** An icon representing a hard drive. */
protected Icon hardDriveIcon = new Icon()
{
public int getIconHeight()
@@ -701,19 +745,20 @@ public class BasicFileChooserUI extends FileChooserUI
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ // FIXME: is this not implemented, or is the icon intentionally blank?
}
};
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the "help" button. */
protected int helpButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the "help" button. */
protected String helpButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the help button. */
protected String helpButtonToolTipText;
- /** DOCUMENT ME! */
+ /** An icon representing the user's home folder. */
protected Icon homeFolderIcon = new Icon()
{
public int getIconHeight()
@@ -753,7 +798,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** An icon for the "list view" button. */
protected Icon listViewIcon = new Icon()
{
public int getIconHeight()
@@ -795,37 +840,37 @@ public class BasicFileChooserUI extends FileChooserUI
}
};
- /** DOCUMENT ME! */
+ /** An icon for the "new folder" button. */
protected Icon newFolderIcon = directoryIcon;
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the "open" button. */
protected int openButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the "open" button. */
protected String openButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the "open" button. */
protected String openButtonToolTipText;
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the "save" button. */
protected int saveButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the "save" button. */
protected String saveButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the save button. */
protected String saveButtonToolTipText;
- /** DOCUMENT ME! */
+ /** The localised mnemonic for the "update" button. */
protected int updateButtonMnemonic;
- /** DOCUMENT ME! */
+ /** The localised text for the "update" button. */
protected String updateButtonText;
- /** DOCUMENT ME! */
+ /** The localised tool tip text for the "update" button. */
protected String updateButtonToolTipText;
- /** DOCUMENT ME! */
+ /** An icon for the "up folder" button. */
protected Icon upFolderIcon = new Icon()
{
public int getIconHeight()
@@ -876,77 +921,84 @@ public class BasicFileChooserUI extends FileChooserUI
// -- begin private, but package local since used in inner classes --
+ /** The file chooser component represented by this UI delegate. */
JFileChooser filechooser;
- /** DOCUMENT ME! */
+ /** The file list. */
JList filelist;
- /** DOCUMENT ME! */
+ /** The combo box used to display/select file filters. */
JComboBox filters;
- /** DOCUMENT ME! */
+ /** The model for the directory list. */
BasicDirectoryModel model;
- /** DOCUMENT ME! */
+ /** The file filter for all files. */
FileFilter acceptAll = new AcceptAllFileFilter();
- /** DOCUMENT ME! */
+ /** The default file view. */
FileView fv = new BasicFileView();
- /** DOCUMENT ME! */
+ /** The icon size. */
static final int ICON_SIZE = 24;
- /** DOCUMENT ME! */
+ /** A combo box for display/selection of parent directories. */
JComboBox parents;
- /** DOCUMENT ME! */
+ /** The current file name. */
String filename;
- /** DOCUMENT ME! */
+ /** The accept (open/save) button. */
JButton accept;
- /** DOCUMENT ME! */
+ /** The cancel button. */
JButton cancel;
- /** DOCUMENT ME! */
+ /** The button to move up to the parent directory. */
JButton upFolderButton;
- /** DOCUMENT ME! */
+ /** The button to create a new directory. */
JButton newFolderButton;
- /** DOCUMENT ME! */
+ /** The button to move to the user's home directory. */
JButton homeFolderButton;
- /** DOCUMENT ME! */
+ /** An optional accessory panel. */
JPanel accessoryPanel;
- /** DOCUMENT ME! */
+ /** A property change listener. */
PropertyChangeListener propertyChangeListener;
- /** DOCUMENT ME! */
+ /** The text describing the filter for "all files". */
String acceptAllFileFilterText;
- /** DOCUMENT ME! */
+ /** The text describing a directory type. */
String dirDescText;
- /** DOCUMENT ME! */
+ /** The text describing a file type. */
String fileDescText;
- /** DOCUMENT ME! */
+ /** Is a directory selected? */
boolean dirSelected = false;
- /** DOCUMENT ME! */
+ /** The current directory. */
File currDir = null;
+ // FIXME: describe what is contained in the bottom panel
+ /** The bottom panel. */
JPanel bottomPanel;
-
- /** DOCUMENT ME! */
+
+ /** The close panel. */
JPanel closePanel;
+ /** Text box that displays file name */
+ JTextField entry;
+
+ /** Current parent path */
+ String parentPath;
+
// -- end private --
- private class ListLabelRenderer
- extends JLabel
- implements ListCellRenderer
+ private class ListLabelRenderer extends JLabel implements ListCellRenderer
{
/** DOCUMENT ME! */
final Color selected = new Color(153, 204, 255);
@@ -988,45 +1040,8 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Closes the dialog.
*/
- public class CBLabelRenderer extends JLabel implements ListCellRenderer
- {
- /**
- * Creates a new CBLabelRenderer object.
- */
- public CBLabelRenderer()
- {
- super();
- setOpaque(true);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param list DOCUMENT ME!
- * @param value DOCUMENT ME!
- * @param index DOCUMENT ME!
- * @param isSelected DOCUMENT ME!
- * @param cellHasFocus DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public Component getListCellRendererComponent(JList list, Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus)
- {
- setHorizontalAlignment(SwingConstants.LEFT);
- setIcon(directoryIcon);
- setText(value.toString());
- setForeground(Color.BLACK);
- setBackground(Color.WHITE);
-
- return this;
- }
- }
-
void closeDialog()
{
Window owner = SwingUtilities.windowForComponent(filechooser);
@@ -1035,9 +1050,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * Creates a new BasicFileChooserUI object.
+ * Creates a new <code>BasicFileChooserUI</code> object.
*
- * @param b DOCUMENT ME!
+ * @param b the file chooser component.
*/
public BasicFileChooserUI(JFileChooser b)
{
@@ -1045,11 +1060,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns a UI delegate for the given component.
*
- * @param c DOCUMENT ME!
+ * @param c the component (should be a {@link JFileChooser}).
*
- * @return DOCUMENT ME!
+ * @return A new UI delegate.
*/
public static ComponentUI createUI(JComponent c)
{
@@ -1057,28 +1072,32 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
- *
- * @param c DOCUMENT ME!
+ * Installs the UI for the specified component.
+ *
+ * @param c the component (should be a {@link JFileChooser}).
*/
public void installUI(JComponent c)
{
if (c instanceof JFileChooser)
{
- JFileChooser fc = (JFileChooser) c;
- fc.resetChoosableFileFilters();
- createModel();
- clearIconCache();
- installDefaults(fc);
- installComponents(fc);
- installListeners(fc);
+ JFileChooser fc = (JFileChooser) c;
+ fc.resetChoosableFileFilters();
+ createModel();
+ clearIconCache();
+ installDefaults(fc);
+ installComponents(fc);
+ installListeners(fc);
+
+ Object path = filechooser.getCurrentDirectory();
+ if (path != null)
+ parentPath = path.toString().substring(path.toString().lastIndexOf("/"));
}
}
/**
- * DOCUMENT ME!
- *
- * @param c DOCUMENT ME!
+ * Uninstalls this UI from the given component.
+ *
+ * @param c the component (should be a {@link JFileChooser}).
*/
public void uninstallUI(JComponent c)
{
@@ -1185,16 +1204,16 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and install the subcomponents for the file chooser.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
public void installComponents(JFileChooser fc)
{
JLabel look = new JLabel("Look In:");
parents = new JComboBox();
- parents.setRenderer(new CBLabelRenderer());
+ parents.setRenderer(new BasicComboBoxRenderer());
boxEntries();
look.setLabelFor(parents);
JPanel parentsPanel = new JPanel();
@@ -1226,9 +1245,9 @@ public class BasicFileChooserUI extends FileChooserUI
buttonPanel.add(detailsViewButton);
JPanel topPanel = new JPanel();
- topPanel.setLayout(new java.awt.FlowLayout());
+ parentsPanel.add(buttonPanel);
+ topPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));
topPanel.add(parentsPanel);
- topPanel.add(buttonPanel);
accessoryPanel = new JPanel();
if (filechooser.getAccessory() != null)
@@ -1260,7 +1279,7 @@ public class BasicFileChooserUI extends FileChooserUI
JLabel fileNameLabel = new JLabel("File Name:");
JLabel fileTypesLabel = new JLabel("Files of Type:");
- JTextField entry = new JTextField();
+ entry = new JTextField();
filters = new JComboBox();
filterEntries();
@@ -1309,9 +1328,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Uninstalls the components from the file chooser.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
public void uninstallComponents(JFileChooser fc)
{
@@ -1327,9 +1346,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Installs the listeners required by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void installListeners(JFileChooser fc)
{
@@ -1349,9 +1368,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Uninstalls the listeners previously installed by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void uninstallListeners(JFileChooser fc)
{
@@ -1360,9 +1379,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Installs the defaults for this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void installDefaults(JFileChooser fc)
{
@@ -1371,9 +1390,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Uninstalls the defaults previously added by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void uninstallDefaults(JFileChooser fc)
{
@@ -1382,9 +1401,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Installs the icons for this UI delegate (NOT YET IMPLEMENTED).
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void installIcons(JFileChooser fc)
{
@@ -1392,9 +1411,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Uninstalls the icons previously added by this UI delegate (NOT YET
+ * IMPLEMENTED).
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void uninstallIcons(JFileChooser fc)
{
@@ -1402,39 +1422,37 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Installs the strings used by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void installStrings(JFileChooser fc)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- acceptAllFileFilterText = defaults.getString("FileChooser.acceptAllFileFilterText");
- cancelButtonMnemonic = defaults.getInt("FileChooser.cancelButtonMnemonic");
- cancelButtonText = defaults.getString("FileChooser.cancelButtonText");
- cancelButtonToolTipText = defaults.getString("FileChooser.cancelButtonToolTipText");
+ acceptAllFileFilterText = UIManager.getString("FileChooser.acceptAllFileFilterText");
+ cancelButtonMnemonic = UIManager.getInt("FileChooser.cancelButtonMnemonic");
+ cancelButtonText = UIManager.getString("FileChooser.cancelButtonText");
+ cancelButtonToolTipText = UIManager.getString("FileChooser.cancelButtonToolTipText");
- dirDescText = defaults.getString("FileChooser.directoryDescriptionText");
- fileDescText = defaults.getString("FileChooser.fileDescriptionText");
+ dirDescText = UIManager.getString("FileChooser.directoryDescriptionText");
+ fileDescText = UIManager.getString("FileChooser.fileDescriptionText");
- helpButtonMnemonic = defaults.getInt("FileChooser.helpButtonMnemonic");
- helpButtonText = defaults.getString("FileChooser.helpButtonText");
- helpButtonToolTipText = defaults.getString("FileChooser.helpButtonToolTipText");
+ helpButtonMnemonic = UIManager.getInt("FileChooser.helpButtonMnemonic");
+ helpButtonText = UIManager.getString("FileChooser.helpButtonText");
+ helpButtonToolTipText = UIManager.getString("FileChooser.helpButtonToolTipText");
- openButtonMnemonic = defaults.getInt("FileChooser.openButtonMnemonic");
- openButtonText = defaults.getString("FileChooser.openButtonText");
- openButtonToolTipText = defaults.getString("FileChooser.openButtonToolTipText");
+ openButtonMnemonic = UIManager.getInt("FileChooser.openButtonMnemonic");
+ openButtonText = UIManager.getString("FileChooser.openButtonText");
+ openButtonToolTipText = UIManager.getString("FileChooser.openButtonToolTipText");
- saveButtonMnemonic = defaults.getInt("FileChooser.saveButtonMnemonic");
- saveButtonText = defaults.getString("FileChooser.saveButtonText");
- saveButtonToolTipText = defaults.getString("FileChooser.saveButtonToolTipText");
+ saveButtonMnemonic = UIManager.getInt("FileChooser.saveButtonMnemonic");
+ saveButtonText = UIManager.getString("FileChooser.saveButtonText");
+ saveButtonToolTipText = UIManager.getString("FileChooser.saveButtonToolTipText");
}
/**
- * DOCUMENT ME!
+ * Uninstalls the strings previously added by this UI delegate.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
protected void uninstallStrings(JFileChooser fc)
{
@@ -1460,7 +1478,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates a new directory model.
*/
protected void createModel()
{
@@ -1468,9 +1486,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the directory model.
*
- * @return DOCUMENT ME!
+ * @return The directory model.
*/
public BasicDirectoryModel getModel()
{
@@ -1478,115 +1496,131 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
- *
- * @param fc DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Creates a listener to handle changes to the properties of the given
+ * file chooser component.
+ *
+ * @param fc the file chooser component.
+ *
+ * @return A new listener.
*/
public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)
{
return new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent e)
{
- public void propertyChange(PropertyChangeEvent e)
- {
- // FIXME: Multiple file selection waiting on JList multiple selection bug.
- if (e.getPropertyName().equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY))
- {
- if (filechooser.getSelectedFile() == null)
- setFileName(null);
- else
- setFileName(filechooser.getSelectedFile().toString());
- int index = -1;
- File file = filechooser.getSelectedFile();
- for (index = 0; index < model.getSize(); index++)
- if (((File) model.getElementAt(index)).equals(file))
- break;
- if (index == -1)
- return;
- filelist.setSelectedIndex(index);
- filelist.ensureIndexIsVisible(index);
- filelist.revalidate();
- filelist.repaint();
- }
- else if (e.getPropertyName().equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY))
- {
- filelist.clearSelection();
- filelist.revalidate();
- filelist.repaint();
- setDirectorySelected(false);
- setDirectory(filechooser.getCurrentDirectory());
- boxEntries();
- }
- else if (e.getPropertyName().equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)
- || e.getPropertyName().equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY))
- filterEntries();
- else if (e.getPropertyName().equals(JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY)
- || e.getPropertyName().equals(JFileChooser.DIALOG_TITLE_CHANGED_PROPERTY))
- {
- Window owner = SwingUtilities.windowForComponent(filechooser);
- if (owner instanceof JDialog)
- ((JDialog) owner).setTitle(getDialogTitle(filechooser));
- accept.setText(getApproveButtonText(filechooser));
- accept.setToolTipText(getApproveButtonToolTipText(filechooser));
- accept.setMnemonic(getApproveButtonMnemonic(filechooser));
- }
- else if (e.getPropertyName().equals(JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY))
- accept.setText(getApproveButtonText(filechooser));
- else if (e.getPropertyName().equals(JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY))
- accept.setToolTipText(getApproveButtonToolTipText(filechooser));
- else if (e.getPropertyName().equals(JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY))
- accept.setMnemonic(getApproveButtonMnemonic(filechooser));
- else if (e.getPropertyName().equals(JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY))
- {
- if (filechooser.getControlButtonsAreShown())
- {
- GridBagConstraints c = new GridBagConstraints();
- c.gridy = 1;
- bottomPanel.add(filters, c);
-
- c.fill = GridBagConstraints.BOTH;
- c.gridy = 2;
- c.anchor = GridBagConstraints.EAST;
- bottomPanel.add(closePanel, c);
- bottomPanel.revalidate();
- bottomPanel.repaint();
- bottomPanel.doLayout();
- }
- else
- bottomPanel.remove(closePanel);
- }
- else if (e.getPropertyName().equals(JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY))
- {
- if (filechooser.isAcceptAllFileFilterUsed())
- filechooser.addChoosableFileFilter(getAcceptAllFileFilter(filechooser));
- else
- filechooser.removeChoosableFileFilter(getAcceptAllFileFilter(filechooser));
- }
- else if (e.getPropertyName().equals(JFileChooser.ACCESSORY_CHANGED_PROPERTY))
- {
- JComponent old = (JComponent) e.getOldValue();
- if (old != null)
- getAccessoryPanel().remove(old);
- JComponent newval = (JComponent) e.getNewValue();
- if (newval != null)
- getAccessoryPanel().add(newval);
- }
- if (e.getPropertyName().equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)
- || e.getPropertyName().equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)
- || e.getPropertyName().equals(JFileChooser.FILE_HIDING_CHANGED_PROPERTY))
- rescanCurrentDirectory(filechooser);
-
- filechooser.revalidate();
- filechooser.repaint();
- }
- };
+ // FIXME: Multiple file selection waiting on JList multiple selection
+ // bug.
+ if (e.getPropertyName().equals(
+ JFileChooser.SELECTED_FILE_CHANGED_PROPERTY))
+ {
+ if (filechooser.getSelectedFile() == null)
+ setFileName(null);
+ else
+ setFileName(filechooser.getSelectedFile().toString());
+ int index = -1;
+ File file = filechooser.getSelectedFile();
+ for (index = 0; index < model.getSize(); index++)
+ if (((File) model.getElementAt(index)).equals(file))
+ break;
+ if (index == -1)
+ return;
+ filelist.setSelectedIndex(index);
+ filelist.ensureIndexIsVisible(index);
+ filelist.revalidate();
+ filelist.repaint();
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.DIRECTORY_CHANGED_PROPERTY))
+ {
+ filelist.clearSelection();
+ filelist.revalidate();
+ filelist.repaint();
+ setDirectorySelected(false);
+ setDirectory(filechooser.getCurrentDirectory());
+ boxEntries();
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)
+ || e.getPropertyName().equals(
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY))
+ filterEntries();
+ else if (e.getPropertyName().equals(
+ JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY)
+ || e.getPropertyName().equals(
+ JFileChooser.DIALOG_TITLE_CHANGED_PROPERTY))
+ {
+ Window owner = SwingUtilities.windowForComponent(filechooser);
+ if (owner instanceof JDialog)
+ ((JDialog) owner).setTitle(getDialogTitle(filechooser));
+ accept.setText(getApproveButtonText(filechooser));
+ accept.setToolTipText(getApproveButtonToolTipText(filechooser));
+ accept.setMnemonic(getApproveButtonMnemonic(filechooser));
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY))
+ accept.setText(getApproveButtonText(filechooser));
+ else if (e.getPropertyName().equals(
+ JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY))
+ accept.setToolTipText(getApproveButtonToolTipText(filechooser));
+ else if (e.getPropertyName().equals(
+ JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY))
+ accept.setMnemonic(getApproveButtonMnemonic(filechooser));
+ else if (e.getPropertyName().equals(
+ JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY))
+ {
+ if (filechooser.getControlButtonsAreShown())
+ {
+ GridBagConstraints c = new GridBagConstraints();
+ c.gridy = 1;
+ bottomPanel.add(filters, c);
+
+ c.fill = GridBagConstraints.BOTH;
+ c.gridy = 2;
+ c.anchor = GridBagConstraints.EAST;
+ bottomPanel.add(closePanel, c);
+ bottomPanel.revalidate();
+ bottomPanel.repaint();
+ bottomPanel.doLayout();
+ }
+ else
+ bottomPanel.remove(closePanel);
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY))
+ {
+ if (filechooser.isAcceptAllFileFilterUsed())
+ filechooser.addChoosableFileFilter(getAcceptAllFileFilter(filechooser));
+ else
+ filechooser.removeChoosableFileFilter(getAcceptAllFileFilter(filechooser));
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.ACCESSORY_CHANGED_PROPERTY))
+ {
+ JComponent old = (JComponent) e.getOldValue();
+ if (old != null)
+ getAccessoryPanel().remove(old);
+ JComponent newval = (JComponent) e.getNewValue();
+ if (newval != null)
+ getAccessoryPanel().add(newval);
+ }
+ if (e.getPropertyName().equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)
+ || e.getPropertyName().equals(
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY)
+ || e.getPropertyName().equals(
+ JFileChooser.FILE_HIDING_CHANGED_PROPERTY))
+ rescanCurrentDirectory(filechooser);
+
+ filechooser.revalidate();
+ filechooser.repaint();
+ }
+ };
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns the current file name.
+ *
+ * @return The current file name.
*/
public String getFileName()
{
@@ -1594,9 +1628,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the current directory name.
*
- * @return DOCUMENT ME!
+ * @return The directory name.
+ *
+ * @see #setDirectoryName(String)
*/
public String getDirectoryName()
{
@@ -1605,9 +1641,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Sets the file name.
*
- * @param filename DOCUMENT ME!
+ * @param filename the file name.
+ *
+ * @see #getFileName()
*/
public void setFileName(String filename)
{
@@ -1615,9 +1653,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Sets the directory name (NOT IMPLEMENTED).
*
- * @param dirname DOCUMENT ME!
+ * @param dirname the directory name.
+ *
+ * @see #getDirectoryName()
*/
public void setDirectoryName(String dirname)
{
@@ -1625,9 +1665,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Rescans the current directory.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*/
public void rescanCurrentDirectory(JFileChooser fc)
{
@@ -1636,10 +1676,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * NOT YET IMPLEMENTED.
*
- * @param fc DOCUMENT ME!
- * @param f DOCUMENT ME!
+ * @param fc the file chooser.
+ * @param f the file.
*/
public void ensureFileIsVisible(JFileChooser fc, File f)
{
@@ -1647,9 +1687,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the {@link JFileChooser} component that this UI delegate
+ * represents.
*
- * @return DOCUMENT ME!
+ * @return The component represented by this UI delegate.
*/
public JFileChooser getFileChooser()
{
@@ -1657,9 +1698,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the optional accessory panel.
*
- * @return DOCUMENT ME!
+ * @return The optional accessory panel.
*/
public JPanel getAccessoryPanel()
{
@@ -1667,11 +1708,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns an approve (open or save) button for the dialog.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*
- * @return DOCUMENT ME!
+ * @return The button.
*/
public JButton getApproveButton(JFileChooser fc)
{
@@ -1682,11 +1723,14 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the tool tip text for the approve (open/save) button. This first
+ * checks the file chooser to see if a value has been explicitly set - if
+ * not, a default value appropriate for the type of file chooser is
+ * returned.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser.
*
- * @return DOCUMENT ME!
+ * @return The tool tip text.
*/
public String getApproveButtonToolTipText(JFileChooser fc)
{
@@ -1699,7 +1743,7 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Clears the icon cache.
*/
public void clearIconCache()
{
@@ -1708,11 +1752,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates a new listener to handle selections in the file list.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser component.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link SelectionListener}.
*/
public ListSelectionListener createListSelectionListener(JFileChooser fc)
{
@@ -1720,12 +1764,12 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates a new listener to handle double-click events.
*
- * @param fc DOCUMENT ME!
- * @param list DOCUMENT ME!
+ * @param fc the file chooser component.
+ * @param list the list.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link DoubleClickListener}.
*/
protected MouseListener createDoubleClickListener(JFileChooser fc, JList list)
{
@@ -1733,9 +1777,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if a directory is selected, and
+ * <code>false</code> otherwise.
*
- * @return DOCUMENT ME!
+ * @return A boolean.
*/
protected boolean isDirectorySelected()
{
@@ -1743,9 +1788,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Sets the flag that indicates whether the current directory is selected.
*
- * @param selected DOCUMENT ME!
+ * @param selected the new flag value.
*/
protected void setDirectorySelected(boolean selected)
{
@@ -1753,9 +1798,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the current directory.
*
- * @return DOCUMENT ME!
+ * @return The current directory.
*/
protected File getDirectory()
{
@@ -1763,9 +1808,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Sets the current directory.
*
- * @param f DOCUMENT ME!
+ * @param f the directory.
*/
protected void setDirectory(File f)
{
@@ -1773,11 +1818,11 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the "accept all" file filter.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser component.
*
- * @return DOCUMENT ME!
+ * @return The "accept all" file filter.
*/
public FileFilter getAcceptAllFileFilter(JFileChooser fc)
{
@@ -1785,25 +1830,29 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the file view for the file chooser. This returns either the
+ * file view that has been explicitly set for the {@link JFileChooser}, or
+ * a default file view.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser component.
*
- * @return DOCUMENT ME!
+ * @return The file view.
+ *
+ * @see JFileChooser#getFileView()
*/
public FileView getFileView(JFileChooser fc)
{
- if (fc.getFileView() != null)
- return fc.getFileView();
return fv;
}
/**
- * DOCUMENT ME!
+ * Returns the dialog title.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return The dialog title.
+ *
+ * @see JFileChooser#getDialogTitle()
*/
public String getDialogTitle(JFileChooser fc)
{
@@ -1828,11 +1877,13 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the approve button mnemonic.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return The approve button mnemonic.
+ *
+ * @see JFileChooser#getApproveButtonMnemonic()
*/
public int getApproveButtonMnemonic(JFileChooser fc)
{
@@ -1845,11 +1896,13 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Returns the approve button text.
*
- * @param fc DOCUMENT ME!
+ * @param fc the file chooser (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return The approve button text.
+ *
+ * @see JFileChooser#getApproveButtonText()
*/
public String getApproveButtonText(JFileChooser fc)
{
@@ -1862,9 +1915,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "new folder"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link GoHomeAction}.
*/
public Action getNewFolderAction()
{
@@ -1872,9 +1926,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "home folder"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link GoHomeAction}.
*/
public Action getGoHomeAction()
{
@@ -1882,9 +1937,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "up folder"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link ChangeToParentDirectoryAction}.
*/
public Action getChangeToParentDirectoryAction()
{
@@ -1892,9 +1948,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "approve"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link ApproveSelectionAction}.
*/
public Action getApproveSelectionAction()
{
@@ -1902,9 +1959,10 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new action that will be used with the "cancel"
+ * button.
*
- * @return DOCUMENT ME!
+ * @return A new instance of {@link CancelSelectionAction}.
*/
public Action getCancelSelectionAction()
{
@@ -1912,9 +1970,9 @@ public class BasicFileChooserUI extends FileChooserUI
}
/**
- * DOCUMENT ME!
+ * Creates and returns a new instance of {@link UpdateAction}.
*
- * @return DOCUMENT ME!
+ * @return An action.
*/
public Action getUpdateAction()
{
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
index 3abd76fe2d3..9c7f1c4c5d1 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
@@ -1,5 +1,5 @@
/* BasicFormattedTextFieldUI.java
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
import javax.swing.JComponent;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
/**
@@ -48,6 +49,7 @@ public class BasicFormattedTextFieldUI extends BasicTextFieldUI
{
public BasicFormattedTextFieldUI()
{
+ // Nothing to do here.
}
public static ComponentUI createUI(JComponent c)
@@ -55,6 +57,11 @@ public class BasicFormattedTextFieldUI extends BasicTextFieldUI
return new BasicFormattedTextFieldUI();
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "FormattedTextField"
+ */
protected String getPropertyPrefix()
{
return "FormattedTextField";
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
index 757ac47c903..068de345bec 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicGraphicsUtils.java
@@ -71,6 +71,7 @@ public class BasicGraphicsUtils
*/
public BasicGraphicsUtils()
{
+ // Nothing to do here.
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java b/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java
index 56a67b02935..6debd649509 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicIconFactory.java
@@ -41,7 +41,6 @@ package javax.swing.plaf.basic;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
-import java.awt.Polygon;
import java.io.Serializable;
import javax.swing.Icon;
@@ -241,34 +240,33 @@ public class BasicIconFactory implements Serializable
{
return new DummyIcon();
}
+
+ /**
+ * Returns a new instance of a 4 x 8 icon showing a small black triangle that
+ * points to the right. This is displayed in menu items that have a
+ * sub menu.
+ *
+ * @return The icon.
+ */
public static Icon getMenuArrowIcon()
{
return new Icon()
{
public int getIconHeight()
{
- return 12;
+ return 8;
}
-
public int getIconWidth()
{
- return 12;
+ return 4;
}
-
public void paintIcon(Component c, Graphics g, int x, int y)
{
- g.translate(x, y);
-
Color saved = g.getColor();
-
g.setColor(Color.BLACK);
-
- g.fillPolygon(new Polygon(new int[] { 3, 9, 3 },
- new int[] { 2, 6, 10 },
- 3));
-
+ for (int i = 0; i < 4; i++)
+ g.drawLine(x + i, y + i, x + i, y + 7 - i);
g.setColor(saved);
- g.translate(-x, -y);
}
};
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
index cc262948ded..56022f3331e 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
@@ -66,7 +66,6 @@ import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
/**
@@ -84,6 +83,14 @@ public class BasicInternalFrameTitlePane extends JComponent
public class CloseAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public CloseAction()
+ {
+ super("Close");
+ }
+
+ /**
* This method is called when something closes the JInternalFrame.
*
* @param e The ActionEvent.
@@ -92,13 +99,14 @@ public class BasicInternalFrameTitlePane extends JComponent
{
if (frame.isClosable())
{
- try
- {
- frame.setClosed(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ frame.setClosed(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
}
@@ -113,6 +121,14 @@ public class BasicInternalFrameTitlePane extends JComponent
public class IconifyAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public IconifyAction()
+ {
+ super("Minimize");
+ }
+
+ /**
* This method is called when the user wants to iconify the
* JInternalFrame.
*
@@ -122,13 +138,14 @@ public class BasicInternalFrameTitlePane extends JComponent
{
if (frame.isIconifiable() && ! frame.isIcon())
{
- try
- {
- frame.setIcon(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ frame.setIcon(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
}
@@ -143,6 +160,13 @@ public class BasicInternalFrameTitlePane extends JComponent
public class MaximizeAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public MaximizeAction()
+ {
+ super("Maximize");
+ }
+ /**
* This method is called when the user wants to maximize the
* JInternalFrame.
*
@@ -152,13 +176,14 @@ public class BasicInternalFrameTitlePane extends JComponent
{
try
{
- if (frame.isMaximizable() && ! frame.isMaximum())
- frame.setMaximum(true);
- else if (frame.isMaximum())
- frame.setMaximum(false);
+ if (frame.isMaximizable() && ! frame.isMaximum())
+ frame.setMaximum(true);
+ else if (frame.isMaximum())
+ frame.setMaximum(false);
}
catch (PropertyVetoException pve)
{
+ // We do nothing if the attempt has been vetoed.
}
}
}
@@ -173,6 +198,13 @@ public class BasicInternalFrameTitlePane extends JComponent
public class MoveAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public MoveAction()
+ {
+ super("Move");
+ }
+ /**
* This method is called when the user wants to drag the JInternalFrame.
*
* @param e The ActionEvent.
@@ -194,6 +226,13 @@ public class BasicInternalFrameTitlePane extends JComponent
public class RestoreAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public RestoreAction()
+ {
+ super("Restore");
+ }
+ /**
* This method is called when the user wants to restore the
* JInternalFrame.
*
@@ -203,13 +242,14 @@ public class BasicInternalFrameTitlePane extends JComponent
{
if (frame.isMaximum())
{
- try
- {
- frame.setMaximum(false);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ frame.setMaximum(false);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if the attempt has been vetoed.
+ }
}
}
}
@@ -224,6 +264,13 @@ public class BasicInternalFrameTitlePane extends JComponent
public class SizeAction extends AbstractAction
{
/**
+ * Creates a new action.
+ */
+ public SizeAction()
+ {
+ super("Size");
+ }
+ /**
* This method is called when the user wants to resize the JInternalFrame.
*
* @param e The ActionEvent.
@@ -377,24 +424,26 @@ public class BasicInternalFrameTitlePane extends JComponent
int loc = width + insets.left - 1;
int top = insets.top + 1;
- int buttonWidth = height - 2;
int buttonHeight = height - 4;
if (closeButton.isVisible())
{
- loc -= buttonWidth + 2;
- closeButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ int buttonWidth = closeIcon.getIconWidth();
+ loc -= buttonWidth + 2;
+ closeButton.setBounds(loc, top, buttonWidth, buttonHeight);
}
if (maxButton.isVisible())
{
- loc -= buttonWidth + 2;
- maxButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ int buttonWidth = maxIcon.getIconWidth();
+ loc -= buttonWidth + 2;
+ maxButton.setBounds(loc, top, buttonWidth, buttonHeight);
}
if (iconButton.isVisible())
{
- loc -= buttonWidth + 2;
- iconButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ int buttonWidth = iconIcon.getIconWidth();
+ loc -= buttonWidth + 2;
+ iconButton.setBounds(loc, top, buttonWidth, buttonHeight);
}
if (title != null)
@@ -435,6 +484,7 @@ public class BasicInternalFrameTitlePane extends JComponent
*/
public void removeLayoutComponent(Component c)
{
+ // Nothing to do here.
}
}
@@ -466,6 +516,7 @@ public class BasicInternalFrameTitlePane extends JComponent
// These buttons cannot be given focus.
return false;
}
+
}
/** The action command for the Close action. */
@@ -522,6 +573,9 @@ public class BasicInternalFrameTitlePane extends JComponent
/** The icon displayed in the iconify button. */
protected Icon iconIcon = BasicIconFactory.createEmptyFrameIcon();
+ /** The icon displayed in the close button. */
+ protected Icon closeIcon;
+
/** The JInternalFrame that this TitlePane is used in. */
protected JInternalFrame frame;
@@ -645,7 +699,7 @@ public class BasicInternalFrameTitlePane extends JComponent
*/
protected void installListeners()
{
- propertyChangeListener = new PropertyChangeHandler();
+ propertyChangeListener = createPropertyChangeListener();
frame.addPropertyChangeListener(propertyChangeListener);
}
@@ -663,14 +717,15 @@ public class BasicInternalFrameTitlePane extends JComponent
*/
protected void installDefaults()
{
- // FIXME: move icons to defaults.
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- setFont(defaults.getFont("InternalFrame.titleFont"));
- selectedTextColor = defaults.getColor("InternalFrame.activeTitleForeground");
- selectedTitleColor = defaults.getColor("InternalFrame.activeTitleBackground");
- notSelectedTextColor = defaults.getColor("InternalFrame.inactiveTitleForeground");
- notSelectedTitleColor = defaults.getColor("InternalFrame.inactiveTitleBackground");
+ title.setFont(UIManager.getFont("InternalFrame.titleFont"));
+ selectedTextColor = UIManager.getColor("InternalFrame.activeTitleForeground");
+ selectedTitleColor = UIManager.getColor("InternalFrame.activeTitleBackground");
+ notSelectedTextColor = UIManager.getColor("InternalFrame.inactiveTitleForeground");
+ notSelectedTitleColor = UIManager.getColor("InternalFrame.inactiveTitleBackground");
+
+ closeIcon = UIManager.getIcon("InternalFrame.closeIcon");
+ iconIcon = UIManager.getIcon("InternalFrame.iconifyIcon");
+ maxIcon = UIManager.getIcon("InternalFrame.maximizeIcon");
}
/**
@@ -683,6 +738,10 @@ public class BasicInternalFrameTitlePane extends JComponent
selectedTitleColor = null;
notSelectedTextColor = null;
notSelectedTitleColor = null;
+
+ closeIcon = null;
+ iconIcon = null;
+ maxIcon = null;
}
/**
@@ -691,12 +750,15 @@ public class BasicInternalFrameTitlePane extends JComponent
protected void createButtons()
{
closeButton = new PaneButton(closeAction);
+ closeButton.setText(null);
if (!frame.isClosable())
closeButton.setVisible(false);
iconButton = new PaneButton(iconifyAction);
+ iconButton.setText(null);
if (!frame.isIconifiable())
iconButton.setVisible(false);
maxButton = new PaneButton(maximizeAction);
+ maxButton.setText(null);
if (!frame.isMaximizable())
maxButton.setVisible(false);
}
@@ -706,15 +768,12 @@ public class BasicInternalFrameTitlePane extends JComponent
*/
protected void setButtonIcons()
{
- Icon icon = UIManager.getIcon("InternalFrame.closeIcon");
- if (icon != null)
- closeButton.setIcon(icon);
- icon = UIManager.getIcon("InternalFrame.iconifyIcon");
- if (icon != null)
- iconButton.setIcon(icon);
- icon = UIManager.getIcon("InternalFrame.maximizeIcon");
- if (icon != null)
- maxButton.setIcon(icon);
+ if (closeIcon != null && closeButton != null)
+ closeButton.setIcon(closeIcon);
+ if (iconIcon != null && iconButton != null)
+ iconButton.setIcon(iconIcon);
+ if (maxIcon != null && maxButton != null)
+ maxButton.setIcon(maxIcon);
}
/**
@@ -816,11 +875,12 @@ public class BasicInternalFrameTitlePane extends JComponent
public void paintComponent(Graphics g)
{
paintTitleBackground(g);
- Font f = g.getFont();
- FontMetrics fm = g.getFontMetrics(f);
if (frame.getTitle() != null && title != null)
{
Color saved = g.getColor();
+ Font f = title.getFont();
+ g.setFont(f);
+ FontMetrics fm = g.getFontMetrics(f);
if (frame.isSelected())
g.setColor(selectedTextColor);
else
@@ -838,6 +898,9 @@ public class BasicInternalFrameTitlePane extends JComponent
*/
protected void paintTitleBackground(Graphics g)
{
+ if (!isOpaque())
+ return;
+
Color saved = g.getColor();
Dimension dims = getSize();
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
index 8f76ea0cc19..d9dadda688a 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java
@@ -56,20 +56,17 @@ import java.beans.PropertyChangeListener;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
-import javax.swing.BorderFactory;
import javax.swing.DefaultDesktopManager;
import javax.swing.DesktopManager;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.AbstractBorder;
-import javax.swing.border.BevelBorder;
-import javax.swing.border.Border;
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import javax.swing.event.MouseInputAdapter;
@@ -202,67 +199,66 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
public void mouseDragged(MouseEvent e)
{
- // If the frame is maximized, there is nothing that
+ // If the frame is maximized, there is nothing that
// can be dragged around.
if (frame.isMaximum())
- return;
+ return;
DesktopManager dm = getDesktopManager();
Rectangle b = frame.getBounds();
Dimension min = frame.getMinimumSize();
if (min == null)
- min = new Dimension(0, 0);
+ min = new Dimension(0, 0);
Insets insets = frame.getInsets();
int x = e.getX();
int y = e.getY();
if (e.getSource() == frame && frame.isResizable())
{
- switch (direction)
- {
- case NORTH:
- cacheRect.setBounds(b.x,
- Math.min(b.y + y, b.y + b.height
- - min.height), b.width, b.height
- - y);
- break;
- case NORTH_EAST:
- cacheRect.setBounds(b.x,
- Math.min(b.y + y, b.y + b.height
- - min.height), x, b.height - y);
- break;
- case EAST:
- cacheRect.setBounds(b.x, b.y, x, b.height);
- break;
- case SOUTH_EAST:
- cacheRect.setBounds(b.x, b.y, x, y);
- break;
- case SOUTH:
- cacheRect.setBounds(b.x, b.y, b.width, y);
- break;
- case SOUTH_WEST:
- cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
- b.y, b.width - x, y);
- break;
- case WEST:
- cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
- b.y, b.width - x, b.height);
- break;
- case NORTH_WEST:
- cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
- Math.min(b.y + y, b.y + b.height
- - min.height), b.width - x,
- b.height - y);
- break;
- }
- dm.resizeFrame(frame, cacheRect.x, cacheRect.y,
- Math.max(min.width, cacheRect.width),
- Math.max(min.height, cacheRect.height));
+ switch (direction)
+ {
+ case NORTH:
+ cacheRect.setBounds(b.x, Math.min(b.y + y, b.y + b.height
+ - min.height),
+ b.width, b.height - y);
+ break;
+ case NORTH_EAST:
+ cacheRect.setBounds(b.x, Math.min(b.y + y, b.y + b.height
+ - min.height), x,
+ b.height - y);
+ break;
+ case EAST:
+ cacheRect.setBounds(b.x, b.y, x, b.height);
+ break;
+ case SOUTH_EAST:
+ cacheRect.setBounds(b.x, b.y, x, y);
+ break;
+ case SOUTH:
+ cacheRect.setBounds(b.x, b.y, b.width, y);
+ break;
+ case SOUTH_WEST:
+ cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
+ b.y, b.width - x, y);
+ break;
+ case WEST:
+ cacheRect.setBounds(Math.min(b.x + x, b.x + b.width - min.width),
+ b.y, b.width - x, b.height);
+ break;
+ case NORTH_WEST:
+ cacheRect.setBounds(
+ Math.min(b.x + x, b.x + b.width - min.width),
+ Math.min(b.y + y, b.y + b.height - min.height),
+ b.width - x, b.height - y);
+ break;
+ }
+ dm.resizeFrame(frame, cacheRect.x, cacheRect.y,
+ Math.max(min.width, cacheRect.width),
+ Math.max(min.height, cacheRect.height));
}
else if (e.getSource() == titlePane)
{
- Rectangle fBounds = frame.getBounds();
+ Rectangle fBounds = frame.getBounds();
- dm.dragFrame(frame, e.getX() - xOffset + b.x,
- e.getY() - yOffset + b.y);
+ dm.dragFrame(frame, e.getX() - xOffset + b.x, e.getY() - yOffset
+ + b.y);
}
}
@@ -304,17 +300,17 @@ public class BasicInternalFrameUI extends InternalFrameUI
if (e.getSource() == frame && frame.isResizable())
{
- direction = sectionOfClick(x, y);
- dm.beginResizingFrame(frame, direction);
+ direction = sectionOfClick(x, y);
+ dm.beginResizingFrame(frame, direction);
}
else if (e.getSource() == titlePane)
{
- Rectangle tBounds = titlePane.getBounds();
+ Rectangle tBounds = titlePane.getBounds();
- xOffset = e.getX() - tBounds.x + insets.left;
- yOffset = e.getY() - tBounds.y + insets.top;
+ xOffset = e.getX() - tBounds.x + insets.left;
+ yOffset = e.getY() - tBounds.y + insets.top;
- dm.beginDraggingFrame(frame);
+ dm.beginDraggingFrame(frame);
}
}
@@ -329,9 +325,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
xOffset = 0;
yOffset = 0;
if (e.getSource() == frame && frame.isResizable())
- dm.endResizingFrame(frame);
+ dm.endResizingFrame(frame);
else if (e.getSource() == titlePane)
- dm.endDraggingFrame(frame);
+ dm.endDraggingFrame(frame);
}
/**
@@ -348,21 +344,21 @@ public class BasicInternalFrameUI extends InternalFrameUI
Insets insets = frame.getInsets();
Rectangle b = frame.getBounds();
if (x < insets.left && y < insets.top)
- return NORTH_WEST;
+ return NORTH_WEST;
else if (x > b.width - insets.right && y < insets.top)
- return NORTH_EAST;
+ return NORTH_EAST;
else if (x > b.width - insets.right && y > b.height - insets.bottom)
- return SOUTH_EAST;
+ return SOUTH_EAST;
else if (x < insets.left && y > b.height - insets.bottom)
- return SOUTH_WEST;
+ return SOUTH_WEST;
else if (y < insets.top)
- return NORTH;
+ return NORTH;
else if (x < insets.left)
- return WEST;
+ return WEST;
else if (y > b.height - insets.bottom)
- return SOUTH;
+ return SOUTH;
else if (x > b.width - insets.right)
- return EAST;
+ return EAST;
return -1;
}
@@ -377,8 +373,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
{
/**
* This method is called when the JDesktopPane is hidden.
- *
- * @param e The ComponentEvent fired.
+ *
+ * @param e
+ * The ComponentEvent fired.
*/
public void componentHidden(ComponentEvent e)
{
@@ -387,8 +384,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the JDesktopPane is moved.
- *
- * @param e The ComponentEvent fired.
+ *
+ * @param e
+ * The ComponentEvent fired.
*/
public void componentMoved(ComponentEvent e)
{
@@ -397,22 +395,23 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the JDesktopPane is resized.
- *
- * @param e The ComponentEvent fired.
+ *
+ * @param e
+ * The ComponentEvent fired.
*/
public void componentResized(ComponentEvent e)
{
if (frame.isMaximum())
{
- JDesktopPane pane = (JDesktopPane) e.getSource();
- Insets insets = pane.getInsets();
- Rectangle bounds = pane.getBounds();
-
- frame.setBounds(bounds.x + insets.left, bounds.y + insets.top,
- bounds.width - insets.left - insets.right,
- bounds.height - insets.top - insets.bottom);
- frame.revalidate();
- frame.repaint();
+ JDesktopPane pane = (JDesktopPane) e.getSource();
+ Insets insets = pane.getInsets();
+ Rectangle bounds = pane.getBounds();
+
+ frame.setBounds(bounds.x + insets.left, bounds.y + insets.top,
+ bounds.width - insets.left - insets.right,
+ bounds.height - insets.top - insets.bottom);
+ frame.revalidate();
+ frame.repaint();
}
// Sun also resizes the icons. but it doesn't seem to do anything.
@@ -420,8 +419,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the JDesktopPane is shown.
- *
- * @param e The ComponentEvent fired.
+ *
+ * @param e
+ * The ComponentEvent fired.
*/
public void componentShown(ComponentEvent e)
{
@@ -435,21 +435,25 @@ public class BasicInternalFrameUI extends InternalFrameUI
public class InternalFrameLayout implements LayoutManager
{
/**
- * This method is called when the given Component is added to the
+ * This method is called when the given Component is added to the
* JInternalFrame.
- *
- * @param name The name of the Component.
- * @param c The Component added.
+ *
+ * @param name
+ * The name of the Component.
+ * @param c
+ * The Component added.
*/
public void addLayoutComponent(String name, Component c)
{
+ // Nothing to do here.
}
/**
* This method is used to set the bounds of the children of the
* JInternalFrame.
- *
- * @param c The Container to lay out.
+ *
+ * @param c
+ * The Container to lay out.
*/
public void layoutContainer(Container c)
{
@@ -468,38 +472,38 @@ public class BasicInternalFrameUI extends InternalFrameUI
if (northPane != null)
{
- Dimension nDims = northPane.getPreferredSize();
- nh = Math.min(nDims.height, dims.height);
+ Dimension nDims = northPane.getPreferredSize();
+ nh = Math.min(nDims.height, dims.height);
- northPane.setBounds(insets.left, insets.top, dims.width, nh);
+ northPane.setBounds(insets.left, insets.top, dims.width, nh);
}
if (southPane != null)
{
- Dimension sDims = southPane.getPreferredSize();
- sh = Math.min(sDims.height, dims.height - nh);
+ Dimension sDims = southPane.getPreferredSize();
+ sh = Math.min(sDims.height, dims.height - nh);
- southPane.setBounds(insets.left, insets.top + dims.height - sh,
- dims.width, sh);
+ southPane.setBounds(insets.left, insets.top + dims.height - sh,
+ dims.width, sh);
}
int remHeight = dims.height - sh - nh;
if (westPane != null)
{
- Dimension wDims = westPane.getPreferredSize();
- ww = Math.min(dims.width, wDims.width);
+ Dimension wDims = westPane.getPreferredSize();
+ ww = Math.min(dims.width, wDims.width);
- westPane.setBounds(insets.left, insets.top + nh, ww, remHeight);
+ westPane.setBounds(insets.left, insets.top + nh, ww, remHeight);
}
if (eastPane != null)
{
- Dimension eDims = eastPane.getPreferredSize();
- ew = Math.min(eDims.width, dims.width - ww);
+ Dimension eDims = eastPane.getPreferredSize();
+ ew = Math.min(eDims.width, dims.width - ww);
- eastPane.setBounds(insets.left + dims.width - ew, insets.top + nh,
- ew, remHeight);
+ eastPane.setBounds(insets.left + dims.width - ew, insets.top + nh,
+ ew, remHeight);
}
int remWidth = dims.width - ww - ew;
@@ -510,9 +514,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method returns the minimum layout size.
- *
- * @param c The Container to find a minimum layout size for.
- *
+ *
+ * @param c
+ * The Container to find a minimum layout size for.
* @return The minimum dimensions for the JInternalFrame.
*/
public Dimension minimumLayoutSize(Container c)
@@ -522,9 +526,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method returns the maximum layout size.
- *
- * @param c The Container to find a maximum layout size for.
- *
+ *
+ * @param c
+ * The Container to find a maximum layout size for.
* @return The maximum dimensions for the JInternalFrame.
*/
public Dimension maximumLayoutSize(Container c)
@@ -534,9 +538,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* Th8is method returns the preferred layout size.
- *
- * @param c The Container to find a preferred layout size for.
- *
+ *
+ * @param c
+ * The Container to find a preferred layout size for.
* @return The preferred dimensions for the JInternalFrame.
*/
public Dimension preferredLayoutSize(Container c)
@@ -546,10 +550,11 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* DOCUMENT ME!
- *
- * @param c DOCUMENT ME!
- * @param min DOCUMENT ME!
- *
+ *
+ * @param c
+ * DOCUMENT ME!
+ * @param min
+ * DOCUMENT ME!
* @return DOCUMENT ME!
*/
private Dimension getSize(Container c, boolean min)
@@ -558,7 +563,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
Dimension contentDims = frame.getContentPane().getPreferredSize();
if (min)
- contentDims.width = contentDims.height = 0;
+ contentDims.width = contentDims.height = 0;
int nWidth = 0;
int nHeight = 0;
int sWidth = 0;
@@ -571,42 +576,42 @@ public class BasicInternalFrameUI extends InternalFrameUI
if (northPane != null)
{
- dims = northPane.getPreferredSize();
- if (dims != null)
- {
- nWidth = dims.width;
- nHeight = dims.height;
- }
+ dims = northPane.getPreferredSize();
+ if (dims != null)
+ {
+ nWidth = dims.width;
+ nHeight = dims.height;
+ }
}
if (southPane != null)
{
- dims = southPane.getPreferredSize();
- if (dims != null)
- {
- sWidth = dims.width;
- sHeight = dims.height;
- }
+ dims = southPane.getPreferredSize();
+ if (dims != null)
+ {
+ sWidth = dims.width;
+ sHeight = dims.height;
+ }
}
if (eastPane != null)
{
- dims = eastPane.getPreferredSize();
- if (dims != null)
- {
- sWidth = dims.width;
- sHeight = dims.height;
- }
+ dims = eastPane.getPreferredSize();
+ if (dims != null)
+ {
+ sWidth = dims.width;
+ sHeight = dims.height;
+ }
}
if (westPane != null)
{
- dims = westPane.getPreferredSize();
- if (dims != null)
- {
- wWidth = dims.width;
- wHeight = dims.height;
- }
+ dims = westPane.getPreferredSize();
+ if (dims != null)
+ {
+ wWidth = dims.width;
+ wHeight = dims.height;
+ }
}
int width = Math.max(sWidth, nWidth);
@@ -630,6 +635,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
public void removeLayoutComponent(Component c)
{
+ // Nothing to do here.
}
}
@@ -657,8 +663,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse enters the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseEntered(MouseEvent e)
{
@@ -667,8 +674,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse is clicked on the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseClicked(MouseEvent e)
{
@@ -677,8 +685,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse is dragged in the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseDragged(MouseEvent e)
{
@@ -687,8 +696,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse exits the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseExited(MouseEvent e)
{
@@ -697,8 +707,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method is called when the mouse is moved in the glass pane.
- *
- * @param e The MouseEvent.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseMoved(MouseEvent e)
{
@@ -706,9 +717,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
/**
- * This method is called when the mouse is pressed in the glass pane.
- *
- * @param e The MouseEvent.
+ * This method is called when the mouse is pressed in the glass pane.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mousePressed(MouseEvent e)
{
@@ -717,9 +729,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
/**
- * This method is called when the mouse is released in the glass pane.
- *
- * @param e The MouseEvent.
+ * This method is called when the mouse is released in the glass pane.
+ *
+ * @param e
+ * The MouseEvent.
*/
public void mouseReleased(MouseEvent e)
{
@@ -727,10 +740,10 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
/**
- * This method acquires a candidate component to dispatch the MouseEvent
- * to.
- *
- * @param me The MouseEvent to acquire a component for.
+ * This method acquires a candidate component to dispatch the MouseEvent to.
+ *
+ * @param me
+ * The MouseEvent to acquire a component for.
*/
private void acquireComponentForMouseEvent(MouseEvent me)
{
@@ -738,134 +751,137 @@ public class BasicInternalFrameUI extends InternalFrameUI
int y = me.getY();
// Find the candidate which should receive this event.
- Component parent = frame.getContentPane();
+ Component parent = frame.getLayeredPane();
if (parent == null)
- return;
+ return;
Component candidate = null;
Point p = me.getPoint();
while (candidate == null && parent != null)
{
- candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y);
- if (candidate == null)
- {
- p = SwingUtilities.convertPoint(parent, p.x, p.y,
- parent.getParent());
- parent = parent.getParent();
- }
+ candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y);
+ if (candidate == null)
+ {
+ p = SwingUtilities.convertPoint(parent, p.x, p.y,
+ parent.getParent());
+ parent = parent.getParent();
+ }
}
// If the only candidate we found was the native container itself,
- // don't dispatch any event at all. We only care about the lightweight
+ // don't dispatch any event at all. We only care about the lightweight
// children here.
if (candidate == frame.getContentPane())
- candidate = null;
+ candidate = null;
// If our candidate is new, inform the old target we're leaving.
if (lastComponentEntered != null && lastComponentEntered.isShowing()
&& lastComponentEntered != candidate)
{
- Point tp = SwingUtilities.convertPoint(frame.getContentPane(), x, y,
- lastComponentEntered);
- MouseEvent exited = new MouseEvent(lastComponentEntered,
- MouseEvent.MOUSE_EXITED,
- me.getWhen(), me.getModifiersEx(),
- tp.x, tp.y, me.getClickCount(),
- me.isPopupTrigger(),
- me.getButton());
+ Point tp = SwingUtilities.convertPoint(frame.getContentPane(), x, y,
+ lastComponentEntered);
+ MouseEvent exited = new MouseEvent(lastComponentEntered,
+ MouseEvent.MOUSE_EXITED,
+ me.getWhen(), me.getModifiersEx(),
+ tp.x, tp.y, me.getClickCount(),
+ me.isPopupTrigger(),
+ me.getButton());
tempComponent = lastComponentEntered;
- lastComponentEntered = null;
- tempComponent.dispatchEvent(exited);
+ lastComponentEntered = null;
+ tempComponent.dispatchEvent(exited);
}
// If we have a candidate, maybe enter it.
if (candidate != null)
{
- mouseEventTarget = candidate;
- if (candidate.isLightweight() && candidate.isShowing()
- && candidate != frame.getContentPane()
- && candidate != lastComponentEntered)
- {
- lastComponentEntered = mouseEventTarget;
- Point cp = SwingUtilities.convertPoint(frame.getContentPane(),
- x, y, lastComponentEntered);
- MouseEvent entered = new MouseEvent(lastComponentEntered,
- MouseEvent.MOUSE_ENTERED,
- me.getWhen(),
- me.getModifiersEx(), cp.x,
- cp.y, me.getClickCount(),
- me.isPopupTrigger(),
- me.getButton());
- lastComponentEntered.dispatchEvent(entered);
- }
+ mouseEventTarget = candidate;
+ if (candidate.isLightweight() && candidate.isShowing()
+ && candidate != frame.getContentPane()
+ && candidate != lastComponentEntered)
+ {
+ lastComponentEntered = mouseEventTarget;
+ Point cp = SwingUtilities.convertPoint(frame.getContentPane(), x,
+ y, lastComponentEntered);
+ MouseEvent entered = new MouseEvent(lastComponentEntered,
+ MouseEvent.MOUSE_ENTERED,
+ me.getWhen(),
+ me.getModifiersEx(), cp.x,
+ cp.y, me.getClickCount(),
+ me.isPopupTrigger(),
+ me.getButton());
+ lastComponentEntered.dispatchEvent(entered);
+ }
}
if (me.getID() == MouseEvent.MOUSE_RELEASED
|| me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0
|| me.getID() == MouseEvent.MOUSE_DRAGGED)
- // If any of the following events occur while a button is held down,
- // they should be dispatched to the same component to which the
- // original MOUSE_PRESSED event was dispatched:
- // - MOUSE_RELEASED
- // - MOUSE_PRESSED: another button pressed while the first is held down
- // - MOUSE_DRAGGED
- mouseEventTarget = pressedComponent;
+ // If any of the following events occur while a button is held down,
+ // they should be dispatched to the same component to which the
+ // original MOUSE_PRESSED event was dispatched:
+ // - MOUSE_RELEASED
+ // - MOUSE_PRESSED: another button pressed while the first is held down
+ // - MOUSE_DRAGGED
+ mouseEventTarget = pressedComponent;
else if (me.getID() == MouseEvent.MOUSE_CLICKED)
{
- // Don't dispatch CLICKED events whose target is not the same as the
- // target for the original PRESSED event.
- if (candidate != pressedComponent)
- mouseEventTarget = null;
- else if (pressCount == 0)
- pressedComponent = null;
+ // Don't dispatch CLICKED events whose target is not the same as the
+ // target for the original PRESSED event.
+ if (candidate != pressedComponent)
+ mouseEventTarget = null;
+ else if (pressCount == 0)
+ pressedComponent = null;
}
}
/**
- * This is a helper method that dispatches the GlassPane MouseEvents to
- * the proper component.
- *
- * @param e The AWTEvent to be dispatched. Usually an instance of
- * MouseEvent.
+ * This is a helper method that dispatches the GlassPane MouseEvents to the
+ * proper component.
+ *
+ * @param e
+ * The AWTEvent to be dispatched. Usually an instance of
+ * MouseEvent.
*/
private void handleEvent(AWTEvent e)
{
if (e instanceof MouseEvent)
{
- MouseEvent me = SwingUtilities.convertMouseEvent(frame.getRootPane()
- .getGlassPane(),
- (MouseEvent) e,
- frame.getRootPane()
- .getGlassPane());
-
- acquireComponentForMouseEvent(me);
-
- // Avoid dispatching ENTERED and EXITED events twice.
- if (mouseEventTarget != null && mouseEventTarget.isShowing()
- && e.getID() != MouseEvent.MOUSE_ENTERED
- && e.getID() != MouseEvent.MOUSE_EXITED)
- {
- MouseEvent newEvt = SwingUtilities.convertMouseEvent(frame
- .getContentPane(),
- me,
- mouseEventTarget);
- mouseEventTarget.dispatchEvent(newEvt);
-
- switch (e.getID())
- {
- case MouseEvent.MOUSE_PRESSED:
- if (pressCount++ == 0)
- pressedComponent = mouseEventTarget;
- break;
- case MouseEvent.MOUSE_RELEASED:
- // Clear our memory of the original PRESSED event, only if
- // we're not expecting a CLICKED event after this. If
- // there is a CLICKED event after this, it will do clean up.
- if (--pressCount == 0
- && mouseEventTarget != pressedComponent)
- pressedComponent = null;
- break;
- }
- }
+ MouseEvent me = (MouseEvent) e;
+ acquireComponentForMouseEvent(me);
+
+ //If there is no target, return
+ if (mouseEventTarget == null)
+ return;
+
+ //Avoid re-dispatching to ourselves and causing an infinite loop
+ if (mouseEventTarget.equals(frame.getGlassPane()))
+ return;
+
+ // Avoid dispatching ENTERED and EXITED events twice.
+ if (mouseEventTarget.isShowing()
+ && e.getID() != MouseEvent.MOUSE_ENTERED
+ && e.getID() != MouseEvent.MOUSE_EXITED)
+ {
+ MouseEvent newEvt = SwingUtilities.convertMouseEvent(
+ frame.getGlassPane(),
+ me,
+ mouseEventTarget);
+ mouseEventTarget.dispatchEvent(newEvt);
+
+ switch (e.getID())
+ {
+ case MouseEvent.MOUSE_PRESSED:
+ if (pressCount++ == 0)
+ pressedComponent = mouseEventTarget;
+ break;
+ case MouseEvent.MOUSE_RELEASED:
+ // Clear our memory of the original PRESSED event, only if
+ // we're not expecting a CLICKED event after this. If
+ // there is a CLICKED event after this, it will do clean up.
+ if (--pressCount == 0 && mouseEventTarget != pressedComponent)
+ pressedComponent = null;
+ break;
+ }
+ }
}
}
}
@@ -874,17 +890,18 @@ public class BasicInternalFrameUI extends InternalFrameUI
* This helper class listens for PropertyChangeEvents from the
* JInternalFrame.
*/
- public class InternalFramePropertyChangeListener
- implements PropertyChangeListener, VetoableChangeListener
+ public class InternalFramePropertyChangeListener implements
+ PropertyChangeListener, VetoableChangeListener
{
/**
- * This method is called when one of the JInternalFrame's properties
- * change. This method is to allow JInternalFrame to veto an attempt
- * to close the internal frame. This allows JInternalFrame to honour
- * its defaultCloseOperation if that is DO_NOTHING_ON_CLOSE.
+ * This method is called when one of the JInternalFrame's properties change.
+ * This method is to allow JInternalFrame to veto an attempt to close the
+ * internal frame. This allows JInternalFrame to honour its
+ * defaultCloseOperation if that is DO_NOTHING_ON_CLOSE.
*/
- public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException
+ public void vetoableChange(PropertyChangeEvent e)
+ throws PropertyVetoException
{
if (e.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY))
{
@@ -892,75 +909,78 @@ public class BasicInternalFrameUI extends InternalFrameUI
{
frame.setVisible(false);
frame.getDesktopPane().repaint();
- throw new PropertyVetoException ("close operation is HIDE_ON_CLOSE\n", e);
+ throw new PropertyVetoException(
+ "close operation is HIDE_ON_CLOSE\n",
+ e);
}
else if (frame.getDefaultCloseOperation() == JInternalFrame.DISPOSE_ON_CLOSE)
closeFrame(frame);
else
- throw new PropertyVetoException ("close operation is DO_NOTHING_ON_CLOSE\n", e);
+ throw new PropertyVetoException(
+ "close operation is DO_NOTHING_ON_CLOSE\n",
+ e);
}
}
-
+
/**
- * This method is called when one of the JInternalFrame's properties
- * change.
- *
- * @param evt The PropertyChangeEvent.
+ * This method is called when one of the JInternalFrame's properties change.
+ *
+ * @param evt
+ * The PropertyChangeEvent.
*/
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getPropertyName().equals(JInternalFrame.IS_MAXIMUM_PROPERTY))
{
- if (frame.isMaximum())
- maximizeFrame(frame);
- else
- minimizeFrame(frame);
+ if (frame.isMaximum())
+ maximizeFrame(frame);
+ else
+ minimizeFrame(frame);
}
else if (evt.getPropertyName().equals(JInternalFrame.IS_ICON_PROPERTY))
{
- if (frame.isIcon())
- iconifyFrame(frame);
- else
- deiconifyFrame(frame);
+ if (frame.isIcon())
+ iconifyFrame(frame);
+ else
+ deiconifyFrame(frame);
}
else if (evt.getPropertyName().equals(JInternalFrame.IS_SELECTED_PROPERTY))
{
- if (frame.isSelected())
- activateFrame(frame);
- else
- getDesktopManager().deactivateFrame(frame);
+ if (frame.isSelected())
+ activateFrame(frame);
+ else
+ deactivateFrame(frame);
}
else if (evt.getPropertyName().equals(JInternalFrame.ROOT_PANE_PROPERTY)
- || evt.getPropertyName().equals(JInternalFrame.GLASS_PANE_PROPERTY))
+ || evt.getPropertyName().equals(
+ JInternalFrame.GLASS_PANE_PROPERTY))
{
- Component old = (Component) evt.getOldValue();
- old.removeMouseListener(glassPaneDispatcher);
- old.removeMouseMotionListener(glassPaneDispatcher);
+ Component old = (Component) evt.getOldValue();
+ old.removeMouseListener(glassPaneDispatcher);
+ old.removeMouseMotionListener(glassPaneDispatcher);
- Component newPane = (Component) evt.getNewValue();
- newPane.addMouseListener(glassPaneDispatcher);
- newPane.addMouseMotionListener(glassPaneDispatcher);
+ Component newPane = (Component) evt.getNewValue();
+ newPane.addMouseListener(glassPaneDispatcher);
+ newPane.addMouseMotionListener(glassPaneDispatcher);
- frame.revalidate();
+ frame.revalidate();
}
- /* FIXME: need to add ancestor properties to JComponents.
- else if (evt.getPropertyName().equals(JComponent.ANCESTOR_PROPERTY))
- {
- if (desktopPane != null)
- desktopPane.removeComponentListener(componentListener);
- desktopPane = frame.getDesktopPane();
- if (desktopPane != null)
- desktopPane.addComponentListener(componentListener);
- }
- */
+ /*
+ * FIXME: need to add ancestor properties to JComponents. else if
+ * (evt.getPropertyName().equals(JComponent.ANCESTOR_PROPERTY)) { if
+ * (desktopPane != null)
+ * desktopPane.removeComponentListener(componentListener); desktopPane =
+ * frame.getDesktopPane(); if (desktopPane != null)
+ * desktopPane.addComponentListener(componentListener); }
+ */
}
}
/**
* This helper class is the border for the JInternalFrame.
*/
- private class InternalFrameBorder extends AbstractBorder
- implements UIResource
+ private class InternalFrameBorder extends AbstractBorder implements
+ UIResource
{
/** The width of the border. */
private static final int bSize = 5;
@@ -970,7 +990,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method returns whether the border is opaque.
- *
+ *
* @return Whether the border is opaque.
*/
public boolean isBorderOpaque()
@@ -980,9 +1000,9 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method returns the insets of the border.
- *
- * @param c The Component to find border insets for.
- *
+ *
+ * @param c
+ * The Component to find border insets for.
* @return The border insets.
*/
public Insets getBorderInsets(Component c)
@@ -992,13 +1012,19 @@ public class BasicInternalFrameUI extends InternalFrameUI
/**
* This method paints the border.
- *
- * @param c The Component that owns the border.
- * @param g The Graphics object to paint with.
- * @param x The x coordinate to paint at.
- * @param y The y coordinate to paint at.
- * @param width The width of the Component.
- * @param height The height of the Component.
+ *
+ * @param c
+ * The Component that owns the border.
+ * @param g
+ * The Graphics object to paint with.
+ * @param x
+ * The x coordinate to paint at.
+ * @param y
+ * The y coordinate to paint at.
+ * @param width
+ * The width of the Component.
+ * @param height
+ * The height of the Component.
*/
public void paintBorder(Component c, Graphics g, int x, int y, int width,
int height)
@@ -1111,6 +1137,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
public BasicInternalFrameUI(JInternalFrame b)
{
+ // Nothing to do here.
}
/**
@@ -1135,21 +1162,21 @@ public class BasicInternalFrameUI extends InternalFrameUI
{
if (c instanceof JInternalFrame)
{
- frame = (JInternalFrame) c;
+ frame = (JInternalFrame) c;
- internalFrameLayout = createLayoutManager();
- frame.setLayout(internalFrameLayout);
+ internalFrameLayout = createLayoutManager();
+ frame.setLayout(internalFrameLayout);
- ((JComponent) frame.getRootPane().getGlassPane()).setOpaque(false);
- frame.getRootPane().getGlassPane().setVisible(true);
+ ((JComponent) frame.getRootPane().getGlassPane()).setOpaque(false);
+ frame.getRootPane().getGlassPane().setVisible(true);
- installDefaults();
- installListeners();
- installComponents();
- installKeyboardActions();
+ installDefaults();
+ installListeners();
+ installComponents();
+ installKeyboardActions();
- frame.setOpaque(true);
- frame.invalidate();
+ frame.setOpaque(true);
+ frame.invalidate();
}
}
@@ -1177,10 +1204,8 @@ public class BasicInternalFrameUI extends InternalFrameUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- Border border = defaults.getBorder("InternalFrame.border");
- frame.setBorder(border);
- frame.setFrameIcon(defaults.getIcon("InternalFrame.icon"));
+ LookAndFeel.installBorder(frame, "InternalFrame.border");
+ frame.setFrameIcon(UIManager.getIcon("InternalFrame.icon"));
// InternalFrames are invisible by default.
frame.setVisible(false);
}
@@ -1343,14 +1368,14 @@ public class BasicInternalFrameUI extends InternalFrameUI
{
if (currentPane != null)
{
- deinstallMouseHandlers(currentPane);
- frame.remove(currentPane);
+ deinstallMouseHandlers(currentPane);
+ frame.remove(currentPane);
}
if (newPane != null)
{
- installMouseHandlers(newPane);
- frame.add(newPane);
+ installMouseHandlers(newPane);
+ frame.add(newPane);
}
}
@@ -1678,6 +1703,16 @@ public class BasicInternalFrameUI extends InternalFrameUI
}
/**
+ * This is a convenience method that deactivates the JInternalFrame.
+ *
+ * @param f the JInternalFrame to deactivate
+ */
+ protected void deactivateFrame(JInternalFrame f)
+ {
+ getDesktopManager().deactivateFrame(f);
+ }
+
+ /**
* This method returns a new ComponentListener for the JDesktopPane.
*
* @return A new ComponentListener.
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
index bb9ce6cb1d9..c8f677fa0a0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicLabelUI.java
@@ -50,9 +50,8 @@ import java.beans.PropertyChangeListener;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JLabel;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.LabelUI;
@@ -60,9 +59,7 @@ import javax.swing.plaf.LabelUI;
* This is the Basic Look and Feel class for the JLabel. One BasicLabelUI
* object is used to paint all JLabels that utilize the Basic Look and Feel.
*/
-public class BasicLabelUI
- extends LabelUI
- implements PropertyChangeListener
+public class BasicLabelUI extends LabelUI implements PropertyChangeListener
{
/** The labelUI that is shared by all labels. */
protected static BasicLabelUI labelUI;
@@ -345,11 +342,8 @@ public class BasicLabelUI
*/
protected void installDefaults(JLabel c)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- c.setForeground(defaults.getColor("Label.foreground"));
- c.setBackground(defaults.getColor("Label.background"));
- c.setFont(defaults.getFont("Label.font"));
+ LookAndFeel.installColorsAndFont(c, "Label.background", "Label.foreground",
+ "Label.font");
//XXX: There are properties we don't use called disabledForeground
//and disabledShadow.
}
@@ -417,8 +411,6 @@ public class BasicLabelUI
*/
public void propertyChange(PropertyChangeEvent e)
{
- JLabel c = (JLabel) e.getSource();
- c.revalidate();
- c.repaint();
+ // What to do here?
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java
index 841bd670f67..2d66645fb7d 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicListUI.java
@@ -38,31 +38,35 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
import javax.swing.CellRendererPane;
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JViewport;
+import javax.swing.KeyStroke;
import javax.swing.ListCellRenderer;
import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
+import javax.swing.LookAndFeel;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ListDataEvent;
@@ -70,7 +74,9 @@ import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.ListUI;
/**
@@ -125,8 +131,9 @@ public class BasicListUI extends ListUI
* Helper method to repaint the focused cell's
* lost or acquired focus state.
*/
- void repaintCellFocus()
+ protected void repaintCellFocus()
{
+ // TODO: Implement this properly.
}
}
@@ -183,141 +190,231 @@ public class BasicListUI extends ListUI
*/
public void valueChanged(ListSelectionEvent e)
{
+ int index1 = e.getFirstIndex();
+ int index2 = e.getLastIndex();
+ Rectangle damaged = getCellBounds(list, index1, index2);
+ list.repaint(damaged);
}
}
/**
- * A helper class which listens for {@link KeyEvents}s
- * from the {@link JList}.
+ * This class is used to mimmic the behaviour of the JDK when registering
+ * keyboard actions. It is the same as the private class used in JComponent
+ * for the same reason. This class receives an action event and dispatches
+ * it to the true receiver after altering the actionCommand property of the
+ * event.
*/
- private class KeyHandler extends KeyAdapter
+ private static class ActionListenerProxy
+ extends AbstractAction
{
- public KeyHandler()
+ ActionListener target;
+ String bindingCommandName;
+
+ public ActionListenerProxy(ActionListener li,
+ String cmd)
{
+ target = li;
+ bindingCommandName = cmd;
}
-
- public void keyPressed( KeyEvent evt )
+
+ public void actionPerformed(ActionEvent e)
+ {
+ ActionEvent derivedEvent = new ActionEvent(e.getSource(),
+ e.getID(),
+ bindingCommandName,
+ e.getModifiers());
+ target.actionPerformed(derivedEvent);
+ }
+ }
+
+ class ListAction extends AbstractAction
+ {
+ public void actionPerformed (ActionEvent e)
{
- int lead = BasicListUI.this.list.getLeadSelectionIndex();
- int max = BasicListUI.this.list.getModel().getSize() - 1;
+ int lead = list.getLeadSelectionIndex();
+ int max = list.getModel().getSize() - 1;
+ DefaultListSelectionModel selModel = (DefaultListSelectionModel)list.getSelectionModel();
+ String command = e.getActionCommand();
// Do nothing if list is empty
if (max == -1)
return;
-
- // Process the key event. Bindings can be found in
- // javax.swing.plaf.basic.BasicLookAndFeel.java
- if ((evt.getKeyCode() == KeyEvent.VK_DOWN)
- || (evt.getKeyCode() == KeyEvent.VK_KP_DOWN))
+
+ if (command.equals("selectNextRow"))
{
- if (evt.getModifiers() == 0)
- {
- BasicListUI.this.list.clearSelection();
- BasicListUI.this.list.setSelectedIndex(Math.min(lead+1,max));
- }
- else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
+ selectNextIndex();
+ }
+ else if (command.equals("selectPreviousRow"))
+ {
+ selectPreviousIndex();
+ }
+ else if (command.equals("clearSelection"))
+ {
+ list.clearSelection();
+ }
+ else if (command.equals("selectAll"))
+ {
+ list.setSelectionInterval(0, max);
+ // this next line is to restore the lead selection index to the old
+ // position, because select-all should not change the lead index
+ list.addSelectionInterval(lead, lead);
+ }
+ else if (command.equals("selectLastRow"))
+ {
+ list.setSelectedIndex(list.getModel().getSize() - 1);
+ }
+ else if (command.equals("selectLastRowChangeLead"))
+ {
+ selModel.moveLeadSelectionIndex(list.getModel().getSize() - 1);
+ }
+ else if (command.equals("scrollDownExtendSelection"))
+ {
+ int target;
+ if (lead == list.getLastVisibleIndex())
{
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(Math.min(lead+1,max));
+ target = Math.min
+ (max, lead + (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
+ else
+ target = list.getLastVisibleIndex();
+ selModel.setLeadSelectionIndex(target);
}
- else if ((evt.getKeyCode() == KeyEvent.VK_UP)
- || (evt.getKeyCode() == KeyEvent.VK_KP_UP))
+ else if (command.equals("scrollDownChangeLead"))
{
- if (evt.getModifiers() == 0)
+ int target;
+ if (lead == list.getLastVisibleIndex())
{
- BasicListUI.this.list.clearSelection();
- BasicListUI.this.list.setSelectedIndex(Math.max(lead-1,0));
+ target = Math.min
+ (max, lead + (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
- else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
+ else
+ target = list.getLastVisibleIndex();
+ selModel.moveLeadSelectionIndex(target);
+ }
+ else if (command.equals("scrollUpExtendSelection"))
+ {
+ int target;
+ if (lead == list.getFirstVisibleIndex())
{
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(Math.max(lead-1,0));
+ target = Math.max
+ (0, lead - (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
+ else
+ target = list.getFirstVisibleIndex();
+ selModel.setLeadSelectionIndex(target);
}
- else if (evt.getKeyCode() == KeyEvent.VK_PAGE_UP)
+ else if (command.equals("scrollUpChangeLead"))
{
int target;
- if (lead == BasicListUI.this.list.getFirstVisibleIndex())
+ if (lead == list.getFirstVisibleIndex())
{
target = Math.max
- (0, lead - (BasicListUI.this.list.getLastVisibleIndex() -
- BasicListUI.this.list.getFirstVisibleIndex() + 1));
+ (0, lead - (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
else
+ target = list.getFirstVisibleIndex();
+ selModel.moveLeadSelectionIndex(target);
+ }
+ else if (command.equals("selectNextRowExtendSelection"))
+ {
+ selModel.setLeadSelectionIndex(Math.min(lead + 1,max));
+ }
+ else if (command.equals("selectFirstRow"))
+ {
+ list.setSelectedIndex(0);
+ }
+ else if (command.equals("selectFirstRowChangeLead"))
+ {
+ selModel.moveLeadSelectionIndex(0);
+ }
+ else if (command.equals("selectFirstRowExtendSelection"))
+ {
+ selModel.setLeadSelectionIndex(0);
+ }
+ else if (command.equals("selectPreviousRowExtendSelection"))
+ {
+ selModel.setLeadSelectionIndex(Math.max(0,lead - 1));
+ }
+ else if (command.equals("scrollUp"))
+ {
+ int target;
+ if (lead == list.getFirstVisibleIndex())
{
- target = BasicListUI.this.list.getFirstVisibleIndex();
+ target = Math.max
+ (0, lead - (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
- if (evt.getModifiers() == 0)
- BasicListUI.this.list.setSelectedIndex(target);
- else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(target);
+ else
+ target = list.getFirstVisibleIndex();
+ list.setSelectedIndex(target);
}
- else if (evt.getKeyCode() == KeyEvent.VK_PAGE_DOWN)
+ else if (command.equals("selectLastRowExtendSelection"))
+ {
+ selModel.setLeadSelectionIndex(list.getModel().getSize() - 1);
+ }
+ else if (command.equals("scrollDown"))
{
int target;
- if (lead == BasicListUI.this.list.getLastVisibleIndex())
+ if (lead == list.getLastVisibleIndex())
{
target = Math.min
- (max, lead + (BasicListUI.this.list.getLastVisibleIndex() -
- BasicListUI.this.list.getFirstVisibleIndex() + 1));
+ (max, lead + (list.getLastVisibleIndex() -
+ list.getFirstVisibleIndex() + 1));
}
else
+ target = list.getLastVisibleIndex();
+ list.setSelectedIndex(target);
+ }
+ else if (command.equals("selectNextRowChangeLead"))
+ {
+ if (selModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ selectNextIndex();
+ else
+ {
+ selModel.moveLeadSelectionIndex(Math.min(max, lead + 1));
+ }
+ }
+ else if (command.equals("selectPreviousRowChangeLead"))
+ {
+ if (selModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ selectPreviousIndex();
+ else
{
- target = BasicListUI.this.list.getLastVisibleIndex();
+ selModel.moveLeadSelectionIndex(Math.max(0, lead - 1));
}
- if (evt.getModifiers() == 0)
- BasicListUI.this.list.setSelectedIndex(target);
- else if (evt.getModifiers() == InputEvent.SHIFT_MASK)
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(target);
- }
- else if (evt.getKeyCode() == KeyEvent.VK_BACK_SLASH
- && (evt.getModifiers() == InputEvent.CTRL_MASK))
+ }
+ else if (command.equals("addToSelection"))
{
- BasicListUI.this.list.clearSelection();
+ list.addSelectionInterval(lead, lead);
}
- else if ((evt.getKeyCode() == KeyEvent.VK_HOME)
- || evt.getKeyCode() == KeyEvent.VK_END)
+ else if (command.equals("extendTo"))
{
- if (evt.getModifiers() != 0 &&
- evt.getModifiers() != InputEvent.SHIFT_MASK)
- return;
- // index is either 0 for HOME, or last cell for END
- int index = (evt.getKeyCode() == KeyEvent.VK_HOME) ? 0 : max;
-
- if (!evt.isShiftDown() ||(BasicListUI.this.list.getSelectionMode()
- == ListSelectionModel.SINGLE_SELECTION))
- BasicListUI.this.list.setSelectedIndex(index);
- else if (BasicListUI.this.list.getSelectionMode() ==
- ListSelectionModel.SINGLE_INTERVAL_SELECTION)
- BasicListUI.this.list.setSelectionInterval
- (BasicListUI.this.list.getAnchorSelectionIndex(), index);
- else
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(index);
+ selModel.setSelectionInterval(selModel.getAnchorSelectionIndex(),
+ lead);
}
- else if ((evt.getKeyCode() == KeyEvent.VK_A || evt.getKeyCode()
- == KeyEvent.VK_SLASH) && (evt.getModifiers() ==
- InputEvent.CTRL_MASK))
+ else if (command.equals("toggleAndAnchor"))
{
- BasicListUI.this.list.setSelectionInterval(0, max);
- // this next line is to restore the lead selection index to the old
- // position, because select-all should not change the lead index
- BasicListUI.this.list.addSelectionInterval(lead, lead);
+ if (!list.isSelectedIndex(lead))
+ list.addSelectionInterval(lead, lead);
+ else
+ list.removeSelectionInterval(lead, lead);
+ selModel.setAnchorSelectionIndex(lead);
}
- else if (evt.getKeyCode() == KeyEvent.VK_SPACE &&
- (evt.getModifiers() == InputEvent.CTRL_MASK))
+ else
{
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(Math.min(lead+1,max));
+ // DEBUG: uncomment the following line to print out
+ // key bindings that aren't implemented yet
+
+ // System.out.println ("not implemented: "+e.getActionCommand());
}
-
- BasicListUI.this.list.ensureIndexIsVisible
- (BasicListUI.this.list.getLeadSelectionIndex());
+
+ list.ensureIndexIsVisible(list.getLeadSelectionIndex());
}
}
-
+
/**
* A helper class which listens for {@link MouseEvent}s
* from the {@link JList}.
@@ -333,48 +430,46 @@ public class BasicListUI extends ListUI
public void mouseClicked(MouseEvent event)
{
Point click = event.getPoint();
- int index = BasicListUI.this.locationToIndex(list, click);
+ int index = locationToIndex(list, click);
if (index == -1)
return;
if (event.isShiftDown())
{
- if (BasicListUI.this.list.getSelectionMode() ==
- ListSelectionModel.SINGLE_SELECTION)
- BasicListUI.this.list.setSelectedIndex(index);
- else if (BasicListUI.this.list.getSelectionMode() ==
+ if (list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION)
+ list.setSelectedIndex(index);
+ else if (list.getSelectionMode() ==
ListSelectionModel.SINGLE_INTERVAL_SELECTION)
// COMPAT: the IBM VM is compatible with the following line of code.
// However, compliance with Sun's VM would correspond to replacing
// getAnchorSelectionIndex() with getLeadSelectionIndex().This is
// both unnatural and contradictory to the way they handle other
// similar UI interactions.
- BasicListUI.this.list.setSelectionInterval
- (BasicListUI.this.list.getAnchorSelectionIndex(), index);
+ list.setSelectionInterval(list.getAnchorSelectionIndex(), index);
else
// COMPAT: both Sun and IBM are compatible instead with:
- // BasicListUI.this.list.setSelectionInterval
- // (BasicListUI.this.list.getLeadSelectionIndex(),index);
+ // list.setSelectionInterval
+ // (list.getLeadSelectionIndex(),index);
// Note that for IBM this is contradictory to what they did in
// the above situation for SINGLE_INTERVAL_SELECTION.
// The most natural thing to do is the following:
- BasicListUI.this.list.getSelectionModel().
- setLeadSelectionIndex(index);
+ if (list.isSelectedIndex(list.getAnchorSelectionIndex()))
+ list.getSelectionModel().setLeadSelectionIndex(index);
+ else
+ list.addSelectionInterval(list.getAnchorSelectionIndex(), index);
}
else if (event.isControlDown())
{
- if (BasicListUI.this.list.getSelectionMode() ==
- ListSelectionModel.SINGLE_SELECTION)
- BasicListUI.this.list.setSelectedIndex(index);
- else if (BasicListUI.this.list.isSelectedIndex(index))
- BasicListUI.this.list.removeSelectionInterval(index,index);
+ if (list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION)
+ list.setSelectedIndex(index);
+ else if (list.isSelectedIndex(index))
+ list.removeSelectionInterval(index,index);
else
- BasicListUI.this.list.addSelectionInterval(index,index);
+ list.addSelectionInterval(index,index);
}
else
- BasicListUI.this.list.setSelectedIndex(index);
+ list.setSelectedIndex(index);
- BasicListUI.this.list.ensureIndexIsVisible
- (BasicListUI.this.list.getLeadSelectionIndex());
+ list.ensureIndexIsVisible(list.getLeadSelectionIndex());
}
/**
@@ -385,6 +480,7 @@ public class BasicListUI extends ListUI
*/
public void mousePressed(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -395,6 +491,7 @@ public class BasicListUI extends ListUI
*/
public void mouseReleased(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -405,6 +502,7 @@ public class BasicListUI extends ListUI
*/
public void mouseEntered(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -415,6 +513,7 @@ public class BasicListUI extends ListUI
*/
public void mouseExited(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -425,6 +524,7 @@ public class BasicListUI extends ListUI
*/
public void mouseDragged(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -435,6 +535,7 @@ public class BasicListUI extends ListUI
*/
public void mouseMoved(MouseEvent event)
{
+ // TODO: What should be done here, if anything?
}
}
@@ -459,11 +560,61 @@ public class BasicListUI extends ListUI
if (e.getNewValue() != null && e.getNewValue() instanceof ListModel)
((ListModel) e.getNewValue()).addListDataListener(BasicListUI.this.listDataListener);
}
+ // Update the updateLayoutStateNeeded flag.
+ if (e.getPropertyName().equals("model"))
+ updateLayoutStateNeeded += modelChanged;
+ else if (e.getPropertyName().equals("selectionModel"))
+ updateLayoutStateNeeded += selectionModelChanged;
+ else if (e.getPropertyName().equals("font"))
+ updateLayoutStateNeeded += fontChanged;
+ else if (e.getPropertyName().equals("fixedCellWidth"))
+ updateLayoutStateNeeded += fixedCellWidthChanged;
+ else if (e.getPropertyName().equals("fixedCellHeight"))
+ updateLayoutStateNeeded += fixedCellHeightChanged;
+ else if (e.getPropertyName().equals("prototypeCellValue"))
+ updateLayoutStateNeeded += prototypeCellValueChanged;
+ else if (e.getPropertyName().equals("cellRenderer"))
+ updateLayoutStateNeeded += cellRendererChanged;
BasicListUI.this.damageLayout();
}
}
/**
+ * A constant to indicate that the model has changed.
+ */
+ protected static final int modelChanged = 1;
+
+ /**
+ * A constant to indicate that the selection model has changed.
+ */
+ protected static final int selectionModelChanged = 2;
+
+ /**
+ * A constant to indicate that the font has changed.
+ */
+ protected static final int fontChanged = 4;
+
+ /**
+ * A constant to indicate that the fixedCellWidth has changed.
+ */
+ protected static final int fixedCellWidthChanged = 8;
+
+ /**
+ * A constant to indicate that the fixedCellHeight has changed.
+ */
+ protected static final int fixedCellHeightChanged = 16;
+
+ /**
+ * A constant to indicate that the prototypeCellValue has changed.
+ */
+ protected static final int prototypeCellValueChanged = 32;
+
+ /**
+ * A constant to indicate that the cellRenderer has changed.
+ */
+ protected static final int cellRendererChanged = 64;
+
+ /**
* Creates a new BasicListUI for the component.
*
* @param c The component to create a UI for
@@ -487,9 +638,6 @@ public class BasicListUI extends ListUI
/** The mouse listener listening to the list. */
protected MouseInputListener mouseInputListener;
- /** The key listener listening to the list */
- private KeyHandler keyListener;
-
/** The property change listener listening to the list. */
protected PropertyChangeListener propertyChangeListener;
@@ -501,7 +649,11 @@ public class BasicListUI extends ListUI
/** Saved reference to the list this UI was created for. */
protected JList list;
- /** The height of a single cell in the list. */
+ /**
+ * The height of a single cell in the list. This field is used when the
+ * fixedCellHeight property of the list is set. Otherwise this field is
+ * set to <code>-1</code> and {@link #cellHeights} is used instead.
+ */
protected int cellHeight;
/** The width of a single cell in the list. */
@@ -509,14 +661,25 @@ public class BasicListUI extends ListUI
/**
* An array of varying heights of cells in the list, in cases where each
- * cell might have a different height.
+ * cell might have a different height. This field is used when the
+ * <code>fixedCellHeight</code> property of the list is not set. Otherwise
+ * this field is <code>null</code> and {@link #cellHeight} is used.
*/
protected int[] cellHeights;
/**
- * A simple counter. When nonzero, indicates that the UI class is out of
+ * A bitmask that indicates which properties of the JList have changed.
+ * When nonzero, indicates that the UI class is out of
* date with respect to the underlying list, and must recalculate the
* list layout before painting or performing size calculations.
+ *
+ * @see #modelChanged
+ * @see #selectionModelChanged
+ * @see #fontChanged
+ * @see #fixedCellWidthChanged
+ * @see #fixedCellHeightChanged
+ * @see #prototypeCellValueChanged
+ * @see #cellRendererChanged
*/
protected int updateLayoutStateNeeded;
@@ -524,6 +687,9 @@ public class BasicListUI extends ListUI
* The {@link CellRendererPane} that is used for painting.
*/
protected CellRendererPane rendererPane;
+
+ /** The action bound to KeyStrokes. */
+ ListAction action;
/**
* Calculate the height of a particular row. If there is a fixed {@link
@@ -537,12 +703,17 @@ public class BasicListUI extends ListUI
*/
protected int getRowHeight(int row)
{
- if (row < 0 || row >= cellHeights.length)
- return -1;
- else if (cellHeight != -1)
- return cellHeight;
+ int height;
+ if (cellHeights == null)
+ height = cellHeight;
else
- return cellHeights[row];
+ {
+ if (row < 0 || row >= cellHeights.length)
+ height = -1;
+ else
+ height = cellHeights[row];
+ }
+ return height;
}
/**
@@ -611,19 +782,49 @@ public class BasicListUI extends ListUI
* @param y0 The Y coordinate to calculate the row number for
*
* @return The row number containing the specified Y value, or <code>-1</code>
- * if the specified Y coordinate is invalid
+ * if the list model is empty
+ *
+ * @specnote This method is specified to return -1 for an invalid Y
+ * coordinate. However, some simple tests show that the behaviour
+ * is to return the index of the last list element for an Y
+ * coordinate that lies outside of the list bounds (even for
+ * negative indices). <code>-1</code>
+ * is only returned if the list model is empty.
*/
protected int convertYToRow(int y0)
{
- for (int row = 0; row < cellHeights.length; ++row)
- {
- int h = getRowHeight(row);
+ if (list.getModel().getSize() == 0)
+ return -1;
+
+ // When y0 < 0, then the JDK returns the maximum row index of the list. So
+ // do we.
+ if (y0 < 0)
+ return list.getModel().getSize() - 1;
+
+ // Update the layout if necessary.
+ maybeUpdateLayoutState();
+
+ int index = list.getModel().getSize() - 1;;
- if (y0 < h)
- return row;
- y0 -= h;
+ // If a fixed cell height is set, then we can work more efficient.
+ if (cellHeight > 0)
+ index = Math.min(y0 / cellHeight, index);
+ // If we have no fixed cell height, we must add up each cell height up
+ // to y0.
+ else
+ {
+ int h = 0;
+ for (int row = 0; row < cellHeights.length; ++row)
+ {
+ h += cellHeights[row];
+ if (y0 < h)
+ {
+ index = row;
+ break;
+ }
+ }
}
- return -1;
+ return index;
}
/**
@@ -638,29 +839,47 @@ public class BasicListUI extends ListUI
cellWidth = -1;
if (cellHeights == null || cellHeights.length != nrows)
cellHeights = new int[nrows];
- if (list.getFixedCellHeight() == -1 || list.getFixedCellWidth() == -1)
+ ListCellRenderer rend = list.getCellRenderer();
+ // Update the cellHeight(s) fields.
+ int fixedCellHeight = list.getFixedCellHeight();
+ if (fixedCellHeight > 0)
{
- ListCellRenderer rend = list.getCellRenderer();
+ cellHeight = fixedCellHeight;
+ cellHeights = null;
+ }
+ else
+ {
+ cellHeight = -1;
for (int i = 0; i < nrows; ++i)
{
- Component flyweight = rend.getListCellRendererComponent(list,
- list.getModel()
- .getElementAt(i),
- 0, false,
- false);
+ Component flyweight =
+ rend.getListCellRendererComponent(list,
+ list.getModel().getElementAt(i),
+ i, list.isSelectedIndex(i),
+ list.getSelectionModel().getAnchorSelectionIndex() == i);
Dimension dim = flyweight.getPreferredSize();
cellHeights[i] = dim.height;
- // compute average cell height (little hack here)
- cellHeight = (cellHeight * i + cellHeights[i]) / (i + 1);
- cellWidth = Math.max(cellWidth, dim.width);
- if (list.getLayoutOrientation() == JList.VERTICAL)
- cellWidth = Math.max(cellWidth, list.getSize().width);
}
}
+
+ // Update the cellWidth field.
+ int fixedCellWidth = list.getFixedCellWidth();
+ if (fixedCellWidth > 0)
+ cellWidth = fixedCellWidth;
else
{
- cellHeight = list.getFixedCellHeight();
- cellWidth = list.getFixedCellWidth();
+ for (int i = 0; i < nrows; ++i)
+ {
+ Component flyweight =
+ rend.getListCellRendererComponent(list,
+ list.getModel().getElementAt(i),
+ i, list.isSelectedIndex(i),
+ list.getSelectionModel().getAnchorSelectionIndex() == i);
+ Dimension dim = flyweight.getPreferredSize();
+ cellWidth = Math.max(cellWidth, dim.width);
+ }
+ if (list.getLayoutOrientation() == JList.VERTICAL)
+ cellWidth = Math.max(cellWidth, list.getSize().width);
}
}
@@ -694,13 +913,6 @@ public class BasicListUI extends ListUI
*/
public BasicListUI()
{
- focusListener = new FocusHandler();
- listDataListener = new ListDataHandler();
- listSelectionListener = new ListSelectionHandler();
- mouseInputListener = new MouseInputHandler();
- keyListener = new KeyHandler();
- propertyChangeListener = new PropertyChangeHandler();
- componentListener = new ComponentHandler();
updateLayoutStateNeeded = 1;
rendererPane = new CellRendererPane();
}
@@ -713,11 +925,10 @@ public class BasicListUI extends ListUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- list.setForeground(defaults.getColor("List.foreground"));
- list.setBackground(defaults.getColor("List.background"));
- list.setSelectionForeground(defaults.getColor("List.selectionForeground"));
- list.setSelectionBackground(defaults.getColor("List.selectionBackground"));
+ LookAndFeel.installColorsAndFont(list, "List.background",
+ "List.foreground", "List.font");
+ list.setSelectionForeground(UIManager.getColor("List.selectionForeground"));
+ list.setSelectionBackground(UIManager.getColor("List.selectionBackground"));
list.setOpaque(true);
}
@@ -727,7 +938,6 @@ public class BasicListUI extends ListUI
*/
protected void uninstallDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
list.setForeground(null);
list.setBackground(null);
list.setSelectionForeground(null);
@@ -742,14 +952,28 @@ public class BasicListUI extends ListUI
*/
protected void installListeners()
{
+ if (focusListener == null)
+ focusListener = createFocusListener();
list.addFocusListener(focusListener);
+ if (listDataListener == null)
+ listDataListener = createListDataListener();
list.getModel().addListDataListener(listDataListener);
+ if (listSelectionListener == null)
+ listSelectionListener = createListSelectionListener();
list.addListSelectionListener(listSelectionListener);
+ if (mouseInputListener == null)
+ mouseInputListener = createMouseInputListener();
list.addMouseListener(mouseInputListener);
- list.addKeyListener(keyListener);
list.addMouseMotionListener(mouseInputListener);
+ if (propertyChangeListener == null)
+ propertyChangeListener = createPropertyChangeListener();
list.addPropertyChangeListener(propertyChangeListener);
+
+ // FIXME: Are these two really needed? At least they are not documented.
+ //keyListener = new KeyHandler();
+ componentListener = new ComponentHandler();
list.addComponentListener(componentListener);
+ //list.addKeyListener(keyListener);
}
/**
@@ -761,16 +985,40 @@ public class BasicListUI extends ListUI
list.getModel().removeListDataListener(listDataListener);
list.removeListSelectionListener(listSelectionListener);
list.removeMouseListener(mouseInputListener);
- list.removeKeyListener(keyListener);
+ //list.removeKeyListener(keyListener);
list.removeMouseMotionListener(mouseInputListener);
list.removePropertyChangeListener(propertyChangeListener);
}
-
+
/**
* Installs keyboard actions for this UI in the {@link JList}.
*/
protected void installKeyboardActions()
{
+ InputMap focusInputMap = (InputMap) UIManager.get("List.focusInputMap");
+ InputMapUIResource parentInputMap = new InputMapUIResource();
+ // FIXME: The JDK uses a LazyActionMap for parentActionMap
+ ActionMap parentActionMap = new ActionMapUIResource();
+ action = new ListAction();
+ Object keys[] = focusInputMap.allKeys();
+ // Register key bindings in the UI InputMap-ActionMap pair
+ for (int i = 0; i < keys.length; i++)
+ {
+ KeyStroke stroke = (KeyStroke)keys[i];
+ String actionString = (String) focusInputMap.get(stroke);
+ parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(),
+ stroke.getModifiers()),
+ actionString);
+
+ parentActionMap.put (actionString,
+ new ActionListenerProxy(action, actionString));
+ }
+ // Register the new InputMap-ActionMap as the parents of the list's
+ // InputMap and ActionMap
+ parentInputMap.setParent(list.getInputMap().getParent());
+ parentActionMap.setParent(list.getActionMap().getParent());
+ list.getInputMap().setParent(parentInputMap);
+ list.getActionMap().setParent(parentActionMap);
}
/**
@@ -778,6 +1026,7 @@ public class BasicListUI extends ListUI
*/
protected void uninstallKeyboardActions()
{
+ // TODO: Implement this properly.
}
/**
@@ -855,22 +1104,6 @@ public class BasicListUI extends ListUI
}
/**
- * Paints the packground of the list using the background color
- * of the specified component.
- *
- * @param g The graphics context to paint in
- * @param c The component to paint the background of
- */
- private void paintBackground(Graphics g, JComponent c)
- {
- Dimension size = getPreferredSize(c);
- Color save = g.getColor();
- g.setColor(c.getBackground());
- g.fillRect(0, 0, size.width, size.height);
- g.setColor(save);
- }
-
- /**
* Paints a single cell in the list.
*
* @param g The graphics context to paint in
@@ -892,14 +1125,12 @@ public class BasicListUI extends ListUI
Component comp = rend.getListCellRendererComponent(list,
data.getElementAt(row),
0, isSel, hasFocus);
- //comp.setBounds(new Rectangle(0, 0, bounds.width, bounds.height));
- //comp.paint(g);
rendererPane.paintComponent(g, comp, list, bounds);
}
/**
- * Paints the list by calling {@link #paintBackground} and then repeatedly
- * calling {@link #paintCell} for each visible cell in the list.
+ * Paints the list by repeatedly calling {@link #paintCell} for each visible
+ * cell in the list.
*
* @param g The graphics context to paint with
* @param c Ignored; uses the saved {@link JList} reference
@@ -916,9 +1147,12 @@ public class BasicListUI extends ListUI
ListSelectionModel sel = list.getSelectionModel();
int lead = sel.getLeadSelectionIndex();
Rectangle clip = g.getClipBounds();
- paintBackground(g, list);
- for (int row = 0; row < nrows; ++row)
+ int startIndex = list.locationToIndex(new Point(clip.x, clip.y));
+ int endIndex = list.locationToIndex(new Point(clip.x + clip.width,
+ clip.y + clip.height));
+
+ for (int row = startIndex; row <= endIndex; ++row)
{
Rectangle bounds = getCellBounds(list, row, row);
if (bounds.intersects(clip))
@@ -927,13 +1161,15 @@ public class BasicListUI extends ListUI
}
/**
- * Computes the index of a list cell given a point within the list.
+ * Computes the index of a list cell given a point within the list. If the
+ * location lies outside the bounds of the list, the greatest index in the
+ * list model is returned.
*
* @param list the list which on which the computation is based on
* @param location the coordinates
*
* @return the index of the list item that is located at the given
- * coordinates or <code>null</code> if the location is invalid
+ * coordinates or <code>-1</code> if the list model is empty
*/
public int locationToIndex(JList list, Point location)
{
@@ -983,7 +1219,6 @@ public class BasicListUI extends ListUI
int numberOfItems2 = list.getModel().getSize();
int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1;
- Dimension listDim2 = list.getSize();
int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1);
int gridY2 = Math.min(location.y / cellHeight, visibleRows2);
index = gridY2 + gridX2 * visibleRows2;
@@ -1045,4 +1280,82 @@ public class BasicListUI extends ListUI
}
return loc;
}
+
+ /**
+ * Creates and returns the focus listener for this UI.
+ *
+ * @return the focus listener for this UI
+ */
+ protected FocusListener createFocusListener()
+ {
+ return new FocusHandler();
+ }
+
+ /**
+ * Creates and returns the list data listener for this UI.
+ *
+ * @return the list data listener for this UI
+ */
+ protected ListDataListener createListDataListener()
+ {
+ return new ListDataHandler();
+ }
+
+ /**
+ * Creates and returns the list selection listener for this UI.
+ *
+ * @return the list selection listener for this UI
+ */
+ protected ListSelectionListener createListSelectionListener()
+ {
+ return new ListSelectionHandler();
+ }
+
+ /**
+ * Creates and returns the mouse input listener for this UI.
+ *
+ * @return the mouse input listener for this UI
+ */
+ protected MouseInputListener createMouseInputListener()
+ {
+ return new MouseInputHandler();
+ }
+
+ /**
+ * Creates and returns the property change listener for this UI.
+ *
+ * @return the property change listener for this UI
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new PropertyChangeHandler();
+ }
+
+ /**
+ * Selects the next list item and force it to be visible.
+ */
+ protected void selectNextIndex()
+ {
+ int index = list.getSelectionModel().getLeadSelectionIndex();
+ if (index < list.getModel().getSize() - 1)
+ {
+ index++;
+ list.setSelectedIndex(index);
+ }
+ list.ensureIndexIsVisible(index);
+ }
+
+ /**
+ * Selects the previous list item and force it to be visible.
+ */
+ protected void selectPreviousIndex()
+ {
+ int index = list.getSelectionModel().getLeadSelectionIndex();
+ if (index > 0)
+ {
+ index--;
+ list.setSelectedIndex(index);
+ }
+ list.ensureIndexIsVisible(index);
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
index d35ac9eb926..13c78add6f8 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -273,7 +273,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Button.foreground", new ColorUIResource(Color.BLACK),
"Button.highlight", new ColorUIResource(Color.WHITE),
"Button.light", new ColorUIResource(Color.LIGHT_GRAY),
- "Button.margin", new InsetsUIResource(2, 2, 2, 2),
+ "Button.margin", new InsetsUIResource(2, 14, 2, 14),
"Button.shadow", new ColorUIResource(Color.GRAY),
"Button.textIconGap", new Integer(4),
"Button.textShiftOffset", new Integer(0),
@@ -362,16 +362,16 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"HOME", "homePassThrough",
"END", "endPassThrough"
}),
- "ComboBox.background", new ColorUIResource(light),
+ "ComboBox.background", new ColorUIResource(Color.white),
"ComboBox.buttonBackground", new ColorUIResource(light),
- "ComboBox.buttonDarkShadow", new ColorUIResource(shadow),
+ "ComboBox.buttonDarkShadow", new ColorUIResource(darkShadow),
"ComboBox.buttonHighlight", new ColorUIResource(highLight),
"ComboBox.buttonShadow", new ColorUIResource(shadow),
"ComboBox.disabledBackground", new ColorUIResource(light),
"ComboBox.disabledForeground", new ColorUIResource(Color.gray),
"ComboBox.font", new FontUIResource("SansSerif", Font.PLAIN, 12),
"ComboBox.foreground", new ColorUIResource(Color.black),
- "ComboBox.selectionBackground", new ColorUIResource(Color.black),
+ "ComboBox.selectionBackground", new ColorUIResource(0, 0, 128),
"ComboBox.selectionForeground", new ColorUIResource(Color.white),
"Desktop.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
"KP_LEFT", "left",
@@ -397,7 +397,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null,
null),
"EditorPane.background", new ColorUIResource(Color.white),
- "EditorPane.border", new BasicBorders.MarginBorder(),
+ "EditorPane.border", BasicBorders.getMarginBorder(),
"EditorPane.caretBlinkRate", new Integer(500),
"EditorPane.caretForeground", new ColorUIResource(Color.black),
"EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12),
@@ -466,6 +466,8 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"FocusManagerClassName", "TODO",
"FormattedTextField.background", new ColorUIResource(light),
"FormattedTextField.caretForeground", new ColorUIResource(Color.black),
+ "FormattedTextField.font",
+ new FontUIResource("SansSerif", Font.PLAIN, 12),
"FormattedTextField.foreground", new ColorUIResource(Color.black),
"FormattedTextField.inactiveBackground", new ColorUIResource(light),
"FormattedTextField.inactiveForeground", new ColorUIResource(Color.gray),
@@ -528,30 +530,74 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Label.disabledShadow", new ColorUIResource(shadow),
"Label.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"Label.foreground", new ColorUIResource(darkShadow),
- "List.background", new ColorUIResource(light),
+ "List.background", new ColorUIResource(Color.white),
"List.border", new BasicBorders.MarginBorder(),
"List.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
- "PAGE_UP", "scrollUp",
- "ctrl \\", "clearSelection",
- "PAGE_DOWN", "scrollDown",
- "shift PAGE_DOWN","scrollDownExtendSelection",
+ "ctrl DOWN", "selectNextRowChangeLead",
+ "shift UP", "selectPreviousRowExtendSelection",
+ "ctrl RIGHT", "selectNextColumnChangeLead",
+ "shift ctrl LEFT", "selectPreviousColumnExtendSelection",
+ "shift KP_UP", "selectPreviousRowChangeLead",
+ "DOWN", "selectNextRow",
+ "ctrl UP", "selectPreviousRowChangeLead",
+ "ctrl LEFT", "selectPreviousColumnChangeLead",
+ "CUT", "cut",
"END", "selectLastRow",
- "HOME", "selectFirstRow",
- "shift END", "selectLastRowExtendSelection",
+ "shift PAGE_UP","scrollUpExtendSelection",
+ "KP_UP", "selectPreviousRow",
+ "shift ctrl UP", "selectPreviousRowExtendSelection",
+ "ctrl HOME", "selectFirstRowChangeLead",
+ "shift LEFT", "selectPreviousColumnExtendSelection",
+ "ctrl END", "selectLastRowChangeLead",
+ "ctrl PAGE_DOWN", "scrollDownChangeLead",
+ "shift ctrl RIGHT", "selectNextColumnExtendSelection",
+ "LEFT", "selectPreviousColumn",
+ "ctrl PAGE_UP", "scrollUpChangeLead",
+ "KP_LEFT", "selectPreviousColumn",
+ "shift KP_RIGHT", "selectNextColumnExtendSelection",
+ "SPACE", "addToSelection",
+ "ctrl SPACE", "toggleAndAnchor",
+ "shift SPACE", "extendTo",
+ "shift ctrl SPACE", "moveSelectionTo",
+ "shift ctrl DOWN", "selectNextRowExtendSelection",
+ "ctrl BACK_SLASH", "clearSelection",
"shift HOME", "selectFirstRowExtendSelection",
- "UP", "selectPreviousRow",
- "ctrl /", "selectAll",
- "ctrl A", "selectAll",
- "DOWN", "selectNextRow",
- "shift UP", "selectPreviousRowExtendSelection",
- "ctrl SPACE", "selectNextRowExtendSelection",
+ "RIGHT", "selectNextColumn",
+ "shift ctrl PAGE_UP", "scrollUpExtendSelection",
"shift DOWN", "selectNextRowExtendSelection",
- "KP_UP", "selectPreviousRow",
- "shift PAGE_UP","scrollUpExtendSelection",
- "KP_DOWN", "selectNextRow"
+ "PAGE_DOWN", "scrollDown",
+ "shift ctrl KP_UP", "selectPreviousRowExtendSelection",
+ "shift KP_LEFT", "selectPreviousColumnExtendSelection",
+ "ctrl X", "cut",
+ "shift ctrl PAGE_DOWN", "scrollDownExtendSelection",
+ "ctrl SLASH", "selectAll",
+ "ctrl C", "copy",
+ "ctrl KP_RIGHT", "selectNextColumnChangeLead",
+ "shift END", "selectLastRowExtendSelection",
+ "shift ctrl KP_DOWN", "selectNextRowExtendSelection",
+ "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
+ "HOME", "selectFirstRow",
+ "ctrl V", "paste",
+ "KP_DOWN", "selectNextRow",
+ "ctrl KP_DOWN", "selectNextRowChangeLead",
+ "shift RIGHT", "selectNextColumnExtendSelection",
+ "ctrl A", "selectAll",
+ "shift ctrl END", "selectLastRowExtendSelection",
+ "COPY", "copy",
+ "ctrl KP_UP", "selectPreviousRowChangeLead",
+ "shift ctrl KP_LEFT", "selectPreviousColumnExtendSelection",
+ "shift KP_DOWN", "selectNextRowExtendSelection",
+ "UP", "selectPreviousRow",
+ "shift ctrl HOME", "selectFirstRowExtendSelection",
+ "shift PAGE_DOWN", "scrollDownExtendSelection",
+ "KP_RIGHT", "selectNextColumn",
+ "shift ctrl KP_RIGHT", "selectNextColumnExtendSelection",
+ "PAGE_UP", "scrollUp",
+ "PASTE", "paste"
}),
- "List.foreground", new ColorUIResource(darkShadow),
- "List.selectionBackground", new ColorUIResource(Color.black),
+ "List.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "List.foreground", new ColorUIResource(Color.black),
+ "List.selectionBackground", new ColorUIResource(0, 0, 128),
"List.selectionForeground", new ColorUIResource(Color.white),
"List.focusCellHighlightBorder",
new BorderUIResource.
@@ -601,7 +647,6 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"MenuItem.background", new ColorUIResource(light),
"MenuItem.border", new BasicBorders.MarginBorder(),
"MenuItem.borderPainted", Boolean.FALSE,
- "MenuItem.checkIcon", BasicIconFactory.getMenuItemCheckIcon(),
"MenuItem.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"MenuItem.foreground", new ColorUIResource(darkShadow),
"MenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
@@ -624,7 +669,9 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"OptionPane.messageAreaBorder",
new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0),
"OptionPane.messageForeground", new ColorUIResource(darkShadow),
- "OptionPane.minimumSize", new DimensionUIResource(262, 90),
+ "OptionPane.minimumSize",
+ new DimensionUIResource(BasicOptionPaneUI.MinimumWidth,
+ BasicOptionPaneUI.MinimumHeight),
"OptionPane.noButtonText", "No",
"OptionPane.okButtonText", "OK",
// XXX Don't use gif
@@ -660,16 +707,17 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"PopupMenu.border", new BorderUIResource.BevelBorderUIResource(0),
"PopupMenu.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"PopupMenu.foreground", new ColorUIResource(darkShadow),
- "ProgressBar.background", new ColorUIResource(light),
- "ProgressBar.border", new BorderUIResource.LineBorderUIResource(Color.darkGray),
+ "ProgressBar.background", new ColorUIResource(Color.LIGHT_GRAY),
+ "ProgressBar.border",
+ new BorderUIResource.LineBorderUIResource(Color.GREEN, 2),
"ProgressBar.cellLength", new Integer(1),
"ProgressBar.cellSpacing", new Integer(0),
"ProgressBar.font", new FontUIResource("Dialog", Font.PLAIN, 12),
- "ProgressBar.foreground", new ColorUIResource(Color.black),
- "ProgressBar.selectionBackground", new ColorUIResource(Color.black),
- "ProgressBar.selectionForeground", new ColorUIResource(light),
- "ProgressBar.repaintInterval", new Integer(250),
- "ProgressBar.cycleTime", new Integer(6000),
+ "ProgressBar.foreground", new ColorUIResource(0, 0, 128),
+ "ProgressBar.selectionBackground", new ColorUIResource(0, 0, 128),
+ "ProgressBar.selectionForeground", new ColorUIResource(Color.LIGHT_GRAY),
+ "ProgressBar.repaintInterval", new Integer(50),
+ "ProgressBar.cycleTime", new Integer(3000),
"RadioButton.background", new ColorUIResource(light),
"RadioButton.border", new BorderUIResource.CompoundBorderUIResource(null,
null),
@@ -742,6 +790,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"ScrollBar.thumbShadow", new ColorUIResource(shadow),
"ScrollBar.track", new ColorUIResource(light),
"ScrollBar.trackHighlight", new ColorUIResource(shadow),
+ "ScrollBar.width", new Integer(16),
"ScrollPane.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
"PAGE_UP", "scrollUp",
"KP_LEFT", "unitScrollLeft",
@@ -846,6 +895,24 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TabbedPane.tabRunOverlay", new Integer(2),
"TabbedPane.textIconGap", new Integer(4),
"Table.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
+ "ctrl DOWN", "selectNextRowChangeLead",
+ "ctrl RIGHT", "selectNextColumnChangeLead",
+ "ctrl UP", "selectPreviousRowChangeLead",
+ "ctrl LEFT", "selectPreviousColumnChangeLead",
+ "CUT", "cut",
+ "SPACE", "addToSelection",
+ "ctrl SPACE", "toggleAndAnchor",
+ "shift SPACE", "extendTo",
+ "shift ctrl SPACE", "moveSelectionTo",
+ "ctrl X", "cut",
+ "ctrl C", "copy",
+ "ctrl KP_RIGHT", "selectNextColumnChangeLead",
+ "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
+ "ctrl V", "paste",
+ "ctrl KP_DOWN", "selectNextRowChangeLead",
+ "COPY", "copy",
+ "ctrl KP_UP", "selectPreviousRowChangeLead",
+ "PASTE", "paste",
"shift PAGE_DOWN","scrollDownExtendSelection",
"PAGE_DOWN", "scrollDownChangeSelection",
"END", "selectLastColumn",
@@ -896,25 +963,26 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"ctrl SLASH", "selectAll",
"ctrl shift KP_DOWN", "selectNextRowExtendSelection",
}),
- "Table.background", new ColorUIResource(light),
- "Table.focusCellBackground", new ColorUIResource(light),
- "Table.focusCellForeground", new ColorUIResource(darkShadow),
+ "Table.background", new ColorUIResource(new ColorUIResource(255, 255, 255)),
+ "Table.focusCellBackground", new ColorUIResource(new ColorUIResource(255, 255, 255)),
+ "Table.focusCellForeground", new ColorUIResource(new ColorUIResource(0, 0, 0)),
"Table.focusCellHighlightBorder",
new BorderUIResource.LineBorderUIResource(
new ColorUIResource(255, 255, 0)),
"Table.font", new FontUIResource("Dialog", Font.PLAIN, 12),
- "Table.foreground", new ColorUIResource(darkShadow),
- "Table.gridColor", new ColorUIResource(Color.gray),
+ "Table.foreground", new ColorUIResource(new ColorUIResource(0, 0, 0)),
+ "Table.gridColor", new ColorUIResource(new ColorUIResource(128, 128, 128)),
"Table.scrollPaneBorder", new BorderUIResource.BevelBorderUIResource(0),
- "Table.selectionBackground", new ColorUIResource(Color.black),
- "Table.selectionForeground", new ColorUIResource(Color.white),
- "TableHeader.background", new ColorUIResource(light),
+ "Table.selectionBackground", new ColorUIResource(new ColorUIResource(0, 0, 128)),
+ "Table.selectionForeground", new ColorUIResource(new ColorUIResource(255, 255, 255)),
+ "TableHeader.background", new ColorUIResource(new ColorUIResource(192, 192, 192)),
"TableHeader.cellBorder", new BorderUIResource.BevelBorderUIResource(0),
"TableHeader.font", new FontUIResource("Dialog", Font.PLAIN, 12),
- "TableHeader.foreground", new ColorUIResource(darkShadow),
+ "TableHeader.foreground", new ColorUIResource(new ColorUIResource(0, 0, 0)),
"TextArea.background", new ColorUIResource(light),
- "TextArea.border", new BasicBorders.MarginBorder(),
+ "TextArea.border",
+ new BorderUIResource(BasicBorders.getMarginBorder()),
"TextArea.caretBlinkRate", new Integer(500),
"TextArea.caretForeground", new ColorUIResource(Color.black),
"TextArea.font", new FontUIResource("MonoSpaced", Font.PLAIN, 12),
@@ -945,8 +1013,8 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TextField.font", new FontUIResource("SansSerif", Font.PLAIN, 12),
"TextField.foreground", new ColorUIResource(Color.black),
"TextField.highlight", new ColorUIResource(highLight),
- "TextField.inactiveBackground", new ColorUIResource(light),
- "TextField.inactiveForeground", new ColorUIResource(Color.gray),
+ "TextField.inactiveBackground", new ColorUIResource(Color.LIGHT_GRAY),
+ "TextField.inactiveForeground", new ColorUIResource(Color.GRAY),
"TextField.light", new ColorUIResource(highLight),
"TextField.highlight", new ColorUIResource(light),
"TextField.keyBindings", new JTextComponent.KeyBinding[] {
@@ -964,7 +1032,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TextField.selectionBackground", new ColorUIResource(Color.black),
"TextField.selectionForeground", new ColorUIResource(Color.white),
"TextPane.background", new ColorUIResource(Color.white),
- "TextPane.border", new BasicBorders.MarginBorder(),
+ "TextPane.border", BasicBorders.getMarginBorder(),
"TextPane.caretBlinkRate", new Integer(500),
"TextPane.caretForeground", new ColorUIResource(Color.black),
"TextPane.font", new FontUIResource("Serif", Font.PLAIN, 12),
@@ -1036,7 +1104,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
"ESCAPE", "cancel"
}),
- "Tree.background", new ColorUIResource(light),
+ "Tree.background", new ColorUIResource(new Color(255, 255, 255)),
"Tree.changeSelectionWithFocus", Boolean.TRUE,
// "Tree.closedIcon", new IconUIResource(new ImageIcon("icons/TreeClosed.png")),
// "Tree.collapsedIcon", new IconUIResource(new ImageIcon("icons/TreeCollapsed.png")),
@@ -1086,20 +1154,20 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"PAGE_UP", "scrollUpChangeSelection",
"ctrl PAGE_DOWN", "scrollDownChangeLead"
}),
- "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)),
+ "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"Tree.foreground", new ColorUIResource(Color.black),
"Tree.hash", new ColorUIResource(new Color(128, 128, 128)),
"Tree.leftChildIndent", new Integer(7),
"Tree.rightChildIndent", new Integer(13),
- "Tree.rowHeight", new Integer(20), // FIXME
+ "Tree.rowHeight", new Integer(0),
"Tree.scrollsOnExpand", Boolean.TRUE,
"Tree.selectionBackground", new ColorUIResource(Color.black),
- "Tree.nonSelectionBackground", new ColorUIResource(new Color(239, 235, 231)),
+ "Tree.nonSelectionBackground", new ColorUIResource(new Color(255, 255, 255)),
"Tree.selectionBorderColor", new ColorUIResource(Color.black),
"Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(Color.black),
"Tree.selectionForeground", new ColorUIResource(new Color(255, 255, 255)),
- "Tree.textBackground", new ColorUIResource(new Color(255, 255, 255)),
- "Tree.textForeground", new ColorUIResource(Color.black),
+ "Tree.textBackground", new ColorUIResource(new Color(192, 192, 192)),
+ "Tree.textForeground", new ColorUIResource(new Color(0, 0, 0)),
"Viewport.background", new ColorUIResource(light),
"Viewport.foreground", new ColorUIResource(Color.black),
"Viewport.font", new FontUIResource("Dialog", Font.PLAIN, 12)
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java
index 95f6b84fb7c..daa9b0d6b63 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuBarUI.java
@@ -41,16 +41,19 @@ package javax.swing.plaf.basic;
import java.awt.Dimension;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
+import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
+import javax.swing.JMenu;
import javax.swing.JMenuBar;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.LookAndFeel;
+import javax.swing.MenuElement;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.MouseInputListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.MenuBarUI;
@@ -63,12 +66,15 @@ public class BasicMenuBarUI extends MenuBarUI
/*ContainerListener that listens to the ContainerEvents fired from menu bar*/
protected ContainerListener containerListener;
-
+
/*Property change listeners that listener to PropertyChangeEvent from menu bar*/
protected PropertyChangeListener propertyChangeListener;
/* menu bar for which this UI delegate is for*/
protected JMenuBar menuBar;
+
+ /* MouseListener that listens to the mouseEvents fired from menu bar*/
+ private MouseInputListener mouseListener;
/**
* Creates a new BasicMenuBarUI object.
@@ -78,6 +84,7 @@ public class BasicMenuBarUI extends MenuBarUI
changeListener = createChangeListener();
containerListener = createContainerListener();
propertyChangeListener = new PropertyChangeHandler();
+ mouseListener = new MouseInputHandler();
}
/**
@@ -159,12 +166,9 @@ public class BasicMenuBarUI extends MenuBarUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- menuBar.setBackground(defaults.getColor("MenuBar.background"));
- menuBar.setBorder(defaults.getBorder("MenuBar.border"));
- menuBar.setFont(defaults.getFont("MenuBar.font"));
- menuBar.setForeground(defaults.getColor("MenuBar.foreground"));
+ LookAndFeel.installBorder(menuBar, "MenuBar.border");
+ LookAndFeel.installColorsAndFont(menuBar, "MenuBar.background",
+ "MenuBar.foreground", "MenuBar.font");
menuBar.setOpaque(true);
}
@@ -183,6 +187,7 @@ public class BasicMenuBarUI extends MenuBarUI
{
menuBar.addContainerListener(containerListener);
menuBar.addPropertyChangeListener(propertyChangeListener);
+ menuBar.addMouseListener(mouseListener);
}
/**
@@ -229,6 +234,7 @@ public class BasicMenuBarUI extends MenuBarUI
{
menuBar.removeContainerListener(containerListener);
menuBar.removePropertyChangeListener(propertyChangeListener);
+ menuBar.removeMouseListener(mouseListener);
}
/**
@@ -250,6 +256,7 @@ public class BasicMenuBarUI extends MenuBarUI
{
public void stateChanged(ChangeEvent event)
{
+ // TODO: What should be done here, if anything?
}
}
@@ -301,4 +308,84 @@ public class BasicMenuBarUI extends MenuBarUI
menuBar.repaint();
}
}
+
+ private class MouseInputHandler implements MouseInputListener
+ {
+ /**
+ * Handles mouse clicked event
+ *
+ * @param e Mouse event
+ */
+ public void mouseClicked(MouseEvent e)
+ {
+ MenuElement[] me = menuBar.getSubElements();
+
+ for (int i = 0; i < me.length; i++)
+ {
+ JMenu menu = menuBar.getMenu(i);
+ if (menu != null)
+ menu.setSelected(false);
+ }
+ }
+
+ /**
+ * Handles mouse pressed event
+ *
+ * @param e Mouse event
+ */
+ public void mousePressed(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse released event
+ *
+ * @param e Mouse event
+ */
+ public void mouseReleased(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse exited event
+ *
+ * @param e Mouse event
+ */
+ public void mouseExited(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse dragged event
+ *
+ * @param e Mouse event
+ */
+ public void mouseDragged(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse moved event
+ *
+ * @param e Mouse event
+ */
+ public void mouseMoved(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+
+ /**
+ * Handles mouse entered event
+ *
+ * @param e Mouse event
+ */
+ public void mouseEntered(MouseEvent e)
+ {
+ // TODO: What should be done here, if anything?
+ }
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
index 8aa1193bcc4..c8754a3e049 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java
@@ -7,7 +7,7 @@ GNU Classpath 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, or (at your option)
any later version.
-
+
GNU Classpath 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
@@ -46,18 +46,27 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
+import javax.swing.ButtonModel;
import javax.swing.Icon;
+import javax.swing.InputMap;
+import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.SwingConstants;
@@ -69,6 +78,8 @@ import javax.swing.event.MenuDragMouseListener;
import javax.swing.event.MenuKeyEvent;
import javax.swing.event.MenuKeyListener;
import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ActionMapUIResource;
+import javax.swing.plaf.ComponentInputMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.MenuItemUI;
@@ -109,7 +120,7 @@ public class BasicMenuItemUI extends MenuItemUI
* Number of spaces between icon and text.
*/
protected int defaultTextIconGap = 4;
-
+
/**
* Color of the text when menu item is disabled
*/
@@ -156,16 +167,69 @@ public class BasicMenuItemUI extends MenuItemUI
private String acceleratorDelimiter;
/**
- * PropertyChangeListener to listen for property changes in the menu item
+ * ItemListener to listen for item changes in the menu item
*/
- private PropertyChangeListener propertyChangeListener;
+ private ItemListener itemListener;
/**
* Number of spaces between accelerator and menu item's label.
*/
- private int defaultAcceleratorLabelGap = 4;
+ private int defaultAcceleratorLabelGap = 10;
/**
+ * The gap between different menus on the MenuBar.
+ */
+ private int MenuGap = 10;
+
+ /** A PropertyChangeListener to make UI updates after property changes **/
+ PropertyChangeHandler propertyChangeListener;
+
+ /**
+ * A class to handle PropertChangeEvents for the JMenuItem
+ * @author Anthony Balkissoon abalkiss at redhat dot com.
+ */
+ class PropertyChangeHandler implements PropertyChangeListener
+ {
+ /**
+ * This method is called when a property of the menuItem is changed.
+ * Currently it is only used to update the accelerator key bindings.
+ *
+ * @param e
+ * the PropertyChangeEvent
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName() == "accelerator")
+ {
+ InputMap map = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW);
+ if (map != null)
+ map.remove((KeyStroke)e.getOldValue());
+ else
+ map = new ComponentInputMapUIResource(menuItem);
+ map.put((KeyStroke)e.getNewValue(), "doClick");
+ }
+ }
+ }
+
+ /**
+ * A class to handle accelerator keys. This is the Action we will
+ * perform when the accelerator key for this JMenuItem is pressed.
+ * @author Anthony Balkissoon abalkiss at redhat dot com
+ *
+ */
+ class ClickAction extends AbstractAction
+ {
+ /**
+ * This is what is done when the accelerator key for the JMenuItem is
+ * pressed.
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ doClick(MenuSelectionManager.defaultManager());
+ }
+ }
+
+ /**
* Creates a new BasicMenuItemUI object.
*/
public BasicMenuItemUI()
@@ -173,14 +237,15 @@ public class BasicMenuItemUI extends MenuItemUI
mouseInputListener = createMouseInputListener(menuItem);
menuDragMouseListener = createMenuDragMouseListener(menuItem);
menuKeyListener = createMenuKeyListener(menuItem);
+ itemListener = new ItemHandler();
propertyChangeListener = new PropertyChangeHandler();
}
/**
* Create MenuDragMouseListener to listen for mouse dragged events.
- *
- * @param c menu item to listen to
- *
+ *
+ * @param c
+ * menu item to listen to
* @return The MenuDragMouseListener
*/
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)
@@ -189,11 +254,11 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * Creates MenuKeyListener to listen to key events occuring when menu item
- * is visible on the screen.
- *
- * @param c menu item to listen to
- *
+ * Creates MenuKeyListener to listen to key events occuring when menu item is
+ * visible on the screen.
+ *
+ * @param c
+ * menu item to listen to
* @return The MenuKeyListener
*/
protected MenuKeyListener createMenuKeyListener(JComponent c)
@@ -203,9 +268,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Handles mouse input events occuring for this menu item
- *
- * @param c menu item to listen to
- *
+ *
+ * @param c
+ * menu item to listen to
* @return The MouseInputListener
*/
protected MouseInputListener createMouseInputListener(JComponent c)
@@ -216,9 +281,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Factory method to create a BasicMenuItemUI for the given {@link
* JComponent}, which should be a {@link JMenuItem}.
- *
- * @param c The {@link JComponent} a UI is being created for.
- *
+ *
+ * @param c
+ * The {@link JComponent} a UI is being created for.
* @return A BasicMenuItemUI for the {@link JComponent}.
*/
public static ComponentUI createUI(JComponent c)
@@ -228,8 +293,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Programatically clicks menu item.
- *
- * @param msm MenuSelectionManager for the menu hierarchy
+ *
+ * @param msm
+ * MenuSelectionManager for the menu hierarchy
*/
protected void doClick(MenuSelectionManager msm)
{
@@ -239,9 +305,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Returns maximum size for the specified menu item
- *
- * @param c component for which to get maximum size
- *
+ *
+ * @param c
+ * component for which to get maximum size
* @return Maximum size for the specified menu item.
*/
public Dimension getMaximumSize(JComponent c)
@@ -251,9 +317,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Returns minimum size for the specified menu item
- *
- * @param c component for which to get minimum size
- *
+ *
+ * @param c
+ * component for which to get minimum size
* @return Minimum size for the specified menu item.
*/
public Dimension getMinimumSize(JComponent c)
@@ -263,9 +329,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Returns path to this menu item.
- *
- * @return $MenuElement[]$ Returns array of menu elements
- * that constitute a path to this menu item.
+ *
+ * @return $MenuElement[]$ Returns array of menu elements that constitute a
+ * path to this menu item.
*/
public MenuElement[] getPath()
{
@@ -278,12 +344,12 @@ public class BasicMenuItemUI extends MenuItemUI
Component c = menuItem;
while (c instanceof MenuElement)
{
- path.add(0, (MenuElement) c);
+ path.add(0, (MenuElement) c);
- if (c instanceof JPopupMenu)
- c = ((JPopupMenu) c).getInvoker();
- else
- c = c.getParent();
+ if (c instanceof JPopupMenu)
+ c = ((JPopupMenu) c).getInvoker();
+ else
+ c = c.getParent();
}
MenuElement[] pathArray = new MenuElement[path.size()];
@@ -293,12 +359,15 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Returns preferred size for the given menu item.
- *
- * @param c menu item for which to get preferred size
- * @param checkIcon check icon displayed in the given menu item
- * @param arrowIcon arrow icon displayed in the given menu item
- * @param defaultTextIconGap space between icon and text in the given menuItem
- *
+ *
+ * @param c
+ * menu item for which to get preferred size
+ * @param checkIcon
+ * check icon displayed in the given menu item
+ * @param arrowIcon
+ * arrow icon displayed in the given menu item
+ * @param defaultTextIconGap
+ * space between icon and text in the given menuItem
* @return $Dimension$ preferred size for the given menu item
*/
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon,
@@ -308,7 +377,7 @@ public class BasicMenuItemUI extends MenuItemUI
JMenuItem m = (JMenuItem) c;
Dimension d = BasicGraphicsUtils.getPreferredButtonSize(m,
defaultTextIconGap);
-
+
// if menu item has accelerator then take accelerator's size into account
// when calculating preferred size.
KeyStroke accelerator = m.getAccelerator();
@@ -316,52 +385,57 @@ public class BasicMenuItemUI extends MenuItemUI
if (accelerator != null)
{
- rect = getAcceleratorRect(accelerator,
- m.getToolkit().getFontMetrics(acceleratorFont));
+ rect = getAcceleratorRect(
+ accelerator,
+ m.getToolkit().getFontMetrics(acceleratorFont));
- // add width of accelerator's text
- d.width = d.width + rect.width + defaultAcceleratorLabelGap;
+ // add width of accelerator's text
+ d.width += rect.width + defaultAcceleratorLabelGap;
- // adjust the heigth of the preferred size if necessary
- if (d.height < rect.height)
- d.height = rect.height;
+ // adjust the heigth of the preferred size if necessary
+ if (d.height < rect.height)
+ d.height = rect.height;
}
if (checkIcon != null)
{
- d.width = d.width + checkIcon.getIconWidth() + defaultTextIconGap;
+ d.width += checkIcon.getIconWidth() + defaultTextIconGap;
- if (checkIcon.getIconHeight() > d.height)
- d.height = checkIcon.getIconHeight();
+ if (checkIcon.getIconHeight() > d.height)
+ d.height = checkIcon.getIconHeight();
}
if (arrowIcon != null && (c instanceof JMenu))
{
- d.width = d.width + arrowIcon.getIconWidth() + defaultTextIconGap;
-
- if (arrowIcon.getIconHeight() > d.height)
- d.height = arrowIcon.getIconHeight();
+ int pWidth = m.getParent().getWidth();
+ if (!((JMenu)c).isTopLevelMenu() && d.width < pWidth)
+ d.width = pWidth
+ - m.getInsets().left - m.getInsets().right;
+ else
+ d.width += arrowIcon.getIconWidth() + MenuGap;
+
+ if (arrowIcon.getIconHeight() > d.height)
+ d.height = arrowIcon.getIconHeight();
}
-
+
return d;
}
/**
* Returns preferred size of the given component
- *
- * @param c component for which to return preferred size
- *
+ *
+ * @param c
+ * component for which to return preferred size
* @return $Dimension$ preferred size for the given component
*/
public Dimension getPreferredSize(JComponent c)
{
- return getPreferredMenuItemSize(c, checkIcon, arrowIcon,
- defaultTextIconGap);
+ return getPreferredMenuItemSize(c, checkIcon, arrowIcon, defaultTextIconGap);
}
/**
* Returns the prefix for entries in the {@link UIDefaults} table.
- *
+ *
* @return "MenuItem"
*/
protected String getPropertyPrefix()
@@ -371,8 +445,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* This method installs the components for this {@link JMenuItem}.
- *
- * @param menuItem The {@link JMenuItem} to install components for.
+ *
+ * @param menuItem
+ * The {@link JMenuItem} to install components for.
*/
protected void installComponents(JMenuItem menuItem)
{
@@ -380,26 +455,24 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * This method installs the defaults that are defined in the Basic look and
+ * This method installs the defaults that are defined in the Basic look and
* feel for this {@link JMenuItem}.
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- menuItem.setBackground(defaults.getColor("MenuItem.background"));
- menuItem.setBorder(defaults.getBorder("MenuItem.border"));
- menuItem.setFont(defaults.getFont("MenuItem.font"));
- menuItem.setForeground(defaults.getColor("MenuItem.foreground"));
- menuItem.setMargin(defaults.getInsets("MenuItem.margin"));
- menuItem.setOpaque(true);
- acceleratorFont = defaults.getFont("MenuItem.acceleratorFont");
- acceleratorForeground = defaults.getColor("MenuItem.acceleratorForeground");
- acceleratorSelectionForeground = defaults.getColor("MenuItem.acceleratorSelectionForeground");
- selectionBackground = defaults.getColor("MenuItem.selectionBackground");
- selectionForeground = defaults.getColor("MenuItem.selectionForeground");
- acceleratorDelimiter = defaults.getString("MenuItem.acceleratorDelimiter");
-
+ String prefix = getPropertyPrefix();
+ LookAndFeel.installBorder(menuItem, prefix + ".border");
+ LookAndFeel.installColorsAndFont(menuItem, prefix + ".background",
+ prefix + ".foreground", prefix + ".font");
+ menuItem.setMargin(UIManager.getInsets(prefix + ".margin"));
+ acceleratorFont = UIManager.getFont(prefix + ".acceleratorFont");
+ acceleratorForeground = UIManager.getColor(prefix + ".acceleratorForeground");
+ acceleratorSelectionForeground = UIManager.getColor(prefix + ".acceleratorSelectionForeground");
+ selectionBackground = UIManager.getColor(prefix + ".selectionBackground");
+ selectionForeground = UIManager.getColor(prefix + ".selectionForeground");
+ acceleratorDelimiter = UIManager.getString(prefix + ".acceleratorDelimiter");
+ checkIcon = UIManager.getIcon(prefix + ".checkIcon");
+
menuItem.setHorizontalTextPosition(SwingConstants.TRAILING);
menuItem.setHorizontalAlignment(SwingConstants.LEADING);
}
@@ -409,7 +482,17 @@ public class BasicMenuItemUI extends MenuItemUI
*/
protected void installKeyboardActions()
{
- // FIXME: Need to implement
+ InputMap focusedWindowMap = SwingUtilities.getUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW);
+ if (focusedWindowMap == null)
+ focusedWindowMap = new ComponentInputMapUIResource(menuItem);
+ focusedWindowMap.put(menuItem.getAccelerator(), "doClick");
+ SwingUtilities.replaceUIInputMap(menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW, focusedWindowMap);
+
+ ActionMap UIActionMap = SwingUtilities.getUIActionMap(menuItem);
+ if (UIActionMap == null)
+ UIActionMap = new ActionMapUIResource();
+ UIActionMap.put("doClick", new ClickAction());
+ SwingUtilities.replaceUIActionMap(menuItem, UIActionMap);
}
/**
@@ -421,15 +504,17 @@ public class BasicMenuItemUI extends MenuItemUI
menuItem.addMouseMotionListener(mouseInputListener);
menuItem.addMenuDragMouseListener(menuDragMouseListener);
menuItem.addMenuKeyListener(menuKeyListener);
+ menuItem.addItemListener(itemListener);
menuItem.addPropertyChangeListener(propertyChangeListener);
}
/**
- * Installs and initializes all fields for this UI delegate. Any properties
- * of the UI that need to be initialized and/or set to defaults will be
- * done now. It will also install any listeners necessary.
- *
- * @param c The {@link JComponent} that is having this UI installed.
+ * Installs and initializes all fields for this UI delegate. Any properties of
+ * the UI that need to be initialized and/or set to defaults will be done now.
+ * It will also install any listeners necessary.
+ *
+ * @param c
+ * The {@link JComponent} that is having this UI installed.
*/
public void installUI(JComponent c)
{
@@ -438,13 +523,16 @@ public class BasicMenuItemUI extends MenuItemUI
installDefaults();
installComponents(menuItem);
installListeners();
+ installKeyboardActions();
}
/**
* Paints given menu item using specified graphics context
- *
- * @param g The graphics context used to paint this menu item
- * @param c Menu Item to paint
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param c
+ * Menu Item to paint
*/
public void paint(Graphics g, JComponent c)
{
@@ -454,31 +542,49 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Paints background of the menu item
- *
- * @param g The graphics context used to paint this menu item
- * @param menuItem menu item to paint
- * @param bgColor Background color to use when painting menu item
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param menuItem
+ * menu item to paint
+ * @param bgColor
+ * Background color to use when painting menu item
*/
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)
{
- Dimension size = getPreferredSize(menuItem);
- Color foreground = g.getColor();
- g.setColor(bgColor);
- g.drawRect(0, 0, size.width, size.height);
- g.setColor(foreground);
+ // Menu item is considered to be highlighted when it is selected.
+ // But we don't want to paint the background of JCheckBoxMenuItems
+ ButtonModel mod = menuItem.getModel();
+ if ((menuItem.isSelected() && checkIcon == null) || (mod != null &&
+ mod.isArmed())
+ && (menuItem.getParent() instanceof MenuElement))
+ {
+ if (menuItem.isContentAreaFilled())
+ {
+ g.setColor(selectionBackground);
+ g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight());
+ }
+ }
+
}
/**
* Paints specified menu item
- *
- * @param g The graphics context used to paint this menu item
- * @param c menu item to paint
- * @param checkIcon check icon to use when painting menu item
- * @param arrowIcon arrow icon to use when painting menu item
- * @param background Background color of the menu item
- * @param foreground Foreground color of the menu item
- * @param defaultTextIconGap space to use between icon and
- * text when painting menu item
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param c
+ * menu item to paint
+ * @param checkIcon
+ * check icon to use when painting menu item
+ * @param arrowIcon
+ * arrow icon to use when painting menu item
+ * @param background
+ * Background color of the menu item
+ * @param foreground
+ * Foreground color of the menu item
+ * @param defaultTextIconGap
+ * space to use between icon and text when painting menu item
*/
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon,
Icon arrowIcon, Color background,
@@ -496,7 +602,7 @@ public class BasicMenuItemUI extends MenuItemUI
int horAlign = m.getHorizontalAlignment();
int vertTextPos = m.getVerticalTextPosition();
int horTextPos = m.getHorizontalTextPosition();
-
+
Font f = m.getFont();
g.setFont(f);
FontMetrics fm = g.getFontMetrics(f);
@@ -504,99 +610,83 @@ public class BasicMenuItemUI extends MenuItemUI
SwingUtilities.calculateInsetArea(br, m.getInsets(), vr);
paintBackground(g, m, m.getBackground());
- /* MenuItems insets are equal to menuItems margin, space between text and
- menuItems border. We need to paint insets region as well. */
+ /*
+ * MenuItems insets are equal to menuItems margin, space between text and
+ * menuItems border. We need to paint insets region as well.
+ */
Insets insets = m.getInsets();
br.x -= insets.left;
br.y -= insets.top;
br.width += insets.right + insets.left;
br.height += insets.top + insets.bottom;
- // Menu item is considered to be highlighted when it is selected.
- // But we don't want to paint the background of JCheckBoxMenuItems
- if ((m.isSelected() && checkIcon == null) || m.getModel().isArmed() &&
- (m.getParent() instanceof MenuElement))
- {
- if (m.isContentAreaFilled())
- {
- g.setColor(selectionBackground);
- g.fillRect(br.x, br.y, br.width, br.height);
- }
- }
- else
- {
- if (m.isContentAreaFilled())
- {
- g.setColor(m.getBackground());
- g.fillRect(br.x, br.y, br.width, br.height);
- }
- }
-
// If this menu item is a JCheckBoxMenuItem then paint check icon
if (checkIcon != null)
{
- SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign,
- horAlign, vertTextPos, horTextPos,
- vr, cr, tr, defaultTextIconGap);
+ SwingUtilities.layoutCompoundLabel(m, fm, null, checkIcon, vertAlign,
+ horAlign, vertTextPos, horTextPos,
+ vr, cr, tr, defaultTextIconGap);
checkIcon.paintIcon(m, g, cr.x, cr.y);
- // We need to calculate position of the menu text and position of
- // user menu icon if there exists one relative to the check icon.
- // So we need to adjust view rectangle s.t. its starting point is at
- // checkIcon.width + defaultTextIconGap.
- vr.x = cr.x + cr.width + defaultTextIconGap;
+ // We need to calculate position of the menu text and position of
+ // user menu icon if there exists one relative to the check icon.
+ // So we need to adjust view rectangle s.t. its starting point is at
+ // checkIcon.width + defaultTextIconGap.
+ vr.x = cr.x + cr.width + defaultTextIconGap;
}
// if this is a submenu, then paint arrow icon to indicate it.
if (arrowIcon != null && (c instanceof JMenu))
{
- if (! ((JMenu) c).isTopLevelMenu())
- {
- int width = arrowIcon.getIconWidth();
- int height = arrowIcon.getIconHeight();
-
- arrowIcon.paintIcon(m, g, vr.width - width + defaultTextIconGap,
- vr.y + 2);
- }
+ if (!((JMenu) c).isTopLevelMenu())
+ {
+ int width = arrowIcon.getIconWidth();
+ int height = arrowIcon.getIconHeight();
+ int offset = (vr.height - height) / 2;
+ arrowIcon.paintIcon(m, g, vr.width - width, vr.y + offset);
+ }
}
- // paint text and user menu icon if it exists
+ // paint text and user menu icon if it exists
Icon i = m.getIcon();
- SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), i,
- vertAlign, horAlign, vertTextPos,
- horTextPos, vr, ir, tr,
- defaultTextIconGap);
+ SwingUtilities.layoutCompoundLabel(c, fm, m.getText(), i, vertAlign,
+ horAlign, vertTextPos, horTextPos, vr,
+ ir, tr, defaultTextIconGap);
if (i != null)
i.paintIcon(c, g, ir.x, ir.y);
paintText(g, m, tr, m.getText());
- // paint accelerator
+ // paint accelerator
String acceleratorText = "";
if (m.getAccelerator() != null)
{
- acceleratorText = getAcceleratorText(m.getAccelerator());
- fm = g.getFontMetrics(acceleratorFont);
- ar.width = fm.stringWidth(acceleratorText);
- ar.x = br.width - ar.width;
- vr.x = br.width - ar.width;
-
- SwingUtilities.layoutCompoundLabel(m, fm, acceleratorText, null,
- vertAlign, horAlign, vertTextPos,
- horTextPos, vr, ir, ar,
- defaultTextIconGap);
-
- paintAccelerator(g, m, ar, acceleratorText);
+ acceleratorText = getAcceleratorText(m.getAccelerator());
+ fm = g.getFontMetrics(acceleratorFont);
+ ar.width = fm.stringWidth(acceleratorText);
+ ar.x = br.width - ar.width;
+ vr.x = br.width - ar.width - defaultTextIconGap;
+
+ SwingUtilities.layoutCompoundLabel(m, fm, acceleratorText, null,
+ vertAlign, horAlign, vertTextPos,
+ horTextPos, vr, ir, ar,
+ defaultTextIconGap);
+
+ paintAccelerator(g, m, ar, acceleratorText);
}
}
/**
* Paints label for the given menu item
- *
- * @param g The graphics context used to paint this menu item
- * @param menuItem menu item for which to draw its label
- * @param textRect rectangle specifiying position of the text relative to
- * the given menu item
- * @param text label of the menu item
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param menuItem
+ * menu item for which to draw its label
+ * @param textRect
+ * rectangle specifiying position of the text relative to the given
+ * menu item
+ * @param text
+ * label of the menu item
*/
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect,
String text)
@@ -605,43 +695,46 @@ public class BasicMenuItemUI extends MenuItemUI
g.setFont(f);
FontMetrics fm = g.getFontMetrics(f);
- if (text != null && ! text.equals(""))
+ if (text != null && !text.equals(""))
{
- if (menuItem.isEnabled())
+ if (menuItem.isEnabled())
{
// Menu item is considered to be highlighted when it is selected.
// But not if it's a JCheckBoxMenuItem
- if ((menuItem.isSelected() && checkIcon == null) || menuItem.getModel().isArmed() &&
- (menuItem.getParent() instanceof MenuElement))
+ ButtonModel mod = menuItem.getModel();
+ if ((menuItem.isSelected() && checkIcon == null)
+ || (mod != null && mod.isArmed())
+ && (menuItem.getParent() instanceof MenuElement))
g.setColor(selectionForeground);
else
g.setColor(menuItem.getForeground());
}
- else
- // FIXME: should fix this to use 'disabledForeground', but its
- // default value in BasicLookAndFeel is null.
-
+ else
+ // FIXME: should fix this to use 'disabledForeground', but its
+ // default value in BasicLookAndFeel is null.
+
// FIXME: should there be different foreground colours for selected
// or deselected, when disabled?
g.setColor(Color.gray);
- int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();
+ int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();
- if (mnemonicIndex != -1)
- BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, mnemonicIndex,
- textRect.x,
- textRect.y
- + fm.getAscent());
- else
- BasicGraphicsUtils.drawString(g, text, 0, textRect.x,
- textRect.y + fm.getAscent());
+ if (mnemonicIndex != -1)
+ BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, mnemonicIndex,
+ textRect.x,
+ textRect.y
+ + fm.getAscent());
+ else
+ BasicGraphicsUtils.drawString(g, text, 0, textRect.x,
+ textRect.y + fm.getAscent());
}
}
/**
* This method uninstalls the components for this {@link JMenuItem}.
- *
- * @param menuItem The {@link JMenuItem} to uninstall components for.
+ *
+ * @param menuItem
+ * The {@link JMenuItem} to uninstall components for.
*/
protected void uninstallComponents(JMenuItem menuItem)
{
@@ -676,8 +769,9 @@ public class BasicMenuItemUI extends MenuItemUI
* Uninstalls any keyboard actions.
*/
protected void uninstallKeyboardActions()
- {
- // FIXME: need to implement
+ {
+ SwingUtilities.replaceUIInputMap(menuItem,
+ JComponent.WHEN_IN_FOCUSED_WINDOW, null);
}
/**
@@ -688,15 +782,17 @@ public class BasicMenuItemUI extends MenuItemUI
menuItem.removeMouseListener(mouseInputListener);
menuItem.removeMenuDragMouseListener(menuDragMouseListener);
menuItem.removeMenuKeyListener(menuKeyListener);
+ menuItem.removeItemListener(itemListener);
menuItem.removePropertyChangeListener(propertyChangeListener);
}
/**
* Performs the opposite of installUI. Any properties or resources that need
- * to be cleaned up will be done now. It will also uninstall any listeners
- * it has. In addition, any properties of this UI will be nulled.
- *
- * @param c The {@link JComponent} that is having this UI uninstalled.
+ * to be cleaned up will be done now. It will also uninstall any listeners it
+ * has. In addition, any properties of this UI will be nulled.
+ *
+ * @param c
+ * The {@link JComponent} that is having this UI uninstalled.
*/
public void uninstallUI(JComponent c)
{
@@ -708,9 +804,11 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* This method calls paint.
- *
- * @param g The graphics context used to paint this menu item
- * @param c The menu item to paint
+ *
+ * @param g
+ * The graphics context used to paint this menu item
+ * @param c
+ * The menu item to paint
*/
public void update(Graphics g, JComponent c)
{
@@ -719,9 +817,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Return text representation of the specified accelerator
- *
- * @param accelerator Accelerator for which to return string representation
- *
+ *
+ * @param accelerator
+ * Accelerator for which to return string representation
* @return $String$ Text representation of the given accelerator
*/
private String getAcceleratorText(KeyStroke accelerator)
@@ -744,10 +842,11 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Calculates and return rectange in which accelerator should be displayed
- *
- * @param accelerator accelerator for which to return the display rectangle
- * @param fm The font metrics used to measure the text
- *
+ *
+ * @param accelerator
+ * accelerator for which to return the display rectangle
+ * @param fm
+ * The font metrics used to measure the text
* @return $Rectangle$ reactangle which will be used to display accelerator
*/
private Rectangle getAcceleratorRect(KeyStroke accelerator, FontMetrics fm)
@@ -759,12 +858,16 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* Paints accelerator inside menu item
- *
- * @param g The graphics context used to paint the border
- * @param menuItem Menu item for which to draw accelerator
- * @param acceleratorRect rectangle representing position
- * of the accelerator relative to the menu item
- * @param acceleratorText accelerator's text
+ *
+ * @param g
+ * The graphics context used to paint the border
+ * @param menuItem
+ * Menu item for which to draw accelerator
+ * @param acceleratorRect
+ * rectangle representing position of the accelerator relative to the
+ * menu item
+ * @param acceleratorText
+ * accelerator's text
*/
private void paintAccelerator(Graphics g, JMenuItem menuItem,
Rectangle acceleratorRect,
@@ -785,10 +888,9 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * This class handles mouse events occuring inside the menu item.
- * Most of the events are forwarded for processing to MenuSelectionManager
- * of the current menu hierarchy.
- *
+ * This class handles mouse events occuring inside the menu item. Most of the
+ * events are forwarded for processing to MenuSelectionManager of the current
+ * menu hierarchy.
*/
protected class MouseInputHandler implements MouseInputListener
{
@@ -797,13 +899,15 @@ public class BasicMenuItemUI extends MenuItemUI
*/
protected MouseInputHandler()
{
+ // Nothing to do here.
}
/**
- * This method is called when mouse is clicked on the menu item.
- * It forwards this event to MenuSelectionManager.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse is clicked on the menu item. It forwards
+ * this event to MenuSelectionManager.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseClicked(MouseEvent e)
{
@@ -812,10 +916,11 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * This method is called when mouse is dragged inside the menu item.
- * It forwards this event to MenuSelectionManager.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse is dragged inside the menu item. It
+ * forwards this event to MenuSelectionManager.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseDragged(MouseEvent e)
{
@@ -824,29 +929,31 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * This method is called when mouse enters menu item.
- * When this happens menu item is considered to be selected and selection path
- * in MenuSelectionManager is set. This event is also forwarded to MenuSelection
- * Manager for further processing.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse enters menu item. When this happens menu
+ * item is considered to be selected and selection path in
+ * MenuSelectionManager is set. This event is also forwarded to
+ * MenuSelection Manager for further processing.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseEntered(MouseEvent e)
{
Component source = (Component) e.getSource();
if (source.getParent() instanceof MenuElement)
{
- MenuSelectionManager manager = MenuSelectionManager.defaultManager();
- manager.setSelectedPath(getPath());
- manager.processMouseEvent(e);
+ MenuSelectionManager manager = MenuSelectionManager.defaultManager();
+ manager.setSelectedPath(getPath());
+ manager.processMouseEvent(e);
}
}
/**
- * This method is called when mouse exits menu item. The event is
- * forwarded to MenuSelectionManager for processing.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse exits menu item. The event is forwarded
+ * to MenuSelectionManager for processing.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseExited(MouseEvent e)
{
@@ -855,10 +962,11 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * This method is called when mouse is inside the menu item.
- * This event is forwarder to MenuSelectionManager for further processing.
- *
- * @param e A {@link MouseEvent}.
+ * This method is called when mouse is inside the menu item. This event is
+ * forwarder to MenuSelectionManager for further processing.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseMoved(MouseEvent e)
{
@@ -869,8 +977,9 @@ public class BasicMenuItemUI extends MenuItemUI
/**
* This method is called when mouse is pressed. This event is forwarded to
* MenuSelectionManager for further processing.
- *
- * @param e A {@link MouseEvent}.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mousePressed(MouseEvent e)
{
@@ -882,8 +991,9 @@ public class BasicMenuItemUI extends MenuItemUI
* This method is called when mouse is released. If the mouse is released
* inside this menuItem, then this menu item is considered to be chosen and
* the menu hierarchy should be closed.
- *
- * @param e A {@link MouseEvent}.
+ *
+ * @param e
+ * A {@link MouseEvent}.
*/
public void mouseReleased(MouseEvent e)
{
@@ -892,24 +1002,25 @@ public class BasicMenuItemUI extends MenuItemUI
if (e.getX() > 0 && e.getX() < size.width && e.getY() > 0
&& e.getY() < size.height)
{
- manager.clearSelectedPath();
- menuItem.doClick();
+ manager.clearSelectedPath();
+ menuItem.doClick();
}
else
- manager.processMouseEvent(e);
+ manager.processMouseEvent(e);
}
}
/**
* This class handles mouse dragged events.
*/
- protected class MenuDragMouseHandler implements MenuDragMouseListener
+ private class MenuDragMouseHandler implements MenuDragMouseListener
{
/**
* Tbis method is invoked when mouse is dragged over the menu item.
- *
- * @param e The MenuDragMouseEvent
+ *
+ * @param e
+ * The MenuDragMouseEvent
*/
public void menuDragMouseDragged(MenuDragMouseEvent e)
{
@@ -918,10 +1029,11 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * Tbis method is invoked when mouse enters the menu item while it is
- * being dragged.
- *
- * @param e The MenuDragMouseEvent
+ * Tbis method is invoked when mouse enters the menu item while it is being
+ * dragged.
+ *
+ * @param e
+ * The MenuDragMouseEvent
*/
public void menuDragMouseEntered(MenuDragMouseEvent e)
{
@@ -930,27 +1042,29 @@ public class BasicMenuItemUI extends MenuItemUI
}
/**
- * Tbis method is invoked when mouse exits the menu item while
- * it is being dragged
- *
- * @param e The MenuDragMouseEvent
+ * Tbis method is invoked when mouse exits the menu item while it is being
+ * dragged
+ *
+ * @param e the MenuDragMouseEvent
*/
public void menuDragMouseExited(MenuDragMouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
- * Tbis method is invoked when mouse was dragged and released
- * inside the menu item.
- *
- * @param e The MenuDragMouseEvent
+ * Tbis method is invoked when mouse was dragged and released inside the
+ * menu item.
+ *
+ * @param e
+ * The MenuDragMouseEvent
*/
public void menuDragMouseReleased(MenuDragMouseEvent e)
{
MenuElement[] path = e.getPath();
if (path[path.length - 1] instanceof JMenuItem)
- ((JMenuItem) path[path.length - 1]).doClick();
+ ((JMenuItem) path[path.length - 1]).doClick();
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
manager.clearSelectedPath();
@@ -961,50 +1075,63 @@ public class BasicMenuItemUI extends MenuItemUI
* This class handles key events occuring when menu item is visible on the
* screen.
*/
- protected class MenuKeyHandler implements MenuKeyListener
+ private class MenuKeyHandler implements MenuKeyListener
{
/**
* This method is invoked when key has been pressed
- *
- * @param e A {@link MenuKeyEvent}.
+ *
+ * @param e
+ * A {@link MenuKeyEvent}.
*/
public void menuKeyPressed(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
* This method is invoked when key has been pressed
- *
- * @param e A {@link MenuKeyEvent}.
+ *
+ * @param e
+ * A {@link MenuKeyEvent}.
*/
public void menuKeyReleased(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
- * This method is invoked when key has been typed
- * It handles the mnemonic key for the menu item.
- *
- * @param e A {@link MenuKeyEvent}.
+ * This method is invoked when key has been typed It handles the mnemonic
+ * key for the menu item.
+ *
+ * @param e
+ * A {@link MenuKeyEvent}.
*/
public void menuKeyTyped(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
}
-
+
/**
- * Helper class that listens for changes to the properties of the {@link
+ * Helper class that listens for item changes to the properties of the {@link
* JMenuItem}.
*/
- protected class PropertyChangeHandler implements PropertyChangeListener
+ private class ItemHandler implements ItemListener
{
/**
- * This method is called when one of the menu item's properties change.
+ * This method is called when one of the menu item changes.
*
- * @param evt A {@link PropertyChangeEvent}.
+ * @param evt A {@link ItemEvent}.
*/
- public void propertyChange(PropertyChangeEvent evt)
+ public void itemStateChanged(ItemEvent evt)
{
+ boolean state = false;
+ if (menuItem instanceof JCheckBoxMenuItem)
+ {
+ if (evt.getStateChange() == ItemEvent.SELECTED)
+ state = true;
+ ((JCheckBoxMenuItem) menuItem).setState(state);
+ }
menuItem.revalidate();
menuItem.repaint();
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java
index 30be592ee79..e638b68e1dc 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuUI.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
@@ -46,8 +47,8 @@ import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
+import javax.swing.LookAndFeel;
import javax.swing.MenuSelectionManager;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
@@ -92,7 +93,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
protected ChangeListener createChangeListener(JComponent c)
{
- return new ChangeHandler();
+ return new ChangeHandler((JMenu) c, this);
}
/**
@@ -180,12 +181,6 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public Dimension getMaximumSize(JComponent c)
{
- // If this menu is in a popup menu, treat it like a regular JMenuItem
- if (!((JMenu)c).isTopLevelMenu())
- {
- JMenuItem menuItem = new JMenuItem(((JMenu)c).getText(), ((JMenu)c).getIcon());
- return menuItem.getMaximumSize();
- }
return c.getPreferredSize();
}
@@ -205,21 +200,17 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- menuItem.setBackground(defaults.getColor("Menu.background"));
- menuItem.setBorder(defaults.getBorder("Menu.border"));
- menuItem.setFont(defaults.getFont("Menu.font"));
- menuItem.setForeground(defaults.getColor("Menu.foreground"));
- menuItem.setMargin(defaults.getInsets("Menu.margin"));
- acceleratorFont = defaults.getFont("Menu.acceleratorFont");
- acceleratorForeground = defaults.getColor("Menu.acceleratorForeground");
- acceleratorSelectionForeground = defaults.getColor("Menu.acceleratorSelectionForeground");
- selectionBackground = defaults.getColor("Menu.selectionBackground");
- selectionForeground = defaults.getColor("Menu.selectionForeground");
- arrowIcon = defaults.getIcon("Menu.arrowIcon");
- oldBorderPainted = defaults.getBoolean("Menu.borderPainted");
- menuItem.setOpaque(true);
+ LookAndFeel.installBorder(menuItem, "Menu.border");
+ LookAndFeel.installColorsAndFont(menuItem, "Menu.background",
+ "Menu.foreground", "Menu.font");
+ menuItem.setMargin(UIManager.getInsets("Menu.margin"));
+ acceleratorFont = UIManager.getFont("Menu.acceleratorFont");
+ acceleratorForeground = UIManager.getColor("Menu.acceleratorForeground");
+ acceleratorSelectionForeground = UIManager.getColor("Menu.acceleratorSelectionForeground");
+ selectionBackground = UIManager.getColor("Menu.selectionBackground");
+ selectionForeground = UIManager.getColor("Menu.selectionForeground");
+ arrowIcon = UIManager.getIcon("Menu.arrowIcon");
+ oldBorderPainted = UIManager.getBoolean("Menu.borderPainted");
}
/**
@@ -245,6 +236,7 @@ public class BasicMenuUI extends BasicMenuItemUI
protected void setupPostTimer(JMenu menu)
{
+ // TODO: Implement this properly.
}
/**
@@ -356,6 +348,7 @@ public class BasicMenuUI extends BasicMenuItemUI
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
public void mousePressed(MouseEvent e)
@@ -421,10 +414,13 @@ public class BasicMenuUI extends BasicMenuItemUI
public void menuDeselected(MenuEvent e)
{
JMenu menu = (JMenu) menuItem;
- if (menu.isTopLevelMenu())
- ((JMenuBar) menu.getParent()).getSelectionModel().clearSelection();
- else
- ((JPopupMenu) menu.getParent()).getSelectionModel().clearSelection();
+ if (menu.getParent() != null)
+ {
+ if (menu.isTopLevelMenu())
+ ((JMenuBar) menu.getParent()).getSelectionModel().clearSelection();
+ else
+ ((JPopupMenu) menu.getParent()).getSelectionModel().clearSelection();
+ }
}
/**
@@ -456,6 +452,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void propertyChange(PropertyChangeEvent e)
{
+ // TODO: Implement this properly.
}
}
@@ -464,9 +461,40 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public class ChangeHandler implements ChangeListener
{
+ /**
+ * Not used.
+ */
+ public boolean isSelected;
+
+ /**
+ * Not used.
+ */
+ public JMenu menu;
+
+ /**
+ * Not used.
+ */
+ public BasicMenuUI ui;
+
+ /**
+ * Not used.
+ */
+ public Component wasFocused;
+
+ /**
+ * Not used.
+ */
+ public ChangeHandler(JMenu m, BasicMenuUI ui)
+ {
+ // Not used.
+ }
+
+ /**
+ * Not used.
+ */
public void stateChanged(ChangeEvent e)
{
- // FIXME: It seems that this class is not used anywhere
+ // Not used.
}
}
@@ -506,6 +534,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuDragMouseExited(MenuDragMouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -516,6 +545,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuDragMouseReleased(MenuDragMouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
}
@@ -532,6 +562,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuKeyPressed(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -541,6 +572,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuKeyReleased(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -551,6 +583,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/
public void menuKeyTyped(MenuKeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
index c9f623259ba..6b37d315fa8 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java
@@ -70,8 +70,8 @@ import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
@@ -141,13 +141,14 @@ public class BasicOptionPaneUI extends OptionPaneUI
optionPane);
if (inf != null)
{
- try
- {
- inf.setClosed(true);
- }
- catch (PropertyVetoException pve)
- {
- }
+ try
+ {
+ inf.setClosed(true);
+ }
+ catch (PropertyVetoException pve)
+ {
+ // We do nothing if attempt has been vetoed.
+ }
}
}
}
@@ -405,16 +406,30 @@ public class BasicOptionPaneUI extends OptionPaneUI
|| e.getPropertyName().equals(JOptionPane.WANTS_INPUT_PROPERTY)
|| e.getPropertyName().equals(JOptionPane.SELECTION_VALUES_PROPERTY))
{
- optionPane.removeAll();
- messageAreaContainer = createMessageArea();
- optionPane.add(messageAreaContainer);
- optionPane.add(buttonContainer);
+ optionPane.remove(messageAreaContainer);
+ messageAreaContainer = createMessageArea();
+ optionPane.add(messageAreaContainer);
+ Container newButtons = createButtonArea();
+ optionPane.remove(buttonContainer);
+ optionPane.add(newButtons);
+ buttonContainer = newButtons;
+ optionPane.add(buttonContainer);
}
optionPane.invalidate();
optionPane.repaint();
}
}
+ /**
+ * The minimum width for JOptionPanes.
+ */
+ public static final int MinimumWidth = 262;
+
+ /**
+ * The minimum height for JOptionPanes.
+ */
+ public static final int MinimumHeight = 90;
+
/** Whether the JOptionPane contains custom components. */
protected boolean hasCustomComponents = false;
@@ -433,12 +448,6 @@ public class BasicOptionPaneUI extends OptionPaneUI
/** The component that receives input when the JOptionPane needs it. */
protected JComponent inputComponent;
- /** The minimum height of the JOptionPane. */
- public static int minimumHeight;
-
- /** The minimum width of the JOptionPane. */
- public static int minimumWidth;
-
/** The minimum dimensions of the JOptionPane. */
protected Dimension minimumSize;
@@ -518,6 +527,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ // Nothing to do here.
}
}
@@ -637,6 +647,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
*/
public BasicOptionPaneUI()
{
+ // Nothing to do here.
}
/**
@@ -860,10 +871,10 @@ public class BasicOptionPaneUI extends OptionPaneUI
addIcon(messageArea);
JPanel rightSide = new JPanel();
- rightSide.setBorder(BorderFactory.createEmptyBorder(0, 11, 17, 0));
+ rightSide.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
rightSide.setLayout(new GridBagLayout());
GridBagConstraints con = createConstraints();
-
+
addMessageComponents(rightSide, con, getMessage(),
getMaxCharactersPerLineCount(), false);
@@ -886,7 +897,7 @@ public class BasicOptionPaneUI extends OptionPaneUI
}
}
- messageArea.add(rightSide, BorderLayout.EAST);
+ messageArea.add(rightSide, BorderLayout.CENTER);
return messageArea;
}
@@ -944,8 +955,14 @@ public class BasicOptionPaneUI extends OptionPaneUI
case JOptionPane.YES_NO_CANCEL_OPTION:
return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING };
case JOptionPane.OK_CANCEL_OPTION:
- case JOptionPane.DEFAULT_OPTION:
return new Object[] { OK_STRING, CANCEL_STRING };
+ case JOptionPane.DEFAULT_OPTION:
+ return (optionPane.getWantsInput() ) ?
+ new Object[] { OK_STRING, CANCEL_STRING } :
+ ( optionPane.getMessageType() == JOptionPane.QUESTION_MESSAGE ) ?
+ new Object[] { YES_STRING, NO_STRING, CANCEL_STRING } :
+ // ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, PLAIN_MESSAGE
+ new Object[] { OK_STRING };
}
return null;
}
@@ -1142,21 +1159,17 @@ public class BasicOptionPaneUI extends OptionPaneUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- optionPane.setFont(defaults.getFont("OptionPane.font"));
- optionPane.setBackground(defaults.getColor("OptionPane.background"));
- optionPane.setForeground(defaults.getColor("OptionPane.foreground"));
- optionPane.setBorder(defaults.getBorder("OptionPane.border"));
+ LookAndFeel.installColorsAndFont(optionPane, "OptionPane.background",
+ "OptionPane.foreground",
+ "OptionPane.font");
+ LookAndFeel.installBorder(optionPane, "OptionPane.border");
optionPane.setOpaque(true);
- messageBorder = defaults.getBorder("OptionPane.messageAreaBorder");
- messageForeground = defaults.getColor("OptionPane.messageForeground");
- buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder");
+ messageBorder = UIManager.getBorder("OptionPane.messageAreaBorder");
+ messageForeground = UIManager.getColor("OptionPane.messageForeground");
+ buttonBorder = UIManager.getBorder("OptionPane.buttonAreaBorder");
- minimumSize = defaults.getDimension("OptionPane.minimumSize");
- minimumWidth = minimumSize.width;
- minimumHeight = minimumSize.height;
+ minimumSize = UIManager.getDimension("OptionPane.minimumSize");
// FIXME: Image icons don't seem to work properly right now.
// Once they do, replace the synthetic icons with these ones.
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java
index b715c57b360..783cec473bc 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicPanelUI.java
@@ -40,8 +40,7 @@ package javax.swing.plaf.basic;
import javax.swing.JComponent;
import javax.swing.JPanel;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.LookAndFeel;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.PanelUI;
@@ -64,8 +63,29 @@ public class BasicPanelUI extends PanelUI
public void installDefaults(JPanel p)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- p.setBackground(defaults.getColor("Panel.background"));
+ LookAndFeel.installColorsAndFont(p, "Panel.background", "Panel.foreground",
+ "Panel.font");
p.setOpaque(true);
}
+
+ /**
+ * Uninstalls this UI from the JPanel.
+ *
+ * @param c the JPanel from which to uninstall this UI
+ */
+ public void uninstallUI(JComponent c)
+ {
+ uninstallDefaults((JPanel) c);
+ }
+
+ /**
+ * Uninstalls the UI defaults that have been install through
+ * {@link #installDefaults}.
+ *
+ * @param p the panel from which to uninstall the UI defaults
+ */
+ protected void uninstallDefaults(JPanel p)
+ {
+ // Nothing to do here.
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java
index 044027b0b4a..76dcfc43559 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicPasswordFieldUI.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
import javax.swing.JComponent;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
import javax.swing.text.PasswordView;
@@ -48,6 +49,7 @@ public class BasicPasswordFieldUI extends BasicTextFieldUI
{
public BasicPasswordFieldUI()
{
+ // Nothing to do here.
}
public View create(Element elem)
@@ -60,6 +62,11 @@ public class BasicPasswordFieldUI extends BasicTextFieldUI
return new BasicPasswordFieldUI();
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "PasswordField"
+ */
protected String getPropertyPrefix()
{
return "PasswordField";
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java
index 247117bc983..e15a17bab28 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicPopupMenuUI.java
@@ -53,12 +53,11 @@ import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
+import javax.swing.LookAndFeel;
import javax.swing.MenuElement;
import javax.swing.MenuSelectionManager;
import javax.swing.RootPaneContainer;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
import javax.swing.event.MouseInputListener;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
@@ -131,12 +130,9 @@ public class BasicPopupMenuUI extends PopupMenuUI
*/
public void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- popupMenu.setBackground(defaults.getColor("PopupMenu.background"));
- popupMenu.setBorder(defaults.getBorder("PopupMenu.border"));
- popupMenu.setFont(defaults.getFont("PopupMenu.font"));
- popupMenu.setForeground(defaults.getColor("PopupMenu.foreground"));
+ LookAndFeel.installColorsAndFont(popupMenu, "PopupMenu.background",
+ "PopupMenu.foreground", "PopupMenu.font");
+ LookAndFeel.installBorder(popupMenu, "PopupMenu.border");
popupMenu.setOpaque(true);
}
@@ -277,23 +273,26 @@ public class BasicPopupMenuUI extends PopupMenuUI
RootPaneContainer rootContainer = (RootPaneContainer) SwingUtilities
.getRoot(invoker);
- ((Container) rootContainer).removeComponentListener(topWindowListener);
-
- // If this popup menu is the last popup menu visible on the screen, then
- // stop interrupting mouse events in the glass pane before hiding this
- // last popup menu.
- boolean topLevelMenu = (popupMenu.getInvoker() instanceof JMenu)
- && ((JMenu) popupMenu.getInvoker())
- .isTopLevelMenu();
-
- if (topLevelMenu || ! (popupMenu.getInvoker() instanceof MenuElement))
+ if (rootContainer != null)
{
- // set glass pane not to interrupt mouse events and remove
- // mouseInputListener
- Container glassPane = (Container) rootContainer.getGlassPane();
- glassPane.setVisible(false);
- glassPane.removeMouseListener(mouseInputListener);
- mouseInputListener = null;
+ ((Container) rootContainer).removeComponentListener(topWindowListener);
+
+ // If this popup menu is the last popup menu visible on the screen,
+ // then
+ // stop interrupting mouse events in the glass pane before hiding this
+ // last popup menu.
+ boolean topLevelMenu = (popupMenu.getInvoker() instanceof JMenu)
+ && ((JMenu) popupMenu.getInvoker()).isTopLevelMenu();
+
+ if (topLevelMenu || !(popupMenu.getInvoker() instanceof MenuElement))
+ {
+ // set glass pane not to interrupt mouse events and remove
+ // mouseInputListener
+ Container glassPane = (Container) rootContainer.getGlassPane();
+ glassPane.setVisible(false);
+ glassPane.removeMouseListener(mouseInputListener);
+ mouseInputListener = null;
+ }
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java
index d00628f53d4..d3674664d4c 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java
@@ -46,21 +46,24 @@ import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.font.FontRenderContext;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Rectangle2D;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JProgressBar;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.AncestorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
@@ -110,14 +113,56 @@ public class BasicProgressBarUI extends ProgressBarUI
{
// Only need to listen for indeterminate changes.
// All other things are done on a repaint.
- if (e.getPropertyName().equals("inderterminate"))
- if (((Boolean) e.getNewValue()).booleanValue())
- startAnimationTimer();
- else
- stopAnimationTimer();
- else
- progressBar.repaint();
+ if (e.getPropertyName().equals("indeterminate"))
+ if (((Boolean) e.getNewValue()).booleanValue()
+ && progressBar.isShowing())
+ startAnimationTimer();
+ else
+ stopAnimationTimer();
+ }
+ }
+
+ /**
+ * Receives notification when the progressbar is becoming visible or
+ * invisible and starts/stops the animation timer accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class AncestorHandler implements AncestorListener
+ {
+
+ /**
+ * Receives notification when the progressbar is becoming visible. This
+ * starts the animation timer if the progressbar is indeterminate.
+ *
+ * @param event the ancestor event
+ */
+ public void ancestorAdded(AncestorEvent event)
+ {
+ if (progressBar.isIndeterminate())
+ startAnimationTimer();
+ }
+
+ /**
+ * Receives notification when the progressbar is becoming invisible. This
+ * stops the animation timer if the progressbar is indeterminate.
+ *
+ * @param event the ancestor event
+ */
+ public void ancestorRemoved(AncestorEvent event)
+ {
+ stopAnimationTimer();
+ }
+
+ /**
+ * Receives notification when an ancestor has been moved. We don't need to
+ * do anything here.
+ */
+ public void ancestorMoved(AncestorEvent event)
+ {
+ // Nothing to do here.
}
+
}
/**
@@ -141,6 +186,37 @@ public class BasicProgressBarUI extends ProgressBarUI
}
}
+ /**
+ * Receives notification when the size of the progress bar changes and
+ * invalidates the layout information for the box calculation in
+ * {@link BasicProgressBarUI#getBox(Rectangle)}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class ComponentHandler extends ComponentAdapter
+ {
+ /**
+ * Receives notification when the size of the progress bar changes and
+ * invalidates the layout information for the box calculation in
+ * {@link BasicProgressBarUI#getBox}.
+ *
+ * @param e the component event
+ */
+ public void componentResized(ComponentEvent e)
+ {
+ boxDependent = -1;
+ boxIndependent = -1;
+ incr = -1;
+ }
+ }
+
+ /**
+ * Holds the value of the bouncing box that is returned by {@link #getBox}.
+ *
+ * @since 1.5
+ */
+ protected Rectangle boxRect;
+
/** The timer used to move the bouncing box. */
private transient Timer animationTimer;
@@ -172,6 +248,27 @@ public class BasicProgressBarUI extends ProgressBarUI
/** The progressBar for this UI. */
protected JProgressBar progressBar;
+
+ /**
+ * The size of the box returned by {@link #getBox} in the orientation
+ * direction of the progress bar. This is package private to avoid accessor
+ * method.
+ */
+ transient double boxDependent = - 1;
+
+ /**
+ * The size of the box returned by {@link #getBox} against the orientation
+ * direction of the progress bar. This is package private to avoid accessor
+ * method.
+ */
+ transient int boxIndependent = - 1;
+
+ /**
+ * The increment for box animation. This is package private to avoid accessor
+ * method.
+ */
+ transient double incr = -1;
+
/** The length of the cell. The cell is the painted part. */
private transient int cellLength;
@@ -185,6 +282,18 @@ public class BasicProgressBarUI extends ProgressBarUI
private transient Color selectionForeground;
/**
+ * Listens for notification when the component becomes showing and
+ * starts/stops the animation timer.
+ */
+ private AncestorListener ancestorListener;
+
+ /**
+ * Listens for resize events on the progress bar and invalidates some
+ * layout info.
+ */
+ private ComponentListener componentListener;
+
+ /**
* Creates a new BasicProgressBarUI object.
*/
public BasicProgressBarUI()
@@ -248,48 +357,49 @@ public class BasicProgressBarUI extends ProgressBarUI
{
if (!progressBar.isIndeterminate())
return null;
- //numFrames has to be an even number as defined by spec.
- int iterations = numFrames / 2 + 1;
+ if (r == null)
+ r = new Rectangle();
- double boxDependent;
- double boxIndependent;
+ Rectangle vr = new Rectangle();
+ SwingUtilities.calculateInnerArea(progressBar, vr);
- if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
- {
- Dimension dims = getPreferredInnerHorizontal();
- boxDependent = (double) dims.width / iterations;
- boxIndependent = dims.height;
- }
- else
+ // Recalculate the metrics only when size of the progressbar has changed.
+ if (incr == -1 || boxDependent == -1 || boxIndependent == -1)
{
- Dimension dims = getPreferredInnerVertical();
- boxDependent = (double) dims.height / iterations;
- boxIndependent = dims.width;
+ //numFrames has to be an even number as defined by spec.
+ int iterations = numFrames / 2;
+ if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
+ {
+ boxDependent = vr.width / 6.;
+ incr = ((double) (vr.width - boxDependent)) / (double) iterations;
+ boxIndependent = vr.height;
+ }
+ else
+ {
+ boxDependent = vr.height / 6.;
+ incr = ((double) (vr.height - boxDependent)) / (double) iterations;
+ boxIndependent = vr.width;
+ }
}
- Rectangle vr = new Rectangle();
- SwingUtilities.calculateInnerArea(progressBar, vr);
-
int index = getAnimationIndex();
- if (animationIndex > (numFrames + 1) / 2)
+ if (animationIndex > (numFrames) / 2)
index = numFrames - getAnimationIndex();
if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
{
- r.x = vr.x + (int) (index * boxDependent);
- r.y = vr.y;
- r.width = (int) boxDependent;
- r.height = (int) boxIndependent;
+ r.x = vr.x + (int) (incr * index);
+ r.y = vr.y;
+ r.width = (int) boxDependent;
+ r.height = (int) boxIndependent;
}
else
{
- index++;
- r.x = vr.x;
- r.y = vr.height - (int) (index * boxDependent) + vr.y;
- r.width = (int) boxIndependent;
- r.height = (int) boxDependent;
+ r.x = vr.x;
+ r.y = vr.height - (int) (incr * index) + vr.y - (int) boxDependent;
+ r.width = (int) boxIndependent;
+ r.height = (int) boxDependent;
}
-
return r;
}
@@ -324,7 +434,22 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
public Dimension getMaximumSize(JComponent c)
{
- return getPreferredSize(c);
+ Insets insets = c.getInsets();
+ Dimension ret;
+ int orientation = progressBar.getOrientation();
+ if (orientation == JProgressBar.VERTICAL)
+ {
+ ret = getPreferredInnerVertical();
+ ret.height = Short.MAX_VALUE;
+ ret.width += insets.left + insets.right;
+ }
+ else
+ {
+ ret = getPreferredInnerHorizontal();
+ ret.width = Short.MAX_VALUE;
+ ret.height += insets.top + insets.bottom;
+ }
+ return ret;
}
/**
@@ -338,7 +463,22 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
public Dimension getMinimumSize(JComponent c)
{
- return getPreferredSize(c);
+ Insets insets = c.getInsets();
+ Dimension ret;
+ int orientation = progressBar.getOrientation();
+ if (orientation == JProgressBar.VERTICAL)
+ {
+ ret = getPreferredInnerVertical();
+ ret.height = 10;
+ ret.width += insets.left + insets.right;
+ }
+ else
+ {
+ ret = getPreferredInnerHorizontal();
+ ret.width = 10;
+ ret.height += insets.top + insets.bottom;
+ }
+ return ret;
}
/**
@@ -351,11 +491,22 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
protected Dimension getPreferredInnerHorizontal()
{
- Rectangle vr = new Rectangle();
+ Font font = progressBar.getFont();
+ FontMetrics fm = progressBar.getFontMetrics(font);
- SwingUtilities.calculateInnerArea(progressBar, vr);
+ int stringWidth = 0;
+ String str = progressBar.getString();
+ if (str != null)
+ stringWidth = fm.stringWidth(progressBar.getString());
+ Insets i = progressBar.getInsets();
+ int prefWidth = Math.max(200 - i.left - i.right, stringWidth);
+
+ int stringHeight = 0;
+ if (str != null)
+ stringHeight = fm.getHeight();
+ int prefHeight = Math.max(16 - i.top - i.bottom, stringHeight);
- return new Dimension(vr.width, vr.height);
+ return new Dimension(prefWidth, prefHeight);
}
/**
@@ -368,11 +519,22 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
protected Dimension getPreferredInnerVertical()
{
- Rectangle vr = new Rectangle();
+ Font font = progressBar.getFont();
+ FontMetrics fm = progressBar.getFontMetrics(font);
- SwingUtilities.calculateInnerArea(progressBar, vr);
+ int stringWidth = 0;
+ String str = progressBar.getString();
+ if (str != null)
+ stringWidth = fm.stringWidth(progressBar.getString());
+ Insets i = progressBar.getInsets();
+ int prefHeight = Math.max(200 - i.left - i.right, stringWidth);
- return new Dimension(vr.width, vr.height);
+ int stringHeight = 0;
+ if (str != null)
+ stringHeight = fm.getHeight();
+ int prefWidth = Math.max(16 - i.top - i.bottom, stringHeight);
+
+ return new Dimension(prefWidth, prefHeight);
}
/**
@@ -386,36 +548,16 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
public Dimension getPreferredSize(JComponent c)
{
- // The only thing we need to worry about is
- // the text size.
Insets insets = c.getInsets();
-
- // make a fontrenderer context so that we can make assumptions about
- // the string bounds
- FontRenderContext ctx = new FontRenderContext(new AffineTransform(),
- false, false);
- Rectangle2D bounds = c.getFont().getStringBounds(progressBar.getString(),
- ctx);
- int textW = (int) bounds.getWidth();
- int textH = (int) bounds.getHeight();
-
- if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
- {
- if (textH < 20)
- textH = 20;
- if (textW < 200)
- textW = 200;
- }
+ Dimension ret;
+ int orientation = progressBar.getOrientation();
+ if (orientation == JProgressBar.VERTICAL)
+ ret = getPreferredInnerVertical();
else
- {
- if (textH < 200)
- textH = 200;
- if (textW < 20)
- textW = 20;
- }
- textW += insets.left + insets.right;
- textH += insets.top + insets.bottom;
- return new Dimension(textW, textH);
+ ret = getPreferredInnerHorizontal();
+ ret.width += insets.left + insets.right;
+ ret.height += insets.top + insets.bottom;
+ return ret;
}
/**
@@ -514,66 +656,22 @@ public class BasicProgressBarUI extends ProgressBarUI
int min = progressBar.getMinimum();
int value = progressBar.getValue();
- Rectangle vr = new Rectangle();
- SwingUtilities.calculateInnerArea(c, vr);
-
- Rectangle or = c.getBounds();
-
+ Rectangle vr = SwingUtilities.calculateInnerArea(c, new Rectangle());
+ Rectangle or = progressBar.getBounds();
Insets insets = c.getInsets();
int amountFull = getAmountFull(insets, or.width, or.height);
- g.setColor(c.getBackground());
- g.fill3DRect(vr.x, vr.y, vr.width, vr.height, false);
-
- if (max != min && len != 0 && value > min)
- {
- int iterations = value / (space + len);
-
if (progressBar.getOrientation() == JProgressBar.HORIZONTAL)
{
- double spaceInUnits = space * (double) vr.width / (max - min);
- double lenInUnits = len * (double) vr.width / (max - min);
- double currX = vr.x;
-
g.setColor(c.getForeground());
- g.fill3DRect(vr.x, vr.y, amountFull, vr.height, true);
-
- g.setColor(c.getBackground());
- if (spaceInUnits != 0)
- {
- for (int i = 0; i < iterations; i++)
- {
- currX += lenInUnits;
- g.fill3DRect((int) currX, vr.y, (int) spaceInUnits,
- vr.height, true);
- currX += spaceInUnits;
- }
- }
+ g.fillRect(vr.x, vr.y, amountFull, vr.height);
}
else
{
- double currY = vr.y;
- double spaceInUnits = space * (double) vr.height / (max - min);
- double lenInUnits = len * (double) vr.height / (max - min);
-
g.setColor(c.getForeground());
- g.fill3DRect(vr.x, vr.y + vr.height - amountFull, vr.width,
- amountFull, true);
-
- g.setColor(c.getBackground());
-
- if (spaceInUnits != 0)
- {
- for (int i = 0; i < iterations; i++)
- {
- currY -= lenInUnits + spaceInUnits;
- g.fill3DRect(vr.x, (int) currY, vr.width,
- (int) spaceInUnits, true);
- }
- }
+ g.fillRect(vr.x, vr.y + vr.height - amountFull, vr.width, amountFull);
}
- }
if (progressBar.isStringPainted() && !progressBar.getString().equals(""))
paintString(g, 0, 0, or.width, or.height, amountFull, insets);
@@ -599,13 +697,12 @@ public class BasicProgressBarUI extends ProgressBarUI
SwingUtilities.calculateInnerArea(c, vr);
g.setColor(c.getBackground());
- g.fill3DRect(vr.x, vr.y, vr.width, vr.height, false);
+ g.fillRect(vr.x, vr.y, vr.width, vr.height);
- Rectangle box = new Rectangle();
- getBox(box);
+ boxRect = getBox(boxRect);
g.setColor(c.getForeground());
- g.fill3DRect(box.x, box.y, box.width, box.height, true);
+ g.fillRect(boxRect.x, boxRect.y, boxRect.width, boxRect.height);
if (progressBar.isStringPainted() && !progressBar.getString().equals(""))
paintString(g, 0, 0, or.width, or.height,
@@ -628,23 +725,34 @@ public class BasicProgressBarUI extends ProgressBarUI
protected void paintString(Graphics g, int x, int y, int width, int height,
int amountFull, Insets b)
{
+ // FIXME: We do not support vertical text painting because Java2D is needed
+ // for this.
+ if (progressBar.getOrientation() == JProgressBar.VERTICAL)
+ return;
+
// We want to place in the exact center of the bar.
Point placement = getStringPlacement(g, progressBar.getString(),
x + b.left, y + b.top,
width - b.left - b.right,
height - b.top - b.bottom);
- Color saved = g.getColor();
-
- // FIXME: The Color of the text should use selectionForeground and selectionBackground
- // but that can't be done right now, so we'll use white in the mean time.
- g.setColor(Color.WHITE);
+ Color savedColor = g.getColor();
+ Shape savedClip = g.getClip();
FontMetrics fm = g.getFontMetrics(progressBar.getFont());
+ int full = getAmountFull(b, width, height);
+ String str = progressBar.getString();
- g.drawString(progressBar.getString(), placement.x,
- placement.y + fm.getAscent());
-
- g.setColor(saved);
+ // We draw this string two times with different clips so that the text
+ // over the filled area is painted with selectionForeground and over
+ // the clear area with selectionBackground.
+ g.setColor(getSelectionForeground());
+ g.setClip(0, 0, full + b.left, height);
+ g.drawString(str, placement.x, placement.y + fm.getAscent());
+ g.setColor(getSelectionBackground());
+ g.setClip(full + b.left, 0, width - full, height);
+ g.drawString(str, placement.x, placement.y + fm.getAscent());
+ g.setClip(savedClip);
+ g.setColor(savedColor);
}
/**
@@ -712,21 +820,19 @@ public class BasicProgressBarUI extends ProgressBarUI
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- progressBar.setFont(defaults.getFont("ProgressBar.font"));
- progressBar.setForeground(defaults.getColor("ProgressBar.foreground"));
- progressBar.setBackground(defaults.getColor("ProgressBar.background"));
- progressBar.setBorder(defaults.getBorder("ProgressBar.border"));
+ LookAndFeel.installColorsAndFont(progressBar, "ProgressBar.background",
+ "ProgressBar.foreground",
+ "ProgressBar.font");
+ LookAndFeel.installBorder(progressBar, "ProgressBar.border");
progressBar.setOpaque(true);
- selectionForeground = defaults.getColor("ProgressBar.selectionForeground");
- selectionBackground = defaults.getColor("ProgressBar.selectionBackground");
- cellLength = defaults.getInt("ProgressBar.cellLength");
- cellSpacing = defaults.getInt("ProgressBar.cellSpacing");
+ selectionForeground = UIManager.getColor("ProgressBar.selectionForeground");
+ selectionBackground = UIManager.getColor("ProgressBar.selectionBackground");
+ cellLength = UIManager.getInt("ProgressBar.cellLength");
+ cellSpacing = UIManager.getInt("ProgressBar.cellSpacing");
- int repaintInterval = defaults.getInt("ProgressBar.repaintInterval");
- int cycleTime = defaults.getInt("ProgressBar.cycleTime");
+ int repaintInterval = UIManager.getInt("ProgressBar.repaintInterval");
+ int cycleTime = UIManager.getInt("ProgressBar.cycleTime");
if (cycleTime % repaintInterval != 0
&& (cycleTime / repaintInterval) % 2 != 0)
@@ -768,6 +874,12 @@ public class BasicProgressBarUI extends ProgressBarUI
progressBar.addChangeListener(changeListener);
progressBar.addPropertyChangeListener(propertyListener);
animationTimer.addActionListener(animation);
+
+ ancestorListener = new AncestorHandler();
+ progressBar.addAncestorListener(ancestorListener);
+
+ componentListener = new ComponentHandler();
+ progressBar.addComponentListener(componentListener);
}
/**
@@ -783,6 +895,14 @@ public class BasicProgressBarUI extends ProgressBarUI
changeListener = null;
propertyListener = null;
animation = null;
+
+ if (ancestorListener != null)
+ progressBar.removeAncestorListener(ancestorListener);
+ ancestorListener = null;
+
+ if (componentListener != null)
+ progressBar.removeComponentListener(componentListener);
+ componentListener = null;
}
/**
@@ -806,6 +926,8 @@ public class BasicProgressBarUI extends ProgressBarUI
installDefaults();
installListeners();
}
+ if (progressBar.isIndeterminate())
+ startAnimationTimer();
}
/**
@@ -824,4 +946,5 @@ public class BasicProgressBarUI extends ProgressBarUI
animationTimer = null;
progressBar = null;
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
index fa74a008bae..8af5ff7f95c 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonMenuItemUI.java
@@ -59,8 +59,6 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
public BasicRadioButtonMenuItemUI()
{
super();
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- checkIcon = defaults.getIcon("RadioButtonMenuItem.checkIcon");
}
/**
@@ -98,5 +96,7 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
MenuElement[] path,
MenuSelectionManager manager)
{
+ // TODO: May not be implemented properly.
+ item.processMouseEvent(e, path, manager);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
index fbd21241a0d..66e53803722 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicRadioButtonUI.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
+import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;
@@ -46,7 +48,6 @@ import javax.swing.AbstractButton;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
@@ -93,6 +94,10 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
b.setIcon(icon);
if (b.getSelectedIcon() == null)
b.setSelectedIcon(icon);
+ if (b.getDisabledIcon() == null)
+ b.setDisabledIcon(icon);
+ if (b.getDisabledSelectedIcon() == null)
+ b.setDisabledSelectedIcon(icon);
}
/**
@@ -116,8 +121,7 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
*/
public Icon getDefaultIcon()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- return defaults.getIcon(getPropertyPrefix() + "icon");
+ return UIManager.getIcon(getPropertyPrefix() + "icon");
}
/**
@@ -139,10 +143,14 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
g.setFont(f);
Icon currentIcon = null;
- if (b.isSelected())
+ if (b.isSelected() && b.isEnabled())
currentIcon = b.getSelectedIcon();
- else
+ else if (!b.isSelected() && b.isEnabled())
currentIcon = b.getIcon();
+ else if (b.isSelected() && !b.isEnabled())
+ currentIcon = b.getDisabledSelectedIcon();
+ else // (!b.isSelected() && !b.isEnabled())
+ currentIcon = b.getDisabledIcon();
SwingUtilities.calculateInnerArea(b, vr);
String text = SwingUtilities.layoutCompoundLabel
@@ -157,6 +165,25 @@ public class BasicRadioButtonUI extends BasicToggleButtonUI
}
if (text != null)
paintText(g, b, tr, text);
- paintFocus(g, b, vr, tr, ir);
+ // TODO: Figure out what is the size parameter?
+ if (b.hasFocus() && b.isFocusPainted() && b.isEnabled())
+ paintFocus(g, tr, null);
+ }
+
+ /**
+ * Paints the focus indicator for JRadioButtons.
+ *
+ * @param g the graphics context
+ * @param tr the rectangle for the text label
+ * @param size the size (??)
+ */
+ // TODO: Figure out what for is the size parameter.
+ protected void paintFocus(Graphics g, Rectangle tr, Dimension size)
+ {
+ Color focusColor = UIManager.getColor(getPropertyPrefix() + ".focus");
+ Color saved = g.getColor();
+ g.setColor(focusColor);
+ g.drawRect(tr.x, tr.y, tr.width, tr.height);
+ g.setColor(saved);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java
index d97f7baea67..2a698e8a162 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java
@@ -42,6 +42,7 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
+import javax.swing.JRootPane;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.RootPaneUI;
@@ -56,11 +57,127 @@ public class BasicRootPaneUI extends RootPaneUI
public void installUI(JComponent c)
{
- c.setBackground(UIManager.getColor("control"));
super.installUI(c);
+ if (c instanceof JRootPane)
+ {
+ JRootPane rp = (JRootPane) c;
+ installDefaults(rp);
+ installComponents(rp);
+ installListeners(rp);
+ installKeyboardActions(rp);
+ }
+ }
+
+ /**
+ * Installs the look and feel defaults for JRootPane.
+ *
+ * @param rp the root pane to install the defaults to
+ */
+ protected void installDefaults(JRootPane rp)
+ {
+ // Is this ok?
+ rp.setBackground(UIManager.getColor("control"));
+ }
+
+ /**
+ * Installs additional look and feel components to the root pane.
+ *
+ * @param rp the root pane to install the components to
+ */
+ protected void installComponents(JRootPane rp)
+ {
+ // All components are initialized in the JRootPane constructor, and since
+ // the createXXXPane methods are protected, I see no reasonable way,
+ // and no need to initialize them here. This method is here anyway
+ // for compatibility and to provide the necessary hooks to subclasses.
+ }
+
+ /**
+ * Installs any look and feel specific listeners on the root pane.
+ *
+ * @param rp the root pane to install the listeners to
+ */
+ protected void installListeners(JRootPane rp)
+ {
+ rp.addPropertyChangeListener(this);
+ }
+
+ /**
+ * Installs look and feel keyboard actions on the root pane.
+ *
+ * @param rp the root pane to install the keyboard actions to
+ */
+ protected void installKeyboardActions(JRootPane rp)
+ {
+ // We currently do not install any keyboard actions here.
+ // This method is here anyway for compatibility and to provide
+ // the necessary hooks to subclasses.
}
public void propertyChange(PropertyChangeEvent event)
{
+ // TODO: Implement this properly.
+ }
+
+ /**
+ * Uninstalls this UI from the root pane. This calls
+ * {@link #uninstallDefaults}, {@link #uninstallComponents},
+ * {@link #uninstallListeners}, {@link #uninstallKeyboardActions}
+ * in this order.
+ *
+ * @param c the root pane to uninstall the UI from
+ */
+ public void uninstallUI(JComponent c)
+ {
+ super.uninstallUI(c);
+ if (c instanceof JRootPane)
+ {
+ JRootPane rp = (JRootPane) c;
+ uninstallDefaults(rp);
+ uninstallComponents(rp);
+ uninstallListeners(rp);
+ uninstallKeyboardActions(rp);
+ }
+ }
+
+ /**
+ * Uninstalls the look and feel defaults that have been installed in
+ * {@link #installDefaults}.
+ *
+ * @param rp the root pane to uninstall the defaults from
+ */
+ protected void uninstallDefaults(JRootPane rp)
+ {
+ // We do nothing here.
+ }
+
+ /**
+ * Uninstalls look and feel components from the root pane.
+ *
+ * @param rp the root pane to uninstall the components from
+ */
+ protected void uninstallComponents(JRootPane rp)
+ {
+ // We do nothing here.
+ }
+
+ /**
+ * Uninstalls any look and feel specific listeners from the root pane.
+ *
+ * @param rp the root pane to uninstall the listeners from
+ */
+ protected void uninstallListeners(JRootPane rp)
+ {
+ rp.removePropertyChangeListener(this);
+ }
+
+ /**
+ * Uninstalls look and feel keyboard actions from the root pane.
+ *
+ * @param rp the root pane to uninstall the keyboard actions from
+ */
+ protected void uninstallKeyboardActions(JRootPane rp)
+ {
+ // We do nothing here.
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
index 22242afcd8a..a2f5b82dbec 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -58,10 +58,10 @@ import javax.swing.BoundedRangeModel;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -80,6 +80,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected class ArrowButtonListener extends MouseAdapter
{
+
/**
* Move the thumb in the direction specified by the button's arrow. If
* this button is held down, then it should keep moving the thumb.
@@ -91,9 +92,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
scrollTimer.stop();
scrollListener.setScrollByBlock(false);
if (e.getSource() == incrButton)
- scrollListener.setDirection(POSITIVE_SCROLL);
- else
- scrollListener.setDirection(NEGATIVE_SCROLL);
+ scrollListener.setDirection(POSITIVE_SCROLL);
+ else if (e.getSource() == decrButton)
+ scrollListener.setDirection(NEGATIVE_SCROLL);
+ scrollTimer.setDelay(100);
scrollTimer.start();
}
@@ -105,6 +107,11 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
public void mouseReleased(MouseEvent e)
{
scrollTimer.stop();
+ scrollTimer.setDelay(300);
+ if (e.getSource() == incrButton)
+ scrollByUnit(POSITIVE_SCROLL);
+ else if (e.getSource() == decrButton)
+ scrollByUnit(NEGATIVE_SCROLL);
}
}
@@ -120,9 +127,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
public void stateChanged(ChangeEvent e)
{
- // System.err.println(this + ".stateChanged()");
calculatePreferredSize();
- getThumbBounds();
+ updateThumbRect();
scrollbar.repaint();
}
}
@@ -141,31 +147,27 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
if (e.getPropertyName().equals("model"))
{
- ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener);
- scrollbar.getModel().addChangeListener(modelListener);
- getThumbBounds();
+ ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener);
+ scrollbar.getModel().addChangeListener(modelListener);
+ updateThumbRect();
}
else if (e.getPropertyName().equals("orientation"))
{
- incrButton.removeMouseListener(buttonListener);
- decrButton.removeMouseListener(buttonListener);
- int orientation = scrollbar.getOrientation();
- switch (orientation)
- {
- case (JScrollBar.HORIZONTAL):
- incrButton = createIncreaseButton(EAST);
- decrButton = createDecreaseButton(WEST);
- break;
- default:
- incrButton = createIncreaseButton(SOUTH);
- decrButton = createDecreaseButton(NORTH);
- break;
- }
- incrButton.addMouseListener(buttonListener);
- decrButton.addMouseListener(buttonListener);
- calculatePreferredSize();
+ uninstallListeners();
+ uninstallComponents();
+ uninstallDefaults();
+ installDefaults();
+ installComponents();
+ installListeners();
+ }
+ else if (e.getPropertyName().equals("enabled"))
+ {
+ Boolean b = (Boolean) e.getNewValue();
+ if (incrButton != null)
+ incrButton.setEnabled(b.booleanValue());
+ if (decrButton != null)
+ decrButton.setEnabled(b.booleanValue());
}
- scrollbar.repaint();
}
}
@@ -233,19 +235,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
if (block)
{
- // Only need to check it if it's block scrolling
- // We only block scroll if the click occurs
- // in the track.
- if (! trackListener.shouldScroll(direction))
- {
- trackHighlight = NO_HIGHLIGHT;
- scrollbar.repaint();
- return;
- }
- scrollByBlock(direction);
+ // Only need to check it if it's block scrolling
+ // We only block scroll if the click occurs
+ // in the track.
+ if (!trackListener.shouldScroll(direction))
+ {
+ trackHighlight = NO_HIGHLIGHT;
+ scrollbar.repaint();
+ return;
+ }
+ scrollByBlock(direction);
}
else
- scrollByUnit(direction);
+ scrollByUnit(direction);
}
}
@@ -316,9 +318,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
else
value = valueForYPosition(currentMouseY);
- if (value == scrollbar.getValue())
- return;
-
if (! thumbRect.contains(e.getPoint()))
{
scrollTimer.stop();
@@ -333,6 +332,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
trackHighlight = DECREASE_HIGHLIGHT;
scrollListener.setDirection(NEGATIVE_SCROLL);
}
+ scrollTimer.setDelay(100);
scrollTimer.start();
}
else
@@ -343,8 +343,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
// "lower" edge of the thumb. The value at which
// the cursor is at must be greater or equal
// to that value.
+
+ scrollListener.setScrollByBlock(false);
scrollbar.setValueIsAdjusting(true);
- offset = value - scrollbar.getValue();
+ offset = value - scrollbar.getValue();
}
scrollbar.repaint();
}
@@ -357,11 +359,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
public void mouseReleased(MouseEvent e)
{
- trackHighlight = NO_HIGHLIGHT;
scrollTimer.stop();
+ scrollTimer.setDelay(300);
+ currentMouseX = e.getX();
+ currentMouseY = e.getY();
- if (scrollbar.getValueIsAdjusting())
- scrollbar.setValueIsAdjusting(false);
+ if (shouldScroll(POSITIVE_SCROLL))
+ scrollByBlock(POSITIVE_SCROLL);
+ else if (shouldScroll(NEGATIVE_SCROLL))
+ scrollByBlock(NEGATIVE_SCROLL);
+
+ trackHighlight = NO_HIGHLIGHT;
+ scrollListener.setScrollByBlock(false);
+ scrollbar.setValueIsAdjusting(true);
scrollbar.repaint();
}
@@ -381,6 +391,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
else
value = valueForYPosition(currentMouseY);
+ if (thumbRect.contains(currentMouseX, currentMouseY))
+ return false;
+
if (direction == POSITIVE_SCROLL)
return (value > scrollbar.getValue());
else
@@ -487,14 +500,12 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void configureScrollBarColors()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- trackColor = defaults.getColor("ScrollBar.track");
- trackHighlightColor = defaults.getColor("ScrollBar.trackHighlight");
- thumbColor = defaults.getColor("ScrollBar.thumb");
- thumbHighlightColor = defaults.getColor("ScrollBar.thumbHighlight");
- thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow");
- thumbLightShadowColor = defaults.getColor("ScrollBar.thumbShadow");
+ trackColor = UIManager.getColor("ScrollBar.track");
+ trackHighlightColor = UIManager.getColor("ScrollBar.trackHighlight");
+ thumbColor = UIManager.getColor("ScrollBar.thumb");
+ thumbHighlightColor = UIManager.getColor("ScrollBar.thumbHighlight");
+ thumbDarkShadowColor = UIManager.getColor("ScrollBar.thumbDarkShadow");
+ thumbLightShadowColor = UIManager.getColor("ScrollBar.thumbShadow");
}
/**
@@ -517,11 +528,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected JButton createIncreaseButton(int orientation)
{
- if (incrButton == null)
- incrButton = new BasicArrowButton(orientation);
- else
- ((BasicArrowButton) incrButton).setDirection(orientation);
- return incrButton;
+ return new BasicArrowButton(orientation);
}
/**
@@ -534,11 +541,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected JButton createDecreaseButton(int orientation)
{
- if (decrButton == null)
- decrButton = new BasicArrowButton(orientation);
- else
- ((BasicArrowButton) decrButton).setDirection(orientation);
- return decrButton;
+ return new BasicArrowButton(orientation);
}
/**
@@ -602,7 +605,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
public Dimension getMaximumSize(JComponent c)
{
- return getPreferredSize(c);
+ return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
}
/**
@@ -644,7 +647,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
void calculatePreferredSize()
{
- // System.err.println(this + ".calculatePreferredSize()");
int height;
int width;
height = width = 0;
@@ -655,11 +657,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
width += decrButton.getPreferredSize().getWidth();
width += (scrollbar.getMaximum() - scrollbar.getMinimum());
-
- height = Math.max(incrButton.getPreferredSize().height,
- decrButton.getPreferredSize().height);
- height = Math.max(getMinimumThumbSize().height, height);
- height = Math.min(getMaximumThumbSize().height, height);
+ height = UIManager.getInt("ScrollBar.width");
}
else
{
@@ -667,11 +665,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
height += decrButton.getPreferredSize().getHeight();
height += (scrollbar.getMaximum() - scrollbar.getMinimum());
-
- width = Math.max(incrButton.getPreferredSize().width,
- decrButton.getPreferredSize().width);
- width = Math.max(getMinimumThumbSize().width, width);
- width = Math.min(getMaximumThumbSize().width, width);
+ width = UIManager.getInt("ScrollBar.width");
}
Insets insets = scrollbar.getInsets();
@@ -707,48 +701,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected Rectangle getThumbBounds()
{
- int max = scrollbar.getMaximum();
- int min = scrollbar.getMinimum();
- int value = scrollbar.getValue();
- int extent = scrollbar.getVisibleAmount();
-
- // System.err.println(this + ".getThumbBounds()");
- if (max == min)
- {
- thumbRect.x = trackRect.x;
- thumbRect.y = trackRect.y;
- if (scrollbar.getOrientation() == HORIZONTAL)
- {
- thumbRect.width = getMinimumThumbSize().width;
- thumbRect.height = trackRect.height;
- }
- else
- {
- thumbRect.width = trackRect.width;
- thumbRect.height = getMinimumThumbSize().height;
- }
- return thumbRect;
- }
-
- if (scrollbar.getOrientation() == HORIZONTAL)
- {
- thumbRect.x = trackRect.x;
- thumbRect.x += (value - min) * trackRect.width / (max - min);
- thumbRect.y = trackRect.y;
-
- thumbRect.width = Math.max(extent * trackRect.width / (max - min),
- getMinimumThumbSize().width);
- thumbRect.height = trackRect.height;
- }
- else
- {
- thumbRect.x = trackRect.x;
- thumbRect.y = trackRect.y + value * trackRect.height / (max - min);
-
- thumbRect.width = trackRect.width;
- thumbRect.height = Math.max(extent * trackRect.height / (max - min),
- getMinimumThumbSize().height);
- }
return thumbRect;
}
@@ -760,22 +712,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected Rectangle getTrackBounds()
{
- SwingUtilities.calculateInnerArea(scrollbar, trackRect);
-
- if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL)
- {
- trackRect.width -= incrButton.getPreferredSize().getWidth();
- trackRect.width -= decrButton.getPreferredSize().getWidth();
-
- trackRect.x += decrButton.getPreferredSize().getWidth();
- }
- else
- {
- trackRect.height -= incrButton.getPreferredSize().getHeight();
- trackRect.height -= decrButton.getPreferredSize().getHeight();
-
- trackRect.y += incrButton.getPreferredSize().getHeight();
- }
return trackRect;
}
@@ -785,6 +721,18 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void installComponents()
{
+ if (incrButton != null)
+ scrollbar.add(incrButton);
+ if (decrButton != null)
+ scrollbar.add(decrButton);
+ }
+
+ /**
+ * This method installs the defaults for the scrollbar specified by the
+ * Basic Look and Feel.
+ */
+ protected void installDefaults()
+ {
int orientation = scrollbar.getOrientation();
switch (orientation)
{
@@ -797,31 +745,20 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
decrButton = createDecreaseButton(NORTH);
break;
}
- scrollbar.add(incrButton);
- scrollbar.add(decrButton);
- }
- /**
- * This method installs the defaults for the scrollbar specified by the
- * Basic Look and Feel.
- */
- protected void installDefaults()
- {
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- scrollbar.setForeground(defaults.getColor("ScrollBar.foreground"));
- scrollbar.setBackground(defaults.getColor("ScrollBar.background"));
- scrollbar.setBorder(defaults.getBorder("ScrollBar.border"));
+ LookAndFeel.installColors(scrollbar, "ScrollBar.background",
+ "ScrollBar.foreground");
+ LookAndFeel.installBorder(scrollbar, "ScrollBar.border");
scrollbar.setOpaque(true);
scrollbar.setLayout(this);
- thumbColor = defaults.getColor("ScrollBar.thumb");
- thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow");
- thumbHighlightColor = defaults.getColor("ScrollBar.thumbHighlight");
- thumbLightShadowColor = defaults.getColor("ScrollBar.thumbShadow");
+ thumbColor = UIManager.getColor("ScrollBar.thumb");
+ thumbDarkShadowColor = UIManager.getColor("ScrollBar.thumbDarkShadow");
+ thumbHighlightColor = UIManager.getColor("ScrollBar.thumbHighlight");
+ thumbLightShadowColor = UIManager.getColor("ScrollBar.thumbShadow");
- maximumThumbSize = defaults.getDimension("ScrollBar.maximumThumbSize");
- minimumThumbSize = defaults.getDimension("ScrollBar.minimumThumbSize");
+ maximumThumbSize = UIManager.getDimension("ScrollBar.maximumThumbSize");
+ minimumThumbSize = UIManager.getDimension("ScrollBar.minimumThumbSize");
}
/**
@@ -873,11 +810,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
trackRect = new Rectangle();
thumbRect = new Rectangle();
- scrollTimer = new Timer(200, null);
- scrollTimer.setRepeats(true);
+ scrollTimer = new Timer(300, null);
+ installDefaults();
installComponents();
- installDefaults();
configureScrollBarColors();
installListeners();
@@ -908,17 +844,20 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void layoutHScrollbar(JScrollBar sb)
{
- // All we have to do is layout the 2 buttons?
Rectangle vr = new Rectangle();
SwingUtilities.calculateInnerArea(scrollbar, vr);
- // Update the rectangles.
- getTrackBounds();
- getThumbBounds();
-
Dimension incrDims = incrButton.getPreferredSize();
Dimension decrDims = decrButton.getPreferredSize();
+
+ // calculate and update the track bounds
+ SwingUtilities.calculateInnerArea(scrollbar, trackRect);
+ trackRect.width -= incrDims.getWidth();
+ trackRect.width -= decrDims.getWidth();
+ trackRect.x += decrDims.getWidth();
+ updateThumbRect();
+
decrButton.setBounds(vr.x, vr.y, decrDims.width, trackRect.height);
incrButton.setBounds(trackRect.x + trackRect.width, vr.y, incrDims.width,
trackRect.height);
@@ -934,12 +873,16 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
Rectangle vr = new Rectangle();
SwingUtilities.calculateInnerArea(scrollbar, vr);
- // Update rectangles
- getTrackBounds();
- getThumbBounds();
-
Dimension incrDims = incrButton.getPreferredSize();
Dimension decrDims = decrButton.getPreferredSize();
+
+ // Update rectangles
+ SwingUtilities.calculateInnerArea(scrollbar, trackRect);
+ trackRect.height -= incrDims.getHeight();
+ trackRect.height -= decrDims.getHeight();
+ trackRect.y += decrDims.getHeight();
+
+ updateThumbRect();
decrButton.setBounds(vr.x, vr.y, trackRect.width, decrDims.height);
incrButton.setBounds(vr.x, trackRect.y + trackRect.height,
@@ -947,6 +890,58 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
+ * Updates the thumb rect.
+ */
+ void updateThumbRect()
+ {
+ int max = scrollbar.getMaximum();
+ int min = scrollbar.getMinimum();
+ int value = scrollbar.getValue();
+ int extent = scrollbar.getVisibleAmount();
+ if (max - extent <= min)
+ {
+ if (scrollbar.getOrientation() == JScrollBar.HORIZONTAL)
+ {
+ thumbRect.x = trackRect.x;
+ thumbRect.y = trackRect.y;
+ thumbRect.width = getMinimumThumbSize().width;
+ thumbRect.height = trackRect.height;
+ }
+ else
+ {
+ thumbRect.x = trackRect.x;
+ thumbRect.y = trackRect.y;
+ thumbRect.width = trackRect.width;
+ thumbRect.height = getMinimumThumbSize().height;
+ }
+ }
+ else
+ {
+ if (scrollbar.getOrientation() == JScrollBar.HORIZONTAL)
+ {
+ thumbRect.x = trackRect.x;
+ thumbRect.width = Math.max(extent * trackRect.width / (max - min),
+ getMinimumThumbSize().width);
+ int availableWidth = trackRect.width - thumbRect.width;
+ thumbRect.x += (value - min) * availableWidth / (max - min - extent);
+ thumbRect.y = trackRect.y;
+ thumbRect.height = trackRect.height;
+ }
+ else
+ {
+ thumbRect.x = trackRect.x;
+ thumbRect.height = Math.max(extent * trackRect.height / (max - min),
+ getMinimumThumbSize().height);
+ int availableHeight = trackRect.height - thumbRect.height;
+ thumbRect.y = trackRect.y
+ + (value - min) * availableHeight / (max - min - extent);
+ thumbRect.width = trackRect.width;
+ }
+ }
+
+ }
+
+ /**
* This method returns the minimum size required for the layout.
*
* @param scrollbarContainer The Container that is laid out.
@@ -1124,10 +1119,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void uninstallComponents()
{
- scrollbar.remove(incrButton);
- scrollbar.remove(decrButton);
- incrButton = null;
- decrButton = null;
+ if (incrButton != null)
+ scrollbar.remove(incrButton);
+ if (decrButton != null)
+ scrollbar.remove(decrButton);
}
/**
@@ -1138,7 +1133,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
scrollbar.setForeground(null);
scrollbar.setBackground(null);
- scrollbar.setBorder(null);
+ LookAndFeel.uninstallBorder(scrollbar);
+ incrButton = null;
+ decrButton = null;
}
/**
@@ -1155,17 +1152,22 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
protected void uninstallListeners()
{
- scrollTimer.removeActionListener(scrollListener);
+ if (scrollTimer != null)
+ scrollTimer.removeActionListener(scrollListener);
- scrollbar.getModel().removeChangeListener(modelListener);
- scrollbar.removePropertyChangeListener(propertyChangeListener);
-
- decrButton.removeMouseListener(buttonListener);
- incrButton.removeMouseListener(buttonListener);
-
- scrollbar.removeMouseListener(trackListener);
- scrollbar.removeMouseMotionListener(trackListener);
+ if (scrollbar != null)
+ {
+ scrollbar.getModel().removeChangeListener(modelListener);
+ scrollbar.removePropertyChangeListener(propertyChangeListener);
+ scrollbar.removeMouseListener(trackListener);
+ scrollbar.removeMouseMotionListener(trackListener);
+ }
+ if (decrButton != null)
+ decrButton.removeMouseListener(buttonListener);
+ if (incrButton != null)
+ incrButton.removeMouseListener(buttonListener);
+
propertyChangeListener = null;
modelListener = null;
buttonListener = null;
@@ -1182,8 +1184,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
*/
public void uninstallUI(JComponent c)
{
- uninstallDefaults();
uninstallListeners();
+ uninstallDefaults();
uninstallComponents();
scrollTimer = null;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
index bd1576f37a5..808ed2763e9 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java
@@ -40,13 +40,21 @@ package javax.swing.plaf.basic;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
+import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
+import javax.swing.JViewport;
+import javax.swing.LookAndFeel;
import javax.swing.ScrollPaneConstants;
import javax.swing.ScrollPaneLayout;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ScrollPaneUI;
@@ -54,9 +62,207 @@ public class BasicScrollPaneUI extends ScrollPaneUI
implements ScrollPaneConstants
{
+ /**
+ * Listens for changes in the state of the horizontal scrollbar's model and
+ * updates the scrollpane accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class HSBChangeListener implements ChangeListener
+ {
+
+ /**
+ * Receives notification when the state of the horizontal scrollbar
+ * model has changed.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ JScrollBar hsb = scrollpane.getHorizontalScrollBar();
+ JViewport vp = scrollpane.getViewport();
+ Point viewPosition = vp.getViewPosition();
+ int xpos = hsb.getValue();
+
+ if (xpos != viewPosition.x)
+ {
+ viewPosition.x = xpos;
+ vp.setViewPosition(viewPosition);
+ }
+
+ viewPosition.y = 0;
+ JViewport columnHeader = scrollpane.getColumnHeader();
+ if (columnHeader != null
+ && !columnHeader.getViewPosition().equals(viewPosition))
+ columnHeader.setViewPosition(viewPosition);
+ }
+
+ }
+
+ /**
+ * Listens for changes in the state of the vertical scrollbar's model and
+ * updates the scrollpane accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class VSBChangeListener implements ChangeListener
+ {
+
+ /**
+ * Receives notification when the state of the vertical scrollbar
+ * model has changed.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ JScrollBar vsb = scrollpane.getVerticalScrollBar();
+ JViewport vp = scrollpane.getViewport();
+ Point viewPosition = vp.getViewPosition();
+ int ypos = vsb.getValue();
+ if (ypos != viewPosition.y)
+ {
+ viewPosition.y = ypos;
+ vp.setViewPosition(viewPosition);
+ }
+
+ viewPosition.x = 0;
+ JViewport rowHeader = scrollpane.getRowHeader();
+ if (rowHeader != null
+ && !rowHeader.getViewPosition().equals(viewPosition))
+ rowHeader.setViewPosition(viewPosition);
+ }
+
+ }
+
+ /**
+ * Listens for changes of the viewport's extent size and updates the
+ * scrollpane accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class ViewportChangeHandler implements ChangeListener
+ {
+
+ /**
+ * Receives notification when the view's size, position or extent size
+ * changes. When the extents size has changed, this method calls
+ * {@link BasicScrollPaneUI#syncScrollPaneWithViewport()} to adjust the
+ * scrollbars extents as well.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ JViewport vp = scrollpane.getViewport();
+ JScrollBar hsb = scrollpane.getHorizontalScrollBar();
+ JScrollBar vsb = scrollpane.getVerticalScrollBar();
+ syncScrollPaneWithViewport();
+ }
+
+ }
+
+ /**
+ * Listens for property changes on the scrollpane and update the view
+ * accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class PropertyChangeHandler implements PropertyChangeListener
+ {
+
+ /**
+ * Receives notification when any of the scrollpane's bound property
+ * changes. This method calls the appropriate update method on the
+ * <code>ScrollBarUI</code>.
+ *
+ * @param e the property change event
+ *
+ * @see BasicScrollPaneUI#updateColumnHeader(PropertyChangeEvent)
+ * @see BasicScrollPaneUI#updateRowHeader(PropertyChangeEvent)
+ * @see BasicScrollPaneUI#updateScrollBarDisplayPolicy(PropertyChangeEvent)
+ * @see BasicScrollPaneUI#updateViewport(PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ String propName = e.getPropertyName();
+ if (propName.equals("viewport"))
+ updateViewport(e);
+ else if (propName.equals("rowHeader"))
+ updateRowHeader(e);
+ else if (propName.equals("columnHeader"))
+ updateColumnHeader(e);
+ else if (propName.equals("horizontalScrollBarPolicy")
+ || e.getPropertyName().equals("verticalScrollBarPolicy"))
+ updateScrollBarDisplayPolicy(e);
+ else if (propName.equals("verticalScrollBar"))
+ {
+ JScrollBar oldSb = (JScrollBar) e.getOldValue();
+ oldSb.getModel().removeChangeListener(vsbChangeListener);
+ JScrollBar newSb = (JScrollBar) e.getNewValue();
+ newSb.getModel().addChangeListener(vsbChangeListener);
+ }
+ else if (propName.equals("horizontalScrollBar"))
+ {
+ JScrollBar oldSb = (JScrollBar) e.getOldValue();
+ oldSb.getModel().removeChangeListener(hsbChangeListener);
+ JScrollBar newSb = (JScrollBar) e.getNewValue();
+ newSb.getModel().addChangeListener(hsbChangeListener);
+ }
+ }
+
+ }
+
+ /**
+ * Listens for mouse wheel events and update the scrollpane accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ *
+ * @since 1.4
+ */
+ protected class MouseWheelHandler implements MouseWheelListener
+ {
+
+ /**
+ * Receives notification whenever the mouse wheel is moved.
+ *
+ * @param event the mouse wheel event
+ */
+ public void mouseWheelMoved(MouseWheelEvent event)
+ {
+ // TODO: Implement this properly.
+ }
+
+ }
+
/** The Scrollpane for which the UI is provided by this class. */
protected JScrollPane scrollpane;
+ /**
+ * The horizontal scrollbar listener.
+ */
+ protected ChangeListener hsbChangeListener;
+
+ /**
+ * The vertical scrollbar listener.
+ */
+ protected ChangeListener vsbChangeListener;
+
+ /**
+ * The viewport listener.
+ */
+ protected ChangeListener viewportChangeListener;
+
+ /**
+ * The scrollpane property change listener.
+ */
+ protected PropertyChangeListener spPropertyChangeListener;
+
+ /**
+ * The mousewheel listener for the scrollpane.
+ */
+ MouseWheelListener mouseWheelListener;
+
public static ComponentUI createUI(final JComponent c)
{
return new BasicScrollPaneUI();
@@ -65,11 +271,10 @@ public class BasicScrollPaneUI extends ScrollPaneUI
protected void installDefaults(JScrollPane p)
{
scrollpane = p;
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- p.setForeground(defaults.getColor("ScrollPane.foreground"));
- p.setBackground(defaults.getColor("ScrollPane.background"));
- p.setFont(defaults.getFont("ScrollPane.font"));
- p.setBorder(defaults.getBorder("ScrollPane.border"));
+ LookAndFeel.installColorsAndFont(p, "ScrollPane.background",
+ "ScrollPane.foreground",
+ "ScrollPane.font");
+ LookAndFeel.installBorder(p, "ScrollPane.border");
p.setOpaque(true);
}
@@ -85,16 +290,141 @@ public class BasicScrollPaneUI extends ScrollPaneUI
public void installUI(final JComponent c)
{
super.installUI(c);
- this.installDefaults((JScrollPane)c);
+ installDefaults((JScrollPane) c);
+ installListeners((JScrollPane) c);
+ installKeyboardActions((JScrollPane) c);
+ }
+
+ /**
+ * Installs the listeners on the scrollbars, the viewport and the scrollpane.
+ *
+ * @param sp the scrollpane on which to install the listeners
+ */
+ protected void installListeners(JScrollPane sp)
+ {
+ if (spPropertyChangeListener == null)
+ spPropertyChangeListener = createPropertyChangeListener();
+ sp.addPropertyChangeListener(spPropertyChangeListener);
+
+ if (hsbChangeListener == null)
+ hsbChangeListener = createHSBChangeListener();
+ sp.getHorizontalScrollBar().getModel().addChangeListener(hsbChangeListener);
+
+ if (vsbChangeListener == null)
+ vsbChangeListener = createVSBChangeListener();
+ sp.getVerticalScrollBar().getModel().addChangeListener(vsbChangeListener);
+
+ if (viewportChangeListener == null)
+ viewportChangeListener = createViewportChangeListener();
+ sp.getViewport().addChangeListener(viewportChangeListener);
+
+ if (mouseWheelListener == null)
+ mouseWheelListener = createMouseWheelListener();
+ sp.addMouseWheelListener(mouseWheelListener);
+ }
+
+ /**
+ * Installs additional keyboard actions on the scrollpane. This is a hook
+ * method provided to subclasses in order to install their own keyboard
+ * actions.
+ *
+ * @param sp the scrollpane to install keyboard actions on
+ */
+ protected void installKeyboardActions(JScrollPane sp)
+ {
+ // TODO: Is this only a hook method or should we actually do something
+ // here? If the latter, than figure out what and implement this.
+ }
+
+ /**
+ * Creates and returns the change listener for the horizontal scrollbar.
+ *
+ * @return the change listener for the horizontal scrollbar
+ */
+ protected ChangeListener createHSBChangeListener()
+ {
+ return new HSBChangeListener();
+ }
+
+ /**
+ * Creates and returns the change listener for the vertical scrollbar.
+ *
+ * @return the change listener for the vertical scrollbar
+ */
+ protected ChangeListener createVSBChangeListener()
+ {
+ return new VSBChangeListener();
+ }
+
+ /**
+ * Creates and returns the change listener for the viewport.
+ *
+ * @return the change listener for the viewport
+ */
+ protected ChangeListener createViewportChangeListener()
+ {
+ return new ViewportChangeHandler();
+ }
+
+ /**
+ * Creates and returns the property change listener for the scrollpane.
+ *
+ * @return the property change listener for the scrollpane
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new PropertyChangeHandler();
+ }
+
+ /**
+ * Creates and returns the mouse wheel listener for the scrollpane.
+ *
+ * @return the mouse wheel listener for the scrollpane
+ */
+ protected MouseWheelListener createMouseWheelListener()
+ {
+ return new MouseWheelHandler();
}
public void uninstallUI(final JComponent c)
{
super.uninstallUI(c);
this.uninstallDefaults((JScrollPane)c);
+ uninstallListeners((JScrollPane) c);
+ installKeyboardActions((JScrollPane) c);
+ }
+
+ /**
+ * Uninstalls all the listeners that have been installed in
+ * {@link #installListeners(JScrollPane)}.
+ *
+ * @param c the scrollpane from which to uninstall the listeners
+ */
+ protected void uninstallListeners(JComponent c)
+ {
+ JScrollPane sp = (JScrollPane) c;
+ sp.removePropertyChangeListener(spPropertyChangeListener);
+ sp.getHorizontalScrollBar().getModel()
+ .removeChangeListener(hsbChangeListener);
+ sp.getVerticalScrollBar().getModel()
+ .removeChangeListener(vsbChangeListener);
+ sp.getViewport().removeChangeListener(viewportChangeListener);
+ sp.removeMouseWheelListener(mouseWheelListener);
+ }
+
+ /**
+ * Uninstalls all keyboard actions from the JScrollPane that have been
+ * installed by {@link #installKeyboardActions}. This is a hook method
+ * provided to subclasses to add their own keyboard actions.
+ *
+ * @param sp the scrollpane to uninstall keyboard actions from
+ */
+ protected void uninstallKeyboardActions(JScrollPane sp)
+ {
+ // TODO: Is this only a hook method or should we actually do something
+ // here? If the latter, than figure out what and implement this.
}
-
public Dimension getMinimumSize(JComponent c)
{
JScrollPane p = (JScrollPane ) c;
@@ -107,6 +437,76 @@ public class BasicScrollPaneUI extends ScrollPaneUI
// do nothing; the normal painting-of-children algorithm, along with
// ScrollPaneLayout, does all the relevant work.
}
+
+ /**
+ * Synchronizes the scrollbars with the viewport's extents.
+ */
+ protected void syncScrollPaneWithViewport()
+ {
+ JViewport vp = scrollpane.getViewport();
+
+ // Update the horizontal scrollbar.
+ JScrollBar hsb = scrollpane.getHorizontalScrollBar();
+ hsb.setMaximum(vp.getViewSize().width);
+ hsb.setValue(vp.getViewPosition().x);
+ hsb.setVisibleAmount(vp.getExtentSize().width);
+
+ // Update the vertical scrollbar.
+ JScrollBar vsb = scrollpane.getVerticalScrollBar();
+ vsb.setMaximum(vp.getViewSize().height);
+ vsb.setValue(vp.getViewPosition().y);
+ vsb.setVisibleAmount(vp.getExtentSize().height);
+ }
+
+ /**
+ * Receives notification when the <code>columnHeader</code> property has
+ * changed on the scrollpane.
+ *
+ * @param ev the property change event
+ */
+ protected void updateColumnHeader(PropertyChangeEvent ev)
+ {
+ // TODO: Find out what should be done here. Or is this only a hook?
+ }
+
+ /**
+ * Receives notification when the <code>rowHeader</code> property has changed
+ * on the scrollpane.
+ *
+ * @param ev the property change event
+ */
+ protected void updateRowHeader(PropertyChangeEvent ev)
+ {
+ // TODO: Find out what should be done here. Or is this only a hook?
+ }
+
+ /**
+ * Receives notification when the <code>scrollBarDisplayPolicy</code>
+ * property has changed on the scrollpane.
+ *
+ * @param ev the property change event
+ */
+ protected void updateScrollBarDisplayPolicy(PropertyChangeEvent ev)
+ {
+ // TODO: Find out what should be done here. Or is this only a hook?
+ }
+
+ /**
+ * Receives notification when the <code>viewport</code> property has changed
+ * on the scrollpane.
+ *
+ * This method sets removes the viewportChangeListener from the old viewport
+ * and adds it to the new viewport.
+ *
+ * @param ev the property change event
+ */
+ protected void updateViewport(PropertyChangeEvent ev)
+ {
+ JViewport oldViewport = (JViewport) ev.getOldValue();
+ oldViewport.removeChangeListener(viewportChangeListener);
+ JViewport newViewport = (JViewport) ev.getNewValue();
+ oldViewport.addChangeListener(viewportChangeListener);
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java
index 38c9c7a2820..97caa3af7bd 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java
@@ -41,13 +41,11 @@ package javax.swing.plaf.basic;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.Insets;
import java.awt.Rectangle;
import javax.swing.JComponent;
import javax.swing.JSeparator;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.SeparatorUI;
@@ -121,10 +119,8 @@ public class BasicSeparatorUI extends SeparatorUI
*/
protected void installDefaults(JSeparator s)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- shadow = defaults.getColor("Separator.shadow");
- highlight = defaults.getColor("Separator.highlight");
+ shadow = UIManager.getColor("Separator.shadow");
+ highlight = UIManager.getColor("Separator.highlight");
s.setOpaque(false);
}
@@ -165,8 +161,8 @@ public class BasicSeparatorUI extends SeparatorUI
/**
* The separator is made of two lines. The top line will be
- * the highlight color (or left line if it's vertical). The bottom
- * or right line will be the shadow color. The two lines will
+ * the shadow color (or left line if it's vertical). The bottom
+ * or right line will be the highlight color. The two lines will
* be centered inside the bounds box. If the separator is horizontal,
* then it will be vertically centered, or if it's vertical, it will
* be horizontally centered.
@@ -180,9 +176,6 @@ public class BasicSeparatorUI extends SeparatorUI
SwingUtilities.calculateInnerArea(c, r);
Color saved = g.getColor();
- int midAB = r.width / 2 + r.x;
- int midAD = r.height / 2 + r.y;
-
JSeparator s;
if (c instanceof JSeparator)
s = (JSeparator) c;
@@ -190,21 +183,24 @@ public class BasicSeparatorUI extends SeparatorUI
return;
if (s.getOrientation() == JSeparator.HORIZONTAL)
- {
- g.setColor(highlight);
- g.drawLine(r.x, midAD, r.x + r.width, midAD);
-
- g.setColor(shadow);
- g.drawLine(r.x, midAD + 1, r.x + r.width, midAD + 1);
- }
- else
- {
- g.setColor(highlight);
- g.drawLine(midAB, r.y, midAB, r.y + r.height);
-
- g.setColor(shadow);
- g.drawLine(midAB + 1, r.y, midAB + 1, r.y + r.height);
- }
+ {
+ int midAB = r.height / 2;
+ g.setColor(shadow);
+ g.drawLine(r.x, r.y + midAB - 1, r.x + r.width, r.y + midAB - 1);
+
+ g.setColor(highlight);
+ g.fillRect(r.x, r.y + midAB, r.x + r.width, r.y + midAB);
+ }
+ else
+ {
+ int midAD = r.height / 2 + r.y;
+ g.setColor(shadow);
+ g.drawLine(r.x, r.y, r.x, r.y + r.height);
+
+ g.setColor(highlight);
+ g.fillRect(r.x + midAD, r.y + r.height, r.x + midAD, r.y + r.height);
+ }
+ g.setColor(saved);
}
/**
@@ -217,28 +213,14 @@ public class BasicSeparatorUI extends SeparatorUI
*/
public Dimension getPreferredSize(JComponent c)
{
- Dimension dims = new Dimension(0, 0);
- Insets insets = c.getInsets();
-
+ Dimension pref = new Dimension(2, 0);
if (c instanceof JSeparator)
{
JSeparator s = (JSeparator) c;
-
if (s.getOrientation() == JSeparator.HORIZONTAL)
- {
- dims.height = 2;
- dims.width = 40;
- }
- else
- {
- dims.width = 2;
- dims.height = 40;
- }
+ pref = new Dimension(0, 2);
}
- dims.width += insets.left + insets.right;
- dims.height += insets.top + insets.bottom;
-
- return dims;
+ return pref;
}
/**
@@ -251,7 +233,7 @@ public class BasicSeparatorUI extends SeparatorUI
*/
public Dimension getMinimumSize(JComponent c)
{
- return getPreferredSize(c);
+ return new Dimension(0, 0);
}
/**
@@ -264,6 +246,7 @@ public class BasicSeparatorUI extends SeparatorUI
*/
public Dimension getMaximumSize(JComponent c)
{
- return getPreferredSize(c);
+ return new Dimension(Short.MAX_VALUE,
+ Short.MAX_VALUE);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
index 0b4058429c5..26f58051902 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSliderUI.java
@@ -60,13 +60,14 @@ import java.beans.PropertyChangeListener;
import java.util.Dictionary;
import java.util.Enumeration;
+import javax.swing.AbstractAction;
import javax.swing.BoundedRangeModel;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JSlider;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -470,6 +471,34 @@ public class BasicSliderUI extends SliderUI
}
}
+ /**
+ * This class is no longer used as of JDK1.3.
+ */
+ public class ActionScroller extends AbstractAction
+ {
+ /**
+ * Not used.
+ *
+ * @param slider not used
+ * @param dir not used
+ * @param block not used
+ */
+ public ActionScroller(JSlider slider, int dir, boolean block)
+ {
+ // Not used.
+ }
+
+ /**
+ * Not used.
+ *
+ * @param event not used
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ // Not used.
+ }
+ }
+
/** Listener for changes from the model. */
protected ChangeListener changeListener;
@@ -680,16 +709,14 @@ public class BasicSliderUI extends SliderUI
*/
protected void installDefaults(JSlider slider)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- slider.setForeground(defaults.getColor("Slider.foreground"));
- slider.setBackground(defaults.getColor("Slider.background"));
- shadowColor = defaults.getColor("Slider.shadow");
- highlightColor = defaults.getColor("Slider.highlight");
- focusColor = defaults.getColor("Slider.focus");
- slider.setBorder(defaults.getBorder("Slider.border"));
+ LookAndFeel.installColors(slider, "Slider.background",
+ "Slider.foreground");
+ LookAndFeel.installBorder(slider, "Slider.border");
+ shadowColor = UIManager.getColor("Slider.shadow");
+ highlightColor = UIManager.getColor("Slider.highlight");
+ focusColor = UIManager.getColor("Slider.focus");
+ focusInsets = UIManager.getInsets("Slider.focusInsets");
slider.setOpaque(true);
- focusInsets = defaults.getInsets("Slider.focusInsets");
}
/**
@@ -1465,7 +1492,7 @@ public class BasicSliderUI extends SliderUI
// FIXME: Move this to propertyChangeEvent handler, when we get those.
leftToRightCache = slider.getComponentOrientation() != ComponentOrientation.RIGHT_TO_LEFT;
// FIXME: This next line is only here because the above line is here.
- calculateThumbLocation();
+ calculateGeometry();
if (slider.getPaintTrack())
paintTrack(g);
@@ -1958,7 +1985,7 @@ public class BasicSliderUI extends SliderUI
public void paintThumb(Graphics g)
{
Color saved_color = g.getColor();
-
+
Point a = new Point(thumbRect.x, thumbRect.y);
Point b = new Point(a);
Point c = new Point(a);
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java
index 97ab97b8972..3b7399eafaa 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSpinnerUI.java
@@ -53,9 +53,8 @@ import java.beans.PropertyChangeListener;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JSpinner;
+import javax.swing.LookAndFeel;
import javax.swing.Timer;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.SpinnerUI;
@@ -167,16 +166,9 @@ public class BasicSpinnerUI extends SpinnerUI
*/
protected void installDefaults()
{
- /* most of it copied from BasicLabelUI, I don't know what keys are
- available, so someone may want to update this. Hence: TODO
- */
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- /*
- spinner.setForeground(defaults.getColor("Spinner.foreground"));
- spinner.setBackground(defaults.getColor("Spinner.background"));
- spinner.setFont(defaults.getFont("Spinner.font"));
- spinner.setBorder(defaults.getBorder("Spinner.border"));
- */
+ LookAndFeel.installColorsAndFont(spinner, "Spinner.background",
+ "Spinner.foreground", "Spinner.font");
+ LookAndFeel.installBorder(spinner, "Spinner.border");
spinner.setLayout(createLayout());
spinner.setOpaque(true);
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java
index b8674ed2f08..69ed2be7c61 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneDivider.java
@@ -802,6 +802,7 @@ public class BasicSplitPaneDivider extends Container
*/
protected DividerLayout()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java
index ef8e2282349..cf31e8b5df1 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java
@@ -58,7 +58,7 @@ import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JSplitPane;
import javax.swing.KeyStroke;
-import javax.swing.UIDefaults;
+import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.SplitPaneUI;
@@ -126,14 +126,14 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
int i = 0;
if (place == null)
- i = 2;
+ i = 2;
else if (place.equals(JSplitPane.TOP) || place.equals(JSplitPane.LEFT))
- i = 0;
+ i = 0;
else if (place.equals(JSplitPane.BOTTOM)
|| place.equals(JSplitPane.RIGHT))
- i = 1;
+ i = 1;
else
- throw new IllegalArgumentException("Illegal placement in JSplitPane");
+ throw new IllegalArgumentException("Illegal placement in JSplitPane");
components[i] = component;
resetSizeAt(i);
splitPane.revalidate();
@@ -164,7 +164,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
protected int getInitialLocation(Insets insets)
{
if (insets != null)
- return insets.left;
+ return insets.left;
return 0;
}
@@ -205,7 +205,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
Dimension dims = c.getPreferredSize();
if (dims != null)
- return dims.width;
+ return dims.width;
return 0;
}
@@ -250,23 +250,23 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
if (container instanceof JSplitPane)
{
- JSplitPane split = (JSplitPane) container;
- distributeExtraSpace();
- Insets insets = split.getInsets();
- int width = getInitialLocation(insets);
- Dimension dims = split.getSize();
- for (int i = 0; i < components.length; i += 2)
- {
- if (components[i] == null)
- continue;
- setComponentToSize(components[i], sizes[i], width, insets, dims);
- width += sizes[i];
- }
- if (components[1] != null)
- {
- setComponentToSize(components[1], sizes[1], width, insets, dims);
- width += sizes[1];
- }
+ JSplitPane split = (JSplitPane) container;
+ distributeExtraSpace();
+ Insets insets = split.getInsets();
+ int width = getInitialLocation(insets);
+ Dimension dims = split.getSize();
+ for (int i = 0; i < components.length; i += 2)
+ {
+ if (components[i] == null)
+ continue;
+ setComponentToSize(components[i], sizes[i], width, insets, dims);
+ width += sizes[i];
+ }
+ if (components[1] != null)
+ {
+ setComponentToSize(components[1], sizes[1], width, insets, dims);
+ width += sizes[1];
+ }
}
}
@@ -297,23 +297,23 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
if (target instanceof JSplitPane)
{
- JSplitPane split = (JSplitPane) target;
- Insets insets = target.getInsets();
-
- int height = 0;
- int width = 0;
- for (int i = 0; i < components.length; i++)
- {
- if (components[i] == null)
- continue;
- Dimension dims = components[i].getMinimumSize();
- if (dims != null)
- {
- width += dims.width;
- height = Math.max(height, dims.height);
- }
- }
- return new Dimension(width, height);
+ JSplitPane split = (JSplitPane) target;
+ Insets insets = target.getInsets();
+
+ int height = 0;
+ int width = 0;
+ for (int i = 0; i < components.length; i++)
+ {
+ if (components[i] == null)
+ continue;
+ Dimension dims = components[i].getMinimumSize();
+ if (dims != null)
+ {
+ width += dims.width;
+ height = Math.max(height, dims.height);
+ }
+ }
+ return new Dimension(width, height);
}
return null;
}
@@ -331,24 +331,24 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
if (target instanceof JSplitPane)
{
- JSplitPane split = (JSplitPane) target;
- Insets insets = target.getInsets();
-
- int height = 0;
- int width = 0;
- for (int i = 0; i < components.length; i++)
- {
- if (components[i] == null)
- continue;
- Dimension dims = components[i].getPreferredSize();
- if (dims != null)
- {
- width += dims.width;
- if (! (components[i] instanceof BasicSplitPaneDivider))
- height = Math.max(height, dims.height);
- }
- }
- return new Dimension(width, height);
+ JSplitPane split = (JSplitPane) target;
+ Insets insets = target.getInsets();
+
+ int height = 0;
+ int width = 0;
+ for (int i = 0; i < components.length; i++)
+ {
+ if (components[i] == null)
+ continue;
+ Dimension dims = components[i].getPreferredSize();
+ if (dims != null)
+ {
+ width += dims.width;
+ if (!(components[i] instanceof BasicSplitPaneDivider))
+ height = Math.max(height, dims.height);
+ }
+ }
+ return new Dimension(width, height);
}
return null;
}
@@ -362,11 +362,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
for (int i = 0; i < components.length; i++)
{
- if (component == components[i])
- {
- components[i] = null;
- sizes[i] = 0;
- }
+ if (component == components[i])
+ {
+ components[i] = null;
+ sizes[i] = 0;
+ }
}
}
@@ -378,7 +378,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
protected void resetSizeAt(int index)
{
if (components[index] != null)
- sizes[index] = getPreferredSizeOfComponent(components[index]);
+ sizes[index] = getPreferredSizeOfComponent(components[index]);
}
/**
@@ -387,7 +387,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
public void resetToPreferredSizes()
{
for (int i = 0; i < components.length; i++)
- resetSizeAt(i);
+ resetSizeAt(i);
}
/**
@@ -404,7 +404,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
protected void setComponentToSize(Component c, int size, int location,
Insets insets, Dimension containerSize)
- {
+ {
int w = size;
int h = containerSize.height - insets.top - insets.bottom;
int x = location;
@@ -433,13 +433,13 @@ public class BasicSplitPaneUI extends SplitPaneUI
if (left != null)
{
- components[0] = left;
- resetSizeAt(0);
+ components[0] = left;
+ resetSizeAt(0);
}
if (right != null)
{
- components[1] = right;
- resetSizeAt(1);
+ components[1] = right;
+ resetSizeAt(1);
}
components[2] = divider;
resetSizeAt(2);
@@ -480,9 +480,9 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
Dimension dims = components[index].getMinimumSize();
if (dims != null)
- return dims.width;
+ return dims.width;
else
- return 0;
+ return 0;
}
} //end BasicHorizontalLayoutManager
@@ -534,7 +534,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
Dimension dims = c.getPreferredSize();
if (dims != null)
- return dims.height;
+ return dims.height;
return 0;
}
@@ -563,23 +563,23 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
if (container instanceof JSplitPane)
{
- JSplitPane split = (JSplitPane) container;
- Insets insets = container.getInsets();
-
- int height = 0;
- int width = 0;
- for (int i = 0; i < components.length; i++)
- {
- if (components[i] == null)
- continue;
- Dimension dims = components[i].getMinimumSize();
- if (dims != null)
- {
- height += dims.height;
- width = Math.max(width, dims.width);
- }
- }
- return new Dimension(width, height);
+ JSplitPane split = (JSplitPane) container;
+ Insets insets = container.getInsets();
+
+ int height = 0;
+ int width = 0;
+ for (int i = 0; i < components.length; i++)
+ {
+ if (components[i] == null)
+ continue;
+ Dimension dims = components[i].getMinimumSize();
+ if (dims != null)
+ {
+ height += dims.height;
+ width = Math.max(width, dims.width);
+ }
+ }
+ return new Dimension(width, height);
}
return null;
}
@@ -597,23 +597,23 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
if (container instanceof JSplitPane)
{
- JSplitPane split = (JSplitPane) container;
- Insets insets = container.getInsets();
-
- int height = 0;
- int width = 0;
- for (int i = 0; i < components.length; i++)
- {
- if (components[i] == null)
- continue;
- Dimension dims = components[i].getPreferredSize();
- if (dims != null)
- {
- height += dims.height;
- width = Math.max(width, dims.width);
- }
- }
- return new Dimension(width, height);
+ JSplitPane split = (JSplitPane) container;
+ Insets insets = container.getInsets();
+
+ int height = 0;
+ int width = 0;
+ for (int i = 0; i < components.length; i++)
+ {
+ if (components[i] == null)
+ continue;
+ Dimension dims = components[i].getPreferredSize();
+ if (dims != null)
+ {
+ height += dims.height;
+ width = Math.max(width, dims.width);
+ }
+ }
+ return new Dimension(width, height);
}
return null;
}
@@ -637,7 +637,6 @@ public class BasicSplitPaneUI extends SplitPaneUI
int x = insets.left;
int h = size;
int w = containerSize.width - insets.left - insets.right;
-
c.setBounds(x, y, w, h);
}
@@ -653,9 +652,9 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
Dimension dims = components[index].getMinimumSize();
if (dims != null)
- return dims.height;
+ return dims.height;
else
- return 0;
+ return 0;
}
}
@@ -814,30 +813,27 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
if (e.getPropertyName().equals(JSplitPane.DIVIDER_SIZE_PROPERTY))
{
- int newSize = splitPane.getDividerSize();
- int[] tmpSizes = layoutManager.getSizes();
- dividerSize = tmpSizes[2];
- Component left = splitPane.getLeftComponent();
- Component right = splitPane.getRightComponent();
- int newSpace = newSize - tmpSizes[2];
-
- tmpSizes[2] = newSize;
-
- tmpSizes[0] += newSpace / 2;
- tmpSizes[1] += newSpace / 2;
-
- layoutManager.setSizes(tmpSizes);
+ int newSize = splitPane.getDividerSize();
+ int[] tmpSizes = layoutManager.getSizes();
+ dividerSize = tmpSizes[2];
+ int newSpace = newSize - tmpSizes[2];
+ tmpSizes[2] = newSize;
+
+ tmpSizes[0] += newSpace / 2;
+ tmpSizes[1] += newSpace / 2;
+
+ layoutManager.setSizes(tmpSizes);
}
else if (e.getPropertyName().equals(JSplitPane.ORIENTATION_PROPERTY))
{
- int max = layoutManager.getAvailableSize(splitPane.getSize(),
- splitPane.getInsets());
- int dividerLoc = getDividerLocation(splitPane);
- double prop = ((double) dividerLoc) / max;
-
- resetLayoutManager();
- if (prop <= 1 && prop >= 0)
- splitPane.setDividerLocation(prop);
+ int max = layoutManager.getAvailableSize(splitPane.getSize(),
+ splitPane.getInsets());
+ int dividerLoc = getDividerLocation(splitPane);
+ double prop = ((double) dividerLoc) / max;
+
+ resetLayoutManager();
+ if (prop <= 1 && prop >= 0)
+ splitPane.setDividerLocation(prop);
}
layoutManager.layoutContainer(splitPane);
splitPane.repaint();
@@ -847,13 +843,13 @@ public class BasicSplitPaneUI extends SplitPaneUI
// Don't have to deal with resize_weight (as there
// will be no extra space associated with this
// event - the changes to the weighting will
- // be taken into account the next time the
+ // be taken into account the next time the
// sizes change.)
- // Don't have to deal with divider_location
+ // Don't have to deal with divider_location
// The method in JSplitPane calls our setDividerLocation
// so we'll know about those anyway.
// Don't have to deal with last_divider_location
- // Although I'm not sure why, it doesn't seem to
+ // Although I'm not sure why, it doesn't seem to
// have any effect on Sun's JSplitPane.
// one_touch_expandable changes are dealt with
// by our divider.
@@ -942,6 +938,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
public BasicSplitPaneUI()
{
+ // Nothing to do here.
}
/**
@@ -965,10 +962,10 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
if (c instanceof JSplitPane)
{
- splitPane = (JSplitPane) c;
- installDefaults();
- installListeners();
- installKeyboardActions();
+ splitPane = (JSplitPane) c;
+ installDefaults();
+ installListeners();
+ installKeyboardActions();
}
}
@@ -991,16 +988,16 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
protected void installDefaults()
{
+ LookAndFeel.installColors(splitPane, "SplitPane.background",
+ "SplitPane.foreground");
+ LookAndFeel.installBorder(splitPane, "SplitPane.border");
divider = createDefaultDivider();
resetLayoutManager();
nonContinuousLayoutDivider = createDefaultNonContinuousLayoutDivider();
splitPane.add(divider, JSplitPane.DIVIDER);
// There is no need to add the nonContinuousLayoutDivider
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- splitPane.setBackground(defaults.getColor("SplitPane.background"));
- splitPane.setBorder(defaults.getBorder("SplitPane.border"));
- splitPane.setDividerSize(defaults.getInt("SplitPane.dividerSize"));
+ splitPane.setDividerSize(UIManager.getInt("SplitPane.dividerSize"));
splitPane.setOpaque(true);
}
@@ -1221,8 +1218,8 @@ public class BasicSplitPaneUI extends SplitPaneUI
{
if (nonContinuousLayoutDivider == null)
{
- nonContinuousLayoutDivider = new Canvas();
- nonContinuousLayoutDivider.setBackground(Color.DARK_GRAY);
+ nonContinuousLayoutDivider = new Canvas();
+ nonContinuousLayoutDivider.setBackground(Color.DARK_GRAY);
}
return nonContinuousLayoutDivider;
}
@@ -1301,6 +1298,35 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
public void setDividerLocation(JSplitPane jc, int location)
{
+ location = validLocation(location);
+ Container p = jc.getParent();
+ Component right = jc.getRightComponent();
+ Dimension rightPrefSize = right == null ? new Dimension(0, 0)
+ : right.getPreferredSize();
+ Dimension size = jc.getSize();
+ // check if the size has been set for the splitpane
+ if (size.width == 0 && size.height == 0)
+ size = jc.getPreferredSize();
+
+ if (getOrientation() == 0 && location > size.height)
+ {
+ location = size.height;
+ while (p != null)
+ {
+ p.setSize(p.getWidth(), p.getHeight() + rightPrefSize.height);
+ p = p.getParent();
+ }
+ }
+ else if (location > size.width)
+ {
+ location = size.width;
+ while (p != null)
+ {
+ p.setSize(p.getWidth() + rightPrefSize.width, p.getHeight());
+ p = p.getParent();
+ }
+ }
+
setLastDragLocation(getDividerLocation(splitPane));
splitPane.setLastDividerLocation(getDividerLocation(splitPane));
int[] tmpSizes = layoutManager.getSizes();
@@ -1308,8 +1334,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
- layoutManager.getInitialLocation(splitPane.getInsets());
tmpSizes[1] = layoutManager.getAvailableSize(splitPane.getSize(),
splitPane.getInsets())
- - tmpSizes[0] - tmpSizes[1];
-
+ - tmpSizes[0];
layoutManager.setSizes(tmpSizes);
splitPane.revalidate();
splitPane.repaint();
@@ -1338,11 +1363,9 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
public int getMinimumDividerLocation(JSplitPane jc)
{
- int value = layoutManager.getInitialLocation(jc.getInsets())
- - layoutManager.getAvailableSize(jc.getSize(), jc.getInsets())
- + splitPane.getDividerSize();
- if (layoutManager.components[1] != null)
- value += layoutManager.minimumSizeOfComponent(1);
+ int value = layoutManager.getInitialLocation(jc.getInsets());
+ if (layoutManager.components[0] != null)
+ value -= layoutManager.minimumSizeOfComponent(0);
return value;
}
@@ -1388,6 +1411,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
public void paint(Graphics g, JComponent jc)
{
+ // TODO: What should be done here?
}
/**
@@ -1461,19 +1485,21 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
protected void startDragging()
{
+ Component left = splitPane.getLeftComponent();
+ Component right = splitPane.getRightComponent();
dividerSize = divider.getDividerSize();
setLastDragLocation(-1);
- if (! splitPane.getLeftComponent().isLightweight()
- || ! splitPane.getRightComponent().isLightweight())
+ if ((left != null && !left.isLightweight())
+ || (right != null && !right.isLightweight()))
draggingHW = true;
if (splitPane.isContinuousLayout())
nonContinuousLayoutDivider.setVisible(false);
else
{
- nonContinuousLayoutDivider.setVisible(true);
- nonContinuousLayoutDivider.setBounds(divider.getBounds());
+ nonContinuousLayoutDivider.setVisible(true);
+ nonContinuousLayoutDivider.setBounds(divider.getBounds());
}
splitPane.revalidate();
splitPane.repaint();
@@ -1496,12 +1522,12 @@ public class BasicSplitPaneUI extends SplitPaneUI
splitPane.setDividerLocation(location);
else
{
- Point p = nonContinuousLayoutDivider.getLocation();
- if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT)
- p.x = location;
- else
- p.y = location;
- nonContinuousLayoutDivider.setLocation(p);
+ Point p = nonContinuousLayoutDivider.getLocation();
+ if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT)
+ p.x = location;
+ else
+ p.y = location;
+ nonContinuousLayoutDivider.setLocation(p);
}
setLastDragLocation(location);
splitPane.repaint();
@@ -1550,10 +1576,12 @@ public class BasicSplitPaneUI extends SplitPaneUI
*/
private int validLocation(int location)
{
- if (location < getMinimumDividerLocation(splitPane))
- return getMinimumDividerLocation(splitPane);
- if (location > getMaximumDividerLocation(splitPane))
- return getMaximumDividerLocation(splitPane);
+ int min = getMinimumDividerLocation(splitPane);
+ int max = getMaximumDividerLocation(splitPane);
+ if (min > 0 && location < min)
+ return min;
+ if (max > 0 && location > max)
+ return max;
return location;
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
index 7e9d9b9820c..ce9ea3ec7f1 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java
@@ -64,9 +64,9 @@ import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JViewport;
import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -136,36 +136,36 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
{
- if (e.getSource() == incrButton)
- {
- if (++currentScrollLocation >= tabCount)
- currentScrollLocation = tabCount - 1;
-
- int width = 0;
- for (int i = currentScrollLocation - 1; i < tabCount; i++)
- width += rects[i].width;
- if (width < viewport.getWidth())
- // FIXME: Still getting mouse events after the button is disabled.
- // incrButton.setEnabled(false);
- currentScrollLocation--;
- else if (! decrButton.isEnabled())
- decrButton.setEnabled(true);
- tabPane.revalidate();
- tabPane.repaint();
- return;
- }
- else if (e.getSource() == decrButton)
- {
- if (--currentScrollLocation < 0)
- currentScrollLocation = 0;
- if (currentScrollLocation == 0)
- decrButton.setEnabled(false);
- else if (! incrButton.isEnabled())
- incrButton.setEnabled(true);
- tabPane.revalidate();
- tabPane.repaint();
- return;
- }
+ if (e.getSource() == incrButton)
+ {
+ if (++currentScrollLocation >= tabCount)
+ currentScrollLocation = tabCount - 1;
+
+ int width = 0;
+ for (int i = currentScrollLocation - 1; i < tabCount; i++)
+ width += rects[i].width;
+ if (width < viewport.getWidth())
+ // FIXME: Still getting mouse events after the button is disabled.
+ // incrButton.setEnabled(false);
+ currentScrollLocation--;
+ else if (! decrButton.isEnabled())
+ decrButton.setEnabled(true);
+ tabPane.revalidate();
+ tabPane.repaint();
+ return;
+ }
+ else if (e.getSource() == decrButton)
+ {
+ if (--currentScrollLocation < 0)
+ currentScrollLocation = 0;
+ if (currentScrollLocation == 0)
+ decrButton.setEnabled(false);
+ else if (! incrButton.isEnabled())
+ incrButton.setEnabled(true);
+ tabPane.revalidate();
+ tabPane.repaint();
+ return;
+ }
}
int index = tabForCoordinate(tabPane, x, y);
@@ -173,7 +173,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// We need to check since there are areas where tabs cannot be
// e.g. in the inset area.
if (index != -1 && tabPane.isEnabledAt(index))
- tabPane.setSelectedIndex(index);
+ tabPane.setSelectedIndex(index);
tabPane.revalidate();
tabPane.repaint();
}
@@ -198,15 +198,15 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
if (e.getPropertyName().equals("tabLayoutPolicy"))
{
- layoutManager = createLayoutManager();
-
- tabPane.setLayout(layoutManager);
+ layoutManager = createLayoutManager();
+
+ tabPane.setLayout(layoutManager);
}
else if (e.getPropertyName().equals("tabPlacement")
- && tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ && tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
{
- incrButton = createIncreaseButton();
- decrButton = createDecreaseButton();
+ incrButton = createIncreaseButton();
+ decrButton = createDecreaseButton();
}
tabPane.layout();
tabPane.repaint();
@@ -245,13 +245,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPane.getSelectedIndex() != -1)
{
- Component visible = getVisibleComponent();
- Insets insets = getContentBorderInsets(tabPane.getTabPlacement());
- if (visible != null)
- visible.setBounds(contentRect.x + insets.left,
- contentRect.y + insets.top,
- contentRect.width - insets.left - insets.right,
- contentRect.height - insets.top - insets.bottom);
+ Component visible = getVisibleComponent();
+ Insets insets = getContentBorderInsets(tabPane.getTabPlacement());
+ if (visible != null)
+ visible.setBounds(contentRect.x + insets.left,
+ contentRect.y + insets.top,
+ contentRect.width - insets.left - insets.right,
+ contentRect.height - insets.top - insets.bottom);
}
}
@@ -275,35 +275,35 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
Dimension dims;
for (int i = 0; i < tabPane.getTabCount(); i++)
{
- c = tabPane.getComponentAt(i);
- if (c == null)
- continue;
- calcRect = c.getBounds();
- dims = c.getPreferredSize();
- if (dims != null)
- {
- componentHeight = Math.max(componentHeight, dims.height);
- componentWidth = Math.max(componentWidth, dims.width);
- }
+ c = tabPane.getComponentAt(i);
+ if (c == null)
+ continue;
+ calcRect = c.getBounds();
+ dims = c.getPreferredSize();
+ if (dims != null)
+ {
+ componentHeight = Math.max(componentHeight, dims.height);
+ componentWidth = Math.max(componentWidth, dims.width);
+ }
}
Insets insets = tabPane.getInsets();
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- int min = calculateMaxTabWidth(tabPlacement);
- width = Math.max(min, componentWidth);
-
- int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width);
- height = tabAreaHeight + componentHeight;
+ int min = calculateMaxTabWidth(tabPlacement);
+ width = Math.max(min, componentWidth);
+
+ int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width);
+ height = tabAreaHeight + componentHeight;
}
else
{
- int min = calculateMaxTabHeight(tabPlacement);
- height = Math.max(min, componentHeight);
-
- int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height);
- width = tabAreaWidth + componentWidth;
+ int min = calculateMaxTabHeight(tabPlacement);
+ height = Math.max(min, componentHeight);
+
+ int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height);
+ width = tabAreaWidth + componentWidth;
}
return new Dimension(width, height);
@@ -330,7 +330,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected void calculateTabRects(int tabPlacement, int tabCount)
{
if (tabCount == 0)
- return;
+ return;
assureRectsCreated(tabCount);
FontMetrics fm = getFontMetrics();
@@ -343,113 +343,112 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- int maxHeight = calculateMaxTabHeight(tabPlacement);
-
- calcRect.width -= tabAreaInsets.left + tabAreaInsets.right;
- max = calcRect.width + tabAreaInsets.left + insets.left;
- start += tabAreaInsets.left + insets.left;
- int width = 0;
- int runWidth = start;
-
- for (int i = 0; i < tabCount; i++)
- {
- width = calculateTabWidth(tabPlacement, i, fm);
-
- if (runWidth + width > max)
- {
- runWidth = tabAreaInsets.left + insets.left
- + getTabRunIndent(tabPlacement, ++runs);
- rects[i] = new Rectangle(runWidth,
- insets.top + tabAreaInsets.top,
- width, maxHeight);
- runWidth += width;
- if (runs > tabRuns.length - 1)
- expandTabRunsArray();
- tabRuns[runs] = i;
- }
- else
- {
- rects[i] = new Rectangle(runWidth,
- insets.top + tabAreaInsets.top,
- width, maxHeight);
- runWidth += width;
- }
- }
- runs++;
- tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right;
- tabAreaRect.height = runs * maxTabHeight
- - (runs - 1) * tabRunOverlay
- + tabAreaInsets.top + tabAreaInsets.bottom;
- contentRect.width = tabAreaRect.width;
- contentRect.height = tabPane.getHeight() - insets.top
- - insets.bottom - tabAreaRect.height;
- contentRect.x = insets.left;
- tabAreaRect.x = insets.left;
- if (tabPlacement == SwingConstants.BOTTOM)
- {
- contentRect.y = insets.top;
- tabAreaRect.y = contentRect.y + contentRect.height;
- }
- else
- {
- tabAreaRect.y = insets.top;
- contentRect.y = tabAreaRect.y + tabAreaRect.height;
- }
+ int maxHeight = calculateMaxTabHeight(tabPlacement);
+
+ calcRect.width -= tabAreaInsets.left + tabAreaInsets.right;
+ max = calcRect.width + tabAreaInsets.left + insets.left;
+ start += tabAreaInsets.left + insets.left;
+ int width = 0;
+ int runWidth = start;
+
+ for (int i = 0; i < tabCount; i++)
+ {
+ width = calculateTabWidth(tabPlacement, i, fm);
+ if (runWidth + width > max)
+ {
+ runWidth = tabAreaInsets.left + insets.left
+ + getTabRunIndent(tabPlacement, ++runs);
+ rects[i] = new Rectangle(runWidth,
+ insets.top + tabAreaInsets.top,
+ width, maxHeight);
+ runWidth += width;
+ if (runs > tabRuns.length - 1)
+ expandTabRunsArray();
+ tabRuns[runs] = i;
+ }
+ else
+ {
+ rects[i] = new Rectangle(runWidth,
+ insets.top + tabAreaInsets.top,
+ width, maxHeight);
+ runWidth += width;
+ }
+ }
+ runs++;
+ tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right;
+ tabAreaRect.height = runs * maxTabHeight
+ - (runs - 1) * tabRunOverlay
+ + tabAreaInsets.top + tabAreaInsets.bottom;
+ contentRect.width = tabAreaRect.width;
+ contentRect.height = tabPane.getHeight() - insets.top
+ - insets.bottom - tabAreaRect.height;
+ contentRect.x = insets.left;
+ tabAreaRect.x = insets.left;
+ if (tabPlacement == SwingConstants.BOTTOM)
+ {
+ contentRect.y = insets.top;
+ tabAreaRect.y = contentRect.y + contentRect.height;
+ }
+ else
+ {
+ tabAreaRect.y = insets.top;
+ contentRect.y = tabAreaRect.y + tabAreaRect.height;
+ }
}
else
{
- int maxWidth = calculateMaxTabWidth(tabPlacement);
- calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom;
- max = calcRect.height + tabAreaInsets.top + insets.top;
-
- int height = 0;
- start += tabAreaInsets.top + insets.top;
- int runHeight = start;
-
- int fontHeight = fm.getHeight();
-
- for (int i = 0; i < tabCount; i++)
- {
- height = calculateTabHeight(tabPlacement, i, fontHeight);
- if (runHeight + height > max)
- {
- runHeight = tabAreaInsets.top + insets.top
- + getTabRunIndent(tabPlacement, ++runs);
- rects[i] = new Rectangle(insets.left + tabAreaInsets.left,
- runHeight, maxWidth, height);
- runHeight += height;
- if (runs > tabRuns.length - 1)
- expandTabRunsArray();
- tabRuns[runs] = i;
- }
- else
- {
- rects[i] = new Rectangle(insets.left + tabAreaInsets.left,
- runHeight, maxWidth, height);
- runHeight += height;
- }
- }
- runs++;
-
- tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay
- + tabAreaInsets.left + tabAreaInsets.right;
- tabAreaRect.height = tabPane.getHeight() - insets.top
- - insets.bottom;
- tabAreaRect.y = insets.top;
- contentRect.width = tabPane.getWidth() - insets.left - insets.right
- - tabAreaRect.width;
- contentRect.height = tabAreaRect.height;
- contentRect.y = insets.top;
- if (tabPlacement == SwingConstants.LEFT)
- {
- tabAreaRect.x = insets.left;
- contentRect.x = tabAreaRect.x + tabAreaRect.width;
- }
- else
- {
- contentRect.x = insets.left;
- tabAreaRect.x = contentRect.x + contentRect.width;
- }
+ int maxWidth = calculateMaxTabWidth(tabPlacement);
+ calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom;
+ max = calcRect.height + tabAreaInsets.top + insets.top;
+
+ int height = 0;
+ start += tabAreaInsets.top + insets.top;
+ int runHeight = start;
+
+ int fontHeight = fm.getHeight();
+
+ for (int i = 0; i < tabCount; i++)
+ {
+ height = calculateTabHeight(tabPlacement, i, fontHeight);
+ if (runHeight + height > max)
+ {
+ runHeight = tabAreaInsets.top + insets.top
+ + getTabRunIndent(tabPlacement, ++runs);
+ rects[i] = new Rectangle(insets.left + tabAreaInsets.left,
+ runHeight, maxWidth, height);
+ runHeight += height;
+ if (runs > tabRuns.length - 1)
+ expandTabRunsArray();
+ tabRuns[runs] = i;
+ }
+ else
+ {
+ rects[i] = new Rectangle(insets.left + tabAreaInsets.left,
+ runHeight, maxWidth, height);
+ runHeight += height;
+ }
+ }
+ runs++;
+
+ tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay
+ + tabAreaInsets.left + tabAreaInsets.right;
+ tabAreaRect.height = tabPane.getHeight() - insets.top
+ - insets.bottom;
+ tabAreaRect.y = insets.top;
+ contentRect.width = tabPane.getWidth() - insets.left - insets.right
+ - tabAreaRect.width;
+ contentRect.height = tabAreaRect.height;
+ contentRect.y = insets.top;
+ if (tabPlacement == SwingConstants.LEFT)
+ {
+ tabAreaRect.x = insets.left;
+ contentRect.x = tabAreaRect.x + tabAreaRect.width;
+ }
+ else
+ {
+ contentRect.x = insets.left;
+ tabAreaRect.x = contentRect.x + contentRect.width;
+ }
}
runCount = runs;
@@ -457,62 +456,62 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
normalizeTabRuns(tabPlacement, tabCount, start, max);
selectedRun = getRunForTab(tabCount, tabPane.getSelectedIndex());
if (shouldRotateTabRuns(tabPlacement))
- rotateTabRuns(tabPlacement, selectedRun);
+ rotateTabRuns(tabPlacement, selectedRun);
// Need to pad the runs and move them to the correct location.
for (int i = 0; i < runCount; i++)
{
- int first = lastTabInRun(tabCount, getPreviousTabRun(i)) + 1;
- if (first == tabCount)
- first = 0;
- int last = lastTabInRun(tabCount, i);
- if (shouldPadTabRun(tabPlacement, i))
- padTabRun(tabPlacement, first, last, max);
-
- // Done padding, now need to move it.
- if (tabPlacement == SwingConstants.TOP && i > 0)
- {
- for (int j = first; j <= last; j++)
- rects[j].y += (runCount - i) * maxTabHeight
- - (runCount - i) * tabRunOverlay;
- }
-
- if (tabPlacement == SwingConstants.BOTTOM)
- {
- int height = tabPane.getBounds().height - insets.bottom
- - tabAreaInsets.bottom;
- int adjustment;
- if (i == 0)
- adjustment = height - maxTabHeight;
- else
- adjustment = height - (runCount - i + 1) * maxTabHeight
- - (runCount - i) * tabRunOverlay;
-
- for (int j = first; j <= last; j++)
- rects[j].y = adjustment;
- }
-
- if (tabPlacement == SwingConstants.LEFT && i > 0)
- {
- for (int j = first; j <= last; j++)
- rects[j].x += (runCount - i) * maxTabWidth
- - (runCount - i) * tabRunOverlay;
- }
-
- if (tabPlacement == SwingConstants.RIGHT)
- {
- int width = tabPane.getBounds().width - insets.right
- - tabAreaInsets.right;
- int adjustment;
- if (i == 0)
- adjustment = width - maxTabWidth;
- else
- adjustment = width - (runCount - i + 1) * maxTabWidth
- + (runCount - i) * tabRunOverlay;
-
- for (int j = first; j <= last; j++)
- rects[j].x = adjustment;
- }
+ int first = lastTabInRun(tabCount, getPreviousTabRun(i)) + 1;
+ if (first == tabCount)
+ first = 0;
+ int last = lastTabInRun(tabCount, i);
+ if (shouldPadTabRun(tabPlacement, i))
+ padTabRun(tabPlacement, first, last, max);
+
+ // Done padding, now need to move it.
+ if (tabPlacement == SwingConstants.TOP && i > 0)
+ {
+ for (int j = first; j <= last; j++)
+ rects[j].y += (runCount - i) * maxTabHeight
+ - (runCount - i) * tabRunOverlay;
+ }
+
+ if (tabPlacement == SwingConstants.BOTTOM)
+ {
+ int height = tabPane.getBounds().height - insets.bottom
+ - tabAreaInsets.bottom;
+ int adjustment;
+ if (i == 0)
+ adjustment = height - maxTabHeight;
+ else
+ adjustment = height - (runCount - i + 1) * maxTabHeight
+ - (runCount - i) * tabRunOverlay;
+
+ for (int j = first; j <= last; j++)
+ rects[j].y = adjustment;
+ }
+
+ if (tabPlacement == SwingConstants.LEFT && i > 0)
+ {
+ for (int j = first; j <= last; j++)
+ rects[j].x += (runCount - i) * maxTabWidth
+ - (runCount - i) * tabRunOverlay;
+ }
+
+ if (tabPlacement == SwingConstants.RIGHT)
+ {
+ int width = tabPane.getBounds().width - insets.right
+ - tabAreaInsets.right;
+ int adjustment;
+ if (i == 0)
+ adjustment = width - maxTabWidth;
+ else
+ adjustment = width - (runCount - i + 1) * maxTabWidth
+ + (runCount - i) * tabRunOverlay;
+
+ for (int j = first; j <= last; j++)
+ rects[j].x = adjustment;
+ }
}
padSelectedTab(tabPlacement, tabPane.getSelectedIndex());
}
@@ -565,74 +564,74 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingUtilities.TOP
|| tabPlacement == SwingUtilities.BOTTOM)
{
- // We should only do this for runCount - 1, cause we can only shift that many times between
- // runs.
- for (int i = 1; i < runCount; i++)
- {
- Rectangle currRun = rects[lastTabInRun(tabCount, i)];
- Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];
- int spaceInCurr = currRun.x + currRun.width;
- int spaceInNext = nextRun.x + nextRun.width;
-
- int diffNow = spaceInCurr - spaceInNext;
- int diffLater = (spaceInCurr - currRun.width)
- - (spaceInNext + currRun.width);
- while (Math.abs(diffLater) < Math.abs(diffNow)
- && spaceInNext + currRun.width < max)
- {
- tabRuns[i]--;
- spaceInNext += currRun.width;
- spaceInCurr -= currRun.width;
- currRun = rects[lastTabInRun(tabCount, i)];
- diffNow = spaceInCurr - spaceInNext;
- diffLater = (spaceInCurr - currRun.width)
- - (spaceInNext + currRun.width);
- }
-
- // Fix the bounds.
- int first = lastTabInRun(tabCount, i) + 1;
- int last = lastTabInRun(tabCount, getNextTabRun(i));
- int currX = tabAreaInsets.left;
- for (int j = first; j <= last; j++)
- {
- rects[j].x = currX;
- currX += rects[j].width;
- }
- }
+ // We should only do this for runCount - 1, cause we can only shift that many times between
+ // runs.
+ for (int i = 1; i < runCount; i++)
+ {
+ Rectangle currRun = rects[lastTabInRun(tabCount, i)];
+ Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];
+ int spaceInCurr = currRun.x + currRun.width;
+ int spaceInNext = nextRun.x + nextRun.width;
+
+ int diffNow = spaceInCurr - spaceInNext;
+ int diffLater = (spaceInCurr - currRun.width)
+ - (spaceInNext + currRun.width);
+ while (Math.abs(diffLater) < Math.abs(diffNow)
+ && spaceInNext + currRun.width < max)
+ {
+ tabRuns[i]--;
+ spaceInNext += currRun.width;
+ spaceInCurr -= currRun.width;
+ currRun = rects[lastTabInRun(tabCount, i)];
+ diffNow = spaceInCurr - spaceInNext;
+ diffLater = (spaceInCurr - currRun.width)
+ - (spaceInNext + currRun.width);
+ }
+
+ // Fix the bounds.
+ int first = lastTabInRun(tabCount, i) + 1;
+ int last = lastTabInRun(tabCount, getNextTabRun(i));
+ int currX = tabAreaInsets.left;
+ for (int j = first; j <= last; j++)
+ {
+ rects[j].x = currX;
+ currX += rects[j].width;
+ }
+ }
}
else
{
- for (int i = 1; i < runCount; i++)
- {
- Rectangle currRun = rects[lastTabInRun(tabCount, i)];
- Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];
- int spaceInCurr = currRun.y + currRun.height;
- int spaceInNext = nextRun.y + nextRun.height;
-
- int diffNow = spaceInCurr - spaceInNext;
- int diffLater = (spaceInCurr - currRun.height)
- - (spaceInNext + currRun.height);
- while (Math.abs(diffLater) < Math.abs(diffNow)
- && spaceInNext + currRun.height < max)
- {
- tabRuns[i]--;
- spaceInNext += currRun.height;
- spaceInCurr -= currRun.height;
- currRun = rects[lastTabInRun(tabCount, i)];
- diffNow = spaceInCurr - spaceInNext;
- diffLater = (spaceInCurr - currRun.height)
- - (spaceInNext + currRun.height);
- }
-
- int first = lastTabInRun(tabCount, i) + 1;
- int last = lastTabInRun(tabCount, getNextTabRun(i));
- int currY = tabAreaInsets.top;
- for (int j = first; j <= last; j++)
- {
- rects[j].y = currY;
- currY += rects[j].height;
- }
- }
+ for (int i = 1; i < runCount; i++)
+ {
+ Rectangle currRun = rects[lastTabInRun(tabCount, i)];
+ Rectangle nextRun = rects[lastTabInRun(tabCount, getNextTabRun(i))];
+ int spaceInCurr = currRun.y + currRun.height;
+ int spaceInNext = nextRun.y + nextRun.height;
+
+ int diffNow = spaceInCurr - spaceInNext;
+ int diffLater = (spaceInCurr - currRun.height)
+ - (spaceInNext + currRun.height);
+ while (Math.abs(diffLater) < Math.abs(diffNow)
+ && spaceInNext + currRun.height < max)
+ {
+ tabRuns[i]--;
+ spaceInNext += currRun.height;
+ spaceInCurr -= currRun.height;
+ currRun = rects[lastTabInRun(tabCount, i)];
+ diffNow = spaceInCurr - spaceInNext;
+ diffLater = (spaceInCurr - currRun.height)
+ - (spaceInNext + currRun.height);
+ }
+
+ int first = lastTabInRun(tabCount, i) + 1;
+ int last = lastTabInRun(tabCount, getNextTabRun(i));
+ int currY = tabAreaInsets.top;
+ for (int j = first; j <= last; j++)
+ {
+ rects[j].y = currY;
+ currY += rects[j].height;
+ }
+ }
}
}
@@ -673,42 +672,42 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- int runWidth = rects[end].x + rects[end].width;
- int spaceRemaining = max - runWidth;
- int numTabs = end - start + 1;
-
- // now divvy up the space.
- int spaceAllocated = spaceRemaining / numTabs;
- int currX = rects[start].x;
- for (int i = start; i <= end; i++)
- {
- rects[i].x = currX;
- rects[i].width += spaceAllocated;
- currX += rects[i].width;
- // This is used because since the spaceAllocated
- // variable is an int, it rounds down. Sometimes,
- // we don't fill an entire row, so we make it do
- // so now.
- if (i == end && rects[i].x + rects[i].width != max)
- rects[i].width = max - rects[i].x;
- }
+ int runWidth = rects[end].x + rects[end].width;
+ int spaceRemaining = max - runWidth;
+ int numTabs = end - start + 1;
+
+ // now divvy up the space.
+ int spaceAllocated = spaceRemaining / numTabs;
+ int currX = rects[start].x;
+ for (int i = start; i <= end; i++)
+ {
+ rects[i].x = currX;
+ rects[i].width += spaceAllocated;
+ currX += rects[i].width;
+ // This is used because since the spaceAllocated
+ // variable is an int, it rounds down. Sometimes,
+ // we don't fill an entire row, so we make it do
+ // so now.
+ if (i == end && rects[i].x + rects[i].width != max)
+ rects[i].width = max - rects[i].x;
+ }
}
else
{
- int runHeight = rects[end].y + rects[end].height;
- int spaceRemaining = max - runHeight;
- int numTabs = end - start + 1;
-
- int spaceAllocated = spaceRemaining / numTabs;
- int currY = rects[start].y;
- for (int i = start; i <= end; i++)
- {
- rects[i].y = currY;
- rects[i].height += spaceAllocated;
- currY += rects[i].height;
- if (i == end && rects[i].y + rects[i].height != max)
- rects[i].height = max - rects[i].y;
- }
+ int runHeight = rects[end].y + rects[end].height;
+ int spaceRemaining = max - runHeight;
+ int numTabs = end - start + 1;
+
+ int spaceAllocated = spaceRemaining / numTabs;
+ int currY = rects[start].y;
+ for (int i = start; i <= end; i++)
+ {
+ rects[i].y = currY;
+ rects[i].height += spaceAllocated;
+ currY += rects[i].height;
+ if (i == end && rects[i].y + rects[i].height != max)
+ rects[i].height = max - rects[i].y;
+ }
}
}
@@ -736,7 +735,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected int preferredTabAreaHeight(int tabPlacement, int width)
{
if (tabPane.getTabCount() == 0)
- return calculateTabAreaHeight(tabPlacement, 0, 0);
+ return calculateTabAreaHeight(tabPlacement, 0, 0);
int runs = 0;
int runWidth = 0;
@@ -758,14 +757,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// be IF we got our desired width.
for (int i = 0; i < tabPane.getTabCount(); i++)
{
- tabWidth = calculateTabWidth(tabPlacement, i, fm);
- if (runWidth + tabWidth > width)
- {
- runWidth = tabWidth;
- runs++;
- }
- else
- runWidth += tabWidth;
+ tabWidth = calculateTabWidth(tabPlacement, i, fm);
+ if (runWidth + tabWidth > width)
+ {
+ runWidth = tabWidth;
+ runs++;
+ }
+ else
+ runWidth += tabWidth;
}
runs++;
@@ -787,7 +786,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected int preferredTabAreaWidth(int tabPlacement, int height)
{
if (tabPane.getTabCount() == 0)
- return calculateTabAreaHeight(tabPlacement, 0, 0);
+ return calculateTabAreaHeight(tabPlacement, 0, 0);
int runs = 0;
int runHeight = 0;
@@ -804,14 +803,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
for (int i = 0; i < tabPane.getTabCount(); i++)
{
- tabHeight = calculateTabHeight(tabPlacement, i, fontHeight);
- if (runHeight + tabHeight > height)
- {
- runHeight = tabHeight;
- runs++;
- }
- else
- runHeight += tabHeight;
+ tabHeight = calculateTabHeight(tabPlacement, i, fontHeight);
+ if (runHeight + tabHeight > height)
+ {
+ runHeight = tabHeight;
+ runs++;
+ }
+ else
+ runHeight += tabHeight;
}
runs++;
@@ -831,19 +830,19 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected void rotateTabRuns(int tabPlacement, int selectedRun)
{
if (runCount == 1 || selectedRun == 1 || selectedRun == -1)
- return;
+ return;
int[] newTabRuns = new int[tabRuns.length];
int currentRun = selectedRun;
int i = 1;
do
{
- newTabRuns[i] = tabRuns[currentRun];
- currentRun = getNextTabRun(currentRun);
- i++;
+ newTabRuns[i] = tabRuns[currentRun];
+ currentRun = getNextTabRun(currentRun);
+ i++;
}
while (i < runCount);
if (runCount > 1)
- newTabRuns[0] = tabRuns[currentRun];
+ newTabRuns[0] = tabRuns[currentRun];
tabRuns = newTabRuns;
BasicTabbedPaneUI.this.selectedRun = 1;
@@ -902,7 +901,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected int preferredTabAreaHeight(int tabPlacement, int width)
{
if (tabPane.getTabCount() == 0)
- return calculateTabAreaHeight(tabPlacement, 0, 0);
+ return calculateTabAreaHeight(tabPlacement, 0, 0);
int runs = 1;
@@ -923,7 +922,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected int preferredTabAreaWidth(int tabPlacement, int height)
{
if (tabPane.getTabCount() == 0)
- return calculateTabAreaHeight(tabPlacement, 0, 0);
+ return calculateTabAreaHeight(tabPlacement, 0, 0);
int runs = 1;
@@ -944,7 +943,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
protected void calculateTabRects(int tabPlacement, int tabCount)
{
if (tabCount == 0)
- return;
+ return;
assureRectsCreated(tabCount);
FontMetrics fm = getFontMetrics();
@@ -958,76 +957,76 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- int maxHeight = calculateMaxTabHeight(tabPlacement);
- calcRect.width -= tabAreaInsets.left + tabAreaInsets.right;
- max = calcRect.width + tabAreaInsets.left + insets.left;
- start = tabAreaInsets.left + insets.left;
- int width = 0;
- int runWidth = start;
- top = insets.top + tabAreaInsets.top;
- for (int i = 0; i < tabCount; i++)
- {
- width = calculateTabWidth(tabPlacement, i, fm);
-
- rects[i] = new Rectangle(runWidth, top, width, maxHeight);
- runWidth += width;
- }
- tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right;
- tabAreaRect.height = runs * maxTabHeight
- - (runs - 1) * tabRunOverlay
- + tabAreaInsets.top + tabAreaInsets.bottom;
- contentRect.width = tabAreaRect.width;
- contentRect.height = tabPane.getHeight() - insets.top
- - insets.bottom - tabAreaRect.height;
- contentRect.x = insets.left;
- tabAreaRect.x = insets.left;
- if (tabPlacement == SwingConstants.BOTTOM)
- {
- contentRect.y = insets.top;
- tabAreaRect.y = contentRect.y + contentRect.height;
- }
- else
- {
- tabAreaRect.y = insets.top;
- contentRect.y = tabAreaRect.y + tabAreaRect.height;
- }
+ int maxHeight = calculateMaxTabHeight(tabPlacement);
+ calcRect.width -= tabAreaInsets.left + tabAreaInsets.right;
+ max = calcRect.width + tabAreaInsets.left + insets.left;
+ start = tabAreaInsets.left + insets.left;
+ int width = 0;
+ int runWidth = start;
+ top = insets.top + tabAreaInsets.top;
+ for (int i = 0; i < tabCount; i++)
+ {
+ width = calculateTabWidth(tabPlacement, i, fm);
+
+ rects[i] = new Rectangle(runWidth, top, width, maxHeight);
+ runWidth += width;
+ }
+ tabAreaRect.width = tabPane.getWidth() - insets.left - insets.right;
+ tabAreaRect.height = runs * maxTabHeight
+ - (runs - 1) * tabRunOverlay
+ + tabAreaInsets.top + tabAreaInsets.bottom;
+ contentRect.width = tabAreaRect.width;
+ contentRect.height = tabPane.getHeight() - insets.top
+ - insets.bottom - tabAreaRect.height;
+ contentRect.x = insets.left;
+ tabAreaRect.x = insets.left;
+ if (tabPlacement == SwingConstants.BOTTOM)
+ {
+ contentRect.y = insets.top;
+ tabAreaRect.y = contentRect.y + contentRect.height;
+ }
+ else
+ {
+ tabAreaRect.y = insets.top;
+ contentRect.y = tabAreaRect.y + tabAreaRect.height;
+ }
}
else
{
- int maxWidth = calculateMaxTabWidth(tabPlacement);
-
- calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom;
- max = calcRect.height + tabAreaInsets.top;
- int height = 0;
- start = tabAreaInsets.top + insets.top;
- int runHeight = start;
- int fontHeight = fm.getHeight();
- top = insets.left + tabAreaInsets.left;
- for (int i = 0; i < tabCount; i++)
- {
- height = calculateTabHeight(tabPlacement, i, fontHeight);
- rects[i] = new Rectangle(top, runHeight, maxWidth, height);
- runHeight += height;
- }
- tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay
- + tabAreaInsets.left + tabAreaInsets.right;
- tabAreaRect.height = tabPane.getHeight() - insets.top
- - insets.bottom;
- tabAreaRect.y = insets.top;
- contentRect.width = tabPane.getWidth() - insets.left - insets.right
- - tabAreaRect.width;
- contentRect.height = tabAreaRect.height;
- contentRect.y = insets.top;
- if (tabPlacement == SwingConstants.LEFT)
- {
- tabAreaRect.x = insets.left;
- contentRect.x = tabAreaRect.x + tabAreaRect.width;
- }
- else
- {
- contentRect.x = insets.left;
- tabAreaRect.x = contentRect.x + contentRect.width;
- }
+ int maxWidth = calculateMaxTabWidth(tabPlacement);
+
+ calcRect.height -= tabAreaInsets.top + tabAreaInsets.bottom;
+ max = calcRect.height + tabAreaInsets.top;
+ int height = 0;
+ start = tabAreaInsets.top + insets.top;
+ int runHeight = start;
+ int fontHeight = fm.getHeight();
+ top = insets.left + tabAreaInsets.left;
+ for (int i = 0; i < tabCount; i++)
+ {
+ height = calculateTabHeight(tabPlacement, i, fontHeight);
+ rects[i] = new Rectangle(top, runHeight, maxWidth, height);
+ runHeight += height;
+ }
+ tabAreaRect.width = runs * maxTabWidth - (runs - 1) * tabRunOverlay
+ + tabAreaInsets.left + tabAreaInsets.right;
+ tabAreaRect.height = tabPane.getHeight() - insets.top
+ - insets.bottom;
+ tabAreaRect.y = insets.top;
+ contentRect.width = tabPane.getWidth() - insets.left - insets.right
+ - tabAreaRect.width;
+ contentRect.height = tabAreaRect.height;
+ contentRect.y = insets.top;
+ if (tabPlacement == SwingConstants.LEFT)
+ {
+ tabAreaRect.x = insets.left;
+ contentRect.x = tabAreaRect.x + tabAreaRect.width;
+ }
+ else
+ {
+ contentRect.x = insets.left;
+ tabAreaRect.x = contentRect.x + contentRect.width;
+ }
}
runCount = runs;
@@ -1047,68 +1046,68 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int tabCount = tabPane.getTabCount();
Point p = null;
if (tabCount == 0)
- return;
+ return;
int tabPlacement = tabPane.getTabPlacement();
incrButton.hide();
decrButton.hide();
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- if (tabAreaRect.x + tabAreaRect.width < rects[tabCount - 1].x
- + rects[tabCount - 1].width)
- {
- Dimension incrDims = incrButton.getPreferredSize();
- Dimension decrDims = decrButton.getPreferredSize();
-
- decrButton.setBounds(tabAreaRect.x + tabAreaRect.width
- - incrDims.width - decrDims.width,
- tabAreaRect.y, decrDims.width,
- tabAreaRect.height);
- incrButton.setBounds(tabAreaRect.x + tabAreaRect.width
- - incrDims.width, tabAreaRect.y,
- decrDims.width, tabAreaRect.height);
-
- tabAreaRect.width -= decrDims.width + incrDims.width;
- incrButton.show();
- decrButton.show();
- }
+ if (tabAreaRect.x + tabAreaRect.width < rects[tabCount - 1].x
+ + rects[tabCount - 1].width)
+ {
+ Dimension incrDims = incrButton.getPreferredSize();
+ Dimension decrDims = decrButton.getPreferredSize();
+
+ decrButton.setBounds(tabAreaRect.x + tabAreaRect.width
+ - incrDims.width - decrDims.width,
+ tabAreaRect.y, decrDims.width,
+ tabAreaRect.height);
+ incrButton.setBounds(tabAreaRect.x + tabAreaRect.width
+ - incrDims.width, tabAreaRect.y,
+ decrDims.width, tabAreaRect.height);
+
+ tabAreaRect.width -= decrDims.width + incrDims.width;
+ incrButton.show();
+ decrButton.show();
+ }
}
if (tabPlacement == SwingConstants.LEFT
|| tabPlacement == SwingConstants.RIGHT)
{
- if (tabAreaRect.y + tabAreaRect.height < rects[tabCount - 1].y
- + rects[tabCount - 1].height)
- {
- Dimension incrDims = incrButton.getPreferredSize();
- Dimension decrDims = decrButton.getPreferredSize();
-
- decrButton.setBounds(tabAreaRect.x,
- tabAreaRect.y + tabAreaRect.height
- - incrDims.height - decrDims.height,
- tabAreaRect.width, decrDims.height);
- incrButton.setBounds(tabAreaRect.x,
- tabAreaRect.y + tabAreaRect.height
- - incrDims.height, tabAreaRect.width,
- incrDims.height);
-
- tabAreaRect.height -= decrDims.height + incrDims.height;
- incrButton.show();
- decrButton.show();
- }
+ if (tabAreaRect.y + tabAreaRect.height < rects[tabCount - 1].y
+ + rects[tabCount - 1].height)
+ {
+ Dimension incrDims = incrButton.getPreferredSize();
+ Dimension decrDims = decrButton.getPreferredSize();
+
+ decrButton.setBounds(tabAreaRect.x,
+ tabAreaRect.y + tabAreaRect.height
+ - incrDims.height - decrDims.height,
+ tabAreaRect.width, decrDims.height);
+ incrButton.setBounds(tabAreaRect.x,
+ tabAreaRect.y + tabAreaRect.height
+ - incrDims.height, tabAreaRect.width,
+ incrDims.height);
+
+ tabAreaRect.height -= decrDims.height + incrDims.height;
+ incrButton.show();
+ decrButton.show();
+ }
}
viewport.setBounds(tabAreaRect.x, tabAreaRect.y, tabAreaRect.width,
tabAreaRect.height);
int tabC = tabPane.getTabCount() - 1;
if (tabCount > 0)
{
- int w = Math.max(rects[tabC].width + rects[tabC].x, tabAreaRect.width);
- int h = Math.max(rects[tabC].height, tabAreaRect.height);
- p = findPointForIndex(currentScrollLocation);
-
- // we want to cover that entire space so that borders that run under
- // the tab area don't show up when we move the viewport around.
- panel.setSize(w + p.x, h + p.y);
+ int w = Math.max(rects[tabC].width + rects[tabC].x, tabAreaRect.width);
+ int h = Math.max(rects[tabC].height, tabAreaRect.height);
+ p = findPointForIndex(currentScrollLocation);
+
+ // we want to cover that entire space so that borders that run under
+ // the tab area don't show up when we move the viewport around.
+ panel.setSize(w + p.x, h + p.y);
}
viewport.setViewPosition(p);
viewport.repaint();
@@ -1160,7 +1159,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
public void paint(Graphics g, JComponent c)
{
- paintTabArea(g, tabPane.getTabPlacement(), tabPane.getSelectedIndex());
+ paintTabArea(g, tabPane.getTabPlacement(), tabPane.getSelectedIndex());
}
}
@@ -1182,6 +1181,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
private class ScrollingViewport extends JViewport implements UIResource
{
+ // TODO: Maybe remove this inner class.
}
/**
@@ -1407,22 +1407,22 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == TOP || tabPlacement == BOTTOM)
{
- if (index > 0)
- {
- w += rects[index - 1].x + rects[index - 1].width;
- if (index > selectedIndex)
- w -= insets.left + insets.right;
- }
+ if (index > 0)
+ {
+ w += rects[index - 1].x + rects[index - 1].width;
+ if (index > selectedIndex)
+ w -= insets.left + insets.right;
+ }
}
else
{
- if (index > 0)
- {
- h += rects[index - 1].y + rects[index - 1].height;
- if (index > selectedIndex)
- h -= insets.top + insets.bottom;
- }
+ if (index > 0)
+ {
+ h += rects[index - 1].y + rects[index - 1].height;
+ if (index > selectedIndex)
+ h -= insets.top + insets.bottom;
+ }
}
Point p = new Point(w, h);
@@ -1451,16 +1451,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
super.installUI(c);
if (c instanceof JTabbedPane)
{
- tabPane = (JTabbedPane) c;
-
- installComponents();
- installDefaults();
- installListeners();
- installKeyboardActions();
-
- layoutManager = createLayoutManager();
- tabPane.setLayout(layoutManager);
- tabPane.layout();
+ tabPane = (JTabbedPane) c;
+
+ installComponents();
+ installDefaults();
+ installListeners();
+ installKeyboardActions();
+
+ layoutManager = createLayoutManager();
+ tabPane.setLayout(layoutManager);
+ tabPane.layout();
}
}
@@ -1495,23 +1495,23 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
return new TabbedPaneLayout();
else
{
- incrButton = createIncreaseButton();
- decrButton = createDecreaseButton();
- viewport = new ScrollingViewport();
- viewport.setLayout(null);
- panel = new ScrollingPanel();
- viewport.setView(panel);
- tabPane.add(incrButton);
- tabPane.add(decrButton);
- tabPane.add(viewport);
- currentScrollLocation = 0;
- decrButton.setEnabled(false);
- panel.addMouseListener(mouseListener);
- incrButton.addMouseListener(mouseListener);
- decrButton.addMouseListener(mouseListener);
- viewport.setBackground(Color.LIGHT_GRAY);
-
- return new TabbedPaneScrollLayout();
+ incrButton = createIncreaseButton();
+ decrButton = createDecreaseButton();
+ viewport = new ScrollingViewport();
+ viewport.setLayout(null);
+ panel = new ScrollingPanel();
+ viewport.setView(panel);
+ tabPane.add(incrButton);
+ tabPane.add(decrButton);
+ tabPane.add(viewport);
+ currentScrollLocation = 0;
+ decrButton.setEnabled(false);
+ panel.addMouseListener(mouseListener);
+ incrButton.addMouseListener(mouseListener);
+ decrButton.addMouseListener(mouseListener);
+ viewport.setBackground(Color.LIGHT_GRAY);
+
+ return new TabbedPaneScrollLayout();
}
}
@@ -1536,28 +1536,26 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- tabPane.setFont(defaults.getFont("TabbedPane.font"));
- tabPane.setForeground(defaults.getColor("TabbedPane.foreground"));
- tabPane.setBackground(defaults.getColor("TabbedPane.background"));
+ LookAndFeel.installColorsAndFont(tabPane, "TabbedPane.background",
+ "TabbedPane.foreground",
+ "TabbedPane.font");
tabPane.setOpaque(false);
- highlight = defaults.getColor("TabbedPane.highlight");
- lightHighlight = defaults.getColor("TabbedPane.lightHighlight");
+ highlight = UIManager.getColor("TabbedPane.highlight");
+ lightHighlight = UIManager.getColor("TabbedPane.lightHighlight");
- shadow = defaults.getColor("TabbedPane.shadow");
- darkShadow = defaults.getColor("TabbedPane.darkShadow");
+ shadow = UIManager.getColor("TabbedPane.shadow");
+ darkShadow = UIManager.getColor("TabbedPane.darkShadow");
- focus = defaults.getColor("TabbedPane.focus");
+ focus = UIManager.getColor("TabbedPane.focus");
- textIconGap = defaults.getInt("TabbedPane.textIconGap");
- tabRunOverlay = defaults.getInt("TabbedPane.tabRunOverlay");
+ textIconGap = UIManager.getInt("TabbedPane.textIconGap");
+ tabRunOverlay = UIManager.getInt("TabbedPane.tabRunOverlay");
- tabInsets = defaults.getInsets("TabbedPane.tabbedPaneTabInsets");
- selectedTabPadInsets = defaults.getInsets("TabbedPane.tabbedPaneTabPadInsets");
- tabAreaInsets = defaults.getInsets("TabbedPane.tabbedPaneTabAreaInsets");
- contentBorderInsets = defaults.getInsets("TabbedPane.tabbedPaneContentBorderInsets");
+ tabInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabInsets");
+ selectedTabPadInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabPadInsets");
+ tabAreaInsets = UIManager.getInsets("TabbedPane.tabbedPaneTabAreaInsets");
+ contentBorderInsets = UIManager.getInsets("TabbedPane.tabbedPaneContentBorderInsets");
calcRect = new Rectangle();
tabRuns = new int[10];
@@ -1737,38 +1735,42 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// we WANT to paint the outermost run first and then work our way in.
int tabCount = tabPane.getTabCount();
int currRun = 1;
+
+ if (tabCount > runCount)
+ runCount = tabCount;
+
if (tabCount < 1)
return;
-
+
if (runCount > 1)
- currRun = 0;
+ currRun = 0;
for (int i = 0; i < runCount; i++)
{
- int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
- if (isScroll)
- first = currentScrollLocation;
- else if (first == tabCount)
- first = 0;
- int last = lastTabInRun(tabCount, currRun);
- if (isScroll)
- {
- for (int k = first; k < tabCount; k++)
- {
- if (rects[k].x + rects[k].width - rects[first].x > viewport
- .getWidth())
- {
- last = k;
- break;
- }
- }
- }
-
- for (int j = first; j <= last; j++)
- {
- if (j != selectedIndex || isScroll)
- paintTab(g, tabPlacement, rects, j, ir, tr);
- }
- currRun = getPreviousTabRun(currRun);
+ int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
+ if (isScroll)
+ first = currentScrollLocation;
+ else if (first == tabCount)
+ first = 0;
+ int last = lastTabInRun(tabCount, currRun);
+ if (isScroll)
+ {
+ for (int k = first; k < tabCount; k++)
+ {
+ if (rects[k].x + rects[k].width - rects[first].x > viewport
+ .getWidth())
+ {
+ last = k;
+ break;
+ }
+ }
+ }
+
+ for (int j = first; j <= last; j++)
+ {
+ if (j != selectedIndex || isScroll)
+ paintTab(g, tabPlacement, rects, j, ir, tr);
+ }
+ currRun = getPreviousTabRun(currRun);
}
if (! isScroll)
paintTab(g, tabPlacement, rects, selectedIndex, ir, tr);
@@ -1800,24 +1802,24 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int h = calcRect.height;
if (getRunForTab(tabPane.getTabCount(), tabIndex) == 1)
{
- Insets insets = getTabAreaInsets(tabPlacement);
- switch (tabPlacement)
- {
- case TOP:
- h += insets.bottom;
- break;
- case LEFT:
- w += insets.right;
- break;
- case BOTTOM:
- y -= insets.top;
- h += insets.top;
- break;
- case RIGHT:
- x -= insets.left;
- w += insets.left;
- break;
- }
+ Insets insets = getTabAreaInsets(tabPlacement);
+ switch (tabPlacement)
+ {
+ case TOP:
+ h += insets.bottom;
+ break;
+ case LEFT:
+ w += insets.right;
+ break;
+ case BOTTOM:
+ y -= insets.top;
+ h += insets.top;
+ break;
+ case RIGHT:
+ x -= insets.left;
+ w += insets.left;
+ break;
+ }
}
layoutLabel(tabPlacement, fm, tabIndex, title, icon, calcRect, iconRect,
@@ -1856,7 +1858,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
SwingConstants.CENTER,
SwingConstants.CENTER,
SwingConstants.CENTER,
- SwingConstants.CENTER, tabRect,
+ SwingConstants.RIGHT, tabRect,
iconRect, textRect, textIconGap);
int shiftX = getTabLabelShiftX(tabPlacement, tabIndex, isSelected);
@@ -1904,8 +1906,8 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
View textView = getTextViewForTab(tabIndex);
if (textView != null)
{
- textView.paint(g, textRect);
- return;
+ textView.paint(g, textRect);
+ return;
}
Color fg = tabPane.getForegroundAt(tabIndex);
@@ -1921,37 +1923,37 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPane.isEnabledAt(tabIndex))
{
- g.setColor(fg);
+ g.setColor(fg);
- int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
+ int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
- if (mnemIndex != -1)
- BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
- textRect.x,
- textRect.y
- + metrics.getAscent());
- else
- g.drawString(title, textRect.x, textRect.y + metrics.getAscent());
+ if (mnemIndex != -1)
+ BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
+ textRect.x,
+ textRect.y
+ + metrics.getAscent());
+ else
+ g.drawString(title, textRect.x, textRect.y + metrics.getAscent());
}
else
{
- g.setColor(bg.brighter());
-
- int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
-
- if (mnemIndex != -1)
- BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
- textRect.x, textRect.y);
- else
- g.drawString(title, textRect.x, textRect.y);
-
- g.setColor(bg.darker());
- if (mnemIndex != -1)
- BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
- textRect.x + 1,
- textRect.y + 1);
- else
- g.drawString(title, textRect.x + 1, textRect.y + 1);
+ g.setColor(bg.brighter());
+
+ int mnemIndex = tabPane.getDisplayedMnemonicIndexAt(tabIndex);
+
+ if (mnemIndex != -1)
+ BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
+ textRect.x, textRect.y);
+ else
+ g.drawString(title, textRect.x, textRect.y);
+
+ g.setColor(bg.darker());
+ if (mnemIndex != -1)
+ BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex,
+ textRect.x + 1,
+ textRect.y + 1);
+ else
+ g.drawString(title, textRect.x + 1, textRect.y + 1);
}
g.setColor(saved_color);
@@ -2037,30 +2039,30 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (! isSelected || tabPlacement != SwingConstants.TOP)
{
- g.setColor(shadow);
- g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
- g.setColor(darkShadow);
- g.drawLine(x, y + h, x + w, y + h);
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.setColor(darkShadow);
+ g.drawLine(x, y + h, x + w, y + h);
}
if (! isSelected || tabPlacement != SwingConstants.LEFT)
{
- g.setColor(darkShadow);
- g.drawLine(x + w, y, x + w, y + h);
- g.setColor(shadow);
- g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ g.setColor(darkShadow);
+ g.drawLine(x + w, y, x + w, y + h);
+ g.setColor(shadow);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
}
if (! isSelected || tabPlacement != SwingConstants.RIGHT)
{
- g.setColor(lightHighlight);
- g.drawLine(x, y, x, y + h);
+ g.setColor(lightHighlight);
+ g.drawLine(x, y, x, y + h);
}
if (! isSelected || tabPlacement != SwingConstants.BOTTOM)
{
- g.setColor(lightHighlight);
- g.drawLine(x, y, x + w, y);
+ g.setColor(lightHighlight);
+ g.drawLine(x, y, x + w, y);
}
g.setColor(saved);
@@ -2087,10 +2089,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
g.setColor(Color.LIGHT_GRAY);
else
{
- Color bg = tabPane.getBackgroundAt(tabIndex);
- if (bg == null)
- bg = Color.GRAY;
- g.setColor(bg);
+ Color bg = tabPane.getBackgroundAt(tabIndex);
+ if (bg == null)
+ bg = Color.GRAY;
+ g.setColor(bg);
}
g.fillRect(x, y, w, h);
@@ -2144,14 +2146,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP)
{
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.x;
- }
-
- g.drawLine(x, y, startgap - diff, y);
- g.drawLine(endgap - diff, y, x + w, y);
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.x;
+ }
+
+ g.drawLine(x, y, startgap - diff, y);
+ g.drawLine(endgap - diff, y, x + w, y);
}
else
g.drawLine(x, y, x + w, y);
@@ -2184,14 +2186,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.LEFT)
{
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.y;
- }
-
- g.drawLine(x, y, x, startgap - diff);
- g.drawLine(x, endgap - diff, x, y + h);
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.y;
+ }
+
+ g.drawLine(x, y, x, startgap - diff);
+ g.drawLine(x, endgap - diff, x, y + h);
}
else
g.drawLine(x, y, x, y + h);
@@ -2223,26 +2225,26 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.BOTTOM)
{
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.x;
- }
-
- g.setColor(shadow);
- g.drawLine(x + 1, y + h - 1, startgap - diff, y + h - 1);
- g.drawLine(endgap - diff, y + h - 1, x + w - 1, y + h - 1);
-
- g.setColor(darkShadow);
- g.drawLine(x, y + h, startgap - diff, y + h);
- g.drawLine(endgap - diff, y + h, x + w, y + h);
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.x;
+ }
+
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 1, startgap - diff, y + h - 1);
+ g.drawLine(endgap - diff, y + h - 1, x + w - 1, y + h - 1);
+
+ g.setColor(darkShadow);
+ g.drawLine(x, y + h, startgap - diff, y + h);
+ g.drawLine(endgap - diff, y + h, x + w, y + h);
}
else
{
- g.setColor(shadow);
- g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
- g.setColor(darkShadow);
- g.drawLine(x, y + h, x + w, y + h);
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.setColor(darkShadow);
+ g.drawLine(x, y + h, x + w, y + h);
}
g.setColor(saved);
@@ -2271,26 +2273,26 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.RIGHT)
{
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.y;
- }
-
- g.setColor(shadow);
- g.drawLine(x + w - 1, y + 1, x + w - 1, startgap - diff);
- g.drawLine(x + w - 1, endgap - diff, x + w - 1, y + h - 1);
-
- g.setColor(darkShadow);
- g.drawLine(x + w, y, x + w, startgap - diff);
- g.drawLine(x + w, endgap - diff, x + w, y + h);
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.y;
+ }
+
+ g.setColor(shadow);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, startgap - diff);
+ g.drawLine(x + w - 1, endgap - diff, x + w - 1, y + h - 1);
+
+ g.setColor(darkShadow);
+ g.drawLine(x + w, y, x + w, startgap - diff);
+ g.drawLine(x + w, endgap - diff, x + w, y + h);
}
else
{
- g.setColor(shadow);
- g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
- g.setColor(darkShadow);
- g.drawLine(x + w, y, x + w, y + h);
+ g.setColor(shadow);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ g.setColor(darkShadow);
+ g.drawLine(x + w, y, x + w, y + h);
}
g.setColor(saved);
@@ -2337,16 +2339,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int currRun = 1;
for (int i = 0; i < runCount; i++)
{
- int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
- if (first == tabCount)
- first = 0;
- int last = lastTabInRun(tabCount, currRun);
- for (int j = first; j <= last; j++)
- {
- if (getTabBounds(pane, j).contains(p))
- return j;
- }
- currRun = getNextTabRun(currRun);
+ int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
+ if (first == tabCount)
+ first = 0;
+ int last = lastTabInRun(tabCount, currRun);
+ for (int j = first; j <= last; j++)
+ {
+ if (getTabBounds(pane, j).contains(p))
+ return j;
+ }
+ currRun = getNextTabRun(currRun);
}
return -1;
}
@@ -2400,10 +2402,10 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
return;
else
{
- int numToCopy = Math.min(tabCount, rects.length);
- Rectangle[] tmp = new Rectangle[tabCount];
- System.arraycopy(rects, 0, tmp, 0, numToCopy);
- rects = tmp;
+ int numToCopy = Math.min(tabCount, rects.length);
+ Rectangle[] tmp = new Rectangle[tabCount];
+ System.arraycopy(rects, 0, tmp, 0, numToCopy);
+ rects = tmp;
}
}
@@ -2418,9 +2420,9 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
tabRuns = new int[10];
else
{
- int[] newRuns = new int[tabRuns.length + 10];
- System.arraycopy(tabRuns, 0, newRuns, 0, tabRuns.length);
- tabRuns = newRuns;
+ int[] newRuns = new int[tabRuns.length + 10];
+ System.arraycopy(tabRuns, 0, newRuns, 0, tabRuns.length);
+ tabRuns = newRuns;
}
}
@@ -2438,12 +2440,12 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
return 1;
for (int i = 0; i < runCount; i++)
{
- int first = lastTabInRun(tabCount, getPreviousTabRun(i)) + 1;
- if (first == tabCount)
- first = 0;
- int last = lastTabInRun(tabCount, i);
- if (last >= tabIndex && first <= tabIndex)
- return i;
+ int first = lastTabInRun(tabCount, getPreviousTabRun(i)) + 1;
+ if (first == tabCount)
+ first = 0;
+ int last = lastTabInRun(tabCount, i);
+ if (last >= tabIndex && first <= tabIndex)
+ return i;
}
return -1;
}
@@ -2560,21 +2562,22 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
Icon icon = getIconForTab(tabIndex);
Insets insets = getTabInsets(tabPlacement, tabIndex);
+ int height = 0;
if (icon != null)
{
- Rectangle vr = new Rectangle();
- Rectangle ir = new Rectangle();
- Rectangle tr = new Rectangle();
- layoutLabel(tabPlacement, getFontMetrics(), tabIndex,
- tabPane.getTitleAt(tabIndex), icon, vr, ir, tr,
- tabIndex == tabPane.getSelectedIndex());
- calcRect = tr.union(ir);
+ Rectangle vr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle tr = new Rectangle();
+ layoutLabel(tabPlacement, getFontMetrics(), tabIndex,
+ tabPane.getTitleAt(tabIndex), icon, vr, ir, tr,
+ tabIndex == tabPane.getSelectedIndex());
+ height = tr.union(ir).height;
}
else
- calcRect.height = fontHeight;
+ height = fontHeight;
- calcRect.height += insets.top + insets.bottom;
- return calcRect.height;
+ height += insets.top + insets.bottom;
+ return height;
}
/**
@@ -2614,21 +2617,22 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
Icon icon = getIconForTab(tabIndex);
Insets insets = getTabInsets(tabPlacement, tabIndex);
+ int width = 0;
if (icon != null)
{
- Rectangle vr = new Rectangle();
- Rectangle ir = new Rectangle();
- Rectangle tr = new Rectangle();
- layoutLabel(tabPlacement, getFontMetrics(), tabIndex,
- tabPane.getTitleAt(tabIndex), icon, vr, ir, tr,
- tabIndex == tabPane.getSelectedIndex());
- calcRect = tr.union(ir);
+ Rectangle vr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle tr = new Rectangle();
+ layoutLabel(tabPlacement, getFontMetrics(), tabIndex,
+ tabPane.getTitleAt(tabIndex), icon, vr, ir, tr,
+ tabIndex == tabPane.getSelectedIndex());
+ width = tr.union(ir).width;
}
else
- calcRect.width = metrics.stringWidth(tabPane.getTitleAt(tabIndex));
+ width = metrics.stringWidth(tabPane.getTitleAt(tabIndex));
- calcRect.width += insets.left + insets.right;
- return calcRect.width;
+ width += insets.left + insets.right;
+ return width;
}
/**
@@ -2775,37 +2779,37 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- if (direction == SwingConstants.WEST)
- selectPreviousTabInRun(tabPane.getSelectedIndex());
- else if (direction == SwingConstants.EAST)
- selectNextTabInRun(tabPane.getSelectedIndex());
-
- else
- {
- int offset = getTabRunOffset(tabPlacement, tabPane.getTabCount(),
- tabPane.getSelectedIndex(),
- (tabPlacement == SwingConstants.RIGHT)
- ? true : false);
- selectAdjacentRunTab(tabPlacement, tabPane.getSelectedIndex(),
- offset);
- }
+ if (direction == SwingConstants.WEST)
+ selectPreviousTabInRun(tabPane.getSelectedIndex());
+ else if (direction == SwingConstants.EAST)
+ selectNextTabInRun(tabPane.getSelectedIndex());
+
+ else
+ {
+ int offset = getTabRunOffset(tabPlacement, tabPane.getTabCount(),
+ tabPane.getSelectedIndex(),
+ (tabPlacement == SwingConstants.RIGHT)
+ ? true : false);
+ selectAdjacentRunTab(tabPlacement, tabPane.getSelectedIndex(),
+ offset);
+ }
}
if (tabPlacement == SwingConstants.LEFT
|| tabPlacement == SwingConstants.RIGHT)
{
- if (direction == SwingConstants.NORTH)
- selectPreviousTabInRun(tabPane.getSelectedIndex());
- else if (direction == SwingConstants.SOUTH)
- selectNextTabInRun(tabPane.getSelectedIndex());
- else
- {
- int offset = getTabRunOffset(tabPlacement, tabPane.getTabCount(),
- tabPane.getSelectedIndex(),
- (tabPlacement == SwingConstants.RIGHT)
- ? true : false);
- selectAdjacentRunTab(tabPlacement, tabPane.getSelectedIndex(),
- offset);
- }
+ if (direction == SwingConstants.NORTH)
+ selectPreviousTabInRun(tabPane.getSelectedIndex());
+ else if (direction == SwingConstants.SOUTH)
+ selectNextTabInRun(tabPane.getSelectedIndex());
+ else
+ {
+ int offset = getTabRunOffset(tabPlacement, tabPane.getTabCount(),
+ tabPane.getSelectedIndex(),
+ (tabPlacement == SwingConstants.RIGHT)
+ ? true : false);
+ selectAdjacentRunTab(tabPlacement, tabPane.getSelectedIndex(),
+ offset);
+ }
}
}
@@ -2869,16 +2873,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int y = rects[tabIndex].y + rects[tabIndex].height / 2;
switch (tabPlacement)
- {
- case SwingConstants.TOP:
- case SwingConstants.BOTTOM:
- y += offset;
- break;
- case SwingConstants.RIGHT:
- case SwingConstants.LEFT:
- x += offset;
- break;
- }
+ {
+ case SwingConstants.TOP:
+ case SwingConstants.BOTTOM:
+ y += offset;
+ break;
+ case SwingConstants.RIGHT:
+ case SwingConstants.LEFT:
+ x += offset;
+ break;
+ }
int index = tabForCoordinate(tabPane, x, y);
if (index != -1)
@@ -3042,31 +3046,31 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// Sun's version will happily throw an NPE if params are null,
// so I won't check it either.
switch (targetPlacement)
- {
- case SwingConstants.TOP:
- targetInsets.top = topInsets.top;
- targetInsets.left = topInsets.left;
- targetInsets.right = topInsets.right;
- targetInsets.bottom = topInsets.bottom;
- break;
- case SwingConstants.LEFT:
- targetInsets.left = topInsets.top;
- targetInsets.top = topInsets.left;
- targetInsets.right = topInsets.bottom;
- targetInsets.bottom = topInsets.right;
- break;
- case SwingConstants.BOTTOM:
- targetInsets.top = topInsets.bottom;
- targetInsets.bottom = topInsets.top;
- targetInsets.left = topInsets.left;
- targetInsets.right = topInsets.right;
- break;
- case SwingConstants.RIGHT:
- targetInsets.top = topInsets.left;
- targetInsets.left = topInsets.bottom;
- targetInsets.bottom = topInsets.right;
- targetInsets.right = topInsets.top;
- break;
- }
+ {
+ case SwingConstants.TOP:
+ targetInsets.top = topInsets.top;
+ targetInsets.left = topInsets.left;
+ targetInsets.right = topInsets.right;
+ targetInsets.bottom = topInsets.bottom;
+ break;
+ case SwingConstants.LEFT:
+ targetInsets.left = topInsets.top;
+ targetInsets.top = topInsets.left;
+ targetInsets.right = topInsets.bottom;
+ targetInsets.bottom = topInsets.right;
+ break;
+ case SwingConstants.BOTTOM:
+ targetInsets.top = topInsets.bottom;
+ targetInsets.bottom = topInsets.top;
+ targetInsets.left = topInsets.left;
+ targetInsets.right = topInsets.right;
+ break;
+ case SwingConstants.RIGHT:
+ targetInsets.top = topInsets.left;
+ targetInsets.left = topInsets.bottom;
+ targetInsets.bottom = topInsets.right;
+ targetInsets.right = topInsets.top;
+ break;
+ }
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java
index 700b406d076..ec0467a74f3 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTableHeaderUI.java
@@ -46,7 +46,7 @@ import java.awt.event.MouseEvent;
import javax.swing.CellRendererPane;
import javax.swing.JComponent;
-import javax.swing.UIDefaults;
+import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.MouseInputListener;
@@ -57,8 +57,7 @@ import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
-public class BasicTableHeaderUI
- extends TableHeaderUI
+public class BasicTableHeaderUI extends TableHeaderUI
{
public static ComponentUI createUI(JComponent h)
@@ -71,16 +70,42 @@ public class BasicTableHeaderUI
protected CellRendererPane rendererPane;
protected Border cellBorder;
- class MouseInputHandler
- implements MouseInputListener
+ public class MouseInputHandler implements MouseInputListener
{
- public void mouseClicked(MouseEvent e) {}
- public void mouseDragged(MouseEvent e) {}
- public void mouseEntered(MouseEvent e) {}
- public void mouseExited(MouseEvent e) {}
- public void mouseMoved(MouseEvent e) {}
- public void mousePressed(MouseEvent e) {}
- public void mouseReleased(MouseEvent e) {}
+ public void mouseClicked(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseDragged(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseEntered(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseExited(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseMoved(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mousePressed(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
+
+ public void mouseReleased(MouseEvent e)
+ {
+ // TODO: Implement this properly.
+ }
}
protected MouseInputListener createMouseInputListener()
@@ -95,15 +120,15 @@ public class BasicTableHeaderUI
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- header.setBackground(defaults.getColor("TableHeader.background"));
- header.setForeground(defaults.getColor("TableHeader.foreground"));
- header.setFont(defaults.getFont("TableHeader.font"));
- cellBorder = defaults.getBorder("TableHeader.cellBorder");
+ LookAndFeel.installColorsAndFont(header, "TableHeader.background",
+ "TableHeader.foreground",
+ "TableHeader.font");
+ cellBorder = UIManager.getBorder("TableHeader.cellBorder");
}
protected void installKeyboardActions()
{
+ // TODO: Implement this properly.
}
protected void installListeners()
@@ -128,6 +153,7 @@ public class BasicTableHeaderUI
protected void uninstallKeyboardActions()
{
+ // TODO: Implement this properly.
}
protected void uninstallListeners()
@@ -157,6 +183,7 @@ public class BasicTableHeaderUI
Rectangle bounds = header.getHeaderRect(i);
if (bounds.intersects(clip))
{
+ Rectangle oldClip = gfx.getClipBounds();
TableColumn col = cmod.getColumn(i);
TableCellRenderer rend = col.getHeaderRenderer();
if (rend == null)
@@ -173,10 +200,12 @@ public class BasicTableHeaderUI
if (comp instanceof JComponent)
((JComponent)comp).setBorder(cellBorder);
gfx.translate(bounds.x, bounds.y);
+ gfx.setClip(0, 0, bounds.width, bounds.height);
comp.setSize(bounds.width, bounds.height);
comp.setLocation(0,0);
comp.paint(gfx);
gfx.translate(-bounds.x, -bounds.y);
+ gfx.setClip(oldClip);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
index 4559937eb69..015443946d7 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTableUI.java
@@ -49,35 +49,37 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
-import javax.swing.BorderFactory;
import javax.swing.CellRendererPane;
+import javax.swing.DefaultListSelectionModel;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.ListSelectionModel;
-import javax.swing.UIDefaults;
+import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.TableUI;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
-public class BasicTableUI
- extends TableUI
+public class BasicTableUI extends TableUI
{
public static ComponentUI createUI(JComponent comp)
{
@@ -93,23 +95,72 @@ public class BasicTableUI
/** The normal cell border. */
Border cellBorder;
- /** The cell border for selected/highlighted cells. */
- Border highlightCellBorder;
-
/** The action bound to KeyStrokes. */
TableAction action;
- class FocusHandler implements FocusListener
+ /**
+ * Listens for changes to the tables properties.
+ */
+ private PropertyChangeListener propertyChangeListener;
+
+ /**
+ * Handles key events for the JTable. Key events should be handled through
+ * the InputMap/ActionMap mechanism since JDK1.3. This class is only there
+ * for backwards compatibility.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public class KeyHandler implements KeyListener
+ {
+
+ /**
+ * Receives notification that a key has been pressed and released.
+ *
+ * @param event the key event
+ */
+ public void keyTyped(KeyEvent event)
+ {
+ // Key events should be handled through the InputMap/ActionMap mechanism
+ // since JDK1.3. This class is only there for backwards compatibility.
+ }
+
+ /**
+ * Receives notification that a key has been pressed.
+ *
+ * @param event the key event
+ */
+ public void keyPressed(KeyEvent event)
+ {
+ // Key events should be handled through the InputMap/ActionMap mechanism
+ // since JDK1.3. This class is only there for backwards compatibility.
+ }
+
+ /**
+ * Receives notification that a key has been released.
+ *
+ * @param event the key event
+ */
+ public void keyReleased(KeyEvent event)
+ {
+ // Key events should be handled through the InputMap/ActionMap mechanism
+ // since JDK1.3. This class is only there for backwards compatibility.
+ }
+ }
+
+ public class FocusHandler implements FocusListener
{
public void focusGained(FocusEvent e)
{
+ // TODO: Implement this properly.
}
+
public void focusLost(FocusEvent e)
{
+ // TODO: Implement this properly.
}
}
- class MouseInputHandler implements MouseInputListener
+ public class MouseInputHandler implements MouseInputListener
{
Point begin, curr;
@@ -145,54 +196,123 @@ public class BasicTableUI
public void mouseClicked(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
+
public void mouseDragged(MouseEvent e)
{
- curr = new Point(e.getX(), e.getY());
- updateSelection(e.isControlDown());
+ if (table.isEnabled())
+ {
+ curr = new Point(e.getX(), e.getY());
+ updateSelection(e.isControlDown());
+ }
}
+
public void mouseEntered(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
+
public void mouseExited(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
+
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
+
public void mousePressed(MouseEvent e)
{
- ListSelectionModel rowModel = table.getSelectionModel();
- ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
- int rowLead = rowModel.getLeadSelectionIndex();
- int colLead = colModel.getLeadSelectionIndex();
+ if (table.isEnabled())
+ {
+ ListSelectionModel rowModel = table.getSelectionModel();
+ ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
+ int rowLead = rowModel.getLeadSelectionIndex();
+ int colLead = colModel.getLeadSelectionIndex();
- begin = new Point(e.getX(), e.getY());
- curr = new Point(e.getX(), e.getY());
- //if control is pressed and the cell is already selected, deselect it
- if (e.isControlDown() && table.
- isCellSelected(table.rowAtPoint(begin),table.columnAtPoint(begin)))
- {
- table.getSelectionModel().
- removeSelectionInterval(table.rowAtPoint(begin),
- table.rowAtPoint(begin));
- table.getColumnModel().getSelectionModel().
- removeSelectionInterval(table.columnAtPoint(begin),
- table.columnAtPoint(begin));
- }
- else
- updateSelection(e.isControlDown());
+ begin = new Point(e.getX(), e.getY());
+ curr = new Point(e.getX(), e.getY());
+ //if control is pressed and the cell is already selected, deselect it
+ if (e.isControlDown() && table.
+ isCellSelected(table.rowAtPoint(begin),table.columnAtPoint(begin)))
+ {
+ table.getSelectionModel().
+ removeSelectionInterval(table.rowAtPoint(begin),
+ table.rowAtPoint(begin));
+ table.getColumnModel().getSelectionModel().
+ removeSelectionInterval(table.columnAtPoint(begin),
+ table.columnAtPoint(begin));
+ }
+ else
+ updateSelection(e.isControlDown());
- // If we were editing, but the moved to another cell, stop editing
- if (rowLead != rowModel.getLeadSelectionIndex() ||
- colLead != colModel.getLeadSelectionIndex())
- if (table.isEditing())
- table.editingStopped(new ChangeEvent(e));
+ // If we were editing, but the moved to another cell, stop editing
+ if (rowLead != rowModel.getLeadSelectionIndex() ||
+ colLead != colModel.getLeadSelectionIndex())
+ if (table.isEditing())
+ table.editingStopped(new ChangeEvent(e));
+ }
}
+
public void mouseReleased(MouseEvent e)
{
- begin = null;
- curr = null;
+ if (table.isEnabled())
+ {
+ begin = null;
+ curr = null;
+ }
+ }
+ }
+
+ /**
+ * Listens for changes to the model property of the JTable and adjusts some
+ * settings.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class PropertyChangeHandler implements PropertyChangeListener
+ {
+ /**
+ * Receives notification if one of the JTable's properties changes.
+ *
+ * @param ev the property change event
+ */
+ public void propertyChange(PropertyChangeEvent ev)
+ {
+ String propName = ev.getPropertyName();
+ if (propName.equals("model"))
+ {
+ ListSelectionModel rowSel = table.getSelectionModel();
+ rowSel.clearSelection();
+ ListSelectionModel colSel = table.getColumnModel().getSelectionModel();
+ colSel.clearSelection();
+ TableModel model = table.getModel();
+
+ // Adjust lead and anchor selection indices of the row and column
+ // selection models.
+ if (model.getRowCount() > 0)
+ {
+ rowSel.setAnchorSelectionIndex(0);
+ rowSel.setLeadSelectionIndex(0);
+ }
+ else
+ {
+ rowSel.setAnchorSelectionIndex(-1);
+ rowSel.setLeadSelectionIndex(-1);
+ }
+ if (model.getColumnCount() > 0)
+ {
+ colSel.setAnchorSelectionIndex(0);
+ colSel.setLeadSelectionIndex(0);
+ }
+ else
+ {
+ colSel.setAnchorSelectionIndex(-1);
+ colSel.setLeadSelectionIndex(-1);
+ }
+ }
}
}
@@ -206,6 +326,17 @@ public class BasicTableUI
return new MouseInputHandler();
}
+
+ /**
+ * Creates and returns a key listener for the JTable.
+ *
+ * @return a key listener for the JTable
+ */
+ protected KeyListener createKeyListener()
+ {
+ return new KeyHandler();
+ }
+
/**
* Return the maximum size of the table. The maximum height is the row
* height times the number of rows. The maximum width is the sum of
@@ -255,76 +386,35 @@ public class BasicTableUI
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- table.setFont(defaults.getFont("Table.font"));
- table.setGridColor(defaults.getColor("Table.gridColor"));
- table.setForeground(defaults.getColor("Table.foreground"));
- table.setBackground(defaults.getColor("Table.background"));
- table.setSelectionForeground(defaults.getColor("Table.selectionForeground"));
- table.setSelectionBackground(defaults.getColor("Table.selectionBackground"));
+ LookAndFeel.installColorsAndFont(table, "Table.background",
+ "Table.foreground", "Table.font");
+ table.setGridColor(UIManager.getColor("Table.gridColor"));
+ table.setSelectionForeground(UIManager.getColor("Table.selectionForeground"));
+ table.setSelectionBackground(UIManager.getColor("Table.selectionBackground"));
table.setOpaque(true);
-
- highlightCellBorder = defaults.getBorder("Table.focusCellHighlightBorder");
- cellBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1);
- }
-
- private int convertModifiers(int mod)
- {
- if ((mod & KeyEvent.SHIFT_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.SHIFT_MASK;
- mod &= ~KeyEvent.SHIFT_DOWN_MASK;
- }
- if ((mod & KeyEvent.CTRL_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.CTRL_MASK;
- mod &= ~KeyEvent.CTRL_DOWN_MASK;
- }
- if ((mod & KeyEvent.META_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.META_MASK;
- mod &= ~KeyEvent.META_DOWN_MASK;
- }
- if ((mod & KeyEvent.ALT_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.ALT_MASK;
- mod &= ~KeyEvent.ALT_DOWN_MASK;
- }
- if ((mod & KeyEvent.ALT_GRAPH_DOWN_MASK) != 0)
- {
- mod |= KeyEvent.ALT_GRAPH_MASK;
- mod &= ~KeyEvent.ALT_GRAPH_DOWN_MASK;
- }
- return mod;
+ rendererPane = new CellRendererPane();
}
protected void installKeyboardActions()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- InputMap ancestorMap = (InputMap)defaults.get("Table.ancestorInputMap");
+ InputMap ancestorMap = (InputMap) UIManager.get("Table.ancestorInputMap");
InputMapUIResource parentInputMap = new InputMapUIResource();
// FIXME: The JDK uses a LazyActionMap for parentActionMap
- ActionMap parentActionMap = new ActionMap();
+ ActionMap parentActionMap = new ActionMapUIResource();
action = new TableAction();
Object keys[] = ancestorMap.allKeys();
// Register key bindings in the UI InputMap-ActionMap pair
- // Note that we register key bindings with both the old and new modifier
- // masks: InputEvent.SHIFT_MASK and InputEvent.SHIFT_DOWN_MASK and so on.
for (int i = 0; i < keys.length; i++)
{
- parentInputMap.put(KeyStroke.getKeyStroke
- (((KeyStroke)keys[i]).getKeyCode(), convertModifiers
- (((KeyStroke)keys[i]).getModifiers())),
- (String)ancestorMap.get((KeyStroke)keys[i]));
+ KeyStroke stroke = (KeyStroke)keys[i];
+ String actionString = (String) ancestorMap.get(stroke);
- parentInputMap.put(KeyStroke.getKeyStroke
- (((KeyStroke)keys[i]).getKeyCode(),
- ((KeyStroke)keys[i]).getModifiers()),
- (String)ancestorMap.get((KeyStroke)keys[i]));
+ parentInputMap.put(KeyStroke.getKeyStroke(stroke.getKeyCode(),
+ stroke.getModifiers()),
+ actionString);
- parentActionMap.put
- ((String)ancestorMap.get((KeyStroke)keys[i]), new ActionListenerProxy
- (action, (String)ancestorMap.get((KeyStroke)keys[i])));
+ parentActionMap.put (actionString,
+ new ActionListenerProxy (action, actionString));
}
// Set the UI InputMap-ActionMap pair to be the parents of the
@@ -383,8 +473,8 @@ public class BasicTableUI
*/
public void actionPerformed (ActionEvent e)
{
- ListSelectionModel rowModel = table.getSelectionModel();
- ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
+ DefaultListSelectionModel rowModel = (DefaultListSelectionModel) table.getSelectionModel();
+ DefaultListSelectionModel colModel = (DefaultListSelectionModel) table.getColumnModel().getSelectionModel();
int rowLead = rowModel.getLeadSelectionIndex();
int rowMax = table.getModel().getRowCount() - 1;
@@ -392,74 +482,75 @@ public class BasicTableUI
int colLead = colModel.getLeadSelectionIndex();
int colMax = table.getModel().getColumnCount() - 1;
- if (e.getActionCommand().equals("selectPreviousRowExtendSelection"))
+ String command = e.getActionCommand();
+
+ if (command.equals("selectPreviousRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(Math.max(rowLead - 1, 0));
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("selectLastColumn"))
+ else if (command.equals("selectLastColumn"))
{
- table.clearSelection();
rowModel.setSelectionInterval(rowLead, rowLead);
colModel.setSelectionInterval(colMax, colMax);
}
- else if (e.getActionCommand().equals("startEditing"))
+ else if (command.equals("startEditing"))
{
if (table.isCellEditable(rowLead, colLead))
table.editCellAt(rowLead,colLead);
}
- else if (e.getActionCommand().equals("selectFirstRowExtendSelection"))
+ else if (command.equals("selectFirstRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(0);
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("selectFirstColumn"))
+ else if (command.equals("selectFirstColumn"))
{
rowModel.setSelectionInterval(rowLead, rowLead);
colModel.setSelectionInterval(0, 0);
}
- else if (e.getActionCommand().equals("selectFirstColumnExtendSelection"))
+ else if (command.equals("selectFirstColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(0);
rowModel.setLeadSelectionIndex(rowLead);
- }
- else if (e.getActionCommand().equals("selectLastRow"))
+ }
+ else if (command.equals("selectLastRow"))
{
rowModel.setSelectionInterval(rowMax,rowMax);
colModel.setSelectionInterval(colLead, colLead);
}
- else if (e.getActionCommand().equals("selectNextRowExtendSelection"))
+ else if (command.equals("selectNextRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(Math.min(rowLead + 1, rowMax));
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("selectFirstRow"))
+ else if (command.equals("selectFirstRow"))
{
rowModel.setSelectionInterval(0,0);
colModel.setSelectionInterval(colLead, colLead);
}
- else if (e.getActionCommand().equals("selectNextColumnExtendSelection"))
+ else if (command.equals("selectNextColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(Math.min(colLead + 1, colMax));
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("selectLastColumnExtendSelection"))
+ else if (command.equals("selectLastColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(colMax);
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("selectPreviousColumnExtendSelection"))
+ else if (command.equals("selectPreviousColumnExtendSelection"))
{
colModel.setLeadSelectionIndex(Math.max(colLead - 1, 0));
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("selectNextRow"))
+ else if (command.equals("selectNextRow"))
{
rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax),
Math.min(rowLead + 1, rowMax));
colModel.setSelectionInterval(colLead,colLead);
}
- else if (e.getActionCommand().equals("scrollUpExtendSelection"))
+ else if (command.equals("scrollUpExtendSelection"))
{
int target;
if (rowLead == getFirstVisibleRowIndex())
@@ -472,13 +563,13 @@ public class BasicTableUI
rowModel.setLeadSelectionIndex(target);
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("selectPreviousRow"))
+ else if (command.equals("selectPreviousRow"))
{
rowModel.setSelectionInterval(Math.max(rowLead - 1, 0),
Math.max(rowLead - 1, 0));
colModel.setSelectionInterval(colLead,colLead);
}
- else if (e.getActionCommand().equals("scrollRightChangeSelection"))
+ else if (command.equals("scrollRightChangeSelection"))
{
int target;
if (colLead == getLastVisibleColumnIndex())
@@ -491,13 +582,13 @@ public class BasicTableUI
colModel.setSelectionInterval(target, target);
rowModel.setSelectionInterval(rowLead, rowLead);
}
- else if (e.getActionCommand().equals("selectPreviousColumn"))
+ else if (command.equals("selectPreviousColumn"))
{
rowModel.setSelectionInterval(rowLead,rowLead);
colModel.setSelectionInterval(Math.max(colLead - 1, 0),
Math.max(colLead - 1, 0));
}
- else if (e.getActionCommand().equals("scrollLeftChangeSelection"))
+ else if (command.equals("scrollLeftChangeSelection"))
{
int target;
if (colLead == getFirstVisibleColumnIndex())
@@ -510,11 +601,11 @@ public class BasicTableUI
colModel.setSelectionInterval(target, target);
rowModel.setSelectionInterval(rowLead, rowLead);
}
- else if (e.getActionCommand().equals("clearSelection"))
+ else if (command.equals("clearSelection"))
{
table.clearSelection();
}
- else if (e.getActionCommand().equals("cancel"))
+ else if (command.equals("cancel"))
{
// FIXME: implement other parts of "cancel" like undo-ing last
// selection. Right now it just calls editingCancelled if
@@ -522,10 +613,10 @@ public class BasicTableUI
if (table.isEditing())
table.editingCanceled(new ChangeEvent("cancel"));
}
- else if (e.getActionCommand().equals("selectNextRowCell")
- || e.getActionCommand().equals("selectPreviousRowCell")
- || e.getActionCommand().equals("selectNextColumnCell")
- || e.getActionCommand().equals("selectPreviousColumnCell"))
+ else if (command.equals("selectNextRowCell")
+ || command.equals("selectPreviousRowCell")
+ || command.equals("selectNextColumnCell")
+ || command.equals("selectPreviousColumnCell"))
{
// If nothing is selected, select the first cell in the table
if (table.getSelectedRowCount() == 0 &&
@@ -561,13 +652,13 @@ public class BasicTableUI
// when you get to the edges of the table.
if (!multColsSelected && !multRowsSelected)
{
- if (e.getActionCommand().indexOf("Column") != -1)
+ if (command.indexOf("Column") != -1)
advanceSingleSelection(colModel, colMax, rowModel, rowMax,
- (e.getActionCommand().equals
+ (command.equals
("selectPreviousColumnCell")));
else
advanceSingleSelection(rowModel, rowMax, colModel, colMax,
- (e.getActionCommand().equals
+ (command.equals
("selectPreviousRowCell")));
return;
}
@@ -588,25 +679,25 @@ public class BasicTableUI
// If there are multiple rows and columns selected, select the next
// cell and wrap at the edges of the selection.
- if (e.getActionCommand().indexOf("Column") != -1)
+ if (command.indexOf("Column") != -1)
advanceMultipleSelection(colModel, colMinSelected, colMaxSelected,
rowModel, rowMinSelected, rowMaxSelected,
- (e.getActionCommand().equals
+ (command.equals
("selectPreviousColumnCell")), true);
else
advanceMultipleSelection(rowModel, rowMinSelected, rowMaxSelected,
colModel, colMinSelected, colMaxSelected,
- (e.getActionCommand().equals
+ (command.equals
("selectPreviousRowCell")), false);
}
- else if (e.getActionCommand().equals("selectNextColumn"))
+ else if (command.equals("selectNextColumn"))
{
rowModel.setSelectionInterval(rowLead,rowLead);
colModel.setSelectionInterval(Math.min(colLead + 1, colMax),
Math.min(colLead + 1, colMax));
}
- else if (e.getActionCommand().equals("scrollLeftExtendSelection"))
+ else if (command.equals("scrollLeftExtendSelection"))
{
int target;
if (colLead == getFirstVisibleColumnIndex())
@@ -619,7 +710,7 @@ public class BasicTableUI
colModel.setLeadSelectionIndex(target);
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("scrollDownChangeSelection"))
+ else if (command.equals("scrollDownChangeSelection"))
{
int target;
if (rowLead == getLastVisibleRowIndex())
@@ -632,7 +723,7 @@ public class BasicTableUI
rowModel.setSelectionInterval(target, target);
colModel.setSelectionInterval(colLead, colLead);
}
- else if (e.getActionCommand().equals("scrollRightExtendSelection"))
+ else if (command.equals("scrollRightExtendSelection"))
{
int target;
if (colLead == getLastVisibleColumnIndex())
@@ -645,16 +736,16 @@ public class BasicTableUI
colModel.setLeadSelectionIndex(target);
rowModel.setLeadSelectionIndex(rowLead);
}
- else if (e.getActionCommand().equals("selectAll"))
+ else if (command.equals("selectAll"))
{
table.selectAll();
}
- else if (e.getActionCommand().equals("selectLastRowExtendSelection"))
+ else if (command.equals("selectLastRowExtendSelection"))
{
rowModel.setLeadSelectionIndex(rowMax);
colModel.setLeadSelectionIndex(colLead);
}
- else if (e.getActionCommand().equals("scrollDownExtendSelection"))
+ else if (command.equals("scrollDownExtendSelection"))
{
int target;
if (rowLead == getLastVisibleRowIndex())
@@ -666,8 +757,8 @@ public class BasicTableUI
rowModel.setLeadSelectionIndex(target);
colModel.setLeadSelectionIndex(colLead);
- }
- else if (e.getActionCommand().equals("scrollUpChangeSelection"))
+ }
+ else if (command.equals("scrollUpChangeSelection"))
{
int target;
if (rowLead == getFirstVisibleRowIndex())
@@ -680,22 +771,119 @@ public class BasicTableUI
rowModel.setSelectionInterval(target, target);
colModel.setSelectionInterval(colLead, colLead);
}
+ else if (command.equals("selectNextRowChangeLead"))
+ {
+ if (rowModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ {
+ // just "selectNextRow"
+ rowModel.setSelectionInterval(Math.min(rowLead + 1, rowMax),
+ Math.min(rowLead + 1, rowMax));
+ colModel.setSelectionInterval(colLead,colLead);
+ }
+ else
+ rowModel.moveLeadSelectionIndex(Math.min(rowLead + 1, rowMax));
+ }
+ else if (command.equals("selectPreviousRowChangeLead"))
+ {
+ if (rowModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ {
+ // just selectPreviousRow
+ rowModel.setSelectionInterval(Math.max(rowLead - 1, 0),
+ Math.min(rowLead -1, 0));
+ colModel.setSelectionInterval(colLead,colLead);
+ }
+ else
+ rowModel.moveLeadSelectionIndex(Math.max(rowLead - 1, 0));
+ }
+ else if (command.equals("selectNextColumnChangeLead"))
+ {
+ if (colModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ {
+ // just selectNextColumn
+ rowModel.setSelectionInterval(rowLead,rowLead);
+ colModel.setSelectionInterval(Math.min(colLead + 1, colMax),
+ Math.min(colLead + 1, colMax));
+ }
+ else
+ colModel.moveLeadSelectionIndex(Math.min(colLead + 1, colMax));
+ }
+ else if (command.equals("selectPreviousColumnChangeLead"))
+ {
+ if (colModel.getSelectionMode() != ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+ {
+ // just selectPreviousColumn
+ rowModel.setSelectionInterval(rowLead,rowLead);
+ colModel.setSelectionInterval(Math.max(colLead - 1, 0),
+ Math.max(colLead - 1, 0));
+
+ }
+ else
+ colModel.moveLeadSelectionIndex(Math.max(colLead - 1, 0));
+ }
+ else if (command.equals("addToSelection"))
+ {
+ if (!table.isEditing())
+ {
+ int oldRowAnchor = rowModel.getAnchorSelectionIndex();
+ int oldColAnchor = colModel.getAnchorSelectionIndex();
+ rowModel.addSelectionInterval(rowLead, rowLead);
+ colModel.addSelectionInterval(colLead, colLead);
+ rowModel.setAnchorSelectionIndex(oldRowAnchor);
+ colModel.setAnchorSelectionIndex(oldColAnchor);
+ }
+ }
+ else if (command.equals("extendTo"))
+ {
+ rowModel.setSelectionInterval(rowModel.getAnchorSelectionIndex(),
+ rowLead);
+ colModel.setSelectionInterval(colModel.getAnchorSelectionIndex(),
+ colLead);
+ }
+ else if (command.equals("toggleAndAnchor"))
+ {
+ if (rowModel.isSelectedIndex(rowLead))
+ rowModel.removeSelectionInterval(rowLead, rowLead);
+ else
+ rowModel.addSelectionInterval(rowLead, rowLead);
+
+ if (colModel.isSelectedIndex(colLead))
+ colModel.removeSelectionInterval(colLead, colLead);
+ else
+ colModel.addSelectionInterval(colLead, colLead);
+
+ rowModel.setAnchorSelectionIndex(rowLead);
+ colModel.setAnchorSelectionIndex(colLead);
+ }
else
{
// If we're here that means we bound this TableAction class
// to a keyboard input but we either want to ignore that input
// or we just haven't implemented its action yet.
+
+ // Uncomment the following line to print the names of unused bindings
+ // when their keys are pressed
+
+ // System.out.println ("not implemented: "+e.getActionCommand());
}
- if (table.isEditing() && e.getActionCommand() != "startEditing")
- table.editingCanceled(new ChangeEvent("update"));
- table.repaint();
-
+ // Any commands whose keyStrokes should be used by the Editor should not
+ // cause editing to be stopped: ie, the SPACE sends "addToSelection" but
+ // if the table is in editing mode, the space should not cause us to stop
+ // editing because it should be used by the Editor.
+ if (table.isEditing() && command != "startEditing"
+ && command != "addToSelection")
+ table.editingStopped(new ChangeEvent("update"));
+
table.scrollRectToVisible
(table.getCellRect(rowModel.getLeadSelectionIndex(),
colModel.getLeadSelectionIndex(), false));
+ table.repaint();
}
+ /**
+ * Returns the column index of the first visible column.
+ * @return the column index of the first visible column.
+ */
int getFirstVisibleColumnIndex()
{
ComponentOrientation or = table.getComponentOrientation();
@@ -922,10 +1110,19 @@ public class BasicTableUI
protected void installListeners()
{
- table.addFocusListener(focusListener);
+ if (focusListener == null)
+ focusListener = createFocusListener();
+ table.addFocusListener(focusListener);
+ if (keyListener == null)
+ keyListener = createKeyListener();
table.addKeyListener(keyListener);
+ if (mouseInputListener == null)
+ mouseInputListener = createMouseInputListener();
table.addMouseListener(mouseInputListener);
table.addMouseMotionListener(mouseInputListener);
+ if (propertyChangeListener == null)
+ propertyChangeListener = new PropertyChangeHandler();
+ table.addPropertyChangeListener(propertyChangeListener);
}
protected void uninstallDefaults()
@@ -950,6 +1147,7 @@ public class BasicTableUI
protected void uninstallKeyboardActions()
{
+ // TODO: Implement this properly.
}
protected void uninstallListeners()
@@ -958,13 +1156,13 @@ public class BasicTableUI
table.removeKeyListener(keyListener);
table.removeMouseListener(mouseInputListener);
table.removeMouseMotionListener(mouseInputListener);
+ table.removePropertyChangeListener(propertyChangeListener);
+ propertyChangeListener = null;
}
public void installUI(JComponent comp)
{
table = (JTable)comp;
- focusListener = createFocusListener();
- mouseInputListener = createMouseInputListener();
installDefaults();
installKeyboardActions();
installListeners();
@@ -977,6 +1175,60 @@ public class BasicTableUI
uninstallDefaults();
}
+ /**
+ * Paints a single cell in the table.
+ *
+ * @param g The graphics context to paint in
+ * @param row The row number to paint
+ * @param col The column number to paint
+ * @param bounds The bounds of the cell to paint, assuming a coordinate
+ * system beginning at <code>(0,0)</code> in the upper left corner of the
+ * table
+ * @param rend A cell renderer to paint with
+ * @param data The data to provide to the cell renderer
+ * @param rowLead The lead selection for the rows of the table.
+ * @param colLead The lead selection for the columns of the table.
+ */
+ void paintCell(Graphics g, int row, int col, Rectangle bounds,
+ TableCellRenderer rend, TableModel data,
+ int rowLead, int colLead)
+ {
+ boolean rowSelAllowed = table.getRowSelectionAllowed();
+ boolean colSelAllowed = table.getColumnSelectionAllowed();
+ boolean isSel = false;
+ if (rowSelAllowed && colSelAllowed || !rowSelAllowed && !colSelAllowed)
+ isSel = table.isCellSelected(row, col);
+ else
+ isSel = table.isRowSelected(row) && table.getRowSelectionAllowed()
+ || table.isColumnSelected(col) && table.getColumnSelectionAllowed();
+
+ // Determine the focused cell. The focused cell is the cell at the
+ // leadSelectionIndices of the row and column selection model.
+ ListSelectionModel rowSel = table.getSelectionModel();
+ ListSelectionModel colSel = table.getColumnModel().getSelectionModel();
+ boolean hasFocus = table.hasFocus() && table.isEnabled()
+ && rowSel.getLeadSelectionIndex() == row
+ && colSel.getLeadSelectionIndex() == col;
+
+ Component comp = rend.getTableCellRendererComponent(table,
+ data.getValueAt(row, col),
+ isSel, hasFocus, row, col);
+
+ rendererPane.paintComponent(g, comp, table, bounds);
+
+ // FIXME: this is manual painting of the Caret, why doesn't the
+ // JTextField take care of this itself?
+ if (comp instanceof JTextField)
+ {
+ Rectangle oldClip = g.getClipBounds();
+ g.translate(bounds.x, bounds.y);
+ g.clipRect(0, 0, bounds.width, bounds.height);
+ ((JTextField)comp).getCaret().paint(g);
+ g.translate(-bounds.x, -bounds.y);
+ g.setClip(oldClip);
+ }
+ }
+
public void paint(Graphics gfx, JComponent ignored)
{
int ncols = table.getColumnCount();
@@ -1002,40 +1254,24 @@ public class BasicTableUI
y = y0;
TableColumn col = cols.getColumn(c);
int width = col.getWidth();
- int modelCol = col.getModelIndex();
-
+ int halfGapWidth = gap.width / 2;
+ int halfGapHeight = gap.height / 2;
for (int r = 0; r < nrows && y < ymax; ++r)
{
- Rectangle bounds = new Rectangle(x, y, width, height);
- if (bounds.intersects(clip))
- {
- TableCellRenderer rend = table.getCellRenderer(r, c);
- Component comp = table.prepareRenderer(rend, r, c);
- gfx.translate(x, y);
- comp.setBounds(new Rectangle(0, 0, width, height));
- // Set correct border on cell renderer.
- // Only the lead selection cell gets a border
- if (comp instanceof JComponent)
- {
- if (table.getSelectionModel().getLeadSelectionIndex() == r
- && table.getColumnModel().getSelectionModel().
- getLeadSelectionIndex() == c)
- ((JComponent) comp).setBorder(highlightCellBorder);
- else
- ((JComponent) comp).setBorder(cellBorder);
- }
- comp.paint(gfx);
- if (comp instanceof JTextField)
- ((JTextField)comp).getCaret().paint(gfx);
- gfx.translate(-x, -y);
+ Rectangle bounds = new Rectangle(x + halfGapWidth,
+ y + halfGapHeight + 1,
+ width - gap.width + 1,
+ height - gap.height);
+ if (bounds.intersects(clip))
+ {
+ paintCell(gfx, r, c, bounds, table.getCellRenderer(r, c),
+ table.getModel(),
+ table.getSelectionModel().getLeadSelectionIndex(),
+ table.getColumnModel().getSelectionModel().getLeadSelectionIndex());
}
- y += height;
- if (gap != null)
- y += gap.height;
+ y += height;
}
x += width;
- if (gap != null)
- x += gap.width;
}
// tighten up the x and y max bounds
@@ -1044,7 +1280,7 @@ public class BasicTableUI
Color grid = table.getGridColor();
- // paint vertical grid lines
+ // paint vertical grid lines
if (grid != null && table.getShowVerticalLines())
{
x = x0;
@@ -1053,9 +1289,7 @@ public class BasicTableUI
boolean paintedLine = false;
for (int c = 0; c < ncols && x < xmax; ++c)
{
- x += cols.getColumn(c).getWidth();;
- if (gap != null)
- x += gap.width;
+ x += cols.getColumn(c).getWidth();
gfx.drawLine(x, y0, x, ymax);
paintedLine = true;
}
@@ -1072,8 +1306,6 @@ public class BasicTableUI
for (int r = 0; r < nrows && y < ymax; ++r)
{
y += height;
- if (gap != null)
- y += gap.height;
gfx.drawLine(x0, y, xmax, y);
paintedLine = true;
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java
index 97b0ccb6ee6..36854e07fe0 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextAreaUI.java
@@ -39,11 +39,16 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.beans.PropertyChangeEvent;
+
import javax.swing.JComponent;
+import javax.swing.JTextArea;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
import javax.swing.text.PlainView;
import javax.swing.text.View;
+import javax.swing.text.WrappedPlainView;
public class BasicTextAreaUI extends BasicTextUI
{
@@ -54,15 +59,55 @@ public class BasicTextAreaUI extends BasicTextUI
public BasicTextAreaUI()
{
+ // Nothing to do here.
}
+ /**
+ * Create the view. Returns a WrappedPlainView if the text area
+ * has lineWrap set to true, otherwise returns a PlainView. If
+ * lineWrap is true has to check whether the wrap style is word
+ * or character and return an appropriate WrappedPlainView.
+ *
+ * @param elem the element to create a View for
+ * @return an appropriate View for the element
+ */
public View create(Element elem)
{
- return new PlainView(elem);
+ JTextArea comp = (JTextArea)getComponent();
+ if (comp.getLineWrap())
+ {
+ if (comp.getWrapStyleWord())
+ return new WrappedPlainView(elem, true);
+ else
+ return new WrappedPlainView(elem, false);
+ }
+ else
+ return new PlainView(elem);
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "TextArea"
+ */
protected String getPropertyPrefix()
{
return "TextArea";
}
+
+ /**
+ * Receives notification whenever one of the text component's bound
+ * properties changes. This changes the view to WrappedPlainView
+ * if setLineWrap(true) is called, and back to PlainView if
+ * setLineWrap(false) is called.
+ *
+ * @param ev the property change event
+ */
+ protected void propertyChange(PropertyChangeEvent ev)
+ {
+ JTextArea comp = (JTextArea)getComponent();
+ if (ev.getPropertyName() == "lineWrap"
+ || ev.getPropertyName() == "wrapStyleWord")
+ modelChanged();
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java
index a300446c262..4e2ca9f93df 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextFieldUI.java
@@ -41,6 +41,7 @@ package javax.swing.plaf.basic;
import java.beans.PropertyChangeEvent;
import javax.swing.JComponent;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
import javax.swing.text.FieldView;
@@ -63,6 +64,11 @@ public class BasicTextFieldUI extends BasicTextUI
return new BasicTextFieldUI();
}
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "TextField"
+ */
protected String getPropertyPrefix()
{
return "TextField";
@@ -73,8 +79,22 @@ public class BasicTextFieldUI extends BasicTextUI
super.installUI(c);
}
+ /**
+ * Receives notification whenever one of the text component's bound
+ * properties changes. Here we check for the editable and enabled
+ * properties and adjust the background color accordingly.
+ *
+ * @param event the property change event
+ */
protected void propertyChange(PropertyChangeEvent event)
{
- // Does nothing by default.
+ if (event.getPropertyName().equals("editable"))
+ {
+ boolean editable = ((Boolean) event.getNewValue()).booleanValue();
+ if (editable)
+ textComponent.setBackground(background);
+ else
+ textComponent.setBackground(inactiveBackground);
+ }
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java
index 55d908e1b88..a988c5a63c8 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextPaneUI.java
@@ -38,11 +38,16 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
+
import javax.swing.JComponent;
+import javax.swing.JTextPane;
+import javax.swing.plaf.ColorUIResource;
+import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
-import javax.swing.text.Element;
-import javax.swing.text.PlainView;
-import javax.swing.text.View;
+import javax.swing.text.Style;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.StyleContext;
public class BasicTextPaneUI extends BasicEditorPaneUI
{
@@ -56,13 +61,32 @@ public class BasicTextPaneUI extends BasicEditorPaneUI
return new BasicTextPaneUI();
}
- public View create(Element elem)
+ /**
+ * Returns the prefix for entries in the {@link UIDefaults} table.
+ *
+ * @return "TextPane"
+ */
+ protected String getPropertyPrefix()
{
- return new PlainView(elem);
+ return "TextPane";
}
- protected String getPropertyPrefix()
+ /**
+ * Installs this UI on the specified <code>JTextPane</code>. This calls the
+ * super implementation and then adds a default style to the text pane.
+ *
+ * @param c the text pane to install the UI to
+ */
+ public void installUI(JComponent c)
{
- return "TextPane";
+ super.installUI(c);
+ JTextPane tp = (JTextPane) c;
+ Style defaultStyle = tp.getStyle(StyleContext.DEFAULT_STYLE);
+ defaultStyle.addAttribute(StyleConstants.Foreground,
+ new ColorUIResource(Color.BLACK));
+ defaultStyle.addAttribute(StyleConstants.FontFamily, "Serif");
+ defaultStyle.addAttribute(StyleConstants.Italic, Boolean.FALSE);
+ defaultStyle.addAttribute(StyleConstants.Bold, Boolean.FALSE);
+ defaultStyle.addAttribute(StyleConstants.FontSize, new Integer(12));
}
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
index 91ccb0056bb..e8eeece3b32 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
@@ -54,8 +55,9 @@ import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JComponent;
+import javax.swing.LookAndFeel;
+import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@@ -73,7 +75,6 @@ import javax.swing.text.Element;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import javax.swing.text.Keymap;
-import javax.swing.text.PlainView;
import javax.swing.text.Position;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
@@ -92,11 +93,11 @@ public abstract class BasicTextUI extends TextUI
/**
* A {@link DefaultCaret} that implements {@link UIResource}.
*/
- public static class BasicCaret extends DefaultCaret
- implements UIResource
+ public static class BasicCaret extends DefaultCaret implements UIResource
{
public BasicCaret()
{
+ // Nothing to do here.
}
}
@@ -108,6 +109,7 @@ public abstract class BasicTextUI extends TextUI
{
public BasicHighlighter()
{
+ // Nothing to do here.
}
}
@@ -241,7 +243,7 @@ public abstract class BasicTextUI extends TextUI
public void paint(Graphics g, Shape s)
{
if (view != null)
- view.paint(g, s);
+ view.paint(g, s);
}
@@ -252,10 +254,10 @@ public abstract class BasicTextUI extends TextUI
*
* This is delegated to the real root view.
*
- * @param pos the position of the character in the model
+ * @param position the position of the character in the model
* @param a the area that is occupied by the view
- * @param bias either {@link Position.Bias.Forward} or
- * {@link Position.Bias.Backward} depending on the preferred
+ * @param bias either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
* direction bias. If <code>null</code> this defaults to
* <code>Position.Bias.Forward</code>
*
@@ -327,12 +329,41 @@ public abstract class BasicTextUI extends TextUI
{
view.changedUpdate(ev, shape, vf);
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ return view.getNextVisualPositionFrom(c, pos, b, d, biasRet);
+ }
}
/**
* Receives notifications when properties of the text component change.
*/
- class UpdateHandler implements PropertyChangeListener
+ class PropertyChangeHandler implements PropertyChangeListener
{
/**
* Notifies when a property of the text component changes.
@@ -342,10 +373,12 @@ public abstract class BasicTextUI extends TextUI
public void propertyChange(PropertyChangeEvent event)
{
if (event.getPropertyName().equals("document"))
- {
+ {
// Document changed.
- modelChanged();
- }
+ modelChanged();
+ }
+
+ BasicTextUI.this.propertyChange(event);
}
}
@@ -364,11 +397,10 @@ public abstract class BasicTextUI extends TextUI
*/
public void changedUpdate(DocumentEvent ev)
{
- Dimension size = textComponent.getSize();
- rootView.changedUpdate(ev, new Rectangle(0, 0, size.width, size.height),
+ rootView.changedUpdate(ev, getVisibleEditorRect(),
rootView.getViewFactory());
}
-
+
/**
* Notification about a document insert event.
*
@@ -376,12 +408,8 @@ public abstract class BasicTextUI extends TextUI
*/
public void insertUpdate(DocumentEvent ev)
{
- Dimension size = textComponent.getSize();
- rootView.insertUpdate(ev, new Rectangle(0, 0, size.width, size.height),
+ rootView.insertUpdate(ev, getVisibleEditorRect(),
rootView.getViewFactory());
- int caretPos = textComponent.getCaretPosition();
- if (caretPos >= ev.getOffset())
- textComponent.setCaretPosition(caretPos + ev.getLength());
}
/**
@@ -391,12 +419,8 @@ public abstract class BasicTextUI extends TextUI
*/
public void removeUpdate(DocumentEvent ev)
{
- Dimension size = textComponent.getSize();
- rootView.removeUpdate(ev, new Rectangle(0, 0, size.width, size.height),
+ rootView.removeUpdate(ev, getVisibleEditorRect(),
rootView.getViewFactory());
- int caretPos = textComponent.getCaretPosition();
- if (caretPos >= ev.getOffset())
- textComponent.setCaretPosition(ev.getOffset());
}
}
@@ -419,16 +443,29 @@ public abstract class BasicTextUI extends TextUI
/**
* Receives notification when the model changes.
*/
- UpdateHandler updateHandler = new UpdateHandler();
+ PropertyChangeHandler updateHandler = new PropertyChangeHandler();
/** The DocumentEvent handler. */
DocumentHandler documentHandler = new DocumentHandler();
/**
+ * The standard background color. This is the color which is used to paint
+ * text in enabled text components.
+ */
+ Color background;
+
+ /**
+ * The inactive background color. This is the color which is used to paint
+ * text in disabled text components.
+ */
+ Color inactiveBackground;
+
+ /**
* Creates a new <code>BasicTextUI</code> instance.
*/
public BasicTextUI()
{
+ // Nothing to do here.
}
/**
@@ -506,14 +543,20 @@ public abstract class BasicTextUI extends TextUI
textComponent.setHighlighter(createHighlighter());
String prefix = getPropertyPrefix();
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- textComponent.setBackground(defaults.getColor(prefix + ".background"));
- textComponent.setForeground(defaults.getColor(prefix + ".foreground"));
- textComponent.setMargin(defaults.getInsets(prefix + ".margin"));
- textComponent.setBorder(defaults.getBorder(prefix + ".border"));
- textComponent.setFont(defaults.getFont(prefix + ".font"));
-
- caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate"));
+ LookAndFeel.installColorsAndFont(textComponent, prefix + ".background",
+ prefix + ".foreground", prefix + ".font");
+ LookAndFeel.installBorder(textComponent, prefix + ".border");
+ textComponent.setMargin(UIManager.getInsets(prefix + ".margin"));
+
+ caret.setBlinkRate(UIManager.getInt(prefix + ".caretBlinkRate"));
+
+ // Fetch the colors for enabled/disabled text components.
+ background = UIManager.getColor(prefix + ".background");
+ inactiveBackground = UIManager.getColor(prefix + ".inactiveBackground");
+ textComponent.setDisabledTextColor
+ (UIManager.getColor(prefix + ".inactiveForeground"));
+ textComponent.setSelectedTextColor(UIManager.getColor(prefix + ".selectionForeground"));
+ textComponent.setSelectionColor(UIManager.getColor(prefix + ".selectionBackground"));
}
/**
@@ -574,13 +617,14 @@ public abstract class BasicTextUI extends TextUI
protected Keymap createKeymap()
{
String prefix = getPropertyPrefix();
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
JTextComponent.KeyBinding[] bindings =
- (JTextComponent.KeyBinding[]) defaults.get(prefix + ".keyBindings");
+ (JTextComponent.KeyBinding[]) UIManager.get(prefix + ".keyBindings");
if (bindings == null)
{
bindings = new JTextComponent.KeyBinding[0];
- defaults.put(prefix + ".keyBindings", bindings);
+ // FIXME: Putting something into the defaults map is certainly wrong.
+ // Must be fixed somehow.
+ UIManager.put(prefix + ".keyBindings", bindings);
}
Keymap km = JTextComponent.addKeymap(getKeymapName(),
@@ -617,17 +661,16 @@ public abstract class BasicTextUI extends TextUI
InputMap getInputMap(int condition)
{
String prefix = getPropertyPrefix();
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
switch (condition)
{
case JComponent.WHEN_IN_FOCUSED_WINDOW:
// FIXME: is this the right string? nobody seems to use it.
- return (InputMap) defaults.get(prefix + ".windowInputMap");
+ return (InputMap) UIManager.get(prefix + ".windowInputMap");
case JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT:
- return (InputMap) defaults.get(prefix + ".ancestorInputMap");
+ return (InputMap) UIManager.get(prefix + ".ancestorInputMap");
default:
case JComponent.WHEN_FOCUSED:
- return (InputMap) defaults.get(prefix + ".focusInputMap");
+ return (InputMap) UIManager.get(prefix + ".focusInputMap");
}
}
@@ -641,12 +684,14 @@ public abstract class BasicTextUI extends TextUI
ActionMap getActionMap()
{
String prefix = getPropertyPrefix();
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- ActionMap am = (ActionMap) defaults.get(prefix + ".actionMap");
+ ActionMap am = (ActionMap) UIManager.get(prefix + ".actionMap");
if (am == null)
{
am = createActionMap();
- defaults.put(prefix + ".actionMap", am);
+ // FIXME: Putting something in the UIDefaults map is certainly wrong.
+ // However, the whole method seems wrong and must be replaced by
+ // something that is less wrong.
+ UIManager.put(prefix + ".actionMap", am);
}
return am;
}
@@ -704,6 +749,7 @@ public abstract class BasicTextUI extends TextUI
protected void uninstallListeners()
{
textComponent.removeFocusListener(focuslistener);
+ textComponent.getDocument().removeDocumentListener(documentHandler);
}
/**
@@ -757,6 +803,18 @@ public abstract class BasicTextUI extends TextUI
}
/**
+ * Returns the minimum size for text components. This returns the size
+ * of the component's insets.
+ *
+ * @return the minimum size for text components
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Insets i = c.getInsets();
+ return new Dimension(i.left + i.right, i.top + i.bottom);
+ }
+
+ /**
* Paints the text component.
*
* @param g the <code>Graphics</code> context to paint to
@@ -776,10 +834,10 @@ public abstract class BasicTextUI extends TextUI
{
Caret caret = textComponent.getCaret();
Highlighter highlighter = textComponent.getHighlighter();
-
+
if (textComponent.isOpaque())
paintBackground(g);
-
+
if (highlighter != null
&& textComponent.getSelectionStart() != textComponent.getSelectionEnd())
highlighter.paint(g);
@@ -797,8 +855,10 @@ public abstract class BasicTextUI extends TextUI
*/
protected void paintBackground(Graphics g)
{
- g.setColor(textComponent.getBackground());
- g.fillRect(0, 0, textComponent.getWidth(), textComponent.getHeight());
+ // This method does nothing. All the background filling is done by the
+ // ComponentUI update method. However, the method is called by paint
+ // to provide a way for subclasses to draw something different (e.g.
+ // background images etc) on the background.
}
/**
@@ -885,10 +945,10 @@ public abstract class BasicTextUI extends TextUI
/**
* Maps a position in the document into the coordinate space of the View.
* The output rectangle usually reflects the font height but has a width
- * of zero. A bias of {@link Position.Bias.Forward} is used in this method.
+ * of zero. A bias of {@link Position.Bias#Forward} is used in this method.
*
+ * @param t the text component
* @param pos the position of the character in the model
- * @param a the area that is occupied by the view
*
* @return a rectangle that gives the location of the document position
* inside the view coordinate space
@@ -908,10 +968,10 @@ public abstract class BasicTextUI extends TextUI
* The output rectangle usually reflects the font height but has a width
* of zero.
*
+ * @param t the text component
* @param pos the position of the character in the model
- * @param a the area that is occupied by the view
- * @param bias either {@link Position.Bias.Forward} or
- * {@link Position.Bias.Backward} depending on the preferred
+ * @param bias either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
* direction bias. If <code>null</code> this defaults to
* <code>Position.Bias.Forward</code>
*
@@ -957,7 +1017,7 @@ public abstract class BasicTextUI extends TextUI
*/
public int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn)
{
- return 0; // FIXME: Implement me.
+ return rootView.viewToModel(pt.x, pt.y, getVisibleEditorRect(), biasReturn);
}
/**
@@ -999,16 +1059,17 @@ public abstract class BasicTextUI extends TextUI
*/
protected Rectangle getVisibleEditorRect()
{
+ JTextComponent textComponent = getComponent();
int width = textComponent.getWidth();
int height = textComponent.getHeight();
if (width <= 0 || height <= 0)
- return null;
+ return new Rectangle(0, 0, 0, 0);
Insets insets = textComponent.getInsets();
return new Rectangle(insets.left, insets.top,
- width - insets.left + insets.right,
- height - insets.top + insets.bottom);
+ width - insets.left - insets.right,
+ height - insets.top - insets.bottom);
}
/**
@@ -1020,6 +1081,8 @@ public abstract class BasicTextUI extends TextUI
{
rootView.setView(view);
view.setParent(rootView);
+ textComponent.revalidate();
+ textComponent.repaint();
}
/**
@@ -1043,4 +1106,17 @@ public abstract class BasicTextUI extends TextUI
View view = factory.create(elem);
setView(view);
}
+
+ /**
+ * Receives notification whenever one of the text component's bound
+ * properties changes. This default implementation does nothing.
+ * It is a hook that enables subclasses to react to property changes
+ * on the text component.
+ *
+ * @param ev the property change event
+ */
+ protected void propertyChange(PropertyChangeEvent ev)
+ {
+ // The default implementation does nothing.
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java
index 9106b0b6673..896ea0c89dc 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToggleButtonUI.java
@@ -38,7 +38,13 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
+import javax.swing.AbstractButton;
import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
import javax.swing.plaf.ComponentUI;
public class BasicToggleButtonUI extends BasicButtonUI
@@ -58,5 +64,62 @@ public class BasicToggleButtonUI extends BasicButtonUI
{
return "ToggleButton.";
}
-}
+ /**
+ * Paint the component, which is an {@link AbstractButton}, according to
+ * its current state.
+ *
+ * @param g The graphics context to paint with
+ * @param c The component to paint the state of
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ AbstractButton b = (AbstractButton) c;
+
+ Rectangle tr = new Rectangle();
+ Rectangle ir = new Rectangle();
+ Rectangle vr = new Rectangle();
+
+ Font f = c.getFont();
+
+ g.setFont(f);
+
+ if (b.isBorderPainted())
+ SwingUtilities.calculateInnerArea(b, vr);
+ else
+ vr = SwingUtilities.getLocalBounds(b);
+ String text = SwingUtilities.layoutCompoundLabel(c, g.getFontMetrics(f),
+ b.getText(),
+ currentIcon(b),
+ b.getVerticalAlignment(),
+ b.getHorizontalAlignment(),
+ b.getVerticalTextPosition(),
+ b.getHorizontalTextPosition(),
+ vr, ir, tr,
+ b.getIconTextGap()
+ + defaultTextShiftOffset);
+
+ if ((b.getModel().isArmed() && b.getModel().isPressed())
+ || b.isSelected())
+ paintButtonPressed(g, b);
+
+ paintIcon(g, b, ir);
+ if (text != null)
+ paintText(g, b, tr, text);
+ if (b.isFocusOwner() && b.isFocusPainted())
+ paintFocus(g, b, vr, tr, ir);
+ }
+
+ /**
+ * Paints the icon for the toggle button. This delegates to
+ * {@link BasicButtonUI#paintIcon(Graphics, JComponent, Rectangle)}.
+ *
+ * @param g the graphics context
+ * @param b the button to paint the icon for
+ * @param iconRect the area allocated for the icon
+ */
+ protected void paintIcon(Graphics g, AbstractButton b, Rectangle iconRect)
+ {
+ super.paintIcon(g, b, iconRect);
+ }
+}
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
index db29fdca583..79cf0b0c213 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
@@ -43,7 +43,6 @@ import java.awt.Graphics;
import javax.swing.JComponent;
import javax.swing.JSeparator;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
@@ -73,9 +72,7 @@ public class BasicToolBarSeparatorUI extends BasicSeparatorUI
*/
protected void installDefaults(JSeparator s)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- size = defaults.getDimension("ToolBar.separatorSize");
+ size = UIManager.getDimension("ToolBar.separatorSize");
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
index 8be89efcfa6..7bf2a4ab167 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolBarUI.java
@@ -65,10 +65,11 @@ import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JToolBar;
+import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.RootPaneContainer;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.event.MouseInputListener;
@@ -133,6 +134,26 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
protected FocusListener toolBarFocusListener;
/**
+ * @deprecated since JDK1.3.
+ */
+ protected KeyStroke leftKey;
+
+ /**
+ * @deprecated since JDK1.3.
+ */
+ protected KeyStroke rightKey;
+
+ /**
+ * @deprecated since JDK1.3.
+ */
+ protected KeyStroke upKey;
+
+ /**
+ * @deprecated since JDK1.3.
+ */
+ protected KeyStroke downKey;
+
+ /**
* The floating window that is responsible for holding the JToolBar when it
* is dragged outside of its original parent.
*/
@@ -383,6 +404,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
boolean tmp = ((loc == SwingConstants.NORTH)
|| (loc == SwingConstants.SOUTH) || (loc == -1));
+ cachedOrientation = toolBar.getOrientation();
+ cachedBounds = toolBar.getSize();
if (((cachedOrientation == SwingConstants.HORIZONTAL) && tmp)
|| ((cachedOrientation == VERTICAL) && ! tmp))
{
@@ -550,9 +573,6 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
dragWindow = createDragWindow(toolBar);
- cachedBounds = toolBar.getPreferredSize();
- cachedOrientation = toolBar.getOrientation();
-
nonRolloverBorder = createNonRolloverBorder();
rolloverBorder = createRolloverBorder();
@@ -566,18 +586,16 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
*/
protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- toolBar.setBorder(new ToolBarBorder());
- toolBar.setBackground(defaults.getColor("ToolBar.background"));
- toolBar.setForeground(defaults.getColor("ToolBar.foreground"));
- toolBar.setFont(defaults.getFont("ToolBar.font"));
+ LookAndFeel.installBorder(toolBar, "ToolBar.border");
+ LookAndFeel.installColorsAndFont(toolBar, "ToolBar.background",
+ "ToolBar.foreground", "ToolBar.font");
- dockingBorderColor = defaults.getColor("ToolBar.dockingForeground");
- dockingColor = defaults.getColor("ToolBar.dockingBackground");
+ dockingBorderColor = UIManager.getColor("ToolBar.dockingForeground");
+ dockingColor = UIManager.getColor("ToolBar.dockingBackground");
- floatingBorderColor = defaults.getColor("ToolBar.floatingForeground");
- floatingColor = defaults.getColor("ToolBar.floatingBackground");
+ floatingBorderColor = UIManager.getColor("ToolBar.floatingForeground");
+ floatingColor = UIManager.getColor("ToolBar.floatingBackground");
+ setRolloverBorders(toolBar.isRollover());
}
/**
@@ -591,10 +609,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
/**
* This method installs listeners for the JToolBar.
- *
- * @param toolbar The JToolBar to register listeners for.
*/
- protected void installListeners(JToolBar toolbar)
+ protected void installListeners()
{
dockingListener = createDockingListener();
toolBar.addMouseListener(dockingListener);
@@ -694,7 +710,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
toolBar.setOpaque(true);
installDefaults();
installComponents();
- installListeners(toolBar);
+ installListeners();
installKeyboardActions();
}
}
@@ -1000,6 +1016,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
*/
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -1030,13 +1047,15 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
}
origin = new Point(0, 0);
- SwingUtilities.convertPointToScreen(ssd, toolBar);
+ if (toolBar.isShowing())
+ SwingUtilities.convertPointToScreen(ssd, toolBar);
if (! (SwingUtilities.getAncestorOfClass(Window.class, toolBar) instanceof UIResource))
// Need to know who keeps the toolBar if it gets dragged back into it.
origParent = toolBar.getParent();
-
- SwingUtilities.convertPointToScreen(origin, toolBar);
+
+ if (toolBar.isShowing())
+ SwingUtilities.convertPointToScreen(origin, toolBar);
isDragging = true;
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java
index b7a08aa728e..5cec2e33365 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicToolTipUI.java
@@ -1,5 +1,5 @@
/* BasicToolTipUI.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,20 +39,18 @@ exception statement from your version. */
package javax.swing.plaf.basic;
import java.awt.Color;
-import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
+import java.awt.Toolkit;
import javax.swing.JComponent;
import javax.swing.JToolTip;
+import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
-import javax.swing.UIDefaults;
-import javax.swing.UIManager;
-import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ToolTipUI;
@@ -61,58 +59,12 @@ import javax.swing.plaf.ToolTipUI;
*/
public class BasicToolTipUI extends ToolTipUI
{
- /** The default Border around the JToolTip. */
- private static Border defaultBorder = new Border()
- {
- // FIXME: This needs to go into Basic Look and Feel
- // defaults.
- /**
- * This method returns the border insets.
- *
- * @param c The Component to find Border insets for.
- *
- * @return The Border insets.
- */
- public Insets getBorderInsets(Component c)
- {
- return new Insets(4, 4, 4, 4);
- }
+ /** The shared instance of BasicToolTipUI used for all ToolTips. */
+ private static BasicToolTipUI shared;
- /**
- * This method returns whether the border is opaque.
- *
- * @return Whether the border is opaque.
- */
- public boolean isBorderOpaque()
- {
- return false;
- }
-
- /**
- * This method paints the border.
- *
- * @param c The Component to paint this border around.
- * @param g The Graphics object to paint with.
- * @param x The x coordinate to start painting at.
- * @param y The y coordinate to start painting at.
- * @param w The width of the Component.
- * @param h The height of the Component.
- */
- public void paintBorder(Component c, Graphics g, int x, int y, int w,
- int h)
- {
- Color saved = g.getColor();
- g.setColor(Color.BLACK);
-
- g.drawRect(0, 0, w - 1, h - 1);
-
- g.setColor(saved);
- }
- };
-
- /** The shared instance of BasicToolTipUI used for all ToolTips. */
- private static BasicToolTipUI shared;
+ /** The tooltip's text */
+ private String text;
/**
* Creates a new BasicToolTipUI object.
@@ -124,7 +76,7 @@ public class BasicToolTipUI extends ToolTipUI
/**
* This method creates a new BasicToolTip UI for the given
- * JComponent.
+ * JComponent.
*
* @param c The JComponent to create a UI for.
*
@@ -132,9 +84,9 @@ public class BasicToolTipUI extends ToolTipUI
*/
public static ComponentUI createUI(JComponent c)
{
- if (shared == null)
- shared = new BasicToolTipUI();
- return shared;
+ if (shared == null)
+ shared = new BasicToolTipUI();
+ return shared;
}
/**
@@ -171,12 +123,16 @@ public class BasicToolTipUI extends ToolTipUI
public Dimension getPreferredSize(JComponent c)
{
JToolTip tip = (JToolTip) c;
+ FontMetrics fm;
+ Toolkit g = tip.getToolkit();
+ text = tip.getTipText();
+
Rectangle vr = new Rectangle();
Rectangle ir = new Rectangle();
Rectangle tr = new Rectangle();
Insets insets = tip.getInsets();
- FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont());
- SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null,
+ fm = g.getFontMetrics(tip.getFont());
+ SwingUtilities.layoutCompoundLabel(tip, fm, text, null,
SwingConstants.CENTER,
SwingConstants.CENTER,
SwingConstants.CENTER,
@@ -192,11 +148,9 @@ public class BasicToolTipUI extends ToolTipUI
*/
protected void installDefaults(JComponent c)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- c.setBackground(defaults.getColor("ToolTip.background"));
- c.setForeground(defaults.getColor("ToolTip.foreground"));
- c.setFont(defaults.getFont("ToolTip.font"));
- c.setBorder(defaultBorder);
+ LookAndFeel.installColorsAndFont(c, "ToolTip.background",
+ "ToolTip.foreground", "ToolTip.font");
+ LookAndFeel.installBorder(c, "ToolTip.border");
}
/**
@@ -206,6 +160,7 @@ public class BasicToolTipUI extends ToolTipUI
*/
protected void installListeners(JComponent c)
{
+ // TODO: Implement this properly.
}
/**
@@ -231,6 +186,7 @@ public class BasicToolTipUI extends ToolTipUI
JToolTip tip = (JToolTip) c;
String text = tip.getTipText();
+ Toolkit t = tip.getToolkit();
if (text == null)
return;
@@ -238,19 +194,19 @@ public class BasicToolTipUI extends ToolTipUI
vr = SwingUtilities.calculateInnerArea(tip, vr);
Rectangle ir = new Rectangle();
Rectangle tr = new Rectangle();
- FontMetrics fm = tip.getToolkit().getFontMetrics(tip.getFont());
- SwingUtilities.layoutCompoundLabel(tip, fm, tip.getTipText(), null,
+ FontMetrics fm = t.getFontMetrics(tip.getFont());
+ int ascent = fm.getAscent();
+ SwingUtilities.layoutCompoundLabel(tip, fm, text, null,
SwingConstants.CENTER,
SwingConstants.CENTER,
SwingConstants.CENTER,
SwingConstants.CENTER, vr, ir, tr, 0);
-
Color saved = g.getColor();
g.setColor(Color.BLACK);
- g.drawString(text, vr.x, vr.y + fm.getAscent());
+ g.drawString(text, vr.x, vr.y + ascent);
- g.setColor(saved);
+ g.setColor(saved);
}
/**
@@ -273,6 +229,7 @@ public class BasicToolTipUI extends ToolTipUI
*/
protected void uninstallListeners(JComponent c)
{
+ // TODO: Implement this properly.
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
index 6f714a39cb2..2d54983e61f 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicTreeUI.java
@@ -44,6 +44,7 @@ import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
@@ -62,6 +63,7 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.Enumeration;
import java.util.Hashtable;
import javax.swing.AbstractAction;
@@ -76,9 +78,9 @@ import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.KeyStroke;
+import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
@@ -89,6 +91,7 @@ import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
+import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.TreeUI;
@@ -96,7 +99,6 @@ import javax.swing.text.Caret;
import javax.swing.tree.AbstractLayoutCache;
import javax.swing.tree.DefaultTreeCellEditor;
import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.FixedHeightLayoutCache;
import javax.swing.tree.TreeCellEditor;
import javax.swing.tree.TreeCellRenderer;
@@ -110,11 +112,11 @@ import javax.swing.tree.TreeSelectionModel;
* the Basic look and feel.
*
* @see javax.swing.JTree
- * @author Sascha Brawer (brawer@dandelis.ch)
+ *
* @author Lillian Angel (langel@redhat.com)
+ * @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class BasicTreeUI
- extends TreeUI
+public class BasicTreeUI extends TreeUI
{
/** Collapse Icon for the tree. */
protected transient Icon collapsedIcon;
@@ -136,9 +138,6 @@ public class BasicTreeUI
*/
protected int totalChildIndent;
- /** Minimum preferred size. */
- protected Dimension preferredMinsize;
-
/** Index of the row that was last selected. */
protected int lastSelectedRow;
@@ -174,6 +173,9 @@ public class BasicTreeUI
/** Size needed to completely display all the nodes. */
protected Dimension preferredSize;
+
+ /** Minimum size needed to completely display all the nodes. */
+ protected Dimension preferredMinSize;
/** Is the preferredSize valid? */
protected boolean validCachedPreferredSize;
@@ -223,38 +225,38 @@ public class BasicTreeUI
/** Set to true if the editor has a different size than the renderer. */
protected boolean editorHasDifferentSize;
-
+
/** The action listener for the editor's Timer. */
- private Timer editorTimer = new EditorUpdateTimer();
+ Timer editorTimer = new EditorUpdateTimer();
/** The new value of the node after editing. */
- private Object newVal;
+ Object newVal;
/** The action bound to KeyStrokes. */
- private TreeAction action;
+ TreeAction action;
/** Boolean to keep track of editing. */
- private boolean isEditing;
+ boolean isEditing;
+
+ /** The current path of the visible nodes in the tree. */
+ TreePath currentVisiblePath;
+
+ /** The gap between the icon and text. */
+ int gap = 4;
+
+ /** Default row height, if none was set. */
+ int rowHeight = 20;
/** Listeners */
private PropertyChangeListener propertyChangeListener;
-
private FocusListener focusListener;
-
private TreeSelectionListener treeSelectionListener;
-
- private MouseInputListener mouseInputListener;
-
+ private MouseListener mouseListener;
private KeyListener keyListener;
-
private PropertyChangeListener selectionModelPropertyChangeListener;
-
private ComponentListener componentListener;
-
- private CellEditorListener cellEditorListener;
-
+ CellEditorListener cellEditorListener;
private TreeExpansionListener treeExpansionListener;
-
private TreeModelListener treeModelListener;
/**
@@ -262,6 +264,7 @@ public class BasicTreeUI
*/
public BasicTreeUI()
{
+ validCachedPreferredSize = false;
drawingCache = new Hashtable();
nodeDimensions = createNodeDimensions();
configureLayoutCache();
@@ -269,7 +272,7 @@ public class BasicTreeUI
propertyChangeListener = createPropertyChangeListener();
focusListener = createFocusListener();
treeSelectionListener = createTreeSelectionListener();
- mouseInputListener = new MouseInputHandler(null, null, null);
+ mouseListener = createMouseListener();
keyListener = createKeyListener();
selectionModelPropertyChangeListener = createSelectionModelPropertyChangeListener();
componentListener = createComponentListener();
@@ -300,7 +303,7 @@ public class BasicTreeUI
*/
protected Color getHashColor()
{
- return UIManager.getLookAndFeelDefaults().getColor("Tree.hash");
+ return UIManager.getColor("Tree.hash");
}
/**
@@ -311,8 +314,8 @@ public class BasicTreeUI
*/
protected void setHashColor(Color color)
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- defaults.put("Tree.hash", color);
+ // FIXME: Putting something in the UIDefaults map is certainly wrong.
+ UIManager.put("Tree.hash", color);
}
/**
@@ -331,7 +334,7 @@ public class BasicTreeUI
*
* @return the indent value for the left child.
*/
- public int getLeftChildIndent(int newAmount)
+ public int getLeftChildIndent()
{
return leftChildIndent;
}
@@ -433,6 +436,8 @@ public class BasicTreeUI
*/
protected void setRowHeight(int rowHeight)
{
+ if (rowHeight == 0)
+ rowHeight = this.rowHeight;
treeState.setRowHeight(rowHeight);
}
@@ -456,7 +461,6 @@ public class BasicTreeUI
protected void setCellRenderer(TreeCellRenderer tcr)
{
currentCellRenderer = tcr;
- tree.setCellRenderer(tcr);
updateRenderer();
}
@@ -621,22 +625,19 @@ public class BasicTreeUI
*/
public Rectangle getPathBounds(JTree tree, TreePath path)
{
+ Rectangle bounds = null;
+ int row = -1;
+ Object cell = null;
if (path != null)
{
- Object cell = path.getLastPathComponent();
-
- TreeModel mod = tree.getModel();
- if (mod != null)
- {
- Object root = mod.getRoot();
- if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root)))
- root = getNextNode(root);
-
- Point loc = getCellLocation(0, 0, tree, mod, cell, root);
- return getCellBounds(loc.x, loc.y, cell);
- }
+ row = getRowForPath(tree, path);
+ cell = path.getLastPathComponent();
+ bounds = new Rectangle(0, row * getRowHeight(), 0, 0);
}
- return null;
+ return nodeDimensions.getNodeDimensions(cell, row,
+ getLevel(cell),
+ tree.isExpanded(path),
+ bounds);
}
/**
@@ -650,21 +651,11 @@ public class BasicTreeUI
*/
public TreePath getPathForRow(JTree tree, int row)
{
- TreeModel mod = tree.getModel();
- if (mod != null)
+ if (treeModel != null && currentVisiblePath != null)
{
- Object node = mod.getRoot();
- if (!tree.isRootVisible()
- && tree.isExpanded(new TreePath(getPathToRoot(node, 0))))
- node = getNextNode(node);
-
- for (int i = 0; i < row; i++)
- node = getNextVisibleNode(node);
-
- if (node == null)
- return null;
-
- return new TreePath(getPathToRoot(node, 0));
+ Object[] nodes = currentVisiblePath.getPath();
+ if (row < nodes.length)
+ return new TreePath(getPathToRoot(nodes[row], 0));
}
return null;
}
@@ -683,17 +674,20 @@ public class BasicTreeUI
*/
public int getRowForPath(JTree tree, TreePath path)
{
- int row = path.getPathCount();
- if (tree.isVisible(path))
- return row;
-
- path = path.getParentPath();
- while (row > 0 && !tree.isVisible(path))
+ int row = 0;
+ Object dest = path.getLastPathComponent();
+ int rowCount = getRowCount(tree);
+ if (currentVisiblePath != null)
{
- path = path.getParentPath();
- row--;
+ Object[] nodes = currentVisiblePath.getPath();
+ while (row < rowCount)
+ {
+ if (dest.equals(nodes[row]))
+ return row;
+ row++;
+ }
}
- return row;
+ return -1;
}
/**
@@ -705,22 +699,9 @@ public class BasicTreeUI
*/
public int getRowCount(JTree tree)
{
- TreeModel mod = tree.getModel();
- int count = 0;
- if (mod != null)
- {
- Object node = mod.getRoot();
- if (!tree.isRootVisible()
- && tree.isExpanded(new TreePath((getPathToRoot(node, 0)))))
- node = getNextNode(node);
-
- while (node != null)
- {
- count++;
- node = getNextVisibleNode(node);
- }
- }
- return count;
+ if (currentVisiblePath != null)
+ return currentVisiblePath.getPathCount();
+ return 0;
}
/**
@@ -739,9 +720,6 @@ public class BasicTreeUI
*/
public TreePath getClosestPathForLocation(JTree tree, int x, int y)
{
- // FIXME: what if root is hidden? should not depend on (0,0)
- // should start counting rows from where root is.
-
int row = Math.round(y / getRowHeight());
TreePath path = getPathForRow(tree, row);
@@ -828,7 +806,7 @@ public class BasicTreeUI
*/
protected void prepareForUIInstall()
{
- // FIXME: not implemented
+ // TODO: Implement this properly.
}
/**
@@ -837,7 +815,7 @@ public class BasicTreeUI
*/
protected void completeUIInstall()
{
- // FIXME: not implemented
+ // TODO: Implement this properly.
}
/**
@@ -846,7 +824,7 @@ public class BasicTreeUI
*/
protected void completeUIUninstall()
{
- // FIXME: not implemented
+ // TODO: Implement this properly.
}
/**
@@ -854,7 +832,10 @@ public class BasicTreeUI
*/
protected void installComponents()
{
- // FIXME: not implemented
+ currentCellRenderer = createDefaultCellRenderer();
+ rendererPane = createCellRendererPane();
+ createdRenderer = true;
+ setCellRenderer(currentCellRenderer);
}
/**
@@ -865,8 +846,7 @@ public class BasicTreeUI
*/
protected AbstractLayoutCache.NodeDimensions createNodeDimensions()
{
- // FIXME: not implemented
- return null;
+ return new NodeDimensionsHandler();
}
/**
@@ -1035,7 +1015,7 @@ public class BasicTreeUI
tree.removePropertyChangeListener(propertyChangeListener);
tree.removeFocusListener(focusListener);
tree.removeTreeSelectionListener(treeSelectionListener);
- tree.removeMouseListener(mouseInputListener);
+ tree.removeMouseListener(mouseListener);
tree.removeKeyListener(keyListener);
tree.removePropertyChangeListener(selectionModelPropertyChangeListener);
tree.removeComponentListener(componentListener);
@@ -1044,9 +1024,8 @@ public class BasicTreeUI
TreeCellEditor tce = tree.getCellEditor();
if (tce != null)
tce.removeCellEditorListener(cellEditorListener);
- TreeModel tm = tree.getModel();
- if (tm != null)
- tm.removeTreeModelListener(treeModelListener);
+ if (treeModel != null)
+ treeModel.removeTreeModelListener(treeModelListener);
}
/**
@@ -1054,6 +1033,9 @@ public class BasicTreeUI
*/
protected void uninstallKeyboardActions()
{
+ action = null;
+ tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).setParent(null);
+ tree.getActionMap().setParent(null);
}
/**
@@ -1061,7 +1043,10 @@ public class BasicTreeUI
*/
protected void uninstallComponents()
{
- // FIXME: not implemented
+ currentCellRenderer = null;
+ rendererPane = null;
+ createdRenderer = false;
+ setCellRenderer(currentCellRenderer);
}
/**
@@ -1072,8 +1057,7 @@ public class BasicTreeUI
*/
protected int getVerticalLegBuffer()
{
- // FIXME: not implemented
- return 0;
+ return getRowHeight() / 2;
}
/**
@@ -1085,17 +1069,17 @@ public class BasicTreeUI
*/
protected int getHorizontalLegBuffer()
{
- // FIXME: not implemented
- return 0;
+ return rightChildIndent / 2;
}
/**
* Make all the nodes that are expanded in JTree expanded in LayoutCache. This
- * invokes update ExpandedDescendants with the root path.
+ * invokes updateExpandedDescendants with the root path.
*/
protected void updateLayoutCacheExpandedNodes()
{
- // FIXME: not implemented
+ if (treeModel != null)
+ updateExpandedDescendants(new TreePath(treeModel.getRoot()));
}
/**
@@ -1108,7 +1092,9 @@ public class BasicTreeUI
*/
protected void updateExpandedDescendants(TreePath path)
{
- // FIXME: not implemented
+ Enumeration expanded = tree.getExpandedDescendants(path);
+ while (expanded.hasMoreElements())
+ treeState.setExpandedState(((TreePath) expanded.nextElement()), true);
}
/**
@@ -1128,7 +1114,7 @@ public class BasicTreeUI
*/
protected void updateDepthOffset()
{
- // FIXME: not implemented
+ depthOffset += getVerticalLegBuffer();
}
/**
@@ -1148,7 +1134,15 @@ public class BasicTreeUI
*/
protected void updateRenderer()
{
- // FIXME: not implemented
+ if (tree != null)
+ {
+ if(tree.getCellRenderer() == null)
+ {
+ if(currentCellRenderer == null)
+ currentCellRenderer = createDefaultCellRenderer();
+ tree.setCellRenderer(currentCellRenderer);
+ }
+ }
}
/**
@@ -1166,19 +1160,36 @@ public class BasicTreeUI
*/
protected void updateSize()
{
- // FIXME: not implemented
+ preferredSize = null;
+ updateCachedPreferredSize();
+ tree.treeDidChange();
}
/**
* Updates the <code>preferredSize</code> instance variable, which is
- * returned from <code>getPreferredSize()</code>. For left to right
- * orientations, the size is determined from the current AbstractLayoutCache.
- * For RTL orientations, the preferred size becomes the width minus the
- * minimum x position.
+ * returned from <code>getPreferredSize()</code>.
*/
protected void updateCachedPreferredSize()
{
- // FIXME: not implemented
+ int maxWidth = 0;
+ boolean isLeaf = false;
+ if (currentVisiblePath != null)
+ {
+ Object[] path = currentVisiblePath.getPath();
+ for (int i = 0; i < path.length; i++)
+ {
+ TreePath curr = new TreePath(getPathToRoot(path[i], 0));
+ Rectangle bounds = getPathBounds(tree, curr);
+ if (treeModel != null)
+ isLeaf = treeModel.isLeaf(path[i]);
+ if (!isLeaf && hasControlIcons())
+ bounds.width += getCurrentControlIcon(curr).getIconWidth();
+ maxWidth = Math.max(maxWidth, bounds.x + bounds.width);
+ }
+ preferredSize = new Dimension(maxWidth, (getRowHeight() * path.length));
+ }
+ else preferredSize = new Dimension(0, 0);
+ validCachedPreferredSize = true;
}
/**
@@ -1189,7 +1200,9 @@ public class BasicTreeUI
*/
protected void pathWasExpanded(TreePath path)
{
- // FIXME: not implemented
+ validCachedPreferredSize = false;
+ tree.revalidate();
+ tree.repaint();
}
/**
@@ -1197,28 +1210,28 @@ public class BasicTreeUI
*/
protected void pathWasCollapsed(TreePath path)
{
- // FIXME: not implemented
+ validCachedPreferredSize = false;
+ tree.revalidate();
+ tree.repaint();
}
/**
* Install all defaults for the tree.
- *
- * @param tree
- * is the JTree to install defaults for
*/
- protected void installDefaults(JTree tree)
+ protected void installDefaults()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
- tree.setFont(defaults.getFont("Tree.font"));
- tree.setForeground(defaults.getColor("Tree.foreground"));
- tree.setBackground(defaults.getColor("Tree.background"));
+ LookAndFeel.installColorsAndFont(tree, "Tree.background",
+ "Tree.foreground", "Tree.font");
tree.setOpaque(true);
- rightChildIndent = defaults.getInt("Tree.rightChildIndent");
- leftChildIndent = defaults.getInt("Tree.leftChildIndent");
- setRowHeight(defaults.getInt("Tree.rowHeight"));
+ rightChildIndent = UIManager.getInt("Tree.rightChildIndent");
+ leftChildIndent = UIManager.getInt("Tree.leftChildIndent");
+ setRowHeight(UIManager.getInt("Tree.rowHeight"));
+ tree.setRowHeight(getRowHeight());
tree.requestFocusInWindow(false);
+ tree.setScrollsOnExpand(UIManager.getBoolean("Tree.scrollsOnExpand"));
+ setExpandedIcon(UIManager.getIcon("Tree.expandedIcon"));
+ setCollapsedIcon(UIManager.getIcon("Tree.collapsedIcon"));
}
/**
@@ -1226,10 +1239,9 @@ public class BasicTreeUI
*/
protected void installKeyboardActions()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- InputMap focusInputMap = (InputMap) defaults.get("Tree.focusInputMap");
+ InputMap focusInputMap = (InputMap) UIManager.get("Tree.focusInputMap");
InputMapUIResource parentInputMap = new InputMapUIResource();
- ActionMap parentActionMap = new ActionMap();
+ ActionMap parentActionMap = new ActionMapUIResource();
action = new TreeAction();
Object keys[] = focusInputMap.allKeys();
@@ -1308,7 +1320,7 @@ public class BasicTreeUI
tree.addPropertyChangeListener(propertyChangeListener);
tree.addFocusListener(focusListener);
tree.addTreeSelectionListener(treeSelectionListener);
- tree.addMouseListener(mouseInputListener);
+ tree.addMouseListener(mouseListener);
tree.addKeyListener(keyListener);
tree.addPropertyChangeListener(selectionModelPropertyChangeListener);
tree.addComponentListener(componentListener);
@@ -1325,37 +1337,36 @@ public class BasicTreeUI
*/
public void installUI(JComponent c)
{
- super.installUI(c);
- installDefaults((JTree) c);
tree = (JTree) c;
+ prepareForUIInstall();
+ super.installUI(c);
+ installDefaults();
- currentCellRenderer = createDefaultCellRenderer();
- rendererPane = createCellRendererPane();
- createdRenderer = true;
-
+ installComponents();
+ installKeyboardActions();
+ installListeners();
+
setCellEditor(createDefaultCellEditor());
createdCellEditor = true;
isEditing = false;
-
+
TreeModel mod = tree.getModel();
setModel(mod);
- tree.setRootVisible(true);
if (mod != null)
- tree.expandPath(new TreePath(mod.getRoot()));
+ {
+ TreePath path = new TreePath(mod.getRoot());
+ if (!tree.isExpanded(path))
+ toggleExpandState(path);
+ }
treeSelectionModel = tree.getSelectionModel();
- installKeyboardActions();
- installListeners();
completeUIInstall();
}
/**
* Uninstall the defaults for the tree
- *
- * @param tree
- * to uninstall defaults for
*/
- protected void uninstallDefaults(JTree tree)
+ protected void uninstallDefaults()
{
tree.setFont(null);
tree.setForeground(null);
@@ -1370,10 +1381,12 @@ public class BasicTreeUI
*/
public void uninstallUI(JComponent c)
{
- uninstallDefaults((JTree) c);
+ prepareForUIUninstall();
+ uninstallDefaults();
uninstallKeyboardActions();
uninstallListeners();
tree = null;
+ uninstallComponents();
completeUIUninstall();
}
@@ -1393,20 +1406,32 @@ public class BasicTreeUI
public void paint(Graphics g, JComponent c)
{
JTree tree = (JTree) c;
+ if (currentVisiblePath == null)
+ updateCurrentVisiblePath();
- TreeModel mod = tree.getModel();
+ Rectangle clip = g.getClipBounds();
+ Insets insets = tree.getInsets();
- if (mod != null)
+ if (clip != null && treeModel != null && currentVisiblePath != null)
{
- Object root = mod.getRoot();
-
- if (!tree.isRootVisible())
- tree.expandPath(new TreePath(root));
+ int startIndex = tree.getClosestRowForLocation(clip.x, clip.y);
+ int endIndex = tree.getClosestRowForLocation(clip.x + clip.width,
+ clip.y + clip.height);
- paintRecursive(g, 0, 0, 0, 0, tree, mod, root);
-
- if (hasControlIcons())
- paintControlIcons(g, 0, 0, 0, 0, tree, mod, root);
+ paintVerticalPartOfLeg(g, clip, insets, currentVisiblePath);
+ for (int i = startIndex; i <= endIndex; i++)
+ {
+ Object curr = currentVisiblePath.getPathComponent(i);
+ boolean isLeaf = treeModel.isLeaf(curr);
+ TreePath path = new TreePath(getPathToRoot(curr, 0));
+
+ boolean isExpanded = tree.isExpanded(path);
+ Rectangle bounds = getPathBounds(tree, path);
+ paintHorizontalPartOfLeg(g, clip, insets, bounds, path, i,
+ isExpanded, false, isLeaf);
+ paintRow(g, clip, insets, bounds, path, i, isExpanded, false,
+ isLeaf);
+ }
}
}
@@ -1420,7 +1445,19 @@ public class BasicTreeUI
*/
protected void ensureRowsAreVisible(int beginRow, int endRow)
{
- // FIXME: not implemented
+ if (beginRow < endRow)
+ {
+ int temp = endRow;
+ endRow = beginRow;
+ beginRow = temp;
+ }
+
+ for (int i = beginRow; i < endRow; i++)
+ {
+ TreePath path = getPathForRow(tree, i);
+ if (!tree.isVisible(path))
+ tree.makeVisible(path);
+ }
}
/**
@@ -1431,7 +1468,7 @@ public class BasicTreeUI
*/
public void setPreferredMinSize(Dimension newSize)
{
- // FIXME: not implemented
+ preferredMinSize = newSize;
}
/**
@@ -1441,8 +1478,7 @@ public class BasicTreeUI
*/
public Dimension getPreferredMinSize()
{
- // FIXME: not implemented
- return null;
+ return preferredMinSize;
}
/**
@@ -1472,28 +1508,10 @@ public class BasicTreeUI
*/
public Dimension getPreferredSize(JComponent c, boolean checkConsistancy)
{
- // FIXME: checkConsistancy not implemented, c not used
- TreeModel model = tree.getModel();
- int maxWidth = 0;
- int count = 0;
- if (model != null)
- {
- Object node = model.getRoot();
- if (node != null)
- {
- maxWidth = (int) (getCellBounds(0, 0, node).getWidth());
- while (node != null)
- {
- count++;
- Object nextNode = getNextVisibleNode(node);
- if (nextNode != null)
- maxWidth = Math.max(maxWidth,
- (int) (getCellBounds(0, 0, nextNode).getWidth()));
- node = nextNode;
- }
- }
- }
- return new Dimension(maxWidth, (getRowHeight() * count));
+ // FIXME: checkConsistancy not implemented, c not used
+ if(!validCachedPreferredSize)
+ updateCachedPreferredSize();
+ return preferredSize;
}
/**
@@ -1506,8 +1524,10 @@ public class BasicTreeUI
*/
public Dimension getMinimumSize(JComponent c)
{
- // FIXME: not implemented
- return getPreferredSize(c);
+ Dimension min = getPreferredMinSize();
+ if (min == null)
+ return new Dimension();
+ return min;
}
/**
@@ -1520,8 +1540,9 @@ public class BasicTreeUI
*/
public Dimension getMaximumSize(JComponent c)
{
- // FIXME: not implemented
- return getPreferredSize(c);
+ if (c instanceof JTree)
+ return ((JTree) c).getPreferredSize();
+ return new Dimension();
}
/**
@@ -1565,7 +1586,7 @@ public class BasicTreeUI
}
if (messageTree)
- tree.getModel().valueForPathChanged(tree.getLeadSelectionPath(), newVal);
+ treeModel.valueForPathChanged(tree.getLeadSelectionPath(), newVal);
}
/**
@@ -1600,6 +1621,7 @@ public class BasicTreeUI
{
editingPath = path;
editingRow = tree.getRowForPath(editingPath);
+
Object val = editingPath.getLastPathComponent();
cellEditor.addCellEditorListener(cellEditorListener);
stopEditingInCompleteEditing = false;
@@ -1613,6 +1635,8 @@ public class BasicTreeUI
editingComponent.getParent().validate();
tree.add(editingComponent.getParent());
editingComponent.getParent().validate();
+ validCachedPreferredSize = false;
+ tree.revalidate();
((JTextField) editingComponent).requestFocusInWindow(false);
editorTimer.start();
return true;
@@ -1634,7 +1658,8 @@ public class BasicTreeUI
protected void checkForClickInExpandControl(TreePath path, int mouseX,
int mouseY)
{
- // FIXME: not implemented
+ if (isLocationInExpandControl(path, mouseX, mouseY))
+ toggleExpandState(path);
}
/**
@@ -1655,8 +1680,18 @@ public class BasicTreeUI
protected boolean isLocationInExpandControl(TreePath path, int mouseX,
int mouseY)
{
- // FIXME: not implemented
- return false;
+ boolean cntlClick = false;
+ int row = getRowForPath(tree, path);
+
+ if (!isLeaf(row))
+ {
+ Rectangle bounds = getPathBounds(tree, path);
+
+ if (hasControlIcons() && (mouseX < bounds.x)
+ && (mouseX > (bounds.x - getCurrentControlIcon(path).getIconWidth() - gap)))
+ cntlClick = true;
+ }
+ return cntlClick;
}
/**
@@ -1672,7 +1707,7 @@ public class BasicTreeUI
*/
protected void handleExpandControlClick(TreePath path, int mouseX, int mouseY)
{
- // FIXME: not implemented
+ toggleExpandState(path);
}
/**
@@ -1686,7 +1721,11 @@ public class BasicTreeUI
*/
protected void toggleExpandState(TreePath path)
{
- // FIXME: not implemented
+ if (tree.isExpanded(path))
+ tree.collapsePath(path);
+ else
+ tree.expandPath(path);
+ updateCurrentVisiblePath();
}
/**
@@ -1700,8 +1739,8 @@ public class BasicTreeUI
*/
protected boolean isToggleSelectionEvent(MouseEvent event)
{
- // FIXME: not implemented
- return false;
+ return (tree.getSelectionModel().getSelectionMode() ==
+ TreeSelectionModel.SINGLE_TREE_SELECTION);
}
/**
@@ -1715,8 +1754,8 @@ public class BasicTreeUI
*/
protected boolean isMultiSelectEvent(MouseEvent event)
{
- // FIXME: not implemented
- return false;
+ return (tree.getSelectionModel().getSelectionMode() ==
+ TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);
}
/**
@@ -1731,8 +1770,7 @@ public class BasicTreeUI
*/
protected boolean isToggleEvent(MouseEvent event)
{
- // FIXME: not implemented
- return false;
+ return true;
}
/**
@@ -1749,7 +1787,29 @@ public class BasicTreeUI
*/
protected void selectPathForEvent(TreePath path, MouseEvent event)
{
- // FIXME: not implemented
+ if (isToggleSelectionEvent(event))
+ {
+ if (tree.isPathSelected(path))
+ tree.removeSelectionPath(path);
+ else
+ {
+ tree.addSelectionPath(path);
+ tree.setAnchorSelectionPath(path);
+ }
+ }
+ else if (isMultiSelectEvent(event))
+ {
+ TreePath anchor = tree.getAnchorSelectionPath();
+ if (anchor != null)
+ {
+ int aRow = getRowForPath(tree, anchor);
+ tree.addSelectionInterval(aRow, getRowForPath(tree, path));
+ }
+ else
+ tree.addSelectionPath(path);
+ }
+ else
+ tree.addSelectionPath(path);
}
/**
@@ -1766,7 +1826,7 @@ public class BasicTreeUI
return true;
Object node = pathForRow.getLastPathComponent();
- return tree.getModel().isLeaf(node);
+ return treeModel.isLeaf(node);
}
/**
@@ -1800,9 +1860,9 @@ public class BasicTreeUI
(new TreeTraverseAction(0, "")).actionPerformed(e);
else if (e.getActionCommand().equals("selectAll"))
{
- TreePath[] paths = new TreePath[tree.getRowCount()];
+ TreePath[] paths = new TreePath[tree.getVisibleRowCount()];
- Object curr = getNextVisibleNode(tree.getModel().getRoot());
+ Object curr = getNextVisibleNode(treeModel.getRoot());
int i = 0;
while (curr != null && i < paths.length)
{
@@ -1822,13 +1882,8 @@ public class BasicTreeUI
{
Object last = lead.getLastPathComponent();
TreePath path = new TreePath(getPathToRoot(last, 0));
- if (!tree.getModel().isLeaf(last))
- {
- if (tree.isExpanded(path))
- tree.collapsePath(path);
- else
- tree.expandPath(path);
- }
+ if (!treeModel.isLeaf(last))
+ toggleExpandState(path);
}
}
else if (e.getActionCommand().equals("clearSelection"))
@@ -1920,8 +1975,7 @@ public class BasicTreeUI
/**
* Updates the preferred size when scrolling, if necessary.
*/
- public class ComponentHandler
- extends ComponentAdapter
+ public class ComponentHandler extends ComponentAdapter
implements ActionListener
{
/**
@@ -1937,6 +1991,7 @@ public class BasicTreeUI
*/
public ComponentHandler()
{
+ // Nothing to do here.
}
/**
@@ -1947,14 +2002,16 @@ public class BasicTreeUI
*/
public void componentMoved(ComponentEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
- * Creats, if necessary, and starts a Timer to check if needed to resize the
+ * Creates, if necessary, and starts a Timer to check if needed to resize the
* bounds
*/
protected void startTimer()
{
+ // TODO: Implement this properly.
}
/**
@@ -1976,21 +2033,22 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent ae)
{
+ // TODO: Implement this properly.
}
- }// ComponentHandler
+ }
/**
* Listener responsible for getting cell editing events and updating the tree
* accordingly.
*/
- public class CellEditorHandler
- implements CellEditorListener
+ public class CellEditorHandler implements CellEditorListener
{
/**
* Constructor
*/
public CellEditorHandler()
{
+ // Nothing to do here.
}
/**
@@ -2023,6 +2081,9 @@ public class BasicTreeUI
isEditing = false;
tree.requestFocusInWindow(false);
editorTimer.stop();
+ validCachedPreferredSize = false;
+ tree.revalidate();
+ tree.repaint();
}
/**
@@ -2051,6 +2112,8 @@ public class BasicTreeUI
tree.requestFocusInWindow(false);
editorTimer.stop();
isEditing = false;
+ validCachedPreferredSize = false;
+ tree.revalidate();
tree.repaint();
}
}// CellEditorHandler
@@ -2066,6 +2129,7 @@ public class BasicTreeUI
*/
public FocusHandler()
{
+ // Nothing to do here.
}
/**
@@ -2077,6 +2141,7 @@ public class BasicTreeUI
*/
public void focusGained(FocusEvent e)
{
+ // TODO: Implement this properly.
}
/**
@@ -2088,8 +2153,9 @@ public class BasicTreeUI
*/
public void focusLost(FocusEvent e)
{
+ // TODO: Implement this properly.
}
- }// FocusHandler
+ }
/**
* This is used to get multiple key down events to appropriately genereate
@@ -2109,6 +2175,7 @@ public class BasicTreeUI
*/
public KeyHandler()
{
+ // Nothing to do here.
}
/**
@@ -2122,6 +2189,7 @@ public class BasicTreeUI
*/
public void keyTyped(KeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2132,6 +2200,7 @@ public class BasicTreeUI
*/
public void keyPressed(KeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2142,22 +2211,22 @@ public class BasicTreeUI
*/
public void keyReleased(KeyEvent e)
{
+ // TODO: What should be done here, if anything?
}
- }// KeyHandler
+ }
/**
* MouseListener is responsible for updating the selection based on mouse
* events.
*/
- public class MouseHandler
- extends MouseAdapter
- implements MouseMotionListener
+ public class MouseHandler extends MouseAdapter implements MouseMotionListener
{
/**
* Constructor
*/
public MouseHandler()
{
+ // Nothing to do here.
}
/**
@@ -2168,6 +2237,58 @@ public class BasicTreeUI
*/
public void mousePressed(MouseEvent e)
{
+ Point click = e.getPoint();
+ TreePath path = getClosestPathForLocation(tree, click.x, click.y);
+
+ if (path != null)
+ {
+ Rectangle bounds = getPathBounds(tree, path);
+ int row = getRowForPath(tree, path);
+ boolean cntlClick = isLocationInExpandControl(path, click.x, click.y);
+
+ boolean isLeaf = isLeaf(row);
+
+ TreeCellRenderer tcr = getCellRenderer();
+ Icon icon;
+ if (isLeaf)
+ icon = UIManager.getIcon("Tree.leafIcon");
+ else if (tree.isExpanded(path))
+ icon = UIManager.getIcon("Tree.openIcon");
+ else
+ icon = UIManager.getIcon("Tree.closedIcon");
+
+ if (tcr instanceof DefaultTreeCellRenderer)
+ {
+ Icon tmp = ((DefaultTreeCellRenderer) tcr).getIcon();
+ if (tmp != null)
+ icon = tmp;
+ }
+
+ // add gap*2 for the space before and after the text
+ if (icon != null)
+ bounds.width += icon.getIconWidth() + gap*2;
+
+ boolean inBounds = bounds.contains(click.x, click.y);
+ if ((inBounds || cntlClick) && tree.isVisible(path))
+ {
+ if (inBounds)
+ {
+ selectPath(tree, path);
+ if (e.getClickCount() == 2 && !isLeaf(row))
+ toggleExpandState(path);
+ }
+
+ if (cntlClick)
+ {
+ handleExpandControlClick(path, click.x, click.y);
+ if (cellEditor != null)
+ cellEditor.cancelCellEditing();
+ tree.scrollPathToVisible(path);
+ }
+ else if (tree.isEditable())
+ startEditing(path, e);
+ }
+ }
}
/**
@@ -2181,6 +2302,7 @@ public class BasicTreeUI
*/
public void mouseDragged(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2192,6 +2314,7 @@ public class BasicTreeUI
*/
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2202,16 +2325,16 @@ public class BasicTreeUI
*/
public void mouseReleased(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
- }// MouseHandler
+ }
/**
* MouseInputHandler handles passing all mouse events, including mouse motion
* events, until the mouse is released to the destination it is constructed
* with.
*/
- public class MouseInputHandler
- implements MouseInputListener
+ public class MouseInputHandler implements MouseInputListener
{
/** Source that events are coming from */
protected Component source;
@@ -2232,6 +2355,8 @@ public class BasicTreeUI
public MouseInputHandler(Component source, Component destination,
MouseEvent e)
{
+ this.source = source;
+ this.destination = destination;
}
/**
@@ -2243,6 +2368,7 @@ public class BasicTreeUI
*/
public void mouseClicked(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2253,42 +2379,7 @@ public class BasicTreeUI
*/
public void mousePressed(MouseEvent e)
{
- Point click = e.getPoint();
- int row = Math.round(click.y / getRowHeight());
- TreePath path = getClosestPathForLocation(tree, click.x, click.y);
-
- if (path != null)
- {
- boolean inBounds = false;
- boolean cntlClick = false;
- Rectangle bounds = getPathBounds(tree, path);
-
- bounds.x -= rightChildIndent - 4;
- bounds.width += rightChildIndent + 4;
-
- if (bounds.contains(click.x, click.y))
- inBounds = true;
- else if (hasControlIcons()
- && (click.x < (bounds.x - rightChildIndent + 5) &&
- click.x > (bounds.x - rightChildIndent - 5)))
- cntlClick = true;
-
- if ((inBounds || cntlClick) && tree.isVisible(path))
- {
- selectPath(tree, path);
-
- if ((e.getClickCount() == 2 || cntlClick) && !isLeaf(row))
- {
- if (tree.isExpanded(path))
- tree.collapsePath(path);
- else
- tree.expandPath(path);
- }
-
- if (!cntlClick && tree.isEditable())
- startEditing(path, e);
- }
- }
+ // TODO: What should be done here, if anything?
}
/**
@@ -2299,6 +2390,7 @@ public class BasicTreeUI
*/
public void mouseReleased(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2309,6 +2401,7 @@ public class BasicTreeUI
*/
public void mouseEntered(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2319,6 +2412,7 @@ public class BasicTreeUI
*/
public void mouseExited(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2332,6 +2426,7 @@ public class BasicTreeUI
*/
public void mouseDragged(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2343,6 +2438,7 @@ public class BasicTreeUI
*/
public void mouseMoved(MouseEvent e)
{
+ // TODO: What should be done here, if anything?
}
/**
@@ -2350,8 +2446,9 @@ public class BasicTreeUI
*/
protected void removeFromSource()
{
+ // TODO: Implement this properly.
}
- }// MouseInputHandler
+ }
/**
* Class responsible for getting size of node, method is forwarded to
@@ -2366,12 +2463,16 @@ public class BasicTreeUI
*/
public NodeDimensionsHandler()
{
+ // Nothing to do here.
}
/**
- * Responsible for getting the size of a particular node.
+ * Returns, by reference in bounds, the size and x origin to place value at.
+ * The calling method is responsible for determining the Y location.
+ * If bounds is null, a newly created Rectangle should be returned,
+ * otherwise the value should be placed in bounds and returned.
*
- * @param value
+ * @param cell
* the value to be represented
* @param row
* row being queried
@@ -2383,10 +2484,23 @@ public class BasicTreeUI
* a Rectangle containing the size needed to represent value
* @return containing the node dimensions, or null if node has no dimension
*/
- public Rectangle getNodeDimensions(Object value, int row, int depth,
+ public Rectangle getNodeDimensions(Object cell, int row, int depth,
boolean expanded, Rectangle size)
{
- return null;
+ if (size == null || cell == null)
+ return null;
+
+ String s = cell.toString();
+ Font f = tree.getFont();
+ FontMetrics fm = tree.getToolkit().getFontMetrics(f);
+
+ if (s != null)
+ {
+ size.x = getRowX(row, depth);
+ size.width = SwingUtilities.computeStringWidth(fm, s);
+ size.height = fm.getHeight();
+ }
+ return size;
}
/**
@@ -2396,7 +2510,9 @@ public class BasicTreeUI
*/
protected int getRowX(int row, int depth)
{
- return 0;
+ if (row == 0)
+ return 0;
+ return depth * rightChildIndent;
}
}// NodeDimensionsHandler
@@ -2413,6 +2529,7 @@ public class BasicTreeUI
*/
public PropertyChangeHandler()
{
+ // Nothing to do here.
}
/**
@@ -2424,8 +2541,15 @@ public class BasicTreeUI
*/
public void propertyChange(PropertyChangeEvent event)
{
+ if ((event.getPropertyName()).equals("rootVisible"))
+ {
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
+ tree.repaint();
+ }
}
- }// PropertyChangeHandler
+ }
/**
* Listener on the TreeSelectionModel, resets the row selection if any of the
@@ -2440,6 +2564,7 @@ public class BasicTreeUI
*/
public SelectionModelPropertyChangeHandler()
{
+ // Nothing to do here.
}
/**
@@ -2451,8 +2576,9 @@ public class BasicTreeUI
*/
public void propertyChange(PropertyChangeEvent event)
{
+ // TODO: What should be done here, if anything?
}
- }// SelectionModelPropertyChangeHandler
+ }
/**
* ActionListener that invokes cancelEditing when action performed.
@@ -2464,8 +2590,9 @@ public class BasicTreeUI
/**
* Constructor
*/
- public TreeCancelEditingAction()
+ public TreeCancelEditingAction(String name)
{
+ // TODO: Implement this properly.
}
/**
@@ -2476,6 +2603,7 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
+ // TODO: Implement this properly.
}
/**
@@ -2485,9 +2613,10 @@ public class BasicTreeUI
*/
public boolean isEnabled()
{
+ // TODO: Implement this properly.
return false;
}
- }// TreeCancelEditingAction
+ }
/**
* Updates the TreeState in response to nodes expanding/collapsing.
@@ -2501,6 +2630,7 @@ public class BasicTreeUI
*/
public TreeExpansionHandler()
{
+ // Nothing to do here.
}
/**
@@ -2511,6 +2641,9 @@ public class BasicTreeUI
*/
public void treeExpanded(TreeExpansionEvent event)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
@@ -2522,6 +2655,9 @@ public class BasicTreeUI
*/
public void treeCollapsed(TreeExpansionEvent event)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
}// TreeExpansionHandler
@@ -2547,6 +2683,7 @@ public class BasicTreeUI
*/
public TreeHomeAction(int direction, String name)
{
+ // TODO: Implement this properly
}
/**
@@ -2557,6 +2694,7 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
+ // TODO: Implement this properly
}
/**
@@ -2566,9 +2704,10 @@ public class BasicTreeUI
*/
public boolean isEnabled()
{
+ // TODO: Implement this properly
return false;
}
- }// TreeHomeAction
+ }
/**
* TreeIncrementAction is used to handle up/down actions. Selection is moved
@@ -2591,6 +2730,7 @@ public class BasicTreeUI
*/
public TreeIncrementAction(int direction, String name)
{
+ // TODO: Implement this properly
}
/**
@@ -2606,11 +2746,11 @@ public class BasicTreeUI
if (e.getActionCommand().equals("selectPreviousChangeLead"))
{
Object prev = getPreviousVisibleNode(last);
-
+
if (prev != null)
{
TreePath newPath = new TreePath(getPathToRoot(prev, 0));
- selectPath(tree, new TreePath(getPathToRoot(prev, 0)));
+ selectPath(tree, newPath);
tree.setLeadSelectionPath(newPath);
}
}
@@ -2627,15 +2767,17 @@ public class BasicTreeUI
else if (e.getActionCommand().equals("selectPrevious"))
{
Object prev = getPreviousVisibleNode(last);
+
if (prev != null)
{
TreePath newPath = new TreePath(getPathToRoot(prev, 0));
- selectPath(tree, new TreePath(getPathToRoot(prev, 0)));
+ selectPath(tree, newPath);
}
}
else if (e.getActionCommand().equals("selectNext"))
{
Object next = getNextVisibleNode(last);
+
if (next != null)
{
TreePath newPath = new TreePath(getPathToRoot(next, 0));
@@ -2671,21 +2813,22 @@ public class BasicTreeUI
*/
public boolean isEnabled()
{
+ // TODO: Implement this properly
return false;
}
- }// TreeIncrementAction
+ }
/**
* Forwards all TreeModel events to the TreeState.
*/
- public class TreeModelHandler
- implements TreeModelListener
+ public class TreeModelHandler implements TreeModelListener
{
/**
* Constructor
*/
public TreeModelHandler()
{
+ // Nothing to do here.
}
/**
@@ -2703,6 +2846,9 @@ public class BasicTreeUI
*/
public void treeNodesChanged(TreeModelEvent e)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
@@ -2716,6 +2862,9 @@ public class BasicTreeUI
*/
public void treeNodesInserted(TreeModelEvent e)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
@@ -2732,6 +2881,9 @@ public class BasicTreeUI
*/
public void treeNodesRemoved(TreeModelEvent e)
{
+ validCachedPreferredSize = false;
+ updateCurrentVisiblePath();
+ tree.revalidate();
tree.repaint();
}
@@ -2747,6 +2899,12 @@ public class BasicTreeUI
*/
public void treeStructureChanged(TreeModelEvent e)
{
+ if (e.getPath().length == 1
+ && !e.getPath()[0].equals(treeModel.getRoot()))
+ tree.expandPath(new TreePath(treeModel.getRoot()));
+ updateCurrentVisiblePath();
+ validCachedPreferredSize = false;
+ tree.revalidate();
tree.repaint();
}
}// TreeModelHandler
@@ -2754,8 +2912,7 @@ public class BasicTreeUI
/**
* TreePageAction handles page up and page down events.
*/
- public class TreePageAction
- extends AbstractAction
+ public class TreePageAction extends AbstractAction
{
/** Specifies the direction to adjust the selection by. */
protected int direction;
@@ -2770,6 +2927,7 @@ public class BasicTreeUI
*/
public TreePageAction(int direction, String name)
{
+ this.direction = direction;
}
/**
@@ -2780,6 +2938,7 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
+ // TODO: Implement this properly.
}
/**
@@ -2797,14 +2956,14 @@ public class BasicTreeUI
* Listens for changes in the selection model and updates the display
* accordingly.
*/
- public class TreeSelectionHandler
- implements TreeSelectionListener
+ public class TreeSelectionHandler implements TreeSelectionListener
{
/**
* Constructor
*/
public TreeSelectionHandler()
{
+ // Nothing to do here.
}
/**
@@ -2824,8 +2983,7 @@ public class BasicTreeUI
/**
* For the first selected row expandedness will be toggled.
*/
- public class TreeToggleAction
- extends AbstractAction
+ public class TreeToggleAction extends AbstractAction
{
/**
* Constructor
@@ -2835,6 +2993,7 @@ public class BasicTreeUI
*/
public TreeToggleAction(String name)
{
+ // Nothing to do here.
}
/**
@@ -2845,6 +3004,7 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
+ // TODO: Implement this properly.
}
/**
@@ -2862,8 +3022,7 @@ public class BasicTreeUI
* TreeTraverseAction is the action used for left/right keys. Will toggle the
* expandedness of a node, as well as potentially incrementing the selection.
*/
- public class TreeTraverseAction
- extends AbstractAction
+ public class TreeTraverseAction extends AbstractAction
{
/**
* Determines direction to traverse, 1 means expand, -1 means collapse.
@@ -2880,6 +3039,7 @@ public class BasicTreeUI
*/
public TreeTraverseAction(int direction, String name)
{
+ this.direction = direction;
}
/**
@@ -2890,16 +3050,15 @@ public class BasicTreeUI
*/
public void actionPerformed(ActionEvent e)
{
- TreeModel mod = tree.getModel();
Object last = tree.getLeadSelectionPath().getLastPathComponent();
if (e.getActionCommand().equals("selectParent"))
{
TreePath path = new TreePath(getPathToRoot(last, 0));
- Object p = getParent(mod.getRoot(), last);
+ Object p = getParent(treeModel.getRoot(), last);
- if (!mod.isLeaf(last) && tree.isExpanded(path))
- tree.collapsePath(path);
+ if (!treeModel.isLeaf(last))
+ toggleExpandState(path);
else if (p != null)
selectPath(tree, new TreePath(getPathToRoot(p, 0)));
}
@@ -2907,8 +3066,8 @@ public class BasicTreeUI
{
TreePath path = new TreePath(getPathToRoot(last, 0));
- if (!mod.isLeaf(last) && tree.isCollapsed(path))
- tree.expandPath(path);
+ if (!treeModel.isLeaf(last))
+ toggleExpandState(path);
else
{
Object next = getNextVisibleNode(last);
@@ -2926,302 +3085,35 @@ public class BasicTreeUI
*/
public boolean isEnabled()
{
+ // TODO: Implement this properly
return false;
}
- } // TreeTraverseAction
-
- /**
- * Returns the cell bounds for painting selected cells Package private for use
- * in inner classes.
- *
- * @param x
- * is the x location of the cell
- * @param y
- * is the y location of the cell
- * @param cell
- * is the Object to get the bounds for
- * @returns Rectangle that represents the cell bounds
- */
- Rectangle getCellBounds(int x, int y, Object cell)
- {
- if (cell != null)
- {
- String s = cell.toString();
- Font f = tree.getFont();
- FontMetrics fm = tree.getToolkit().getFontMetrics(f);
-
- if (s != null)
- return new Rectangle(x, y,
- SwingUtilities.computeStringWidth(fm, s) + 4,
- fm.getHeight());
- }
- return new Rectangle(x, y, 0, 0);
- }
-
- /**
- * Retrieves the location of some node, recursively starting at from some
- * node. Package private for use in inner classes.
- *
- * @param x
- * is the starting x position, offset
- * @param y
- * is the starting y position, offset
- * @param tree
- * is the tree to traverse
- * @param mod
- * is the TreeModel to use
- * @param node
- * is the node to get the location for
- * @param startNode
- * is the node to start searching from
- * @return Point - the location of node
- */
- Point getCellLocation(int x, int y, JTree tree, TreeModel mod, Object node,
- Object startNode)
- {
- int rowHeight = getRowHeight();
- if (startNode == null || startNode.equals(node))
- {
- if (!tree.isRootVisible()
- && tree.isExpanded(new TreePath(mod.getRoot())))
- return new Point(x + ((getLevel(node)) * rightChildIndent), y);
-
- return new Point(x + ((getLevel(node) + 1) * rightChildIndent), y);
- }
-
- if (!mod.isLeaf(startNode)
- && tree.isExpanded(new TreePath(getPathToRoot(startNode, 0)))
- && !mod.isLeaf(startNode) && mod.getChildCount(startNode) > 0)
- {
- Object child = mod.getChild(startNode, 0);
- if (child != null)
- return getCellLocation(x, y + rowHeight, tree, mod, node, child);
- }
-
- return getCellLocation(x, y + rowHeight, tree, mod, node,
- getNextVisibleNode(startNode));
- }
-
- /**
- * Paints a node in the tree Package private for use in inner classes.
- *
- * @param g
- * the Graphics context in which to paint
- * @param x
- * the x location of the node
- * @param y
- * the y location of the node
- * @param tree
- * the tree to draw on
- * @param node
- * the object to draw
- */
- void paintNode(Graphics g, int x, int y, JTree tree, Object node,
- boolean isLeaf)
- {
- TreePath curr = new TreePath(getPathToRoot(node, 0));
- boolean selected = tree.isPathSelected(curr);
- boolean expanded = false;
- boolean hasIcons = false;
-
- if (tree.isVisible(curr))
- {
- if (!isLeaf)
- expanded = tree.isExpanded(curr);
-
- if (editingComponent != null && editingPath != null && isEditing(tree)
- && node.equals(editingPath.getLastPathComponent()))
- {
- Rectangle bounds = getPathBounds(tree, editingPath);
- rendererPane.paintComponent(g, editingComponent.getParent(), null,
- new Rectangle(0, 0, bounds.width,
- bounds.height));
- }
- else
- {
- TreeCellRenderer dtcr = tree.getCellRenderer();
- if (dtcr == null)
- dtcr = createDefaultCellRenderer();
-
- int row = getRowForPath(tree, curr);
-
- Component c = dtcr.getTreeCellRendererComponent(tree, node,
- selected, expanded,
- isLeaf, row, false);
-
- rendererPane.paintComponent(g, c, c.getParent(),
- getCellBounds(x, y, node));
- }
- }
}
/**
- * Recursively paints all elements of the tree Package private for use in
- * inner classes.
+ * Returns true if the LookAndFeel implements the control icons. Package
+ * private for use in inner classes.
*
- * @param g
- * the Graphics context in which to paint
- * @param indentation
- * of the current object
- * @param descent
- * is the number of elements drawn
- * @param childNumber
- * is the index of the current child in the tree
- * @param depth
- * is the depth of the current object in the tree
- * @param tree
- * is the tree to draw to
- * @param mod
- * is the TreeModel we are using to draw
- * @param curr
- * is the current object to draw
- * @return int - current descent of the tree
+ * @returns true if there are control icons
*/
- int paintRecursive(Graphics g, int indentation, int descent, int childNumber,
- int depth, JTree tree, TreeModel mod, Object curr)
+ boolean hasControlIcons()
{
- Rectangle clip = g.getClipBounds();
- if (indentation > clip.x + clip.width + rightChildIndent
- || descent > clip.y + clip.height + getRowHeight())
- return descent;
-
- int halfHeight = getRowHeight() / 2;
- int halfWidth = rightChildIndent / 2;
- int y0 = descent + halfHeight;
- int heightOfLine = descent + halfHeight;
- boolean isRootVisible = tree.isRootVisible();
-
- if (mod.isLeaf(curr))
- {
- paintNode(g, indentation + 4, descent, tree, curr, true);
- descent += getRowHeight();
- }
- else
- {
- if (depth > 0 || isRootVisible)
- {
- paintNode(g, indentation + 4, descent, tree, curr, false);
- descent += getRowHeight();
- y0 += halfHeight;
- }
-
- int max = 0;
- if (!mod.isLeaf(curr))
- max = mod.getChildCount(curr);
- if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0))))
- {
- for (int i = 0; i < max; i++)
- {
- int indent = indentation + rightChildIndent;
- if (!isRootVisible && depth == 0)
- indent = 0;
- else if ((!isRootVisible && !curr.equals(mod.getRoot()))
- || isRootVisible)
- {
- g.setColor(getHashColor());
- heightOfLine = descent + halfHeight;
- g.drawLine(indentation + halfWidth, heightOfLine,
- indentation + rightChildIndent, heightOfLine);
- }
-
- descent = paintRecursive(g, indent, descent, i, depth + 1,
- tree, mod, mod.getChild(curr, i));
- }
- }
- }
-
- if (tree.isExpanded(new TreePath(getPathToRoot(curr, 0))))
- if (y0 != heightOfLine && !mod.isLeaf(curr)
- && mod.getChildCount(curr) > 0)
- {
- g.setColor(getHashColor());
- g.drawLine(indentation + halfWidth, y0, indentation + halfWidth,
- heightOfLine);
- }
-
- return descent;
- }
-
- /**
- * Recursively paints all the control icons on the tree. Package private for
- * use in inner classes.
- *
- * @param g
- * the Graphics context in which to paint
- * @param indentation
- * of the current object
- * @param descent
- * is the number of elements drawn
- * @param childNumber
- * is the index of the current child in the tree
- * @param depth
- * is the depth of the current object in the tree
- * @param tree
- * is the tree to draw to
- * @param mod
- * is the TreeModel we are using to draw
- * @param curr
- * is the current object to draw
- * @return int - current descent of the tree
- */
- int paintControlIcons(Graphics g, int indentation, int descent,
- int childNumber, int depth, JTree tree, TreeModel mod,
- Object node)
- {
- int h = descent;
- int rowHeight = getRowHeight();
- Icon ei = UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon");
- Icon ci = UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon");
- Rectangle clip = g.getClipBounds();
- if (indentation > clip.x + clip.width + rightChildIndent
- || descent > clip.y + clip.height + getRowHeight())
- return descent;
-
- if (mod.isLeaf(node))
- descent += rowHeight;
- else
- {
- if (depth > 0 || tree.isRootVisible())
- descent += rowHeight;
-
- int max = 0;
- if (!mod.isLeaf(node))
- max = mod.getChildCount(node);
- if (tree.isExpanded(new TreePath(getPathToRoot(node, 0))))
- {
- if (!node.equals(mod.getRoot()))
- ei.paintIcon(tree, g, indentation - rightChildIndent - 3, h);
-
- for (int i = 0; i < max; i++)
- {
- int indent = indentation + rightChildIndent;
- if (depth == 0 && !tree.isRootVisible())
- indent = -1;
-
- descent = paintControlIcons(g, indent, descent, i, depth + 1,
- tree, mod, mod.getChild(node, i));
- }
- }
- else if (!node.equals(mod.getRoot()))
- ci.paintIcon(tree, g, indentation - rightChildIndent - 3,
- descent - getRowHeight());
- }
-
- return descent;
+ if (expandedIcon != null || collapsedIcon != null)
+ return true;
+ return false;
}
-
+
/**
- * Returns true if the LookAndFeel implements the control icons Package
- * private for use in inner classes.
+ * Returns control icon. It is null if the LookAndFeel does not implements the
+ * control icons. Package private for use in inner classes.
*
- * @return true if control icons are visible
+ * @return control icon if it exists.
*/
- boolean hasControlIcons()
+ Icon getCurrentControlIcon(TreePath path)
{
- if (UIManager.getLookAndFeelDefaults().getIcon("Tree.expandedIcon") == null
- || UIManager.getLookAndFeelDefaults().getIcon("Tree.collapsedIcon") == null)
- return false;
- return true;
+ if (tree.isExpanded(path))
+ return expandedIcon;
+ return collapsedIcon;
}
/**
@@ -3235,8 +3127,10 @@ public class BasicTreeUI
*/
Object getParent(Object root, Object node)
{
- if (root == null || node == null)
+ if (root == null || node == null ||
+ root.equals(node))
return null;
+
if (node instanceof TreeNode)
return ((TreeNode) node).getParent();
return findNode(root, node);
@@ -3253,113 +3147,68 @@ public class BasicTreeUI
*/
private Object findNode(Object root, Object node)
{
- TreeModel mod = tree.getModel();
- int size = 0;
- if (!mod.isLeaf(root))
- size = mod.getChildCount(root);
- for (int i = 0; i < size; i++)
- {
- if (mod.getIndexOfChild(root, node) != -1)
- return root;
-
- Object n = findNode(mod.getChild(root, i), node);
- if (n != null)
- return n;
- }
- return null;
- }
-
- /**
- * Get next visible node in the tree. Package private for use in inner
- * classes.
- *
- * @param the
- * current node
- * @return the next visible node in the JTree. Return null if there are no
- * more.
- */
- Object getNextVisibleNode(Object node)
- {
- Object next = null;
- TreePath current = null;
-
- if (node != null)
- next = getNextNode(node);
-
- if (next != null)
+ if (!treeModel.isLeaf(root) && !root.equals(node))
{
- current = new TreePath(getPathToRoot(next, 0));
- if (tree.isVisible(current))
- return next;
-
- while (next != null && !tree.isVisible(current))
+ int size = treeModel.getChildCount(root);
+ for (int j = 0; j < size; j++)
{
- next = getNextNode(next);
+ Object child = treeModel.getChild(root, j);
+ if (node.equals(child))
+ return root;
- if (next != null)
- current = new TreePath(getPathToRoot(next, 0));
+ Object n = findNode(child, node);
+ if (n != null)
+ return n;
}
}
- return next;
+ return null;
}
-
+
/**
* Get previous visible node in the tree. Package private for use in inner
* classes.
*
- * @param the
+ * @param node -
* current node
* @return the next visible node in the JTree. Return null if there are no
* more.
*/
Object getPreviousVisibleNode(Object node)
{
- Object prev = null;
- TreePath current = null;
-
- if (node != null)
- prev = getPreviousNode(node);
-
- if (prev != null)
+ if (currentVisiblePath != null)
{
- current = new TreePath(getPathToRoot(prev, 0));
- if (tree.isVisible(current))
- return prev;
-
- while (prev != null && !tree.isVisible(current))
- {
- prev = getPreviousNode(prev);
-
- if (prev != null)
- current = new TreePath(getPathToRoot(prev, 0));
- }
+ Object[] nodes = currentVisiblePath.getPath();
+ int i = 0;
+ while (i < nodes.length && !node.equals(nodes[i]))
+ i++;
+ // return the next node
+ if (i-1 >= 0)
+ return nodes[i-1];
}
- return prev;
+ return null;
}
/**
* Returns the next node in the tree Package private for use in inner classes.
*
- * @param the
+ * @param curr -
* current node
* @return the next node in the tree
*/
Object getNextNode(Object curr)
{
- TreeModel mod = tree.getModel();
- if (!mod.isLeaf(curr) && mod.getChildCount(curr) > 0)
- return mod.getChild(curr, 0);
+ if (!treeModel.isLeaf(curr) && treeModel.getChildCount(curr) > 0)
+ return treeModel.getChild(curr, 0);
Object node = curr;
Object sibling = null;
-
do
{
sibling = getNextSibling(node);
- node = getParent(mod.getRoot(), node);
+ node = getParent(treeModel.getRoot(), node);
}
while (sibling == null && node != null);
-
+
return sibling;
}
@@ -3367,14 +3216,13 @@ public class BasicTreeUI
* Returns the previous node in the tree Package private for use in inner
* classes.
*
- * @param the
+ * @param node
* current node
* @return the previous node in the tree
*/
Object getPreviousNode(Object node)
{
- TreeModel mod = tree.getModel();
- Object parent = getParent(mod.getRoot(), node);
+ Object parent = getParent(treeModel.getRoot(), node);
if (parent == null)
return null;
@@ -3384,13 +3232,13 @@ public class BasicTreeUI
return parent;
int size = 0;
- if (!mod.isLeaf(sibling))
- size = mod.getChildCount(sibling);
+ if (!treeModel.isLeaf(sibling))
+ size = treeModel.getChildCount(sibling);
while (size > 0)
{
- sibling = mod.getChild(sibling, size - 1);
- if (!mod.isLeaf(sibling))
- size = mod.getChildCount(sibling);
+ sibling = treeModel.getChild(sibling, size - 1);
+ if (!treeModel.isLeaf(sibling))
+ size = treeModel.getChildCount(sibling);
else
size = 0;
}
@@ -3402,52 +3250,50 @@ public class BasicTreeUI
* Returns the next sibling in the tree Package private for use in inner
* classes.
*
- * @param the
+ * @param node -
* current node
* @return the next sibling in the tree
*/
Object getNextSibling(Object node)
{
- TreeModel mod = tree.getModel();
- Object parent = getParent(mod.getRoot(), node);
+ Object parent = getParent(treeModel.getRoot(), node);
if (parent == null)
return null;
- int index = mod.getIndexOfChild(parent, node) + 1;
+ int index = treeModel.getIndexOfChild(parent, node) + 1;
int size = 0;
- if (!mod.isLeaf(parent))
- size = mod.getChildCount(parent);
+ if (!treeModel.isLeaf(parent))
+ size = treeModel.getChildCount(parent);
if (index == 0 || index >= size)
return null;
- return mod.getChild(parent, index);
+ return treeModel.getChild(parent, index);
}
-
+
/**
* Returns the previous sibling in the tree Package private for use in inner
* classes.
*
- * @param the
+ * @param node -
* current node
* @return the previous sibling in the tree
*/
Object getPreviousSibling(Object node)
{
- TreeModel mod = tree.getModel();
- Object parent = getParent(mod.getRoot(), node);
+ Object parent = getParent(treeModel.getRoot(), node);
if (parent == null)
return null;
- int index = mod.getIndexOfChild(parent, node) - 1;
+ int index = treeModel.getIndexOfChild(parent, node) - 1;
int size = 0;
- if (!mod.isLeaf(parent))
- size = mod.getChildCount(parent);
+ if (!treeModel.isLeaf(parent))
+ size = treeModel.getChildCount(parent);
if (index < 0 || index >= size)
return null;
- return mod.getChild(parent, index);
+ return treeModel.getChild(parent, index);
}
/**
@@ -3463,22 +3309,24 @@ public class BasicTreeUI
{
if (path != null)
{
- if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)
+ if (tree.getSelectionModel().getSelectionMode() ==
+ TreeSelectionModel.SINGLE_TREE_SELECTION)
{
+ tree.getSelectionModel().clearSelection();
tree.addSelectionPath(path);
tree.setLeadSelectionPath(path);
}
- else if (tree.getSelectionModel().getSelectionMode() == TreeSelectionModel.CONTIGUOUS_TREE_SELECTION)
+ else if (tree.getSelectionModel().getSelectionMode() ==
+ TreeSelectionModel.CONTIGUOUS_TREE_SELECTION)
{
// TODO
}
else
{
- tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
-
- tree.getSelectionModel().clearSelection();
tree.addSelectionPath(path);
tree.setLeadSelectionPath(path);
+ tree.getSelectionModel().setSelectionMode
+ (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
}
}
}
@@ -3495,7 +3343,6 @@ public class BasicTreeUI
*/
Object[] getPathToRoot(Object node, int depth)
{
- TreeModel mod = tree.getModel();
if (node == null)
{
if (depth == 0)
@@ -3504,7 +3351,7 @@ public class BasicTreeUI
return new Object[depth];
}
- Object[] path = getPathToRoot(getParent(mod.getRoot(), node), depth + 1);
+ Object[] path = getPathToRoot(getParent(treeModel.getRoot(), node), depth + 1);
path[path.length - depth - 1] = node;
return path;
}
@@ -3512,22 +3359,29 @@ public class BasicTreeUI
/**
* Returns the level of the node in the tree.
*
- * @param the
+ * @param node -
* current node
* @return the number of the level
*/
int getLevel(Object node)
{
int count = -1;
+
Object current = node;
- do
+ if (treeModel != null)
{
- current = getParent(tree.getModel().getRoot(), current);
- count++;
+ Object root = treeModel.getRoot();
+ if (!tree.isRootVisible() && tree.isExpanded(new TreePath(root)))
+ count--;
+
+ do
+ {
+ current = getParent(root, current);
+ count++;
+ }
+ while (current != null);
}
- while (current != null);
-
return count;
}
@@ -3548,6 +3402,8 @@ public class BasicTreeUI
protected void paintVerticalLine(Graphics g, JComponent c, int x, int top,
int bottom)
{
+ // FIXME: Check if drawing a dashed line or not.
+ g.setColor(getHashColor());
g.drawLine(x, top, x, bottom);
}
@@ -3568,6 +3424,8 @@ public class BasicTreeUI
protected void paintHorizontalLine(Graphics g, JComponent c, int y, int left,
int right)
{
+ // FIXME: Check if drawing a dashed line or not.
+ g.setColor(getHashColor());
g.drawLine(left, y, right, y);
}
@@ -3583,13 +3441,311 @@ public class BasicTreeUI
* @param x
* is the center position in x-direction
* @param y
- * is the center position in y-direction FIXME what to do if x <
- * (icon.width / 2). Same with y
+ * is the center position in y-direction
+ */
+ protected void drawCentered(Component c, Graphics g, Icon icon, int x, int y)
+ {
+ x -= icon.getIconWidth() / 2;
+ y -= icon.getIconHeight() / 2;
+
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+
+ icon.paintIcon(c, g, x, y);
+ }
+
+ /**
+ * Draws a dashed horizontal line.
+ *
+ * @param g - the graphics configuration.
+ * @param y - the y location to start drawing at
+ * @param x1 - the x location to start drawing at
+ * @param x2 - the x location to finish drawing at
+ */
+ protected void drawDashedHorizontalLine(Graphics g, int y, int x1, int x2)
+ {
+ g.setColor(getHashColor());
+ for (int i = x1; i < x2; i += 2)
+ g.drawLine(i, y, i + 1, y);
+ }
+
+ /**
+ * Draws a dashed vertical line.
+ *
+ * @param g - the graphics configuration.
+ * @param x - the x location to start drawing at
+ * @param y1 - the y location to start drawing at
+ * @param y2 - the y location to finish drawing at
+ */
+ protected void drawDashedVerticalLine(Graphics g, int x, int y1, int y2)
+ {
+ g.setColor(getHashColor());
+ for (int i = y1; i < y2; i += 2)
+ g.drawLine(x, i, x, i + 1);
+ }
+
+ /**
+ * Paints the expand (toggle) part of a row. The receiver should NOT modify
+ * clipBounds, or insets.
+ *
+ * @param g - the graphics configuration
+ * @param clipBounds -
+ * @param insets -
+ * @param bounds - bounds of expand control
+ * @param path - path to draw control for
+ * @param row - row to draw control for
+ * @param isExpanded - is the row expanded
+ * @param hasBeenExpanded - has the row already been expanded
+ * @param isLeaf - is the path a leaf
+ */
+ protected void paintExpandControl(Graphics g, Rectangle clipBounds,
+ Insets insets, Rectangle bounds,
+ TreePath path, int row,
+ boolean isExpanded, boolean hasBeenExpanded,
+ boolean isLeaf)
+ {
+ if (shouldPaintExpandControl(path, row, isExpanded, hasBeenExpanded, isLeaf))
+ {
+ Icon icon = getCurrentControlIcon(path);
+ int iconW = icon.getIconWidth();
+ int x = bounds.x - rightChildIndent + iconW/2;
+ if (x + iconW > bounds.x)
+ x = bounds.x - rightChildIndent - gap;
+ icon.paintIcon(tree, g, x, bounds.y + bounds.height/2 - icon.getIconHeight()/2);
+ }
+ }
+
+ /**
+ * Paints the horizontal part of the leg. The receiver should NOT modify
+ * clipBounds, or insets.
+ * NOTE: parentRow can be -1 if the root is not visible.
+ *
+ * @param g - the graphics configuration
+ * @param clipBounds -
+ * @param insets -
+ * @param bounds - bounds of the cell
+ * @param path - path to draw leg for
+ * @param row - row to start drawing at
+ * @param isExpanded - is the row expanded
+ * @param hasBeenExpanded - has the row already been expanded
+ * @param isLeaf - is the path a leaf
*/
- protected void drawCentered(JComponent c, Graphics g, Icon icon, int x, int y)
+ protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
+ Insets insets, Rectangle bounds,
+ TreePath path, int row,
+ boolean isExpanded, boolean hasBeenExpanded,
+ boolean isLeaf)
{
- int beginPositionX = x - icon.getIconWidth() / 2;
- int beginPositionY = y - icon.getIconHeight() / 2;
- icon.paintIcon(c, g, beginPositionX, beginPositionY);
+ if (row != 0)
+ paintHorizontalLine(g, tree, bounds.y + bounds.height/2, bounds.x - gap - 2,
+ bounds.x);
+ }
+
+ /**
+ * Paints the vertical part of the leg. The receiver should NOT modify
+ * clipBounds, insets.
+ *
+ * @param g - the graphics configuration.
+ * @param clipBounds -
+ * @param insets -
+ * @param path - the path to draw the vertical part for.
+ */
+ protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds,
+ Insets insets, TreePath path)
+ {
+ int max = tree.getVisibleRowCount();
+ for (int i = 0; i < max; i++)
+ {
+ Object curr = path.getPathComponent(i);
+ TreePath currPath = new TreePath(getPathToRoot(curr, 0));
+ int numChild = treeModel.getChildCount(curr);
+ if (numChild > 0 && tree.isExpanded(currPath))
+ {
+ Rectangle bounds = getPathBounds(tree, currPath);
+ Rectangle lastChildBounds = getPathBounds(tree,
+ new TreePath(getPathToRoot(
+ treeModel.getChild(curr, numChild - 1),
+ 0)));
+ paintVerticalLine(g, tree, bounds.x + gap + 2, bounds.y +
+ bounds.height - 2, lastChildBounds.y +
+ lastChildBounds.height/2);
+ }
+ }
+ }
+
+ /**
+ * Paints the renderer part of a row. The receiver should NOT modify clipBounds,
+ * or insets.
+ *
+ * @param g - the graphics configuration
+ * @param clipBounds -
+ * @param insets -
+ * @param bounds - bounds of expand control
+ * @param path - path to draw control for
+ * @param row - row to draw control for
+ * @param isExpanded - is the row expanded
+ * @param hasBeenExpanded - has the row already been expanded
+ * @param isLeaf - is the path a leaf
+ */
+ protected void paintRow(Graphics g, Rectangle clipBounds,
+ Insets insets, Rectangle bounds,
+ TreePath path, int row,
+ boolean isExpanded, boolean hasBeenExpanded,
+ boolean isLeaf)
+ {
+ boolean selected = tree.isPathSelected(path);
+ boolean hasIcons = false;
+ Object node = path.getLastPathComponent();
+
+ if (tree.isVisible(path))
+ {
+ if (!validCachedPreferredSize)
+ updateCachedPreferredSize();
+
+
+ paintExpandControl(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
+
+ if (row != 0)
+ bounds.x += gap;
+ bounds.width = preferredSize.width + bounds.x;
+
+ if (editingComponent != null && editingPath != null && isEditing(tree)
+ && node.equals(editingPath.getLastPathComponent()))
+ {
+ rendererPane.paintComponent(g, editingComponent.getParent(), null,
+ bounds);
+ }
+ else
+ {
+ TreeCellRenderer dtcr = tree.getCellRenderer();
+ if (dtcr == null)
+ dtcr = createDefaultCellRenderer();
+
+ Component c = dtcr.getTreeCellRendererComponent(tree, node,
+ selected, isExpanded, isLeaf, row, tree.hasFocus());
+ rendererPane.paintComponent(g, c, c.getParent(), bounds);
+ }
+ }
+ }
+
+ /**
+ * Prepares for the UI to uninstall.
+ */
+ protected void prepareForUIUninstall()
+ {
+ // TODO: Implement this properly.
+ }
+
+ /**
+ * Returns true if the expand (toggle) control should be drawn for the
+ * specified row.
+ *
+ * @param path - current path to check for.
+ * @param row - current row to check for.
+ * @param isExpanded - true if the path is expanded
+ * @param hasBeenExpanded - true if the path has been expanded already
+ * @param isLeaf - true if the row is a lead
+ */
+ protected boolean shouldPaintExpandControl(TreePath path, int row,
+ boolean isExpanded,
+ boolean hasBeenExpanded,
+ boolean isLeaf)
+ {
+ Object node = path.getLastPathComponent();
+ return (!isLeaf && getLevel(node) != 0 && hasControlIcons());
+ }
+
+ /**
+ * Updates the cached current TreePath of all visible
+ * nodes in the tree.
+ */
+ void updateCurrentVisiblePath()
+ {
+ if (treeModel == null)
+ return;
+
+ Object next = treeModel.getRoot();
+ TreePath rootPath = new TreePath(next);
+ Rectangle bounds = getPathBounds(tree, rootPath);
+
+ // If root is not a valid size to be visible, or is
+ // not visible and the tree is expanded, then the next node acts
+ // as the root
+ if ((bounds.width == 0 && bounds.height == 0) || (!isRootVisible()
+ && tree.isExpanded(new TreePath(next))))
+ {
+ next = getNextNode(next);
+ rootPath = new TreePath(next);
+ }
+
+ Object root = next;
+ TreePath current = null;
+ while (next != null)
+ {
+ if (current == null)
+ current = rootPath;
+ else
+ current = current.pathByAddingChild(next);
+
+ do
+ {
+ TreePath path = new TreePath(getPathToRoot(next, 0));
+ if ((tree.isVisible(path) && tree.isExpanded(path))
+ || treeModel.isLeaf(next))
+ next = getNextNode(next);
+ else
+ {
+ Object pNext = next;
+ next = getNextSibling(pNext);
+ // if no next sibling, check parent's next sibling.
+ if (next == null)
+ {
+ Object parent = getParent(root, pNext);
+ while (next == null && parent != null)
+ {
+ next = getNextSibling(parent);
+ if (next == null)
+ parent = getParent(root, parent);
+ }
+ }
+ }
+ }
+ while (next != null &&
+ !tree.isVisible(new TreePath(getPathToRoot(next, 0))));
+ }
+
+ currentVisiblePath = current;
+ tree.setVisibleRowCount(getRowCount(tree));
+
+ if (tree.getSelectionModel() != null && tree.getSelectionCount() == 0 &&
+ currentVisiblePath != null)
+ selectPath(tree, new TreePath(getPathToRoot(currentVisiblePath.
+ getPathComponent(0), 0)));
+ }
+
+ /**
+ * Get next visible node in the currentVisiblePath. Package private for use in
+ * inner classes.
+ *
+ * @param node
+ * current node
+ * @return the next visible node in the JTree. Return null if there are no
+ * more.
+ */
+ Object getNextVisibleNode(Object node)
+ {
+ if (currentVisiblePath != null)
+ {
+ Object[] nodes = currentVisiblePath.getPath();
+ int i = 0;
+ while (i < nodes.length && !node.equals(nodes[i]))
+ i++;
+ // return the next node
+ if (i+1 < nodes.length)
+ return nodes[i+1];
+ }
+ return null;
}
} // BasicTreeUI
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java
index 0d461332a70..51b902d6443 100644
--- a/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java
+++ b/libjava/classpath/javax/swing/plaf/basic/BasicViewportUI.java
@@ -38,61 +38,22 @@ exception statement from your version. */
package javax.swing.plaf.basic;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.image.ImageObserver;
-
import javax.swing.JComponent;
-import javax.swing.JViewport;
-import javax.swing.ViewportLayout;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
+import javax.swing.LookAndFeel;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ViewportUI;
public class BasicViewportUI extends ViewportUI
{
-
- ChangeListener changeListener;
- Image backingStoreImage;
- int backingStoreWidth = -1;
- int backingStoreHeight = -1;
-
- class ChangeHandler implements ChangeListener
+ protected void installDefaults(JComponent c)
{
- public void stateChanged(ChangeEvent event)
- {
- JViewport v = (JViewport) event.getSource();
- v.repaint();
- }
- }
-
- void installDefaults(JComponent c)
- {
c.setOpaque(true);
+ LookAndFeel.installColorsAndFont(c, "Viewport.background",
+ "Viewport.foreground", "Viewport.font");
}
-
- void uninstallDefaults(JComponent c)
- {
- }
-
- void installListeners(JComponent c)
+ protected void uninstallDefaults(JComponent c)
{
- ((JViewport)c).addChangeListener(changeListener);
- }
-
- void uninstallListeners(JComponent c)
- {
- ((JViewport)c).removeChangeListener(changeListener);
- }
-
- public BasicViewportUI()
- {
- changeListener = new ChangeHandler();
+ // TODO: Implement this properly.
}
public static ComponentUI createUI(JComponent c)
@@ -103,132 +64,12 @@ public class BasicViewportUI extends ViewportUI
public void installUI(JComponent c)
{
super.installUI(c);
- installListeners(c);
+ installDefaults(c);
}
public void uninstallUI(JComponent c)
{
- uninstallListeners(c);
- }
-
-
- public Dimension getPreferredSize(JComponent c)
- {
- // let the ViewportLayout decide
- return null;
- }
-
- public void paint(Graphics g, JComponent c)
- {
- JViewport port = (JViewport)c;
- Component view = port.getView();
-
- if (view == null)
- return;
-
- Point pos = port.getViewPosition();
- Rectangle viewBounds = view.getBounds();
- Rectangle portBounds = port.getBounds();
-
- if (viewBounds.width == 0
- || viewBounds.height == 0
- || portBounds.width == 0
- || portBounds.height == 0)
- return;
-
- switch (port.getScrollMode())
- {
-
- case JViewport.BACKINGSTORE_SCROLL_MODE:
- paintBackingStore(g, port, view, pos, viewBounds, portBounds);
- break;
-
- case JViewport.BLIT_SCROLL_MODE:
- // FIXME: implement separate blit mode
-
- case JViewport.SIMPLE_SCROLL_MODE:
- default:
- paintSimple(g, port, view, pos, viewBounds, portBounds);
- break;
- }
- }
-
- private void paintSimple(Graphics g,
- JViewport v,
- Component view,
- Point pos,
- Rectangle viewBounds,
- Rectangle portBounds)
- {
- Rectangle oldClip = g.getClipBounds();
- g.setClip(new Rectangle(0, 0, portBounds.width, portBounds.height));
- g.translate (-pos.x, -pos.y);
- try
- {
- view.paint(g);
- }
- finally
- {
- g.translate (pos.x, pos.y);
- g.setClip (oldClip);
- }
- }
-
- private void paintBackingStore(Graphics g,
- JViewport v,
- Component view,
- Point pos,
- Rectangle viewBounds,
- Rectangle portBounds)
- {
- if (backingStoreImage == null
- || backingStoreWidth != viewBounds.width
- || backingStoreHeight != viewBounds.height)
- {
- backingStoreImage = v.createImage(viewBounds.width, viewBounds.height);
- backingStoreWidth = viewBounds.width;
- backingStoreHeight = viewBounds.height;
- }
-
- Graphics g2 = backingStoreImage.getGraphics();
-
- if (v.getBackground() != null)
- {
- // fill the backing store background
- java.awt.Color save = g2.getColor();
- g2.setColor(v.getBackground());
- g2.fillRect (0, 0, backingStoreWidth, backingStoreHeight);
- g2.setColor(save);
-
- // fill the viewport background
- save = g.getColor();
- g.setColor(v.getBackground());
- g.fillRect (0, 0, portBounds.width, portBounds.height);
- g.setColor(save);
-
- }
- else
- {
- // clear the backing store background
- g2.clearRect(0, 0, backingStoreWidth, backingStoreHeight);
-
- // clear the viewport background
- g.clearRect(0, 0, portBounds.width, portBounds.height);
- }
-
- g2.setClip(g.getClipBounds());
- g2.translate(-pos.x, -pos.y);
- try
- {
- view.paint(g2);
- }
- finally
- {
- g2.translate(pos.x, pos.y);
- }
- g2 = null;
- g.drawImage(backingStoreImage,
- 0, 0,
- (ImageObserver)null);
+ super.uninstallUI(c);
+ uninstallDefaults(c);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java b/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java
index f55510684c6..28143d51ecd 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalBorders.java
@@ -45,21 +45,28 @@ import java.awt.Insets;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
+import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
import javax.swing.JTextField;
+import javax.swing.JToggleButton;
+import javax.swing.JToolBar;
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
import javax.swing.border.AbstractBorder;
import javax.swing.border.Border;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicBorders;
+import javax.swing.text.JTextComponent;
/**
- * This factory class creates borders for the different Swing components
- * UI.
+ * A factory class that creates borders for the different Swing components.
*
* @author Roman Kennke (roman@kennke.org)
*/
@@ -69,12 +76,24 @@ public class MetalBorders
/** The shared instance for getButtonBorder(). */
private static Border buttonBorder;
+ /** The shared instance for getToggleButtonBorder(). */
+ private static Border toggleButtonBorder;
+
+ /** The shared instance for getDesktopIconBorder(). */
+ private static Border desktopIconBorder;
+
/** The shared instance for getRolloverButtonBorder(). */
private static Border toolbarButtonBorder;
/** The shared instance for getTextFieldBorder(). */
private static Border textFieldBorder;
+ /** The shared instance for getTextBorder(). */
+ private static Border textBorder;
+
+ /** The shared instance for getRolloverBorder(). */
+ private static Border rolloverBorder;
+
/**
* A MarginBorder that gets shared by multiple components.
* Created on demand by the private helper function {@link
@@ -83,20 +102,19 @@ public class MetalBorders
private static BasicBorders.MarginBorder marginBorder;
/**
- * The border that is drawn around Swing buttons.
+ * A border used for {@link JButton} components.
*/
- public static class ButtonBorder
- extends AbstractBorder
- implements UIResource
+ public static class ButtonBorder extends AbstractBorder implements UIResource
{
/** The borders insets. */
protected static Insets borderInsets = new Insets(3, 3, 3, 3);
/**
- * Creates a new instance of ButtonBorder.
+ * Creates a new instance of <code>ButtonBorder</code>.
*/
public ButtonBorder()
{
+ // Nothing to do here.
}
/**
@@ -112,6 +130,82 @@ public class MetalBorders
public void paintBorder(Component c, Graphics g, int x, int y, int w,
int h)
{
+ // With the OceanTheme the button border is painted entirely different.
+ // However, I couldn't figure out how this is determined besides checking
+ // for instanceof OceanTheme. The button painting is definitely not
+ // influenced by a UI default property and it is definitely performed
+ // by the same Border class.
+ if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme)
+ paintOceanButtonBorder(c, g, x, y, w, h);
+ else
+ {
+ ButtonModel bmodel = null;
+
+ if (c instanceof AbstractButton)
+ bmodel = ((AbstractButton) c).getModel();
+
+ Color darkShadow = MetalLookAndFeel.getControlDarkShadow();
+ Color shadow = MetalLookAndFeel.getControlShadow();
+ Color light = MetalLookAndFeel.getControlHighlight();
+ Color middle = MetalLookAndFeel.getControl();
+
+ if (c.isEnabled())
+ {
+ // draw dark border
+ g.setColor(darkShadow);
+ g.drawRect(x, y, w - 2, h - 2);
+
+ if (!bmodel.isPressed())
+ {
+ // draw light border
+ g.setColor(light);
+ g.drawRect(x + 1, y + 1, w - 2, h - 2);
+
+ // draw crossing pixels of both borders
+ g.setColor(middle);
+ g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2);
+ g.drawLine(x + w - 2, y + 1, x + w - 2, y + 1);
+ }
+ else
+ {
+ // draw light border
+ g.setColor(light);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+
+ // draw shadow border
+ g.setColor(middle);
+ g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+
+ // draw crossing pixels of both borders
+ g.setColor(shadow);
+ g.drawRect(x + 1, y + h - 2, 0, 0);
+ g.drawRect(x + w - 2, y + 1, 0, 0);
+ }
+ }
+ else
+ {
+ // draw disabled border
+ g.setColor(MetalLookAndFeel.getInactiveControlTextColor());
+ g.drawRect(x, y, w - 2, h - 2);
+ }
+ }
+ }
+
+ /**
+ * Paints the button border for the OceanTheme.
+ *
+ * @param c the button
+ * @param g the graphics context
+ * @param x the X coordinate of the upper left corner of the painting rect
+ * @param y the Y coordinate of the upper left corner of the painting rect
+ * @param w the width of the painting rect
+ * @param h the height of the painting rect
+ */
+ private void paintOceanButtonBorder(Component c, Graphics g, int x,
+ int y, int w, int h)
+ {
ButtonModel bmodel = null;
if (c instanceof AbstractButton)
@@ -119,49 +213,45 @@ public class MetalBorders
Color darkShadow = MetalLookAndFeel.getControlDarkShadow();
Color shadow = MetalLookAndFeel.getControlShadow();
- Color light = MetalLookAndFeel.getWhite();
+ Color light = MetalLookAndFeel.getControlHighlight();
Color middle = MetalLookAndFeel.getControl();
- // draw dark border
- g.setColor(darkShadow);
- g.drawRect(x, y, w - 2, h - 2);
-
- if (!bmodel.isPressed())
+ if (c.isEnabled())
{
- // draw light border
- g.setColor(light);
- g.drawRect(x + 1, y + 1, w - 2, h - 2);
-
- // draw crossing pixels of both borders
- g.setColor(middle);
- g.drawRect(x + 1, y + h - 2, 0, 0);
- g.drawRect(x + w - 2, y + 1, 0, 0);
+ if (bmodel.isPressed())
+ {
+ // draw fat border
+ g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+ }
+ else if (bmodel.isRollover())
+ {
+ g.setColor(shadow);
+ g.drawRect(x, y, w - 1, h - 1);
+ g.drawRect(x + 2, y + 2, w - 5, h - 5);
+ g.setColor(darkShadow);
+ g.drawRect(x + 1, y + 1, w - 3, h - 3);
+ }
+ else
+ {
+ g.setColor(darkShadow);
+ g.drawRect(x, y, w - 1, h - 1);
+ }
}
- else
+ else
{
- // draw light border
- g.setColor(light);
- g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
- g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
-
- // draw shadow border
- g.setColor(middle);
- g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
- g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
-
- // draw crossing pixels of both borders
- g.setColor(shadow);
- g.drawRect(x + 1, y + h - 2, 0, 0);
- g.drawRect(x + w - 2, y + 1, 0, 0);
+ // draw disabled border
+ g.setColor(MetalLookAndFeel.getInactiveControlTextColor());
+ g.drawRect(x, y, w - 2, h - 2);
}
}
/**
- * Returns the insets of the ButtonBorder.
+ * Returns the insets of the <code>ButtonBorder</code>.
*
* @param c the component for which the border is used
*
- * @return the insets of the ButtonBorder
+ * @return The insets of the ButtonBorder
*/
public Insets getBorderInsets(Component c)
{
@@ -169,19 +259,20 @@ public class MetalBorders
}
/**
- * Returns the insets of the ButtonBorder in the specified Insets object.
+ * Returns the insets of the <code>ButtonBorder</code> in the specified
+ * <code>newInsets</code> object.
*
* @param c the component for which the border is used
- * @param newInsets the insets object where to put the values
+ * @param newInsets the insets object where to put the values (if
+ * <code>null</code>, a new instance is created).
*
- * @return the insets of the ButtonBorder
+ * @return The insets.
*/
public Insets getBorderInsets(Component c, Insets newInsets)
{
if (newInsets == null)
newInsets = new Insets(0, 0, 0, 0);
- AbstractButton b = (AbstractButton) c;
newInsets.bottom = borderInsets.bottom;
newInsets.left = borderInsets.left;
newInsets.right = borderInsets.right;
@@ -191,6 +282,71 @@ public class MetalBorders
}
/**
+ * A border used when painting {@link JInternalFrame} instances.
+ */
+ static class DesktopIconBorder extends AbstractBorder
+ implements UIResource
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public DesktopIconBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(3, 3, 2, 3);
+ else
+ {
+ newInsets.top = 3;
+ newInsets.left = 3;
+ newInsets.bottom = 2;
+ newInsets.right = 3;
+ }
+ return newInsets;
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawRect(x, y, w - 1, h - 1);
+ }
+
+ }
+
+ /**
* A simple 3D border.
*/
public static class Flush3DBorder extends AbstractBorder
@@ -201,6 +357,7 @@ public class MetalBorders
*/
public Flush3DBorder()
{
+ // Nothing to do here.
}
/**
@@ -262,6 +419,88 @@ public class MetalBorders
}
/**
+ * A border used for a {@link JInternalFrame} when it is being used as a
+ * palette.
+ *
+ * @since 1.3
+ */
+ public static class PaletteBorder extends AbstractBorder
+ implements UIResource
+ {
+ /**
+ * Creates a new <code>PaletteBorder</code>.
+ */
+ public PaletteBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @param newInsets the insets object that, if non-<code>null</code>, will
+ * be populated with the result from this method.
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(1, 1, 1, 1);
+ else
+ {
+ newInsets.top = 1;
+ newInsets.left = 1;
+ newInsets.bottom = 1;
+ newInsets.right = 1;
+ }
+ return newInsets;
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ Color savedColor = g.getColor();
+
+ // draw the outline
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ g.drawRect(x, y, w - 1, h - 1);
+
+ // put a dot in each corner
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x, y, 1, 1);
+ g.fillRect(x + w - 1, y, 1, 1);
+ g.fillRect(x + w - 1, y + h - 1, 1, 1);
+ g.fillRect(x, y + h - 1, 1, 1);
+ g.setColor(savedColor);
+ }
+
+ }
+
+ /**
* A border used for the {@link JTextField} component.
*/
public static class TextFieldBorder extends Flush3DBorder
@@ -272,6 +511,7 @@ public class MetalBorders
*/
public TextFieldBorder()
{
+ // Nothing to do here.
}
/**
@@ -286,8 +526,17 @@ public class MetalBorders
*/
public void paintBorder(Component c, Graphics g, int x, int y, int w,
int h)
- {
- if (c.isEnabled())
+ {
+ boolean enabledTextBorder;
+ if (c instanceof JTextComponent)
+ {
+ JTextComponent tc = (JTextComponent) c;
+ enabledTextBorder = tc.isEnabled() && tc.isEditable();
+ }
+ else
+ enabledTextBorder = false;
+
+ if (enabledTextBorder)
super.paintBorder(c, g, x, y, w, h);
else
{
@@ -301,7 +550,7 @@ public class MetalBorders
}
/**
- * A border used when painting {@link JInternalFrame} instances.
+ * A border used for the {@link JInternalFrame} component.
*/
public static class InternalFrameBorder extends AbstractBorder
implements UIResource
@@ -311,6 +560,7 @@ public class MetalBorders
*/
public InternalFrameBorder()
{
+ // Nothing to do here.
}
/**
@@ -386,7 +636,10 @@ public class MetalBorders
g.drawLine(x + w - 3, y + 14, x + w - 3, y + h - 15);
// draw the line highlights
- g.setColor(MetalLookAndFeel.getControl());
+ if (f.isSelected())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlShadow());
g.drawLine(x + 15, y + 3, x + w - 14, y + 3);
g.drawLine(x + 15, y + h - 2, x + w - 14, y + h - 2);
g.drawLine(x + 3, y + 15, x + 3, y + h - 14);
@@ -396,24 +649,128 @@ public class MetalBorders
}
/**
+ * A border used for {@link JInternalFrame} components that are
+ * presented as dialogs (by the {@link JOptionPane} class).
+ */
+ public static class OptionDialogBorder extends AbstractBorder
+ implements UIResource
+ {
+
+ /**
+ * Creates a new border instance.
+ */
+ public OptionDialogBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(3, 3, 3, 3);
+ else
+ {
+ newInsets.top = 3;
+ newInsets.left = 3;
+ newInsets.bottom = 3;
+ newInsets.right = 3;
+ }
+ return newInsets;
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+
+ JInternalFrame f = (JInternalFrame) c;
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ if (f.getContentPane() instanceof JOptionPane)
+ {
+ JOptionPane pane = (JOptionPane) f.getContentPane();
+ int type = pane.getMessageType();
+ if (type == JOptionPane.QUESTION_MESSAGE)
+ {
+ Color bc = UIManager.getColor(
+ "OptionPane.questionDialog.border.background");
+ if (bc != null)
+ g.setColor(bc);
+ }
+ if (type == JOptionPane.WARNING_MESSAGE)
+ {
+ Color bc = UIManager.getColor(
+ "OptionPane.warningDialog.border.background");
+ if (bc != null)
+ g.setColor(bc);
+ }
+ else if (type == JOptionPane.ERROR_MESSAGE)
+ {
+ Color bc = UIManager.getColor(
+ "OptionPane.errorDialog.border.background");
+ if (bc != null)
+ g.setColor(bc);
+ }
+ }
+
+ // fill the border background
+ g.fillRect(x, y, w, 3);
+ g.fillRect(x, y, 3, h);
+ g.fillRect(x + w - 3, y, 3, h);
+ g.fillRect(x, y + h - 3, w, 3);
+
+ // draw a dot in each corner
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x, y, 1, 1);
+ g.fillRect(x + w - 1, y, 1, 1);
+ g.fillRect(x + w - 1, y + h - 1, 1, 1);
+ g.fillRect(x, y + h - 1, 1, 1);
+
+ }
+
+ }
+
+ /**
* A border used for {@link JMenu} and {@link JMenuItem} components.
*/
- public static class MenuItemBorder
- extends AbstractBorder
- implements UIResource
+ public static class MenuItemBorder extends AbstractBorder
+ implements UIResource
{
/** The border insets. */
- protected static Insets borderInsets = new Insets(2, 2, 2, 2);
-
- // TODO: find where the real colors come from
- private static Color borderColorDark = new Color(102, 102, 153);
- private static Color borderColorLight = new Color(255, 255, 255);
+ protected static Insets borderInsets = new Insets(1, 1, 1, 1);
/**
* Creates a new border instance.
*/
public MenuItemBorder()
{
+ // Nothing to do here.
}
/**
@@ -430,15 +787,17 @@ public class MetalBorders
public void paintBorder(Component c, Graphics g, int x, int y, int w,
int h)
{
+ Color dark = MetalLookAndFeel.getPrimaryControlDarkShadow();
+ Color light = MetalLookAndFeel.getPrimaryControlHighlight();
if (c instanceof JMenu) {
JMenu menu = (JMenu) c;
if (menu.isSelected())
{
- g.setColor(borderColorDark);
+ g.setColor(dark);
g.drawLine(x, y, x, y + h);
g.drawLine(x, y, x + w, y);
g.drawLine(x + w - 2, y + 1, x + w - 2, y + h);
- g.setColor(borderColorLight);
+ g.setColor(light);
g.drawLine(x + w - 1, y + 1, x + w - 1, y + h);
}
}
@@ -446,12 +805,18 @@ public class MetalBorders
{
JMenuItem item = (JMenuItem) c;
if (item.isArmed())
- {
- g.setColor(borderColorDark);
- g.drawLine(x, y, x + w, y);
- g.setColor(borderColorLight);
- g.drawLine(x, y + h - 1, x + w, y + h - 1);
- }
+ {
+ g.setColor(dark);
+ g.drawLine(x, y, x + w, y);
+ g.setColor(light);
+ g.drawLine(x, y + h - 1, x + w, y + h - 1);
+ }
+ else
+ {
+ // Normally we draw a light line on the left.
+ g.setColor(light);
+ g.drawLine(x, y, x, y + h);
+ }
}
}
@@ -505,6 +870,7 @@ public class MetalBorders
*/
public MenuBarBorder()
{
+ // Nothing to do here.
}
/**
@@ -558,7 +924,7 @@ public class MetalBorders
}
/**
- * A border for JScrollPanes.
+ * A border for {@link JScrollPane} components.
*/
public static class ScrollPaneBorder
extends AbstractBorder
@@ -572,6 +938,7 @@ public class MetalBorders
*/
public ScrollPaneBorder()
{
+ // Nothing to do here.
}
/**
@@ -634,6 +1001,45 @@ public class MetalBorders
}
/**
+ * A button border that is only visible when the mouse pointer is within
+ * the button's bounds.
+ */
+ public static class RolloverButtonBorder
+ extends MetalBorders.ButtonBorder
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public RolloverButtonBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Paints the border.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ boolean mouseIsOver = false;
+ if (c instanceof AbstractButton)
+ {
+ ButtonModel bmodel = ((AbstractButton) c).getModel();
+ mouseIsOver = bmodel.isRollover();
+ }
+ if (mouseIsOver)
+ super.paintBorder(c, g, x, y, w, h);
+ }
+ }
+
+ /**
* This border is used in Toolbar buttons as inner border.
*/
static class RolloverMarginBorder extends AbstractBorder
@@ -646,6 +1052,7 @@ public class MetalBorders
*/
public RolloverMarginBorder()
{
+ // Nothing to do here.
}
/**
@@ -693,13 +1100,14 @@ public class MetalBorders
{
/** The border's insets. */
- protected static Insets borderInsets = new Insets(2, 2, 1, 1);
+ protected static Insets borderInsets = new Insets(3, 1, 2, 1);
/**
* Constructs a new PopupMenuBorder.
*/
public PopupMenuBorder()
{
+ // Nothing to do here.
}
/**
@@ -763,13 +1171,258 @@ public class MetalBorders
// draw highlighted inner border (only top and left)
g.setColor(light);
- g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
}
}
/**
+ * A border used for the {@link JToggleButton} component.
+ *
+ * @since 1.3
+ */
+ public static class ToggleButtonBorder
+ extends ButtonBorder
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public ToggleButtonBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Paints the toggle button border.
+ *
+ * @param c the component for which we paint the border
+ * @param g the Graphics context to use
+ * @param x the X coordinate of the upper left corner of c
+ * @param y the Y coordinate of the upper left corner of c
+ * @param w the width of c
+ * @param h the height of c
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ ButtonModel bmodel = null;
+
+ if (c instanceof AbstractButton)
+ bmodel = ((AbstractButton) c).getModel();
+
+ Color darkShadow = MetalLookAndFeel.getControlDarkShadow();
+ Color shadow = MetalLookAndFeel.getControlShadow();
+ Color light = MetalLookAndFeel.getWhite();
+ Color middle = MetalLookAndFeel.getControl();
+
+ if (c.isEnabled())
+ {
+ // draw dark border
+ g.setColor(darkShadow);
+ g.drawRect(x, y, w - 2, h - 2);
+
+ if (!bmodel.isArmed())
+ {
+ // draw light border
+ g.setColor(light);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ if (bmodel.isSelected())
+ g.setColor(middle);
+ g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
+
+ // draw crossing pixels of both borders
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2);
+ g.drawLine(x + w - 2, y + 1, x + w - 2, y + 1);
+ }
+ else
+ {
+ // draw light border
+ g.setColor(light);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+
+ // draw shadow border
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+
+ // draw crossing pixels of both borders
+ g.setColor(shadow);
+ g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2);
+ g.drawLine(x + w - 2, y + 1, x + w - 2, y + 1);
+
+ }
+ // draw corners
+ g.setColor(middle);
+ g.drawLine(x, y + h - 1, x, y + h - 1);
+ g.drawLine(x + w - 1, y, x + w - 1, y);
+ }
+ else
+ {
+ // draw disabled border
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawRect(x, y, w - 2, h - 2);
+ }
+ }
+ }
+
+ /**
+ * A border used for the {@link JToolBar} component.
+ */
+ public static class ToolBarBorder extends AbstractBorder
+ implements UIResource, SwingConstants
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public ToolBarBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ *
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return getBorderInsets(c, null);
+ }
+
+ /**
+ * Returns the border insets.
+ *
+ * @param c the component (ignored).
+ * @return The border insets.
+ */
+ public Insets getBorderInsets(Component c, Insets newInsets)
+ {
+ JToolBar tb = (JToolBar) c;
+ if (tb.getOrientation() == JToolBar.HORIZONTAL)
+ {
+ if (newInsets == null)
+ newInsets = new Insets(2, 16, 2, 2);
+ else
+ {
+ newInsets.top = 2;
+ newInsets.left = 16;
+ newInsets.bottom = 2;
+ newInsets.right = 2;
+ }
+ return newInsets;
+ }
+ else // assume JToolBar.VERTICAL
+ {
+ if (newInsets == null)
+ newInsets = new Insets(16, 2, 2, 2);
+ else
+ {
+ newInsets.top = 16;
+ newInsets.left = 2;
+ newInsets.bottom = 2;
+ newInsets.right = 2;
+ }
+ return newInsets;
+ }
+
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component.
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+
+ JToolBar tb = (JToolBar) c;
+ if (tb.getOrientation() == JToolBar.HORIZONTAL)
+ {
+ MetalUtils.fillMetalPattern(tb, g, x + 2, y + 2, x + 11, y + h - 5,
+ MetalLookAndFeel.getControlHighlight(),
+ MetalLookAndFeel.getControlDarkShadow());
+ }
+ else
+ {
+ MetalUtils.fillMetalPattern(tb, g, x + 2, y + 2, x + w - 5, y + 11,
+ MetalLookAndFeel.getControlHighlight(),
+ MetalLookAndFeel.getControlDarkShadow());
+ }
+ }
+
+ }
+
+ /**
+ * A border for table header cells.
+ *
+ * @since 1.3
+ */
+ public static class TableHeaderBorder extends AbstractBorder
+ {
+ /**
+ * The insets of this border.
+ */
+ // TODO: According to tests that I have done, this is really the border
+ // that should be returned by getBorderInsets(). However, the name
+ // is very distracting. Is there any deeper meaning in it?
+ protected Insets editorBorderInsets;
+
+ /**
+ * Creates a new instance of <code>TableHeaderBorder</code>.
+ */
+ public TableHeaderBorder()
+ {
+ editorBorderInsets = new Insets(1, 1, 1, 1);
+ }
+
+ /**
+ * Return the insets of this border.
+ *
+ * @return the insets of this border
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return editorBorderInsets;
+ }
+
+ /**
+ * Paints the border.
+ *
+ * @param c the component for which to paint the border
+ * @param g the graphics context to use
+ * @param x the x cooridinate of the border rectangle
+ * @param y the y cooridinate of the border rectangle
+ * @param w the width of the border rectangle
+ * @param h the height of the border rectangle
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
+ {
+ Color dark = MetalLookAndFeel.getControlDarkShadow();
+ Color light = MetalLookAndFeel.getWhite();
+ Color old = g.getColor();
+ g.setColor(light);
+ g.drawLine(x, y, x + w - 2, y);
+ g.drawLine(x, y, x, y + h - 2);
+ g.setColor(dark);
+ g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.setColor(old);
+ }
+ }
+
+ /**
* Returns a border for Swing buttons in the Metal Look &amp; Feel.
*
* @return a border for Swing buttons in the Metal Look &amp; Feel
@@ -785,6 +1438,40 @@ public class MetalBorders
}
return buttonBorder;
}
+
+ /**
+ * Returns a border for use with {@link JToggleButton} components.
+ *
+ * @return A border.
+ *
+ * @since 1.3
+ */
+ public static Border getToggleButtonBorder()
+ {
+ if (toggleButtonBorder == null)
+ {
+ Border outer = new ToggleButtonBorder();
+ Border inner = getMarginBorder();
+ toggleButtonBorder = new BorderUIResource.CompoundBorderUIResource
+ (outer, inner);
+ }
+ return toggleButtonBorder;
+ }
+
+ /**
+ * Returns a border instance that is used with a {@link JInternalFrame} when
+ * it is in the iconified state.
+ *
+ * @return A border.
+ *
+ * @since 1.3
+ */
+ public static Border getDesktopIconBorder()
+ {
+ if (desktopIconBorder == null)
+ desktopIconBorder = new DesktopIconBorder();
+ return desktopIconBorder;
+ }
/**
* Returns a border for use by the {@link JTextField} component.
@@ -796,11 +1483,36 @@ public class MetalBorders
public static Border getTextFieldBorder()
{
if (textFieldBorder == null)
- textFieldBorder = new TextFieldBorder();
+ {
+ Border inner = getMarginBorder();
+ Border outer = new TextFieldBorder();
+ textFieldBorder =
+ new BorderUIResource.CompoundBorderUIResource(outer, inner);
+ }
return textFieldBorder;
}
/**
+ * Returns the border that is used for text components (except text fields,
+ * which use {@link #getTextFieldBorder}.
+ *
+ * @return the border that is used for text components
+ *
+ * @since 1.3
+ */
+ public static Border getTextBorder()
+ {
+ if (textBorder == null)
+ {
+ Border inner = getMarginBorder();
+ Border outer = new Flush3DBorder();
+ textBorder =
+ new BorderUIResource.CompoundBorderUIResource(outer, inner);
+ }
+ return textBorder;
+ }
+
+ /**
* Returns a border for Toolbar buttons in the Metal Look &amp; Feel.
*
* @return a border for Toolbar buttons in the Metal Look &amp; Feel
@@ -828,4 +1540,22 @@ public class MetalBorders
marginBorder = new BasicBorders.MarginBorder();
return marginBorder;
}
+
+ /**
+ * Returns a shared instance of a compound border for rollover buttons.
+ *
+ * @return A shared border instance.
+ */
+ static Border getRolloverBorder()
+ {
+ if (rolloverBorder == null)
+ {
+ Border outer = new MetalBorders.RolloverButtonBorder();
+ Border inner = MetalBorders.getMarginBorder();
+ rolloverBorder = new BorderUIResource.CompoundBorderUIResource(outer,
+ inner);
+ }
+ return rolloverBorder;
+ }
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalButtonListener.java b/libjava/classpath/javax/swing/plaf/metal/MetalButtonListener.java
new file mode 100644
index 00000000000..e6fb22e929f
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalButtonListener.java
@@ -0,0 +1,86 @@
+/* MetalButtonListener.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.beans.PropertyChangeEvent;
+
+import javax.swing.AbstractButton;
+import javax.swing.plaf.UIResource;
+import javax.swing.plaf.basic.BasicButtonListener;
+
+/**
+ * A listener for buttons under the {@link MetalLookAndFeel}.
+ *
+ * @see MetalButtonUI#createButtonListener
+ */
+class MetalButtonListener extends BasicButtonListener
+{
+
+ /**
+ * Creates a new instance.
+ *
+ * @param button the button.
+ */
+ public MetalButtonListener(AbstractButton button)
+ {
+ super(button);
+ }
+
+ /**
+ * Handles property change events.
+ *
+ * @param e the event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ super.propertyChange(e);
+ if (e.getPropertyName().equals(
+ AbstractButton.ROLLOVER_ENABLED_CHANGED_PROPERTY))
+ {
+ AbstractButton b = (AbstractButton) e.getSource();
+ if (b.getBorder() instanceof UIResource)
+ {
+ if (Boolean.TRUE.equals(e.getNewValue()))
+ b.setBorder(MetalBorders.getRolloverBorder());
+ else if (Boolean.FALSE.equals(e.getNewValue()))
+ b.setBorder(MetalBorders.getButtonBorder());
+ }
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
index 0dac5ec3953..10e51117329 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalButtonUI.java
@@ -39,18 +39,23 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Rectangle;
import javax.swing.AbstractButton;
+import javax.swing.JButton;
import javax.swing.JComponent;
-import javax.swing.JToolBar;
-import javax.swing.UIDefaults;
+import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
+import javax.swing.plaf.basic.BasicButtonListener;
import javax.swing.plaf.basic.BasicButtonUI;
/**
- * The Metal Look &amp; Feel implementation for
- * {@link javax.swing.AbstractButton}s.
+ * A UI delegate for the {@link JButton} component.
*
* @author Roman Kennke (roman@kennke.org)
*/
@@ -58,27 +63,24 @@ public class MetalButtonUI
extends BasicButtonUI
{
- /** The cached MetalButtonUI instance. */
- private static MetalButtonUI instance = null;
-
- /** The color for the focus border. */
+ /** The color used to draw the focus rectangle around the text and/or icon. */
protected Color focusColor;
-
- /** The color that indicates a selected button. */
+
+ /** The background color for the button when it is pressed. */
protected Color selectColor;
/** The color for disabled button labels. */
protected Color disabledTextColor;
/**
- * Creates a new instance of MetalButtonUI.
+ * Creates a new instance.
*/
public MetalButtonUI()
{
super();
- focusColor = getFocusColor();
- selectColor = getSelectColor();
- disabledTextColor = getDisabledTextColor();
+ focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
+ selectColor = UIManager.getColor(getPropertyPrefix() + "select");
+ disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText");
}
/**
@@ -88,8 +90,7 @@ public class MetalButtonUI
*/
protected Color getFocusColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".focus");
+ return focusColor;
}
/**
@@ -99,8 +100,7 @@ public class MetalButtonUI
*/
protected Color getSelectColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".select");
+ return selectColor;
}
/**
@@ -110,36 +110,139 @@ public class MetalButtonUI
*/
protected Color getDisabledTextColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".disabledText");
+ return disabledTextColor;
}
/**
- * Returns an instance of MetalButtonUI.
- *
- * @param component a button for which a UI instance should be returned
+ * Returns a UI delegate for the specified component.
+ *
+ * @param c the component (should be a subclass of {@link AbstractButton}).
+ *
+ * @return A new instance of <code>MetalButtonUI</code>.
*/
- public static ComponentUI createUI(JComponent component)
- {
- if (instance == null)
- instance = new MetalButtonUI();
- return instance;
+ public static ComponentUI createUI(JComponent c) {
+ return new MetalButtonUI();
}
/**
- * Install the Look &amp; Feel defaults for Buttons.
- *
- * @param button the button for which to install the Look &amp; Feel
+ * Installs the default settings for the specified button.
+ *
+ * @param button the button.
+ *
+ * @see #uninstallDefaults(AbstractButton)
*/
public void installDefaults(AbstractButton button)
{
super.installDefaults(button);
+ button.setRolloverEnabled(UIManager.getBoolean(
+ getPropertyPrefix() + "rollover"));
+ }
+
+ /**
+ * Removes the defaults added by {@link #installDefaults(AbstractButton)}.
+ */
+ public void uninstallDefaults(AbstractButton button)
+ {
+ super.uninstallDefaults(button);
+ button.setRolloverEnabled(false);
+ }
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- button.setFont(defaults.getFont("Button.font"));
+ /**
+ * Returns a button listener for the specified button.
+ *
+ * @param button the button.
+ *
+ * @return A button listener.
+ */
+ protected BasicButtonListener createButtonListener(AbstractButton button)
+ {
+ return new MetalButtonListener(button);
+ }
- if (button.getParent() instanceof JToolBar)
- button.setBorder(MetalBorders.getToolbarButtonBorder());
+ /**
+ * Paints the background of the button to indicate that it is in the "pressed"
+ * state.
+ *
+ * @param g the graphics context.
+ * @param b the button.
+ */
+ protected void paintButtonPressed(Graphics g, AbstractButton b)
+ {
+ if (b.isContentAreaFilled())
+ {
+ Rectangle area = b.getVisibleRect();
+ g.setColor(selectColor);
+ g.fillRect(area.x, area.y, area.width, area.height);
+ }
+ }
+
+ /**
+ * Paints the focus rectangle around the button text and/or icon.
+ *
+ * @param g the graphics context.
+ * @param b the button.
+ * @param viewRect the button bounds.
+ * @param textRect the text bounds.
+ * @param iconRect the icon bounds.
+ */
+ protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect,
+ Rectangle textRect, Rectangle iconRect) {
+ if (b.isEnabled() && b.hasFocus() && b.isFocusPainted())
+ {
+ Color savedColor = g.getColor();
+ g.setColor(getFocusColor());
+ Rectangle focusRect = iconRect.union(textRect);
+ g.drawRect(focusRect.x - 1, focusRect.y,
+ focusRect.width + 1, focusRect.height);
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * Paints the button text.
+ *
+ * @param g the graphics context.
+ * @param c the button.
+ * @param textRect the text bounds.
+ * @param text the text to display.
+ */
+ protected void paintText(Graphics g, JComponent c, Rectangle textRect,
+ String text)
+ {
+ AbstractButton b = (AbstractButton) c;
+ Font f = b.getFont();
+ g.setFont(f);
+ FontMetrics fm = g.getFontMetrics(f);
+
+ if (b.isEnabled())
+ {
+ g.setColor(b.getForeground());
+ g.drawString(text, textRect.x, textRect.y + fm.getAscent());
+ }
+ else
+ {
+ g.setColor(getDisabledTextColor());
+ g.drawString(text, textRect.x, textRect.y + fm.getAscent());
+ }
}
+ /**
+ * If the property <code>Button.gradient</code> is set, then a gradient is
+ * painted as background, otherwise the normal superclass behaviour is
+ * called.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ AbstractButton b = (AbstractButton) c;
+ if (b.isOpaque() && UIManager.get(getPropertyPrefix() + "gradient") != null
+ && !b.getModel().isPressed() && b.isEnabled())
+ {
+ MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(),
+ SwingConstants.VERTICAL,
+ getPropertyPrefix() + "gradient");
+ paint(g, c);
+ }
+ else
+ super.update(g, c);
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java
index 3f3c9ce58b3..fb8280e44da 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java
@@ -38,19 +38,18 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
-
import java.io.Serializable;
import javax.swing.Icon;
import javax.swing.JCheckBox;
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
import javax.swing.plaf.UIResource;
/**
- * An {@link Icon} implementation for {@link JCheckBox}es in the
- * Metal Look &amp; Feel.
+ * An {@link Icon} used by the {@link MetalCheckBoxUI} class.
*
* @author Roman Kennke (roman@kennke.org)
*/
@@ -79,7 +78,10 @@ public class MetalCheckBoxIcon
*/
protected void drawCheck(Component c, Graphics g, int x, int y)
{
- g.setColor(Color.BLACK);
+ if (c.isEnabled())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(3 + x, 5 + y, 3 + x, 9 + y);
g.drawLine(4 + x, 5 + y, 4 + x, 9 + y);
g.drawLine(5 + x, 7 + y, 9 + x, 3 + y);
@@ -128,6 +130,9 @@ public class MetalCheckBoxIcon
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ if (UIManager.get("CheckBox.gradient") != null)
+ MetalUtils.paintGradient(g, x, y, getIconWidth(), getIconHeight(),
+ SwingConstants.VERTICAL, "CheckBox.gradient");
border.paintBorder(c, g, x, y, getIconWidth(), getIconHeight());
JCheckBox cb = (JCheckBox) c;
if (cb.isSelected())
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java
index c46cb5f2fb1..b4f6f0a56cd 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java
@@ -44,8 +44,7 @@ import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
/**
- * A UI delegate for the {@link JCheckBox} component under the
- * {@link MetalLookAndFeel}.
+ * A UI delegate for the {@link JCheckBox} component.
*/
public class MetalCheckBoxUI
extends MetalRadioButtonUI
@@ -64,11 +63,11 @@ public class MetalCheckBoxUI
}
/**
- * Returns an instance of MetalCheckBoxUI.
+ * Returns a shared instance of <code>MetalCheckBoxUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalCheckBoxUI
+ * @return A shared instance of <code>MetalCheckBoxUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxButton.java b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxButton.java
new file mode 100644
index 00000000000..6993e18e9b9
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxButton.java
@@ -0,0 +1,241 @@
+/* MetalComboBoxButton.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+
+import javax.swing.CellRendererPane;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JList;
+import javax.swing.SwingUtilities;
+
+/**
+ * A button used by the {@link MetalComboBoxUI} class.
+ */
+public class MetalComboBoxButton extends JButton {
+
+ /** A reference to the JComboBox that the button belongs to. */
+ protected JComboBox comboBox;
+
+ /** A reference to the JList. */
+ protected JList listBox;
+
+ /** ??? */
+ protected CellRendererPane rendererPane;
+
+ /** The button icon. */
+ protected Icon comboIcon;
+
+ /** Display just the icon, or the icon plus the label. */
+ protected boolean iconOnly;
+
+ /**
+ * Creates a new button.
+ *
+ * @param cb the combo that the button is used for (<code>null</code> not
+ * permitted).
+ * @param i the icon displayed on the button.
+ * @param pane the rendering pane.
+ * @param list the list.
+ */
+ public MetalComboBoxButton(JComboBox cb, Icon i, CellRendererPane pane,
+ JList list)
+ {
+ this(cb, i, cb.isEditable(), pane, list);
+ }
+
+ /**
+ * Creates a new button.
+ *
+ * @param cb the combo that the button is used for (<code>null</code> not
+ * permitted).
+ * @param i the icon displayed on the button.
+ * @parma onlyIcon a flag that specifies whether the button displays only an
+ * icon, or text as well.
+ * @param pane the rendering pane.
+ * @param list the list.
+ */
+ public MetalComboBoxButton(JComboBox cb, Icon i, boolean onlyIcon,
+ CellRendererPane pane, JList list)
+ {
+ super();
+ if (cb == null)
+ throw new NullPointerException("Null 'cb' argument");
+ comboBox = cb;
+ comboIcon = i;
+ iconOnly = onlyIcon;
+ listBox = list;
+ rendererPane = pane;
+ }
+
+ /**
+ * Returns the combo box that the button is used with.
+ *
+ * @return The combo box.
+ */
+ public final JComboBox getComboBox()
+ {
+ return comboBox;
+ }
+
+ /**
+ * Sets the combo box that the button is used with.
+ *
+ * @param cb the combo box.
+ */
+ public final void setComboBox(JComboBox cb)
+ {
+ comboBox = cb;
+ }
+
+ /**
+ * Returns the icon displayed by the button. By default, this will be an
+ * instance of {@link MetalComboBoxIcon}.
+ *
+ * @return The icon displayed by the button.
+ */
+ public final Icon getComboIcon()
+ {
+ return comboIcon;
+ }
+
+ /**
+ * Sets the icon displayed by the button.
+ *
+ * @param i the icon.
+ */
+ public final void setComboIcon(Icon i)
+ {
+ comboIcon = i;
+ }
+
+ /**
+ * Returns a flag that controls whether the button displays an icon only,
+ * or text as well.
+ *
+ * @return A boolean.
+ */
+ public final boolean isIconOnly()
+ {
+ return iconOnly;
+ }
+
+ /**
+ * Sets the flag that controls whether the button displays an icon only,
+ * or text as well.
+ *
+ * @param isIconOnly the flag.
+ */
+ public final void setIconOnly(boolean isIconOnly)
+ {
+ iconOnly = isIconOnly;
+ }
+
+ /**
+ * Returns <code>false</code>, to indicate that this component is not part
+ * of the focus traversal group.
+ *
+ * @return <code>false</code>
+ */
+ public boolean isFocusTraversable()
+ {
+ return false;
+ }
+
+ /**
+ * Enables or disables the button.
+ *
+ * @param enabled the new status.
+ */
+ public void setEnabled(boolean enabled)
+ {
+ super.setEnabled(enabled);
+ // TODO: figure out what this might need to be used for
+ // perhaps it has something to do with the button's icon and/or border?
+ }
+
+ /**
+ * Paints the component.
+ *
+ * @param g the graphics device.
+ */
+ public void paintComponent(Graphics g)
+ {
+ super.paintComponent(g);
+ if (iconOnly)
+ {
+ Rectangle bounds = getBounds();
+ int x = (bounds.width - comboIcon.getIconWidth()) / 2;
+ int y = (bounds.height - comboIcon.getIconHeight()) / 2;
+ comboIcon.paintIcon(comboBox, g, x, y);
+ }
+ else
+ {
+ Object selected = comboBox.getModel().getSelectedItem();
+ if (selected == null)
+ selected = "";
+ Rectangle bounds = comboBox.getBounds();
+ Rectangle innerArea = SwingUtilities.calculateInnerArea(this, null);
+ Insets insets = comboBox.getInsets();
+ Rectangle renderArea = new Rectangle(innerArea.x, innerArea.y,
+ innerArea.width - comboIcon.getIconWidth() - 4, innerArea.height);
+ Component cellRenderer
+ = comboBox.getRenderer().getListCellRendererComponent(this.listBox,
+ selected, comboBox.getSelectedIndex(), false, false);
+ cellRenderer.setBackground(comboBox.getBackground());
+ cellRenderer.setEnabled(comboBox.isEnabled());
+ rendererPane.paintComponent(g, cellRenderer, this, renderArea);
+ if (comboBox.hasFocus())
+ {
+ g.setColor(MetalLookAndFeel.getFocusColor());
+ g.drawRect(innerArea.x, innerArea.y - 1, innerArea.width - 1,
+ innerArea.height);
+ }
+ int iconX = bounds.width - insets.right - comboIcon.getIconWidth() - 7;
+ int iconY = insets.top
+ + (bounds.height - comboIcon.getIconHeight()) / 2;
+ comboIcon.paintIcon(comboBox, g, iconX, iconY);
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java
new file mode 100644
index 00000000000..a531079cb1d
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java
@@ -0,0 +1,143 @@
+/* MetalComboBoxEditor.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Insets;
+
+import javax.swing.JTextField;
+import javax.swing.plaf.basic.BasicComboBoxEditor;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.metal.MetalBorders.Flush3DBorder;
+
+/**
+ * An editor used by the {@link MetalComboBoxUI} class.
+ */
+public class MetalComboBoxEditor extends BasicComboBoxEditor
+{
+ /**
+ * A border used for the {@link JTextField} component.
+ */
+ static class MetalComboBoxEditorBorder extends Flush3DBorder
+ {
+ /**
+ * Creates a new border instance.
+ */
+ public MetalComboBoxEditorBorder()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Paints the border for the specified component.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate.
+ * @param y the y-coordinate.
+ * @param w the width.
+ * @param h the height.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ Color savedColor = g.getColor();
+ if (c.isEnabled())
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 2);
+ g.drawLine(x + 2, y + h - 2, x + w - 1, y + h - 2);
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(x + 1, y + h - 2, x + 1, y + h - 2);
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+ g.setColor(savedColor);
+ }
+
+ /**
+ * Measures the width of this border.
+ *
+ * @param c the component whose border is to be measured.
+ *
+ * @return an Insets object whose <code>left</code>, <code>right</code>,
+ * <code>top</code> and <code>bottom</code> fields indicate the
+ * width of the border at the respective edge, which is zero
+ * for the default implementation provided by AbstractButton.
+ *
+ * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return editorBorderInsets;
+ }
+ }
+
+ /**
+ * A subclass of {@link MetalComboBoxEditor} that implements the
+ * {@link javax.swing.plaf.UIResource} interface.
+ */
+ public static class UIResource extends MetalComboBoxEditor
+ implements javax.swing.plaf.UIResource
+ {
+ /**
+ * Creates a new instance.
+ */
+ public UIResource()
+ {
+ // Nothing to do here.
+ }
+ }
+
+ /** The editor's border insets. */
+ protected static Insets editorBorderInsets = new Insets(4, 2, 4, 0);
+
+ /**
+ * Creates a new editor.
+ */
+ public MetalComboBoxEditor()
+ {
+ super();
+ editor.setBorder(new MetalComboBoxEditorBorder());
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java
index ce4fa7d32ce..f21c5af6136 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java
@@ -1,4 +1,4 @@
-/* MetalComboBoxButton.java
+/* MetalComboBoxIcon.java
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -88,10 +88,11 @@ public class MetalComboBoxIcon implements Icon, Serializable {
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- // TODO: work out whether/how the icon changes with different component
- // states (and also different metal themes)
Color savedColor = g.getColor();
- g.setColor(Color.black);
+ if (c.isEnabled())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
for (int i = 0; i < 5; i++)
g.drawLine(x + i, y + i, x + 9 - i, y + i);
g.setColor(savedColor);
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java
index 28c279d8ed6..a43ee3cb04f 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalComboBoxUI.java
@@ -38,20 +38,134 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.util.HashMap;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.CellRendererPane;
+import javax.swing.ComboBoxEditor;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicComboBoxUI;
+import javax.swing.plaf.basic.BasicComboPopup;
+import javax.swing.plaf.basic.ComboPopup;
-public class MetalComboBoxUI
- extends BasicComboBoxUI
-{
- /** The UI instances for JComboBoxes. */
- private static HashMap instances = null;
+/**
+ * A UI delegate for the {@link JComboBox} component.
+ */
+public class MetalComboBoxUI extends BasicComboBoxUI
+{
+ /**
+ * A layout manager that arranges the editor component (if active) and the
+ * button that make up the combo box.
+ */
+ public class MetalComboBoxLayoutManager
+ extends BasicComboBoxUI.ComboBoxLayoutManager
+ {
+ /**
+ * Creates a new instance of the layout manager.
+ */
+ public MetalComboBoxLayoutManager()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Arranges the editor (if visible) and button that comprise the combo
+ * box.
+ *
+ * @param parent the parent.
+ */
+ public void layoutContainer(Container parent)
+ {
+ JComboBox cb = (JComboBox) parent;
+ if (!cb.isEditable())
+ {
+ Rectangle bounds = parent.getBounds();
+ arrowButton.setBounds(0, 0, bounds.width, bounds.height);
+ }
+ else
+ superLayout(parent);
+ }
+
+ /**
+ * Calls the <code>layoutContainer(Container)</code> method in the super
+ * class.
+ *
+ * @param parent the container.
+ */
+ public void superLayout(Container parent)
+ {
+ super.layoutContainer(parent);
+ }
+ }
+
+ /**
+ * A listener used to handle property changes in the {@link JComboBox}
+ * component, to ensure that the UI delegate accurately reflects the current
+ * state in the rendering onscreen.
+ */
+ public class MetalPropertyChangeListener
+ extends BasicComboBoxUI.PropertyChangeHandler
+ {
+ /**
+ * Creates a new listener.
+ */
+ public MetalPropertyChangeListener()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Handles a property change event, updating the UI components as
+ * appropriate.
+ *
+ * @param e the event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals("editable"))
+ editablePropertyChanged(e);
+ super.propertyChange(e);
+ }
+ }
/**
+ * A popup menu for the combo-box.
+ *
+ * @see #createPopup()
+ *
+ * @deprecated 1.4
+ */
+ public class MetalComboPopup extends BasicComboPopup
+ {
+ /**
+ * Creates a new popup.
+ *
+ * @param cBox the combo box.
+ */
+ public MetalComboPopup(JComboBox cBox)
+ {
+ super(cBox);
+ }
+
+ public void delegateFocus(MouseEvent e)
+ {
+ super.delegateFocus(e);
+ }
+ }
+
+ /**
* Constructs a new instance of MetalComboBoxUI.
*/
public MetalComboBoxUI()
@@ -68,19 +182,135 @@ public class MetalComboBoxUI
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalComboBoxUI instance;
- if (o == null)
+ return new MetalComboBoxUI();
+ }
+
+ /**
+ * Creates an editor for the combo box.
+ *
+ * @return An editor.
+ */
+ protected ComboBoxEditor createEditor()
+ {
+ return new MetalComboBoxEditor.UIResource();
+ }
+
+ /**
+ * Creates a popup for the combo box.
+ *
+ * @return A popup.
+ */
+ protected ComboPopup createPopup()
+ {
+ return new MetalComboPopup(comboBox);
+ }
+
+ /**
+ * Creates a new button for use in rendering the JComboBox.
+ *
+ * @return A button.
+ */
+ protected JButton createArrowButton()
+ {
+ JButton button = new MetalComboBoxButton(comboBox, new MetalComboBoxIcon(),
+ new CellRendererPane(), listBox);
+ button.setMargin(new Insets(0, 1, 1, 3));
+ return button;
+ }
+
+ /**
+ * Creates a new property change listener.
+ *
+ * @return A new property change listener.
+ */
+ public PropertyChangeListener createPropertyChangeListener()
+ {
+ return new MetalPropertyChangeListener();
+ }
+
+ public void paint(Graphics g, JComponent c)
+ {
+ // do nothing, the button and text field are painted elsewhere
+ }
+
+ /**
+ * Updates the button and text field to reflect a change in the 'editable'
+ * property.
+ *
+ * @param e the event.
+ *
+ * @deprecated 1.4
+ */
+ protected void editablePropertyChanged(PropertyChangeEvent e)
+ {
+ if (arrowButton instanceof MetalComboBoxButton)
+ {
+ MetalComboBoxButton b = (MetalComboBoxButton) arrowButton;
+ b.setIconOnly(comboBox.isEditable());
+ }
+ if (comboBox.isEditable())
{
- instance = new MetalComboBoxUI();
- instances.put(component, instance);
+ arrowButton.setText(null);
+ if (editor != null)
+ editor.setVisible(true);
}
else
- instance = (MetalComboBoxUI) o;
-
- return instance;
+ {
+ String text = "";
+ Object selected = comboBox.getSelectedItem();
+ if (selected != null)
+ text = selected.toString();
+ arrowButton.setText(text);
+ if (editor != null)
+ editor.setVisible(true);
+ }
+ }
+
+ /**
+ * Creates a new layout manager for the UI delegate.
+ *
+ * @return A new layout manager.
+ */
+ protected LayoutManager createLayoutManager()
+ {
+ return new MetalComboBoxLayoutManager();
+ }
+
+ /**
+ * Not used in Classpath.
+ *
+ * @deprecated 1.4
+ */
+ protected void removeListeners()
+ {
+ // no longer used in JDK 1.4
+ }
+
+ /**
+ * Returns the minimum size for the combo.
+ *
+ * @param c the component
+ *
+ * @return The minimum size for the combo box.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ Dimension d = getDisplaySize();
+ MetalComboBoxButton b = (MetalComboBoxButton) arrowButton;
+ Insets insets = b.getInsets();
+ int insetsH = insets.top + insets.bottom;
+ int insetsW = insets.left + insets.right;
+ if (!comboBox.isEditable())
+ {
+ Icon icon = b.getComboIcon();
+ int iconWidth = icon.getIconWidth() + 6;
+ return new Dimension(d.width + insetsW + iconWidth, d.height + insetsH);
+ }
+ else
+ // FIXME: the following dimensions pass most of the Mauve tests, but
+ // I don't yet understand the logic behind this...it is probably wrong
+ return new Dimension(d.width + insetsW + (d.height + insetsH) - 4,
+ d.height + insetsH + 1);
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java
index 00870545bc6..ecbb76e6e7a 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java
@@ -39,9 +39,13 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import javax.swing.JComponent;
+import javax.swing.JInternalFrame;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicDesktopIconUI;
+/**
+ * A UI delegate for the {@link JInternalFrame.JDesktopIcon} component.
+ */
public class MetalDesktopIconUI
extends BasicDesktopIconUI
{
@@ -51,7 +55,7 @@ public class MetalDesktopIconUI
private static MetalDesktopIconUI instance = null;
/**
- * Constructs a new instance of MetalDesktopIconUI.
+ * Constructs a new instance of <code>MetalDesktopIconUI</code>.
*/
public MetalDesktopIconUI()
{
@@ -59,11 +63,11 @@ public class MetalDesktopIconUI
}
/**
- * Returns an instance of MetalDesktopIconUI.
+ * Returns a shared instance of <code>MetalDesktopIconUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalDesktopIconUI
+ * @return A shared instance of <code>MetalDesktopIconUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java
new file mode 100644
index 00000000000..3a2e1c13508
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalFileChooserUI.java
@@ -0,0 +1,430 @@
+/* MetalFileChooserUI.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JList;
+import javax.swing.UIManager;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileSystemView;
+import javax.swing.filechooser.FileView;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+
+/**
+ * A UI delegate for the {@link JFileChooser} component. This class is only
+ * partially implemented and is not usable yet.
+ */
+public class MetalFileChooserUI extends BasicFileChooserUI
+{
+ /**
+ * A combo box model containing the selected directory and all its parent
+ * directories.
+ */
+ protected class DirectoryComboBoxModel extends AbstractListModel
+ implements ComboBoxModel
+ {
+ /** Storage for the items in the model. */
+ private List items;
+
+ /** The index of the selected item. */
+ private int selectedIndex;
+
+ /**
+ * Creates a new model.
+ */
+ public DirectoryComboBoxModel()
+ {
+ items = new java.util.ArrayList();
+ selectedIndex = -1;
+ }
+
+ /**
+ * Returns the number of items in the model.
+ *
+ * @return The number of items in the model.
+ */
+ public int getSize()
+ {
+ return items.size();
+ }
+
+ /**
+ * Returns the item at the specified index.
+ *
+ * @param index the item index.
+ *
+ * @return The item.
+ */
+ public Object getElementAt(int index)
+ {
+ return items.get(index);
+ }
+
+ /**
+ * Returns the depth of the item at the given <code>index</code>.
+ *
+ * @param index the item index.
+ *
+ * @return The depth.
+ */
+ public int getDepth(int index)
+ {
+ return Math.max(index, 0);
+ }
+
+ /**
+ * Returns the selected item, or <code>null</code> if no item is selected.
+ *
+ * @return The selected item, or <code>null</code>.
+ */
+ public Object getSelectedItem()
+ {
+ if (selectedIndex >= 0)
+ return items.get(selectedIndex);
+ else
+ return null;
+ }
+
+ /**
+ * Sets the selected item. This clears all the directories from the
+ * existing list, and repopulates it with the new selected directory
+ * and all its parent directories.
+ *
+ * @param selectedDirectory the selected directory.
+ */
+ public void setSelectedItem(Object selectedDirectory)
+ {
+ items.clear();
+ FileSystemView fsv = getFileChooser().getFileSystemView();
+ File parent = (File) selectedDirectory;
+ while (parent != null)
+ {
+ items.add(0, parent);
+ parent = fsv.getParentDirectory(parent);
+ }
+ selectedIndex = items.indexOf(selectedDirectory);
+ fireContentsChanged(this, 0, items.size() - 1);
+ }
+
+ }
+
+ /**
+ * Handles changes to the selection in the directory combo box.
+ */
+ protected class DirectoryComboBoxAction extends AbstractAction
+ {
+ /**
+ * Creates a new action.
+ */
+ protected DirectoryComboBoxAction()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Handles the action event.
+ *
+ * @param e the event.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ JFileChooser fc = getFileChooser();
+ fc.setCurrentDirectory((File) directoryModel.getSelectedItem());
+ }
+ }
+
+ /**
+ * A renderer for the files and directories in the file chooser.
+ */
+ protected class FileRenderer extends DefaultListCellRenderer
+ {
+
+ /**
+ * Creates a new renderer.
+ */
+ protected FileRenderer()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns a component that can render the specified value.
+ *
+ * @param list the list.
+ * @param value the value (a {@link File}).
+ * @param index the index.
+ * @param isSelected is the item selected?
+ * @param cellHasFocus does the item have the focus?
+ *
+ * @return The renderer.
+ */
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus)
+ {
+ FileView v = getFileView(getFileChooser());
+ File f = (File) value;
+ setText(v.getName(f));
+ setIcon(v.getIcon(f));
+ if (isSelected)
+ {
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
+ }
+ else
+ {
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
+ }
+
+ setEnabled(list.isEnabled());
+ setFont(list.getFont());
+
+ if (cellHasFocus)
+ setBorder(UIManager.getBorder("List.focusCellHighlightBorder"));
+ else
+ setBorder(noFocusBorder);
+ return this;
+ }
+ }
+
+ /**
+ * A combo box model for the file selection filters.
+ */
+ protected class FilterComboBoxModel
+ extends AbstractListModel
+ implements ComboBoxModel, PropertyChangeListener
+ {
+
+ /** Storage for the filters in the model. */
+ protected FileFilter[] filters;
+
+ /** The index of the selected file filter. */
+ private int selectedIndex;
+
+ /**
+ * Creates a new model.
+ */
+ protected FilterComboBoxModel()
+ {
+ filters = new FileFilter[1];
+ filters[0] = getAcceptAllFileFilter(getFileChooser());
+ selectedIndex = 0;
+ }
+
+ /**
+ * Handles property changes.
+ *
+ * @param e the property change event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY))
+ {
+ selectedIndex = -1;
+ FileFilter selected = (FileFilter) e.getNewValue();
+ for (int i = 0; i < filters.length; i++)
+ if (filters[i].equals(selected))
+ selectedIndex = i;
+ fireContentsChanged(this, -1, -1);
+ }
+ else if (e.getPropertyName().equals(
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY))
+ {
+ // repopulate list
+ JFileChooser fc = getFileChooser();
+ FileFilter[] choosableFilters = fc.getChoosableFileFilters();
+ filters = choosableFilters;
+ fireContentsChanged(this, 0, filters.length);
+ }
+ }
+
+ /**
+ * Sets the selected filter.
+ *
+ * @param filter the filter.
+ */
+ public void setSelectedItem(Object filter)
+ {
+ // change the filter in the file chooser and let the property change
+ // event trigger the change to the selected item
+ getFileChooser().setFileFilter((FileFilter) filter);
+ }
+
+ /**
+ * Returns the selected file filter.
+ *
+ * @return The selected file filter.
+ */
+ public Object getSelectedItem()
+ {
+ if (selectedIndex >= 0)
+ return filters[selectedIndex];
+ return null;
+ }
+
+ /**
+ * Returns the number of items in the model.
+ *
+ * @return The number of items in the model.
+ */
+ public int getSize()
+ {
+ return filters.length;
+ }
+
+ /**
+ * Returns the item at the specified index.
+ *
+ * @param index the item index.
+ *
+ * @return The item at the specified index.
+ */
+ public Object getElementAt(int index)
+ {
+ return filters[index];
+ }
+
+ }
+
+ /**
+ * A renderer for the items in the file filter combo box.
+ */
+ public class FilterComboBoxRenderer extends DefaultListCellRenderer
+ {
+ /**
+ * Creates a new renderer.
+ */
+ public FilterComboBoxRenderer()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns a component that can be used to paint the given value within
+ * the list.
+ *
+ * @param list the list.
+ * @param value the value (a {@link FileFilter}).
+ * @param index the item index.
+ * @param isSelected is the item selected?
+ * @param cellHasFocus does the list cell have focus?
+ *
+ * @return A component.
+ */
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected, boolean cellHasFocus)
+ {
+ FileFilter filter = (FileFilter) value;
+ return super.getListCellRendererComponent(list, filter.getDescription(),
+ index, isSelected, cellHasFocus);
+ }
+ }
+
+ /** The model for the directory combo box. */
+ DirectoryComboBoxModel directoryModel;
+
+ /**
+ * A factory method that returns a UI delegate for the specified
+ * component.
+ *
+ * @param c the component (which should be a {@link JFileChooser}).
+ */
+ public static ComponentUI createUI(JComponent c)
+ {
+ JFileChooser chooser = (JFileChooser) c;
+ return new MetalFileChooserUI(chooser);
+ }
+
+ /**
+ * Creates a new instance of this UI delegate.
+ *
+ * @param filechooser the file chooser component.
+ */
+ public MetalFileChooserUI(JFileChooser filechooser)
+ {
+ super(filechooser);
+ }
+
+ /**
+ * Creates and returns a new instance of {@link DirectoryComboBoxModel}.
+ *
+ * @return A new instance of {@link DirectoryComboBoxModel}.
+ */
+ protected MetalFileChooserUI.DirectoryComboBoxModel
+ createDirectoryComboBoxModel(JFileChooser fc)
+ {
+ return new DirectoryComboBoxModel();
+ }
+
+ /**
+ * Creates and returns a new instance of {@link FilterComboBoxModel}.
+ *
+ * @return A new instance of {@link FilterComboBoxModel}.
+ */
+ protected FilterComboBoxModel createFilterComboBoxModel()
+ {
+ return new FilterComboBoxModel();
+ }
+
+ /**
+ * Creates and returns a new instance of {@link FilterComboBoxRenderer}.
+ *
+ * @return A new instance of {@link FilterComboBoxRenderer}.
+ */
+ protected MetalFileChooserUI.FilterComboBoxRenderer
+ createFilterComboBoxRenderer()
+ {
+ return new FilterComboBoxRenderer();
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java b/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
index d8c77432653..bcb86e61047 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalIconFactory.java
@@ -43,13 +43,17 @@ import java.awt.Component;
import java.awt.Graphics;
import java.io.Serializable;
+import javax.swing.AbstractButton;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JRadioButton;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JSlider;
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
import javax.swing.plaf.UIResource;
@@ -75,6 +79,7 @@ public class MetalIconFactory implements Serializable
*/
public CheckBoxMenuItemIcon()
{
+ // Nothing to do here.
}
/**
@@ -137,6 +142,385 @@ public class MetalIconFactory implements Serializable
}
/**
+ * An icon used for the "detail view" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserDetailViewIcon()
+ */
+ private static class FileChooserDetailViewIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserDetailViewIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 18;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 18;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+
+ // file 1 outline
+ g.drawLine(x + 2, y + 2, x + 5, y + 2);
+ g.drawLine(x + 6, y + 3, x + 6, y + 7);
+ g.drawLine(x + 2, y + 7, x + 6, y + 7);
+ g.drawLine(x + 2, y + 2, x + 2, y + 7);
+
+ // file 2 outline
+ g.drawLine(x + 2, y + 10, x + 5, y + 10);
+ g.drawLine(x + 6, y + 11, x + 6, y + 15);
+ g.drawLine(x + 2, y + 15, x + 6, y + 15);
+ g.drawLine(x + 2, y + 10, x + 2, y + 15);
+
+ // detail lines
+ g.drawLine(x + 8, y + 5, x + 15, y + 5);
+ g.drawLine(x + 8, y + 13, x + 15, y + 13);
+
+ // fill files
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 3, y + 3, 3, 4);
+ g.fillRect(x + 3, y + 11, 3, 4);
+
+ // highlight files
+ g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
+ g.drawLine(x + 4, y + 4, x + 4, y + 5);
+ g.drawLine(x + 4, y + 12, x + 4, y + 13);
+
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An icon used for the "home folder" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserHomeFolderIcon()
+ */
+ private static class FileChooserHomeFolderIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserHomeFolderIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 18;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 18;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+
+ // roof
+ g.drawLine(x + 1, y + 8, x + 8, y + 1);
+ g.drawLine(x + 8, y + 1, x + 15, y + 8);
+
+ // base of house
+ g.drawLine(x + 3, y + 6, x + 3, y + 15);
+ g.drawLine(x + 3, y + 15, x + 13, y + 15);
+ g.drawLine(x + 13, y + 6, x + 13, y + 15);
+
+ // door frame
+ g.drawLine(x + 6, y + 9, x + 6, y + 15);
+ g.drawLine(x + 6, y + 9, x + 10, y + 9);
+ g.drawLine(x + 10, y + 9, x + 10, y + 15);
+
+ // chimney
+ g.drawLine(x + 11, y + 2, x + 11, y + 4);
+ g.drawLine(x + 12, y + 2, x + 12, y + 5);
+
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+
+ // roof paint
+ int xx = x + 8;
+ for (int i = 0; i < 4; i++)
+ g.drawLine(xx - i, y + 2 + i, xx + i, y + 2 + i);
+ g.fillRect(x + 4, y + 6, 9, 2);
+
+ // door knob
+ g.drawLine(x + 9, y + 12, x + 9, y + 12);
+
+ // house paint
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.drawLine(x + 4, y + 8, x + 12, y + 8);
+ g.fillRect(x + 4, y + 9, 2, 6);
+ g.fillRect(x + 11, y + 9, 2, 6);
+
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An icon used for the "list view" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserListViewIcon()
+ */
+ private static class FileChooserListViewIcon implements Icon, Serializable
+ {
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserListViewIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 18;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 18;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+
+ // file 1 outline
+ g.drawLine(x + 2, y + 2, x + 5, y + 2);
+ g.drawLine(x + 6, y + 3, x + 6, y + 7);
+ g.drawLine(x + 2, y + 7, x + 6, y + 7);
+ g.drawLine(x + 2, y + 2, x + 2, y + 7);
+
+ // file 2 outline
+ g.drawLine(x + 2, y + 10, x + 5, y + 10);
+ g.drawLine(x + 6, y + 11, x + 6, y + 15);
+ g.drawLine(x + 2, y + 15, x + 6, y + 15);
+ g.drawLine(x + 2, y + 10, x + 2, y + 15);
+
+ // file 3 outline
+ g.drawLine(x + 10, y + 2, x + 13, y + 2);
+ g.drawLine(x + 14, y + 3, x + 14, y + 7);
+ g.drawLine(x + 10, y + 7, x + 14, y + 7);
+ g.drawLine(x + 10, y + 2, x + 10, y + 7);
+
+ // file 4 outline
+ g.drawLine(x + 10, y + 10, x + 13, y + 10);
+ g.drawLine(x + 14, y + 11, x + 14, y + 15);
+ g.drawLine(x + 10, y + 15, x + 14, y + 15);
+ g.drawLine(x + 10, y + 10, x + 10, y + 15);
+
+ g.drawLine(x + 8, y + 5, x + 8, y + 5);
+ g.drawLine(x + 8, y + 13, x + 8, y + 13);
+ g.drawLine(x + 16, y + 5, x + 16, y + 5);
+ g.drawLine(x + 16, y + 13, x + 16, y + 13);
+
+ // fill files
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 3, y + 3, 3, 4);
+ g.fillRect(x + 3, y + 11, 3, 4);
+ g.fillRect(x + 11, y + 3, 3, 4);
+ g.fillRect(x + 11, y + 11, 3, 4);
+
+ // highlight files
+ g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
+ g.drawLine(x + 4, y + 4, x + 4, y + 5);
+ g.drawLine(x + 4, y + 12, x + 4, y + 13);
+ g.drawLine(x + 12, y + 4, x + 12, y + 5);
+ g.drawLine(x + 12, y + 12, x + 12, y + 13);
+
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An icon used for the "new folder" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserNewFolderIcon()
+ */
+ private static class FileChooserNewFolderIcon implements Icon, Serializable
+ {
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserNewFolderIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
+ */
+ public int getIconWidth()
+ {
+ return 18;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 18;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+
+ g.drawLine(x + 2, y + 5, x + 9, y + 5);
+ g.drawLine(x + 10, y + 6, x + 15, y + 6);
+ g.drawLine(x + 15, y + 5, x + 15, y + 14);
+ g.drawLine(x + 2, y + 14, x + 15, y + 14);
+ g.drawLine(x + 1, y + 6, x + 1, y + 14);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ g.drawLine(x + 11, y + 3, x + 15, y + 3);
+ g.drawLine(x + 10, y + 4, x + 15, y + 4);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 3, y + 7, 7, 7);
+ g.fillRect(x + 10, y + 8, 5, 6);
+ g.drawLine(x + 10, y + 5, x + 14, y + 5);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
+ g.drawLine(x + 10, y + 7, x + 14, y + 7);
+ g.drawLine(x + 2, y + 6, x + 9, y + 6);
+ g.drawLine(x + 2, y + 6, x + 2, y + 13);
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An icon used for the "up folder" button on a {@link JFileChooser} under
+ * the {@link MetalLookAndFeel}.
+ *
+ * @see MetalIconFactory#getFileChooserNewFolderIcon()
+ */
+ private static class FileChooserUpFolderIcon extends FileChooserNewFolderIcon
+ implements Icon, Serializable
+ {
+ /**
+ * Creates a new icon.
+ */
+ public FileChooserUpFolderIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+
+ // draw the folder
+ super.paintIcon(c, g, x, y);
+
+ // now draw the up arrow
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 8, y + 9, x + 8, y + 16);
+ int xx = x + 8;
+ for (int i = 0; i < 4; i++)
+ g.drawLine(xx - i, y + 9 + i, xx + i, y + 9 + i);
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
* An icon representing a file (drawn as a piece of paper with the top-right
* corner turned down).
*/
@@ -153,13 +537,15 @@ public class MetalIconFactory implements Serializable
}
/**
- * Returns the height of the icon, in pixels.
+ * Returns the height of the icon, in pixels. The height returned is
+ * <code>16</code> plus the value returned by
+ * {@link #getAdditionalHeight()}.
*
* @return The height of the icon.
*/
public int getIconHeight()
{
- return 16;
+ return 16 + getAdditionalHeight();
}
/**
@@ -192,9 +578,11 @@ public class MetalIconFactory implements Serializable
}
/**
- * Returns the additional height (???).
+ * Returns the additional height for the icon. The
+ * {@link #getIconHeight()} method adds this value to the icon height it
+ * returns. Subclasses can override this method to adjust the icon height.
*
- * @return The additional height.
+ * @return The additional height (<code>0</code> unless overridden).
*/
public int getAdditionalHeight()
{
@@ -228,13 +616,15 @@ public class MetalIconFactory implements Serializable
}
/**
- * Returns the height of the icon, in pixels.
+ * Returns the height of the icon, in pixels. The height returned is
+ * <code>16</code> plus the value returned by
+ * {@link #getAdditionalHeight()}.
*
* @return The height of the icon.
*/
public int getIconHeight()
{
- return 16;
+ return 16 + getAdditionalHeight();
}
/**
@@ -265,9 +655,11 @@ public class MetalIconFactory implements Serializable
}
/**
- * Returns the additional height (???).
+ * Returns the additional height for the icon. The
+ * {@link #getIconHeight()} method adds this value to the icon height it
+ * returns. Subclasses can override this method to adjust the icon height.
*
- * @return The additional height.
+ * @return The additional height (<code>0</code> unless overridden).
*/
public int getAdditionalHeight()
{
@@ -285,29 +677,77 @@ public class MetalIconFactory implements Serializable
}
}
-
+
/**
- * An {@link Icon} implementation for {@link JCheckBox}es in the
- * Metal Look &amp; Feel.
- *
- * @author Roman Kennke (roman@kennke.org)
+ * An icon used by the {@link MetalInternalFrameUI} class when the frame
+ * is displayed as a palette.
+ *
+ * @since 1.3
*/
- static class RadioButtonIcon
- implements Icon, UIResource, Serializable
+ public static class PaletteCloseIcon
+ implements Icon, Serializable, UIResource
{
/**
- * Draws the check in the RadioButton.
- *
- * @param c the component to draw on
- * @param g the Graphics context to draw with
+ * Returns the width of the icon, in pixels.
+ *
+ * @return The width of the icon.
*/
- protected void drawCheck(Component c, Graphics g)
+ public int getIconWidth()
{
- g.setColor(MetalLookAndFeel.getBlack());
- g.fillRect(4, 3, 4, 6);
- g.drawLine(3, 4, 3, 7);
- g.drawLine(8, 4, 8, 7);
+ return 7;
}
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return The height of the icon.
+ */
+ public int getIconHeight()
+ {
+ return 7;
+ }
+
+ /**
+ * Paints the icon using colors from the {@link MetalLookAndFeel}.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color savedColor = g.getColor();
+ AbstractButton button = (AbstractButton) c;
+ if (button.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.fillRect(x + 2, y + 2, 3, 3);
+ g.drawLine(x + 1, y, x + 1, y + 2);
+ g.drawLine(x, y + 1, x + 2, y + 1);
+ g.drawLine(x + 5, y, x + 5, y + 2);
+ g.drawLine(x + 4, y + 1, x + 6, y + 1);
+ g.drawLine(x + 1, y + 4, x + 1, y + 6);
+ g.drawLine(x, y + 5, x + 2, y + 5);
+ g.drawLine(x + 5, y + 4, x + 5, y + 6);
+ g.drawLine(x + 4, y + 5, x + 6, y + 5);
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(x + 2, y + 6, x + 3, y + 5);
+ g.drawLine(x + 5, y + 3, x + 6, y + 2);
+ g.drawLine(x + 6, y + 6, x + 6, y + 6);
+ g.setColor(savedColor);
+ }
+ }
+
+ /**
+ * An {@link Icon} implementation for {@link JCheckBox}es in the
+ * Metal Look &amp; Feel.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+ static class RadioButtonIcon implements Icon, UIResource, Serializable
+ {
/**
* Returns the width of the icon in pixels.
@@ -330,70 +770,108 @@ public class MetalIconFactory implements Serializable
}
/**
- * Paints the icon. This first paints the border of the RadioButton and
- * if the CheckBox is selected it calls {@link #drawCheck} to draw
- * the check.
+ * Paints the icon, taking into account whether or not the component is
+ * enabled, selected and/or armed.
*
- * @param c the Component to draw on (gets casted to JCheckBox)
+ * @param c the Component to draw on (must be an instance of
+ * {@link JRadioButton})
* @param g the Graphics context to draw with
* @param x the X position
* @param y the Y position
*/
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- Color dark = MetalLookAndFeel.getControlDarkShadow();
- Color light = MetalLookAndFeel.getWhite();
- g.translate(x, y);
-
- // The light 'circle'
- g.setColor(light);
- g.drawLine(4, 1, 10, 1);
- g.drawLine(2, 2, 3, 2);
- g.drawLine(8, 2, 11, 2);
- g.drawLine(2, 3, 2, 3);
- g.drawLine(11, 2, 11, 9);
- g.drawLine(1, 4, 1, 7);
- g.drawLine(12, 4, 12, 7);
- g.drawLine(2, 8, 2, 11);
- g.drawLine(11, 8, 11, 9);
- g.drawLine(10, 10, 10, 10);
- g.drawLine(2, 11, 9, 11);
- g.drawLine(4, 12, 7, 12);
-
- // The dark 'circle'
- g.setColor(dark);
- g.drawLine(4, 0, 7, 0);
- g.drawLine(2, 1, 3, 1);
- g.drawLine(8, 1, 9, 1);
- g.drawLine(1, 2, 1, 3);
- g.drawLine(10, 2, 10, 3);
- g.drawLine(0, 4, 0, 7);
- g.drawLine(11, 4, 11, 7);
- g.drawLine(1, 8, 1, 9);
- g.drawLine(10, 8, 10, 9);
- g.drawLine(2, 10, 3, 10);
- g.drawLine(8, 10, 9, 10);
- g.drawLine(4, 11, 7, 11);
-
- JRadioButton rb = (JRadioButton) c;
- if (rb.isSelected())
- drawCheck(c, g);
-
- g.translate(-x, -y);
- }
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ if (UIManager.get("RadioButton.gradient") != null)
+ MetalUtils.paintGradient(g, x, y, getIconWidth(), getIconHeight(),
+ SwingConstants.VERTICAL, "RadioButton.gradient");
+
+ Color savedColor = g.getColor();
+ JRadioButton b = (JRadioButton) c;
+
+ // draw outer circle
+ if (b.isEnabled())
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(x + 2, y + 1, x + 3, y + 1);
+ g.drawLine(x + 4, y, x + 7, y);
+ g.drawLine(x + 8, y + 1, x + 9, y + 1);
+ g.drawLine(x + 10, y + 2, x + 10, y + 3);
+ g.drawLine(x + 11, y + 4, x + 11, y + 7);
+ g.drawLine(x + 10, y + 8, x + 10, y + 9);
+ g.drawLine(x + 8, y + 10, x + 9, y + 10);
+ g.drawLine(x + 4, y + 11, x + 7, y + 11);
+ g.drawLine(x + 2, y + 10, x + 3, y + 10);
+ g.drawLine(x + 1, y + 9, x + 1, y + 8);
+ g.drawLine(x, y + 7, x, y + 4);
+ g.drawLine(x + 1, y + 2, x + 1, y + 3);
+
+ if (b.getModel().isArmed())
+ {
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawLine(x + 4, y + 1, x + 7, y + 1);
+ g.drawLine(x + 4, y + 10, x + 7, y + 10);
+ g.drawLine(x + 1, y + 4, x + 1, y + 7);
+ g.drawLine(x + 10, y + 4, x + 10, y + 7);
+ g.fillRect(x + 2, y + 2, 8, 8);
+ }
+ else
+ {
+ // only draw inner highlight if not filled
+ if (b.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getWhite());
+
+ g.drawLine(x + 2, y + 8, x + 2, y + 9);
+ g.drawLine(x + 1, y + 4, x + 1, y + 7);
+ g.drawLine(x + 2, y + 2, x + 2, y + 3);
+ g.drawLine(x + 3, y + 2, x + 3, y + 2);
+ g.drawLine(x + 4, y + 1, x + 7, y + 1);
+ g.drawLine(x + 8, y + 2, x + 9, y + 2);
+ }
+ }
+
+ // draw outer highlight
+ if (b.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getWhite());
+
+ // outer
+ g.drawLine(x + 10, y + 1, x + 10, y + 1);
+ g.drawLine(x + 11, y + 2, x + 11, y + 3);
+ g.drawLine(x + 12, y + 4, x + 12, y + 7);
+ g.drawLine(x + 11, y + 8, x + 11, y + 9);
+ g.drawLine(x + 10, y + 10, x + 10, y + 10);
+ g.drawLine(x + 8, y + 11, x + 9, y + 11);
+ g.drawLine(x + 4, y + 12, x + 7, y + 12);
+ g.drawLine(x + 2, y + 11, x + 3, y + 11);
+ }
+
+ if (b.isSelected())
+ {
+ if (b.isEnabled())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(x + 4, y + 3, x + 7, y + 3);
+ g.fillRect(x + 3, y + 4, 6, 4);
+ g.drawLine(x + 4, y + 8, x + 7, y + 8);
+ }
+ g.setColor(savedColor);
+ }
}
/**
* An icon displayed for {@link JRadioButtonMenuItem} components.
*/
- private static class RadioButtonMenuItemIcon
- implements Icon, Serializable
+ private static class RadioButtonMenuItemIcon implements Icon, Serializable
{
/**
* Creates a new icon instance.
*/
public RadioButtonMenuItemIcon()
- {
+ {
+ // Nothing to do here.
}
/**
@@ -463,8 +941,7 @@ public class MetalIconFactory implements Serializable
* The icon used to display the thumb control on a horizontally oriented
* {@link JSlider} component.
*/
- private static class HorizontalSliderThumbIcon
- implements Icon, Serializable
+ private static class HorizontalSliderThumbIcon implements Icon, Serializable
{
/**
@@ -472,6 +949,7 @@ public class MetalIconFactory implements Serializable
*/
public HorizontalSliderThumbIcon()
{
+ // Nothing to do here.
}
/**
@@ -505,13 +983,19 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ boolean enabled = false;
boolean focus = false;
- if (c != null)
- focus = c.hasFocus();
- // TODO: pick up the colors from the look and feel
+ if (c != null)
+ {
+ enabled = c.isEnabled();
+ focus = c.hasFocus();
+ }
// draw the outline
- g.setColor(Color.black);
+ if (enabled)
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.drawLine(x + 1, y, x + 13, y);
g.drawLine(x + 14, y + 1, x + 14, y + 7);
g.drawLine(x + 14, y + 8, x + 7, y + 15);
@@ -519,8 +1003,11 @@ public class MetalIconFactory implements Serializable
g.drawLine(x, y + 7, x, y + 1);
// fill the icon
- g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium
- g.fillRect(x + 2, y + 2, 12, 7);
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x + 1, y + 2, 13, 7);
g.drawLine(x + 2, y + 9, x + 12, y + 9);
g.drawLine(x + 3, y + 10, x + 11, y + 10);
g.drawLine(x + 4, y + 11, x + 10, y + 11);
@@ -528,33 +1015,42 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 6, y + 13, x + 8, y + 13);
g.drawLine(x + 7, y + 14, x + 7, y + 14);
- // draw highlights
- g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light
- g.drawLine(x + 1, y + 1, x + 13, y + 1);
- g.drawLine(x + 1, y + 2, x + 1, y + 8);
- g.drawLine(x + 2, y + 2, x + 2, y + 2);
- g.drawLine(x + 6, y + 2, x + 6, y + 2);
- g.drawLine(x + 10, y + 2, x + 10, y + 2);
-
- g.drawLine(x + 4, y + 4, x + 4, y + 4);
- g.drawLine(x + 8, y + 4, x + 8, y + 4);
+ // if the slider is enabled, draw dots and highlights
+ if (c.isEnabled())
+ {
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 3, y + 3, x + 3, y + 3);
+ g.drawLine(x + 7, y + 3, x + 7, y + 3);
+ g.drawLine(x + 11, y + 3, x + 11, y + 3);
- g.drawLine(x + 2, y + 6, x + 2, y + 6);
- g.drawLine(x + 6, y + 6, x + 6, y + 6);
- g.drawLine(x + 10, y + 6, x + 10, y + 6);
+ g.drawLine(x + 5, y + 5, x + 5, y + 5);
+ g.drawLine(x + 9, y + 5, x + 9, y + 5);
- // draw dots
- g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark
- g.drawLine(x + 3, y + 3, x + 3, y + 3);
- g.drawLine(x + 7, y + 3, x + 7, y + 3);
- g.drawLine(x + 11, y + 3, x + 11, y + 3);
+ g.drawLine(x + 3, y + 7, x + 3, y + 7);
+ g.drawLine(x + 7, y + 7, x + 7, y + 7);
+ g.drawLine(x + 11, y + 7, x + 11, y + 7);
- g.drawLine(x + 5, y + 5, x + 5, y + 5);
- g.drawLine(x + 9, y + 5, x + 9, y + 5);
+ // draw highlights
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ else
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x + 1, y + 1, x + 13, y + 1);
+ g.drawLine(x + 1, y + 2, x + 1, y + 8);
+ g.drawLine(x + 2, y + 2, x + 2, y + 2);
+ g.drawLine(x + 6, y + 2, x + 6, y + 2);
+ g.drawLine(x + 10, y + 2, x + 10, y + 2);
+
+ g.drawLine(x + 4, y + 4, x + 4, y + 4);
+ g.drawLine(x + 8, y + 4, x + 8, y + 4);
- g.drawLine(x + 3, y + 7, x + 3, y + 7);
- g.drawLine(x + 7, y + 7, x + 7, y + 7);
- g.drawLine(x + 11, y + 7, x + 11, y + 7);
+ g.drawLine(x + 2, y + 6, x + 2, y + 6);
+ g.drawLine(x + 6, y + 6, x + 6, y + 6);
+ g.drawLine(x + 10, y + 6, x + 10, y + 6);
+ }
}
}
@@ -563,7 +1059,7 @@ public class MetalIconFactory implements Serializable
* An icon used for the 'close' button in the title frame of a
* {@link JInternalFrame}.
*/
- private static class InternalFrameCloseIcon implements Icon, Serializable
+ private static class InternalFrameCloseIcon implements Icon, Serializable
{
/** The icon size in pixels. */
private int size;
@@ -601,25 +1097,53 @@ public class MetalIconFactory implements Serializable
/**
* Paints the icon.
*
- * @param c the component.
+ * @param c the component (an {@link JInternalFrame} is expected).
* @param g the graphics device.
* @param x the x-coordinate.
* @param y the y-coordinate.
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- // draw the gray areas first
- g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ Color savedColor = g.getColor();
+ AbstractButton b = (AbstractButton) c;
+
+ // fill the interior
+ if (b.getModel().isPressed())
+ // FIXME: also need to take into account whether the internal frame is
+ // selected
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 2, y + 2, 10, 10);
+
+ // draw the outline box and the cross
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ {
+ // FIXME: also need to take into account whether the internal frame is
+ // selected
+ boolean selected = true;
+ if (selected)
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ }
g.drawLine(x + 1, y + 1, x + 13, y + 1);
g.drawLine(x + 1, y + 2, x + 1, y + 12);
g.drawLine(x + 1, y + 13, x + 13, y + 13);
g.drawLine(x + 13, y + 2, x + 13, y + 12);
+ g.drawLine(x + 2, y + 12, x + 2, y + 12);
+ g.drawLine(x + 12, y + 2, x + 12, y + 2);
g.fillRect(x + 4, y + 4, 2, 2);
- g.fillRect(x + 4, y + 9, 2, 2);
- g.fillRect(x + 9, y + 4, 2, 2);
- g.fillRect(x + 9, y + 9, 2, 2);
- g.fillRect(x + 5, y + 5, 5, 5);
+ g.fillRect(x + 5, y + 5, 4, 4);
+ g.drawLine(x + 9, y + 4, x + 10, y + 4);
+ g.drawLine(x + 9, y + 4, x + 9, y + 5);
+ g.drawLine(x + 4, y + 9, x + 4, y + 10);
+ g.drawLine(x + 4, y + 9, x + 5, y + 9);
+ g.drawLine(x + 9, y + 8, x + 9, y + 10);
+ g.drawLine(x + 8, y + 9, x + 10, y + 9);
g.setColor(MetalLookAndFeel.getBlack());
g.drawLine(x, y, x + 13, y);
@@ -635,20 +1159,24 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 1, y + 14, x + 14, y + 14);
g.drawLine(x + 14, y + 1, x + 14, y + 14);
- g.drawLine(x + 5, y + 10, x + 5, y + 10);
- g.drawLine(x + 6, y + 9, x + 7, y + 9);
- g.drawLine(x + 10, y + 5, x + 10, y + 5);
- g.drawLine(x + 9, y + 6, x + 9, y + 7);
- g.drawLine(x + 10, y + 10, x + 11, y + 10);
- g.drawLine(x + 10, y + 11, x + 10, y + 11);
+ if (!b.getModel().isPressed())
+ {
+ g.drawLine(x + 5, y + 10, x + 5, y + 10);
+ g.drawLine(x + 6, y + 9, x + 7, y + 9);
+ g.drawLine(x + 10, y + 5, x + 10, y + 5);
+ g.drawLine(x + 9, y + 6, x + 9, y + 7);
+ g.drawLine(x + 10, y + 10, x + 11, y + 10);
+ g.drawLine(x + 10, y + 11, x + 10, y + 11);
+ }
+ g.setColor(savedColor);
}
}
/**
* The icon displayed at the top-left corner of a {@link JInternalFrame}.
*/
- private static class InternalFrameDefaultMenuIcon
- implements Icon, Serializable
+ private static class InternalFrameDefaultMenuIcon
+ implements Icon, Serializable
{
/**
@@ -656,6 +1184,7 @@ public class MetalIconFactory implements Serializable
*/
public InternalFrameDefaultMenuIcon()
{
+ // Nothing to do here.
}
/**
@@ -718,8 +1247,8 @@ public class MetalIconFactory implements Serializable
* maximise an internal frame, this icon will replace the 'maximise' icon to
* provide a 'restore' option.
*/
- private static class InternalFrameAltMaximizeIcon
- implements Icon, Serializable
+ private static class InternalFrameAltMaximizeIcon
+ implements Icon, Serializable
{
/** The icon size in pixels. */
private int size;
@@ -764,14 +1293,23 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- Color color = MetalLookAndFeel.getControlDarkShadow();
- if (c instanceof JInternalFrame)
- {
- JInternalFrame f = (JInternalFrame) c;
- if (f.isSelected())
- color = MetalLookAndFeel.getPrimaryControlShadow();
- }
- g.setColor(color);
+ Color savedColor = g.getColor();
+
+ AbstractButton b = (AbstractButton) c;
+
+ // fill the small box interior
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 2, y + 6, 7, 7);
+
+
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+
g.drawLine(x + 12, y + 1, x + 13, y + 1);
g.drawLine(x + 11, y + 2, x + 12, y + 2);
g.drawLine(x + 10, y + 3, x + 11, y + 3);
@@ -803,10 +1341,16 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 13, y + 6, x + 13, y + 6);
g.drawLine(x + 8, y + 7, x + 13, y + 7);
g.drawLine(x + 6, y + 5, x + 6, y + 5);
- g.drawLine(x + 2, y + 6, x + 6, y + 6);
- g.drawLine(x + 2, y + 6, x + 2, y + 11);
g.drawLine(x + 10, y + 8, x + 10, y + 13);
g.drawLine(x + 1, y + 14, x + 10, y + 14);
+
+ if (!b.getModel().isPressed())
+ {
+ g.drawLine(x + 2, y + 6, x + 6, y + 6);
+ g.drawLine(x + 2, y + 6, x + 2, y + 11);
+ }
+
+ g.setColor(savedColor);
}
}
@@ -814,8 +1358,7 @@ public class MetalIconFactory implements Serializable
* An icon used for the 'maximize' button in the title frame of a
* {@link JInternalFrame}.
*/
- private static class InternalFrameMaximizeIcon
- implements Icon, Serializable
+ private static class InternalFrameMaximizeIcon implements Icon, Serializable
{
/**
@@ -823,6 +1366,7 @@ public class MetalIconFactory implements Serializable
*/
public InternalFrameMaximizeIcon()
{
+ // Nothing to do here.
}
/**
@@ -855,14 +1399,22 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- Color color = MetalLookAndFeel.getControlDarkShadow();
- if (c instanceof JInternalFrame)
- {
- JInternalFrame f = (JInternalFrame) c;
- if (f.isSelected())
- color = MetalLookAndFeel.getPrimaryControlShadow();
- }
- g.setColor(color);
+ Color savedColor = g.getColor();
+
+ AbstractButton b = (AbstractButton) c;
+
+ // fill the interior
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 2, y + 6, 7, 7);
+
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+
g.drawLine(x + 9, y + 1, x + 10, y + 1);
g.fillRect(x + 11, y + 1, 3, 3);
g.fillRect(x + 12, y + 4, 2, 2);
@@ -897,9 +1449,12 @@ public class MetalIconFactory implements Serializable
// draw white
g.setColor(MetalLookAndFeel.getWhite());
- g.drawLine(x + 2, y + 6, x + 5, y + 6);
- g.drawLine(x + 2, y + 7, x + 2, y + 9);
- g.drawLine(x + 4, y + 11, x + 7, y + 8);
+ if (!b.getModel().isPressed())
+ {
+ g.drawLine(x + 2, y + 6, x + 5, y + 6);
+ g.drawLine(x + 2, y + 7, x + 2, y + 9);
+ g.drawLine(x + 4, y + 11, x + 7, y + 8);
+ }
g.drawLine(x + 1, y + 14, x + 10, y + 14);
g.drawLine(x + 10, y + 5, x + 10, y + 13);
@@ -908,14 +1463,14 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 11, y + 4, x + 11, y + 5);
g.drawLine(x + 13, y + 6, x + 14, y + 6);
g.drawLine(x + 14, y + 1, x + 14, y + 5);
+ g.setColor(savedColor);
}
}
/**
* An icon used in the title frame of a {@link JInternalFrame}.
*/
- private static class InternalFrameMinimizeIcon
- implements Icon, Serializable
+ private static class InternalFrameMinimizeIcon implements Icon, Serializable
{
/**
@@ -923,6 +1478,7 @@ public class MetalIconFactory implements Serializable
*/
public InternalFrameMinimizeIcon()
{
+ // Nothing to do here.
}
/**
@@ -955,14 +1511,17 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
- Color color = MetalLookAndFeel.getControlDarkShadow();
- if (c instanceof JInternalFrame)
- {
- JInternalFrame f = (JInternalFrame) c;
- if (f.isSelected())
- color = MetalLookAndFeel.getPrimaryControlShadow();
- }
- g.setColor(color);
+ Color savedColor = g.getColor();
+
+ AbstractButton b = (AbstractButton) c;
+
+ if (b.getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ // FIXME: here the color depends on whether or not the internal frame
+ // is selected
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+
g.drawLine(x + 12, y + 1, x + 13, y + 1);
g.drawLine(x + 11, y + 2, x + 12, y + 2);
g.drawLine(x + 10, y + 3, x + 11, y + 3);
@@ -993,10 +1552,21 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 11, y + 4, x + 13, y + 2);
g.drawLine(x + 13, y + 6, x + 13, y + 6);
g.drawLine(x + 8, y + 7, x + 13, y + 7);
- g.drawLine(x + 2, y + 9, x + 4, y + 9);
- g.drawLine(x + 2, y + 10, x + 2, y + 11);
g.drawLine(x + 7, y + 9, x + 7, y + 13);
g.drawLine(x + 1, y + 14, x + 7, y + 14);
+
+ if (b.getModel().isPressed())
+ {
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ g.fillRect(x + 2, y + 9, 3, 3);
+ }
+ else
+ {
+ g.drawLine(x + 2, y + 9, x + 4, y + 9);
+ g.drawLine(x + 2, y + 10, x + 2, y + 11);
+ }
+
+ g.setColor(savedColor);
}
}
@@ -1004,13 +1574,14 @@ public class MetalIconFactory implements Serializable
* The icon used to display the thumb control on a horizontally oriented
* {@link JSlider} component.
*/
- private static class VerticalSliderThumbIcon implements Icon, Serializable
+ private static class VerticalSliderThumbIcon implements Icon, Serializable
{
/**
* Creates a new instance.
*/
public VerticalSliderThumbIcon()
{
+ // Nothing to do here.
}
/**
@@ -1045,13 +1616,19 @@ public class MetalIconFactory implements Serializable
*/
public void paintIcon(Component c, Graphics g, int x, int y)
{
+ boolean enabled = false;
boolean focus = false;
- if (c != null)
- focus = c.hasFocus();
- // TODO: pick up the colors from the look and feel
+ if (c != null)
+ {
+ enabled = c.isEnabled();
+ focus = c.hasFocus();
+ }
// draw the outline
- g.setColor(Color.black);
+ if (enabled)
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.drawLine(x + 1, y, x + 7, y);
g.drawLine(x + 8, y, x + 15, y + 7);
g.drawLine(x + 14, y + 8, x + 8, y + 14);
@@ -1059,8 +1636,11 @@ public class MetalIconFactory implements Serializable
g.drawLine(x, y + 13, x, y + 1);
// fill the icon
- g.setColor(focus ? new Color(153, 153, 204) : new Color(204, 204, 204)); // medium
- g.fillRect(x + 2, y + 2, 7, 12);
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(x + 2, y + 1, 7, 13);
g.drawLine(x + 9, y + 2, x + 9, y + 12);
g.drawLine(x + 10, y + 3, x + 10, y + 11);
g.drawLine(x + 11, y + 4, x + 11, y + 10);
@@ -1068,41 +1648,51 @@ public class MetalIconFactory implements Serializable
g.drawLine(x + 13, y + 6, x + 13, y + 8);
g.drawLine(x + 14, y + 7, x + 14, y + 7);
- // draw highlights
- g.setColor(focus ? new Color(204, 204, 255) : new Color(255, 255, 255)); // light
- g.drawLine(x + 1, y + 1, x + 8, y + 1);
- g.drawLine(x + 1, y + 2, x + 1, y + 13);
- g.drawLine(x + 2, y + 2, x + 2, y + 2);
- g.drawLine(x + 2, y + 6, x + 2, y + 6);
- g.drawLine(x + 2, y + 10, x + 2, y + 10);
+ // if the slider is enabled, draw dots and highlights
+ if (enabled)
+ {
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 3, y + 3, x + 3, y + 3);
+ g.drawLine(x + 3, y + 7, x + 3, y + 7);
+ g.drawLine(x + 3, y + 11, x + 3, y + 11);
- g.drawLine(x + 4, y + 4, x + 4, y + 4);
- g.drawLine(x + 4, y + 8, x + 4, y + 8);
+ g.drawLine(x + 5, y + 5, x + 5, y + 5);
+ g.drawLine(x + 5, y + 9, x + 5, y + 9);
- g.drawLine(x + 6, y + 2, x + 6, y + 2);
- g.drawLine(x + 6, y + 6, x + 6, y + 6);
- g.drawLine(x + 6, y + 10, x + 6, y + 10);
+ g.drawLine(x + 7, y + 3, x + 7, y + 3);
+ g.drawLine(x + 7, y + 7, x + 7, y + 7);
+ g.drawLine(x + 7, y + 11, x + 7, y + 11);
- // draw dots
- g.setColor(focus ? new Color(102, 102, 153) : Color.black); // dark
- g.drawLine(x + 3, y + 3, x + 3, y + 3);
- g.drawLine(x + 3, y + 7, x + 3, y + 7);
- g.drawLine(x + 3, y + 11, x + 3, y + 11);
+ // draw highlights
+ if (focus)
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ else
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.drawLine(x + 1, y + 1, x + 8, y + 1);
+ g.drawLine(x + 1, y + 2, x + 1, y + 13);
+ g.drawLine(x + 2, y + 2, x + 2, y + 2);
+ g.drawLine(x + 2, y + 6, x + 2, y + 6);
+ g.drawLine(x + 2, y + 10, x + 2, y + 10);
- g.drawLine(x + 5, y + 5, x + 5, y + 5);
- g.drawLine(x + 5, y + 9, x + 5, y + 9);
+ g.drawLine(x + 4, y + 4, x + 4, y + 4);
+ g.drawLine(x + 4, y + 8, x + 4, y + 8);
- g.drawLine(x + 7, y + 3, x + 7, y + 3);
- g.drawLine(x + 7, y + 7, x + 7, y + 7);
- g.drawLine(x + 7, y + 11, x + 7, y + 11);
+ g.drawLine(x + 6, y + 2, x + 6, y + 2);
+ g.drawLine(x + 6, y + 6, x + 6, y + 6);
+ g.drawLine(x + 6, y + 10, x + 6, y + 10);
+
+ }
}
}
-
+
/**
* A tree control icon. This icon can be in one of two states: expanded and
* collapsed.
*/
- public static class TreeControlIcon implements Icon, Serializable
+ public static class TreeControlIcon implements Icon, Serializable
{
/** ???. */
@@ -1235,19 +1825,21 @@ public class MetalIconFactory implements Serializable
/**
* A tree folder icon.
*/
- public static class TreeFolderIcon extends FolderIcon16
+ public static class TreeFolderIcon extends FolderIcon16
{
/**
* Creates a new instance.
*/
public TreeFolderIcon()
- {
+ {
+ // Nothing to do here.
}
/**
- * Returns the additional height (???).
+ * Returns the additional height for this icon, in this case <code>2</code>
+ * pixels.
*
- * @return The additional height.
+ * @return <code>2</code>.
*/
public int getAdditionalHeight()
{
@@ -1268,19 +1860,21 @@ public class MetalIconFactory implements Serializable
/**
* A tree leaf icon.
*/
- public static class TreeLeafIcon extends FileIcon16
+ public static class TreeLeafIcon extends FileIcon16
{
/**
* Creates a new instance.
*/
public TreeLeafIcon()
{
+ // Nothing to do here.
}
/**
- * Returns the additional height (???).
+ * Returns the additional height for this icon, in this case <code>4</code>
+ * pixels.
*
- * @return The additional height.
+ * @return <code>4</code>.
*/
public int getAdditionalHeight()
{
@@ -1297,16 +1891,310 @@ public class MetalIconFactory implements Serializable
return 2;
}
}
+
+ /**
+ * An icon representing a hard disk.
+ *
+ * @see MetalIconFactory#getTreeHardDriveIcon()
+ */
+ private static class TreeHardDriveIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon instance.
+ */
+ public TreeHardDriveIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconWidth()
+ {
+ return 16;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconHeight()
+ {
+ return 16;
+ }
+
+ /**
+ * Paints the icon at the specified location, using colors from the
+ * current theme.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color saved = g.getColor();
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 1, y + 4, x + 1, y + 5);
+ g.drawLine(x + 14, y + 4, x + 14, y + 5);
+ g.drawLine(x + 1, y + 7, x + 1, y + 8);
+ g.drawLine(x + 14, y + 7, x + 14, y + 8);
+ g.drawLine(x + 1, y + 10, x + 1, y + 11);
+ g.drawLine(x + 14, y + 10, x + 14, y + 11);
+
+ g.drawLine(x + 2, y + 3, x + 3, y + 3);
+ g.drawLine(x + 12, y + 3, x + 13, y + 3);
+ g.drawLine(x + 2, y + 6, x + 3, y + 6);
+ g.drawLine(x + 12, y + 6, x + 13, y + 6);
+ g.drawLine(x + 2, y + 9, x + 3, y + 9);
+ g.drawLine(x + 12, y + 9, x + 13, y + 9);
+ g.drawLine(x + 2, y + 12, x + 3, y + 12);
+ g.drawLine(x + 12, y + 12, x + 13, y + 12);
+
+ g.drawLine(x + 4, y + 2, x + 11, y + 2);
+ g.drawLine(x + 4, y + 7, x + 11, y + 7);
+ g.drawLine(x + 4, y + 10, x + 11, y + 10);
+ g.drawLine(x + 4, y + 13, x + 11, y + 13);
+
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.fillRect(x + 4, y + 3, 2, 2);
+ g.drawLine(x + 6, y + 4, x + 6, y + 4);
+ g.drawLine(x + 7, y + 3, x + 9, y + 3);
+ g.drawLine(x + 8, y + 4, x + 8, y + 4);
+ g.drawLine(x + 11, y + 3, x + 11, y + 3);
+ g.fillRect(x + 2, y + 4, 2, 2);
+ g.fillRect(x + 2, y + 7, 2, 2);
+ g.fillRect(x + 2, y + 10, 2, 2);
+ g.drawLine(x + 4, y + 6, x + 4, y + 6);
+ g.drawLine(x + 4, y + 9, x + 4, y + 9);
+ g.drawLine(x + 4, y + 12, x + 4, y + 12);
+
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawLine(x + 13, y + 4, x + 13, y + 4);
+ g.drawLine(x + 12, y + 5, x + 13, y + 5);
+ g.drawLine(x + 13, y + 7, x + 13, y + 7);
+ g.drawLine(x + 12, y + 8, x + 13, y + 8);
+ g.drawLine(x + 13, y + 10, x + 13, y + 10);
+ g.drawLine(x + 12, y + 11, x + 13, y + 11);
+
+ g.drawLine(x + 10, y + 5, x + 10, y + 5);
+ g.drawLine(x + 7, y + 6, x + 7, y + 6);
+ g.drawLine(x + 9, y + 6, x + 9, y + 6);
+ g.drawLine(x + 11, y + 6, x + 11, y + 6);
+
+ g.drawLine(x + 10, y + 8, x + 10, y + 8);
+ g.drawLine(x + 7, y + 9, x + 7, y + 9);
+ g.drawLine(x + 9, y + 9, x + 9, y + 9);
+ g.drawLine(x + 11, y + 9, x + 11, y + 9);
+
+ g.drawLine(x + 10, y + 11, x + 10, y + 11);
+ g.drawLine(x + 7, y + 12, x + 7, y + 12);
+ g.drawLine(x + 9, y + 12, x + 9, y + 12);
+ g.drawLine(x + 11, y + 12, x + 11, y + 12);
+
+ g.setColor(saved);
+ }
+ }
+
+ /**
+ * An icon representing a floppy disk.
+ *
+ * @see MetalIconFactory#getTreeFloppyDriveIcon()
+ */
+ private static class TreeFloppyDriveIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon instance.
+ */
+ public TreeFloppyDriveIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconWidth()
+ {
+ return 16;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconHeight()
+ {
+ return 16;
+ }
+
+ /**
+ * Paints the icon at the specified location, using colors from the
+ * current theme.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color saved = g.getColor();
+
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 1, y + 1, x + 13, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + 14);
+ g.drawLine(x + 1, y + 14, x + 14, y + 14);
+ g.drawLine(x + 14, y + 2, x + 14, y + 14);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 2, y + 2, 12, 12);
+
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.fillRect(x + 5, y + 2, 6, 5);
+ g.drawLine(x + 4, y + 8, x + 11, y + 8);
+ g.drawLine(x + 3, y + 9, x + 3, y + 13);
+ g.drawLine(x + 12, y + 9, x + 12, y + 13);
+
+ g.setColor(MetalLookAndFeel.getWhite());
+ g.fillRect(x + 8, y + 3, 2, 3);
+ g.fillRect(x + 4, y + 9, 8, 5);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ g.drawLine(x + 5, y + 10, x + 9, y + 10);
+ g.drawLine(x + 5, y + 12, x + 8, y + 12);
+
+ g.setColor(saved);
+ }
+ }
+
+ /**
+ * An icon representing a computer.
+ *
+ * @see MetalIconFactory#getTreeComputerIcon()
+ */
+ private static class TreeComputerIcon implements Icon, Serializable
+ {
+
+ /**
+ * Creates a new icon instance.
+ */
+ public TreeComputerIcon()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the width of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconWidth()
+ {
+ return 16;
+ }
+
+ /**
+ * Returns the height of the icon, in pixels.
+ *
+ * @return <code>16</code>.
+ */
+ public int getIconHeight()
+ {
+ return 16;
+ }
+
+ /**
+ * Paints the icon at the specified location, using colors from the
+ * current theme.
+ *
+ * @param c the component (ignored).
+ * @param g the graphics device.
+ * @param x the x-coordinate for the top-left of the icon.
+ * @param y the y-coordinate for the top-left of the icon.
+ */
+ public void paintIcon(Component c, Graphics g, int x, int y)
+ {
+ Color saved = g.getColor();
+
+ g.setColor(MetalLookAndFeel.getBlack());
+ g.drawLine(x + 3, y + 1, x + 12, y + 1);
+ g.drawLine(x + 2, y + 2, x + 2, y + 8);
+ g.drawLine(x + 13, y + 2, x + 13, y + 8);
+ g.drawLine(x + 3, y + 9, x + 3, y + 9);
+ g.drawLine(x + 12, y + 9, x + 12, y + 9);
+ g.drawRect(x + 1, y + 10, 13, 4);
+ g.drawLine(x + 5, y + 3, x + 10, y + 3);
+ g.drawLine(x + 5, y + 8, x + 10, y + 8);
+ g.drawLine(x + 4, y + 4, x + 4, y + 7);
+ g.drawLine(x + 11, y + 4, x + 11, y + 7);
+
+ g.setColor(MetalLookAndFeel.getPrimaryControl());
+ g.fillRect(x + 5, y + 4, 6, 4);
+
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawLine(x + 6, y + 12, x + 8, y + 12);
+ g.drawLine(x + 10, y + 12, x + 12, y + 12);
+ g.setColor(saved);
+ }
+ }
+ /** The icon returned by {@link #getCheckBoxIcon()}. */
+ private static Icon checkBoxIcon;
+
+ /** The icon returned by {@link #getCheckBoxMenuItemIcon()}. */
+ private static Icon checkBoxMenuItemIcon;
+
+ /** The icon returned by {@link #getFileChooserDetailViewIcon()}. */
+ private static Icon fileChooserDetailViewIcon;
+
+ /** The icon returned by {@link #getFileChooserHomeFolderIcon()}. */
+ private static Icon fileChooserHomeFolderIcon;
+
+ /** The icon returned by {@link #getFileChooserListViewIcon()}. */
+ private static Icon fileChooserListViewIcon;
+
+ /** The icon returned by {@link #getFileChooserNewFolderIcon()}. */
+ private static Icon fileChooserNewFolderIcon;
+
+ /** The icon returned by {@link #getFileChooserUpFolderIcon()}. */
+ private static Icon fileChooserUpFolderIcon;
+
/** The cached RadioButtonIcon instance. */
private static RadioButtonIcon radioButtonIcon;
+ /** The icon returned by {@link #getRadioButtonMenuItemIcon()}. */
+ private static Icon radioButtonMenuItemIcon;
+
+ /** The icon returned by {@link #getInternalFrameDefaultMenuIcon()}. */
+ private static Icon internalFrameDefaultMenuIcon;
+
+ /** The icon returned by {@link #getTreeComputerIcon()}. */
+ private static Icon treeComputerIcon;
+
+ /** The icon instance returned by {@link #getTreeFloppyDriveIcon()}. */
+ private static Icon treeFloppyDriveIcon;
+
+ /** The icon instance returned by {@link #getTreeHardDriveIcon()}. */
+ private static Icon treeHardDriveIcon;
+
/**
* Creates a new instance. All the methods are static, so creating an
* instance isn't necessary.
*/
public MetalIconFactory()
- {
+ {
+ // Nothing to do here.
}
/**
@@ -1318,7 +2206,9 @@ public class MetalIconFactory implements Serializable
*/
public static Icon getCheckBoxIcon()
{
- return new MetalCheckBoxIcon();
+ if (checkBoxIcon == null)
+ checkBoxIcon = new MetalCheckBoxIcon();
+ return checkBoxIcon;
}
/**
@@ -1329,7 +2219,69 @@ public class MetalIconFactory implements Serializable
*/
public static Icon getCheckBoxMenuItemIcon()
{
- return new CheckBoxMenuItemIcon();
+ if (checkBoxMenuItemIcon == null)
+ checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
+ return checkBoxMenuItemIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserDetailViewIcon()
+ {
+ if (fileChooserDetailViewIcon == null)
+ fileChooserDetailViewIcon = new FileChooserDetailViewIcon();
+ return fileChooserDetailViewIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserHomeFolderIcon()
+ {
+ if (fileChooserHomeFolderIcon == null)
+ fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon();
+ return fileChooserHomeFolderIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserListViewIcon()
+ {
+ if (fileChooserListViewIcon == null)
+ fileChooserListViewIcon = new FileChooserListViewIcon();
+ return fileChooserListViewIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserNewFolderIcon()
+ {
+ if (fileChooserNewFolderIcon == null)
+ fileChooserNewFolderIcon = new FileChooserNewFolderIcon();
+ return fileChooserNewFolderIcon;
+ }
+
+ /**
+ * Returns an icon for use by the {@link JFileChooser} component.
+ *
+ * @return An icon.
+ */
+ public static Icon getFileChooserUpFolderIcon()
+ {
+ if (fileChooserUpFolderIcon == null)
+ fileChooserUpFolderIcon = new FileChooserUpFolderIcon();
+ return fileChooserUpFolderIcon;
}
/**
@@ -1351,7 +2303,9 @@ public class MetalIconFactory implements Serializable
*/
public static Icon getRadioButtonMenuItemIcon()
{
- return new RadioButtonMenuItemIcon();
+ if (radioButtonMenuItemIcon == null)
+ radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
+ return radioButtonMenuItemIcon;
}
/**
@@ -1386,7 +2340,9 @@ public class MetalIconFactory implements Serializable
*/
public static Icon getInternalFrameDefaultMenuIcon()
{
- return new InternalFrameDefaultMenuIcon();
+ if (internalFrameDefaultMenuIcon == null)
+ internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon();
+ return internalFrameDefaultMenuIcon;
}
/**
@@ -1475,4 +2431,40 @@ public class MetalIconFactory implements Serializable
return new TreeControlIcon(isCollapsed);
}
+ /**
+ * Returns a <code>16x16</code> icon representing a computer.
+ *
+ * @return The icon.
+ */
+ public static Icon getTreeComputerIcon()
+ {
+ if (treeComputerIcon == null)
+ treeComputerIcon = new TreeComputerIcon();
+ return treeComputerIcon;
+ }
+
+ /**
+ * Returns a <code>16x16</code> icon representing a floppy disk.
+ *
+ * @return The icon.
+ */
+ public static Icon getTreeFloppyDriveIcon()
+ {
+ if (treeFloppyDriveIcon == null)
+ treeFloppyDriveIcon = new TreeFloppyDriveIcon();
+ return treeFloppyDriveIcon;
+ }
+
+ /**
+ * Returns a <code>16x16</code> icon representing a hard disk.
+ *
+ * @return The icon.
+ */
+ public static Icon getTreeHardDriveIcon()
+ {
+ if (treeHardDriveIcon == null)
+ treeHardDriveIcon = new TreeHardDriveIcon();
+ return treeHardDriveIcon;
+ }
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
index 20526eba8cd..2cf5f67d55d 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java
@@ -38,30 +38,207 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.LayoutManager;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.swing.Icon;
import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
import javax.swing.JMenu;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
+
/**
- * The title pane for a {@link JInternalFrame}.
+ * The title pane for a {@link JInternalFrame} (see
+ * {@link MetalInternalFrameUI#createNorthPane(JInternalFrame)}). This can
+ * be displayed in two styles: one for regular internal frames, and the other
+ * for "palette" style internal frames.
*/
public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane
{
+ /**
+ * A property change handler that listens for changes to the
+ * <code>JInternalFrame.isPalette</code> property and updates the title
+ * pane as appropriate.
+ */
+ class MetalInternalFrameTitlePanePropertyChangeHandler
+ extends PropertyChangeHandler
+ {
+ /**
+ * Creates a new handler.
+ */
+ public MetalInternalFrameTitlePanePropertyChangeHandler()
+ {
+ super();
+ }
+
+ /**
+ * Handles <code>JInternalFrame.isPalette</code> property changes, with all
+ * other property changes being passed to the superclass.
+ *
+ * @param e the event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ String propName = e.getPropertyName();
+ if (propName.equals("JInternalFrame.isPalette"))
+ {
+ if (e.getNewValue().equals(Boolean.TRUE))
+ setPalette(true);
+ else
+ setPalette(false);
+ }
+ else
+ super.propertyChange(e);
+ }
+ }
+
+ /**
+ * A layout manager for the title pane.
+ *
+ * @see #createLayout()
+ */
+ private class MetalTitlePaneLayout implements LayoutManager
+ {
+ /**
+ * Creates a new <code>TitlePaneLayout</code> object.
+ */
+ public MetalTitlePaneLayout()
+ {
+ // Do nothing.
+ }
+
+ /**
+ * Adds a Component to the Container.
+ *
+ * @param name The name to reference the added Component by.
+ * @param c The Component to add.
+ */
+ public void addLayoutComponent(String name, Component c)
+ {
+ // Do nothing.
+ }
+
+ /**
+ * This method is called to lay out the children of the Title Pane.
+ *
+ * @param c The Container to lay out.
+ */
+ public void layoutContainer(Container c)
+ {
+
+ Dimension size = c.getSize();
+ Insets insets = c.getInsets();
+ int width = size.width - insets.left - insets.right;
+ int height = size.height - insets.top - insets.bottom;
+
+
+ int loc = width - insets.right - 1;
+ int top = insets.top + 2;
+ int buttonHeight = height - 4;
+ if (closeButton.isVisible())
+ {
+ int buttonWidth = closeIcon.getIconWidth();
+ loc -= buttonWidth + 2;
+ closeButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ loc -= 6;
+ }
+
+ if (maxButton.isVisible())
+ {
+ int buttonWidth = maxIcon.getIconWidth();
+ loc -= buttonWidth + 4;
+ maxButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ }
+
+ if (iconButton.isVisible())
+ {
+ int buttonWidth = minIcon.getIconWidth();
+ loc -= buttonWidth + 4;
+ iconButton.setBounds(loc, top, buttonWidth, buttonHeight);
+ loc -= 2;
+ }
+
+ Dimension titlePreferredSize = title.getPreferredSize();
+ title.setBounds(insets.left + 5, insets.top,
+ Math.min(titlePreferredSize.width, loc - insets.left - 10),
+ height);
+
+ }
+
+ /**
+ * This method returns the minimum size of the given Container given the
+ * children that it has.
+ *
+ * @param c The Container to get a minimum size for.
+ *
+ * @return The minimum size of the Container.
+ */
+ public Dimension minimumLayoutSize(Container c)
+ {
+ return preferredLayoutSize(c);
+ }
+
+ /**
+ * Returns the preferred size of the given Container taking
+ * into account the children that it has.
+ *
+ * @param c The Container to lay out.
+ *
+ * @return The preferred size of the Container.
+ */
+ public Dimension preferredLayoutSize(Container c)
+ {
+ if (isPalette)
+ return new Dimension(paletteTitleHeight, paletteTitleHeight);
+ else
+ return new Dimension(22, 22);
+ }
+
+ /**
+ * Removes a Component from the Container.
+ *
+ * @param c The Component to remove.
+ */
+ public void removeLayoutComponent(Component c)
+ {
+ // Nothing to do here.
+ }
+ }
+
+ /** A flag indicating whether the title pane uses the palette style. */
protected boolean isPalette;
- protected Icon paletteCloseIcon = MetalIconFactory.getInternalFrameCloseIcon(16);
+ /**
+ * The icon used for the close button - this is fetched from the look and
+ * feel defaults using the key <code>InternalFrame.paletteCloseIcon</code>.
+ */
+ protected Icon paletteCloseIcon;
+
+ /**
+ * The height of the title pane when <code>isPalette</code> is
+ * <code>true</code>. This value is fetched from the look and feel defaults
+ * using the key <code>InternalFrame.paletteTitleHeight</code>.
+ */
+ protected int paletteTitleHeight;
+
+ /** The label used to display the title for the internal frame. */
+ JLabel title;
- protected int paletteTitleHeight = 12;
-
/**
- * Creates a new title pane.
+ * Creates a new title pane for the specified frame.
*
* @param f the internal frame.
*/
@@ -81,6 +258,14 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane
selectedTitleColor = MetalLookAndFeel.getWindowTitleBackground();
notSelectedTextColor = MetalLookAndFeel.getInactiveControlTextColor();
notSelectedTitleColor = MetalLookAndFeel.getWindowTitleInactiveBackground();
+
+ paletteTitleHeight = UIManager.getInt("InternalFrame.paletteTitleHeight");
+ paletteCloseIcon = UIManager.getIcon("InternalFrame.paletteCloseIcon");
+ minIcon = MetalIconFactory.getInternalFrameAltMaximizeIcon(16);
+
+ title = new JLabel(frame.getTitle(),
+ MetalIconFactory.getInternalFrameDefaultMenuIcon(),
+ SwingConstants.LEFT);
}
/**
@@ -93,6 +278,9 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane
selectedTitleColor = null;
notSelectedTextColor = null;
notSelectedTitleColor = null;
+ paletteCloseIcon = null;
+ minIcon = null;
+ title = null;
}
/**
@@ -128,44 +316,137 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane
}
/**
- * Creates a layout manager for the components in the title pane.
+ * Adds the sub components of the title pane.
+ */
+ protected void addSubComponents()
+ {
+ // FIXME: this method is probably overridden to only add the required
+ // buttons
+ add(title);
+ add(closeButton);
+ add(iconButton);
+ add(maxButton);
+ }
+
+ /**
+ * Creates a new instance of {@link MetalTitlePaneLayout}.
*
- * @return A layout manager.
- */
+ * @return A new instance of {@link MetalTitlePaneLayout}.
+ */
protected LayoutManager createLayout()
{
- return new TitlePaneLayout()
- {
- public Dimension preferredLayoutSize(Container c)
- {
- return new Dimension(24, 24);
- }
- };
+ return new MetalTitlePaneLayout();
}
+ /**
+ * Draws the title pane in the palette style.
+ *
+ * @param g the graphics device.
+ *
+ * @see #paintComponent(Graphics)
+ */
public void paintPalette(Graphics g)
{
- // FIXME: needs implementing
- // most likely this is equivalent to paintComponent(g) when the isPalette
- // flag is true
+ Color savedColor = g.getColor();
+ Rectangle b = SwingUtilities.getLocalBounds(this);
+
+ if (UIManager.get("InternalFrame.activeTitleGradient") != null
+ && frame.isSelected())
+ {
+ MetalUtils.paintGradient(g, b.x, b.y, b.width, b.height,
+ SwingConstants.VERTICAL,
+ "InternalFrame.activeTitleGradient");
+ }
+ MetalUtils.fillMetalPattern(this, g, b.x + 4, b.y + 2, b.width
+ - paletteCloseIcon.getIconWidth() - 13, b.height - 5,
+ MetalLookAndFeel.getPrimaryControlHighlight(),
+ MetalLookAndFeel.getBlack());
+
+ // draw a line separating the title pane from the frame content
+ Dimension d = getSize();
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ g.drawLine(0, d.height - 1, d.width - 1, d.height - 1);
+
+ g.setColor(savedColor);
}
-
+
+ /**
+ * Paints a representation of the current state of the internal frame.
+ *
+ * @param g the graphics device.
+ */
public void paintComponent(Graphics g)
{
- // probably need to check the isPalette flag here, if true pass over to
- // paintPalette(Graphics)
- super.paintComponent(g);
- Dimension d = getSize();
- if (frame.isSelected())
- g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ Color savedColor = g.getColor();
+ if (isPalette)
+ paintPalette(g);
else
- g.setColor(MetalLookAndFeel.getControlDarkShadow());
- g.drawLine(0, d.height - 1, d.width - 1, d.height - 1);
+ {
+ paintTitleBackground(g);
+ paintChildren(g);
+ Dimension d = getSize();
+ if (frame.isSelected())
+ g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+
+ // put a dot in each of the top corners
+ g.drawLine(0, 0, 0, 0);
+ g.drawLine(d.width - 1, 0, d.width - 1, 0);
+
+ g.drawLine(0, d.height - 1, d.width - 1, d.height - 1);
+
+ // draw the metal pattern
+ if (UIManager.get("InternalFrame.activeTitleGradient") != null
+ && frame.isSelected())
+ {
+ MetalUtils.paintGradient(g, 0, 0, getWidth(), getHeight(),
+ SwingConstants.VERTICAL,
+ "InternalFrame.activeTitleGradient");
+ }
+
+ Rectangle b = title.getBounds();
+ int startX = b.x + b.width + 5;
+ int endX = startX;
+ if (iconButton.isVisible())
+ endX = Math.max(iconButton.getX(), endX);
+ else if (maxButton.isVisible())
+ endX = Math.max(maxButton.getX(), endX);
+ else if (closeButton.isVisible())
+ endX = Math.max(closeButton.getX(), endX);
+ endX -= 7;
+ if (endX > startX)
+ MetalUtils.fillMetalPattern(this, g, startX, 3, endX - startX, getHeight() - 6, Color.white, Color.gray);
+ }
+ g.setColor(savedColor);
}
+ /**
+ * Sets the flag that controls whether the title pane is drawn in the
+ * palette style or the regular style.
+ *
+ * @param b the new value of the flag.
+ */
public void setPalette(boolean b)
{
- isPalette = b;
+ isPalette = b;
+ title.setVisible(!isPalette);
+ iconButton.setVisible(!isPalette && frame.isIconifiable());
+ maxButton.setVisible(!isPalette && frame.isMaximizable());
+ if (isPalette)
+ closeButton.setIcon(paletteCloseIcon);
+ else
+ closeButton.setIcon(closeIcon);
+ }
+
+ /**
+ * Creates and returns a property change handler for the title pane.
+ *
+ * @return The property change handler.
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new MetalInternalFrameTitlePanePropertyChangeHandler();
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java
index 7c7cb92e549..6be573f4bac 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java
@@ -38,24 +38,31 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.util.HashMap;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
-import javax.swing.border.EmptyBorder;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicInternalFrameUI;
-
+/**
+ * A UI delegate for the {@link JInternalFrame} component.
+ */
public class MetalInternalFrameUI
extends BasicInternalFrameUI
{
-
- /** The instances of MetalInternalFrameUI*/
- private static HashMap instances;
+ /**
+ * The key (<code>JInternalFrame.isPalette</code>) for the client property
+ * that controls whether the internal frame is displayed using the palette
+ * style.
+ */
+ protected static String IS_PALETTE = "JInternalFrame.isPalette";
/**
- * Constructs a new instance of MetalInternalFrameUI.
+ * Constructs a new instance of <code>MetalInternalFrameUI</code>.
+ *
+ * @param frame the frame.
*/
public MetalInternalFrameUI(JInternalFrame frame)
{
@@ -63,37 +70,96 @@ public class MetalInternalFrameUI
}
/**
- * Returns an instance of MetalInternalFrameUI.
+ * Returns an instance of <code>MetalInternalFrameUI</code>.
*
- * @param component the component for which we return an UI instance
+ * @param component the internal frame.
*
- * @return an instance of MetalInternalFrameUI
+ * @return an instance of <code>MetalInternalFrameUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
-
- Object o = instances.get(component);
- MetalInternalFrameUI instance;
- if (o == null)
- {
- instance = new MetalInternalFrameUI((JInternalFrame) component);
- instances.put(component, instance);
- }
- else
- instance = (MetalInternalFrameUI) o;
-
- return instance;
+ return new MetalInternalFrameUI((JInternalFrame) component);
}
+ /**
+ * Sets the fields and properties for the component.
+ *
+ * @param c the component.
+ */
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+ JInternalFrame f = (JInternalFrame) c;
+ boolean isPalette = false;
+ Boolean p = (Boolean) f.getClientProperty(IS_PALETTE);
+ if (p != null)
+ isPalette = p.booleanValue();
+ setPalette(isPalette);
+ }
+
+ /**
+ * Creates and returns the component that will be used for the north pane
+ * of the {@link JInternalFrame}.
+ *
+ * @param w the internal frame.
+ *
+ * @return A new instance of {@link MetalInternalFrameTitlePane}.
+ */
protected JComponent createNorthPane(JInternalFrame w)
{
titlePane = new MetalInternalFrameTitlePane(w);
- titlePane.setBorder(new EmptyBorder(2, 2, 2, 2));
return titlePane;
}
-
+ /**
+ * Sets the state of the {@link JInternalFrame} to reflect whether or not
+ * it is using the palette style. When a frame is displayed as a palette,
+ * it uses a different border and the title pane is drawn differently.
+ *
+ * @param isPalette use the palette style?
+ */
+ public void setPalette(boolean isPalette)
+ {
+ MetalInternalFrameTitlePane title = (MetalInternalFrameTitlePane) northPane;
+ title.setPalette(isPalette);
+ if (isPalette)
+ frame.setBorder(new MetalBorders.PaletteBorder());
+ else
+ frame.setBorder(new MetalBorders.InternalFrameBorder());
+ }
+
+ /** A listener that is used to handle IS_PALETTE property changes. */
+ private PropertyChangeListener paletteListener;
+
+ /**
+ * Adds the required listeners.
+ */
+ protected void installListeners()
+ {
+ super.installListeners();
+ paletteListener = new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(IS_PALETTE))
+ {
+ if (Boolean.TRUE.equals(e.getNewValue()))
+ setPalette(true);
+ else
+ setPalette(false);
+ }
+ }
+ };
+ frame.addPropertyChangeListener(paletteListener);
+ }
+
+ /**
+ * Removes the listeners used.
+ */
+ protected void uninstallListeners()
+ {
+ super.uninstallListeners();
+ frame.removePropertyChangeListener(IS_PALETTE, paletteListener);
+ paletteListener = null;
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java
index fe8a9e4e4ea..12b858e0a93 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalLabelUI.java
@@ -43,24 +43,23 @@ import java.awt.Graphics;
import javax.swing.JComponent;
import javax.swing.JLabel;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicLabelUI;
/**
- * A UI delegate used for {@link JLabel}s in the {@link MetalLookAndFeel}.
+ * A UI delegate for the {@link JLabel} component.
*/
public class MetalLabelUI
extends BasicLabelUI
{
- /** The shared UI instance for JLabels. */
+ /** The shared instance of the UI delegate. */
protected static MetalLabelUI metalLabelUI;
/**
- * Constructs a new instance of MetalLabelUI.
+ * Constructs a new instance of <code>MetalLabelUI</code>.
*/
public MetalLabelUI()
{
@@ -68,11 +67,11 @@ public class MetalLabelUI
}
/**
- * Returns an instance of MetalLabelUI.
+ * Returns a shared instance of <code>MetalLabelUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalLabelUI
+ * @return A shared instance of <code>MetalLabelUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
@@ -83,22 +82,20 @@ public class MetalLabelUI
/**
* Draws the text for a disabled label, using the color defined in the
- * {@link UIDefaults} with the key <code>Label.disabledForeground</code>.
+ * {@link UIManager} defaults with the key
+ * <code>Label.disabledForeground</code>.
*
* @param l the label.
* @param g the graphics device.
* @param s the label text.
* @param textX the x-coordinate for the label.
* @param textY the y-coordinate for the label.
- *
- * @see UIManager#getLookAndFeelDefaults()
*/
protected void paintDisabledText(JLabel l, Graphics g, String s, int textX,
int textY)
{
Color savedColor = g.getColor();
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- g.setColor(defaults.getColor("Label.disabledForeground"));
+ g.setColor(UIManager.getColor("Label.disabledForeground"));
int mnemIndex = l.getDisplayedMnemonicIndex();
if (mnemIndex != -1)
BasicGraphicsUtils.drawStringUnderlineCharAt(g, s, mnemIndex, textX,
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java b/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java
index d9cf7c6220c..da019379bf5 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalLookAndFeel.java
@@ -42,11 +42,14 @@ import java.awt.Color;
import java.awt.Font;
import java.awt.Insets;
+import javax.swing.LookAndFeel;
import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.plaf.BorderUIResource;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.InsetsUIResource;
+import javax.swing.plaf.BorderUIResource.LineBorderUIResource;
import javax.swing.plaf.basic.BasicLookAndFeel;
@@ -69,7 +72,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel
*/
public MetalLookAndFeel()
{
- createDefaultTheme();
+ if (theme == null)
+ createDefaultTheme();
}
/**
@@ -601,12 +605,21 @@ public class MetalLookAndFeel extends BasicLookAndFeel
}
/**
- * Sets the current theme for the look and feel.
+ * Sets the current theme for the look and feel. Note that the theme must be
+ * set <em>before</em> the look and feel is installed. To change the theme
+ * for an already running application that is using the
+ * {@link MetalLookAndFeel}, first set the theme with this method, then
+ * create a new instance of {@link MetalLookAndFeel} and install it in the
+ * usual way (see {@link UIManager#setLookAndFeel(LookAndFeel)}).
*
- * @param theme the theme.
+ * @param theme the theme (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if <code>theme</code> is <code>null</code>.
*/
public static void setCurrentTheme(MetalTheme theme)
{
+ if (theme == null)
+ throw new NullPointerException("Null 'theme' not permitted.");
MetalLookAndFeel.theme = theme;
}
@@ -680,6 +693,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel
"DesktopIconUI", "javax.swing.plaf.metal.MetalDesktopIconUI",
"InternalFrameUI", "javax.swing.plaf.metal.MetalInternalFrameUI",
"LabelUI", "javax.swing.plaf.metal.MetalLabelUI",
+ "MenuBarUI", "javax.swing.plaf.metal.MetalMenuBarUI",
"PopupMenuSeparatorUI",
"javax.swing.plaf.metal.MetalPopupMenuSeparatorUI",
"ProgressBarUI", "javax.swing.plaf.metal.MetalProgressBarUI",
@@ -759,62 +773,206 @@ public class MetalLookAndFeel extends BasicLookAndFeel
{
super.initComponentDefaults(defaults);
Object[] myDefaults = new Object[] {
- "Button.background", new ColorUIResource(getControl()),
+ "Button.background", getControl(),
"Button.border", MetalBorders.getButtonBorder(),
- "Button.darkShadow", new ColorUIResource(getControlDarkShadow()),
- "Button.disabledText", new ColorUIResource(getControlDisabled()),
- "Button.focus", new ColorUIResource(getFocusColor()),
+ "Button.darkShadow", getControlDarkShadow(),
+ "Button.disabledText", getInactiveControlTextColor(),
+ "Button.focus", getFocusColor(),
"Button.font", getControlTextFont(),
- "Button.foreground", new ColorUIResource(getSystemTextColor()),
- "Button.highlight", new ColorUIResource(getControlHighlight()),
- "Button.light", new ColorUIResource(getControlHighlight()),
- "Button.margin", new Insets(2, 14, 2, 14),
- "Button.select", new ColorUIResource(getPrimaryControlShadow()),
- "Button.shadow", new ColorUIResource(getPrimaryControlShadow()),
- "CheckBox.background", new ColorUIResource(getControl()),
+ "Button.foreground", getControlTextColor(),
+ "Button.highlight", getControlHighlight(),
+ "Button.light", getControlHighlight(),
+ "Button.margin", new InsetsUIResource(2, 14, 2, 14),
+ "Button.select", getControlShadow(),
+ "Button.shadow", getControlShadow(),
+
+ "CheckBox.background", getControl(),
"CheckBox.border", MetalBorders.getButtonBorder(),
+ "CheckBox.disabledText", getInactiveControlTextColor(),
+ "CheckBox.focus", getFocusColor(),
+ "CheckBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "CheckBox.foreground", getControlTextColor(),
"CheckBox.icon",
new UIDefaults.ProxyLazyValue
("javax.swing.plaf.metal.MetalCheckBoxIcon"),
"CheckBox.checkIcon",
new UIDefaults.ProxyLazyValue
("javax.swing.plaf.metal.MetalCheckBoxIcon"),
- "CheckBoxMenuItem.background", new ColorUIResource(getControl()),
+ "Checkbox.select", getControlShadow(),
+
+ "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
+ "CheckBoxMenuItem.acceleratorForeground", getAcceleratorForeground(),
+ "CheckBoxMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
+ "CheckBoxMenuItem.background", getMenuBackground(),
+ "CheckBoxMenuItem.borderPainted", new Boolean(true),
+ "CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav",
"CheckBoxMenuItem.checkIcon", MetalIconFactory.getCheckBoxMenuItemIcon(),
- "ToolBar.background", new ColorUIResource(getControl()),
- "Panel.background", new ColorUIResource(getControl()),
- "Slider.background", new ColorUIResource(getControl()),
- "OptionPane.background", new ColorUIResource(getControl()),
- "ProgressBar.background", new ColorUIResource(getControl()),
- "ScrollPane.border", new MetalBorders.ScrollPaneBorder(),
- "TabbedPane.background", new ColorUIResource(getControl()),
+ "CheckBoxMenuItem.disabledForeground", getMenuDisabledForeground(),
+ "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "CheckBoxMenuItem.foreground", getMenuForeground(),
+ "CheckBoxMenuItem.selectionBackground", getMenuSelectedBackground(),
+ "CheckBoxMenuItem.selectionForeground", getMenuSelectedForeground(),
+
+ "ColorChooser.background", getControl(),
+ "ColorChooser.foreground", getControlTextColor(),
+ "ColorChooser.rgbBlueMnemonic", new Integer(0),
+ "ColorChooser.rgbGreenMnemonic", new Integer(0),
+ "ColorChooser.rgbRedMnemonic", new Integer(0),
+ "ColorChooser.swatchesDefaultRecentColor", getControl(),
+
+ "ComboBox.background", getControl(),
+ "ComboBox.buttonBackground", getControl(),
+ "ComboBox.buttonDarkShadow", getControlDarkShadow(),
+ "ComboBox.buttonHighlight", getControlHighlight(),
+ "ComboBox.buttonShadow", getControlShadow(),
+ "ComboBox.disabledBackground", getControl(),
+ "ComboBox.disabledForeground", getInactiveSystemTextColor(),
+ "ComboBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "ComboBox.foreground", getControlTextColor(),
+ "ComboBox.selectionBackground", getPrimaryControlShadow(),
+ "ComboBox.selectionForeground", getControlTextColor(),
+
+ "Desktop.background", getDesktopColor(),
+
+ "DesktopIcon.background", getControl(),
+ "DesktopIcon.foreground", getControlTextColor(),
+ "DesktopIcon.width", new Integer(160),
+ "DesktopIcon.border", MetalBorders.getDesktopIconBorder(),
+
+ "EditorPane.background", getWindowBackground(),
+ "EditorPane.caretForeground", getUserTextColor(),
+ "EditorPane.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "EditorPane.foreground", getUserTextColor(),
+ "EditorPane.inactiveForeground", getInactiveSystemTextColor(),
+ "EditorPane.selectionBackground", getTextHighlightColor(),
+ "EditorPane.selectionForeground", getHighlightedTextColor(),
+
+ "FormattedTextField.background", getWindowBackground(),
+ "FormattedTextField.border",
+ new BorderUIResource(MetalBorders.getTextFieldBorder()),
+ "FormattedTextField.caretForeground", getUserTextColor(),
+ "FormattedTextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "FormattedTextField.foreground", getUserTextColor(),
+ "FormattedTextField.inactiveBackground", getControl(),
+ "FormattedTextField.inactiveForeground", getInactiveSystemTextColor(),
+ "FormattedTextField.selectionBackground", getTextHighlightColor(),
+ "FormattedTextField.selectionForeground", getHighlightedTextColor(),
+
+ "FileView.computerIcon", MetalIconFactory.getTreeComputerIcon(),
+ "FileView.directoryIcon", MetalIconFactory.getTreeFolderIcon(),
+ "FileView.fileIcon", MetalIconFactory.getTreeLeafIcon(),
+ "FileView.floppyDriveIcon", MetalIconFactory.getTreeFloppyDriveIcon(),
+ "FileView.hardDriveIcon", MetalIconFactory.getTreeHardDriveIcon(),
+
+ "InternalFrame.activeTitleBackground", getWindowTitleBackground(),
+ "InternalFrame.activeTitleForeground", getWindowTitleForeground(),
"InternalFrame.border", new MetalBorders.InternalFrameBorder(),
+ "InternalFrame.borderColor", getControl(),
+ "InternalFrame.borderDarkShadow", getControlDarkShadow(),
+ "InternalFrame.borderHighlight", getControlHighlight(),
+ "InternalFrame.borderLight", getControlHighlight(),
+ "InternalFrame.borderShadow", getControlShadow(),
"InternalFrame.icon", MetalIconFactory.getInternalFrameDefaultMenuIcon(),
"InternalFrame.closeIcon",
MetalIconFactory.getInternalFrameCloseIcon(16),
+ "InternalFrame.inactiveTitleBackground", getWindowTitleInactiveBackground(),
+ "InternalFrame.inactiveTitleForeground", getWindowTitleInactiveForeground(),
"InternalFrame.maximizeIcon",
MetalIconFactory.getInternalFrameMaximizeIcon(16),
"InternalFrame.iconifyIcon",
MetalIconFactory.getInternalFrameMinimizeIcon(16),
- "Label.background", new ColorUIResource(getControl()),
+ "InternalFrame.paletteBorder", new MetalBorders.PaletteBorder(),
+ "InternalFrame.paletteCloseIcon", new MetalIconFactory.PaletteCloseIcon(),
+ "InternalFrame.paletteTitleHeight", new Integer(11),
+
+ "Label.background", getControl(),
+ "Label.disabledForeground", getInactiveSystemTextColor(),
+ "Label.disabledShadow", getControlShadow(),
"Label.font", getControlTextFont(),
- "Label.disabledForeground", new ColorUIResource(getInactiveControlTextColor()),
- "Label.foreground", new ColorUIResource(getControlTextColor()),
- "Menu.background", new ColorUIResource(getControl()),
+ "Label.foreground", getSystemTextColor(),
+
+ "List.font", getControlTextFont(),
+ "List.background", getWindowBackground(),
+ "List.foreground", getUserTextColor(),
+ "List.selectionBackground", getTextHighlightColor(),
+ "List.selectionForeground", getHighlightedTextColor(),
+ "List.focusCellHighlightBorder",
+ new LineBorderUIResource(MetalLookAndFeel.getFocusColor()),
+
+ "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
+ "Menu.acceleratorForeground", getAcceleratorForeground(),
+ "Menu.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
+ "Menu.background", getMenuBackground(),
"Menu.border", new MetalBorders.MenuItemBorder(),
"Menu.borderPainted", Boolean.TRUE,
+ "Menu.disabledForeground", getMenuDisabledForeground(),
"Menu.font", getControlTextFont(),
+ "Menu.foreground", getMenuForeground(),
"Menu.selectionBackground", getMenuSelectedBackground(),
"Menu.selectionForeground", getMenuSelectedForeground(),
- "MenuBar.background", new ColorUIResource(getControl()),
+
+ "MenuBar.background", getMenuBackground(),
"MenuBar.border", new MetalBorders.MenuBarBorder(),
"MenuBar.font", getControlTextFont(),
- "MenuItem.background", new ColorUIResource(getControl()),
+ "MenuBar.foreground", getMenuForeground(),
+ "MenuBar.highlight", getControlHighlight(),
+ "MenuBar.shadow", getControlShadow(),
+
+ "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
+ "MenuItem.acceleratorForeground", getAcceleratorForeground(),
+ "MenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
+ "MenuItem.background", getMenuBackground(),
"MenuItem.border", new MetalBorders.MenuItemBorder(),
+ "MenuItem.disabledForeground", getMenuDisabledForeground(),
"MenuItem.font", getControlTextFont(),
+ "MenuItem.foreground", getMenuForeground(),
"MenuItem.selectionBackground", getMenuSelectedBackground(),
"MenuItem.selectionForeground", getMenuSelectedForeground(),
- "Panel.background", new ColorUIResource(getControl()),
+
+ "OptionPane.background", getControl(),
+ "OptionPane.errorDialog.border.background", new ColorUIResource(153, 51, 51),
+ "OptionPane.errorDialog.titlePane.background", new ColorUIResource(255, 153, 153),
+ "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(51, 0, 0),
+ "OptionPane.errorDialog.titlePane.shadow", new ColorUIResource(204, 102, 102),
+ "OptionPane.foreground", getControlTextColor(),
+ "OptionPane.messageForeground", getControlTextColor(),
+ "OptionPane.questionDialog.border.background", new ColorUIResource(51, 102, 51),
+ "OptionPane.questionDialog.titlePane.background", new ColorUIResource(153, 204, 153),
+ "OptionPane.questionDialog.titlePane.foreground", new ColorUIResource(0, 51, 0),
+ "OptionPane.questionDialog.titlePane.shadow", new ColorUIResource(102, 153, 102),
+ "OptionPane.warningDialog.border.background", new ColorUIResource(153, 102, 51),
+ "OptionPane.warningDialog.titlePane.background", new ColorUIResource(255, 204, 153),
+ "OptionPane.warningDialog.titlePane.foreground", new ColorUIResource(102, 51, 0),
+ "OptionPane.warningDialog.titlePane.shadow", new ColorUIResource(204, 153, 102),
+
+ "Panel.background", getControl(),
+ "Panel.foreground", getUserTextColor(),
+
+ "PasswordField.background", getWindowBackground(),
+ "PasswordField.border",
+ new BorderUIResource(MetalBorders.getTextFieldBorder()),
+ "PasswordField.caretForeground", getUserTextColor(),
+ "PasswordField.foreground", getUserTextColor(),
+ "PasswordField.inactiveBackground", getControl(),
+ "PasswordField.inactiveForeground", getInactiveSystemTextColor(),
+ "PasswordField.selectionBackground", getTextHighlightColor(),
+ "PasswordField.selectionForeground", getHighlightedTextColor(),
+
+ "PopupMenu.background", getMenuBackground(),
+ "PopupMenu.border", new MetalBorders.PopupMenuBorder(),
+ "PopupMenu.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "PopupMenu.foreground", getMenuForeground(),
+
+ "ProgressBar.background", getControl(),
+ "ProgressBar.border", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
+ "ProgressBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "ProgressBar.foreground", getPrimaryControlShadow(),
+ "ProgressBar.selectionBackground", getPrimaryControlDarkShadow(),
+ "ProgressBar.selectionForeground", getControl(),
+
+ "RadioButton.background", getControl(),
+ "RadioButton.darkShadow", getControlDarkShadow(),
+ "RadioButton.disabledText", getInactiveControlTextColor(),
"RadioButton.icon",
new UIDefaults.LazyValue()
{
@@ -823,80 +981,199 @@ public class MetalLookAndFeel extends BasicLookAndFeel
return MetalIconFactory.getRadioButtonIcon();
}
},
-
+ "RadioButton.focus", MetalLookAndFeel.getFocusColor(),
+ "RadioButton.font", MetalLookAndFeel.getControlTextFont(),
+ "RadioButton.foreground", getControlTextColor(),
+ "RadioButton.highlight", getControlHighlight(),
+ "RadioButton.light", getControlHighlight(),
+ "RadioButton.select", getControlShadow(),
+ "RadioButton.shadow", getControlShadow(),
+
+ "RadioButtonMenuItem.acceleratorFont", new Font("Dialog", Font.PLAIN, 10),
+ "RadioButtonMenuItem.acceleratorForeground", getAcceleratorForeground(),
+ "RadioButtonMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
+ "RadioButtonMenuItem.background", getMenuBackground(),
"RadioButtonMenuItem.border", new MetalBorders.MenuItemBorder(),
"RadioButtonMenuItem.borderPainted", Boolean.TRUE,
"RadioButtonMenuItem.checkIcon",
MetalIconFactory.getRadioButtonMenuItemIcon(),
+ "RadioButtonMenuItem.disabledForeground", getMenuDisabledForeground(),
"RadioButtonMenuItem.font", MetalLookAndFeel.getControlTextFont(),
+ "RadioButtonMenuItem.foreground", getMenuForeground(),
"RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
"RadioButtonMenuItem.selectionBackground",
MetalLookAndFeel.getMenuSelectedBackground(),
"RadioButtonMenuItem.selectionForeground",
MetalLookAndFeel.getMenuSelectedForeground(),
- "ScrollBar.background", new ColorUIResource(getControl()),
- "ScrollBar.shadow", new ColorUIResource(getControlShadow()),
- "ScrollBar.thumb", new ColorUIResource(getPrimaryControlShadow()),
- "ScrollBar.thumbDarkShadow",
- new ColorUIResource(getPrimaryControlDarkShadow()),
- "ScrollBar.thumbHighlight",
- new ColorUIResource(getPrimaryControl()),
+ "ScrollBar.background", getControl(),
+ "ScrollBar.darkShadow", getControlDarkShadow(),
+ "ScrollBar.foreground", getControl(),
+ "ScrollBar.highlight", getControlHighlight(),
+ "ScrollBar.shadow", getControlShadow(),
+ "ScrollBar.thumb", getPrimaryControlShadow(),
+ "ScrollBar.thumbDarkShadow", getControlDarkShadow(),
+ "ScrollBar.thumbHighlight", getPrimaryControl(),
+ "ScrollBar.thumbShadow", getPrimaryControlDarkShadow(),
+ "ScrollBar.track", getControl(),
+ "ScrollBar.trackHighlight", getControlDarkShadow(),
+ "ScrollBar.width", new Integer(17),
+
+ "ScrollPane.background", getControl(),
+ "ScrollPane.border", new MetalBorders.ScrollPaneBorder(),
+ "ScrollPane.foreground", getControlTextColor(),
- "SplitPane.darkShadow",
- new ColorUIResource(getControlDarkShadow()),
- "SplitPane.highlight",
- new ColorUIResource(getControlHighlight()),
+ "Separator.background", getSeparatorBackground(),
+ "Separator.foreground", getSeparatorForeground(),
+ "Separator.highlight", getControlHighlight(),
+ "Separator.shadow", getControlShadow(),
+ "Slider.background", getControl(),
+ "Slider.focus", getFocusColor(),
"Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0),
+ "Slider.foreground", getPrimaryControlShadow(),
+ "Slider.highlight", getControlHighlight(),
"Slider.horizontalThumbIcon",
MetalIconFactory.getHorizontalSliderThumbIcon(),
+ "Slider.majorTickLength", new Integer(6),
+ "Slider.shadow", getControlShadow(),
+ "Slider.trackWidth", new Integer(7),
"Slider.verticalThumbIcon",
MetalIconFactory.getVerticalSliderThumbIcon(),
- "Slider.trackWidth", new Integer(7),
- "Slider.majorTickLength", new Integer(6),
-
+
+ "Spinner.background", getControl(),
+ "Spinner.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "Spinner.foreground", getControl(),
+
+ "SplitPane.background", getControl(),
+ "SplitPane.darkShadow", getControlDarkShadow(),
+ "SplitPane.dividerFocusColor", getPrimaryControl(),
+ "SplitPane.highlight", getControlHighlight(),
+ "SplitPane.shadow", getControlShadow(),
+
+ "SplitPaneDivider.draggingColor", Color.DARK_GRAY,
+
+ "TabbedPane.background", getControlShadow(),
+ "TabbedPane.darkShadow", getControlDarkShadow(),
+ "TabbedPane.focus", getPrimaryControlDarkShadow(),
"TabbedPane.font", new FontUIResource("Dialog", Font.BOLD, 12),
- "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9),
+ "TabbedPane.foreground", getControlTextColor(),
+ "TabbedPane.highlight", getControlHighlight(),
+ "TabbedPane.light", getControl(),
+ "TabbedPane.selected", getControl(),
+ "TabbedPane.selectHighlight", getControlHighlight(),
"TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1),
+ "TabbedPane.shadow", getControlShadow(),
+ "TabbedPane.tabAreaBackground", getControl(),
"TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6),
-
- "ToggleButton.background", new ColorUIResource(getControl()),
- "ToggleButton.border", MetalBorders.getButtonBorder(),
- "ToggleButton.darkShadow", new ColorUIResource(getControlDarkShadow()),
- "ToggleButton.disabledText", new ColorUIResource(getControlDisabled()),
- "ToggleButton.focus", new ColorUIResource(getFocusColor()),
+ "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9),
+
+ "Table.background", getWindowBackground(),
+ "Table.focusCellBackground", getWindowBackground(),
+ "Table.focusCellForeground", getControlTextColor(),
+ "Table.foreground", getControlTextColor(),
+ "Table.focusCellHighlightBorder",
+ new BorderUIResource.LineBorderUIResource(getControlShadow()),
+ "Table.focusCellBackground", getWindowBackground(),
+ "Table.gridColor", getControlDarkShadow(),
+ "Table.selectionBackground", new ColorUIResource(204, 204, 255),
+ "Table.selectionForeground", new ColorUIResource(0, 0, 0),
+
+ "TableHeader.background", getControl(),
+ "TableHeader.cellBorder", new MetalBorders.TableHeaderBorder(),
+ "TableHeader.foreground", getControlTextColor(),
+
+ "TextArea.background", getWindowBackground(),
+ "TextArea.caretForeground", getUserTextColor(),
+ "TextArea.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "TextArea.foreground", getUserTextColor(),
+ "TextArea.inactiveForeground", getInactiveSystemTextColor(),
+ "TextArea.selectionBackground", getTextHighlightColor(),
+ "TextArea.selectionForeground", getHighlightedTextColor(),
+
+ "TextField.background", getWindowBackground(),
+ "TextField.border",
+ new BorderUIResource(MetalBorders.getTextFieldBorder()),
+ "TextField.caretForeground", getUserTextColor(),
+ "TextField.darkShadow", getControlDarkShadow(),
+ "TextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "TextField.foreground", getUserTextColor(),
+ "TextField.highlight", getControlHighlight(),
+ "TextField.inactiveBackground", getControl(),
+ "TextField.inactiveForeground", getInactiveSystemTextColor(),
+ "TextField.light", getControlHighlight(),
+ "TextField.selectionBackground", getTextHighlightColor(),
+ "TextField.selectionForeground", getHighlightedTextColor(),
+ "TextField.shadow", getControlShadow(),
+
+ "TextPane.background", getWindowBackground(),
+ "TextPane.caretForeground", getUserTextColor(),
+ "TextPane.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "TextPane.foreground", getUserTextColor(),
+ "TextPane.inactiveForeground", getInactiveSystemTextColor(),
+ "TextPane.selectionBackground", getTextHighlightColor(),
+ "TextPane.selectionForeground", getHighlightedTextColor(),
+
+ "TitledBorder.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "TitledBorder.titleColor", getSystemTextColor(),
+
+ "ToggleButton.background", getControl(),
+ "ToggleButton.border", MetalBorders.getToggleButtonBorder(),
+ "ToggleButton.darkShadow", getControlDarkShadow(),
+ "ToggleButton.disabledText", getInactiveControlTextColor(),
+ "ToggleButton.focus", getFocusColor(),
"ToggleButton.font", getControlTextFont(),
- "ToggleButton.foreground", new ColorUIResource(getSystemTextColor()),
- "ToggleButton.highlight", new ColorUIResource(getControlHighlight()),
- "ToggleButton.light", new ColorUIResource(getControlHighlight()),
- "ToggleButton.margin", new Insets(2, 14, 2, 14),
- "ToggleButton.select", new ColorUIResource(getPrimaryControlShadow()),
- "ToggleButton.shadow", new ColorUIResource(getPrimaryControlShadow()),
-
- "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(),
+ "ToggleButton.foreground", getControlTextColor(),
+ "ToggleButton.highlight", getControlHighlight(),
+ "ToggleButton.light", getControlHighlight(),
+ "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
+ "ToggleButton.select", getControlShadow(),
+ "ToggleButton.shadow", getControlShadow(),
+
+ "ToolBar.background", getMenuBackground(),
+ "ToolBar.darkShadow", getControlDarkShadow(),
+ "ToolBar.dockingBackground", getMenuBackground(),
+ "ToolBar.dockingForeground", getPrimaryControlDarkShadow(),
+ "ToolBar.floatingBackground", getMenuBackground(),
+ "ToolBar.floatingForeground", getPrimaryControl(),
+ "ToolBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
+ "ToolBar.foreground", getMenuForeground(),
+ "ToolBar.highlight", getControlHighlight(),
+ "ToolBar.light", getControlHighlight(),
+ "ToolBar.shadow", getControlShadow(),
+ "ToolBar.border", new MetalBorders.ToolBarBorder(),
+
+ "ToolTip.background", getPrimaryControl(),
+ "ToolTip.backgroundInactive", getControl(),
+ "ToolTip.border", new BorderUIResource.LineBorderUIResource(getPrimaryControlDarkShadow(), 1),
+ "ToolTip.borderInactive", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
+ "ToolTip.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "ToolTip.foreground", getPrimaryControlInfo(),
+ "ToolTip.foregroundInactive", getControlDarkShadow(),
+
+ "Tree.background", getWindowBackground(),
"Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(),
- "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(),
"Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true),
"Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false),
- "Tree.font", new FontUIResource(new Font("Helvetica", Font.PLAIN, 12)),
- "Tree.background", new ColorUIResource(Color.white),
- "Tree.foreground", new ColorUIResource(new Color(204, 204, 255)),
- "Tree.hash", new ColorUIResource(new Color(204, 204, 255)),
+ "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
+ "Tree.foreground", getUserTextColor(),
+ "Tree.hash", getPrimaryControl(),
+ "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(),
"Tree.leftChildIndent", new Integer(7),
+ "Tree.line", getPrimaryControl(),
+ "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(),
"Tree.rightChildIndent", new Integer(13),
- "Tree.rowHeight", new Integer(20),
+ "Tree.rowHeight", new Integer(0),
"Tree.scrollsOnExpand", Boolean.TRUE,
- "Tree.selectionBackground", new ColorUIResource(new Color(204, 204, 255)),
- "Tree.nonSelectionBackground", new ColorUIResource(Color.white),
- "Tree.selectionBorderColor", new ColorUIResource(new Color(102, 102, 153)),
+ "Tree.selectionBackground", getTextHighlightColor(),
"Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)),
- "Tree.nonSelectionBorder", new BorderUIResource.LineBorderUIResource(Color.white),
- "Tree.selectionForeground", new ColorUIResource(Color.black),
- "Tree.textBackground", new ColorUIResource(new Color(204, 204, 255)),
- "Tree.textForeground", new ColorUIResource(Color.black),
- "Tree.selectionForeground", new ColorUIResource(Color.black),
- "PopupMenu.border", new MetalBorders.PopupMenuBorder()
+ "Tree.selectionBorderColor", getFocusColor(),
+ "Tree.selectionForeground", getHighlightedTextColor(),
+ "Tree.textBackground", getWindowBackground(),
+ "Tree.textForeground", getUserTextColor(),
+
+ "Viewport.background", getControl(),
+ "Viewport.foreground", getUserTextColor()
};
defaults.putDefaults(myDefaults);
}
@@ -925,4 +1202,13 @@ public class MetalLookAndFeel extends BasicLookAndFeel
defaults.putDefaults(uiDefaults);
}
+ /**
+ * Returns the current theme setting for the Metal L&amp;F.
+ *
+ * @return the current theme setting for the Metal L&amp;F
+ */
+ public static MetalTheme getCurrentTheme()
+ {
+ return theme;
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java
new file mode 100644
index 00000000000..31d8d671fa1
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalMenuBarUI.java
@@ -0,0 +1,88 @@
+/* MetalMenuBarUI.java -- MenuBar UI for the Metal L&F
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Graphics;
+
+import javax.swing.JComponent;
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicMenuBarUI;
+
+/**
+ * A UI implementation for MenuBar in the Metal Look &amp; Feel.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ *
+ * @since 1.5
+ */
+public class MetalMenuBarUI extends BasicMenuBarUI
+{
+ /**
+ * Creates and returns a new instance of this UI for the specified component.
+ *
+ * @param c the component to create a UI for
+ *
+ * @return the UI for the component
+ */
+ public static ComponentUI createUI(JComponent c)
+ {
+ return new MetalMenuBarUI();
+ }
+
+
+ /**
+ * If the property <code>MenuBar.gradient</code> is set, then a gradient
+ * is painted as background, otherwise the normal superclass behaviour is
+ * called.
+ */
+ public void update(Graphics g, JComponent c)
+ {
+ if (c.isOpaque() && UIManager.get("MenuBar.gradient") != null)
+ {
+ MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(),
+ SwingConstants.VERTICAL, "MenuBar.gradient");
+ paint(g, c);
+ }
+ else
+ super.update(g, c);
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
index ec9bf2b5586..44a2d3bcd6a 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java
@@ -39,8 +39,12 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import javax.swing.JComponent;
+import javax.swing.JPopupMenu;
import javax.swing.plaf.ComponentUI;
+/**
+ * A UI delegate for the {@link JPopupMenu.Separator} component.
+ */
public class MetalPopupMenuSeparatorUI
extends MetalSeparatorUI
{
@@ -50,7 +54,7 @@ public class MetalPopupMenuSeparatorUI
private static MetalPopupMenuSeparatorUI instance = null;
/**
- * Constructs a new instance of MetalPopupMenuSeparatorUI.
+ * Constructs a new instance of <code>MetalPopupMenuSeparatorUI</code>.
*/
public MetalPopupMenuSeparatorUI()
{
@@ -58,11 +62,11 @@ public class MetalPopupMenuSeparatorUI
}
/**
- * Returns an instance of MetalPopupMenuSeparatorUI.
+ * Returns a shared instance of <code>MetalPopupMenuSeparatorUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalPopupMenuSeparatorUI
+ * @return A shared instance of <code>MetalPopupMenuSeparatorUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java
index 96d1988fd3d..0f28818b96c 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalProgressBarUI.java
@@ -38,20 +38,22 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Insets;
+
import javax.swing.JComponent;
+import javax.swing.JProgressBar;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicProgressBarUI;
-public class MetalProgressBarUI
- extends BasicProgressBarUI
-{
-
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for MetalProgressBarUIs */
- private static MetalProgressBarUI instance = null;
-
+/**
+ * A UI delegate for the {@link JProgressBar} component.
+ */
+public class MetalProgressBarUI extends BasicProgressBarUI
+{
/**
- * Constructs a new instance of MetalProgressBarUI.
+ * Constructs a new instance of <code>MetalProgressBarUI</code>.
*/
public MetalProgressBarUI()
{
@@ -59,16 +61,87 @@ public class MetalProgressBarUI
}
/**
- * Returns an instance of MetalProgressBarUI.
+ * Returns a new instance of <code>MetalProgressBarUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalProgressBarUI
+ * @return A new instance of <code>MetalProgressBarUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalProgressBarUI();
- return instance;
+ return new MetalProgressBarUI();
+ }
+
+ /**
+ * Performs the painting for determinate progress bars. This calls the
+ * superclass behaviour and then adds some highlighting to the upper and left
+ * edge of the progress bar.
+ *
+ * @param g the graphics context
+ * @param c not used here
+ */
+ public void paintDeterminate(Graphics g, JComponent c)
+ {
+ super.paintDeterminate(g, c);
+ Color saved = g.getColor();
+ Insets i = progressBar.getInsets();
+ int w = progressBar.getWidth();
+ int h = progressBar.getHeight();
+ int orientation = progressBar.getOrientation();
+
+ Color shadow = MetalLookAndFeel.getControlShadow();
+ g.setColor(shadow);
+
+ g.drawLine(i.left, i.top, w - i.right, i.top);
+ g.drawLine(i.left, i.top, i.left, h - i.bottom);
+ int full = getAmountFull(i, w, h);
+ if (full > 0)
+ {
+ Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow();
+ g.setColor(darkShadow);
+ if (orientation == JProgressBar.HORIZONTAL)
+ {
+ g.drawLine(i.left, i.top, i.left, h - i.bottom);
+ g.drawLine(i.left, i.top, i.left + full - 1, i.top);
+ }
+ else
+ {
+ if (full >= (h - i.top - i.bottom))
+ g.drawLine(i.left, i.top, w - i.right, i.top);
+ g.drawLine(i.left, h - i.bottom, i.left, h - i.bottom - full);
+ }
+ }
+ g.setColor(saved);
+ }
+
+ /**
+ * Performs the painting for indeterminate progress bars. This calls the
+ * superclass behaviour and then adds some highlighting to the upper and left
+ * edge of the progress bar.
+ *
+ * @param g the graphics context
+ * @param c not used here
+ */
+ public void paintIndeterminate(Graphics g, JComponent c)
+ {
+ super.paintIndeterminate(g, c);
+ Color saved = g.getColor();
+ Insets i = progressBar.getInsets();
+ int w = progressBar.getWidth();
+ int h = progressBar.getHeight();
+ Color shadow = MetalLookAndFeel.getControlShadow();
+ g.setColor(shadow);
+ g.drawLine(i.left, i.top, w - i.right, i.top);
+ g.drawLine(i.left, i.top, i.left, h - i.bottom);
+
+ boxRect = getBox(boxRect);
+ Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow();
+ g.setColor(darkShadow);
+ int orientation = progressBar.getOrientation();
+ if (orientation == JProgressBar.HORIZONTAL)
+ g.drawLine(boxRect.x, i.top, boxRect.x + boxRect.width - 1, i.top);
+ else
+ g.drawLine(i.left, boxRect.y, i.left, boxRect.y + boxRect.height - 1);
+ g.setColor(saved);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java
index a668f914e43..de71fe8e5b2 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java
@@ -38,20 +38,37 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
+import javax.swing.AbstractButton;
import javax.swing.JComponent;
+import javax.swing.JRadioButton;
+import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicRadioButtonUI;
+
+/**
+ * A UI delegate for the {@link JRadioButton} component.
+ */
public class MetalRadioButtonUI
extends BasicRadioButtonUI
{
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for JRadioButtons. */
- private static MetalRadioButtonUI instance = null;
-
+ /** Used to draw the focus rectangle. */
+ protected Color focusColor;
+
+ /** Used to fill the icon when the button is pressed. */
+ protected Color selectColor;
+
+ /** Used to draw disabled text. */
+ protected Color disabledTextColor;
+
/**
- * Constructs a new instance of MetalRadioButtonUI.
+ * Constructs a new instance of <code>MetalRadioButtonUI</code>.
*/
public MetalRadioButtonUI()
{
@@ -59,16 +76,107 @@ public class MetalRadioButtonUI
}
/**
- * Returns an instance of MetalRadioButtonUI.
+ * Returns a new instance of <code>MetalRadioButtonUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalRadioButtonUI
+ * @return A new instance of <code>MetalRadioButtonUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalRadioButtonUI();
- return instance;
+ return new MetalRadioButtonUI();
+ }
+
+ /**
+ * Sets the default values for the specified button.
+ *
+ * @param b the button.
+ */
+ public void installDefaults(AbstractButton b)
+ {
+ super.installDefaults(b);
+ disabledTextColor = UIManager.getColor("RadioButton.disabledText");
+ focusColor = UIManager.getColor("RadioButton.focus");
+ selectColor = UIManager.getColor("RadioButton.select");
+ }
+
+ /**
+ * Clears any defaults set in the installDefaults() method.
+ *
+ * @param b the {@link JRadioButton}.
+ */
+ protected void uninstallDefaults(AbstractButton b)
+ {
+ super.uninstallDefaults(b);
+ disabledTextColor = null;
+ focusColor = null;
+ selectColor = null;
+ }
+
+ /**
+ * Returns the color used to fill the {@link JRadioButton}'s icon when the
+ * button is pressed. The default color is obtained from the
+ * {@link UIManager} defaults via an entry with the key
+ * <code>RadioButton.select</code>.
+ *
+ * @return The select color.
+ */
+ protected Color getSelectColor()
+ {
+ return selectColor;
+ }
+
+ /**
+ * Returns the color for the {@link JRadioButton}'s text when the button is
+ * disabled. The default color is obtained from the {@link UIManager}
+ * defaults via an entry with the key <code>RadioButton.disabledText</code>.
+ *
+ * @return The disabled text color.
+ */
+ protected Color getDisabledTextColor()
+ {
+ return disabledTextColor;
+ }
+
+ /**
+ * Returns the color used to draw the focus rectangle when the
+ * {@link JRadioButton} has the focus. The default color is obtained from
+ * the {@link UIManager} defaults via an entry with the key
+ * <code>RadioButton.focus</code>.
+ *
+ * @return The color used to draw the focus rectangle.
+ *
+ * @see #paintFocus(Graphics, Rectangle, Dimension)
+ */
+ protected Color getFocusColor()
+ {
+ return focusColor;
+ }
+
+ /**
+ * Paints the {@link JRadioButton}.
+ *
+ * @param g the graphics device.
+ * @param c the component (an instance of {@link JRadioButton}).
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ super.paint(g, c);
+ // FIXME: disabled text isn't being drawn correctly, it's possible that
+ // it could be done here...
+ }
+
+ /**
+ * Paints the focus rectangle for the {@link JRadioButton}.
+ *
+ * @param g the graphics device.
+ * @param t the bounding rectangle for the text.
+ * @param d ???
+ */
+ protected void paintFocus(Graphics g, Rectangle t, Dimension d)
+ {
+ g.setColor(focusColor);
+ g.drawRect(t.x - 1, t.y + 2, t.width + 2, t.height - 4);
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java
index 4196a4e477c..faed80382d0 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalRootPaneUI.java
@@ -39,9 +39,16 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import javax.swing.JComponent;
+import javax.swing.JRootPane;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicRootPaneUI;
+/**
+ * A UI delegate for the {@link JRootPane} component. This class is not fully
+ * implemented.
+ *
+ * @since 1.4
+ */
public class MetalRootPaneUI
extends BasicRootPaneUI
{
@@ -51,7 +58,7 @@ public class MetalRootPaneUI
private static MetalRootPaneUI instance = null;
/**
- * Constructs a new instance of MetalRootPaneUI.
+ * Constructs a shared instance of <code>MetalRootPaneUI</code>.
*/
public MetalRootPaneUI()
{
@@ -59,11 +66,11 @@ public class MetalRootPaneUI
}
/**
- * Returns an instance of MetalRootPaneUI.
+ * Returns a shared instance of <code>MetalRootPaneUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalRootPaneUI
+ * @return A shared instance of <code>MetalRootPaneUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
index 526dfb50ae2..0ff501f89a9 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java
@@ -38,30 +38,105 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
-import java.util.HashMap;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.JButton;
import javax.swing.JComponent;
-import javax.swing.UIDefaults;
+import javax.swing.JScrollBar;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicScrollBarUI;
-public class MetalScrollBarUI
- extends BasicScrollBarUI
+/**
+ * A UI delegate for the {@link JScrollBar} component.
+ */
+public class MetalScrollBarUI extends BasicScrollBarUI
{
+
+ /**
+ * A property change handler for the UI delegate that monitors for
+ * changes to the "JScrollBar.isFreeStanding" property, and updates
+ * the buttons and track rendering as appropriate.
+ */
+ class MetalScrollBarPropertyChangeHandler
+ extends BasicScrollBarUI.PropertyChangeHandler
+ {
+ /**
+ * Creates a new handler.
+ *
+ * @see #createPropertyChangeListener()
+ */
+ public MetalScrollBarPropertyChangeHandler()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Handles a property change event. If the event name is
+ * <code>JSlider.isFreeStanding</code>, this method updates the
+ * delegate, otherwise the event is passed up to the super class.
+ *
+ * @param e the property change event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(FREE_STANDING_PROP))
+ {
+ Boolean prop = (Boolean) e.getNewValue();
+ isFreeStanding = (prop == null ? true : prop.booleanValue());
+ if (increaseButton != null)
+ increaseButton.setFreeStanding(isFreeStanding);
+ if (decreaseButton != null)
+ decreaseButton.setFreeStanding(isFreeStanding);
+ }
+ else
+ super.propertyChange(e);
+ }
+ }
+
+ /** The name for the 'free standing' property. */
+ public static final String FREE_STANDING_PROP = "JScrollBar.isFreeStanding";
- /** The minimum thumb size */
- private static final Dimension MIN_THUMB_SIZE = new Dimension(18, 18);
-
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for JScrollBars. */
- private static HashMap instances = null;
+ /** The minimum thumb size for a scroll bar that is not free standing. */
+ private static final Dimension MIN_THUMB_SIZE = new Dimension(15, 15);
+ /** The minimum thumb size for a scroll bar that is free standing. */
+ private static final Dimension MIN_THUMB_SIZE_FREE_STANDING
+ = new Dimension(17, 17);
+
+ /** The button that increases the value in the scroll bar. */
+ protected MetalScrollButton increaseButton;
+
+ /** The button that decreases the value in the scroll bar. */
+ protected MetalScrollButton decreaseButton;
+
+ /**
+ * The scroll bar width.
+ */
+ protected int scrollBarWidth;
+
+ /**
+ * A flag that indicates whether the scroll bar is "free standing", which
+ * means it has complete borders and can be used anywhere in the UI. A
+ * scroll bar which is not free standing has borders missing from one
+ * side, and relies on being part of another container with its own borders
+ * to look right visually. */
+ protected boolean isFreeStanding = true;
+
+ /**
+ * The color for the scroll bar shadow (this is read from the UIDefaults in
+ * the installDefaults() method).
+ */
+ Color scrollBarShadowColor;
+
/**
- * Constructs a new instance of MetalScrollBarUI.
+ * Constructs a new instance of <code>MetalScrollBarUI</code>, with no
+ * specific initialisation.
*/
public MetalScrollBarUI()
{
@@ -69,28 +144,190 @@ public class MetalScrollBarUI
}
/**
- * Returns an instance of MetalScrollBarUI.
+ * Returns a new instance of <code>MetalScrollBarUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalScrollBarUI
+ * @return An instance of MetalScrollBarUI
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
+ return new MetalScrollBarUI();
+ }
- Object o = instances.get(component);
- MetalScrollBarUI instance;
- if (o == null)
+ /**
+ * Installs the defaults.
+ */
+ protected void installDefaults()
+ {
+ // need to initialise isFreeStanding before calling the super class,
+ // so that the value is set when createIncreaseButton() and
+ // createDecreaseButton() are called (unless there is somewhere earlier
+ // that we can do this).
+ Boolean prop = (Boolean) scrollbar.getClientProperty(FREE_STANDING_PROP);
+ isFreeStanding = (prop == null ? true : prop.booleanValue());
+ scrollBarShadowColor = UIManager.getColor("ScrollBar.shadow");
+ super.installDefaults();
+ }
+
+ /**
+ * Creates a property change listener for the delegate to use. This
+ * overrides the method to provide a custom listener for the
+ * {@link MetalLookAndFeel} that can handle the
+ * <code>JScrollBar.isFreeStanding</code> property.
+ *
+ * @return A property change listener.
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new MetalScrollBarPropertyChangeHandler();
+ }
+
+ /**
+ * Creates a new button to use as the control at the lower end of the
+ * {@link JScrollBar}.
+ *
+ * @param orientation the orientation of the button ({@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} or {@link #WEST}).
+ *
+ * @return The button.
+ */
+ protected JButton createDecreaseButton(int orientation)
+ {
+ scrollBarWidth = UIManager.getInt("ScrollBar.width");
+ decreaseButton = new MetalScrollButton(orientation, scrollBarWidth,
+ isFreeStanding);
+ return decreaseButton;
+ }
+
+ /**
+ * Creates a new button to use as the control at the upper end of the
+ * {@link JScrollBar}.
+ *
+ * @param orientation the orientation of the button ({@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} or {@link #WEST}).
+ *
+ * @return The button.
+ */
+ protected JButton createIncreaseButton(int orientation)
+ {
+ scrollBarWidth = UIManager.getInt("ScrollBar.width");
+ increaseButton = new MetalScrollButton(orientation, scrollBarWidth,
+ isFreeStanding);
+ return increaseButton;
+ }
+
+ /**
+ * Paints the track for the scrollbar.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ * @param trackBounds the track bounds.
+ */
+ protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)
+ {
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(trackBounds.x, trackBounds.y, trackBounds.width,
+ trackBounds.height);
+ if (scrollbar.getOrientation() == HORIZONTAL)
+ paintTrackHorizontal(g, c, trackBounds.x, trackBounds.y,
+ trackBounds.width, trackBounds.height);
+ else
+ paintTrackVertical(g, c, trackBounds.x, trackBounds.y,
+ trackBounds.width, trackBounds.height);
+
+ }
+
+ /**
+ * Paints the track for a horizontal scrollbar.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ * @param x the x-coordinate for the track bounds.
+ * @param y the y-coordinate for the track bounds.
+ * @param w the width for the track bounds.
+ * @param h the height for the track bounds.
+ */
+ private void paintTrackHorizontal(Graphics g, JComponent c,
+ int x, int y, int w, int h)
+ {
+ if (c.isEnabled())
{
- instance = new MetalScrollBarUI();
- instances.put(component, instance);
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
+
+ g.setColor(scrollBarShadowColor);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
+ g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
+
+ if (isFreeStanding)
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y + h - 2, x + w - 1, y + h - 2);
+ g.setColor(scrollBarShadowColor);
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+ }
}
else
- instance = (MetalScrollBarUI) o;
-
- return instance;
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ if (isFreeStanding)
+ g.drawRect(x, y, w - 1, h - 1);
+ else
+ {
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
+ }
+ }
+ }
+
+ /**
+ * Paints the track for a vertical scrollbar.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ * @param x the x-coordinate for the track bounds.
+ * @param y the y-coordinate for the track bounds.
+ * @param w the width for the track bounds.
+ * @param h the height for the track bounds.
+ */
+ private void paintTrackVertical(Graphics g, JComponent c,
+ int x, int y, int w, int h)
+ {
+ if (c.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+
+ g.setColor(scrollBarShadowColor);
+ g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 2);
+
+ if (isFreeStanding)
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(x + w - 2, y, x + w - 2, y + h - 1);
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
+ }
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ if (isFreeStanding)
+ g.drawRect(x, y, w - 1, h - 1);
+ else
+ {
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+ }
+ }
}
/**
@@ -102,45 +339,137 @@ public class MetalScrollBarUI
*/
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
{
- // first we fill the background
- g.setColor(thumbColor);
- g.fillRect(thumbBounds.x, thumbBounds.y, thumbBounds.width,
- thumbBounds.height);
+ // a disabled scrollbar has no thumb in the metal look and feel
+ if (!c.isEnabled())
+ return;
+ if (scrollbar.getOrientation() == HORIZONTAL)
+ paintThumbHorizontal(g, c, thumbBounds);
+ else
+ paintThumbVertical(g, c, thumbBounds);
- // draw the outer dark line
- g.setColor(thumbDarkShadowColor);
- g.drawRect(thumbBounds.x, thumbBounds.y, thumbBounds.width - 1,
- thumbBounds.height - 1);
+ // draw the pattern
+ MetalUtils.fillMetalPattern(c, g, thumbBounds.x + 3, thumbBounds.y + 3,
+ thumbBounds.width - 6, thumbBounds.height - 6,
+ thumbHighlightColor, thumbLightShadowColor);
+ }
- // draw the inner light line
+ /**
+ * Paints the thumb for a horizontal scroll bar.
+ *
+ * @param g the graphics device.
+ * @param c the scroll bar component.
+ * @param thumbBounds the thumb bounds.
+ */
+ private void paintThumbHorizontal(Graphics g, JComponent c,
+ Rectangle thumbBounds)
+ {
+ int x = thumbBounds.x;
+ int y = thumbBounds.y;
+ int w = thumbBounds.width;
+ int h = thumbBounds.height;
+
+ // first we fill the background
+ g.setColor(thumbColor);
+ if (isFreeStanding)
+ g.fillRect(x, y, w, h - 1);
+ else
+ g.fillRect(x, y, w, h);
+
+ // then draw the dark box
+ g.setColor(thumbLightShadowColor);
+ if (isFreeStanding)
+ g.drawRect(x, y, w - 1, h - 2);
+ else
+ {
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x + w - 1, y, x + w - 1, y + h -1);
+ }
+
+ // then the highlight
g.setColor(thumbHighlightColor);
- g.drawLine(thumbBounds.x + 1, thumbBounds.y + 1,
- thumbBounds.x + thumbBounds.width - 2,
- thumbBounds.y + 1);
- g.drawLine(thumbBounds.x + 1, thumbBounds.y + 1,
- thumbBounds.x + 1,
- thumbBounds.y + thumbBounds.height - 2);
-
+ if (isFreeStanding)
+ {
+ g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
+ }
+ else
+ {
+ g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
+ }
+
// draw the shadow line
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- g.setColor(def.getColor("ScrollBar.shadow"));
- g.drawLine(thumbBounds.x + 1, thumbBounds.y + thumbBounds.height,
- thumbBounds.x + thumbBounds.width,
- thumbBounds.y + thumbBounds.height);
+ g.setColor(UIManager.getColor("ScrollBar.shadow"));
+ g.drawLine(x + w, y + 1, x + w, y + h - 1);
- // draw the pattern
- MetalUtils.fillMetalPattern(g, thumbBounds.x + 3, thumbBounds.y + 3,
- thumbBounds.width - 6, thumbBounds.height - 6,
- thumbHighlightColor, thumbDarkShadowColor);
}
-
+
+ /**
+ * Paints the thumb for a vertical scroll bar.
+ *
+ * @param g the graphics device.
+ * @param c the scroll bar component.
+ * @param thumbBounds the thumb bounds.
+ */
+ private void paintThumbVertical(Graphics g, JComponent c,
+ Rectangle thumbBounds)
+ {
+ int x = thumbBounds.x;
+ int y = thumbBounds.y;
+ int w = thumbBounds.width;
+ int h = thumbBounds.height;
+
+ // first we fill the background
+ g.setColor(thumbColor);
+ if (isFreeStanding)
+ g.fillRect(x, y, w - 1, h);
+ else
+ g.fillRect(x, y, w, h);
+
+ // then draw the dark box
+ g.setColor(thumbLightShadowColor);
+ if (isFreeStanding)
+ g.drawRect(x, y, w - 2, h - 1);
+ else
+ {
+ g.drawLine(x, y, x + w - 1, y);
+ g.drawLine(x, y, x, y + h - 1);
+ g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
+ }
+
+ // then the highlight
+ g.setColor(thumbHighlightColor);
+ if (isFreeStanding)
+ {
+ g.drawLine(x + 1, y + 1, x + w - 3, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
+ }
+ else
+ {
+ g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 3);
+ }
+
+ // draw the shadow line
+ g.setColor(UIManager.getColor("ScrollBar.shadow"));
+ g.drawLine(x + 1, y + h, x + w - 2, y + h);
+ }
+
/**
- * This method returns the minimum thumb size.
+ * Returns the minimum thumb size. For a free standing scroll bar the
+ * minimum size is <code>17 x 17</code> pixels, whereas for a non free
+ * standing scroll bar the minimum size is <code>15 x 15</code> pixels.
*
* @return The minimum thumb size.
*/
protected Dimension getMinimumThumbSize()
{
- return MIN_THUMB_SIZE;
+ if (isFreeStanding)
+ return MIN_THUMB_SIZE_FREE_STANDING;
+ else
+ return MIN_THUMB_SIZE;
}
+
}
+
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java b/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java
new file mode 100644
index 00000000000..84f9cfe494e
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalScrollButton.java
@@ -0,0 +1,483 @@
+/* MetalScrollButton.java
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.metal;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
+import javax.swing.SwingUtilities;
+import javax.swing.plaf.basic.BasicArrowButton;
+
+/**
+ * A button used by the {@link MetalScrollBarUI}. The button appearance
+ * varies according to the button direction, whether or not it is part of a
+ * "free standing" scroll bar, and the current state of the button.
+ */
+public class MetalScrollButton extends BasicArrowButton
+{
+
+ /**
+ * The maximum size for buttons.
+ * @see #getMaximumSize()
+ */
+ private static Dimension maximumSize;
+
+ /** The width of the button. */
+ private int buttonWidth;
+
+ /**
+ * A flag that indicates whether the button is part of a free standing
+ * scroll bar. This affects how the border is drawn.
+ */
+ private boolean freeStanding;
+
+ /**
+ * Creates a new button.
+ *
+ * @param direction the direction (this should be one of {@link #NORTH},
+ * {@link #SOUTH}, {@link #EAST} and {@link #WEST}, but
+ * this is not enforced).
+ * @param width the button width.
+ * @param freeStanding a flag indicating whether the scroll button is free
+ * standing or not.
+ */
+ public MetalScrollButton(int direction, int width, boolean freeStanding)
+ {
+ super(direction);
+ buttonWidth = width;
+ this.freeStanding = freeStanding;
+ }
+
+ /**
+ * Returns the button width.
+ *
+ * @return The button width.
+ */
+ public int getButtonWidth()
+ {
+ return buttonWidth;
+ }
+
+ /**
+ * Sets the free standing flag. This controls how the button border is
+ * drawn.
+ *
+ * @param freeStanding the new value of the flag.
+ */
+ public void setFreeStanding(boolean freeStanding)
+ {
+ this.freeStanding = freeStanding;
+ }
+
+ /**
+ * Paints the button.
+ *
+ * @param g the graphics device.
+ */
+ public void paint(Graphics g)
+ {
+ Rectangle bounds = SwingUtilities.getLocalBounds(this);
+
+ // fill the background
+ if (getModel().isPressed())
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControl());
+ g.fillRect(0, 0, bounds.width, bounds.height);
+
+ paintArrow(g, bounds.width, bounds.height);
+
+ // paint a border manually - I tried using a real (custom) Border
+ // but couldn't get it to stay set for the button, something was
+ // overwriting it...
+ if (freeStanding)
+ {
+ if (direction == WEST)
+ paintWestBorderFreeStanding(g, bounds.width, bounds.height);
+ else if (direction == EAST)
+ paintEastBorderFreeStanding(g, bounds.width, bounds.height);
+ else if (direction == SOUTH)
+ paintSouthBorderFreeStanding(g, bounds.width, bounds.height);
+ else // asume NORTH
+ paintNorthBorderFreeStanding(g, bounds.width, bounds.height);
+ }
+ else
+ {
+ if (direction == WEST)
+ paintWestBorder(g, bounds.width, bounds.height);
+ else if (direction == EAST)
+ paintEastBorder(g, bounds.width, bounds.height);
+ else if (direction == SOUTH)
+ paintSouthBorder(g, bounds.width, bounds.height);
+ else // asume NORTH
+ paintNorthBorder(g, bounds.width, bounds.height);
+ }
+ }
+
+ private void paintArrow(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ g.setColor(MetalLookAndFeel.getBlack());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+
+ if (direction == SOUTH)
+ {
+ int x = w / 2;
+ int y = h / 2 + 2;
+ for (int i = 1; i < 5; i++)
+ g.drawLine(x - i, y - i, x + i - 1, y - i);
+ }
+ else if (direction == EAST)
+ {
+ int x = w / 2 + 2;
+ int y = h / 2;
+ for (int i = 1; i < 5; i++)
+ g.drawLine(x - i, y - i, x - i, y + i - 1);
+ }
+ else if (direction == WEST)
+ {
+ int x = w / 2 - 3;
+ int y = h / 2;
+ for (int i = 1; i < 5; i++)
+ g.drawLine(x + i, y - i, x + i, y + i - 1);
+ }
+ else // assume NORTH
+ {
+ int x = w / 2;
+ int y = h / 2 - 3;
+ for (int i = 1; i < 5; i++)
+ g.drawLine(x - i, y + i, x + i - 1, y + i);
+ }
+ }
+ /**
+ * Paints the border for a button with a {@link #NORTH} direction that
+ * belongs to a free standing scroll bar.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintNorthBorderFreeStanding(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 2, 0);
+ g.drawLine(0, 0, 0, h - 1);
+ g.drawLine(2, h - 1, w - 2, h - 1);
+ g.drawLine(w - 2, 2, w - 2, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 1, 1, h - 2);
+ g.drawLine(1, 1, w - 3, 1);
+ g.drawLine(w - 1, 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(1, h - 1, 1, h - 1);
+ g.drawLine(w - 2, 1, w - 2, 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(w - 1, 0, w - 1, h - 1);
+ g.drawLine(0, 0, 0, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #SOUTH} direction that
+ * belongs to a free standing scroll bar.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintSouthBorderFreeStanding(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 2, 0);
+ g.drawLine(0, 0, 0, h - 1);
+ g.drawLine(2, h - 1, w - 2, h - 1);
+ g.drawLine(w - 2, 2, w - 2, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 1, 1, h - 1);
+ g.drawLine(1, 1, w - 1, 1);
+ g.drawLine(w - 1, 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(1, h - 1, 1, h - 1);
+ g.drawLine(w - 1, 1, w - 1, 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, h - 1, w - 1, h - 1);
+ g.drawLine(w - 1, 0, w - 1, h - 1);
+ g.drawLine(0, 0, 0, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with an {@link #EAST} direction that
+ * belongs to a free standing scroll bar.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintEastBorderFreeStanding(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 2, 0);
+ g.drawLine(w - 2, 0, w - 2, h - 2);
+ g.drawLine(0, h - 2, w - 2, h - 2);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(0, 1, w - 1, 1);
+ g.drawLine(w - 1, 1, w - 1, h - 1);
+ g.drawLine(0, h - 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(w - 2, 1, w - 2, 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(w - 1, 0, w - 1, h - 1);
+ g.drawLine(0, h - 1, w - 1, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #WEST} direction that
+ * belongs to a free standing scroll bar.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintWestBorderFreeStanding(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(0, 0, 0, h - 2);
+ g.drawLine(0, h - 2, w - 1, h - 2);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 1, w - 1, 1);
+ g.drawLine(1, 1, 1, h - 1);
+ g.drawLine(1, h - 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(1, h - 2, 1, h - 2);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(0, 0, 0, h - 1);
+ g.drawLine(0, h - 1, w - 1, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #NORTH} direction that
+ * belongs to a scroll bar that is not free standing.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintNorthBorder(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, 0, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 0, 1, h - 1);
+ g.drawLine(1, 0, w - 1, 0);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, 0, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #SOUTH} direction that
+ * belongs to a scroll bar that is not free standing.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintSouthBorder(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, 0, h - 1);
+ g.drawLine(0, h - 1, w - 1, h - 1);
+
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(1, 0, 1, h - 1);
+ g.drawLine(1, 0, w - 1, 0);
+
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(1, h - 1, 1, h - 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, 0, h - 1);
+ }
+ }
+
+ /**
+ * Paints the border for a button with an {@link #EAST} direction that
+ * belongs to a scroll bar that is not free standing.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintEastBorder(Graphics g, int w, int h)
+ {
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, w - 1, 0);
+ g.drawLine(w - 1, 2, w - 1, h - 1);
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(0, 1, w - 2, 1);
+ g.drawLine(0, 1, 0, h - 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, w - 1, 0);
+ }
+ }
+
+ /**
+ * Paints the border for a button with a {@link #WEST} direction that
+ * belongs to a scroll bar that is not free standing.
+ *
+ * @param g the graphics device.
+ * @param w the button width.
+ * @param h the button height.
+ */
+ private void paintWestBorder(Graphics g, int w, int h)
+ {
+ Rectangle bounds = SwingUtilities.getLocalBounds(this);
+ if (isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControlDarkShadow());
+ g.drawLine(0, 0, bounds.width - 1, 0);
+ g.setColor(MetalLookAndFeel.getControlHighlight());
+ g.drawLine(0, 1, bounds.width - 1, 1);
+ g.drawLine(0, 1, 0, bounds.height - 1);
+ }
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlDisabled());
+ g.drawLine(0, 0, bounds.width - 1, 0);
+ }
+ }
+
+ /**
+ * Returns the preferred size for the button, which varies depending on
+ * the direction of the button and whether or not it is free standing.
+ *
+ * @return The preferred size.
+ */
+ public Dimension getPreferredSize()
+ {
+ int adj = 1;
+ if (!freeStanding)
+ adj = 2;
+
+ if (direction == EAST)
+ return new Dimension(buttonWidth - adj, buttonWidth);
+ else if (direction == WEST)
+ return new Dimension(buttonWidth - 2, buttonWidth);
+ else if (direction == SOUTH)
+ return new Dimension(buttonWidth, buttonWidth - adj);
+ else // assume NORTH
+ return new Dimension(buttonWidth, buttonWidth - 2);
+ }
+
+ /**
+ * Returns the minimum size for the button.
+ *
+ * @return The minimum size for the button.
+ */
+ public Dimension getMinimumSize()
+ {
+ return getPreferredSize();
+ }
+
+ /**
+ * Returns the maximum size for the button.
+ *
+ * @return <code>Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)</code>.
+ */
+ public Dimension getMaximumSize()
+ {
+ if (maximumSize == null)
+ maximumSize = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+ return maximumSize;
+ }
+
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java
index 3e1198b398d..d5bf175f92d 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java
@@ -39,19 +39,18 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import javax.swing.JComponent;
+import javax.swing.JScrollPane;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicScrollPaneUI;
+/**
+ * A UI delegate for the {@link JScrollPane} component.
+ */
public class MetalScrollPaneUI
extends BasicScrollPaneUI
{
-
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for JScrollPanes. */
- private static MetalScrollPaneUI instance = null;
-
/**
- * Constructs a new instance of MetalScrollPaneUI.
+ * Constructs a new instance of <code>MetalScrollPaneUI</code>.
*/
public MetalScrollPaneUI()
{
@@ -59,16 +58,14 @@ public class MetalScrollPaneUI
}
/**
- * Returns an instance of MetalScrollPaneUI.
+ * Returns a shared instance of <code>MetalScrollPaneUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalScrollPaneUI
+ * @return A shared instance of <code>MetalScrollPaneUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalScrollPaneUI();
- return instance;
+ return new MetalScrollPaneUI();
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java
index 6e78ccb7071..1d48e9be2b0 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalSeparatorUI.java
@@ -38,10 +38,20 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
import javax.swing.JComponent;
+import javax.swing.JSeparator;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicSeparatorUI;
+/**
+ * A UI delegate for the {@link JSeparator} component.
+ */
public class MetalSeparatorUI
extends BasicSeparatorUI
{
@@ -51,7 +61,7 @@ public class MetalSeparatorUI
private static MetalSeparatorUI instance = null;
/**
- * Constructs a new instance of MetalSeparatorUI.
+ * Constructs a new instance of <code>MetalSeparatorUI</code>.
*/
public MetalSeparatorUI()
{
@@ -59,11 +69,11 @@ public class MetalSeparatorUI
}
/**
- * Returns an instance of MetalSeparatorUI.
+ * Returns a shared instance of <code>MetalSeparatorUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalSeparatorUI
+ * @return A shared instance of <code>MetalSeparatorUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
@@ -71,4 +81,51 @@ public class MetalSeparatorUI
instance = new MetalSeparatorUI();
return instance;
}
+
+ /**
+ * The separator is made of two lines. The top line will be
+ * the Metal theme color separatorForeground (or left line if it's vertical).
+ * The bottom or right line will be the Metal theme color
+ * separatorBackground.
+ * The two lines will
+ * be centered inside the bounds box. If the separator is horizontal,
+ * then it will be vertically centered, or if it's vertical, it will
+ * be horizontally centered.
+ *
+ * @param g The Graphics object to paint with
+ * @param c The JComponent to paint.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ Rectangle r = new Rectangle();
+ SwingUtilities.calculateInnerArea(c, r);
+ Color saved = g.getColor();
+ Color c1 = UIManager.getColor("Separator.foreground");
+ Color c2 = UIManager.getColor("Separator.background");
+ JSeparator s;
+ if (c instanceof JSeparator)
+ s = (JSeparator) c;
+ else
+ return;
+
+ if (s.getOrientation() == JSeparator.HORIZONTAL)
+ {
+ int midAB = r.height / 2;
+ g.setColor(c1);
+ g.drawLine(r.x, r.y + midAB - 1, r.x + r.width, r.y + midAB - 1);
+
+ g.setColor(c2);
+ g.fillRect(r.x, r.y + midAB, r.x + r.width, r.y + midAB);
+ }
+ else
+ {
+ int midAD = r.height / 2 + r.y;
+ g.setColor(c1);
+ g.drawLine(r.x, r.y, r.x, r.y + r.height);
+
+ g.setColor(c2);
+ g.fillRect(r.x + midAD, r.y + r.height, r.x + midAD, r.y + r.height);
+ }
+ g.setColor(saved);
+ }
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java
index 4b52c4b0041..08fb99d216c 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalSliderUI.java
@@ -42,8 +42,8 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.HashMap;
import javax.swing.Icon;
import javax.swing.JComponent;
@@ -56,16 +56,59 @@ import javax.swing.plaf.basic.BasicSliderUI;
/**
* A UI delegate for the {@link JSlider} component.
*/
-public class MetalSliderUI
- extends BasicSliderUI
+public class MetalSliderUI extends BasicSliderUI
{
- // TODO: find a use for this
+ /**
+ * A property change handler that updates the rendered component in response
+ * to specific property change events. This custom handler is used to
+ * intercept the "JSlider.isFilled" property, which is only recognised by
+ * the {@link MetalLookAndFeel}.
+ */
+ protected class MetalPropertyListener
+ extends BasicSliderUI.PropertyChangeHandler
+ {
+ /**
+ * Creates a new listener.
+ */
+ protected MetalPropertyListener()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Handles property change events. Events with the name "JSlider.isFilled"
+ * are handled here, and other events are passed to the superclass.
+ *
+ * @param e the property change event.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(SLIDER_FILL))
+ {
+ Boolean b = (Boolean) e.getNewValue();
+ if (b == null)
+ filledSlider = false;
+ else
+ filledSlider = b.booleanValue();
+ }
+ else
+ super.propertyChange(e);
+ }
+ }
+
+ /** The thumb color (unused, because an icon is used to draw the thumb). */
protected static Color thumbColor;
- // TODO: find a use for this
+ /**
+ * The highlight color used for drawing the track rect when the slider is
+ * enabled.
+ */
protected static Color highlightColor;
- // TODO: find a use for this
+ /**
+ * The shadow color used for drawing the track rect when the slider is
+ * enabled.
+ */
protected static Color darkShadowColor;
/** The track width. */
@@ -85,17 +128,14 @@ public class MetalSliderUI
/** The gap between the track and the tick marks. */
protected final int TICK_BUFFER = 4;
+ /** A key to look up the filledSlider setting in the {@link UIManager}. */
+ protected final String SLIDER_FILL = "JSlider.isFilled";
+
/**
* A flag that controls whether or not the track is filled up to the value
* of the slider.
*/
protected boolean filledSlider;
-
- /** A key to look up the filledSlider setting in the {@link UIManager}. */
- protected final String SLIDER_FILL = "JSlider.isFilled";
-
- /** The UI instances for MetalSliderUIs */
- private static HashMap instances;
/**
* Constructs a new instance.
@@ -104,33 +144,27 @@ public class MetalSliderUI
{
super(null);
filledSlider = UIManager.getBoolean(SLIDER_FILL);
+ darkShadowColor = MetalLookAndFeel.getControlDarkShadow();
+ highlightColor = MetalLookAndFeel.getControlHighlight();
}
/**
- * Returns an instance of MetalSliderUI.
+ * Returns a new instance of <code>MetalSliderUI</code>.
*
- * @param component the component for which we return an UI instance
+ * @param component the component (ignored).
*
- * @return an instance of MetalSliderUI
+ * @return A new instance of <code>MetalSliderUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalSliderUI instance;
- if (o == null)
- {
- instance = new MetalSliderUI();
- instances.put(component, instance);
- }
- else
- instance = (MetalSliderUI) o;
-
- return instance;
+ return new MetalSliderUI();
}
+ /**
+ * Installs the default for this UI delegate in the supplied component.
+ *
+ * @param c the component.
+ */
public void installUI(JComponent c)
{
super.installUI(c);
@@ -140,6 +174,18 @@ public class MetalSliderUI
}
/**
+ * Creates a property change listener for the slider.
+ *
+ * @param slider the slider.
+ *
+ * @return A new instance of {@link MetalPropertyListener}.
+ */
+ protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
+ {
+ return new MetalPropertyListener();
+ }
+
+ /**
* Paints the thumb icon for the slider.
*
* @param g the graphics device.
@@ -153,46 +199,79 @@ public class MetalSliderUI
}
/**
- * Creates a property change listener for the slider.
- *
- * @param slider the slider.
- */
- protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
- {
- // TODO: try to figure out why it might be necessary to override this
- // method as is done in Sun's implementation
- return super.createPropertyChangeListener(slider);
- }
-
- /**
* Paints the track along which the thumb control moves.
*
* @param g the graphics device.
*/
public void paintTrack(Graphics g)
{
+ Color shadowColor = MetalLookAndFeel.getControlShadow();
if (slider.getOrientation() == JSlider.HORIZONTAL)
- {
- if (filledSlider)
{
- // TODO: fill the track
+ int trackX = trackRect.x;
+ int trackY = trackRect.y + (trackRect.height - getTrackWidth()) / 2;
+ int trackW = trackRect.width - 1;
+ int trackH = getTrackWidth();
+
+ // draw border
+ if (slider.isEnabled())
+ BasicGraphicsUtils.drawEtchedRect(g, trackX, trackY, trackW, trackH,
+ darkShadowColor, shadowColor, darkShadowColor, highlightColor);
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawRect(trackX, trackY, trackW - 2, trackH - 2);
+ }
+
+ // fill track (if required)
+ if (filledSlider)
+ {
+ int xPos = xPositionForValue(slider.getValue());
+ int x = (slider.getInverted() ? xPos : trackRect.x);
+ int w = (slider.getInverted() ? trackX + trackW - xPos
+ : xPos - trackRect.x);
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.fillRect(x + 1, trackY + 1, w - 3, getTrackWidth() - 3);
+ if (slider.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(x + 1, trackY + 1, x + w - 3, trackY + 1);
+ g.drawLine(x + 1, trackY + 1, x + 1,
+ trackY + getTrackWidth() - 3);
+ }
+ }
}
- BasicGraphicsUtils.drawEtchedRect(g, trackRect.x, trackRect.y
- + (trackRect.height - getTrackWidth()) / 2, trackRect.width - 1,
- getTrackWidth(), Color.darkGray, Color.gray, Color.darkGray,
- Color.white);
- }
else
- {
- if (filledSlider)
{
- // TODO: fill the track
+ int trackX = trackRect.x + (trackRect.width - getTrackWidth()) / 2;
+ int trackY = trackRect.y;
+ int trackW = getTrackWidth();
+ int trackH = trackRect.height - 1;
+ if (slider.isEnabled())
+ BasicGraphicsUtils.drawEtchedRect(g, trackX, trackY, trackW, trackH,
+ darkShadowColor, shadowColor, darkShadowColor, highlightColor);
+ else
+ {
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.drawRect(trackX, trackY, trackW - 2, trackH - 2);
+ }
+
+ if (filledSlider)
+ {
+ int yPos = yPositionForValue(slider.getValue());
+ int y = (slider.getInverted() ? trackY : yPos);
+ int h = (slider.getInverted() ? yPos - trackY
+ : trackY + trackH - yPos);
+ g.setColor(MetalLookAndFeel.getControlShadow());
+ g.fillRect(trackX + 1, y + 1, getTrackWidth() - 3, h - 3);
+ if (slider.isEnabled())
+ {
+ g.setColor(MetalLookAndFeel.getControl());
+ g.drawLine(trackX + 1, y + 1, trackX + trackW - 3, y + 1);
+ g.drawLine(trackX + 1, y + 1, trackX + 1, y + h - 3);
+ }
+ }
}
- BasicGraphicsUtils.drawEtchedRect(g, trackRect.x + (trackRect.width
- - getTrackWidth()) / 2, trackRect.y, getTrackWidth(),
- trackRect.height - 1, Color.darkGray, Color.gray, Color.darkGray,
- Color.white);
- }
}
/**
@@ -262,12 +341,13 @@ public class MetalSliderUI
*/
protected int getThumbOverhang()
{
- // TODO: figure out what this is used for
+ // FIXME: for what might this method be used?
return 0;
}
protected void scrollDueToClickInTrack(int dir)
{
+ // FIXME: for what might this method be overridden?
super.scrollDueToClickInTrack(dir);
}
@@ -283,8 +363,10 @@ public class MetalSliderUI
{
// Note the incoming 'g' has a translation in place to get us to the
// start of the tick rect already...
- // TODO: get color from UIManager...
- g.setColor(new Color(153, 153, 204));
+ if (slider.isEnabled())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength / 2);
}
@@ -300,8 +382,10 @@ public class MetalSliderUI
{
// Note the incoming 'g' has a translation in place to get us to the
// start of the tick rect already...
- // TODO: get color from UIManager...
- g.setColor(new Color(153, 153, 204));
+ if (slider.isEnabled())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(x, TICK_BUFFER, x, TICK_BUFFER + tickLength);
}
@@ -317,8 +401,10 @@ public class MetalSliderUI
{
// Note the incoming 'g' has a translation in place to get us to the
// start of the tick rect already...
- // TODO: get color from UIManager...
- g.setColor(new Color(153, 153, 204));
+ if (slider.isEnabled())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength / 2, y);
}
@@ -334,8 +420,10 @@ public class MetalSliderUI
{
// Note the incoming 'g' has a translation in place to get us to the
// start of the tick rect already...
- // TODO: get color from UIManager...
- g.setColor(new Color(153, 153, 204));
+ if (slider.isEnabled())
+ g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
+ else
+ g.setColor(MetalLookAndFeel.getControlDisabled());
g.drawLine(TICK_BUFFER - 1, y, TICK_BUFFER - 1 + tickLength, y);
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java b/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java
index 60e9c055952..016e09557d6 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneDivider.java
@@ -78,7 +78,7 @@ class MetalSplitPaneDivider extends BasicSplitPaneDivider
{
//super.paint(g);
Dimension s = getSize();
- MetalUtils.fillMetalPattern(g, 2, 2, s.width - 4, s.height - 4,
+ MetalUtils.fillMetalPattern(splitPane, g, 2, 2, s.width - 4, s.height - 4,
light, dark);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java
index b7ea8984b43..dbcc0910d46 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalSplitPaneUI.java
@@ -39,24 +39,21 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import java.awt.Color;
-import java.util.HashMap;
import javax.swing.JComponent;
-import javax.swing.UIDefaults;
+import javax.swing.JSplitPane;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
-import javax.swing.plaf.basic.BasicSplitPaneUI;
import javax.swing.plaf.basic.BasicSplitPaneDivider;
+import javax.swing.plaf.basic.BasicSplitPaneUI;
-public class MetalSplitPaneUI
- extends BasicSplitPaneUI
+/**
+ * A UI delegate for the {@link JSplitPane} component.
+ */
+public class MetalSplitPaneUI extends BasicSplitPaneUI
{
-
- /** The UI instances for MetalSplitPaneUIs */
- private static HashMap instances;
-
/**
- * Constructs a new instance of MetalSplitPaneUI.
+ * Constructs a new instance of <code>MetalSplitPaneUI</code>.
*/
public MetalSplitPaneUI()
{
@@ -64,28 +61,15 @@ public class MetalSplitPaneUI
}
/**
- * Returns an instance of MetalSplitPaneUI.
+ * Returns a new instance of <code>MetalSplitPaneUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalSplitPaneUI
+ * @return A new instance of <code>MetalSplitPaneUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalSplitPaneUI instance;
- if (o == null)
- {
- instance = new MetalSplitPaneUI();
- instances.put(component, instance);
- }
- else
- instance = (MetalSplitPaneUI) o;
-
- return instance;
+ return new MetalSplitPaneUI();
}
/**
@@ -98,9 +82,8 @@ public class MetalSplitPaneUI
*/
public BasicSplitPaneDivider createDefaultDivider()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- Color light = defaults.getColor("SplitPane.highlight");
- Color dark = defaults.getColor("SplitPane.darkShadow");
+ Color light = UIManager.getColor("SplitPane.highlight");
+ Color dark = UIManager.getColor("SplitPane.darkShadow");
return new MetalSplitPaneDivider(this, light, dark);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java
index 1b5fe144f6c..b1e02c7a6b0 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalTabbedPaneUI.java
@@ -40,7 +40,6 @@ package javax.swing.plaf.metal;
import java.awt.Graphics;
import java.awt.LayoutManager;
-import java.util.HashMap;
import javax.swing.JComponent;
import javax.swing.JTabbedPane;
@@ -48,11 +47,9 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
/**
- * A UI delegate used for the {@link JTabbedPane} component in the
- * {@link MetalLookAndFeel}.
+ * A UI delegate for the {@link JTabbedPane} component.
*/
-public class MetalTabbedPaneUI
- extends BasicTabbedPaneUI
+public class MetalTabbedPaneUI extends BasicTabbedPaneUI
{
/**
@@ -65,13 +62,14 @@ public class MetalTabbedPaneUI
* public for compatibility.
*/
public class TabbedPaneLayout
- extends BasicTabbedPaneUI.TabbedPaneLayout
+ extends BasicTabbedPaneUI.TabbedPaneLayout
{
/**
* Creates a new instance of the layout manager.
*/
public TabbedPaneLayout()
{
+ // Nothing to do here.
}
/**
@@ -102,9 +100,6 @@ public class MetalTabbedPaneUI
}
}
- /** The shared UI instance for JTabbedPanes. */
- private static HashMap instances = null;
-
/**
* Constructs a new instance of MetalTabbedPaneUI.
*/
@@ -122,20 +117,7 @@ public class MetalTabbedPaneUI
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalTabbedPaneUI instance;
- if (o == null)
- {
- instance = new MetalTabbedPaneUI();
- instances.put(component, instance);
- }
- else
- instance = (MetalTabbedPaneUI) o;
-
- return instance;
+ return new MetalTabbedPaneUI();
}
/**
@@ -145,7 +127,7 @@ public class MetalTabbedPaneUI
*/
protected LayoutManager createLayoutManager()
{
- return new TabbedPaneLayout();
+ return super.createLayoutManager();
}
/**
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java
index d6e50e12239..6984daeccbe 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalTextFieldUI.java
@@ -38,19 +38,16 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.util.HashMap;
-
import javax.swing.JComponent;
+import javax.swing.JTextField;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTextFieldUI;
-public class MetalTextFieldUI
- extends BasicTextFieldUI
+/**
+ * A UI delegate for the {@link JTextField} component.
+ */
+public class MetalTextFieldUI extends BasicTextFieldUI
{
-
- /** The UI instances for MetalTextFieldUIs */
- private static HashMap instances = null;
-
/**
* Constructs a new instance of MetalTextFieldUI.
*/
@@ -60,27 +57,14 @@ public class MetalTextFieldUI
}
/**
- * Returns an instance of MetalTextFieldUI.
+ * Returns a new instance of <code>MetalTextFieldUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalTextFieldUI
+ * @return A new instance of <code>MetalTextFieldUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalTextFieldUI instance;
- if (o == null)
- {
- instance = new MetalTextFieldUI();
- instances.put(component, instance);
- }
- else
- instance = (MetalTextFieldUI) o;
-
- return instance;
+ return new MetalTextFieldUI();
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
index be6d0c39ec8..0b56d591442 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java
@@ -39,13 +39,24 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import javax.swing.AbstractButton;
import javax.swing.JComponent;
-import javax.swing.UIDefaults;
+import javax.swing.JToggleButton;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicButtonUI;
import javax.swing.plaf.basic.BasicToggleButtonUI;
+/**
+ * A UI delegate for the {@link JToggleButton} component.
+ */
public class MetalToggleButtonUI
extends BasicToggleButtonUI
{
@@ -59,21 +70,26 @@ public class MetalToggleButtonUI
/** The color for disabled button labels. */
protected Color disabledTextColor;
- /** The shared UI instance for MetalToggleButtonUIs */
- private static MetalToggleButtonUI instance = null;
+ /**
+ * Returns a new instance of <code>MetalToggleButtonUI</code>.
+ *
+ * @param component the component for which we return an UI instance
+ *
+ * @return A new instance of <code>MetalToggleButtonUI</code>.
+ */
+ public static ComponentUI createUI(JComponent component)
+ {
+ return new MetalToggleButtonUI();
+ }
/**
- * Constructs a new instance of MetalToggleButtonUI.
+ * Constructs a new instance of <code>MetalToggleButtonUI</code>.
*/
public MetalToggleButtonUI()
{
super();
- focusColor = getFocusColor();
- selectColor = getSelectColor();
- disabledTextColor = getDisabledTextColor();
}
-
/**
* Returns the color for the focus border.
*
@@ -81,8 +97,7 @@ public class MetalToggleButtonUI
*/
protected Color getFocusColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".focus");
+ return focusColor;
}
/**
@@ -92,32 +107,115 @@ public class MetalToggleButtonUI
*/
protected Color getSelectColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".select");
+ return selectColor;
}
/**
- * Returns the color for the text label of disabled buttons.
+ * Returns the color for the text label of disabled buttons. The value
+ * is initialised in the {@link #installDefaults(AbstractButton)} method
+ * by reading the <code>ToggleButton.disabledText</code> item from the UI
+ * defaults.
*
- * @return the color for the text label of disabled buttons
+ * @return The color for the text label of disabled buttons.
*/
protected Color getDisabledTextColor()
{
- UIDefaults def = UIManager.getLookAndFeelDefaults();
- return def.getColor(getPropertyPrefix() + ".disabledText");
+ return disabledTextColor;
}
/**
- * Returns an instance of MetalToggleButtonUI.
- *
- * @param component the component for which we return an UI instance
- *
- * @return an instance of MetalToggleButtonUI
+ * Updates the button with the defaults for this look and feel.
+ *
+ * @param b the button.
*/
- public static ComponentUI createUI(JComponent component)
+ public void installDefaults(AbstractButton b)
+ {
+ super.installDefaults(b);
+ focusColor = UIManager.getColor(getPropertyPrefix() + "focus");
+ selectColor = UIManager.getColor(getPropertyPrefix() + "select");
+ disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText");
+ }
+
+ /**
+ * Paints the button background when it is pressed/selected.
+ *
+ * @param g the graphics device.
+ * @param b the button.
+ */
+ protected void paintButtonPressed(Graphics g, AbstractButton b)
+ {
+ if (b.isContentAreaFilled() && b.isOpaque())
+ {
+ Color saved = g.getColor();
+ Rectangle bounds = SwingUtilities.getLocalBounds(b);
+ g.setColor(selectColor);
+ g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
+ g.setColor(saved);
+ }
+ }
+
+ /**
+ * Paints the text for the button.
+ *
+ * @param g the graphics device.
+ * @param c the component.
+ * @param textRect the bounds for the text.
+ * @param text the text.
+ *
+ * @deprecated 1.4 Use {@link BasicButtonUI#paintText(java.awt.Graphics,
+ * javax.swing.AbstractButton, java.awt.Rectangle, java.lang.String)}.
+ */
+ protected void paintText(Graphics g, JComponent c, Rectangle textRect,
+ String text)
+ {
+ Font savedFont = g.getFont();
+ Color savedColor = g.getColor();
+ g.setFont(c.getFont());
+ if (c.isEnabled())
+ g.setColor(c.getForeground());
+ else
+ g.setColor(disabledTextColor);
+ FontMetrics fm = g.getFontMetrics(c.getFont());
+ int ascent = fm.getAscent();
+ g.drawString(text, textRect.x, textRect.y + ascent);
+ g.setFont(savedFont);
+ g.setColor(savedColor);
+ }
+
+ /**
+ * Draws the focus highlight around the text and icon.
+ *
+ * @param g the graphics device.
+ * @param b the button.
+ */
+ protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect,
+ Rectangle textRect, Rectangle iconRect)
+ {
+ if (!b.hasFocus())
+ return;
+ Color saved = g.getColor();
+ g.setColor(focusColor);
+ Rectangle fr = iconRect.union(textRect);
+ g.drawRect(fr.x - 1, fr.y - 1, fr.width + 1, fr.height + 1);
+ g.setColor(saved);
+ }
+
+ /**
+ * If the property <code>ToggleButton.gradient</code> is set, then a gradient
+ * is painted as background, otherwise the normal superclass behaviour is
+ * called.
+ */
+ public void update(Graphics g, JComponent c)
{
- if (instance == null)
- instance = new MetalToggleButtonUI();
- return instance;
+ if (c.isOpaque() && UIManager.get(getPropertyPrefix() + "gradient") != null)
+ {
+ MetalUtils.paintGradient(g, 0, 0, c.getWidth(), c.getHeight(),
+ SwingConstants.VERTICAL,
+ getPropertyPrefix() + "gradient");
+ paint(g, c);
+ }
+ else
+ super.update(g, c);
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java
index 39af0011ae6..c5ca91399ab 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalToolBarUI.java
@@ -38,20 +38,73 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.event.ContainerListener;
+import java.beans.PropertyChangeListener;
+
import javax.swing.JComponent;
+import javax.swing.JToolBar;
+import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicToolBarUI;
-public class MetalToolBarUI
- extends BasicToolBarUI
+/**
+ * A UI delegate for the {@link JToolBar} component.
+ */
+public class MetalToolBarUI extends BasicToolBarUI
{
+
+ /**
+ * A listener (no longer used) that responds when components are added to or
+ * removed from the {@link JToolBar}. The required behaviour is now
+ * handled in the super class.
+ *
+ * @see MetalToolBarUI#createContainerListener()
+ */
+ protected class MetalContainerListener
+ extends BasicToolBarUI.ToolBarContListener
+ {
+ /**
+ * Creates a new instance.
+ */
+ protected MetalContainerListener()
+ {
+ // Nothing to do here.
+ }
+ }
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for MetalToolBarUIs */
- private static MetalToolBarUI instance = null;
+ /**
+ * A listener (no longer used) that responds to property change events in a
+ * {@link JToolBar} component. The required behaviour is now handled in the
+ * super class.
+ *
+ * @see MetalToolBarUI#createRolloverListener()
+ */
+ protected class MetalRolloverListener
+ extends BasicToolBarUI.PropertyListener
+ {
+ /**
+ * Creates a new instance.
+ */
+ protected MetalRolloverListener()
+ {
+ // Nothing to do here.
+ }
+ }
+
+ /**
+ * The container listener (an implementation specific field, according to the
+ * spec, and not used in GNU Classpath).
+ */
+ protected ContainerListener contListener;
+
+ /**
+ * The rollover listener (an implementation specific field, according to the
+ * spec, and not used in GNU Classpath).
+ */
+ protected PropertyChangeListener rolloverListener;
/**
- * Constructs a new instance of MetalToolBarUI.
+ * Creates a new instance of this UI delegate.
*/
public MetalToolBarUI()
{
@@ -59,16 +112,51 @@ public class MetalToolBarUI
}
/**
- * Returns an instance of MetalToolBarUI.
+ * Returns a new instance of <code>MetalToolBarUI</code>.
*
- * @param component the component for which we return an UI instance
+ * @param component the component for which we return an UI instance
*
- * @return an instance of MetalToolBarUI
+ * @return A new instance of <code>MetalToolBarUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalToolBarUI();
- return instance;
+ return new MetalToolBarUI();
+ }
+
+ /**
+ * Returns <code>null</code> as permitted by recent versions of the API
+ * specification. Originally it seems this method returned a new instance of
+ * {@link MetalRolloverListener}, but this is now redundant.
+ *
+ * @return <code>null</code>.
+ */
+ protected PropertyChangeListener createRolloverListener()
+ {
+ return null;
+ }
+
+ /**
+ * Returns <code>null</code> as permitted by recent versions of the API
+ * specification. Originally it seems this method returned a new instance of
+ * {@link MetalContainerListener}, but this is now redundant.
+ *
+ * @return <code>null</code>.
+ */
+ protected ContainerListener createContainerListener()
+ {
+ return null;
+ }
+
+ /**
+ * Returns a border with no rollover effect for buttons in the tool bar.
+ *
+ * @return A border.
+ *
+ * @see MetalBorders#getToolbarButtonBorder()
+ */
+ protected Border createNonRolloverBorder()
+ {
+ return MetalBorders.getToolbarButtonBorder();
}
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java
index c88b6534ab7..f183ed5a149 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalToolTipUI.java
@@ -38,32 +38,90 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.AbstractButton;
import javax.swing.JComponent;
+import javax.swing.JMenuItem;
+import javax.swing.JToolTip;
+import javax.swing.KeyStroke;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicToolTipUI;
+/**
+ * A UI delegate for the {@link JToolTip} component.
+ */
public class MetalToolTipUI
extends BasicToolTipUI
{
+ /**
+ * The amount of space between the tool tip text and the accelerator
+ * description (if visible).
+ */
+ public static final int padSpaceBetweenStrings = 12;
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for MetalToolTipUIs */
+ /** The shared UI instance. */
private static MetalToolTipUI instance = null;
-
+
+ /** A flag controlling the visibility of the accelerator (if there is one). */
+ private boolean isAcceleratorHidden;
+
+ /** A string representing the accelerator key for the component. */
+ private String acceleratorString;
+
+ /**
+ * The delimiter for the accelerator string.
+ */
+ private String acceleratorDelimiter;
+
+ /** The font for the accelerator string. */
+ private Font acceleratorFont;
+
+ /** The color for the accelerator string. */
+ private Color acceleratorForeground;
+
+ /** The active border. */
+ private Border activeBorder;
+
+ /** The inactive border. */
+ private Border inactiveBorder;
+
/**
- * Constructs a new instance of MetalToolTipUI.
+ * Constructs a new instance of <code>MetalToolTipUI</code>.
*/
public MetalToolTipUI()
{
super();
+ activeBorder = UIManager.getBorder("ToolTip.border");
+ inactiveBorder = UIManager.getBorder("ToolTip.borderInactive");
+ isAcceleratorHidden = UIManager.getBoolean("ToolTip.hideAccelerator");
+ acceleratorFont = UIManager.getFont("MenuItem.acceleratorFont");
+ acceleratorForeground = UIManager.getColor("MenuItem.acceleratorForeground");
+ acceleratorDelimiter = UIManager.getString("MenuItem.acceleratorDelimiter");
}
/**
- * Returns an instance of MetalToolTipUI.
+ * Returns a shared instance of the <code>MetalToolTipUI</code> class.
+ * Although this UI delegate does maintain state information, there is never
+ * more than one tool tip visible, so it is OK to use a shared instance.
*
- * @param component the component for which we return an UI instance
+ * @param component the component (a {@link JToolTip}).
*
- * @return an instance of MetalToolTipUI
+ * @return A shared instance of the <code>MetalToolTipUI</code> class.
*/
public static ComponentUI createUI(JComponent component)
{
@@ -71,4 +129,202 @@ public class MetalToolTipUI
instance = new MetalToolTipUI();
return instance;
}
+
+ /**
+ * Returns a string representing the accelerator key (if there is one) for
+ * the component that the tool tip belongs to.
+ *
+ * @return A string representing the accelerator key.
+ */
+ public String getAcceleratorString()
+ {
+ return acceleratorString;
+ }
+
+ /**
+ * Installs the UI for the specified component (a {@link JToolTip}).
+ *
+ * @param c the {@link JToolTip} component.
+ */
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+ Border existingBorder = c.getBorder();
+ if (existingBorder == null || existingBorder instanceof UIResource)
+ {
+ if (c.isEnabled())
+ c.setBorder(activeBorder);
+ else
+ c.setBorder(inactiveBorder);
+ }
+ }
+
+ /**
+ * Clears the defaults set in {@link #installUI(JComponent)}.
+ *
+ * @param c the component.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ super.uninstallUI(c);
+ if (c.getBorder() instanceof UIResource)
+ c.setBorder(null);
+ }
+
+ /**
+ * Returns <code>true</code> if the accelerator string is hidden, and
+ * <code>false</code> otherwise. This setting is controlled by the
+ * <code>ToolTip.hideAccelerator</code> entry in the UI defaults table.
+ *
+ * @return A boolean.
+ */
+ protected boolean isAcceleratorHidden()
+ {
+ return isAcceleratorHidden;
+ }
+
+ /**
+ * Returns the preferred size for the {@link JToolTip} component.
+ *
+ * @param c the component (a {@link JToolTip}).
+ *
+ * @return The preferred size.
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ if (isAcceleratorHidden())
+ return super.getPreferredSize(c);
+ else
+ {
+ Insets insets = c.getInsets();
+ JToolTip tt = (JToolTip) c;
+ String tipText = tt.getTipText();
+ if (tipText != null)
+ {
+ FontMetrics fm = c.getFontMetrics(c.getFont());
+ int prefH = fm.getHeight() + insets.top + insets.bottom;
+ int prefW = fm.stringWidth(tipText) + insets.left + insets.right;
+
+ // this seems to be the first opportunity we have to get the
+ // accelerator string from the component (if it has one)
+ acceleratorString = fetchAcceleratorString(c);
+ if (acceleratorString != null)
+ {
+ prefW += padSpaceBetweenStrings;
+ fm = c.getFontMetrics(acceleratorFont);
+ prefW += fm.stringWidth(acceleratorString);
+ }
+ return new Dimension(prefW, prefH);
+ }
+ else return new Dimension(0, 0);
+ }
+ }
+
+ /**
+ * Paints the tool tip.
+ *
+ * @param g the graphics context.
+ * @param c the {@link JToolTip} component.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ JToolTip tip = (JToolTip) c;
+
+ String text = tip.getTipText();
+ Toolkit t = tip.getToolkit();
+ if (text == null)
+ return;
+
+ Rectangle vr = new Rectangle();
+ vr = SwingUtilities.calculateInnerArea(tip, vr);
+ Rectangle ir = new Rectangle();
+ Rectangle tr = new Rectangle();
+ FontMetrics fm = t.getFontMetrics(tip.getFont());
+ int ascent = fm.getAscent();
+ SwingUtilities.layoutCompoundLabel(tip, fm, text, null,
+ SwingConstants.CENTER, SwingConstants.LEFT,
+ SwingConstants.CENTER, SwingConstants.CENTER, vr, ir, tr, 0);
+ Color saved = g.getColor();
+ g.setColor(Color.BLACK);
+
+ g.drawString(text, vr.x, vr.y + ascent);
+
+ // paint accelerator
+ if (acceleratorString != null)
+ {
+ g.setFont(acceleratorFont);
+ g.setColor(acceleratorForeground);
+ fm = t.getFontMetrics(acceleratorFont);
+ int width = fm.stringWidth(acceleratorString);
+ g.drawString(acceleratorString, vr.x + vr.width - width - padSpaceBetweenStrings/2,
+ vr.y + vr.height - fm.getDescent());
+ }
+
+ g.setColor(saved);
+ }
+
+ /**
+ * Returns a string representing the accelerator for the component, or
+ * <code>null</code> if the component has no accelerator.
+ *
+ * @param c the component.
+ *
+ * @return A string representing the accelerator (possibly
+ * <code>null</code>).
+ */
+ private String fetchAcceleratorString(JComponent c)
+ {
+ String result = null;
+ if (c instanceof JToolTip)
+ {
+ JToolTip toolTip = (JToolTip) c;
+ JComponent component = toolTip.getComponent();
+ KeyStroke ks = null;
+ int mne = 0;
+ if (component instanceof JMenuItem)
+ {
+ JMenuItem item = (JMenuItem) component;
+ ks = item.getAccelerator();
+ if (ks == null)
+ mne = item.getMnemonic();
+ }
+ else if (component instanceof AbstractButton)
+ {
+ AbstractButton button = (AbstractButton) component;
+ mne = button.getMnemonic();
+ }
+ if (mne > 0)
+ ks = KeyStroke.getKeyStroke(Character.toUpperCase((char) mne),
+ InputEvent.ALT_MASK, false);
+ if (ks != null)
+ result = acceleratorToString(ks);
+ }
+ return result;
+ }
+
+ /**
+ * Returns a string representing an accelerator.
+ *
+ * @param accelerator the accelerator (<code>null</code> not permitted).
+ *
+ * @return A string representing an accelerator.
+ */
+ private String acceleratorToString(KeyStroke accelerator)
+ {
+ // convert keystroke into string format
+ String modifiersText = "";
+ int modifiers = accelerator.getModifiers();
+ char keyChar = accelerator.getKeyChar();
+ int keyCode = accelerator.getKeyCode();
+
+ if (modifiers != 0)
+ modifiersText = KeyEvent.getKeyModifiersText(modifiers)
+ + acceleratorDelimiter;
+
+ if (keyCode == KeyEvent.VK_UNDEFINED)
+ return modifiersText + keyChar;
+ else
+ return modifiersText + KeyEvent.getKeyText(keyCode);
+ }
+
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java b/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java
index 8d16f7463fe..24432a2b5f6 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalTreeUI.java
@@ -38,21 +38,23 @@ exception statement from your version. */
package javax.swing.plaf.metal;
-import java.util.HashMap;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
import javax.swing.JComponent;
+import javax.swing.JTree;
+import javax.swing.tree.TreePath;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTreeUI;
-public class MetalTreeUI
- extends BasicTreeUI
+/**
+ * A UI delegate for the {@link JTree} component.
+ */
+public class MetalTreeUI extends BasicTreeUI
{
-
- /** The UI instances for MetalTreeUIs */
- private static HashMap instances = null;
-
/**
- * Constructs a new instance of MetalTreeUI.
+ * Constructs a new instance of <code>MetalTreeUI</code>.
*/
public MetalTreeUI()
{
@@ -60,27 +62,152 @@ public class MetalTreeUI
}
/**
- * Returns an instance of MetalTreeUI.
+ * Returns a new instance of <code>MetalTreeUI</code>.
*
* @param component the component for which we return an UI instance
*
- * @return an instance of MetalTreeUI
+ * @return A new instance of <code>MetalTreeUI</code>.
*/
public static ComponentUI createUI(JComponent component)
{
- if (instances == null)
- instances = new HashMap();
-
- Object o = instances.get(component);
- MetalTreeUI instance;
- if (o == null)
- {
- instance = new MetalTreeUI();
- instances.put(component, instance);
- }
- else
- instance = (MetalTreeUI) o;
-
- return instance;
+ return new MetalTreeUI();
+ }
+
+ /**
+ * The horizontal element of legs between nodes starts at the right of the
+ * left-hand side of the child node by default. This method makes the
+ * leg end before that.
+ */
+ protected int getHorizontalLegBuffer()
+ {
+ return super.getHorizontalLegBuffer();
+ }
+
+ /**
+ * Configures the specified component appropriate for the look and feel.
+ * This method is invoked when the ComponentUI instance is being installed
+ * as the UI delegate on the specified component. This method should completely
+ * configure the component for the look and feel, including the following:
+ * 1. Install any default property values for color, fonts, borders, icons,
+ * opacity, etc. on the component. Whenever possible, property values
+ * initialized by the client program should not be overridden.
+ * 2. Install a LayoutManager on the component if necessary.
+ * 3. Create/add any required sub-components to the component.
+ * 4. Create/install event listeners on the component.
+ * 5. Create/install a PropertyChangeListener on the component in order
+ * to detect and respond to component property changes appropriately.
+ * 6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
+ * 7. Initialize any appropriate instance data.
+ */
+ public void installUI(JComponent c)
+ {
+ // TODO: What to do here, if anything?
+ super.installUI(c);
+ }
+
+ /**
+ * Reverses configuration which was done on the specified component during
+ * installUI. This method is invoked when this UIComponent instance is being
+ * removed as the UI delegate for the specified component. This method should
+ * undo the configuration performed in installUI, being careful to leave the
+ * JComponent instance in a clean state (no extraneous listeners,
+ * look-and-feel-specific property objects, etc.). This should include
+ * the following:
+ * 1. Remove any UI-set borders from the component.
+ * 2. Remove any UI-set layout managers on the component.
+ * 3. Remove any UI-added sub-components from the component.
+ * 4. Remove any UI-added event/property listeners from the component.
+ * 5. Remove any UI-installed keyboard UI from the component.
+ * 6. Nullify any allocated instance data objects to allow for GC.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ // TODO: What to do here?
+ super.uninstallUI(c);
+ }
+
+ /**
+ * This function converts between the string passed into the client
+ * property and the internal representation (currently an int).
+ *
+ * @param lineStyleFlag - String representation
+ */
+ protected void decodeLineStyle(Object lineStyleFlag)
+ {
+ // FIXME: not implemented
+ }
+
+ /**
+ * Checks if the location is in expand control.
+ *
+ * @param row - current row
+ * @param rowLevel - current level
+ * @param mouseX - current x location of the mouse click
+ * @param mouseY - current y location of the mouse click
+ */
+ protected boolean isLocationInExpandControl(int row, int rowLevel,
+ int mouseX, int mouseY)
+ {
+ return super.isLocationInExpandControl(tree.getPathForRow(row),
+ mouseX, mouseY);
+ }
+
+ /**
+ * Paints the specified component appropriate for the look and feel.
+ * This method is invoked from the ComponentUI.update method when the
+ * specified component is being painted. Subclasses should override this
+ * method and use the specified Graphics object to render the content of
+ * the component.
+ *
+ * @param g - the current graphics configuration.
+ * @param c - the current component to draw
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ // Calls BasicTreeUI's paint since it takes care of painting all
+ // types of icons.
+ super.paint(g, c);
+ }
+
+ /**
+ * Paints the horizontal separators.
+ *
+ * @param g - the current graphics configuration.
+ * @param c - the current component to draw
+ */
+ protected void paintHorizontalSeparators(Graphics g, JComponent c)
+ {
+ // FIXME: not implemented
+ }
+
+
+ /**
+ * Paints the vertical part of the leg. The receiver should NOT modify
+ * clipBounds, insets.
+ *
+ * @param g - the current graphics configuration.
+ * @param clipBounds -
+ * @param insets -
+ * @param path - the current path
+ */
+ protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds,
+ Insets insets, TreePath path)
+ {
+ super.paintVerticalPartOfLeg(g, clipBounds, insets, path);
+ }
+
+ /**
+ * Paints the horizontal part of the leg. The receiver should NOT \
+ * modify clipBounds, or insets.
+ * NOTE: parentRow can be -1 if the root is not visible.
+ */
+ protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
+ Insets insets, Rectangle bounds,
+ TreePath path, int row,
+ boolean isExpanded, boolean hasBeenExpanded,
+ boolean isLeaf)
+ {
+ super.paintHorizontalPartOfLeg(g, clipBounds, insets, bounds, path, row,
+ isExpanded, hasBeenExpanded, isLeaf);
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/MetalUtils.java b/libjava/classpath/javax/swing/plaf/metal/MetalUtils.java
index a342ee02bd3..50112ce2161 100644
--- a/libjava/classpath/javax/swing/plaf/metal/MetalUtils.java
+++ b/libjava/classpath/javax/swing/plaf/metal/MetalUtils.java
@@ -1,4 +1,4 @@
-/* Metaltils.java
+/* MetalUtils.java
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,16 @@ exception statement from your version. */
package javax.swing.plaf.metal;
import java.awt.Color;
+import java.awt.Component;
import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.TexturePaint;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.util.List;
+
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
/**
* Some utility and helper methods for the Metal Look &amp; Feel.
@@ -49,6 +58,21 @@ class MetalUtils
{
/**
+ * The typical metal pattern for use with Graphics2D.
+ */
+ static BufferedImage pattern2D;
+
+ /**
+ * The light color to draw the pattern.
+ */
+ static Color lightColor;
+
+ /**
+ * The dark color to draw to draw the pattern.
+ */
+ static Color darkColor;
+
+ /**
* Fills a rectangle with the typical Metal pattern.
*
* @param g the <code>Graphics</code> context to use
@@ -57,31 +81,326 @@ class MetalUtils
* @param y the Y coordinate of the upper left corner of the rectangle to
* fill
* @param w the width of the rectangle to fill
- * @param w the height of the rectangle to fill
+ * @param h the height of the rectangle to fill
* @param light the light color to use
* @param dark the dark color to use
*/
- static void fillMetalPattern(Graphics g, int x, int y, int w, int h,
+ static void fillMetalPattern(Component c, Graphics g, int x, int y, int w, int h,
Color light, Color dark)
{
- int xOff = 0;
- for (int mY = y; mY < (y + h); mY++)
+ if (g instanceof Graphics2D)
+ fillMetalPattern2D((Graphics2D) g, x, y, w, h, light, dark);
+ else
{
- // set color alternating with every line
- if ((mY % 2) == 0)
- g.setColor(light);
- else
- g.setColor(dark);
-
- for (int mX = x + (xOff); mX < (x + w); mX += 4)
+ int xOff = 0;
+ for (int mY = y; mY < (y + h); mY++)
{
- g.drawLine(mX, mY, mX, mY);
+ // set color alternating with every line
+ if (((mY - y) % 2) == 0)
+ g.setColor(light);
+ else
+ g.setColor(dark);
+
+ for (int mX = x + (xOff); mX < (x + w); mX += 4)
+ {
+ g.drawLine(mX, mY, mX, mY);
+ }
+
+ // increase x offset
+ xOff++;
+ if (xOff > 3)
+ xOff = 0;
}
+ }
+ }
+
+ /**
+ * Fills a rectangle with the typical Metal pattern using Java2D.
+ *
+ * @param g2d the <code>Graphics2D</code> context to use
+ * @param x the X coordinate of the upper left corner of the rectangle to
+ * fill
+ * @param y the Y coordinate of the upper left corner of the rectangle to
+ * fill
+ * @param w the width of the rectangle to fill
+ * @param h the height of the rectangle to fill
+ */
+ static void fillMetalPattern2D(Graphics2D g2d, int x, int y, int w, int h,
+ Color light, Color dark)
+ {
+ if (pattern2D == null || !darkColor.equals(dark) || !lightColor.equals(light))
+ initializePattern(light, dark);
+
+ // Prepare the texture.
+ TexturePaint texture =
+ new TexturePaint(pattern2D, new Rectangle2D.Double(0., 0., 4., 4.));
+ g2d.setPaint(texture);
+ g2d.fillRect(x, y, w, h);
+ }
+
+ /**
+ * Initializes the pattern image.
+ */
+ static void initializePattern(Color light, Color dark)
+ {
+ pattern2D = new BufferedImage(4, 4, BufferedImage.TYPE_INT_ARGB);
+ lightColor = light;
+ darkColor = dark;
+ Graphics g = pattern2D.getGraphics();
+ g.setColor(light);
+ g.fillRect(0, 0, 1, 1);
+ g.fillRect(2, 2, 1, 1);
+ g.setColor(dark);
+ g.fillRect(1, 1, 1, 1);
+ g.fillRect(3, 3, 1, 1);
+ g.dispose();
+ }
+
+ /**
+ * Paints the typical Metal gradient. See {@link #paintGradient(Graphics,
+ * int, int, int, int, double, double, Color, Color, Color, int)}
+ * for more details.
+ *
+ * The parameters are fetched from the UIManager using the key
+ * <code>uiProp</code>. The value is expected to be a {@link List} that
+ * contains 4 values: two {@link Double}s and 3 {@link Color} object that
+ * together make up the parameters passed to the painting method.
+ *
+ * @param g the graphics context to use
+ * @param x the X coordinate of the upper left corner of the rectangle
+ * @param y the Y coordinate of the upper left corner of the rectangle
+ * @param w the width of the rectangle
+ * @param h the height of the rectangle
+ * @param dir the direction of the gradient, either
+ * @param uiProp the key of the UIManager property that has the parameters
+ */
+ static void paintGradient(Graphics g, int x, int y, int w, int h,
+ int dir, String uiProp)
+ {
+ List params = (List) UIManager.get(uiProp);
+ double g1 = ((Double) params.get(0)).doubleValue();
+ double g2 = ((Double) params.get(1)).doubleValue();
+ Color c1 = (Color) params.get(2);
+ Color c2 = (Color) params.get(3);
+ Color c3 = (Color) params.get(4);
+ paintGradient(g, x, y, w, h, g1, g2, c1, c2, c3, dir);
+ }
+
+ /**
+ * Paints the typical Metal gradient. The gradient is painted as follows:
+ * <pre>
+ *
+ * +-------+--------+--------+-----------------------------+
+ * | | | | |
+ * +-------+--------+--------+-----------------------------+
+ * c1 -> c2 -- c2 -> c1 --------> c3
+ * < -g1- > < -g2- > < -g1- >
+ * </pre>
+ *
+ * There are 4 distinct areas in this gradient:
+ * <ol>
+ * <li>A gradient from color 1 to color 2 with the relative width specified
+ * by <code>g1</code></li>
+ * <li>A solid area with the color 2 and the relative width specified by
+ * <code>g2</code></li>
+ * <li>A gradient from color 2 to color 1 with the relative width specified
+ * by <code>g1</code></li>
+ *
+ * @param g the graphics context to use
+ * @param x the X coordinate of the upper left corner of the rectangle
+ * @param y the Y coordinate of the upper left corner of the rectangle
+ * @param w the width of the rectangle
+ * @param h the height of the rectangle
+ * @param g1 the relative width of the c1->c2 gradients
+ * @param g2 the relative width of the c2 solid area
+ * @param c1 the color 1
+ * @param c2 the color 2
+ * @param c3 the color 3
+ * @param dir the direction of the gradient, either
+ * {@link SwingConstants#HORIZONTAL} or {@link SwingConstants#VERTICAL}
+ */
+ static void paintGradient(Graphics g, int x, int y, int w, int h, double g1,
+ double g2, Color c1, Color c2, Color c3, int dir)
+ {
+ if (dir == SwingConstants.HORIZONTAL)
+ paintHorizontalGradient(g, x, y, w, h, g1, g2, c1, c2, c3);
+ else
+ paintVerticalGradient(g, x, y, w, h, g1, g2, c1, c2, c3);
+ }
+
+ /**
+ * Paints a horizontal gradient. See {@link #paintGradient(Graphics, int,
+ * int, int, int, double, double, Color, Color, Color, int)} for details.
+ *
+ * @param x the X coordinate of the upper left corner of the rectangle
+ * @param y the Y coordinate of the upper left corner of the rectangle
+ * @param w the width of the rectangle
+ * @param h the height of the rectangle
+ * @param g1 the relative width of the c1->c2 gradients
+ * @param g2 the relative width of the c2 solid area
+ * @param c1 the color 1
+ * @param c2 the color 2
+ * @param c3 the color 3
+ */
+ static void paintHorizontalGradient(Graphics g, int x, int y, int w, int h,
+ double g1, double g2, Color c1, Color c2,
+ Color c3)
+ {
+ // Calculate the coordinates.
+ // The size of the first gradient area (c1->2).
+ int w1 = (int) (w * g1);
+ // The size of the solid c2 area.
+ int w2 = (int) (w * g2);
+ int x0 = x;
+ int x1 = x0 + w1;
+ int x2 = x1 + w2;
+ int x3 = x2 + w1;
+ int x4 = x + w;
+
+ // Paint first gradient area (c1->c2).
+ int xc; // The current y coordinate.
+ for (xc = x0; xc < x1; xc++)
+ {
+ if (xc > x + w)
+ break;
+
+ // Perform color interpolation;
+ double factor = (xc - x0) / (double) w1;
+ int rInt = (int) ((c2.getRed() - c1.getRed()) * factor + c1.getRed());
+ int gInt = (int) ((c2.getGreen() - c1.getGreen()) * factor
+ + c1.getGreen());
+ int bInt = (int) ((c2.getBlue() - c1.getBlue()) * factor
+ + c1.getBlue());
+ Color interpolated = new Color(rInt, gInt, bInt);
+ g.setColor(interpolated);
+ g.drawLine(xc, y, xc, y + h);
+ }
+ // Paint solid c2 area.
+ g.setColor(c2);
+ g.fillRect(x1, y, x2 - x1, h);
+
+ // Paint second gradient area (c2->c1).
+ for (xc = x2; xc < x3; xc++)
+ {
+ if (xc > x + w)
+ break;
+
+ // Perform color interpolation;
+ double factor = (xc - x2) / (double) w1;
+ int rInt = (int) ((c1.getRed() - c2.getRed()) * factor + c2.getRed());
+ int gInt = (int) ((c1.getGreen() - c2.getGreen()) * factor
+ + c2.getGreen());
+ int bInt = (int) ((c1.getBlue() - c2.getBlue()) * factor
+ + c2.getBlue());
+ Color interpolated = new Color(rInt, gInt, bInt);
+ g.setColor(interpolated);
+ g.drawLine(xc, y, xc, y + h);
+ }
+
+ // Paint third gradient area (c1->c3).
+ for (xc = x3; xc < x4; xc++)
+ {
+ if (xc > x + w)
+ break;
+
+ // Perform color interpolation;
+ double factor = (xc - x3) / (double) (x4 - x3);
+ int rInt = (int) ((c3.getRed() - c1.getRed()) * factor + c1.getRed());
+ int gInt = (int) ((c3.getGreen() - c1.getGreen()) * factor
+ + c1.getGreen());
+ int bInt = (int) ((c3.getBlue() - c1.getBlue()) * factor
+ + c1.getBlue());
+ Color interpolated = new Color(rInt, gInt, bInt);
+ g.setColor(interpolated);
+ g.drawLine(xc, y, xc, y + h);
+ }
+ }
+
+ /**
+ * Paints a vertical gradient. See {@link #paintGradient(Graphics, int, int,
+ * int, int, double, double, Color, Color, Color, int)} for details.
+ *
+ * @param x the X coordinate of the upper left corner of the rectangle
+ * @param y the Y coordinate of the upper left corner of the rectangle
+ * @param w the width of the rectangle
+ * @param h the height of the rectangle
+ * @param g1 the relative width of the c1->c2 gradients
+ * @param g2 the relative width of the c2 solid area
+ * @param c1 the color 1
+ * @param c2 the color 2
+ * @param c3 the color 3
+ */
+ static void paintVerticalGradient(Graphics g, int x, int y, int w, int h,
+ double g1, double g2, Color c1, Color c2,
+ Color c3)
+ {
+ // Calculate the coordinates.
+ // The size of the first gradient area (c1->2).
+ int w1 = (int) (h * g1);
+ // The size of the solid c2 area.
+ int w2 = (int) (h * g2);
+ int y0 = y;
+ int y1 = y0 + w1;
+ int y2 = y1 + w2;
+ int y3 = y2 + w1;
+ int y4 = y + h;
+
+ // Paint first gradient area (c1->c2).
+ int yc; // The current y coordinate.
+ for (yc = y0; yc < y1; yc++)
+ {
+ if (yc > y + h)
+ break;
+
+ // Perform color interpolation;
+ double factor = (yc - y0) / (double) w1;
+ int rInt = (int) ((c2.getRed() - c1.getRed()) * factor + c1.getRed());
+ int gInt = (int) ((c2.getGreen() - c1.getGreen()) * factor
+ + c1.getGreen());
+ int bInt = (int) ((c2.getBlue() - c1.getBlue()) * factor
+ + c1.getBlue());
+ Color interpolated = new Color(rInt, gInt, bInt);
+ g.setColor(interpolated);
+ g.drawLine(x, yc, x + w, yc);
+ }
+ // Paint solid c2 area.
+ g.setColor(c2);
+ g.fillRect(x, y1, w, y2 - y1);
+
+ // Paint second gradient area (c2->c1).
+ for (yc = y2; yc < y3; yc++)
+ {
+ if (yc > y + h)
+ break;
+
+ // Perform color interpolation;
+ double factor = (yc - y2) / (double) w1;
+ int rInt = (int) ((c1.getRed() - c2.getRed()) * factor + c2.getRed());
+ int gInt = (int) ((c1.getGreen() - c2.getGreen()) * factor
+ + c2.getGreen());
+ int bInt = (int) ((c1.getBlue() - c2.getBlue()) * factor
+ + c2.getBlue());
+ Color interpolated = new Color(rInt, gInt, bInt);
+ g.setColor(interpolated);
+ g.drawLine(x, yc, x + w, yc);
+ }
+
+ // Paint third gradient area (c1->c3).
+ for (yc = y3; yc < y4; yc++)
+ {
+ if (yc > y + h)
+ break;
- // increase x offset
- xOff++;
- if (xOff > 3)
- xOff = 0;
+ // Perform color interpolation;
+ double factor = (yc - y3) / (double) (y4 - y3);
+ int rInt = (int) ((c3.getRed() - c1.getRed()) * factor + c1.getRed());
+ int gInt = (int) ((c3.getGreen() - c1.getGreen()) * factor
+ + c1.getGreen());
+ int bInt = (int) ((c3.getBlue() - c1.getBlue()) * factor
+ + c1.getBlue());
+ Color interpolated = new Color(rInt, gInt, bInt);
+ g.setColor(interpolated);
+ g.drawLine(x, yc, x + w, yc);
}
}
}
diff --git a/libjava/classpath/javax/swing/plaf/metal/OceanTheme.java b/libjava/classpath/javax/swing/plaf/metal/OceanTheme.java
new file mode 100644
index 00000000000..f1886b167cf
--- /dev/null
+++ b/libjava/classpath/javax/swing/plaf/metal/OceanTheme.java
@@ -0,0 +1,243 @@
+/* DefaultMetalTheme.java -- A modern theme for the Metal L&F
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.metal;
+
+import java.awt.Color;
+import java.util.Arrays;
+
+import javax.swing.UIDefaults;
+import javax.swing.plaf.ColorUIResource;
+
+/**
+ * A modern theme for the Metal Look &amp; Feel.
+ * @since 1.5
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+public class OceanTheme extends DefaultMetalTheme
+{
+ /**
+ * The OceanTheme value for black.
+ */
+ static final ColorUIResource BLACK = new ColorUIResource(51, 51, 51);
+
+ /**
+ * The OceanTheme value for primary1.
+ */
+ static final ColorUIResource PRIMARY1 = new ColorUIResource(99, 130, 191);
+
+ /**
+ * The OceanTheme value for primary1.
+ */
+ static final ColorUIResource PRIMARY2 = new ColorUIResource(163, 184, 204);
+
+ /**
+ * The OceanTheme value for primary1.
+ */
+ static final ColorUIResource PRIMARY3 = new ColorUIResource(184, 207, 229);
+
+ /**
+ * The OceanTheme value for secondary1.
+ */
+ static final ColorUIResource SECONDARY1 = new ColorUIResource(122, 138, 153);
+
+ /**
+ * The OceanTheme value for secondary2.
+ */
+ static final ColorUIResource SECONDARY2 = new ColorUIResource(184, 207, 229);
+
+ /**
+ * The OceanTheme value for secondary3.
+ */
+ static final ColorUIResource SECONDARY3 = new ColorUIResource(238, 238, 238);
+
+ /**
+ * The OceanTheme value for inactive control text.
+ */
+ static final ColorUIResource INACTIVE_CONTROL_TEXT =
+ new ColorUIResource(153, 153, 153);
+
+ /**
+ * Returns the name of this theme, &quot;Ocean&quot;
+ */
+ public String getName()
+ {
+ return "Ocean";
+ }
+
+ /**
+ * Returns the color for control text, which is the
+ * value of the theme's black value.
+ */
+ public ColorUIResource getControlTextColor()
+ {
+ return getBlack();
+ }
+
+ /**
+ * Returns the desktop color, which is the theme's white color.
+ */
+ public ColorUIResource getDesktopColor()
+ {
+ return getWhite();
+ }
+
+ /**
+ * Returns the color for inactive control text, which is the
+ * RGB value (153, 153, 153).
+ */
+ public ColorUIResource getInactiveControlTextColor()
+ {
+ return INACTIVE_CONTROL_TEXT;
+ }
+
+ /**
+ * Returns the OceanTheme's color for disabled menu foreground,
+ *
+ */
+ public ColorUIResource getMenuDisabledForeground()
+ {
+ return INACTIVE_CONTROL_TEXT;
+ }
+
+
+ /**
+ * Returns the OceanTheme's color for black, the RGB value
+ * (51, 51, 51).
+ *
+ * @return Returns the OceanTheme's value for black
+ */
+ protected ColorUIResource getBlack()
+ {
+ return BLACK;
+ }
+
+ /**
+ * Return the OceanTheme's value for primary 1, the RGB value
+ * (99, 130, 191).
+ */
+ protected ColorUIResource getPrimary1()
+ {
+ return PRIMARY1;
+ }
+
+ /**
+ * Return the OceanTheme's value for primary 2, the RGB value
+ * (163, 184, 204).
+ */
+ protected ColorUIResource getPrimary2()
+ {
+ return PRIMARY2;
+ }
+
+ /**
+ * Return the OceanTheme's value for primary 1, the RGB value
+ * (184, 207, 229).
+ */
+ protected ColorUIResource getPrimary3()
+ {
+ return PRIMARY3;
+ }
+
+ /**
+ * Return the OceanTheme's value for secondary 1, the RGB value
+ * (122, 138, 153).
+ */
+ protected ColorUIResource getSecondary1()
+ {
+ return SECONDARY1;
+ }
+
+ /**
+ * Return the OceanTheme's value for secondary 2, the RGB value
+ * (184, 207, 229).
+ */
+ protected ColorUIResource getSecondary2()
+ {
+ return SECONDARY2;
+ }
+ /**
+ * Return the OceanTheme's value for secondary 3, the RGB value
+ * (238, 238, 238).
+ */
+ protected ColorUIResource getSecondary3()
+ {
+ return SECONDARY3;
+ }
+
+ /**
+ * Adds customized entries to the UIDefaults table.
+ *
+ * @param defaults the UI defaults table
+ */
+ public void addCustomEntriesToTable(UIDefaults defaults)
+ {
+ defaults.put("Button.gradient", Arrays.asList(new Object[]
+ {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
+ new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
+ defaults.put("CheckBox.gradient", Arrays.asList(new Object[]
+ {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
+ new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
+ defaults.put("CheckBoxMenuItem.gradient", Arrays.asList(new Object[]
+ {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
+ new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
+ defaults.put("MenuBar.gradient", Arrays.asList(new Object[]
+ {new Double(1.0), new Double(0.0), new ColorUIResource(Color.WHITE),
+ new ColorUIResource(218, 218, 218), new ColorUIResource(218, 218, 218)}));
+ defaults.put("RadioButton.gradient", Arrays.asList(new Object[]
+ {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
+ new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
+ defaults.put("RadioButtonMenuItem.gradient", Arrays.asList(new Object[]
+ {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
+ new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
+ defaults.put("ScrollBar.gradient", Arrays.asList(new Object[]
+ {new Double(1.0), new Double(0.0), new ColorUIResource(Color.WHITE),
+ new ColorUIResource(218, 218, 218), new ColorUIResource(218, 218, 218)}));
+ defaults.put("Slider.gradient", Arrays.asList(new Object[]
+ {new Double(0.3), new Double(0.2), new ColorUIResource(200, 221, 242),
+ new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
+ defaults.put("ToggleButton.gradient", Arrays.asList(new Object[]
+ {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
+ new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
+ defaults.put("InternalFrame.activeTitleGradient", Arrays.asList(new Object[]
+ {new Double(0.3), new Double(0.0), new ColorUIResource(221, 232, 243),
+ new ColorUIResource(Color.WHITE), new ColorUIResource(184, 207, 229)}));
+
+ defaults.put("Button.rollover", Boolean.TRUE);
+ }
+}
diff --git a/libjava/classpath/javax/swing/plaf/metal/package.html b/libjava/classpath/javax/swing/plaf/metal/package.html
index 2ea787bb5e2..8675493b68c 100644
--- a/libjava/classpath/javax/swing/plaf/metal/package.html
+++ b/libjava/classpath/javax/swing/plaf/metal/package.html
@@ -40,7 +40,16 @@ exception statement from your version. -->
<head><title>GNU Classpath - javax.swing.plaf.metal</title></head>
<body>
-<p>Provides a cross-platform look and feel known as "Metal".</p>
-
+<p>Provides a cross-platform look and feel known as "Metal". To install this
+look and feel, add the following code (or something similar)
+near the start of your application:</p>
+<pre>try
+ {
+&nbsp;&nbsp;UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+catch (UnsupportedLookAndFeelException e)
+ {
+&nbsp;&nbsp;e.printStackTrace();
+ }</pre>
</body>
</html>
diff --git a/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java b/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java
index a70a8ff690e..2bd358dd01e 100644
--- a/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java
+++ b/libjava/classpath/javax/swing/plaf/multi/MultiLookAndFeel.java
@@ -56,6 +56,7 @@ public class MultiLookAndFeel extends LookAndFeel {
*/
public MultiLookAndFeel()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java b/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
index 349f4baad12..a187d74a686 100644
--- a/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
+++ b/libjava/classpath/javax/swing/table/DefaultTableCellRenderer.java
@@ -43,8 +43,10 @@ import java.awt.Component;
import java.awt.Rectangle;
import java.io.Serializable;
+import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JTable;
+import javax.swing.UIManager;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
@@ -64,10 +66,21 @@ public class DefaultTableCellRenderer extends JLabel
{
public UIResource()
{
+ super();
}
}
/**
+ * Stores the color set by setForeground().
+ */
+ Color foreground;
+
+ /**
+ * Stores the color set by setBackground().
+ */
+ Color background;
+
+ /**
* Creates a default table cell renderer with an empty border.
*/
public DefaultTableCellRenderer()
@@ -83,6 +96,7 @@ public class DefaultTableCellRenderer extends JLabel
public void setForeground(Color c)
{
super.setForeground(c);
+ foreground = c;
}
/**
@@ -93,6 +107,7 @@ public class DefaultTableCellRenderer extends JLabel
public void setBackground(Color c)
{
super.setBackground(c);
+ background = c;
}
/**
@@ -104,6 +119,8 @@ public class DefaultTableCellRenderer extends JLabel
public void updateUI()
{
super.updateUI();
+ background = null;
+ foreground = null;
}
/**
@@ -137,17 +154,41 @@ public class DefaultTableCellRenderer extends JLabel
if (isSelected)
{
- setBackground(table.getSelectionBackground());
- setForeground(table.getSelectionForeground());
+ super.setBackground(table.getSelectionBackground());
+ super.setForeground(table.getSelectionForeground());
}
else
{
- setBackground(table.getBackground());
- setForeground(table.getForeground());
+ if (background != null)
+ super.setBackground(background);
+ else
+ super.setBackground(table.getBackground());
+ if (foreground != null)
+ super.setForeground(foreground);
+ else
+ super.setForeground(table.getForeground());
}
+ if (hasFocus)
+ {
+ setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
+ if (table.isCellEditable(row, column))
+ {
+ super.setBackground(UIManager.getColor("Table.focusCellBackground"));
+ super.setForeground(UIManager.getColor("Table.focusCellForeground"));
+ }
+ }
+ else
+ setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
+
setEnabled(table.isEnabled());
setFont(table.getFont());
+
+ // If the current background is equal to the table's background, then we
+ // can avoid filling the background by setting the renderer opaque.
+ Color back = getBackground();
+ setOpaque(back != null && back.equals(table.getBackground()));
+
return this;
}
diff --git a/libjava/classpath/javax/swing/table/JTableHeader.java b/libjava/classpath/javax/swing/table/JTableHeader.java
index 45586da2009..163509a45c2 100644
--- a/libjava/classpath/javax/swing/table/JTableHeader.java
+++ b/libjava/classpath/javax/swing/table/JTableHeader.java
@@ -61,9 +61,14 @@ import javax.accessibility.AccessibleValue;
import javax.swing.JComponent;
import javax.swing.JTable;
import javax.swing.UIManager;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.TableColumnModelEvent;
+import javax.swing.event.TableColumnModelListener;
import javax.swing.plaf.TableHeaderUI;
public class JTableHeader extends JComponent
+ implements TableColumnModelListener, Accessible
{
protected class AccessibleJTableHeader extends AccessibleJComponent
{
@@ -305,11 +310,6 @@ public class JTableHeader extends JComponent
private static final long serialVersionUID = 5144633983372967710L;
/**
- * The accessibleContext property.
- */
- AccessibleContext accessibleContext;
-
- /**
* The columnModel property.
*/
protected TableColumnModel columnModel;
@@ -373,17 +373,8 @@ public class JTableHeader extends JComponent
*/
public JTableHeader(TableColumnModel cm)
{
- accessibleContext = new AccessibleJTableHeader();
columnModel = cm == null ? createDefaultColumnModel() : cm;
- draggedColumn = null;
- draggedDistance = 0;
- opaque = true;
- reorderingAllowed = true;
- resizingAllowed = true;
- resizingColumn = null;
- table = null;
- updateTableInRealTime = true;
- cellRenderer = createDefaultRenderer();
+ initializeLocalVars();
updateUI();
}
@@ -504,7 +495,9 @@ public class JTableHeader extends JComponent
*/
public void setColumnModel(TableColumnModel c)
{
+ columnModel.removeColumnModelListener(this);
columnModel = c;
+ columnModel.addColumnModelListener(this);
}
/**
@@ -619,7 +612,7 @@ public class JTableHeader extends JComponent
public Rectangle getHeaderRect(int column)
{
- Rectangle r = getTable().getCellRect(-1, column, true);
+ Rectangle r = getTable().getCellRect(-1, column, false);
r.height = getHeight();
return r;
}
@@ -665,4 +658,88 @@ public class JTableHeader extends JComponent
return -1;
}
+
+ /**
+ * Receives notification when a column is added to the column model.
+ *
+ * @param event the table column model event
+ */
+ public void columnAdded(TableColumnModelEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Receives notification when a column margin changes in the column model.
+ *
+ * @param event the table column model event
+ */
+ public void columnMarginChanged(ChangeEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Receives notification when a column is moved within the column model.
+ *
+ * @param event the table column model event
+ */
+ public void columnMoved(TableColumnModelEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Receives notification when a column is removed from the column model.
+ *
+ * @param event the table column model event
+ */
+ public void columnRemoved(TableColumnModelEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Receives notification when the column selection has changed.
+ *
+ * @param event the table column model event
+ */
+ public void columnSelectionChanged(ListSelectionEvent event)
+ {
+ // TODO: What else to do here (if anything)?
+ resizeAndRepaint();
+ }
+
+ /**
+ * Validates the layout of this table header and repaints it. This is
+ * equivalent to <code>revalidate()</code> followed by
+ * <code>repaint()</code>.
+ */
+ public void resizeAndRepaint()
+ {
+ revalidate();
+ repaint();
+ }
+
+ /**
+ * Initializes the fields and properties of this class with default values.
+ * This is called by the constructors.
+ */
+ protected void initializeLocalVars()
+ {
+ accessibleContext = new AccessibleJTableHeader();
+ draggedColumn = null;
+ draggedDistance = 0;
+ opaque = true;
+ reorderingAllowed = true;
+ resizingAllowed = true;
+ resizingColumn = null;
+ table = null;
+ updateTableInRealTime = true;
+ cellRenderer = createDefaultRenderer();
+ }
}
diff --git a/libjava/classpath/javax/swing/table/TableColumn.java b/libjava/classpath/javax/swing/table/TableColumn.java
index 9c36bb05ab0..9f06c5b7fcc 100644
--- a/libjava/classpath/javax/swing/table/TableColumn.java
+++ b/libjava/classpath/javax/swing/table/TableColumn.java
@@ -402,7 +402,11 @@ public class TableColumn
if (width == oldWidth)
return;
- firePropertyChange(COLUMN_WIDTH_PROPERTY, oldWidth, width);
+ // We do have a constant field COLUMN_WIDTH_PROPERTY,
+ // however, tests show that the actual fired property name is 'width'
+ // and even Sun's API docs say that this constant field is obsolete and
+ // not used.
+ firePropertyChange("width", oldWidth, width);
}
/**
@@ -422,12 +426,16 @@ public class TableColumn
*/
public void setPreferredWidth(int preferredWidth)
{
+ int oldPrefWidth = this.preferredWidth;
+
if (preferredWidth < minWidth)
this.preferredWidth = minWidth;
else if (preferredWidth > maxWidth)
this.preferredWidth = maxWidth;
else
this.preferredWidth = preferredWidth;
+
+ firePropertyChange("preferredWidth", oldPrefWidth, this.preferredWidth);
}
/**
diff --git a/libjava/classpath/javax/swing/table/TableColumnModel.java b/libjava/classpath/javax/swing/table/TableColumnModel.java
index 76a145604db..b006f9ad4bb 100644
--- a/libjava/classpath/javax/swing/table/TableColumnModel.java
+++ b/libjava/classpath/javax/swing/table/TableColumnModel.java
@@ -50,6 +50,7 @@ import javax.swing.event.TableColumnModelListener;
*
* @author Andrew Selkirk
*/
+// FIXME: The API documentation in this class is incomplete.
public interface TableColumnModel
{
/**
@@ -107,7 +108,7 @@ public interface TableColumnModel
* @throws IllegalArgumentException if <code>identifier</code> is
* <code>null</code> or there is no column with that identifier.
*/
- int getColumnIndex(Object columnIdentifier);
+ int getColumnIndex(Object identifier);
/**
* Returns the <code>TableColumn</code> at the specified index.
@@ -169,7 +170,6 @@ public interface TableColumnModel
/**
* getSelectionModel
- * @param column TableColumn
*/
ListSelectionModel getSelectionModel();
diff --git a/libjava/classpath/javax/swing/text/AbstractDocument.java b/libjava/classpath/javax/swing/text/AbstractDocument.java
index 3c9a4d497a5..a324425562e 100644
--- a/libjava/classpath/javax/swing/text/AbstractDocument.java
+++ b/libjava/classpath/javax/swing/text/AbstractDocument.java
@@ -65,11 +65,10 @@ import javax.swing.undo.UndoableEdit;
* @author original author unknown
* @author Roman Kennke (roman@kennke.org)
*/
-public abstract class AbstractDocument
- implements Document, Serializable
+public abstract class AbstractDocument implements Document, Serializable
{
- /** The serial version UID for this class as of JDK1.4. */
- private static final long serialVersionUID = -116069779446114664L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 6842927725919637215L;
/**
* Standard error message to indicate a bad location.
@@ -128,7 +127,28 @@ public abstract class AbstractDocument
* Manages event listeners for this <code>Document</code>.
*/
protected EventListenerList listenerList = new EventListenerList();
+
+ /**
+ * Stores the current writer thread. Used for locking.
+ */
+ private Thread currentWriter = null;
+
+ /**
+ * The number of readers. Used for locking.
+ */
+ private int numReaders = 0;
+
+ /**
+ * Tells if there are one or more writers waiting.
+ */
+ private int numWritersWaiting = 0;
+
+ /**
+ * A condition variable that readers and writers wait on.
+ */
+ Object documentCV = new Object();
+
/**
* Creates a new <code>AbstractDocument</code> with the specified
* {@link Content} model.
@@ -332,7 +352,7 @@ public abstract class AbstractDocument
* @see GapContent
* @see StringContent
*/
- protected Content getContent()
+ protected final Content getContent()
{
return content;
}
@@ -348,8 +368,7 @@ public abstract class AbstractDocument
*/
protected Thread getCurrentWriter()
{
- // FIXME: Implement locking!
- return null;
+ return currentWriter;
}
/**
@@ -516,13 +535,18 @@ public abstract class AbstractDocument
// Just return when no text to insert was given.
if (text == null || text.length() == 0)
return;
-
DefaultDocumentEvent event =
new DefaultDocumentEvent(offset, text.length(),
DocumentEvent.EventType.INSERT);
- content.insertString(offset, text);
+
+ writeLock();
+ UndoableEdit undo = content.insertString(offset, text);
insertUpdate(event, attributes);
+ writeUnlock();
+
fireInsertUpdate(event);
+ if (undo != null)
+ fireUndoableEditUpdate(new UndoableEditEvent(this, undo));
}
/**
@@ -566,10 +590,28 @@ public abstract class AbstractDocument
}
/**
- * Blocks until a read lock can be obtained.
+ * Blocks until a read lock can be obtained. Must block if there is
+ * currently a writer modifying the <code>Document</code>.
*/
public void readLock()
{
+ if (currentWriter != null && currentWriter.equals(Thread.currentThread()))
+ return;
+ synchronized (documentCV)
+ {
+ while (currentWriter != null || numWritersWaiting > 0)
+ {
+ try
+ {
+ documentCV.wait();
+ }
+ catch (InterruptedException ie)
+ {
+ throw new Error("interrupted trying to get a readLock");
+ }
+ }
+ numReaders++;
+ }
}
/**
@@ -578,6 +620,40 @@ public abstract class AbstractDocument
*/
public void readUnlock()
{
+ // Note we could have a problem here if readUnlock was called without a
+ // prior call to readLock but the specs simply warn users to ensure that
+ // balance by using a finally block:
+ // readLock()
+ // try
+ // {
+ // doSomethingHere
+ // }
+ // finally
+ // {
+ // readUnlock();
+ // }
+
+ // All that the JDK seems to check for is that you don't call unlock
+ // more times than you've previously called lock, but it doesn't make
+ // sure that the threads calling unlock were the same ones that called lock
+
+ // FIXME: the reference implementation throws a
+ // javax.swing.text.StateInvariantError here
+ if (numReaders == 0)
+ throw new IllegalStateException("document lock failure");
+
+ synchronized (documentCV)
+ {
+ // If currentWriter is not null, the application code probably had a
+ // writeLock and then tried to obtain a readLock, in which case
+ // numReaders wasn't incremented
+ if (currentWriter == null)
+ {
+ numReaders --;
+ if (numReaders == 0 && numWritersWaiting != 0)
+ documentCV.notify();
+ }
+ }
}
/**
@@ -595,10 +671,19 @@ public abstract class AbstractDocument
DefaultDocumentEvent event =
new DefaultDocumentEvent(offset, length,
DocumentEvent.EventType.REMOVE);
+
removeUpdate(event);
- content.remove(offset, length);
+
+ boolean shouldFire = content.getString(offset, length).length() != 0;
+
+ writeLock();
+ UndoableEdit temp = content.remove(offset, length);
+ writeUnlock();
+
postRemoveUpdate(event);
- fireRemoveUpdate(event);
+
+ if (shouldFire)
+ fireRemoveUpdate(event);
}
/**
@@ -713,7 +798,15 @@ public abstract class AbstractDocument
*/
public void render(Runnable runnable)
{
- // FIXME: Implement me!
+ readLock();
+ try
+ {
+ runnable.run();
+ }
+ finally
+ {
+ readUnlock();
+ }
}
/**
@@ -725,6 +818,7 @@ public abstract class AbstractDocument
*/
public void setAsynchronousLoadPriority(int p)
{
+ // TODO: Implement this properly.
}
/**
@@ -739,11 +833,30 @@ public abstract class AbstractDocument
}
/**
- * Blocks until a write lock can be obtained.
+ * Blocks until a write lock can be obtained. Must wait if there are
+ * readers currently reading or another thread is currently writing.
*/
protected void writeLock()
{
- // FIXME: Implement me.
+ if (currentWriter!= null && currentWriter.equals(Thread.currentThread()))
+ return;
+ synchronized (documentCV)
+ {
+ numWritersWaiting++;
+ while (numReaders > 0)
+ {
+ try
+ {
+ documentCV.wait();
+ }
+ catch (InterruptedException ie)
+ {
+ throw new Error("interruped while trying to obtain write lock");
+ }
+ }
+ numWritersWaiting --;
+ currentWriter = Thread.currentThread();
+ }
}
/**
@@ -752,7 +865,14 @@ public abstract class AbstractDocument
*/
protected void writeUnlock()
{
- // FIXME: Implement me.
+ synchronized (documentCV)
+ {
+ if (Thread.currentThread().equals(currentWriter))
+ {
+ currentWriter = null;
+ documentCV.notifyAll();
+ }
+ }
}
/**
@@ -970,8 +1090,8 @@ public abstract class AbstractDocument
public abstract class AbstractElement
implements Element, MutableAttributeSet, TreeNode, Serializable
{
- /** The serial version UID for AbstractElement. */
- private static final long serialVersionUID = 1265312733007397733L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 1712240033321461704L;
/** The number of characters that this Element spans. */
int count;
@@ -1231,6 +1351,9 @@ public abstract class AbstractDocument
/**
* Returns the resolve parent of this element.
+ * This is taken from the AttributeSet, but if this is null,
+ * this method instead returns the Element's parent's
+ * AttributeSet
*
* @return the resolve parent of this element
*
@@ -1238,7 +1361,9 @@ public abstract class AbstractDocument
*/
public AttributeSet getResolveParent()
{
- return attributes.getResolveParent();
+ if (attributes.getResolveParent() != null)
+ return attributes.getResolveParent();
+ return element_parent.getAttributes();
}
/**
@@ -1355,49 +1480,6 @@ public abstract class AbstractDocument
public abstract int getStartOffset();
/**
- * Prints diagnostic information to the specified stream.
- *
- * @param stream the stream to dump to
- * @param indent the indentation level
- * @param element the element to be dumped
- */
- private void dumpElement(PrintStream stream, String indent,
- Element element)
- {
- // FIXME: Should the method be removed?
- System.out.println(indent + "<" + element.getName() +">");
-
- if (element.isLeaf())
- {
- int start = element.getStartOffset();
- int end = element.getEndOffset();
- String text = "";
- try
- {
- text = getContent().getString(start, end - start);
- }
- catch (BadLocationException e)
- {
- AssertionError error =
- new AssertionError("BadLocationException should not be "
- + "thrown here. start = " + start
- + ", end = " + end);
- error.initCause(e);
- throw error;
- }
- System.out.println(indent + " ["
- + start + ","
- + end + "]["
- + text + "]");
- }
- else
- {
- for (int i = 0; i < element.getElementCount(); ++i)
- dumpElement(stream, indent + " ", element.getElement(i));
- }
- }
-
- /**
* Prints diagnostic output to the specified stream.
*
* @param stream the stream to write to
@@ -1405,10 +1487,66 @@ public abstract class AbstractDocument
*/
public void dump(PrintStream stream, int indent)
{
- String indentStr = "";
+ StringBuffer b = new StringBuffer();
for (int i = 0; i < indent; ++i)
- indentStr += " ";
- dumpElement(stream, indentStr, this);
+ b.append(' ');
+ b.append('<');
+ b.append(getName());
+ // Dump attributes if there are any.
+ if (getAttributeCount() > 0)
+ {
+ b.append('\n');
+ Enumeration attNames = getAttributeNames();
+ while (attNames.hasMoreElements())
+ {
+ for (int i = 0; i < indent + 2; ++i)
+ b.append(' ');
+ Object attName = attNames.nextElement();
+ b.append(attName);
+ b.append('=');
+ Object attribute = getAttribute(attName);
+ b.append(attribute);
+ b.append('\n');
+ }
+ }
+ b.append(">\n");
+
+ // Dump element content for leaf elements.
+ if (isLeaf())
+ {
+ for (int i = 0; i < indent + 2; ++i)
+ b.append(' ');
+ int start = getStartOffset();
+ int end = getEndOffset();
+ b.append('[');
+ b.append(start);
+ b.append(',');
+ b.append(end);
+ b.append("][");
+ try
+ {
+ b.append(getDocument().getText(start, end - start));
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("BadLocationException "
+ + "must not be thrown "
+ + "here.");
+ err.initCause(ex);
+ throw err;
+ }
+ b.append("]\n");
+ }
+ stream.print(b.toString());
+
+ // Dump child elements if any.
+ int count = getElementCount();
+ for (int i = 0; i < count; ++i)
+ {
+ Element el = getElement(i);
+ if (el instanceof AbstractElement)
+ ((AbstractElement) el).dump(stream, indent + 2);
+ }
}
}
@@ -1418,8 +1556,8 @@ public abstract class AbstractDocument
*/
public class BranchElement extends AbstractElement
{
- /** The serial version UID for BranchElement. */
- private static final long serialVersionUID = -8595176318868717313L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6037216547466333183L;
/** The child elements of this BranchElement. */
private Element[] children = new Element[0];
@@ -1503,19 +1641,30 @@ public abstract class AbstractDocument
*/
public int getElementIndex(int offset)
{
- // If we have no children, return -1.
- if (getElementCount() == 0)
- return - 1;
-
+ // If offset is less than the start offset of our first child,
+ // return 0
+ if (offset < getStartOffset())
+ return 0;
+
// XXX: There is surely a better algorithm
// as beginning from first element each time.
- for (int index = 0; index < children.length; ++index)
+ for (int index = 0; index < children.length - 1; ++index)
{
Element elem = children[index];
if ((elem.getStartOffset() <= offset)
&& (offset < elem.getEndOffset()))
return index;
+ // If the next element's start offset is greater than offset
+ // then we have to return the closest Element, since no Elements
+ // will contain the offset
+ if (children[index + 1].getStartOffset() > offset)
+ {
+ if ((offset - elem.getEndOffset()) > (children[index + 1].getStartOffset() - offset))
+ return index + 1;
+ else
+ return index;
+ }
}
// If offset is greater than the index of the last element, return
@@ -1642,8 +1791,8 @@ public abstract class AbstractDocument
public class DefaultDocumentEvent extends CompoundEdit
implements DocumentEvent
{
- /** The serial version UID of DefaultDocumentEvent. */
- private static final long serialVersionUID = -7406103236022413522L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 5230037221564563284L;
/** The starting offset of the change. */
private int offset;
@@ -1748,7 +1897,7 @@ public abstract class AbstractDocument
return (DocumentEvent.ElementChange) changes.get(elem);
}
}
-
+
/**
* An implementation of {@link DocumentEvent.ElementChange} to be added
* to {@link DefaultDocumentEvent}s.
@@ -1843,8 +1992,8 @@ public abstract class AbstractDocument
*/
public class LeafElement extends AbstractElement
{
- /** The serial version UID of LeafElement. */
- private static final long serialVersionUID = 5115368706941283802L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -8906306331347768017L;
/** Manages the start offset of this element. */
Position startPos;
@@ -1971,7 +2120,10 @@ public abstract class AbstractDocument
*/
public String getName()
{
- return ContentElementName;
+ String name = super.getName();
+ if (name == null)
+ name = ContentElementName;
+ return name;
}
/**
diff --git a/libjava/classpath/javax/swing/text/AttributeSet.java b/libjava/classpath/javax/swing/text/AttributeSet.java
index 2f1f1890bae..01d148c067b 100644
--- a/libjava/classpath/javax/swing/text/AttributeSet.java
+++ b/libjava/classpath/javax/swing/text/AttributeSet.java
@@ -58,6 +58,7 @@ public interface AttributeSet
*/
static interface CharacterAttribute
{
+ // This interface is a marker interface and has no methods.
}
/**
@@ -65,6 +66,7 @@ public interface AttributeSet
*/
static interface ColorAttribute
{
+ // This interface is a marker interface and has no methods.
}
/**
@@ -72,6 +74,7 @@ public interface AttributeSet
*/
static interface FontAttribute
{
+ // This interface is a marker interface and has no methods.
}
/**
@@ -79,6 +82,7 @@ public interface AttributeSet
*/
static interface ParagraphAttribute
{
+ // This interface is a marker interface and has no methods.
}
/**
@@ -99,7 +103,7 @@ public interface AttributeSet
* <code>false</code> otherwise.
*
* @param name the name of the requested attribute
- * @param the value of the requested attribute
+ * @param value the value of the requested attribute
*
* @return <code>true</code> if this <code>AttributeSet</code> contains
* an attribute with the specified <code>name</code> and
diff --git a/libjava/classpath/javax/swing/text/BoxView.java b/libjava/classpath/javax/swing/text/BoxView.java
index 0f8ba1ce15e..5c9587dfe5d 100644
--- a/libjava/classpath/javax/swing/text/BoxView.java
+++ b/libjava/classpath/javax/swing/text/BoxView.java
@@ -155,8 +155,9 @@ public class BoxView
* automatically when any of the child view changes its preferences
* via {@link #preferenceChanged(View, boolean, boolean)}.
*
- * The layout will be updated the next time when {@link #setSize()} is
- * called, typically from within the {@link #paint()} method.
+ * The layout will be updated the next time when
+ * {@link #setSize(float, float)} is called, typically from within the
+ * {@link #paint(Graphics, Shape)} method.
*
* Valid values for the axis are {@link View#X_AXIS} and
* {@link View#Y_AXIS}.
@@ -216,12 +217,11 @@ public class BoxView
* @param alloc the allocated region for the child to paint into
* @param index the index of the child to be painted
*
- * @see {@link #childAllocation}
+ * @see #childAllocation(int, Rectangle)
*/
protected void paintChild(Graphics g, Rectangle alloc, int index)
{
View child = getView(index);
- childAllocation(index, alloc);
child.paint(g, alloc);
}
@@ -301,18 +301,15 @@ public class BoxView
setSize(bounds.width, bounds.height);
Rectangle inside = getInsideAllocation(a);
-
Rectangle copy = new Rectangle(inside);
int count = getViewCount();
for (int i = 0; i < count; ++i)
{
- // TODO: Figure out if the parameter to paintChild is meant to
- // be the child allocation or the allocation of this BoxView.
- // I assume the second option here.
- // We pass this method a copy of the inside rectangle here because
- // it modifies the actual values.
copy.setBounds(inside);
- paintChild(g, copy, i);
+ childAllocation(i, copy);
+ if (!copy.isEmpty()
+ && g.hitClip(copy.x, copy.y, copy.width, copy.height))
+ paintChild(g, copy, i);
}
}
@@ -362,6 +359,24 @@ public class BoxView
}
/**
+ * Calculates the layout of the children of this <code>BoxView</code> along
+ * the specified axis.
+ *
+ * @param span the target span
+ * @param axis the axis that is examined
+ * @param offsets an empty array, filled with the offsets of the children
+ * @param spans an empty array, filled with the spans of the children
+ */
+ protected void baselineLayout(int span, int axis, int[] offsets,
+ int[] spans)
+ {
+ if (axis == myAxis)
+ layoutMajorAxis(span, axis, offsets, spans);
+ else
+ layoutMinorAxis(span, axis, offsets, spans);
+ }
+
+ /**
* Calculates the size requirements of this <code>BoxView</code> along
* its major axis, that is the axis specified in the constructor.
*
@@ -375,27 +390,8 @@ public class BoxView
protected SizeRequirements calculateMajorAxisRequirements(int axis,
SizeRequirements sr)
{
- if (sr == null)
- sr = new SizeRequirements();
- else
- {
- sr.maximum = 0;
- sr.minimum = 0;
- sr.preferred = 0;
- sr.alignment = 0.5F;
- }
-
- int count = getViewCount();
-
- // Sum up the sizes of the children along the specified axis.
- for (int i = 0; i < count; ++i)
- {
- View child = getView(i);
- sr.minimum += child.getMinimumSpan(axis);
- sr.preferred += child.getPreferredSpan(axis);
- sr.maximum += child.getMaximumSpan(axis);
- }
- return sr;
+ SizeRequirements[] childReqs = getChildRequirements(axis);
+ return SizeRequirements.getTiledSizeRequirements(childReqs);
}
/**
@@ -413,48 +409,8 @@ public class BoxView
protected SizeRequirements calculateMinorAxisRequirements(int axis,
SizeRequirements sr)
{
- if (sr == null)
- sr = new SizeRequirements();
- else
- {
- sr.maximum = 0;
- sr.minimum = 0;
- sr.preferred = 0;
- sr.alignment = 0.5F;
- }
-
- int count = getViewCount();
-
- int aboveBaseline = 0;
- int belowBaseline = 0;
- int aboveBaselineMin = 0;
- int belowBaselineMin = 0;
- int aboveBaselineMax = 0;
- int belowBaselineMax = 0;
-
- for (int i = 0; i < count; ++i)
- {
- View child = getView(i);
- float align = child.getAlignment(axis);
- int pref = (int) child.getPreferredSpan(axis);
- int min = (int) child.getMinimumSpan(axis);
- int max = (int) child.getMaximumSpan(axis);
- aboveBaseline += (int) (align * pref);
- belowBaseline += (int) ((1.F - align) * pref);
- aboveBaselineMin += (int) (align * min);
- belowBaselineMin += (int) ((1.F - align) * min);
- aboveBaselineMax += (int) (align * max);
- belowBaselineMax += (int) ((1.F - align) * max);
- }
- sr.minimum = aboveBaselineMin + belowBaselineMin;
- sr.maximum = aboveBaselineMax + belowBaselineMax;
- sr.preferred = aboveBaseline + belowBaseline;
- if (aboveBaseline == 0)
- sr.alignment = 1.0F;
- else
- sr.alignment = (float) (sr.preferred / aboveBaseline);
-
- return sr;
+ SizeRequirements[] childReqs = getChildRequirements(axis);
+ return SizeRequirements.getAlignedSizeRequirements(childReqs);
}
/**
@@ -520,7 +476,6 @@ public class BoxView
protected View getViewAtPoint(int x, int y, Rectangle r)
{
View result = null;
-
int count = getViewCount();
Rectangle copy = new Rectangle(r);
@@ -534,7 +489,9 @@ public class BoxView
break;
}
}
-
+
+ if (result == null && count > 0)
+ return getView(count - 1);
return result;
}
@@ -542,10 +499,12 @@ public class BoxView
* Computes the allocation for a child <code>View</code>. The parameter
* <code>a</code> stores the allocation of this <code>CompositeView</code>
* and is then adjusted to hold the allocation of the child view.
- *
- * @param index the index of the child <code>View</code>
- * @param a the allocation of this <code>CompositeView</code> before the
- * call, the allocation of the child on exit
+ *
+ * @param index
+ * the index of the child <code>View</code>
+ * @param a
+ * the allocation of this <code>CompositeView</code> before the
+ * call, the allocation of the child on exit
*/
protected void childAllocation(int index, Rectangle a)
{
@@ -569,19 +528,8 @@ public class BoxView
*/
protected void layout(int width, int height)
{
- this.width = width;
- this.height = height;
-
- if (myAxis == X_AXIS)
- {
- layoutMajorAxis(width, X_AXIS, offsetsX, spansX);
- layoutMinorAxis(height, Y_AXIS, offsetsY, spansY);
- }
- else
- {
- layoutMajorAxis(height, Y_AXIS, offsetsY, spansY);
- layoutMinorAxis(width, X_AXIS, offsetsX, spansX);
- }
+ baselineLayout(width, X_AXIS, offsetsX, spansX);
+ baselineLayout(height, Y_AXIS, offsetsY, spansY);
}
/**
@@ -591,28 +539,16 @@ public class BoxView
* to layout the children
* @param axis the axis along which the layout is performed
* @param offsets the array that holds the offsets of the children on exit
- * @param offsets the array that holds the spans of the children on exit
+ * @param spans the array that holds the spans of the children on exit
*/
protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets,
int[] spans)
{
- // Allocate SizeRequirements for each child view.
- int count = getViewCount();
- SizeRequirements[] childReqs = new SizeRequirements[count];
- for (int i = 0; i < count; ++i)
- {
- View view = getView(i);
- childReqs[i] = new SizeRequirements((int) view.getMinimumSpan(axis),
- (int) view.getPreferredSpan(axis),
- (int) view.getMaximumSpan(axis),
- view.getAlignment(axis));
- }
-
+ SizeRequirements[] childReqs = getChildRequirements(axis);
// Calculate the spans and offsets using the SizeRequirements uility
// methods.
SizeRequirements.calculateTiledPositions(targetSpan, null, childReqs,
offsets, spans);
-
validateLayout(axis);
}
@@ -623,26 +559,21 @@ public class BoxView
* to layout the children
* @param axis the axis along which the layout is performed
* @param offsets the array that holds the offsets of the children on exit
- * @param offsets the array that holds the spans of the children on exit
+ * @param spans the array that holds the spans of the children on exit
*/
protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets,
int[] spans)
{
- // Allocate SizeRequirements for each child view.
- int count = getViewCount();
- SizeRequirements[] childReqs = new SizeRequirements[count];
- for (int i = 0; i < count; ++i)
- {
- View view = getView(i);
- childReqs[i] = new SizeRequirements((int) view.getMinimumSpan(axis),
- (int) view.getPreferredSpan(axis),
- (int) view.getMaximumSpan(axis),
- view.getAlignment(axis));
- }
-
+ SizeRequirements[] childReqs = getChildRequirements(axis);
// Calculate the spans and offsets using the SizeRequirements uility
// methods.
- SizeRequirements.calculateAlignedPositions(targetSpan, null, childReqs,
+ // TODO: This might be an opportunity for performance optimization. Here
+ // we could use a cached instance of SizeRequirements instead of passing
+ // null to baselineRequirements. However, this would involve rewriting
+ // the baselineRequirements() method to not use the SizeRequirements
+ // utility method, since they cannot reuse a cached instance.
+ SizeRequirements total = baselineRequirements(axis, null);
+ SizeRequirements.calculateAlignedPositions(targetSpan, total, childReqs,
offsets, spans);
validateLayout(axis);
}
@@ -692,6 +623,9 @@ public class BoxView
layoutChanged(X_AXIS);
if (this.height != (int) height)
layoutChanged(Y_AXIS);
+
+ this.width = (int) width;
+ this.height = (int) height;
Rectangle outside = new Rectangle(0, 0, this.width, this.height);
Rectangle inside = getInsideAllocation(outside);
@@ -711,4 +645,117 @@ public class BoxView
if (axis == Y_AXIS)
yLayoutValid = true;
}
+
+ /**
+ * Returns the size requirements of this view's children for the major
+ * axis.
+ *
+ * @return the size requirements of this view's children for the major
+ * axis
+ */
+ SizeRequirements[] getChildRequirements(int axis)
+ {
+ // Allocate SizeRequirements for each child view.
+ int count = getViewCount();
+ SizeRequirements[] childReqs = new SizeRequirements[count];
+ for (int i = 0; i < count; ++i)
+ {
+ View view = getView(i);
+ childReqs[i] = new SizeRequirements((int) view.getMinimumSpan(axis),
+ (int) view.getPreferredSpan(axis),
+ (int) view.getMaximumSpan(axis),
+ view.getAlignment(axis));
+ }
+ return childReqs;
+ }
+
+ /**
+ * Returns the span for the child view with the given index for the specified
+ * axis.
+ *
+ * @param axis the axis to examine, either <code>X_AXIS</code> or
+ * <code>Y_AXIS</code>
+ * @param childIndex the index of the child for for which to return the span
+ *
+ * @return the span for the child view with the given index for the specified
+ * axis
+ */
+ protected int getSpan(int axis, int childIndex)
+ {
+ if (axis == X_AXIS)
+ return spansX[childIndex];
+ else
+ return spansY[childIndex];
+ }
+
+ /**
+ * Returns the offset for the child view with the given index for the
+ * specified axis.
+ *
+ * @param axis the axis to examine, either <code>X_AXIS</code> or
+ * <code>Y_AXIS</code>
+ * @param childIndex the index of the child for for which to return the span
+ *
+ * @return the offset for the child view with the given index for the
+ * specified axis
+ */
+ protected int getOffset(int axis, int childIndex)
+ {
+ if (axis == X_AXIS)
+ return offsetsX[childIndex];
+ else
+ return offsetsY[childIndex];
+ }
+
+ /**
+ * Returns the alignment for this box view for the specified axis. The
+ * axis that is tiled (the major axis) will be requested to be aligned
+ * centered (0.5F). The minor axis alignment depends on the child view's
+ * total alignment.
+ *
+ * @param axis the axis which is examined
+ *
+ * @return the alignment for this box view for the specified axis
+ */
+ public float getAlignment(int axis)
+ {
+ if (axis == myAxis)
+ return 0.5F;
+ else
+ return baselineRequirements(axis, null).alignment;
+ }
+
+ /**
+ * Called by a child View when its preferred span has changed.
+ *
+ * @param width indicates that the preferred width of the child changed.
+ * @param height indicates that the preferred height of the child changed.
+ * @param child the child View.
+ */
+ public void preferenceChanged (View child, boolean width, boolean height)
+ {
+ if (width)
+ xLayoutValid = false;
+ if (height)
+ yLayoutValid = false;
+ super.preferenceChanged(child, width, height);
+ }
+
+ /**
+ * Maps the document model position <code>pos</code> to a Shape
+ * in the view coordinate space. This method overrides CompositeView's
+ * method to make sure the children are allocated properly before
+ * calling the super's behaviour.
+ */
+ public Shape modelToView(int pos, Shape a, Position.Bias bias)
+ throws BadLocationException
+ {
+ // Make sure everything is allocated properly and then call super
+ if (!isAllocationValid())
+ {
+ Rectangle bounds = a.getBounds();
+ setSize(bounds.width, bounds.height);
+ }
+ return super.modelToView(pos, a, bias);
+ }
}
diff --git a/libjava/classpath/javax/swing/text/ComponentView.java b/libjava/classpath/javax/swing/text/ComponentView.java
index f6feda21513..830dda3ecdc 100644
--- a/libjava/classpath/javax/swing/text/ComponentView.java
+++ b/libjava/classpath/javax/swing/text/ComponentView.java
@@ -1,5 +1,5 @@
/* ComponentView.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,70 +38,213 @@ exception statement from your version. */
package javax.swing.text;
import java.awt.Component;
+import java.awt.Container;
import java.awt.Graphics;
+import java.awt.Rectangle;
import java.awt.Shape;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+
+/**
+ * A {@link View} implementation that is able to render arbitrary
+ * {@link Component}s. This uses the attribute
+ * {@link StyleConstants#ComponentAttribute} to determine the
+ * <code>Component</code> that should be rendered. This <code>Component</code>
+ * becomes a direct child of the <code>JTextComponent</code> that contains
+ * this <code>ComponentView</code>, so this view must not be shared between
+ * multiple <code>JTextComponent</code>s.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ * @author original author unknown
+ */
public class ComponentView extends View
{
- public ComponentView(Element elem)
- {
- super(elem);
- }
-
- protected Component createComponent()
- {
- return null;
- }
-
- public float getAlignment(int axis)
- {
- return 0;
- }
-
- public final Component getComponent()
- {
- return null;
- }
-
- public float getMaximumSpan(int axis)
- {
- return 0;
- }
-
- public float getMinimumSpan(int axis)
- {
- return 0;
- }
-
- public float getPreferredSpan(int axis)
- {
- return 0;
- }
-
- public Shape modelToView(int pos, Shape a, Position.Bias b)
- throws BadLocationException
- {
- return null;
- }
-
- public void paint(Graphics g, Shape a)
- {
- }
-
- public void setParent(View p)
- {
- }
-
- public void setSize(float width, float height)
- {
- }
-
- public int viewToModel(float x, float y, Shape a, Position.Bias[] bias)
- {
- return 0;
- }
/**
+ * The component that is displayed by this view.
+ */
+ private Component comp;
+
+ /**
+ * Creates a new instance of <code>ComponentView</code> for the specified
+ * <code>Element</code>.
+ *
+ * @param elem the element that this <code>View</code> is rendering
+ */
+ public ComponentView(Element elem)
+ {
+ super(elem);
+ }
+
+ /**
+ * Creates the <code>Component</code> that this <code>View</code> is
+ * rendering. The <code>Component</code> is determined using
+ * the {@link StyleConstants#ComponentAttribute} of the associated
+ * <code>Element</code>.
+ *
+ * @return the component that is rendered
+ */
+ protected Component createComponent()
+ {
+ return StyleConstants.getComponent(getElement().getAttributes());
+ }
+
+ /**
+ * Returns the alignment of this <code>View</code> along the specified axis.
+ *
+ * @param axis either {@link View#X_AXIS} or {@link View#Y_AXIS}
+ *
+ * @return the alignment of this <code>View</code> along the specified axis
+ */
+ public float getAlignment(int axis)
+ {
+ float align;
+ if (axis == X_AXIS)
+ align = getComponent().getAlignmentX();
+ else if (axis == Y_AXIS)
+ align = getComponent().getAlignmentY();
+ else
+ throw new IllegalArgumentException();
+ return align;
+ }
+
+ /**
+ * Returns the <code>Component</code> that is rendered by this
+ * <code>ComponentView</code>.
+ *
+ * @return the <code>Component</code> that is rendered by this
+ * <code>ComponentView</code>
+ */
+ public final Component getComponent()
+ {
+ if (comp == null)
+ comp = createComponent();
+ return comp;
+ }
+
+ /**
+ * Returns the maximum span of this <code>View</code> along the specified
+ * axis.
+ *
+ * This will return {@link Component#getMaximumSize()} for the specified
+ * axis.
+ *
+ * @return the maximum span of this <code>View</code> along the specified
+ * axis
+ */
+ public float getMaximumSpan(int axis)
+ {
+ float span;
+ if (axis == X_AXIS)
+ span = getComponent().getMaximumSize().width;
+ else if (axis == Y_AXIS)
+ span = getComponent().getMaximumSize().height;
+ else
+ throw new IllegalArgumentException();
+ return span;
+ }
+
+ public float getMinimumSpan(int axis)
+ {
+ float span;
+ if (axis == X_AXIS)
+ span = getComponent().getMinimumSize().width;
+ else if (axis == Y_AXIS)
+ span = getComponent().getMinimumSize().height;
+ else
+ throw new IllegalArgumentException();
+ return span;
+ }
+
+ public float getPreferredSpan(int axis)
+ {
+ float span;
+ if (axis == X_AXIS)
+ span = getComponent().getPreferredSize().width;
+ else if (axis == Y_AXIS)
+ span = getComponent().getPreferredSize().height;
+ else
+ throw new IllegalArgumentException();
+ return span;
+ }
+
+ public Shape modelToView(int pos, Shape a, Position.Bias b)
+ throws BadLocationException
+ {
+ Element el = getElement();
+ if (pos < el.getStartOffset() || pos >= el.getEndOffset())
+ throw new BadLocationException("Illegal offset for this view", pos);
+ Rectangle r = a.getBounds();
+ Component c = getComponent();
+ return new Rectangle(r.x, r.y, c.getWidth(), c.getHeight());
+ }
+
+ /**
+ * The real painting behavour is performed by normal component painting,
+ * triggered by the text component that hosts this view. This method does
+ * not paint by itself. However, it sets the size of the component according
+ * to the allocation that is passed here.
+ *
+ * @param g the graphics context
+ * @param a the allocation of the child
+ */
+ public void paint(Graphics g, Shape a)
+ {
+ Rectangle r = a.getBounds();
+ getComponent().setBounds(r.x, r.y, r.width, r.height);
+ }
+
+ /**
+ * This sets up the component when the view is added to its parent, or
+ * cleans up the view when it is removed from its parent.
+ *
+ * When this view is added to a parent view, the component of this view
+ * is added to the container that hosts this view. When <code>p</code> is
+ * <code>null</code>, then the view is removed from it's parent and we have
+ * to also remove the component from it's parent container.
+ *
+ * @param p the parent view or <code>null</code> if this view is removed
+ * from it's parent
+ */
+ public void setParent(final View p)
+ {
+ if (SwingUtilities.isEventDispatchThread())
+ setParentImpl(p);
+ else
+ SwingUtilities.invokeLater
+ (new Runnable()
+ {
+ public void run()
+ {
+ setParentImpl(p);
+ }
+ });
+ }
+
+ /**
+ * The implementation of {@link #setParent}. This is package private to
+ * avoid a synthetic accessor method.
+ *
+ * @param p the parent view to set
+ */
+ void setParentImpl(View p)
+ {
+ if (p != null)
+ {
+ Component c = getComponent();
+ p.getContainer().add(c);
+ }
+ else
+ {
+ Component c = getComponent();
+ Container parent = c.getParent();
+ parent.remove(c);
+ comp = null;
+ }
+ }
+
+ /**
* Maps coordinates from the <code>View</code>'s space into a position
* in the document model.
*
@@ -113,9 +256,42 @@ public class ComponentView extends View
* @return the position in the document that corresponds to the screen
* coordinates <code>x, y</code>
*/
- public int viewToModel(float x, float y, Shape a, Position.Bias b)
+ public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
+ {
+ // The element should only have one character position and it is clear
+ // that this position is the position that best matches the given screen
+ // coordinates, simply because this view has only this one position.
+ Element el = getElement();
+ return el.getStartOffset();
+ }
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
{
- // FIXME: Implement this properly.
- return 0;
+ // FIXME: Implement this method.
+ throw new AssertionError("Not yet implemented");
}
}
diff --git a/libjava/classpath/javax/swing/text/CompositeView.java b/libjava/classpath/javax/swing/text/CompositeView.java
index 6776c95727a..e6c2e4cc2d8 100644
--- a/libjava/classpath/javax/swing/text/CompositeView.java
+++ b/libjava/classpath/javax/swing/text/CompositeView.java
@@ -62,7 +62,7 @@ public abstract class CompositeView
/**
* The allocation of this <code>View</code> minus its insets. This is
* initialized in {@link #getInsideAllocation} and reused and modified in
- * {@link childAllocation}.
+ * {@link #childAllocation(int, Rectangle)}.
*/
Rectangle insideAllocation;
@@ -221,20 +221,17 @@ public abstract class CompositeView
if (childIndex != -1)
{
View child = getView(childIndex);
- Shape result = child.modelToView(pos, a, bias);
+ Rectangle r = a.getBounds();
+ childAllocation(childIndex, r);
+ Shape result = child.modelToView(pos, r, bias);
if (result == null)
throw new AssertionError("" + child.getClass().getName()
+ ".modelToView() must not return null");
return result;
}
else
- {
- // FIXME: Handle the case when we have no child view for the given
- // position.
- throw new AssertionError("No child views found where child views are "
- + "expected. pos = " + pos + ", bias = "
- + bias);
- }
+ throw new BadLocationException("No child view for the specified location",
+ pos);
}
/**
@@ -267,53 +264,60 @@ public abstract class CompositeView
* Maps coordinates from the <code>View</code>'s space into a position
* in the document model.
*
- * @param x the x coordinate in the view space
- * @param y the y coordinate in the view space
+ * @param x the x coordinate in the view space, x >= 0
+ * @param y the y coordinate in the view space, y >= 0
* @param a the allocation of this <code>View</code>
* @param b the bias to use
*
* @return the position in the document that corresponds to the screen
- * coordinates <code>x, y</code>
+ * coordinates <code>x, y</code> >= 0
*/
public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
{
- Rectangle r = getInsideAllocation(a);
- View view = getViewAtPoint((int) x, (int) y, r);
- return view.viewToModel(x, y, a, b);
+ if (x >= 0 && y >= 0)
+ {
+ Rectangle r = getInsideAllocation(a);
+ View view = getViewAtPoint((int) x, (int) y, r);
+ return view.viewToModel(x, y, a, b);
+ }
+ return 0;
}
/**
* Returns the next model location that is visible in eiter north / south
- * direction or east / west direction. This is used to determine the
- * placement of the caret when navigating around the document with
- * the arrow keys.
- *
- * This is a convenience method for
- * {@link #getNextNorthSouthVisualPositionFrom} and
- * {@link #getNextEastWestVisualPositionFrom}.
- *
- * @param pos the model position to start search from
- * @param b the bias for <code>pos</code>
- * @param a the allocated region for this view
- * @param direction the direction from the current position, can be one of
- * the following:
- * <ul>
- * <li>{@link SwingConstants#WEST}</li>
- * <li>{@link SwingConstants#EAST}</li>
- * <li>{@link SwingConstants#NORTH}</li>
- * <li>{@link SwingConstants#SOUTH}</li>
- * </ul>
- * @param biasRet the bias of the return value gets stored here
- *
+ * direction or east / west direction. This is used to determine the placement
+ * of the caret when navigating around the document with the arrow keys. This
+ * is a convenience method for {@link #getNextNorthSouthVisualPositionFrom}
+ * and {@link #getNextEastWestVisualPositionFrom}.
+ *
+ * @param pos
+ * the model position to start search from
+ * @param b
+ * the bias for <code>pos</code>
+ * @param a
+ * the allocated region for this view
+ * @param direction
+ * the direction from the current position, can be one of the
+ * following:
+ * <ul>
+ * <li>{@link SwingConstants#WEST}</li>
+ * <li>{@link SwingConstants#EAST}</li>
+ * <li>{@link SwingConstants#NORTH}</li>
+ * <li>{@link SwingConstants#SOUTH}</li>
+ * </ul>
+ * @param biasRet
+ * the bias of the return value gets stored here
* @return the position inside the model that represents the next visual
* location
- *
- * @throws BadLocationException if <code>pos</code> is not a valid location
- * inside the document model
- * @throws IllegalArgumentException if <code>direction</code> is invalid
+ * @throws BadLocationException
+ * if <code>pos</code> is not a valid location inside the document
+ * model
+ * @throws IllegalArgumentException
+ * if <code>direction</code> is invalid
*/
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
int direction, Position.Bias[] biasRet)
+ throws BadLocationException
{
int retVal = -1;
switch (direction)
@@ -433,10 +437,16 @@ public abstract class CompositeView
*/
protected int getViewIndexAtPosition(int pos)
{
- // We have one child view allocated for each child element in
- // loadChildren(), so this should work.
- Element el = getElement();
- int index = el.getElementIndex(pos);
+ int index = -1;
+ for (int i = 0; i < children.length; i++)
+ {
+ if (children[i].getStartOffset() <= pos
+ && children[i].getEndOffset() > pos)
+ {
+ index = i;
+ break;
+ }
+ }
return index;
}
@@ -473,8 +483,8 @@ public abstract class CompositeView
insideAllocation = inside;
}
}
- inside.x = alloc.x - insets.left;
- inside.y = alloc.y - insets.top;
+ inside.x = alloc.x + insets.left;
+ inside.y = alloc.y + insets.top;
inside.width = alloc.width - insets.left - insets.right;
inside.height = alloc.height - insets.top - insets.bottom;
return inside;
@@ -594,6 +604,7 @@ public abstract class CompositeView
protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b,
Shape a, int direction,
Position.Bias[] biasRet)
+ throws BadLocationException
{
// FIXME: Implement this correctly.
return pos;
@@ -627,6 +638,7 @@ public abstract class CompositeView
protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b,
Shape a, int direction,
Position.Bias[] biasRet)
+ throws BadLocationException
{
// FIXME: Implement this correctly.
return pos;
@@ -649,4 +661,34 @@ public abstract class CompositeView
{
return false;
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
+ }
}
diff --git a/libjava/classpath/javax/swing/text/DefaultCaret.java b/libjava/classpath/javax/swing/text/DefaultCaret.java
index 33c3ae3bf28..3ebeceb947d 100644
--- a/libjava/classpath/javax/swing/text/DefaultCaret.java
+++ b/libjava/classpath/javax/swing/text/DefaultCaret.java
@@ -40,15 +40,24 @@ package javax.swing.text;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.EventListener;
+import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
import javax.swing.event.EventListenerList;
/**
@@ -60,12 +69,164 @@ import javax.swing.event.EventListenerList;
public class DefaultCaret extends Rectangle
implements Caret, FocusListener, MouseListener, MouseMotionListener
{
+
+ /**
+ * Controls the blinking of the caret.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+ private class BlinkTimerListener implements ActionListener
+ {
+ /**
+ * Forces the next event to be ignored. The next event should be ignored
+ * if we force the caret to appear. We do not know how long will it take
+ * to fire the comming event; this may be near immediately. Better to leave
+ * the caret visible one iteration longer.
+ */
+ boolean ignoreNextEvent;
+
+ /**
+ * Receives notification when the blink timer fires and updates the visible
+ * state of the caret.
+ *
+ * @param event the action event
+ */
+ public void actionPerformed(ActionEvent event)
+ {
+ if (ignoreNextEvent)
+ ignoreNextEvent = false;
+ else
+ {
+ visible = !visible;
+ repaint();
+ }
+ }
+ }
+
+ /**
+ * Listens for changes in the text component's document and updates the
+ * caret accordingly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class DocumentHandler implements DocumentListener
+ {
+ /**
+ * Receives notification that some text attributes have changed. No action
+ * is taken here.
+ *
+ * @param event the document event
+ */
+ public void changedUpdate(DocumentEvent event)
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Receives notification that some text has been inserted from the text
+ * component. The caret is moved forward accordingly.
+ *
+ * @param event the document event
+ */
+ public void insertUpdate(DocumentEvent event)
+ {
+ if (policy == ALWAYS_UPDATE ||
+ (SwingUtilities.isEventDispatchThread() &&
+ policy == UPDATE_WHEN_ON_EDT))
+ {
+ int dot = getDot();
+ setDot(dot + event.getLength());
+ }
+ }
+
+ /**
+ * Receives notification that some text has been removed into the text
+ * component. The caret is moved backwards accordingly.
+ *
+ * @param event the document event
+ */
+ public void removeUpdate(DocumentEvent event)
+ {
+ if (policy == ALWAYS_UPDATE ||
+ (SwingUtilities.isEventDispatchThread() &&
+ policy == UPDATE_WHEN_ON_EDT))
+ {
+ int dot = getDot();
+ setDot(dot - event.getLength());
+ }
+ else if (policy == NEVER_UPDATE)
+ {
+ int docLength = event.getDocument().getLength();
+ if (getDot() > docLength)
+ setDot(docLength);
+ }
+ }
+ }
+
+ /**
+ * Listens for property changes on the text document. This is used to add and
+ * remove our document listener, if the document of the text component has
+ * changed.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class PropertyChangeHandler implements PropertyChangeListener
+ {
+
+ /**
+ * Receives notification when a property has changed on the text component.
+ * This adds/removes our document listener from the text component's
+ * document when the document changes.
+ *
+ * @param e the property change event
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals("document"))
+ {
+ Document oldDoc = (Document) e.getOldValue();
+ oldDoc.removeDocumentListener(documentListener);
+ Document newDoc = (Document) e.getNewValue();
+ newDoc.addDocumentListener(documentListener);
+ }
+ }
+
+ }
+
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 4325555698756477346L;
+
/**
- * The serial version UID for DefaultCaret.
+ * Indicates the Caret position should always be updated after Document
+ * changes even if the updates are not performed on the Event Dispatching
+ * thread.
+ *
+ * @since 1.5
*/
- private static final long serialVersionUID = 228155774675466193L;
+ public static final int ALWAYS_UPDATE = 2;
/**
+ * Indicates the Caret position should not be changed unless the Document
+ * length becomes less than the Caret position, in which case the Caret
+ * is moved to the end of the Document.
+ *
+ * @since 1.5
+ */
+ public static final int NEVER_UPDATE = 1;
+
+ /**
+ * Indicates the Caret position should be updated only if Document changes
+ * are made on the Event Dispatcher thread.
+ *
+ * @since 1.5
+ */
+ public static final int UPDATE_WHEN_ON_EDT = 0;
+
+ /** Keeps track of the current update policy **/
+ int policy = UPDATE_WHEN_ON_EDT;
+
+ /**
* The <code>ChangeEvent</code> that is fired by {@link #fireStateChanged()}.
*/
protected ChangeEvent changeEvent = new ChangeEvent(this);
@@ -76,6 +237,16 @@ public class DefaultCaret extends Rectangle
protected EventListenerList listenerList = new EventListenerList();
/**
+ * Our document listener.
+ */
+ DocumentListener documentListener;
+
+ /**
+ * Our property listener.
+ */
+ PropertyChangeListener propertyChangeListener;
+
+ /**
* The text component in which this caret is installed.
*/
private JTextComponent textComponent;
@@ -106,15 +277,65 @@ public class DefaultCaret extends Rectangle
private Point magicCaretPosition = null;
/**
- * Indicates if this <code>Caret</code> is currently visible or not.
+ * Indicates if this <code>Caret</code> is currently visible or not. This is
+ * package private to avoid an accessor method.
*/
- private boolean visible = true;
+ boolean visible = false;
/**
* The current highlight entry.
*/
private Object highlightEntry;
+ private Timer blinkTimer;
+
+ private BlinkTimerListener blinkListener;
+
+ /**
+ * Creates a new <code>DefaultCaret</code> instance.
+ */
+ public DefaultCaret()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Sets the Caret update policy.
+ *
+ * @param policy the new policy. Valid values are:
+ * ALWAYS_UPDATE: always update the Caret position, even when Document
+ * updates don't occur on the Event Dispatcher thread.
+ * NEVER_UPDATE: don't update the Caret position unless the Document
+ * length becomes less than the Caret position (then update the
+ * Caret to the end of the Document).
+ * UPDATE_WHEN_ON_EDT: update the Caret position when the
+ * Document updates occur on the Event Dispatcher thread. This is the
+ * default.
+ *
+ * @since 1.5
+ * @throws IllegalArgumentException if policy is not one of the above.
+ */
+ public void setUpdatePolicy (int policy)
+ {
+ if (policy != ALWAYS_UPDATE && policy != NEVER_UPDATE
+ && policy != UPDATE_WHEN_ON_EDT)
+ throw new
+ IllegalArgumentException
+ ("policy must be ALWAYS_UPDATE, NEVER__UPDATE, or UPDATE_WHEN_ON_EDT");
+ this.policy = policy;
+ }
+
+ /**
+ * Gets the caret update policy.
+ *
+ * @return the caret update policy.
+ * @since 1.5
+ */
+ public int getUpdatePolicy ()
+ {
+ return policy;
+ }
+
/**
* Moves the caret position when the mouse is dragged over the text
* component, modifying the selection accordingly.
@@ -123,7 +344,7 @@ public class DefaultCaret extends Rectangle
*/
public void mouseDragged(MouseEvent event)
{
- // FIXME: Implement this properly.
+ moveCaret(event);
}
/**
@@ -153,7 +374,7 @@ public class DefaultCaret extends Rectangle
*/
public void mouseClicked(MouseEvent event)
{
- // FIXME: Implement this properly.
+ // TODO: Implement double- and triple-click behaviour here.
}
/**
@@ -175,6 +396,7 @@ public class DefaultCaret extends Rectangle
*/
public void mouseExited(MouseEvent event)
{
+ // Nothing to do here.
}
/**
@@ -187,7 +409,7 @@ public class DefaultCaret extends Rectangle
*/
public void mousePressed(MouseEvent event)
{
- // FIXME: Implement this properly.
+ positionCaret(event);
}
/**
@@ -208,6 +430,7 @@ public class DefaultCaret extends Rectangle
*/
public void focusGained(FocusEvent event)
{
+ setVisible(true);
}
/**
@@ -217,6 +440,8 @@ public class DefaultCaret extends Rectangle
*/
public void focusLost(FocusEvent event)
{
+ if (event.isTemporary() == false)
+ setVisible(false);
}
/**
@@ -227,7 +452,8 @@ public class DefaultCaret extends Rectangle
*/
protected void moveCaret(MouseEvent event)
{
- // FIXME: Implement this properly.
+ int newDot = getComponent().viewToModel(event.getPoint());
+ moveDot(newDot);
}
/**
@@ -238,7 +464,8 @@ public class DefaultCaret extends Rectangle
*/
protected void positionCaret(MouseEvent event)
{
- // FIXME: Implement this properly.
+ int newDot = getComponent().viewToModel(event.getPoint());
+ setDot(newDot);
}
/**
@@ -253,7 +480,16 @@ public class DefaultCaret extends Rectangle
textComponent.removeFocusListener(this);
textComponent.removeMouseListener(this);
textComponent.removeMouseMotionListener(this);
+ textComponent.getDocument().removeDocumentListener(documentListener);
+ documentListener = null;
+ textComponent.removePropertyChangeListener(propertyChangeListener);
+ propertyChangeListener = null;
textComponent = null;
+
+ // Deinstall blink timer if present.
+ if (blinkTimer != null)
+ blinkTimer.stop();
+ blinkTimer = null;
}
/**
@@ -269,6 +505,11 @@ public class DefaultCaret extends Rectangle
textComponent.addFocusListener(this);
textComponent.addMouseListener(this);
textComponent.addMouseMotionListener(this);
+ propertyChangeListener = new PropertyChangeHandler();
+ textComponent.addPropertyChangeListener(propertyChangeListener);
+ documentListener = new DocumentHandler();
+ textComponent.getDocument().addDocumentListener(documentListener);
+
repaint();
}
@@ -376,10 +617,7 @@ public class DefaultCaret extends Rectangle
*/
protected final void repaint()
{
- // FIXME: Is this good? This possibly causes alot of the component
- // hierarchy to be repainted on every caret blink.
- if (textComponent != null)
- textComponent.repaint();
+ getComponent().repaint(x, y, width, height);
}
/**
@@ -390,7 +628,8 @@ public class DefaultCaret extends Rectangle
*/
public void paint(Graphics g)
{
- if (textComponent == null)
+ JTextComponent comp = getComponent();
+ if (comp == null)
return;
int dot = getDot();
@@ -398,25 +637,33 @@ public class DefaultCaret extends Rectangle
try
{
- rect = textComponent.modelToView(dot);
+ rect = textComponent.modelToView(dot);
}
catch (BadLocationException e)
{
- // This should never happen as dot should be always valid.
- return;
+ assert false : "Unexpected bad caret location: " + dot;
+ return;
}
if (rect == null)
return;
-
- // First we need to delete the old caret.
- // FIXME: Implement deleting of old caret.
-
+
+ // Check if paint has possibly been called directly, without a previous
+ // call to damage(). In this case we need to do some cleanup first.
+ if ((x != rect.x) || (y != rect.y))
+ {
+ repaint(); // Erase previous location of caret.
+ x = rect.x;
+ y = rect.y;
+ width = 1;
+ height = rect.height;
+ }
+
// Now draw the caret on the new position if visible.
if (visible)
{
- g.setColor(textComponent.getCaretColor());
- g.drawLine(rect.x, rect.y, rect.x, rect.y + rect.height);
+ g.setColor(textComponent.getCaretColor());
+ g.drawLine(rect.x, rect.y, rect.x, rect.y + rect.height);
}
}
@@ -507,6 +754,8 @@ public class DefaultCaret extends Rectangle
*/
public void setBlinkRate(int rate)
{
+ if (blinkTimer != null)
+ blinkTimer.setDelay(rate);
blinkRate = rate;
}
@@ -532,27 +781,71 @@ public class DefaultCaret extends Rectangle
*/
public void moveDot(int dot)
{
- this.dot = dot;
- handleHighlight();
- repaint();
+ if (dot >= 0)
+ {
+ this.dot = dot;
+ handleHighlight();
+ adjustVisibility(this);
+ appear();
+ }
}
/**
* Sets the current position of this <code>Caret</code> within the
- * <code>Document</code>. This also sets the <code>mark</code> to the
- * new location.
- *
- * @param dot the new position to be set
- *
+ * <code>Document</code>. This also sets the <code>mark</code> to the new
+ * location.
+ *
+ * @param dot
+ * the new position to be set
* @see #moveDot(int)
*/
public void setDot(int dot)
{
- this.dot = dot;
- this.mark = dot;
- handleHighlight();
- repaint();
+ if (dot >= 0)
+ {
+ this.mark = dot;
+ this.dot = dot;
+ handleHighlight();
+ adjustVisibility(this);
+ appear();
+ }
}
+
+ /**
+ * Show the caret (may be hidden due blinking) and adjust the timer not to
+ * hide it (possibly immediately).
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+ void appear()
+ {
+ // All machinery is only required if the carret is blinking.
+ if (blinkListener != null)
+ {
+ blinkListener.ignoreNextEvent = true;
+
+ // If the caret is visible, erase the current position by repainting
+ // over.
+ if (visible)
+ repaint();
+
+ // Draw the caret in the new position.
+ visible = true;
+
+ Rectangle area = null;
+ try
+ {
+ area = getComponent().modelToView(getDot());
+ }
+ catch (BadLocationException ex)
+ {
+ assert false : "Unexpected bad caret location: " + getDot();
+ }
+ if (area != null)
+ damage(area);
+ }
+ repaint();
+ }
/**
* Returns <code>true</code> if this <code>Caret</code> is currently visible,
@@ -574,8 +867,33 @@ public class DefaultCaret extends Rectangle
*/
public void setVisible(boolean v)
{
- visible = v;
- repaint();
+ if (v != visible)
+ {
+ visible = v;
+ if (visible)
+ if (textComponent.isEnabled() && textComponent.isEditable())
+ {
+ if (blinkTimer == null)
+ initBlinkTimer();
+ blinkTimer.start();
+ }
+ else
+ {
+ if (blinkTimer != null)
+ blinkTimer.stop();
+ }
+ Rectangle area = null;
+ try
+ {
+ area = getComponent().modelToView(getDot());
+ }
+ catch (BadLocationException ex)
+ {
+ assert false: "Unexpected bad caret location: " + getDot();
+ }
+ if (area != null)
+ damage(area);
+ }
}
/**
@@ -589,4 +907,47 @@ public class DefaultCaret extends Rectangle
{
return DefaultHighlighter.DefaultPainter;
}
+
+ /**
+ * Updates the carets rectangle properties to the specified rectangle and
+ * repaints the caret.
+ *
+ * @param r the rectangle to set as the caret rectangle
+ */
+ protected void damage(Rectangle r)
+ {
+ if (r == null)
+ return;
+ x = r.x;
+ y = r.y;
+ width = 1;
+ // height is normally set in paint and we leave it untouched. However, we
+ // must set a valid value here, since otherwise the painting mechanism
+ // sets a zero clip and never calls paint.
+ if (height <= 0)
+ height = getComponent().getHeight();
+ repaint();
+ }
+
+ /**
+ * Adjusts the text component so that the caret is visible. This default
+ * implementation simply calls
+ * {@link JComponent#scrollRectToVisible(Rectangle)} on the text component.
+ * Subclasses may wish to change this.
+ */
+ protected void adjustVisibility(Rectangle rect)
+ {
+ getComponent().scrollRectToVisible(rect);
+ }
+
+ /**
+ * Initializes the blink timer.
+ */
+ private void initBlinkTimer()
+ {
+ // Setup the blink timer.
+ blinkListener = new BlinkTimerListener();
+ blinkTimer = new Timer(getBlinkRate(), blinkListener);
+ blinkTimer.setRepeats(true);
+ }
}
diff --git a/libjava/classpath/javax/swing/text/DefaultEditorKit.java b/libjava/classpath/javax/swing/text/DefaultEditorKit.java
index a14f3ff4fe0..3b3fc1f7238 100644
--- a/libjava/classpath/javax/swing/text/DefaultEditorKit.java
+++ b/libjava/classpath/javax/swing/text/DefaultEditorKit.java
@@ -66,8 +66,7 @@ public class DefaultEditorKit extends EditorKit
*
* @see Toolkit#beep()
*/
- public static class BeepAction
- extends TextAction
+ public static class BeepAction extends TextAction
{
/**
* Creates a new <code>BeepAction</code>.
@@ -95,8 +94,7 @@ public class DefaultEditorKit extends EditorKit
* @see CutAction
* @see PasteAction
*/
- public static class CopyAction
- extends TextAction
+ public static class CopyAction extends TextAction
{
/**
@@ -128,8 +126,7 @@ public class DefaultEditorKit extends EditorKit
* @see CopyAction
* @see PasteAction
*/
- public static class CutAction
- extends TextAction
+ public static class CutAction extends TextAction
{
/**
@@ -159,8 +156,7 @@ public class DefaultEditorKit extends EditorKit
* @see CopyAction
* @see CutAction
*/
- public static class PasteAction
- extends TextAction
+ public static class PasteAction extends TextAction
{
/**
@@ -226,9 +222,6 @@ public class DefaultEditorKit extends EditorKit
{
t.getDocument().insertString(t.getCaret().getDot(),
event.getActionCommand(), null);
- t.getCaret().setDot(Math.min(t.getCaret().getDot() + 1,
- t.getDocument().getEndPosition()
- .getOffset()));
}
catch (BadLocationException be)
{
@@ -243,8 +236,7 @@ public class DefaultEditorKit extends EditorKit
* of the text component. This is typically triggered by hitting
* ENTER on the keyboard.
*/
- public static class InsertBreakAction
- extends TextAction
+ public static class InsertBreakAction extends TextAction
{
/**
@@ -273,8 +265,7 @@ public class DefaultEditorKit extends EditorKit
*/
// FIXME: Figure out what this Action is supposed to do. Obviously text
// that is entered by the user is inserted through DefaultKeyTypedAction.
- public static class InsertContentAction
- extends TextAction
+ public static class InsertContentAction extends TextAction
{
/**
@@ -292,14 +283,15 @@ public class DefaultEditorKit extends EditorKit
*/
public void actionPerformed(ActionEvent event)
{
+ // FIXME: Figure out what this Action is supposed to do. Obviously text
+ // that is entered by the user is inserted through DefaultKeyTypedAction.
}
}
/**
* Inserts a TAB character into the text editor.
*/
- public static class InsertTabAction
- extends TextAction
+ public static class InsertTabAction extends TextAction
{
/**
@@ -699,6 +691,7 @@ public class DefaultEditorKit extends EditorKit
*/
public DefaultEditorKit()
{
+ // Nothing to do here.
}
/**
@@ -954,15 +947,23 @@ public class DefaultEditorKit extends EditorKit
* @param offset the beginning offset from where to write
* @param len the length of the fragment to write
*
- * @throws BadLocationException if <code>offset</code> or
- * <code>offset + len</code>is an invalid location inside
- * <code>document</code>
+ * @throws BadLocationException if <code>offset</code> is an
+ * invalid location inside <code>document</code>.
* @throws IOException if something goes wrong while writing to
* <code>out</code>
*/
public void write(Writer out, Document document, int offset, int len)
- throws BadLocationException, IOException
+ throws BadLocationException, IOException
{
- // TODO: Implement this properly.
+ // Throw a BLE if offset is invalid
+ if (offset < 0 || offset > document.getLength())
+ throw new BadLocationException("Tried to write to invalid location",
+ offset);
+
+ // If they gave an overly large len, just adjust it
+ if (offset + len > document.getLength())
+ len = document.getLength() - offset;
+
+ out.write(document.getText(offset, len));
}
}
diff --git a/libjava/classpath/javax/swing/text/DefaultFormatter.java b/libjava/classpath/javax/swing/text/DefaultFormatter.java
index c97d90703c7..f9e0f10e654 100644
--- a/libjava/classpath/javax/swing/text/DefaultFormatter.java
+++ b/libjava/classpath/javax/swing/text/DefaultFormatter.java
@@ -57,8 +57,7 @@ import javax.swing.JFormattedTextField;
*
* @author Roman Kennke (roman@kennke.org)
*/
-public class DefaultFormatter
- extends JFormattedTextField.AbstractFormatter
+public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
implements Cloneable, Serializable
{
@@ -156,9 +155,6 @@ public class DefaultFormatter
* Checks if the value in the input field is valid. If the
* property allowsInvalid is set to <code>false</code>, then
* the string in the input field is not allowed to be entered.
- *
- * @param doc the document of the input field
- * @param value the current (old) value of the input field
*/
private void checkValidInput()
{
@@ -179,15 +175,18 @@ public class DefaultFormatter
catch (ParseException pe)
{
// if that happens, something serious must be wrong
- throw new AssertionError("values must be parseable");
+ AssertionError ae;
+ ae = new AssertionError("values must be parseable");
+ ae.initCause(pe);
+ throw ae;
}
}
}
}
}
- /** The serialVersoinUID. */
- private static final long serialVersionUID = -7369196326612908900L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -355018354457785329L;
/**
* Indicates if the value should be committed after every
diff --git a/libjava/classpath/javax/swing/text/DefaultHighlighter.java b/libjava/classpath/javax/swing/text/DefaultHighlighter.java
index c8d874caa51..40ea4f80aab 100644
--- a/libjava/classpath/javax/swing/text/DefaultHighlighter.java
+++ b/libjava/classpath/javax/swing/text/DefaultHighlighter.java
@@ -168,6 +168,7 @@ public class DefaultHighlighter extends LayeredHighlighter
public DefaultHighlighter()
{
+ // Nothing to do here.
}
public boolean getDrawsLayeredHighlights()
@@ -238,6 +239,7 @@ public class DefaultHighlighter extends LayeredHighlighter
Shape viewBounds, JTextComponent editor,
View view)
{
+ // TODO: Implement this properly.
}
public void paint(Graphics g)
diff --git a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
index 3545e52c453..eb56bb0f8e5 100644
--- a/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
+++ b/libjava/classpath/javax/swing/text/DefaultStyledDocument.java
@@ -1,5 +1,5 @@
/* DefaultStyledDocument.java --
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,8 +41,14 @@ package javax.swing.text;
import java.awt.Color;
import java.awt.Font;
import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Vector;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
+import javax.swing.undo.AbstractUndoableEdit;
+import javax.swing.undo.UndoableEdit;
/**
* The default implementation of {@link StyledDocument}.
@@ -60,12 +66,359 @@ public class DefaultStyledDocument extends AbstractDocument
implements StyledDocument
{
/**
+ * An {@link UndoableEdit} that can undo attribute changes to an element.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ public static class AttributeUndoableEdit
+ extends AbstractUndoableEdit
+ {
+ /**
+ * A copy of the old attributes.
+ */
+ protected AttributeSet copy;
+
+ /**
+ * The new attributes.
+ */
+ protected AttributeSet newAttributes;
+
+ /**
+ * If the new attributes replaced the old attributes or if they only were
+ * added to them.
+ */
+ protected boolean isReplacing;
+
+ /**
+ * The element that has changed.
+ */
+ protected Element element;
+
+ /**
+ * Creates a new <code>AttributeUndoableEdit</code>.
+ *
+ * @param el the element that changes attributes
+ * @param newAtts the new attributes
+ * @param replacing if the new attributes replace the old or only append to
+ * them
+ */
+ public AttributeUndoableEdit(Element el, AttributeSet newAtts,
+ boolean replacing)
+ {
+ element = el;
+ newAttributes = newAtts;
+ isReplacing = replacing;
+ copy = el.getAttributes().copyAttributes();
+ }
+
+ /**
+ * Undos the attribute change. The <code>copy</code> field is set as
+ * attributes on <code>element</code>.
+ */
+ public void undo()
+ {
+ super.undo();
+ AttributeSet atts = element.getAttributes();
+ if (atts instanceof MutableAttributeSet)
+ {
+ MutableAttributeSet mutable = (MutableAttributeSet) atts;
+ mutable.removeAttributes(atts);
+ mutable.addAttributes(copy);
+ }
+ }
+
+ /**
+ * Redos an attribute change. This adds <code>newAttributes</code> to the
+ * <code>element</code>'s attribute set, possibly clearing all attributes
+ * if <code>isReplacing</code> is true.
+ */
+ public void redo()
+ {
+ super.undo();
+ AttributeSet atts = element.getAttributes();
+ if (atts instanceof MutableAttributeSet)
+ {
+ MutableAttributeSet mutable = (MutableAttributeSet) atts;
+ if (isReplacing)
+ mutable.removeAttributes(atts);
+ mutable.addAttributes(newAttributes);
+ }
+ }
+ }
+
+ /**
+ * Carries specification information for new {@link Element}s that should
+ * be created in {@link ElementBuffer}. This allows the parsing process
+ * to be decoupled from the <code>Element</code> creation process.
+ */
+ public static class ElementSpec
+ {
+ /**
+ * This indicates a start tag. This is a possible value for
+ * {@link #getType}.
+ */
+ public static final short StartTagType = 1;
+
+ /**
+ * This indicates an end tag. This is a possible value for
+ * {@link #getType}.
+ */
+ public static final short EndTagType = 2;
+
+ /**
+ * This indicates a content element. This is a possible value for
+ * {@link #getType}.
+ */
+ public static final short ContentType = 3;
+
+ /**
+ * This indicates that the data associated with this spec should be joined
+ * with what precedes it. This is a possible value for
+ * {@link #getDirection}.
+ */
+ public static final short JoinPreviousDirection = 4;
+
+ /**
+ * This indicates that the data associated with this spec should be joined
+ * with what follows it. This is a possible value for
+ * {@link #getDirection}.
+ */
+ public static final short JoinNextDirection = 5;
+
+ /**
+ * This indicates that the data associated with this spec should be used
+ * to create a new element. This is a possible value for
+ * {@link #getDirection}.
+ */
+ public static final short OriginateDirection = 6;
+
+ /**
+ * This indicates that the data associated with this spec should be joined
+ * to the fractured element. This is a possible value for
+ * {@link #getDirection}.
+ */
+ public static final short JoinFractureDirection = 7;
+
+ /**
+ * The type of the tag.
+ */
+ short type;
+
+ /**
+ * The direction of the tag.
+ */
+ short direction;
+
+ /**
+ * The offset of the content.
+ */
+ int offset;
+
+ /**
+ * The length of the content.
+ */
+ int length;
+
+ /**
+ * The actual content.
+ */
+ char[] content;
+
+ /**
+ * The attributes for the tag.
+ */
+ AttributeSet attributes;
+
+ /**
+ * Creates a new <code>ElementSpec</code> with no content, length or
+ * offset. This is most useful for start and end tags.
+ *
+ * @param a the attributes for the element to be created
+ * @param type the type of the tag
+ */
+ public ElementSpec(AttributeSet a, short type)
+ {
+ this(a, type, 0);
+ }
+
+ /**
+ * Creates a new <code>ElementSpec</code> that specifies the length but
+ * not the offset of an element. Such <code>ElementSpec</code>s are
+ * processed sequentially from a known starting point.
+ *
+ * @param a the attributes for the element to be created
+ * @param type the type of the tag
+ * @param len the length of the element
+ */
+ public ElementSpec(AttributeSet a, short type, int len)
+ {
+ this(a, type, null, 0, len);
+ }
+
+ /**
+ * Creates a new <code>ElementSpec</code> with document content.
+ *
+ * @param a the attributes for the element to be created
+ * @param type the type of the tag
+ * @param txt the actual content
+ * @param offs the offset into the <code>txt</code> array
+ * @param len the length of the element
+ */
+ public ElementSpec(AttributeSet a, short type, char[] txt, int offs,
+ int len)
+ {
+ attributes = a;
+ this.type = type;
+ offset = offs;
+ length = len;
+ content = txt;
+ direction = OriginateDirection;
+ }
+
+ /**
+ * Sets the type of the element.
+ *
+ * @param type the type of the element to be set
+ */
+ public void setType(short type)
+ {
+ this.type = type;
+ }
+
+ /**
+ * Returns the type of the element.
+ *
+ * @return the type of the element
+ */
+ public short getType()
+ {
+ return type;
+ }
+
+ /**
+ * Sets the direction of the element.
+ *
+ * @param dir the direction of the element to be set
+ */
+ public void setDirection(short dir)
+ {
+ direction = dir;
+ }
+
+ /**
+ * Returns the direction of the element.
+ *
+ * @return the direction of the element
+ */
+ public short getDirection()
+ {
+ return direction;
+ }
+
+ /**
+ * Returns the attributes of the element.
+ *
+ * @return the attributes of the element
+ */
+ public AttributeSet getAttributes()
+ {
+ return attributes;
+ }
+
+ /**
+ * Returns the actual content of the element.
+ *
+ * @return the actual content of the element
+ */
+ public char[] getArray()
+ {
+ return content;
+ }
+
+ /**
+ * Returns the offset of the content.
+ *
+ * @return the offset of the content
+ */
+ public int getOffset()
+ {
+ return offset;
+ }
+
+ /**
+ * Returns the length of the content.
+ *
+ * @return the length of the content
+ */
+ public int getLength()
+ {
+ return length;
+ }
+
+ /**
+ * Returns a String representation of this <code>ElementSpec</code>
+ * describing the type, direction and length of this
+ * <code>ElementSpec</code>.
+ *
+ * @return a String representation of this <code>ElementSpec</code>
+ */
+ public String toString()
+ {
+ StringBuilder b = new StringBuilder();
+ b.append('<');
+ switch (type)
+ {
+ case StartTagType:
+ b.append("StartTag");
+ break;
+ case EndTagType:
+ b.append("EndTag");
+ break;
+ case ContentType:
+ b.append("Content");
+ break;
+ default:
+ b.append("??");
+ break;
+ }
+
+ b.append(':');
+
+ switch (direction)
+ {
+ case JoinPreviousDirection:
+ b.append("JoinPrevious");
+ break;
+ case JoinNextDirection:
+ b.append("JoinNext");
+ break;
+ case OriginateDirection:
+ b.append("Originate");
+ break;
+ case JoinFractureDirection:
+ b.append("Fracture");
+ break;
+ default:
+ b.append("??");
+ break;
+ }
+
+ b.append(':');
+ b.append(length);
+
+ return b.toString();
+ }
+ }
+
+ /**
* Performs all <em>structural</code> changes to the <code>Element</code>
* hierarchy.
*/
- public class ElementBuffer
- implements Serializable
+ public class ElementBuffer implements Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 1688745877691146623L;
+
/** The root element of the hierarchy. */
private Element root;
@@ -76,6 +429,19 @@ public class DefaultStyledDocument extends AbstractDocument
private int length;
/**
+ * Holds fractured elements during insertion of end and start tags.
+ * Inserting an end tag may lead to fracturing of the current paragraph
+ * element. The elements that have been cut off may be added to the
+ * next paragraph that is created in the next start tag.
+ */
+ Element[] fracture;
+
+ /**
+ * The ElementChange that describes the latest changes.
+ */
+ DefaultDocumentEvent documentEvent;
+
+ /**
* Creates a new <code>ElementBuffer</code> for the specified
* <code>root</code> element.
*
@@ -114,6 +480,7 @@ public class DefaultStyledDocument extends AbstractDocument
{
this.offset = offset;
this.length = length;
+ documentEvent = ev;
changeUpdate();
}
@@ -142,38 +509,352 @@ public class DefaultStyledDocument extends AbstractDocument
void split(Element el, int offset)
{
if (el instanceof AbstractElement)
- {
- AbstractElement ael = (AbstractElement) el;
- int startOffset = ael.getStartOffset();
- int endOffset = ael.getEndOffset();
- int len = endOffset - startOffset;
- if (startOffset != offset && endOffset != offset)
- {
- Element paragraph = ael.getParentElement();
- if (paragraph instanceof BranchElement)
- {
- BranchElement par = (BranchElement) paragraph;
- Element child1 = createLeafElement(par, ael, startOffset,
- offset);
- Element child2 = createLeafElement(par, ael, offset,
- endOffset);
- int index = par.getElementIndex(startOffset);
- par.replace(index, 1, new Element[]{ child1, child2 });
- }
+ {
+ AbstractElement ael = (AbstractElement) el;
+ int startOffset = ael.getStartOffset();
+ int endOffset = ael.getEndOffset();
+ int len = endOffset - startOffset;
+ if (startOffset != offset && endOffset != offset)
+ {
+ Element paragraph = ael.getParentElement();
+ if (paragraph instanceof BranchElement)
+ {
+ BranchElement par = (BranchElement) paragraph;
+ Element child1 = createLeafElement(par, ael, startOffset,
+ offset);
+ Element child2 = createLeafElement(par, ael, offset,
+ endOffset);
+ int index = par.getElementIndex(startOffset);
+ Element[] add = new Element[]{ child1, child2 };
+ par.replace(index, 1, add);
+ documentEvent.addEdit(new ElementEdit(par, index,
+ new Element[]{ el },
+ add));
+ }
else
throw new AssertionError("paragraph elements are expected to "
+ "be instances of "
+ "javax.swing.text.AbstractDocument.BranchElement");
- }
- }
+ }
+ }
else
- throw new AssertionError("content elements are expected to be "
- + "instances of "
+ throw new AssertionError("content elements are expected to be "
+ + "instances of "
+ "javax.swing.text.AbstractDocument.AbstractElement");
}
+
+ /**
+ * Inserts new <code>Element</code> in the document at the specified
+ * position.
+ *
+ * Most of the work is done by {@link #insertUpdate}, after some fields
+ * have been prepared for it.
+ *
+ * @param offset the location in the document at which the content is
+ * inserted
+ * @param length the length of the inserted content
+ * @param data the element specifications for the content to be inserted
+ * @param ev the document event that is updated to reflect the structural
+ * changes
+ */
+ public void insert(int offset, int length, ElementSpec[] data,
+ DefaultDocumentEvent ev)
+ {
+ this.offset = offset;
+ this.length = length;
+ documentEvent = ev;
+ insertUpdate(data);
+ }
+
+ /**
+ * Performs the actual structural change for {@link #insert}. This
+ * creates a bunch of {@link Element}s as specified by <code>data</code>
+ * and inserts it into the document as specified in the arguments to
+ * {@link #insert}.
+ *
+ * @param data the element specifications for the elements to be inserte
+ */
+ protected void insertUpdate(ElementSpec[] data)
+ {
+ for (int i = 0; i < data.length; i++)
+ {
+ switch (data[i].getType())
+ {
+ case ElementSpec.StartTagType:
+ insertStartTag(data[i]);
+ break;
+ case ElementSpec.EndTagType:
+ insertEndTag(data[i]);
+ break;
+ default:
+ insertContentTag(data[i]);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Insert a new paragraph after the paragraph at the current position.
+ *
+ * @param tag the element spec that describes the element to be inserted
+ */
+ void insertStartTag(ElementSpec tag)
+ {
+ BranchElement root = (BranchElement) getDefaultRootElement();
+ int index = root.getElementIndex(offset);
+ if (index == -1)
+ index = 0;
+
+ BranchElement newParagraph =
+ (BranchElement) createBranchElement(root, tag.getAttributes());
+ newParagraph.setResolveParent(getStyle(StyleContext.DEFAULT_STYLE));
+
+ // Add new paragraph into document structure.
+ Element[] added = new Element[]{newParagraph};
+ root.replace(index + 1, 0, added);
+ ElementEdit edit = new ElementEdit(root, index + 1, new Element[0],
+ added);
+ documentEvent.addEdit(edit);
+
+ // Maybe add fractured elements.
+ if (tag.getDirection() == ElementSpec.JoinFractureDirection)
+ {
+ Element[] newFracture = new Element[fracture.length];
+ for (int i = 0; i < fracture.length; i++)
+ {
+ Element oldLeaf = fracture[i];
+ Element newLeaf = createLeafElement(newParagraph,
+ oldLeaf.getAttributes(),
+ oldLeaf.getStartOffset(),
+ oldLeaf.getEndOffset());
+ newFracture[i] = newLeaf;
+ }
+ newParagraph.replace(0, 0, newFracture);
+ edit = new ElementEdit(newParagraph, 0, new Element[0],
+ fracture);
+ documentEvent.addEdit(edit);
+ fracture = new Element[0];
+ }
+ }
+
+ /**
+ * Inserts an end tag into the document structure. This cuts of the
+ * current paragraph element, possibly fracturing it's child elements.
+ * The fractured elements are saved so that they can be joined later
+ * with a new paragraph element.
+ */
+ void insertEndTag(ElementSpec tag)
+ {
+ BranchElement root = (BranchElement) getDefaultRootElement();
+ int parIndex = root.getElementIndex(offset);
+ BranchElement paragraph = (BranchElement) root.getElement(parIndex);
+
+ int index = paragraph.getElementIndex(offset);
+ LeafElement content = (LeafElement) paragraph.getElement(index);
+ // We might have to split the element at offset.
+ split(content, offset);
+ index = paragraph.getElementIndex(offset);
+
+ int count = paragraph.getElementCount();
+ // Store fractured elements.
+ fracture = new Element[count - index];
+ for (int i = index; i < count; ++i)
+ fracture[i - index] = paragraph.getElement(i);
+
+ // Delete fractured elements.
+ paragraph.replace(index, count - index, new Element[0]);
+
+ // Add this action to the document event.
+ ElementEdit edit = new ElementEdit(paragraph, index, fracture,
+ new Element[0]);
+ documentEvent.addEdit(edit);
+ }
+
+ /**
+ * Inserts a content element into the document structure.
+ *
+ * @param tag the element spec
+ */
+ void insertContentTag(ElementSpec tag)
+ {
+ int len = tag.getLength();
+ int dir = tag.getDirection();
+ if (dir == ElementSpec.JoinPreviousDirection)
+ {
+ Element prev = getCharacterElement(offset);
+ BranchElement prevParent = (BranchElement) prev.getParentElement();
+ Element join = createLeafElement(prevParent, tag.getAttributes(),
+ prev.getStartOffset(),
+ Math.max(prev.getEndOffset(),
+ offset + len));
+ int ind = prevParent.getElementIndex(offset);
+ if (ind == -1)
+ ind = 0;
+ Element[] add = new Element[]{join};
+ prevParent.replace(ind, 1, add);
+
+ // Add this action to the document event.
+ ElementEdit edit = new ElementEdit(prevParent, ind,
+ new Element[]{prev}, add);
+ documentEvent.addEdit(edit);
+ }
+ else if (dir == ElementSpec.JoinNextDirection)
+ {
+ Element next = getCharacterElement(offset + len);
+ BranchElement nextParent = (BranchElement) next.getParentElement();
+ Element join = createLeafElement(nextParent, tag.getAttributes(),
+ offset,
+ next.getEndOffset());
+ int ind = nextParent.getElementIndex(offset + len);
+ if (ind == -1)
+ ind = 0;
+ Element[] add = new Element[]{join};
+ nextParent.replace(ind, 1, add);
+
+ // Add this action to the document event.
+ ElementEdit edit = new ElementEdit(nextParent, ind,
+ new Element[]{next}, add);
+ documentEvent.addEdit(edit);
+ }
+ else
+ {
+ BranchElement par = (BranchElement) getParagraphElement(offset);
+
+ int ind = par.getElementIndex(offset);
+
+ // Make room for the element.
+ // Cut previous element.
+ Element prev = par.getElement(ind);
+ if (prev != null && prev.getStartOffset() < offset)
+ {
+ Element cutPrev = createLeafElement(par, prev.getAttributes(),
+ prev.getStartOffset(),
+ offset);
+ Element[] remove = new Element[]{prev};
+ Element[] add = new Element[]{cutPrev};
+ if (prev.getEndOffset() > offset + len)
+ {
+ Element rem = createLeafElement(par, prev.getAttributes(),
+ offset + len,
+ prev.getEndOffset());
+ add = new Element[]{cutPrev, rem};
+ }
+
+ par.replace(ind, 1, add);
+ documentEvent.addEdit(new ElementEdit(par, ind, remove, add));
+ ind++;
+ }
+ // ind now points to the next element.
+
+ // Cut next element if necessary.
+ Element next = par.getElement(ind);
+ if (next != null && next.getStartOffset() < offset + len)
+ {
+ Element cutNext = createLeafElement(par, next.getAttributes(),
+ offset + len,
+ next.getEndOffset());
+ Element[] remove = new Element[]{next};
+ Element[] add = new Element[]{cutNext};
+ par.replace(ind, 1, add);
+ documentEvent.addEdit(new ElementEdit(par, ind, remove,
+ add));
+ }
+
+ // Insert new element.
+ Element newEl = createLeafElement(par, tag.getAttributes(),
+ offset, offset + len);
+ Element[] added = new Element[]{newEl};
+ par.replace(ind, 0, added);
+ // Add this action to the document event.
+ ElementEdit edit = new ElementEdit(par, ind, new Element[0],
+ added);
+ documentEvent.addEdit(edit);
+ }
+ offset += len;
+ }
+
+ /**
+ * Creates a copy of the element <code>clonee</code> that has the parent
+ * <code>parent</code>.
+ * @param parent the parent of the newly created Element
+ * @param clonee the Element to clone
+ * @return the cloned Element
+ */
+ public Element clone (Element parent, Element clonee)
+ {
+ // If the Element we want to clone is a leaf, then simply copy it
+ if (clonee.isLeaf())
+ return createLeafElement(parent, clonee.getAttributes(),
+ clonee.getStartOffset(), clonee.getEndOffset());
+
+ // Otherwise create a new BranchElement with the desired parent and
+ // the clonee's attributes
+ BranchElement result = (BranchElement) createBranchElement(parent, clonee.getAttributes());
+
+ // And clone all the of clonee's children
+ Element[] children = new Element[clonee.getElementCount()];
+ for (int i = 0; i < children.length; i++)
+ children[i] = clone(result, clonee.getElement(i));
+
+ // Make the cloned children the children of the BranchElement
+ result.replace(0, 0, children);
+ return result;
+ }
}
/**
+ * An element type for sections. This is a simple BranchElement with
+ * a unique name.
+ */
+ protected class SectionElement extends BranchElement
+ {
+ /**
+ * Creates a new SectionElement.
+ */
+ public SectionElement()
+ {
+ super(null, null);
+ }
+
+ /**
+ * Returns the name of the element. This method always returns
+ * &quot;section&quot;.
+ *
+ * @return the name of the element
+ */
+ public String getName()
+ {
+ return "section";
+ }
+ }
+
+ /**
+ * Receives notification when any of the document's style changes and calls
+ * {@link DefaultStyledDocument#styleChanged(Style)}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ private class StyleChangeListener
+ implements ChangeListener
+ {
+
+ /**
+ * Receives notification when any of the document's style changes and calls
+ * {@link DefaultStyledDocument#styleChanged(Style)}.
+ *
+ * @param event the change event
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ Style style = (Style) event.getSource();
+ styleChanged(style);
+ }
+ }
+
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 940485415728614849L;
+
+ /**
* The default size to use for new content buffers.
*/
public static final int BUFFER_SIZE_DEFAULT = 4096;
@@ -185,6 +866,11 @@ public class DefaultStyledDocument extends AbstractDocument
protected DefaultStyledDocument.ElementBuffer buffer;
/**
+ * Listens for changes on this document's styles and notifies styleChanged().
+ */
+ private StyleChangeListener styleChangeListener;
+
+ /**
* Creates a new <code>DefaultStyledDocument</code>.
*/
public DefaultStyledDocument()
@@ -237,7 +923,14 @@ public class DefaultStyledDocument extends AbstractDocument
public Style addStyle(String nm, Style parent)
{
StyleContext context = (StyleContext) getAttributeContext();
- return context.addStyle(nm, parent);
+ Style newStyle = context.addStyle(nm, parent);
+
+ // Register change listener.
+ if (styleChangeListener == null)
+ styleChangeListener = new StyleChangeListener();
+ newStyle.addChangeListener(styleChangeListener);
+
+ return newStyle;
}
/**
@@ -250,9 +943,11 @@ public class DefaultStyledDocument extends AbstractDocument
Element[] tmp;
// FIXME: Create a SecionElement here instead of a BranchElement.
// Use createBranchElement() and createLeafElement instead.
- BranchElement section = new BranchElement(null, null);
-
- BranchElement paragraph = new BranchElement(section, null);
+ SectionElement section = new SectionElement();
+
+ BranchElement paragraph =
+ (BranchElement) createBranchElement(section, null);
+ paragraph.setResolveParent(getStyle(StyleContext.DEFAULT_STYLE));
tmp = new Element[1];
tmp[0] = paragraph;
section.replace(0, 0, tmp);
@@ -261,7 +956,7 @@ public class DefaultStyledDocument extends AbstractDocument
tmp = new Element[1];
tmp[0] = leaf;
paragraph.replace(0, 0, tmp);
-
+
return section;
}
@@ -279,10 +974,10 @@ public class DefaultStyledDocument extends AbstractDocument
{
Element element = getDefaultRootElement();
- while (! element.isLeaf())
+ while (!element.isLeaf())
{
- int index = element.getElementIndex(position);
- element = element.getElement(index);
+ int index = element.getElementIndex(position);
+ element = element.getElement(index);
}
return element;
@@ -353,6 +1048,10 @@ public class DefaultStyledDocument extends AbstractDocument
/**
* Returns the paragraph element for the specified position.
+ * If the position is outside the bounds of the document's root element,
+ * then the closest element is returned. That is the last paragraph if
+ * <code>position >= endIndex</code> or the first paragraph if
+ * <code>position < startIndex</code>.
*
* @param position the position for which to query the paragraph element
*
@@ -360,8 +1059,18 @@ public class DefaultStyledDocument extends AbstractDocument
*/
public Element getParagraphElement(int position)
{
- Element element = getCharacterElement(position);
- return element.getParentElement();
+ BranchElement root = (BranchElement) getDefaultRootElement();
+ int start = root.getStartOffset();
+ int end = root.getEndOffset();
+ if (position >= end)
+ position = end - 1;
+ else if (position < start)
+ position = start;
+
+ Element par = root.positionToElement(position);
+
+ assert par != null : "The paragraph element must not be null";
+ return par;
}
/**
@@ -416,35 +1125,37 @@ public class DefaultStyledDocument extends AbstractDocument
int paragraphCount = root.getElementCount();
for (int pindex = 0; pindex < paragraphCount; pindex++)
{
- Element paragraph = root.getElement(pindex);
- // Skip paragraphs that lie outside the interval.
- if ((paragraph.getStartOffset() > offset + length)
- || (paragraph.getEndOffset() < offset))
- continue;
-
- // Visit content elements within this paragraph
- int contentCount = paragraph.getElementCount();
- for (int cindex = 0; cindex < contentCount; cindex++)
- {
- Element content = paragraph.getElement(cindex);
- // Skip content that lies outside the interval.
- if ((content.getStartOffset() > offset + length)
- || (content.getEndOffset() < offset))
- continue;
-
- if (content instanceof AbstractElement)
- {
- AbstractElement el = (AbstractElement) content;
- if (replace)
- el.removeAttributes(el);
- el.addAttributes(attributes);
- }
- else
- throw new AssertionError("content elements are expected to be"
- + "instances of "
+ Element paragraph = root.getElement(pindex);
+ // Skip paragraphs that lie outside the interval.
+ if ((paragraph.getStartOffset() > offset + length)
+ || (paragraph.getEndOffset() < offset))
+ continue;
+
+ // Visit content elements within this paragraph
+ int contentCount = paragraph.getElementCount();
+ for (int cindex = 0; cindex < contentCount; cindex++)
+ {
+ Element content = paragraph.getElement(cindex);
+ // Skip content that lies outside the interval.
+ if ((content.getStartOffset() > offset + length)
+ || (content.getEndOffset() < offset))
+ continue;
+
+ if (content instanceof AbstractElement)
+ {
+ AbstractElement el = (AbstractElement) content;
+ if (replace)
+ el.removeAttributes(el);
+ el.addAttributes(attributes);
+ }
+ else
+ throw new AssertionError("content elements are expected to be"
+ + "instances of "
+ "javax.swing.text.AbstractDocument.AbstractElement");
- }
+ }
}
+
+ fireChangedUpdate(ev);
}
/**
@@ -476,10 +1187,199 @@ public class DefaultStyledDocument extends AbstractDocument
* selection are overridden, otherwise they are merged
*/
public void setParagraphAttributes(int offset, int length,
- AttributeSet attributes,
- boolean replace)
+ AttributeSet attributes,
+ boolean replace)
+ {
+ int index = offset;
+ while (index < offset + length)
+ {
+ AbstractElement par = (AbstractElement) getParagraphElement(index);
+ AttributeContext ctx = getAttributeContext();
+ if (replace)
+ par.removeAttributes(par);
+ par.addAttributes(attributes);
+ index = par.getElementCount();
+ }
+ }
+
+ /**
+ * Called in response to content insert actions. This is used to
+ * update the element structure.
+ *
+ * @param ev the <code>DocumentEvent</code> describing the change
+ * @param attr the attributes for the change
+ */
+ protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr)
+ {
+ super.insertUpdate(ev, attr);
+ int offset = ev.getOffset();
+ int length = ev.getLength();
+ int endOffset = offset + length;
+ Segment txt = new Segment();
+ try
+ {
+ getText(offset, length, txt);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(ex);
+ throw ae;
+ }
+
+ int len = 0;
+ Vector specs = new Vector();
+
+ Element prev = getCharacterElement(offset);
+ Element next = getCharacterElement(endOffset);
+
+ for (int i = offset; i < endOffset; ++i)
+ {
+ len++;
+ if (txt.array[i] == '\n')
+ {
+ ElementSpec spec = new ElementSpec(attr, ElementSpec.ContentType,
+ len);
+
+ // If we are at the last index, then check if we could probably be
+ // joined with the next element.
+ if (i == endOffset - 1)
+ {
+ if (next.getAttributes().isEqual(attr))
+ spec.setDirection(ElementSpec.JoinNextDirection);
+ }
+ // If we are at the first new element, then check if it could be
+ // joined with the previous element.
+ else if (specs.size() == 0)
+ {
+ if (prev.getAttributes().isEqual(attr))
+ spec.setDirection(ElementSpec.JoinPreviousDirection);
+ }
+
+ specs.add(spec);
+
+ // Add ElementSpecs for the newline.
+ ElementSpec endTag = new ElementSpec(null, ElementSpec.EndTagType);
+ specs.add(endTag);
+ ElementSpec startTag = new ElementSpec(null,
+ ElementSpec.StartTagType);
+ startTag.setDirection(ElementSpec.JoinFractureDirection);
+ specs.add(startTag);
+
+ len = 0;
+ offset += len;
+ }
+ }
+
+ // Create last element if last character hasn't been a newline.
+ if (len > 0)
+ {
+ ElementSpec spec = new ElementSpec(attr, ElementSpec.ContentType, len);
+ // If we are at the first new element, then check if it could be
+ // joined with the previous element.
+ if (specs.size() == 0)
+ {
+ if (prev.getAttributes().isEqual(attr))
+ spec.setDirection(ElementSpec.JoinPreviousDirection);
+ }
+ // Check if we could probably be joined with the next element.
+ else if (next.getAttributes().isEqual(attr))
+ spec.setDirection(ElementSpec.JoinNextDirection);
+
+ specs.add(spec);
+ }
+
+ ElementSpec[] elSpecs =
+ (ElementSpec[]) specs.toArray(new ElementSpec[specs.size()]);
+
+ buffer.insert(offset, length, elSpecs, ev);
+ }
+
+ /**
+ * Returns an enumeration of all style names.
+ *
+ * @return an enumeration of all style names
+ */
+ public Enumeration getStyleNames()
+ {
+ StyleContext context = (StyleContext) getAttributeContext();
+ return context.getStyleNames();
+ }
+
+ /**
+ * Called when any of this document's styles changes.
+ *
+ * @param style the style that changed
+ */
+ protected void styleChanged(Style style)
{
- // FIXME: Implement me.
- throw new Error("not implemented");
+ // Nothing to do here. This is intended to be overridden by subclasses.
+ }
+
+ /**
+ * Inserts a bulk of structured content at once.
+ *
+ * @param offset the offset at which the content should be inserted
+ * @param data the actual content spec to be inserted
+ */
+ protected void insert(int offset, ElementSpec[] data)
+ throws BadLocationException
+ {
+ writeLock();
+ // First we insert the content.
+ int index = offset;
+ for (int i = 0; i < data.length; i++)
+ {
+ ElementSpec spec = data[i];
+ if (spec.getArray() != null && spec.getLength() > 0)
+ {
+ String insertString = new String(spec.getArray(), spec.getOffset(),
+ spec.getLength());
+ content.insertString(index, insertString);
+ }
+ index += spec.getLength();
+ }
+ // Update the view structure.
+ DefaultDocumentEvent ev = new DefaultDocumentEvent(offset, index - offset,
+ DocumentEvent.EventType.INSERT);
+ for (int i = 0; i < data.length; i++)
+ {
+ ElementSpec spec = data[i];
+ AttributeSet atts = spec.getAttributes();
+ if (atts != null)
+ insertUpdate(ev, atts);
+ }
+
+ // Finally we must update the document structure and fire the insert update
+ // event.
+ buffer.insert(offset, index - offset, data, ev);
+ fireInsertUpdate(ev);
+ writeUnlock();
+ }
+
+ /**
+ * Initializes the <code>DefaultStyledDocument</code> with the specified
+ * data.
+ *
+ * @param data the specification of the content with which the document is
+ * initialized
+ */
+ protected void create(ElementSpec[] data)
+ {
+ try
+ {
+ // Clear content.
+ content.remove(0, content.length());
+ // Clear buffer and root element.
+ buffer = new ElementBuffer(createDefaultRoot());
+ // Insert the data.
+ insert(0, data);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("Unexpected bad location");
+ err.initCause(ex);
+ throw err;
+ }
}
}
diff --git a/libjava/classpath/javax/swing/text/DefaultTextUI.java b/libjava/classpath/javax/swing/text/DefaultTextUI.java
new file mode 100644
index 00000000000..e7ff01845e6
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/DefaultTextUI.java
@@ -0,0 +1,61 @@
+/* DefaultTextUI.java -- Deprecated base UI for text components
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import javax.swing.plaf.basic.BasicTextUI;
+
+/**
+ * This class is deprecated and should not be used anymore. The base UI for
+ * all text components is now {@link BasicTextUI}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public abstract class DefaultTextUI extends BasicTextUI
+{
+ /**
+ * This class is deprecated and should not be used anymore. The base UI for
+ * all text components is now {@link BasicTextUI}.
+ *
+ * @deprecated use {@link BasicTextUI} instead
+ */
+ public DefaultTextUI()
+ {
+ // Nothing to do here.
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/EditorKit.java b/libjava/classpath/javax/swing/text/EditorKit.java
index bd51a866f68..8719aee595f 100644
--- a/libjava/classpath/javax/swing/text/EditorKit.java
+++ b/libjava/classpath/javax/swing/text/EditorKit.java
@@ -48,24 +48,24 @@ import java.io.Writer;
import javax.swing.Action;
import javax.swing.JEditorPane;
-public abstract class EditorKit
- implements Cloneable, Serializable
+public abstract class EditorKit implements Cloneable, Serializable
{
private static final long serialVersionUID = -5044124649345887822L;
public EditorKit()
{
+ // Nothing to do here.
}
public Object clone()
{
try
{
- return super.clone();
+ return super.clone();
}
catch (CloneNotSupportedException e)
{
- return null;
+ return null;
}
}
@@ -74,10 +74,12 @@ public abstract class EditorKit
*/
public void deinstall(JEditorPane c)
{
+ // This default implementation does nothing.
}
public void install(JEditorPane c)
{
+ // This default implementation does nothing.
}
public abstract Caret createCaret();
diff --git a/libjava/classpath/javax/swing/text/FieldView.java b/libjava/classpath/javax/swing/text/FieldView.java
index e2e04d7c495..2496418444e 100644
--- a/libjava/classpath/javax/swing/text/FieldView.java
+++ b/libjava/classpath/javax/swing/text/FieldView.java
@@ -118,22 +118,24 @@ public class FieldView extends PlainView
FontMetrics fm = getFontMetrics();
if (axis == Y_AXIS)
- return fm.getHeight();
+ return super.getPreferredSpan(axis);
String text;
Element elem = getElement();
try
{
- text = elem.getDocument().getText(elem.getStartOffset(),
- elem.getEndOffset());
+ text = elem.getDocument().getText(elem.getStartOffset(),
+ elem.getEndOffset());
}
catch (BadLocationException e)
{
- // This should never happen.
- text = "";
+ // Should never happen
+ AssertionError ae = new AssertionError();
+ ae.initCause(e);
+ throw ae;
}
-
+
return fm.stringWidth(text);
}
@@ -159,18 +161,21 @@ public class FieldView extends PlainView
{
Shape newAlloc = adjustAllocation(shape);
super.insertUpdate(ev, newAlloc, vf);
+ getContainer().repaint();
}
public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
{
Shape newAlloc = adjustAllocation(shape);
super.removeUpdate(ev, newAlloc, vf);
+ getContainer().repaint();
}
public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf)
{
Shape newAlloc = adjustAllocation(shape);
super.removeUpdate(ev, newAlloc, vf);
+ getContainer().repaint();
}
public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias)
diff --git a/libjava/classpath/javax/swing/text/FlowView.java b/libjava/classpath/javax/swing/text/FlowView.java
index a6ef89efb78..765f515a20d 100644
--- a/libjava/classpath/javax/swing/text/FlowView.java
+++ b/libjava/classpath/javax/swing/text/FlowView.java
@@ -42,8 +42,10 @@ import java.awt.Container;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
+import java.util.Iterator;
import java.util.Vector;
+import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;
/**
@@ -71,6 +73,7 @@ public abstract class FlowView extends BoxView
*/
public FlowStrategy()
{
+ // Nothing to do here.
}
/**
@@ -137,7 +140,7 @@ public abstract class FlowView extends BoxView
* Performs the layout for the whole view. By default this rebuilds
* all the physical views from the logical views of the managed FlowView.
*
- * This is called by {@link FlowLayout#layout} to update the layout of
+ * This is called by {@link FlowView#layout} to update the layout of
* the view.
*
* @param fv the flow view for which we perform the layout
@@ -183,11 +186,17 @@ public abstract class FlowView extends BoxView
{
View child = createView(fv, offset, spanLeft, rowIndex);
if (child == null)
- break;
+ {
+ offset = -1;
+ break;
+ }
int span = (int) child.getPreferredSpan(flowAxis);
if (span > spanLeft)
- break;
+ {
+ offset = -1;
+ break;
+ }
row.append(child);
spanLeft -= span;
@@ -204,7 +213,7 @@ public abstract class FlowView extends BoxView
* not fit in the available span and also cannot be broken down).
*
* @param fv the flow view
- * @param startOffset the start offset for the view to be created
+ * @param offset the start offset for the view to be created
* @param spanLeft the available span
* @param rowIndex the index of the row
*
@@ -218,13 +227,15 @@ public abstract class FlowView extends BoxView
View logicalView = getLogicalView(fv);
int viewIndex = logicalView.getViewIndex(offset, Position.Bias.Forward);
+ if (viewIndex == -1)
+ return null;
+
View child = logicalView.getView(viewIndex);
int flowAxis = fv.getFlowAxis();
int span = (int) child.getPreferredSpan(flowAxis);
if (span <= spanLeft)
return child;
-
else if (child.getBreakWeight(flowAxis, offset, spanLeft)
> BadBreakWeight)
// FIXME: What to do with the pos parameter here?
@@ -326,7 +337,19 @@ public abstract class FlowView extends BoxView
*/
public int getViewIndex(int pos, Position.Bias b)
{
- return getElement().getElementIndex(pos);
+ int index = -1;
+ int i = 0;
+ for (Iterator it = children.iterator(); it.hasNext(); i++)
+ {
+ View child = (View) it.next();
+ if (child.getStartOffset() >= pos
+ && child.getEndOffset() < pos)
+ {
+ index = i;
+ break;
+ }
+ }
+ return index;
}
/**
@@ -373,6 +396,37 @@ public abstract class FlowView extends BoxView
throw new AssertionError("This method must not be called in "
+ "LogicalView.");
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ assert false : "getNextVisualPositionFrom() must not be called in "
+ + "LogicalView";
+ return 0;
+ }
}
/**
@@ -478,7 +532,7 @@ public abstract class FlowView extends BoxView
* The real children are created at layout time and each represent one
* row.
*
- * This method is called by {@link #setParent} in order to initialize
+ * This method is called by {@link View#setParent} in order to initialize
* the view.
*
* @param vf the view factory to use for creating the child views
@@ -502,7 +556,7 @@ public abstract class FlowView extends BoxView
/**
* Performs the layout of this view. If the span along the flow axis changed,
- * this first calls {@link FlowStrategy.layout} in order to rebuild the
+ * this first calls {@link FlowStrategy#layout} in order to rebuild the
* rows of this view. Then the superclass's behaviour is called to arrange
* the rows within the box.
*
@@ -547,6 +601,9 @@ public abstract class FlowView extends BoxView
*/
public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory vf)
{
+ // First we must send the insertUpdate to the logical view so it can
+ // be updated accordingly.
+ layoutPool.insertUpdate(changes, a, vf);
strategy.insertUpdate(this, changes, getInsideAllocation(a));
}
diff --git a/libjava/classpath/javax/swing/text/GapContent.java b/libjava/classpath/javax/swing/text/GapContent.java
index 1dd46c4b0f4..4c65de0f5f4 100644
--- a/libjava/classpath/javax/swing/text/GapContent.java
+++ b/libjava/classpath/javax/swing/text/GapContent.java
@@ -39,10 +39,15 @@ exception statement from your version. */
package javax.swing.text;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
+import java.util.Iterator;
import java.util.ListIterator;
+import java.util.Vector;
+import javax.swing.undo.AbstractUndoableEdit;
+import javax.swing.undo.CannotRedoException;
+import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
/**
@@ -59,7 +64,6 @@ import javax.swing.undo.UndoableEdit;
public class GapContent
implements AbstractDocument.Content, Serializable
{
-
/**
* A {@link Position} implementation for <code>GapContent</code>.
*/
@@ -114,6 +118,11 @@ public class GapContent
*/
public int getOffset()
{
+ // Check precondition.
+ assert mark <= gapStart || mark >= gapEnd : "mark: " + mark
+ + ", gapStart: " + gapStart
+ + ", gapEnd: " + gapEnd;
+
if (mark <= gapStart)
return mark;
else
@@ -121,13 +130,91 @@ public class GapContent
}
}
- private static final long serialVersionUID = 8374645204155842629L;
+ class UndoInsertString extends AbstractUndoableEdit
+ {
+ public int where, length;
+ String text;
+ public UndoInsertString(int start, int len)
+ {
+ where = start;
+ length = len;
+ }
+
+ public void undo () throws CannotUndoException
+ {
+ super.undo();
+ try
+ {
+ text = getString(where, length);
+ remove(where, length);
+ }
+ catch (BadLocationException ble)
+ {
+ throw new CannotUndoException();
+ }
+ }
+
+ public void redo () throws CannotUndoException
+ {
+ super.redo();
+ try
+ {
+ insertString(where, text);
+ }
+ catch (BadLocationException ble)
+ {
+ throw new CannotRedoException();
+ }
+ }
+
+ }
+
+ class UndoRemove extends AbstractUndoableEdit
+ {
+ public int where;
+ String text;
+ public UndoRemove(int start, String removedText)
+ {
+ where = start;
+ text = removedText;
+ }
+
+ public void undo () throws CannotUndoException
+ {
+ super.undo();
+ try
+ {
+ insertString(where, text);
+ }
+ catch (BadLocationException ble)
+ {
+ throw new CannotUndoException();
+ }
+ }
+
+ public void redo () throws CannotUndoException
+ {
+ super.redo();
+ try
+ {
+ remove(where, text.length());
+ }
+ catch (BadLocationException ble)
+ {
+ throw new CannotRedoException();
+ }
+ }
+
+ }
+
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6226052713477823730L;
/**
* This is the default buffer size and the amount of bytes that a buffer is
* extended if it is full.
*/
- static final int DEFAULT_BUFSIZE = 64;
+ static final int DEFAULT_BUFSIZE = 10;
/**
* The text buffer.
@@ -148,7 +235,7 @@ public class GapContent
* The positions generated by this GapContent. They are kept in an ordered
* fashion, so they can be looked up easily.
*/
- LinkedList positions;
+ ArrayList positions;
/**
* Creates a new GapContent object.
@@ -166,10 +253,10 @@ public class GapContent
public GapContent(int size)
{
buffer = (char[]) allocateArray(size);
- gapStart = 0;
- gapEnd = size - 1;
- buffer[size - 1] = '\n';
- positions = new LinkedList();
+ gapStart = 1;
+ gapEnd = size;
+ buffer[0] = '\n';
+ positions = new ArrayList();
}
/**
@@ -211,8 +298,7 @@ public class GapContent
* @param where the position where the string is inserted
* @param str the string that is to be inserted
*
- * @return an UndoableEdit object (currently not supported, so
- * <code>null</code> is returned)
+ * @return an UndoableEdit object
*
* @throws BadLocationException if <code>where</code> is not a valid
* location in the buffer
@@ -228,9 +314,9 @@ public class GapContent
throw new BadLocationException("the where argument cannot be greater"
+ " than the content length", where);
- replace(where, 0, str.toCharArray(), str.length());
+ replace(where, 0, str.toCharArray(), strLen);
- return null;
+ return new UndoInsertString(where, strLen);
}
/**
@@ -239,8 +325,7 @@ public class GapContent
* @param where the position where the content is to be removed
* @param nitems number of characters to be removed
*
- * @return an UndoableEdit object (currently not supported, so
- * <code>null</code> is returned)
+ * @return an UndoableEdit object
*
* @throws BadLocationException if <code>where</code> is not a valid
* location in the buffer
@@ -257,9 +342,10 @@ public class GapContent
throw new BadLocationException("where + nitems cannot be greater"
+ " than the content length", where + nitems);
+ String removedText = getString(where, nitems);
replace(where, nitems, null, 0);
- return null;
+ return new UndoRemove(where, removedText);
}
/**
@@ -372,7 +458,6 @@ public class GapContent
if (index < 0)
index = -(index + 1);
positions.add(index, pos);
-
return pos;
}
@@ -386,7 +471,14 @@ public class GapContent
*/
protected void shiftEnd(int newSize)
{
- int delta = (gapEnd - gapStart) - newSize;
+ assert newSize > (gapEnd - gapStart) : "The new gap size must be greater "
+ + "than the old gap size";
+
+ int delta = newSize - gapEnd + gapStart;
+ // Update the marks after the gapEnd.
+ adjustPositionsInRange(gapEnd, buffer.length - gapEnd, delta);
+
+ // Copy the data around.
char[] newBuf = (char[]) allocateArray(length() + newSize);
System.arraycopy(buffer, 0, newBuf, 0, gapStart);
System.arraycopy(buffer, gapEnd, newBuf, gapStart + newSize, buffer.length
@@ -394,18 +486,6 @@ public class GapContent
gapEnd = gapStart + newSize;
buffer = newBuf;
- // Update the marks after the gapEnd.
- int index = Collections.binarySearch(positions, new GapContentPosition(
- gapEnd));
- if (index < 0)
- {
- index = -(index + 1);
- }
- for (ListIterator i = positions.listIterator(index); i.hasNext();)
- {
- GapContentPosition p = (GapContentPosition) i.next();
- p.mark += delta;
- }
}
/**
@@ -415,32 +495,15 @@ public class GapContent
*/
protected void shiftGap(int newGapStart)
{
- int newGapEnd = newGapStart + (gapEnd - gapStart);
-
- // Update the positions between newGapEnd and (old) gapEnd. The marks
- // must be shifted by (gapEnd - newGapEnd).
- int index1 = Collections.binarySearch(positions,
- new GapContentPosition(gapEnd));
- int index2 = Collections.binarySearch(positions,
- new GapContentPosition(newGapEnd));
- if (index1 > 0 && index2 > 0)
- {
- int i1 = Math.min(index1, index2);
- int i2 = Math.max(index1, index2);
- for (ListIterator i = positions.listIterator(i1); i.hasNext();)
- {
- if (i.nextIndex() > i2)
- break;
-
- GapContentPosition p = (GapContentPosition) i.next();
- p.mark += gapEnd - newGapEnd;
- }
- }
-
if (newGapStart == gapStart)
return;
- else if (newGapStart < gapStart)
+
+ int newGapEnd = newGapStart + gapEnd - gapStart;
+ if (newGapStart < gapStart)
{
+ // Update the positions between newGapStart and (old) gapStart. The marks
+ // must be shifted by (gapEnd - gapStart).
+ adjustPositionsInRange(newGapStart, gapStart - newGapStart, gapEnd - gapStart);
System.arraycopy(buffer, newGapStart, buffer, newGapEnd, gapStart
- newGapStart);
gapStart = newGapStart;
@@ -448,11 +511,54 @@ public class GapContent
}
else
{
+ // Update the positions between newGapEnd and (old) gapEnd. The marks
+ // must be shifted by (gapEnd - gapStart).
+ adjustPositionsInRange(gapEnd, newGapEnd - gapEnd, -(gapEnd - gapStart));
System.arraycopy(buffer, gapEnd, buffer, gapStart, newGapStart
- gapStart);
gapStart = newGapStart;
gapEnd = newGapEnd;
}
+ if (gapStart == 0)
+ resetMarksAtZero();
+ }
+
+ /**
+ * Shifts the gap start downwards. This does not affect the content of the
+ * buffer. This only updates the gap start and all the marks that are between
+ * the old gap start and the new gap start. They all are squeezed to the start
+ * of the gap, because their location has been removed.
+ *
+ * @param newGapStart the new gap start
+ */
+ protected void shiftGapStartDown(int newGapStart)
+ {
+ if (newGapStart == gapStart)
+ return;
+
+ assert newGapStart < gapStart : "The new gap start must be less than the "
+ + "old gap start.";
+ setPositionsInRange(newGapStart, gapStart - newGapStart, gapStart);
+ gapStart = newGapStart;
+ }
+
+ /**
+ * Shifts the gap end upwards. This does not affect the content of the
+ * buffer. This only updates the gap end and all the marks that are between
+ * the old gap end and the new end start. They all are squeezed to the end
+ * of the gap, because their location has been removed.
+ *
+ * @param newGapEnd the new gap start
+ */
+ protected void shiftGapEndUp(int newGapEnd)
+ {
+ if (newGapEnd == gapEnd)
+ return;
+
+ assert newGapEnd > gapEnd : "The new gap end must be greater than the "
+ + "old gap end.";
+ setPositionsInRange(gapEnd, newGapEnd - gapEnd, newGapEnd + 1);
+ gapEnd = newGapEnd;
}
/**
@@ -476,13 +582,15 @@ public class GapContent
protected void replace(int position, int rmSize, Object addItems,
int addSize)
{
+ if (gapStart != position)
+ shiftGap(position);
// Remove content
- shiftGap(position);
- gapEnd += rmSize;
+ if (rmSize > 0)
+ shiftGapEndUp(gapEnd + rmSize);
// If gap is too small, enlarge the gap.
- if ((gapEnd - gapStart) < addSize)
- shiftEnd(addSize);
+ if ((gapEnd - gapStart) <= addSize)
+ shiftEnd((addSize - gapEnd + gapStart + 1) * 2 + gapEnd + DEFAULT_BUFSIZE);
// Add new items to the buffer.
if (addItems != null)
@@ -491,4 +599,164 @@ public class GapContent
gapStart += addSize;
}
}
+
+ /**
+ * Returns the start index of the gap within the buffer array.
+ *
+ * @return the start index of the gap within the buffer array
+ */
+ protected final int getGapStart()
+ {
+ return gapStart;
+ }
+
+ /**
+ * Returns the end index of the gap within the buffer array.
+ *
+ * @return the end index of the gap within the buffer array
+ */
+ protected final int getGapEnd()
+ {
+ return gapEnd;
+ }
+
+ /**
+ * Returns all <code>Position</code>s that are in the range specified by
+ * <code>offset</code> and </code>length</code> within the buffer array.
+ *
+ * @param v the vector to use; if <code>null</code>, a new Vector is allocated
+ * @param offset the start offset of the range to search
+ * @param length the length of the range to search
+ *
+ * @return the positions within the specified range
+ */
+ protected Vector getPositionsInRange(Vector v, int offset, int length)
+ {
+ Vector res = v;
+ if (res == null)
+ res = new Vector();
+ else
+ res.clear();
+
+ int endOffset = offset + length;
+
+ int index1 = Collections.binarySearch(positions,
+ new GapContentPosition(offset));
+ if (index1 < 0)
+ index1 = -(index1 + 1);
+ for (ListIterator i = positions.listIterator(index1); i.hasNext();)
+ {
+ GapContentPosition p = (GapContentPosition) i.next();
+ if (p.mark > endOffset)
+ break;
+ if (p.mark >= offset && p.mark <= endOffset)
+ res.add(p);
+ }
+ return res;
+ }
+
+ /**
+ * Sets the mark of all <code>Position</code>s that are in the range
+ * specified by <code>offset</code> and </code>length</code> within
+ * the buffer array to <code>value</code>
+ *
+ * @param offset the start offset of the range to search
+ * @param length the length of the range to search
+ * @param value the new value for each mark
+ */
+ void setPositionsInRange(int offset, int length, int value)
+ {
+ int endOffset = offset + length;
+
+ int index1 = Collections.binarySearch(positions,
+ new GapContentPosition(offset));
+ if (index1 < 0)
+ index1 = -(index1 + 1);
+ for (ListIterator i = positions.listIterator(index1); i.hasNext();)
+ {
+ GapContentPosition p = (GapContentPosition) i.next();
+ if (p.mark > endOffset)
+ break;
+
+ if (p.mark >= offset && p.mark <= endOffset)
+ p.mark = value;
+ }
+ }
+
+ /**
+ * Adjusts the mark of all <code>Position</code>s that are in the range
+ * specified by <code>offset</code> and </code>length</code> within
+ * the buffer array by <code>increment</code>
+ *
+ * @param offset the start offset of the range to search
+ * @param length the length of the range to search
+ * @param incr the increment
+ */
+ void adjustPositionsInRange(int offset, int length, int incr)
+ {
+ int endOffset = offset + length;
+
+ int index1 = Collections.binarySearch(positions,
+ new GapContentPosition(offset));
+ if (index1 < 0)
+ index1 = -(index1 + 1);
+ for (ListIterator i = positions.listIterator(index1); i.hasNext();)
+ {
+ GapContentPosition p = (GapContentPosition) i.next();
+ if (p.mark > endOffset)
+ break;
+
+ if (p.mark >= offset && p.mark <= endOffset)
+ p.mark += incr;
+ }
+ }
+
+ /**
+ * Resets all <code>Position</code> that have an offset of <code>0</code>,
+ * to also have an array index of <code>0</code>. This might be necessary
+ * after a call to <code>shiftGap(0)</code>, since then the marks at offset
+ * <code>0</code> get shifted to <code>gapEnd</code>.
+ */
+ protected void resetMarksAtZero()
+ {
+ if (gapStart != 0)
+ return;
+
+ setPositionsInRange(gapEnd, 0, 0);
+ }
+
+ /**
+ * Outputs debugging info to System.err. It prints out the buffer array,
+ * the gapStart is marked by a &lt; sign, the gapEnd is marked by a &gt;
+ * sign and each position is marked by a # sign.
+ */
+ private void dump()
+ {
+ System.err.println("GapContent debug information");
+ System.err.println("buffer length: " + buffer.length);
+ System.err.println("gap start: " + gapStart);
+ System.err.println("gap end: " + gapEnd);
+ for (int i = 0; i < buffer.length; i++)
+ {
+ if (i == gapStart)
+ System.err.print('<');
+ if (i == gapEnd)
+ System.err.print('>');
+
+ if (!Character.isISOControl(buffer[i]))
+ System.err.print(buffer[i]);
+ else
+ System.err.print('.');
+ }
+ System.err.println();
+ }
+
+ private void dumpPositions()
+ {
+ for (Iterator i = positions.iterator(); i.hasNext();)
+ {
+ GapContentPosition pos = (GapContentPosition) i.next();
+ System.err.println("position at: " + pos.mark);
+ }
+ }
}
diff --git a/libjava/classpath/javax/swing/text/GlyphView.java b/libjava/classpath/javax/swing/text/GlyphView.java
index f9e60972d84..d3dd75e624b 100644
--- a/libjava/classpath/javax/swing/text/GlyphView.java
+++ b/libjava/classpath/javax/swing/text/GlyphView.java
@@ -44,6 +44,12 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
+import java.awt.Toolkit;
+import java.text.BreakIterator;
+
+import javax.swing.SwingConstants;
+import javax.swing.event.DocumentEvent;
+import javax.swing.text.Position.Bias;
/**
* Renders a run of styled text. This {@link View} subclass paints the
@@ -52,9 +58,7 @@ import java.awt.Shape;
*
* @author Roman Kennke (roman@kennke.org)
*/
-public class GlyphView
- extends View
- implements TabableView, Cloneable
+public class GlyphView extends View implements TabableView, Cloneable
{
/**
@@ -68,15 +72,47 @@ public class GlyphView
*/
public GlyphPainter()
{
+ // Nothing to do here.
}
/**
+ * Returns the ascent of the font that is used by this glyph painter.
+ *
+ * @param v the glyph view
+ *
+ * @return the ascent of the font that is used by this glyph painter
+ */
+ public abstract float getAscent(GlyphView v);
+
+ /**
+ * Returns the descent of the font that is used by this glyph painter.
+ *
+ * @param v the glyph view
+ *
+ * @return the descent of the font that is used by this glyph painter
+ */
+ public abstract float getDescent(GlyphView v);
+
+ /**
* Returns the full height of the rendered text.
*
* @return the full height of the rendered text
*/
public abstract float getHeight(GlyphView view);
-
+
+ /**
+ * Determines the model offset, so that the text between <code>p0</code>
+ * and this offset fits within the span starting at <code>x</code> with
+ * the length of <code>len</code>.
+ *
+ * @param v the glyph view
+ * @param p0 the starting offset in the model
+ * @param x the start location in the view
+ * @param len the length of the span in the view
+ */
+ public abstract int getBoundedPosition(GlyphView v, int p0, float x,
+ float len);
+
/**
* Paints the glyphs.
*
@@ -97,8 +133,8 @@ public class GlyphView
* @param view the glyph view
* @param pos the position of the character in the model
* @param a the area that is occupied by the view
- * @param bias either {@link Position.Bias.Forward} or
- * {@link Position.Bias.Backward} depending on the preferred
+ * @param b either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
* direction bias. If <code>null</code> this defaults to
* <code>Position.Bias.Forward</code>
*
@@ -114,6 +150,20 @@ public class GlyphView
throws BadLocationException;
/**
+ * Maps a visual position into a document location.
+ *
+ * @param v the glyph view
+ * @param x the X coordinate of the visual position
+ * @param y the Y coordinate of the visual position
+ * @param a the allocated region
+ * @param biasRet filled with the bias of the model location on method exit
+ *
+ * @return the model location that represents the specified view location
+ */
+ public abstract int viewToModel(GlyphView v, float x, float y, Shape a,
+ Position.Bias[] biasRet);
+
+ /**
* Determine the span of the glyphs from location <code>p0</code> to
* location <code>p1</code>. If <code>te</code> is not <code>null</code>,
* then TABs are expanded using this <code>TabExpander</code>.
@@ -122,7 +172,7 @@ public class GlyphView
*
* @param view the glyph view
* @param p0 the starting location in the document model
- * @param p0 the end location in the document model
+ * @param p1 the end location in the document model
* @param te the tab expander to use
* @param x the location at which the view is located
*
@@ -132,6 +182,69 @@ public class GlyphView
public abstract float getSpan(GlyphView view, int p0, int p1,
TabExpander te, float x);
+
+ /**
+ * Returns the model location that should be used to place a caret when
+ * moving the caret through the document.
+ *
+ * @param v the glyph view
+ * @param pos the current model location
+ * @param b the bias for <code>p</code>
+ * @param a the allocated region for the glyph view
+ * @param direction the direction from the current position; Must be one of
+ * {@link SwingConstants#EAST}, {@link SwingConstants#WEST},
+ * {@link SwingConstants#NORTH} or {@link SwingConstants#SOUTH}
+ * @param biasRet filled with the bias of the resulting location when method
+ * returns
+ *
+ * @return the location within the document that should be used to place the
+ * caret when moving the caret around the document
+ *
+ * @throws BadLocationException if <code>pos</code> is an invalid model
+ * location
+ * @throws IllegalArgumentException if <code>d</code> is invalid
+ */
+ public int getNextVisualPositionFrom(GlyphView v, int pos, Position.Bias b,
+ Shape a, int direction,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+
+ {
+ int result = pos;
+ switch (direction)
+ {
+ case SwingConstants.EAST:
+ result = pos + 1;
+ break;
+ case SwingConstants.WEST:
+ result = pos - 1;
+ break;
+ case SwingConstants.NORTH:
+ case SwingConstants.SOUTH:
+ default:
+ // This should be handled in enclosing view, since the glyph view
+ // does not layout vertically.
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * Returns a painter that can be used to render the specified glyph view.
+ * If this glyph painter is stateful, then it should return a new instance.
+ * However, if this painter is stateless it should return itself. The
+ * default behaviour is to return itself.
+ *
+ * @param v the glyph view for which to create a painter
+ * @param p0 the start offset of the rendered area
+ * @param p1 the end offset of the rendered area
+ *
+ * @return a painter that can be used to render the specified glyph view
+ */
+ public GlyphPainter getPainter(GlyphView v, int p0, int p1)
+ {
+ return this;
+ }
}
/**
@@ -147,7 +260,7 @@ public class GlyphView
public float getHeight(GlyphView view)
{
Font font = view.getFont();
- FontMetrics metrics = view.getContainer().getFontMetrics(font);
+ FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font);
float height = metrics.getHeight();
return height;
}
@@ -173,11 +286,40 @@ public class GlyphView
if (parent instanceof TabExpander)
tabEx = (TabExpander) parent;
- // FIXME: Set character attributes like font-family, font-size, colors.
- Color foreground = view.getForeground();
- g.setColor(foreground);
- Utilities.drawTabbedText(txt, bounds.x, bounds.y, g, tabEx,
- txt.offset);
+ // Fill the background of the text run.
+ Color background = view.getBackground();
+ g.setColor(background);
+ int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(),
+ bounds.x, tabEx, txt.offset);
+ g.fillRect(bounds.x, bounds.y, width, height);
+
+ // Draw the actual text.
+ g.setColor(view.getForeground());
+ g.setFont(view.getFont());
+ if (view.isSuperscript())
+ // TODO: Adjust font for superscripting.
+ Utilities.drawTabbedText(txt, bounds.x, bounds.y - height / 2, g, tabEx,
+ txt.offset);
+ else if (view.isSubscript())
+ // TODO: Adjust font for subscripting.
+ Utilities.drawTabbedText(txt, bounds.x, bounds.y + height / 2, g, tabEx,
+ txt.offset);
+ else
+ Utilities.drawTabbedText(txt, bounds.x, bounds.y, g, tabEx,
+ txt.offset);
+
+ if (view.isStikeThrough())
+ {
+ int strikeHeight = (int) (getAscent(view) / 2);
+ g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width,
+ bounds.y + strikeHeight);
+ }
+ if (view.isUnderline())
+ {
+ int lineHeight = (int) getAscent(view);
+ g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width,
+ bounds.y + lineHeight);
+ }
}
/**
@@ -188,8 +330,8 @@ public class GlyphView
* @param view the glyph view
* @param pos the position of the character in the model
* @param a the area that is occupied by the view
- * @param bias either {@link Position.Bias.Forward} or
- * {@link Position.Bias.Backward} depending on the preferred
+ * @param b either {@link Position.Bias#Forward} or
+ * {@link Position.Bias#Backward} depending on the preferred
* direction bias. If <code>null</code> this defaults to
* <code>Position.Bias.Forward</code>
*
@@ -225,7 +367,7 @@ public class GlyphView
*
* @param view the glyph view
* @param p0 the starting location in the document model
- * @param p0 the end location in the document model
+ * @param p1 the end location in the document model
* @param te the tab expander to use
* @param x the location at which the view is located
*
@@ -237,11 +379,87 @@ public class GlyphView
{
Element el = view.getElement();
Font font = view.getFont();
- FontMetrics fm = view.getContainer().getFontMetrics(font);
+ FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font);
Segment txt = view.getText(p0, p1);
int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0);
return span;
}
+
+ /**
+ * Returns the ascent of the text run that is rendered by this
+ * <code>GlyphPainter</code>.
+ *
+ * @param v the glyph view
+ *
+ * @return the ascent of the text run that is rendered by this
+ * <code>GlyphPainter</code>
+ *
+ * @see FontMetrics#getAscent()
+ */
+ public float getAscent(GlyphView v)
+ {
+ Font font = v.getFont();
+ FontMetrics fm = v.getContainer().getFontMetrics(font);
+ return fm.getAscent();
+ }
+
+ /**
+ * Returns the descent of the text run that is rendered by this
+ * <code>GlyphPainter</code>.
+ *
+ * @param v the glyph view
+ *
+ * @return the descent of the text run that is rendered by this
+ * <code>GlyphPainter</code>
+ *
+ * @see FontMetrics#getDescent()
+ */
+ public float getDescent(GlyphView v)
+ {
+ Font font = v.getFont();
+ FontMetrics fm = v.getContainer().getFontMetrics(font);
+ return fm.getDescent();
+ }
+
+ /**
+ * Determines the model offset, so that the text between <code>p0</code>
+ * and this offset fits within the span starting at <code>x</code> with
+ * the length of <code>len</code>.
+ *
+ * @param v the glyph view
+ * @param p0 the starting offset in the model
+ * @param x the start location in the view
+ * @param len the length of the span in the view
+ */
+ public int getBoundedPosition(GlyphView v, int p0, float x, float len)
+ {
+ TabExpander te = v.getTabExpander();
+ Segment txt = v.getText(p0, v.getEndOffset());
+ Font font = v.getFont();
+ FontMetrics fm = v.getContainer().getFontMetrics(font);
+ int pos = Utilities.getTabbedTextOffset(txt, fm, (int) x,
+ (int) (x + len), te, p0, false);
+ return pos;
+ }
+
+ /**
+ * Maps a visual position into a document location.
+ *
+ * @param v the glyph view
+ * @param x the X coordinate of the visual position
+ * @param y the Y coordinate of the visual position
+ * @param a the allocated region
+ * @param biasRet filled with the bias of the model location on method exit
+ *
+ * @return the model location that represents the specified view location
+ */
+ public int viewToModel(GlyphView v, float x, float y, Shape a,
+ Bias[] biasRet)
+ {
+ Rectangle b = a.getBounds();
+ int pos = getBoundedPosition(v, v.getStartOffset(), b.x, x - b.x);
+ return pos;
+ }
}
/**
@@ -250,6 +468,16 @@ public class GlyphView
GlyphPainter glyphPainter;
/**
+ * The start offset within the document for this view.
+ */
+ int startOffset;
+
+ /**
+ * The end offset within the document for this view.
+ */
+ int endOffset;
+
+ /**
* Creates a new <code>GlyphView</code> for the given <code>Element</code>.
*
* @param element the element that is rendered by this GlyphView
@@ -257,6 +485,8 @@ public class GlyphView
public GlyphView(Element element)
{
super(element);
+ startOffset = element.getStartOffset();
+ endOffset = element.getEndOffset();
}
/**
@@ -319,16 +549,21 @@ public class GlyphView
*/
public float getPreferredSpan(int axis)
{
- Element el = getElement();
+ float span = 0;
checkPainter();
GlyphPainter painter = getGlyphPainter();
- TabExpander tabEx = null;
- View parent = getParent();
- if (parent instanceof TabExpander)
- tabEx = (TabExpander) parent;
- // FIXME: Figure out how to determine the x parameter.
- float span = painter.getSpan(this, el.getStartOffset(), el.getEndOffset(),
- tabEx, 0.F);
+ if (axis == X_AXIS)
+ {
+ Element el = getElement();
+ TabExpander tabEx = null;
+ View parent = getParent();
+ if (parent instanceof TabExpander)
+ tabEx = (TabExpander) parent;
+ span = painter.getSpan(this, getStartOffset(), getEndOffset(),
+ tabEx, 0.F);
+ }
+ else
+ span = painter.getHeight(this);
return span;
}
@@ -372,8 +607,9 @@ public class GlyphView
*/
public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
{
- // FIXME: not implemented
- return 0;
+ checkPainter();
+ GlyphPainter painter = getGlyphPainter();
+ return painter.viewToModel(this, x, y, a, b);
}
/**
@@ -383,12 +619,11 @@ public class GlyphView
*/
public TabExpander getTabExpander()
{
- // TODO: Figure out if this is correct.
TabExpander te = null;
View parent = getParent();
- if (parent instanceof ParagraphView)
- te = (ParagraphView) parent;
+ if (parent instanceof TabExpander)
+ te = (TabExpander) parent;
return te;
}
@@ -428,23 +663,26 @@ public class GlyphView
}
catch (BadLocationException ex)
{
- throw new AssertionError("BadLocationException must not be thrown "
- + "here");
+ AssertionError ae;
+ ae = new AssertionError("BadLocationException must not be thrown "
+ + "here");
+ ae.initCause(ex);
+ throw ae;
}
FontMetrics fm = null; // Fetch font metrics somewhere.
return Utilities.getTabbedTextWidth(seg, fm, 0, null, p0);
}
/**
- * Returns the starting offset in the document model of the portion
+ * Returns the start offset in the document model of the portion
* of text that this view is responsible for.
*
- * @return the starting offset in the document model of the portion
+ * @return the start offset in the document model of the portion
* of text that this view is responsible for
*/
- public int getBeginIndex()
+ public int getStartOffset()
{
- return getElement().getStartOffset();
+ return startOffset;
}
/**
@@ -454,9 +692,9 @@ public class GlyphView
* @return the end offset in the document model of the portion
* of text that this view is responsible for
*/
- public int getEndIndex()
+ public int getEndOffset()
{
- return getElement().getEndOffset();
+ return endOffset;
}
/**
@@ -476,8 +714,11 @@ public class GlyphView
}
catch (BadLocationException ex)
{
- throw new AssertionError("BadLocationException should not be "
- + "thrown here. p0 = " + p0 + ", p1 = " + p1);
+ AssertionError ae;
+ ae = new AssertionError("BadLocationException should not be "
+ + "thrown here. p0 = " + p0 + ", p1 = " + p1);
+ ae.initCause(ex);
+ throw ae;
}
return txt;
@@ -518,4 +759,332 @@ public class GlyphView
AttributeSet atts = el.getAttributes();
return StyleConstants.getForeground(atts);
}
+
+ /**
+ * Returns the background color which should be used to paint the text.
+ * This is fetched from the associated element's text attributes using
+ * {@link StyleConstants#getBackground}.
+ *
+ * @return the background color which should be used to paint the text
+ */
+ public Color getBackground()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.getBackground(atts);
+ }
+
+ /**
+ * Determines whether the text should be rendered strike-through or not. This
+ * is determined using the method
+ * {@link StyleConstants#isStrikeThrough(AttributeSet)} on the element of
+ * this view.
+ *
+ * @return whether the text should be rendered strike-through or not
+ */
+ public boolean isStikeThrough()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.isStrikeThrough(atts);
+ }
+
+ /**
+ * Determines whether the text should be rendered as subscript or not. This
+ * is determined using the method
+ * {@link StyleConstants#isSubscript(AttributeSet)} on the element of
+ * this view.
+ *
+ * @return whether the text should be rendered as subscript or not
+ */
+ public boolean isSubscript()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.isSubscript(atts);
+ }
+
+ /**
+ * Determines whether the text should be rendered as superscript or not. This
+ * is determined using the method
+ * {@link StyleConstants#isSuperscript(AttributeSet)} on the element of
+ * this view.
+ *
+ * @return whether the text should be rendered as superscript or not
+ */
+ public boolean isSuperscript()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.isSuperscript(atts);
+ }
+
+ /**
+ * Determines whether the text should be rendered as underlined or not. This
+ * is determined using the method
+ * {@link StyleConstants#isUnderline(AttributeSet)} on the element of
+ * this view.
+ *
+ * @return whether the text should be rendered as underlined or not
+ */
+ public boolean isUnderline()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ return StyleConstants.isUnderline(atts);
+ }
+
+ /**
+ * Creates and returns a shallow clone of this GlyphView. This is used by
+ * the {@link #createFragment} and {@link #breakView} methods.
+ *
+ * @return a shallow clone of this GlyphView
+ */
+ protected final Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch (CloneNotSupportedException ex)
+ {
+ AssertionError err = new AssertionError("CloneNotSupportedException "
+ + "must not be thrown here");
+ err.initCause(ex);
+ throw err;
+ }
+ }
+
+ /**
+ * Tries to break the view near the specified view span <code>len</code>.
+ * The glyph view can only be broken in the X direction. For Y direction it
+ * returns itself.
+ *
+ * @param axis the axis for breaking, may be {@link View#X_AXIS} or
+ * {@link View#Y_AXIS}
+ * @param p0 the model location where the fragment should start
+ * @param pos the view position along the axis where the fragment starts
+ * @param len the desired length of the fragment view
+ *
+ * @return the fragment view, or <code>this</code> if breaking was not
+ * possible
+ */
+ public View breakView(int axis, int p0, float pos, float len)
+ {
+ if (axis == Y_AXIS)
+ return this;
+
+ checkPainter();
+ GlyphPainter painter = getGlyphPainter();
+ int breakLocation = painter.getBoundedPosition(this, p0, pos, len);
+ // Try to find a suitable line break.
+ BreakIterator lineBreaker = BreakIterator.getLineInstance();
+ Segment txt = new Segment();
+ try
+ {
+ getDocument().getText(getStartOffset(), getEndOffset(), txt);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("BadLocationException must not "
+ + "be thrown here.");
+ err.initCause(ex);
+ throw err;
+ }
+ lineBreaker.setText(txt);
+ int goodBreakLocation = lineBreaker.previous();
+ if (goodBreakLocation != BreakIterator.DONE)
+ breakLocation = goodBreakLocation;
+
+ View brokenView = createFragment(p0, breakLocation);
+ return brokenView;
+ }
+
+ /**
+ * Determines how well the specified view location is suitable for inserting
+ * a line break. If <code>axis</code> is <code>View.Y_AXIS</code>, then
+ * this method forwards to the superclass, if <code>axis</code> is
+ * <code>View.X_AXIS</code> then this method returns
+ * {@link View#ExcellentBreakWeight} if there is a suitable break location
+ * (usually whitespace) within the specified view span, or
+ * {@link View#GoodBreakWeight} if not.
+ *
+ * @param axis the axis along which the break weight is requested
+ * @param pos the starting view location
+ * @param len the length of the span at which the view should be broken
+ *
+ * @return the break weight
+ */
+ public int getBreakWeight(int axis, float pos, float len)
+ {
+ int weight;
+ if (axis == Y_AXIS)
+ weight = super.getBreakWeight(axis, pos, len);
+ else
+ {
+ // Determine the model locations at pos and pos + len.
+ int spanX = (int) getPreferredSpan(X_AXIS);
+ int spanY = (int) getPreferredSpan(Y_AXIS);
+ Rectangle dummyAlloc = new Rectangle(0, 0, spanX, spanY);
+ Position.Bias[] biasRet = new Position.Bias[1];
+ int offset1 = viewToModel(pos, spanY / 2, dummyAlloc, biasRet);
+ int offset2 = viewToModel(pos, spanY / 2, dummyAlloc, biasRet);
+ Segment txt = getText(offset1, offset2);
+ BreakIterator lineBreaker = BreakIterator.getLineInstance();
+ lineBreaker.setText(txt);
+ int breakLoc = lineBreaker.previous();
+ if (breakLoc == offset1)
+ weight = View.BadBreakWeight;
+ else if(breakLoc == BreakIterator.DONE)
+ weight = View.GoodBreakWeight;
+ else
+ weight = View.ExcellentBreakWeight;
+ }
+ return weight;
+ }
+
+ /**
+ * Receives notification that some text attributes have changed within the
+ * text fragment that this view is responsible for. This calls
+ * {@link View#preferenceChanged(View, boolean, boolean)} on the parent for
+ * both width and height.
+ *
+ * @param e the document event describing the change; not used here
+ * @param a the view allocation on screen; not used here
+ * @param vf the view factory; not used here
+ */
+ public void changedUpdate(DocumentEvent e, Shape a, ViewFactory vf)
+ {
+ getParent().preferenceChanged(this, true, true);
+ }
+
+ /**
+ * Receives notification that some text has been inserted within the
+ * text fragment that this view is responsible for. This calls
+ * {@link View#preferenceChanged(View, boolean, boolean)} on the parent for
+ * width.
+ *
+ * @param e the document event describing the change; not used here
+ * @param a the view allocation on screen; not used here
+ * @param vf the view factory; not used here
+ */
+ public void insertUpdate(DocumentEvent e, Shape a, ViewFactory vf)
+ {
+ getParent().preferenceChanged(this, true, false);
+ }
+
+ /**
+ * Receives notification that some text has been removed within the
+ * text fragment that this view is responsible for. This calls
+ * {@link View#preferenceChanged(View, boolean, boolean)} on the parent for
+ * width.
+ *
+ * @param e the document event describing the change; not used here
+ * @param a the view allocation on screen; not used here
+ * @param vf the view factory; not used here
+ */
+ public void removeUpdate(DocumentEvent e, Shape a, ViewFactory vf)
+ {
+ getParent().preferenceChanged(this, true, false);
+ }
+
+ /**
+ * Creates a fragment view of this view that starts at <code>p0</code> and
+ * ends at <code>p1</code>.
+ *
+ * @param p0 the start location for the fragment view
+ * @param p1 the end location for the fragment view
+ *
+ * @return the fragment view
+ */
+ public View createFragment(int p0, int p1)
+ {
+ GlyphView fragment = (GlyphView) clone();
+ fragment.startOffset = p0;
+ fragment.endOffset = p1;
+ return fragment;
+ }
+
+ /**
+ * Returns the alignment of this view along the specified axis. For the Y
+ * axis this is <code>(height - descent) / height</code> for the used font,
+ * so that it is aligned along the baseline.
+ * For the X axis the superclass is called.
+ */
+ public float getAlignment(int axis)
+ {
+ float align;
+ if (axis == Y_AXIS)
+ {
+ checkPainter();
+ GlyphPainter painter = getGlyphPainter();
+ float height = painter.getHeight(this);
+ float descent = painter.getDescent(this);
+ align = (height - descent) / height;
+ }
+ else
+ align = super.getAlignment(axis);
+
+ return align;
+ }
+
+ /**
+ * Returns the model location that should be used to place a caret when
+ * moving the caret through the document.
+ *
+ * @param pos the current model location
+ * @param bias the bias for <code>p</code>
+ * @param a the allocated region for the glyph view
+ * @param direction the direction from the current position; Must be one of
+ * {@link SwingConstants#EAST}, {@link SwingConstants#WEST},
+ * {@link SwingConstants#NORTH} or {@link SwingConstants#SOUTH}
+ * @param biasRet filled with the bias of the resulting location when method
+ * returns
+ *
+ * @return the location within the document that should be used to place the
+ * caret when moving the caret around the document
+ *
+ * @throws BadLocationException if <code>pos</code> is an invalid model
+ * location
+ * @throws IllegalArgumentException if <code>d</code> is invalid
+ */
+ public int getNextVisualPositionFrom(int pos, Position.Bias bias, Shape a,
+ int direction, Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ checkPainter();
+ GlyphPainter painter = getGlyphPainter();
+ return painter.getNextVisualPositionFrom(this, pos, bias, a, direction,
+ biasRet);
+ }
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
+ }
}
diff --git a/libjava/classpath/javax/swing/text/IconView.java b/libjava/classpath/javax/swing/text/IconView.java
index c7e22b6c3eb..86c27dd5fda 100644
--- a/libjava/classpath/javax/swing/text/IconView.java
+++ b/libjava/classpath/javax/swing/text/IconView.java
@@ -39,9 +39,25 @@ exception statement from your version. */
package javax.swing.text;
import java.awt.Graphics;
+import java.awt.Rectangle;
import java.awt.Shape;
-// TODO: Implement this class.
+import javax.swing.Icon;
+import javax.swing.JTextPane;
+import javax.swing.SwingConstants;
+
+/**
+ * A View that can render an icon. This view is created by the
+ * {@link StyledEditorKit}'s view factory for all elements that have name
+ * {@link StyleConstants#IconElementName}. This is usually created by
+ * inserting an icon into <code>JTextPane</code> using
+ * {@link JTextPane#insertIcon(Icon)}
+ *
+ * The icon is determined using the attribute
+ * {@link StyleConstants#IconAttribute}, which's value must be an {@link Icon}.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
public class IconView
extends View
{
@@ -65,7 +81,9 @@ public class IconView
*/
public void paint(Graphics g, Shape a)
{
- // TODO: Implement me.
+ Icon icon = StyleConstants.getIcon(getElement().getAttributes());
+ Rectangle b = a.getBounds();
+ icon.paintIcon(getContainer(), g, b.x, b.y);
}
/**
@@ -78,8 +96,15 @@ public class IconView
*/
public float getPreferredSpan(int axis)
{
- // TODO: Implement me.
- return 0F;
+ Icon icon = StyleConstants.getIcon(getElement().getAttributes());
+ float span;
+ if (axis == X_AXIS)
+ span = icon.getIconWidth();
+ else if (axis == Y_AXIS)
+ span = icon.getIconHeight();
+ else
+ throw new IllegalArgumentException();
+ return span;
}
/**
@@ -104,8 +129,12 @@ public class IconView
public Shape modelToView(int pos, Shape a, Position.Bias b)
throws BadLocationException
{
- // Implement me.
- return null;
+ Element el = getElement();
+ if (pos < el.getStartOffset() || pos >= el.getEndOffset())
+ throw new BadLocationException("Illegal offset for this view", pos);
+ Rectangle r = a.getBounds();
+ Icon icon = StyleConstants.getIcon(el.getAttributes());
+ return new Rectangle(r.x, r.y, icon.getIconWidth(), icon.getIconHeight());
}
/**
@@ -122,7 +151,41 @@ public class IconView
*/
public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
{
- // FIXME: not implemented
- return 0;
+ // The element should only have one character position and it is clear
+ // that this position is the position that best matches the given screen
+ // coordinates, simply because this view has only this one position.
+ Element el = getElement();
+ return el.getStartOffset();
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
+ }
+
}
diff --git a/libjava/classpath/javax/swing/text/InternationalFormatter.java b/libjava/classpath/javax/swing/text/InternationalFormatter.java
index cedaf59feeb..86300a70d8e 100644
--- a/libjava/classpath/javax/swing/text/InternationalFormatter.java
+++ b/libjava/classpath/javax/swing/text/InternationalFormatter.java
@@ -57,9 +57,8 @@ import javax.swing.JFormattedTextField;
public class InternationalFormatter
extends DefaultFormatter
{
-
- /** The serialVersoinUID. */
- private static final long serialVersionUID = 6941977820906408656L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 2436068675711756856L;
/** The format that handles value to string conversion. */
Format format;
diff --git a/libjava/classpath/javax/swing/text/JTextComponent.java b/libjava/classpath/javax/swing/text/JTextComponent.java
index b3fad79124c..83966bbdf47 100644
--- a/libjava/classpath/javax/swing/text/JTextComponent.java
+++ b/libjava/classpath/javax/swing/text/JTextComponent.java
@@ -50,9 +50,9 @@ import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.InputMethodListener;
import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
@@ -72,7 +72,6 @@ import javax.swing.JViewport;
import javax.swing.KeyStroke;
import javax.swing.Scrollable;
import javax.swing.SwingConstants;
-import javax.swing.Timer;
import javax.swing.TransferHandler;
import javax.swing.UIManager;
import javax.swing.event.CaretEvent;
@@ -89,6 +88,7 @@ public abstract class JTextComponent extends JComponent
/**
* AccessibleJTextComponent
*/
+ // FIXME: This inner class is a complete stub and needs to be implemented.
public class AccessibleJTextComponent extends AccessibleJComponent
implements AccessibleText, CaretListener, DocumentListener
{
@@ -99,6 +99,7 @@ public abstract class JTextComponent extends JComponent
*/
public AccessibleJTextComponent()
{
+ // Nothing to do here.
}
/**
@@ -301,50 +302,6 @@ public abstract class JTextComponent extends JComponent
}
/**
- * The timer that lets the caret blink.
- */
- private class CaretBlinkTimer
- extends Timer
- implements ActionListener
- {
- /**
- * Creates a new CaretBlinkTimer object with a default delay of 1 second.
- */
- public CaretBlinkTimer()
- {
- super(1000, null);
- addActionListener(this);
- }
-
- /**
- * Lets the caret blink.
- */
- public void actionPerformed(ActionEvent ev)
- {
- Caret c = caret;
- if (c != null)
- c.setVisible(!c.isVisible());
- }
-
- /**
- * Updates the blink delay according to the current caret.
- */
- public void update()
- {
- stop();
- Caret c = caret;
- if (c != null)
- {
- setDelay(c.getBlinkRate());
- if (editable)
- start();
- else
- c.setVisible(false);
- }
- }
- }
-
- /**
* According to <a
* href="http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html">this
* report</a>, a pair of private classes wraps a {@link
@@ -604,8 +561,7 @@ public abstract class JTextComponent extends JComponent
}
}
- class DefaultTransferHandler
- extends TransferHandler
+ class DefaultTransferHandler extends TransferHandler
{
public boolean canImport(JComponent component, DataFlavor[] flavors)
{
@@ -631,23 +587,23 @@ public abstract class JTextComponent extends JComponent
int end = textComponent.getSelectionEnd();
if (start == end)
- return;
+ return;
try
- {
- // Copy text to clipboard.
- String data = textComponent.getDocument().getText(start, end);
- StringSelection selection = new StringSelection(data);
- clipboard.setContents(selection, null);
-
- // Delete selected text on cut action.
- if (action == MOVE)
- doc.remove(start, end - start);
- }
+ {
+ // Copy text to clipboard.
+ String data = textComponent.getDocument().getText(start, end);
+ StringSelection selection = new StringSelection(data);
+ clipboard.setContents(selection, null);
+
+ // Delete selected text on cut action.
+ if (action == MOVE)
+ doc.remove(start, end - start);
+ }
catch (BadLocationException e)
- {
- // Ignore this and do nothing.
- }
+ {
+ // Ignore this and do nothing.
+ }
}
public int getSourceActions()
@@ -661,30 +617,30 @@ public abstract class JTextComponent extends JComponent
DataFlavor[] flavors = transferable.getTransferDataFlavors();
if (flavors == null)
- return false;
+ return false;
for (int i = 0; i < flavors.length; ++i)
- if (flavors[i].equals(DataFlavor.stringFlavor))
- flavor = flavors[i];
+ if (flavors[i].equals(DataFlavor.stringFlavor))
+ flavor = flavors[i];
if (flavor == null)
- return false;
+ return false;
try
- {
- JTextComponent textComponent = (JTextComponent) component;
- String data = (String) transferable.getTransferData(flavor);
- textComponent.replaceSelection(data);
- return true;
- }
+ {
+ JTextComponent textComponent = (JTextComponent) component;
+ String data = (String) transferable.getTransferData(flavor);
+ textComponent.replaceSelection(data);
+ return true;
+ }
catch (IOException e)
- {
- // Ignored.
- }
+ {
+ // Ignored.
+ }
catch (UnsupportedFlavorException e)
- {
- // Ignored.
- }
+ {
+ // Ignored.
+ }
return false;
}
@@ -701,8 +657,6 @@ public abstract class JTextComponent extends JComponent
private char focusAccelerator = '\0';
private NavigationFilter navigationFilter;
- private CaretBlinkTimer caretBlinkTimer;
-
/**
* Get a Keymap from the global keymap table, by name.
*
@@ -960,8 +914,6 @@ public abstract class JTextComponent extends JComponent
creatingKeymap = true;
}
- caretBlinkTimer = new CaretBlinkTimer();
-
setFocusable(true);
setEditable(true);
enableEvents(AWTEvent.KEY_EVENT_MASK);
@@ -1021,12 +973,17 @@ public abstract class JTextComponent extends JComponent
{
try
{
- doc.remove(0, doc.getLength());
- doc.insertString(0, text, null);
+ if (doc instanceof AbstractDocument)
+ ((AbstractDocument) doc).replace(0, doc.getLength(), text, null);
+ else
+ {
+ doc.remove(0, doc.getLength());
+ doc.insertString(0, text, null);
+ }
}
catch (BadLocationException e)
{
- // This can never happen.
+ // This can never happen.
}
}
@@ -1044,12 +1001,12 @@ public abstract class JTextComponent extends JComponent
try
{
- return doc.getText(0, doc.getLength());
+ return doc.getText(0, doc.getLength());
}
catch (BadLocationException e)
{
- // This should never happen.
- return "";
+ // This should never happen.
+ return "";
}
}
@@ -1080,12 +1037,12 @@ public abstract class JTextComponent extends JComponent
{
try
{
- return doc.getText(getSelectionStart(), getSelectionEnd());
+ return doc.getText(getSelectionStart(), getSelectionEnd());
}
catch (BadLocationException e)
{
- // This should never happen.
- return null;
+ // This should never happen.
+ return null;
}
}
@@ -1105,7 +1062,8 @@ public abstract class JTextComponent extends JComponent
*/
protected String paramString()
{
- return "JTextComponent";
+ // TODO: Do something useful here.
+ return super.paramString();
}
/**
@@ -1194,14 +1152,6 @@ public abstract class JTextComponent extends JComponent
if (editable == newValue)
return;
- if (newValue == true)
- caretBlinkTimer.start();
- else
- {
- caretBlinkTimer.stop();
- caret.setVisible(false);
- }
-
boolean oldValue = editable;
editable = newValue;
firePropertyChange("editable", oldValue, newValue);
@@ -1230,8 +1180,6 @@ public abstract class JTextComponent extends JComponent
Caret oldCaret = caret;
caret = newCaret;
- caretBlinkTimer.update();
-
if (caret != null)
caret.install(this);
@@ -1399,7 +1347,7 @@ public abstract class JTextComponent extends JComponent
start = Math.max(start, 0);
start = Math.min(start, length);
- end = Math.max(end, 0);
+ end = Math.max(end, start);
end = Math.min(end, length);
setCaretPosition(start);
@@ -1422,28 +1370,28 @@ public abstract class JTextComponent extends JComponent
// If content is empty delete selection.
if (content == null)
{
- caret.setDot(dot);
- return;
+ caret.setDot(dot);
+ return;
}
try
{
- int start = getSelectionStart();
- int end = getSelectionEnd();
-
- // Remove selected text.
- if (dot != mark)
- doc.remove(start, end - start);
-
- // Insert new text.
- doc.insertString(start, content, null);
-
- // Set dot to new position.
- setCaretPosition(start + content.length());
+ int start = getSelectionStart();
+ int end = getSelectionEnd();
+
+ // Remove selected text.
+ if (dot != mark)
+ doc.remove(start, end - start);
+
+ // Insert new text.
+ doc.insertString(start, content, null);
+
+ // Set dot to new position.
+ setCaretPosition(start + content.length());
}
catch (BadLocationException e)
{
- // This should never happen.
+ // This should never happen.
}
}
@@ -1577,15 +1525,15 @@ public abstract class JTextComponent extends JComponent
// Install default TransferHandler if none set.
if (getTransferHandler() == null)
{
- if (defaultTransferHandler == null)
- defaultTransferHandler = new DefaultTransferHandler();
-
- setTransferHandler(defaultTransferHandler);
+ if (defaultTransferHandler == null)
+ defaultTransferHandler = new DefaultTransferHandler();
+
+ setTransferHandler(defaultTransferHandler);
}
// Perform action.
ActionEvent event = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
- action.getValue(Action.NAME).toString());
+ action.getValue(Action.NAME).toString());
action.actionPerformed(event);
}
@@ -1669,5 +1617,20 @@ public abstract class JTextComponent extends JComponent
throws IOException
{
output.write(getText());
- }
+ }
+
+ /**
+ * Returns the tooltip text for this text component for the given mouse
+ * event. This forwards the call to
+ * {@link TextUI#getToolTipText(JTextComponent, Point)}.
+ *
+ * @param ev the mouse event
+ *
+ * @return the tooltip text for this text component for the given mouse
+ * event
+ */
+ public String getToolTipText(MouseEvent ev)
+ {
+ return getUI().getToolTipText(this, ev.getPoint());
+ }
}
diff --git a/libjava/classpath/javax/swing/text/LabelView.java b/libjava/classpath/javax/swing/text/LabelView.java
index a10391613cd..4890735b925 100644
--- a/libjava/classpath/javax/swing/text/LabelView.java
+++ b/libjava/classpath/javax/swing/text/LabelView.java
@@ -38,10 +38,57 @@ exception statement from your version. */
package javax.swing.text;
-// TODO: Implement this class.
-public class LabelView
- extends GlyphView
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Shape;
+
+import javax.swing.event.DocumentEvent;
+
+/**
+ * A {@link GlyphView} that caches the textattributes for most effective
+ * rendering.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class LabelView extends GlyphView
{
+
+ /**
+ * The background color.
+ */
+ Color background;
+
+ /**
+ * The foreground color.
+ */
+ Color foreground;
+
+ /**
+ * The background color.
+ */
+ Font font;
+
+ /**
+ * The strikethrough flag.
+ */
+ boolean strikeThrough;
+
+ /**
+ * The underline flag.
+ */
+ boolean underline;
+
+ /**
+ * The subscript flag.
+ */
+ boolean subscript;
+
+ /**
+ * The superscript flag.
+ */
+ boolean superscript;
+
/**
* Creates a new <code>GlyphView</code> for the given <code>Element</code>.
*
@@ -50,5 +97,194 @@ public class LabelView
public LabelView(Element element)
{
super(element);
+ setPropertiesFromAttributes();
+ }
+
+ /**
+ * Loads the properties of this label view from the element's text
+ * attributes. This method is called from the constructor and the
+ * {@link #changedUpdate} method
+ */
+ protected void setPropertiesFromAttributes()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ background = StyleConstants.getBackground(atts);
+ foreground = StyleConstants.getForeground(atts);
+ strikeThrough = StyleConstants.isStrikeThrough(atts);
+ subscript = StyleConstants.isSubscript(atts);
+ superscript = StyleConstants.isSuperscript(atts);
+ underline = StyleConstants.isUnderline(atts);
+
+ // Determine the font.
+ String family = StyleConstants.getFontFamily(atts);
+ int size = StyleConstants.getFontSize(atts);
+ int style = Font.PLAIN;
+ if (StyleConstants.isBold(atts))
+ style |= Font.BOLD;
+ if (StyleConstants.isItalic(atts))
+ style |= Font.ITALIC;
+ font = new Font(family, style, size);
+ }
+
+ /**
+ * Receives notification when text attributes change in the chunk of
+ * text that this view is responsible for. This simply calls
+ * {@link #setPropertiesFromAttributes()}.
+ *
+ * @param e the document event
+ * @param a the allocation of this view
+ * @param vf the view factory to use for creating new views
+ */
+ public void changedUpdate(DocumentEvent e, Shape a, ViewFactory vf)
+ {
+ setPropertiesFromAttributes();
+ }
+
+ /**
+ * Returns the background color for the glyphs.
+ *
+ * @return the background color for the glyphs
+ */
+ public Color getBackground()
+ {
+ return background;
+ }
+
+ /**
+ * Sets the background color for the glyphs. A value of <code>null</code>
+ * means the background of the parent view should shine through.
+ *
+ * @param bg the background to set or <code>null</code>
+ *
+ * @since 1.5
+ */
+ protected void setBackground(Color bg)
+ {
+ background = bg;
+ }
+
+ /**
+ * Returns the foreground color for the glyphs.
+ *
+ * @return the foreground color for the glyphs
+ */
+ public Color getForeground()
+ {
+ return foreground;
+ }
+
+ /**
+ * Returns the font for the glyphs.
+ *
+ * @return the font for the glyphs
+ */
+ public Font getFont()
+ {
+ return font;
+ }
+
+ /**
+ * Returns the font metrics of the current font.
+ *
+ * @return the font metrics of the current font
+ *
+ * @deprecated this is not used anymore
+ */
+ protected FontMetrics getFontMetrics()
+ {
+ return getContainer().getGraphics().getFontMetrics(font);
+ }
+
+ /**
+ * Returns <code>true</code> if the glyphs are rendered underlined,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the glyphs are rendered underlined,
+ * <code>false</code> otherwise
+ */
+ public boolean isUnderline()
+ {
+ return underline;
+ }
+
+ /**
+ * Sets the underline flag.
+ *
+ * @param flag <code>true</code> if the glyphs are rendered underlined,
+ * <code>false</code> otherwise
+ */
+ protected void setUnderline(boolean flag)
+ {
+ underline = flag;
+ }
+
+ /**
+ * Returns <code>true</code> if the glyphs are rendered as subscript,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the glyphs are rendered as subscript,
+ * <code>false</code> otherwise
+ */
+ public boolean isSubscript()
+ {
+ return subscript;
+ }
+
+ /**
+ * Sets the subscript flag.
+ *
+ * @param flag <code>true</code> if the glyphs are rendered as subscript,
+ * <code>false</code> otherwise
+ */
+ protected void setSubscript(boolean flag)
+ {
+ subscript = flag;
+ }
+
+ /**
+ * Returns <code>true</code> if the glyphs are rendered as superscript,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the glyphs are rendered as superscript,
+ * <code>false</code> otherwise
+ */
+ public boolean isSuperscript()
+ {
+ return superscript;
+ }
+
+ /**
+ * Sets the superscript flag.
+ *
+ * @param flag <code>true</code> if the glyphs are rendered as superscript,
+ * <code>false</code> otherwise
+ */
+ protected void setSuperscript(boolean flag)
+ {
+ superscript = flag;
+ }
+
+ /**
+ * Returns <code>true</code> if the glyphs are rendered strike-through,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the glyphs are rendered strike-through,
+ * <code>false</code> otherwise
+ */
+ public boolean isStrikeThrough()
+ {
+ return strikeThrough;
+ }
+
+ /**
+ * Sets the strike-through flag.
+ *
+ * @param flag <code>true</code> if the glyphs are rendered strike-through,
+ * <code>false</code> otherwise
+ */
+ protected void setStrikeThrough(boolean flag)
+ {
+ strikeThrough = flag;
}
}
diff --git a/libjava/classpath/javax/swing/text/LayoutQueue.java b/libjava/classpath/javax/swing/text/LayoutQueue.java
index 83433b6eef5..b0c84b972b2 100644
--- a/libjava/classpath/javax/swing/text/LayoutQueue.java
+++ b/libjava/classpath/javax/swing/text/LayoutQueue.java
@@ -57,6 +57,7 @@ public class LayoutQueue
*/
public LayoutQueue()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/text/ParagraphView.java b/libjava/classpath/javax/swing/text/ParagraphView.java
index 6c6006a2a0f..c4864503187 100644
--- a/libjava/classpath/javax/swing/text/ParagraphView.java
+++ b/libjava/classpath/javax/swing/text/ParagraphView.java
@@ -38,6 +38,10 @@ exception statement from your version. */
package javax.swing.text;
+import java.awt.Shape;
+
+import javax.swing.event.DocumentEvent;
+
/**
* A {@link FlowView} that flows it's children horizontally and boxes the rows
* vertically.
@@ -59,9 +63,34 @@ public class ParagraphView extends FlowView implements TabExpander
{
super(el, X_AXIS);
}
+ public float getAlignment(int axis)
+ {
+ // FIXME: This is very likely not 100% correct. Work this out.
+ return 0.0F;
+ }
}
/**
+ * The indentation of the first line of the paragraph.
+ */
+ protected int firstLineIndent;
+
+ /**
+ * The justification of the paragraph.
+ */
+ private int justification;
+
+ /**
+ * The line spacing of this paragraph.
+ */
+ private float lineSpacing;
+
+ /**
+ * The TabSet of this paragraph.
+ */
+ private TabSet tabSet;
+
+ /**
* Creates a new <code>ParagraphView</code> for the given
* <code>Element</code>.
*
@@ -86,4 +115,118 @@ public class ParagraphView extends FlowView implements TabExpander
{
return new Row(getElement());
}
+
+ /**
+ * Returns the alignment for this paragraph view for the specified axis.
+ * For the X_AXIS the paragraph view will be aligned at it's left edge
+ * (0.0F). For the Y_AXIS the paragraph view will be aligned at the
+ * center of it's first row.
+ *
+ * @param axis the axis which is examined
+ *
+ * @return the alignment for this paragraph view for the specified axis
+ */
+ public float getAlignment(int axis)
+ {
+ if (axis == X_AXIS)
+ return 0.0F;
+ else if (getViewCount() > 0)
+ {
+
+ float prefHeight = getPreferredSpan(Y_AXIS);
+ float firstRowHeight = getView(0).getPreferredSpan(Y_AXIS);
+ return (firstRowHeight / 2.F) / prefHeight;
+ }
+ else
+ return 0.0F;
+ }
+
+ /**
+ * Receives notification when some attributes of the displayed element
+ * changes. This triggers a refresh of the cached attributes of this
+ * paragraph.
+ *
+ * @param ev the document event
+ * @param a the allocation of this view
+ * @param fv the view factory to use for creating new child views
+ */
+ public void changedUpdate(DocumentEvent ev, Shape a, ViewFactory fv)
+ {
+ setPropertiesFromAttributes();
+ }
+
+ /**
+ * Fetches the cached properties from the element's attributes.
+ */
+ protected void setPropertiesFromAttributes()
+ {
+ Element el = getElement();
+ AttributeSet atts = el.getAttributes();
+ setFirstLineIndent(StyleConstants.getFirstLineIndent(atts));
+ setLineSpacing(StyleConstants.getLineSpacing(atts));
+ setJustification(StyleConstants.getAlignment(atts));
+ tabSet = StyleConstants.getTabSet(atts);
+ }
+
+ /**
+ * Sets the indentation of the first line of the paragraph.
+ *
+ * @param i the indentation to set
+ */
+ protected void setFirstLineIndent(float i)
+ {
+ firstLineIndent = (int) i;
+ }
+
+ /**
+ * Sets the justification of the paragraph.
+ *
+ * @param j the justification to set
+ */
+ protected void setJustification(int j)
+ {
+ justification = j;
+ }
+
+ /**
+ * Sets the line spacing for this paragraph.
+ *
+ * @param s the line spacing to set
+ */
+ protected void setLineSpacing(float s)
+ {
+ lineSpacing = s;
+ }
+
+ /**
+ * Returns the i-th view from the logical views, before breaking into rows.
+ *
+ * @param i the index of the logical view to return
+ *
+ * @return the i-th view from the logical views, before breaking into rows
+ */
+ protected View getLayoutView(int i)
+ {
+ return layoutPool.getView(i);
+ }
+
+ /**
+ * Returns the number of logical child views.
+ *
+ * @return the number of logical child views
+ */
+ protected int getLayoutViewCount()
+ {
+ return layoutPool.getViewCount();
+ }
+
+ /**
+ * Returns the TabSet used by this ParagraphView.
+ *
+ * @return the TabSet used by this ParagraphView
+ */
+ protected TabSet getTabSet()
+ {
+ return tabSet;
+ }
}
diff --git a/libjava/classpath/javax/swing/text/PlainDocument.java b/libjava/classpath/javax/swing/text/PlainDocument.java
index 71070e92da7..0c00a06ff25 100644
--- a/libjava/classpath/javax/swing/text/PlainDocument.java
+++ b/libjava/classpath/javax/swing/text/PlainDocument.java
@@ -105,10 +105,65 @@ public class PlainDocument extends AbstractDocument
return root;
}
- protected void insertUpdate(DefaultDocumentEvent event, AttributeSet attributes)
+ protected void insertUpdate(DefaultDocumentEvent event,
+ AttributeSet attributes)
{
- reindex();
+ int offset = event.getOffset();
+ int end = offset + event.getLength();
+ int elementIndex = rootElement.getElementIndex(offset);
+ Element firstElement = rootElement.getElement(elementIndex);
+
+ // added and removed are Element arrays used to add an ElementEdit
+ // to the DocumentEvent if there were entire lines added or removed.
+ Element[] removed = new Element[1];
+ Element[] added;
+ try
+ {
+ String str = content.getString(0, content.length());
+ ArrayList elts = new ArrayList();
+ // Determine how many NEW lines were added by finding the newline
+ // characters within the newly inserted text
+ int j = firstElement.getStartOffset();
+ int i = str.indexOf('\n', offset);
+ while (i != -1 && i <= end)
+ {
+ // For each new line, create a new element
+ elts.add(createLeafElement(rootElement, SimpleAttributeSet.EMPTY,
+ j, i + 1));
+ j = i + 1;
+ if (j >= str.length())
+ break;
+ i = str.indexOf('\n', j);
+ }
+ // If there were new lines added we have to add an ElementEdit to
+ // the DocumentEvent and we have to call rootElement.replace to
+ // insert the new lines
+ if (elts.size() != 0)
+ {
+ // Set up the ElementEdit by filling the added and removed
+ // arrays with the proper Elements
+ added = new Element[elts.size()];
+ for (int k = 0; k < elts.size(); ++k)
+ added[k] = (Element) elts.get(k);
+ removed[0] = firstElement;
+
+ // Now create and add the ElementEdit
+ ElementEdit e = new ElementEdit(rootElement, elementIndex, removed,
+ added);
+ event.addEdit(e);
+
+ // And call replace to actually make the changes
+ ((BranchElement) rootElement).replace(elementIndex, 1, added);
+ }
+ }
+ catch (BadLocationException e)
+ {
+ // This shouldn't happen so we throw an AssertionError
+ AssertionError ae = new AssertionError();
+ ae.initCause(e);
+ throw ae;
+ }
super.insertUpdate(event, attributes);
}
@@ -116,24 +171,37 @@ public class PlainDocument extends AbstractDocument
{
super.removeUpdate(event);
+ // added and removed are Element arrays used to add an ElementEdit
+ // to the DocumentEvent if there were entire lines added or removed
+ // from the Document
+ Element[] added = new Element[1];
+ Element[] removed;
int p0 = event.getOffset();
- int len = event.getLength();
- int p1 = len + p0;
// check if we must collapse some elements
int i1 = rootElement.getElementIndex(p0);
- int i2 = rootElement.getElementIndex(p1);
+ int i2 = rootElement.getElementIndex(p0 + event.getLength());
if (i1 != i2)
{
- Element el1 = rootElement.getElement(i1);
- Element el2 = rootElement.getElement(i2);
- int start = el1.getStartOffset();
- int end = el2.getEndOffset();
- // collapse elements if the removal spans more than 1 line
- Element newEl = createLeafElement(rootElement,
+ // If there were lines removed then we have to add an ElementEdit
+ // to the DocumentEvent so we set it up now by filling the Element
+ // arrays "removed" and "added" appropriately
+ removed = new Element [i2 - i1 + 1];
+ for (int i = i1; i <= i2; i++)
+ removed[i-i1] = rootElement.getElement(i);
+
+ int start = rootElement.getElement(i1).getStartOffset();
+ int end = rootElement.getElement(i2).getEndOffset();
+ added[0] = createLeafElement(rootElement,
SimpleAttributeSet.EMPTY,
- start, end - len);
- rootElement.replace(i1, i2 - i1, new Element[]{ newEl });
+ start, end);
+
+ // Now create and add the ElementEdit
+ ElementEdit e = new ElementEdit(rootElement, i1, removed, added);
+ event.addEdit(e);
+
+ // collapse elements if the removal spans more than 1 line
+ rootElement.replace(i1, i2 - i1 + 1, added);
}
}
@@ -147,4 +215,28 @@ public class PlainDocument extends AbstractDocument
Element root = getDefaultRootElement();
return root.getElement(root.getElementIndex(pos));
}
+
+ /**
+ * Inserts a string into the document. If the document property
+ * '<code>filterNewLines</code>' is set to <code>Boolean.TRUE</code>, then
+ * all newlines in the inserted string are replaced by space characters,
+ * otherwise the superclasses behaviour is executed.
+ *
+ * Inserting content causes a write lock to be acquired during this method
+ * call.
+ *
+ * @param offs the offset at which to insert the string
+ * @param str the string to be inserted
+ * @param atts the text attributes of the string to be inserted
+ *
+ * @throws BadLocationException
+ */
+ public void insertString(int offs, String str, AttributeSet atts)
+ throws BadLocationException
+ {
+ String string = str;
+ if (str != null && Boolean.TRUE.equals(getProperty("filterNewlines")))
+ string = str.replaceAll("\n", " ");
+ super.insertString(offs, string, atts);
+ }
}
diff --git a/libjava/classpath/javax/swing/text/PlainView.java b/libjava/classpath/javax/swing/text/PlainView.java
index 91d7547e77c..9f5ee8ad3c8 100644
--- a/libjava/classpath/javax/swing/text/PlainView.java
+++ b/libjava/classpath/javax/swing/text/PlainView.java
@@ -46,15 +46,35 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
-public class PlainView extends View
- implements TabExpander
+import javax.swing.SwingConstants;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentEvent.ElementChange;
+
+public class PlainView extends View implements TabExpander
{
Color selectedColor;
Color unselectedColor;
+
+ /**
+ * The color that is used to draw disabled text fields.
+ */
+ Color disabledColor;
+
Font font;
+ /** The length of the longest line in the Document **/
+ float maxLineLength = -1;
+
+ /** The longest line in the Document **/
+ Element longestLine = null;
+
protected FontMetrics metrics;
+ /**
+ * The instance returned by {@link #getLineBuffer()}.
+ */
+ private transient Segment lineBuffer;
+
public PlainView(Element elem)
{
super(elem);
@@ -104,7 +124,7 @@ public class PlainView extends View
// Get the rectangle for position.
Element line = getElement().getElement(lineIndex);
int lineStart = line.getStartOffset();
- Segment segment = new Segment();
+ Segment segment = getLineBuffer();
document.getText(lineStart, position - lineStart, segment);
int xoffset = Utilities.getTabbedTextWidth(segment, metrics, rect.x,
this, lineStart);
@@ -129,7 +149,9 @@ public class PlainView extends View
}
catch (BadLocationException e)
{
- // This should never happen.
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(e);
+ throw ae;
}
}
@@ -137,7 +159,7 @@ public class PlainView extends View
throws BadLocationException
{
g.setColor(selectedColor);
- Segment segment = new Segment();
+ Segment segment = getLineBuffer();
getDocument().getText(p0, p1 - p0, segment);
return Utilities.drawTabbedText(segment, x, y, g, this, 0);
}
@@ -145,8 +167,13 @@ public class PlainView extends View
protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
throws BadLocationException
{
- g.setColor(unselectedColor);
- Segment segment = new Segment();
+ JTextComponent textComponent = (JTextComponent) getContainer();
+ if (textComponent.isEnabled())
+ g.setColor(unselectedColor);
+ else
+ g.setColor(disabledColor);
+
+ Segment segment = getLineBuffer();
getDocument().getText(p0, p1 - p0, segment);
return Utilities.drawTabbedText(segment, x, y, g, this, segment.offset);
}
@@ -161,7 +188,8 @@ public class PlainView extends View
g.setFont(textComponent.getFont());
selectedColor = textComponent.getSelectedTextColor();
unselectedColor = textComponent.getForeground();
-
+ disabledColor = textComponent.getDisabledTextColor();
+
Rectangle rect = s.getBounds();
// FIXME: Text may be scrolled.
@@ -176,9 +204,19 @@ public class PlainView extends View
}
}
+ /**
+ * Returns the tab size of a tab. Checks the Document's
+ * properties for PlainDocument.tabSizeAttribute and returns it if it is
+ * defined, otherwise returns 8.
+ *
+ * @return the tab size.
+ */
protected int getTabSize()
{
- return 8;
+ Object tabSize = getDocument().getProperty(PlainDocument.tabSizeAttribute);
+ if (tabSize == null)
+ return 8;
+ return ((Integer)tabSize).intValue();
}
/**
@@ -191,10 +229,54 @@ public class PlainView extends View
*/
public float nextTabStop(float x, int tabStop)
{
- float tabSizePixels = getTabSize() + metrics.charWidth('m');
+ float tabSizePixels = getTabSize() * metrics.charWidth('m');
return (float) (Math.floor(x / tabSizePixels) + 1) * tabSizePixels;
}
+ /**
+ * Returns the length of the longest line, used for getting the span
+ * @return the length of the longest line
+ */
+ float determineMaxLineLength()
+ {
+ // if the longest line is cached, return the cached value
+ if (maxLineLength != -1)
+ return maxLineLength;
+
+ // otherwise we have to go through all the lines and find it
+ Element el = getElement();
+ Segment seg = getLineBuffer();
+ float span = 0;
+ for (int i = 0; i < el.getElementCount(); i++)
+ {
+ Element child = el.getElement(i);
+ int start = child.getStartOffset();
+ int end = child.getEndOffset();
+ try
+ {
+ el.getDocument().getText(start, end - start, seg);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(ex);
+ throw ae;
+ }
+
+ if (seg == null || seg.array == null || seg.count == 0)
+ continue;
+
+ int width = metrics.charsWidth(seg.array, seg.offset, seg.count);
+ if (width > span)
+ {
+ longestLine = child;
+ span = width;
+ }
+ }
+ maxLineLength = span;
+ return maxLineLength;
+ }
+
public float getPreferredSpan(int axis)
{
if (axis != X_AXIS && axis != Y_AXIS)
@@ -205,36 +287,16 @@ public class PlainView extends View
float span = 0;
Element el = getElement();
- Document doc = el.getDocument();
- Segment seg = new Segment();
switch (axis)
{
case X_AXIS:
- // calculate the maximum of the line's widths
- for (int i = 0; i < el.getElementCount(); i++)
- {
- Element child = el.getElement(i);
- int start = child.getStartOffset();
- int end = child.getEndOffset();
- try {
- doc.getText(start, start + end, seg);
- }
- catch (BadLocationException ex)
- {
- // throw new ClasspathAssertionError
- // ("no BadLocationException should be thrown here");
- }
- int width = metrics.charsWidth(seg.array, seg.offset, seg.count);
- span = Math.max(span, width);
- }
- break;
+ span = determineMaxLineLength();
case Y_AXIS:
default:
span = metrics.getHeight() * el.getElementCount();
break;
}
-
return span;
}
@@ -252,8 +314,251 @@ public class PlainView extends View
*/
public int viewToModel(float x, float y, Shape a, Position.Bias[] b)
{
- // FIXME: not implemented
- return 0;
+ Rectangle rec = a.getBounds();
+ Document doc = getDocument();
+ Element root = doc.getDefaultRootElement();
+
+ // PlainView doesn't support line-wrapping so we can find out which
+ // Element was clicked on just by the y-position
+ int lineClicked = (int) (y - rec.y) / metrics.getHeight();
+ if (lineClicked >= root.getElementCount())
+ return getEndOffset() - 1;
+
+ Element line = root.getElement(lineClicked);
+ Segment s = getLineBuffer();
+ int start = line.getStartOffset();
+ // We don't want the \n at the end of the line.
+ int end = line.getEndOffset() - 1;
+ try
+ {
+ doc.getText(start, end - start, s);
+ }
+ catch (BadLocationException ble)
+ {
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(ble);
+ throw ae;
+ }
+
+ int pos = Utilities.getTabbedTextOffset(s, metrics, rec.x, (int)x, this, start);
+ return Math.max (0, pos);
+ }
+
+ /**
+ * Since insertUpdate and removeUpdate each deal with children
+ * Elements being both added and removed, they both have to perform
+ * the same checks. So they both simply call this method.
+ * @param changes the DocumentEvent for the changes to the Document.
+ * @param a the allocation of the View.
+ * @param f the ViewFactory to use for rebuilding.
+ */
+ protected void updateDamage(DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ Element el = getElement();
+ ElementChange ec = changes.getChange(el);
+
+ // If ec is null then no lines were added or removed, just
+ // repaint the changed line
+ if (ec == null)
+ {
+ int line = getElement().getElementIndex(changes.getOffset());
+ damageLineRange(line, line, a, getContainer());
+ return;
+ }
+
+ Element[] removed = ec.getChildrenRemoved();
+ Element[] newElements = ec.getChildrenAdded();
+
+ // If no Elements were added or removed, we just want to repaint
+ // the area containing the line that was modified
+ if (removed == null && newElements == null)
+ {
+ int line = getElement().getElementIndex(changes.getOffset());
+ damageLineRange(line, line, a, getContainer());
+ return;
+ }
+
+ // Check to see if we removed the longest line, if so we have to
+ // search through all lines and find the longest one again
+ if (removed != null)
+ {
+ for (int i = 0; i < removed.length; i++)
+ if (removed[i].equals(longestLine))
+ {
+ // reset maxLineLength and search through all lines for longest one
+ maxLineLength = -1;
+ determineMaxLineLength();
+ ((JTextComponent)getContainer()).repaint();
+ return;
+ }
+ }
+
+ // If we've reached here, that means we haven't removed the longest line
+ if (newElements == null)
+ {
+ // No lines were added, just repaint the container and exit
+ ((JTextComponent)getContainer()).repaint();
+ return;
+ }
+
+ // Make sure we have the metrics
+ updateMetrics();
+
+ // If we've reached here, that means we haven't removed the longest line
+ // and we have added at least one line, so we have to check if added lines
+ // are longer than the previous longest line
+ Segment seg = getLineBuffer();
+ float longestNewLength = 0;
+ Element longestNewLine = null;
+
+ // Loop through the added lines to check their length
+ for (int i = 0; i < newElements.length; i++)
+ {
+ Element child = newElements[i];
+ int start = child.getStartOffset();
+ int end = child.getEndOffset();
+ try
+ {
+ el.getDocument().getText(start, end - start, seg);
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError ae = new AssertionError("Unexpected bad location");
+ ae.initCause(ex);
+ throw ae;
+ }
+
+ if (seg == null || seg.array == null || seg.count == 0)
+ continue;
+
+ int width = metrics.charsWidth(seg.array, seg.offset, seg.count);
+ if (width > longestNewLength)
+ {
+ longestNewLine = child;
+ longestNewLength = width;
+ }
+ }
+
+ // Check if the longest of the new lines is longer than our previous
+ // longest line, and if so update our values
+ if (longestNewLength > maxLineLength)
+ {
+ maxLineLength = longestNewLength;
+ longestLine = longestNewLine;
+ }
+ // Repaint the container
+ ((JTextComponent)getContainer()).repaint();
+ }
+
+ /**
+ * This method is called when something is inserted into the Document
+ * that this View is displaying.
+ *
+ * @param changes the DocumentEvent for the changes.
+ * @param a the allocation of the View
+ * @param f the ViewFactory used to rebuild
+ */
+ public void insertUpdate(DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage(changes, a, f);
+ }
+
+ /**
+ * This method is called when something is removed from the Document
+ * that this View is displaying.
+ *
+ * @param changes the DocumentEvent for the changes.
+ * @param a the allocation of the View
+ * @param f the ViewFactory used to rebuild
+ */
+ public void removeUpdate(DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage(changes, a, f);
+ }
+
+ /**
+ * This method is called when attributes were changed in the
+ * Document in a location that this view is responsible for.
+ */
+ public void changedUpdate (DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage(changes, a, f);
+ }
+
+ /**
+ * Repaint the given line range. This is called from insertUpdate,
+ * changedUpdate, and removeUpdate when no new lines were added
+ * and no lines were removed, to repaint the line that was
+ * modified.
+ *
+ * @param line0 the start of the range
+ * @param line1 the end of the range
+ * @param a the rendering region of the host
+ * @param host the Component that uses this View (used to call repaint
+ * on that Component)
+ *
+ * @since 1.4
+ */
+ protected void damageLineRange (int line0, int line1, Shape a, Component host)
+ {
+ if (a == null)
+ return;
+
+ Rectangle rec0 = lineToRect(a, line0);
+ Rectangle rec1 = lineToRect(a, line1);
+
+ if (rec0 == null || rec1 == null)
+ // something went wrong, repaint the entire host to be safe
+ host.repaint();
+ else
+ {
+ Rectangle repaintRec = rec0.union(rec1);
+ host.repaint();
+ }
+ }
+
+ /**
+ * Provides a {@link Segment} object, that can be used to fetch text from
+ * the document.
+ *
+ * @returna {@link Segment} object, that can be used to fetch text from
+ * the document
+ */
+ protected Segment getLineBuffer()
+ {
+ if (lineBuffer == null)
+ lineBuffer = new Segment();
+ return lineBuffer;
+ }
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
}
}
diff --git a/libjava/classpath/javax/swing/text/Segment.java b/libjava/classpath/javax/swing/text/Segment.java
index 92d850016d9..84e0e700f2e 100644
--- a/libjava/classpath/javax/swing/text/Segment.java
+++ b/libjava/classpath/javax/swing/text/Segment.java
@@ -39,8 +39,7 @@ package javax.swing.text;
import java.text.CharacterIterator;
-public class Segment
- implements Cloneable, CharacterIterator
+public class Segment implements Cloneable, CharacterIterator
{
private boolean partialReturn;
private int current;
@@ -51,6 +50,7 @@ public class Segment
public Segment()
{
+ // Nothing to do here.
}
public Segment(char[] array, int offset, int count)
diff --git a/libjava/classpath/javax/swing/text/SimpleAttributeSet.java b/libjava/classpath/javax/swing/text/SimpleAttributeSet.java
index 3ef5db61d43..0c9f607b196 100644
--- a/libjava/classpath/javax/swing/text/SimpleAttributeSet.java
+++ b/libjava/classpath/javax/swing/text/SimpleAttributeSet.java
@@ -45,6 +45,9 @@ import java.util.Hashtable;
public class SimpleAttributeSet
implements MutableAttributeSet, Serializable, Cloneable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 8267656273837665219L;
+
public static final AttributeSet EMPTY = new SimpleAttributeSet();
Hashtable tab;
@@ -84,12 +87,34 @@ public class SimpleAttributeSet
return s;
}
+ /**
+ * Returns true if the given name and value represent an attribute
+ * found either in this AttributeSet or in its resolve parent hierarchy.
+ * @param name the key for the attribute
+ * @param value the value for the attribute
+ * @return true if the attribute is found here or in this set's resolve
+ * parent hierarchy
+ */
public boolean containsAttribute(Object name, Object value)
{
+ return (tab.containsKey(name) && tab.get(name).equals(value)) ||
+ (getResolveParent() != null && getResolveParent().
+ containsAttribute(name, value));
+ }
+
+ /**
+ * Returns true if the given name and value are found in this AttributeSet.
+ * Does not check the resolve parent.
+ * @param name the key for the attribute
+ * @param value the value for the attribute
+ * @return true if the attribute is found in this AttributeSet
+ */
+ boolean containsAttributeLocally(Object name, Object value)
+ {
return tab.containsKey(name)
&& tab.get(name).equals(value);
}
-
+
public boolean containsAttributes(AttributeSet attributes)
{
Enumeration e = attributes.getAttributeNames();
@@ -110,9 +135,9 @@ public class SimpleAttributeSet
public boolean equals(Object obj)
{
- return (obj != null)
- && (obj instanceof SimpleAttributeSet)
- && ((SimpleAttributeSet)obj).tab.equals(this.tab);
+ return
+ (obj instanceof AttributeSet)
+ && this.isEqual((AttributeSet) obj);
}
public Object getAttribute(Object name)
@@ -157,10 +182,16 @@ public class SimpleAttributeSet
{
return tab.isEmpty();
}
-
+
+ /**
+ * Returns true if the given set has the same number of attributes
+ * as this set and <code>containsAttributes(attr)</code> returns
+ * true.
+ */
public boolean isEqual(AttributeSet attr)
{
- return this.equals(attr);
+ return getAttributeCount() == attr.getAttributeCount()
+ && this.containsAttributes(attr);
}
public void removeAttribute(Object name)
@@ -168,9 +199,21 @@ public class SimpleAttributeSet
tab.remove(name);
}
+ /**
+ * Removes attributes from this set if they are found in the
+ * given set. Only attributes whose key AND value are removed.
+ * Removes attributes only from this set, not from the resolving parent.
+ */
public void removeAttributes(AttributeSet attributes)
{
- removeAttributes(attributes.getAttributeNames());
+ Enumeration e = attributes.getAttributeNames();
+ while (e.hasMoreElements())
+ {
+ Object name = e.nextElement();
+ Object val = attributes.getAttribute(name);
+ if (containsAttributeLocally(name, val))
+ removeAttribute(name);
+ }
}
public void removeAttributes(Enumeration names)
diff --git a/libjava/classpath/javax/swing/text/StringContent.java b/libjava/classpath/javax/swing/text/StringContent.java
index bedf480d4ec..7db377a1c9b 100644
--- a/libjava/classpath/javax/swing/text/StringContent.java
+++ b/libjava/classpath/javax/swing/text/StringContent.java
@@ -56,6 +56,9 @@ import javax.swing.undo.UndoableEdit;
*/
public final class StringContent implements AbstractDocument.Content, Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 4755994433709540381L;
+
// This is package-private to avoid an accessor method.
char[] content;
diff --git a/libjava/classpath/javax/swing/text/StyleConstants.java b/libjava/classpath/javax/swing/text/StyleConstants.java
index 3f973f22631..598eaf621bc 100644
--- a/libjava/classpath/javax/swing/text/StyleConstants.java
+++ b/libjava/classpath/javax/swing/text/StyleConstants.java
@@ -54,11 +54,13 @@ public class StyleConstants
public static final Object BidiLevel = CharacterConstants.BidiLevel;
public static final Object Bold = CharacterConstants.Bold;
public static final Object ComponentAttribute = CharacterConstants.ComponentAttribute;
- public static final Object FontFamily = CharacterConstants.Family;
+ public static final Object Family = CharacterConstants.Family;
+ public static final Object FontFamily = CharacterConstants.Family;
public static final Object FontSize = CharacterConstants.Size;
public static final Object Foreground = CharacterConstants.Foreground;
public static final Object IconAttribute = CharacterConstants.IconAttribute;
public static final Object Italic = CharacterConstants.Italic;
+ public static final Object Size = CharacterConstants.Size;
public static final Object StrikeThrough = CharacterConstants.StrikeThrough;
public static final Object Subscript = CharacterConstants.Subscript;
public static final Object Superscript = CharacterConstants.Superscript;
@@ -109,7 +111,7 @@ public class StyleConstants
if (a.isDefined(Background))
return (Color) a.getAttribute(Background);
else
- return Color.BLACK;
+ return Color.WHITE;
}
public static int getBidiLevel(AttributeSet a)
diff --git a/libjava/classpath/javax/swing/text/StyleContext.java b/libjava/classpath/javax/swing/text/StyleContext.java
index ae11622ffc6..6c4e299455f 100644
--- a/libjava/classpath/javax/swing/text/StyleContext.java
+++ b/libjava/classpath/javax/swing/text/StyleContext.java
@@ -57,9 +57,15 @@ import javax.swing.event.EventListenerList;
public class StyleContext
implements Serializable, AbstractDocument.AttributeContext
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 8042858831190784241L;
+
public class NamedStyle
implements Serializable, Style
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6690628971806226374L;
+
protected ChangeEvent changeEvent;
protected EventListenerList listenerList;
@@ -288,7 +294,7 @@ public class StyleContext
public boolean equals(Object obj)
{
return
- (obj instanceof SmallAttributeSet)
+ (obj instanceof AttributeSet)
&& this.isEqual((AttributeSet)obj);
}
@@ -300,9 +306,14 @@ public class StyleContext
return attrs[i+1];
}
- Object p = getResolveParent();
- if (p != null && p instanceof AttributeSet)
- return (((AttributeSet)p).getAttribute(key));
+ // Check the resolve parent, unless we're looking for the
+ // ResolveAttribute, which would cause an infinite loop
+ if (!(key.equals(ResolveAttribute)))
+ {
+ Object p = getResolveParent();
+ if (p != null && p instanceof AttributeSet)
+ return (((AttributeSet)p).getAttribute(key));
+ }
return null;
}
diff --git a/libjava/classpath/javax/swing/text/StyledDocument.java b/libjava/classpath/javax/swing/text/StyledDocument.java
index ea277540f23..168e1b116f3 100644
--- a/libjava/classpath/javax/swing/text/StyledDocument.java
+++ b/libjava/classpath/javax/swing/text/StyledDocument.java
@@ -45,101 +45,96 @@ import java.awt.Font;
* @author Andrew Selkirk
* @version 1.0
*/
-public interface StyledDocument extends Document {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * addStyle
- * @param nm TODO
- * @param rent TODO
- * @returns Style
- */
- Style addStyle(String nm, Style parent);
-
- /**
- * removeStyle
- * @param nm TODO
- */
- void removeStyle(String nm);
-
- /**
- * getStyle
- * @param nm TODO
- * @returns Style
- */
- Style getStyle(String nm);
-
- /**
- * setCharacterAttributes
- * @param offset TODO
- * @param length TODO
- * @param set TODO
- * @param replace TODO
- */
- void setCharacterAttributes(int offset, int length,
- AttributeSet set, boolean replace);
-
- /**
- * setParagraphAttributes
- * @param offset TODO
- * @param length TODO
- * @param set TODO
- * @param replace TODO
- */
- void setParagraphAttributes(int offset, int length,
- AttributeSet set, boolean replace);
-
- /**
- * getLogicalStyle
- * @param position TODO
- * @returns Style
- */
- Style getLogicalStyle(int position);
-
- /**
- * setLogicalStyle
- * @param position TODO
- * @param style TODO
- */
- void setLogicalStyle(int position, Style style);
-
- /**
- * getParagraphElement
- * @param position TODO
- * @returns Element
- */
- Element getParagraphElement(int position);
-
- /**
- * getCharacterElement
- * @param position TODO
- * @returns Element
- */
- Element getCharacterElement(int position);
-
- /**
- * getForeground
- * @param set TODO
- * @returns Color
- */
- Color getForeground(AttributeSet set);
-
- /**
- * getBackground
- * @param set TODO
- * @returns Color
- */
- Color getBackground(AttributeSet set);
-
- /**
- * getFont
- * @param set TODO
- * @returns Font
- */
- Font getFont(AttributeSet set);
-
-
-} // StyledDocument
+public interface StyledDocument extends Document
+{
+ /**
+ * addStyle
+ * @param nm TODO
+ * @param parent TODO
+ * @returns Style
+ */
+ Style addStyle(String nm, Style parent);
+
+ /**
+ * removeStyle
+ * @param nm TODO
+ */
+ void removeStyle(String nm);
+
+ /**
+ * getStyle
+ * @param nm TODO
+ * @returns Style
+ */
+ Style getStyle(String nm);
+
+ /**
+ * setCharacterAttributes
+ * @param offset TODO
+ * @param length TODO
+ * @param set TODO
+ * @param replace TODO
+ */
+ void setCharacterAttributes(int offset, int length, AttributeSet set,
+ boolean replace);
+
+ /**
+ * setParagraphAttributes
+ * @param offset TODO
+ * @param length TODO
+ * @param set TODO
+ * @param replace TODO
+ */
+ void setParagraphAttributes(int offset, int length, AttributeSet set,
+ boolean replace);
+
+ /**
+ * getLogicalStyle
+ * @param position TODO
+ * @returns Style
+ */
+ Style getLogicalStyle(int position);
+
+ /**
+ * setLogicalStyle
+ * @param position TODO
+ * @param style TODO
+ */
+ void setLogicalStyle(int position, Style style);
+
+ /**
+ * getParagraphElement
+ * @param position TODO
+ * @returns Element
+ */
+ Element getParagraphElement(int position);
+
+ /**
+ * getCharacterElement
+ * @param position TODO
+ * @returns Element
+ */
+ Element getCharacterElement(int position);
+
+ /**
+ * getForeground
+ * @param set TODO
+ * @returns Color
+ */
+ Color getForeground(AttributeSet set);
+
+ /**
+ * getBackground
+ * @param set TODO
+ * @returns Color
+ */
+ Color getBackground(AttributeSet set);
+
+ /**
+ * getFont
+ * @param set TODO
+ * @returns Font
+ */
+ Font getFont(AttributeSet set);
+
+}
diff --git a/libjava/classpath/javax/swing/text/StyledEditorKit.java b/libjava/classpath/javax/swing/text/StyledEditorKit.java
index 89c4cf18ee4..e71f992b534 100644
--- a/libjava/classpath/javax/swing/text/StyledEditorKit.java
+++ b/libjava/classpath/javax/swing/text/StyledEditorKit.java
@@ -40,13 +40,9 @@ package javax.swing.text;
import java.awt.Color;
import java.awt.event.ActionEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.Serializable;
import javax.swing.Action;
import javax.swing.JEditorPane;
-import javax.swing.JTextPane;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
@@ -460,11 +456,11 @@ public class StyledEditorKit extends DefaultEditorKit
* <code>StyledEditorKit</code>, namely the following types of Elements:
*
* <ul>
- * <li>{@link AbstractDocument.ContentElementName}</li>
- * <li>{@link AbstractDocument.ParagraphElementName}</li>
- * <li>{@link AbstractDocument.SectionElementName}</li>
- * <li>{@link StyleContext.ComponentElementName}</li>
- * <li>{@link StyleContext.IconElementName}</li>
+ * <li>{@link AbstractDocument#ContentElementName}</li>
+ * <li>{@link AbstractDocument#ParagraphElementName}</li>
+ * <li>{@link AbstractDocument#SectionElementName}</li>
+ * <li>{@link StyleConstants#ComponentElementName}</li>
+ * <li>{@link StyleConstants#IconElementName}</li>
* </ul>
*/
static class StyledViewFactory
@@ -667,11 +663,11 @@ public class StyledEditorKit extends DefaultEditorKit
* namely the following types of <code>Element</code>s:
*
* <ul>
- * <li>{@link AbstractDocument.ContentElementName}</li>
- * <li>{@link AbstractDocument.ParagraphElementName}</li>
- * <li>{@link AbstractDocument.SectionElementName}</li>
- * <li>{@link StyleContext.ComponentElementName}</li>
- * <li>{@link StyleContext.IconElementName}</li>
+ * <li>{@link AbstractDocument#ContentElementName}</li>
+ * <li>{@link AbstractDocument#ParagraphElementName}</li>
+ * <li>{@link AbstractDocument#SectionElementName}</li>
+ * <li>{@link StyleConstants#ComponentElementName}</li>
+ * <li>{@link StyleConstants#IconElementName}</li>
* </ul>
*
* @return a {@link ViewFactory} that is able to create {@link View}s
diff --git a/libjava/classpath/javax/swing/text/TabSet.java b/libjava/classpath/javax/swing/text/TabSet.java
index 146f545aac7..ecad9444ea5 100644
--- a/libjava/classpath/javax/swing/text/TabSet.java
+++ b/libjava/classpath/javax/swing/text/TabSet.java
@@ -41,6 +41,9 @@ import java.io.Serializable;
public class TabSet implements Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 2367703481999080593L;
+
TabStop[] tabs;
public TabSet(TabStop[] t)
diff --git a/libjava/classpath/javax/swing/text/TabStop.java b/libjava/classpath/javax/swing/text/TabStop.java
index 032da8bca46..56f862fdae4 100644
--- a/libjava/classpath/javax/swing/text/TabStop.java
+++ b/libjava/classpath/javax/swing/text/TabStop.java
@@ -41,6 +41,9 @@ import java.io.Serializable;
public class TabStop implements Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -5381995917363605058L;
+
public static final int ALIGN_LEFT = 0;
public static final int ALIGN_RIGHT = 1;
public static final int ALIGN_CENTER = 2;
diff --git a/libjava/classpath/javax/swing/text/Utilities.java b/libjava/classpath/javax/swing/text/Utilities.java
index d40408ddc3f..7830b2fca04 100644
--- a/libjava/classpath/javax/swing/text/Utilities.java
+++ b/libjava/classpath/javax/swing/text/Utilities.java
@@ -40,6 +40,11 @@ package javax.swing.text;
import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.text.BreakIterator;
+
+import javax.swing.SwingConstants;
/**
* A set of utilities to deal with text. This is used by several other classes
@@ -195,4 +200,409 @@ public class Utilities
return maxWidth;
}
+
+ /**
+ * Provides a facility to map screen coordinates into a model location. For a
+ * given text fragment and start location within this fragment, this method
+ * determines the model location so that the resulting fragment fits best
+ * into the span <code>[x0, x]</code>.
+ *
+ * The parameter <code>round</code> controls which model location is returned
+ * if the view coordinates are on a character: If <code>round</code> is
+ * <code>true</code>, then the result is rounded up to the next character, so
+ * that the resulting fragment is the smallest fragment that is larger than
+ * the specified span. If <code>round</code> is <code>false</code>, then the
+ * resulting fragment is the largest fragment that is smaller than the
+ * specified span.
+ *
+ * @param s the text segment
+ * @param fm the font metrics to use
+ * @param x0 the starting screen location
+ * @param x the target screen location at which the requested fragment should
+ * end
+ * @param te the tab expander to use; if this is <code>null</code>, TABs are
+ * expanded to one space character
+ * @param p0 the starting model location
+ * @param round if <code>true</code> round up to the next location, otherwise
+ * round down to the current location
+ *
+ * @return the model location, so that the resulting fragment fits within the
+ * specified span
+ */
+ public static final int getTabbedTextOffset(Segment s, FontMetrics fm, int x0,
+ int x, TabExpander te, int p0,
+ boolean round)
+ {
+ // At the end of the for loop, this holds the requested model location
+ int pos;
+ int currentX = x0;
+
+ for (pos = p0; pos < s.count; pos++)
+ {
+ char nextChar = s.array[s.offset+pos];
+ if (nextChar == 0)
+ {
+ if (! round)
+ pos--;
+ break;
+ }
+ if (nextChar != '\t')
+ currentX += fm.charWidth(nextChar);
+ else
+ {
+ if (te == null)
+ currentX += fm.charWidth(' ');
+ else
+ currentX = (int) te.nextTabStop(currentX, pos);
+ }
+ if (currentX > x)
+ {
+ if (! round)
+ pos--;
+ break;
+ }
+ }
+ return pos;
+ }
+
+ /**
+ * Provides a facility to map screen coordinates into a model location. For a
+ * given text fragment and start location within this fragment, this method
+ * determines the model location so that the resulting fragment fits best
+ * into the span <code>[x0, x]</code>.
+ *
+ * This method rounds up to the next location, so that the resulting fragment
+ * will be the smallest fragment of the text, that is greater than the
+ * specified span.
+ *
+ * @param s the text segment
+ * @param fm the font metrics to use
+ * @param x0 the starting screen location
+ * @param x the target screen location at which the requested fragment should
+ * end
+ * @param te the tab expander to use; if this is <code>null</code>, TABs are
+ * expanded to one space character
+ * @param p0 the starting model location
+ *
+ * @return the model location, so that the resulting fragment fits within the
+ * specified span
+ */
+ public static final int getTabbedTextOffset(Segment s, FontMetrics fm, int x0,
+ int x, TabExpander te, int p0)
+ {
+ return getTabbedTextOffset(s, fm, x0, x, te, p0, true);
+ }
+
+ /**
+ * Finds the start of the next word for the given offset.
+ *
+ * @param c
+ * the text component
+ * @param offs
+ * the offset in the document
+ * @return the location in the model of the start of the next word.
+ * @throws BadLocationException
+ * if the offset is invalid.
+ */
+ public static final int getNextWord(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ if (offs < 0 || offs > (c.getText().length() - 1))
+ throw new BadLocationException("invalid offset specified", offs);
+ String text = c.getText();
+ BreakIterator wb = BreakIterator.getWordInstance();
+ wb.setText(text);
+ int last = wb.following(offs);
+ int current = wb.next();
+ while (current != BreakIterator.DONE)
+ {
+ for (int i = last; i < current; i++)
+ {
+ // FIXME: Should use isLetter(int) and text.codePointAt(int)
+ // instead, but isLetter(int) isn't implemented yet
+ if (Character.isLetter(text.charAt(i)))
+ return last;
+ }
+ last = current;
+ current = wb.next();
+ }
+ return BreakIterator.DONE;
+ }
+
+ /**
+ * Finds the start of the previous word for the given offset.
+ *
+ * @param c
+ * the text component
+ * @param offs
+ * the offset in the document
+ * @return the location in the model of the start of the previous word.
+ * @throws BadLocationException
+ * if the offset is invalid.
+ */
+ public static final int getPreviousWord(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ if (offs < 0 || offs > (c.getText().length() - 1))
+ throw new BadLocationException("invalid offset specified", offs);
+ String text = c.getText();
+ BreakIterator wb = BreakIterator.getWordInstance();
+ wb.setText(text);
+ int last = wb.preceding(offs);
+ int current = wb.previous();
+
+ while (current != BreakIterator.DONE)
+ {
+ for (int i = last; i < offs; i++)
+ {
+ // FIXME: Should use isLetter(int) and text.codePointAt(int)
+ // instead, but isLetter(int) isn't implemented yet
+ if (Character.isLetter(text.charAt(i)))
+ return last;
+ }
+ last = current;
+ current = wb.previous();
+ }
+ return 0;
+ }
+
+ /**
+ * Finds the start of a word for the given location.
+ * @param c the text component
+ * @param offs the offset location
+ * @return the location of the word beginning
+ * @throws BadLocationException if the offset location is invalid
+ */
+ public static final int getWordStart(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ if (offs < 0 || offs >= c.getText().length())
+ throw new BadLocationException("invalid offset specified", offs);
+
+ String text = c.getText();
+ BreakIterator wb = BreakIterator.getWordInstance();
+ wb.setText(text);
+ if (wb.isBoundary(offs))
+ return offs;
+ return wb.preceding(offs);
+ }
+
+ /**
+ * Finds the end of a word for the given location.
+ * @param c the text component
+ * @param offs the offset location
+ * @return the location of the word end
+ * @throws BadLocationException if the offset location is invalid
+ */
+ public static final int getWordEnd(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ if (offs < 0 || offs >= c.getText().length())
+ throw new BadLocationException("invalid offset specified", offs);
+
+ String text = c.getText();
+ BreakIterator wb = BreakIterator.getWordInstance();
+ wb.setText(text);
+ return wb.following(offs);
+ }
+
+ /**
+ * Get the model position of the end of the row that contains the
+ * specified model position. Return null if the given JTextComponent
+ * does not have a size.
+ * @param c the JTextComponent
+ * @param offs the model position
+ * @return the model position of the end of the row containing the given
+ * offset
+ * @throws BadLocationException if the offset is invalid
+ */
+ public static final int getRowEnd(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ String text = c.getText();
+ if (text == null)
+ return -1;
+
+ // Do a binary search for the smallest position X > offs
+ // such that that character at positino X is not on the same
+ // line as the character at position offs
+ int high = offs + ((text.length() - 1 - offs) / 2);
+ int low = offs;
+ int oldHigh = text.length() + 1;
+ while (true)
+ {
+ if (c.modelToView(high).y != c.modelToView(offs).y)
+ {
+ oldHigh = high;
+ high = low + ((high + 1 - low) / 2);
+ if (oldHigh == high)
+ return high - 1;
+ }
+ else
+ {
+ low = high;
+ high += ((oldHigh - high) / 2);
+ if (low == high)
+ return low;
+ }
+ }
+ }
+
+ /**
+ * Get the model position of the start of the row that contains the specified
+ * model position. Return null if the given JTextComponent does not have a
+ * size.
+ *
+ * @param c the JTextComponent
+ * @param offs the model position
+ * @return the model position of the start of the row containing the given
+ * offset
+ * @throws BadLocationException if the offset is invalid
+ */
+ public static final int getRowStart(JTextComponent c, int offs)
+ throws BadLocationException
+ {
+ String text = c.getText();
+ if (text == null)
+ return -1;
+
+ // Do a binary search for the greatest position X < offs
+ // such that the character at position X is not on the same
+ // row as the character at position offs
+ int high = offs;
+ int low = 0;
+ int oldLow = 0;
+ while (true)
+ {
+ if (c.modelToView(low).y != c.modelToView(offs).y)
+ {
+ oldLow = low;
+ low = high - ((high + 1 - low) / 2);
+ if (oldLow == low)
+ return low + 1;
+ }
+ else
+ {
+ high = low;
+ low -= ((low - oldLow) / 2);
+ if (low == high)
+ return low;
+ }
+ }
+ }
+
+ /**
+ * Determine where to break the text in the given Segment, attempting to find
+ * a word boundary.
+ * @param s the Segment that holds the text
+ * @param metrics the font metrics used for calculating the break point
+ * @param x0 starting view location representing the start of the text
+ * @param x the target view location
+ * @param e the TabExpander used for expanding tabs (if this is null tabs
+ * are expanded to 1 space)
+ * @param startOffset the offset in the Document of the start of the text
+ * @return the offset at which we should break the text
+ */
+ public static final int getBreakLocation(Segment s, FontMetrics metrics,
+ int x0, int x, TabExpander e,
+ int startOffset)
+ {
+ int mark = Utilities.getTabbedTextOffset(s, metrics, x0, x, e, startOffset);
+ BreakIterator breaker = BreakIterator.getWordInstance();
+ breaker.setText(s.toString());
+
+ // If mark is equal to the end of the string, just use that position
+ if (mark == s.count)
+ return mark;
+
+ // Try to find a word boundary previous to the mark at which we
+ // can break the text
+ int preceding = breaker.preceding(mark + 1);
+
+ if (preceding != 0)
+ return preceding;
+ else
+ // If preceding is 0 we couldn't find a suitable word-boundary so
+ // just break it on the character boundary
+ return mark;
+ }
+
+ /**
+ * Returns the paragraph element in the text component <code>c</code> at
+ * the specified location <code>offset</code>.
+ *
+ * @param c the text component
+ * @param offset the offset of the paragraph element to return
+ *
+ * @return the paragraph element at <code>offset</code>
+ */
+ public static final Element getParagraphElement(JTextComponent c, int offset)
+ {
+ Document doc = c.getDocument();
+ Element par = null;
+ if (doc instanceof StyledDocument)
+ {
+ StyledDocument styledDoc = (StyledDocument) doc;
+ par = styledDoc.getParagraphElement(offset);
+ }
+ else
+ {
+ Element root = c.getDocument().getDefaultRootElement();
+ int parIndex = root.getElementIndex(offset);
+ par = root.getElement(parIndex);
+ }
+ return par;
+ }
+
+ /**
+ * Returns the document position that is closest above to the specified x
+ * coordinate in the row containing <code>offset</code>.
+ *
+ * @param c the text component
+ * @param offset the offset
+ * @param x the x coordinate
+ *
+ * @return the document position that is closest above to the specified x
+ * coordinate in the row containing <code>offset</code>
+ *
+ * @throws BadLocationException if <code>offset</code> is not a valid offset
+ */
+ public static final int getPositionAbove(JTextComponent c, int offset, int x)
+ throws BadLocationException
+ {
+ View rootView = c.getUI().getRootView(c);
+ Rectangle r = c.modelToView(offset);
+ int offs = c.viewToModel(new Point(x, r.y));
+ int pos = rootView.getNextVisualPositionFrom(c, offs,
+ Position.Bias.Forward,
+ SwingConstants.NORTH,
+ new Position.Bias[1]);
+ return pos;
+ }
+
+ /**
+ * Returns the document position that is closest below to the specified x
+ * coordinate in the row containing <code>offset</code>.
+ *
+ * @param c the text component
+ * @param offset the offset
+ * @param x the x coordinate
+ *
+ * @return the document position that is closest above to the specified x
+ * coordinate in the row containing <code>offset</code>
+ *
+ * @throws BadLocationException if <code>offset</code> is not a valid offset
+ */
+ public static final int getPositionBelow(JTextComponent c, int offset, int x)
+ throws BadLocationException
+ {
+ View rootView = c.getUI().getRootView(c);
+ Rectangle r = c.modelToView(offset);
+ int offs = c.viewToModel(new Point(x, r.y));
+ int pos = rootView.getNextVisualPositionFrom(c, offs,
+ Position.Bias.Forward,
+ SwingConstants.SOUTH,
+ new Position.Bias[1]);
+ return pos;
+ }
}
diff --git a/libjava/classpath/javax/swing/text/View.java b/libjava/classpath/javax/swing/text/View.java
index 24efba9a1bc..daab347d731 100644
--- a/libjava/classpath/javax/swing/text/View.java
+++ b/libjava/classpath/javax/swing/text/View.java
@@ -43,7 +43,6 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
-import javax.swing.JComponent;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;
@@ -87,9 +86,9 @@ public abstract class View implements SwingConstants
{
View parent = getParent();
if (parent == null)
- throw new AssertionError("The parent of a View must not be null.");
-
- return parent.getContainer();
+ return null;
+ else
+ return parent.getContainer();
}
public Document getDocument()
@@ -508,6 +507,30 @@ public abstract class View implements SwingConstants
}
/**
+ * Maps a position in the document into the coordinate space of the View.
+ * The output rectangle usually reflects the font height but has a width
+ * of zero.
+ *
+ * This method is deprecated and calls
+ * {@link #modelToView(int, Position.Bias, int, Position.Bias, Shape)} with
+ * a bias of {@link Position.Bias#Forward}.
+ *
+ * @param pos the position of the character in the model
+ * @param a the area that is occupied by the view
+ *
+ * @return a rectangle that gives the location of the document position
+ * inside the view coordinate space
+ *
+ * @throws BadLocationException if <code>pos</code> is invalid
+ *
+ * @deprecated Use {@link #modelToView(int, Shape, Position.Bias)} instead.
+ */
+ public Shape modelToView(int pos, Shape a) throws BadLocationException
+ {
+ return modelToView(pos, a, Position.Bias.Forward);
+ }
+
+ /**
* Maps coordinates from the <code>View</code>'s space into a position
* in the document model.
*
@@ -521,6 +544,25 @@ public abstract class View implements SwingConstants
*/
public abstract int viewToModel(float x, float y, Shape a, Position.Bias[] b);
+ /**
+ * Maps coordinates from the <code>View</code>'s space into a position
+ * in the document model. This method is deprecated and only there for
+ * compatibility.
+ *
+ * @param x the x coordinate in the view space
+ * @param y the y coordinate in the view space
+ * @param a the allocation of this <code>View</code>
+ *
+ * @return the position in the document that corresponds to the screen
+ * coordinates <code>x, y</code>
+ *
+ * @deprecated Use {@link #viewToModel(float, float, Shape, Position.Bias[])}
+ * instead.
+ */
+ public int viewToModel(float x, float y, Shape a)
+ {
+ return viewToModel(x, y, a, new Position.Bias[0]);
+ }
/**
* Dumps the complete View hierarchy. This method can be used for debugging
@@ -552,4 +594,30 @@ public abstract class View implements SwingConstants
for (int i = 0; i < count; ++i)
getView(i).dump(indent + 1);
}
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset in
+ * the document model
+ */
+ public abstract int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException;
}
diff --git a/libjava/classpath/javax/swing/text/WrappedPlainView.java b/libjava/classpath/javax/swing/text/WrappedPlainView.java
new file mode 100644
index 00000000000..b03399d0974
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/WrappedPlainView.java
@@ -0,0 +1,700 @@
+/* WrappedPlainView.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.Shape;
+
+import javax.swing.SwingConstants;
+import javax.swing.event.DocumentEvent;
+import javax.swing.text.Position.Bias;
+
+/**
+ * @author Anthony Balkissoon abalkiss at redhat dot com
+ *
+ */
+public class WrappedPlainView extends BoxView implements TabExpander
+{
+ /** The color for selected text **/
+ Color selectedColor;
+
+ /** The color for unselected text **/
+ Color unselectedColor;
+
+ /** The color for disabled components **/
+ Color disabledColor;
+
+ /** Stores the font metrics **/
+ protected FontMetrics metrics;
+
+ /** Whether or not to wrap on word boundaries **/
+ boolean wordWrap;
+
+ /** A ViewFactory that creates WrappedLines **/
+ ViewFactory viewFactory = new WrappedLineCreator();
+
+ /** The start of the selected text **/
+ int selectionStart;
+
+ /** The end of the selected text **/
+ int selectionEnd;
+
+ /**
+ * The instance returned by {@link #getLineBuffer()}.
+ */
+ private transient Segment lineBuffer;
+
+ public WrappedPlainView (Element elem)
+ {
+ this (elem, false);
+ }
+
+ public WrappedPlainView (Element elem, boolean wordWrap)
+ {
+ super (elem, Y_AXIS);
+ this.wordWrap = wordWrap;
+ }
+
+ /**
+ * Provides access to the Segment used for retrievals from the Document.
+ * @return the Segment.
+ */
+ protected final Segment getLineBuffer()
+ {
+ if (lineBuffer == null)
+ lineBuffer = new Segment();
+ return lineBuffer;
+ }
+
+ /**
+ * Returns the next tab stop position after a given reference position.
+ *
+ * This implementation ignores the <code>tabStop</code> argument.
+ *
+ * @param x the current x position in pixels
+ * @param tabStop the position within the text stream that the tab occured at
+ */
+ public float nextTabStop(float x, int tabStop)
+ {
+ JTextComponent host = (JTextComponent)getContainer();
+ float tabSizePixels = getTabSize()
+ * host.getFontMetrics(host.getFont()).charWidth('m');
+ return (float) (Math.floor(x / tabSizePixels) + 1) * tabSizePixels;
+ }
+
+ /**
+ * Returns the tab size for the Document based on
+ * PlainDocument.tabSizeAttribute, defaulting to 8 if this property is
+ * not defined
+ *
+ * @return the tab size.
+ */
+ protected int getTabSize()
+ {
+ Object tabSize = getDocument().getProperty(PlainDocument.tabSizeAttribute);
+ if (tabSize == null)
+ return 8;
+ return ((Integer)tabSize).intValue();
+ }
+
+ /**
+ * Draws a line of text, suppressing white space at the end and expanding
+ * tabs. Calls drawSelectedText and drawUnselectedText.
+ * @param p0 starting document position to use
+ * @param p1 ending document position to use
+ * @param g graphics context
+ * @param x starting x position
+ * @param y starting y position
+ */
+ protected void drawLine(int p0, int p1, Graphics g, int x, int y)
+ {
+ try
+ {
+ // We have to draw both selected and unselected text. There are
+ // several cases:
+ // - entire range is unselected
+ // - entire range is selected
+ // - start of range is selected, end of range is unselected
+ // - start of range is unselected, end of range is selected
+ // - middle of range is selected, start and end of range is unselected
+
+ // entire range unselected:
+ if ((selectionStart == selectionEnd) ||
+ (p0 > selectionEnd || p1 < selectionStart))
+ drawUnselectedText(g, x, y, p0, p1);
+
+ // entire range selected
+ else if (p0 >= selectionStart && p1 <= selectionEnd)
+ drawSelectedText(g, x, y, p0, p1);
+
+ // start of range selected, end of range unselected
+ else if (p0 >= selectionStart)
+ {
+ x = drawSelectedText(g, x, y, p0, selectionEnd);
+ drawUnselectedText(g, x, y, selectionEnd, p1);
+ }
+
+ // start of range unselected, end of range selected
+ else if (selectionStart > p0 && selectionEnd > p1)
+ {
+ x = drawUnselectedText(g, x, y, p0, selectionStart);
+ drawSelectedText(g, x, y, selectionStart, p1);
+ }
+
+ // middle of range selected
+ else if (selectionStart > p0)
+ {
+ x = drawUnselectedText(g, x, y, p0, selectionStart);
+ x = drawSelectedText(g, x, y, selectionStart, selectionEnd);
+ drawUnselectedText(g, x, y, selectionEnd, p1);
+ }
+ }
+ catch (BadLocationException ble)
+ {
+ // shouldn't happen
+ }
+ }
+
+ /**
+ * Renders the range of text as selected text. Just paints the text
+ * in the color specified by the host component. Assumes the highlighter
+ * will render the selected background.
+ * @param g the graphics context
+ * @param x the starting X coordinate
+ * @param y the starting Y coordinate
+ * @param p0 the starting model location
+ * @param p1 the ending model location
+ * @return the X coordinate of the end of the text
+ * @throws BadLocationException if the given range is invalid
+ */
+ protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
+ throws BadLocationException
+ {
+ g.setColor(selectedColor);
+ Segment segment = getLineBuffer();
+ getDocument().getText(p0, p1 - p0, segment);
+ return Utilities.drawTabbedText(segment, x, y, g, this, p0);
+ }
+
+ /**
+ * Renders the range of text as normal unhighlighted text.
+ * @param g the graphics context
+ * @param x the starting X coordinate
+ * @param y the starting Y coordinate
+ * @param p0 the starting model location
+ * @param p1 the end model location
+ * @return the X location of the end off the range
+ * @throws BadLocationException if the range given is invalid
+ */
+ protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
+ throws BadLocationException
+ {
+ JTextComponent textComponent = (JTextComponent) getContainer();
+ if (textComponent.isEnabled())
+ g.setColor(unselectedColor);
+ else
+ g.setColor(disabledColor);
+
+ Segment segment = getLineBuffer();
+ getDocument().getText(p0, p1 - p0, segment);
+ return Utilities.drawTabbedText(segment, x, y, g, this, p0);
+ }
+
+ /**
+ * Loads the children to initiate the view. Called by setParent.
+ * Creates a WrappedLine for each child Element.
+ */
+ protected void loadChildren (ViewFactory f)
+ {
+ Element root = getElement();
+ int numChildren = root.getElementCount();
+ if (numChildren == 0)
+ return;
+
+ View[] children = new View[numChildren];
+ for (int i = 0; i < numChildren; i++)
+ children[i] = new WrappedLine(root.getElement(i));
+ replace(0, 0, children);
+ }
+
+ /**
+ * Calculates the break position for the text between model positions
+ * p0 and p1. Will break on word boundaries or character boundaries
+ * depending on the break argument given in construction of this
+ * WrappedPlainView. Used by the nested WrappedLine class to determine
+ * when to start the next logical line.
+ * @param p0 the start model position
+ * @param p1 the end model position
+ * @return the model position at which to break the text
+ */
+ protected int calculateBreakPosition(int p0, int p1)
+ {
+ Container c = getContainer();
+ Rectangle alloc = c.isValid() ? c.getBounds()
+ : new Rectangle(c.getPreferredSize());
+ updateMetrics();
+ try
+ {
+ getDocument().getText(p0, p1 - p0, getLineBuffer());
+ }
+ catch (BadLocationException ble)
+ {
+ // this shouldn't happen
+ }
+ // FIXME: Should we account for the insets of the container?
+ if (wordWrap)
+ return p0
+ + Utilities.getBreakLocation(lineBuffer, metrics, alloc.x,
+ alloc.x + alloc.width, this, 0);
+ else
+ {
+ return p0
+ + Utilities.getTabbedTextOffset(lineBuffer, metrics, alloc.x,
+ alloc.x + alloc.width, this, 0);
+ }
+ }
+
+ void updateMetrics()
+ {
+ Container component = getContainer();
+ metrics = component.getFontMetrics(component.getFont());
+ }
+
+ /**
+ * Determines the preferred span along the given axis. Implemented to
+ * cache the font metrics and then call the super classes method.
+ */
+ public float getPreferredSpan (int axis)
+ {
+ updateMetrics();
+ return super.getPreferredSpan(axis);
+ }
+
+ /**
+ * Determines the minimum span along the given axis. Implemented to
+ * cache the font metrics and then call the super classes method.
+ */
+ public float getMinimumSpan (int axis)
+ {
+ updateMetrics();
+ return super.getMinimumSpan(axis);
+ }
+
+ /**
+ * Determines the maximum span along the given axis. Implemented to
+ * cache the font metrics and then call the super classes method.
+ */
+ public float getMaximumSpan (int axis)
+ {
+ updateMetrics();
+ return super.getMaximumSpan(axis);
+ }
+
+ /**
+ * Called when something was inserted. Overridden so that
+ * the view factory creates WrappedLine views.
+ */
+ public void insertUpdate (DocumentEvent e, Shape a, ViewFactory f)
+ {
+ super.insertUpdate(e, a, viewFactory);
+ // FIXME: could improve performance by repainting only the necessary area
+ getContainer().repaint();
+ }
+
+ /**
+ * Called when something is removed. Overridden so that
+ * the view factory creates WrappedLine views.
+ */
+ public void removeUpdate (DocumentEvent e, Shape a, ViewFactory f)
+ {
+ super.removeUpdate(e, a, viewFactory);
+ // FIXME: could improve performance by repainting only the necessary area
+ getContainer().repaint();
+ }
+
+ /**
+ * Called when the portion of the Document that this View is responsible
+ * for changes. Overridden so that the view factory creates
+ * WrappedLine views.
+ */
+ public void changedUpdate (DocumentEvent e, Shape a, ViewFactory f)
+ {
+ super.changedUpdate(e, a, viewFactory);
+ // FIXME: could improve performance by repainting only the necessary area
+ getContainer().repaint();
+ }
+
+ class WrappedLineCreator implements ViewFactory
+ {
+ // Creates a new WrappedLine
+ public View create(Element elem)
+ {
+ return new WrappedLine(elem);
+ }
+ }
+
+ /**
+ * Renders the <code>Element</code> that is associated with this
+ * <code>View</code>. Caches the metrics and then calls
+ * super.paint to paint all the child views.
+ *
+ * @param g the <code>Graphics</code> context to render to
+ * @param a the allocated region for the <code>Element</code>
+ */
+ public void paint(Graphics g, Shape a)
+ {
+ JTextComponent comp = (JTextComponent)getContainer();
+ selectionStart = comp.getSelectionStart();
+ selectionEnd = comp.getSelectionEnd();
+ updateMetrics();
+ super.paint(g, a);
+ }
+
+ /**
+ * Sets the size of the View. Implemented to update the metrics
+ * and then call super method.
+ */
+ public void setSize (float width, float height)
+ {
+ updateMetrics();
+ if (width != getWidth())
+ preferenceChanged(null, true, true);
+ super.setSize(width, height);
+ }
+
+ class WrappedLine extends View
+ {
+ /** Used to cache the number of lines for this View **/
+ int numLines;
+
+ public WrappedLine(Element elem)
+ {
+ super(elem);
+ determineNumLines();
+ }
+
+ /**
+ * Renders this (possibly wrapped) line using the given Graphics object
+ * and on the given rendering surface.
+ */
+ public void paint(Graphics g, Shape s)
+ {
+ // Ensure metrics are up-to-date.
+ updateMetrics();
+ JTextComponent textComponent = (JTextComponent) getContainer();
+
+ g.setFont(textComponent.getFont());
+ selectedColor = textComponent.getSelectedTextColor();
+ unselectedColor = textComponent.getForeground();
+ disabledColor = textComponent.getDisabledTextColor();
+
+ // FIXME: this is a hack, for some reason textComponent.getSelectedColor
+ // was returning black, which is not visible against a black background
+ selectedColor = Color.WHITE;
+
+ Rectangle rect = s.getBounds();
+ int lineHeight = metrics.getHeight();
+
+ int end = getEndOffset();
+ int currStart = getStartOffset();
+ int currEnd;
+ while (currStart < end)
+ {
+ currEnd = calculateBreakPosition(currStart, end);
+ drawLine(currStart, currEnd, g, rect.x, rect.y);
+ rect.y += lineHeight;
+ if (currEnd == currStart)
+ currStart ++;
+ else
+ currStart = currEnd;
+ }
+ }
+
+ /**
+ * Determines the number of logical lines that the Element
+ * needs to be displayed
+ * @return the number of lines needed to display the Element
+ */
+ int determineNumLines()
+ {
+ numLines = 0;
+ int end = getEndOffset();
+ if (end == 0)
+ return 0;
+
+ int breakPoint;
+ for (int i = getStartOffset(); i < end;)
+ {
+ numLines ++;
+ // careful: check that there's no off-by-one problem here
+ // depending on which position calculateBreakPosition returns
+ breakPoint = calculateBreakPosition(i, end);
+ if (breakPoint == i)
+ i ++;
+ else
+ i = breakPoint;
+ }
+ return numLines;
+ }
+
+ /**
+ * Determines the preferred span for this view along the given axis.
+ *
+ * @param axis the axis (either X_AXIS or Y_AXIS)
+ *
+ * @return the preferred span along the given axis.
+ * @throws IllegalArgumentException if axis is not X_AXIS or Y_AXIS
+ */
+ public float getPreferredSpan(int axis)
+ {
+ if (axis == X_AXIS)
+ return getWidth();
+ else if (axis == Y_AXIS)
+ return numLines * metrics.getHeight();
+
+ throw new IllegalArgumentException("Invalid axis for getPreferredSpan: "
+ + axis);
+ }
+
+ /**
+ * Provides a mapping from model space to view space.
+ *
+ * @param pos the position in the model
+ * @param a the region into which the view is rendered
+ * @param b the position bias (forward or backward)
+ *
+ * @return a box in view space that represents the given position
+ * in model space
+ * @throws BadLocationException if the given model position is invalid
+ */
+ public Shape modelToView(int pos, Shape a, Bias b)
+ throws BadLocationException
+ {
+ Segment s = getLineBuffer();
+ int lineHeight = metrics.getHeight();
+ Rectangle rect = a.getBounds();
+
+ // Return a rectangle with width 1 and height equal to the height
+ // of the text
+ rect.height = lineHeight;
+ rect.width = 1;
+
+ int currLineStart = getStartOffset();
+ int end = getEndOffset();
+
+ if (pos < currLineStart || pos >= end)
+ throw new BadLocationException("invalid offset", pos);
+
+ while (true)
+ {
+ int currLineEnd = calculateBreakPosition(currLineStart, end);
+ // If pos is between currLineStart and currLineEnd then just find
+ // the width of the text from currLineStart to pos and add that
+ // to rect.x
+ if (pos >= currLineStart && pos < currLineEnd || pos == end - 1)
+ {
+ try
+ {
+ getDocument().getText(currLineStart, pos - currLineStart, s);
+ }
+ catch (BadLocationException ble)
+ {
+ // Shouldn't happen
+ }
+ rect.x += Utilities.getTabbedTextWidth(s, metrics, rect.x,
+ WrappedPlainView.this,
+ currLineStart);
+ return rect;
+ }
+ // Increment rect.y so we're checking the next logical line
+ rect.y += lineHeight;
+
+ // Increment currLineStart to the model position of the start
+ // of the next logical line
+ if (currLineEnd == currLineStart)
+ currLineStart = end;
+ else
+ currLineStart = currLineEnd;
+ }
+
+ }
+
+ /**
+ * Provides a mapping from view space to model space.
+ *
+ * @param x the x coordinate in view space
+ * @param y the y coordinate in view space
+ * @param a the region into which the view is rendered
+ * @param b the position bias (forward or backward)
+ *
+ * @return the location in the model that best represents the
+ * given point in view space
+ */
+ public int viewToModel(float x, float y, Shape a, Bias[] b)
+ {
+ Segment s = getLineBuffer();
+ Rectangle rect = a.getBounds();
+ int currLineStart = getStartOffset();
+ int end = getEndOffset();
+ int lineHeight = metrics.getHeight();
+ if (y < rect.y)
+ return currLineStart;
+ if (y > rect.y + rect.height)
+ return end - 1;
+
+ while (true)
+ {
+ int currLineEnd = calculateBreakPosition(currLineStart, end);
+ // If we're at the right y-position that means we're on the right
+ // logical line and we should look for the character
+ if (y >= rect.y && y < rect.y + lineHeight)
+ {
+ // Check if the x position is to the left or right of the text
+ if (x < rect.x)
+ return currLineStart;
+ if (x > rect.x + rect.width)
+ return currLineEnd - 1;
+
+ try
+ {
+ getDocument().getText(currLineStart, end - currLineStart, s);
+ }
+ catch (BadLocationException ble)
+ {
+ // Shouldn't happen
+ }
+ int mark = Utilities.getTabbedTextOffset(s, metrics, rect.x,
+ (int) x,
+ WrappedPlainView.this,
+ currLineStart);
+ return currLineStart + mark;
+ }
+ // Increment rect.y so we're checking the next logical line
+ rect.y += lineHeight;
+
+ // Increment currLineStart to the model position of the start
+ // of the next logical line
+ if (currLineEnd == currLineStart)
+ currLineStart = end;
+ else
+ currLineStart = currLineEnd;
+ }
+ }
+
+ /**
+ * Returns the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction <code>d</code>.
+ *
+ * @param c the text component
+ * @param pos the document position
+ * @param b the bias for <code>pos</code>
+ * @param d the direction, must be either {@link SwingConstants#NORTH},
+ * {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or
+ * {@link SwingConstants#EAST}
+ * @param biasRet an array of {@link Position.Bias} that can hold at least
+ * one element, which is filled with the bias of the return position
+ * on method exit
+ *
+ * @return the document position that is (visually) nearest to the given
+ * document position <code>pos</code> in the given direction
+ * <code>d</code>
+ *
+ * @throws BadLocationException if <code>pos</code> is not a valid offset
+ * in the document model
+ */
+ public int getNextVisualPositionFrom(JTextComponent c, int pos,
+ Position.Bias b, int d,
+ Position.Bias[] biasRet)
+ throws BadLocationException
+ {
+ // TODO: Implement this properly.
+ throw new AssertionError("Not implemented yet.");
+ }
+
+ /**
+ * This method is called from insertUpdate and removeUpdate.
+ * If the number of lines in the document has changed, just repaint
+ * the whole thing (note, could improve performance by not repainting
+ * anything above the changes). If the number of lines hasn't changed,
+ * just repaint the given Rectangle.
+ * @param a the Rectangle to repaint if the number of lines hasn't changed
+ */
+ void updateDamage (Rectangle a)
+ {
+ int newNumLines = determineNumLines();
+ if (numLines != newNumLines)
+ {
+ numLines = newNumLines;
+ getContainer().repaint();
+ }
+ else
+ getContainer().repaint(a.x, a.y, a.width, a.height);
+ }
+
+ /**
+ * This method is called when something is inserted into the Document
+ * that this View is displaying.
+ *
+ * @param changes the DocumentEvent for the changes.
+ * @param a the allocation of the View
+ * @param f the ViewFactory used to rebuild
+ */
+ public void insertUpdate (DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage((Rectangle)a);
+ }
+
+ /**
+ * This method is called when something is removed from the Document
+ * that this View is displaying.
+ *
+ * @param changes the DocumentEvent for the changes.
+ * @param a the allocation of the View
+ * @param f the ViewFactory used to rebuild
+ */
+ public void removeUpdate (DocumentEvent changes, Shape a, ViewFactory f)
+ {
+ updateDamage((Rectangle)a);
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/html/CSS.java b/libjava/classpath/javax/swing/text/html/CSS.java
new file mode 100644
index 00000000000..029ad26f8a9
--- /dev/null
+++ b/libjava/classpath/javax/swing/text/html/CSS.java
@@ -0,0 +1,461 @@
+/* CSS.java -- Provides CSS attributes
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text.html;
+
+import java.util.HashMap;
+
+/**
+ * Provides CSS attributes to be used by the HTML view classes. The constants
+ * defined here are used as keys for text attributes for use in
+ * {@link javax.swing.text.AttributeSet}s of {@link javax.swing.text.Element}s.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class CSS
+{
+ /**
+ * Returns an array of all CSS attributes.
+ *
+ * @return All available CSS.Attribute objects.
+ */
+ public static CSS.Attribute[] getAllAttributeKeys()
+ {
+ Object[] src = Attribute.attributeMap.values().toArray();
+ CSS.Attribute[] dst = new CSS.Attribute[ src.length ];
+ System.arraycopy(src, 0, dst, 0, src.length);
+ return dst;
+ }
+
+ /**
+ * Returns an a given CSS attribute.
+ *
+ * @param name - The name of the attribute.
+ * @return The CSS attribute with the given name, or <code>null</code> if
+ * no attribute with that name exists.
+ */
+ public static CSS.Attribute getAttribute(String name)
+ {
+ return (CSS.Attribute)Attribute.attributeMap.get( name );
+ }
+
+ public static final class Attribute
+ {
+ /**
+ * The CSS attribute 'background'.
+ */
+ public static final Attribute BACKGROUND =
+ new Attribute("background", false, null);
+
+ /**
+ * The CSS attribute 'background-attachment'.
+ */
+ public static final Attribute BACKGROUND_ATTACHMENT =
+ new Attribute("background-attachment", false, "scroll");
+
+ /**
+ * The CSS attribute 'background-color'.
+ */
+ public static final Attribute BACKGROUND_COLOR =
+ new Attribute("background-color", false, "transparent");
+
+ /**
+ * The CSS attribute 'background-image'.
+ */
+ public static final Attribute BACKGROUND_IMAGE =
+ new Attribute("background-image", false, "none");
+
+ /**
+ * The CSS attribute 'background-position'.
+ */
+ public static final Attribute BACKGROUND_POSITION =
+ new Attribute("background-position", false, null);
+
+ /**
+ * The CSS attribute 'background-repeat'.
+ */
+ public static final Attribute BACKGROUND_REPEAT =
+ new Attribute("background-repeat", false, "repeat");
+
+ /**
+ * The CSS attribute 'border'.
+ */
+ public static final Attribute BORDER = new Attribute("border", false, null);
+
+ /**
+ * The CSS attribute 'border-bottom'.
+ */
+ public static final Attribute BORDER_BOTTOM =
+ new Attribute("border-bottom", false, null);
+
+ /**
+ * The CSS attribute 'border-bottom-width'.
+ */
+ public static final Attribute BORDER_BOTTOM_WIDTH =
+ new Attribute("border-bottom-width", false, "medium");
+
+ /**
+ * The CSS attribute 'border-color'.
+ */
+ public static final Attribute BORDER_COLOR =
+ new Attribute("border-color", false, "black");
+
+ /**
+ * The CSS attribute 'border-left'.
+ */
+ public static final Attribute BORDER_LEFT =
+ new Attribute("border-left", false, null);
+
+ /**
+ * The CSS attribute 'border-left-width'.
+ */
+ public static final Attribute BORDER_LEFT_WIDTH =
+ new Attribute("border-left-width", false, "medium");
+
+ /**
+ * The CSS attribute 'border-right'.
+ */
+ public static final Attribute BORDER_RIGHT =
+ new Attribute("border-right", false, null);
+
+ /**
+ * The CSS attribute 'border-right-width'.
+ */
+ public static final Attribute BORDER_RIGHT_WIDTH =
+ new Attribute("border-right-width", false, "medium");
+
+ /**
+ * The CSS attribute 'border-style'.
+ */
+ public static final Attribute BORDER_STYLE =
+ new Attribute("border-style", false, "none");
+
+ /**
+ * The CSS attribute 'border-top'.
+ */
+ public static final Attribute BORDER_TOP =
+ new Attribute("border-top", false, null);
+
+ /**
+ * The CSS attribute 'border-top-width'.
+ */
+ public static final Attribute BORDER_TOP_WIDTH =
+ new Attribute("border-top-width", false, "medium");
+
+ /**
+ * The CSS attribute 'border-width'.
+ */
+ public static final Attribute BORDER_WIDTH =
+ new Attribute("border-width", false, "medium");
+
+ /**
+ * The CSS attribute 'clear'.
+ */
+ public static final Attribute CLEAR = new Attribute("clear", false, "none");
+
+ /**
+ * The CSS attribute 'color'.
+ */
+ public static final Attribute COLOR = new Attribute("color", true, "black");
+
+ /**
+ * The CSS attribute 'display'.
+ */
+ public static final Attribute DISPLAY =
+ new Attribute("display", false, "block");
+
+ /**
+ * The CSS attribute 'float'.
+ */
+ public static final Attribute FLOAT = new Attribute("float", false, "none");
+
+ /**
+ * The CSS attribute 'font'.
+ */
+ public static final Attribute FONT = new Attribute("font", true, null);
+
+ /**
+ * The CSS attribute 'font-family'.
+ */
+ public static final Attribute FONT_FAMILY =
+ new Attribute("font-family", true, null);
+
+ /**
+ * The CSS attribute 'font-size'.
+ */
+ public static final Attribute FONT_SIZE =
+ new Attribute("font-size", true, "medium");
+
+ /**
+ * The CSS attribute 'font-style'.
+ */
+ public static final Attribute FONT_STYLE =
+ new Attribute("font-style", true, "normal");
+
+ /**
+ * The CSS attribute 'font-variant'.
+ */
+ public static final Attribute FONT_VARIANT =
+ new Attribute("font-variant", true, "normal");
+
+ /**
+ * The CSS attribute 'font-weight'.
+ */
+ public static final Attribute FONT_WEIGHT =
+ new Attribute("font-weight", true, "normal");
+
+ /**
+ * The CSS attribute 'height'.
+ */
+ public static final Attribute HEIGHT =
+ new Attribute("height", false, "auto");
+
+ /**
+ * The CSS attribute 'letter-spacing'.
+ */
+ public static final Attribute LETTER_SPACING =
+ new Attribute("letter-spacing", true, "normal");
+
+ /**
+ * The CSS attribute 'line-height'.
+ */
+ public static final Attribute LINE_HEIGHT =
+ new Attribute("line-height", true, "normal");
+
+ /**
+ * The CSS attribute 'list-style'.
+ */
+ public static final Attribute LIST_STYLE =
+ new Attribute("list-style", true, null);
+
+ /**
+ * The CSS attribute 'list-style-image'.
+ */
+ public static final Attribute LIST_STYLE_IMAGE =
+ new Attribute("list-style-image", true, "none");
+
+ /**
+ * The CSS attribute 'list-style-position'.
+ */
+ public static final Attribute LIST_STYLE_POSITION =
+ new Attribute("list-style-position", true, "outside");
+
+ /**
+ * The CSS attribute 'list-style-type'.
+ */
+ public static final Attribute LIST_STYLE_TYPE =
+ new Attribute("list-style-type", true, "disc");
+
+ /**
+ * The CSS attribute 'margin'.
+ */
+ public static final Attribute MARGIN = new Attribute("margin", false, null);
+
+ /**
+ * The CSS attribute 'margin-bottom'.
+ */
+ public static final Attribute MARGIN_BOTTOM =
+ new Attribute("margin-bottom", false, "0");
+
+ /**
+ * The CSS attribute 'margin-left'.
+ */
+ public static final Attribute MARGIN_LEFT =
+ new Attribute("margin-left", false, "0");
+
+ /**
+ * The CSS attribute 'margin-right'.
+ */
+ public static final Attribute MARGIN_RIGHT =
+ new Attribute("margin-right", false, "0");
+
+ /**
+ * The CSS attribute 'margin-top'.
+ */
+ public static final Attribute MARGIN_TOP =
+ new Attribute("margin-top", false, "0");
+
+ /**
+ * The CSS attribute 'padding'.
+ */
+ public static final Attribute PADDING =
+ new Attribute("padding", false, null);
+
+ /**
+ * The CSS attribute 'padding-bottom'.
+ */
+ public static final Attribute PADDING_BOTTOM =
+ new Attribute("padding-bottom", false, "0");
+
+ /**
+ * The CSS attribute 'padding-left'.
+ */
+ public static final Attribute PADDING_LEFT =
+ new Attribute("padding-left", false, "0");
+
+ /**
+ * The CSS attribute 'padding-right'.
+ */
+ public static final Attribute PADDING_RIGHT =
+ new Attribute("padding-right", false, "0");
+
+ /**
+ * The CSS attribute 'padding-top'.
+ */
+ public static final Attribute PADDING_TOP =
+ new Attribute("padding-top", false, "0");
+
+ /**
+ * The CSS attribute 'text-align'.
+ */
+ public static final Attribute TEXT_ALIGN =
+ new Attribute("text-align", true, null);
+
+ /**
+ * The CSS attribute 'text-decoration'.
+ */
+ public static final Attribute TEXT_DECORATION =
+ new Attribute("text-decoration", true, "none");
+
+ /**
+ * The CSS attribute 'text-indent'.
+ */
+ public static final Attribute TEXT_INDENT =
+ new Attribute("text-indent", true, "0");
+
+ /**
+ * The CSS attribute 'text-transform'.
+ */
+ public static final Attribute TEXT_TRANSFORM =
+ new Attribute("text-transform", true, "none");
+
+ /**
+ * The CSS attribute 'vertical-align'.
+ */
+ public static final Attribute VERTICAL_ALIGN =
+ new Attribute("vertical-align", false, "baseline");
+
+ /**
+ * The CSS attribute 'white-space'.
+ */
+ public static final Attribute WHITE_SPACE =
+ new Attribute("white-space", true, "normal");
+
+ /**
+ * The CSS attribute 'width'.
+ */
+ public static final Attribute WIDTH =
+ new Attribute("width", false, "auto");
+
+ /**
+ * The CSS attribute 'word-spacing'.
+ */
+ public static final Attribute WORD_SPACING =
+ new Attribute("word-spacing", true, "normal");
+
+ /**
+ * The attribute string.
+ */
+ String attStr;
+
+ /**
+ * Indicates if this attribute should be inherited from it's parent or
+ * not.
+ */
+ boolean isInherited;
+
+ /**
+ * A default value for this attribute if one exists, otherwise null.
+ */
+ String defaultValue;
+
+ /**
+ * A HashMap of all attributes.
+ */
+ static HashMap attributeMap;
+
+ /**
+ * Creates a new Attribute instance with the specified values.
+ *
+ * @param attr the attribute string
+ * @param inherited if the attribute should be inherited or not
+ * @param def a default value; may be <code>null</code>
+ */
+ Attribute(String attr, boolean inherited, String def)
+ {
+ attStr = attr;
+ isInherited = inherited;
+ defaultValue = def;
+ if( attributeMap == null)
+ attributeMap = new HashMap();
+ attributeMap.put( attr, this );
+ }
+
+ /**
+ * Returns the string representation of this attribute as specified
+ * in the CSS specification.
+ */
+ public String toString()
+ {
+ return attStr;
+ }
+
+ /**
+ * Returns <code>true</code> if the attribute should be inherited from
+ * the parent, <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if the attribute should be inherited from
+ * the parent, <code>false</code> otherwise
+ */
+ public boolean isInherited()
+ {
+ return isInherited;
+ }
+
+ /**
+ * Returns the default value of this attribute if one exists,
+ * <code>null</code> otherwise.
+ *
+ * @return the default value of this attribute if one exists,
+ * <code>null</code> otherwise
+ */
+ public String getDefaultValue()
+ {
+ return defaultValue;
+ }
+ }
+}
diff --git a/libjava/classpath/javax/swing/text/html/HTML.java b/libjava/classpath/javax/swing/text/html/HTML.java
index 3c03a63a471..0b758d2b873 100644
--- a/libjava/classpath/javax/swing/text/html/HTML.java
+++ b/libjava/classpath/javax/swing/text/html/HTML.java
@@ -945,22 +945,22 @@ public class HTML
* This tag is not included into the array, returned by getAllTags().
* toString() returns 'comment'. HTML reader synthesizes this tag.
*/
- public static final Tag COMMENT = new Tag("comment", SYNTETIC);
+ public static final Tag COMMENT = new Tag("comment", SYNTHETIC);
/**
* All text content is labeled with this tag.
* This tag is not included into the array, returned by getAllTags().
* toString() returns 'content'. HTML reader synthesizes this tag.
*/
- public static final Tag CONTENT = new Tag("content", SYNTETIC);
+ public static final Tag CONTENT = new Tag("content", SYNTHETIC);
/**
* All text content must be in a paragraph element.
* If a paragraph didn't exist when content was encountered,
* a paragraph is manufactured.
- * toString() returns 'implied'. HTML reader synthesizes this tag.
+ * toString() returns 'p-implied'. HTML reader synthesizes this tag.
*/
- public static final Tag IMPLIED = new Tag("implied", SYNTETIC);
+ public static final Tag IMPLIED = new Tag("p-implied", SYNTHETIC);
final String name;
final int flags;
@@ -1144,7 +1144,7 @@ public class HTML
*/
boolean isSyntetic()
{
- return (flags & SYNTETIC) != 0;
+ return (flags & SYNTHETIC) != 0;
}
private static void unexpected(Exception ex)
@@ -1185,7 +1185,7 @@ public class HTML
static final int BREAKS = 1;
static final int BLOCK = 2;
static final int PREFORMATTED = 4;
- static final int SYNTETIC = 8;
+ static final int SYNTHETIC = 8;
private static Map tagMap;
private static Map attrMap;
@@ -1196,6 +1196,7 @@ public class HTML
*/
public HTML()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/text/html/HTMLDocument.java b/libjava/classpath/javax/swing/text/html/HTMLDocument.java
index a95e496ec4d..d048a04e614 100644
--- a/libjava/classpath/javax/swing/text/html/HTMLDocument.java
+++ b/libjava/classpath/javax/swing/text/html/HTMLDocument.java
@@ -38,7 +38,14 @@ exception statement from your version. */
package javax.swing.text.html;
+import java.net.URL;
+
+import javax.swing.text.AbstractDocument;
+import javax.swing.text.AttributeSet;
import javax.swing.text.DefaultStyledDocument;
+import javax.swing.text.Element;
+import javax.swing.text.ElementIterator;
+import javax.swing.text.html.HTML.Tag;
/**
* TODO: This class is not yet completetely implemented.
@@ -47,7 +54,215 @@ import javax.swing.text.DefaultStyledDocument;
*/
public class HTMLDocument extends DefaultStyledDocument
{
+ /** A key for document properies. The value for the key is
+ * a Vector of Strings of comments not found in the body.
+ */
+ public static final String AdditionalComments = "AdditionalComments";
+ URL baseURL = null;
+ boolean preservesUnknownTags = true;
+
+ /**
+ * Returns the location against which to resolve relative URLs.
+ * This is the document's URL if the document was loaded from a URL.
+ * If a <code>base</code> tag is found, it will be used.
+ * @return the base URL
+ */
+ public URL getBase()
+ {
+ return baseURL;
+ }
+
+ /**
+ * Sets the location against which to resolve relative URLs.
+ * @param u the new base URL
+ */
+ public void setBase(URL u)
+ {
+ baseURL = u;
+ //TODO: also set the base of the StyleSheet
+ }
+
+ /**
+ * Returns whether or not the parser preserves unknown HTML tags.
+ * @return true if the parser preserves unknown tags
+ */
+ public boolean getPreservesUnknownTags()
+ {
+ return preservesUnknownTags;
+ }
+
+ /**
+ * Sets the behaviour of the parser when it encounters unknown HTML tags.
+ * @param preservesTags true if the parser should preserve unknown tags.
+ */
+ public void setPreservesUnknownTags(boolean preservesTags)
+ {
+ preservesUnknownTags = preservesTags;
+ }
+
+ /**
+ * An iterator to iterate through LeafElements in the document.
+ */
+ class LeafIterator extends Iterator
+ {
+ HTML.Tag tag;
+ HTMLDocument doc;
+ ElementIterator it;
+
+ public LeafIterator (HTML.Tag t, HTMLDocument d)
+ {
+ doc = d;
+ tag = t;
+ it = new ElementIterator(doc);
+ }
+
+ /**
+ * Return the attributes for the tag associated with this iteartor
+ * @return the AttributeSet
+ */
+ public AttributeSet getAttributes()
+ {
+ if (it.current() != null)
+ return it.current().getAttributes();
+ return null;
+ }
+
+ /**
+ * Get the end of the range for the current occurrence of the tag
+ * being defined and having the same attributes.
+ * @return the end of the range
+ */
+ public int getEndOffset()
+ {
+ if (it.current() != null)
+ return it.current().getEndOffset();
+ return -1;
+ }
+
+ /**
+ * Get the start of the range for the current occurrence of the tag
+ * being defined and having the same attributes.
+ * @return the start of the range (-1 if it can't be found).
+ */
+
+ public int getStartOffset()
+ {
+ if (it.current() != null)
+ return it.current().getStartOffset();
+ return -1;
+ }
+
+ /**
+ * Advance the iterator to the next LeafElement .
+ */
+ public void next()
+ {
+ it.next();
+ while (it.current()!= null && !it.current().isLeaf())
+ it.next();
+ }
+
+ /**
+ * Indicates whether or not the iterator currently represents an occurrence
+ * of the tag.
+ * @return true if the iterator currently represents an occurrence of the
+ * tag.
+ */
+ public boolean isValid()
+ {
+ return it.current() != null;
+ }
+
+ /**
+ * Type of tag for this iterator.
+ */
+ public Tag getTag()
+ {
+ return tag;
+ }
+
+ }
+
public void processHTMLFrameHyperlinkEvent(HTMLFrameHyperlinkEvent event)
{
+ // TODO: Implement this properly.
+ }
+
+ /**
+ * Gets an iterator for the given HTML.Tag.
+ * @param t the requested HTML.Tag
+ * @return the Iterator
+ */
+ public HTMLDocument.Iterator getIterator (HTML.Tag t)
+ {
+ return new HTMLDocument.LeafIterator(t, this);
+ }
+
+ /**
+ * An iterator over a particular type of tag.
+ */
+ public abstract static class Iterator
+ {
+ /**
+ * Return the attribute set for this tag.
+ * @return the <code>AttributeSet</code> (null if none found).
+ */
+ public abstract AttributeSet getAttributes();
+
+ /**
+ * Get the end of the range for the current occurrence of the tag
+ * being defined and having the same attributes.
+ * @return the end of the range
+ */
+ public abstract int getEndOffset();
+
+ /**
+ * Get the start of the range for the current occurrence of the tag
+ * being defined and having the same attributes.
+ * @return the start of the range (-1 if it can't be found).
+ */
+ public abstract int getStartOffset();
+
+ /**
+ * Move the iterator forward.
+ */
+ public abstract void next();
+
+ /**
+ * Indicates whether or not the iterator currently represents an occurrence
+ * of the tag.
+ * @return true if the iterator currently represents an occurrence of the
+ * tag.
+ */
+ public abstract boolean isValid();
+
+ /**
+ * Type of tag this iterator represents.
+ * @return the tag.
+ */
+ public abstract HTML.Tag getTag();
+ }
+
+ public class BlockElement extends AbstractDocument.BranchElement
+ {
+ public BlockElement (Element parent, AttributeSet a)
+ {
+ super (parent, a);
+ }
+
+ /**
+ * Gets the resolving parent. Since HTML attributes are not
+ * inherited at the model level, this returns null.
+ */
+ public AttributeSet getResolveParent()
+ {
+ return null;
+ }
+
+ public String getName()
+ {
+ //FIXME: this is supposed to do something different from the super class
+ return super.getName();
+ }
}
}
diff --git a/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java b/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java
index c0182fe6ac9..5189c777539 100644
--- a/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java
+++ b/libjava/classpath/javax/swing/text/html/HTMLEditorKit.java
@@ -43,8 +43,10 @@ import java.io.Reader;
import java.io.Serializable;
import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.parser.ParserDelegator;
/**
* This class is NOT implemented. This file currently holds only
@@ -96,9 +98,9 @@ public class HTMLEditorKit
/**
* The parser calls this method after it finishes parsing the document.
*/
- public void flush()
- throws BadLocationException
+ public void flush() throws BadLocationException
{
+ // TODO: What to do here, if anything?
}
/**
@@ -108,6 +110,7 @@ public class HTMLEditorKit
*/
public void handleComment(char[] comment, int position)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -118,6 +121,7 @@ public class HTMLEditorKit
*/
public void handleEndOfLineString(String end_of_line)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -129,6 +133,7 @@ public class HTMLEditorKit
*/
public void handleEndTag(HTML.Tag tag, int position)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -139,6 +144,7 @@ public class HTMLEditorKit
*/
public void handleError(String message, int position)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -149,9 +155,9 @@ public class HTMLEditorKit
* @param position The tag position in the text being parsed.
*/
public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes,
- int position
- )
+ int position)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -165,6 +171,7 @@ public class HTMLEditorKit
int position
)
{
+ // TODO: What to do here, if anything?
}
/**
@@ -174,6 +181,7 @@ public class HTMLEditorKit
*/
public void handleText(char[] text, int position)
{
+ // TODO: What to do here, if anything?
}
}
@@ -247,4 +255,26 @@ public class HTMLEditorKit
* The "ident paragraph right" action.
*/
public static final String PARA_INDENT_RIGHT = "html-para-indent-right";
+
+ /**
+ * Create a text storage model for this type of editor.
+ *
+ * @return the model
+ */
+ public Document createDefaultDocument()
+ {
+ HTMLDocument document = new HTMLDocument();
+ return document;
+ }
+
+ /**
+ * Get the parser that this editor kit uses for reading HTML streams. This
+ * method can be overridden to use the alternative parser.
+ *
+ * @return the HTML parser (by default, {@link ParserDelegator}).
+ */
+ protected Parser getParser()
+ {
+ return new ParserDelegator();
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java b/libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java
index dc0ab10a8f7..e146965d778 100644
--- a/libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java
+++ b/libjava/classpath/javax/swing/text/html/HTMLFrameHyperlinkEvent.java
@@ -41,7 +41,6 @@ package javax.swing.text.html;
import java.net.URL;
import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.text.Element;
/**
@@ -50,8 +49,7 @@ import javax.swing.text.Element;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public class HTMLFrameHyperlinkEvent
- extends HyperlinkEvent
+public class HTMLFrameHyperlinkEvent extends HyperlinkEvent
{
private final String target_frame;
diff --git a/libjava/classpath/javax/swing/text/html/parser/ContentModel.java b/libjava/classpath/javax/swing/text/html/parser/ContentModel.java
index deb7b1602bb..70e9c2acbff 100644
--- a/libjava/classpath/javax/swing/text/html/parser/ContentModel.java
+++ b/libjava/classpath/javax/swing/text/html/parser/ContentModel.java
@@ -95,9 +95,12 @@ public final class ContentModel
*/
public int type;
- /** Create a content model initializing all fields to default values. */
+ /**
+ * Create a content model initializing all fields to default values.
+ */
public ContentModel()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/text/html/parser/DTD.java b/libjava/classpath/javax/swing/text/html/parser/DTD.java
index f17ca011ea0..16bc5b0d6af 100644
--- a/libjava/classpath/javax/swing/text/html/parser/DTD.java
+++ b/libjava/classpath/javax/swing/text/html/parser/DTD.java
@@ -81,8 +81,9 @@ public class DTD
{
/**
* The version of the persistent data format.
+ * @specnote This was made <code>final</code> in 1.5.
*/
- public static int FILE_VERSION = 1;
+ public static final int FILE_VERSION = 1;
/**
* The table of existing available DTDs.
@@ -590,8 +591,7 @@ public class DTD
* @param name the name of the entity
* @param type the type of the entity, a bitwise combination
* of GENERAL, PARAMETER, SYSTEM and PUBLIC.
- * @throws an error if the parameter is both GENERAL and PARAMETER
- * of both PUBLIC and SYSTEM.
+ *
* @return the created entity
*/
private Entity newEntity(String name, int type)
diff --git a/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java b/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java
index 164297f1882..062606d17ba 100644
--- a/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java
+++ b/libjava/classpath/javax/swing/text/html/parser/DocumentParser.java
@@ -168,6 +168,7 @@ public class DocumentParser
* specific packages, write your own DTD or obtain the working instance
* of parser in other way, for example, by calling
* {@link javax.swing.text.html.HTMLEditorKit#getParser()}.
+ *
* @param a_dtd a DTD to use.
*/
public DocumentParser(DTD a_dtd)
@@ -212,6 +213,7 @@ public class DocumentParser
*/
protected void handleComment(char[] comment)
{
+ // This default implementation does nothing.
}
/**
@@ -224,6 +226,7 @@ public class DocumentParser
protected void handleEmptyTag(TagElement tag)
throws javax.swing.text.ChangedCharSetException
{
+ // This default implementation does nothing.
}
/**
@@ -234,11 +237,13 @@ public class DocumentParser
*/
protected void handleEndTag(TagElement tag)
{
+ // This default implementation does nothing.
}
/* Handle error that has occured in the given line. */
protected void handleError(int line, String message)
{
+ // This default implementation does nothing.
}
/**
@@ -249,6 +254,7 @@ public class DocumentParser
*/
protected void handleStartTag(TagElement tag)
{
+ // This default implementation does nothing.
}
/**
@@ -257,5 +263,6 @@ public class DocumentParser
*/
protected void handleText(char[] text)
{
+ // This default implementation does nothing.
}
}
diff --git a/libjava/classpath/javax/swing/text/html/parser/Element.java b/libjava/classpath/javax/swing/text/html/parser/Element.java
index 098983c6923..c07c07f5426 100644
--- a/libjava/classpath/javax/swing/text/html/parser/Element.java
+++ b/libjava/classpath/javax/swing/text/html/parser/Element.java
@@ -148,10 +148,10 @@ public final class Element
/**
* The default constructor must have package level access in this
* class. Use DTD.defineElement(..) to create an element when required.
- * @todo MAKE THIS PACKAGE in the final version. Now the Parser needs it!
*/
Element()
{
+ // Nothing to do here.
}
/**
diff --git a/libjava/classpath/javax/swing/text/html/parser/Parser.java b/libjava/classpath/javax/swing/text/html/parser/Parser.java
index 7ff6853da82..a88e9ce1953 100644
--- a/libjava/classpath/javax/swing/text/html/parser/Parser.java
+++ b/libjava/classpath/javax/swing/text/html/parser/Parser.java
@@ -256,6 +256,7 @@ public class Parser
*/
protected void endTag(boolean omitted)
{
+ // This default implementation does nothing.
}
/**
@@ -310,6 +311,7 @@ public class Parser
*/
protected void handleComment(char[] comment)
{
+ // This default implementation does nothing.
}
/**
@@ -333,6 +335,7 @@ public class Parser
protected void handleEmptyTag(TagElement tag)
throws ChangedCharSetException
{
+ // This default implementation does nothing.
}
/**
@@ -343,11 +346,13 @@ public class Parser
*/
protected void handleEndTag(TagElement tag)
{
+ // This default implementation does nothing.
}
/* Handle error that has occured in the given line. */
protected void handleError(int line, String message)
{
+ // This default implementation does nothing.
}
/**
@@ -358,6 +363,7 @@ public class Parser
*/
protected void handleStartTag(TagElement tag)
{
+ // This default implementation does nothing.
}
/**
@@ -376,6 +382,7 @@ public class Parser
*/
protected void handleText(char[] text)
{
+ // This default implementation does nothing.
}
/**
@@ -387,6 +394,7 @@ public class Parser
*/
protected void handleTitle(char[] title)
{
+ // This default implementation does nothing.
}
/**
@@ -420,6 +428,7 @@ public class Parser
*/
protected void markFirstTime(Element element)
{
+ // This default implementation does nothing.
}
/**
@@ -432,5 +441,6 @@ public class Parser
protected void startTag(TagElement tag)
throws ChangedCharSetException
{
+ // This default implementation does nothing.
}
}
diff --git a/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java b/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java
index e709e2a0449..d9747729317 100644
--- a/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java
+++ b/libjava/classpath/javax/swing/tree/DefaultMutableTreeNode.java
@@ -45,7 +45,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.NoSuchElementException;
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java b/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
index 7a44e738338..ae8b99c2fe5 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeCellEditor.java
@@ -47,7 +47,6 @@ import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Rectangle;
-import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
@@ -56,12 +55,8 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.EventObject;
-import javax.swing.CellRendererPane;
import javax.swing.DefaultCellEditor;
import javax.swing.Icon;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
@@ -344,9 +339,8 @@ public class DefaultTreeCellEditor
lastPath = tree.getLeadSelectionPath();
tree.addTreeSelectionListener(this);
editingContainer = createContainer();
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
- setFont(defaults.getFont("Tree.font"));
- setBorderSelectionColor(defaults.getColor("Tree.selectionBorderColor"));
+ setFont(UIManager.getFont("Tree.font"));
+ setBorderSelectionColor(UIManager.getColor("Tree.selectionBorderColor"));
editingIcon = renderer.getIcon();
timer = new javax.swing.Timer(1200, this);
}
@@ -354,9 +348,9 @@ public class DefaultTreeCellEditor
/**
* Configures the editing component whenever it is null.
*
- * @param tree- the tree to configure to component for.
- * @param renderer- the renderer used to set up the nodes
- * @param editor- the editor used
+ * @param tree the tree to configure to component for.
+ * @param renderer the renderer used to set up the nodes
+ * @param editor the editor used
*/
private void configureEditingComponent(JTree tree,
DefaultTreeCellRenderer renderer,
@@ -513,6 +507,8 @@ public class DefaultTreeCellEditor
// Cell may not be currently editable, but may need to start timer.
if (shouldStartEditingTimer(event))
startEditingTimer();
+ else if (timer.isRunning())
+ timer.stop();
return false;
}
@@ -605,7 +601,7 @@ public class DefaultTreeCellEditor
/**
* Messaged when the timer fires, this will start the editing session.
*
- * @param @param e - the event that characterizes the action.
+ * @param e the event that characterizes the action.
*/
public void actionPerformed(ActionEvent e)
{
@@ -738,9 +734,8 @@ public class DefaultTreeCellEditor
*/
protected TreeCellEditor createTreeCellEditor()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
realEditor = new DefaultCellEditor(new DefaultTreeCellEditor.DefaultTextField(
- defaults.getBorder("Tree.selectionBorder")));
+ UIManager.getBorder("Tree.selectionBorder")));
return realEditor;
}
}
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java b/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
index 4a353b30176..df70ba7fb9f 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeCellRenderer.java
@@ -51,7 +51,6 @@ import javax.swing.border.Border;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JTree;
-import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.SwingUtilities;
import javax.swing.plaf.UIResource;
@@ -133,17 +132,15 @@ public class DefaultTreeCellRenderer
*/
public DefaultTreeCellRenderer()
{
- UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
setLeafIcon(getDefaultLeafIcon());
setOpenIcon(getDefaultOpenIcon());
setClosedIcon(getDefaultClosedIcon());
- setTextNonSelectionColor(defaults.getColor("Tree.textForeground"));
- setTextSelectionColor(defaults.getColor("Tree.selectionForeground"));
- setBackgroundNonSelectionColor(defaults.getColor("Tree.nonSelectionBackground"));
- setBackgroundSelectionColor(defaults.getColor("Tree.selectionBackground"));
- setBorderSelectionColor(defaults.getColor("Tree.selectionBorderColor"));
+ setTextNonSelectionColor(UIManager.getColor("Tree.textForeground"));
+ setTextSelectionColor(UIManager.getColor("Tree.selectionForeground"));
+ setBackgroundNonSelectionColor(UIManager.getColor("Tree.nonSelectionBackground"));
+ setBackgroundSelectionColor(UIManager.getColor("Tree.selectionBackground"));
+ setBorderSelectionColor(UIManager.getColor("Tree.selectionBorderColor"));
}
// -------------------------------------------------------------
@@ -157,7 +154,7 @@ public class DefaultTreeCellRenderer
*/
public Icon getDefaultOpenIcon()
{
- return UIManager.getLookAndFeelDefaults().getIcon("Tree.openIcon");
+ return UIManager.getIcon("Tree.openIcon");
}
/**
@@ -167,7 +164,7 @@ public class DefaultTreeCellRenderer
*/
public Icon getDefaultClosedIcon()
{
- return UIManager.getLookAndFeelDefaults().getIcon("Tree.closedIcon");
+ return UIManager.getIcon("Tree.closedIcon");
}
/**
@@ -177,7 +174,7 @@ public class DefaultTreeCellRenderer
*/
public Icon getDefaultLeafIcon()
{
- return UIManager.getLookAndFeelDefaults().getIcon("Tree.leafIcon");
+ return UIManager.getIcon("Tree.leafIcon");
}
/**
@@ -412,15 +409,14 @@ public class DefaultTreeCellRenderer
setOpaque(false);
setVerticalAlignment(TOP);
setEnabled(true);
- super.setFont(UIManager.getLookAndFeelDefaults().getFont("Tree.font"));
+ super.setFont(UIManager.getFont("Tree.font"));
if (selected)
{
super.setBackground(getBackgroundSelectionColor());
setForeground(getTextSelectionColor());
- if (tree.getLeadSelectionPath() == null ||
- (tree.getLeadSelectionPath().getLastPathComponent()).equals(val))
+ if (hasFocus)
setBorderSelectionColor(UIManager.getLookAndFeelDefaults().
getColor("Tree.selectionBorderColor"));
else
@@ -460,8 +456,7 @@ public class DefaultTreeCellRenderer
Rectangle tr = new Rectangle();
Insets insets = new Insets(0, 0, 0, 0);
- Border border = UIManager.getLookAndFeelDefaults().getBorder(
- "Tree.selectionBorder");
+ Border border = UIManager.getBorder("Tree.selectionBorder");
if (border != null)
insets = border.getBorderInsets(this);
diff --git a/libjava/classpath/javax/swing/tree/DefaultTreeModel.java b/libjava/classpath/javax/swing/tree/DefaultTreeModel.java
index 5b5e0391478..5cf80986061 100644
--- a/libjava/classpath/javax/swing/tree/DefaultTreeModel.java
+++ b/libjava/classpath/javax/swing/tree/DefaultTreeModel.java
@@ -299,6 +299,7 @@ public class DefaultTreeModel
public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent,
int index)
{
+ newChild.setParent(parent);
parent.insert(newChild, index);
int[] childIndices = new int[1];
childIndices[0] = index;
diff --git a/libjava/classpath/javax/swing/tree/TreeCellRenderer.java b/libjava/classpath/javax/swing/tree/TreeCellRenderer.java
index ebbe3fa9133..a1808c9ee91 100644
--- a/libjava/classpath/javax/swing/tree/TreeCellRenderer.java
+++ b/libjava/classpath/javax/swing/tree/TreeCellRenderer.java
@@ -46,22 +46,24 @@ import javax.swing.JTree;
* TreeCellRenderer public interface
* @author Andrew Selkirk
*/
-public interface TreeCellRenderer {
+public interface TreeCellRenderer
+{
- /**
- * getTreeCellRendererComponent
- * @param tree TODO
- * @param value TODO
- * @param selected TODO
- * @param expanded TODO
- * @param leaf TODO
- * @param row TODO
- * @param us TODO
- * @returns TODO
- */
- Component getTreeCellRendererComponent(JTree tree,
- Object value, boolean selected, boolean expanded,
- boolean leaf, int row, boolean hasFocus);
+ /**
+ * getTreeCellRendererComponent
+ * @param tree TODO
+ * @param value TODO
+ * @param selected TODO
+ * @param expanded TODO
+ * @param leaf TODO
+ * @param row TODO
+ * @param hasFocus TODO
+ * @returns TODO
+ */
+ Component getTreeCellRendererComponent(JTree tree, Object value,
+ boolean selected, boolean expanded,
+ boolean leaf, int row,
+ boolean hasFocus);
-} // TreeCellRenderer
+}
diff --git a/libjava/classpath/javax/swing/tree/TreeModel.java b/libjava/classpath/javax/swing/tree/TreeModel.java
index 759aaac588c..ec1884efdb7 100644
--- a/libjava/classpath/javax/swing/tree/TreeModel.java
+++ b/libjava/classpath/javax/swing/tree/TreeModel.java
@@ -44,66 +44,62 @@ import javax.swing.event.TreeModelListener;
* TreeModel public interface
* @author Andrew Selkirk
*/
-public interface TreeModel {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getRoot
- * @returns Object
- */
- Object getRoot();
-
- /**
- * getChild
- * @param parent TODO
- * @param index TODO
- * @returns Object
- */
- Object getChild(Object parent, int index);
-
- /**
- * getChildCount
- * @param parent TODO
- * @returns int
- */
- int getChildCount(Object parent);
-
- /**
- * isLeaf
- * @param node TODO
- * @returns boolean
- */
- boolean isLeaf(Object node);
-
- /**
- * valueForPathChanged
- * @param path TODO
- * @param newvalue TODO
- */
- void valueForPathChanged(TreePath path, Object newvalue);
-
- /**
- * getIndexOfChild
- * @param parent TODO
- * @param ild TODO
- * @returns int
- */
- int getIndexOfChild(Object parent, Object child);
-
- /**
- * addTreeModelListener
- * @param listener TODO
- */
- void addTreeModelListener(TreeModelListener listener);
-
- /**
- * removeTreeModelListener
- * @param listener TODO
- */
- void removeTreeModelListener(TreeModelListener listener);
-
-
-} // TreeModel
+public interface TreeModel
+{
+ /**
+ * getRoot
+ * @returns Object
+ */
+ Object getRoot();
+
+ /**
+ * getChild
+ * @param parent TODO
+ * @param index TODO
+ * @returns Object
+ */
+ Object getChild(Object parent, int index);
+
+ /**
+ * getChildCount
+ * @param parent TODO
+ * @returns int
+ */
+ int getChildCount(Object parent);
+
+ /**
+ * isLeaf
+ * @param node TODO
+ * @returns boolean
+ */
+ boolean isLeaf(Object node);
+
+ /**
+ * valueForPathChanged
+ * @param path TODO
+ * @param newvalue TODO
+ */
+ void valueForPathChanged(TreePath path, Object newvalue);
+
+ /**
+ * getIndexOfChild
+ * @param parent TODO
+ * @param child TODO
+ * @returns int
+ */
+ int getIndexOfChild(Object parent, Object child);
+
+ /**
+ * addTreeModelListener
+ * @param listener TODO
+ */
+ void addTreeModelListener(TreeModelListener listener);
+
+ /**
+ * removeTreeModelListener
+ * @param listener TODO
+ */
+ void removeTreeModelListener(TreeModelListener listener);
+
+
+}
diff --git a/libjava/classpath/javax/swing/undo/CannotRedoException.java b/libjava/classpath/javax/swing/undo/CannotRedoException.java
index 7d70a38c2c8..5f22648350a 100644
--- a/libjava/classpath/javax/swing/undo/CannotRedoException.java
+++ b/libjava/classpath/javax/swing/undo/CannotRedoException.java
@@ -44,13 +44,13 @@ package javax.swing.undo;
* @author Andrew Selkirk (aselkirk@sympatico.ca)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
-public class CannotRedoException
- extends RuntimeException
+public class CannotRedoException extends RuntimeException
{
/**
* Constructs a new instance of a <code>CannotRedoException</code>.
*/
public CannotRedoException()
{
+ super();
}
}
diff --git a/libjava/classpath/javax/swing/undo/CannotUndoException.java b/libjava/classpath/javax/swing/undo/CannotUndoException.java
index 9fc0ec3bd3a..8d08cda6853 100644
--- a/libjava/classpath/javax/swing/undo/CannotUndoException.java
+++ b/libjava/classpath/javax/swing/undo/CannotUndoException.java
@@ -53,5 +53,6 @@ public class CannotUndoException
*/
public CannotUndoException()
{
+ super();
}
}
diff --git a/libjava/classpath/javax/xml/namespace/QName.java b/libjava/classpath/javax/xml/namespace/QName.java
index 7b8b194c33c..19700b32e41 100644
--- a/libjava/classpath/javax/xml/namespace/QName.java
+++ b/libjava/classpath/javax/xml/namespace/QName.java
@@ -1,5 +1,5 @@
/* QName.java - An XML qualified name.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.xml.namespace;
+import java.io.Serializable;
+
import javax.xml.XMLConstants;
/**
@@ -47,14 +49,15 @@ import javax.xml.XMLConstants;
* @author <a href='mailto:dog@gnu.org'>Chris Burdess</a>
* @since 1.3
*/
-public class QName
+public class QName implements Serializable
{
+ private static final long serialVersionUID = 4418622981026545151L;
private final String namespaceURI;
private final String localPart;
private final String prefix;
- private final String qName;
- int hashCode = -1;
+ private transient String qName;
+ transient int hashCode = -1;
public QName(String namespaceURI, String localPart)
{
@@ -78,21 +81,6 @@ public class QName
this.namespaceURI = namespaceURI;
this.localPart = localPart;
this.prefix = prefix;
-
- StringBuffer buf = new StringBuffer();
- if (namespaceURI.length() > 0)
- {
- buf.append('{');
- buf.append(namespaceURI);
- buf.append('}');
- }
- if (prefix.length() > 0)
- {
- buf.append(prefix);
- buf.append(':');
- }
- buf.append(localPart);
- qName = buf.toString();
}
public QName(String localPart)
@@ -115,7 +103,7 @@ public class QName
return prefix;
}
- public boolean equals(Object obj)
+ public final boolean equals(Object obj)
{
if (obj instanceof QName)
{
@@ -129,19 +117,29 @@ public class QName
public final int hashCode()
{
if (hashCode == -1)
- {
- StringBuffer buf = new StringBuffer();
- buf.append('{');
- buf.append(namespaceURI);
- buf.append('}');
- buf.append(localPart);
- hashCode = buf.toString().hashCode();
- }
+ hashCode = localPart.hashCode() ^ namespaceURI.hashCode();
return hashCode;
}
- public String toString()
+ public synchronized String toString()
{
+ if (qName == null)
+ {
+ StringBuffer buf = new StringBuffer();
+ if (namespaceURI.length() > 0)
+ {
+ buf.append('{');
+ buf.append(namespaceURI);
+ buf.append('}');
+ }
+ if (prefix.length() > 0)
+ {
+ buf.append(prefix);
+ buf.append(':');
+ }
+ buf.append(localPart);
+ qName = buf.toString();
+ }
return qName;
}
diff --git a/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java b/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java
index b2153c2cbf9..81db3bed913 100644
--- a/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java
+++ b/libjava/classpath/javax/xml/transform/TransformerConfigurationException.java
@@ -45,9 +45,8 @@ package javax.xml.transform;
public class TransformerConfigurationException
extends TransformerException
{
+ private static final long serialVersionUID = 1285547467942875745L;
- private SourceLocator locator;
-
/**
* Constructor with no detail message.
*/
@@ -96,8 +95,7 @@ public class TransformerConfigurationException
SourceLocator locator,
Throwable e)
{
- super(message, e);
- this.locator = locator;
+ super(message, locator, e);
}
}
diff --git a/libjava/classpath/javax/xml/transform/TransformerException.java b/libjava/classpath/javax/xml/transform/TransformerException.java
index a72ee1c2f56..3d97eda1bbb 100644
--- a/libjava/classpath/javax/xml/transform/TransformerException.java
+++ b/libjava/classpath/javax/xml/transform/TransformerException.java
@@ -47,9 +47,11 @@ import java.io.PrintWriter;
public class TransformerException
extends Exception
{
+ private static final long serialVersionUID = 975798773772956428L;
+ // Field names fixed by serialization spec.
private SourceLocator locator;
- private Throwable cause;
+ private Throwable containedException;
/**
* Constructor with a detail message.
@@ -94,7 +96,7 @@ public class TransformerException
if (cause != null)
{
initCause(cause);
- this.cause = cause;
+ this.containedException = cause;
}
}
@@ -119,7 +121,7 @@ public class TransformerException
*/
public Throwable getException()
{
- return cause;
+ return containedException;
}
/**
@@ -127,7 +129,7 @@ public class TransformerException
*/
public Throwable getCause()
{
- return cause;
+ return containedException;
}
/**
@@ -143,7 +145,7 @@ public class TransformerException
*/
public Throwable initCause(Throwable cause)
{
- if (this.cause != null)
+ if (this.containedException != null)
{
throw new IllegalStateException();
}
@@ -151,7 +153,7 @@ public class TransformerException
{
throw new IllegalArgumentException();
}
- this.cause = cause;
+ this.containedException = cause;
return this;
}
@@ -221,20 +223,20 @@ public class TransformerException
public void printStackTrace(PrintStream s)
{
super.printStackTrace(s);
- if (cause != null)
+ if (containedException != null)
{
s.print("caused by ");
- cause.printStackTrace(s);
+ containedException.printStackTrace(s);
}
}
public void printStackTrace(PrintWriter s)
{
super.printStackTrace(s);
- if (cause != null)
+ if (containedException != null)
{
s.print("caused by ");
- cause.printStackTrace(s);
+ containedException.printStackTrace(s);
}
}
diff --git a/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java b/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java
index 9b16b2b2e4c..82afeeac750 100644
--- a/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java
+++ b/libjava/classpath/javax/xml/transform/TransformerFactoryConfigurationError.java
@@ -44,7 +44,9 @@ package javax.xml.transform;
public class TransformerFactoryConfigurationError
extends Error
{
+ private static final long serialVersionUID = -6527718720676281516L;
+ // Name is fixed by the serialization spec.
private final Exception exception;
/**
diff --git a/libjava/classpath/javax/xml/xpath/XPathException.java b/libjava/classpath/javax/xml/xpath/XPathException.java
index 030d0a9c1d7..cf004c1791e 100644
--- a/libjava/classpath/javax/xml/xpath/XPathException.java
+++ b/libjava/classpath/javax/xml/xpath/XPathException.java
@@ -49,7 +49,9 @@ import java.io.PrintWriter;
public class XPathException
extends Exception
{
+ private static final long serialVersionUID = -1837080260374986980L;
+ // Name is fixed by serialization spec.
Throwable cause;
public XPathException(String message)
diff --git a/libjava/classpath/javax/xml/xpath/XPathExpressionException.java b/libjava/classpath/javax/xml/xpath/XPathExpressionException.java
index 91716f1502f..6257adb474b 100644
--- a/libjava/classpath/javax/xml/xpath/XPathExpressionException.java
+++ b/libjava/classpath/javax/xml/xpath/XPathExpressionException.java
@@ -46,6 +46,7 @@ package javax.xml.xpath;
public class XPathExpressionException
extends XPathException
{
+ private static final long serialVersionUID = -1837080260374986980L;
public XPathExpressionException(String message)
{
diff --git a/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java b/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java
index a89646336d8..0fc68a7634b 100644
--- a/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java
+++ b/libjava/classpath/javax/xml/xpath/XPathFactoryConfigurationException.java
@@ -46,6 +46,7 @@ package javax.xml.xpath;
public class XPathFactoryConfigurationException
extends XPathException
{
+ private static final long serialVersionUID = -1837080260374986980L;
public XPathFactoryConfigurationException(String message)
{
diff --git a/libjava/classpath/javax/xml/xpath/XPathFunctionException.java b/libjava/classpath/javax/xml/xpath/XPathFunctionException.java
index ebc8ce7d341..db680ae65da 100644
--- a/libjava/classpath/javax/xml/xpath/XPathFunctionException.java
+++ b/libjava/classpath/javax/xml/xpath/XPathFunctionException.java
@@ -46,6 +46,7 @@ package javax.xml.xpath;
public class XPathFunctionException
extends XPathExpressionException
{
+ private static final long serialVersionUID = -1837080260374986980L;
public XPathFunctionException(String message)
{
diff --git a/libjava/classpath/lib/Makefile.am b/libjava/classpath/lib/Makefile.am
index ada3b2bc95e..9d44ef0c531 100644
--- a/libjava/classpath/lib/Makefile.am
+++ b/libjava/classpath/lib/Makefile.am
@@ -29,7 +29,7 @@ if FOUND_GCJX
JAVAC = $(GCJX) -encoding UTF-8 -classpath .:$(USER_CLASSLIB) -d . @classes
else
if FOUND_ECJ
-JAVAC = $(ECJ) -encoding UTF-8 -warn:none -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
+JAVAC = $(ECJ) -source 1.4 -encoding UTF-8 -warn:-deprecation,serial,typeHiding,unchecked,unused,varargsCast -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
endif # FOUND_ECJ
endif # FOUND_GCJX
endif # FOUND_KJC
@@ -40,7 +40,7 @@ JAVAH = $(USER_JAVAH) -jni -classpath .:$(USER_CLASSLIB)
if INSTALL_GLIBJ_ZIP
-pkgdata_DATA = glibj.zip
+glibj_DATA = glibj.zip
endif # INSTALL_GLIBJ_ZIP
@@ -73,7 +73,7 @@ endif # INSTALL_CLASS_FILES
glibj.zip: classes compile-classes resources
if test "$(ZIP)" != ""; then $(ZIP) -r -D glibj.zip gnu java javax org META-INF > /dev/null; fi
-resources:
+resources: copy-vmresources.sh
if ! [ -e gnu ]; then mkdir gnu; fi
if ! [ -e gnu/java ]; then mkdir gnu/java; fi
if ! [ -e gnu/java/locale ]; then mkdir gnu/java/locale; fi
@@ -87,6 +87,7 @@ resources:
@list='$(metafiles)'; for p in $$list; do \
cp $(top_srcdir)/resource/$$p $$p; \
done
+ @$(SHELL) ./copy-vmresources.sh
@list='$(iconfiles)'; for p in $$list; do \
cp $(top_srcdir)/$$p $$p; \
done
@@ -145,6 +146,7 @@ clean-local:
-rm -rf java
-rm -rf javax
-rm -rf org
+ -rm -rf com
-rm -rf META-INF
-rm -rf lists
-rm -f Makefile.deps
diff --git a/libjava/classpath/lib/Makefile.in b/libjava/classpath/lib/Makefile.in
index c205407eaff..08db2de8eb9 100644
--- a/libjava/classpath/lib/Makefile.in
+++ b/libjava/classpath/lib/Makefile.in
@@ -39,12 +39,10 @@ host_triplet = @host@
target_triplet = @target@
subdir = lib
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/gen-classlist.sh.in
+ $(srcdir)/copy-vmresources.sh.in $(srcdir)/gen-classlist.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -53,7 +51,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES = gen-classlist.sh
+CONFIG_CLEAN_FILES = gen-classlist.sh copy-vmresources.sh
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -62,9 +60,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkgdatadir)"
-pkgdataDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(noinst_DATA) $(pkgdata_DATA)
+am__installdirs = "$(DESTDIR)$(glibjdir)"
+glibjDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(glibj_DATA) $(noinst_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
@@ -86,10 +84,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -226,6 +228,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -239,6 +242,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -257,7 +261,7 @@ propertyfiles := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java org -name
metafiles := $(shell cd $(top_srcdir)/resource && $(FIND) META-INF -name CVS -prune -o -type f -print)
iconfiles := $(shell cd $(top_srcdir) && $(FIND) gnu/javax/swing/plaf/gtk/icons -name *.png -type f -print)
compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$(top_srcdir)/external/sax:.:$(USER_CLASSLIB)
-@FOUND_ECJ_TRUE@@FOUND_GCJX_FALSE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_FALSE@JAVAC = $(ECJ) -encoding UTF-8 -warn:none -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
+@FOUND_ECJ_TRUE@@FOUND_GCJX_FALSE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_FALSE@JAVAC = $(ECJ) -source 1.4 -encoding UTF-8 -warn:-deprecation,serial,typeHiding,unchecked,unused,varargsCast -proceedOnError -bootclasspath '' -classpath $(compile_classpath) -d . @classes
@FOUND_GCJX_TRUE@@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_FALSE@JAVAC = $(GCJX) -encoding UTF-8 -classpath .:$(USER_CLASSLIB) -d . @classes
@FOUND_GCJ_FALSE@@FOUND_JIKES_FALSE@@FOUND_KJC_TRUE@JAVAC = $(KJC) -classpath .:$(USER_CLASSLIB) -d . @classes
@FOUND_GCJ_FALSE@@FOUND_JIKES_TRUE@JAVAC = $(JIKES) +Pno-shadow +Pno-switchcheck +F $(JIKESENCODING) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(compile_classpath) -d . @classes
@@ -265,7 +269,7 @@ compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$
# handling source to bytecode compiler programs like gcj, jikes and kjc
@FOUND_GCJ_TRUE@JAVAC = exit 1
JAVAH = $(USER_JAVAH) -jni -classpath .:$(USER_CLASSLIB)
-@INSTALL_GLIBJ_ZIP_TRUE@pkgdata_DATA = glibj.zip
+@INSTALL_GLIBJ_ZIP_TRUE@glibj_DATA = glibj.zip
@BUILD_CLASS_FILES_TRUE@noinst_DATA = genclasses compile-classes resources
EXTRA_DIST = standard.omit mkcollections.pl.in Makefile.gcj split-for-gcj.sh
CLEANFILES = compile-classes resources classes \
@@ -307,6 +311,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
gen-classlist.sh: $(top_builddir)/config.status $(srcdir)/gen-classlist.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+copy-vmresources.sh: $(top_builddir)/config.status $(srcdir)/copy-vmresources.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
@@ -317,22 +323,22 @@ clean-libtool:
distclean-libtool:
-rm -f libtool
uninstall-info-am:
-install-pkgdataDATA: $(pkgdata_DATA)
+install-glibjDATA: $(glibj_DATA)
@$(NORMAL_INSTALL)
- test -z "$(pkgdatadir)" || $(mkdir_p) "$(DESTDIR)$(pkgdatadir)"
- @list='$(pkgdata_DATA)'; for p in $$list; do \
+ test -z "$(glibjdir)" || $(mkdir_p) "$(DESTDIR)$(glibjdir)"
+ @list='$(glibj_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
- echo " $(pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \
- $(pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \
+ echo " $(glibjDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(glibjdir)/$$f'"; \
+ $(glibjDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(glibjdir)/$$f"; \
done
-uninstall-pkgdataDATA:
+uninstall-glibjDATA:
@$(NORMAL_UNINSTALL)
- @list='$(pkgdata_DATA)'; for p in $$list; do \
+ @list='$(glibj_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
- rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
+ echo " rm -f '$(DESTDIR)$(glibjdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(glibjdir)/$$f"; \
done
tags: TAGS
TAGS:
@@ -375,7 +381,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
- for dir in "$(DESTDIR)$(pkgdatadir)"; do \
+ for dir in "$(DESTDIR)$(glibjdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -423,7 +429,7 @@ info: info-am
info-am:
-install-data-am: install-data-local install-pkgdataDATA
+install-data-am: install-data-local install-glibjDATA
install-exec-am:
@@ -449,18 +455,19 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-local uninstall-pkgdataDATA
+uninstall-am: uninstall-glibjDATA uninstall-info-am uninstall-local
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
clean-local dist-hook distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
- install-data-local install-exec install-exec-am install-info \
- install-info-am install-man install-pkgdataDATA install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
- uninstall-info-am uninstall-local uninstall-pkgdataDATA
+ install-data-local install-exec install-exec-am \
+ install-glibjDATA install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-glibjDATA uninstall-info-am \
+ uninstall-local
sinclude $(JAVA_DEPEND)
@@ -486,7 +493,7 @@ sinclude $(JAVA_DEPEND)
glibj.zip: classes compile-classes resources
if test "$(ZIP)" != ""; then $(ZIP) -r -D glibj.zip gnu java javax org META-INF > /dev/null; fi
-resources:
+resources: copy-vmresources.sh
if ! [ -e gnu ]; then mkdir gnu; fi
if ! [ -e gnu/java ]; then mkdir gnu/java; fi
if ! [ -e gnu/java/locale ]; then mkdir gnu/java/locale; fi
@@ -500,6 +507,7 @@ resources:
@list='$(metafiles)'; for p in $$list; do \
cp $(top_srcdir)/resource/$$p $$p; \
done
+ @$(SHELL) ./copy-vmresources.sh
@list='$(iconfiles)'; for p in $$list; do \
cp $(top_srcdir)/$$p $$p; \
done
@@ -541,6 +549,7 @@ clean-local:
-rm -rf java
-rm -rf javax
-rm -rf org
+ -rm -rf com
-rm -rf META-INF
-rm -rf lists
-rm -f Makefile.deps
diff --git a/libjava/classpath/lib/copy-vmresources.sh.in b/libjava/classpath/lib/copy-vmresources.sh.in
new file mode 100644
index 00000000000..9c3e882b250
--- /dev/null
+++ b/libjava/classpath/lib/copy-vmresources.sh.in
@@ -0,0 +1,41 @@
+#! @SHELL@
+# @configure_input@
+
+top_srcdir=@top_srcdir@
+vmdirs=`echo "@vm_classes@" | sed 's%:% %g'`
+destMetaDir=`pwd`/META-INF
+destResDir=`pwd`
+
+for p in ${vmdirs}; do
+ if test -d $p/META-INF; then
+ (cd $p/META-INF;
+ dirs=`find -name "CVS" -prune -o -type d -print`;
+ for u in ${dirs}; do
+ mkdir -p ${destMetaDir}/${u};
+ done;
+ files=`find -name "CVS" -prune -o -type f -print`;
+ for u in ${files}; do
+ cp ${u} ${destMetaDir}/${u};
+ done
+ );
+ fi;
+
+ (cd ${p};
+ resfiles=`find ${p} -name "*.properties"`
+ resdirs=
+ for i in ${resfiles}; do
+ a=`basename ${i}`;
+ b=`echo ${i} | sed "s%${a}%%g"`;
+ resdirs="${resdirs} ${b}";
+ done;
+ resnewdirs=`echo ${resdirs} | uniq`;
+
+ for u in ${resnewdirs}; do
+ mkdir -p ${destResDir}/${u};
+ done
+
+ for f in ${resfiles}; do
+ echo ${f} ${destResDir}/${f};
+ done
+ )
+done
diff --git a/libjava/classpath/lib/gen-classlist.sh.in b/libjava/classpath/lib/gen-classlist.sh.in
index 12845f2ccee..2f2dfc8a828 100755
--- a/libjava/classpath/lib/gen-classlist.sh.in
+++ b/libjava/classpath/lib/gen-classlist.sh.in
@@ -2,6 +2,8 @@
# @configure_input@
# Make sure sorting is done the same on all configurations
+# Note the use of sort -r below. This is done explicitly to work around
+# a gcj bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21418)
LC_ALL=C; export LC_ALL
LANG=C; export LANG
@@ -12,7 +14,7 @@ echo "Adding java source files from srcdir '@top_srcdir@'."
@FIND@ @top_srcdir@/java @top_srcdir@/javax @top_srcdir@/gnu \
@top_srcdir@/org \
@top_srcdir@/external/w3c_dom @top_srcdir@/external/sax \
- -follow -type f -print | sort | grep '\.java$' \
+ -follow -type f -print | sort -r | grep '\.java$' \
> ${top_builddir}/lib/classes.1
# Generate files for the VM classes.
@@ -22,7 +24,7 @@ vm_dirlist=`echo "@vm_classes@" | sed -e 's/:/ /g'`
echo "Adding java source files from VM directory $vm_dirlist"
for dir in $vm_dirlist; do
(cd $dir
- for subdir in java javax gnu org; do
+ for subdir in java javax gnu org com; do
if test -d $subdir; then
@FIND@ $subdir -name '*.java' -print
fi
diff --git a/libjava/classpath/lib/split-for-gcj.sh b/libjava/classpath/lib/split-for-gcj.sh
index 0f5ffaff285..f69b7979728 100755
--- a/libjava/classpath/lib/split-for-gcj.sh
+++ b/libjava/classpath/lib/split-for-gcj.sh
@@ -31,7 +31,7 @@ test -d lists || mkdir lists
for dir in java javax gnu org; do
fgrep /$dir/ classes | while read file; do
pkg=`echo "$file " | sed -n -e "s,^.*/\($dir/.*\)/[^/]*$,\1,p"`
- list=lists/`echo $pkg | sed -e 's,/,-,g'`
+ list=lists/`echo $pkg | sed -e 's,/,-,g' | cut -f1-3 -d-`
echo "$file" >> ${list}.list.1
f2=`echo "$file" | sed -n -e "s,^.*/\($dir/.*\)$,\1,p"`
f2=`echo "$f2" | sed -e 's/.java$//'`.class
diff --git a/libjava/classpath/lib/standard.omit b/libjava/classpath/lib/standard.omit
index c95c4ed95b6..a518f7df828 100644
--- a/libjava/classpath/lib/standard.omit
+++ b/libjava/classpath/lib/standard.omit
@@ -1,4 +1 @@
../gnu/test/.*$
-../gnu/classpath/jdwp/.*$
-../gnu/xml/stream/.*$
-../javax/xml/stream/.*$
diff --git a/libjava/classpath/ltmain.sh b/libjava/classpath/ltmain.sh
index 9882b46c96b..474423aaf10 100644
--- a/libjava/classpath/ltmain.sh
+++ b/libjava/classpath/ltmain.sh
@@ -17,7 +17,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -829,6 +829,7 @@ EOF
linker_flags=
dllsearchpath=
lib_search_path=`pwd`
+ inst_prefix_dir=
avoid_version=no
dlfiles=
@@ -961,6 +962,11 @@ EOF
prev=
continue
;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
release)
release="-$arg"
prev=
@@ -1187,6 +1193,11 @@ EOF
continue
;;
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
# so, if we see these flags be careful not to treat them like -L
-L[A-Z][A-Z]*:*)
@@ -2171,6 +2182,14 @@ EOF
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
add="-l$name"
elif test "$hardcode_shlibpath_var" = yes; then
add_shlibpath="$dir"
@@ -2229,6 +2248,14 @@ EOF
else
# We cannot seem to hardcode it, guess we'll fake it.
add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
add="-l$name"
fi
@@ -4460,7 +4487,7 @@ fi\
for tag in $taglist; do
tagopts="$tagopts --tag $tag"
done
- relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)"
+ relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args @inst_prefix_dir@)"
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
# Only create the output if not a dry run.
@@ -4761,6 +4788,27 @@ relink_command=\"$relink_command\""
dir="$dir$objdir"
if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit 1
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
+ fi
+
$echo "$modename: warning: relinking \`$file'" 1>&2
$show "$relink_command"
if $run eval "$relink_command"; then :
diff --git a/libjava/classpath/m4/acattribute.m4 b/libjava/classpath/m4/acattribute.m4
new file mode 100644
index 00000000000..7b490d4b7cb
--- /dev/null
+++ b/libjava/classpath/m4/acattribute.m4
@@ -0,0 +1,25 @@
+dnl modified AC_C_INLINE from autoconf/c.m4
+
+AN_IDENTIFIER([attribute], [AC_C_ATTRIBUTE])
+AC_DEFUN([AC_C_ATTRIBUTE],
+[AC_CACHE_CHECK([for __attribute__], ac_cv_c_attribute,
+[
+AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+[void foo(void) __attribute__ ((__noreturn__));]
+)],
+[ac_cv_c_attribute=yes],
+[ac_cv_c_attribute=no]
+)
+])
+AH_VERBATIM([attribute],
+[/* Define to `__attribute__' to nothing if it's not supported. */
+#undef __attribute__])
+case $ac_cv_c_attribute in
+ yes) ;;
+ no)
+ cat >>confdefs.h <<_ACEOF
+#define __attribute__(x) /* nothing */
+_ACEOF
+ ;;
+esac
+])# AC_C_ATTRIBUTE
diff --git a/libjava/classpath/m4/acinclude.m4 b/libjava/classpath/m4/acinclude.m4
index e05a2f8e7b5..e41321f89f3 100644
--- a/libjava/classpath/m4/acinclude.m4
+++ b/libjava/classpath/m4/acinclude.m4
@@ -63,48 +63,23 @@ AC_DEFUN([CLASSPATH_CHECK_GCJ],
else
AC_PATH_PROG(GCJ, "gcj")
fi
-
+ dnl Test the given GCJ, but use it as C (!) compiler to check version
if test "x$GCJ" != x; then
- ## GCC version 2 puts out version messages that looked like:
- ## 2.95
-
- ## GCC version 3 puts out version messages like:
- ## gcj (GCC) 3.3.3
- ## Copyright (C) 2003 Free Software Foundation, Inc.
- ## This is free software; see the source for copying conditions. There is NO
- ## warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- AC_MSG_CHECKING(gcj version)
- ## Take the output from gcj --version and extract just the version number
- ## into GCJ_VERSION.
- ## (we need to do this to be compatible with both GCC 2 and GCC 3 version
- ## numbers)
- ##
- ## First, we get rid of everything before the first number on that line.
- ## Assume that the first number on that line is the start of the
- ## version.
- ##
- ## Second, while we're at it, go ahead and get rid of the first character
- ## that is not part of a version number (i.e., is neither a digit nor
- ## a dot).
- ##
- ## Third, quit, so that we won't process the second and subsequent lines.
- GCJ_VERSION=`$GCJ --version | sed -e 's/^@<:@^0-9@:>@*//' -e 's/@<:@^.0-9@:>@@<:@^.0-9@:>@*//' -e 'q'`
- GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
- GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
-
- if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
- GCJ=""
- fi
- if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
- if expr "$GCJ_VERSION_MINOR" \< 3; then
- GCJ=""
- fi
- fi
- if test "x$GCJ" != x; then
- AC_MSG_RESULT($GCJ_VERSION)
+ AC_MSG_CHECKING([gcj version 4.0])
+ AC_LANG_PUSH([C])
+ AC_LANG_CONFTEST(
+ [[#if __GNUC__ <= 3
+ #error GCJ 4.0.0 or higher is required
+ #endif
+ ]])
+ $GCJ -E conftest.c > /dev/null
+ gcj_4_result=$?
+ if test "x$gcj_4_result" = "x0"; then
+ AC_MSG_RESULT([4.0 or higher found])
else
- AC_MSG_WARN($GCJ_VERSION: gcj 3.3 or higher required)
+ AC_MSG_WARN([4.0 or higher required])
fi
+ AC_LANG_POP
fi
])
diff --git a/libjava/classpath/native/Makefile.in b/libjava/classpath/native/Makefile.in
index b8c2b89fa1b..bfa05c800d2 100644
--- a/libjava/classpath/native/Makefile.in
+++ b/libjava/classpath/native/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -83,10 +81,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -223,6 +225,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -236,6 +239,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/fdlibm/Makefile.in b/libjava/classpath/native/fdlibm/Makefile.in
index b3a4577595d..5d53fa66bc4 100644
--- a/libjava/classpath/native/fdlibm/Makefile.in
+++ b/libjava/classpath/native/fdlibm/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/fdlibm
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -102,10 +100,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -242,6 +244,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -255,6 +258,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/fdlibm/java-assert.h b/libjava/classpath/native/fdlibm/java-assert.h
index 6f178bd9e98..ad512ad137a 100644
--- a/libjava/classpath/native/fdlibm/java-assert.h
+++ b/libjava/classpath/native/fdlibm/java-assert.h
@@ -1,4 +1,4 @@
-// java-assert.h - Header file holding assertion definitions. -*- c++ -*-
+/* java-assert.h - Header file holding assertion definitions. -*- c++ -*- */
/* Copyright (C) 1998, 1999 Free Software Foundation
@@ -11,7 +11,9 @@ details. */
#ifndef __JAVA_ASSERT_H__
#define __JAVA_ASSERT_H__
-// This is a libgcj implementation header.
+#include <config.h>
+
+/* This is a libgcj implementation header. */
void _Jv_Abort (const char *, const char *, int, const char *)
__attribute__ ((__noreturn__));
diff --git a/libjava/classpath/native/fdlibm/mprec.h b/libjava/classpath/native/fdlibm/mprec.h
index d796b81de82..f250619b022 100644
--- a/libjava/classpath/native/fdlibm/mprec.h
+++ b/libjava/classpath/native/fdlibm/mprec.h
@@ -291,7 +291,12 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
#define MAX_BIGNUMS 16
+#ifdef Pack_32
#define MAX_BIGNUM_WDS 32
+#else
+ /* Note that this is a workaround for */
+#define MAX_BIGNUM_WDS 128
+#endif
struct _Jv_Bigint
{
diff --git a/libjava/classpath/native/jawt/Makefile.in b/libjava/classpath/native/jawt/Makefile.in
index feb30904be1..1fa178b10d9 100644
--- a/libjava/classpath/native/jawt/Makefile.in
+++ b/libjava/classpath/native/jawt/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jawt
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -96,10 +94,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -236,6 +238,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -249,6 +252,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/jawt/jawt.c b/libjava/classpath/native/jawt/jawt.c
index 6d26a0da9f3..a4178685054 100644
--- a/libjava/classpath/native/jawt/jawt.c
+++ b/libjava/classpath/native/jawt/jawt.c
@@ -176,11 +176,11 @@ static void
static void
(JNICALL _Jv_AWTLock) (JNIEnv* env __attribute__((unused)))
{
- classpath_jawt_lock ();
+ /* FIXME: what is this supposed to do? */
}
static void
(JNICALL _Jv_AWTUnlock) (JNIEnv* env __attribute__((unused)))
{
- classpath_jawt_unlock ();
+ /* FIXME: what is this supposed to do? */
}
diff --git a/libjava/classpath/native/jni/Makefile.am b/libjava/classpath/native/jni/Makefile.am
index fce6b1a6f42..64cd35a5156 100644
--- a/libjava/classpath/native/jni/Makefile.am
+++ b/libjava/classpath/native/jni/Makefile.am
@@ -4,6 +4,14 @@ if CREATE_CORE_JNI_LIBRARIES
JNIDIRS = java-io java-lang java-net java-nio java-util
endif
+if CREATE_ALSA_LIBRARIES
+ ALSADIR = midi-alsa
+endif
+
+if CREATE_DSSI_LIBRARIES
+ DSSIDIR = midi-dssi
+endif
+
if CREATE_GTK_PEER_LIBRARIES
GTKDIR = gtk-peer
endif
@@ -16,9 +24,10 @@ if CREATE_XMLJ_LIBRARY
XMLJDIR = xmlj
endif
-SUBDIRS = classpath $(JNIDIRS) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
+SUBDIRS = classpath $(JNIDIRS) \
+ $(ALSADIR) $(DSSIDIR) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \
- gtk-peer qt-peer xmlj
+ gtk-peer qt-peer xmlj midi-alsa midi-dssi
all-local:
cd $(top_srcdir) && $(SHELL) ./scripts/check_jni_methods.sh
diff --git a/libjava/classpath/native/jni/Makefile.in b/libjava/classpath/native/jni/Makefile.in
index 46ae0aaba0f..79d9fa7ab50 100644
--- a/libjava/classpath/native/jni/Makefile.in
+++ b/libjava/classpath/native/jni/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native/jni
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -83,10 +81,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -223,6 +225,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -236,6 +239,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -249,12 +253,16 @@ target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
@CREATE_CORE_JNI_LIBRARIES_TRUE@JNIDIRS = java-io java-lang java-net java-nio java-util
+@CREATE_ALSA_LIBRARIES_TRUE@ALSADIR = midi-alsa
+@CREATE_DSSI_LIBRARIES_TRUE@DSSIDIR = midi-dssi
@CREATE_GTK_PEER_LIBRARIES_TRUE@GTKDIR = gtk-peer
@CREATE_QT_PEER_LIBRARIES_TRUE@CLASSPATH_QT_PEER_DIR = qt-peer
@CREATE_XMLJ_LIBRARY_TRUE@XMLJDIR = xmlj
-SUBDIRS = classpath $(JNIDIRS) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
+SUBDIRS = classpath $(JNIDIRS) \
+ $(ALSADIR) $(DSSIDIR) $(GTKDIR) $(CLASSPATH_QT_PEER_DIR) $(XMLJDIR)
+
DIST_SUBDIRS = classpath java-io java-lang java-net java-nio java-util \
- gtk-peer qt-peer xmlj
+ gtk-peer qt-peer xmlj midi-alsa midi-dssi
all: all-recursive
diff --git a/libjava/classpath/native/jni/classpath/Makefile.am b/libjava/classpath/native/jni/classpath/Makefile.am
index 2baa60abcdc..a26ab832bd2 100644
--- a/libjava/classpath/native/jni/classpath/Makefile.am
+++ b/libjava/classpath/native/jni/classpath/Makefile.am
@@ -5,7 +5,6 @@ noinst_LTLIBRARIES = libclasspath.la
libclasspath_la_SOURCES = jcl.c jcl.h \
jnilink.c jnilink.h \
- primlib.c primlib.h \
native_state.c native_state.h
AM_LDFLAGS = @CLASSPATH_MODULE@
diff --git a/libjava/classpath/native/jni/classpath/Makefile.in b/libjava/classpath/native/jni/classpath/Makefile.in
index 6180577ba31..9531df7673c 100644
--- a/libjava/classpath/native/jni/classpath/Makefile.in
+++ b/libjava/classpath/native/jni/classpath/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/classpath
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -57,8 +55,7 @@ CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libclasspath_la_LIBADD =
-am_libclasspath_la_OBJECTS = jcl.lo jnilink.lo primlib.lo \
- native_state.lo
+am_libclasspath_la_OBJECTS = jcl.lo jnilink.lo native_state.lo
libclasspath_la_OBJECTS = $(am_libclasspath_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -96,10 +93,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -236,6 +237,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -249,6 +251,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -267,7 +270,6 @@ EXTRA_DIST = classpath_jawt.h
noinst_LTLIBRARIES = libclasspath.la
libclasspath_la_SOURCES = jcl.c jcl.h \
jnilink.c jnilink.h \
- primlib.c primlib.h \
native_state.c native_state.h
AM_LDFLAGS = @CLASSPATH_MODULE@
@@ -327,7 +329,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jcl.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jnilink.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/native_state.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primlib.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
diff --git a/libjava/classpath/native/jni/classpath/jcl.c b/libjava/classpath/native/jni/classpath/jcl.c
index 4821770ed05..aacbe8900a2 100644
--- a/libjava/classpath/native/jni/classpath/jcl.c
+++ b/libjava/classpath/native/jni/classpath/jcl.c
@@ -1,5 +1,5 @@
/* jcl.c
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -193,7 +193,8 @@ JCL_NewRawDataObject (JNIEnv * env, void *data)
{
if (rawDataClass == NULL)
{
-#ifdef POINTERS_ARE_64BIT
+ jclass tmp;
+#if SIZEOF_VOID_P == 8
rawDataClass = (*env)->FindClass (env, "gnu/classpath/Pointer64");
if (rawDataClass == NULL)
{
@@ -243,17 +244,18 @@ JCL_NewRawDataObject (JNIEnv * env, void *data)
}
#endif
- (*env)->DeleteLocalRef(env, rawDataClass);
- rawDataClass = (*env)->NewGlobalRef (env, rawDataClass);
- if (rawDataClass == NULL)
+ tmp = (*env)->NewGlobalRef (env, rawDataClass);
+ if (tmp == NULL)
{
JCL_ThrowException (env, "java/lang/InternalError",
"unable to create an internal global ref");
return NULL;
}
+ (*env)->DeleteLocalRef(env, rawDataClass);
+ rawDataClass = tmp;
}
-#ifdef POINTERS_ARE_64BIT
+#if SIZEOF_VOID_P == 8
return (*env)->NewObject (env, rawDataClass, rawData_mid, (jlong) data);
#else
return (*env)->NewObject (env, rawDataClass, rawData_mid, (jint) data);
@@ -263,7 +265,7 @@ JCL_NewRawDataObject (JNIEnv * env, void *data)
JNIEXPORT void * JNICALL
JCL_GetRawData (JNIEnv * env, jobject rawdata)
{
-#ifdef POINTERS_ARE_64BIT
+#if SIZEOF_VOID_P == 8
return (void *) (*env)->GetLongField (env, rawdata, rawData_fid);
#else
return (void *) (*env)->GetIntField (env, rawdata, rawData_fid);
diff --git a/libjava/classpath/native/jni/classpath/primlib.c b/libjava/classpath/native/jni/classpath/primlib.c
deleted file mode 100644
index e6773ba5353..00000000000
--- a/libjava/classpath/native/jni/classpath/primlib.c
+++ /dev/null
@@ -1,724 +0,0 @@
-/* primlib.c
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#include <jnilink.h>
-#include <primlib.h>
-#include <jcl.h>
-
-static jclass nativeWrapClass[PRIMLIB_NUMTYPES] =
- { NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-static jclass nativeTypeClass[PRIMLIB_NUMTYPES] =
- { NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-static jmethodID nativeWrapClassConstructor[PRIMLIB_NUMTYPES] =
- { NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-static jmethodID nativeWrapClassAccessor[PRIMLIB_NUMTYPES] =
- { NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL
-};
-
-static const char *nativeWrapClassName[PRIMLIB_NUMTYPES] = {
- NULL,
- NULL,
- "java/lang/Boolean",
- "java/lang/Byte",
- "java/lang/Character",
- "java/lang/Short",
- "java/lang/Integer",
- "java/lang/Long",
- "java/lang/Float",
- "java/lang/Double",
- "java/lang/Void",
- NULL
-};
-
-static const char *nativeWrapClassConstructorSig[PRIMLIB_NUMTYPES] = {
- NULL,
- NULL,
- "(Z)V",
- "(B)V",
- "(C)V",
- "(S)V",
- "(I)V",
- "(J)V",
- "(F)V",
- "(D)V",
- "()V",
- NULL
-};
-
-static const char *nativeWrapClassAccessorName[PRIMLIB_NUMTYPES] = {
- NULL,
- NULL,
- "booleanValue",
- "byteValue",
- "charValue",
- "shortValue",
- "intValue",
- "longValue",
- "floatValue",
- "doubleValue",
- NULL,
- NULL
-};
-
-static const char *nativeWrapClassAccessorSig[PRIMLIB_NUMTYPES] = {
- NULL,
- NULL,
- "()Z",
- "()B",
- "()C",
- "()S",
- "()I",
- "()J",
- "()F",
- "()D",
- NULL,
- NULL
-};
-
-
-JNIEXPORT jclass JNICALL
-PRIMLIB_GetNativeWrapClass (JNIEnv * env, int reflectType)
-{
- return LINK_LinkClass (env, nativeWrapClass[reflectType],
- nativeWrapClassName[reflectType]);
-}
-
-static jclass
-ActuallyGetNativeTypeClass (JNIEnv * env, int reflectType)
-{
- jclass wrapClass;
- jfieldID typeField;
-
- wrapClass = PRIMLIB_GetNativeWrapClass (env, reflectType);
- if (wrapClass == NULL)
- return NULL;
- typeField =
- (*env)->GetStaticFieldID (env, wrapClass, "TYPE", "Ljava/lang/Class");
- if (typeField == NULL)
- return NULL;
- return (*env)->GetStaticObjectField (env, wrapClass, typeField);
-}
-
-JNIEXPORT jclass JNICALL
-PRIMLIB_GetNativeTypeClass (JNIEnv * env, int reflectType)
-{
- return LINK_LinkKnownClass (env, nativeTypeClass[reflectType],
- ActuallyGetNativeTypeClass (env, reflectType));
-}
-
-JNIEXPORT jmethodID JNICALL
-PRIMLIB_GetNativeWrapClassConstructor (JNIEnv * env, int reflectType)
-{
- PRIMLIB_GetNativeWrapClass (env, reflectType);
- return LINK_LinkConstructor (env, nativeWrapClassConstructor[reflectType],
- nativeWrapClass[reflectType],
- nativeWrapClassConstructorSig[reflectType]);
-}
-
-JNIEXPORT jmethodID JNICALL
-PRIMLIB_GetNativeWrapClassAccessor (JNIEnv * env, int reflectType)
-{
- PRIMLIB_GetNativeWrapClass (env, reflectType);
- return LINK_LinkMethod (env, nativeWrapClassAccessor[reflectType],
- nativeWrapClass[reflectType],
- nativeWrapClassAccessorName[reflectType],
- nativeWrapClassAccessorSig[reflectType]);
-}
-
-
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapBoolean (JNIEnv * env, jboolean b)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_BOOLEAN);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BOOLEAN),
- construct, b);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapByte (JNIEnv * env, jbyte b)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_BYTE);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE),
- construct, b);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapChar (JNIEnv * env, jchar c)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_CHAR);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR),
- construct, c);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapShort (JNIEnv * env, jshort s)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_SHORT);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT),
- construct, s);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapInt (JNIEnv * env, jint i)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_INT);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT),
- construct, i);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapLong (JNIEnv * env, jlong l)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_LONG);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG),
- construct, l);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapFloat (JNIEnv * env, jfloat f)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_FLOAT);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_FLOAT),
- construct, f);
-}
-
-JNIEXPORT jobject JNICALL
-PRIMLIB_WrapDouble (JNIEnv * env, jdouble d)
-{
- jmethodID construct =
- PRIMLIB_GetNativeWrapClassConstructor (env, PRIMLIB_DOUBLE);
- JCL_RETHROW_EXCEPTION (env);
- return (*env)->NewObject (env,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_DOUBLE),
- construct, d);
-}
-
-
-JNIEXPORT jboolean JNICALL
-PRIMLIB_UnwrapBoolean (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BOOLEAN)))
- {
- return PRIMLIB_GetBooleanObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return JNI_FALSE;
- }
-}
-
-JNIEXPORT jbyte JNICALL
-PRIMLIB_UnwrapByte (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj, PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jshort JNICALL
-PRIMLIB_UnwrapShort (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jshort) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jchar JNICALL
-PRIMLIB_UnwrapChar (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj, PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return PRIMLIB_GetCharObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jint JNICALL
-PRIMLIB_UnwrapInt (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj, PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT)))
- {
- return PRIMLIB_GetIntObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return (jint) PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return (jint) PRIMLIB_GetCharObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jint) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jlong JNICALL
-PRIMLIB_UnwrapLong (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj, PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG)))
- {
- return PRIMLIB_GetLongObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT)))
- {
- return (jlong) PRIMLIB_GetIntObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return (jlong) PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return (jlong) PRIMLIB_GetCharObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jlong) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jfloat JNICALL
-PRIMLIB_UnwrapFloat (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_FLOAT)))
- {
- return PRIMLIB_GetFloatObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG)))
- {
- return (jfloat) PRIMLIB_GetLongObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT)))
- {
- return (jfloat) PRIMLIB_GetIntObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return (jfloat) PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return (jfloat) PRIMLIB_GetCharObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jfloat) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jdouble JNICALL
-PRIMLIB_UnwrapDouble (JNIEnv * env, jobject obj)
-{
- if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_DOUBLE)))
- {
- return PRIMLIB_GetDoubleObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_FLOAT)))
- {
- return (jdouble) PRIMLIB_GetFloatObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG)))
- {
- return (jdouble) PRIMLIB_GetLongObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT)))
- {
- return (jdouble) PRIMLIB_GetIntObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT)))
- {
- return (jdouble) PRIMLIB_GetShortObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR)))
- {
- return (jdouble) PRIMLIB_GetCharObjectValue (env, obj);
- }
- else if ((*env)->
- IsInstanceOf (env, obj,
- PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE)))
- {
- return (jdouble) PRIMLIB_GetByteObjectValue (env, obj);
- }
- else
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct type.");
- return 0;
- }
-}
-
-JNIEXPORT jint JNICALL
-PRIMLIB_GetReflectiveWrapperType (JNIEnv * env, jobject obj)
-{
- jclass typeClass;
- if (obj == NULL)
- {
- return PRIMLIB_NULL;
- }
-
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_DOUBLE);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_DOUBLE;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_FLOAT);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_FLOAT;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_LONG);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_LONG;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_INT);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_INT;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_CHAR);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_CHAR;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_SHORT);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_SHORT;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BYTE);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_BYTE;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_BOOLEAN);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_BOOLEAN;
- }
- typeClass = PRIMLIB_GetNativeWrapClass (env, PRIMLIB_VOID);
- if ((*env)->IsInstanceOf (env, obj, typeClass))
- {
- return PRIMLIB_VOID;
- }
- return PRIMLIB_OBJECT;
-}
-
-JNIEXPORT jint JNICALL
-PRIMLIB_GetReflectiveType (JNIEnv * env, jclass returnType)
-{
- jclass typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_DOUBLE);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_DOUBLE;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_FLOAT);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_FLOAT;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_LONG);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_LONG;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_INT);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_INT;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_CHAR);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_CHAR;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_SHORT);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_SHORT;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_BYTE);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_BYTE;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_BOOLEAN);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_BOOLEAN;
- }
- typeClass = PRIMLIB_GetNativeTypeClass (env, PRIMLIB_VOID);
- if ((*env)->IsAssignableFrom (env, returnType, typeClass))
- {
- return PRIMLIB_VOID;
- }
- return PRIMLIB_OBJECT;
-}
-
-
-JNIEXPORT jboolean JNICALL
-PRIMLIB_GetBooleanObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_BOOLEAN);
- return (*env)->CallBooleanMethod (env, obj, acc);
-}
-
-JNIEXPORT jbyte JNICALL
-PRIMLIB_GetByteObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_BYTE);
- return (*env)->CallByteMethod (env, obj, acc);
-}
-
-JNIEXPORT jshort JNICALL
-PRIMLIB_GetShortObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_SHORT);
- return (*env)->CallShortMethod (env, obj, acc);
-}
-
-JNIEXPORT jchar JNICALL
-PRIMLIB_GetCharObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_CHAR);
- return (*env)->CallCharMethod (env, obj, acc);
-}
-
-JNIEXPORT jint JNICALL
-PRIMLIB_GetIntObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_INT);
- return (*env)->CallIntMethod (env, obj, acc);
-}
-
-JNIEXPORT jlong JNICALL
-PRIMLIB_GetLongObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_LONG);
- return (*env)->CallLongMethod (env, obj, acc);
-}
-
-JNIEXPORT jfloat JNICALL
-PRIMLIB_GetFloatObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_FLOAT);
- return (*env)->CallFloatMethod (env, obj, acc);
-}
-
-JNIEXPORT jdouble JNICALL
-PRIMLIB_GetDoubleObjectValue (JNIEnv * env, jobject obj)
-{
- jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor (env, PRIMLIB_DOUBLE);
- return (*env)->CallDoubleMethod (env, obj, acc);
-}
-
-
-
-JNIEXPORT jvalue JNICALL
-PRIMLIB_UnwrapJValue (JNIEnv * env, jobject obj, jclass classType)
-{
- jvalue retval;
- jint objType = PRIMLIB_GetReflectiveType (env, classType);
- if (objType == PRIMLIB_BOOLEAN)
- {
- retval.z = PRIMLIB_UnwrapBoolean (env, obj);
- }
- else if (objType == PRIMLIB_BYTE)
- {
- retval.b = PRIMLIB_UnwrapByte (env, obj);
- }
- else if (objType == PRIMLIB_CHAR)
- {
- retval.c = PRIMLIB_UnwrapChar (env, obj);
- }
- else if (objType == PRIMLIB_SHORT)
- {
- retval.s = PRIMLIB_UnwrapShort (env, obj);
- }
- else if (objType == PRIMLIB_INT)
- {
- retval.i = PRIMLIB_UnwrapInt (env, obj);
- }
- else if (objType == PRIMLIB_LONG)
- {
- retval.j = PRIMLIB_UnwrapLong (env, obj);
- }
- else if (objType == PRIMLIB_FLOAT)
- {
- retval.f = PRIMLIB_UnwrapFloat (env, obj);
- }
- else if (objType == PRIMLIB_DOUBLE)
- {
- retval.d = PRIMLIB_UnwrapDouble (env, obj);
- }
- else
- {
- if (obj != NULL && !(*env)->IsInstanceOf (env, obj, classType))
- {
- JCL_ThrowException (env, "java/lang/IllegalArgumentException",
- "Argument not of correct object type.");
- return retval;
- }
- retval.l = obj;
- }
- return retval;
-}
diff --git a/libjava/classpath/native/jni/classpath/primlib.h b/libjava/classpath/native/jni/classpath/primlib.h
deleted file mode 100644
index 3cdaaa4a148..00000000000
--- a/libjava/classpath/native/jni/classpath/primlib.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* primlib.h
- Copyright (C) 1998 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#ifndef __PRIMLIB_H__
-#define __PRIMLIB_H__
-
-#include <jni.h>
-
-#define PRIMLIB_UNKNOWN 0
-#define PRIMLIB_OBJECT 1
-#define PRIMLIB_BOOLEAN 2
-#define PRIMLIB_BYTE 3
-#define PRIMLIB_CHAR 4
-#define PRIMLIB_SHORT 5
-#define PRIMLIB_INT 6
-#define PRIMLIB_LONG 7
-#define PRIMLIB_FLOAT 8
-#define PRIMLIB_DOUBLE 9
-#define PRIMLIB_VOID 10
-#define PRIMLIB_NULL 11
-#define PRIMLIB_NUMTYPES 12
-
-/* Low-level primitive class accessor functions. */
-JNIEXPORT jclass JNICALL PRIMLIB_GetNativeWrapClass (JNIEnv * env,
- int reflectType);
-JNIEXPORT jclass JNICALL PRIMLIB_GetNativeTypeClass (JNIEnv * env,
- int reflectType);
-JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassConstructor (JNIEnv *
- env,
- int
- reflectType);
-JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassAccessor (JNIEnv * env,
- int
- reflectType);
-
-/* Type discovery functions: WrapperType finds out j.l.Boolean/Byte/etc., and
- Type finds out j.l.Boolean.TYPE, etc.
-*/
-JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveWrapperType (JNIEnv * env,
- jobject obj);
-JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveType (JNIEnv * env,
- jclass returnType);
-
-/* Constructor functions. */
-JNIEXPORT jobject JNICALL PRIMLIB_WrapBoolean (JNIEnv * env, jboolean b);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapByte (JNIEnv * env, jbyte b);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapChar (JNIEnv * env, jchar c);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapShort (JNIEnv * env, jshort s);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapInt (JNIEnv * env, jint i);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapLong (JNIEnv * env, jlong l);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapFloat (JNIEnv * env, jfloat f);
-JNIEXPORT jobject JNICALL PRIMLIB_WrapDouble (JNIEnv * env, jdouble d);
-
-/* Widening conversion unwrapping functions. */
-JNIEXPORT jboolean JNICALL PRIMLIB_UnwrapBoolean (JNIEnv * env, jobject obj);
-JNIEXPORT jbyte JNICALL PRIMLIB_UnwrapByte (JNIEnv * env, jobject obj);
-JNIEXPORT jshort JNICALL PRIMLIB_UnwrapShort (JNIEnv * env, jobject obj);
-JNIEXPORT jchar JNICALL PRIMLIB_UnwrapChar (JNIEnv * env, jobject obj);
-JNIEXPORT jint JNICALL PRIMLIB_UnwrapInt (JNIEnv * env, jobject obj);
-JNIEXPORT jlong JNICALL PRIMLIB_UnwrapLong (JNIEnv * env, jobject obj);
-JNIEXPORT jfloat JNICALL PRIMLIB_UnwrapFloat (JNIEnv * env, jobject obj);
-JNIEXPORT jdouble JNICALL PRIMLIB_UnwrapDouble (JNIEnv * env, jobject obj);
-
-/* Simple unwrapping functions. Objects *must* be of correct type. */
-JNIEXPORT jboolean JNICALL PRIMLIB_GetBooleanObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jbyte JNICALL PRIMLIB_GetByteObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jshort JNICALL PRIMLIB_GetShortObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jchar JNICALL PRIMLIB_GetCharObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jint JNICALL PRIMLIB_GetIntObjectValue (JNIEnv * env, jobject obj);
-JNIEXPORT jlong JNICALL PRIMLIB_GetLongObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jfloat JNICALL PRIMLIB_GetFloatObjectValue (JNIEnv * env,
- jobject obj);
-JNIEXPORT jdouble JNICALL PRIMLIB_GetDoubleObjectValue (JNIEnv * env,
- jobject obj);
-
-/* jvalue conversion: Unwrap obj to the type of classType, with widening conversion. */
-JNIEXPORT jvalue JNICALL PRIMLIB_UnwrapJValue (JNIEnv * env, jobject obj,
- jclass classType);
-
-#endif
diff --git a/libjava/classpath/native/jni/gtk-peer/Makefile.am b/libjava/classpath/native/jni/gtk-peer/Makefile.am
index e233357a163..453873037b4 100644
--- a/libjava/classpath/native/jni/gtk-peer/Makefile.am
+++ b/libjava/classpath/native/jni/gtk-peer/Makefile.am
@@ -55,10 +55,12 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \
libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
$(top_builddir)/native/jni/classpath/jcl.lo
-AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ -lXtst
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ \
+ @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ -lX11 -lXtst
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
# Just the WARNING_CFLAGS. We cannot use the strict flags since the gtk
# headers contain broken prototypes (by design, see gtkitemfactory.h).
AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ \
- @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@
+ @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@ \
+ @X_CFLAGS@
diff --git a/libjava/classpath/native/jni/gtk-peer/Makefile.in b/libjava/classpath/native/jni/gtk-peer/Makefile.in
index 2b980d7fe2b..77ce68f0458 100644
--- a/libjava/classpath/native/jni/gtk-peer/Makefile.in
+++ b/libjava/classpath/native/jni/gtk-peer/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/gtk-peer
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -173,10 +171,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -313,6 +315,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -326,6 +329,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -391,13 +395,16 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \
libgtkpeer_la_LIBADD = $(top_builddir)/native/jni/classpath/native_state.lo \
$(top_builddir)/native/jni/classpath/jcl.lo
-AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ @X_LIBS@ -lXtst
+AM_LDFLAGS = @CLASSPATH_MODULE@ @GTK_LIBS@ @CAIRO_LIBS@ @PANGOFT2_LIBS@ \
+ @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ -lX11 -lXtst
+
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
# Just the WARNING_CFLAGS. We cannot use the strict flags since the gtk
# headers contain broken prototypes (by design, see gtkitemfactory.h).
AM_CFLAGS = @WARNING_CFLAGS@ @ERROR_CFLAGS@ \
- @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@
+ @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOFT2_CFLAGS@ \
+ @X_CFLAGS@
all: all-am
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
index 6f2a1ae7272..cd7eee614b0 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
@@ -65,6 +65,9 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState
glyphVector_class = (*env)->FindClass
(env, "gnu/java/awt/peer/gtk/GdkGlyphVector");
+ glyphVector_class = (*env)->NewGlobalRef
+ (env, glyphVector_class);
+
glyphVector_ctor = (*env)->GetMethodID
(env, glyphVector_class, "<init>",
"([D[ILjava/awt/Font;Ljava/awt/font/FontRenderContext;)V");
@@ -98,7 +101,7 @@ Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose
pfont = (struct peerfont *)NSA_DEL_FONT_PTR (env, self);
g_assert (pfont != NULL);
if (pfont->layout != NULL)
- g_object_unref (pfont->font);
+ g_object_unref (pfont->layout);
if (pfont->font != NULL)
g_object_unref (pfont->font);
if (pfont->ctx != NULL)
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
index b122eb01544..4aca1cf57b9 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
@@ -116,11 +116,11 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
gdk_gc_copy (g->gc, g_old->gc);
if (GDK_STABLE_IS_PIXMAP (g->drawable))
- gdk_pixmap_ref (g->drawable);
+ g_object_ref (g->drawable);
else /* GDK_IS_WINDOW (g->drawable) */
- gdk_window_ref (g->drawable);
+ g_object_ref (g->drawable);
- gdk_colormap_ref (g->cm);
+ g_object_ref (g->cm);
NSA_SET_G_PTR (env, obj, g);
@@ -140,8 +140,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
g->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height,
gdk_rgb_get_visual ()->depth);
- g->cm = gdk_rgb_get_cmap ();
- gdk_colormap_ref (g->cm);
+ g->cm = gdk_rgb_get_colormap ();
+ g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
@@ -160,7 +160,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
pixmap = cp_gtk_image_get_pixmap (env, source);
g_assert(pixmap != NULL);
- gdk_pixmap_ref (pixmap);
+ g_object_ref (pixmap);
g = (struct graphics *) g_malloc (sizeof (struct graphics));
g->x_offset = g->y_offset = 0;
@@ -168,7 +168,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage
g->drawable = (GdkDrawable *)pixmap;
g->cm = gdk_drawable_get_colormap (g->drawable);
- gdk_colormap_ref (g->cm);
+ g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
NSA_SET_G_PTR (env, obj, g);
@@ -193,9 +193,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initStateUnlocked
widget = GTK_WIDGET (ptr);
g->drawable = (GdkDrawable *) widget->window;
- gdk_window_ref (g->drawable);
+ g_object_ref (g->drawable);
g->cm = gtk_widget_get_colormap (widget);
- gdk_colormap_ref (g->cm);
+ g_object_ref (g->cm);
g->gc = gdk_gc_new (g->drawable);
gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
color = widget->style->fg[GTK_STATE_NORMAL];
@@ -254,14 +254,14 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
XFlush (GDK_DISPLAY ());
- gdk_gc_destroy (g->gc);
+ g_object_unref (g->gc);
if (GDK_STABLE_IS_PIXMAP (g->drawable))
- gdk_pixmap_unref (g->drawable);
+ g_object_unref (g->drawable);
else /* GDK_IS_WINDOW (g->drawable) */
- gdk_window_unref (g->drawable);
+ g_object_unref (g->drawable);
- gdk_colormap_unref (g->cm);
+ g_object_unref (g->cm);
g_free (g);
@@ -388,12 +388,12 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
- gdk_window_copy_area ((GdkWindow *)g->drawable,
- g->gc,
- x + g->x_offset + dx, y + g->y_offset + dy,
- (GdkWindow *)g->drawable,
- x + g->x_offset, y + g->y_offset,
- width, height);
+ gdk_draw_drawable ((GdkWindow *)g->drawable,
+ g->gc,
+ (GdkWindow *)g->drawable,
+ x + g->x_offset, y + g->y_offset,
+ x + g->x_offset + dx, y + g->y_offset + dy,
+ width, height);
gdk_flush ();
gdk_threads_leave ();
@@ -471,8 +471,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
color.blue = blue << 8;
g = (struct graphics *) NSA_GET_G_PTR (env, obj);
-
- gdk_color_alloc (g->cm, &color);
+
+ gdk_colormap_alloc_color (g->cm, &color, TRUE, TRUE);
gdk_gc_set_foreground (g->gc, &color);
gdk_threads_leave ();
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
index fe9980ffd02..092e997a36d 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
@@ -58,9 +58,12 @@ void
cp_gtk_graphics2d_init_jni (void)
{
jclass gdkgraphics2d;
+ JNIEnv *env = cp_gtk_gdk_env();
- gdkgraphics2d = (*cp_gtk_gdk_env())->FindClass (cp_gtk_gdk_env(),
- "gnu/java/awt/peer/gtk/GdkGraphics2D");
+ gdkgraphics2d = (*env)->FindClass (env,
+ "gnu/java/awt/peer/gtk/GdkGraphics2D");
+ if ((*env)->ExceptionOccurred(env))
+ return;
initComponentGraphics2DUnlockedID = (*cp_gtk_gdk_env())->GetMethodID (cp_gtk_gdk_env(), gdkgraphics2d,
"initComponentGraphics2DUnlocked",
@@ -562,6 +565,13 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable
/* gdk_flush(); */
+ if (!GDK_IS_DRAWABLE (src->drawable) ||
+ !GDK_IS_DRAWABLE (dst->drawable))
+ {
+ gdk_threads_leave ();
+ return;
+ }
+
gdk_drawable_get_size (src->drawable, &s_width, &s_height);
gdk_drawable_get_size (dst->drawable, &d_width, &d_height);
width = min (s_width, d_width);
@@ -777,12 +787,13 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradientUnlocked
if (peer_is_disposed(env, obj))
return;
- if (gr->debug) printf ("setGradient (%f,%f) -> (%f,%f); (%d,%d,%d,%d) -> (%d,%d,%d,%d)\n",
- x1, y1,
- x2, y2,
- r1, g1, b1, a1,
- r2, g2, b2, a2);
-
+ if (gr->debug)
+ printf ("setGradientUnlocked (%f,%f) -> (%f,%f); (%d,%d,%d,%d) -> (%d,%d,%d,%d)\n",
+ x1, y1,
+ x2, y2,
+ r1, g1, b1, a1,
+ r2, g2, b2, a2);
+
if (cyclic)
surf = cairo_surface_create_similar (gr->surface, CAIRO_FORMAT_ARGB32, 3, 2);
else
@@ -903,8 +914,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("setTexturePixels (%d pixels, %dx%d, stride: %d)\n",
- (*env)->GetArrayLength (env, jarr), w, h, stride);
+ if (gr->debug)
+ printf ("setTexturePixelsUnlocked (%d pixels, %dx%d, stride: %d)\n",
+ (*env)->GetArrayLength (env, jarr), w, h, stride);
if (gr->pattern)
cairo_pattern_destroy (gr->pattern);
@@ -931,9 +943,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixelsUnlocked
CAIRO_FORMAT_ARGB32,
w, h, stride * 4);
g_assert (gr->pattern_surface != NULL);
- cairo_pattern_set_extend (gr->pattern, 1);
gr->pattern = cairo_pattern_create_for_surface (gr->pattern_surface);
g_assert (gr->pattern != NULL);
+ cairo_pattern_set_extend (gr->pattern, CAIRO_EXTEND_REPEAT);
cairo_set_source (gr->cr, gr->pattern);
}
@@ -957,8 +969,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("drawPixels (%d pixels, %dx%d, stride: %d)\n",
- (*env)->GetArrayLength (env, java_pixels), w, h, stride);
+ if (gr->debug)
+ printf ("drawPixels (%d pixels, %dx%d, stride: %d)\n",
+ (*env)->GetArrayLength (env, java_pixels), w, h, stride);
native_pixels = (*env)->GetIntArrayElements (env, java_pixels, NULL);
native_matrix = (*env)->GetDoubleArrayElements (env, java_matrix, NULL);
@@ -1078,10 +1091,11 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrixUnlocked
g_assert (native_matrix != NULL);
g_assert ((*env)->GetArrayLength (env, java_matrix) == 6);
- if (gr->debug) printf ("cairo_set_matrix [ %f, %f, %f, %f, %f, %f ]\n",
- native_matrix[0], native_matrix[1],
- native_matrix[2], native_matrix[3],
- native_matrix[4], native_matrix[5]);
+ if (gr->debug)
+ printf ("cairo_matrix_init [ %f, %f, %f, %f, %f, %f ]\n",
+ native_matrix[0], native_matrix[1],
+ native_matrix[2], native_matrix[3],
+ native_matrix[4], native_matrix[5]);
{
cairo_matrix_t mat;
@@ -1269,7 +1283,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector
(*env)->ReleaseFloatArrayElements (env, java_positions, native_positions, 0);
(*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
- begin_drawing_operation (env, gr);
+ begin_drawing_operation (env, gr);
cairo_show_glyphs (gr->cr, glyphs, n);
end_drawing_operation (env, gr);
@@ -1437,7 +1451,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBAColorUnlocked
draw to a PixBuf, you must exchange the R and B components of your
color. */
- if (gr->debug) printf ("cairo_set_source_rgb (%f, %f, %f)\n", r, g, b);
+ if (gr->debug)
+ printf ("cairo_set_source_rgba (%f, %f, %f, %f)\n", r, g, b, a);
if (gr->drawbuf)
cairo_set_source_rgba (gr->cr, b, g, r, a);
@@ -1728,7 +1743,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_curve_to (%f, %f), (%f, %f), (%f, %f)\n", x1, y1, x2, y2, x3, y3);
+ if (gr->debug)
+ printf ("cairo_curve_to (%f, %f), (%f, %f), (%f, %f)\n",
+ x1, y1, x2, y2, x3, y3);
cairo_curve_to (gr->cr, x1, y1, x2, y2, x3, y3);
gdk_threads_leave();
@@ -1794,7 +1811,9 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_rel_curve_to (%f, %f), (%f, %f), (%f, %f)\n", dx1, dy1, dx2, dy2, dx3, dy3);
+ if (gr->debug)
+ printf ("cairo_rel_curve_to (%f, %f), (%f, %f), (%f, %f)\n",
+ dx1, dy1, dx2, dy2, dx3, dy3);
cairo_rel_curve_to (gr->cr, dx1, dy1, dx2, dy2, dx3, dy3);
gdk_threads_leave();
@@ -1822,7 +1841,8 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle
return;
}
- if (gr->debug) printf ("cairo_rectangle (%f, %f) (%f, %f)\n", x, y, width, height);
+ if (gr->debug)
+ printf ("cairo_rectangle (%f, %f) (%f, %f)\n", x, y, width, height);
cairo_rectangle (gr->cr, x, y, width, height);
gdk_threads_leave();
@@ -1952,7 +1972,7 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilterUnlocked
gr = (struct graphics2d *) NSA_GET_G2D_PTR (env, obj);
g_assert (gr != NULL);
- if (gr->debug) printf ("cairo_surface_set_filter %d\n", filter);
+ if (gr->debug) printf ("cairo_pattern_set_filter %d\n", filter);
switch ((enum java_awt_rendering_hints_filter) filter)
{
case java_awt_rendering_hints_VALUE_INTERPOLATION_NEAREST_NEIGHBOR:
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
index 918ecfd0a8e..edce3917d68 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c
@@ -1,5 +1,5 @@
/* gnu_java_awt_GdkTextLayout.c
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,12 +38,28 @@
#include <jni.h>
#include <gtk/gtk.h>
+#include <string.h>
+#include <pango/pango.h>
+#include <pango/pangoft2.h>
+#include <pango/pangofc-font.h>
+#include <freetype/ftglyph.h>
+#include <freetype/ftoutln.h>
#include "native_state.h"
#include "gdkfont.h"
#include "gnu_java_awt_peer_gtk_GdkTextLayout.h"
struct state_table *cp_gtk_native_text_layout_state_table;
+typedef struct gp
+{
+ JNIEnv *env;
+ jobject obj;
+ double px;
+ double py;
+ double sx;
+ double sy;
+} generalpath ;
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkTextLayout_initStaticState
(JNIEnv *env, jclass clazz)
@@ -190,3 +206,219 @@ Java_gnu_java_awt_peer_gtk_GdkTextLayout_dispose
gdk_threads_leave ();
}
+
+/* GetOutline code follows ****************************/
+/********* Freetype callback functions *****************************/
+
+static int _moveTo( FT_Vector* to,
+ void *p)
+{
+ JNIEnv *env;
+ jobject obj;
+ jclass cls;
+ jmethodID method;
+ jvalue values[2];
+ generalpath *path = (generalpath *) p;
+
+ env = path->env;
+ obj = path->obj;
+
+ values[0].f = (jfloat)(to->x * path->sx + path->px);
+ values[1].f = (jfloat)(to->y * path->sy + path->py);
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "moveTo", "(FF)V");
+ (*env)->CallVoidMethodA(env, obj, method, values );
+
+ return 0;
+}
+
+static int _lineTo( FT_Vector* to,
+ void *p)
+{
+ JNIEnv *env;
+ jobject obj;
+ jclass cls;
+ jmethodID method;
+ jvalue values[2];
+ generalpath *path = (generalpath *) p;
+
+ env = path->env;
+ obj = path->obj;
+ values[0].f = (jfloat)(to->x * path->sx + path->px);
+ values[1].f = (jfloat)(to->y * path->sy + path->py);
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "lineTo", "(FF)V");
+ (*env)->CallVoidMethodA(env, obj, method, values );
+
+ return 0;
+}
+
+static int _quadTo( FT_Vector* cp,
+ FT_Vector* to,
+ void *p)
+{
+ JNIEnv *env;
+ jobject obj;
+ jclass cls;
+ jmethodID method;
+ jvalue values[4];
+ generalpath *path = (generalpath *) p;
+
+ env = path->env;
+ obj = path->obj;
+ values[0].f = (jfloat)(cp->x * path->sx + path->px);
+ values[1].f = (jfloat)(cp->y * path->sy + path->py);
+ values[2].f = (jfloat)(to->x * path->sx + path->px);
+ values[3].f = (jfloat)(to->y * path->sy + path->py);
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "quadTo", "(FFFF)V");
+ (*env)->CallVoidMethodA(env, obj, method, values );
+
+ return 0;
+}
+
+static int _curveTo( FT_Vector* cp1,
+ FT_Vector* cp2,
+ FT_Vector* to,
+ void *p)
+{
+ JNIEnv *env;
+ jobject obj;
+ jclass cls;
+ jmethodID method;
+ jvalue values[6];
+ generalpath *path = (generalpath *) p;
+
+ env = path->env;
+ obj = path->obj;
+ values[0].f = (jfloat)(cp1->x * path->sx + path->px);
+ values[1].f = (jfloat)(cp1->y * path->sy + path->py);
+ values[2].f = (jfloat)(cp2->x * path->sx + path->px);
+ values[3].f = (jfloat)(cp2->y * path->sy + path->py);
+ values[4].f = (jfloat)(to->x * path->sx + path->px);
+ values[5].f = (jfloat)(to->y * path->sy + path->py);
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "curveTo", "(FFFFFF)V");
+ (*env)->CallVoidMethodA(env, obj, method, values );
+
+ return 0;
+}
+
+
+JNIEXPORT jobject JNICALL
+Java_gnu_java_awt_peer_gtk_GdkTextLayout_getOutline
+ (JNIEnv *env, jobject obj, jobject transform)
+{
+ struct textlayout *tl;
+ generalpath *path;
+ jobject gp;
+ GSList *current_run;
+ PangoLayoutLine *current_line;
+ FT_Outline_Funcs ftCallbacks =
+ {
+ _moveTo,
+ _lineTo,
+ _quadTo,
+ _curveTo,
+ 0,
+ 0
+ };
+ PangoLayoutIter* layoutIterator;
+
+ gdk_threads_enter ();
+
+ tl = (struct textlayout *)NSA_GET_TEXT_LAYOUT_PTR (env, obj);
+ g_assert(tl != NULL);
+ g_assert(tl->pango_layout != NULL);
+
+ path = g_malloc0 (sizeof (generalpath));
+ g_assert(path != NULL);
+ path->env = env;
+
+ /* Scaling factors */
+ path->sx = PANGO_SCALE/65536.0;
+ path->sy = -PANGO_SCALE/65536.0;
+
+ { /* create a GeneralPath instance */
+ jclass cls;
+ jmethodID method;
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "<init>", "()V");
+ gp = path->obj = (*env)->NewObject (env, cls, method);
+ }
+
+ layoutIterator = pango_layout_get_iter (tl->pango_layout);
+ g_assert (layoutIterator != NULL);
+
+ if (pango_layout_iter_get_line (layoutIterator))
+ do
+ {
+ PangoRectangle line_logical_rect;
+ current_line = pango_layout_iter_get_line (layoutIterator);
+ pango_layout_iter_get_line_extents (layoutIterator,
+ NULL,
+ &line_logical_rect);
+
+ path->px = line_logical_rect.x/(double)PANGO_SCALE;
+ path->py = line_logical_rect.y/(double)PANGO_SCALE;
+
+ current_run = current_line->runs;
+ while (current_run)
+ {
+ FT_Face ft_face;
+ int index;
+ PangoGlyphItem *run = current_run->data;
+ PangoGlyphString *glyphs = run->glyphs;
+
+ PangoAnalysis *analysis = &run->item->analysis;
+ g_assert (analysis != NULL);
+ g_assert (analysis->font != NULL);
+
+ ft_face = pango_fc_font_lock_face ((PangoFcFont *)analysis->font);
+ g_assert (ft_face != NULL);
+
+ for (index = 0; index < glyphs->num_glyphs; index++)
+ {
+ FT_Glyph glyph;
+ FT_Error fterror;
+ PangoGlyphGeometry pgg = glyphs->glyphs[index].geometry;
+
+ fterror = FT_Load_Glyph(ft_face,
+ (FT_UInt)(glyphs->glyphs[index].glyph),
+ FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP);
+ g_assert(fterror == 0);
+
+ FT_Get_Glyph (ft_face->glyph, &glyph);
+ FT_Outline_Decompose (&(((FT_OutlineGlyph)glyph)->outline),
+ &ftCallbacks, path);
+ FT_Done_Glyph (glyph);
+
+ path->px += pgg.width/(double)PANGO_SCALE;
+ }
+
+ pango_fc_font_unlock_face ((PangoFcFont *)analysis->font);
+ current_run = current_run->next;
+ }
+ } while (pango_layout_iter_next_line (layoutIterator));
+
+ g_free(path);
+ gdk_threads_leave ();
+
+ if (transform != NULL)
+ {
+ jclass cls;
+ jmethodID method;
+
+ cls = (*env)->FindClass (env, "java/awt/geom/GeneralPath");
+ method = (*env)->GetMethodID (env, cls, "transform",
+ "(Ljava/awt/geom/AffineTransform;)V");
+ (*env)->CallVoidMethod(env, gp, method, transform );
+ }
+
+ return gp;
+}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
index 52922ddb82e..ef9ac12076a 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
@@ -46,11 +46,11 @@ Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
gpointer widget;
gdk_threads_enter ();
-
+
/* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
- widget = gtk_type_new (gtk_drawing_area_get_type ());
+ widget = gtk_drawing_area_new ();
NSA_SET_PTR (env, obj, widget);
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
index 4f28750921b..5ba300b7e20 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer.c
@@ -64,7 +64,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove
/* Update the group to point to some other widget in the group. We
have to do this because Gtk doesn't have a separate object to
represent a radio button's group. */
- for (list = gtk_radio_button_group (button); list != NULL;
+ for (list = gtk_radio_button_get_group (button); list != NULL;
list = list->next)
{
if (list->data != button)
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
index 7012bd82115..b74b0a265e0 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
@@ -130,7 +130,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup
gtk_radio_button_set_group (button, NULL);
else
gtk_radio_button_set_group (button,
- gtk_radio_button_group
+ gtk_radio_button_get_group
(GTK_RADIO_BUTTON (native_group)));
/* If the native group wasn't set on the new CheckboxGroup, then set
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
index f10a80d580b..779be57235d 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
@@ -53,7 +53,11 @@ jstring cp_gtk_imageTarget;
jstring cp_gtk_filesTarget;
/* Simple id to keep track of the selection we are currently managing. */
+#if SIZEOF_VOID_P == 8
+static long current_selection = 0;
+#else
static int current_selection = 0;
+#endif
/* Whether we "own" the clipboard. And may clear it. */
static int owner = 0;
@@ -261,7 +265,11 @@ static void
clipboard_clear_func (GtkClipboard *clipboard __attribute__((unused)),
gpointer user_data)
{
+#if SIZEOF_VOID_P == 8
+ if (owner && (long) user_data == current_selection)
+#else
if (owner && (int) user_data == current_selection)
+#endif
{
JNIEnv *env = cp_gtk_gdk_env();
owner = 0;
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index f832da5a462..6de7b61b8e9 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -56,10 +56,6 @@ exception statement from your version. */
#define AWT_HAND_CURSOR 12
#define AWT_MOVE_CURSOR 13
-#define AWT_BUTTON1_DOWN_MASK (1 << 10)
-#define AWT_BUTTON2_DOWN_MASK (1 << 11)
-#define AWT_BUTTON3_DOWN_MASK (1 << 12)
-
/* FIXME: use gtk-double-click-time, gtk-double-click-distance */
#define MULTI_CLICK_TIME 250
/* as opposed to a MULTI_PASS_TIME :) */
@@ -135,11 +131,11 @@ button_to_awt_mods (int button)
switch (button)
{
case 1:
- return AWT_BUTTON1_MASK;
+ return AWT_BUTTON1_DOWN_MASK | AWT_BUTTON1_MASK;
case 2:
- return AWT_BUTTON2_MASK;
+ return AWT_BUTTON2_DOWN_MASK | AWT_BUTTON2_MASK;
case 3:
- return AWT_BUTTON3_MASK;
+ return AWT_BUTTON3_DOWN_MASK | AWT_BUTTON3_MASK;
}
return 0;
@@ -151,11 +147,11 @@ cp_gtk_state_to_awt_mods (guint state)
jint result = 0;
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= (AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK);
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= (AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK);
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= (AWT_ALT_DOWN_MASK | AWT_ALT_MASK);
return result;
}
@@ -166,13 +162,13 @@ state_to_awt_mods_with_button_states (guint state)
jint result = 0;
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
if (state & GDK_BUTTON1_MASK)
- result |= AWT_BUTTON1_DOWN_MASK;
+ result |= AWT_BUTTON1_DOWN_MASK | AWT_BUTTON1_MASK;
if (state & GDK_BUTTON2_MASK)
result |= AWT_BUTTON2_DOWN_MASK;
if (state & GDK_BUTTON3_MASK)
@@ -253,7 +249,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursorUnlocked
gdk_cursor = gdk_cursor_new (gdk_cursor_type);
gdk_window_set_cursor (widget->window, gdk_cursor);
- gdk_cursor_destroy (gdk_cursor);
+ gdk_cursor_unref (gdk_cursor);
}
JNIEXPORT void JNICALL
@@ -276,9 +272,9 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent
if (widget->parent == NULL)
{
if (GTK_IS_WINDOW (parent_widget))
- {
- GList *children = gtk_container_children
- (GTK_CONTAINER (parent_widget));
+ {
+ GList *children = gtk_container_get_children
+ (GTK_CONTAINER (parent_widget));
if (GTK_IS_MENU_BAR (children->data))
gtk_fixed_put (GTK_FIXED (children->next->data), widget, 0, 0);
@@ -458,24 +454,47 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetDispatchKeyEvent
* Find the origin of a widget's window.
*/
JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWindowGetLocationOnScreen
+ (JNIEnv * env, jobject obj, jintArray jpoint)
+{
+ void *ptr;
+ jint *point;
+
+ gdk_threads_enter ();
+
+ ptr = NSA_GET_PTR (env, obj);
+ point = (*env)->GetIntArrayElements (env, jpoint, 0);
+
+ gdk_window_get_root_origin (GTK_WIDGET (ptr)->window, point, point+1);
+
+ (*env)->ReleaseIntArrayElements(env, jpoint, point, 0);
+
+ gdk_threads_leave ();
+}
+
+/*
+ * Find the origin of a widget
+ */
+JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen
(JNIEnv * env, jobject obj, jintArray jpoint)
{
void *ptr;
jint *point;
+ GtkWidget *widget;
gdk_threads_enter ();
ptr = NSA_GET_PTR (env, obj);
point = (*env)->GetIntArrayElements (env, jpoint, 0);
- gdk_window_get_origin (GTK_WIDGET (ptr)->window, point, point+1);
+ widget = GTK_WIDGET(ptr);
+ while(gtk_widget_get_parent(widget) != NULL)
+ widget = gtk_widget_get_parent(widget);
+ gdk_window_get_position (GTK_WIDGET(widget)->window, point, point+1);
- if (!GTK_IS_CONTAINER (ptr))
- {
- *point += GTK_WIDGET(ptr)->allocation.x;
- *(point+1) += GTK_WIDGET(ptr)->allocation.y;
- }
+ *point += GTK_WIDGET(ptr)->allocation.x;
+ *(point+1) += GTK_WIDGET(ptr)->allocation.y;
(*env)->ReleaseIntArrayElements(env, jpoint, point, 0);
@@ -766,7 +785,10 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isRealized
ptr = NSA_GET_PTR (env, obj);
if (ptr == NULL)
- return FALSE;
+ {
+ gdk_threads_leave ();
+ return FALSE;
+ }
ret_val = GTK_WIDGET_REALIZED (GTK_WIDGET (ptr));
@@ -844,7 +866,7 @@ find_fg_color_widget (GtkWidget *widget)
if (GTK_IS_EVENT_BOX (widget)
|| (GTK_IS_BUTTON (widget)
- && !GTK_IS_OPTION_MENU (widget)))
+ && !GTK_IS_COMBO_BOX (widget)))
fg_color_widget = gtk_bin_get_child (GTK_BIN(widget));
else
fg_color_widget = widget;
@@ -974,7 +996,7 @@ component_button_release_cb (GtkWidget *widget __attribute__((unused)),
/* Generate an AWT click event only if the release occured in the
window it was pressed in, and the mouse has not been dragged since
the last time it was pressed. */
- gdk_window_get_size (event->window, &width, &height);
+ gdk_drawable_get_size (event->window, &width, &height);
if (! hasBeenDragged
&& event->x >= 0
&& event->y >= 0
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
index fdc73ccdba5..ae065763688 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
@@ -299,7 +299,7 @@ Java_gnu_java_awt_peer_gtk_GtkImage_freePixmap(JNIEnv *env, jobject obj)
if (offScreen (env, obj) == JNI_FALSE)
gdk_pixbuf_unref ((GdkPixbuf *)getData (env, obj));
else
- gdk_pixmap_unref ((GdkPixmap *)getData (env, obj));
+ g_object_unref ((GdkPixmap *)getData (env, obj));
gdk_threads_leave ();
}
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
index 3e21a04024d..a5c0074c068 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
@@ -88,7 +88,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMenu
if (helpmenu != NULL)
{
- list = gtk_container_children (GTK_CONTAINER (mbar));
+ list = gtk_container_get_children (GTK_CONTAINER (mbar));
while (list != NULL && list->data != helpmenu)
list = list->next;
if (list != NULL && list->data == helpmenu)
@@ -110,7 +110,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
ptr = NSA_GET_PTR (env, obj);
- list = gtk_container_children (GTK_CONTAINER (ptr));
+ list = gtk_container_get_children (GTK_CONTAINER (ptr));
list = g_list_nth (list, index);
gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
index 16018f001e4..b61a55bee56 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
@@ -165,7 +165,7 @@ Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
ptr = NSA_GET_PTR (env, obj);
- list = gtk_container_children (GTK_CONTAINER (ptr));
+ list = gtk_container_get_children (GTK_CONTAINER (ptr));
list = g_list_nth (list, index);
gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
index 040cc92ff1e..b14330e5fe2 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
@@ -135,6 +135,8 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env,
gtkgenericpeer = (*env)->FindClass(env, "gnu/java/awt/peer/gtk/GtkGenericPeer");
+ gtkgenericpeer = (*env)->NewGlobalRef(env, gtkgenericpeer);
+
printCurrentThreadID = (*env)->GetStaticMethodID (env, gtkgenericpeer,
"printCurrentThread", "()V");
@@ -160,9 +162,7 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env,
XSynchronize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), True);
#endif
- gdk_rgb_init ();
- gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
- gtk_widget_set_default_visual (gdk_rgb_get_visual ());
+ gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
/* Make sure queued calls don't get sent to GTK/GDK while
we're shutting down. */
diff --git a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index 0f623d1655f..ac8f6a8ff1e 100644
--- a/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/libjava/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -952,29 +952,29 @@ keyevent_state_to_awt_mods (GdkEventKey *event)
if (event->keyval == GDK_Shift_L
|| event->keyval == GDK_Shift_R)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
else
{
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
}
if (event->keyval == GDK_Control_L
|| event->keyval == GDK_Control_R)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
else
{
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
}
if (event->keyval == GDK_Alt_L
|| event->keyval == GDK_Alt_R)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
else
{
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
}
}
else if (event->type == GDK_KEY_RELEASE)
@@ -985,20 +985,20 @@ keyevent_state_to_awt_mods (GdkEventKey *event)
&& event->keyval != GDK_Shift_R)
{
if (state & GDK_SHIFT_MASK)
- result |= AWT_SHIFT_DOWN_MASK;
+ result |= AWT_SHIFT_DOWN_MASK | AWT_SHIFT_MASK;
}
if (event->keyval != GDK_Control_L
&& event->keyval != GDK_Control_R)
{
if (state & GDK_CONTROL_MASK)
- result |= AWT_CTRL_DOWN_MASK;
+ result |= AWT_CTRL_DOWN_MASK | AWT_CTRL_MASK;
}
if (event->keyval != GDK_Alt_L
&& event->keyval != GDK_Alt_R)
{
if (state & GDK_MOD1_MASK)
- result |= AWT_ALT_DOWN_MASK;
+ result |= AWT_ALT_DOWN_MASK | AWT_ALT_MASK;
}
}
@@ -1028,9 +1028,6 @@ static gboolean window_delete_cb (GtkWidget *widget, GdkEvent *event,
static void window_destroy_cb (GtkWidget *widget, GdkEvent *event,
jobject peer);
static void window_show_cb (GtkWidget *widget, jobject peer);
-static void window_active_state_change_cb (GtkWidget *widget,
- GParamSpec *pspec,
- jobject peer);
static void window_focus_state_change_cb (GtkWidget *widget,
GParamSpec *pspec,
jobject peer);
@@ -1043,7 +1040,6 @@ static gboolean window_focus_out_cb (GtkWidget * widget,
static gboolean window_window_state_cb (GtkWidget *widget,
GdkEvent *event,
jobject peer);
-static jint window_get_new_state (GtkWidget *widget);
static gboolean window_property_changed_cb (GtkWidget *widget,
GdkEventProperty *event,
jobject peer);
@@ -1208,8 +1204,8 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResizable
gdk_threads_enter ();
ptr = NSA_GET_PTR (env, obj);
-
- gtk_window_set_policy (GTK_WINDOW (ptr), resizable, resizable, FALSE);
+ gtk_window_set_resizable (GTK_WINDOW (ptr), resizable);
+ g_object_set (G_OBJECT (ptr), "allow-shrink", resizable, NULL);
gdk_threads_leave ();
}
@@ -1278,9 +1274,6 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals
g_signal_connect (G_OBJECT (ptr), "show",
G_CALLBACK (window_show_cb), *gref);
- g_signal_connect (G_OBJECT (ptr), "notify::is-active",
- G_CALLBACK (window_active_state_change_cb), *gref);
-
g_signal_connect (G_OBJECT (ptr), "notify::has-toplevel-focus",
G_CALLBACK (window_focus_state_change_cb), *gref);
@@ -1592,31 +1585,6 @@ window_show_cb (GtkWidget *widget __attribute__((unused)),
}
static void
-window_active_state_change_cb (GtkWidget *widget __attribute__((unused)),
- GParamSpec *pspec __attribute__((unused)),
- jobject peer __attribute__((unused)))
-{
- /* FIXME: not sure if this is needed or not. */
- /* Remove the unused attributes if you fix the below. */
-#if 0
- gdk_threads_leave ();
-
- if (GTK_WINDOW (widget)->is_active)
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
- postWindowEventID,
- (jint) AWT_WINDOW_GAINED_FOCUS,
- (jobject) NULL, (jint) 0);
- else
- (*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
- postWindowEventID,
- (jint) AWT_WINDOW_DEACTIVATED,
- (jobject) NULL, (jint) 0);
-
- gdk_threads_enter ();
-#endif
-}
-
-static void
window_focus_state_change_cb (GtkWidget *widget,
GParamSpec *pspec __attribute__((unused)),
jobject peer)
@@ -1660,7 +1628,7 @@ window_focus_out_cb (GtkWidget * widget __attribute__((unused)),
}
static gboolean
-window_window_state_cb (GtkWidget *widget,
+window_window_state_cb (GtkWidget *widget __attribute__((unused)),
GdkEvent *event,
jobject peer)
{
@@ -1695,8 +1663,6 @@ window_window_state_cb (GtkWidget *widget,
if (event->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED)
new_state |= AWT_FRAME_STATE_ICONIFIED;
- new_state |= window_get_new_state (widget);
-
(*cp_gtk_gdk_env())->CallVoidMethod (cp_gtk_gdk_env(), peer,
postWindowEventID,
(jint) AWT_WINDOW_STATE_CHANGED,
@@ -1705,47 +1671,6 @@ window_window_state_cb (GtkWidget *widget,
return TRUE;
}
-static jint
-window_get_new_state (GtkWidget *widget)
-{
- GdkDisplay *display = gtk_widget_get_display(widget);
- jint new_state = AWT_FRAME_STATE_NORMAL;
- Atom type;
- gint format;
- gulong atom_count;
- gulong bytes_after;
- Atom *atom_list = NULL;
- union atom_list_union alu;
- gulong i;
-
- alu.atom_list = &atom_list;
- XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XID (widget->window),
- gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
- 0, G_MAXLONG, False, XA_ATOM, &type, &format, &atom_count,
- &bytes_after, alu.gu_extents);
-
- if (type != None)
- {
- Atom maxvert = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT");
- Atom maxhorz = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ");
-
- i = 0;
- while (i < atom_count)
- {
- if (atom_list[i] == maxhorz)
- new_state |= AWT_FRAME_STATE_MAXIMIZED_HORIZ;
- else if (atom_list[i] == maxvert)
- new_state |= AWT_FRAME_STATE_MAXIMIZED_VERT;
-
- ++i;
- }
-
- XFree (atom_list);
- }
- return new_state;
-}
-
static gboolean
window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
GdkEventProperty *event,
diff --git a/libjava/classpath/native/jni/gtk-peer/gtkpeer.h b/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
index 2b16d99b455..f332b62a156 100644
--- a/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
+++ b/libjava/classpath/native/jni/gtk-peer/gtkpeer.h
@@ -111,15 +111,26 @@ struct graphics
jint x_offset, y_offset;
};
+/* New-style event masks. */
+#define AWT_BUTTON1_DOWN_MASK (1 << 10)
+#define AWT_BUTTON2_DOWN_MASK (1 << 11)
+#define AWT_BUTTON3_DOWN_MASK (1 << 12)
+
#define AWT_SHIFT_DOWN_MASK (1 << 6)
#define AWT_CTRL_DOWN_MASK (1 << 7)
#define AWT_META_DOWN_MASK (1 << 8)
#define AWT_ALT_DOWN_MASK (1 << 9)
+/* Old-style event masks. */
#define AWT_BUTTON1_MASK (1 << 4)
#define AWT_BUTTON2_MASK (1 << 3)
#define AWT_BUTTON3_MASK (1 << 2)
+#define AWT_SHIFT_MASK (1 << 0)
+#define AWT_CTRL_MASK (1 << 1)
+#define AWT_META_MASK (1 << 2)
+#define AWT_ALT_MASK (1 << 3)
+
#define AWT_ITEM_SELECTED 1
#define AWT_ITEM_DESELECTED 2
diff --git a/libjava/classpath/native/jni/java-io/Makefile.am b/libjava/classpath/native/jni/java-io/Makefile.am
index 5ed8a1baf4c..efa7d568839 100644
--- a/libjava/classpath/native/jni/java-io/Makefile.am
+++ b/libjava/classpath/native/jni/java-io/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavaio.la
+nativelib_LTLIBRARIES = libjavaio.la
libjavaio_la_SOURCES = javaio.h \
javaio.c \
diff --git a/libjava/classpath/native/jni/java-io/Makefile.in b/libjava/classpath/native/jni/java-io/Makefile.in
index 17b50e2a8cc..baa6217873c 100644
--- a/libjava/classpath/native/jni/java-io/Makefile.in
+++ b/libjava/classpath/native/jni/java-io/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-io
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
libjavaio_la_DEPENDENCIES = \
$(top_builddir)/native/jni/classpath/jcl.lo
am_libjavaio_la_OBJECTS = javaio.lo java_io_VMFile.lo \
@@ -105,10 +103,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -245,6 +247,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -258,6 +261,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -270,7 +274,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavaio.la
+nativelib_LTLIBRARIES = libjavaio.la
libjavaio_la_SOURCES = javaio.h \
javaio.c \
java_io_VMFile.c \
@@ -314,35 +318,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavaio.la: $(libjavaio_la_OBJECTS) $(libjavaio_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavaio_la_LDFLAGS) $(libjavaio_la_OBJECTS) $(libjavaio_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavaio_la_LDFLAGS) $(libjavaio_la_OBJECTS) $(libjavaio_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -465,7 +469,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -494,7 +498,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -513,9 +517,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -541,20 +545,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/java-lang/Makefile.am b/libjava/classpath/native/jni/java-lang/Makefile.am
index 34ffe00fba7..fb8390f085c 100644
--- a/libjava/classpath/native/jni/java-lang/Makefile.am
+++ b/libjava/classpath/native/jni/java-lang/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
+nativelib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
libjavalang_la_SOURCES = java_lang_VMSystem.c \
java_lang_VMFloat.c \
diff --git a/libjava/classpath/native/jni/java-lang/Makefile.in b/libjava/classpath/native/jni/java-lang/Makefile.in
index 861eb9a86e9..4af83039dc0 100644
--- a/libjava/classpath/native/jni/java-lang/Makefile.in
+++ b/libjava/classpath/native/jni/java-lang/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-lang
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
libjavalang_la_DEPENDENCIES = $(wildcard \
$(top_builddir)/native/fdlibm/*.lo) \
$(top_builddir)/native/jni/classpath/jcl.lo
@@ -110,10 +108,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -250,6 +252,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -263,6 +266,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -275,7 +279,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
+nativelib_LTLIBRARIES = libjavalang.la libjavalangreflect.la
libjavalang_la_SOURCES = java_lang_VMSystem.c \
java_lang_VMFloat.c \
java_lang_VMDouble.c \
@@ -322,37 +326,37 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavalang.la: $(libjavalang_la_OBJECTS) $(libjavalang_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavalang_la_LDFLAGS) $(libjavalang_la_OBJECTS) $(libjavalang_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavalang_la_LDFLAGS) $(libjavalang_la_OBJECTS) $(libjavalang_la_LIBADD) $(LIBS)
libjavalangreflect.la: $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavalangreflect_la_LDFLAGS) $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavalangreflect_la_LDFLAGS) $(libjavalangreflect_la_OBJECTS) $(libjavalangreflect_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -477,7 +481,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -506,7 +510,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -525,9 +529,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -553,20 +557,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c b/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c
index 846df2e6a4f..076f42b86a3 100644
--- a/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMDouble.c
@@ -71,6 +71,11 @@ Java_java_lang_VMDouble_initIDs (JNIEnv * env, jclass cls __attribute__ ((__unus
{
DBG ("unable to get class java.lang.Double\n") return;
}
+ clsDouble = (*env)->NewGlobalRef(env, clsDouble);
+ if (clsDouble == NULL)
+ {
+ DBG ("unable to register class java.lang.Double as global ref\n") return;
+ }
isNaNID = (*env)->GetStaticMethodID (env, clsDouble, "isNaN", "(D)Z");
if (isNaNID == NULL)
{
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c b/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
index c1090ed3736..169c7850172 100644
--- a/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
+++ b/libjava/classpath/native/jni/java-lang/java_lang_VMProcess.c
@@ -1,5 +1,5 @@
/* java_lang_VMProcess.c -- native code for java.lang.VMProcess
- Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -351,7 +351,6 @@ Java_java_lang_VMProcess_nativeSpawn (JNIEnv * env, jobject this,
streams[0], streams[1], streams[2], (jlong) pid);
if ((*env)->ExceptionOccurred (env))
goto done;
- (*env)->DeleteLocalRef (env, clazz);
done:
/*
diff --git a/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c b/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c
index 0bd23c16ffc..64ad202dba1 100644
--- a/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c
+++ b/libjava/classpath/native/jni/java-lang/java_lang_reflect_Array.c
@@ -42,6 +42,7 @@ exception statement from your version. */
* Date: 2 Jun 1998
*/
+#include <config.h>
#include <stddef.h>
#include "java_lang_reflect_Array.h"
diff --git a/libjava/classpath/native/jni/java-net/Makefile.am b/libjava/classpath/native/jni/java-net/Makefile.am
index 3e8c863a9a9..bf7a92bbf00 100644
--- a/libjava/classpath/native/jni/java-net/Makefile.am
+++ b/libjava/classpath/native/jni/java-net/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavanet.la
+nativelib_LTLIBRARIES = libjavanet.la
libjavanet_la_SOURCES = javanet.c \
javanet.h \
diff --git a/libjava/classpath/native/jni/java-net/Makefile.in b/libjava/classpath/native/jni/java-net/Makefile.in
index 590b6d75e25..d1d678ebded 100644
--- a/libjava/classpath/native/jni/java-net/Makefile.in
+++ b/libjava/classpath/native/jni/java-net/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-net
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
libjavanet_la_DEPENDENCIES = \
$(top_builddir)/native/jni/classpath/jcl.lo
am_libjavanet_la_OBJECTS = javanet.lo java_net_VMInetAddress.lo \
@@ -107,10 +105,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -247,6 +249,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -260,6 +263,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -272,7 +276,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavanet.la
+nativelib_LTLIBRARIES = libjavanet.la
libjavanet_la_SOURCES = javanet.c \
javanet.h \
java_net_VMInetAddress.c \
@@ -317,35 +321,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavanet.la: $(libjavanet_la_OBJECTS) $(libjavanet_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavanet_la_LDFLAGS) $(libjavanet_la_OBJECTS) $(libjavanet_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavanet_la_LDFLAGS) $(libjavanet_la_OBJECTS) $(libjavanet_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -469,7 +473,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -498,7 +502,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -517,9 +521,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -545,20 +549,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c b/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c
index d33265cff7e..0ba00d1c3c6 100644
--- a/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c
+++ b/libjava/classpath/native/jni/java-net/java_net_VMInetAddress.c
@@ -181,7 +181,8 @@ Java_java_net_VMInetAddress_getHostByAddr (JNIEnv * env,
sizeof (hostname), result);
if (result != TARGET_NATIVE_OK)
{
- JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION, "Bad IP address");
+ JCL_ThrowException (env, UNKNOWN_HOST_EXCEPTION,
+ TARGET_NATIVE_LAST_ERROR_STRING ());
return (jstring) NULL;
}
diff --git a/libjava/classpath/native/jni/java-net/javanet.c b/libjava/classpath/native/jni/java-net/javanet.c
index fdc1c22ecbf..31afbc86997 100644
--- a/libjava/classpath/native/jni/java-net/javanet.c
+++ b/libjava/classpath/native/jni/java-net/javanet.c
@@ -856,8 +856,12 @@ _javanet_accept (JNIEnv * env, jobject this, jobject impl)
&& (TARGET_NATIVE_LAST_ERROR ()
!= TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL))
{
- JCL_ThrowException (env, IO_EXCEPTION,
- "Internal error: _javanet_accept(): ");
+ if (TARGET_NATIVE_LAST_ERROR () == EAGAIN)
+ JCL_ThrowException (env, "java/net/SocketTimeoutException",
+ "Timeout");
+ else
+ JCL_ThrowException (env, IO_EXCEPTION,
+ TARGET_NATIVE_LAST_ERROR_STRING ());
return;
}
}
@@ -1542,8 +1546,7 @@ _javanet_shutdownInput (JNIEnv * env, jobject this)
/* Shutdown input stream of socket. */
if (shutdown (fd, SHUT_RD) == -1)
{
- JCL_ThrowException (env, SOCKET_EXCEPTION,
- "Can't shutdown input of socket");
+ JCL_ThrowException (env, SOCKET_EXCEPTION, strerror (errno));
return;
}
}
@@ -1568,8 +1571,7 @@ _javanet_shutdownOutput (JNIEnv * env, jobject this)
/* Shutdown output stream of socket. */
if (shutdown (fd, SHUT_WR) == -1)
{
- JCL_ThrowException (env, SOCKET_EXCEPTION,
- "Can't shutdown output of socket");
+ JCL_ThrowException (env, SOCKET_EXCEPTION, strerror (errno));
return;
}
}
diff --git a/libjava/classpath/native/jni/java-nio/Makefile.am b/libjava/classpath/native/jni/java-nio/Makefile.am
index 9785fee6d9b..8fd5ba3aeb5 100644
--- a/libjava/classpath/native/jni/java-nio/Makefile.am
+++ b/libjava/classpath/native/jni/java-nio/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavanio.la
+nativelib_LTLIBRARIES = libjavanio.la
libjavanio_la_SOURCES = gnu_java_nio_VMPipe.c \
gnu_java_nio_VMSelector.c \
diff --git a/libjava/classpath/native/jni/java-nio/Makefile.in b/libjava/classpath/native/jni/java-nio/Makefile.in
index 052a175dc01..a082889c655 100644
--- a/libjava/classpath/native/jni/java-nio/Makefile.in
+++ b/libjava/classpath/native/jni/java-nio/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-nio
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libjavanio_la_DEPENDENCIES = \
$(top_builddir)/native/jni/classpath/jcl.lo \
@@ -112,10 +110,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -252,6 +254,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -265,6 +268,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -277,7 +281,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavanio.la
+nativelib_LTLIBRARIES = libjavanio.la
libjavanio_la_SOURCES = gnu_java_nio_VMPipe.c \
gnu_java_nio_VMSelector.c \
gnu_java_nio_channels_FileChannelImpl.c \
@@ -325,35 +329,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavanio.la: $(libjavanio_la_OBJECTS) $(libjavanio_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavanio_la_LDFLAGS) $(libjavanio_la_OBJECTS) $(libjavanio_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavanio_la_LDFLAGS) $(libjavanio_la_OBJECTS) $(libjavanio_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -479,7 +483,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -508,7 +512,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -527,9 +531,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -555,20 +559,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c b/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
index 2541e81ea44..b82cd2d900f 100644
--- a/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
+++ b/libjava/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
@@ -140,7 +140,7 @@ Java_gnu_java_nio_charset_iconv_IconvDecoder_decode (JNIEnv * env,
if (retval == (size_t) (-1))
{
- if (errno == EILSEQ || errno == EINVAL)
+ if (errno == EILSEQ)
retval = 1;
else
retval = 0;
diff --git a/libjava/classpath/native/jni/java-util/Makefile.am b/libjava/classpath/native/jni/java-util/Makefile.am
index da617f6a2b8..148e9ccbe29 100644
--- a/libjava/classpath/native/jni/java-util/Makefile.am
+++ b/libjava/classpath/native/jni/java-util/Makefile.am
@@ -1,4 +1,4 @@
-pkglib_LTLIBRARIES = libjavautil.la
+nativelib_LTLIBRARIES = libjavautil.la
libjavautil_la_SOURCES = java_util_VMTimeZone.c
diff --git a/libjava/classpath/native/jni/java-util/Makefile.in b/libjava/classpath/native/jni/java-util/Makefile.in
index a347072925c..bc5b3f634ce 100644
--- a/libjava/classpath/native/jni/java-util/Makefile.in
+++ b/libjava/classpath/native/jni/java-util/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/java-util
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -61,9 +59,9 @@ am__vpath_adj = case $$p in \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(pkglibdir)"
-pkglibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(pkglib_LTLIBRARIES)
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
libjavautil_la_LIBADD =
am_libjavautil_la_OBJECTS = java_util_VMTimeZone.lo
libjavautil_la_OBJECTS = $(am_libjavautil_la_OBJECTS)
@@ -103,10 +101,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -243,6 +245,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -256,6 +259,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
@@ -268,7 +272,7 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
vm_classes = @vm_classes@
-pkglib_LTLIBRARIES = libjavautil.la
+nativelib_LTLIBRARIES = libjavautil.la
libjavautil_la_SOURCES = java_util_VMTimeZone.c
AM_LDFLAGS = @CLASSPATH_MODULE@
AM_CPPFLAGS = @CLASSPATH_INCLUDES@
@@ -306,35 +310,35 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(pkglibdir)" || $(mkdir_p) "$(DESTDIR)$(pkglibdir)"
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkglibdir)/$$f'"; \
- $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkglibdir)/$$f"; \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
else :; fi; \
done
-uninstall-pkglibLTLIBRARIES:
+uninstall-nativelibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @set -x; list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
- echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$p'"; \
- $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
done
-clean-pkglibLTLIBRARIES:
- -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
- @list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libjavautil.la: $(libjavautil_la_OBJECTS) $(libjavautil_la_DEPENDENCIES)
- $(LINK) -rpath $(pkglibdir) $(libjavautil_la_LDFLAGS) $(libjavautil_la_OBJECTS) $(libjavautil_la_LIBADD) $(LIBS)
+ $(LINK) -rpath $(nativelibdir) $(libjavautil_la_LDFLAGS) $(libjavautil_la_OBJECTS) $(libjavautil_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -454,7 +458,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
- for dir in "$(DESTDIR)$(pkglibdir)"; do \
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -483,7 +487,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
@@ -502,9 +506,9 @@ info: info-am
info-am:
-install-data-am:
+install-data-am: install-nativelibLTLIBRARIES
-install-exec-am: install-pkglibLTLIBRARIES
+install-exec-am:
install-info: install-info-am
@@ -530,20 +534,20 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-info-am uninstall-pkglibLTLIBRARIES
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-pkglibLTLIBRARIES ctags distclean \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
- install-pkglibLTLIBRARIES install-strip installcheck \
+ install-nativelibLTLIBRARIES install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
- uninstall-pkglibLTLIBRARIES
+ uninstall-nativelibLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/libjava/classpath/native/jni/midi-alsa/.cvsignore b/libjava/classpath/native/jni/midi-alsa/.cvsignore
new file mode 100644
index 00000000000..483b2774465
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/.cvsignore
@@ -0,0 +1,9 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.depsMakefile
+Makefile.in
+Makefile
+.deps
diff --git a/libjava/classpath/native/jni/midi-alsa/Makefile.am b/libjava/classpath/native/jni/midi-alsa/Makefile.am
new file mode 100644
index 00000000000..b6498df2be5
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/Makefile.am
@@ -0,0 +1,11 @@
+nativelib_LTLIBRARIES = libgjsmalsa.la
+
+libgjsmalsa_la_SOURCES = gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c \
+gnu_javax_sound_midi_alsa_AlsaPortDevice.c \
+gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
+
+libgjsmalsa_la_LIBADD = -lasound
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ `pkg-config --cflags-only-I alsa`
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ `pkg-config --cflags-only-other alsa`
diff --git a/libjava/classpath/native/jni/midi-alsa/Makefile.in b/libjava/classpath/native/jni/midi-alsa/Makefile.in
new file mode 100644
index 00000000000..5309d729e14
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/Makefile.in
@@ -0,0 +1,563 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SOURCES = $(libgjsmalsa_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/midi-alsa
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
+ $(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
+libgjsmalsa_la_DEPENDENCIES =
+am_libgjsmalsa_la_OBJECTS = \
+ gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.lo \
+ gnu_javax_sound_midi_alsa_AlsaPortDevice.lo \
+ gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.lo
+libgjsmalsa_la_OBJECTS = $(am_libgjsmalsa_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgjsmalsa_la_SOURCES)
+DIST_SOURCES = $(libgjsmalsa_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FIND = @FIND@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GJDOC = @GJDOC@
+GTK_CAIRO_ENABLED = @GTK_CAIRO_ENABLED@
+GTK_CAIRO_FALSE = @GTK_CAIRO_FALSE@
+GTK_CAIRO_TRUE = @GTK_CAIRO_TRUE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+VERSION = @VERSION@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+vm_classes = @vm_classes@
+nativelib_LTLIBRARIES = libgjsmalsa.la
+libgjsmalsa_la_SOURCES = gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c \
+gnu_javax_sound_midi_alsa_AlsaPortDevice.c \
+gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
+
+libgjsmalsa_la_LIBADD = -lasound
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@ `pkg-config --cflags-only-I alsa`
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@ `pkg-config --cflags-only-other alsa`
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu native/jni/midi-alsa/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu native/jni/midi-alsa/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-nativelibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
+ done
+
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgjsmalsa.la: $(libgjsmalsa_la_OBJECTS) $(libgjsmalsa_la_DEPENDENCIES)
+ $(LINK) -rpath $(nativelibdir) $(libgjsmalsa_la_LDFLAGS) $(libgjsmalsa_la_OBJECTS) $(libgjsmalsa_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_alsa_AlsaPortDevice.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-nativelibLTLIBRARIES
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-nativelibLTLIBRARIES install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-nativelibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
new file mode 100644
index 00000000000..f740b276a60
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
@@ -0,0 +1,148 @@
+/* gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.c
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+#include <config.h>
+#include <gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider.h>
+
+#include <alsa/asoundlib.h>
+
+static snd_seq_t *seq;
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_init_1
+(JNIEnv *env __attribute__((unused)), jobject this __attribute__((unused)))
+{
+ int rc = snd_seq_open (&seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK);
+ if (rc < 0)
+ abort ();
+ snd_seq_set_client_name(seq, "gnu.javax.sound.midi.alsa");
+}
+
+/**
+ * Return a CLAZZ[] filled with ports matching TYPE.
+ */
+static jobjectArray
+getPortDeviceInfo (JNIEnv *env, unsigned type, const char *clazz)
+{
+ jobjectArray rarray;
+ snd_seq_client_info_t *cinfo;
+ snd_seq_port_info_t *pinfo;
+ int client;
+ int count = 0;
+ jclass icls;
+ jmethodID mid;
+
+ snd_seq_client_info_alloca(&cinfo);
+ snd_seq_port_info_alloca(&pinfo);
+
+ /* First, count the number of input devices. */
+ snd_seq_client_info_set_client (cinfo, -1);
+ while (snd_seq_query_next_client (seq, cinfo) >= 0)
+ {
+ client = snd_seq_client_info_get_client (cinfo);
+ if (client == 0)
+ continue;
+ snd_seq_port_info_set_client (pinfo, client);
+ snd_seq_port_info_set_port (pinfo, -1);
+ while (snd_seq_query_next_port (seq, pinfo) >= 0)
+ {
+ if ((snd_seq_port_info_get_capability (pinfo) & type) != type)
+ continue;
+ count++;
+ }
+ }
+
+ icls = (*env)->FindClass(env, clazz);
+ mid = (*env)->GetMethodID(env, icls, "<init>",
+ "(Ljava/lang/String;Ljava/lang/String;JJ)V");
+
+ rarray = (jobjectArray) (*env)->NewObjectArray(env, count, icls, NULL);
+
+ /* Now, populate our array. */
+ count = 0;
+ snd_seq_client_info_set_client (cinfo, -1);
+ while (snd_seq_query_next_client (seq, cinfo) >= 0)
+ {
+ const char *client_name;
+ client = snd_seq_client_info_get_client (cinfo);
+ if (client == 0)
+ continue;
+ snd_seq_port_info_set_client (pinfo, client);
+ snd_seq_port_info_set_port (pinfo, -1);
+
+ client_name = snd_seq_client_info_get_name (cinfo);
+
+ while (snd_seq_query_next_port (seq, pinfo) >= 0)
+ {
+ const char *port_name;
+
+ if ((snd_seq_port_info_get_capability (pinfo) & type) != type)
+ continue;
+
+ port_name = snd_seq_port_info_get_name (pinfo);
+
+ (*env)->SetObjectArrayElement(env, rarray, count,
+ (*env)->NewObject (env, icls, mid,
+ (*env)->NewStringUTF (env, client_name),
+ (*env)->NewStringUTF (env, port_name),
+ (jlong) snd_seq_port_info_get_client(pinfo),
+ (jlong) snd_seq_port_info_get_port(pinfo)));
+ count++;
+ }
+ }
+
+ return rarray;
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getInputDeviceInfo_1
+ (JNIEnv *env, jobject this __attribute__((unused)))
+{
+ return getPortDeviceInfo (env,
+ (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ),
+ "gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider$AlsaInputPortInfo");
+}
+
+JNIEXPORT jobjectArray JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiDeviceProvider_getOutputDeviceInfo_1
+ (JNIEnv *env, jobject this __attribute__((unused)))
+{
+ return getPortDeviceInfo (env,
+ (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE),
+ "gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider$AlsaOutputPortInfo");
+}
+
diff --git a/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c
new file mode 100644
index 00000000000..6e079d36c0e
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c
@@ -0,0 +1,59 @@
+/* gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.c
+ Copyright (C) 2005
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+#include <gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice.h>
+
+JNIEXPORT jlong JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_open_1
+ (JNIEnv *env __attribute__((unused)), jobject this __attribute__((unused)))
+{
+ /* Nothing yet. */
+ return 555;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaMidiSequencerDevice_close_1
+ (JNIEnv *env __attribute__((unused)),
+ jobject this __attribute__((unused)), jlong s __attribute__((unused)))
+{
+ /* Nothing. */
+}
+
+
diff --git a/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c
new file mode 100644
index 00000000000..f4f8dd84a06
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c
@@ -0,0 +1,150 @@
+/* gnu_javax_sound_midi_alsa_AlsaPortDevice.c - Native support
+ Copyright (C) 2005
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <config.h>
+#include <gnu_javax_sound_midi_alsa_AlsaPortDevice.h>
+#include <unistd.h>
+
+#include <alsa/asoundlib.h>
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1
+ (JNIEnv *env, jobject this __attribute__((unused)),
+ jlong client, jlong port, jobject receiver)
+{
+ int rc;
+ snd_seq_port_info_t *pinfo, *sinfo;
+ snd_seq_port_subscribe_t *subs;
+ snd_seq_addr_t sender, dest;
+ snd_seq_t *seq;
+
+ snd_seq_port_info_alloca (&pinfo);
+ snd_seq_port_info_alloca (&sinfo);
+ snd_seq_port_subscribe_alloca (&subs);
+
+ rc = snd_seq_open (&seq, "default", SND_SEQ_OPEN_DUPLEX, SND_SEQ_NONBLOCK);
+
+ snd_seq_port_info_set_capability (pinfo, SND_SEQ_PORT_CAP_WRITE);
+ snd_seq_port_info_set_type (pinfo, SND_SEQ_PORT_TYPE_MIDI_GENERIC);
+
+ rc = snd_seq_create_port (seq, pinfo);
+
+ sender.client = (int) client;
+ sender.port = (int) port;
+ dest.client = snd_seq_port_info_get_client(pinfo);
+ dest.port = snd_seq_port_info_get_port(pinfo);
+
+ snd_seq_port_subscribe_set_sender (subs, &sender);
+ snd_seq_port_subscribe_set_dest (subs, &dest);
+ rc = snd_seq_subscribe_port(seq, subs);
+
+ {
+ int npfd;
+ struct pollfd *pfd;
+ jclass smcls, rcls;
+ jmethodID sminit, rsend;
+ jbyteArray mba;
+ jbyte *ba;
+ jobject msg;
+ jlong jtimestamp;
+
+ npfd = snd_seq_poll_descriptors_count (seq, POLLIN);
+ pfd = (struct pollfd *) alloca (npfd * sizeof (struct pollfd));
+ snd_seq_poll_descriptors (seq, pfd, npfd, POLLIN);
+
+ smcls = (*env)->FindClass(env, "javax/sound/midi/ShortMessage");
+ sminit = (*env)->GetMethodID(env, smcls, "<init>", "([B)V");
+
+ rcls = (*env)->FindClass(env, "javax/sound/midi/Receiver");
+ rsend = (*env)->GetMethodID(env, rcls, "send", "(Ljavax/sound/midi/MidiMessage;J)V");
+
+ while (1)
+ {
+ if (poll (pfd, npfd, 100000) > 0)
+ {
+ snd_seq_event_t *ev;
+
+ do
+ {
+ snd_seq_event_input (seq, &ev);
+
+ if ((ev->flags & SND_SEQ_TIME_STAMP_MASK) == SND_SEQ_TIME_STAMP_TICK)
+ jtimestamp = (jlong) ev->time.tick;
+ else
+ jtimestamp = (jlong) ev->time.time.tv_sec * (jlong) 1000000000
+ + (jlong) ev->time.time.tv_nsec;
+
+ switch (ev->type)
+ {
+ case SND_SEQ_EVENT_NOTEON:
+ mba = (*env)->NewByteArray (env, 3);
+ ba = (*env)->GetByteArrayElements (env, mba, 0);
+ ba[0] = 0x90 + ev->data.control.channel;
+ ba[1] = ev->data.note.note;
+ ba[2] = ev->data.note.velocity;
+ (*env)->ReleaseByteArrayElements (env, mba, ba, 0);
+ msg = (*env)->NewObject(env, smcls, sminit, mba);
+ (*env)->CallObjectMethod(env, receiver,
+ rsend, msg, jtimestamp);
+ break;
+
+ case SND_SEQ_EVENT_CONTROLLER:
+ mba = (*env)->NewByteArray (env, 3);
+ ba = (*env)->GetByteArrayElements (env, mba, 0);
+ ba[0] = 0xB0 + ev->data.control.channel;
+ ba[1] = ev->data.control.param;
+ ba[2] = ev->data.control.value;
+ (*env)->ReleaseByteArrayElements (env, mba, ba, 0);
+ msg = (*env)->NewObject(env, smcls, sminit, mba);
+ (*env)->CallObjectMethod(env, receiver,
+ rsend, msg, jtimestamp);
+ break;
+
+ default:
+ printf ("UNKNOWN EVENT 0x%x\n", ev->type);
+ break;
+ }
+
+ snd_seq_free_event(ev);
+ }
+ while (snd_seq_event_input_pending (seq, 0) > 0);
+ }
+ }
+ }
+}
diff --git a/libjava/classpath/native/jni/midi-dssi/.cvsignore b/libjava/classpath/native/jni/midi-dssi/.cvsignore
new file mode 100644
index 00000000000..ac18ca27297
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/.cvsignore
@@ -0,0 +1,9 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.depsMakefile
+Makefile.in
+.deps
+Makefile
diff --git a/libjava/classpath/native/jni/midi-dssi/Makefile.am b/libjava/classpath/native/jni/midi-dssi/Makefile.am
new file mode 100644
index 00000000000..6b1ef0407aa
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/Makefile.am
@@ -0,0 +1,11 @@
+nativelib_LTLIBRARIES = libgjsmdssi.la
+
+libgjsmdssi_la_SOURCES = gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c \
+ gnu_javax_sound_midi_dssi_DSSISynthesizer.c \
+ dssi_data.h
+
+libgjsmdssi_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo -ljack
+
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
diff --git a/libjava/classpath/native/jni/midi-dssi/Makefile.in b/libjava/classpath/native/jni/midi-dssi/Makefile.in
new file mode 100644
index 00000000000..c3b4b7ef007
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/Makefile.in
@@ -0,0 +1,562 @@
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+SOURCES = $(libgjsmdssi_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = native/jni/midi-dssi
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
+ $(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(nativelibdir)"
+nativelibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(nativelib_LTLIBRARIES)
+libgjsmdssi_la_DEPENDENCIES = \
+ $(top_builddir)/native/jni/classpath/jcl.lo
+am_libgjsmdssi_la_OBJECTS = \
+ gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.lo \
+ gnu_javax_sound_midi_dssi_DSSISynthesizer.lo
+libgjsmdssi_la_OBJECTS = $(am_libgjsmdssi_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgjsmdssi_la_SOURCES)
+DIST_SOURCES = $(libgjsmdssi_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
+BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLASSPATH_INCLUDES = @CLASSPATH_INCLUDES@
+CLASSPATH_MODULE = @CLASSPATH_MODULE@
+CP = @CP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
+CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
+CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
+CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
+CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
+CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
+CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
+CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
+CREATE_JNI_HEADERS_TRUE = @CREATE_JNI_HEADERS_TRUE@
+CREATE_JNI_LIBRARIES_FALSE = @CREATE_JNI_LIBRARIES_FALSE@
+CREATE_JNI_LIBRARIES_TRUE = @CREATE_JNI_LIBRARIES_TRUE@
+CREATE_QT_PEER_LIBRARIES_FALSE = @CREATE_QT_PEER_LIBRARIES_FALSE@
+CREATE_QT_PEER_LIBRARIES_TRUE = @CREATE_QT_PEER_LIBRARIES_TRUE@
+CREATE_XMLJ_LIBRARY_FALSE = @CREATE_XMLJ_LIBRARY_FALSE@
+CREATE_XMLJ_LIBRARY_TRUE = @CREATE_XMLJ_LIBRARY_TRUE@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATE = @DATE@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+ECJ = @ECJ@
+EGREP = @EGREP@
+ERROR_CFLAGS = @ERROR_CFLAGS@
+EXAMPLESDIR = @EXAMPLESDIR@
+EXEEXT = @EXEEXT@
+FIND = @FIND@
+FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
+FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
+FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
+FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
+FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
+FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
+FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
+FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
+FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
+GCJ = @GCJ@
+GCJX = @GCJX@
+GJDOC = @GJDOC@
+GTK_CAIRO_ENABLED = @GTK_CAIRO_ENABLED@
+GTK_CAIRO_FALSE = @GTK_CAIRO_FALSE@
+GTK_CAIRO_TRUE = @GTK_CAIRO_TRUE@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
+INSTALL_CLASS_FILES_FALSE = @INSTALL_CLASS_FILES_FALSE@
+INSTALL_CLASS_FILES_TRUE = @INSTALL_CLASS_FILES_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_GLIBJ_ZIP_FALSE = @INSTALL_GLIBJ_ZIP_FALSE@
+INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
+JAY = @JAY@
+JAY_SKELETON = @JAY_SKELETON@
+JIKES = @JIKES@
+JIKESENCODING = @JIKESENCODING@
+KJC = @KJC@
+LDFLAGS = @LDFLAGS@
+LIBDEBUG = @LIBDEBUG@
+LIBICONV = @LIBICONV@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBVERSION = @LIBVERSION@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MKDIR = @MKDIR@
+MOC = @MOC@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PANGOFT2_CFLAGS = @PANGOFT2_CFLAGS@
+PANGOFT2_LIBS = @PANGOFT2_LIBS@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
+REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
+REMOVE = @REMOVE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
+STRIP = @STRIP@
+USER_CLASSLIB = @USER_CLASSLIB@
+USER_JAVAH = @USER_JAVAH@
+USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
+USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
+USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
+USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
+VERSION = @VERSION@
+WARNING_CFLAGS = @WARNING_CFLAGS@
+XML_CFLAGS = @XML_CFLAGS@
+XML_LIBS = @XML_LIBS@
+XSLT_CFLAGS = @XSLT_CFLAGS@
+XSLT_LIBS = @XSLT_LIBS@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+ZIP = @ZIP@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+default_toolkit = @default_toolkit@
+exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+vm_classes = @vm_classes@
+nativelib_LTLIBRARIES = libgjsmdssi.la
+libgjsmdssi_la_SOURCES = gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c \
+ gnu_javax_sound_midi_dssi_DSSISynthesizer.c \
+ dssi_data.h
+
+libgjsmdssi_la_LIBADD = $(top_builddir)/native/jni/classpath/jcl.lo -ljack
+AM_LDFLAGS = @CLASSPATH_MODULE@
+AM_CPPFLAGS = @CLASSPATH_INCLUDES@
+AM_CFLAGS = @WARNING_CFLAGS@ @STRICT_WARNING_CFLAGS@ @ERROR_CFLAGS@
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu native/jni/midi-dssi/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu native/jni/midi-dssi/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-nativelibLTLIBRARIES: $(nativelib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(nativelibdir)" || $(mkdir_p) "$(DESTDIR)$(nativelibdir)"
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(nativelibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(nativelibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(nativelibdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-nativelibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(nativelibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(nativelibdir)/$$p"; \
+ done
+
+clean-nativelibLTLIBRARIES:
+ -test -z "$(nativelib_LTLIBRARIES)" || rm -f $(nativelib_LTLIBRARIES)
+ @list='$(nativelib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libgjsmdssi.la: $(libgjsmdssi_la_OBJECTS) $(libgjsmdssi_la_DEPENDENCIES)
+ $(LINK) -rpath $(nativelibdir) $(libgjsmdssi_la_LDFLAGS) $(libgjsmdssi_la_OBJECTS) $(libgjsmdssi_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnu_javax_sound_midi_dssi_DSSISynthesizer.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(nativelibdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-nativelibLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-nativelibLTLIBRARIES
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nativelibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-nativelibLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-nativelibLTLIBRARIES install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-nativelibLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libjava/classpath/native/jni/midi-dssi/README b/libjava/classpath/native/jni/midi-dssi/README
new file mode 100644
index 00000000000..6913414ffa6
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/README
@@ -0,0 +1,134 @@
+The file native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
+contains two functions (get_port_default and set_control) derived from
+example code in the DSSI distribution (http://dssi.sourceforge.net).
+The original DSSI example code is distributed under the following
+terms:
+
+ Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton.
+
+ Permission to use, copy, modify, distribute, and sell this software
+ for any purpose is hereby granted without fee, provided that the
+ above copyright notice and this permission notice are included in
+ all copies or substantial portions of the software.
+
+
+The rest of this file contain the original versions of these
+functions.
+
+
+LADSPA_Data get_port_default(const LADSPA_Descriptor *plugin, int port)
+{
+ LADSPA_PortRangeHint hint = plugin->PortRangeHints[port];
+ float lower = hint.LowerBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+ float upper = hint.UpperBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+
+ if (!LADSPA_IS_HINT_HAS_DEFAULT(hint.HintDescriptor)) {
+ if (!LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) ||
+ !LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) {
+ /* No hint, its not bounded, wild guess */
+ return 0.0f;
+ }
+
+ if (lower <= 0.0f && upper >= 0.0f) {
+ /* It spans 0.0, 0.0 is often a good guess */
+ return 0.0f;
+ }
+
+ /* No clues, return minimum */
+ return lower;
+ }
+
+ /* Try all the easy ones */
+
+ if (LADSPA_IS_HINT_DEFAULT_0(hint.HintDescriptor)) {
+ return 0.0f;
+ } else if (LADSPA_IS_HINT_DEFAULT_1(hint.HintDescriptor)) {
+ return 1.0f;
+ } else if (LADSPA_IS_HINT_DEFAULT_100(hint.HintDescriptor)) {
+ return 100.0f;
+ } else if (LADSPA_IS_HINT_DEFAULT_440(hint.HintDescriptor)) {
+ return 440.0f;
+ }
+
+ /* All the others require some bounds */
+
+ if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) {
+ if (LADSPA_IS_HINT_DEFAULT_MINIMUM(hint.HintDescriptor)) {
+ return lower;
+ }
+ }
+ if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor)) {
+ if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hint.HintDescriptor)) {
+ return upper;
+ }
+ if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)) {
+ if (LADSPA_IS_HINT_DEFAULT_LOW(hint.HintDescriptor)) {
+ return lower * 0.75f + upper * 0.25f;
+ } else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hint.HintDescriptor)) {
+ return lower * 0.5f + upper * 0.5f;
+ } else if (LADSPA_IS_HINT_DEFAULT_HIGH(hint.HintDescriptor)) {
+ return lower * 0.25f + upper * 0.75f;
+ }
+ }
+ }
+
+ /* fallback */
+ return 0.0f;
+}
+
+
+void
+setControl(d3h_instance_t *instance, long controlIn, snd_seq_event_t *event)
+{
+ long port = pluginControlInPortNumbers[controlIn];
+
+ const LADSPA_Descriptor *p = instance->plugin->descriptor->LADSPA_Plugin;
+
+ LADSPA_PortRangeHintDescriptor d = p->PortRangeHints[port].HintDescriptor;
+
+ LADSPA_Data lb = p->PortRangeHints[port].LowerBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+ sample_rate : 1.0f);
+
+ LADSPA_Data ub = p->PortRangeHints[port].UpperBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+ sample_rate : 1.0f);
+
+ float value = (float)event->data.control.value;
+
+ if (!LADSPA_IS_HINT_BOUNDED_BELOW(d)) {
+ if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) {
+ /* unbounded: might as well leave the value alone. */
+ } else {
+ /* bounded above only. just shift the range. */
+ value = ub - 127.0f + value;
+ }
+ } else {
+ if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d)) {
+ /* bounded below only. just shift the range. */
+ value = lb + value;
+ } else {
+ /* bounded both ends. more interesting. */
+ if (LADSPA_IS_HINT_LOGARITHMIC(d)) {
+ const float llb = logf(lb);
+ const float lub = logf(ub);
+
+ value = expf(llb + ((lub - llb) * value / 127.0f));
+ } else {
+ value = lb + ((ub - lb) * value / 127.0f);
+ }
+ }
+ }
+
+ if (verbose) {
+ printf("%s: %s MIDI controller %d=%d -> control in %ld=%f\n", myName,
+ instance->friendly_name, event->data.control.param,
+ event->data.control.value, controlIn, value);
+ }
+
+ pluginControlIns[controlIn] = value;
+ pluginPortUpdated[controlIn] = 1;
+}
+
diff --git a/libjava/classpath/native/jni/midi-dssi/dssi_data.h b/libjava/classpath/native/jni/midi-dssi/dssi_data.h
new file mode 100644
index 00000000000..8278f7b9e18
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/dssi_data.h
@@ -0,0 +1,121 @@
+/* dssi_data.h - DSSI data
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+#include <jni.h>
+#include <dssi.h>
+#include <jack/jack.h>
+#include <alsa/asoundlib.h>
+#include <alsa/seq.h>
+
+#include <stdio.h>
+
+#include "target_native.h"
+#include "target_native_misc.h"
+#include "../classpath/jcl.h"
+
+/* Specify the size of the circular buffer. It only needs to be big
+ enough to hold the events that happen between jack callbacks (~
+ 1/40th of a second). */
+#define EVENT_BUFFER_SIZE 1024
+
+/* Helper macros for going between pointers and jlongs. */
+#define JLONG_TO_PTR(T,P) ((T *)(long)P)
+#define PTR_TO_JLONG(P) ((jlong)(long)P)
+
+
+/* Every DSSI Synthesizer has one of these associated with it. The
+ Java class sees it as a "long" handle. */
+
+typedef struct
+{
+ /* This is a handle to the dlopen'ed .so file containing the DSSI
+ synthesizer. */
+ void *dlhandle;
+
+ /* The function to call to get the DSS_Descriptor. */
+ DSSI_Descriptor_Function fn;
+
+ /* The descriptor for this synthesizer. See the dssi.h system
+ header. */
+ const DSSI_Descriptor *desc;
+
+ /* We currently open a jack client connection for every
+ synthesizer. */
+ jack_client_t *jack_client;
+
+ /* We currently only handle stereo jack connections. Output from
+ mono synthesizers is sent to both left and right ports. */
+ jack_port_t *jack_left_output_port;
+ jack_port_t *jack_right_output_port;
+
+ /* We use a circular buffer to hold MIDI events before processing
+ them in the jack audio processing callback function. */
+ snd_seq_event_t midiEventBuffer[EVENT_BUFFER_SIZE];
+ int midiEventReadIndex;
+ int midiEventWriteIndex;
+
+ /* This is a handle the synthesizers underlying LADSPA structure.
+ See the ladspa.h system header for details. */
+ LADSPA_Handle plugin_handle;
+
+ /* These are buffers we pass to the DSSI Synthesizer for
+ filling. */
+ float *left_buffer;
+ float *right_buffer;
+
+ /* The number of input controls for this synth. */
+ unsigned control_count;
+
+ /* An array of control values, control_count in length. */
+ LADSPA_Data *control_values;
+
+ /* A mapping of MIDI controllers to control values. There are a
+ maximum of 128 MIDI controllers. */
+ unsigned control_value_map[128];
+
+ /* A mapping of MIDI controllers to LADSPA ports. There are a
+ maximum of 128 MIDI controllers. */
+ unsigned control_port_map[128];
+
+ /* The sample rate. */
+ jack_nframes_t sample_rate;
+
+} dssi_data;
+
diff --git a/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c
new file mode 100644
index 00000000000..3cad45931bb
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c
@@ -0,0 +1,139 @@
+/* gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.c - DSSI Provider
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <config.h>
+#include <gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider.h>
+
+#include "dssi_data.h"
+
+void
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlclose_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong sohandle)
+{
+ dssi_data *data = (dssi_data *) (long) sohandle;
+ dlclose (data->dlhandle);
+ JCL_free (env, data);
+}
+
+jlong
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_dlopen_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jstring name)
+{
+ const char *filename;
+ void *handle;
+ DSSI_Descriptor_Function fn;
+ dssi_data *data = 0;
+
+ filename = JCL_jstring_to_cstring (env, name);
+ if (filename == NULL)
+ return (0);
+
+ handle = dlopen(filename, RTLD_NOW);
+
+ if (handle == 0)
+ goto done;
+
+ fn = (DSSI_Descriptor_Function) dlsym(handle, "dssi_descriptor");
+
+ if (fn == 0)
+ {
+ dlclose(handle);
+ goto done;
+ }
+
+ data = (dssi_data *) JCL_malloc(env, sizeof(dssi_data));
+ data->dlhandle = handle;
+ data->fn = fn;
+ data->midiEventReadIndex = 0;
+ data->midiEventWriteIndex = 0;
+
+ done:
+ JCL_free_cstring (env, name, filename);
+ return PTR_TO_JLONG(data);
+}
+
+jlong
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIHandle_1
+ (JNIEnv *env __attribute__((unused)),
+ jclass clazz __attribute__((unused)), jlong handle, jlong index)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+ data->desc = (data->fn)(index);
+ return PTR_TO_JLONG(data->desc);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIName_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+ const char *str = desc->LADSPA_Plugin->Name;
+
+ return (*env)->NewStringUTF (env, str);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSICopyright_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+ const char *str = desc->LADSPA_Plugin->Copyright;
+
+ return (*env)->NewStringUTF (env, str);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSIVendor_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+ const char *str = desc->LADSPA_Plugin->Maker;
+
+ return (*env)->NewStringUTF (env, str);
+}
+
+jstring
+Java_gnu_javax_sound_midi_dssi_DSSIMidiDeviceProvider_getDSSILabel_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ DSSI_Descriptor *desc = JLONG_TO_PTR(DSSI_Descriptor,handle);
+ const char *str = desc->LADSPA_Plugin->Label;
+
+ return (*env)->NewStringUTF (env, str);
+}
+
+
diff --git a/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
new file mode 100644
index 00000000000..ec1477ec8db
--- /dev/null
+++ b/libjava/classpath/native/jni/midi-dssi/gnu_javax_sound_midi_dssi_DSSISynthesizer.c
@@ -0,0 +1,584 @@
+/* gnu_javax_sound_midi_dssi_DSSISynthesizer.c - DSSI Synth
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* The original get_port_default() and set_control() routines were
+ * copied from the DSSI source distribution and are covered by the
+ * following copyright and license...
+ *
+ * Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * for any purpose is hereby granted without fee, provided that the
+ * above copyright notice and this permission notice are included in
+ * all copies or substantial portions of the software.
+ */
+
+#include <config.h>
+#include <gnu_javax_sound_midi_dssi_DSSISynthesizer.h>
+#include <math.h>
+
+#include "dssi_data.h"
+
+/* Define this for debug output. */
+#undef DEBUG_DSSI_PROVIDER
+
+static void set_control (dssi_data *data, snd_seq_event_t *event);
+
+
+/**
+ * The jack callback routine.
+ *
+ * This function is called by the jack audio system in its own thread
+ * whenever it needs new audio data.
+ *
+ */
+static int
+process (jack_nframes_t nframes, void *arg)
+{
+ dssi_data *data = (dssi_data *) arg;
+ int index;
+ jack_default_audio_sample_t *buffer;
+
+ /* Look through the event buffer to see if any control values
+ need changing. */
+ for ( index = data->midiEventReadIndex;
+ index != data->midiEventWriteIndex;
+ index = (index + 1) % EVENT_BUFFER_SIZE)
+ {
+ if (data->midiEventBuffer[index].type == SND_SEQ_EVENT_CONTROLLER)
+ set_control (data, & data->midiEventBuffer[index]);
+ }
+
+ if (data->desc->run_synth)
+ {
+ /* Call the synth audio processing routine. */
+ data->desc->run_synth
+ (data->plugin_handle,
+ nframes,
+ &data->midiEventBuffer[data->midiEventReadIndex],
+ data->midiEventWriteIndex - data->midiEventReadIndex);
+ }
+ else
+ if (data->desc->run_multiple_synths)
+ {
+ snd_seq_event_t *events =
+ &data->midiEventBuffer[data->midiEventReadIndex];
+ unsigned long event_count =
+ data->midiEventWriteIndex - data->midiEventReadIndex;
+
+ /* Call the synth audio processing routine. */
+ data->desc->run_multiple_synths
+ (1,
+ & (data->plugin_handle),
+ nframes,
+ &events,
+ &event_count);
+ }
+
+ /* Update the read index on our circular buffer. */
+ data->midiEventReadIndex = data->midiEventWriteIndex;
+
+ /* Copy output from the synth to jack.
+
+ FIXME: This is hack that only gets one channel from the synth and
+ send that to both jack ports (until we handle stero synths
+ properly).
+
+ FIXME: Can we avoid this copying? */
+ buffer = jack_port_get_buffer(data->jack_left_output_port, nframes);
+ memcpy (buffer, data->left_buffer, nframes * sizeof(LADSPA_Data));
+ buffer = jack_port_get_buffer(data->jack_right_output_port, nframes);
+ memcpy (buffer, data->left_buffer, nframes * sizeof(LADSPA_Data));
+
+ return 0;
+}
+
+
+/**
+ * Calculate a reasonable default value for a specific control port.
+ * This is mostly copied from the DSSI example code. Copyright info
+ * is found at the top of this file.
+ *
+ */
+static LADSPA_Data
+get_port_default (const LADSPA_Descriptor *plugin,
+ int port, jack_nframes_t sample_rate)
+{
+ LADSPA_PortRangeHint hint = plugin->PortRangeHints[port];
+ float lower = hint.LowerBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+ float upper = hint.UpperBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(hint.HintDescriptor) ? sample_rate : 1.0f);
+
+ if (!LADSPA_IS_HINT_HAS_DEFAULT(hint.HintDescriptor))
+ {
+ if (!LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) ||
+ !LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
+ {
+ /* No hint, its not bounded, wild guess */
+ return 0.0f;
+ }
+
+ if (lower <= 0.0f && upper >= 0.0f)
+ {
+ /* It spans 0.0, 0.0 is often a good guess */
+ return 0.0f;
+ }
+
+ /* No clues, return minimum */
+ return lower;
+ }
+
+ /* Try all the easy ones */
+
+ if (LADSPA_IS_HINT_DEFAULT_0(hint.HintDescriptor))
+ return 0.0f;
+ else if (LADSPA_IS_HINT_DEFAULT_1(hint.HintDescriptor))
+ return 1.0f;
+ else if (LADSPA_IS_HINT_DEFAULT_100(hint.HintDescriptor))
+ return 100.0f;
+ else if (LADSPA_IS_HINT_DEFAULT_440(hint.HintDescriptor))
+ return 440.0f;
+
+ /* All the others require some bounds */
+
+ if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor)
+ && (LADSPA_IS_HINT_DEFAULT_MINIMUM(hint.HintDescriptor)))
+ return lower;
+
+ if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor))
+ {
+ if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(hint.HintDescriptor))
+ return upper;
+
+ if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor))
+ {
+ if (LADSPA_IS_HINT_DEFAULT_LOW(hint.HintDescriptor))
+ return lower * 0.75f + upper * 0.25f;
+ else if (LADSPA_IS_HINT_DEFAULT_MIDDLE(hint.HintDescriptor))
+ return lower * 0.5f + upper * 0.5f;
+ else if (LADSPA_IS_HINT_DEFAULT_HIGH(hint.HintDescriptor))
+ return lower * 0.25f + upper * 0.75f;
+ }
+ }
+
+ /* fallback */
+ return 0.0f;
+}
+
+/**
+ * Set a control value by mapping the MIDI event to a suitable value
+ * for this control.
+ * This is mostly copied from the DSSI example code. Copyright info
+ * is found at the top of this file.
+ *
+ */
+static void
+set_control(dssi_data *data, snd_seq_event_t *event)
+{
+ unsigned control = event->data.control.param;
+ unsigned port = data->control_port_map[control];
+
+ const LADSPA_Descriptor *p = data->desc->LADSPA_Plugin;
+
+ LADSPA_PortRangeHintDescriptor d = p->PortRangeHints[port].HintDescriptor;
+
+ LADSPA_Data lb = p->PortRangeHints[port].LowerBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+ data->sample_rate : 1.0f);
+
+ LADSPA_Data ub = p->PortRangeHints[port].UpperBound *
+ (LADSPA_IS_HINT_SAMPLE_RATE(p->PortRangeHints[port].HintDescriptor) ?
+ data->sample_rate : 1.0f);
+
+ float value = (float)event->data.control.value;
+
+ if (!LADSPA_IS_HINT_BOUNDED_BELOW(d))
+ {
+ if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d))
+ {
+ /* unbounded: might as well leave the value alone. */
+ }
+ else
+ {
+ /* bounded above only. just shift the range. */
+ value = ub - 127.0f + value;
+ }
+ }
+ else
+ {
+ if (!LADSPA_IS_HINT_BOUNDED_ABOVE(d))
+ {
+ /* bounded below only. just shift the range. */
+ value = lb + value;
+ }
+ else
+ {
+ /* bounded both ends. more interesting. */
+ if (LADSPA_IS_HINT_LOGARITHMIC(d))
+ {
+ const float llb = logf(lb);
+ const float lub = logf(ub);
+
+ value = expf(llb + ((lub - llb) * value / 127.0f));
+ }
+ else
+ {
+ value = lb + ((ub - lb) * value / 127.0f);
+ }
+ }
+ }
+
+#ifdef DEBUG_DSSI_PROVIDER
+ printf("MIDI controller %d=%d -> control in %u=%f\n",
+ event->data.control.param,
+ event->data.control.value,
+ data->control_value_map[control], value);
+#endif
+
+ data->control_values[data->control_value_map[control]] = value;
+}
+
+/**
+ * Open a new synthesizer. This currently involves instantiating a
+ * new synth, creating a new jack client connection, and activating
+ * both.
+ *
+ */
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_open_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)), jlong handle)
+{
+ unsigned int port_count, j, cindex;
+ const char **ports;
+ int controller = 0;
+ dssi_data *data = (dssi_data *) (long) handle;
+ if ((data->jack_client = jack_client_new (data->desc->LADSPA_Plugin->Label)) == 0)
+ {
+ /* JCL_ThrowException (env, "javax/sound/midi/MidiUnavailableException", */
+ JCL_ThrowException (env, "java/io/IOException",
+ "can't create jack client");
+ return;
+ }
+
+ /* Get the jack sample rate, which may be used in default control port
+ value calculations. */
+ data->sample_rate = jack_get_sample_rate (data->jack_client);
+
+ data->plugin_handle =
+ (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin,
+ data->sample_rate);
+
+ if (jack_set_process_callback (data->jack_client, process, data) != 0)
+ {
+ JCL_ThrowException (env, "java/io/IOException",
+ "can't set jack process callback");
+ return;
+ }
+
+ data->jack_left_output_port =
+ jack_port_register (data->jack_client, "output_left",
+ JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+ data->jack_right_output_port =
+ jack_port_register (data->jack_client, "output_right",
+ JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+
+ /* Count the number of controls and audio ouput ports. */
+ port_count = data->control_count = 0;
+ for (j = 0; j < data->desc->LADSPA_Plugin->PortCount; j++)
+ {
+ LADSPA_PortDescriptor pod =
+ data->desc->LADSPA_Plugin->PortDescriptors[j];
+
+ if (LADSPA_IS_PORT_AUDIO(pod) && LADSPA_IS_PORT_OUTPUT(pod))
+ port_count++;
+ else if (LADSPA_IS_PORT_CONTROL(pod) && LADSPA_IS_PORT_INPUT(pod))
+ data->control_count++;
+ }
+
+ /* Allocate the array of control values. */
+ data->control_values =
+ (LADSPA_Data *) JCL_malloc (env,
+ data->control_count * sizeof (LADSPA_Data));
+
+ /* Initialize the MIDI control map. */
+ memset (data->control_value_map, 0, data->control_count * sizeof(unsigned));
+
+ /* Create buffers for each port. */
+ for (cindex = 0, j = 0; j < data->desc->LADSPA_Plugin->PortCount; j++)
+ {
+ LADSPA_PortDescriptor pod =
+ data->desc->LADSPA_Plugin->PortDescriptors[j];
+ if (LADSPA_IS_PORT_AUDIO(pod) && LADSPA_IS_PORT_OUTPUT(pod))
+ {
+ data->left_buffer =
+ (float *) calloc(jack_get_buffer_size(data->jack_client),
+ sizeof(float));
+ (data->desc->LADSPA_Plugin->connect_port)(data->plugin_handle, j,
+ data->left_buffer);
+ }
+ else
+ if (LADSPA_IS_PORT_CONTROL(pod) && LADSPA_IS_PORT_INPUT(pod))
+ {
+ /* This is an input control port. Connect it to a properly
+ initialized value in our controller value array. */
+ (data->desc->LADSPA_Plugin->connect_port)
+ (data->plugin_handle, j, &(data->control_values[cindex]));
+ data->control_values[cindex] =
+ get_port_default (data->desc->LADSPA_Plugin,
+ j, data->sample_rate);
+
+ /* Set up the mapping between MIDI controllers and this
+ contoller value. */
+ if (data->desc->get_midi_controller_for_port)
+ {
+ controller = data->desc->
+ get_midi_controller_for_port(data->plugin_handle, j);
+
+ if ((controller != DSSI_NONE) && DSSI_IS_CC(controller))
+ {
+ data->control_value_map[DSSI_CC_NUMBER(controller)] = cindex;
+ data->control_port_map[DSSI_CC_NUMBER(controller)] = j;
+
+#ifdef DEBUG_DSSI_PROVIDER
+ printf ("MIDI Controller 0x%x [%s] = %g\n",
+ DSSI_CC_NUMBER(controller),
+ data->desc->LADSPA_Plugin->PortNames[j],
+ data->control_values[cindex]);
+#endif
+ }
+ }
+
+ cindex++;
+ }
+ }
+
+ (data->desc->LADSPA_Plugin->activate)(data->plugin_handle);
+
+ if (jack_activate (data->jack_client))
+ JCL_ThrowException (env, "java/io/IOException",
+ "can't activate jack client");
+
+ /* Try to connect the synth output to hardware audio ports. */
+ ports = jack_get_ports (data->jack_client, NULL, NULL,
+ JackPortIsPhysical | JackPortIsInput);
+ if (ports)
+ {
+ if (ports[0] && ports[1])
+ {
+ /* Don't bother checking return values. Failing is OK. */
+ jack_connect (data->jack_client,
+ jack_port_name (data->jack_left_output_port),
+ ports[0]);
+ jack_connect (data->jack_client,
+ jack_port_name (data->jack_right_output_port),
+ ports[1]);
+ }
+ free(ports);
+ }
+}
+
+/**
+ * This is called when we receive a new MIDI CONTROL CHANGE message.
+ * Simply stick an appropriate event in the event buffer. This will
+ * get processed in the jack callback function.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_controlChange_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint channel, jint control, jint value)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+
+ /* Insert this event in the event buffer. */
+ snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex];
+
+ /* Set the event value. */
+ snd_seq_ev_set_controller (ev, channel, control, value);
+
+ data->midiEventWriteIndex =
+ (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE;
+}
+
+/**
+ * This is called when we receive a new MIDI NOTE ON message. Simply
+ * stick an appropriate event in the event buffer. This will get
+ * processed in the jack callback function.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOn_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint channel, jint note, jint velocity)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+
+ /* Insert this event in the event buffer. */
+ snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex];
+
+ ev->type = SND_SEQ_EVENT_NOTEON;
+ ev->data.control.channel = channel;
+ ev->data.note.note = note;
+ ev->data.note.velocity = velocity;
+
+ data->midiEventWriteIndex =
+ (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE;
+}
+
+/**
+ * This is called when we receive a new MIDI NOTE OFF message. Simply
+ * stick an appropriate event in the event buffer. This will get
+ * processed in the jack callback function.
+ */
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_noteOff_1
+ (JNIEnv *env __attribute__((unused)),
+ jclass clazz __attribute__((unused)),
+ jlong handle, jint channel, jint note, jint velocity)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data,handle);
+
+ /* Insert this event in the event buffer. */
+ snd_seq_event_t *ev = & data->midiEventBuffer[data->midiEventWriteIndex];
+
+ ev->type = SND_SEQ_EVENT_NOTEOFF;
+ ev->data.control.channel = channel;
+ ev->data.note.note = note;
+ ev->data.note.velocity = velocity;
+
+ data->midiEventWriteIndex =
+ (data->midiEventWriteIndex + 1) % EVENT_BUFFER_SIZE;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_setPolyPressure_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle __attribute__((unused)), jint channel __attribute__((unused)),
+ jint note __attribute__((unused)), jint velocity __attribute__((unused)))
+{
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getPolyPressure_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle __attribute__((unused)), jint channel __attribute__((unused)),
+ jint note __attribute__((unused)))
+{
+ return 0;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_close_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle __attribute__((unused)))
+{
+}
+
+/* FIXME: These next three functions are really inefficient because
+ we're instantiating and cleaning up plugin instances just to query
+ values. */
+
+JNIEXPORT jstring JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramName_1
+ (JNIEnv *env, jclass clazz __attribute__((unused)),
+ jlong handle, jint index)
+{
+ LADSPA_Handle lhandle;
+ jstring name = (jstring) NULL;
+ dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+ if (data->desc->get_program == NULL)
+ return NULL;
+ lhandle =
+ (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin,
+ 48000);
+ const DSSI_Program_Descriptor *program =
+ (data->desc->get_program)(lhandle, (unsigned long) index);
+ if (program)
+ name = (*env)->NewStringUTF (env, program->Name);
+ (data->desc->LADSPA_Plugin->cleanup)(lhandle);
+
+ return name;
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramBank_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint index)
+{
+ LADSPA_Handle lhandle;
+ jint result = -1;
+ dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+ lhandle =
+ (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin,
+ 48000);
+ const DSSI_Program_Descriptor *program =
+ (data->desc->get_program)(lhandle, (unsigned long) index);
+ if (program)
+ result = (jint) program->Bank;
+ (data->desc->LADSPA_Plugin->cleanup)(lhandle);
+ return result;
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_getProgramProgram_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint index)
+{
+ LADSPA_Handle lhandle;
+ jint result = -1;
+ dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+ lhandle =
+ (data->desc->LADSPA_Plugin->instantiate)(data->desc->LADSPA_Plugin,
+ 48000);
+ const DSSI_Program_Descriptor *program =
+ (data->desc->get_program)(lhandle, (unsigned long) index);
+ if (program)
+ result = (jint) program->Program;
+ (data->desc->LADSPA_Plugin->cleanup)(lhandle);
+ return result;
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_javax_sound_midi_dssi_DSSISynthesizer_selectProgram_1
+ (JNIEnv *env __attribute__((unused)), jclass clazz __attribute__((unused)),
+ jlong handle, jint bank, jint program)
+{
+ dssi_data *data = JLONG_TO_PTR(dssi_data, handle);
+
+ (data->desc->select_program)(data->plugin_handle,
+ (unsigned) bank, (unsigned) program);
+}
diff --git a/libjava/classpath/native/jni/qt-peer/Makefile.in b/libjava/classpath/native/jni/qt-peer/Makefile.in
index 266238fc321..ab3b23007d4 100644
--- a/libjava/classpath/native/jni/qt-peer/Makefile.in
+++ b/libjava/classpath/native/jni/qt-peer/Makefile.in
@@ -45,10 +45,8 @@ target_triplet = @target@
subdir = native/jni/qt-peer
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -121,10 +119,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -261,6 +263,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -274,6 +277,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/jni/qt-peer/componentevent.cpp b/libjava/classpath/native/jni/qt-peer/componentevent.cpp
index ff189e49e04..ae88af01929 100644
--- a/libjava/classpath/native/jni/qt-peer/componentevent.cpp
+++ b/libjava/classpath/native/jni/qt-peer/componentevent.cpp
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+#include <assert.h>
#include <QWidget>
#include <QPoint>
diff --git a/libjava/classpath/native/jni/xmlj/Makefile.in b/libjava/classpath/native/jni/xmlj/Makefile.in
index acac40d07a5..2fb6e202a25 100644
--- a/libjava/classpath/native/jni/xmlj/Makefile.in
+++ b/libjava/classpath/native/jni/xmlj/Makefile.in
@@ -42,10 +42,8 @@ target_triplet = @target@
subdir = native/jni/xmlj
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -97,10 +95,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -237,6 +239,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -250,6 +253,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/target/Linux/Makefile.in b/libjava/classpath/native/target/Linux/Makefile.in
index c7a0a2e4013..50579b9d206 100644
--- a/libjava/classpath/native/target/Linux/Makefile.in
+++ b/libjava/classpath/native/target/Linux/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native/target/Linux
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -75,10 +73,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -215,6 +217,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -228,6 +231,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/target/Makefile.in b/libjava/classpath/native/target/Makefile.in
index aaa7a15a5af..2dcc1f20830 100644
--- a/libjava/classpath/native/target/Makefile.in
+++ b/libjava/classpath/native/target/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native/target
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -84,10 +82,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -224,6 +226,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -237,6 +240,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/native/target/generic/Makefile.in b/libjava/classpath/native/target/generic/Makefile.in
index 097f8da674a..13f2026f259 100644
--- a/libjava/classpath/native/target/generic/Makefile.in
+++ b/libjava/classpath/native/target/generic/Makefile.in
@@ -39,10 +39,8 @@ target_triplet = @target@
subdir = native/target/generic
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -75,10 +73,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -215,6 +217,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -228,6 +231,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/org/ietf/jgss/GSSCredential.java b/libjava/classpath/org/ietf/jgss/GSSCredential.java
index 724825d5eed..bdf14971006 100644
--- a/libjava/classpath/org/ietf/jgss/GSSCredential.java
+++ b/libjava/classpath/org/ietf/jgss/GSSCredential.java
@@ -331,4 +331,14 @@ public interface GSSCredential extends Cloneable
* @return True if this object equals the other.
*/
boolean equals(Object another);
+
+ /**
+ * Return the hash code of this credential. When overriding {@link #equals},
+ * it is necessary to override hashCode() as well.
+ *
+ * @return the hash code that must be the same for two credentials if
+ * {@link #equals} returns true.
+ */
+ int hashCode();
+
}
diff --git a/libjava/classpath/org/ietf/jgss/GSSException.java b/libjava/classpath/org/ietf/jgss/GSSException.java
index 5443f766cfe..9c352e3e937 100644
--- a/libjava/classpath/org/ietf/jgss/GSSException.java
+++ b/libjava/classpath/org/ietf/jgss/GSSException.java
@@ -1,5 +1,5 @@
/* GSSException.java -- a general exception in GSS.
- Copyright (C) 2004 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -79,6 +79,9 @@ import java.util.ResourceBundle;
* the caller, this class performs the mapping from their numeric values
* to textual representations. All Java GSS-API methods are declared
* throwing this exception.
+ *
+ * @specnote Some of the constant values defined in this class were
+ * chosen to be compatible with J2SE 1.4, and not with RFC 2853.
*/
public class GSSException extends Exception
{
@@ -90,28 +93,29 @@ public class GSSException extends Exception
// Constants and fields.
// -------------------------------------------------------------------------
- // These values do not jive with the "Constant Field Values" in the J2SE
- // 1.4.1, but do follow RFC 2853. I trust the IETF, but not Sun.
-
/**
* Channel bindings mismatch error.
+ * @specnote Should be 4 according to RFC 2853.
*/
- public static final int BAD_BINDINGS = 4;
+ public static final int BAD_BINDINGS = 1;
/**
* Unsupported mechanism requested error.
+ * @specnote Should be 1 according to RFC 2853.
*/
- public static final int BAD_MECH = 1;
+ public static final int BAD_MECH = 2;
/**
* Invalid name provided error.
+ * @specnote Should be 2 according to RFC 2853.
*/
- public static final int BAD_NAME = 2;
+ public static final int BAD_NAME = 3;
/**
* Name of unsupported type provided error.
+ * @specnote Should be 3 according to RFC 2853.
*/
- public static final int BAD_NAMETYPE = 3;
+ public static final int BAD_NAMETYPE = 4;
/**
* Invalid status code error - this is the default status value.
@@ -125,38 +129,45 @@ public class GSSException extends Exception
/**
* Specified security context expired error.
+ * @specnote Should be 12 according to RFC 2853.
*/
- public static final int CONTEXT_EXPIRED = 12;
+ public static final int CONTEXT_EXPIRED = 7;
/**
* Expired credentials detected error.
+ * @specnote Should be 11 according to RFC 2853.
*/
- public static final int CREDENTIALS_EXPIRED = 11;
+ public static final int CREDENTIALS_EXPIRED = 8;
/**
* Defective credential error.
+ * @specnote Should be 10 according to RFC 2853.
*/
- public static final int DEFECTIVE_CREDENTIAL = 10;
+ public static final int DEFECTIVE_CREDENTIAL = 9;
/**
* Defective token error.
+ * @specnote Should be 9 according to RFC 2853.
*/
- public static final int DEFECTIVE_TOKEN = 9;
+ public static final int DEFECTIVE_TOKEN = 10;
/**
* General failure, unspecified at GSS-API level.
+ * @specnote Should be 13 according to RFC 2853.
*/
- public static final int FAILURE = 13;
+ public static final int FAILURE = 11;
/**
* Invalid security context error.
+ * @specnote Should be 8 according to RFC 2853.
*/
- public static final int NO_CONTEXT = 8;
+ public static final int NO_CONTEXT = 12;
/**
* Invalid credentials error.
+ * @specnote Should be 7 according to RFC 2853.
*/
- public static final int NO_CRED = 7;
+ public static final int NO_CRED = 13;
/**
* Unsupported QOP value error.
@@ -188,16 +199,18 @@ public class GSSException extends Exception
* code that may occur during context establishment. It is not used to
* indicate supplementary status values. The MessageProp object is used
* for that purpose.
+ * @specnote Should be 20 according to RFC 2853.
*/
- public static final int DUPLICATE_TOKEN = 20;
+ public static final int DUPLICATE_TOKEN = 19;
/**
* The token's validity period has expired. This is a fatal error code
* that may occur during context establishment. It is not used to
* indicate supplementary status values. The MessageProp object is used
* for that purpose.
+ * @specnote Should be 19 according to RFC 2853.
*/
- public static final int OLD_TOKEN = 19;
+ public static final int OLD_TOKEN = 20;
/**
* A later token has already been processed. This is a fatal error code
diff --git a/libjava/classpath/org/ietf/jgss/GSSName.java b/libjava/classpath/org/ietf/jgss/GSSName.java
index 5550697b5f0..ee3209dd0b4 100644
--- a/libjava/classpath/org/ietf/jgss/GSSName.java
+++ b/libjava/classpath/org/ietf/jgss/GSSName.java
@@ -201,6 +201,15 @@ public interface GSSName
boolean equals(Object another);
/**
+ * Return the hashcode of this GSSName. When overriding {@link #equals},
+ * it is normally necessary to override hashCode() as well.
+ *
+ * @return the hash code that must be the same for two names if {@link #equals}
+ * returns true.
+ */
+ int hashCode();
+
+ /**
* Creates a mechanism name (MN) from an arbitrary internal name. This
* is equivalent to using the factory methods {@link
* GSSManager#createName(java.lang.String,org.ietf.jgss.Oid,org.ietf.jgss.Oid)}
diff --git a/libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java b/libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java
new file mode 100644
index 00000000000..ea234e620c8
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/ACTIVITY_COMPLETED.java
@@ -0,0 +1,102 @@
+/* ACTIVITY_COMPLETED.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * The ACTIVITY_COMPLETED indicates that the Activity context in which the
+ * method call was made has been completed due to a timeout of either the
+ * Activity itself or a transaction that encompasses the Activity. It also
+ * may mean that the Activity is completed in a manner other than that
+ * originally requested.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ACTIVITY_COMPLETED
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 463786710302308798L;
+
+ /**
+ * Creates ACTIVITY_COMPLETED with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public ACTIVITY_COMPLETED(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates ACTIVITY_COMPLETED with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public ACTIVITY_COMPLETED()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a ACTIVITY_COMPLETED exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public ACTIVITY_COMPLETED(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created ACTIVITY_COMPLETED exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public ACTIVITY_COMPLETED(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java b/libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java
new file mode 100644
index 00000000000..c0c72b524b1
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/ACTIVITY_REQUIRED.java
@@ -0,0 +1,100 @@
+/* ACTIVITY_REQUIRED.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * The ACTIVITY_REQUIRED system exception indicates that an Activity context was
+ * necessary to perform the invoked operation, but one was not found
+ * associated with the calling thread.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ACTIVITY_REQUIRED
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = -5684213471781455027L;
+
+ /**
+ * Creates ACTIVITY_REQUIRED with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public ACTIVITY_REQUIRED(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates ACTIVITY_REQUIRED with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public ACTIVITY_REQUIRED()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a ACTIVITY_REQUIRED exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public ACTIVITY_REQUIRED(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created ACTIVITY_REQUIRED exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public ACTIVITY_REQUIRED(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/AnyHolder.java b/libjava/classpath/org/omg/CORBA/AnyHolder.java
index 0055fdd7482..10f828aabe5 100644
--- a/libjava/classpath/org/omg/CORBA/AnyHolder.java
+++ b/libjava/classpath/org/omg/CORBA/AnyHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -55,7 +55,7 @@ public final class AnyHolder
/**
* The default type code for this holder.
*/
- private static final TypeCode t_any = new primitiveTypeCode(TCKind.tk_any);
+ private static final TypeCode t_any = new PrimitiveTypeCode(TCKind.tk_any);
/**
* The instance of {@link Any} (not the "any value"), held by this holder.
diff --git a/libjava/classpath/org/omg/CORBA/AnySeqHelper.java b/libjava/classpath/org/omg/CORBA/AnySeqHelper.java
index 5c45bb3d83b..8ebae7a193f 100644
--- a/libjava/classpath/org/omg/CORBA/AnySeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/AnySeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -130,7 +130,7 @@ public abstract class AnySeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_any);
+ return new ArrayTypeCode(TCKind.tk_any);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/AnySeqHolder.java b/libjava/classpath/org/omg/CORBA/AnySeqHolder.java
index 905e05c8b03..b18a1457b15 100644
--- a/libjava/classpath/org/omg/CORBA/AnySeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/AnySeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class AnySeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_any);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_any);
/**
* Constructs an instance of AnySeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java b/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java
index 26b3406658f..2649f2a6dc4 100755
--- a/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java
+++ b/libjava/classpath/org/omg/CORBA/BAD_OPERATION.java
@@ -41,8 +41,76 @@ package org.omg.CORBA;
import java.io.Serializable;
/**
- * Means that the object exists but does not support the operation that
- * was invoked on it.
+ * Means that the object exists but does not support the operation that was
+ * invoked on it.
+ *
+ * In GNU Classpath, this exception may have the following Minor codes:
+ *
+ * <table border="1">
+ * <tr>
+ * <th>Hex</th>
+ * <th>Dec</th>
+ * <th>Minor</th>
+ * <th>Name</th>
+ * <th>Case</th>
+ * </tr>
+ * <tr>
+ * <td>47430000</td>
+ * <td>1195573248 </td>
+ * <td>0</td>
+ * <td>Method</td>
+ * <td> The remote side requested to invoke the method that is not available on
+ * that target (client and server probably disagree in the object definition).
+ * This code is set when the problem arises in the Classpath core; the idlj and
+ * rmic may generate the user code that sets 0x0 or other value.</td>
+ * </tr>
+ * <tr>
+ * <td>47430009</td>
+ * <td>1195573257</td>
+ * <td>9</td>
+ * <td>Any</td>
+ * <td> Attempt to extract from the Any value of the different type that was
+ * stored into that Any. </td>
+ * </tr>
+ * <tr>
+ * <td>4743000a</td>
+ * <td>1195573258</td>
+ * <td>10</td>
+ * <td>Activation</td>
+ * <td>Failed to activate the inactive object due any reason.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000b</td>
+ * <td>1195573259</td>
+ * <td>11</td>
+ * <td>Policy</td>
+ * <td> The policies, applying to ORB or POA prevent the requested operation.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>4743000c</td>
+ * <td>1195573260</td>
+ * <td>12</td>
+ * <td>Socket</td>
+ * <td> Socket related errors like failure to open socket on the expected port.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000e</td>
+ * <td>1195573262</td>
+ * <td>14</td>
+ * <td>Enumeration</td>
+ * <td> The passed value for enumeration is outside the valid range for that
+ * enumeration. </td>
+ * </tr>
+ * <tr>
+ * <td>4743000f</td>
+ * <td>1195573263</td>
+ * <td>15</td>
+ * <td>PolicyType</td>
+ * <td> The passed policy code is outside the valid range of the possible
+ * policies for the given policy type. </td>
+ * </tr>
+ * </table>
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
@@ -50,14 +118,15 @@ public class BAD_OPERATION
extends SystemException
implements Serializable
{
- /**
- * Use serialVersionUID for interoperability.
+ /**
+ * Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 1654621651720499682L;
/**
- * Creates a BAD_OPERATION with the default minor code of 0,
- * completion state COMPLETED_NO and the given explaining message.
+ * Creates a BAD_OPERATION with the default minor code of 0, completion state
+ * COMPLETED_NO and the given explaining message.
+ *
* @param reasom the explaining message.
*/
public BAD_OPERATION(String message)
@@ -66,16 +135,18 @@ public class BAD_OPERATION
}
/**
- * Creates BAD_OPERATION with the default minor code of 0 and a
- * completion state COMPLETED_NO.
+ * Creates BAD_OPERATION with the default minor code of 0 and a completion
+ * state COMPLETED_NO.
*/
public BAD_OPERATION()
{
super("", 0, CompletionStatus.COMPLETED_NO);
}
- /** Creates a BAD_OPERATION exception with the specified minor
- * code and completion status.
+ /**
+ * Creates a BAD_OPERATION exception with the specified minor code and
+ * completion status.
+ *
* @param minor additional error code.
* @param completed the method completion status.
*/
@@ -86,6 +157,7 @@ public class BAD_OPERATION
/**
* Created BAD_OPERATION exception, providing full information.
+ *
* @param reason explaining message.
* @param minor additional error code (the "minor").
* @param completed the method completion status.
diff --git a/libjava/classpath/org/omg/CORBA/BAD_QOS.java b/libjava/classpath/org/omg/CORBA/BAD_QOS.java
new file mode 100644
index 00000000000..ba8a0df3248
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/BAD_QOS.java
@@ -0,0 +1,99 @@
+/* BAD_QOS.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * The BAD_QOS is raised when the object cannot support the quality of
+ * service required by an invocation parameter.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class BAD_QOS
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 4746597571263117454L;
+
+ /**
+ * Creates BAD_QOS with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public BAD_QOS(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates BAD_QOS with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public BAD_QOS()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a BAD_QOS exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public BAD_QOS(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created BAD_QOS exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public BAD_QOS(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/BooleanHolder.java b/libjava/classpath/org/omg/CORBA/BooleanHolder.java
index eddc62933a9..73cfeb29613 100644
--- a/libjava/classpath/org/omg/CORBA/BooleanHolder.java
+++ b/libjava/classpath/org/omg/CORBA/BooleanHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class BooleanHolder
* The default type code for this holder.
*/
private static final TypeCode t_boolean =
- new primitiveTypeCode(TCKind.tk_boolean);
+ new PrimitiveTypeCode(TCKind.tk_boolean);
/**
* The <code>boolean</code> (CORBA <code>boolean</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java b/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java
index d1fde8b7726..41f93d10d73 100644
--- a/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/BooleanSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class BooleanSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_boolean);
+ return new ArrayTypeCode(TCKind.tk_boolean);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java b/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java
index ac8224f92e6..bdec3b79273 100644
--- a/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/BooleanSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class BooleanSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_boolean);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_boolean);
/**
* Constructs an instance of BooleanSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/ByteHolder.java b/libjava/classpath/org/omg/CORBA/ByteHolder.java
index 0cfd8f03cba..c440822e58c 100644
--- a/libjava/classpath/org/omg/CORBA/ByteHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ByteHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class ByteHolder
* The default type code for this holder.
*/
private static final TypeCode t_octet =
- new primitiveTypeCode(TCKind.tk_octet);
+ new PrimitiveTypeCode(TCKind.tk_octet);
/**
* The <code>byte</code> (CORBA <code>octet</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java b/libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java
new file mode 100644
index 00000000000..41ccaf49248
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/CODESET_INCOMPATIBLE.java
@@ -0,0 +1,103 @@
+/* CODESET_INCOMPATIBLE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised when client and server are unable to reach any consensus on which
+ * code set should be used to represent the characters. This happens when
+ * neither server nor client cannot convert from the native code set of the
+ * corresponding side, there is no shared codeset from that both sides could
+ * convert and additionally the client and server* native sets are too
+ * different to communicate anyway without the massive data loss.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class CODESET_INCOMPATIBLE
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = -8784048396454171789L;
+
+ /**
+ * Creates CODESET_INCOMPATIBLE with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public CODESET_INCOMPATIBLE(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates CODESET_INCOMPATIBLE with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public CODESET_INCOMPATIBLE()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a CODESET_INCOMPATIBLE exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public CODESET_INCOMPATIBLE(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created CODESET_INCOMPATIBLE exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public CODESET_INCOMPATIBLE(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/CharHolder.java b/libjava/classpath/org/omg/CORBA/CharHolder.java
index 67eb2ee8741..b8d0a3d6a31 100644
--- a/libjava/classpath/org/omg/CORBA/CharHolder.java
+++ b/libjava/classpath/org/omg/CORBA/CharHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -61,7 +61,7 @@ public final class CharHolder
/**
* The default type code for this holder.
*/
- private static final TypeCode t_char = new primitiveTypeCode(TCKind.tk_char);
+ private static final TypeCode t_char = new PrimitiveTypeCode(TCKind.tk_char);
/**
* The <code>char</code> (CORBA <code>char</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/CharSeqHelper.java b/libjava/classpath/org/omg/CORBA/CharSeqHelper.java
index b91306c2c3e..08406058ca8 100644
--- a/libjava/classpath/org/omg/CORBA/CharSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/CharSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class CharSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_char);
+ return new ArrayTypeCode(TCKind.tk_char);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/CharSeqHolder.java b/libjava/classpath/org/omg/CORBA/CharSeqHolder.java
index dc7d0a84050..a60483b5f0f 100644
--- a/libjava/classpath/org/omg/CORBA/CharSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/CharSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class CharSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_char);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_char);
/**
* Constructs an instance of CharSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/CompletionStatus.java b/libjava/classpath/org/omg/CORBA/CompletionStatus.java
index f9f3704430a..1ddcca2877a 100644
--- a/libjava/classpath/org/omg/CORBA/CompletionStatus.java
+++ b/libjava/classpath/org/omg/CORBA/CompletionStatus.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
+
import java.io.Serializable;
import org.omg.CORBA.portable.IDLEntity;
@@ -108,6 +110,7 @@ public class CompletionStatus
/**
* Returns the CompletionStatus, matching the given integer constant
+ *
* @param completion one of COMPLETED_YES, COMPLETED_NO or COMPLEED_MAYBE.
* @return one of COMPLETED_YES, COMPLETED_NO or COMPLEED_MAYBE.
* @throws BAD_PARAM if the parameter is not one of these three valid values.
@@ -116,11 +119,14 @@ public class CompletionStatus
{
try
{
- return states [ completion ];
+ return states[completion];
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid completion status " + completion);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid completion status "
+ + completion);
+ bad.minor = Minor.Enumeration;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java b/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java
index f6285744852..43b6b8c1099 100644
--- a/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java
+++ b/libjava/classpath/org/omg/CORBA/CompletionStatusHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -131,7 +131,7 @@ public abstract class CompletionStatusHelper
new String[] { "COMPLETED_YES", "COMPLETED_NO", "COMPLETED_MAYBE" };
typeCode =
- Restricted_ORB.Singleton.create_enum_tc(id(), "CompletionStatus",
+ OrbRestricted.Singleton.create_enum_tc(id(), "CompletionStatus",
members
);
}
diff --git a/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java b/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java
index 3faacdcb2dd..7261aae4684 100644
--- a/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java
+++ b/libjava/classpath/org/omg/CORBA/DATA_CONVERSION.java
@@ -44,6 +44,26 @@ import java.io.Serializable;
* Means that the ORB cannot convert between the marshalled and
* native data representation.
*
+ * In GNU Classpath, this exception may have the following minor codes:
+ *
+ * <table border="1">
+ * <tr>
+ * <td>Hex</td>
+ * <td>Dec</td>
+ * <td>Minor</td>
+ * <td>Name</td>
+ * <td>Case</td>
+ * </tr>
+ * <td>47430016</td>
+ * <td>1195573270</td>
+ * <td>22</td>
+ * <td>Missing_IOR</td>
+ * <td>The object URL is such that the IOR string must be read from some
+ * local or remote resource (file or network), but this resource is not
+ * reacheable.</td>
+ * </tr>
+ * </table>
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class DATA_CONVERSION
diff --git a/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java b/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java
index d9c7cc15a46..fddbb585a2e 100644
--- a/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java
+++ b/libjava/classpath/org/omg/CORBA/DefinitionKindHelper.java
@@ -39,9 +39,9 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.DefinitionKindHolder;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.gnuAny;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -97,7 +97,7 @@ public abstract class DefinitionKindHelper
};
typeCode =
- Restricted_ORB.Singleton.create_enum_tc(id(), "DefinitionKind",
+ OrbRestricted.Singleton.create_enum_tc(id(), "DefinitionKind",
members
);
}
diff --git a/libjava/classpath/org/omg/CORBA/DoubleHolder.java b/libjava/classpath/org/omg/CORBA/DoubleHolder.java
index efee74b0faa..65c8ebaf5e0 100644
--- a/libjava/classpath/org/omg/CORBA/DoubleHolder.java
+++ b/libjava/classpath/org/omg/CORBA/DoubleHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class DoubleHolder
* The default type code for this holder.
*/
private static final TypeCode t_double =
- new primitiveTypeCode(TCKind.tk_double);
+ new PrimitiveTypeCode(TCKind.tk_double);
/**
* The <code>double</code> (CORBA <code>double</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java b/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java
index d8dffbf4cdb..2d9423fd095 100644
--- a/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/DoubleSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class DoubleSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_double);
+ return new ArrayTypeCode(TCKind.tk_double);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java b/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java
index a6828e1c137..619e9215bb9 100644
--- a/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/DoubleSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class DoubleSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_double);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_double);
/**
* Constructs an instance of DoubleSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/DynamicImplementation.java b/libjava/classpath/org/omg/CORBA/DynamicImplementation.java
index 3bcf93d422b..3b1b4431905 100644
--- a/libjava/classpath/org/omg/CORBA/DynamicImplementation.java
+++ b/libjava/classpath/org/omg/CORBA/DynamicImplementation.java
@@ -38,7 +38,12 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Unexpected;
+import gnu.CORBA.gnuAny;
+import gnu.CORBA.gnuNVList;
+
import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
/**
* This class was probably originally thinked as a base of all CORBA
@@ -51,18 +56,110 @@ import org.omg.CORBA.portable.ObjectImpl;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public abstract class DynamicImplementation
+public class DynamicImplementation
extends ObjectImpl
{
/**
- * Invoke the method of the CORBA object.
- *
+ * Invoke the method of the CORBA object. After converting the parameters,
+ * this method delegates call to the {@link ObjectImpl#invoke}.
+ *
* @deprecated since 1.4.
- *
- * @param request the container for both passing and returing the
- * parameters, also contains the method name and thrown exceptions.
+ *
+ * @param request the container for both passing and returing the parameters,
+ * also contains the method name and thrown exceptions.
*/
- public abstract void invoke(ServerRequest request);
+ public void invoke(ServerRequest request)
+ {
+ Request r = _request(request.operation());
+
+ // Copy the parameters.
+ NVList args = new gnuNVList();
+ request.arguments(args);
+ NamedValue v;
+ int i = 0;
+
+ try
+ {
+ // Set the arguments.
+ for (i = 0; i < args.count(); i++)
+ {
+ v = args.item(i);
+ Any n;
+ OutputStream out;
+
+ switch (v.flags())
+ {
+ case ARG_IN.value:
+ out = v.value().create_output_stream();
+ v.value().write_value(out);
+ n = r.add_named_in_arg(v.name());
+ n.read_value(out.create_input_stream(), v.value().type());
+ break;
+ case ARG_INOUT.value:
+ out = v.value().create_output_stream();
+ v.value().write_value(out);
+ n = r.add_named_inout_arg(v.name());
+ n.read_value(out.create_input_stream(), v.value().type());
+ break;
+ case ARG_OUT.value:
+ r.add_named_out_arg(v.name());
+ break;
+
+ default:
+ throw new InternalError("Invalid flags " + v.flags());
+ }
+ }
+ }
+ catch (Bounds b)
+ {
+ throw new Unexpected(args.count() + "[" + i + "]", b);
+ }
+
+ // Set context.
+ r.ctx(request.ctx());
+
+ // Set the return type (expects that the ServerRequest will initialise
+ // the passed Any.
+
+ gnuAny g = new gnuAny();
+ request.result(g);
+ r.set_return_type(g.type());
+
+ // Invoke the method.
+ r.invoke();
+
+ // Transfer the returned values.
+ NVList r_args = r.arguments();
+
+ try
+ {
+ // API states that the ServerRequest.arguments must be called only
+ // once. Hence we assume we can just modify the previously returned
+ // value <code>args</code>, and the ServerRequest will preserve the
+ // reference.
+ for (i = 0; i < args.count(); i++)
+ {
+ v = args.item(i);
+
+ if (v.flags() == ARG_OUT.value || v.flags() == ARG_INOUT.value)
+ {
+ OutputStream out = r_args.item(i).value().create_output_stream();
+ r_args.item(i).value().write_value(out);
+ v.value().read_value(out.create_input_stream(),
+ v.value().type());
+ }
+ }
+ }
+ catch (Bounds b)
+ {
+ throw new Unexpected(args.count() + "[" + i + "]", b);
+ }
+
+ // Set the returned result (if any).
+ NamedValue returns = r.result();
+ if (returns != null)
+ request.set_result(returns.value());
+ }
/**
* Returns the array of the repository ids, supported by this object.
diff --git a/libjava/classpath/org/omg/CORBA/FieldNameHelper.java b/libjava/classpath/org/omg/CORBA/FieldNameHelper.java
index a35df4f3565..6d6de43da67 100644
--- a/libjava/classpath/org/omg/CORBA/FieldNameHelper.java
+++ b/libjava/classpath/org/omg/CORBA/FieldNameHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -80,7 +80,7 @@ public abstract class FieldNameHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "FieldName", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CORBA/FixedHolder.java b/libjava/classpath/org/omg/CORBA/FixedHolder.java
index c3918a08d0d..8913acc1755 100644
--- a/libjava/classpath/org/omg/CORBA/FixedHolder.java
+++ b/libjava/classpath/org/omg/CORBA/FixedHolder.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.fixedTypeCode;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.FixedTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import java.math.BigDecimal;
@@ -108,7 +108,7 @@ public final class FixedHolder
*/
public TypeCode _type()
{
- return new fixedTypeCode(value);
+ return new FixedTypeCode(value);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/FloatHolder.java b/libjava/classpath/org/omg/CORBA/FloatHolder.java
index 059953faf83..1d6de16a192 100644
--- a/libjava/classpath/org/omg/CORBA/FloatHolder.java
+++ b/libjava/classpath/org/omg/CORBA/FloatHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class FloatHolder
* The default type code for this holder.
*/
private static final TypeCode t_float =
- new primitiveTypeCode(TCKind.tk_float);
+ new PrimitiveTypeCode(TCKind.tk_float);
/**
* The <code>float</code> (CORBA <code>float</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java b/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java
index 9f7630c3f95..1656dae440a 100644
--- a/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/FloatSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class FloatSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_float);
+ return new ArrayTypeCode(TCKind.tk_float);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java b/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java
index 24c7603336c..dbab1ec08ba 100644
--- a/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/FloatSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class FloatSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_float);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_float);
/**
* Constructs an instance of FloatSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java b/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java
index d9ca36496f5..635168eb82d 100644
--- a/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java
+++ b/libjava/classpath/org/omg/CORBA/IDLTypeHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.Delegate;
import org.omg.CORBA.portable.InputStream;
@@ -84,7 +84,7 @@ public abstract class IDLTypeHelper
if (typeCode == null)
{
typeCode =
- Restricted_ORB.Singleton.create_interface_tc(IDLTypeHelper.id(),
+ OrbRestricted.Singleton.create_interface_tc(IDLTypeHelper.id(),
"IDLType"
);
}
diff --git a/libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java b/libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java
new file mode 100644
index 00000000000..a6e60d02ad4
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/INVALID_ACTIVITY.java
@@ -0,0 +1,100 @@
+/* INVALID_ACTIVITY.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised when the transaction or Activity is resumed in a different context
+ * than from which it was suspended. It is also raised when the invocation is
+ * not incompatible with the Activity’s current state.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class INVALID_ACTIVITY
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 7907846629733712546L;
+
+ /**
+ * Creates INVALID_ACTIVITY with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public INVALID_ACTIVITY(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates INVALID_ACTIVITY with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public INVALID_ACTIVITY()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a INVALID_ACTIVITY exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public INVALID_ACTIVITY(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created INVALID_ACTIVITY exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public INVALID_ACTIVITY(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/IdentifierHelper.java b/libjava/classpath/org/omg/CORBA/IdentifierHelper.java
index fa204484125..5c055f81290 100644
--- a/libjava/classpath/org/omg/CORBA/IdentifierHelper.java
+++ b/libjava/classpath/org/omg/CORBA/IdentifierHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -80,7 +80,7 @@ public abstract class IdentifierHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "Identifier", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CORBA/IntHolder.java b/libjava/classpath/org/omg/CORBA/IntHolder.java
index 19822ef766e..4729535a7ec 100644
--- a/libjava/classpath/org/omg/CORBA/IntHolder.java
+++ b/libjava/classpath/org/omg/CORBA/IntHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -61,7 +61,7 @@ public final class IntHolder
/**
* The default type code for this holder.
*/
- private static final TypeCode t_long = new primitiveTypeCode(TCKind.tk_long);
+ private static final TypeCode t_long = new PrimitiveTypeCode(TCKind.tk_long);
/**
* The <code>int</code> (CORBA <code>long</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/LocalObject.java b/libjava/classpath/org/omg/CORBA/LocalObject.java
index 4b6ae68afda..7c06e18249d 100644
--- a/libjava/classpath/org/omg/CORBA/LocalObject.java
+++ b/libjava/classpath/org/omg/CORBA/LocalObject.java
@@ -49,6 +49,13 @@ import org.omg.CORBA.NamedValue;
import org.omg.CORBA.Policy;
import org.omg.CORBA.Request;
import org.omg.CORBA.SetOverrideType;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+import javax.rmi.CORBA.Util;
/**
* An object, formally implementing the CORBA {@link Object}, but actually
@@ -141,6 +148,17 @@ public class LocalObject
*
* @throws NO_IMPLEMENT, always.
*/
+ public org.omg.CORBA.Object _get_interface()
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
public Policy _get_policy(int a_policy_type)
throws BAD_PARAM
{
@@ -232,4 +250,114 @@ public class LocalObject
{
throw new NO_IMPLEMENT(INAPPROPRIATE);
}
+
+ /**
+ * This method is called from <code>rmic</code> generated stubs if the
+ * {@link Util#isLocal()}, called passing <code>this</code> as parameter,
+ * returns true. If the method returns null, the requested method is then
+ * invoked on <code>this</code>. Else it is invoked on the returned object,
+ * casting it into the interface that the local object implements. In this
+ * case, the generated stub also later calls
+ * {@link _servant_postinvoke(ServantObject)}, passing that returned target
+ * as parameter.
+ *
+ * @param operation the name of the method being invoked.
+ * @param expectedType the interface that the returned servant
+ * object must implement.
+ *
+ * @throws NO_IMPLEMENT always. If used, the method must be overridden.
+ */
+ public ServantObject _servant_preinvoke(String operation, Class expectedType)
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+
+ /**
+ * This method is called from <code>rmic</code> generated stubs if the
+ * {@link Util#isLocal()}, called passing <code>this</code> as parameter,
+ * returns true, and the {@link #_servant_preinvoke} return non-null object.
+ * The stub then invokes the requrested method on that returned object and
+ * later calls _servant_postinvoke, passing that returned target as parameter.
+ *
+ * @param servant the object that has served as the invocation target for the
+ * current operation.
+ */
+ public void _servant_postinvoke(ServantObject servant)
+ {
+ }
+
+ /**
+ * Invokes the operation. This method takes the OutputStream that was previously
+ * returned by a {@link _request()} and returns an InputStream which
+ * contains the reply. Up till jdk 1.5 inclusive this method is marked as
+ * unimplemented.
+ *
+ * @throws NO_IMPLEMENT always.
+ */
+ public InputStream _invoke(OutputStream output)
+ throws ApplicationException, RemarshalException
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * While it may look that this should return true, the jdk 1.5 API states
+ * that it must throw NO_IMPLEMENT instead. The rmi stubs do not call this
+ * method to check if the object is local; they call {@link Util#isLocal()}
+ * instead (passing <code>this</code> as parameter).
+ *
+ * @return never.
+ *
+ * @throws NO_IMPLEMENT always.
+ */
+ public boolean _is_local()
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
+ public ORB _orb()
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
+ public void _releaseReply(InputStream input)
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
+ public OutputStream _request(String operation, boolean responseExpected)
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
+
+ /**
+ * This method is not appropriate for the local objects and just
+ * throws an exception.
+ *
+ * @throws NO_IMPLEMENT, always.
+ */
+ public boolean validate_connection()
+ {
+ throw new NO_IMPLEMENT(INAPPROPRIATE);
+ }
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/LongHolder.java b/libjava/classpath/org/omg/CORBA/LongHolder.java
index c0b14d33be2..ac249fed3c6 100644
--- a/libjava/classpath/org/omg/CORBA/LongHolder.java
+++ b/libjava/classpath/org/omg/CORBA/LongHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class LongHolder
* The default type code for this holder.
*/
private static final TypeCode t_longlong =
- new primitiveTypeCode(TCKind.tk_longlong);
+ new PrimitiveTypeCode(TCKind.tk_longlong);
/**
* The <code>long</code> (CORBA <code>long long</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java b/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java
index 1d7cde01cbb..0e31c713647 100644
--- a/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/LongLongSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class LongLongSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_long);
+ return new ArrayTypeCode(TCKind.tk_long);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java b/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java
index 95579029673..e56acd4ad78 100644
--- a/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/LongLongSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class LongLongSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_longlong);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_longlong);
/**
* Constructs an instance of LongLongSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/LongSeqHelper.java b/libjava/classpath/org/omg/CORBA/LongSeqHelper.java
index e98c77920dd..26b4e91c2a5 100644
--- a/libjava/classpath/org/omg/CORBA/LongSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/LongSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class LongSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_long);
+ return new ArrayTypeCode(TCKind.tk_long);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/LongSeqHolder.java b/libjava/classpath/org/omg/CORBA/LongSeqHolder.java
index ac571decdb6..2359eb0b2f6 100644
--- a/libjava/classpath/org/omg/CORBA/LongSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/LongSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -56,8 +56,8 @@ public final class LongSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_long);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_long);
/**
* The <code>int[]</code> (CORBA <code>LongSeq</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/MARSHAL.java b/libjava/classpath/org/omg/CORBA/MARSHAL.java
index 34cfa78f637..2cd92f5a626 100644
--- a/libjava/classpath/org/omg/CORBA/MARSHAL.java
+++ b/libjava/classpath/org/omg/CORBA/MARSHAL.java
@@ -41,8 +41,230 @@ package org.omg.CORBA;
import java.io.Serializable;
/**
- * Means that some request or reply from the network has a wrong
- * size or is structurally invalid.
+ * Means that some request or reply from the network has a wrong size or is
+ * structurally invalid. In GNU Classpath, this exception may have the following
+ * minor codes (the high 20 bits being Classpath VMCID):
+ *
+ * <table border="1">
+ * <tr>
+ * <th>Hex</th>
+ * <th>Dec</th>
+ * <th>Minor</th>
+ * <th>Name</th>
+ * <th>Case</th>
+ * </tr>
+ * <tr>
+ * <td>47430001</td>
+ * <td>1195573249</td>
+ * <td>1</td>
+ * <td>Giop</td>
+ * <td>The message being received is not a GIOP message. It does not start from
+ * the expected magic sequence byte[] { 'G', 'I', 'O', 'P' }.</td>
+ * </tr>
+ * <tr>
+ * <td>47430002</td>
+ * <td>1195573250</td>
+ * <td>2</td>
+ * <td>Header</td>
+ * <td>The unexpected IOException while reading or writing the GIOP message
+ * header or the subsequent request or response header</td>
+ * </tr>
+ * <tr>
+ * <td>47430003</td>
+ * <td>1195573251</td>
+ * <td>3</td>
+ * <td>EOF</td>
+ * <td>The data stream ended before reading all expected values from it. This
+ * usually means that the CORBA message is corrupted, but may also indicate that
+ * the server expects the remote method being invoked to have more or different
+ * parameters</td>
+ * </tr>
+ * <tr>
+ * <td>47430005</td>
+ * <td>1195573253</td>
+ * <td>5</td>
+ * <td>CDR</td>
+ * <td>The unexpected IOException while reading or writing the data via Commond
+ * Data Representation stream</td>
+ * </tr>
+ * <tr>
+ * <td>47430006</td>
+ * <td>1195573254 </td>
+ * <td>6</td>
+ * <td>Value</td>
+ * <td>The unexpected IOException while reading or writing the Value type.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>47430007 </td>
+ * <td>1195573255</td>
+ * <td>7</td>
+ * <td>Forwarding</td>
+ * <td>The unexpected IOException while handling request forwarding.</td>
+ * </tr>
+ * <tr>
+ * <td>47430008</td>
+ * <td>1195573256</td>
+ * <td>8</td>
+ * <td>Encapsulation </td>
+ * <td>The unexpected IOException while handling data encapsulation, tagged
+ * components, tagged profiles, etc.</td>
+ * </tr>
+ * <tr>
+ * <td>47430009</td>
+ * <td>1195573257</td>
+ * <td>9 </td>
+ * <td>Any</td>
+ * <td>The unexpected IOException while inserting or extracting data to/from
+ * the Any.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000a</td>
+ * <td>1195573258 </td>
+ * <td>10</td>
+ * <td>UserException</td>
+ * <td>The unexpected UserException in the context where it cannot be handled
+ * as such and must be converted to the SystemException. </td>
+ * </tr>
+ * <tr>
+ * <td>4743000b</td>
+ * <td>1195573259</td>
+ * <td>11</td>
+ * <td>Inappropriate</td>
+ * <td>While the operation could formally be applied to the target, the OMG
+ * standard states that it is actually not applicable. For example, some CORBA
+ * objects like POA are always local and should not be passed to or returned
+ * from the remote side.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000c</td>
+ * <td>1195573260</td>
+ * <td>12</td>
+ * <td>Negative</td>
+ * <td>When reading data, it was discovered that size of the data structure
+ * like string, sequence or character is written as the negative number.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000e</td>
+ * <td>1195573262 </td>
+ * <td>14</td>
+ * <td>Graph</td>
+ * <td>Reference to non-existing node in the data grapth while reading the
+ * value types.</td>
+ * </tr>
+ * <tr>
+ * <td>4743000f</td>
+ * <td>1195573263</td>
+ * <td>15</td>
+ * <td>Boxed</td>
+ * <td>Unexpected exception was thrown from the IDL type helper while handling
+ * the object of this type as a boxed value.</td>
+ * </tr>
+ * <tr>
+ * <td>47430010</td>
+ * <td>1195573264</td>
+ * <td>16</td>
+ * <td>Instantiation</td>
+ * <td>Unable to instantiate an value type object while reading it from the
+ * stream.</td>
+ * </tr>
+ * <tr>
+ * <td>47430011</td>
+ * <td>1195573265</td>
+ * <td>17</td>
+ * <td>ValueHeaderTag</td>
+ * <td>The header tag of the value type being read from the CDR stream contains
+ * an unexpected value outside 0x7fffff00 .. 0x7fffffff and also not null and
+ * not an indirection.</td>
+ * </tr>
+ * <tr>
+ * <td>47430012</td>
+ * <td>1195573266</td>
+ * <td>18</td>
+ * <td>ValueHeaderFlags</td>
+ * <td>The header tag flags of the value type being read from the CDR stream
+ * make the invalid combination (for instance, 0x7fffff04).</td>
+ * </tr>
+ * <tr>
+ * <td>47430013</td>
+ * <td>1195573267</td>
+ * <td>19</td>
+ * <td>ClassCast</td>
+ * <td>The value type class, written on the wire, is not compatible with the
+ * expected class, passed as a parameter to the InputStream.read_value.</td>
+ * </tr>
+ * <tr>
+ * <td>47430014</td>
+ * <td>1195573268</td>
+ * <td>20</td>
+ * <td>Offset</td>
+ * <td>Positive or otherwise invalid indirection offset when reading the data
+ * graph of the value type.</td>
+ * </tr>
+ * <tr>
+ * <td>47430015</td>
+ * <td>1195573269</td>
+ * <td>21</td>
+ * <td>Chunks</td>
+ * <td>Errors while reading the chunked value type.</td>
+ * </tr>
+ * <tr>
+ * <td>47430016</td>
+ * <td>1195573270</td>
+ * <td>22</td>
+ * <td>UnsupportedValue</td>
+ * <td>No means are provided to read or write this value type (not Streamable,
+ * not CustomMarshal, not Serializable, no factory, no helper.</td>
+ * </tr>
+ * <tr>
+ * <td>47430017</td>
+ * <td>1195573271</td>
+ * <td>23</td>
+ * <td>Factory</td>
+ * <td>The value factory, required for the operation being invoked, is not
+ * registered with this ORB.</td>
+ * </tr>
+ * <tr>
+ * <td>47430018</td>
+ * <td>1195573272</td>
+ * <td>24</td>
+ *
+ * <td>UnsupportedAddressing</td>
+ * <td>Unsupported object addressing method in GIOP request header.</td>
+ * </tr>
+ * <tr>
+ * <td>47430019</td>
+ * <td>1195573273</td>
+ * <td>25</td>
+ * <td>IOR</td>
+ * <td>Invalid object reference (IOR).</td>
+ * </tr>
+ * <tr>
+ * <td>4743001a</td>
+ * <td>1195573274</td>
+ * <td>26</td>
+ * <td>TargetConversion</td>
+ * <td>Problems with converting between stubs, ties, interfaces and
+ * implementations.</td>
+ *
+ * </tr>
+ * <tr>
+ * <td>4743001b</td>
+ * <td>1195573275</td>
+ * <td>27</td>
+ * <td>ValueFields</td>
+ * <td>Problems with reading or writing the fields of the value type object
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>4743001c</td>
+ * <td>1195573276</td>
+ * <td>28</td>
+ * <td>NonSerializable</td>
+ * <td>The instance of the value type, passed using RMI over IIOP, is not
+ * serializable</td>
+ * </tr>
+ * </table>
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
@@ -50,14 +272,15 @@ public class MARSHAL
extends SystemException
implements Serializable
{
- /**
+ /**
* Use serialVersionUID for interoperability.
*/
private static final long serialVersionUID = 7416408250336395546L;
/**
- * Creates a MARSHAL with the default minor code of 0,
- * completion state COMPLETED_NO and the given explaining message.
+ * Creates a MARSHAL with the default minor code of 0, completion state
+ * COMPLETED_NO and the given explaining message.
+ *
* @param reasom the explaining message.
*/
public MARSHAL(String message)
@@ -66,32 +289,35 @@ public class MARSHAL
}
/**
- * Creates MARSHAL with the default minor code of 0 and a
- * completion state COMPLETED_NO.
+ * Creates MARSHAL with the default minor code of 0 and a completion state
+ * COMPLETED_NO.
*/
public MARSHAL()
{
super("", 0, CompletionStatus.COMPLETED_NO);
}
- /** Creates a MARSHAL exception with the specified minor
- * code and completion status.
- * @param minor additional error code.
- * @param completed the method completion status.
+ /**
+ * Creates a MARSHAL exception with the specified minor code and completion
+ * status.
+ *
+ * @param minor_code additional error code.
+ * @param is_completed the method completion status.
*/
- public MARSHAL(int minor, CompletionStatus completed)
+ public MARSHAL(int minor_code, CompletionStatus is_completed)
{
- super("", minor, completed);
+ super("", minor_code, is_completed);
}
/**
* Created MARSHAL exception, providing full information.
+ *
* @param reason explaining message.
- * @param minor additional error code (the "minor").
- * @param completed the method completion status.
+ * @param minor_code additional error code (the "minor").
+ * @param is_completed the method completion status.
*/
- public MARSHAL(String reason, int minor, CompletionStatus completed)
+ public MARSHAL(String reason, int minor_code, CompletionStatus is_completed)
{
- super(reason, minor, completed);
+ super(reason, minor_code, is_completed);
}
}
diff --git a/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java b/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java
index 262b8ce1a6b..013bdb674ce 100644
--- a/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java
+++ b/libjava/classpath/org/omg/CORBA/NO_RESOURCES.java
@@ -41,9 +41,39 @@ package org.omg.CORBA;
import java.io.Serializable;
/**
- * Means that the ORB has reached some general resource limitation like
- * maximal number of the opened connections.
- *
+ * Means that the ORB has reached some general resource limitation like maximal
+ * number of the opened connections.
+ *
+ * In GNU Classpath, this exception may have the following minor codes:
+ *
+ * <table border="1">
+ * <tr>
+ * <td>Hex</td>
+ * <td>Dec</td>
+ * <td>Minor</td>
+ * <td>Name</td>
+ * <td>Case</td>
+ * </tr>
+ * <tr>
+ * <td>47430014</td>
+ * <td>1195573268</td>
+ * <td>20</td>
+ * <td>Ports</td>
+ * <td>No more free ports available for the new objects. The port control, if
+ * turned on, prevents malicios client from knocking the server out by suddenly
+ * requiring to allocate a very large number of objects.</td>
+ * </tr>
+ * <tr>
+ * <td>47430015</td>
+ * <td>1195573269</td>
+ * <td>21</td>
+ * <td>Threads</td>
+ * <td> Too many parallel calls (too many parallel threads). The thread control,
+ * if turned on, prevents malicios client from knocking the server out by
+ * suddenly submitting a very large number of requests. </td>
+ * </tr>
+ * </table>
+ *
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
public class NO_RESOURCES
@@ -56,8 +86,9 @@ public class NO_RESOURCES
private static final long serialVersionUID = 8129246118235803597L;
/**
- * Creates a NO_RESOURCES with the default minor code of 0,
- * completion state COMPLETED_NO and the given explaining message.
+ * Creates a NO_RESOURCES with the default minor code of 0, completion state
+ * COMPLETED_NO and the given explaining message.
+ *
* @param reasom the explaining message.
*/
public NO_RESOURCES(String message)
@@ -66,32 +97,35 @@ public class NO_RESOURCES
}
/**
- * Creates NO_RESOURCES with the default minor code of 0 and a
- * completion state COMPLETED_NO.
+ * Creates NO_RESOURCES with the default minor code of 0 and a completion
+ * state COMPLETED_NO.
*/
public NO_RESOURCES()
{
super("", 0, CompletionStatus.COMPLETED_NO);
}
- /** Creates a NO_RESOURCES exception with the specified minor
- * code and completion status.
- * @param minor additional error code.
- * @param completed the method completion status.
+ /**
+ * Creates a NO_RESOURCES exception with the specified minor code and
+ * completion status.
+ *
+ * @param a_minor additional error code.
+ * @param a_completed the method completion status.
*/
- public NO_RESOURCES(int minor, CompletionStatus completed)
+ public NO_RESOURCES(int a_minor, CompletionStatus a_completed)
{
- super("", minor, completed);
+ super("", a_minor, a_completed);
}
/**
* Created NO_RESOURCES exception, providing full information.
- * @param reason explaining message.
- * @param minor additional error code (the "minor").
- * @param completed the method completion status.
+ *
+ * @param a_reason explaining message.
+ * @param a_minor additional error code (the "minor").
+ * @param a_completed the method completion status.
*/
- public NO_RESOURCES(String reason, int minor, CompletionStatus completed)
+ public NO_RESOURCES(String a_reason, int a_minor, CompletionStatus a_completed)
{
- super(reason, minor, completed);
+ super(a_reason, a_minor, a_completed);
}
}
diff --git a/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java b/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java
index f40e570a79b..5d2430b23bb 100644
--- a/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java
+++ b/libjava/classpath/org/omg/CORBA/NameValuePairHelper.java
@@ -39,9 +39,10 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.DynAn.NameValuePairHolder;
-import gnu.CORBA.aliasTypeCode;
-import gnu.CORBA.primitiveTypeCode;
-import gnu.CORBA.stringTypeCode;
+import gnu.CORBA.typecodes.AliasTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
+import gnu.CORBA.Minor;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -75,7 +76,9 @@ public abstract class NameValuePairHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("NameValuePair expected");
+ BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected");
+ bad.minor = Minor.Any;
+ throw bad;
}
}
@@ -117,12 +120,12 @@ public abstract class NameValuePairHelper
StructMember[] members = new StructMember[ 2 ];
TypeCode t_id =
- new aliasTypeCode(new stringTypeCode(TCKind.tk_string), "", "id");
+ new AliasTypeCode(new StringTypeCode(TCKind.tk_string), "", "id");
members [ 0 ] = new StructMember("id", t_id, null);
members [ 1 ] =
- new StructMember("value", new primitiveTypeCode(TCKind.tk_any), null);
+ new StructMember("value", new PrimitiveTypeCode(TCKind.tk_any), null);
typeCode = ORB.init().create_struct_tc(id(), "NameValuePair", members);
}
diff --git a/libjava/classpath/org/omg/CORBA/OMGVMCID.java b/libjava/classpath/org/omg/CORBA/OMGVMCID.java
index 6c7b30810ef..2b2bd4bc3ef 100644
--- a/libjava/classpath/org/omg/CORBA/OMGVMCID.java
+++ b/libjava/classpath/org/omg/CORBA/OMGVMCID.java
@@ -1,54 +1,72 @@
/* OMGVMCID.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath 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, or (at your option)
+ any later version.
+
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
package org.omg.CORBA;
/**
- * Holds a single constant, specifying, that
- * The vendor minor code ID reserved for the Object Management Group
- * (http://www.omg.org).
+ * </p>
+ * The higher 20 bits of any CORBA exception hold "Vendor Minor Codeset ID"
+ * (VMCID), for instance 0x4F4D0000 (OMG standard), 0x54410000 (TAO), 0x4A430000
+ * (JacORB), 0x49540000 (IONA), 0x53550000 (Sun).
+ * </p>
+ * <p>
+ * GNU Classpath official vendor minor code set id is 0x47430000 ("GC\x00\x00"),
+ * and the reserved space spans till 0x47430FFF, allowing to use up to 4096
+ * Classpath specific exceptions. It was assigned 30/09/2005 by OMG Vice President
+ * Andrew Watson.
+ * </p>
+ * <p>
+ * The standard minor codes for the standard system exceptions are prefaced by
+ * the VMCID assigned to OMG, defined as 0x4F4D0000 (the code of the minor field
+ * for the standard exception with minor code 1 is 0x4F4D0001). Within a vendor
+ * assigned space, the assignment of values to minor codes is left to the
+ * vendor.
+ * </p>
+ *
+ * <p>
+ * The VMCID 0 and 0xFFFFF0000 are reserved for experimental use.
+ * </p>
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public interface OMGVMCID
{
/**
- * The vendor minor code ID (1330446336) reserved for the Object
- * Management Group (http://www.omg.org).
+ * The OMG vendor minor code ID.
*/
- int value = 1330446336;
+ int value = 0x4F4D0000;
}
diff --git a/libjava/classpath/org/omg/CORBA/ORB.java b/libjava/classpath/org/omg/CORBA/ORB.java
index 9163736eb97..06259fafa32 100644
--- a/libjava/classpath/org/omg/CORBA/ORB.java
+++ b/libjava/classpath/org/omg/CORBA/ORB.java
@@ -38,15 +38,18 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
-import gnu.CORBA.fixedTypeCode;
-import gnu.CORBA.generalTypeCode;
+import gnu.CORBA.OrbFocused;
+import gnu.CORBA.ObjectCreator;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.gnuContext;
-import gnu.CORBA.primitiveTypeCode;
-import gnu.CORBA.recordTypeCode;
-import gnu.CORBA.recursiveTypeCode;
+import gnu.CORBA.typecodes.FixedTypeCode;
+import gnu.CORBA.typecodes.GeneralTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+import gnu.CORBA.typecodes.RecursiveTypeCode;
import org.omg.CORBA.ORBPackage.InconsistentTypeCode;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
import java.applet.Applet;
@@ -58,17 +61,17 @@ import java.io.IOException;
import java.util.Properties;
/**
- * A central class in CORBA implementation, responsible for sending and
- * handling remote invocations. ORB also works as a factory for
- * creating instances of certain CORBA classes.
- *
- * Despite the core library contains the fully working CORBA implementation,
- * it also provides a simple way to plug-in the alternative CORBA support.
- * This is done by replacing the ORB. The alternative ORB can be specified
- * via properties, passed to ORB.Init(...).
- *
- * When creating an ORB instance, the class name
- * is searched in the following locations:
+ * A central class in CORBA implementation, responsible for sending and handling
+ * remote invocations. ORB also works as a factory for creating instances of
+ * certain CORBA classes.
+ *
+ * Despite the core library contains the fully working CORBA implementation, it
+ * also provides a simple way to plug-in the alternative CORBA support. This is
+ * done by replacing the ORB. The alternative ORB can be specified via
+ * properties, passed to ORB.Init(...).
+ *
+ * When creating an ORB instance, the class name is searched in the following
+ * locations:
* <p>
* 1. Applet parameter or application string array, if any.<br>
* 2. The properties parameter, if any.<br>
@@ -76,32 +79,72 @@ import java.util.Properties;
* 4. The orb.properties file located in the user.home directory (if any).<br>
* 5. The orb.properties file located in the java.home/lib directory (if any).
* </p>
- *
- * The supported properties are:
- * <table border="1">
- * <tr><td> org.omg.CORBA.ORBClass</td><td>The class,
- * implementing the functional ORB, returned by
- * {@link #init(Applet, Properties)} or
- * {@link #init(String[], Properties)} </td></tr>
- * <tr><td>org.omg.CORBA.ORBSingletonClass</td><td>The class,
- * implementing the restricted ORB, returned by
- * {@link #init()}.
- * </td></tr>
- * <tr><td>org.omg.CORBA.ORBInitRef</td><td>Specifies the
- * initial reference, accessible by name with the method
- * {@link resolve_initial_references(String)}.
- * </table>
- * The command line accepts the same properties as a keys. When specifying
- * in the command line, the prefix org.omg.CORBA can be omitted,
- * for instance<code> -ORBInitRef NameService=IOR:aabbccdd....</code>
- *
+ *
+ * The supported properties are: <table border="1">
+ * <tr>
+ * <td> org.omg.CORBA.ORBClass</td>
+ * <td>The class, implementing the functional ORB, returned by
+ * {@link #init(Applet, Properties)} or {@link #init(String[], Properties)}
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>org.omg.CORBA.ORBSingletonClass</td>
+ * <td>The class, implementing the restricted ORB, returned by {@link #init()}.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>org.omg.CORBA.ORBInitRef</td>
+ * <td>Specifies the initial reference, accessible by name with the method
+ * {@link #resolve_initial_references(String)}.</td>
+ * </tr>
+ * <tr>
+ * <td>org.omg.CORBA.ORBid</td>
+ * <td>Specifies the name (ORB Id) of this ORB. The ORB Id is later accessible
+ * by {@link ObjectReferenceTemplate#orb_id}. The default value includes the
+ * hashcode of the ORB instance that is normally different for each ORB.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>org.omg.CORBA.ServerId</td>
+ * <td>Specifies the name (Server Id) of this server. This property assigns
+ * value to the <i>static</i> field, ensuring that all ORB's on the same jre
+ * have the same Server Id. It is normally set as the system property. The
+ * server Id is later accessible as {@link ObjectReferenceTemplate#server_id}.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>gnu.CORBA.ListenerPort</td>
+ * <td>Specifies that this ORB should serve all its objects on a single port
+ * (for example, "1234") or on a specified port range (for example,
+ * "1100-1108"). The property is used when working with firewals and serves as a
+ * replacement for the proprietary properties like com.ibm.CORBA.ListenerPort
+ * or com.sun.CORBA.POA.ORBPersistentServerPort. The specified port or range
+ * should not overlap with the values, specified for other ORB's.
+ * </td>
+ * </tr>
+ * <tr>
+ * <td>gnu.Corba.SocketFactory</td>
+ * <td>Sets the user-defined server and client socket factory for the ORB being
+ * currently instantiated. Serves as a replacement of the proprietary
+ * property com.sun.CORBA.connection.ORBSocketFactoryClass. To have multiple
+ * types of sockets, instantiate several ORB's with this property each time
+ * set to the different value.
+ * The factory must implement gnu.CORBA.interfaces.SocketFactory.
+ * </td>
+ * </tr>
+ * </table>
+ * <p>The command line accepts the same properties as a keys. When
+ * specifying in the command line, the prefix org.omg.CORBA can be omitted, for
+ * instance<code> -ORBInitRef NameService=IOR:aabbccdd....</code>
+ * </p>
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public abstract class ORB
{
/**
- * By default, {@link init(String[], Properties)} and
- * {@link init(Applet, Properties} return
+ * By default, {@link #init(String[], Properties)} and
+ * {@link #iinit(Applet, Properties)} return
* the built-in fully functional ORB is returned. If the
* <code>props</code> contains the property org.omg.CORBA.ORBClass,
* the value of this property is used as a class name to instantiate
@@ -114,18 +157,21 @@ public abstract class ORB
*/
private static final String RESTRICTED_ORB =
"org.omg.CORBA.ORBSingletonClass";
-
+
+ private static final String LISTENER_PORT =
+ OrbFocused.LISTENER_PORT;
+
/**
* The class, implementing the default fully functional ORB.
*/
private static final String DEFAULT_FUNCTIONAL_ORB =
gnu.CORBA.Poa.ORB_1_4.class.getName();
-
- /**
- * The class, implementing the default restricted ORB.
- */
- private static final String DEFAULT_RESTRICTED_ORB =
- gnu.CORBA.Restricted_ORB.class.getName();
+
+ private static final String DEFAULT_FOCUSED_ORB =
+ gnu.CORBA.OrbFocused.class.getName();
+
+ // There is no need for name of the default restricted ORB as it is
+ // singleton and it is more effectively referred directly.
/**
* Connect the given CORBA object to this ORB. After the object is
@@ -172,7 +218,7 @@ public abstract class ORB
/**
* Create an instance of the CORBA {@link Any} with the type, intialised
- * to {@link TCKind#tc_null}
+ * to {@link TCKind#tk_null}
*/
public abstract Any create_any();
@@ -359,7 +405,7 @@ public abstract class ORB
*/
public TypeCode create_fixed_tc(short digits, short scale)
{
- fixedTypeCode r = new fixedTypeCode();
+ FixedTypeCode r = new FixedTypeCode();
r.setDigits(digits);
r.setScale(scale);
return r;
@@ -394,7 +440,7 @@ public abstract class ORB
*
* @return the named value.
*/
- public abstract NamedValue create_named_value(String s, Any any, int flags);
+ public abstract NamedValue create_named_value(String name, Any any, int flags);
/**
* Send multiple prepared requests one way, do not caring about the answer.
@@ -466,7 +512,7 @@ public abstract class ORB
* However this method is oficially documented as not implemented at least
* till v1.4 inclusive.
*
- * @param peration_definition the operation definition, must be
+ * @param operation_definition the operation definition, must be
* CORBA <code>OperationDef</code>.
*
* @return never
@@ -482,7 +528,7 @@ public abstract class ORB
* <p>Creates the new policy of the specified type, having the given value.
* This method looks for the policy factory that was previously registered
* during ORB initialization by
- * {@link org.omg.PortableInterceptor.ORBInitialiser}.
+ * {@link org.omg.PortableInterceptor#ORBInitialiser}.
*
* If the suitable factory is found, this factory creates the requested policy,
* otherwise the PolicyError is thrown.
@@ -532,7 +578,7 @@ public abstract class ORB
*
* The TypeCode object is initialized with the given id, name, and members.
* @param id the Id of this type.
- * @param the name of this type.
+ * @param name the name of this type.
* @param members the member list.
*
* @return the typecode.
@@ -548,7 +594,7 @@ public abstract class ORB
* and members.
*
* @param id the Id of this type.
- * @param the name of this type.
+ * @param name the name of this type.
* @param discriminator the union discriminator.
* @param members the member list.
*
@@ -579,7 +625,7 @@ public abstract class ORB
*/
public TypeCode create_abstract_interface_tc(String id, String name)
{
- generalTypeCode t = new generalTypeCode(TCKind.tk_abstract_interface);
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_abstract_interface);
t.setName(name);
t.setId(id);
return t;
@@ -595,7 +641,7 @@ public abstract class ORB
*/
public TypeCode create_native_tc(String id, String name)
{
- generalTypeCode t = new generalTypeCode(TCKind.tk_native);
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_native);
t.setName(name);
t.setId(id);
return t;
@@ -629,11 +675,11 @@ public abstract class ORB
*/
public TypeCode create_recursive_sequence_tc(int bound, int offset)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_struct);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_struct);
for (int i = 0; i < offset; i++)
r.add(new StructMember());
- TypeCode recurs = new primitiveTypeCode(TCKind.tk_sequence);
+ TypeCode recurs = new PrimitiveTypeCode(TCKind.tk_sequence);
r.add(new StructMember("", recurs, null));
return r;
@@ -648,7 +694,7 @@ public abstract class ORB
*/
public TypeCode create_recursive_tc(String id)
{
- return new recursiveTypeCode(id);
+ return new RecursiveTypeCode(id);
}
/**
@@ -658,7 +704,7 @@ public abstract class ORB
TypeCode boxed_type
)
{
- generalTypeCode t = new generalTypeCode(TCKind.tk_value_box);
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_value_box);
t.setName(name);
t.setId(id);
t.setContentType(boxed_type);
@@ -672,7 +718,7 @@ public abstract class ORB
TypeCode concrete_base, ValueMember[] members
)
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_value);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_value);
r.setId(id);
r.setName(name);
r.setTypeModifier(type_modifier);
@@ -741,7 +787,7 @@ public abstract class ORB
* @return the default context of this ORB.
*
* @throws NO_IMPLEMENT for the Singleton ORB, returned by
- * the parameterless {@link init()}.
+ * the parameterless {@link #init()}.
*/
public Context get_default_context()
{
@@ -751,7 +797,7 @@ public abstract class ORB
/**
* Return thg typecode, representing the given primitive object type.
*
- * @param the kind of the primitive typecode.
+ * @param tcKind the kind of the primitive typecode.
*
* @return the typecode of the primitve typecode.
*/
@@ -779,9 +825,9 @@ public abstract class ORB
*/
public static ORB init()
{
- String orb_cn = getORBName(null, RESTRICTED_ORB);
+ String orb_cn = getCumulatedProperty(null, RESTRICTED_ORB);
if (orb_cn == null)
- return Restricted_ORB.Singleton;
+ return OrbRestricted.Singleton;
else
return createORB(null, orb_cn);
}
@@ -804,6 +850,11 @@ public abstract class ORB
public static ORB init(Applet applet, Properties props)
{
String ocn = applet.getParameter(FUNCTIONAL_ORB);
+ String lp = applet.getParameter(LISTENER_PORT);
+
+ if (ocn==null && lp!=null)
+ ocn = DEFAULT_FOCUSED_ORB;
+
ORB orb = createORB(props, ocn);
orb.set_parameters(applet, props);
@@ -811,40 +862,44 @@ public abstract class ORB
}
/**
- * Creates the working instance of ORB for a
- * standalone application.
- *
- * By default the built-in fully functional ORB is returned. The ORB class
- * is found as described in the header of this class.
- *
- * @param the parameters, passed to the applications
- * <code>main(String[] args)</code> method, may be <code>null</code>.
- * The parameter -org.omg.CORBA.ORBClass <class name>
- * if present, defines the used ORB implementation class. If this
- * property is not present, the ORB class is found as described in the
- * class header.
-
- *
+ * Creates the working instance of ORB for a standalone application.
+ *
+ * By default the built-in fully functional ORB is returned. The ORB class is
+ * found as described in the header of this class.
+ *
+ * @param args the parameters, passed to the applications
+ * <code>main(String[] args)</code> method, may be <code>null</code>. The
+ * parameter -org.omg.CORBA.ORBClass <class name> if present, defines the used
+ * ORB implementation class. If this property is not present, the ORB class is
+ * found as described in the class header.
+ *
* @param props application specific properties, may be <code>null</code>.
- *
+ *
* @return a newly created functional derivative of this abstract class.
*/
public static ORB init(String[] args, Properties props)
{
String ocn = null;
+ String lp = null;
String orbKey = "-" + FUNCTIONAL_ORB;
+ String lpKey = "-" + LISTENER_PORT;
if (args != null)
if (args.length >= 2)
{
for (int i = 0; i < args.length - 1; i++)
{
- if (args [ i ].equals(orbKey))
- ocn = args [ i + 1 ];
+ if (args[i].equals(orbKey))
+ ocn = args[i + 1];
+ if (args[i].equals(lpKey))
+ lp = args[i + 1];
}
}
+ if (lp != null && ocn == null)
+ ocn = DEFAULT_FOCUSED_ORB;
+
ORB orb = createORB(props, ocn);
orb.set_parameters(args, props);
@@ -853,10 +908,10 @@ public abstract class ORB
/**
* List the initially available CORBA objects (services).
- *
+ *
* @return a list of services.
- *
- * @see resolve_initial_references(String)
+ *
+ * @see #resolve_initial_references(String)
*/
public abstract String[] list_initial_services();
@@ -919,9 +974,9 @@ public abstract class ORB
* (key) inside the server, the communication protocol version,
* supported charsets and so on.
*
- * @param the CORBA object
+ * @param forObject the CORBA object
* @return the object IOR representation.
- * @see string_to_object(String)
+ * @see #string_to_object(String)
*/
public abstract String object_to_string(Object forObject);
@@ -985,6 +1040,12 @@ public abstract class ORB
* that runs on the given host at the given port. The ORB expects to find
* there the {@link org.omg.CosNaming.NamingContext} under the key
* "NameService.<br>
+ * 7. file://[file name] Read the object definition string from the
+ * file system<br>
+ * 8. http://[url] Read the object definition string from the provided
+ * url.<br>
+ * 9. ftp://[url] Read the object definition string from the provided
+ * url.<br>
*
* <p>The default port is always 2809. The default iiop version is 1.0
* that now may not always be supported, so we would recommend to specify
@@ -1016,7 +1077,7 @@ public abstract class ORB
* @throws DATA_CONVERSION if the string being parsed contains unsupported
* prefix or protocol.
*
- * @see object_to_string(org.omg.CORBA.Object)
+ * @see #object_to_string(org.omg.CORBA.Object)
*/
public abstract Object string_to_object(String IOR);
@@ -1056,7 +1117,7 @@ public abstract class ORB
* application.
*
* @param props application specific properties that were passed
- * as a second parameter in {@link init(String[], Properties)}).
+ * as a second parameter in {@link #init(String[], Properties)}).
* Can be <code>null</code>.
*/
protected abstract void set_parameters(String[] para, Properties props);
@@ -1074,23 +1135,10 @@ public abstract class ORB
protected abstract void set_parameters(Applet app, Properties props);
/**
- * Checks if the communication over network is allowed.
- * @throws java.lang.SecurityException
+ * Get the property with the given name, searching in the standard
+ * places for the ORB properties.
*/
- private static final void checkNetworkingPermission(String host, int port)
- throws SecurityException
- {
- SecurityManager security = System.getSecurityManager();
- if (security != null)
- {
- security.checkConnect(host, port);
- }
- }
-
- /**
- * Get the ORB class name.
- */
- private static String getORBName(Properties props, String property)
+ private static String getCumulatedProperty(Properties props, String property)
{
String orb_cn = null;
@@ -1105,7 +1153,7 @@ public abstract class ORB
if (orb_cn == null)
orb_cn = checkFile(property, "java.home", "lib");
-
+
return orb_cn;
}
@@ -1148,10 +1196,10 @@ public abstract class ORB
/**
* Create ORB when its name is possibly known.
- *
+ *
* @param props properties, possibly containing the ORB name.
- * @param orbClassName the direct ORB class name, overriding
- * other possible locations, or null if not specified.
+ * @param orbClassName the direct ORB class name, overriding other possible
+ * locations, or null if not specified.
*/
private static ORB createORB(Properties props, String orbClassName)
{
@@ -1159,15 +1207,21 @@ public abstract class ORB
if (orbClassName == null)
{
- orbClassName = getORBName(props, FUNCTIONAL_ORB);
+ orbClassName = getCumulatedProperty(props, FUNCTIONAL_ORB);
if (orbClassName == null)
- orbClassName = DEFAULT_FUNCTIONAL_ORB;
+ {
+ String lp = getCumulatedProperty(props, LISTENER_PORT);
+ if (lp != null)
+ orbClassName = DEFAULT_FOCUSED_ORB;
+ else
+ orbClassName = DEFAULT_FUNCTIONAL_ORB;
+ }
}
try
{
- orb = (ORB) Class.forName(orbClassName).newInstance();
+ orb = (ORB) ObjectCreator.forName(orbClassName).newInstance();
}
catch (ClassNotFoundException ex)
{
diff --git a/libjava/classpath/org/omg/CORBA/ObjectHelper.java b/libjava/classpath/org/omg/CORBA/ObjectHelper.java
index 1324c621f2b..220f2daced2 100644
--- a/libjava/classpath/org/omg/CORBA/ObjectHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ObjectHelper.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.Minor;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -63,7 +64,9 @@ public abstract class ObjectHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("CORBA object expected");
+ BAD_OPERATION bad = new BAD_OPERATION("CORBA object expected");
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/ObjectHolder.java b/libjava/classpath/org/omg/CORBA/ObjectHolder.java
index 27ae674167a..f79a89bef0d 100644
--- a/libjava/classpath/org/omg/CORBA/ObjectHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ObjectHolder.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
-import gnu.CORBA.recordTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -63,11 +63,11 @@ public final class ObjectHolder
* The default type code for this holder if the object type code with
* the zero length string as id.
*/
- private static final recordTypeCode t_object;
+ private static final RecordTypeCode t_object;
static
{
- t_object = new recordTypeCode(TCKind.tk_objref);
+ t_object = new RecordTypeCode(TCKind.tk_objref);
t_object.setId("");
}
diff --git a/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java b/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java
index 0612ae4e2ff..df7b22ff52f 100644
--- a/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/OctetSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class OctetSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_octet);
+ return new ArrayTypeCode(TCKind.tk_octet);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java b/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java
index 5092d707eea..62ea7381920 100644
--- a/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/OctetSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class OctetSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_octet);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_octet);
/**
* Constructs an instance of OctetSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java b/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java
index 8aae9b3bcf6..df17cefa9e9 100644
--- a/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java
+++ b/libjava/classpath/org/omg/CORBA/PERSIST_STORE.java
@@ -57,7 +57,7 @@ public class PERSIST_STORE
/**
* Creates a PERSIST_STORE with the default minor code of 0,
* completion state COMPLETED_NO and the given explaining message.
- * @param reasom the explaining message.
+ * @param message the explaining message.
*/
public PERSIST_STORE(String message)
{
diff --git a/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java b/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java
index ec75b2bcf72..ac17a9235ba 100644
--- a/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ParameterModeHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -87,7 +87,7 @@ public abstract class ParameterModeHelper
new String[] { "PARAM_IN", "PARAM_OUT", "PARAM_INOUT" };
typeCode =
- Restricted_ORB.Singleton.create_enum_tc(id(), "ParameterMode", members);
+ OrbRestricted.Singleton.create_enum_tc(id(), "ParameterMode", members);
}
return typeCode;
}
diff --git a/libjava/classpath/org/omg/CORBA/PolicyError.java b/libjava/classpath/org/omg/CORBA/PolicyError.java
index 82ae4e45dc0..749868a992f 100644
--- a/libjava/classpath/org/omg/CORBA/PolicyError.java
+++ b/libjava/classpath/org/omg/CORBA/PolicyError.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
+import org.omg.CORBA.portable.IDLEntity;
+
import java.io.Serializable;
/**
@@ -75,7 +77,7 @@ public class PolicyError
/**
* Constructs the policy error with the given reason code.
- * @param reason a reason code, one of
+ * @param a_reason a reason code, one of
* {@link BAD_POLICY}, {@link BAD_POLICY_TYPE},
* {@link BAD_POLICY_VALUE}, {@link UNSUPPORTED_POLICY},
* {@link UNSUPPORTED_POLICY_VALUE}.
@@ -88,11 +90,11 @@ public class PolicyError
/**
* Constructs the policy error with the given reason code and the
* detailed message.
- * @param reason a reason code, one of
+ * @param a_details the detailed message.
+ * @param a_reason a reason code, one of
* {@link BAD_POLICY}, {@link BAD_POLICY_TYPE},
* {@link BAD_POLICY_VALUE}, {@link UNSUPPORTED_POLICY},
* {@link UNSUPPORTED_POLICY_VALUE}.
- * @param details the detailed message.
*/
public PolicyError(String a_details, short a_reason)
{
diff --git a/libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java b/libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java
new file mode 100644
index 00000000000..ab7ac95479a
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/PolicyErrorCodeHelper.java
@@ -0,0 +1,115 @@
+/* PolicyErrorCodeHelper.java --
+Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.omg.CORBA;
+
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * A helper operations for the policy error code as an alias of
+ * <code>short</code>.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class PolicyErrorCodeHelper
+
+{
+
+ /**
+ * Delegates call to {@link Any.extract_short()}.
+ */
+ public static short extract(Any a)
+ {
+ return a.extract_short();
+ }
+
+ /**
+ * Returns policy error code repository id.
+ *
+ * @return "IDL:omg.org/CORBA/PolicyErrorCode:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/CORBA/PolicyErrorCode:1.0";
+ }
+
+ /**
+ * Delegates call to {@link Any.insert_short(short)}.
+ */
+ public static void insert(Any a, short that)
+ {
+ a.insert_short(that);
+ }
+
+ /**
+ * Delegates call to {@link InputStream.read_short()}.
+ */
+ public static short read(InputStream istream)
+ {
+ return istream.read_short();
+ }
+
+ /**
+ * Returns a typecode of the policy error code, stating it is an alias of
+ * <code>short</code>, named "PolicyErrorCode".
+ *
+ * @return a typecode of synchronization scope.
+ */
+ public static TypeCode type()
+ {
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_alias);
+ r.setName("PolicyErrorCode");
+ r.setId(id());
+ r.setContentType(new PrimitiveTypeCode(TCKind.tk_short));
+ return r;
+ }
+
+ /**
+ * Delegates call to {@link OutputStream.write_short()}.
+ */
+ public static void write(OutputStream ostream, short value)
+ {
+ ostream.write_short(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java b/libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java
new file mode 100644
index 00000000000..49db768cd3b
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/PolicyErrorHelper.java
@@ -0,0 +1,158 @@
+/* PolicyErrorHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+* The helper operations for the exception {@link PolicyError}.
+*
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public abstract class PolicyErrorHelper
+{
+ /**
+ * The cached typecode value, computed only once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Create the PolicyError typecode. The typecode defines a structure, named
+ * "PolicyError", containing the {@link PolicyErrorCode} (alias int) field,
+ * named "reason".
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ {
+ ORB orb = ORB.init();
+ StructMember[] members = new StructMember[ 1 ];
+
+ TypeCode field;
+
+ field =
+ orb.create_alias_tc("IDL:omg.org/CORBA/PolicyErrorCode:1.0",
+ "PolicyErrorCode", orb.get_primitive_tc(TCKind.tk_short)
+ );
+ members [ 0 ] = new StructMember("reason", field, null);
+ typeCode = orb.create_exception_tc(id(), "PolicyError", members);
+ }
+ return typeCode;
+ }
+
+ /**
+ * Insert the PolicyError into the given Any.
+ * This method uses the PolicyErrorHolder.
+ *
+ * @param any the Any to insert into.
+ * @param that the PolicyError to insert.
+ */
+ public static void insert(Any any, PolicyError that)
+ {
+ any.insert_Streamable(new PolicyErrorHolder(that));
+ }
+
+ /**
+ * Extract the PolicyError from given Any.
+ * This method uses the PolicyErrorHolder.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain PolicyError.
+ */
+ public static PolicyError extract(Any any)
+ {
+ try
+ {
+ return ((PolicyErrorHolder) any.extract_Streamable()).value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("PolicyError expected");
+ bad.minor = Minor.Any;
+ bad.initCause(cex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the PolicyError repository id.
+ *
+ * @return "IDL:omg.org/CORBA/PolicyError:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/CORBA/PolicyError:1.0";
+ }
+
+ /**
+ * Read the exception from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static PolicyError read(InputStream input)
+ {
+ // Read the exception repository id.
+ String id = input.read_string();
+ PolicyError value = new PolicyError();
+
+ value.reason = input.read_short();
+ return value;
+ }
+
+ /**
+ * Write the exception to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, PolicyError value)
+ {
+ // Write the exception repository id.
+ output.write_string(id());
+ output.write_short(value.reason);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java b/libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java
new file mode 100644
index 00000000000..8e2c9a8d342
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/PolicyErrorHolder.java
@@ -0,0 +1,103 @@
+/* PolicyErrorHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+* A holder for the exception {@link PolicyError}.
+
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public class PolicyErrorHolder implements Streamable
+{
+ /**
+ * The stored PolicyError value.
+ */
+ public PolicyError value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public PolicyErrorHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public PolicyErrorHolder(PolicyError initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = PolicyErrorHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ PolicyErrorHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the PolicyError.
+ */
+ public TypeCode _type()
+ {
+ return PolicyErrorHelper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/PolicyHelper.java b/libjava/classpath/org/omg/CORBA/PolicyHelper.java
index 16b9d94c754..66fb0aa0868 100644
--- a/libjava/classpath/org/omg/CORBA/PolicyHelper.java
+++ b/libjava/classpath/org/omg/CORBA/PolicyHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -99,7 +101,9 @@ public abstract class PolicyHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("Policy expected");
+ BAD_OPERATION bad = new BAD_OPERATION("Policy expected");
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/PolicyListHelper.java b/libjava/classpath/org/omg/CORBA/PolicyListHelper.java
index f03836a4fcc..6e4d329b837 100644
--- a/libjava/classpath/org/omg/CORBA/PolicyListHelper.java
+++ b/libjava/classpath/org/omg/CORBA/PolicyListHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -97,7 +99,9 @@ public abstract class PolicyListHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("Policy[] expected");
+ BAD_OPERATION bad = new BAD_OPERATION("Policy[] expected");
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/PrincipalHolder.java b/libjava/classpath/org/omg/CORBA/PrincipalHolder.java
index 22501a0f794..270427f3fdd 100644
--- a/libjava/classpath/org/omg/CORBA/PrincipalHolder.java
+++ b/libjava/classpath/org/omg/CORBA/PrincipalHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -58,7 +58,7 @@ public final class PrincipalHolder
* The default type code for this holder.
*/
private static final TypeCode t_any =
- new primitiveTypeCode(TCKind.tk_Principal);
+ new PrimitiveTypeCode(TCKind.tk_Principal);
/**
* The instance of {@link Principal}, held by this holder.
diff --git a/libjava/classpath/org/omg/CORBA/REBIND.java b/libjava/classpath/org/omg/CORBA/REBIND.java
new file mode 100644
index 00000000000..9480906cc4d
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/REBIND.java
@@ -0,0 +1,99 @@
+/* REBIND.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised on the failure of the requested or implied attempt to
+ * rebind an object reference.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class REBIND
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 823920851143467547L;
+
+ /**
+ * Creates REBIND with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public REBIND(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates REBIND with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public REBIND()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a REBIND exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public REBIND(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created REBIND exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public REBIND(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java b/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java
index 42fb008521f..a392002fd23 100644
--- a/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java
+++ b/libjava/classpath/org/omg/CORBA/RepositoryIdHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -80,7 +80,7 @@ public abstract class RepositoryIdHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "RepositoryId", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java b/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java
index fe0135d975b..58000f2c5c7 100644
--- a/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ServiceDetailHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
import gnu.CORBA.ServiceDetailHolder;
import org.omg.CORBA.portable.InputStream;
@@ -78,7 +79,10 @@ public abstract class ServiceDetailHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java b/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java
index bfdad683e92..1fa1ef868d1 100644
--- a/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java
+++ b/libjava/classpath/org/omg/CORBA/SetOverrideTypeHelper.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.SetOverrideTypeHolder;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -88,7 +88,7 @@ public abstract class SetOverrideTypeHelper
};
typeCode =
- Restricted_ORB.Singleton.create_enum_tc(id(), "SetOverrideType",
+ OrbRestricted.Singleton.create_enum_tc(id(), "SetOverrideType",
members
);
}
diff --git a/libjava/classpath/org/omg/CORBA/ShortHolder.java b/libjava/classpath/org/omg/CORBA/ShortHolder.java
index c2e18cb2a8b..dfc4721f3f9 100644
--- a/libjava/classpath/org/omg/CORBA/ShortHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ShortHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,7 +62,7 @@ public final class ShortHolder
* The default type code for this holder.
*/
private static final TypeCode t_short =
- new primitiveTypeCode(TCKind.tk_short);
+ new PrimitiveTypeCode(TCKind.tk_short);
/**
* The <code>short</code> (CORBA <code>short</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java b/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java
index 21eda87d110..40124f216e9 100644
--- a/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ShortSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class ShortSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_short);
+ return new ArrayTypeCode(TCKind.tk_short);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java b/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java
index 183db3a5770..246d1ecf47e 100644
--- a/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ShortSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class ShortSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_short);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_short);
/**
* Constructs an instance of ShortSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/StringHolder.java b/libjava/classpath/org/omg/CORBA/StringHolder.java
index 8a637c8e57f..ac45c562c70 100644
--- a/libjava/classpath/org/omg/CORBA/StringHolder.java
+++ b/libjava/classpath/org/omg/CORBA/StringHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.stringTypeCode;
+import gnu.CORBA.typecodes.StringTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -61,8 +61,8 @@ public final class StringHolder
/**
* The default type code for this holder.
*/
- private static final stringTypeCode t_string =
- new stringTypeCode(TCKind.tk_string);
+ private static final StringTypeCode t_string =
+ new StringTypeCode(TCKind.tk_string);
/**
* The <code>String</code> (CORBA <code>string</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/StringSeqHelper.java b/libjava/classpath/org/omg/CORBA/StringSeqHelper.java
index 0ae2646795a..4225c0bd12b 100644
--- a/libjava/classpath/org/omg/CORBA/StringSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/StringSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class StringSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_string);
+ return new ArrayTypeCode(TCKind.tk_string);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/StringSeqHolder.java b/libjava/classpath/org/omg/CORBA/StringSeqHolder.java
index 8e419d23333..71ac887e27b 100755
--- a/libjava/classpath/org/omg/CORBA/StringSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/StringSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class StringSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_char);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_char);
/**
* Constructs an instance of StringSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/StringValueHelper.java b/libjava/classpath/org/omg/CORBA/StringValueHelper.java
index 97d0e7a5d06..24e79ce571b 100644
--- a/libjava/classpath/org/omg/CORBA/StringValueHelper.java
+++ b/libjava/classpath/org/omg/CORBA/StringValueHelper.java
@@ -38,10 +38,9 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
-import gnu.CORBA.gnuAny;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
-import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -75,7 +74,7 @@ public class StringValueHelper
* The String typecode.
*/
private static final TypeCode tString =
- Restricted_ORB.Singleton.create_string_tc(0);
+ OrbRestricted.Singleton.create_string_tc(0);
/**
* Returns the String Value repository Id.
@@ -121,7 +120,9 @@ public class StringValueHelper
}
catch (ClassCastException ex)
{
- throw new MARSHAL("String expected");
+ MARSHAL m = new MARSHAL("String expected");
+ m.minor = Minor.ClassCast;
+ throw m;
}
}
@@ -141,7 +142,11 @@ public class StringValueHelper
return an_any.extract_string();
}
else
- throw new BAD_OPERATION("Contains not a string value type");
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("String value type expected");
+ bad.minor = Minor.Any;
+ throw bad;
+ }
}
/**
@@ -177,7 +182,7 @@ public class StringValueHelper
{
if (typecode == null)
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
typecode =
orb.create_value_box_tc(id(), "StringValue", tString);
}
diff --git a/libjava/classpath/org/omg/CORBA/StructMemberHelper.java b/libjava/classpath/org/omg/CORBA/StructMemberHelper.java
index 72d66fa912f..01445129b67 100644
--- a/libjava/classpath/org/omg/CORBA/StructMemberHelper.java
+++ b/libjava/classpath/org/omg/CORBA/StructMemberHelper.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.TypeCodeHelper;
import org.omg.CORBA.portable.InputStream;
@@ -87,7 +88,7 @@ public abstract class StructMemberHelper
{
if (typeCode == null)
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
synchronized (TypeCode.class)
{
@@ -151,6 +152,7 @@ public abstract class StructMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
@@ -170,6 +172,7 @@ public abstract class StructMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/org/omg/CORBA/SystemException.java b/libjava/classpath/org/omg/CORBA/SystemException.java
index 85396ee534f..dd193627900 100644
--- a/libjava/classpath/org/omg/CORBA/SystemException.java
+++ b/libjava/classpath/org/omg/CORBA/SystemException.java
@@ -1,39 +1,39 @@
/* SystemException.java --
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005 Free Software Foundation, Inc.
-This file is part of GNU Classpath.
+ This file is part of GNU Classpath.
-GNU Classpath 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, or (at your option)
-any later version.
+ GNU Classpath 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, or (at your option)
+ any later version.
-GNU Classpath 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.
+ GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
package org.omg.CORBA;
@@ -42,6 +42,7 @@ import java.io.Serializable;
/**
* The root class for all CORBA standard exceptions.
+ *
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
*/
public class SystemException
@@ -49,8 +50,7 @@ public class SystemException
implements Serializable
{
/**
- * Use serialVersionUID for interoperability.
- * Using the version 1.4 UID.
+ * Use serialVersionUID for interoperability. Using the version 1.4 UID.
*/
private static final long serialVersionUID = -8486391734674855519L;
@@ -60,22 +60,35 @@ public class SystemException
public CompletionStatus completed;
/**
- * The additional exception error code ("minor").
+ * <p>
+ * Contains more details about the exception. The lower 12 bits contain a
+ * code, defining the reason why exception has been thrown. The higher 20 bits
+ * hold "Vendor Minor Codeset ID" (VMCID).
+ * </p>
+ * <p>
+ * The Classpath specifice minor exception codes are documented in the headers
+ * of the corresponding exceptions (for instance, {@link MARSHAL}).
+ * </p>
+ *
+ * The VMCID 0 and 0xfffff are reserved for experimental use.
+ *
+ * @see OMGVMCID
*/
public int minor;
/**
* Constructs an instance of the CORBA standard exception.
- * @param a_reason a string, explaining the reason why the
- * exceptions has been thrown.
+ *
+ * @param a_reason a string, explaining the reason why the exceptions has been
+ * thrown.
* @param a_minor an additional error code (known as the "minor")
* @param a_completed the task completion status.
*/
protected SystemException(String a_reason, int a_minor,
- CompletionStatus a_completed
- )
+ CompletionStatus a_completed)
{
- super(a_reason);
+ super(a_reason + " Minor: " + Integer.toHexString(a_minor) + " ("
+ + (a_minor & 0xFFF) + "). Completed: "+a_completed);
minor = a_minor;
completed = a_completed;
}
diff --git a/libjava/classpath/org/omg/CORBA/TIMEOUT.java b/libjava/classpath/org/omg/CORBA/TIMEOUT.java
new file mode 100644
index 00000000000..44ae8b31cb3
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/TIMEOUT.java
@@ -0,0 +1,98 @@
+/* TIMEOUT.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised when no delivery has been made during the specified timeout duration.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class TIMEOUT
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 4674850648191359518L;
+
+ /**
+ * Creates TIMEOUT with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public TIMEOUT(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates TIMEOUT with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public TIMEOUT()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a TIMEOUT exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public TIMEOUT(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created TIMEOUT exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public TIMEOUT(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java b/libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java
new file mode 100644
index 00000000000..5f1981ba408
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/TRANSACTION_MODE.java
@@ -0,0 +1,99 @@
+/* TRANSACTION_MODE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised when the TransactionPolicy in the IOR is not the same as the current
+ * transaction mode.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class TRANSACTION_MODE
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 681236728492128745L;
+
+ /**
+ * Creates TRANSACTION_MODE with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public TRANSACTION_MODE(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates TRANSACTION_MODE with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public TRANSACTION_MODE()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a TRANSACTION_MODE exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public TRANSACTION_MODE(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created TRANSACTION_MODE exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public TRANSACTION_MODE(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java b/libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java
new file mode 100644
index 00000000000..dc808a23ce9
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java
@@ -0,0 +1,99 @@
+/* TRANSACTION_UNAVAILABLE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import java.io.Serializable;
+
+/**
+ * Raised in response to the abnormal termination of the transaction
+ * service.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class TRANSACTION_UNAVAILABLE
+ extends SystemException
+ implements Serializable
+{
+ /**
+ * Use serialVersionUID (v1.5) for interoperability.
+ */
+ private static final long serialVersionUID = 6340246200933309385L;
+
+ /**
+ * Creates TRANSACTION_UNAVAILABLE with the default minor code of 0,
+ * completion state COMPLETED_NO and the given explaining message.
+ * @param reason the explaining message.
+ */
+ public TRANSACTION_UNAVAILABLE(String message)
+ {
+ super(message, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Creates TRANSACTION_UNAVAILABLE with the default minor code of 0 and a
+ * completion state COMPLETED_NO.
+ */
+ public TRANSACTION_UNAVAILABLE()
+ {
+ super("", 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /** Creates a TRANSACTION_UNAVAILABLE exception with the specified minor
+ * code and completion status.
+ * @param minor additional error code.
+ * @param completed the method completion status.
+ */
+ public TRANSACTION_UNAVAILABLE(int minor, CompletionStatus completed)
+ {
+ super("", minor, completed);
+ }
+
+ /**
+ * Created TRANSACTION_UNAVAILABLE exception, providing full information.
+ * @param reason explaining message.
+ * @param minor additional error code (the "minor").
+ * @param completed the method completion status.
+ */
+ public TRANSACTION_UNAVAILABLE(String reason, int minor, CompletionStatus completed)
+ {
+ super(reason, minor, completed);
+ }
+}
diff --git a/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java b/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java
index 276e8bf16e3..bb293376d1f 100644
--- a/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java
+++ b/libjava/classpath/org/omg/CORBA/TypeCodeHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -58,7 +58,7 @@ public class TypeCodeHolder
* The default type code for this holder.
*/
private static final TypeCode t_TypeCode =
- new primitiveTypeCode(TCKind.tk_TypeCode);
+ new PrimitiveTypeCode(TCKind.tk_TypeCode);
/**
* The <code>TypeCode</code> (CORBA <code>TypeCode</code>) value,
diff --git a/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java b/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java
index 88192f6ad8e..8ca659d7f4d 100644
--- a/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java
+++ b/libjava/classpath/org/omg/CORBA/TypeCodePackage/BadKind.java
@@ -40,8 +40,8 @@ package org.omg.CORBA.TypeCodePackage;
import java.io.Serializable;
-import org.omg.CORBA.IDLEntity;
import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
/**
* This exception is thrown when an inappropriate operation is invoked on
diff --git a/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java b/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java
index cd48706bce5..16954e034f1 100644
--- a/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java
+++ b/libjava/classpath/org/omg/CORBA/TypeCodePackage/Bounds.java
@@ -40,8 +40,8 @@ package org.omg.CORBA.TypeCodePackage;
import java.io.Serializable;
-import org.omg.CORBA.IDLEntity;
import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.IDLEntity;
/**
* The {@link org.omg.CORBA.TypeCode#member_name(int) },
diff --git a/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java b/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java
index e92409bb0c4..1148cb40865 100644
--- a/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ULongLongSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class ULongLongSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_ulong);
+ return new ArrayTypeCode(TCKind.tk_ulong);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java b/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java
index 2d0fcf0b371..70b43bf7f45 100644
--- a/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ULongLongSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class ULongLongSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_ulonglong);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_ulonglong);
/**
* Constructs an instance of ULongLongSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java b/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java
index 846833c2a89..dddc1323d7e 100644
--- a/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ULongSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class ULongSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_long);
+ return new ArrayTypeCode(TCKind.tk_long);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java b/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java
index 8810e2159fc..64d9db6ceee 100644
--- a/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ULongSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class ULongSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_ulong);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_ulong);
/**
* Constructs an instance of ULongSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java b/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java
index 76371bc308a..d1fc440a90d 100644
--- a/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/UShortSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class UShortSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_short);
+ return new ArrayTypeCode(TCKind.tk_short);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java b/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java
index 8c6f7d19075..47e33b9be02 100644
--- a/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/UShortSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class UShortSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_ushort);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_ushort);
/**
* Constructs an instance of UShortSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java b/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java
index a4943564489..c599542fb96 100644
--- a/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java
+++ b/libjava/classpath/org/omg/CORBA/UnionMemberHelper.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.TypeCodeHelper;
import org.omg.CORBA.portable.InputStream;
@@ -97,7 +98,7 @@ public abstract class UnionMemberHelper
}
active = true;
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
StructMember[] members = new StructMember[ 4 ];
TypeCode member;
@@ -152,6 +153,7 @@ public abstract class UnionMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
@@ -172,6 +174,7 @@ public abstract class UnionMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java
new file mode 100644
index 00000000000..e93dc740399
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHelper.java
@@ -0,0 +1,157 @@
+/* UnknownUserExceptionHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+* The helper operations for the exception {@link UnknownUserException}.
+*
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public abstract class UnknownUserExceptionHelper
+{
+ /**
+ * The cached typecode value, computed only once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Create the UnknownUserException typecode (structure,
+ * named "UnknownUserException", containing a single field of
+ * type {@link Any}, named "except".
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ {
+ ORB orb = ORB.init();
+ StructMember[] members = new StructMember[ 1 ];
+
+ TypeCode field;
+
+ field = orb.get_primitive_tc(TCKind.tk_any);
+ members [ 0 ] = new StructMember("except", field, null);
+ typeCode =
+ orb.create_exception_tc(id(), "UnknownUserException", members);
+ }
+ return typeCode;
+ }
+
+ /**
+ * Insert the UnknownUserException into the given Any.
+ * This method uses the UnknownUserExceptionHolder.
+ *
+ * @param any the Any to insert into.
+ * @param that the UnknownUserException to insert.
+ */
+ public static void insert(Any any, UnknownUserException that)
+ {
+ any.insert_Streamable(new UnknownUserExceptionHolder(that));
+ }
+
+ /**
+ * Extract the UnknownUserException from given Any.
+ * This method uses the UnknownUserExceptionHolder.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain
+ * UnknownUserException.
+ */
+ public static UnknownUserException extract(Any any)
+ {
+ try
+ {
+ return ((UnknownUserExceptionHolder) any.extract_Streamable()).value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("UnknownUserException expected");
+ bad.minor = Minor.Any;
+ bad.initCause(cex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the UnknownUserException repository id.
+ *
+ * @return "IDL:omg.org/CORBA/UnknownUserException:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/CORBA/UnknownUserException:1.0";
+ }
+
+ /**
+ * Read the exception from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static UnknownUserException read(InputStream input)
+ {
+ // Read the exception repository id.
+ String id = input.read_string();
+ UnknownUserException value = new UnknownUserException();
+
+ value.except = input.read_any();
+ return value;
+ }
+
+ /**
+ * Write the exception to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, UnknownUserException value)
+ {
+ // Write the exception repository id.
+ output.write_string(id());
+ output.write_any(value.except);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java
new file mode 100644
index 00000000000..d7b1ca006d4
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/UnknownUserExceptionHolder.java
@@ -0,0 +1,103 @@
+/* UnknownUserExceptionHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+* A holder for the exception {@link UnknownUserException}.
+
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public class UnknownUserExceptionHolder implements Streamable
+{
+ /**
+ * The stored UnknownUserException value.
+ */
+ public UnknownUserException value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public UnknownUserExceptionHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public UnknownUserExceptionHolder(UnknownUserException initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = UnknownUserExceptionHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ UnknownUserExceptionHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the UnknownUserException.
+ */
+ public TypeCode _type()
+ {
+ return UnknownUserExceptionHelper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java b/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java
index 941e9d740fe..1699d912d61 100644
--- a/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ValueBaseHelper.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package org.omg.CORBA;
import gnu.CORBA.CDR.Vio;
-import gnu.CORBA.recordTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -109,7 +109,7 @@ public abstract class ValueBaseHelper
*/
public static TypeCode type()
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_value);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_value);
return r;
}
diff --git a/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java b/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java
index c6efed5eb04..6f57d17c3f1 100644
--- a/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java
+++ b/libjava/classpath/org/omg/CORBA/ValueBaseHolder.java
@@ -79,7 +79,7 @@ public class ValueBaseHolder
/**
* Read fill in the value field by reading an instance from the
- * given input stream. Uses {@link ValueBaseHelper.}
+ * given input stream. Uses {@link ValueBaseHelper}
*
* @param input a stream to read from.
*/
@@ -89,7 +89,7 @@ public class ValueBaseHolder
}
/**
- * Get the typecode of the stored instance. Uses {@link ValueBaseHelper.}
+ * Get the typecode of the stored instance. Uses {@link ValueBaseHelper}
*/
public TypeCode _type()
{
@@ -97,10 +97,10 @@ public class ValueBaseHolder
}
/**
- * Write the stored instance to the given input stream.
- * Uses {@link ValueBaseHelper.}
+ * Write the stored instance to the given output stream.
+ * Uses {@link ValueBaseHelper}
*
- * @param input a stream to read from.
+ * @param output a stream to write to.
*/
public void _write(OutputStream output)
{
diff --git a/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java b/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java
index 208623c2e7b..3150af2aaf4 100644
--- a/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java
+++ b/libjava/classpath/org/omg/CORBA/ValueMemberHelper.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
import gnu.CORBA.TypeCodeHelper;
import org.omg.CORBA.portable.InputStream;
@@ -91,7 +92,7 @@ public abstract class ValueMemberHelper
{
if (typeCode == null)
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
if (active)
{
@@ -177,6 +178,7 @@ public abstract class ValueMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
@@ -200,6 +202,7 @@ public abstract class ValueMemberHelper
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java b/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java
index dcdad34e4f5..9845702985a 100644
--- a/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java
+++ b/libjava/classpath/org/omg/CORBA/VersionSpecHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -80,7 +80,7 @@ public abstract class VersionSpecHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "VersionSpec", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CORBA/VisibilityHelper.java b/libjava/classpath/org/omg/CORBA/VisibilityHelper.java
index f2ed32f6371..a09e5b6867d 100644
--- a/libjava/classpath/org/omg/CORBA/VisibilityHelper.java
+++ b/libjava/classpath/org/omg/CORBA/VisibilityHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -59,7 +59,7 @@ public abstract class VisibilityHelper
/**
* Insert the Visibility into the given Any.
- * Uses {@link Any.insert_short}.
+ * Uses {@link Any#insert_short}.
*/
public static void insert(Any any, short that)
{
@@ -68,7 +68,7 @@ public abstract class VisibilityHelper
/**
* Extract the Visibility from the given Any.
- * Uses {@link Any.extract_short}.
+ * Uses {@link Any#extract_short}.
*/
public static short extract(Any any)
{
@@ -83,9 +83,9 @@ public abstract class VisibilityHelper
if (typeCode == null)
{
TypeCode tshort =
- Restricted_ORB.Singleton.get_primitive_tc(TCKind.tk_short);
+ OrbRestricted.Singleton.get_primitive_tc(TCKind.tk_short);
typeCode =
- Restricted_ORB.Singleton.create_alias_tc(id(), "Visibility", tshort);
+ OrbRestricted.Singleton.create_alias_tc(id(), "Visibility", tshort);
}
return typeCode;
}
@@ -103,7 +103,7 @@ public abstract class VisibilityHelper
/**
* Read the visibility value (as short) from the CDR intput stream.
*
- * Uses {@link InputStream.read_short()}.
+ * Uses {@link InputStream#read_short()}.
*
* @param istream a stream to read from.
*/
@@ -115,7 +115,7 @@ public abstract class VisibilityHelper
/**
* Write the visibility value (as short) to the CDR output stream.
*
- * USes {@link OutputStream.write_short(short)}.
+ * USes {@link OutputStream#write_short(short)}.
*
* @param ostream a stream to write into.
* @param value a value to write.
diff --git a/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java b/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java
index c12c3de1c78..4bb92989d05 100644
--- a/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/WCharSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -125,7 +125,7 @@ public abstract class WCharSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_char);
+ return new ArrayTypeCode(TCKind.tk_char);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java b/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java
index 1b11506a298..72a9cc8c1e3 100644
--- a/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/WCharSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class WCharSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_wchar);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_wchar);
/**
* Constructs an instance of WCharSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java b/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java
index 916c6a250da..356cf0dd21c 100644
--- a/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java
+++ b/libjava/classpath/org/omg/CORBA/WStringSeqHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.InputStream;
@@ -127,7 +127,7 @@ public abstract class WStringSeqHelper
*/
public static TypeCode type()
{
- return new primitiveArrayTypeCode(TCKind.tk_string);
+ return new ArrayTypeCode(TCKind.tk_string);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java b/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java
index 474d69a47ad..68b77ff6a3a 100755
--- a/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java
+++ b/libjava/classpath/org/omg/CORBA/WStringSeqHolder.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.primitiveArrayTypeCode;
+import gnu.CORBA.typecodes.ArrayTypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -62,8 +62,8 @@ public final class WStringSeqHolder
/**
* The type code for this holder. Each holder has a different instance.
*/
- private final primitiveArrayTypeCode typecode =
- new primitiveArrayTypeCode(TCKind.tk_wchar);
+ private final ArrayTypeCode typecode =
+ new ArrayTypeCode(TCKind.tk_wchar);
/**
* Constructs an instance of WStringSeqHolder,
diff --git a/libjava/classpath/org/omg/CORBA/WStringValueHelper.java b/libjava/classpath/org/omg/CORBA/WStringValueHelper.java
index 7748a6c782d..1c63a408e3d 100644
--- a/libjava/classpath/org/omg/CORBA/WStringValueHelper.java
+++ b/libjava/classpath/org/omg/CORBA/WStringValueHelper.java
@@ -38,10 +38,9 @@ exception statement from your version. */
package org.omg.CORBA;
-import gnu.CORBA.Restricted_ORB;
-import gnu.CORBA.gnuAny;
+import gnu.CORBA.Minor;
+import gnu.CORBA.OrbRestricted;
-import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.BoxedValueHelper;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
@@ -75,7 +74,7 @@ public class WStringValueHelper
* The Wide String typecode.
*/
private static final TypeCode twString =
- Restricted_ORB.Singleton.create_wstring_tc(0);
+ OrbRestricted.Singleton.create_wstring_tc(0);
/**
* Returns the String Value repository Id.
@@ -121,7 +120,9 @@ public class WStringValueHelper
}
catch (ClassCastException ex)
{
- throw new MARSHAL("String expected");
+ MARSHAL m = new MARSHAL("String expected");
+ m.minor = Minor.ClassCast;
+ throw m;
}
}
@@ -141,7 +142,11 @@ public class WStringValueHelper
return an_any.extract_wstring();
}
else
- throw new BAD_OPERATION("Contains not a wide string value type");
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("WString value type expected");
+ bad.minor = Minor.Any;
+ throw bad;
+ }
}
/**
@@ -177,7 +182,7 @@ public class WStringValueHelper
{
if (typecode == null)
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
typecode =
orb.create_value_box_tc(id(), "WStringValue", twString);
}
diff --git a/libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java b/libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java
new file mode 100644
index 00000000000..5bb5baff2eb
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/WrongTransactionHelper.java
@@ -0,0 +1,151 @@
+/* WrongTransactionHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+* The helper operations for the exception {@link WrongTransaction}.
+*
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+*/
+public abstract class WrongTransactionHelper
+{
+ /**
+ * The cached typecode value, computed only once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Create the WrongTransaction typecode (structure,
+ * named "WrongTransaction"), no fields.
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ {
+ ORB orb = ORB.init();
+ StructMember[] members = new StructMember[ 0 ];
+ typeCode = orb.create_exception_tc(id(), "WrongTransaction", members);
+ }
+ return typeCode;
+ }
+
+ /* Every user exception with no user defined
+ fields can use EmptyExceptionHolder */
+
+ /**
+ * Insert the WrongTransaction into the given Any.
+ *
+ * @param any the Any to insert into.
+ * @param that the WrongTransaction to insert.
+ */
+ public static void insert(Any any, WrongTransaction that)
+ {
+ any.insert_Streamable(new EmptyExceptionHolder(that, type()));
+ }
+
+ /**
+ * Extract the WrongTransaction from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain WrongTransaction.
+ */
+ public static WrongTransaction extract(Any any)
+ {
+ try
+ {
+ EmptyExceptionHolder h =
+ (EmptyExceptionHolder) any.extract_Streamable();
+ return (WrongTransaction) h.value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("WrongTransaction expected");
+ bad.minor = Minor.Any;
+ bad.initCause(cex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the WrongTransaction repository id.
+ *
+ * @return "IDL:omg.org/CORBA/WrongTransaction:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/CORBA/WrongTransaction:1.0";
+ }
+
+ /**
+ * Read the exception from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static WrongTransaction read(InputStream input)
+ {
+ // Read the exception repository id.
+ String id = input.read_string();
+ WrongTransaction value = new WrongTransaction(id);
+
+ return value;
+ }
+
+ /**
+ * Write the exception to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, WrongTransaction value)
+ {
+ // Write the exception repository id.
+ output.write_string(id());
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java b/libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java
new file mode 100644
index 00000000000..103724f81dd
--- /dev/null
+++ b/libjava/classpath/org/omg/CORBA/WrongTransactionHolder.java
@@ -0,0 +1,103 @@
+/* WrongTransactionHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A holder for the exception {@link WrongTransaction}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class WrongTransactionHolder implements Streamable
+{
+ /**
+ * The stored WrongTransaction value.
+ */
+ public WrongTransaction value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public WrongTransactionHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public WrongTransactionHolder(WrongTransaction initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = WrongTransactionHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ WrongTransactionHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the WrongTransaction.
+ */
+ public TypeCode _type()
+ {
+ return WrongTransactionHelper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java b/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java
index db36fa78016..6661b0c4702 100644
--- a/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java
+++ b/libjava/classpath/org/omg/CORBA/_IDLTypeStub.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.CORBA;
+import gnu.CORBA.Minor;
import gnu.CORBA.TypeCodeHelper;
import org.omg.CORBA.portable.ApplicationException;
@@ -52,7 +53,7 @@ import java.io.Serializable;
/**
* The stub for the IDL type. This stub can be used to access the
* remote IDL type object, if its IOR is known. To create the
- * working instance with the known IOR, pass {@link gnu.CORBA.IOR_Delegate}
+ * working instance with the known IOR, pass {@link gnu.CORBA.IorDelegate}
* to the constructor.
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
@@ -78,7 +79,7 @@ public class _IDLTypeStub
/**
* Create an instance with the given delegate.
*
- * @see gnu.CORBA.IOR_Delegate
+ * @see gnu.CORBA.IorDelegate
*/
public _IDLTypeStub(Delegate delegate)
{
@@ -114,6 +115,7 @@ public class _IDLTypeStub
catch (UserException ex)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.UserException;
m.initCause(ex);
throw m;
}
diff --git a/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java b/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java
index 3cf1f49770d..f2f21a79e17 100644
--- a/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java
+++ b/libjava/classpath/org/omg/CORBA/portable/ObjectImpl.java
@@ -60,9 +60,9 @@ public abstract class ObjectImpl
implements org.omg.CORBA.Object
{
/**
- * The vendor - dependent delegate, responsible for the method implementations.
+ * The delegate, responsible for the method implementations.
*/
- private Delegate delegate;
+ transient Delegate delegate;
/**
* Create a request to invoke the method of this object, specifying
diff --git a/libjava/classpath/org/omg/CORBA_2_3/ORB.java b/libjava/classpath/org/omg/CORBA_2_3/ORB.java
index 7a9dc6a1a57..82660fea705 100644
--- a/libjava/classpath/org/omg/CORBA_2_3/ORB.java
+++ b/libjava/classpath/org/omg/CORBA_2_3/ORB.java
@@ -117,11 +117,9 @@ public abstract class ORB
}
/**
- * Up till OMG 3.0.3 inclusive and also in Suns API till 1.4
- * inclusive this is totally undocumented. No problem, though,
- * because is in addition not implemented.
- *
- * @throws NO_IMPLEMENT, always.
+ * This method is called by RMI-IIOP {@link javax.rmi.Tie#orb(ORB)},
+ * passing <code>this</code> as parameter. The ORB will try to connect
+ * that tie as one of its objects.
*/
public void set_delegate(java.lang.Object wrapper)
{
diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java b/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java
index 06ee33e6616..23055ef2d4d 100644
--- a/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java
+++ b/libjava/classpath/org/omg/CORBA_2_3/portable/InputStream.java
@@ -40,9 +40,9 @@ package org.omg.CORBA_2_3.portable;
import gnu.CORBA.CDR.Vio;
-import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.CustomMarshal;
import org.omg.CORBA.portable.BoxedValueHelper;
-import org.omg.CORBA.portable.ValueFactory;
+import org.omg.CORBA.portable.StreamableValue;
import java.io.Serializable;
@@ -78,12 +78,12 @@ public abstract class InputStream
*/
public Object read_abstract_interface()
{
- boolean isValue = read_boolean();
+ boolean isObject = read_boolean();
- if (isValue)
- return read_value();
- else
+ if (isObject)
return read_Object();
+ else
+ return read_value();
}
/**
@@ -192,11 +192,7 @@ public abstract class InputStream
*/
public Serializable read_value(String repository_id)
{
- ValueFactory factory =
- ((org.omg.CORBA_2_3.ORB) orb()).lookup_value_factory(repository_id);
- if (factory == null)
- throw new MARSHAL("No factory");
- return (Serializable) Vio.read(this, null, factory);
+ return Vio.read(this, repository_id);
}
/**
diff --git a/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java b/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java
index 2ff8c226a82..70f9a4913ba 100644
--- a/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java
+++ b/libjava/classpath/org/omg/CORBA_2_3/portable/OutputStream.java
@@ -64,40 +64,40 @@ public abstract class OutputStream
extends org.omg.CORBA.portable.OutputStream
{
/**
- * Writes an abstract interface to the stream. An abstract interface can
- * be eithe CORBA object or value type and is written as a union with
- * the boolean discriminator (false for objects, true for value types).
- *
- * The object from value is separated by fact that all values implement
- * the {@link ValueBase} interface. Also, the passed parameter is treated
- * as value it it does not implement CORBA Object.
- *
+ * Writes an abstract interface to the stream. An abstract interface can be
+ * eithe CORBA object or value type and is written as a union with the boolean
+ * discriminator (false for objects, true for value types).
+ *
+ * The object from value is separated by fact that all values implement the
+ * {@link ValueBase} interface. Also, the passed parameter is treated as value
+ * it it does not implement CORBA Object.
+ *
* @param an_interface an abstract interface to write.
*/
public void write_abstract_interface(java.lang.Object an_interface)
{
- boolean isValue =
- an_interface instanceof ValueBase ||
- (!(an_interface instanceof org.omg.CORBA.Object));
+ boolean isObject = !(an_interface instanceof ValueBase)
+ && an_interface instanceof org.omg.CORBA.Object;
- write_boolean(isValue);
+ write_boolean(isObject);
- if (isValue)
- write_value((ValueBase) an_interface);
- else
+ if (isObject)
write_Object((org.omg.CORBA.Object) an_interface);
+ else
+ write_value((Serializable) an_interface);
+
}
/**
* Writes a value type into the output stream.
- *
- * The value type must implement either {@link CustomValue}
- * (for user-defined writing method) or {@link StramableValue}
- * (for standard writing using code, generated by IDL compiler).
- *
- * The written record will have a repository id, matching the
- * class of the passed object. The codebase will not be written.
- *
+ *
+ * The value type must implement either {@link CustomValue} (for user-defined
+ * writing method) or {@link StramableValue} (for standard writing using code,
+ * generated by IDL compiler).
+ *
+ * The written record will have a repository id, matching the class of the
+ * passed object. The codebase will not be written.
+ *
* @param value a value type object to write.
*/
public void write_value(Serializable value)
@@ -124,7 +124,9 @@ public abstract class OutputStream
* Writes a value type into the output stream, stating it is an
* instance of the given class. The written record
* will have a repository id, matching the passed class.
- * The codebase will not be written.
+ * The codebase will not be written. It the object
+ * being written is an instance of the different class, this results
+ * writing two Id inheritance hierarchy.
*
* The value type must implement either {@link CustomValue}
* (for user-defined writing method) or {@link StramableValue}
@@ -138,15 +140,15 @@ public abstract class OutputStream
}
/**
- * Writes a value type into the output stream,
- * stating it has the given repository id.
- *
- * The value type must implement either {@link CustomValue}
- * (for user-defined writing method) or {@link StramableValue}
- * (for standard writing using code, generated by IDL compiler).
- *
+ * Writes a value type into the output stream, stating it has the given
+ * repository id.
+ *
+ * The value type must implement either {@link CustomValue} (for user-defined
+ * writing method) or {@link StramableValue} (for standard writing using code,
+ * generated by IDL compiler).
+ *
* @param repository_id a repository id of the value type.
- *
+ *
* @param value a value type object to write.
*/
public void write_value(Serializable value, String repository_id)
diff --git a/libjava/classpath/org/omg/CosNaming/BindingHelper.java b/libjava/classpath/org/omg/CosNaming/BindingHelper.java
index 1665464ec7e..b5b42077218 100644
--- a/libjava/classpath/org/omg/CosNaming/BindingHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/BindingHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -74,7 +76,10 @@ public abstract class BindingHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("Binding expected");
+ BAD_OPERATION bad = new BAD_OPERATION("Binding expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java
index 204d9f05872..64f7b4dfa51 100644
--- a/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
@@ -78,6 +80,7 @@ public abstract class BindingIteratorHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Binding iterator expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
@@ -121,6 +124,35 @@ public abstract class BindingIteratorHelper
return new _BindingIteratorStub(delegate);
}
}
+
+ /**
+ * Narrow the given object to the BindingIterator. No type-checking is
+ * performed to verify that the object actually supports the requested type.
+ * The {@link BAD_OPERATION} will be thrown if unsupported operations are
+ * invoked on the new returned reference, but no failure is expected at the
+ * time of the unchecked_narrow.
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted binding iterator.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static BindingIterator unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof BindingIterator)
+ return (BindingIterator) obj;
+ else
+ {
+ // Do not call the _is_a(..).
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _BindingIteratorStub(delegate);
+ }
+ }
/**
* Read the exception from the given CDR stream.
diff --git a/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java b/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java
index 1aa7521fbb2..988c4ee9126 100644
--- a/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java
+++ b/libjava/classpath/org/omg/CosNaming/BindingIteratorPOA.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.portable.InputStream;
@@ -103,7 +105,8 @@ public abstract class BindingIteratorPOA
out = rh.createReply();
}
else
- throw new BAD_OPERATION(method, 0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(method, Minor.Method,
+ CompletionStatus.COMPLETED_MAYBE);
return out;
}
diff --git a/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java b/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java
index ede00008ea7..2f0dc71c4ef 100644
--- a/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/BindingTypeHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -71,6 +73,7 @@ public abstract class BindingTypeHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Binding type expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/IstringHelper.java b/libjava/classpath/org/omg/CosNaming/IstringHelper.java
index 83bbecee5af..b90b452e69f 100644
--- a/libjava/classpath/org/omg/CosNaming/IstringHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/IstringHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CosNaming;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -84,7 +84,7 @@ public abstract class IstringHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "Istring", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/CosNaming/NameComponent.java b/libjava/classpath/org/omg/CosNaming/NameComponent.java
index a2db313e620..1e06caaeffe 100644
--- a/libjava/classpath/org/omg/CosNaming/NameComponent.java
+++ b/libjava/classpath/org/omg/CosNaming/NameComponent.java
@@ -40,6 +40,8 @@ package org.omg.CosNaming;
import org.omg.CORBA.portable.IDLEntity;
+import java.util.zip.Adler32;
+
/**
* The name component, a node in the multi-comonent name.
*
@@ -115,4 +117,14 @@ public final class NameComponent
{
return id + "." + kind;
}
-} \ No newline at end of file
+
+ /**
+ * Return the hashCode of this NameComponent.
+ */
+ public int hashCode()
+ {
+ Adler32 adler = new Adler32();
+ adler.update(toString().getBytes());
+ return (int) adler.getValue() & Integer.MAX_VALUE;
+ }
+}
diff --git a/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java b/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java
index 9f0e1287efd..8499edfe66e 100644
--- a/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NameComponentHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -76,6 +78,7 @@ public abstract class NameComponentHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Name component expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NameHelper.java b/libjava/classpath/org/omg/CosNaming/NameHelper.java
index 047ad918f93..18faf31823b 100644
--- a/libjava/classpath/org/omg/CosNaming/NameHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NameHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -77,6 +79,7 @@ public abstract class NameHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Name expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java
index 6e2ef060b9a..86bf8c55dfd 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
@@ -78,6 +80,7 @@ public abstract class NamingContextExtHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NamingContextExt expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
@@ -122,6 +125,35 @@ public abstract class NamingContextExtHelper
return new _NamingContextExtStub(delegate);
}
}
+
+ /**
+ * Narrow the given object to the NamingContextExt. No type-checking is
+ * performed to verify that the object actually supports the requested type.
+ * The {@link BAD_OPERATION} will be thrown if unsupported operations are
+ * invoked on the new returned reference, but no failure is expected at the
+ * time of the unchecked_narrow.
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted NamingContextExt
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static NamingContextExt unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof NamingContextExt)
+ return (NamingContextExt) obj;
+ else
+ {
+ // Do not call the _is_a(..).
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _NamingContextExtStub(delegate);
+ }
+ }
/**
* Read the extended naming context from the given CDR input stream.
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java b/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java
index a6d3346f82c..cf5d7b3d808 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextExtPOA.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.ObjectHelper;
@@ -189,7 +191,7 @@ public abstract class NamingContextExtPOA
OutputStream out = null;
Integer call_method = (Integer) _NamingContextImplBase.methods.get(method);
if (call_method == null)
- throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
switch (call_method.intValue())
{
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java
index 3a60d9cb4de..fb9b091a6a0 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
@@ -78,6 +80,7 @@ public abstract class NamingContextHelper
{
BAD_OPERATION bad = new BAD_OPERATION("Naming context expected");
bad.initCause(ex);
+ bad.minor = Minor.Any;
throw bad;
}
}
@@ -130,6 +133,35 @@ public abstract class NamingContextHelper
else
throw new BAD_PARAM();
}
+
+ /**
+ * Narrow the given object to the NamingContext. No type-checking is performed
+ * to verify that the object actually supports the requested type. The
+ * {@link BAD_OPERATION} will be thrown if unsupported operations are invoked
+ * on the new returned reference, but no failure is expected at the time of
+ * the unchecked_narrow.
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted NamingContext.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static NamingContext unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof NamingContext)
+ return (NamingContext) obj;
+ else
+ {
+ // Do not call the _is_a(..).
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _NamingContextStub(delegate);
+ }
+ }
/**
* Read the naming context from the given CDR input stream.
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java b/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java
index a2db0ad3502..a9788827642 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPOA.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.ObjectHelper;
@@ -92,7 +94,7 @@ public abstract class NamingContextPOA
OutputStream out = null;
Integer call_method = (Integer) _NamingContextImplBase.methods.get(method);
if (call_method == null)
- throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
switch (call_method.intValue())
{
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java
index 9487895213c..6bf7bd7a6b3 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/AlreadyBoundHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -75,7 +77,10 @@ public abstract class AlreadyBoundHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java
index d1a1da51e4e..1d0b6049b66 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/CannotProceedHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -78,7 +80,10 @@ public abstract class CannotProceedHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java
index 434713b2d6f..8f1133602d7 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/InvalidNameHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -75,7 +77,10 @@ public abstract class InvalidNameHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java
index e1f82994f9e..6333dfcbcd3 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotEmptyHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -75,7 +77,10 @@ public abstract class NotEmptyHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java
index 544ab63776f..442b7db9e63 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -77,7 +79,10 @@ public abstract class NotFoundHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java
index b6eacf85f90..45a42a0ba70 100644
--- a/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java
+++ b/libjava/classpath/org/omg/CosNaming/NamingContextPackage/NotFoundReasonHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming.NamingContextPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -74,7 +76,10 @@ public abstract class NotFoundReasonHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION();
+ BAD_OPERATION bad = new BAD_OPERATION();
+ bad.initCause(ex);
+ bad.minor = Minor.Any;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java b/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java
index 53c0dd3a656..9c7e1b34728 100644
--- a/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java
+++ b/libjava/classpath/org/omg/CosNaming/_BindingIteratorImplBase.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BooleanHolder;
import org.omg.CORBA.CompletionStatus;
@@ -114,7 +116,8 @@ public abstract class _BindingIteratorImplBase
out = rh.createReply();
}
else
- throw new BAD_OPERATION(method, 0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(method, Minor.Method,
+ CompletionStatus.COMPLETED_MAYBE);
return out;
}
diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java b/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java
index 3ad77203084..a0bc80ac08d 100644
--- a/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java
+++ b/libjava/classpath/org/omg/CosNaming/_NamingContextExtStub.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.CosNaming;
-import gnu.CORBA.NamingService.snConverter;
+import gnu.CORBA.NamingService.NameTransformer;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.ObjectHelper;
@@ -86,7 +86,7 @@ public class _NamingContextExtStub
/**
* The local name form converter.
*/
- private snConverter converter = new snConverter();
+ private NameTransformer converter = new NameTransformer();
/**
* Create the naming context stub.
diff --git a/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java b/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java
index 7c1fb3a1d1e..33bddef5d74 100644
--- a/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java
+++ b/libjava/classpath/org/omg/CosNaming/_NamingContextImplBase.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.CosNaming;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.DynamicImplementation;
@@ -123,7 +125,7 @@ public abstract class _NamingContextImplBase
OutputStream out = null;
Integer call_method = (Integer) methods.get(method);
if (call_method == null)
- throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
switch (call_method.intValue())
{
@@ -389,7 +391,7 @@ public abstract class _NamingContextImplBase
// The server request contains no required result type.
Integer call_method = (Integer) methods.get(request.operation());
if (call_method == null)
- throw new BAD_OPERATION(0, CompletionStatus.COMPLETED_MAYBE);
+ throw new BAD_OPERATION(Minor.Method, CompletionStatus.COMPLETED_MAYBE);
switch (call_method.intValue())
{
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java
index 0c02916e542..b8e3aafef5b 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryHelper.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.ORB;
@@ -80,6 +82,25 @@ public abstract class DynAnyFactoryHelper
+ " is not a DynAnyFactory");
}
}
+
+ /**
+ * Narrow the given object to the DynAnyFactory. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynAnyFactory.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynAnyFactory unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the final_type code of the {@link DynAnyFactory}.
@@ -161,13 +182,8 @@ public abstract class DynAnyFactoryHelper
*/
static String not_applicable(String Id)
{
- try
- {
- throw new MARSHAL("The read/write are not applicable for " + Id);
- }
- catch (Exception e)
- {
- throw new MARSHAL();
- }
+ MARSHAL m = new MARSHAL("The read/write are not applicable for " + Id);
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java
index c7b54bef89d..a9f45c4b73c 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.DynamicAny.DynAnyFactoryPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class InconsistentTypeCodeHelper
{
BAD_OPERATION bad = new BAD_OPERATION("InconsistentTypeCode expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java
index ca48cd4c5aa..73e2d9856a1 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyHelper.java
@@ -79,6 +79,25 @@ public abstract class DynAnyHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynAny");
}
}
+
+ /**
+ * Narrow the given object to the DynAny. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynAny.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynAny unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynAny}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java
index 55e35eedc81..1b5004f072b 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/InvalidValueHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.DynamicAny.DynAnyPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class InvalidValueHelper
{
BAD_OPERATION bad = new BAD_OPERATION("InvalidValue expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java
index e15fb72c668..b09ab4db863 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnyPackage/TypeMismatchHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.DynamicAny.DynAnyPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class TypeMismatchHelper
{
BAD_OPERATION bad = new BAD_OPERATION("TypeMismatch expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java b/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java
index 87e34452319..ec3f0c4815f 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynAnySeqHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
import gnu.CORBA.DynAnySeqHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class DynAnySeqHelper
{
BAD_OPERATION bad = new BAD_OPERATION("DynAnySeq expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java b/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java
index 0372b58518c..f2892c85692 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java
@@ -78,6 +78,25 @@ public abstract class DynArrayHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynArray");
}
}
+
+ /**
+ * Narrow the given object to the DynArray. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynArray.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynArray unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynArray}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java b/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java
index 944d4375739..8db1a20065e 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynEnumHelper.java
@@ -79,6 +79,25 @@ public abstract class DynEnumHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynEnum");
}
}
+
+ /**
+ * Narrow the given object to the DynEnum. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynEnum.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynEnum unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynEnum}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java b/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java
index 1d818d7b178..84bb59d9f3c 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynFixedHelper.java
@@ -79,6 +79,25 @@ public abstract class DynFixedHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynFixed");
}
}
+
+ /**
+ * Narrow the given object to the DynFixed. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynFixed.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynFixed unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynFixed}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java b/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java
index c38a51f0951..ad30133712e 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynSequenceHelper.java
@@ -78,6 +78,25 @@ public abstract class DynSequenceHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynSequence");
}
}
+
+ /**
+ * Narrow the given object to the DynSequence. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynSequence.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynSequence unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynSequence}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java b/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java
index e4790b443ff..021c5d031a5 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynStructHelper.java
@@ -78,6 +78,25 @@ public abstract class DynStructHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynStruct");
}
}
+
+ /**
+ * Narrow the given object to the DynStruct. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynStruct.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynStruct unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynStruct}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java b/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java
index 794098333e9..8f924c0864e 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynUnionHelper.java
@@ -78,6 +78,25 @@ public abstract class DynUnionHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynUnion");
}
}
+
+ /**
+ * Narrow the given object to the DynUnion. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynUnion.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynUnion unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynUnion}.
diff --git a/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java b/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java
index a6d7afaa9e3..026ca499077 100644
--- a/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/DynValueHelper.java
@@ -78,6 +78,25 @@ public abstract class DynValueHelper
throw new BAD_PARAM(obj.getClass().getName() + " is not a DynValue");
}
}
+
+ /**
+ * Narrow the given object to the DynValue. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted DynValue.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static DynValue unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Get the type code of the {@link DynValue}.
diff --git a/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java b/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java
index 7c4cdbf4919..f15b8adfa4f 100644
--- a/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/FieldNameHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -84,7 +84,7 @@ public abstract class FieldNameHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
+ ORB orb = OrbRestricted.Singleton;
return orb.create_alias_tc(id(), "FieldName", orb.create_string_tc(0));
}
diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java
index d649800b8b6..a0e5c6b85f9 100644
--- a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
import gnu.CORBA.NameDynAnyPairHolder;
import org.omg.CORBA.Any;
@@ -83,6 +84,7 @@ public abstract class NameDynAnyPairHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPair expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java
index f110926b853..ec4f728228f 100644
--- a/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/NameDynAnyPairSeqHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
import gnu.CORBA.NameDynAnyPairSeqHolder;
import org.omg.CORBA.Any;
@@ -105,6 +106,7 @@ public abstract class NameDynAnyPairSeqHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NameDynAnyPairSeq expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java b/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java
index a3d5bff4526..1e0f52b5946 100644
--- a/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/NameValuePairHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
import gnu.CORBA.NameValuePairHolder;
import org.omg.CORBA.Any;
@@ -118,6 +119,7 @@ public abstract class NameValuePairHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NameValuePair expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java b/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java
index 400708e18e0..62481534e1a 100644
--- a/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java
+++ b/libjava/classpath/org/omg/DynamicAny/NameValuePairSeqHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
import gnu.CORBA.NameValuePairSeqHolder;
import org.omg.CORBA.Any;
@@ -98,6 +99,7 @@ public abstract class NameValuePairSeqHelper
{
BAD_OPERATION bad = new BAD_OPERATION("NameValuePairSeq expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java b/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java
index b0f6d6052a6..15f7c816b44 100644
--- a/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java
+++ b/libjava/classpath/org/omg/DynamicAny/_DynAnyFactoryStub.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.DynamicAny;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.TypeCode;
@@ -101,7 +103,9 @@ public class _DynAnyFactoryStub
public DynAny create_dyn_any(Any _0)
throws InconsistentTypeCode
{
- throw new MARSHAL(NOT_APPLICABLE);
+ MARSHAL m = new MARSHAL(NOT_APPLICABLE);
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -113,7 +117,9 @@ public class _DynAnyFactoryStub
public DynAny create_dyn_any_from_type_code(TypeCode _0)
throws InconsistentTypeCode
{
- throw new MARSHAL(NOT_APPLICABLE);
+ MARSHAL m = new MARSHAL(NOT_APPLICABLE);
+ m.minor = Minor.Inappropriate;
+ throw m;
}
static String NOT_APPLICABLE =
diff --git a/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java b/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java
index d5c55a264cc..fea0b887bd9 100644
--- a/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecFactoryHelper.java
@@ -120,6 +120,25 @@ public abstract class CodecFactoryHelper
throw bad;
}
}
+
+ /**
+ * Narrow the given object to the CodecFactory. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted CodecFactory.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static CodecFactory unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* This should read the CodecFactory from the CDR intput stream,
diff --git a/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java b/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java
index a1082178c52..e036dbf1f42 100644
--- a/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecFactoryPackage/UnknownEncodingHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.IOP.CodecFactoryPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.ORB;
import org.omg.CORBA.Any;
@@ -108,6 +109,7 @@ public abstract class UnknownEncodingHelper
{
BAD_OPERATION bad = new BAD_OPERATION("UnknownEncoding expected");
bad.initCause(cex);
+ bad.minor = Minor.Any;
throw bad;
}
}
diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java b/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java
index e5910ac57a0..e353be8f9ed 100644
--- a/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecPackage/FormatMismatchHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.IOP.CodecPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -103,6 +104,7 @@ public abstract class FormatMismatchHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("FormatMismatch expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java b/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java
index 6c4ce52f0b5..8a93c5895a0 100644
--- a/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecPackage/InvalidTypeForEncodingHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.IOP.CodecPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class InvalidTypeForEncodingHelper
{
BAD_OPERATION bad =
new BAD_OPERATION("InvalidTypeForEncoding expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java b/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java
index 9f422863755..33951de701f 100644
--- a/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java
+++ b/libjava/classpath/org/omg/IOP/CodecPackage/TypeMismatchHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.IOP.CodecPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -103,6 +104,7 @@ public abstract class TypeMismatchHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("TypeMismatch expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java b/libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java
new file mode 100644
index 00000000000..167ab1ac7e9
--- /dev/null
+++ b/libjava/classpath/org/omg/IOP/ExceptionDetailMessage.java
@@ -0,0 +1,60 @@
+/* ExceptionDetailMessage.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.IOP;
+
+/**
+ * <p>Defines the ExceptionDetailMessage (= 14) service context. This context
+ * may be included into reply message, having the SYSTEM_EXCEPTION or
+ * USER_EXCEPTION reply status, as the alternative to the stack trace
+ * that might contain sensitive or unwanted information. The service
+ * context contains the CDR-encapsulated wide string, usually
+ * returned by {@link Exception#getMessage}.
+ * </p><p>
+ * The applications may also send the more comprehensive UnknownExceptionInfo
+ * ( = 9 ) service context that contains the thrown exception, written
+ * as the Value type.
+ * </p>
+ */
+public interface ExceptionDetailMessage
+{
+ /**
+ * Specifies the ExceptionDetailMessage value, 14.
+ */
+ int value = 14;
+}
diff --git a/libjava/classpath/org/omg/IOP/IORHelper.java b/libjava/classpath/org/omg/IOP/IORHelper.java
index 5945bb75aa4..77f18d9b9cd 100644
--- a/libjava/classpath/org/omg/IOP/IORHelper.java
+++ b/libjava/classpath/org/omg/IOP/IORHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -111,6 +113,7 @@ public abstract class IORHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("IOR expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java b/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java
index bc26068c94c..6f5156fe223 100644
--- a/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java
+++ b/libjava/classpath/org/omg/IOP/MultipleComponentProfileHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.ORB;
import org.omg.CORBA.Any;
import org.omg.CORBA.TypeCode;
@@ -96,6 +98,7 @@ public abstract class MultipleComponentProfileHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("MultipleComponentProfile expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java b/libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java
new file mode 100644
index 00000000000..a071c848887
--- /dev/null
+++ b/libjava/classpath/org/omg/IOP/RMICustomMaxStreamFormat.java
@@ -0,0 +1,56 @@
+/* RMICustomMaxStreamFormat.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.IOP;
+
+ /**
+ * A single constant interface, defining the RMICustomMaxStreamFormat (= 17)
+ * service context. This constant is used in the service contexts
+ * inside the message when the {@link TAG_RMI_CUSTOM_MAX_STREAM_FORMAT}
+ * are used in IOR references. Please note that these two constants have
+ * different values.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface RMICustomMaxStreamFormat
+{
+ /**
+ * Specifies the RMICustomMaxStreamFormat value, 17.
+ */
+ int value = 17;
+}
diff --git a/libjava/classpath/org/omg/IOP/ServiceContextHelper.java b/libjava/classpath/org/omg/IOP/ServiceContextHelper.java
index a8224a64cdc..5693a32357a 100644
--- a/libjava/classpath/org/omg/IOP/ServiceContextHelper.java
+++ b/libjava/classpath/org/omg/IOP/ServiceContextHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -115,6 +117,7 @@ public abstract class ServiceContextHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ServiceContext expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java b/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java
index 11bbe253fea..fa436cbb885 100644
--- a/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java
+++ b/libjava/classpath/org/omg/IOP/ServiceContextListHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.ORB;
@@ -94,7 +96,10 @@ public abstract class ServiceContextListHelper
}
catch (ClassCastException ex)
{
- throw new BAD_OPERATION("ServiceContext[] expected.");
+ BAD_OPERATION bad = new BAD_OPERATION("ServiceContext[] expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java b/libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java
new file mode 100644
index 00000000000..e13c759c954
--- /dev/null
+++ b/libjava/classpath/org/omg/IOP/TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java
@@ -0,0 +1,61 @@
+/* TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.IOP;
+
+/**
+ * A single constant interface, defining the
+ * TAG_RMI_CUSTOM_MAX_STREAM_FORMAT (= 38) tagged component.
+ *
+ * This component defines the format that has been used to write the RMI-IIOP
+ * value type objects in the message. It consists of the single byte,
+ * having the value of the used version. If this component is missing,
+ * the default value is assumed to be 1 for GIOP 1.2 and 2 for GIOP 1.3.
+ * The component can occur only once in the same IOR profile.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface TAG_RMI_CUSTOM_MAX_STREAM_FORMAT
+{
+ /**
+ * Specifies the TAG_RMI_CUSTOM_MAX_STREAM_FORMAT value, 38.
+ */
+ int value = 38;
+}
diff --git a/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java b/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java
index 906d6390a36..eaee120f081 100644
--- a/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java
+++ b/libjava/classpath/org/omg/IOP/TaggedComponentHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.IOP;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.MARSHAL;
@@ -115,6 +117,7 @@ public abstract class TaggedComponentHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("TaggedComponent expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
@@ -149,6 +152,7 @@ public abstract class TaggedComponentHelper
catch (IOException e)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(e);
throw m;
}
@@ -175,6 +179,7 @@ public abstract class TaggedComponentHelper
catch (IOException e)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(e);
throw m;
}
diff --git a/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java b/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java
index a23122eb975..2943657c01f 100644
--- a/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java
+++ b/libjava/classpath/org/omg/IOP/TaggedProfileHelper.java
@@ -38,8 +38,9 @@ exception statement from your version. */
package org.omg.IOP;
-import gnu.CORBA.CDR.cdrBufInput;
-import gnu.CORBA.CDR.cdrBufOutput;
+import gnu.CORBA.Minor;
+import gnu.CORBA.CDR.BufferredCdrInput;
+import gnu.CORBA.CDR.BufferedCdrOutput;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -118,6 +119,7 @@ public abstract class TaggedProfileHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("TaggedProfile expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
@@ -143,10 +145,10 @@ public abstract class TaggedProfileHelper
TaggedProfile value = new TaggedProfile();
value.tag = input.read_long();
- if (input instanceof cdrBufInput)
+ if (input instanceof BufferredCdrInput)
{
// Highly probable.
- value.profile_data = ((cdrBufInput) input).read_sequence();
+ value.profile_data = ((BufferredCdrInput) input).read_sequence();
}
else
{
@@ -167,7 +169,7 @@ public abstract class TaggedProfileHelper
{
output.write_long(value.tag);
- if (output instanceof cdrBufOutput)
+ if (output instanceof BufferedCdrOutput)
{
// Highly probable.
output.write_long(value.profile_data.length);
@@ -178,6 +180,7 @@ public abstract class TaggedProfileHelper
catch (IOException e)
{
MARSHAL m = new MARSHAL();
+ m.minor = Minor.Encapsulation;
m.initCause(e);
throw m;
}
diff --git a/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java b/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java
index 7d8b412fe5f..1d482c57950 100644
--- a/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java
+++ b/libjava/classpath/org/omg/Messaging/SyncScopeHelper.java
@@ -38,8 +38,8 @@ exception statement from your version. */
package org.omg.Messaging;
-import gnu.CORBA.primitiveTypeCode;
-import gnu.CORBA.recordTypeCode;
+import gnu.CORBA.typecodes.PrimitiveTypeCode;
+import gnu.CORBA.typecodes.RecordTypeCode;
import org.omg.CORBA.Any;
import org.omg.CORBA.TCKind;
@@ -104,10 +104,10 @@ public class SyncScopeHelper
*/
public static TypeCode type()
{
- recordTypeCode r = new recordTypeCode(TCKind.tk_alias);
+ RecordTypeCode r = new RecordTypeCode(TCKind.tk_alias);
r.setName("SyncScope");
r.setId(id());
- r.setContentType(new primitiveTypeCode(TCKind.tk_short));
+ r.setContentType(new PrimitiveTypeCode(TCKind.tk_short));
return r;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java b/libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java
new file mode 100644
index 00000000000..d7e7e1487e9
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ACTIVE.java
@@ -0,0 +1,55 @@
+/* ACTIVE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (ACTIVE) = 1.
+ * Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ACTIVE
+{
+ /**
+ * Specifies the ACTIVE value, 1.
+ */
+ short value = 1;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java
new file mode 100644
index 00000000000..f3f7e64416a
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/AdapterManagerIdHelper.java
@@ -0,0 +1,119 @@
+/* AdapterManagerIdHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * A helper operations for the adapter manager id. An adapter manager id is an
+ * integer constant and needs no helper, but the one is included anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class AdapterManagerIdHelper
+{
+ /**
+ * Create the AdapterManagerId typecode (alias of CORBA long (java int),
+ * named "AdapterManagerId").
+ */
+ public static TypeCode type()
+ {
+ ORB orb = ORB.init();
+ return orb.create_alias_tc(id(), "AdapterManagerId",
+ orb.get_primitive_tc(TCKind.tk_long)
+ );
+ }
+
+ /**
+ * Insert the int into the given Any.
+ */
+ public static void insert(Any any, int that)
+ {
+ any.insert_long(that);
+ }
+
+ /**
+ * Extract the int from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain int.
+ */
+ public static int extract(Any any)
+ {
+ return any.extract_long();
+ }
+
+ /**
+ * Get the adapter manager id repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/AdapterManagerId:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/AdapterManagerId:1.0";
+ }
+
+ /**
+ * Read the int (adapter manager id) from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static int read(InputStream input)
+ {
+ return input.read_long();
+ }
+
+ /**
+ * Write the int (adapter manager id) to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, int value)
+ {
+ output.write_long(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java
new file mode 100644
index 00000000000..1cda311b23d
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/AdapterNameHelper.java
@@ -0,0 +1,144 @@
+/* AdapterNameHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.StringSeqHelper;
+import org.omg.CORBA.StringSeqHolder;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * Provides static helper methods for working with the adapter name helper.
+ * The adapter name helper is an array of strings, so {@link StringSeqHelper}
+ * could be used for io operations. The separate helper is provided anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public abstract class AdapterNameHelper
+{
+
+ /**
+ * The cached typecode, computed once.
+ */
+ static TypeCode typecode;
+
+ /**
+ * Extract the adapter name (<code>String[]</code>) from the given {@link Any}.
+ *
+ * @param a an Any to extract the array from.
+ *
+ * @return the extracted array.
+ */
+ public static String[] extract(Any a)
+ {
+ StringSeqHolder h = (StringSeqHolder) a.extract_Streamable();
+ return h.value;
+ }
+
+ /**
+ * Returns the agreed Id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/AdapterName:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/AdapterName:1.0";
+ }
+
+ /**
+ * Insert into the given adapter name (<code>String[]</code>) into the
+ * given {@link Any}.
+ *
+ * @param into the target Any.
+ * @param that the array to insert.
+ */
+ public static void insert(Any into, String[] that)
+ {
+ StringSeqHolder holder = new StringSeqHolder(that);
+ into.insert_Streamable(holder);
+ into.type(type());
+ }
+
+ /**
+ * Reads the <code>String[]</code> from the CORBA input stream.
+ *
+ * @param input the CORBA stream to read from.
+ * @return the value from the stream.
+ */
+ public static String[] read(InputStream input)
+ {
+ return StringSeqHelper.read(input);
+ }
+
+ /**
+ * Creates and returns a new instance of the TypeCode,
+ * corresponding the adapter name.
+ *
+ * @return the alias of the string sequence, named "AdapterName".
+ */
+ public static TypeCode type()
+ {
+ if (typecode == null)
+ {
+ ORB orb = OrbRestricted.Singleton;
+
+ TypeCode component = orb.create_string_tc(0);
+ typecode = orb.create_alias_tc(id(), "AdapterName", component);
+ }
+ return typecode;
+ }
+
+ /**
+ * Writes the <code>String[]</code> into the given stream.
+ *
+ * @param output the CORBA output stream to write.
+ * @param value the value that must be written.
+ */
+ public static void write(OutputStream output, String[] value)
+ {
+ StringSeqHelper.write(output, value);
+ }
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java b/libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java
new file mode 100644
index 00000000000..ceb7ac8d52a
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/AdapterStateHelper.java
@@ -0,0 +1,119 @@
+/* AdapterStateHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * A helper operations for the adapter state. An adapter state is an
+ * short integer constant and needs no helper, but the one is included anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class AdapterStateHelper
+{
+ /**
+ * Create the AdapterState typecode (alias of <code>short</code>,
+ * named "AdapterState").
+ */
+ public static TypeCode type()
+ {
+ ORB orb = ORB.init();
+ return orb.create_alias_tc(id(), "AdapterState",
+ orb.get_primitive_tc(TCKind.tk_short)
+ );
+ }
+
+ /**
+ * Insert the <code>short</code> into the given Any.
+ */
+ public static void insert(Any any, short that)
+ {
+ any.insert_short(that);
+ }
+
+ /**
+ * Extract the <code>short</code> from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain int.
+ */
+ public static short extract(Any any)
+ {
+ return any.extract_short();
+ }
+
+ /**
+ * Get the adapter state repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/AdapterState:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/AdapterState:1.0";
+ }
+
+ /**
+ * Read the <code>short</code> (adapter state) from the CDR intput stream.
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static short read(InputStream input)
+ {
+ return input.read_short();
+ }
+
+ /**
+ * Write the <code>short</code> (adapter state) to the CDR output stream.
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, short value)
+ {
+ output.write_short(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java b/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java
index b7a5a541e93..df3bcaef72b 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/CurrentHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.MARSHAL;
@@ -45,6 +47,7 @@ import org.omg.CORBA.ORB;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
+import org.omg.PortableServer.ServantActivator;
/**
* The helper operations for the CORBA object {@link Current}.
@@ -123,6 +126,25 @@ public abstract class CurrentHelper
throw new BAD_PARAM("Not a Current");
}
}
+
+ /**
+ * Narrow the given object to the Current. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted Current.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static Current unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* Not supported for compatibility reasons.
@@ -133,7 +155,9 @@ public abstract class CurrentHelper
*/
public static Current read(InputStream input)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -145,6 +169,8 @@ public abstract class CurrentHelper
*/
public static void write(OutputStream output, Current value)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java b/libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java
new file mode 100644
index 00000000000..bec0c25e0ac
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/DISCARDING.java
@@ -0,0 +1,55 @@
+/* DISCARDING.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (DISCARDING) = 2.
+ * Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface DISCARDING
+{
+ /**
+ * Specifies the DISCARDING value, 2.
+ */
+ short value = 2;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java
index 11d6b7f0fd6..5db56d74560 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ForwardRequestHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
+import gnu.CORBA.Minor;
import gnu.CORBA.Interceptor.ForwardRequestHolder;
import org.omg.CORBA.Any;
@@ -106,6 +107,7 @@ public abstract class ForwardRequestHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION(id() + " expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/HOLDING.java b/libjava/classpath/org/omg/PortableInterceptor/HOLDING.java
new file mode 100644
index 00000000000..ce22a1f6860
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/HOLDING.java
@@ -0,0 +1,55 @@
+/* HOLDING.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (HOLDING) = 0.
+ * Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface HOLDING
+{
+ /**
+ * Specifies the HOLDING value, 0.
+ */
+ short value = 0;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java b/libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java
new file mode 100644
index 00000000000..8a5cad1e124
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/INACTIVE.java
@@ -0,0 +1,57 @@
+/* INACTIVE.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (INACTIVE) = 3.
+ * The adapter is shutting down, and will eventually end up in the
+ * NON_EXISTENT state.
+ * Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface INACTIVE
+{
+ /**
+ * Specifies the INACTIVE value, 3.
+ */
+ short value = 3;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java
index 58ef02fb0c0..fdeb2973b8a 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInfoOperations.java
@@ -73,7 +73,7 @@ public interface IORInfoOperations
void add_ior_component(TaggedComponent tagged_component);
/**
- * Get the server side policy for an IOR being constructed. The method returns
+ * Get the server side policy for an IOR being constructed. The method returns
* policies applying for POA where the object, represented by this IOR, is
* connected.
*
@@ -85,4 +85,54 @@ public interface IORInfoOperations
* @see org.omg.PortableServer.POAOperations#create_POA
*/
Policy get_effective_policy(int policy_type);
+
+ /**
+ * Get the adapter template that is associated with the object POA.
+ * The template is also a reference factory and can produce the new object
+ * references.
+ *
+ * @since 1.5
+ */
+ public ObjectReferenceTemplate adapter_template();
+
+ /**
+ * The current_factory is the factory, used by the adapter to create
+ * object references. This factory is initially the same as the
+ * adapter_template.
+ *
+ * @since 1.5
+ */
+ public ObjectReferenceFactory current_factory();
+
+ /**
+ * Set the current object reference factory, used to produce the new objects.
+ *
+ * The current factory can only be set during the call to the
+ * {@link IORInterceptor_3_0Operations#components_established(IORInfo)}.
+ *
+ * @since 1.5
+ */
+ public void current_factory(ObjectReferenceFactory factory);
+
+ /**
+ * Get the POA manager Id.
+ *
+ * @return Id that uniquely refers to the poa manager, used by this POA.
+ *
+ * @since 1.5
+ *
+ * @see IORInterceptor_3_0Operations#adapter_manager_state_changed
+ */
+ public int manager_id();
+
+ /**
+ * Get the state of the adapter manager.
+ *
+ * @since 1.5
+ *
+ * @return the state of the adapters to that the IOR being created belongs.
+ * One of the {@link HOLDING#value}, {@link DISCARDING#value},
+ * {@link INACTIVE#value} or {@link NON_EXISTENT#value}.
+ */
+ short state();
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java
index 868fcab6c62..746d139cf6f 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptorOperations.java
@@ -47,12 +47,12 @@ package org.omg.PortableInterceptor;
public interface IORInterceptorOperations extends InterceptorOperations
{
/**
- * A server side ORB calls this method on all registered IORInterceptor's when
+ * A server side ORB calls this method on all registered IORInterceptor's when
* creating the object reference (IOR). The interceptors have the possibility
* to add additional tags to the IOR being created.
*
- * @param info the interface class providing methods to insert additional tags
- * into IOR being constructed. The same instan
+ * @param info the interface class providing methods to insert additional tags
+ * into IOR being constructed.
*/
public void establish_components(IORInfo info);
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java
new file mode 100644
index 00000000000..4b2093d40c6
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0.java
@@ -0,0 +1,59 @@
+/* IORInterceptor_3_0.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * The IORInterceptor_3_0 adds to {@link Interceptor} functionality, available
+ * since CORBA 3.0. These new operations are defined separately in
+ * {@link IORInterceptor_3_0Operations}.
+ *
+ * IORInterceptor_3_0 is registered exactly in the same way as the
+ * {@link IORInterceptor}. The ORB calls the additional methods to all
+ * IOR interceptors that implement this extended interface.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface IORInterceptor_3_0
+ extends IORInterceptor_3_0Operations, IDLEntity, IORInterceptor
+{
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java
new file mode 100644
index 00000000000..565242477d9
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Helper.java
@@ -0,0 +1,195 @@
+/* IORInterceptor_3_0Helper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The helper operations for the CORBA object {@link IORInterceptor_3_0}.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class IORInterceptor_3_0Helper
+{
+ /**
+ * The cached {@link IORInterceptor_3_0} typecode, computed once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Get the type code of the {@link IORInterceptor_3_0}.
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ typeCode = ORB.init().create_interface_tc(id(), "IORInterceptor_3_0");
+ return typeCode;
+ }
+
+ /**
+ * Insert the IORInterceptor_3_0 into the given Any.
+ *
+ * @param any the Any to insert into.
+ * @param that the IORInterceptor_3_0 to insert.
+ */
+ public static void insert(Any any, IORInterceptor_3_0 that)
+ {
+ any.insert_Streamable(new IORInterceptor_3_0Holder(that));
+ }
+
+ /**
+ * Extract the IORInterceptor_3_0 from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain
+ * IORInterceptor_3_0.
+ */
+ public static IORInterceptor_3_0 extract(Any any)
+ {
+ try
+ {
+ IORInterceptor_3_0Holder holder = (IORInterceptor_3_0Holder)
+ any.extract_Streamable();
+ return holder.value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION("IORInterceptor_3_0 expected");
+ bad.minor = Minor.Any;
+ bad.initCause(cex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the IORInterceptor_3_0 repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/IORInterceptor_3_0:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/IORInterceptor_3_0:1.0";
+ }
+
+ /**
+ * Narrow the passed object into the IORInterceptor_3_0. If the object has a
+ * different java type, create an instance of the _IORInterceptor_3_0Stub,
+ * using the same delegate, as for the passed parameter. Hence, unlike java
+ * type cast, this method may return a different object, than has been passed.
+ *
+ * @param obj the object to narrow.
+ * @return narrowed instance.
+ * @throws BAD_PARAM if the passed object is not a IORInterceptor_3_0.
+ */
+ public static IORInterceptor_3_0 narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof IORInterceptor_3_0)
+ return (IORInterceptor_3_0) obj;
+ else if (!obj._is_a(id()))
+ throw new BAD_PARAM("Not a IORInterceptor_3_0");
+ else
+ {
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _IORInterceptor_3_0Stub(delegate);
+ }
+ }
+
+ /**
+ * Narrow the passed object into the IORInterceptor_3_0. No type-checking is
+ * performed to verify that the object actually supports the requested type.
+ * The {@link BAD_OPERATION} will be thrown if unsupported operations are
+ * invoked on the new returned reference, but no failure is expected at the
+ * time of the unchecked_narrow. For instance, the narrowing of the
+ * remote instance of the {@link IORInterceptor} will work as long as only the
+ * methods, inherited from this parent, are invoked.
+ *
+ *
+ * @param obj the object to narrow.
+ * @return narrowed instance.
+ * @throws BAD_PARAM if the passed object is not a IORInterceptor_3_0.
+ */
+ public static IORInterceptor_3_0 unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof IORInterceptor_3_0)
+ return (IORInterceptor_3_0) obj;
+ else
+ {
+ Delegate delegate = ((ObjectImpl) obj)._get_delegate();
+ return new _IORInterceptor_3_0Stub(delegate);
+ }
+ }
+
+
+ /**
+ * Read the IORInterceptor_3_0 from the CDR intput stream (IOR profile
+ * expected).
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static IORInterceptor_3_0 read(InputStream input)
+ {
+ return unchecked_narrow(input.read_Object());
+ }
+
+ /**
+ * Write the IORInterceptor_3_0 to the CDR output stream (as IOR profile).
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, IORInterceptor_3_0 value)
+ {
+ output.write_Object(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java
new file mode 100644
index 00000000000..dc7ecf23faa
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Holder.java
@@ -0,0 +1,106 @@
+/* IORInterceptor_3_0Holder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A holder for the object {@link IORInterceptor_3_0}.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class IORInterceptor_3_0Holder
+ implements Streamable
+{
+ /**
+ * The stored IORInterceptor_3_0 value.
+ */
+ public IORInterceptor_3_0 value;
+
+ /**
+ * Create the unitialised instance, leaving the value field with default
+ * <code>null</code> value.
+ */
+ public IORInterceptor_3_0Holder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ *
+ * @param initialValue the value that will be assigned to the
+ * <code>value</code> field.
+ */
+ public IORInterceptor_3_0Holder(IORInterceptor_3_0 initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = IORInterceptor_3_0Helper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ IORInterceptor_3_0Helper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the IORInterceptor_3_0.
+ */
+ public org.omg.CORBA.TypeCode _type()
+ {
+ return IORInterceptor_3_0Helper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java
new file mode 100644
index 00000000000..ce6575a4ce0
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/IORInterceptor_3_0Operations.java
@@ -0,0 +1,90 @@
+/* IORInterceptor_3_0Operations.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * Defines the operations, applicable to the IORInterceptor_3_0.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface IORInterceptor_3_0Operations
+ extends IORInterceptorOperations
+{
+ /**
+ * This method is invoked on all registered IORInterceptor_3_0 instances when
+ * the state of the adapter manager changes.
+ *
+ * @param adapterManagerId the Id of the adapter manager that has changed the
+ * state. The same value is returned by
+ * {@link IORInfoOperations#manager_id()}.
+ *
+ * @param adapterState the new state of the adapter manager, one of the
+ * {@link HOLDING#value}, {@link DISCARDING#value}, {@link INACTIVE#value}
+ * or {@link NON_EXISTENT#value}.
+ */
+ void adapter_manager_state_changed(int adapterManagerId, short adapterState);
+
+ /**
+ * Notifies the interceptor about the adapter state changes that are unrelated
+ * to adapter manager state changes. This method is invoked on all registered
+ * IORInterceptor_3_0 instances. The only currently possible change of state
+ * is when POA is destroyed. In this case, the method is invoked passing the
+ * single element array witn the reference template of the POA being destroyed
+ * and the {@link NON_EXISTENT#value} state.
+ *
+ * @param adapters identifies the object adapters that have changed they
+ * state.
+ * @param adaptersState the new state of the adapters, one of the
+ * {@link HOLDING#value}, {@link DISCARDING#value}, {@link INACTIVE#value}
+ * or {@link NON_EXISTENT#value}.
+ */
+ void adapter_state_changed(ObjectReferenceTemplate[] adapters,
+ short adaptersState);
+
+ /**
+ * This metod is invoked after the
+ * {@link IORInterceptorOperations#establish_components} have been called on
+ * all registered interceptor instances. At this stage, it is possible to set
+ * the object reference factory using
+ * {@link IORInfo#current_factory(ObjectReferenceFactory )}.
+ */
+ void components_established(IORInfo info);
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java
index c0aa0ee1bb4..98b2596771f 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/InvalidSlotHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class InvalidSlotHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("InvalidSlot expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java b/libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java
new file mode 100644
index 00000000000..136b64fb008
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/NON_EXISTENT.java
@@ -0,0 +1,57 @@
+/* NON_EXISTENT.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+/**
+ * A single constant interface, defining the adapter state (NON_EXISTENT) = 4.
+ * NON_EXISTENT does not map directly to a particular POAManager state, but
+ * indicates that a POA has been destroyed. Used with IOR interceptors.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+
+public interface NON_EXISTENT
+{
+ /**
+ * Specifies the NON_EXISTENT value, 4.
+ */
+ short value = 4;
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java
new file mode 100644
index 00000000000..8332845a662
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBIdHelper.java
@@ -0,0 +1,119 @@
+/* ORBIdHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The ORB Id is defined in OMG specification just as a narrow (not wide)
+ * string. As such, the ORB Id needs no helper, but one is included in
+ * the API anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ORBIdHelper
+{
+ /**
+ * Insert the ORB Id into Any (uses {@link Any.insert_string}).
+ *
+ * @param a the Any to insert into.
+ * @param that the string to insert.
+ */
+ public static void insert(Any a, String that)
+ {
+ a.insert_string(that);
+ }
+
+ /**
+ * Extract the ORB Id from Any ((uses {@link Any.extract_string}).
+ *
+ * @param a the Any to extract from.
+ */
+ public static String extract(Any a)
+ {
+ return a.extract_string();
+ }
+
+ /**
+ * Return an alias typecode.
+ */
+ public static TypeCode type()
+ {
+ ORB orb = OrbRestricted.Singleton;
+ return orb.create_alias_tc(id(), "ORBId", orb.create_string_tc(0));
+ }
+
+ /**
+ * Return the ORB Id repository id.
+ * @return "IDL:omg.org/PortableInterceptor/ORBId:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ORBId:1.0";
+ }
+
+ /**
+ * Calls {@link InputStream#read_string()}.
+ *
+ * @param input the stream to read from.
+ */
+ public static String read(InputStream input)
+ {
+ return input.read_string();
+ }
+
+ /**
+ * Calls {@link OutputStream#write_string()}.
+ *
+ * @param output the stream to write into.
+ * @param value the string (ORB Id) value to write.
+ */
+ public static void write(OutputStream output, String value)
+ {
+ output.write_string(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java
index 9cffbe1b551..7b545ff8168 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoOperations.java
@@ -55,7 +55,7 @@ public interface ORBInitInfoOperations
*
* @param interceptor the interceptor to register.
*
- * @throws DuplicateName if the interceptor name is not an empty string and an
+ * @throws DuplicateName if the interceptor name is not an empty string and an
* interceptor with this name is already registered with the ORB being
* created.
*/
@@ -63,11 +63,14 @@ public interface ORBInitInfoOperations
throws DuplicateName;
/**
- * Register the IOR (object reference) interceptor.
- *
+ * Register the IOR (object reference) interceptor. If the registered
+ * interceptor implements the extended {@link IORInterceptor_3_0} interface,
+ * ORB will call its additional methods, defined in the
+ * {@link IORInterceptor_3_0Operations}.
+ *
* @param interceptor the interceptor to register.
- *
- * @throws DuplicateName if the interceptor name is not an empty string and an
+ *
+ * @throws DuplicateName if the interceptor name is not an empty string and an
* interceptor with this name is already registered with the ORB being
* created.
*/
@@ -79,7 +82,7 @@ public interface ORBInitInfoOperations
*
* @param interceptor the interceptor to register.
*
- * @throws DuplicateName if the interceptor name is not an empty string and an
+ * @throws DuplicateName if the interceptor name is not an empty string and an
* interceptor with this name is already registered with the ORB being
* created.
*/
@@ -90,7 +93,7 @@ public interface ORBInitInfoOperations
* Allocate a slot on a {@link PortableInterceptor.Current}. While slots can
* be allocated by this method, they cannot be initialized.
* {@link CurrentOperations#get_slot} and {@link CurrentOperations#set_slot}
- * throw {@link org.omg.CORBA.BAD_INV_ORDER} while called from the interceptor
+ * throw {@link org.omg.CORBA.BAD_INV_ORDER} while called from the interceptor
* initializer.
*
* @return the index to the slot that has been allocated.
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
index a5c83fa80b0..648e9679b42 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHelper.java
@@ -110,6 +110,7 @@ public abstract class DuplicateNameHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("DuplicateName expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java
index 7f1132f98a3..f89f9d4c6db 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor.ORBInitInfoPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -103,6 +104,7 @@ public abstract class InvalidNameHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("InvalidName expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java
index d0946e3fa00..c22d14a11fd 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ORBInitInfoPackage/ObjectIdHelper.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package org.omg.PortableInterceptor.ORBInitInfoPackage;
-import gnu.CORBA.Restricted_ORB;
+import gnu.CORBA.OrbRestricted;
import org.omg.CORBA.Any;
import org.omg.CORBA.ORB;
@@ -81,8 +81,8 @@ public class ObjectIdHelper
*/
public static TypeCode type()
{
- ORB orb = Restricted_ORB.Singleton;
- return orb.create_alias_tc(id(), "Object Id", orb.create_string_tc(0));
+ ORB orb = OrbRestricted.Singleton;
+ return orb.create_alias_tc(id(), "ObjectId", orb.create_string_tc(0));
}
/**
@@ -97,7 +97,7 @@ public class ObjectIdHelper
/**
* Calls {@link InputStream#read_string()}.
*
- * @param instream the stream to read from.
+ * @param input the stream to read from.
*/
public static String read(InputStream input)
{
@@ -107,7 +107,7 @@ public class ObjectIdHelper
/**
* Calls {@link OutputStream#write_string()}.
*
- * @param ostream the stream to write into.
+ * @param output the stream to write into.
* @param value the string (Object Id) value to write.
*/
public static void write(OutputStream output, String value)
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java
new file mode 100644
index 00000000000..600d0a0fb94
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectIdHelper.java
@@ -0,0 +1,121 @@
+/* ObjectIdHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.OctetSeqHelper;
+import org.omg.CORBA.OctetSeqHolder;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Object Id of this package is defined in OMG specification as a byte array.
+ * As such, the Object Id needs no helper, but one is included in the API anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ObjectIdHelper
+{
+ /**
+ * Insert the Object Id into Any.
+ *
+ * @param a the Any to insert into.
+ * @param that the string to insert.
+ */
+ public static void insert(Any a, byte[] that)
+ {
+ a.insert_Streamable(new OctetSeqHolder(that));
+ a.type(type());
+ }
+
+ /**
+ * Extract the Object Id from Any.
+ *
+ * @param a the Any to extract from.
+ */
+ public static byte[] extract(Any a)
+ {
+ return ((OctetSeqHolder) a.extract_Streamable()).value;
+ }
+
+ /**
+ * Return an alias typecode (an alias of the octet sequence).
+ */
+ public static TypeCode type()
+ {
+ ORB orb = OrbRestricted.Singleton;
+ return orb.create_alias_tc(id(), "ObjectId", OctetSeqHelper.type());
+ }
+
+ /**
+ * Return the Object Id repository id.
+ * @return "IDL:omg.org/PortableInterceptor/ObjectId:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ObjectId:1.0";
+ }
+
+ /**
+ * Read the Object Id as a byte array.
+ *
+ * @param input the stream to read from.
+ */
+ public static byte[] read(InputStream input)
+ {
+ return OctetSeqHelper.read(input);
+ }
+
+ /**
+ * Write the Object Id as a byte array.
+ *
+ * @param output the stream to write into.
+ * @param value the Object Id value to write.
+ */
+ public static void write(OutputStream output, byte[] value)
+ {
+ OctetSeqHelper.write(output, value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java
new file mode 100644
index 00000000000..55cde585c5e
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactory.java
@@ -0,0 +1,57 @@
+/* ObjectReferenceFactory.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * Provides the possibility to create the CORBA object reference.
+ * The reference is created from repository id (defining the type of the
+ * object) and the object id (defining the identity of the object).
+ * The operation for creating reference is defined separately in
+ * {@link ObjectReferenceFactoryOperations}.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ObjectReferenceFactory
+ extends ObjectReferenceFactoryOperations, IDLEntity
+{
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java
new file mode 100644
index 00000000000..55ee0be18fc
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHelper.java
@@ -0,0 +1,150 @@
+/* ObjectReferenceFactoryHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.CDR.Vio;
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.ValueMember;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.VM_ABSTRACT;
+
+/**
+ * The helper operations for the CORBA object {@link ObjectReferenceFactory}.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ObjectReferenceFactoryHelper
+{
+ /**
+ * The cached {@link ObjectReferenceFactory} typecode, computed once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Get the type code of the {@link ObjectReferenceFactory}.
+ *
+ * @return value type code with the agreed id, named
+ * "ObjectReferenceFactory", abstract, no members, no base type.
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ typeCode =
+ ORB.init().create_value_tc(id(), "ObjectReferenceFactory",
+ VM_ABSTRACT.value, null, new ValueMember[ 0 ]
+ );
+ return typeCode;
+ }
+
+ /**
+ * Insert the ObjectReferenceFactory into the given Any.
+ *
+ * @param any the Any to insert into.
+ * @param that the ObjectReferenceFactory to insert.
+ */
+ public static void insert(Any any, ObjectReferenceFactory that)
+ {
+ ObjectReferenceFactoryHolder h = new ObjectReferenceFactoryHolder(that);
+ any.insert_Streamable(h);
+ }
+
+ /**
+ * Extract the ObjectReferenceFactory from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not contain ObjectReferenceFactory.
+ */
+ public static ObjectReferenceFactory extract(Any any)
+ {
+ try
+ {
+ ObjectReferenceFactoryHolder h =
+ (ObjectReferenceFactoryHolder) (any.extract_Streamable());
+ return h.value;
+ }
+ catch (ClassCastException ex)
+ {
+ BAD_OPERATION bad =
+ new BAD_OPERATION("ObjectReferenceFactory expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the ObjectReferenceFactory repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/ObjectReferenceFactory:1.0",
+ * always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ObjectReferenceFactory:1.0";
+ }
+
+ /**
+ * Read the ObjectReferenceFactory from the CDR intput stream
+ * (ValueBase type expected).
+ *
+ * @param input a org.omg.CORBA.portable stream to read from.
+ */
+ public static ObjectReferenceFactory read(InputStream input)
+ {
+ return (ObjectReferenceFactory) Vio.read(input);
+ }
+
+ /**
+ * Write the ObjectReferenceFactory to the CDR output stream (as a ValueBase).
+ *
+ * @param output a org.omg.CORBA.portable stream stream to write into.
+ * @param value a value to write.
+ */
+ public static void write(OutputStream output, ObjectReferenceFactory value)
+ {
+ Vio.write(output, value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java
new file mode 100644
index 00000000000..fc68ec5c148
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryHolder.java
@@ -0,0 +1,105 @@
+/* ObjectReferenceFactoryHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A holder for the object {@link ObjectReferenceFactory}.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ObjectReferenceFactoryHolder
+ implements Streamable
+{
+ /**
+ * The stored ObjectReferenceFactory value.
+ */
+ public ObjectReferenceFactory value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public ObjectReferenceFactoryHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public ObjectReferenceFactoryHolder(ObjectReferenceFactory initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = ObjectReferenceFactoryHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ ObjectReferenceFactoryHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the ObjectReferenceFactory.
+ */
+ public org.omg.CORBA.TypeCode _type()
+ {
+ return ObjectReferenceFactoryHelper.type();
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java
new file mode 100644
index 00000000000..b5d912d12be
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceFactoryOperations.java
@@ -0,0 +1,69 @@
+/* ObjectReferenceFactoryOperations.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.ValueBase;
+
+/**
+ * Defines the operations, applicable to the ObjectReferenceFactory.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ObjectReferenceFactoryOperations
+ extends ValueBase
+{
+ /**
+ * Create an object with the given repository and object ids. This interface
+ * does not specify where and how the returned object must be connected and
+ * activated. The derived {@link ObjectReferenceTemplate} interface assumes
+ * the the object must be connected to the POA that is specific to that
+ * template (name can be obtained).
+ *
+ * If the object with this objectId already exists in the given context, it is
+ * found and returned; the new object is <i>not</i> created.
+ *
+ * @param repositoryId the repository id of the object being created, defines
+ * the type of the object.
+ *
+ * @param objectId the byte array, defining the identity of the object.
+ */
+ org.omg.CORBA.Object make_object(String repositoryId, byte[] objectId);
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java
new file mode 100644
index 00000000000..666735e7636
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplate.java
@@ -0,0 +1,78 @@
+/* ObjectReferenceTemplate.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.PortableServer.POA;
+
+/**
+ * Defines the identity of the portable object adapter ({@link POA}}. The
+ * adapter name, orb id and server id together uniquely define the identity
+ * of this adapter.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public interface ObjectReferenceTemplate
+ extends ObjectReferenceFactory
+{
+ /**
+ * Get the name of this adapter. This name can be set by specifying
+ * the org.omg.CORBA.ORBid property in the ORB.Init(.., Properties).
+ * The default value includes the hashcode of the ORB instance and hence
+ * should normally differ for each ORB.
+ *
+ * @return the name of adapter, represented in the form of the string array.
+ */
+ String[] adapter_name();
+
+ /**
+ * The id of the {@link org.omg.CORBA.ORB} of this adapter.
+ *
+ * @return the ORB id, represented in the form of string.
+ */
+ String orb_id();
+
+ /**
+ * Get the server id of of this adapter. This name can be set by specifying
+ * the org.omg.CORBA.ServerId property in the ORB.Init(.., Properties) or
+ * in the system property. All ORB's on the same jre share the same value.
+ *
+ * @return the server id, represented in the form of string.
+ */
+ String server_id();
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java
new file mode 100644
index 00000000000..258a73ae8a1
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHelper.java
@@ -0,0 +1,144 @@
+/* ObjectReferenceTemplateHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.Minor;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.VM_ABSTRACT;
+import org.omg.CORBA.ValueMember;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The helper operations for the CORBA object
+ * {@link ObjectReferenceTemplate}.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ObjectReferenceTemplateHelper
+{
+ /**
+ * The cached {@link ObjectReferenceTemplate} typecode, computed once.
+ */
+ private static TypeCode typeCode;
+
+ /**
+ * Get the type code of the {@link ObjectReferenceTemplate}.
+ *
+ * @return value type type code, named ObjectReferenceTemplate,
+ * no members, abstract.
+ */
+ public static TypeCode type()
+ {
+ if (typeCode == null)
+ typeCode =
+ ORB.init().create_value_tc(id(), "ObjectReferenceTemplate",
+ VM_ABSTRACT.value, null, new ValueMember[ 0 ]
+ );
+ return typeCode;
+ }
+
+ /**
+ * Insert the ObjectReferenceTemplate into the given Any.
+ *
+ * @param any the Any to insert into.
+ * @param that the ObjectReferenceTemplate to insert.
+ */
+ public static void insert(Any any, ObjectReferenceTemplate that)
+ {
+ any.insert_Streamable(new ObjectReferenceTemplateHolder(that));
+ }
+
+ /**
+ * Extract the ObjectReferenceTemplate from given Any.
+ *
+ * @throws BAD_OPERATION if the passed Any does not
+ * contain ObjectReferenceTemplate.
+ */
+ public static ObjectReferenceTemplate extract(Any any)
+ {
+ try
+ {
+ ObjectReferenceTemplateHolder h =
+ (ObjectReferenceTemplateHolder) any.extract_Streamable();
+ return h.value;
+ }
+ catch (ClassCastException ex)
+ {
+ BAD_OPERATION bad =
+ new BAD_OPERATION("ObjectReferenceTemplate expected");
+ bad.minor = Minor.Any;
+ bad.initCause(ex);
+ throw bad;
+ }
+ }
+
+ /**
+ * Get the ObjectReferenceTemplate repository id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplate:1.0",
+ * always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplate:1.0";
+ }
+
+ /**
+ * Read the object reference template (as the value type).
+ */
+ public static ObjectReferenceTemplate read(InputStream input)
+ {
+ return (ObjectReferenceTemplate)
+ ((org.omg.CORBA_2_3.portable.InputStream) input).read_value();
+ }
+
+ /**
+ * Write the object reference template (as the value type).
+ */
+ public static void write(OutputStream output, ObjectReferenceTemplate value)
+ {
+ ((org.omg.CORBA_2_3.portable.OutputStream) output).
+ write_value(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java
new file mode 100644
index 00000000000..9658e1fa718
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateHolder.java
@@ -0,0 +1,103 @@
+/* ObjectReferenceTemplateHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+ /**
+ * A holder for the object {@link ObjectReferenceTemplate}.
+ *
+* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ObjectReferenceTemplateHolder
+ implements Streamable
+{
+ /**
+ * The stored ObjectReferenceTemplate value.
+ */
+ public ObjectReferenceTemplate value;
+
+ /**
+ * Create the unitialised instance, leaving the value field
+ * with default <code>null</code> value.
+ */
+ public ObjectReferenceTemplateHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ * @param initialValue the value that will be assigned to
+ * the <code>value</code> field.
+ */
+ public ObjectReferenceTemplateHolder(ObjectReferenceTemplate initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = ObjectReferenceTemplateHelper .read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ ObjectReferenceTemplateHelper .write(output, value);
+ }
+
+ /**
+ * Get the typecode of the ObjectReferenceTemplate.
+ */
+ public org.omg.CORBA.TypeCode _type()
+ {
+ return ObjectReferenceTemplateHelper .type();
+ }
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java
new file mode 100644
index 00000000000..c4f09896f97
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHelper.java
@@ -0,0 +1,169 @@
+/* ObjectReferenceTemplateSeqHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.Minor;
+import gnu.CORBA.typecodes.GeneralTypeCode;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * Provides static helper methods for working with the array of object reference
+ * templates.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public abstract class ObjectReferenceTemplateSeqHelper
+{
+ /**
+ * The type code, computed once.
+ */
+ static TypeCode typecode;
+
+ /**
+ * Extract the <code>ObjectReferenceTemplate[]</code> from the given
+ * {@link Any}. This implementation expects the {@link Any} to hold the
+ * instance of {@link ObjectReferenceTemplateSeqHolder} that is returned by
+ * {@link Any#extract_Streamable() }.
+ *
+ * @param a an Any to extract the array from.
+ *
+ * @return the extracted array.
+ *
+ * @throws BAD_OPERATION if the Any contains something other than the the
+ * {@link ObjectReferenceTemplateSeqHolder}.
+ */
+ public static ObjectReferenceTemplate[] extract(Any a)
+ {
+ try
+ {
+ ObjectReferenceTemplateSeqHolder h = (ObjectReferenceTemplateSeqHolder)
+ a.extract_Streamable();
+ return h.value;
+ }
+ catch (ClassCastException cex)
+ {
+ BAD_OPERATION bad = new BAD_OPERATION(
+ "ObjectReferenceTemplate[] expected");
+ bad.initCause(cex);
+ bad.minor = Minor.Any;
+ throw bad;
+ }
+ }
+
+ /**
+ * Returns the object reference template sequence repository Id.
+ *
+ * @return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplateSeq:1.0",
+ * always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ObjectReferenceTemplateSeq:1.0";
+ }
+
+ /**
+ * Insert into the given <code>ObjectReferenceTemplate[]</code> into the
+ * given {@link Any}. This implementation first creates a
+ * {@link ObjectReferenceTemplateSeqHolder} and then calls
+ * {@link Any#insert_Streamable(Streamable)}.
+ *
+ * @param into the target Any.
+ * @param that the array to insert.
+ */
+ public static void insert(Any into, ObjectReferenceTemplate[] that)
+ {
+ ObjectReferenceTemplateSeqHolder holder =
+ new ObjectReferenceTemplateSeqHolder(that);
+ into.insert_Streamable(holder);
+ }
+
+ /**
+ * Reads the <code>ObjectReferenceTemplate[]</code> from the CORBA input
+ * stream.
+ *
+ * @param input the CORBA (not java.io) stream to read from.
+ * @return the value from the stream.
+ */
+ public static ObjectReferenceTemplate[] read(InputStream input)
+ {
+ ObjectReferenceTemplate[] value =
+ new ObjectReferenceTemplate[input.read_long()];
+ for (int i = 0; i < value.length; i++)
+ value[i] = ObjectReferenceTemplateHelper.read(input);
+ return value;
+ }
+
+ /**
+ * Creates and returns a new instance of the TypeCode, corresponding the CORBA
+ * <code>ObjectReferenceTemplate[]</code>. The length of the sequence is
+ * left with the initial value 0.
+ */
+ public static TypeCode type()
+ {
+ if (typecode == null)
+ {
+ GeneralTypeCode t = new GeneralTypeCode(TCKind.tk_sequence);
+ t.setId(id());
+ t.setLength(0);
+ t.setContentType(ObjectReferenceTemplateHelper.type());
+ typecode = t;
+ }
+ return typecode;
+ }
+
+ /**
+ * Writes the <code>ObjectReferenceTemplate[]</code> into the given stream.
+ *
+ * @param output the CORBA (not java.io) output stream to write.
+ * @param value the value that must be written.
+ */
+ public static void write(OutputStream output, ObjectReferenceTemplate[] value)
+ {
+ output.write_long(value.length);
+
+ for (int i = 0; i < value.length; i++)
+ ObjectReferenceTemplateHelper.write(output, value[i]);
+ }
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java
new file mode 100644
index 00000000000..d16f5cedd9f
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ObjectReferenceTemplateSeqHolder.java
@@ -0,0 +1,104 @@
+/* ObjectReferenceTemplateSeqHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * A holder for the array of {@link ObjectReferenceTemplate}s.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public class ObjectReferenceTemplateSeqHolder
+ implements Streamable
+{
+ /**
+ * The stored ObjectReferenceTemplate value.
+ */
+ public ObjectReferenceTemplate[] value;
+
+ /**
+ * Create the unitialised instance, leaving the value field with default
+ * <code>null</code> value.
+ */
+ public ObjectReferenceTemplateSeqHolder()
+ {
+ }
+
+ /**
+ * Create the initialised instance.
+ *
+ * @param initialValue the value that will be assigned to the
+ * <code>value</code> field.
+ */
+ public ObjectReferenceTemplateSeqHolder(ObjectReferenceTemplate[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ /**
+ * Fill in the {@link value} by data from the CDR stream.
+ *
+ * @param input the org.omg.CORBA.portable stream to read.
+ */
+ public void _read(InputStream input)
+ {
+ value = ObjectReferenceTemplateSeqHelper.read(input);
+ }
+
+ /**
+ * Write the stored value into the CDR stream.
+ *
+ * @param output the org.omg.CORBA.portable stream to write.
+ */
+ public void _write(OutputStream output)
+ {
+ ObjectReferenceTemplateSeqHelper.write(output, value);
+ }
+
+ /**
+ * Get the typecode of the ObjectReferenceTemplate.
+ */
+ public org.omg.CORBA.TypeCode _type()
+ {
+ return ObjectReferenceTemplateSeqHelper.type();
+ }
+}
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java b/libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java
new file mode 100644
index 00000000000..e4f8fe9c28f
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/ServerIdHelper.java
@@ -0,0 +1,119 @@
+/* ServerIdHelper.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import gnu.CORBA.OrbRestricted;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Server Id is defined in OMG specification just as a narrow (not wide)
+ * string. As such, the Server Id needs no helper, but one is included in
+ * the API anyway.
+ *
+ * @since 1.5
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+public abstract class ServerIdHelper
+{
+ /**
+ * Insert the Server Id into Any (uses {@link Any.insert_string}).
+ *
+ * @param a the Any to insert into.
+ * @param that the string to insert.
+ */
+ public static void insert(Any a, String that)
+ {
+ a.insert_string(that);
+ }
+
+ /**
+ * Extract the Server Id from Any ((uses {@link Any.extract_string}).
+ *
+ * @param a the Any to extract from.
+ */
+ public static String extract(Any a)
+ {
+ return a.extract_string();
+ }
+
+ /**
+ * Return an alias typecode.
+ */
+ public static TypeCode type()
+ {
+ ORB orb = OrbRestricted.Singleton;
+ return orb.create_alias_tc(id(), "ServerId", orb.create_string_tc(0));
+ }
+
+ /**
+ * Return the Server Id repository id.
+ * @return "IDL:omg.org/PortableInterceptor/ServerId:1.0", always.
+ */
+ public static String id()
+ {
+ return "IDL:omg.org/PortableInterceptor/ServerId:1.0";
+ }
+
+ /**
+ * Calls {@link InputStream#read_string()}.
+ *
+ * @param input the stream to read from.
+ */
+ public static String read(InputStream input)
+ {
+ return input.read_string();
+ }
+
+ /**
+ * Calls {@link OutputStream#write_string()}.
+ *
+ * @param output the stream to write into.
+ * @param value the string (Server Id) value to write.
+ */
+ public static void write(OutputStream output, String value)
+ {
+ output.write_string(value);
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java
index 7646253d134..a9ee7d92032 100644
--- a/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java
+++ b/libjava/classpath/org/omg/PortableInterceptor/ServerRequestInfoOperations.java
@@ -216,7 +216,8 @@ import org.omg.IOP.ServiceContext;
*
* @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
*/
-public interface ServerRequestInfoOperations extends RequestInfoOperations
+public interface ServerRequestInfoOperations
+ extends RequestInfoOperations
{
/**
* Allows the interceptor to add service contexts to the request. Such added
@@ -231,9 +232,7 @@ public interface ServerRequestInfoOperations extends RequestInfoOperations
* @throws BAD_INV_ORDER minor 15 if the context with the same Id already
* exists and replace=false.
*/
- void add_reply_service_context(ServiceContext service_context,
- boolean replace
- );
+ void add_reply_service_context(ServiceContext service_context, boolean replace);
/**
* Get the identifier for the object adapter (POA).
@@ -257,14 +256,15 @@ public interface ServerRequestInfoOperations extends RequestInfoOperations
* @throws INV_POLICY minor 2 if no factory was registered to produce this
* type of policy or the policy is otherwise invalid.
*/
- Policy get_server_policy(int type) throws INV_POLICY;
+ Policy get_server_policy(int type)
+ throws INV_POLICY;
/**
* Get the exception to be returned to the client. If the returned Any cannot
* not support holding of that exception, it holds
* {@link org.omg.CORBA.UNKNOWN} minor 1 instead.
*
- * @return an Any, holding exception that has been thrown and will be returned
+ * @return an Any, holding exception that has been thrown and will be returned
* to client.
*/
Any sending_exception();
@@ -281,7 +281,8 @@ public interface ServerRequestInfoOperations extends RequestInfoOperations
* @see RequestInfoOperations#get_slot(int)
* @see org.omg.PortableInterceptor#Current
*/
- void set_slot(int id, Any data) throws InvalidSlot;
+ void set_slot(int id, Any data)
+ throws InvalidSlot;
/**
* Checks if the servant is the given repository id.
@@ -299,4 +300,27 @@ public interface ServerRequestInfoOperations extends RequestInfoOperations
* @return the repository id of the servant.
*/
String target_most_derived_interface();
+
+ /**
+ * Returns the name of the adapter that is handling the current request.
+ * The name is returned as a string array, representing full path from
+ * the root poa till the current poa, for instance
+ * {"RootPOA", "childPOA","grandchildPOA"}.
+ */
+ public String[] adapter_name();
+
+ /**
+ * Returns the id of the ORB that is handling the current request. The ORB
+ * id can be specified as the property org.omg.CORBA.ORBid when creating
+ * the ORB.
+ */
+ public String orb_id();
+
+ /**
+ * Returs the id of the server that is handling the current request. The server
+ * id is the same for all POAs and ORBs in the current virtual machine and
+ * can be set as the property org.omg.CORBA.ServerId when creating one of the
+ * ORBs.
+ */
+ public String server_id();
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java b/libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java
new file mode 100644
index 00000000000..52856407a54
--- /dev/null
+++ b/libjava/classpath/org/omg/PortableInterceptor/_IORInterceptor_3_0Stub.java
@@ -0,0 +1,272 @@
+/* _IORInterceptor_3_0Stub.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.PortableInterceptor;
+
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+
+import java.io.Serializable;
+
+/**
+ * The IORInterceptor_3_0 stub (proxy), used on the client side. The
+ * {@link IORInterceptor_3_0} methods contain the code for remote invocaton. The
+ * stub is required by {@link IORInterceptor_3_0Helper} .read, .narrow and
+ * .unchecked_narrow methods.
+ *
+ * @specnote Being not specified in 1.5 API, this class is package private.
+ * From that happened to some other stubs, it will likely to appear in the 1.6
+ * or later. Because of this, it is placed here.
+ *
+ * @specnote The stub and the helper support the existence of the interceptor
+ * on the remote side only. To support the corresponding support on the side
+ * where the ORB is registered with this interceptor, you also need
+ * _IORInfoStub, IORInfoHelper and either servants or implementation bases
+ * for both POA and IORInfo. These classes are not defined in the 1.5 API,
+ * hence they are not included. You may need to generate the manually from
+ * the IDL descriptions, available from
+ * http://www.omg.org/docs/formal/04-03-12.pdf.
+ *
+ * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
+ */
+class _IORInterceptor_3_0Stub
+ extends ObjectImpl
+ implements IORInterceptor_3_0, Serializable
+{
+ /**
+ * Use serialVersionUID for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * Create the IORInterceptor_3_0 stub. To get the stub working, you must later
+ * set the delegate with {@link ObjectImpl#_set_delegate(Delegate)}.
+ */
+ public _IORInterceptor_3_0Stub()
+ {
+ }
+
+ /**
+ * Create the naming context stub with the given delegate.
+ */
+ public _IORInterceptor_3_0Stub(Delegate delegate)
+ {
+ _set_delegate(delegate);
+ }
+
+ /**
+ * Return the array of repository ids for this object.
+ */
+ public String[] _ids()
+ {
+ return new String[] { IORInterceptor_3_0Helper.id() };
+ }
+
+ /** {@inheritDoc} */
+ public void adapter_manager_state_changed(int adapterManagerId,
+ short adapterState)
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("adapter_manager_state_changed", true);
+ output.write_long(adapterManagerId);
+ output.write_short(adapterState);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ adapter_manager_state_changed(adapterManagerId, adapterState);
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void adapter_state_changed(ObjectReferenceTemplate[] adapters,
+ short adaptersState)
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("adapter_state_changed", true);
+ output.write_long(adapters.length);
+ for (int i0 = 0; i0 < adapters.length; i0++)
+ ObjectReferenceTemplateHelper.write(output, adapters[i0]);
+ output.write_short(adaptersState);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ adapter_state_changed(adapters, adaptersState);
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void components_established(IORInfo info)
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("components_established", true);
+ output.write_Object(info);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ components_established(info);
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void establish_components(IORInfo info)
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("establish_components", true);
+ output.write_Object(info);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ establish_components(info);
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public String name()
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("name", true);
+ input = _invoke(output);
+ String returns = input.read_string();
+
+ return returns;
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ return name();
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void destroy()
+ {
+ InputStream input = null;
+ try
+ {
+ OutputStream output = _request("destroy", true);
+ input = _invoke(output);
+
+ }
+ catch (ApplicationException ex)
+ {
+ input = ex.getInputStream();
+ String id = ex.getId();
+ throw new MARSHAL(id);
+ }
+ catch (RemarshalException remarsh)
+ {
+ destroy();
+ }
+ finally
+ {
+ _releaseReply(input);
+ }
+ }
+} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java b/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java
index 0ba6352001f..848a3c3d3f6 100644
--- a/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.CurrentPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -105,6 +106,7 @@ public abstract class NoContextHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("NoContext expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java b/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java
index 6f8d5ea6bf3..f4b0619b017 100644
--- a/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/ForwardRequestHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
import gnu.CORBA.Poa.ForwardRequestHolder;
import org.omg.CORBA.Any;
@@ -80,6 +81,7 @@ public abstract class ForwardRequestHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ForwardRequest expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java
index 2dda0ef2b61..ac81d389cdd 100644
--- a/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/IdAssignmentPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -129,7 +131,9 @@ public class IdAssignmentPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java
index d0992d9dbe2..c0f281249b0 100644
--- a/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/IdUniquenessPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -129,7 +131,9 @@ public class IdUniquenessPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java
index 8d2913bf66f..9d81d5fab81 100644
--- a/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/ImplicitActivationPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -129,7 +131,9 @@ public class ImplicitActivationPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java b/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java
index 1e046c4e941..117eb5a3c9e 100644
--- a/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/LifespanPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -126,7 +128,9 @@ public class LifespanPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAHelper.java b/libjava/classpath/org/omg/PortableServer/POAHelper.java
index 2928d9f0737..3712da00d69 100644
--- a/libjava/classpath/org/omg/PortableServer/POAHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.ORB;
@@ -126,7 +128,9 @@ public abstract class POAHelper
*/
public static POA read(InputStream input)
{
- throw new MARSHAL("Not applicable");
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -142,6 +146,8 @@ public abstract class POAHelper
*/
public static void write(OutputStream output, POA value)
{
- throw new MARSHAL("Not applicable");
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java
index db7b965bbad..2a587a4126b 100644
--- a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/AdapterInactiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAManagerPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class AdapterInactiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("AdapterInactive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java
index 536189a0ce2..9e856098b0b 100644
--- a/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java
+++ b/libjava/classpath/org/omg/PortableServer/POAManagerPackage/State.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer.POAManagerPackage;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -140,7 +142,7 @@ public class State
/**
* Returns the State, matching the given integer constant.
- *
+ *
* @param code one of _HOLDING, _ACTIVE, _DISCARDING, _INACTIVE.
* @return one of HOLDING, ACTIVE, DISCARDING, INACTIVE.
* @throws BAD_PARAM if the parameter is not one of the valid values.
@@ -149,16 +151,19 @@ public class State
{
try
{
- return enume [ code ];
+ return enume[code];
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid state " + code);
+ bad.minor = Minor.Enumeration;
+ throw bad;
}
}
/**
* Returns a short string representation.
+ *
* @return the name of the current enumeration value.
*/
public String toString()
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java
index 3ffee4ff85a..61a41089191 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class AdapterAlreadyExistsHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("AdapterAlreadyExists expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java
index f05daec3d83..dd318bf09cb 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/AdapterNonExistentHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class AdapterNonExistentHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("AdapterNonExistent expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java
index 15aa62d8201..5e9e627c73f 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/InvalidPolicyHelper.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
+import gnu.CORBA.Minor;
import gnu.CORBA.Poa.InvalidPolicyHolder;
import org.omg.CORBA.Any;
@@ -110,6 +111,7 @@ public abstract class InvalidPolicyHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("InvalidPolicy expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java
index 26b21ce6c10..fd2c189fc14 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/NoServantHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class NoServantHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("NoServant expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java
index 99891dbe5c3..011867473ee 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class ObjectAlreadyActiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ObjectAlreadyActive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java
index 867d5f4f641..0d8ff473cf3 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ObjectNotActiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class ObjectNotActiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ObjectNotActive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java
index 0db0e938b69..a74e674012a 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantAlreadyActiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -107,6 +108,7 @@ public abstract class ServantAlreadyActiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ServantAlreadyActive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java
index 429421853ba..5fb52cf35b1 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class ServantNotActiveHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("ServantNotActive expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java
index ebba304a536..cd862b0814b 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongAdapterHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class WrongAdapterHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("WrongAdapter expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java
index 5460d0ea79d..a1f27cbb0eb 100644
--- a/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/POAPackage/WrongPolicyHelper.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package org.omg.PortableServer.POAPackage;
import gnu.CORBA.EmptyExceptionHolder;
+import gnu.CORBA.Minor;
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
@@ -106,6 +107,7 @@ public abstract class WrongPolicyHelper
catch (ClassCastException cex)
{
BAD_OPERATION bad = new BAD_OPERATION("WrongPolicy expected");
+ bad.minor = Minor.Any;
bad.initCause(cex);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java
index 139010c86e8..0b1ce4d0bfa 100644
--- a/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/RequestProcessingPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -151,7 +153,9 @@ public class RequestProcessingPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/Servant.java b/libjava/classpath/org/omg/PortableServer/Servant.java
index 745fc8a7ed4..5c99ee1a0e3 100644
--- a/libjava/classpath/org/omg/PortableServer/Servant.java
+++ b/libjava/classpath/org/omg/PortableServer/Servant.java
@@ -45,6 +45,8 @@ import org.omg.CORBA.ORB;
import org.omg.PortableServer.POAPackage.ServantNotActive;
import org.omg.PortableServer.POAPackage.WrongPolicy;
import org.omg.PortableServer.portable.Delegate;
+
+import gnu.CORBA.Minor;
import gnu.CORBA.Poa.ORB_1_4;
import gnu.CORBA.Poa.gnuPOA;
@@ -239,6 +241,7 @@ public abstract class Servant
catch (WrongPolicy unexp)
{
BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.Policy;
bad.initCause(unexp);
throw bad;
}
@@ -253,6 +256,7 @@ public abstract class Servant
unexp.initCause(ex);
BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.Activation;
bad.initCause(unexp);
throw bad;
}
diff --git a/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java b/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java
index 1aab99cee4c..8aa58b2f627 100644
--- a/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/ServantActivatorHelper.java
@@ -38,7 +38,10 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.ORB;
@@ -112,6 +115,26 @@ public abstract class ServantActivatorHelper
throw bad;
}
}
+
+ /**
+ * Narrow the given object to the ServantActivator. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted ServantActivator.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static ServantActivator unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
+
/**
* This should read the servant activator, but it cannot be transferred
@@ -125,7 +148,9 @@ public abstract class ServantActivatorHelper
*/
public static ServantActivator read(InputStream input)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -140,6 +165,8 @@ public abstract class ServantActivatorHelper
*/
public static void write(OutputStream output, ServantActivator value)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java b/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java
index 984abdffe69..082c4c586ee 100644
--- a/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java
+++ b/libjava/classpath/org/omg/PortableServer/ServantLocatorHelper.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.Any;
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.MARSHAL;
@@ -108,10 +110,30 @@ public abstract class ServantLocatorHelper
catch (ClassCastException ex)
{
BAD_OPERATION bad = new BAD_OPERATION();
+ bad.minor = Minor.ClassCast;
bad.initCause(ex);
throw bad;
}
}
+
+ /**
+ * Narrow the given object to the ServantLocator. For the objects that are
+ * always local, this operation does not differ from the ordinary
+ * {@link #narrow} (ClassCastException will be thrown if narrowing something
+ * different).
+ *
+ * @param obj the object to cast.
+ *
+ * @return the casted ServantLocator.
+ *
+ * @since 1.5
+ *
+ * @see OMG issue 4158.
+ */
+ public static ServantLocator unchecked_narrow(org.omg.CORBA.Object obj)
+ {
+ return narrow(obj);
+ }
/**
* This should read the servant locator, but it cannot be transferred
@@ -125,7 +147,9 @@ public abstract class ServantLocatorHelper
*/
public static ServantLocator read(InputStream input)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
/**
@@ -140,6 +164,8 @@ public abstract class ServantLocatorHelper
*/
public static void write(OutputStream output, ServantLocator value)
{
- throw new MARSHAL();
+ MARSHAL m = new MARSHAL("Inappropriate");
+ m.minor = Minor.Inappropriate;
+ throw m;
}
} \ No newline at end of file
diff --git a/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java
index caf8132e638..0b6ecf62fe1 100644
--- a/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/ServantRetentionPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -126,7 +128,9 @@ public class ServantRetentionPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java b/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java
index c7d4d636726..5c771a7d624 100644
--- a/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java
+++ b/libjava/classpath/org/omg/PortableServer/ThreadPolicyValue.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package org.omg.PortableServer;
+import gnu.CORBA.Minor;
+
import org.omg.CORBA.BAD_OPERATION;
import org.omg.CORBA.portable.IDLEntity;
@@ -139,7 +141,9 @@ public class ThreadPolicyValue
}
catch (ArrayIndexOutOfBoundsException ex)
{
- throw new BAD_OPERATION("Invalid enumeration code " + code);
+ BAD_OPERATION bad = new BAD_OPERATION("Invalid policy code " + code);
+ bad.minor = Minor.PolicyType;
+ throw bad;
}
}
diff --git a/libjava/classpath/resource/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider b/libjava/classpath/resource/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider
new file mode 100644
index 00000000000..c701be55b0e
--- /dev/null
+++ b/libjava/classpath/resource/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider
@@ -0,0 +1,3 @@
+gnu.javax.sound.midi.alsa.AlsaMidiDeviceProvider
+gnu.javax.sound.midi.dssi.DSSIMidiDeviceProvider
+
diff --git a/libjava/classpath/resource/Makefile.in b/libjava/classpath/resource/Makefile.in
index 57a3f79fbd3..841b3cab7e3 100644
--- a/libjava/classpath/resource/Makefile.in
+++ b/libjava/classpath/resource/Makefile.in
@@ -40,10 +40,8 @@ target_triplet = @target@
subdir = resource
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -85,10 +83,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -225,6 +227,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -238,6 +241,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/scripts/Makefile.in b/libjava/classpath/scripts/Makefile.in
index c49baa57d48..09ff6ca4d53 100644
--- a/libjava/classpath/scripts/Makefile.in
+++ b/libjava/classpath/scripts/Makefile.in
@@ -40,10 +40,8 @@ subdir = scripts
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/classpath.spec.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
- $(top_srcdir)/../../config/lead-dot.m4 \
- $(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/accross.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
$(top_srcdir)/m4/acinclude.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
@@ -76,10 +74,14 @@ CLASSPATH_MODULE = @CLASSPATH_MODULE@
CP = @CP@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CREATE_ALSA_LIBRARIES_FALSE = @CREATE_ALSA_LIBRARIES_FALSE@
+CREATE_ALSA_LIBRARIES_TRUE = @CREATE_ALSA_LIBRARIES_TRUE@
CREATE_API_DOCS_FALSE = @CREATE_API_DOCS_FALSE@
CREATE_API_DOCS_TRUE = @CREATE_API_DOCS_TRUE@
CREATE_CORE_JNI_LIBRARIES_FALSE = @CREATE_CORE_JNI_LIBRARIES_FALSE@
CREATE_CORE_JNI_LIBRARIES_TRUE = @CREATE_CORE_JNI_LIBRARIES_TRUE@
+CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
+CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@@ -216,6 +218,7 @@ build_vendor = @build_vendor@
datadir = @datadir@
default_toolkit = @default_toolkit@
exec_prefix = @exec_prefix@
+glibjdir = @glibjdir@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -229,6 +232,7 @@ libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
+nativelibdir = @nativelibdir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
diff --git a/libjava/classpath/scripts/loc b/libjava/classpath/scripts/loc
new file mode 100755
index 00000000000..dc2f327035f
--- /dev/null
+++ b/libjava/classpath/scripts/loc
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# loc Find a class or package
+#
+# Usage: loc [-l] class-pattern [dirname]
+
+# -l Use system locate command instead of find. In that case, loc
+# will ignore any directory to be searched.
+
+# Example:
+#
+# $ loc -l org.objectweb.jonas.common.JProp
+# /var/lib/jonas/demoserver/ejbjars/autoload/mejb.jar
+# /var/lib/jonas/lib/common/ow_jonas_bootstrap.jar
+# /var/lib/jonas/eclipseserver/ejbjars/autoload/mejb.jar
+# /var/lib/jonas/ejbjars/autoload/mejb.jar
+# /var/cache/jonas/work/ejbjars/jonas/mejb_2005.09.15-17.01.52.jar
+# /usr/src/redhat/BUILD/jonas-4.3.3/jonas/classes/common/org/objectweb/jonas/common/JProp.class
+
+
+MODE=$1
+if test "$MODE" == "-l"; then
+ COMMAND='(locate \*.jar ; locate \*.war)'
+ shift
+else
+ COMMAND='(find "$FOO" -name \*.jar -follow ; find "$FOO" -name \*.war -follow)'
+fi
+
+FOO=$2
+if test "x$FOO" == "x"; then
+ FOO=/usr/share/java
+fi
+
+eval "$COMMAND" 2>/dev/null | while read i; do
+ if (fastjar tf $i 2>/dev/null | grep $1) > /dev/null 2>&1 ; then
+ echo $i
+ fi
+done
+
+if test "$MODE" != "-l"; then
+ find "$FOO" -name '*.class' 2>/dev/null | grep $1
+else
+ locate \*.class | grep $1
+fi
diff --git a/libjava/classpath/test/native/lib/PrimlibInterface.c b/libjava/classpath/test/native/lib/PrimlibInterface.c
deleted file mode 100644
index 47918470a87..00000000000
--- a/libjava/classpath/test/native/lib/PrimlibInterface.c
+++ /dev/null
@@ -1,162 +0,0 @@
-#include "PrimlibInterface.h"
-#include <primlib.h>
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapBoolean
- * Signature: (Ljava/lang/Object;)Z
- */
-JNIEXPORT jboolean JNICALL Java_PrimlibInterface_unwrapBoolean
-(JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapBoolean(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapByte
- * Signature: (Ljava/lang/Object;)B
- */
-JNIEXPORT jbyte JNICALL Java_PrimlibInterface_unwrapByte
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapByte(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapShort
- * Signature: (Ljava/lang/Object;)S
- */
-JNIEXPORT jshort JNICALL Java_PrimlibInterface_unwrapShort
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapShort(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapChar
- * Signature: (Ljava/lang/Object;)C
- */
-JNIEXPORT jchar JNICALL Java_PrimlibInterface_unwrapChar
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapChar(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapInt
- * Signature: (Ljava/lang/Object;)I
- */
-JNIEXPORT jint JNICALL Java_PrimlibInterface_unwrapInt
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapInt(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapLong
- * Signature: (Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL Java_PrimlibInterface_unwrapLong
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapLong(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapFloat
- * Signature: (Ljava/lang/Object;)F
- */
-JNIEXPORT jfloat JNICALL Java_PrimlibInterface_unwrapFloat
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapFloat(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapDouble
- * Signature: (Ljava/lang/Object;)D
- */
-JNIEXPORT jdouble JNICALL Java_PrimlibInterface_unwrapDouble
- (JNIEnv * env, jclass thisClass, jobject o) {
- return PRIMLIB_UnwrapDouble(env, o);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapBoolean
- * Signature: (Z)Ljava/lang/Boolean;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapBoolean
-(JNIEnv * env, jclass thisClass, jboolean val) {
- return PRIMLIB_WrapBoolean(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapByte
- * Signature: (B)Ljava/lang/Byte;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapByte
-(JNIEnv * env, jclass thisClass, jbyte val) {
- return PRIMLIB_WrapByte(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapShort
- * Signature: (S)Ljava/lang/Short;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapShort
-(JNIEnv * env, jclass thisClass, jshort val) {
- return PRIMLIB_WrapShort(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapChar
- * Signature: (C)Ljava/lang/Character;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapChar
-(JNIEnv * env, jclass thisClass, jchar val) {
- return PRIMLIB_WrapChar(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapInt
- * Signature: (I)Ljava/lang/Integer;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapInt
-(JNIEnv * env, jclass thisClass, jint val) {
- return PRIMLIB_WrapInt(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapLong
- * Signature: (J)Ljava/lang/Long;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapLong
-(JNIEnv * env, jclass thisClass, jlong val) {
- return PRIMLIB_WrapLong(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapFloat
- * Signature: (F)Ljava/lang/Float;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapFloat
-(JNIEnv * env, jclass thisClass, jfloat val) {
- return PRIMLIB_WrapFloat(env, val);
-}
-
-/*
- * Class: PrimlibInterface
- * Method: wrapDouble
- * Signature: (D)Ljava/lang/Double;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapDouble
-(JNIEnv * env, jclass thisClass, jdouble val) {
- return PRIMLIB_WrapDouble(env, val);
-}
diff --git a/libjava/classpath/test/native/lib/PrimlibInterface.h b/libjava/classpath/test/native/lib/PrimlibInterface.h
deleted file mode 100644
index 2e0463cc2b8..00000000000
--- a/libjava/classpath/test/native/lib/PrimlibInterface.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class PrimlibInterface */
-
-#ifndef _Included_PrimlibInterface
-#define _Included_PrimlibInterface
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: PrimlibInterface
- * Method: unwrapBoolean
- * Signature: (Ljava/lang/Object;)Z
- */
-JNIEXPORT jboolean JNICALL Java_PrimlibInterface_unwrapBoolean
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapByte
- * Signature: (Ljava/lang/Object;)B
- */
-JNIEXPORT jbyte JNICALL Java_PrimlibInterface_unwrapByte
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapShort
- * Signature: (Ljava/lang/Object;)S
- */
-JNIEXPORT jshort JNICALL Java_PrimlibInterface_unwrapShort
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapChar
- * Signature: (Ljava/lang/Object;)C
- */
-JNIEXPORT jchar JNICALL Java_PrimlibInterface_unwrapChar
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapInt
- * Signature: (Ljava/lang/Object;)I
- */
-JNIEXPORT jint JNICALL Java_PrimlibInterface_unwrapInt
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapLong
- * Signature: (Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL Java_PrimlibInterface_unwrapLong
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapFloat
- * Signature: (Ljava/lang/Object;)F
- */
-JNIEXPORT jfloat JNICALL Java_PrimlibInterface_unwrapFloat
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: unwrapDouble
- * Signature: (Ljava/lang/Object;)D
- */
-JNIEXPORT jdouble JNICALL Java_PrimlibInterface_unwrapDouble
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapBoolean
- * Signature: (Z)Ljava/lang/Boolean;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapBoolean
- (JNIEnv *, jclass, jboolean);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapByte
- * Signature: (B)Ljava/lang/Byte;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapByte
- (JNIEnv *, jclass, jbyte);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapShort
- * Signature: (S)Ljava/lang/Short;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapShort
- (JNIEnv *, jclass, jshort);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapChar
- * Signature: (C)Ljava/lang/Character;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapChar
- (JNIEnv *, jclass, jchar);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapInt
- * Signature: (I)Ljava/lang/Integer;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapInt
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapLong
- * Signature: (J)Ljava/lang/Long;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapLong
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapFloat
- * Signature: (F)Ljava/lang/Float;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapFloat
- (JNIEnv *, jclass, jfloat);
-
-/*
- * Class: PrimlibInterface
- * Method: wrapDouble
- * Signature: (D)Ljava/lang/Double;
- */
-JNIEXPORT jobject JNICALL Java_PrimlibInterface_wrapDouble
- (JNIEnv *, jclass, jdouble);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/libjava/classpath/test/native/lib/PrimlibTest.java b/libjava/classpath/test/native/lib/PrimlibTest.java
deleted file mode 100644
index 94b2fb41c3e..00000000000
--- a/libjava/classpath/test/native/lib/PrimlibTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-public class PrimlibTest {
- static {
- System.loadLibrary("jnilinktest");
- }
-
- public static void main(String args[]) {
- Object[] o = new Object[8];
- o[0] = new Boolean(true);
- o[1] = new Byte((byte)1);
- o[2] = new Short((short)2);
- o[3] = new Character((char)3);
- o[4] = new Integer(4);
- o[5] = new Long(5L);
- o[6] = new Float(6F);
- o[7] = new Double(7D);
-
- String[] s = {"boolean", "byte", "short", "char", "int", "long", "float", "double"};
- for(int i=0;i<8;i++) {
- try {
- System.out.println(PrimlibInterface.unwrapBoolean(o[i]) ? "CONVERTED: UnwrapBoolean(" + s[i] + ")" : "INCORRECT: UnwrapBoolean(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapBoolean(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapByte(o[i]) == i ? "CONVERTED: UnwrapByte(" + s[i] + ")" : "INCORRECT: UnwrapByte(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapByte(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapShort(o[i]) == i ? "CONVERTED: UnwrapShort(" + s[i] + ")" : "INCORRECT: UnwrapShort(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapShort(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapChar(o[i]) == i ? "CONVERTED: UnwrapChar(" + s[i] + ")" : "INCORRECT: UnwrapChar(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapChar(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapInt(o[i]) == i ? "CONVERTED: UnwrapInt(" + s[i] + ")" : "INCORRECT: UnwrapInt(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapInt(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapLong(o[i]) == i ? "CONVERTED: UnwrapLong(" + s[i] + ")" : "INCORRECT: UnwrapLong(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapLong(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapFloat(o[i]) == i ? "CONVERTED: UnwrapFloat(" + s[i] + ")" : "INCORRECT: UnwrapFloat(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapFloat(" + s[i] + ")");
- }
-
- try {
- System.out.println(PrimlibInterface.unwrapDouble(o[i]) == i ? "CONVERTED: UnwrapDouble(" + s[i] + ")" : "INCORRECT: UnwrapDouble(" + s[i] + ")");
- } catch(Exception E) {
- System.out.println("EXCEPTION: UnwrapDouble(" + s[i] + ")");
- }
- }
- }
-}
-
-class PrimlibInterface {
- static native boolean unwrapBoolean(Object o);
- static native byte unwrapByte(Object o);
- static native short unwrapShort(Object o);
- static native char unwrapChar(Object o);
- static native int unwrapInt(Object o);
- static native long unwrapLong(Object o);
- static native float unwrapFloat(Object o);
- static native double unwrapDouble(Object o);
-
- static native Boolean wrapBoolean(boolean val);
- static native Byte wrapByte(byte val);
- static native Short wrapShort(short val);
- static native Character wrapChar(char val);
- static native Integer wrapInt(int val);
- static native Long wrapLong(long val);
- static native Float wrapFloat(float val);
- static native Double wrapDouble(double val);
-}
diff --git a/libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java b/libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java
index 28e4ce36443..e995c46341d 100644
--- a/libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java
+++ b/libjava/classpath/vm/reference/gnu/classpath/VMStackWalker.java
@@ -88,9 +88,9 @@ public final class VMStackWalker
/**
* Get the class loader associated with the Class returned by
- * <code>getCallingClass()</code>, or <code>null</code> if no
- * such class exists or it is the boot loader. This method is an optimization
- * for the expression <code>getClassContext()[1].getClassLoader()</code>
+ * <code>getCallingClass()</code>, or <code>null</code> if no such class
+ * exists or it is the boot loader. This method is an optimization for the
+ * expression <code>VMStackWalker.getClassLoader(getClassContext()[1])</code>
* and should return the same result.
*
* <p>
@@ -102,7 +102,15 @@ public final class VMStackWalker
Class[] ctx = getClassContext();
if (ctx.length < 3)
return null;
- return ctx[2].getClassLoader();
+ return getClassLoader(ctx[2]);
}
+
+ /**
+ * Retrieve the class's ClassLoader, or <code>null</code> if loaded
+ * by the bootstrap loader. I.e., this should return the same thing
+ * as {@link java.lang.VMClass#getClassLoader}. This duplicate version
+ * is here to work around access permissions.
+ */
+ public static native ClassLoader getClassLoader(Class cl);
}
diff --git a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
index 09173fcf036..23cbb7b8ee3 100644
--- a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
+++ b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
@@ -138,6 +138,7 @@ public class VMIdManager
{
id.setId (++_lastId);
}
+ id.setReference (obj);
return id;
}
catch (InstantiationException ie)
@@ -162,7 +163,7 @@ public class VMIdManager
{
id.setId (++_lastId);
}
-
+ id.setReference (obj);
return id;
}
diff --git a/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java b/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java
index 7cd97192e74..93a42b1ca9a 100644
--- a/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java
+++ b/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.io;
+import gnu.classpath.Configuration;
import gnu.classpath.VMStackWalker;
import java.lang.reflect.Constructor;
import java.security.AccessController;
@@ -46,8 +47,13 @@ import java.security.PrivilegedAction;
final class VMObjectInputStream
{
- private static Class oisClass = ObjectInputStream.class;
- private static Class vmoisClass = VMObjectInputStream.class;
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javaio");
+ }
+ }
// PrivilegedAction needed for Class.getClassLoader()
private static PrivilegedAction loaderAction = new PrivilegedAction()
diff --git a/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java b/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java
index 2aee7a9e6a7..77470fa807f 100644
--- a/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java
+++ b/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java
@@ -1,5 +1,5 @@
/* VMObjectStreamClass.java -- VM helper functions for ObjectStreamClass
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,10 +38,19 @@ exception statement from your version. */
package java.io;
+import gnu.classpath.Configuration;
import java.lang.reflect.Field;
final class VMObjectStreamClass
{
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javaio");
+ }
+ }
+
/**
* Returns true if CLAZZ has a static class initializer
* (a.k.a. <clinit>).
diff --git a/libjava/classpath/vm/reference/java/lang/VMClassLoader.java b/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
index 4fe12403622..a777462aa36 100644
--- a/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
+++ b/libjava/classpath/vm/reference/java/lang/VMClassLoader.java
@@ -40,6 +40,7 @@ exception statement from your version. */
package java.lang;
import gnu.classpath.SystemProperties;
+import gnu.classpath.Configuration;
import java.io.File;
import java.io.IOException;
@@ -63,6 +64,48 @@ import java.util.zip.ZipFile;
*/
final class VMClassLoader
{
+
+
+ /** packages loaded by the bootstrap class loader */
+ static final HashMap definedPackages = new HashMap();
+
+ /**
+ * Converts the array string of native package names to
+ * Packages. The packages are then put into the
+ * definedPackages hashMap
+ */
+ static
+ {
+ String[] packages = getBootPackages();
+
+ if( packages != null)
+ {
+ String specName =
+ SystemProperties.getProperty("java.specification.name");
+ String vendor =
+ SystemProperties.getProperty("java.specification.vendor");
+ String version =
+ SystemProperties.getProperty("java.specification.version");
+
+ Package p;
+
+ for(int i = 0; i < packages.length; i++)
+ {
+ p = new Package(packages[i],
+ specName,
+ vendor,
+ version,
+ "GNU Classpath",
+ "GNU",
+ Configuration.CLASSPATH_VERSION,
+ null);
+
+ definedPackages.put(packages[i], p);
+ }
+ }
+ }
+
+
/**
* Helper to define a class using a string of bytes. This assumes that
* the security checks have already been performed, if necessary.
@@ -119,6 +162,9 @@ final class VMClassLoader
return null;
}
+ /** jars from property java.boot.class.path */
+ static final HashMap bootjars = new HashMap();
+
/**
* Helper to get a list of resources from the bootstrap class loader.
*
@@ -139,8 +185,9 @@ final class VMClassLoader
{
try
{
- v.add(new URL("file://"
- + new File(file, name).getAbsolutePath()));
+ File f = new File(file, name);
+ if (!f.exists()) continue;
+ v.add(new URL("file://" + f.getAbsolutePath()));
}
catch (MalformedURLException e)
{
@@ -150,30 +197,28 @@ final class VMClassLoader
else if (file.isFile())
{
ZipFile zip;
- try
- {
- zip = new ZipFile(file);
- }
- catch (IOException e)
- {
- continue;
- }
- String zname = name.startsWith("/") ? name.substring(1) : name;
- try
- {
- if (zip.getEntry(zname) == null)
+ synchronized(bootjars)
+ {
+ zip = (ZipFile) bootjars.get(file.getName());
+ }
+ if(zip == null)
+ {
+ try
+ {
+ zip = new ZipFile(file);
+ synchronized(bootjars)
+ {
+ bootjars.put(file.getName(), zip);
+ }
+ }
+ catch (IOException e)
+ {
continue;
- }
- finally
- {
- try
- {
- zip.close();
- }
- catch (IOException e)
- {
- }
- }
+ }
+ }
+ String zname = name.startsWith("/") ? name.substring(1) : name;
+ if (zip.getEntry(zname) == null)
+ continue;
try
{
v.add(new URL("jar:file://"
@@ -188,29 +233,41 @@ final class VMClassLoader
return v.elements();
}
+
+ /**
+ * Returns a String[] of native package names. The default
+ * implementation returns an empty array, or you may decide
+ * this needs native help.
+ */
+ private static String[] getBootPackages()
+ {
+ return new String[0];
+ }
+
+
/**
- * Helper to get a package from the bootstrap class loader. The default
- * implementation of returning null may be adequate, or you may decide
- * that this needs some native help.
+ * Helper to get a package from the bootstrap class loader.
*
* @param name the name to find
* @return the named package, if it exists
*/
static Package getPackage(String name)
{
- return null;
+ return (Package)definedPackages.get(name);
}
+
+
/**
- * Helper to get all packages from the bootstrap class loader. The default
- * implementation of returning an empty array may be adequate, or you may
- * decide that this needs some native help.
+ * Helper to get all packages from the bootstrap class loader.
*
* @return all named packages, if any exist
*/
static Package[] getPackages()
{
- return new Package[0];
+ Package[] packages = new Package[definedPackages.size()];
+ definedPackages.values().toArray(packages);
+ return packages;
}
/**
diff --git a/libjava/classpath/vm/reference/java/lang/VMThread.java b/libjava/classpath/vm/reference/java/lang/VMThread.java
index 6b9102b7071..aa0b8347a73 100644
--- a/libjava/classpath/vm/reference/java/lang/VMThread.java
+++ b/libjava/classpath/vm/reference/java/lang/VMThread.java
@@ -376,15 +376,11 @@ final class VMThread
*/
static void sleep(long ms, int ns) throws InterruptedException
{
-
- // Round up
- ms += (ns != 0) ? 1 : 0;
-
// Note: JDK treats a zero length sleep is like Thread.yield(),
// without checking the interrupted status of the thread.
// It's unclear if this is a bug in the implementation or the spec.
// See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213203
- if (ms == 0)
+ if (ms == 0 && ns == 0)
{
if (Thread.interrupted())
throw new InterruptedException();
@@ -404,11 +400,12 @@ final class VMThread
{
while (true)
{
- vt.wait(ms);
+ vt.wait(ms, ns);
now = System.currentTimeMillis();
if (now >= end)
break;
ms = end - now;
+ ns = 0;
}
}
}
diff --git a/libjava/classpath/vm/reference/java/security/VMAccessController.java b/libjava/classpath/vm/reference/java/security/VMAccessController.java
index 7058a5e345c..da13c688946 100644
--- a/libjava/classpath/vm/reference/java/security/VMAccessController.java
+++ b/libjava/classpath/vm/reference/java/security/VMAccessController.java
@@ -76,7 +76,7 @@ final class VMAccessController
DEFAULT_CONTEXT = new AccessControlContext(domain);
}
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = gnu.classpath.Configuration.DEBUG;
private static void debug(String msg)
{
System.err.print(">>> VMAccessController: ");
@@ -108,6 +108,8 @@ final class VMAccessController
LinkedList stack = (LinkedList) contexts.get();
if (stack == null)
{
+ if (DEBUG)
+ debug("no stack... creating ");
stack = new LinkedList();
contexts.set(stack);
}
@@ -134,6 +136,10 @@ final class VMAccessController
if (stack.isEmpty())
contexts.set(null);
}
+ else if (DEBUG)
+ {
+ debug("no stack during pop?????");
+ }
}
/**
@@ -166,7 +172,7 @@ final class VMAccessController
String[] methods = (String[]) stack[1];
if (DEBUG)
- debug(">>> got trace of length " + classes.length);
+ debug("got trace of length " + classes.length);
HashSet domains = new HashSet();
HashSet seenDomains = new HashSet();
@@ -185,8 +191,9 @@ final class VMAccessController
if (DEBUG)
{
- debug(">>> checking " + clazz + "." + method);
- debug(">>> loader = " + clazz.getClassLoader());
+ debug("checking " + clazz + "." + method);
+ // subject to getClassLoader RuntimePermission
+ debug("loader = " + clazz.getClassLoader());
}
// If the previous frame was a call to doPrivileged, then this is
@@ -198,14 +205,16 @@ final class VMAccessController
&& method.equals ("doPrivileged"))
{
// If there was a call to doPrivileged with a supplied context,
- // return that context.
+ // return that context. If using JAAS doAs*, it should be
+ // a context with a SubjectDomainCombiner
LinkedList l = (LinkedList) contexts.get();
if (l != null)
context = (AccessControlContext) l.getFirst();
privileged = 1;
}
- ProtectionDomain domain = clazz.getProtectionDomain();
+ // subject to getProtectionDomain RuntimePermission
+ ProtectionDomain domain = clazz.getProtectionDomain();
if (domain == null)
continue;
@@ -225,14 +234,25 @@ final class VMAccessController
ProtectionDomain[] result = (ProtectionDomain[])
domains.toArray(new ProtectionDomain[domains.size()]);
- // Intersect the derived protection domain with the context supplied
- // to doPrivileged.
if (context != null)
- context = new AccessControlContext(result, context,
- IntersectingDomainCombiner.SINGLETON);
+ {
+ DomainCombiner dc = context.getDomainCombiner ();
+ // If the supplied context had no explicit DomainCombiner, use
+ // our private version, which computes the intersection of the
+ // context's domains with the derived set.
+ if (dc == null)
+ context = new AccessControlContext
+ (IntersectingDomainCombiner.SINGLETON.combine
+ (result, context.getProtectionDomains ()));
+ // Use the supplied DomainCombiner. This should be secure,
+ // because only trusted code may create an
+ // AccessControlContext with a custom DomainCombiner.
+ else
+ context = new AccessControlContext (result, context, dc);
+ }
// No context was supplied. Return the derived one.
else
- context = new AccessControlContext(result);
+ context = new AccessControlContext (result);
inGetContext.set(Boolean.FALSE);
return context;
diff --git a/libjava/classpath/vm/reference/standard.omit b/libjava/classpath/vm/reference/standard.omit
deleted file mode 100644
index c0499fe053f..00000000000
--- a/libjava/classpath/vm/reference/standard.omit
+++ /dev/null
@@ -1 +0,0 @@
-gnu/classpath/jdwp
diff --git a/libjava/gnu/awt/xlib/XGraphicsDevice.java b/libjava/gnu/awt/xlib/XGraphicsDevice.java
new file mode 100755
index 00000000000..4fe1c2387b4
--- /dev/null
+++ b/libjava/gnu/awt/xlib/XGraphicsDevice.java
@@ -0,0 +1,58 @@
+/* Copyright (C) 2005 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package gnu.awt.xlib;
+
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsConfiguration;
+
+public class XGraphicsDevice extends GraphicsDevice
+{
+ private int id;
+ private String IDstring;
+ private GraphicsConfiguration[] configs;
+
+ public int getType()
+ {
+ return TYPE_RASTER_SCREEN;
+ }
+
+ public XGraphicsDevice(int id, XToolkit toolkit)
+ {
+ this.id = id;
+ IDstring = "XGraphicsDevice " + id;
+ configs = new GraphicsConfiguration [1];
+ configs[0] = toolkit.getDefaultXGraphicsConfiguration();
+ }
+
+ public String getIDstring()
+ {
+ return IDstring;
+ }
+
+ public GraphicsConfiguration[] getConfigurations()
+ {
+ return configs;
+ }
+
+ public GraphicsConfiguration getDefaultConfiguration()
+ {
+ return configs[0];
+ }
+
+ public boolean isDisplayChangeSupported()
+ {
+ return false;
+ }
+
+ public boolean isFullScreenSupported()
+ {
+ return false;
+ }
+}
+
diff --git a/libjava/gnu/awt/xlib/XGraphicsEnvironment.java b/libjava/gnu/awt/xlib/XGraphicsEnvironment.java
new file mode 100755
index 00000000000..64c799017c0
--- /dev/null
+++ b/libjava/gnu/awt/xlib/XGraphicsEnvironment.java
@@ -0,0 +1,59 @@
+/* Copyright (C) 2005 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package gnu.awt.xlib;
+
+import java.awt.GraphicsEnvironment;
+import java.awt.GraphicsDevice;
+import java.awt.Graphics2D;
+import java.awt.Font;
+import java.awt.image.BufferedImage;
+import java.util.Locale;
+
+public class XGraphicsEnvironment extends GraphicsEnvironment
+{
+ private XToolkit toolkit;
+ private XGraphicsDevice [] devices;
+
+ XGraphicsEnvironment (XToolkit toolkit)
+ {
+ this.toolkit = toolkit;
+ devices = new XGraphicsDevice [1];
+ devices [0] = new XGraphicsDevice (0,toolkit);
+ }
+
+ public GraphicsDevice[] getScreenDevices ()
+ {
+ return devices;
+ }
+
+ public GraphicsDevice getDefaultScreenDevice ()
+ {
+ return devices [0];
+ }
+
+ public Graphics2D createGraphics (BufferedImage image)
+ {
+ throw new UnsupportedOperationException ("createGraphics not implemented yet in " + this.getClass ().getName ());
+ }
+
+ public Font[] getAllFonts()
+ {
+ throw new UnsupportedOperationException ("getAllFonts not implemented yet in " + this.getClass ().getName ());
+ }
+
+ public String[] getAvailableFontFamilyNames (Locale l)
+ {
+ throw new UnsupportedOperationException ("getAvailableFontFamilyNames not implemented yet in " + this.getClass ().getName ());
+ }
+
+ public String[] getAvailableFontFamilyNames ()
+ {
+ throw new UnsupportedOperationException ("getAvailableFontFamilyNames not implemented yet in " + this.getClass ().getName ());
+ }
+}
diff --git a/libjava/gnu/awt/xlib/XToolkit.java b/libjava/gnu/awt/xlib/XToolkit.java
index 27e273aa778..6651ae789a2 100644
--- a/libjava/gnu/awt/xlib/XToolkit.java
+++ b/libjava/gnu/awt/xlib/XToolkit.java
@@ -362,7 +362,7 @@ public class XToolkit extends ClasspathToolkit
*/
public GraphicsEnvironment getLocalGraphicsEnvironment ()
{
- throw new java.lang.UnsupportedOperationException ();
+ return new XGraphicsEnvironment (this);
}
/** Acquires an appropriate {@link ClasspathFontPeer}, for use in
diff --git a/libjava/gnu/java/net/natPlainSocketImplPosix.cc b/libjava/gnu/java/net/natPlainSocketImplPosix.cc
index 5f6f046aa85..643f4e4909a 100644
--- a/libjava/gnu/java/net/natPlainSocketImplPosix.cc
+++ b/libjava/gnu/java/net/natPlainSocketImplPosix.cc
@@ -226,6 +226,21 @@ gnu::java::net::PlainSocketImpl::listen (jint backlog)
}
}
+static void
+throw_on_sock_closed (gnu::java::net::PlainSocketImpl *soc_impl)
+{
+ // Avoid races from asynchronous close().
+ JvSynchronize sync (soc_impl);
+ if (soc_impl->native_fd == -1)
+ {
+ using namespace java::net;
+ // Socket was closed.
+ SocketException *se =
+ new SocketException (JvNewStringUTF ("Socket Closed"));
+ throw se;
+ }
+}
+
void
gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s)
{
@@ -284,6 +299,7 @@ gnu::java::net::PlainSocketImpl::accept (gnu::java::net::PlainSocketImpl *s)
error:
char* strerr = strerror (errno);
+ throw_on_sock_closed (this);
throw new ::java::io::IOException (JvNewStringUTF (strerr));
}
@@ -294,7 +310,11 @@ gnu::java::net::PlainSocketImpl::close()
// Avoid races from asynchronous finalization.
JvSynchronize sync (this);
- // should we use shutdown here? how would that effect so_linger?
+ // Should we use shutdown here? Yes.
+ // How would that effect so_linger? Uncertain.
+ ::shutdown (native_fd, 2);
+ // Ignore errors in shutdown as we are closing and all the same
+ // errors are handled in the close.
int res = _Jv_close (native_fd);
if (res == -1)
@@ -371,7 +391,8 @@ gnu::java::net::PlainSocketImpl::sendUrgentData (jint)
}
static jint
-read_helper (jint native_fd, jint timeout, jbyte *bytes, jint count);
+read_helper (gnu::java::net::PlainSocketImpl *soc_impl,
+ jbyte *bytes, jint count);
// Read a single byte from the socket.
jint
@@ -379,7 +400,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(void)
{
jbyte data;
- if (read_helper (this$0->native_fd, this$0->timeout, &data, 1) == 1)
+ if (read_helper (this$0, &data, 1) == 1)
return data & 0xFF;
return -1;
@@ -387,8 +408,9 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(void)
// Read count bytes into the buffer, starting at offset.
jint
-gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, jint offset,
- jint count)
+gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer,
+ jint offset,
+ jint count)
{
if (! buffer)
throw new ::java::lang::NullPointerException;
@@ -398,12 +420,13 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, jint
if (offset < 0 || count < 0 || offset + count > bsize)
throw new ::java::lang::ArrayIndexOutOfBoundsException;
- return read_helper (this$0->native_fd, this$0->timeout,
+ return read_helper (this$0,
elements (buffer) + offset * sizeof (jbyte), count);
}
static jint
-read_helper (jint native_fd, jint timeout, jbyte *bytes, jint count)
+read_helper (gnu::java::net::PlainSocketImpl *soc_impl,
+ jbyte *bytes, jint count)
{
// If zero bytes were requested, short circuit so that recv
// doesn't signal EOF.
@@ -411,19 +434,22 @@ read_helper (jint native_fd, jint timeout, jbyte *bytes, jint count)
return 0;
// Do timeouts via select.
- if (timeout > 0 && native_fd >= 0 && native_fd < FD_SETSIZE)
+ if (soc_impl->timeout > 0
+ && soc_impl->native_fd >= 0
+ && soc_impl->native_fd < FD_SETSIZE)
{
// Create the file descriptor set.
fd_set read_fds;
FD_ZERO (&read_fds);
- FD_SET (native_fd, &read_fds);
+ FD_SET (soc_impl->native_fd, &read_fds);
// Create the timeout struct based on our internal timeout value.
struct timeval timeout_value;
- timeout_value.tv_sec = timeout / 1000;
- timeout_value.tv_usec =(timeout % 1000) * 1000;
+ timeout_value.tv_sec = soc_impl->timeout / 1000;
+ timeout_value.tv_usec =(soc_impl->timeout % 1000) * 1000;
// Select on the fds.
int sel_retval =
- _Jv_select (native_fd + 1, &read_fds, NULL, NULL, &timeout_value);
+ _Jv_select (soc_impl->native_fd + 1,
+ &read_fds, NULL, NULL, &timeout_value);
// We're only interested in the 0 return.
// error returns still require us to try to read
// the socket to see what happened.
@@ -437,10 +463,13 @@ read_helper (jint native_fd, jint timeout, jbyte *bytes, jint count)
}
// Read the socket.
- int r = ::recv (native_fd, (char *) bytes, count, 0);
+ int r = ::recv (soc_impl->native_fd, (char *) bytes, count, 0);
if (r == 0)
- return -1;
+ {
+ throw_on_sock_closed (soc_impl);
+ return -1;
+ }
if (::java::lang::Thread::interrupted())
{
@@ -452,6 +481,7 @@ read_helper (jint native_fd, jint timeout, jbyte *bytes, jint count)
}
else if (r == -1)
{
+ throw_on_sock_closed (soc_impl);
// Some errors cause us to return end of stream...
if (errno == ENOTCONN)
return -1;
diff --git a/libjava/gnu/java/net/natPlainSocketImplWin32.cc b/libjava/gnu/java/net/natPlainSocketImplWin32.cc
index c4a54a90c3a..48c7171c7c1 100644
--- a/libjava/gnu/java/net/natPlainSocketImplWin32.cc
+++ b/libjava/gnu/java/net/natPlainSocketImplWin32.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation
+/* Copyright (C) 2003, 2004, 2005 Free Software Foundation
This file is part of libgcj.
@@ -491,6 +491,11 @@ jint
gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer,
jint offset, jint count)
{
+ // If zero bytes were requested, short circuit so that recv
+ // doesn't signal EOF.
+ if (count == 0)
+ return 0;
+
if (! buffer)
throw new ::java::lang::NullPointerException;
diff --git a/libjava/gnu/java/net/protocol/file/Connection.java b/libjava/gnu/java/net/protocol/file/Connection.java
deleted file mode 100644
index 8e4a413667d..00000000000
--- a/libjava/gnu/java/net/protocol/file/Connection.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/* FileURLConnection.java -- URLConnection class for "file" protocol
- Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.net.protocol.file;
-
-import gnu.classpath.SystemProperties;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FilePermission;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.net.ProtocolException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.Permission;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-import java.net.MalformedURLException;
-
-/**
- * This subclass of java.net.URLConnection models a URLConnection via
- * the "file" protocol.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Nic Ferrier (nferrier@tapsellferrier.co.uk)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class Connection extends URLConnection
-{
- /**
- * Default permission for a file
- */
- private static final String DEFAULT_PERMISSION = "read";
-
- private static class StaticData
- {
- /**
- * HTTP-style DateFormat, used to format the last-modified header.
- */
- static SimpleDateFormat dateFormat
- = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
- new Locale ("En", "Us", "Unix"));
-
- static String lineSeparator =
- SystemProperties.getProperty("line.separator");
- }
-
-
- /**
- * This is a File object for this connection
- */
- private File file;
-
- /**
- * If a directory, contains a list of files in the directory.
- */
- private byte[] directoryListing;
-
- /**
- * InputStream if we are reading from the file
- */
- private InputStream inputStream;
-
- /**
- * OutputStream if we are writing to the file
- */
- private OutputStream outputStream;
-
- /**
- * FilePermission to read the file
- */
- private FilePermission permission;
-
- /**
- * Calls superclass constructor to initialize.
- */
- public Connection(URL url)
- {
- super (url);
-
- permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION);
- }
-
- /**
- * Unquote "%" + hex quotes characters
- *
- * @param str The string to unquote or null.
- *
- * @return The unquoted string or null if str was null.
- *
- * @exception MalformedURLException If the given string contains invalid
- * escape sequences.
- *
- * Sadly the same as URI.unquote, but there's nothing we can do to
- * make it accessible.
- *
- */
- public static String unquote(String str) throws MalformedURLException
- {
- if (str == null)
- return null;
- byte[] buf = new byte[str.length()];
- int pos = 0;
- for (int i = 0; i < str.length(); i++)
- {
- char c = str.charAt(i);
- if (c > 127)
- throw new MalformedURLException(str + " : Invalid character");
- if (c == '%')
- {
- if (i + 2 >= str.length())
- throw new MalformedURLException(str + " : Invalid quoted character");
- int hi = Character.digit(str.charAt(++i), 16);
- int lo = Character.digit(str.charAt(++i), 16);
- if (lo < 0 || hi < 0)
- throw new MalformedURLException(str + " : Invalid quoted character");
- buf[pos++] = (byte) (hi * 16 + lo);
- }
- else
- buf[pos++] = (byte) c;
- }
- try
- {
- return new String(buf, 0, pos, "utf-8");
- }
- catch (java.io.UnsupportedEncodingException x2)
- {
- throw (Error) new InternalError().initCause(x2);
- }
- }
-
- /**
- * "Connects" to the file by opening it.
- */
- public void connect() throws IOException
- {
- // Call is ignored if already connected.
- if (connected)
- return;
-
- // If not connected, then file needs to be openned.
- file = new File (unquote(getURL().getFile()));
-
- if (! file.isDirectory())
- {
- if (doInput)
- inputStream = new BufferedInputStream(new FileInputStream(file));
-
- if (doOutput)
- outputStream = new BufferedOutputStream(new FileOutputStream(file));
- }
- else
- {
- if (doInput)
- {
- inputStream = new ByteArrayInputStream(getDirectoryListing());
- }
-
- if (doOutput)
- throw new ProtocolException
- ("file: protocol does not support output on directories");
- }
-
- connected = true;
- }
-
- /**
- * Populates the <code>directoryListing</code> field with a byte array
- * containing a representation of the directory listing.
- */
- byte[] getDirectoryListing()
- throws IOException
- {
- if (directoryListing == null)
- {
- ByteArrayOutputStream sink = new ByteArrayOutputStream();
- // NB uses default character encoding for this system
- Writer writer = new OutputStreamWriter(sink);
-
- String[] files = file.list();
-
- for (int i = 0; i < files.length; i++)
- {
- writer.write(files[i]);
- writer.write(StaticData.lineSeparator);
- }
-
- directoryListing = sink.toByteArray();
- }
- return directoryListing;
- }
-
- /**
- * Opens the file for reading and returns a stream for it.
- *
- * @return An InputStream for this connection.
- *
- * @exception IOException If an error occurs
- */
- public InputStream getInputStream()
- throws IOException
- {
- if (!doInput)
- throw new ProtocolException("Can't open InputStream if doInput is false");
-
- if (!connected)
- connect();
-
- return inputStream;
- }
-
- /**
- * Opens the file for writing and returns a stream for it.
- *
- * @return An OutputStream for this connection.
- *
- * @exception IOException If an error occurs.
- */
- public OutputStream getOutputStream()
- throws IOException
- {
- if (!doOutput)
- throw new
- ProtocolException("Can't open OutputStream if doOutput is false");
-
- if (!connected)
- connect();
-
- return outputStream;
- }
-
- /**
- * Get the last modified time of the resource.
- *
- * @return the time since epoch that the resource was modified.
- */
- public long getLastModified()
- {
- try
- {
- if (!connected)
- connect();
-
- return file.lastModified();
- }
- catch (IOException e)
- {
- return -1;
- }
- }
-
- /**
- * Get an http-style header field. Just handle a few common ones.
- */
- public String getHeaderField(String field)
- {
- try
- {
- if (!connected)
- connect();
-
- if (field.equals("content-type"))
- return guessContentTypeFromName(file.getName());
- else if (field.equals("content-length"))
- {
- if (file.isDirectory())
- {
- return Integer.toString(getContentLength());
- }
- return Long.toString(file.length());
- }
- else if (field.equals("last-modified"))
- {
- synchronized (StaticData.dateFormat)
- {
- return StaticData.dateFormat.format(
- new Date(file.lastModified()));
- }
- }
- }
- catch (IOException e)
- {
- // Fall through.
- }
- return null;
- }
-
- /**
- * Get the length of content.
- *
- * @return the length of the content.
- */
- public int getContentLength()
- {
- try
- {
- if (!connected)
- connect();
-
- if (file.isDirectory())
- {
- return getDirectoryListing().length;
- }
- return (int) file.length();
- }
- catch (IOException e)
- {
- return -1;
- }
- }
-
- /**
- * This method returns a <code>Permission</code> object representing the
- * permissions required to access this URL. This method returns a
- * <code>java.io.FilePermission</code> for the file's path with a read
- * permission.
- *
- * @return A Permission object
- */
- public Permission getPermission() throws IOException
- {
- return permission;
- }
-}
diff --git a/libjava/gnu/java/net/protocol/file/Handler.java b/libjava/gnu/java/net/protocol/file/Handler.java
deleted file mode 100644
index fc560491d19..00000000000
--- a/libjava/gnu/java/net/protocol/file/Handler.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Handler.java -- "file" protocol handler for java.net
- Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package gnu.java.net.protocol.file;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- * This is the protocol handler for the "file" protocol.
- * It implements the abstract openConnection() method from
- * URLStreamHandler by returning a new FileURLConnection object (from
- * this package). All other methods are inherited
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class Handler extends URLStreamHandler
-{
- /**
- * A do nothing constructor
- */
- public Handler()
- {
- }
-
- /**
- * This method returs a new FileURLConnection for the specified URL
- *
- * @param url The URL to return a connection for
- *
- * @return The URLConnection
- *
- * @exception IOException If an error occurs
- */
- protected URLConnection openConnection(URL url) throws IOException
- {
- // If a hostname is set, then we need to switch protocols to ftp
- // in order to transfer this from the remote host.
- String host = url.getHost();
- if ((host != null) && (! host.equals("")))
- {
- // Reset the protocol (and implicitly the handler) for this URL.
- // Then have the URL attempt the connection again, as it will
- // get the changed handler the next time around.
- // If the ftp protocol handler is not installed, an
- // exception will be thrown from the new openConnection() call.
- setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
- url.getRef());
- return url.openConnection();
- }
-
- return new Connection(url);
- }
-} // class Handler
diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h
index 6061300a74d..fc104d695f8 100644
--- a/libjava/include/jvm.h
+++ b/libjava/include/jvm.h
@@ -233,6 +233,9 @@ namespace gcj
/* When true, enable the bytecode verifier and BC-ABI verification. */
extern bool verifyClasses;
+
+ /* Thread stack size specified by the -Xss runtime argument. */
+ extern size_t stack_size;
}
// This class handles all aspects of class preparation and linking.
@@ -363,6 +366,10 @@ void _Jv_SetMaximumHeapSize (const char *arg);
during thread deregistration. */
void _Jv_FreeMethodCache ();
+/* Set the stack size for threads. Parses ARG, a number which can
+ optionally have "k" or "m" appended. */
+void _Jv_SetStackSize (const char *arg);
+
extern "C" void JvRunMain (jclass klass, int argc, const char **argv);
void _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv,
bool is_jar);
diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java
index 47fd0789306..54661a9bc53 100644
--- a/libjava/java/io/ObjectInputStream.java
+++ b/libjava/java/io/ObjectInputStream.java
@@ -113,7 +113,10 @@ public class ObjectInputStream extends InputStream
* <code>private void readObject (ObjectInputStream)</code>.
*
* If an exception is thrown from this method, the stream is left in
- * an undefined state.
+ * an undefined state. This method can also throw Errors and
+ * RuntimeExceptions if caused by existing readResolve() user code.
+ *
+ * @return The object read from the underlying stream.
*
* @exception ClassNotFoundException The class that an object being
* read in belongs to cannot be found.
@@ -199,7 +202,6 @@ public class ObjectInputStream extends InputStream
for (int i = 0; i < n_intf; i++)
{
intfs[i] = this.realInputStream.readUTF();
- System.out.println(intfs[i]);
}
boolean oldmode = setBlockDataMode(true);
@@ -207,6 +209,21 @@ public class ObjectInputStream extends InputStream
setBlockDataMode(oldmode);
ObjectStreamClass osc = lookupClass(cl);
+ if (osc.firstNonSerializableParentConstructor == null)
+ {
+ osc.realClassIsSerializable = true;
+ osc.fields = osc.fieldMapping = new ObjectStreamField[0];
+ try
+ {
+ osc.firstNonSerializableParentConstructor =
+ Object.class.getConstructor(new Class[0]);
+ }
+ catch (NoSuchMethodException x)
+ {
+ throw (InternalError)
+ new InternalError("Object ctor missing").initCause(x);
+ }
+ }
assignNewHandle(osc);
if (!is_consumed)
@@ -1558,8 +1575,15 @@ public class ObjectInputStream extends InputStream
catch (IllegalAccessException ignore)
{
}
- catch (InvocationTargetException ignore)
+ catch (InvocationTargetException exception)
{
+ Throwable cause = exception.getCause();
+ if (cause instanceof ObjectStreamException)
+ throw (ObjectStreamException) cause;
+ else if (cause instanceof RuntimeException)
+ throw (RuntimeException) cause;
+ else if (cause instanceof Error)
+ throw (Error) cause;
}
}
diff --git a/libjava/java/io/ObjectStreamClass.java b/libjava/java/io/ObjectStreamClass.java
deleted file mode 100644
index a292f0b5ffc..00000000000
--- a/libjava/java/io/ObjectStreamClass.java
+++ /dev/null
@@ -1,929 +0,0 @@
-/* ObjectStreamClass.java -- Class used to write class information
- about serialized objects.
- Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-import gnu.java.io.NullOutputStream;
-import gnu.java.lang.reflect.TypeSignature;
-import gnu.java.security.action.SetAccessibleAction;
-import gnu.java.security.provider.Gnu;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Proxy;
-import java.security.AccessController;
-import java.security.DigestOutputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivilegedAction;
-import java.security.Security;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Hashtable;
-import java.util.Vector;
-
-public class ObjectStreamClass implements Serializable
-{
- /**
- * Returns the <code>ObjectStreamClass</code> for <code>cl</code>.
- * If <code>cl</code> is null, or is not <code>Serializable</code>,
- * null is returned. <code>ObjectStreamClass</code>'s are memorized;
- * later calls to this method with the same class will return the
- * same <code>ObjectStreamClass</code> object and no recalculation
- * will be done.
- *
- * @see java.io.Serializable
- */
- public static ObjectStreamClass lookup(Class cl)
- {
- if (cl == null)
- return null;
- if (! (Serializable.class).isAssignableFrom(cl))
- return null;
-
- return lookupForClassObject(cl);
- }
-
- /**
- * This lookup for internal use by ObjectOutputStream. Suppose
- * we have a java.lang.Class object C for class A, though A is not
- * serializable, but it's okay to serialize C.
- */
- static ObjectStreamClass lookupForClassObject(Class cl)
- {
- if (cl == null)
- return null;
-
- ObjectStreamClass osc = (ObjectStreamClass) classLookupTable.get(cl);
-
- if (osc != null)
- return osc;
- else
- {
- osc = new ObjectStreamClass(cl);
- classLookupTable.put(cl, osc);
- return osc;
- }
- }
-
- /**
- * Returns the name of the class that this
- * <code>ObjectStreamClass</code> represents.
- *
- * @return the name of the class.
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Returns the class that this <code>ObjectStreamClass</code>
- * represents. Null could be returned if this
- * <code>ObjectStreamClass</code> was read from an
- * <code>ObjectInputStream</code> and the class it represents cannot
- * be found or loaded.
- *
- * @see java.io.ObjectInputStream
- */
- public Class forClass()
- {
- return clazz;
- }
-
- /**
- * Returns the serial version stream-unique identifier for the class
- * represented by this <code>ObjectStreamClass</code>. This SUID is
- * either defined by the class as <code>static final long
- * serialVersionUID</code> or is calculated as specified in
- * Javasoft's "Object Serialization Specification" XXX: add reference
- *
- * @return the serial version UID.
- */
- public long getSerialVersionUID()
- {
- return uid;
- }
-
- /**
- * Returns the serializable (non-static and non-transient) Fields
- * of the class represented by this ObjectStreamClass. The Fields
- * are sorted by name.
- *
- * @return the fields.
- */
- public ObjectStreamField[] getFields()
- {
- ObjectStreamField[] copy = new ObjectStreamField[ fields.length ];
- System.arraycopy(fields, 0, copy, 0, fields.length);
- return copy;
- }
-
- // XXX doc
- // Can't do binary search since fields is sorted by name and
- // primitiveness.
- public ObjectStreamField getField (String name)
- {
- for (int i = 0; i < fields.length; i++)
- if (fields[i].getName().equals(name))
- return fields[i];
- return null;
- }
-
- /**
- * Returns a textual representation of this
- * <code>ObjectStreamClass</code> object including the name of the
- * class it represents as well as that class's serial version
- * stream-unique identifier.
- *
- * @see #getSerialVersionUID()
- * @see #getName()
- */
- public String toString()
- {
- return "java.io.ObjectStreamClass< " + name + ", " + uid + " >";
- }
-
- // Returns true iff the class that this ObjectStreamClass represents
- // has the following method:
- //
- // private void writeObject (ObjectOutputStream)
- //
- // This method is used by the class to override default
- // serialization behavior.
- boolean hasWriteMethod()
- {
- return (flags & ObjectStreamConstants.SC_WRITE_METHOD) != 0;
- }
-
- // Returns true iff the class that this ObjectStreamClass represents
- // implements Serializable but does *not* implement Externalizable.
- boolean isSerializable()
- {
- return (flags & ObjectStreamConstants.SC_SERIALIZABLE) != 0;
- }
-
-
- // Returns true iff the class that this ObjectStreamClass represents
- // implements Externalizable.
- boolean isExternalizable()
- {
- return (flags & ObjectStreamConstants.SC_EXTERNALIZABLE) != 0;
- }
-
-
- // Returns the <code>ObjectStreamClass</code> that represents the
- // class that is the superclass of the class this
- // <code>ObjectStreamClass</code> represents. If the superclass is
- // not Serializable, null is returned.
- ObjectStreamClass getSuper()
- {
- return superClass;
- }
-
-
- // returns an array of ObjectStreamClasses that represent the super
- // classes of CLAZZ and CLAZZ itself in order from most super to
- // CLAZZ. ObjectStreamClass[0] is the highest superclass of CLAZZ
- // that is serializable.
- static ObjectStreamClass[] getObjectStreamClasses(Class clazz)
- {
- ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
-
- if (osc == null)
- return new ObjectStreamClass[0];
- else
- {
- Vector oscs = new Vector();
-
- while (osc != null)
- {
- oscs.addElement (osc);
- osc = osc.getSuper();
- }
-
- int count = oscs.size();
- ObjectStreamClass[] sorted_oscs = new ObjectStreamClass[ count ];
-
- for (int i = count - 1; i >= 0; i--)
- sorted_oscs[ count - i - 1 ] = (ObjectStreamClass) oscs.elementAt(i);
-
- return sorted_oscs;
- }
- }
-
-
- // Returns an integer that consists of bit-flags that indicate
- // properties of the class represented by this ObjectStreamClass.
- // The bit-flags that could be present are those defined in
- // ObjectStreamConstants that begin with `SC_'
- int getFlags()
- {
- return flags;
- }
-
-
- ObjectStreamClass(String name, long uid, byte flags,
- ObjectStreamField[] fields)
- {
- this.name = name;
- this.uid = uid;
- this.flags = flags;
- this.fields = fields;
- }
-
- /**
- * This method builds the internal description corresponding to a Java Class.
- * As the constructor only assign a name to the current ObjectStreamClass instance,
- * that method sets the serial UID, chose the fields which will be serialized,
- * and compute the position of the fields in the serialized stream.
- *
- * @param cl The Java class which is used as a reference for building the descriptor.
- * @param superClass The descriptor of the super class for this class descriptor.
- * @throws InvalidClassException if an incompatibility between computed UID and
- * already set UID is found.
- */
- void setClass(Class cl, ObjectStreamClass superClass) throws InvalidClassException
- {
- this.clazz = cl;
-
- cacheMethods();
-
- long class_uid = getClassUID(cl);
- if (uid == 0)
- uid = class_uid;
- else
- {
- // Check that the actual UID of the resolved class matches the UID from
- // the stream.
- if (uid != class_uid)
- {
- String msg = cl +
- ": Local class not compatible: stream serialVersionUID="
- + uid + ", local serialVersionUID=" + class_uid;
- throw new InvalidClassException (msg);
- }
- }
-
- isProxyClass = clazz != null && Proxy.isProxyClass(clazz);
- this.superClass = superClass;
- calculateOffsets();
-
- try
- {
- ObjectStreamField[] exportedFields = getSerialPersistentFields (clazz);
-
- if (exportedFields == null)
- return;
-
- ObjectStreamField[] newFieldList = new ObjectStreamField[exportedFields.length + fields.length];
- int i, j, k;
-
- /* We now check the import fields against the exported fields.
- * There should not be contradiction (e.g. int x and String x)
- * but extra virtual fields can be added to the class.
- */
-
- Arrays.sort(exportedFields);
-
- i = 0; j = 0; k = 0;
- while (i < fields.length && j < exportedFields.length)
- {
- int comp = fields[i].compareTo(exportedFields[j]);
-
- if (comp < 0)
- {
- newFieldList[k] = fields[i];
- fields[i].setPersistent(false);
- fields[i].setToSet(false);
- i++;
- }
- else if (comp > 0)
- {
- /* field not found in imported fields. We add it
- * in the list of supported fields.
- */
- newFieldList[k] = exportedFields[j];
- newFieldList[k].setPersistent(true);
- newFieldList[k].setToSet(false);
- try
- {
- newFieldList[k].lookupField(clazz);
- newFieldList[k].checkFieldType();
- }
- catch (NoSuchFieldException _)
- {
- }
- j++;
- }
- else
- {
- try
- {
- exportedFields[j].lookupField(clazz);
- exportedFields[j].checkFieldType();
- }
- catch (NoSuchFieldException _)
- {
- }
-
- if (!fields[i].getType().equals(exportedFields[j].getType()))
- throw new InvalidClassException
- ("serialPersistentFields must be compatible with" +
- " imported fields (about " + fields[i].getName() + ")");
- newFieldList[k] = fields[i];
- fields[i].setPersistent(true);
- i++;
- j++;
- }
- k++;
- }
-
- if (i < fields.length)
- for (;i<fields.length;i++,k++)
- {
- fields[i].setPersistent(false);
- fields[i].setToSet(false);
- newFieldList[k] = fields[i];
- }
- else
- if (j < exportedFields.length)
- for (;j<exportedFields.length;j++,k++)
- {
- exportedFields[j].setPersistent(true);
- exportedFields[j].setToSet(false);
- newFieldList[k] = exportedFields[j];
- }
-
- fields = new ObjectStreamField[k];
- System.arraycopy(newFieldList, 0, fields, 0, k);
- }
- catch (NoSuchFieldException ignore)
- {
- return;
- }
- catch (IllegalAccessException ignore)
- {
- return;
- }
- }
-
- void setSuperclass (ObjectStreamClass osc)
- {
- superClass = osc;
- }
-
- void calculateOffsets()
- {
- int i;
- ObjectStreamField field;
- primFieldSize = 0;
- int fcount = fields.length;
- for (i = 0; i < fcount; ++ i)
- {
- field = fields[i];
-
- if (! field.isPrimitive())
- break;
-
- field.setOffset(primFieldSize);
- switch (field.getTypeCode())
- {
- case 'B':
- case 'Z':
- ++ primFieldSize;
- break;
- case 'C':
- case 'S':
- primFieldSize += 2;
- break;
- case 'I':
- case 'F':
- primFieldSize += 4;
- break;
- case 'D':
- case 'J':
- primFieldSize += 8;
- break;
- }
- }
-
- for (objectFieldCount = 0; i < fcount; ++ i)
- fields[i].setOffset(objectFieldCount++);
- }
-
- private Method findMethod(Method[] methods, String name, Class[] params,
- Class returnType, boolean mustBePrivate)
- {
-outer:
- for (int i = 0; i < methods.length; i++)
- {
- final Method m = methods[i];
- int mods = m.getModifiers();
- if (Modifier.isStatic(mods)
- || (mustBePrivate && !Modifier.isPrivate(mods)))
- {
- continue;
- }
-
- if (m.getName().equals(name)
- && m.getReturnType() == returnType)
- {
- Class[] mp = m.getParameterTypes();
- if (mp.length == params.length)
- {
- for (int j = 0; j < mp.length; j++)
- {
- if (mp[j] != params[j])
- {
- continue outer;
- }
- }
- AccessController.doPrivileged(new SetAccessibleAction(m));
- return m;
- }
- }
- }
- return null;
- }
-
- private void cacheMethods()
- {
- Method[] methods = forClass().getDeclaredMethods();
- readObjectMethod = findMethod(methods, "readObject",
- new Class[] { ObjectInputStream.class },
- Void.TYPE, true);
- writeObjectMethod = findMethod(methods, "writeObject",
- new Class[] { ObjectOutputStream.class },
- Void.TYPE, true);
- readResolveMethod = findMethod(methods, "readResolve",
- new Class[0], Object.class, false);
- writeReplaceMethod = findMethod(methods, "writeReplace",
- new Class[0], Object.class, false);
- }
-
- private ObjectStreamClass(Class cl)
- {
- uid = 0;
- flags = 0;
- isProxyClass = Proxy.isProxyClass(cl);
-
- clazz = cl;
- cacheMethods();
- name = cl.getName();
- setFlags(cl);
- setFields(cl);
- // to those class nonserializable, its uid field is 0
- if ( (Serializable.class).isAssignableFrom(cl) && !isProxyClass)
- uid = getClassUID(cl);
- superClass = lookup(cl.getSuperclass());
- }
-
-
- // Sets bits in flags according to features of CL.
- private void setFlags(Class cl)
- {
- if ((java.io.Externalizable.class).isAssignableFrom(cl))
- flags |= ObjectStreamConstants.SC_EXTERNALIZABLE;
- else if ((java.io.Serializable.class).isAssignableFrom(cl))
- // only set this bit if CL is NOT Externalizable
- flags |= ObjectStreamConstants.SC_SERIALIZABLE;
-
- if (writeObjectMethod != null)
- flags |= ObjectStreamConstants.SC_WRITE_METHOD;
- }
-
-
- // Sets fields to be a sorted array of the serializable fields of
- // clazz.
- private void setFields(Class cl)
- {
- SetAccessibleAction setAccessible = new SetAccessibleAction();
-
- if (!isSerializable() || isExternalizable())
- {
- fields = NO_FIELDS;
- return;
- }
-
- try
- {
- final Field f =
- cl.getDeclaredField("serialPersistentFields");
- setAccessible.setMember(f);
- AccessController.doPrivileged(setAccessible);
- int modifiers = f.getModifiers();
-
- if (Modifier.isStatic(modifiers)
- && Modifier.isFinal(modifiers)
- && Modifier.isPrivate(modifiers))
- {
- fields = getSerialPersistentFields(cl);
- if (fields != null)
- {
- Arrays.sort (fields);
- // Retrieve field reference.
- for (int i=0; i < fields.length; i++)
- {
- try
- {
- fields[i].lookupField(cl);
- }
- catch (NoSuchFieldException _)
- {
- fields[i].setToSet(false);
- }
- }
-
- calculateOffsets();
- return;
- }
- }
- }
- catch (NoSuchFieldException ignore)
- {
- }
- catch (IllegalAccessException ignore)
- {
- }
-
- int num_good_fields = 0;
- Field[] all_fields = cl.getDeclaredFields();
-
- int modifiers;
- // set non-serializable fields to null in all_fields
- for (int i = 0; i < all_fields.length; i++)
- {
- modifiers = all_fields[i].getModifiers();
- if (Modifier.isTransient(modifiers)
- || Modifier.isStatic(modifiers))
- all_fields[i] = null;
- else
- num_good_fields++;
- }
-
- // make a copy of serializable (non-null) fields
- fields = new ObjectStreamField[ num_good_fields ];
- for (int from = 0, to = 0; from < all_fields.length; from++)
- if (all_fields[from] != null)
- {
- final Field f = all_fields[from];
- setAccessible.setMember(f);
- AccessController.doPrivileged(setAccessible);
- fields[to] = new ObjectStreamField(all_fields[from]);
- to++;
- }
-
- Arrays.sort(fields);
- // Make sure we don't have any duplicate field names
- // (Sun JDK 1.4.1. throws an Internal Error as well)
- for (int i = 1; i < fields.length; i++)
- {
- if(fields[i - 1].getName().equals(fields[i].getName()))
- throw new InternalError("Duplicate field " +
- fields[i].getName() + " in class " + cl.getName());
- }
- calculateOffsets();
- }
-
- // Returns the serial version UID defined by class, or if that
- // isn't present, calculates value of serial version UID.
- private long getClassUID(Class cl)
- {
- try
- {
- // Use getDeclaredField rather than getField, since serialVersionUID
- // may not be public AND we only want the serialVersionUID of this
- // class, not a superclass or interface.
- final Field suid = cl.getDeclaredField("serialVersionUID");
- SetAccessibleAction setAccessible = new SetAccessibleAction(suid);
- AccessController.doPrivileged(setAccessible);
- int modifiers = suid.getModifiers();
-
- if (Modifier.isStatic(modifiers)
- && Modifier.isFinal(modifiers)
- && suid.getType() == Long.TYPE)
- return suid.getLong(null);
- }
- catch (NoSuchFieldException ignore)
- {
- }
- catch (IllegalAccessException ignore)
- {
- }
-
- // cl didn't define serialVersionUID, so we have to compute it
- try
- {
- MessageDigest md;
- try
- {
- md = MessageDigest.getInstance("SHA");
- }
- catch (NoSuchAlgorithmException e)
- {
- // If a provider already provides SHA, use it; otherwise, use this.
- Gnu gnuProvider = new Gnu();
- Security.addProvider(gnuProvider);
- md = MessageDigest.getInstance("SHA");
- }
-
- DigestOutputStream digest_out =
- new DigestOutputStream(nullOutputStream, md);
- DataOutputStream data_out = new DataOutputStream(digest_out);
-
- data_out.writeUTF(cl.getName());
-
- int modifiers = cl.getModifiers();
- // just look at interesting bits
- modifiers = modifiers & (Modifier.ABSTRACT | Modifier.FINAL
- | Modifier.INTERFACE | Modifier.PUBLIC);
- data_out.writeInt(modifiers);
-
- // Pretend that an array has no interfaces, because when array
- // serialization was defined (JDK 1.1), arrays didn't have it.
- if (! cl.isArray())
- {
- Class[] interfaces = cl.getInterfaces();
- Arrays.sort(interfaces, interfaceComparator);
- for (int i = 0; i < interfaces.length; i++)
- data_out.writeUTF(interfaces[i].getName());
- }
-
- Field field;
- Field[] fields = cl.getDeclaredFields();
- Arrays.sort(fields, memberComparator);
- for (int i = 0; i < fields.length; i++)
- {
- field = fields[i];
- modifiers = field.getModifiers();
- if (Modifier.isPrivate(modifiers)
- && (Modifier.isStatic(modifiers)
- || Modifier.isTransient(modifiers)))
- continue;
-
- data_out.writeUTF(field.getName());
- data_out.writeInt(modifiers);
- data_out.writeUTF(TypeSignature.getEncodingOfClass (field.getType()));
- }
-
- // write class initializer method if present
- if (VMObjectStreamClass.hasClassInitializer(cl))
- {
- data_out.writeUTF("<clinit>");
- data_out.writeInt(Modifier.STATIC);
- data_out.writeUTF("()V");
- }
-
- Constructor constructor;
- Constructor[] constructors = cl.getDeclaredConstructors();
- Arrays.sort (constructors, memberComparator);
- for (int i = 0; i < constructors.length; i++)
- {
- constructor = constructors[i];
- modifiers = constructor.getModifiers();
- if (Modifier.isPrivate(modifiers))
- continue;
-
- data_out.writeUTF("<init>");
- data_out.writeInt(modifiers);
-
- // the replacement of '/' with '.' was needed to make computed
- // SUID's agree with those computed by JDK
- data_out.writeUTF
- (TypeSignature.getEncodingOfConstructor(constructor).replace('/','.'));
- }
-
- Method method;
- Method[] methods = cl.getDeclaredMethods();
- Arrays.sort(methods, memberComparator);
- for (int i = 0; i < methods.length; i++)
- {
- method = methods[i];
- modifiers = method.getModifiers();
- if (Modifier.isPrivate(modifiers))
- continue;
-
- data_out.writeUTF(method.getName());
- data_out.writeInt(modifiers);
-
- // the replacement of '/' with '.' was needed to make computed
- // SUID's agree with those computed by JDK
- data_out.writeUTF
- (TypeSignature.getEncodingOfMethod(method).replace('/', '.'));
- }
-
- data_out.close();
- byte[] sha = md.digest();
- long result = 0;
- int len = sha.length < 8 ? sha.length : 8;
- for (int i = 0; i < len; i++)
- result += (long) (sha[i] & 0xFF) << (8 * i);
-
- return result;
- }
- catch (NoSuchAlgorithmException e)
- {
- throw new RuntimeException
- ("The SHA algorithm was not found to use in computing the Serial Version UID for class "
- + cl.getName(), e);
- }
- catch (IOException ioe)
- {
- throw new RuntimeException(ioe);
- }
- }
-
- /**
- * Returns the value of CLAZZ's private static final field named
- * `serialPersistentFields'. It performs some sanity checks before
- * returning the real array. Besides, the returned array is a clean
- * copy of the original. So it can be modified.
- *
- * @param clazz Class to retrieve 'serialPersistentFields' from.
- * @return The content of 'serialPersistentFields'.
- */
- private ObjectStreamField[] getSerialPersistentFields(Class clazz)
- throws NoSuchFieldException, IllegalAccessException
- {
- ObjectStreamField[] fieldsArray = null;
- ObjectStreamField[] o;
-
- // Use getDeclaredField rather than getField for the same reason
- // as above in getDefinedSUID.
- Field f = clazz.getDeclaredField("serialPersistentFields");
- f.setAccessible(true);
-
- int modifiers = f.getModifiers();
- if (!(Modifier.isStatic(modifiers) &&
- Modifier.isFinal(modifiers) &&
- Modifier.isPrivate(modifiers)))
- return null;
-
- o = (ObjectStreamField[]) f.get(null);
-
- if (o == null)
- return null;
-
- fieldsArray = new ObjectStreamField[ o.length ];
- System.arraycopy(o, 0, fieldsArray, 0, o.length);
-
- return fieldsArray;
- }
-
- /**
- * Returns a new instance of the Class this ObjectStreamClass corresponds
- * to.
- * Note that this should only be used for Externalizable classes.
- *
- * @return A new instance.
- */
- Externalizable newInstance() throws InvalidClassException
- {
- synchronized(this)
- {
- if (constructor == null)
- {
- try
- {
- final Constructor c = clazz.getConstructor(new Class[0]);
-
- AccessController.doPrivileged(new PrivilegedAction()
- {
- public Object run()
- {
- c.setAccessible(true);
- return null;
- }
- });
-
- constructor = c;
- }
- catch(NoSuchMethodException x)
- {
- throw new InvalidClassException(clazz.getName(),
- "No public zero-argument constructor");
- }
- }
- }
-
- try
- {
- return (Externalizable)constructor.newInstance(null);
- }
- catch(Exception x)
- {
- throw (InvalidClassException)
- new InvalidClassException(clazz.getName(),
- "Unable to instantiate").initCause(x);
- }
- }
-
- public static final ObjectStreamField[] NO_FIELDS = {};
-
- private static Hashtable classLookupTable = new Hashtable();
- private static final NullOutputStream nullOutputStream = new NullOutputStream();
- private static final Comparator interfaceComparator = new InterfaceComparator();
- private static final Comparator memberComparator = new MemberComparator();
- private static final
- Class[] writeMethodArgTypes = { java.io.ObjectOutputStream.class };
-
- private ObjectStreamClass superClass;
- private Class clazz;
- private String name;
- private long uid;
- private byte flags;
-
- // this field is package protected so that ObjectInputStream and
- // ObjectOutputStream can access it directly
- ObjectStreamField[] fields;
-
- // these are accessed by ObjectIn/OutputStream
- int primFieldSize = -1; // -1 if not yet calculated
- int objectFieldCount;
-
- Method readObjectMethod;
- Method readResolveMethod;
- Method writeReplaceMethod;
- Method writeObjectMethod;
- boolean realClassIsSerializable;
- boolean realClassIsExternalizable;
- ObjectStreamField[] fieldMapping;
- Constructor firstNonSerializableParentConstructor;
- private Constructor constructor; // default constructor for Externalizable
-
- boolean isProxyClass = false;
-
- // This is probably not necessary because this class is special cased already
- // but it will avoid showing up as a discrepancy when comparing SUIDs.
- private static final long serialVersionUID = -6120832682080437368L;
-
-
- // interfaces are compared only by name
- private static final class InterfaceComparator implements Comparator
- {
- public int compare(Object o1, Object o2)
- {
- return ((Class) o1).getName().compareTo(((Class) o2).getName());
- }
- }
-
-
- // Members (Methods and Constructors) are compared first by name,
- // conflicts are resolved by comparing type signatures
- private static final class MemberComparator implements Comparator
- {
- public int compare(Object o1, Object o2)
- {
- Member m1 = (Member) o1;
- Member m2 = (Member) o2;
-
- int comp = m1.getName().compareTo(m2.getName());
-
- if (comp == 0)
- return TypeSignature.getEncodingOfMember(m1).
- compareTo(TypeSignature.getEncodingOfMember(m2));
- else
- return comp;
- }
- }
-}
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java
deleted file mode 100644
index 85604fee7ec..00000000000
--- a/libjava/java/net/ServerSocket.java
+++ /dev/null
@@ -1,609 +0,0 @@
-/* ServerSocket.java -- Class for implementing server side sockets
- Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.net;
-
-import gnu.java.net.PlainSocketImpl;
-
-import java.io.IOException;
-import java.nio.channels.IllegalBlockingModeException;
-import java.nio.channels.ServerSocketChannel;
-
-
-/* Written using on-line Java Platform 1.2 API Specification.
- * Status: I believe all methods are implemented.
- */
-
-/**
- * This class models server side sockets. The basic model is that the
- * server socket is created and bound to some well known port. It then
- * listens for and accepts connections. At that point the client and
- * server sockets are ready to communicate with one another utilizing
- * whatever application layer protocol they desire.
- *
- * As with the <code>Socket</code> class, most instance methods of this class
- * simply redirect their calls to an implementation class.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Per Bothner (bothner@cygnus.com)
- */
-public class ServerSocket
-{
- /**
- * This is the user defined SocketImplFactory, if one is supplied
- */
- private static SocketImplFactory factory;
-
- /**
- * This is the SocketImp object to which most instance methods in this
- * class are redirected
- */
- private SocketImpl impl;
-
- /**
- * True if socket is bound.
- */
- private boolean bound;
-
- /*
- * This constructor is only used by java.nio.
- */
-
- // FIXME: Workaround a bug in gcj.
- //ServerSocket (PlainSocketImpl impl) throws IOException
- ServerSocket(SocketImpl impl) throws IOException
- {
- if (impl == null)
- throw new NullPointerException("impl may not be null");
-
- this.impl = impl;
- this.impl.create(true);
- }
-
- /*
- * This method is only used by java.nio.
- */
-
- // FIXME: Workaround a bug in gcj.
- //PlainSocketImpl getImpl()
- SocketImpl getImpl()
- {
- return impl;
- }
-
- /**
- * Constructor that simply sets the implementation.
- *
- * @exception IOException If an error occurs
- *
- * @specnote This constructor is public since JDK 1.4
- */
- public ServerSocket() throws IOException
- {
- if (factory != null)
- impl = factory.createSocketImpl();
- else
- impl = new PlainSocketImpl();
-
- impl.create(true);
- }
-
- /**
- * Creates a server socket and binds it to the specified port. If the
- * port number is 0, a random free port will be chosen. The pending
- * connection queue on this socket will be set to 50.
- *
- * @param port The port number to bind to
- *
- * @exception IOException If an error occurs
- * @exception SecurityException If a security manager exists and its
- * checkListen method doesn't allow the operation
- */
- public ServerSocket(int port) throws IOException
- {
- this(port, 50);
- }
-
- /**
- * Creates a server socket and binds it to the specified port. If the
- * port number is 0, a random free port will be chosen. The pending
- * connection queue on this socket will be set to the value passed as
- * arg2.
- *
- * @param port The port number to bind to
- * @param backlog The length of the pending connection queue
- *
- * @exception IOException If an error occurs
- * @exception SecurityException If a security manager exists and its
- * checkListen method doesn't allow the operation
- */
- public ServerSocket(int port, int backlog) throws IOException
- {
- this(port, backlog, null);
- }
-
- /**
- * Creates a server socket and binds it to the specified port. If the
- * port number is 0, a random free port will be chosen. The pending
- * connection queue on this socket will be set to the value passed as
- * backlog. The third argument specifies a particular local address to
- * bind t or null to bind to all local address.
- *
- * @param port The port number to bind to
- * @param backlog The length of the pending connection queue
- * @param bindAddr The address to bind to, or null to bind to all addresses
- *
- * @exception IOException If an error occurs
- * @exception SecurityException If a security manager exists and its
- * checkListen method doesn't allow the operation
- *
- * @since 1.1
- */
- public ServerSocket(int port, int backlog, InetAddress bindAddr)
- throws IOException
- {
- this();
-
- // bind/listen socket
- bind(new InetSocketAddress(bindAddr, port), backlog);
- }
-
- /**
- * Binds the server socket to a specified socket address
- *
- * @param endpoint The socket address to bind to
- *
- * @exception IOException If an error occurs
- * @exception IllegalArgumentException If address type is not supported
- * @exception SecurityException If a security manager exists and its
- * checkListen method doesn't allow the operation
- *
- * @since 1.4
- */
- public void bind(SocketAddress endpoint) throws IOException
- {
- bind(endpoint, 50);
- }
-
- /**
- * Binds the server socket to a specified socket address
- *
- * @param endpoint The socket address to bind to
- * @param backlog The length of the pending connection queue
- *
- * @exception IOException If an error occurs
- * @exception IllegalArgumentException If address type is not supported
- * @exception SecurityException If a security manager exists and its
- * checkListen method doesn't allow the operation
- *
- * @since 1.4
- */
- public void bind(SocketAddress endpoint, int backlog)
- throws IOException
- {
- if (isClosed())
- throw new SocketException("ServerSocket is closed");
-
- if (! (endpoint instanceof InetSocketAddress))
- throw new IllegalArgumentException("Address type not supported");
-
- InetSocketAddress tmp = (InetSocketAddress) endpoint;
-
- SecurityManager s = System.getSecurityManager();
- if (s != null)
- s.checkListen(tmp.getPort());
-
- InetAddress addr = tmp.getAddress();
-
- // Initialize addr with 0.0.0.0.
- if (addr == null)
- addr = InetAddress.ANY_IF;
-
- try
- {
- impl.bind(addr, tmp.getPort());
- impl.listen(backlog);
- bound = true;
- }
- catch (IOException exception)
- {
- close();
- throw exception;
- }
- catch (RuntimeException exception)
- {
- close();
- throw exception;
- }
- catch (Error error)
- {
- close();
- throw error;
- }
- }
-
- /**
- * This method returns the local address to which this socket is bound
- *
- * @return The socket's local address
- */
- public InetAddress getInetAddress()
- {
- if (! isBound())
- return null;
-
- try
- {
- return (InetAddress) impl.getOption(SocketOptions.SO_BINDADDR);
- }
- catch (SocketException e)
- {
- // This never happens as we are bound.
- return null;
- }
- }
-
- /**
- * This method returns the local port number to which this socket is bound
- *
- * @return The socket's port number
- */
- public int getLocalPort()
- {
- if (! isBound())
- return -1;
-
- return impl.getLocalPort();
- }
-
- /**
- * Returns the local socket address
- *
- * @return the local socket address, null if not bound
- *
- * @since 1.4
- */
- public SocketAddress getLocalSocketAddress()
- {
- if (! isBound())
- return null;
-
- return new InetSocketAddress(getInetAddress(), getLocalPort());
- }
-
- /**
- * Accepts a new connection and returns a connected <code>Socket</code>
- * instance representing that connection. This method will block until a
- * connection is available.
- *
- * @return socket object for the just accepted connection
- *
- * @exception IOException If an error occurs
- * @exception SecurityException If a security manager exists and its
- * checkListen method doesn't allow the operation
- * @exception IllegalBlockingModeException If this socket has an associated
- * channel, and the channel is in non-blocking mode
- * @exception SocketTimeoutException If a timeout was previously set with
- * setSoTimeout and the timeout has been reached
- */
- public Socket accept() throws IOException
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkListen(impl.getLocalPort());
-
- Socket socket = new Socket();
-
- try
- {
- implAccept(socket);
- }
- catch (IOException e)
- {
- try
- {
- socket.close();
- }
- catch (IOException e2)
- {
- // Ignore.
- }
-
- throw e;
- }
-
- return socket;
- }
-
- /**
- * This protected method is used to help subclasses override
- * <code>ServerSocket.accept()</code>. The passed in socket will be
- * connected when this method returns.
- *
- * @param socket The socket that is used for the accepted connection
- *
- * @exception IOException If an error occurs
- * @exception IllegalBlockingModeException If this socket has an associated
- * channel, and the channel is in non-blocking mode
- *
- * @since 1.1
- */
- protected final void implAccept(Socket socket) throws IOException
- {
- if (isClosed())
- throw new SocketException("ServerSocket is closed");
-
- // The Sun spec says that if we have an associated channel and
- // it is in non-blocking mode, we throw an IllegalBlockingModeException.
- // However, in our implementation if the channel itself initiated this
- // operation, then we must honor it regardless of its blocking mode.
- if (getChannel() != null && ! getChannel().isBlocking()
- && ! ((PlainSocketImpl) getImpl()).isInChannelOperation())
- throw new IllegalBlockingModeException();
-
- impl.accept(socket.impl);
- socket.implCreated = true;
- }
-
- /**
- * Closes this socket and stops listening for connections
- *
- * @exception IOException If an error occurs
- */
- public void close() throws IOException
- {
- if (isClosed())
- return;
-
- impl.close();
- impl = null;
- bound = false;
-
- if (getChannel() != null)
- getChannel().close();
- }
-
- /**
- * Returns the unique <code>ServerSocketChannel</code> object
- * associated with this socket, if any.
- *
- * <p>The socket only has a <code>ServerSocketChannel</code> if its created
- * by <code>ServerSocketChannel.open()</code>.</p>
- *
- * @return the associated socket channel, null if none exists
- *
- * @since 1.4
- */
- public ServerSocketChannel getChannel()
- {
- return null;
- }
-
- /**
- * Returns true when the socket is bound, otherwise false
- *
- * @return true if socket is bound, false otherwise
- *
- * @since 1.4
- */
- public boolean isBound()
- {
- return bound;
- }
-
- /**
- * Returns true if the socket is closed, otherwise false
- *
- * @return true if socket is closed, false otherwise
- *
- * @since 1.4
- */
- public boolean isClosed()
- {
- return impl == null;
- }
-
- /**
- * Sets the value of SO_TIMEOUT. A value of 0 implies that SO_TIMEOUT is
- * disabled (ie, operations never time out). This is the number of
- * milliseconds a socket operation can block before an
- * InterruptedIOException is thrown.
- *
- * @param timeout The new SO_TIMEOUT value
- *
- * @exception SocketException If an error occurs
- *
- * @since 1.1
- */
- public void setSoTimeout(int timeout) throws SocketException
- {
- if (isClosed())
- throw new SocketException("ServerSocket is closed");
-
- if (timeout < 0)
- throw new IllegalArgumentException("SO_TIMEOUT value must be >= 0");
-
- impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
- }
-
- /**
- * Retrieves the current value of the SO_TIMEOUT setting. A value of 0
- * implies that SO_TIMEOUT is disabled (ie, operations never time out).
- * This is the number of milliseconds a socket operation can block before
- * an InterruptedIOException is thrown.
- *
- * @return The value of SO_TIMEOUT
- *
- * @exception IOException If an error occurs
- *
- * @since 1.1
- */
- public int getSoTimeout() throws IOException
- {
- if (isClosed())
- throw new SocketException("ServerSocket is closed");
-
- Object timeout = impl.getOption(SocketOptions.SO_TIMEOUT);
-
- if (! (timeout instanceof Integer))
- throw new IOException("Internal Error");
-
- return ((Integer) timeout).intValue();
- }
-
- /**
- * Enables/Disables the SO_REUSEADDR option
- *
- * @param on true if SO_REUSEADDR should be enabled, false otherwise
- *
- * @exception SocketException If an error occurs
- *
- * @since 1.4
- */
- public void setReuseAddress(boolean on) throws SocketException
- {
- if (isClosed())
- throw new SocketException("ServerSocket is closed");
-
- impl.setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(on));
- }
-
- /**
- * Checks if the SO_REUSEADDR option is enabled
- *
- * @return true if SO_REUSEADDR is set, false otherwise
- *
- * @exception SocketException If an error occurs
- *
- * @since 1.4
- */
- public boolean getReuseAddress() throws SocketException
- {
- if (isClosed())
- throw new SocketException("ServerSocket is closed");
-
- Object reuseaddr = impl.getOption(SocketOptions.SO_REUSEADDR);
-
- if (! (reuseaddr instanceof Boolean))
- throw new SocketException("Internal Error");
-
- return ((Boolean) reuseaddr).booleanValue();
- }
-
- /**
- * This method sets the value for the system level socket option
- * SO_RCVBUF to the specified value. Note that valid values for this
- * option are specific to a given operating system.
- *
- * @param size The new receive buffer size.
- *
- * @exception SocketException If an error occurs or Socket is not connected
- * @exception IllegalArgumentException If size is 0 or negative
- *
- * @since 1.4
- */
- public void setReceiveBufferSize(int size) throws SocketException
- {
- if (isClosed())
- throw new SocketException("ServerSocket is closed");
-
- if (size <= 0)
- throw new IllegalArgumentException("SO_RCVBUF value must be > 0");
-
- impl.setOption(SocketOptions.SO_RCVBUF, new Integer(size));
- }
-
- /**
- * This method returns the value of the system level socket option
- * SO_RCVBUF, which is used by the operating system to tune buffer
- * sizes for data transfers.
- *
- * @return The receive buffer size.
- *
- * @exception SocketException If an error occurs or Socket is not connected
- *
- * @since 1.4
- */
- public int getReceiveBufferSize() throws SocketException
- {
- if (isClosed())
- throw new SocketException("ServerSocket is closed");
-
- Object buf = impl.getOption(SocketOptions.SO_RCVBUF);
-
- if (! (buf instanceof Integer))
- throw new SocketException("Internal Error: Unexpected type");
-
- return ((Integer) buf).intValue();
- }
-
- /**
- * Returns the value of this socket as a <code>String</code>.
- *
- * @return This socket represented as a <code>String</code>.
- */
- public String toString()
- {
- if (! isBound())
- return "ServerSocket[unbound]";
-
- return ("ServerSocket[addr=" + getInetAddress() + ",port="
- + impl.getPort() + ",localport=" + impl.getLocalPort() + "]");
- }
-
- /**
- * Sets the <code>SocketImplFactory</code> for all
- * <code>ServerSocket</code>'s. This may only be done
- * once per virtual machine. Subsequent attempts will generate an
- * exception. Note that a <code>SecurityManager</code> check is made prior
- * to setting the factory. If insufficient privileges exist to set the
- * factory, an exception will be thrown
- *
- * @param fac the factory to set
- *
- * @exception SecurityException If this operation is not allowed by the
- * <code>SecurityManager</code>.
- * @exception SocketException If the factory object is already defined
- * @exception IOException If any other error occurs
- */
- public static synchronized void setSocketFactory(SocketImplFactory fac)
- throws IOException
- {
- factory = fac;
- }
-}
diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java
index dd947cb0115..5bb0337adce 100644
--- a/libjava/java/net/URLClassLoader.java
+++ b/libjava/java/net/URLClassLoader.java
@@ -248,12 +248,10 @@ public class URLClassLoader extends SecureClassLoader
abstract static class Resource
{
final URLLoader loader;
- final String name;
- Resource(URLLoader loader, String name)
+ Resource(URLLoader loader)
{
this.loader = loader;
- this.name = name;
}
/**
@@ -404,11 +402,13 @@ public class URLClassLoader extends SecureClassLoader
static final class JarURLResource extends Resource
{
private final JarEntry entry;
+ private final String name;
JarURLResource(JarURLLoader loader, String name, JarEntry entry)
{
- super(loader, name);
+ super(loader);
this.entry = entry;
+ this.name = name;
}
InputStream getInputStream() throws IOException
@@ -509,7 +509,7 @@ public class URLClassLoader extends SecureClassLoader
RemoteResource(RemoteURLLoader loader, String name, URL url,
InputStream stream, int length)
{
- super(loader, name);
+ super(loader);
this.url = url;
this.stream = stream;
this.length = length;
@@ -561,15 +561,15 @@ public class URLClassLoader extends SecureClassLoader
URL url = helper.findResource(name);
if (url == null)
return null;
- return new SoResource(this, name, url);
+ return new SoResource(this, url);
}
}
final static class SoResource extends Resource
{
- SoResource(SoURLLoader loader, String name, URL url)
+ SoResource(SoURLLoader loader, URL url)
{
- super(loader, name);
+ super(loader);
this.url = url;
}
@@ -614,7 +614,7 @@ public class URLClassLoader extends SecureClassLoader
{
File file = new File(dir, name).getCanonicalFile();
if (file.exists() && !file.isDirectory())
- return new FileResource(this, file.getPath(), file);
+ return new FileResource(this, file);
}
catch (IOException e)
{
@@ -628,9 +628,9 @@ public class URLClassLoader extends SecureClassLoader
{
final File file;
- FileResource(FileURLLoader loader, String name, File file)
+ FileResource(FileURLLoader loader, File file)
{
- super(loader, name);
+ super(loader);
this.file = file;
}
@@ -673,8 +673,7 @@ public class URLClassLoader extends SecureClassLoader
{
try
{
- return new URL(loader.baseURL, name,
- loader.classloader.getURLStreamHandler("file"));
+ return file.toURL();
}
catch (MalformedURLException e)
{
@@ -711,12 +710,14 @@ public class URLClassLoader extends SecureClassLoader
static final class CoreResource extends Resource
{
- final Core core;
+ private final Core core;
+ private final String name;
CoreResource(CoreURLLoader loader, String name, Core core)
{
- super(loader, name);
+ super(loader);
this.core = core;
+ this.name = name;
}
InputStream getInputStream() throws IOException
@@ -755,10 +756,10 @@ public class URLClassLoader extends SecureClassLoader
* in the order given to the URLClassLoader which uses these URLs to
* load classes and resources (after using the default parent ClassLoader).
*
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
* @param urls Locations that should be searched by this ClassLoader when
* resolving Classes or Resources.
+ * @exception SecurityException if the SecurityManager disallows the
+ * creation of a ClassLoader.
* @see SecureClassLoader
*/
public URLClassLoader(URL[] urls) throws SecurityException
@@ -770,25 +771,6 @@ public class URLClassLoader extends SecureClassLoader
}
/**
- * Private constructor used by the static
- * <code>newInstance(URL[])</code> method. Creates an
- * <code>URLClassLoader</code> without any <code>URL</code>s
- * yet. This is used to bypass the normal security check for
- * creating classloaders, but remembers the security context which
- * will be used when defining classes. The <code>URL</code>s to
- * load from must be added by the <code>newInstance()</code> method
- * in the security context of the caller.
- *
- * @param securityContext the security context of the unprivileged code.
- */
- private URLClassLoader(AccessControlContext securityContext)
- {
- super();
- this.factory = null;
- this.securityContext = securityContext;
- }
-
- /**
* Creates a <code>URLClassLoader</code> that gets classes from the supplied
* <code>URL</code>s.
* To determine if this classloader may be created the constructor of
@@ -796,13 +778,13 @@ public class URLClassLoader extends SecureClassLoader
* can throw a SecurityException. Then the supplied URLs are added
* in the order given to the URLClassLoader which uses these URLs to
* load classes and resources (after using the supplied parent ClassLoader).
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
- * @exception SecurityException
* @param urls Locations that should be searched by this ClassLoader when
* resolving Classes or Resources.
* @param parent The parent class loader used before trying this class
* loader.
+ * @exception SecurityException if the SecurityManager disallows the
+ * creation of a ClassLoader.
+ * @exception SecurityException
* @see SecureClassLoader
*/
public URLClassLoader(URL[] urls, ClassLoader parent)
@@ -844,14 +826,14 @@ public class URLClassLoader extends SecureClassLoader
* load classes and resources (after using the supplied parent ClassLoader).
* It will use the supplied <CODE>URLStreamHandlerFactory</CODE> to get the
* protocol handlers of the supplied URLs.
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
- * @exception SecurityException
* @param urls Locations that should be searched by this ClassLoader when
* resolving Classes or Resources.
* @param parent The parent class loader used before trying this class
* loader.
* @param factory Used to get the protocol handler for the URLs.
+ * @exception SecurityException if the SecurityManager disallows the
+ * creation of a ClassLoader.
+ * @exception SecurityException
* @see SecureClassLoader
*/
public URLClassLoader(URL[] urls, ClassLoader parent,
@@ -938,13 +920,21 @@ public class URLClassLoader extends SecureClassLoader
}
/**
- * Adds an array of new locations to the end of the internal URL store.
+ * Adds an array of new locations to the end of the internal URL
+ * store. Called from the the constructors. Should not call to the
+ * protected addURL() method since that can be overridden and
+ * subclasses are not yet in a good state at this point.
+ * jboss 4.0.3 for example depends on this.
+ *
* @param newUrls the locations to add
*/
private void addURLs(URL[] newUrls)
{
for (int i = 0; i < newUrls.length; i++)
- addURL(newUrls[i]);
+ {
+ urls.add(newUrls[i]);
+ addURLImpl(newUrls[i]);
+ }
}
/**
@@ -969,13 +959,13 @@ public class URLClassLoader extends SecureClassLoader
* package is sealed. If the Manifest indicates that the package is sealed
* then the Package will be sealed with respect to the supplied URL.
*
- * @exception IllegalArgumentException If this package name already exists
- * in this class loader
* @param name The name of the package
* @param manifest The manifest describing the specification,
* implementation and sealing details of the package
* @param url the code source url to seal the package
* @return the defined Package
+ * @throws IllegalArgumentException If this package name already exists
+ * in this class loader
*/
protected Package definePackage(String name, Manifest manifest, URL url)
throws IllegalArgumentException
@@ -1062,40 +1052,47 @@ public class URLClassLoader extends SecureClassLoader
// construct the class (and watch out for those nasty IOExceptions)
try
{
- byte[] data;
- InputStream in = resource.getInputStream();
- int length = resource.getLength();
- if (length != -1)
+ byte[] data;
+ InputStream in = resource.getInputStream();
+ try
{
- // We know the length of the data.
- // Just try to read it in all at once
- data = new byte[length];
- int pos = 0;
- while (length - pos > 0)
+ int length = resource.getLength();
+ if (length != -1)
{
- int len = in.read(data, pos, length - pos);
- if (len == -1)
- throw new EOFException("Not enough data reading from: "
- + in);
- pos += len;
+ // We know the length of the data.
+ // Just try to read it in all at once
+ data = new byte[length];
+ int pos = 0;
+ while (length - pos > 0)
+ {
+ int len = in.read(data, pos, length - pos);
+ if (len == -1)
+ throw new EOFException("Not enough data reading from: "
+ + in);
+ pos += len;
+ }
}
- }
- else
- {
- // We don't know the data length.
- // Have to read it in chunks.
- ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
- byte[] b = new byte[4096];
- int l = 0;
- while (l != -1)
+ else
{
- l = in.read(b);
- if (l != -1)
- out.write(b, 0, l);
+ // We don't know the data length.
+ // Have to read it in chunks.
+ ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
+ byte[] b = new byte[4096];
+ int l = 0;
+ while (l != -1)
+ {
+ l = in.read(b);
+ if (l != -1)
+ out.write(b, 0, l);
+ }
+ data = out.toByteArray();
}
- data = out.toByteArray();
- }
- final byte[] classData = data;
+ }
+ finally
+ {
+ in.close();
+ }
+ final byte[] classData = data;
// Now get the CodeSource
final CodeSource source = resource.getCodeSource();
@@ -1136,7 +1133,11 @@ public class URLClassLoader extends SecureClassLoader
else
result = defineClass(className, classData, 0, classData.length, source);
- super.setSigners(result, resource.getCertificates());
+ // Avoid NullPointerExceptions.
+ Certificate[] resourceCertificates = resource.getCertificates();
+ if(resourceCertificates != null)
+ super.setSigners(result, resourceCertificates);
+
return result;
}
catch (IOException ioe)
@@ -1252,11 +1253,11 @@ public class URLClassLoader extends SecureClassLoader
/**
* Finds all the resources with a particular name from all the locations.
*
- * @exception IOException when an error occurs accessing one of the
- * locations
* @param resourceName the name of the resource to lookup
* @return a (possible empty) enumeration of URLs where the resource can be
* found
+ * @exception IOException when an error occurs accessing one of the
+ * locations
*/
public Enumeration findResources(String resourceName)
throws IOException
@@ -1291,7 +1292,7 @@ public class URLClassLoader extends SecureClassLoader
*
* @param source The codesource that needs the permissions to be accessed
* @return the collection of permissions needed to access the code resource
- * @see java.security.SecureClassLoader#getPermissions()
+ * @see java.security.SecureClassLoader#getPermissions(CodeSource)
*/
protected PermissionCollection getPermissions(CodeSource source)
{
diff --git a/libjava/java/net/URLConnection.java b/libjava/java/net/URLConnection.java
index 55b9d664dc7..b5e4cb06241 100644
--- a/libjava/java/net/URLConnection.java
+++ b/libjava/java/net/URLConnection.java
@@ -539,7 +539,7 @@ public abstract class URLConnection
}
/**
- * Returns the value of a flag indicating whether or not input is going
+ * Sets the value of a flag indicating whether or not input is going
* to be done for this connection. This default to true unless the
* doOutput flag is set to false, in which case this defaults to false.
*
@@ -569,7 +569,7 @@ public abstract class URLConnection
}
/**
- * Returns a boolean flag indicating whether or not output will be done
+ * Sets a boolean flag indicating whether or not output will be done
* on this connection. The default value is false, so this method can
* be used to override the default
*
@@ -860,7 +860,7 @@ public abstract class URLConnection
}
/**
- * Set's the ContentHandlerFactory for an application. This can be called
+ * Sets the ContentHandlerFactory for an application. This can be called
* once and only once. If it is called again, then an Error is thrown.
* Unlike for other set factory methods, this one does not do a security
* check prior to setting the factory.
@@ -956,7 +956,7 @@ public abstract class URLConnection
}
/**
- * This method set the <code>FileNameMap</code> object being used
+ * This method sets the <code>FileNameMap</code> object being used
* to decode MIME types by file extension.
*
* @param map The <code>FileNameMap</code>.
diff --git a/libjava/java/net/natVMNetworkInterfaceWin32.cc b/libjava/java/net/natVMNetworkInterfaceWin32.cc
index 257e06d1778..d42f33de90d 100644
--- a/libjava/java/net/natVMNetworkInterfaceWin32.cc
+++ b/libjava/java/net/natVMNetworkInterfaceWin32.cc
@@ -14,6 +14,7 @@ details. */
#include <java/net/NetworkInterface.h>
#include <java/net/Inet4Address.h>
#include <java/net/SocketException.h>
+#include <java/net/VMNetworkInterface.h>
#include <java/util/Vector.h>
/* As of this writing, NetworkInterface.java has
diff --git a/libjava/java/text/Collator.java b/libjava/java/text/Collator.java
index 830fd6f32f5..c1ba87e93b9 100644
--- a/libjava/java/text/Collator.java
+++ b/libjava/java/text/Collator.java
@@ -150,8 +150,8 @@ public abstract class Collator implements Comparator, Cloneable
* <code>Collator</code> and the strength and decomposition rules in
* effect.
*
- * @param str1 The first object to compare
- * @param str2 The second object to compare
+ * @param source The first object to compare
+ * @param target The second object to compare
*
* @return A negative integer if str1 &lt; str2, 0 if str1 == str2, or
* a positive integer if str1 &gt; str2.
@@ -164,8 +164,8 @@ public abstract class Collator implements Comparator, Cloneable
* equal to, or greater than the second argument. These two objects
* must be <code>String</code>'s or an exception will be thrown.
*
- * @param obj1 The first object to compare
- * @param obj2 The second object to compare
+ * @param o1 The first object to compare
+ * @param o2 The second object to compare
*
* @return A negative integer if obj1 &lt; obj2, 0 if obj1 == obj2, or
* a positive integer if obj1 &gt; obj2.
@@ -208,8 +208,8 @@ public abstract class Collator implements Comparator, Cloneable
* according to the collation rules for the locale of this object and
* the current strength and decomposition settings.
*
- * @param str1 The first <code>String</code> to compare
- * @param str2 The second <code>String</code> to compare
+ * @param source The first <code>String</code> to compare
+ * @param target The second <code>String</code> to compare
*
* @return <code>true</code> if the two strings are equal,
* <code>false</code> otherwise.
@@ -256,7 +256,7 @@ public abstract class Collator implements Comparator, Cloneable
* comparisons against a string might be performed multiple times, such
* as during a sort operation.
*
- * @param str The <code>String</code> to convert.
+ * @param source The <code>String</code> to convert.
*
* @return A <code>CollationKey</code> for the specified <code>String</code>.
*/
@@ -292,7 +292,7 @@ public abstract class Collator implements Comparator, Cloneable
* specified locale. If no <code>Collator</code> exists for the desired
* locale, a <code>Collator</code> for the default locale will be returned.
*
- * @param locale The desired localed to load a <code>Collator</code> for.
+ * @param loc The desired localed to load a <code>Collator</code> for.
*
* @return A <code>Collator</code> for the requested locale
*/
@@ -308,7 +308,8 @@ public abstract class Collator implements Comparator, Cloneable
}
catch (MissingResourceException x)
{
- return null;
+ pattern = "<0<1<2<3<4<5<6<7<8<9<A,a<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K" +
+ "<l,L<m,M<n,N<o,O<p,P<q,Q<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y<z,Z";
}
try
{
@@ -316,7 +317,7 @@ public abstract class Collator implements Comparator, Cloneable
}
catch (ParseException x)
{
- return null;
+ throw (InternalError)new InternalError().initCause(x);
}
}
@@ -346,7 +347,7 @@ public abstract class Collator implements Comparator, Cloneable
* exception will be thrown. See the documentation for those
* contants for an explanation of this setting.
*
- * @param decmp The new decomposition setting.
+ * @param mode The new decomposition setting.
*
* @exception IllegalArgumentException If the requested
* decomposition setting is not valid.
diff --git a/libjava/java/text/DateFormat.java b/libjava/java/text/DateFormat.java
index 8cf60ae5c84..c94d9845b30 100644
--- a/libjava/java/text/DateFormat.java
+++ b/libjava/java/text/DateFormat.java
@@ -58,6 +58,9 @@ import java.util.TimeZone;
public abstract class DateFormat extends Format implements Cloneable
{
+ private static final long serialVersionUID = 7218322306649953788L;
+
+ // Names fixed by serialization spec.
protected Calendar calendar;
protected NumberFormat numberFormat;
@@ -405,8 +408,18 @@ public abstract class DateFormat extends Format implements Cloneable
* <ul>
* <li>Is not <code>null</code>.</li>
* <li>Is an instance of <code>DateFormat</code>.</li>
- * <li>Has the same numberFormat field value as this object.</li>
+ * <li>Has equal numberFormat field as this object.</li>
+ * <li>Has equal (Calendar) TimeZone rules as this object.</li>
+ * <li>Has equal (Calendar) isLenient results.</li>
+ * <li>Has equal Calendar first day of week and minimal days in week
+ * values.</li>
* </ul>
+ * Note that not all properties of the Calendar are relevant for a
+ * DateFormat. For formatting only the fact whether or not the
+ * TimeZone has the same rules and whether the calendar is lenient
+ * and has the same week rules is compared for this implementation
+ * of equals. Other properties of the Calendar (such as the time)
+ * are not taken into account.
*
* @param obj The object to test for equality against.
*
@@ -419,8 +432,24 @@ public abstract class DateFormat extends Format implements Cloneable
return false;
DateFormat d = (DateFormat) obj;
-
- return numberFormat.equals(d.numberFormat);
+ TimeZone tz = getTimeZone();
+ TimeZone tzd = d.getTimeZone();
+ if (tz.hasSameRules(tzd))
+ if (isLenient() == d.isLenient())
+ {
+ Calendar c = getCalendar();
+ Calendar cd = d.getCalendar();
+ if ((c == null && cd == null)
+ ||
+ (c.getFirstDayOfWeek() == cd.getFirstDayOfWeek()
+ &&
+ c.getMinimalDaysInFirstWeek()
+ == cd.getMinimalDaysInFirstWeek()))
+ return ((numberFormat == null && d.numberFormat == null)
+ || numberFormat.equals(d.numberFormat));
+ }
+
+ return false;
}
/**
@@ -442,9 +471,9 @@ public abstract class DateFormat extends Format implements Cloneable
* thrown.
*
* @param obj The <code>Object</code> to format.
- * @param toAppendTo The <code>StringBuffer</code> to append the resultant
+ * @param buf The <code>StringBuffer</code> to append the resultant
* <code>String</code> to.
- * @param fieldPosition Is updated to the start and end index of the
+ * @param pos Is updated to the start and end index of the
* specified field.
*
* @return The <code>StringBuffer</code> supplied on input, with the
@@ -479,9 +508,9 @@ public abstract class DateFormat extends Format implements Cloneable
* to the specified <code>StringBuffer</code>.
*
* @param date The <code>Date</code> value to format.
- * @param toAppendTo The <code>StringBuffer</code> to append the resultant
+ * @param buf The <code>StringBuffer</code> to append the resultant
* <code>String</code> to.
- * @param fieldPosition Is updated to the start and end index of the
+ * @param pos Is updated to the start and end index of the
* specified field.
*
* @return The <code>StringBuffer</code> supplied on input, with the
@@ -646,7 +675,7 @@ public abstract class DateFormat extends Format implements Cloneable
* localed will be used in place of the default.
*
* @param style The type of formatting to perform.
- * @param aLocale The desired locale.
+ * @param loc The desired locale.
*
* @return A new <code>DateFormat</code> instance.
*/
@@ -747,7 +776,7 @@ public abstract class DateFormat extends Format implements Cloneable
* localed will be used in place of the default.
*
* @param style The type of formatting to perform.
- * @param aLocale The desired locale.
+ * @param loc The desired locale.
*
* @return A new <code>DateFormat</code> instance.
*/
@@ -821,7 +850,7 @@ public abstract class DateFormat extends Format implements Cloneable
* starting parse position on method entry and the ending parse
* position on method exit.
*
- * @param text The string to parse.
+ * @param source The string to parse.
* @param pos The starting parse position in entry, the ending parse
* position on exit.
*
@@ -851,7 +880,7 @@ public abstract class DateFormat extends Format implements Cloneable
* This method specified the <code>Calendar</code> that should be used
* by this object to parse/format datetimes.
*
- * @param The new <code>Calendar</code> for this object.
+ * @param calendar The new <code>Calendar</code> for this object.
*
* @see java.util.Calendar
*/
@@ -876,7 +905,7 @@ public abstract class DateFormat extends Format implements Cloneable
* This method specifies the <code>NumberFormat</code> object that should
* be used by this object to parse/format times.
*
- * @param The <code>NumberFormat</code> in use by this object.
+ * @param numberFormat The <code>NumberFormat</code> in use by this object.
*/
public void setNumberFormat (NumberFormat numberFormat)
{
@@ -886,7 +915,7 @@ public abstract class DateFormat extends Format implements Cloneable
/**
* This method sets the time zone that should be used by this object.
*
- * @param The new time zone.
+ * @param timeZone The new time zone.
*/
public void setTimeZone (TimeZone timeZone)
{
diff --git a/libjava/java/text/DateFormatSymbols.java b/libjava/java/text/DateFormatSymbols.java
index 274fbf686c3..27a806df1b6 100644
--- a/libjava/java/text/DateFormatSymbols.java
+++ b/libjava/java/text/DateFormatSymbols.java
@@ -266,7 +266,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* This is a two element <code>String</code> array indexed by
* <code>Calendar.AM</code> and <code>Calendar.PM</code>
*
- * @param ampms The new list of AM/PM display strings.
+ * @param value The new list of AM/PM display strings.
*/
public void setAmPmStrings (String[] value)
{
@@ -279,11 +279,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* This is a two element <code>String</code>
* array indexed by <code>Calendar.BC</code> and <code>Calendar.AD</code>.
*
- * @param eras The new list of era disply strings.
+ * @param labels The new list of era display strings.
*/
- public void setEras (String[] value)
+ public void setEras (String[] labels)
{
- eras = value;
+ eras = labels;
}
/**
@@ -317,11 +317,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* <li>17 - time zone (z)</li>
* </ul>
*
- * @param localPatternChars The new format patter characters
+ * @param chars The new format pattern characters
*/
- public void setLocalPatternChars (String value)
+ public void setLocalPatternChars (String chars)
{
- localPatternChars = value;
+ localPatternChars = chars;
}
/**
@@ -331,11 +331,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* <code>Calendar.UNDECEMBER</code>. Note that there are thirteen
* elements because some calendars have thriteen months.
*
- * @param months The list of month display strings.
+ * @param labels The list of month display strings.
*/
- public void setMonths (String[] value)
+ public void setMonths (String[] labels)
{
- months = value;
+ months = labels;
}
/**
@@ -346,11 +346,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* through <code>Calendar.UNDECEMBER</code>. Note that there are thirteen
* elements because some calendars have thirteen months.
*
- * @param shortMonths The new list of abbreviated month display strings.
+ * @param labels The new list of abbreviated month display strings.
*/
- public void setShortMonths (String[] value)
+ public void setShortMonths (String[] labels)
{
- shortMonths = value;
+ shortMonths = labels;
}
/**
@@ -361,11 +361,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* through <code>Calendar.SATURDAY</code>. Note that the first element
* of this array is ignored.
*
- * @param shortWeekdays This list of abbreviated weekday display strings.
+ * @param labels This list of abbreviated weekday display strings.
*/
- public void setShortWeekdays (String[] value)
+ public void setShortWeekdays (String[] labels)
{
- shortWeekdays = value;
+ shortWeekdays = labels;
}
/**
@@ -375,11 +375,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* through <code>Calendar.SATURDAY</code>. Note that the first element
* of this array is ignored.
*
- * @param weekdays This list of weekday display strings.
+ * @param labels This list of weekday display strings.
*/
- public void setWeekdays (String[] value)
+ public void setWeekdays (String[] labels)
{
- weekdays = value;
+ weekdays = labels;
}
/**
@@ -395,11 +395,11 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* <li>4 - the short name of the time zone (daylight savings time).</li>
* </ul>
*
- * @return The list of time zone display strings.
+ * @params zones The list of time zone display strings.
*/
- public void setZoneStrings (String[][] value)
+ public void setZoneStrings (String[][] zones)
{
- zoneStrings = value;
+ zoneStrings = zones;
}
/* Does a "deep" equality test - recurses into arrays. */
@@ -469,7 +469,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
/**
* Returns a new copy of this object.
*
- * @param A copy of this object
+ * @return A copy of this object
*/
public Object clone ()
{
diff --git a/libjava/java/text/DecimalFormatSymbols.java b/libjava/java/text/DecimalFormatSymbols.java
index ea2b68cf59b..c58530fc544 100644
--- a/libjava/java/text/DecimalFormatSymbols.java
+++ b/libjava/java/text/DecimalFormatSymbols.java
@@ -122,7 +122,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
* This method initializes a new instance of
* <code>DecimalFormatSymbols</code> for the specified locale.
*
- * @param locale The local to load symbols for.
+ * @param loc The local to load symbols for.
*/
public DecimalFormatSymbols (Locale loc)
{
@@ -380,7 +380,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
/**
* This method sets the currency symbol to the specified value.
*
- * @param currencySymbol The new currency symbol
+ * @param currency The new currency symbol
*/
public void setCurrencySymbol (String currency)
{
@@ -390,7 +390,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
/**
* This method sets the decimal point character to the specified value.
*
- * @param decimalSeparator The new decimal point character
+ * @param decimalSep The new decimal point character
*/
public void setDecimalSeparator (char decimalSep)
{
@@ -417,7 +417,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
/**
* This method sets the character used to separate groups of digits.
*
- * @param groupingSeparator The character used to separate groups of digits.
+ * @param groupSep The character used to separate groups of digits.
*/
public void setGroupingSeparator (char groupSep)
{
@@ -459,8 +459,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
* This method sets the character used for the decimal point in currency
* values.
*
- * @param monetarySeparator The decimal point character used in
- * currency values.
+ * @param decimalSep The decimal point character used in currency values.
*/
public void setMonetaryDecimalSeparator (char decimalSep)
{
@@ -471,7 +470,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
* This method sets the string used to represent the NaN (not a
* number) value.
*
- * @param NaN The string used to represent NaN
+ * @param nan The string used to represent NaN
*/
public void setNaN (String nan)
{
@@ -482,7 +481,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
* This method sets the character used to separate positive and negative
* subpatterns in a format pattern.
*
- * @param patternSeparator The character used to separate positive and
+ * @param patternSep The character used to separate positive and
* negative subpatterns in a format pattern.
*/
public void setPatternSeparator (char patternSep)
diff --git a/libjava/java/text/SimpleDateFormat.java b/libjava/java/text/SimpleDateFormat.java
deleted file mode 100644
index 8a93b9f256d..00000000000
--- a/libjava/java/text/SimpleDateFormat.java
+++ /dev/null
@@ -1,1237 +0,0 @@
-/* SimpleDateFormat.java -- A class for parsing/formating simple
- date constructs
- Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.text;
-
-import gnu.java.text.AttributedFormatBuffer;
-import gnu.java.text.FormatBuffer;
-import gnu.java.text.FormatCharacterIterator;
-import gnu.java.text.StringFormatBuffer;
-
-import java.io.IOException;
-import java.io.InvalidObjectException;
-import java.io.ObjectInputStream;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.TimeZone;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * SimpleDateFormat provides convenient methods for parsing and formatting
- * dates using Gregorian calendars (see java.util.GregorianCalendar).
- */
-public class SimpleDateFormat extends DateFormat
-{
- /**
- * This class is used by <code>SimpleDateFormat</code> as a
- * compiled representation of a format string. The field
- * ID, size, and character used are stored for each sequence
- * of pattern characters.
- */
- private class CompiledField
- {
- /**
- * The ID of the field within the local pattern characters,
- */
- private int field;
-
- /**
- * The size of the character sequence.
- */
- private int size;
-
- /**
- * The character used.
- */
- private char character;
-
- /**
- * Constructs a compiled field using the
- * the given field ID, size and character
- * values.
- *
- * @param f the field ID.
- * @param s the size of the field.
- * @param c the character used.
- */
- public CompiledField(int f, int s, char c)
- {
- field = f;
- size = s;
- character = c;
- }
-
- /**
- * Retrieves the ID of the field relative to
- * the local pattern characters.
- */
- public int getField()
- {
- return field;
- }
-
- /**
- * Retrieves the size of the character sequence.
- */
- public int getSize()
- {
- return size;
- }
-
- /**
- * Retrieves the character used in the sequence.
- */
- public char getCharacter()
- {
- return character;
- }
-
- /**
- * Returns a <code>String</code> representation
- * of the compiled field, primarily for debugging
- * purposes.
- *
- * @return a <code>String</code> representation.
- */
- public String toString()
- {
- StringBuffer builder;
-
- builder = new StringBuffer(getClass().getName());
- builder.append("[field=");
- builder.append(field);
- builder.append(", size=");
- builder.append(size);
- builder.append(", character=");
- builder.append(character);
- builder.append("]");
-
- return builder.toString();
- }
- }
-
- /**
- * A list of <code>CompiledField</code>s,
- * representing the compiled version of the pattern.
- *
- * @see CompiledField
- * @serial Ignored.
- */
- private transient ArrayList tokens;
-
- /**
- * The localised data used in formatting,
- * such as the day and month names in the local
- * language, and the localized pattern characters.
- *
- * @see DateFormatSymbols
- * @serial The localisation data. May not be null.
- */
- private DateFormatSymbols formatData;
-
- /**
- * The date representing the start of the century
- * used for interpreting two digit years. For
- * example, 24/10/2004 would cause two digit
- * years to be interpreted as representing
- * the years between 2004 and 2104.
- *
- * @see get2DigitYearStart()
- * @see set2DigitYearStart(java.util.Date)
- * @see Date
- * @serial The start date of the century for parsing two digit years.
- * May not be null.
- */
- private Date defaultCenturyStart;
-
- /**
- * The year at which interpretation of two
- * digit years starts.
- *
- * @see get2DigitYearStart()
- * @see set2DigitYearStart(java.util.Date)
- * @serial Ignored.
- */
- private transient int defaultCentury;
-
- /**
- * The non-localized pattern string. This
- * only ever contains the pattern characters
- * stored in standardChars. Localized patterns
- * are translated to this form.
- *
- * @see applyPattern(String)
- * @see applyLocalizedPattern(String)
- * @see toPattern()
- * @see toLocalizedPattern()
- * @serial The non-localized pattern string. May not be null.
- */
- private String pattern;
-
- /**
- * The version of serialized data used by this class.
- * Version 0 only includes the pattern and formatting
- * data. Version 1 adds the start date for interpreting
- * two digit years.
- *
- * @serial This specifies the version of the data being serialized.
- * Version 0 (or no version) specifies just <code>pattern</code>
- * and <code>formatData</code>. Version 1 adds
- * the <code>defaultCenturyStart</code>. This implementation
- * always writes out version 1 data.
- */
- private int serialVersionOnStream = 1; // 0 indicates JDK1.1.3 or earlier
-
- /**
- * For compatability.
- */
- private static final long serialVersionUID = 4774881970558875024L;
-
- // This string is specified in the root of the CLDR. We set it here
- // rather than doing a DateFormatSymbols(Locale.US).getLocalPatternChars()
- // since someone could theoretically change those values (though unlikely).
- private static final String standardChars = "GyMdkHmsSEDFwWahKzYeugAZ";
-
- /**
- * Reads the serialized version of this object.
- * If the serialized data is only version 0,
- * then the date for the start of the century
- * for interpreting two digit years is computed.
- * The pattern is parsed and compiled following the process
- * of reading in the serialized data.
- *
- * @param stream the object stream to read the data from.
- * @throws IOException if an I/O error occurs.
- * @throws ClassNotFoundException if the class of the serialized data
- * could not be found.
- * @throws InvalidObjectException if the pattern is invalid.
- */
- private void readObject(ObjectInputStream stream)
- throws IOException, ClassNotFoundException
- {
- stream.defaultReadObject();
- if (serialVersionOnStream < 1)
- {
- computeCenturyStart ();
- serialVersionOnStream = 1;
- }
- else
- // Ensure that defaultCentury gets set.
- set2DigitYearStart(defaultCenturyStart);
-
- // Set up items normally taken care of by the constructor.
- tokens = new ArrayList();
- try
- {
- compileFormat(pattern);
- }
- catch (IllegalArgumentException e)
- {
- throw new InvalidObjectException("The stream pattern was invalid.");
- }
- }
-
- /**
- * Compiles the supplied non-localized pattern into a form
- * from which formatting and parsing can be performed.
- * This also detects errors in the pattern, which will
- * be raised on later use of the compiled data.
- *
- * @param pattern the non-localized pattern to compile.
- * @throws IllegalArgumentException if the pattern is invalid.
- */
- private void compileFormat(String pattern)
- {
- // Any alphabetical characters are treated as pattern characters
- // unless enclosed in single quotes.
-
- char thisChar;
- int pos;
- int field;
- CompiledField current = null;
-
- for (int i=0; i<pattern.length(); i++) {
- thisChar = pattern.charAt(i);
- field = standardChars.indexOf(thisChar);
- if (field == -1) {
- current = null;
- if ((thisChar >= 'A' && thisChar <= 'Z')
- || (thisChar >= 'a' && thisChar <= 'z')) {
- // Not a valid letter
- throw new IllegalArgumentException("Invalid letter " + thisChar +
- "encountered at character " + i
- + ".");
- } else if (thisChar == '\'') {
- // Quoted text section; skip to next single quote
- pos = pattern.indexOf('\'',i+1);
- if (pos == -1) {
- throw new IllegalArgumentException("Quotes starting at character "
- + i + " not closed.");
- }
- if ((pos+1 < pattern.length()) && (pattern.charAt(pos+1) == '\'')) {
- tokens.add(pattern.substring(i+1,pos+1));
- } else {
- tokens.add(pattern.substring(i+1,pos));
- }
- i = pos;
- } else {
- // A special character
- tokens.add(new Character(thisChar));
- }
- } else {
- // A valid field
- if ((current != null) && (field == current.field)) {
- current.size++;
- } else {
- current = new CompiledField(field,1,thisChar);
- tokens.add(current);
- }
- }
- }
- }
-
- /**
- * Returns a string representation of this
- * class.
- *
- * @return a string representation of the <code>SimpleDateFormat</code>
- * instance.
- */
- public String toString()
- {
- StringBuffer output = new StringBuffer(getClass().getName());
- output.append("[tokens=");
- output.append(tokens);
- output.append(", formatData=");
- output.append(formatData);
- output.append(", defaultCenturyStart=");
- output.append(defaultCenturyStart);
- output.append(", defaultCentury=");
- output.append(defaultCentury);
- output.append(", pattern=");
- output.append(pattern);
- output.append(", serialVersionOnStream=");
- output.append(serialVersionOnStream);
- output.append(", standardChars=");
- output.append(standardChars);
- output.append("]");
- return output.toString();
- }
-
- /**
- * Constructs a SimpleDateFormat using the default pattern for
- * the default locale.
- */
- public SimpleDateFormat()
- {
- /*
- * There does not appear to be a standard API for determining
- * what the default pattern for a locale is, so use package-scope
- * variables in DateFormatSymbols to encapsulate this.
- */
- super();
- Locale locale = Locale.getDefault();
- calendar = new GregorianCalendar(locale);
- computeCenturyStart();
- tokens = new ArrayList();
- formatData = new DateFormatSymbols(locale);
- pattern = (formatData.dateFormats[DEFAULT] + ' '
- + formatData.timeFormats[DEFAULT]);
- compileFormat(pattern);
- numberFormat = NumberFormat.getInstance(locale);
- numberFormat.setGroupingUsed (false);
- numberFormat.setParseIntegerOnly (true);
- numberFormat.setMaximumFractionDigits (0);
- }
-
- /**
- * Creates a date formatter using the specified non-localized pattern,
- * with the default DateFormatSymbols for the default locale.
- *
- * @param pattern the pattern to use.
- * @throws NullPointerException if the pattern is null.
- * @throws IllegalArgumentException if the pattern is invalid.
- */
- public SimpleDateFormat(String pattern)
- {
- this(pattern, Locale.getDefault());
- }
-
- /**
- * Creates a date formatter using the specified non-localized pattern,
- * with the default DateFormatSymbols for the given locale.
- *
- * @param pattern the non-localized pattern to use.
- * @param locale the locale to use for the formatting symbols.
- * @throws NullPointerException if the pattern is null.
- * @throws IllegalArgumentException if the pattern is invalid.
- */
- public SimpleDateFormat(String pattern, Locale locale)
- {
- super();
- calendar = new GregorianCalendar(locale);
- computeCenturyStart();
- tokens = new ArrayList();
- formatData = new DateFormatSymbols(locale);
- compileFormat(pattern);
- this.pattern = pattern;
- numberFormat = NumberFormat.getInstance(locale);
- numberFormat.setGroupingUsed (false);
- numberFormat.setParseIntegerOnly (true);
- numberFormat.setMaximumFractionDigits (0);
- }
-
- /**
- * Creates a date formatter using the specified non-localized
- * pattern. The specified DateFormatSymbols will be used when
- * formatting.
- *
- * @param pattern the non-localized pattern to use.
- * @param formatData the formatting symbols to use.
- * @throws NullPointerException if the pattern or formatData is null.
- * @throws IllegalArgumentException if the pattern is invalid.
- */
- public SimpleDateFormat(String pattern, DateFormatSymbols formatData)
- {
- super();
- calendar = new GregorianCalendar();
- computeCenturyStart ();
- tokens = new ArrayList();
- if (formatData == null)
- throw new NullPointerException("formatData");
- this.formatData = formatData;
- compileFormat(pattern);
- this.pattern = pattern;
- numberFormat = NumberFormat.getInstance();
- numberFormat.setGroupingUsed (false);
- numberFormat.setParseIntegerOnly (true);
- numberFormat.setMaximumFractionDigits (0);
- }
-
- /**
- * This method returns a string with the formatting pattern being used
- * by this object. This string is unlocalized.
- *
- * @return The format string.
- */
- public String toPattern()
- {
- return pattern;
- }
-
- /**
- * This method returns a string with the formatting pattern being used
- * by this object. This string is localized.
- *
- * @return The format string.
- */
- public String toLocalizedPattern()
- {
- String localChars = formatData.getLocalPatternChars();
- return translateLocalizedPattern(pattern, standardChars, localChars);
- }
-
- /**
- * This method sets the formatting pattern that should be used by this
- * object. This string is not localized.
- *
- * @param pattern The new format pattern.
- * @throws NullPointerException if the pattern is null.
- * @throws IllegalArgumentException if the pattern is invalid.
- */
- public void applyPattern(String pattern)
- {
- tokens = new ArrayList();
- compileFormat(pattern);
- this.pattern = pattern;
- }
-
- /**
- * This method sets the formatting pattern that should be used by this
- * object. This string is localized.
- *
- * @param pattern The new format pattern.
- * @throws NullPointerException if the pattern is null.
- * @throws IllegalArgumentException if the pattern is invalid.
- */
- public void applyLocalizedPattern(String pattern)
- {
- String localChars = formatData.getLocalPatternChars();
- pattern = translateLocalizedPattern(pattern, localChars, standardChars);
- applyPattern(pattern);
- }
-
- /**
- * Translates either from or to a localized variant of the pattern
- * string. For example, in the German locale, 't' (for 'tag') is
- * used instead of 'd' (for 'date'). This method translates
- * a localized pattern (such as 'ttt') to a non-localized pattern
- * (such as 'ddd'), or vice versa. Non-localized patterns use
- * a standard set of characters, which match those of the U.S. English
- * locale.
- *
- * @param pattern the pattern to translate.
- * @param oldChars the old set of characters (used in the pattern).
- * @param newChars the new set of characters (which will be used in the
- * pattern).
- * @return a version of the pattern using the characters in
- * <code>newChars</code>.
- */
- private String translateLocalizedPattern(String pattern,
- String oldChars, String newChars)
- {
- int len = pattern.length();
- StringBuffer buf = new StringBuffer(len);
- boolean quoted = false;
- for (int i = 0; i < len; i++)
- {
- char ch = pattern.charAt(i);
- if (ch == '\'')
- quoted = ! quoted;
- if (! quoted)
- {
- int j = oldChars.indexOf(ch);
- if (j >= 0)
- ch = newChars.charAt(j);
- }
- buf.append(ch);
- }
- return buf.toString();
- }
-
- /**
- * Returns the start of the century used for two digit years.
- *
- * @return A <code>Date</code> representing the start of the century
- * for two digit years.
- */
- public Date get2DigitYearStart()
- {
- return defaultCenturyStart;
- }
-
- /**
- * Sets the start of the century used for two digit years.
- *
- * @param date A <code>Date</code> representing the start of the century for
- * two digit years.
- */
- public void set2DigitYearStart(Date date)
- {
- defaultCenturyStart = date;
- calendar.clear();
- calendar.setTime(date);
- int year = calendar.get(Calendar.YEAR);
- defaultCentury = year - (year % 100);
- }
-
- /**
- * This method returns a copy of the format symbol information used
- * for parsing and formatting dates.
- *
- * @return a copy of the date format symbols.
- */
- public DateFormatSymbols getDateFormatSymbols()
- {
- return (DateFormatSymbols) formatData.clone();
- }
-
- /**
- * This method sets the format symbols information used for parsing
- * and formatting dates.
- *
- * @param formatData The date format symbols.
- * @throws NullPointerException if <code>formatData</code> is null.
- */
- public void setDateFormatSymbols(DateFormatSymbols formatData)
- {
- if (formatData == null)
- {
- throw new
- NullPointerException("The supplied format data was null.");
- }
- this.formatData = formatData;
- }
-
- /**
- * This methods tests whether the specified object is equal to this
- * object. This will be true if and only if the specified object:
- * <p>
- * <ul>
- * <li>Is not <code>null</code>.</li>
- * <li>Is an instance of <code>SimpleDateFormat</code>.</li>
- * <li>Is equal to this object at the superclass (i.e., <code>DateFormat</code>)
- * level.</li>
- * <li>Has the same formatting pattern.</li>
- * <li>Is using the same formatting symbols.</li>
- * <li>Is using the same century for two digit years.</li>
- * </ul>
- *
- * @param obj The object to compare for equality against.
- *
- * @return <code>true</code> if the specified object is equal to this object,
- * <code>false</code> otherwise.
- */
- public boolean equals(Object o)
- {
- if (!super.equals(o))
- return false;
-
- if (!(o instanceof SimpleDateFormat))
- return false;
-
- SimpleDateFormat sdf = (SimpleDateFormat)o;
-
- if (defaultCentury != sdf.defaultCentury)
- return false;
-
- if (!toPattern().equals(sdf.toPattern()))
- return false;
-
- if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols()))
- return false;
-
- return true;
- }
-
- /**
- * This method returns a hash value for this object.
- *
- * @return A hash value for this object.
- */
- public int hashCode()
- {
- return super.hashCode() ^ toPattern().hashCode() ^ defaultCentury ^
- getDateFormatSymbols().hashCode();
- }
-
-
- /**
- * Formats the date input according to the format string in use,
- * appending to the specified StringBuffer. The input StringBuffer
- * is returned as output for convenience.
- */
- private void formatWithAttribute(Date date, FormatBuffer buffer, FieldPosition pos)
- {
- String temp;
- AttributedCharacterIterator.Attribute attribute;
- calendar.setTime(date);
-
- // go through vector, filling in fields where applicable, else toString
- Iterator iter = tokens.iterator();
- while (iter.hasNext())
- {
- Object o = iter.next();
- if (o instanceof CompiledField)
- {
- CompiledField cf = (CompiledField) o;
- int beginIndex = buffer.length();
-
- switch (cf.getField())
- {
- case ERA_FIELD:
- buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA);
- break;
- case YEAR_FIELD:
- // If we have two digits, then we truncate. Otherwise, we
- // use the size of the pattern, and zero pad.
- buffer.setDefaultAttribute (DateFormat.Field.YEAR);
- if (cf.getSize() == 2)
- {
- temp = "00"+String.valueOf (calendar.get (Calendar.YEAR));
- buffer.append (temp.substring (temp.length() - 2));
- }
- else
- withLeadingZeros (calendar.get (Calendar.YEAR), cf.getSize(), buffer);
- break;
- case MONTH_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.MONTH);
- if (cf.getSize() < 3)
- withLeadingZeros (calendar.get (Calendar.MONTH) + 1, cf.getSize(), buffer);
- else if (cf.getSize() < 4)
- buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]);
- else
- buffer.append (formatData.months[calendar.get (Calendar.MONTH)]);
- break;
- case DATE_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH);
- withLeadingZeros (calendar.get (Calendar.DATE), cf.getSize(), buffer);
- break;
- case HOUR_OF_DAY1_FIELD: // 1-24
- buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1);
- withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1,
- cf.getSize(), buffer);
- break;
- case HOUR_OF_DAY0_FIELD: // 0-23
- buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0);
- withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), cf.getSize(), buffer);
- break;
- case MINUTE_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.MINUTE);
- withLeadingZeros (calendar.get (Calendar.MINUTE),
- cf.getSize(), buffer);
- break;
- case SECOND_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.SECOND);
- withLeadingZeros(calendar.get (Calendar.SECOND),
- cf.getSize(), buffer);
- break;
- case MILLISECOND_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND);
- withLeadingZeros (calendar.get (Calendar.MILLISECOND), cf.getSize(), buffer);
- break;
- case DAY_OF_WEEK_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK);
- if (cf.getSize() < 4)
- buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]);
- else
- buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]);
- break;
- case DAY_OF_YEAR_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR);
- withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), cf.getSize(), buffer);
- break;
- case DAY_OF_WEEK_IN_MONTH_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH);
- withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH),
- cf.getSize(), buffer);
- break;
- case WEEK_OF_YEAR_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR);
- withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR),
- cf.getSize(), buffer);
- break;
- case WEEK_OF_MONTH_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH);
- withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH),
- cf.getSize(), buffer);
- break;
- case AM_PM_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.AM_PM);
- buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]);
- break;
- case HOUR1_FIELD: // 1-12
- buffer.setDefaultAttribute (DateFormat.Field.HOUR1);
- withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1,
- cf.getSize(), buffer);
- break;
- case HOUR0_FIELD: // 0-11
- buffer.setDefaultAttribute (DateFormat.Field.HOUR0);
- withLeadingZeros (calendar.get (Calendar.HOUR), cf.getSize(), buffer);
- break;
- case TIMEZONE_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE);
- TimeZone zone = calendar.getTimeZone();
- boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0;
- // FIXME: XXX: This should be a localized time zone.
- String zoneID = zone.getDisplayName
- (isDST, cf.getSize() > 3 ? TimeZone.LONG : TimeZone.SHORT);
- buffer.append (zoneID);
- break;
- case RFC822_TIMEZONE_FIELD:
- buffer.setDefaultAttribute(DateFormat.Field.RFC822_TIME_ZONE);
- int pureMinutes = (calendar.get(Calendar.ZONE_OFFSET) +
- calendar.get(Calendar.DST_OFFSET)) / (1000 * 60);
- String sign = (pureMinutes < 0) ? "-" : "+";
- int hours = pureMinutes / 60;
- int minutes = pureMinutes % 60;
- buffer.append(sign);
- withLeadingZeros(hours, 2, buffer);
- withLeadingZeros(minutes, 2, buffer);
- break;
- default:
- throw new IllegalArgumentException ("Illegal pattern character " +
- cf.getCharacter());
- }
- if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute()
- || cf.getField() == pos.getField()))
- {
- pos.setBeginIndex(beginIndex);
- pos.setEndIndex(buffer.length());
- }
- }
- else
- {
- buffer.append(o.toString(), null);
- }
- }
- }
-
- public StringBuffer format(Date date, StringBuffer buffer, FieldPosition pos)
- {
- formatWithAttribute(date, new StringFormatBuffer (buffer), pos);
-
- return buffer;
- }
-
- public AttributedCharacterIterator formatToCharacterIterator(Object date)
- throws IllegalArgumentException
- {
- if (date == null)
- throw new NullPointerException("null argument");
- if (!(date instanceof Date))
- throw new IllegalArgumentException("argument should be an instance of java.util.Date");
-
- AttributedFormatBuffer buf = new AttributedFormatBuffer();
- formatWithAttribute((Date)date, buf,
- null);
- buf.sync();
-
- return new FormatCharacterIterator(buf.getBuffer().toString(),
- buf.getRanges(),
- buf.getAttributes());
- }
-
- private void withLeadingZeros(int value, int length, FormatBuffer buffer)
- {
- String valStr = String.valueOf(value);
- for (length -= valStr.length(); length > 0; length--)
- buffer.append('0');
- buffer.append(valStr);
- }
-
- private boolean expect(String source, ParsePosition pos, char ch)
- {
- int x = pos.getIndex();
- boolean r = x < source.length() && source.charAt(x) == ch;
- if (r)
- pos.setIndex(x + 1);
- else
- pos.setErrorIndex(x);
- return r;
- }
-
- /**
- * This method parses the specified string into a date.
- *
- * @param dateStr The date string to parse.
- * @param pos The input and output parse position
- *
- * @return The parsed date, or <code>null</code> if the string cannot be
- * parsed.
- */
- public Date parse (String dateStr, ParsePosition pos)
- {
- int fmt_index = 0;
- int fmt_max = pattern.length();
-
- calendar.clear();
- boolean saw_timezone = false;
- int quote_start = -1;
- boolean is2DigitYear = false;
- try
- {
- for (; fmt_index < fmt_max; ++fmt_index)
- {
- char ch = pattern.charAt(fmt_index);
- if (ch == '\'')
- {
- int index = pos.getIndex();
- if (fmt_index < fmt_max - 1
- && pattern.charAt(fmt_index + 1) == '\'')
- {
- if (! expect (dateStr, pos, ch))
- return null;
- ++fmt_index;
- }
- else
- quote_start = quote_start < 0 ? fmt_index : -1;
- continue;
- }
-
- if (quote_start != -1
- || ((ch < 'a' || ch > 'z')
- && (ch < 'A' || ch > 'Z')))
- {
- if (! expect (dateStr, pos, ch))
- return null;
- continue;
- }
-
- // We've arrived at a potential pattern character in the
- // pattern.
- int fmt_count = 1;
- while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch)
- {
- ++fmt_count;
- }
-
- // We might need to limit the number of digits to parse in
- // some cases. We look to the next pattern character to
- // decide.
- boolean limit_digits = false;
- if (fmt_index < fmt_max
- && standardChars.indexOf(pattern.charAt(fmt_index)) >= 0)
- limit_digits = true;
- --fmt_index;
-
- // We can handle most fields automatically: most either are
- // numeric or are looked up in a string vector. In some cases
- // we need an offset. When numeric, `offset' is added to the
- // resulting value. When doing a string lookup, offset is the
- // initial index into the string array.
- int calendar_field;
- boolean is_numeric = true;
- int offset = 0;
- boolean maybe2DigitYear = false;
- boolean oneBasedHour = false;
- boolean oneBasedHourOfDay = false;
- Integer simpleOffset;
- String[] set1 = null;
- String[] set2 = null;
- switch (ch)
- {
- case 'd':
- calendar_field = Calendar.DATE;
- break;
- case 'D':
- calendar_field = Calendar.DAY_OF_YEAR;
- break;
- case 'F':
- calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH;
- break;
- case 'E':
- is_numeric = false;
- offset = 1;
- calendar_field = Calendar.DAY_OF_WEEK;
- set1 = formatData.getWeekdays();
- set2 = formatData.getShortWeekdays();
- break;
- case 'w':
- calendar_field = Calendar.WEEK_OF_YEAR;
- break;
- case 'W':
- calendar_field = Calendar.WEEK_OF_MONTH;
- break;
- case 'M':
- calendar_field = Calendar.MONTH;
- if (fmt_count <= 2)
- offset = -1;
- else
- {
- is_numeric = false;
- set1 = formatData.getMonths();
- set2 = formatData.getShortMonths();
- }
- break;
- case 'y':
- calendar_field = Calendar.YEAR;
- if (fmt_count <= 2)
- maybe2DigitYear = true;
- break;
- case 'K':
- calendar_field = Calendar.HOUR;
- break;
- case 'h':
- calendar_field = Calendar.HOUR;
- oneBasedHour = true;
- break;
- case 'H':
- calendar_field = Calendar.HOUR_OF_DAY;
- break;
- case 'k':
- calendar_field = Calendar.HOUR_OF_DAY;
- oneBasedHourOfDay = true;
- break;
- case 'm':
- calendar_field = Calendar.MINUTE;
- break;
- case 's':
- calendar_field = Calendar.SECOND;
- break;
- case 'S':
- calendar_field = Calendar.MILLISECOND;
- break;
- case 'a':
- is_numeric = false;
- calendar_field = Calendar.AM_PM;
- set1 = formatData.getAmPmStrings();
- break;
- case 'z':
- case 'Z':
- // We need a special case for the timezone, because it
- // uses a different data structure than the other cases.
- is_numeric = false;
- calendar_field = Calendar.ZONE_OFFSET;
- String[][] zoneStrings = formatData.getZoneStrings();
- int zoneCount = zoneStrings.length;
- int index = pos.getIndex();
- boolean found_zone = false;
- simpleOffset = computeOffset(dateStr.substring(index));
- if (simpleOffset != null)
- {
- found_zone = true;
- saw_timezone = true;
- calendar.set(Calendar.DST_OFFSET, 0);
- offset = simpleOffset.intValue();
- }
- else
- {
- for (int j = 0; j < zoneCount; j++)
- {
- String[] strings = zoneStrings[j];
- int k;
- for (k = 0; k < strings.length; ++k)
- {
- if (dateStr.startsWith(strings[k], index))
- break;
- }
- if (k != strings.length)
- {
- found_zone = true;
- saw_timezone = true;
- TimeZone tz = TimeZone.getTimeZone (strings[0]);
- // Check if it's a DST zone or ordinary
- if(k == 3 || k == 4)
- calendar.set (Calendar.DST_OFFSET, tz.getDSTSavings());
- else
- calendar.set (Calendar.DST_OFFSET, 0);
- offset = tz.getRawOffset ();
- pos.setIndex(index + strings[k].length());
- break;
- }
- }
- }
- if (! found_zone)
- {
- pos.setErrorIndex(pos.getIndex());
- return null;
- }
- break;
- default:
- pos.setErrorIndex(pos.getIndex());
- return null;
- }
-
- // Compute the value we should assign to the field.
- int value;
- int index = -1;
- if (is_numeric)
- {
- numberFormat.setMinimumIntegerDigits(fmt_count);
- if (limit_digits)
- numberFormat.setMaximumIntegerDigits(fmt_count);
- if (maybe2DigitYear)
- index = pos.getIndex();
- Number n = numberFormat.parse(dateStr, pos);
- if (pos == null || ! (n instanceof Long))
- return null;
- value = n.intValue() + offset;
- }
- else if (set1 != null)
- {
- index = pos.getIndex();
- int i;
- boolean found = false;
- for (i = offset; i < set1.length; ++i)
- {
- if (set1[i] != null)
- if (dateStr.toUpperCase().startsWith(set1[i].toUpperCase(),
- index))
- {
- found = true;
- pos.setIndex(index + set1[i].length());
- break;
- }
- }
- if (!found && set2 != null)
- {
- for (i = offset; i < set2.length; ++i)
- {
- if (set2[i] != null)
- if (dateStr.toUpperCase().startsWith(set2[i].toUpperCase(),
- index))
- {
- found = true;
- pos.setIndex(index + set2[i].length());
- break;
- }
- }
- }
- if (!found)
- {
- pos.setErrorIndex(index);
- return null;
- }
- value = i;
- }
- else
- value = offset;
-
- if (maybe2DigitYear)
- {
- // Parse into default century if the numeric year string has
- // exactly 2 digits.
- int digit_count = pos.getIndex() - index;
- if (digit_count == 2)
- {
- is2DigitYear = true;
- value += defaultCentury;
- }
- }
-
- // Calendar uses 0-based hours.
- // I.e. 00:00 AM is midnight, not 12 AM or 24:00
- if (oneBasedHour && value == 12)
- value = 0;
-
- if (oneBasedHourOfDay && value == 24)
- value = 0;
-
- // Assign the value and move on.
- calendar.set(calendar_field, value);
- }
-
- if (is2DigitYear)
- {
- // Apply the 80-20 heuristic to dermine the full year based on
- // defaultCenturyStart.
- int year = calendar.get(Calendar.YEAR);
- if (calendar.getTime().compareTo(defaultCenturyStart) < 0)
- calendar.set(Calendar.YEAR, year + 100);
- }
- if (! saw_timezone)
- {
- // Use the real rules to determine whether or not this
- // particular time is in daylight savings.
- calendar.clear (Calendar.DST_OFFSET);
- calendar.clear (Calendar.ZONE_OFFSET);
- }
- return calendar.getTime();
- }
- catch (IllegalArgumentException x)
- {
- pos.setErrorIndex(pos.getIndex());
- return null;
- }
- }
-
- /**
- * <p>
- * Computes the time zone offset in milliseconds
- * relative to GMT, based on the supplied
- * <code>String</code> representation.
- * </p>
- * <p>
- * The supplied <code>String</code> must be a three
- * or four digit signed number, with an optional 'GMT'
- * prefix. The first one or two digits represents the hours,
- * while the last two represent the minutes. The
- * two sets of digits can optionally be separated by
- * ':'. The mandatory sign prefix (either '+' or '-')
- * indicates the direction of the offset from GMT.
- * </p>
- * <p>
- * For example, 'GMT+0200' specifies 2 hours after
- * GMT, while '-05:00' specifies 5 hours prior to
- * GMT. The special case of 'GMT' alone can be used
- * to represent the offset, 0.
- * </p>
- * <p>
- * If the <code>String</code> can not be parsed,
- * the result will be null. The resulting offset
- * is wrapped in an <code>Integer</code> object, in
- * order to allow such failure to be represented.
- * </p>
- *
- * @param zoneString a string in the form
- * (GMT)? sign hours : minutes
- * where sign = '+' or '-', hours
- * is a one or two digits representing
- * a number between 0 and 23, and
- * minutes is two digits representing
- * a number between 0 and 59.
- * @return the parsed offset, or null if parsing
- * failed.
- */
- private Integer computeOffset(String zoneString)
- {
- Pattern pattern =
- Pattern.compile("(GMT)?([+-])([012])?([0-9]):?([0-9]{2})");
- Matcher matcher = pattern.matcher(zoneString);
- if (matcher.matches())
- {
- int sign = matcher.group(2).equals("+") ? 1 : -1;
- int hour = (Integer.parseInt(matcher.group(3)) * 10)
- + Integer.parseInt(matcher.group(4));
- int minutes = Integer.parseInt(matcher.group(5));
-
- if (hour > 23)
- return null;
-
- int offset = sign * ((hour * 60) + minutes) * 60000;
- return new Integer(offset);
- }
- else if (zoneString.startsWith("GMT"))
- {
- return new Integer(0);
- }
- return null;
- }
-
- // Compute the start of the current century as defined by
- // get2DigitYearStart.
- private void computeCenturyStart()
- {
- int year = calendar.get(Calendar.YEAR);
- calendar.set(Calendar.YEAR, year - 80);
- set2DigitYearStart(calendar.getTime());
- }
-
- /**
- * Returns a copy of this instance of
- * <code>SimpleDateFormat</code>. The copy contains
- * clones of the formatting symbols and the 2-digit
- * year century start date.
- */
- public Object clone()
- {
- SimpleDateFormat clone = (SimpleDateFormat) super.clone();
- clone.setDateFormatSymbols((DateFormatSymbols) formatData.clone());
- clone.set2DigitYearStart((Date) defaultCenturyStart.clone());
- return clone;
- }
-
-}
diff --git a/libjava/java/util/Calendar.java b/libjava/java/util/Calendar.java
index 51a923fce00..5559d8c53f4 100644
--- a/libjava/java/util/Calendar.java
+++ b/libjava/java/util/Calendar.java
@@ -629,6 +629,7 @@ public abstract class Calendar implements Serializable, Cloneable
clear();
this.time = time;
isTimeSet = true;
+ computeFields();
}
/**
@@ -879,7 +880,6 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Fills any unset fields in the time field list
- * @return true if the specified field has a value.
*/
protected void complete()
{
@@ -897,8 +897,19 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public boolean equals(Object o)
{
- return (o instanceof Calendar)
- && getTimeInMillis() == ((Calendar) o).getTimeInMillis();
+ if (! (o instanceof Calendar))
+ return false;
+ Calendar cal = (Calendar) o;
+ if (getTimeInMillis() == ((Calendar) o).getTimeInMillis()
+ && cal.getFirstDayOfWeek() == getFirstDayOfWeek()
+ && cal.isLenient() == isLenient()
+ && cal.getMinimalDaysInFirstWeek() == getMinimalDaysInFirstWeek())
+ {
+ TimeZone self = getTimeZone();
+ TimeZone oth = cal.getTimeZone();
+ return self == null ? oth == null : self.equals(oth);
+ }
+ return false;
}
/**
@@ -909,7 +920,13 @@ public abstract class Calendar implements Serializable, Cloneable
public int hashCode()
{
long time = getTimeInMillis();
- return (int) ((time & 0xffffffffL) ^ (time >> 32));
+ int val = (int) ((time & 0xffffffffL) ^ (time >> 32));
+ val += (getFirstDayOfWeek() + (isLenient() ? 1230 : 1237)
+ + getMinimalDaysInFirstWeek());
+ TimeZone self = getTimeZone();
+ if (self != null)
+ val ^= self.hashCode();
+ return val;
}
/**
diff --git a/libjava/java/util/Date.java b/libjava/java/util/Date.java
deleted file mode 100644
index 8154ad1d158..00000000000
--- a/libjava/java/util/Date.java
+++ /dev/null
@@ -1,1261 +0,0 @@
-/* java.util.Date
- Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.util;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-
-/**
- * <p>
- * This class represents a specific time in milliseconds since the epoch.
- * The epoch is 1970, January 1 00:00:00.0000 UTC.
- * </p>
- * <p>
- * <code>Date</code> is intended to reflect universal time coordinate (UTC),
- * but this depends on the underlying host environment. Most operating systems
- * don't handle the leap second, which occurs about once every year or
- * so. The leap second is added to the last minute of the day on either
- * the 30th of June or the 31st of December, creating a minute 61 seconds
- * in length.
- * </p>
- * <p>
- * The representations of the date fields are as follows:
- * <ul>
- * <li>
- * Years are specified as the difference between the year
- * and 1900. Thus, the final year used is equal to
- * 1900 + y, where y is the input value.
- * </li>
- * <li>
- * Months are represented using zero-based indexing,
- * making 0 January and 11 December.
- * </li>
- * <li>
- * Dates are represented with the usual values of
- * 1 through to 31.
- * </li>
- * <li>
- * Hours are represented in the twenty-four hour clock,
- * with integer values from 0 to 23. 12am is 0, and
- * 12pm is 12.
- * </li>
- * <li>
- * Minutes are again as usual, with values from 0 to 59.
- * </li>
- * <li>
- * Seconds are represented with the values 0 through to 61,
- * with 60 and 61 being leap seconds (as per the ISO C standard).
- * </li>
- * </ul>
- * </p>
- * <p>
- * Prior to JDK 1.1, this class was the sole class handling date and time
- * related functionality. However, this particular solution was not
- * amenable to internationalization. The new <code>Calendar</code>
- * class should now be used to handle dates and times, with <code>Date</code>
- * being used only for values in milliseconds since the epoch. The
- * <code>Calendar</code> class, and its concrete implementations, handle
- * the interpretation of these values into minutes, hours, days, months
- * and years. The formatting and parsing of dates is left to the
- * <code>DateFormat</code> class, which is able to handle the different
- * types of date format which occur in different locales.
- * </p>
- *
- * @see Calendar
- * @see GregorianCalendar
- * @see java.text.DateFormat
- * @author Jochen Hoenicke
- * @author Per Bothner (bothner@cygnus.com)
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- */
-public class Date
- implements Cloneable, Comparable, Serializable
-{
- /**
- * This is the serialization UID for this class
- * for compatability with Sun's JDK.
- */
- private static final long serialVersionUID = 7523967970034938905L;
-
- /**
- * The time in milliseconds since the epoch.
- */
- private transient long time;
-
- /**
- * An array of week names used to map names to integer values.
- */
- private static final String[] weekNames = { "Sun", "Mon", "Tue", "Wed",
- "Thu", "Fri", "Sat" };
- /**
- * An array of month names used to map names to integer values.
- */
- private static final String[] monthNames = { "Jan", "Feb", "Mar", "Apr",
- "May", "Jun", "Jul", "Aug",
- "Sep", "Oct", "Nov", "Dec" };
- /**
- * Creates a new Date Object representing the current time.
- */
- public Date()
- {
- time = System.currentTimeMillis();
- }
-
- /**
- * Creates a new Date Object representing the given time.
- *
- * @param time the time in milliseconds since the epoch.
- */
- public Date(long time)
- {
- this.time = time;
- }
-
- /**
- * Creates a new Date Object representing the given time.
- *
- * @deprecated use <code>new GregorianCalendar(year+1900, month,
- * day)</code> instead.
- * @param year the difference between the required year and 1900.
- * @param month the month as a value between 0 and 11.
- * @param day the day as a value between 0 and 31.
- */
- public Date(int year, int month, int day)
- {
- this(year, month, day, 0, 0, 0);
- }
-
- /**
- * Creates a new Date Object representing the given time.
- *
- * @deprecated use <code>new GregorianCalendar(year+1900, month,
- * day, hour, min)</code> instead.
- * @param year the difference between the required year and 1900.
- * @param month the month as a value between 0 and 11.
- * @param day the day as a value between 0 and 31.
- * @param hour the hour as a value between 0 and 23, in 24-hour
- * clock notation.
- * @param min the minute as a value between 0 and 59.
- */
- public Date(int year, int month, int day, int hour, int min)
- {
- this(year, month, day, hour, min, 0);
- }
-
- /**
- * Creates a new Date Object representing the given time.
- *
- * @deprecated use <code>new GregorianCalendar(year+1900, month,
- * day, hour, min, sec)</code> instead.
- * @param year the difference between the required year and 1900.
- * @param month the month as a value between 0 and 11.
- * @param day the day as a value between 0 and 31.
- * @param hour the hour as a value between 0 and 23, in 24-hour
- * clock notation.
- * @param min the minute as a value between 0 and 59.
- * @param sec the second as a value between 0 and 61 (with 60
- * and 61 being leap seconds).
- */
- public Date(int year, int month, int day, int hour, int min, int sec)
- {
- GregorianCalendar cal =
- new GregorianCalendar(year + 1900, month, day, hour, min, sec);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Creates a new Date from the given string representation. This
- * does the same as <code>new Date(Date.parse(s))</code>
- * @see #parse
- * @deprecated use <code>java.text.DateFormat.parse(s)</code> instead.
- */
- public Date(String s)
- {
- time = parse(s);
- }
-
- /**
- * Returns a copy of this <code>Date</code> object.
- *
- * @return a copy, or null if the object couldn't be
- * cloned.
- * @see Object#clone()
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException ex)
- {
- return null;
- }
- }
-
- /**
- * Returns the number of milliseconds since the epoch
- * specified by the given arguments. The arguments are
- * interpreted relative to UTC rather than the local
- * time zone.
- *
- * @deprecated Use <code>Calendar</code> with a UTC
- * <code>TimeZone</code> instead.
- * @param year the difference between the required year and 1900.
- * @param month the month as a value between 0 and 11.
- * @param day the day as a value between 0 and 31.
- * @param hour the hour as a value between 0 and 23, in 24-hour
- * clock notation.
- * @param min the minute as a value between 0 and 59.
- * @param sec the second as a value between 0 and 61 (with 60
- * and 61 being leap seconds).
- * @return the time in milliseconds since the epoch.
- */
- public static long UTC(int year, int month, int date,
- int hrs, int min, int sec)
- {
- GregorianCalendar cal =
- new GregorianCalendar(year + 1900, month, date, hrs, min, sec);
- cal.set(Calendar.ZONE_OFFSET, 0);
- cal.set(Calendar.DST_OFFSET, 0);
- return cal.getTimeInMillis();
- }
-
- /**
- * Gets the time represented by this object.
- *
- * @return the time in milliseconds since the epoch.
- */
- public long getTime()
- {
- return time;
- }
-
- /**
- * Returns the number of minutes offset used with UTC to give the time
- * represented by this object in the current time zone. The date information
- * from this object is also used to determine whether or not daylight savings
- * time is in effect. For example, the offset for the UK would be 0 if the
- * month of the date object was January, and 1 if the month was August.
- *
- * @deprecated use
- * <code>Calendar.get(Calendar.ZONE_OFFSET)+Calendar.get(Calendar.DST_OFFSET)</code>
- * instead.
- * @return The time zone offset in minutes of the local time zone
- * relative to UTC. The time represented by this object is used to
- * determine if we should use daylight savings.
- */
- public int getTimezoneOffset()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return - (cal.get(Calendar.ZONE_OFFSET)
- + cal.get(Calendar.DST_OFFSET)) / (60 * 1000);
- }
-
- /**
- * Sets the time which this object should represent.
- *
- * @param time the time in milliseconds since the epoch.
- */
- public void setTime(long time)
- {
- this.time = time;
- }
-
- /**
- * Tests if this date is after the specified date.
- *
- * @param when the other date
- * @return true, if the date represented by this object is
- * strictly later than the time represented by when.
- */
- public boolean after(Date when)
- {
- return time > when.time;
- }
-
- /**
- * Tests if this date is before the specified date.
- *
- * @param when the other date
- * @return true, if the date represented by when is strictly later
- * than the time represented by this object.
- */
- public boolean before(Date when)
- {
- return time < when.time;
- }
-
- /**
- * Compares two dates for equality.
- *
- * @param obj the object to compare.
- * @return true, if obj is a Date object and the time represented
- * by obj is exactly the same as the time represented by this
- * object.
- */
- public boolean equals(Object obj)
- {
- return (obj instanceof Date && time == ((Date) obj).time);
- }
-
- /**
- * Compares two dates.
- *
- * @param when the other date.
- * @return 0, if the date represented
- * by obj is exactly the same as the time represented by this
- * object, a negative if this Date is before the other Date, and
- * a positive value otherwise.
- */
- public int compareTo(Date when)
- {
- return (time < when.time) ? -1 : (time == when.time) ? 0 : 1;
- }
-
- /**
- * Compares this Date to another object. This behaves like
- * <code>compareTo(Date)</code>, but it takes a generic object
- * and throws a <code>ClassCastException</code> if obj is
- * not a <code>Date</code>.
- *
- * @param obj the other date.
- * @return 0, if the date represented
- * by obj is exactly the same as the time represented by this
- * object, a negative if this Date is before the other Date, and
- * a positive value otherwise.
- * @exception ClassCastException if obj is not of type Date.
- */
- public int compareTo(Object obj)
- {
- return compareTo((Date) obj);
- }
-
- /**
- * Computes the hash code of this <code>Date</code> as the
- * XOR of the most significant and the least significant
- * 32 bits of the 64 bit milliseconds value.
- *
- * @return the hash code.
- */
- public int hashCode()
- {
- return (int) time ^ (int) (time >>> 32);
- }
-
- /**
- * <p>
- * Returns a string representation of this date using
- * the following date format:
- * </p>
- * <p>
- * <code>day mon dd hh:mm:ss zz yyyy</code>
- * </p>
- * <p>where the fields used here are:
- * <ul>
- * <li>
- * <code>day</code> -- the day of the week
- * (Sunday through to Saturday).
- * </li>
- * <li>
- * <code>mon</code> -- the month (Jan to Dec).
- * </li>
- * <li>
- * <code>dd</code> -- the day of the month
- * as two decimal digits (01 to 31).
- * </li>
- * <li>
- * <code>hh</code> -- the hour of the day
- * as two decimal digits in 24-hour clock notation
- * (01 to 23).
- * </li>
- * <li>
- * <code>mm</code> -- the minute of the day
- * as two decimal digits (01 to 59).
- * </li>
- * <li>
- * <code>ss</code> -- the second of the day
- * as two decimal digits (01 to 61).
- * </li>
- * <li>
- * <code>zz</code> -- the time zone information if available.
- * The possible time zones used include the abbreviations
- * recognised by <code>parse()</code> (e.g. GMT, CET, etc.)
- * and may reflect the fact that daylight savings time is in
- * effect. The empty string is used if there is no time zone
- * information.
- * </li>
- * <li>
- * <code>yyyy</code> -- the year as four decimal digits.
- * </li>
- * </ul>
- * <p>
- * The <code>DateFormat</code> class should now be
- * preferred over using this method.
- * </p>
- *
- * @return A string of the form 'day mon dd hh:mm:ss zz yyyy'
- * @see #parse(String)
- * @see DateFormat
- */
- public String toString()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- String day = "0" + cal.get(Calendar.DATE);
- String hour = "0" + cal.get(Calendar.HOUR_OF_DAY);
- String min = "0" + cal.get(Calendar.MINUTE);
- String sec = "0" + cal.get(Calendar.SECOND);
- String year = "000" + cal.get(Calendar.YEAR);
- return weekNames[cal.get(Calendar.DAY_OF_WEEK) - 1] + " "
- + monthNames[cal.get(Calendar.MONTH)] + " "
- + day.substring(day.length() - 2) + " "
- + hour.substring(hour.length() - 2) + ":"
- + min.substring(min.length() - 2) + ":"
- + sec.substring(sec.length() - 2) + " "
- +
- cal.getTimeZone().getDisplayName(cal.getTimeZone().inDaylightTime(this),
- TimeZone.SHORT) + " " +
- year.substring(year.length() - 4);
- }
-
- /**
- * Returns a locale-dependent string representation of this
- * <code>Date</code> object.
- *
- * @deprecated Use DateFormat.format(Date)
- * @return A locale-dependent string representation.
- * @see #parse(String)
- * @see DateFormat
- */
- public String toLocaleString()
- {
- return java.text.DateFormat.getInstance().format(this);
- }
-
- /**
- * <p>
- * Returns a string representation of this <code>Date</code>
- * object using GMT rather than the local timezone.
- * The following date format is used:
- * </p>
- * <p>
- * <code>d mon yyyy hh:mm:ss GMT</code>
- * </p>
- * <p>where the fields used here are:
- * <ul>
- * <li>
- * <code>d</code> -- the day of the month
- * as one or two decimal digits (1 to 31).
- * </li>
- * <li>
- * <code>mon</code> -- the month (Jan to Dec).
- * </li>
- * <li>
- * <code>yyyy</code> -- the year as four decimal digits.
- * </li>
- * <li>
- * <code>hh</code> -- the hour of the day
- * as two decimal digits in 24-hour clock notation
- * (01 to 23).
- * </li>
- * <li>
- * <code>mm</code> -- the minute of the day
- * as two decimal digits (01 to 59).
- * </li>
- * <li>
- * <code>ss</code> -- the second of the day
- * as two decimal digits (01 to 61).
- * </li>
- * <li>
- * <code>GMT</code> -- the literal string "GMT"
- * indicating Greenwich Mean Time as opposed to
- * the local timezone.
- * </li>
- * </ul>
- *
- * @deprecated Use DateFormat.format(Date) with a GMT TimeZone.
- * @return A string of the form 'd mon yyyy hh:mm:ss GMT' using
- * GMT as opposed to the local timezone.
- * @see #parse(String)
- * @see DateFormat
- */
- public String toGMTString()
- {
- java.text.DateFormat format = java.text.DateFormat.getInstance();
- format.setTimeZone(TimeZone.getTimeZone("GMT"));
- return format.format(this);
- }
-
- /**
- * Parses the time zone string.
- *
- * @param tok The token containing the time zone.
- * @param sign The sign (+ or -) used by the time zone.
- * @return An integer representing the number of minutes offset
- * from GMT for the time zone.
- */
- private static int parseTz(String tok, char sign)
- throws IllegalArgumentException
- {
- int num;
-
- try
- {
- // parseInt doesn't handle '+' so strip off sign.
- num = Integer.parseInt(tok.substring(1));
- }
- catch (NumberFormatException ex)
- {
- throw new IllegalArgumentException(tok);
- }
-
- // Convert hours to minutes.
- if (num < 24)
- num *= 60;
- else
- num = (num / 100) * 60 + num % 100;
-
- return sign == '-' ? -num : num;
- }
-
- /**
- * Parses the month string.
- *
- * @param tok the token containing the month.
- * @return An integer between 0 and 11, representing
- * a month from January (0) to December (11),
- * or -1 if parsing failed.
- */
- private static int parseMonth(String tok)
- {
- // Initialize strings for month names.
- // We could possibly use the fields of DateFormatSymbols but that is
- // localized and thus might not match the English words specified.
- String months[] = { "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY",
- "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER",
- "NOVEMBER", "DECEMBER" };
-
- int i;
- for (i = 0; i < 12; i++)
- if (months[i].startsWith(tok))
- return i;
-
- // Return -1 if not found.
- return -1;
- }
-
- /**
- * Parses the day of the week string.
- *
- * @param tok the token containing the day of the week.
- * @return true if the token was parsed successfully.
- */
- private static boolean parseDayOfWeek(String tok)
- {
- // Initialize strings for days of the week names.
- // We could possibly use the fields of DateFormatSymbols but that is
- // localized and thus might not match the English words specified.
- String daysOfWeek[] = { "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY",
- "THURSDAY", "FRIDAY", "SATURDAY" };
-
- int i;
- for (i = 0; i < 7; i++)
- if (daysOfWeek[i].startsWith(tok))
- return true;
-
- return false;
- }
-
- /**
- * <p>
- * Parses a String and returns the time, in milliseconds since the
- * epoch, it represents. Most syntaxes are handled, including
- * the IETF date standard "day, dd mon yyyy hh:mm:ss zz" (see
- * <code>toString()</code> for definitions of these fields).
- * Standard U.S. time zone abbreviations are recognised, in
- * addition to time zone offsets in positive or negative minutes.
- * If a time zone is specified, the specified time is assumed to
- * be in UTC and the appropriate conversion is applied, following
- * parsing, to convert this to the local time zone. If no zone
- * is specified, the time is assumed to already be in the local
- * time zone.
- * </p>
- * <p>
- * The method parses the string progressively from left to right.
- * At the end of the parsing process, either a time is returned
- * or an <code>IllegalArgumentException</code> is thrown to signify
- * failure. The ASCII characters A-Z, a-z, 0-9, and ',', '+', '-',
- * ':' and '/' are the only characters permitted within the string,
- * besides whitespace and characters enclosed within parantheses
- * '(' and ')'.
- * </p>
- * <p>
- * A sequence of consecutive digits are recognised as a number,
- * and interpreted as follows:
- * <ul>
- * <li>
- * A number preceded by a sign (+ or -) is taken to be a time zone
- * offset. The time zone offset can be specified in either hours
- * or minutes. The former is assumed if the number is less than 24.
- * Otherwise, the offset is assumed to be in minutes. A - indicates
- * a time zone west of GMT, while a + represents a time zone to the
- * east of GMT. The time zones are always assumed to be relative
- * to GMT, and a (redundant) specification of this can be included
- * with the time zone. For example, '-9', 'utc-9' and 'GMT-9' all
- * represent a time zone nine hours west of GMT. Similarly,
- * '+4', 'ut+4' and 'UTC+4' all give 4 hours east of GMT.
- * </li>
- * <li>
- * A number equal to or greater than 70 is regarded as a year specification.
- * Values lower than 70 are only assumed to indicate a year if both the
- * day of the month and the month itself have already been recognised.
- * Year values less than 100 are interpreted as being relative to the current
- * century when the <code>Date</code> class is initialised.. Given a century,
- * x, the year is assumed to be within the range x - 80 to x + 19. The value
- * itself is then used as a match against the two last digits of one of these
- * years. For example, take x to be 2004. A two-digit year is assumed to fall
- * within the range x - 80 (1924) and x + 19 (2023). Thus, any intepreted value
- * between 0 and 23 is assumed to be 2000 to 2023 and values between 24 and 99
- * are taken as being 1924 to 1999. This only applies for the case of 2004.
- * With a different year, the values will be interpreted differently. 2005
- * will used 0 to 24 as 2000 to 2024 and 25 to 99 as 1925 to 1999, for example.
- * This behaviour differs from that of <code>SimpleDateFormat</code> and is
- * time-dependent (a two-digit year will be interpreted differently depending
- * on the time the code is run).
- * </li>
- * <li>
- * Numbers followed by a colon are interpreted by first an hour, and then
- * as a minute, once an hour has been found.
- * </li>
- * <li>
- * <li>
- * Numbers followed by a slash are regarded first as a month, and then as
- * a day of the month once the month has been found. This follows the
- * U.S. date format of mm/dd, rather than the European dd/mm. Months
- * are converted to the recognised value - 1 before storage, in order
- * to put the number within the range 0 to 11.
- * </li>
- * <li>
- * Numbers followed by commas, whitespace, hyphens or the end of the string
- * are interpreted in the following order: hour, minute, second, day of month.
- * The first type not already recognised in the current string being parsed is
- * assumed.
- * </li>
- * </ul>
- * </p>
- * <p>
- * A sequence of consecutive alphabetic characters is recognised as a word,
- * and interpreted as follows, in a case-insentive fashion:
- * <ul>
- * <li>
- * The characters 'AM' or 'PM' restrict the hour value to a value between 0
- * and 12. In the latter case, 12 is added to the hour value before storage.
- * </li>
- * <li>
- * Any words which match any prefix of one of the days of the week ('Monday',
- * 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' and 'Sunday'),
- * are simply ignored.
- * </li>
- * <li>
- * Any words which match any prefix of one of the months of the year ('January',
- * 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
- * 'October', 'November', 'December') are recognised and interpreted as the
- * appropriate value between 0 and 11. The first match made against a
- * month is the one used, in the order specified here. For example, 'Ma' is
- * intepreted as 'March' (2) and not as 'May' (4). Similarly, 'Ju' is 'June',
- * and not 'July'.
- * </li>
- * <li>
- * The words 'GMT', 'UT' and 'UTC' are interpreted as specifying UTC as the
- * time zone in use for this date.
- * </li>
- * <li>
- * The word pairs 'EST'/'EDT', 'CST'/'CDT', 'MST'/'MDT' and 'PST'/'PDT' are
- * interpreted as the appropriate U.S. time zone abbreviation. Each pair
- * is the standard and daylight savings time zone specification, respectively,
- * for each zone within the U.S, these being Eastern Standard/Daylight Time
- * (-5), Central Standard/Daylight Time (-6), Mountain Standard/Daylight Time
- * (-7) and Pacific Standard/Daylight Time (-8).
- * </li>
- * </ul>
- *
- * @param s The String to parse.
- * @return The time in milliseconds since the epoch.
- * @throws IllegalArgumentException if the string fails to parse.
- * @deprecated Use DateFormat.parse(String)
- * @see #toString()
- * @see SimpleDateFormat
- */
- public static long parse(String string)
- {
- // Initialize date/time fields before parsing begins.
- int year = -1;
- int month = -1;
- int day = -1;
- int hour = -1;
- int minute = -1;
- int second = -1;
- int timezone = 0;
- boolean localTimezone = true;
-
- // Trim out any nested stuff in parentheses now to make parsing easier.
- StringBuffer buf = new StringBuffer();
- int parenNesting = 0;
- int len = string.length();
- for (int i = 0; i < len; i++)
- {
- char ch = string.charAt(i);
- if (ch >= 'a' && ch <= 'z')
- ch -= 'a' - 'A';
- if (ch == '(')
- parenNesting++;
- else if (parenNesting == 0)
- buf.append(ch);
- else if (ch == ')')
- parenNesting--;
- }
- int tmpMonth;
-
- // Make all chars upper case to simplify comparisons later.
- // Also ignore commas; treat them as delimiters.
- StringTokenizer strtok = new StringTokenizer(buf.toString(), " \t\n\r,");
-
- while (strtok.hasMoreTokens())
- {
- String tok = strtok.nextToken();
- char firstch = tok.charAt(0);
- if ((firstch == '+' || firstch == '-') && year >= 0)
- {
- timezone = parseTz(tok, firstch);
- localTimezone = false;
- }
- else if (firstch >= '0' && firstch <= '9')
- {
- while (tok != null && tok.length() > 0)
- {
- int punctOffset = tok.length();
- int num = 0;
- int punct;
- for (int i = 0; ; i++)
- {
- if (i >= punctOffset)
- {
- punct = -1;
- break;
- }
- else
- {
- punct = tok.charAt(i);
- if (punct >= '0' && punct <= '9')
- {
- if (num > 999999999) // in case of overflow
- throw new IllegalArgumentException(tok);
- num = 10 * num + (punct - '0');
- }
- else
- {
- punctOffset = i;
- break;
- }
- }
-
- }
-
- if (punct == ':')
- {
- if (hour < 0)
- hour = num;
- else
- minute = num;
- }
- else if ((num >= 70
- && (punct == ' ' || punct == ','
- || punct == '/' || punct < 0))
- || (num < 70 && day >= 0 && month >= 0 && year < 0))
- {
- if (num >= 100)
- year = num;
- else
- {
- int curYear = 1900 + new Date().getYear();
- int firstYear = curYear - 80;
- year = firstYear / 100 * 100 + num;
- if (year < firstYear)
- year += 100;
- }
- }
- else if (punct == '/')
- {
- if (month < 0)
- month = num - 1;
- else
- day = num;
- }
- else if (hour >= 0 && minute < 0)
- minute = num;
- else if (minute >= 0 && second < 0)
- second = num;
- else if (day < 0)
- day = num;
- else
- throw new IllegalArgumentException(tok);
-
- // Advance string if there's more to process in this token.
- if (punct < 0 || punctOffset + 1 >= tok.length())
- tok = null;
- else
- tok = tok.substring(punctOffset + 1);
- }
- }
- else if (firstch >= 'A' && firstch <= 'Z')
- {
- if (tok.equals("AM"))
- {
- if (hour < 1 || hour > 12)
- throw new IllegalArgumentException(tok);
- if (hour == 12)
- hour = 0;
- }
- else if (tok.equals("PM"))
- {
- if (hour < 1 || hour > 12)
- throw new IllegalArgumentException(tok);
- if (hour < 12)
- hour += 12;
- }
- else if (parseDayOfWeek(tok))
- ; // Ignore it; throw the token away.
- else if (tok.equals("UT") || tok.equals("UTC") || tok.equals("GMT"))
- localTimezone = false;
- else if (tok.startsWith("UT") || tok.startsWith("GMT"))
- {
- int signOffset = 3;
- if (tok.charAt(1) == 'T' && tok.charAt(2) != 'C')
- signOffset = 2;
-
- char sign = tok.charAt(signOffset);
- if (sign != '+' && sign != '-')
- throw new IllegalArgumentException(tok);
-
- timezone = parseTz(tok.substring(signOffset), sign);
- localTimezone = false;
- }
- else if ((tmpMonth = parseMonth(tok)) >= 0)
- month = tmpMonth;
- else if (tok.length() == 3 && tok.charAt(2) == 'T')
- {
- // Convert timezone offset from hours to minutes.
- char ch = tok.charAt(0);
- if (ch == 'E')
- timezone = -5 * 60;
- else if (ch == 'C')
- timezone = -6 * 60;
- else if (ch == 'M')
- timezone = -7 * 60;
- else if (ch == 'P')
- timezone = -8 * 60;
- else
- throw new IllegalArgumentException(tok);
-
- // Shift 60 minutes for Daylight Savings Time.
- if (tok.charAt(1) == 'D')
- timezone += 60;
- else if (tok.charAt(1) != 'S')
- throw new IllegalArgumentException(tok);
-
- localTimezone = false;
- }
- else
- throw new IllegalArgumentException(tok);
- }
- else
- throw new IllegalArgumentException(tok);
- }
-
- // Unspecified hours, minutes, or seconds should default to 0.
- if (hour < 0)
- hour = 0;
- if (minute < 0)
- minute = 0;
- if (second < 0)
- second = 0;
-
- // Throw exception if any other fields have not been recognized and set.
- if (year < 0 || month < 0 || day < 0)
- throw new IllegalArgumentException("Missing field");
-
- // Return the time in either local time or relative to GMT as parsed.
- // If no time-zone was specified, get the local one (in minutes) and
- // convert to milliseconds before adding to the UTC.
- GregorianCalendar cal
- = new GregorianCalendar(year, month, day, hour, minute, second);
- if (!localTimezone)
- {
- cal.set(Calendar.ZONE_OFFSET, timezone * 60 * 1000);
- cal.set(Calendar.DST_OFFSET, 0);
- }
- return cal.getTimeInMillis();
- }
-
- /**
- * Returns the difference between the year represented by this
- * <code>Date</code> object and 1900.
- *
- * @return the year minus 1900 represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.YEAR)
- * instead. Note the 1900 difference in the year.
- * @see Calendar
- * @see #setYear(int)
- */
- public int getYear()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.YEAR) - 1900;
- }
-
- /**
- * Sets the year to the specified year, plus 1900. The other
- * fields are only altered as required to match the same date
- * and time in the new year. Usually, this will mean that
- * the fields are not changed at all, but in the case of
- * a leap day or leap second, the fields will change in
- * relation to the existence of such an event in the new year.
- * For example, if the date specifies February the 29th, 2000,
- * then this will become March the 1st if the year is changed
- * to 2001, as 2001 is not a leap year. Similarly, a seconds
- * value of 60 or 61 may result in the seconds becoming 0 and
- * the minute increasing by 1, if the new time does not include
- * a leap second.
- *
- * @param year the year minus 1900.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.YEAR, year) instead. Note about the 1900
- * difference in year.
- * @see #getYear()
- * @see Calendar
- */
- public void setYear(int year)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.YEAR, 1900 + year);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the month represented by this <code>Date</code> object,
- * as a value between 0 (January) and 11 (December).
- *
- * @return the month represented by this date object (zero based).
- * @deprecated Use Calendar instead of Date, and use get(Calendar.MONTH)
- * instead.
- * @see #setMonth(int)
- * @see Calendar
- */
- public int getMonth()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.MONTH);
- }
-
- /**
- * Sets the month to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time in the new month. In most
- * cases, the other fields won't change at all. However,
- * in the case of a shorter month or a leap second, values
- * may be adjusted. For example, if the day of the month
- * is currently 31, and the month value is changed from
- * January (0) to September (8), the date will become
- * October the 1st, as September only has 30 days. Similarly,
- * a seconds value of 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1, if the new time does
- * not include a leap second.
- *
- * @param month the month, with a zero-based index
- * from January.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.MONTH, month) instead.
- * @see #getMonth()
- * @see Calendar
- */
- public void setMonth(int month)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.MONTH, month);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the day of the month of this <code>Date</code>
- * object, as a value between 0 and 31.
- *
- * @return the day of month represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.DATE)
- * instead.
- * @see Calendar
- * @see #setDate(int)
- */
- public int getDate()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.DATE);
- }
-
- /**
- * Sets the date to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time on the new day of the month. In most
- * cases, the other fields won't change at all. However,
- * in the case of a leap second or the day being out of
- * the range of the current month, values
- * may be adjusted. For example, if the day of the month
- * is currently 30 and the month is June, a new day of the
- * month value of 31 will cause the month to change to July,
- * as June only has 30 days . Similarly,
- * a seconds value of 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1, if the new time does
- * not include a leap second.
- *
- * @param date the date.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.DATE, date) instead.
- * @see Calendar
- * @see #getDate()
- */
- public void setDate(int date)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.DATE, date);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the day represented by this <code>Date</code>
- * object as an integer between 0 (Sunday) and 6 (Saturday).
- *
- * @return the day represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.DAY_OF_WEEK)
- * instead.
- * @see Calendar
- */
- public int getDay()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- // For Calendar, Sunday is 1. For Date, Sunday is 0.
- return cal.get(Calendar.DAY_OF_WEEK) - 1;
- }
-
- /**
- * Returns the hours represented by this <code>Date</code>
- * object as an integer between 0 and 23.
- *
- * @return the hours represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.HOUR_OF_DAY)
- * instead.
- * @see Calendar
- * @see #setHours(int)
- */
- public int getHours()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.HOUR_OF_DAY);
- }
-
- /**
- * Sets the hours to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time in the new hour. In most
- * cases, the other fields won't change at all. However,
- * in the case of a leap second, values
- * may be adjusted. For example,
- * a seconds value of 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1 if the new hour does
- * not contain a leap second.
- *
- * @param hours the hours.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.HOUR_OF_DAY, hours) instead.
- * @see Calendar
- * @see #getHours()
- */
- public void setHours(int hours)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.HOUR_OF_DAY, hours);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the number of minutes represented by the <code>Date</code>
- * object, as an integer between 0 and 59.
- *
- * @return the minutes represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.MINUTE)
- * instead.
- * @see Calendar
- * @see #setMinutes(int)
- */
- public int getMinutes()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.MINUTE);
- }
-
- /**
- * Sets the minutes to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time in the new minute. In most
- * cases, the other fields won't change at all. However,
- * in the case of a leap second, values
- * may be adjusted. For example,
- * a seconds value of 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1 if the new minute does
- * not contain a leap second.
- *
- * @param minutes the minutes.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.MINUTE, minutes) instead.
- * @see Calendar
- * @see #getMinutes()
- */
- public void setMinutes(int minutes)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.MINUTE, minutes);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the number of seconds represented by the <code>Date</code>
- * object, as an integer between 0 and 61 (60 and 61 being leap seconds).
- *
- * @return the seconds represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.SECOND)
- * instead.
- * @see Calendar
- * @see #setSeconds(int)
- */
- public int getSeconds()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.SECOND);
- }
-
- /**
- * Sets the seconds to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time in the new minute. In most
- * cases, the other fields won't change at all. However,
- * in the case of a leap second, values
- * may be adjusted. For example, setting the
- * seconds value to 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1, if the current time does
- * not contain a leap second.
- *
- * @param seconds the seconds.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.SECOND, seconds) instead.
- * @see Calendar
- * @see #getSeconds()
- */
- public void setSeconds(int seconds)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.SECOND, seconds);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Deserializes a <code>Date</code> object from an
- * input stream, setting the time (in milliseconds
- * since the epoch) to the long value read from the
- * stream.
- *
- * @param input the input stream.
- * @throws IOException if an I/O error occurs in the stream.
- * @throws ClassNotFoundException if the class of the
- * serialized object could not be found.
- */
- private void readObject(ObjectInputStream input)
- throws IOException, ClassNotFoundException
- {
- input.defaultReadObject();
- time = input.readLong();
- }
-
- /**
- * Serializes a <code>Date</code> object to an output stream,
- * storing the time (in milliseconds since the epoch) as a long
- * value in the stream.
- *
- * @serialdata A long value representing the offset from the epoch
- * in milliseconds. This is the same value that is returned by the
- * method getTime().
- * @param output the output stream.
- * @throws IOException if an I/O error occurs in the stream.
- */
- private void writeObject(ObjectOutputStream output)
- throws IOException
- {
- output.defaultWriteObject();
- output.writeLong(time);
- }
-
-}
diff --git a/libjava/java/util/GregorianCalendar.java b/libjava/java/util/GregorianCalendar.java
index e7a961880cf..dc77c2f5024 100644
--- a/libjava/java/util/GregorianCalendar.java
+++ b/libjava/java/util/GregorianCalendar.java
@@ -871,6 +871,17 @@ public class GregorianCalendar extends Calendar
areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true;
}
+
+ /**
+ * Return a hash code for this object, following the general contract
+ * specified by {@link Object#hashCode()}.
+ * @return the hash code
+ */
+ public int hashCode()
+ {
+ int val = (int) ((gregorianCutover >>> 32) ^ (gregorianCutover & 0xffffffff));
+ return super.hashCode() ^ val;
+ }
/**
* Compares the given calendar with this. An object, o, is
@@ -893,7 +904,8 @@ public class GregorianCalendar extends Calendar
return false;
GregorianCalendar cal = (GregorianCalendar) o;
- return (cal.getTimeInMillis() == getTimeInMillis());
+ return (cal.gregorianCutover == gregorianCutover
+ && super.equals(o));
}
/**
diff --git a/libjava/java/util/ResourceBundle.java b/libjava/java/util/ResourceBundle.java
index fac3b116607..19dd3cdf19f 100644
--- a/libjava/java/util/ResourceBundle.java
+++ b/libjava/java/util/ResourceBundle.java
@@ -359,7 +359,7 @@ public abstract class ResourceBundle
*
* @param baseName the name of the ResourceBundle
* @param locale A locale
- * @param classloader a ClassLoader
+ * @param classLoader a ClassLoader
* @return the desired resource bundle
* @throws MissingResourceException if the resource bundle can't be found
* @throws NullPointerException if any argument is null
diff --git a/libjava/java/util/SimpleTimeZone.java b/libjava/java/util/SimpleTimeZone.java
deleted file mode 100644
index f754d22b3b4..00000000000
--- a/libjava/java/util/SimpleTimeZone.java
+++ /dev/null
@@ -1,1078 +0,0 @@
-/* java.util.SimpleTimeZone
- Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util;
-
-
-/**
- * This class represents a simple time zone offset and handles
- * daylight savings. It can only handle one daylight savings rule, so
- * it can't represent historical changes.
- *
- * This object is tightly bound to the Gregorian calendar. It assumes
- * a regular seven days week, and the month lengths are that of the
- * Gregorian Calendar. It can only handle daylight savings for years
- * lying in the AD era.
- *
- * @see Calendar
- * @see GregorianCalender
- * @author Jochen Hoenicke
- */
-public class SimpleTimeZone extends TimeZone
-{
- /**
- * The raw time zone offset in milliseconds to GMT, ignoring
- * daylight savings.
- * @serial
- */
- private int rawOffset;
-
- /**
- * True, if this timezone uses daylight savings, false otherwise.
- * @serial
- */
- private boolean useDaylight;
-
- /**
- * The daylight savings offset. This is a positive offset in
- * milliseconds with respect to standard time. Typically this
- * is one hour, but for some time zones this may be half an hour.
- * @serial
- * @since JDK1.1.4
- */
- private int dstSavings = 60 * 60 * 1000;
-
- /**
- * The first year, in which daylight savings rules applies.
- * @serial
- */
- private int startYear;
- private static final int DOM_MODE = 1;
- private static final int DOW_IN_MONTH_MODE = 2;
- private static final int DOW_GE_DOM_MODE = 3;
- private static final int DOW_LE_DOM_MODE = 4;
-
- /**
- * The mode of the start rule. This takes one of the following values:
- * <dl>
- * <dt>DOM_MODE (1)</dt>
- * <dd> startDay contains the day in month of the start date,
- * startDayOfWeek is unused. </dd>
- * <dt>DOW_IN_MONTH_MODE (2)</dt>
- * <dd> The startDay gives the day of week in month, and
- * startDayOfWeek the day of week. For example startDay=2 and
- * startDayOfWeek=Calender.SUNDAY specifies that the change is on
- * the second sunday in that month. You must make sure, that this
- * day always exists (ie. don't specify the 5th sunday).
- * </dd>
- * <dt>DOW_GE_DOM_MODE (3)</dt>
- * <dd> The start is on the first startDayOfWeek on or after
- * startDay. For example startDay=13 and
- * startDayOfWeek=Calendar.FRIDAY specifies that the daylight
- * savings start on the first FRIDAY on or after the 13th of that
- * Month. Make sure that the change is always in the given month, or
- * the result is undefined.
- * </dd>
- * <dt>DOW_LE_DOM_MONTH (4)</dt>
- * <dd> The start is on the first startDayOfWeek on or before the
- * startDay. Make sure that the change is always in the given
- * month, or the result is undefined.
- </dd>
- * </dl>
- * @serial */
- private int startMode;
-
- /**
- * The month in which daylight savings start. This is one of the
- * constants Calendar.JANUARY, ..., Calendar.DECEMBER.
- * @serial
- */
- private int startMonth;
-
- /**
- * This variable can have different meanings. See startMode for details
- * @see #startMode;
- * @serial
- */
- private int startDay;
-
- /**
- * This variable specifies the day of week the change takes place. If
- * startMode == DOM_MODE, this is undefined.
- * @serial
- * @see #startMode;
- */
- private int startDayOfWeek;
-
- /**
- * This variable specifies the time of change to daylight savings.
- * This time is given in milliseconds after midnight local
- * standard time.
- * @serial
- */
- private int startTime;
-
- /**
- * This variable specifies the mode that startTime is specified in. By
- * default it is WALL_TIME, but can also be STANDARD_TIME or UTC_TIME. For
- * startTime, STANDARD_TIME and WALL_TIME are equivalent.
- * @serial
- */
- private int startTimeMode = WALL_TIME;
-
- /**
- * The month in which daylight savings ends. This is one of the
- * constants Calendar.JANUARY, ..., Calendar.DECEMBER.
- * @serial
- */
- private int endMonth;
-
- /**
- * This variable gives the mode for the end of daylight savings rule.
- * It can take the same values as startMode.
- * @serial
- * @see #startMode
- */
- private int endMode;
-
- /**
- * This variable can have different meanings. See startMode for details
- * @serial
- * @see #startMode;
- */
- private int endDay;
-
- /**
- * This variable specifies the day of week the change takes place. If
- * endMode == DOM_MODE, this is undefined.
- * @serial
- * @see #startMode;
- */
- private int endDayOfWeek;
-
- /**
- * This variable specifies the time of change back to standard time.
- * This time is given in milliseconds after midnight local
- * standard time.
- * @serial
- */
- private int endTime;
-
- /**
- * This variable specifies the mode that endTime is specified in. By
- * default it is WALL_TIME, but can also be STANDARD_TIME or UTC_TIME.
- * @serial
- */
- private int endTimeMode = WALL_TIME;
-
- /**
- * This variable points to a deprecated array from JDK 1.1. It is
- * ignored in JDK 1.2 but streamed out for compatibility with JDK 1.1.
- * The array contains the lengths of the months in the year and is
- * assigned from a private static final field to avoid allocating
- * the array for every instance of the object.
- * Note that static final fields are not serialized.
- * @serial
- */
- private byte[] monthLength = monthArr;
- private static final byte[] monthArr =
- {
- 31, 28, 31, 30, 31, 30, 31, 31, 30,
- 31, 30, 31
- };
-
- /**
- * The version of the serialized data on the stream.
- * <dl>
- * <dt>0 or not present on stream</dt>
- * <dd> JDK 1.1.3 or earlier, only provides this fields:
- * rawOffset, startDay, startDayOfWeek, startMonth, startTime,
- * startYear, endDay, endDayOfWeek, endMonth, endTime
- * </dd>
- * <dd> JDK 1.1.4 or later. This includes three new fields, namely
- * startMode, endMode and dstSavings. And there is a optional section
- * as described in writeObject.
- * </dd>
- * </dl>
- *
- * XXX - JDK 1.2 Beta 4 docu states 1.1.4, but my 1.1.5 has the old
- * version.
- *
- * When streaming out this class it is always written in the latest
- * version.
- * @serial
- * @since JDK1.1.4
- */
- private int serialVersionOnStream = 2;
- private static final long serialVersionUID = -403250971215465050L;
-
- /**
- * Constant to indicate that start and end times are specified in standard
- * time, without adjusting for daylight savings.
- */
- public static final int STANDARD_TIME = 1;
-
- /**
- * Constant to indicate that start and end times are specified in wall
- * time, adjusting for daylight savings. This is the default.
- */
- public static final int WALL_TIME = 0;
-
- /**
- * Constant to indicate that start and end times are specified in UTC.
- */
- public static final int UTC_TIME = 2;
-
- /**
- * Create a <code>SimpleTimeZone</code> with the given time offset
- * from GMT and without daylight savings.
- * @param rawOffset the time offset from GMT in milliseconds.
- * @param id The identifier of this time zone.
- */
- public SimpleTimeZone(int rawOffset, String id)
- {
- this.rawOffset = rawOffset;
- setID(id);
- useDaylight = false;
- startYear = 0;
- }
-
- /**
- * Create a <code>SimpleTimeZone</code> with the given time offset
- * from GMT and with daylight savings. The start/end parameters
- * can have different meaning (replace WEEKDAY with a real day of
- * week). Only the first two meanings were supported by earlier
- * versions of jdk.
- *
- * <dl>
- * <dt><code>day &gt; 0, dayOfWeek = Calendar.WEEKDAY</code></dt>
- * <dd>The start/end of daylight savings is on the <code>day</code>-th
- * <code>WEEKDAY</code> in the given month. </dd>
- * <dt><code>day &lt; 0, dayOfWeek = Calendar.WEEKDAY</code></dt>
- * <dd>The start/end of daylight savings is on the <code>-day</code>-th
- * <code>WEEKDAY</code> counted from the <i>end</i> of the month. </dd>
- * <dt><code>day &gt; 0, dayOfWeek = 0</code></dt>
- * <dd>The start/end of daylight is on the <code>day</code>-th day of
- * the month. </dd>
- * <dt><code>day &gt; 0, dayOfWeek = -Calendar.WEEKDAY</code></dt>
- * <dd>The start/end of daylight is on the first WEEKDAY on or after
- * the <code>day</code>-th day of the month. You must make sure that
- * this day lies in the same month. </dd>
- * <dt><code>day &lt; 0, dayOfWeek = -Calendar.WEEKDAY</code></dt>
- * <dd>The start/end of daylight is on the first WEEKDAY on or
- * <i>before</i> the <code>-day</code>-th day of the month. You
- * must make sure that this day lies in the same month. </dd>
- * </dl>
- *
- * If you give a non existing month, a day that is zero, or too big,
- * or a dayOfWeek that is too big, the result is undefined.
- *
- * The start rule must have a different month than the end rule.
- * This restriction shouldn't hurt for all possible time zones.
- *
- * @param rawOffset The time offset from GMT in milliseconds.
- * @param id The identifier of this time zone.
- * @param startMonth The start month of daylight savings; use the
- * constants in Calendar.
- * @param startday A day in month or a day of week number, as
- * described above.
- * @param startDayOfWeek The start rule day of week; see above.
- * @param startTime A time in millis in standard time.
- * @param endMonth The end month of daylight savings; use the
- * constants in Calendar.
- * @param endday A day in month or a day of week number, as
- * described above.
- * @param endDayOfWeek The end rule day of week; see above.
- * @param endTime A time in millis in standard time.
- * @throws IllegalArgumentException if parameters are invalid or out of
- * range.
- */
- public SimpleTimeZone(int rawOffset, String id, int startMonth,
- int startDayOfWeekInMonth, int startDayOfWeek,
- int startTime, int endMonth, int endDayOfWeekInMonth,
- int endDayOfWeek, int endTime)
- {
- this.rawOffset = rawOffset;
- setID(id);
- useDaylight = true;
-
- setStartRule(startMonth, startDayOfWeekInMonth, startDayOfWeek, startTime);
- setEndRule(endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime);
- if (startMonth == endMonth)
- throw new IllegalArgumentException("startMonth and endMonth must be different");
- this.startYear = 0;
- }
-
- /**
- * This constructs a new SimpleTimeZone that supports a daylight savings
- * rule. The parameter are the same as for the constructor above, except
- * there is the additional dstSavaings parameter.
- *
- * @param dstSavings the amount of savings for daylight savings
- * time in milliseconds. This must be positive.
- * @since 1.2
- */
- public SimpleTimeZone(int rawOffset, String id, int startMonth,
- int startDayOfWeekInMonth, int startDayOfWeek,
- int startTime, int endMonth, int endDayOfWeekInMonth,
- int endDayOfWeek, int endTime, int dstSavings)
- {
- this(rawOffset, id, startMonth, startDayOfWeekInMonth, startDayOfWeek,
- startTime, endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime);
-
- this.dstSavings = dstSavings;
- }
-
- /**
- * This constructs a new SimpleTimeZone that supports a daylight savings
- * rule. The parameter are the same as for the constructor above, except
- * there are the additional startTimeMode, endTimeMode, and dstSavings
- * parameters.
- *
- * @param startTimeMode the mode that start times are specified in. One of
- * WALL_TIME, STANDARD_TIME, or UTC_TIME.
- * @param endTimeMode the mode that end times are specified in. One of
- * WALL_TIME, STANDARD_TIME, or UTC_TIME.
- * @param dstSavings the amount of savings for daylight savings
- * time in milliseconds. This must be positive.
- * @throws IllegalArgumentException if parameters are invalid or out of
- * range.
- * @since 1.4
- */
- public SimpleTimeZone(int rawOffset, String id, int startMonth,
- int startDayOfWeekInMonth, int startDayOfWeek,
- int startTime, int startTimeMode, int endMonth,
- int endDayOfWeekInMonth, int endDayOfWeek,
- int endTime, int endTimeMode, int dstSavings)
- {
- this.rawOffset = rawOffset;
- setID(id);
- useDaylight = true;
-
- if (startTimeMode < WALL_TIME || startTimeMode > UTC_TIME)
- throw new IllegalArgumentException("startTimeMode must be one of WALL_TIME, STANDARD_TIME, or UTC_TIME");
- if (endTimeMode < WALL_TIME || endTimeMode > UTC_TIME)
- throw new IllegalArgumentException("endTimeMode must be one of WALL_TIME, STANDARD_TIME, or UTC_TIME");
- this.startTimeMode = startTimeMode;
- this.endTimeMode = endTimeMode;
-
- setStartRule(startMonth, startDayOfWeekInMonth, startDayOfWeek, startTime);
- setEndRule(endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime);
- if (startMonth == endMonth)
- throw new IllegalArgumentException("startMonth and endMonth must be different");
- this.startYear = 0;
-
- this.dstSavings = dstSavings;
- }
-
- /**
- * Sets the first year, where daylight savings applies. The daylight
- * savings rule never apply for years in the BC era. Note that this
- * is gregorian calendar specific.
- * @param year the start year.
- */
- public void setStartYear(int year)
- {
- startYear = year;
- useDaylight = true;
- }
-
- /**
- * Checks if the month, day, dayOfWeek arguments are in range and
- * returns the mode of the rule.
- * @param month the month parameter as in the constructor
- * @param day the day parameter as in the constructor
- * @param dayOfWeek the day of week parameter as in the constructor
- * @return the mode of this rule see startMode.
- * @exception IllegalArgumentException if parameters are out of range.
- * @see #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)
- * @see #startMode
- */
- private int checkRule(int month, int day, int dayOfWeek)
- {
- if (month < 0 || month > 11)
- throw new IllegalArgumentException("month out of range");
-
- int daysInMonth = getDaysInMonth(month, 1);
- if (dayOfWeek == 0)
- {
- if (day <= 0 || day > daysInMonth)
- throw new IllegalArgumentException("day out of range");
- return DOM_MODE;
- }
- else if (dayOfWeek > 0)
- {
- if (Math.abs(day) > (daysInMonth + 6) / 7)
- throw new IllegalArgumentException("dayOfWeekInMonth out of range");
- if (dayOfWeek > Calendar.SATURDAY)
- throw new IllegalArgumentException("dayOfWeek out of range");
- return DOW_IN_MONTH_MODE;
- }
- else
- {
- if (day == 0 || Math.abs(day) > daysInMonth)
- throw new IllegalArgumentException("day out of range");
- if (dayOfWeek < -Calendar.SATURDAY)
- throw new IllegalArgumentException("dayOfWeek out of range");
- if (day < 0)
- return DOW_LE_DOM_MODE;
- else
- return DOW_GE_DOM_MODE;
- }
- }
-
- /**
- * Sets the daylight savings start rule. You must also set the
- * end rule with <code>setEndRule</code> or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * @param month The month where daylight savings start, zero
- * based. You should use the constants in Calendar.
- * @param day A day of month or day of week in month.
- * @param dayOfWeek The day of week where daylight savings start.
- * @param time The time in milliseconds standard time where daylight
- * savings start.
- * @see SimpleTimeZone
- */
- public void setStartRule(int month, int day, int dayOfWeek, int time)
- {
- this.startMode = checkRule(month, day, dayOfWeek);
- this.startMonth = month;
- this.startDay = day;
- this.startDayOfWeek = Math.abs(dayOfWeek);
- if (this.startTimeMode == WALL_TIME || this.startTimeMode == STANDARD_TIME)
- this.startTime = time;
- else
- // Convert from UTC to STANDARD
- this.startTime = time + this.rawOffset;
- useDaylight = true;
- }
-
- /**
- * Sets the daylight savings start rule. You must also set the
- * end rule with <code>setEndRule</code> or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * Note that this API isn't incredibly well specified. It appears that the
- * after flag must override the parameters, since normally, the day and
- * dayofweek can select this. I.e., if day < 0 and dayOfWeek < 0, on or
- * before mode is chosen. But if after == true, this implementation
- * overrides the signs of the other arguments. And if dayOfWeek == 0, it
- * falls back to the behavior in the other APIs. I guess this should be
- * checked against Sun's implementation.
- *
- * @param month The month where daylight savings start, zero
- * based. You should use the constants in Calendar.
- * @param day A day of month or day of week in month.
- * @param dayOfWeek The day of week where daylight savings start.
- * @param time The time in milliseconds standard time where daylight
- * savings start.
- * @param after If true, day and dayOfWeek specify first day of week on or
- * after day, else first day of week on or before.
- * @since 1.2
- * @see SimpleTimeZone
- */
- public void setStartRule(int month, int day, int dayOfWeek, int time,
- boolean after)
- {
- // FIXME: XXX: Validate that checkRule and offset processing work with on
- // or before mode.
- this.startDay = after ? Math.abs(day) : -Math.abs(day);
- this.startDayOfWeek = after ? Math.abs(dayOfWeek) : -Math.abs(dayOfWeek);
- this.startMode = (dayOfWeek != 0)
- ? (after ? DOW_GE_DOM_MODE : DOW_LE_DOM_MODE)
- : checkRule(month, day, dayOfWeek);
- this.startDay = Math.abs(this.startDay);
- this.startDayOfWeek = Math.abs(this.startDayOfWeek);
-
- this.startMonth = month;
-
- if (this.startTimeMode == WALL_TIME || this.startTimeMode == STANDARD_TIME)
- this.startTime = time;
- else
- // Convert from UTC to STANDARD
- this.startTime = time + this.rawOffset;
- useDaylight = true;
- }
-
- /**
- * Sets the daylight savings start rule. You must also set the
- * end rule with <code>setEndRule</code> or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * @param month The month where daylight savings start, zero
- * based. You should use the constants in Calendar.
- * @param day A day of month or day of week in month.
- * @param time The time in milliseconds standard time where daylight
- * savings start.
- * @see SimpleTimeZone
- * @since 1.2
- */
- public void setStartRule(int month, int day, int time)
- {
- setStartRule(month, day, 0, time);
- }
-
- /**
- * Sets the daylight savings end rule. You must also set the
- * start rule with <code>setStartRule</code> or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * @param month The end month of daylight savings.
- * @param day A day in month, or a day of week in month.
- * @param dayOfWeek A day of week, when daylight savings ends.
- * @param time A time in millis in standard time.
- * @see #setStartRule
- */
- public void setEndRule(int month, int day, int dayOfWeek, int time)
- {
- this.endMode = checkRule(month, day, dayOfWeek);
- this.endMonth = month;
- this.endDay = day;
- this.endDayOfWeek = Math.abs(dayOfWeek);
- if (this.endTimeMode == WALL_TIME)
- this.endTime = time;
- else if (this.endTimeMode == STANDARD_TIME)
- // Convert from STANDARD to DST
- this.endTime = time + this.dstSavings;
- else
- // Convert from UTC to DST
- this.endTime = time + this.rawOffset + this.dstSavings;
- useDaylight = true;
- }
-
- /**
- * Sets the daylight savings end rule. You must also set the
- * start rule with <code>setStartRule</code> or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * Note that this API isn't incredibly well specified. It appears that the
- * after flag must override the parameters, since normally, the day and
- * dayofweek can select this. I.e., if day < 0 and dayOfWeek < 0, on or
- * before mode is chosen. But if after == true, this implementation
- * overrides the signs of the other arguments. And if dayOfWeek == 0, it
- * falls back to the behavior in the other APIs. I guess this should be
- * checked against Sun's implementation.
- *
- * @param month The end month of daylight savings.
- * @param day A day in month, or a day of week in month.
- * @param dayOfWeek A day of week, when daylight savings ends.
- * @param time A time in millis in standard time.
- * @param after If true, day and dayOfWeek specify first day of week on or
- * after day, else first day of week on or before.
- * @since 1.2
- * @see #setStartRule
- */
- public void setEndRule(int month, int day, int dayOfWeek, int time,
- boolean after)
- {
- // FIXME: XXX: Validate that checkRule and offset processing work with on
- // or before mode.
- this.endDay = after ? Math.abs(day) : -Math.abs(day);
- this.endDayOfWeek = after ? Math.abs(dayOfWeek) : -Math.abs(dayOfWeek);
- this.endMode = (dayOfWeek != 0)
- ? (after ? DOW_GE_DOM_MODE : DOW_LE_DOM_MODE)
- : checkRule(month, day, dayOfWeek);
- this.endDay = Math.abs(this.endDay);
- this.endDayOfWeek = Math.abs(endDayOfWeek);
-
- this.endMonth = month;
-
- if (this.endTimeMode == WALL_TIME)
- this.endTime = time;
- else if (this.endTimeMode == STANDARD_TIME)
- // Convert from STANDARD to DST
- this.endTime = time + this.dstSavings;
- else
- // Convert from UTC to DST
- this.endTime = time + this.rawOffset + this.dstSavings;
- useDaylight = true;
- }
-
- /**
- * Sets the daylight savings end rule. You must also set the
- * start rule with <code>setStartRule</code> or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * @param month The end month of daylight savings.
- * @param day A day in month, or a day of week in month.
- * @param dayOfWeek A day of week, when daylight savings ends.
- * @param time A time in millis in standard time.
- * @see #setStartRule
- */
- public void setEndRule(int month, int day, int time)
- {
- setEndRule(month, day, 0, time);
- }
-
- /**
- * Gets the time zone offset, for current date, modified in case of
- * daylight savings. This is the offset to add to UTC to get the local
- * time.
- *
- * In the standard JDK the results given by this method may result in
- * inaccurate results at the end of February or the beginning of March.
- * To avoid this, you should use Calendar instead:
- * <code>offset = cal.get(Calendar.ZONE_OFFSET)
- * + cal.get(Calendar.DST_OFFSET);</code>
- *
- * This version doesn't suffer this inaccuracy.
- *
- * The arguments don't follow the approach for setting start and end rules.
- * The day must be a positive number and dayOfWeek must be a positive value
- * from Calendar. dayOfWeek is redundant, but must match the other values
- * or an inaccurate result may be returned.
- *
- * @param era the era of the given date
- * @param year the year of the given date
- * @param month the month of the given date, 0 for January.
- * @param day the day of month
- * @param dayOfWeek the day of week; this must match the other fields.
- * @param millis the millis in the day (in local standard time)
- * @return the time zone offset in milliseconds.
- * @throws IllegalArgumentException if arguments are incorrect.
- */
- public int getOffset(int era, int year, int month, int day, int dayOfWeek,
- int millis)
- {
- int daysInMonth = getDaysInMonth(month, year);
- if (day < 1 || day > daysInMonth)
- throw new IllegalArgumentException("day out of range");
- if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY)
- throw new IllegalArgumentException("dayOfWeek out of range");
- if (month < Calendar.JANUARY || month > Calendar.DECEMBER)
- throw new IllegalArgumentException("month out of range:" + month);
-
- // This method is called by Calendar, so we mustn't use that class.
- int daylightSavings = 0;
- if (useDaylight && era == GregorianCalendar.AD && year >= startYear)
- {
- // This does only work for Gregorian calendars :-(
- // This is mainly because setStartYear doesn't take an era.
- boolean afterStart = ! isBefore(year, month, day, dayOfWeek, millis,
- startMode, startMonth, startDay,
- startDayOfWeek, startTime);
- boolean beforeEnd = isBefore(year, month, day, dayOfWeek,
- millis + dstSavings,
- endMode, endMonth, endDay, endDayOfWeek,
- endTime);
-
- if (startMonth < endMonth)
- // use daylight savings, if the date is after the start of
- // savings, and before the end of savings.
- daylightSavings = afterStart && beforeEnd ? dstSavings : 0;
- else
- // use daylight savings, if the date is before the end of
- // savings, or after the start of savings.
- daylightSavings = beforeEnd || afterStart ? dstSavings : 0;
- }
- return rawOffset + daylightSavings;
- }
-
- /**
- * Returns the time zone offset to GMT in milliseconds, ignoring
- * day light savings.
- * @return the time zone offset.
- */
- public int getRawOffset()
- {
- return rawOffset;
- }
-
- /**
- * Sets the standard time zone offset to GMT.
- * @param rawOffset The time offset from GMT in milliseconds.
- */
- public void setRawOffset(int rawOffset)
- {
- this.rawOffset = rawOffset;
- }
-
- /**
- * Gets the daylight savings offset. This is a positive offset in
- * milliseconds with respect to standard time. Typically this
- * is one hour, but for some time zones this may be half an our.
- * @return the daylight savings offset in milliseconds.
- *
- * @since 1.2
- */
- public int getDSTSavings()
- {
- return dstSavings;
- }
-
- /**
- * Sets the daylight savings offset. This is a positive offset in
- * milliseconds with respect to standard time.
- *
- * @param dstSavings the daylight savings offset in milliseconds.
- *
- * @since 1.2
- */
- public void setDSTSavings(int dstSavings)
- {
- if (dstSavings <= 0)
- throw new IllegalArgumentException("illegal value for dstSavings");
-
- this.dstSavings = dstSavings;
- }
-
- /**
- * Returns if this time zone uses daylight savings time.
- * @return true, if we use daylight savings time, false otherwise.
- */
- public boolean useDaylightTime()
- {
- return useDaylight;
- }
-
- /**
- * Returns the number of days in the given month.
- * Uses gregorian rules prior to 1582 (The default and earliest cutover)
- * @param month The month, zero based; use one of the Calendar constants.
- * @param year The year.
- */
- private int getDaysInMonth(int month, int year)
- {
- if (month == Calendar.FEBRUARY)
- {
- if ((year & 3) != 0)
- return 28;
-
- // Assume default Gregorian cutover,
- // all years prior to this must be Julian
- if (year < 1582)
- return 29;
-
- // Gregorian rules
- return ((year % 100) != 0 || (year % 400) == 0) ? 29 : 28;
- }
- else
- return monthArr[month];
- }
-
- /**
- * Checks if the date given in calXXXX, is before the change between
- * dst and standard time.
- * @param calYear the year of the date to check (for leap day checking).
- * @param calMonth the month of the date to check.
- * @param calDay the day of month of the date to check.
- * @param calDayOfWeek the day of week of the date to check.
- * @param calMillis the millis of day of the date to check (standard time).
- * @param mode the change mode; same semantic as startMode.
- * @param month the change month; same semantic as startMonth.
- * @param day the change day; same semantic as startDay.
- * @param dayOfWeek the change day of week;
- * @param millis the change time in millis since midnight standard time.
- * same semantic as startDayOfWeek.
- * @return true, if cal is before the change, false if cal is on
- * or after the change.
- */
- private boolean isBefore(int calYear, int calMonth, int calDayOfMonth,
- int calDayOfWeek, int calMillis, int mode,
- int month, int day, int dayOfWeek, int millis)
- {
- // This method is called by Calendar, so we mustn't use that class.
- // We have to do all calculations by hand.
- // check the months:
- // XXX - this is not correct:
- // for the DOW_GE_DOM and DOW_LE_DOM modes the change date may
- // be in a different month.
- if (calMonth != month)
- return calMonth < month;
-
- // check the day:
- switch (mode)
- {
- case DOM_MODE:
- if (calDayOfMonth != day)
- return calDayOfMonth < day;
- break;
- case DOW_IN_MONTH_MODE:
- {
- // This computes the day of month of the day of type
- // "dayOfWeek" that lies in the same (sunday based) week as cal.
- calDayOfMonth += (dayOfWeek - calDayOfWeek);
-
- // Now we convert it to 7 based number (to get a one based offset
- // after dividing by 7). If we count from the end of the
- // month, we get want a -7 based number counting the days from
- // the end:
- if (day < 0)
- calDayOfMonth -= getDaysInMonth(calMonth, calYear) + 7;
- else
- calDayOfMonth += 6;
-
- // day > 0 day < 0
- // S M T W T F S S M T W T F S
- // 7 8 9 10 11 12 -36-35-34-33-32-31
- // 13 14 15 16 17 18 19 -30-29-28-27-26-25-24
- // 20 21 22 23 24 25 26 -23-22-21-20-19-18-17
- // 27 28 29 30 31 32 33 -16-15-14-13-12-11-10
- // 34 35 36 -9 -8 -7
- // Now we calculate the day of week in month:
- int week = calDayOfMonth / 7;
-
- // day > 0 day < 0
- // S M T W T F S S M T W T F S
- // 1 1 1 1 1 1 -5 -5 -4 -4 -4 -4
- // 1 2 2 2 2 2 2 -4 -4 -4 -3 -3 -3 -3
- // 2 3 3 3 3 3 3 -3 -3 -3 -2 -2 -2 -2
- // 3 4 4 4 4 4 4 -2 -2 -2 -1 -1 -1 -1
- // 4 5 5 -1 -1 -1
- if (week != day)
- return week < day;
-
- if (calDayOfWeek != dayOfWeek)
- return calDayOfWeek < dayOfWeek;
-
- // daylight savings starts/ends on the given day.
- break;
- }
- case DOW_LE_DOM_MODE:
- // The greatest sunday before or equal December, 12
- // is the same as smallest sunday after or equal December, 6.
- day = Math.abs(day) - 6;
- case DOW_GE_DOM_MODE:
- // Calculate the day of month of the day of type
- // "dayOfWeek" that lies before (or on) the given date.
- calDayOfMonth -= (calDayOfWeek < dayOfWeek ? 7 : 0) + calDayOfWeek
- - dayOfWeek;
- if (calDayOfMonth < day)
- return true;
- if (calDayOfWeek != dayOfWeek || calDayOfMonth >= day + 7)
- return false;
-
- // now we have the same day
- break;
- }
-
- // the millis decides:
- return (calMillis < millis);
- }
-
- /**
- * Determines if the given date is in daylight savings time.
- * @return true, if it is in daylight savings time, false otherwise.
- */
- public boolean inDaylightTime(Date date)
- {
- Calendar cal = Calendar.getInstance(this);
- cal.setTime(date);
- return (cal.get(Calendar.DST_OFFSET) != 0);
- }
-
- /**
- * Generates the hashCode for the SimpleDateFormat object. It is
- * the rawOffset, possibly, if useDaylightSavings is true, xored
- * with startYear, startMonth, startDayOfWeekInMonth, ..., endTime.
- */
- public synchronized int hashCode()
- {
- return rawOffset
- ^ (useDaylight
- ? startMonth ^ startDay ^ startDayOfWeek ^ startTime ^ endMonth
- ^ endDay ^ endDayOfWeek ^ endTime : 0);
- }
-
- public synchronized boolean equals(Object o)
- {
- if (this == o)
- return true;
- if (! (o instanceof SimpleTimeZone))
- return false;
- SimpleTimeZone zone = (SimpleTimeZone) o;
- if (zone.hashCode() != hashCode() || ! getID().equals(zone.getID())
- || rawOffset != zone.rawOffset || useDaylight != zone.useDaylight)
- return false;
- if (! useDaylight)
- return true;
- return (startYear == zone.startYear && startMonth == zone.startMonth
- && startDay == zone.startDay
- && startDayOfWeek == zone.startDayOfWeek
- && startTime == zone.startTime
- && startTimeMode == zone.startTimeMode && endMonth == zone.endMonth
- && endDay == zone.endDay && endDayOfWeek == zone.endDayOfWeek
- && endTime == zone.endTime && endTimeMode == zone.endTimeMode);
- }
-
- /**
- * Test if the other time zone uses the same rule and only
- * possibly differs in ID. This implementation for this particular
- * class will return true if the other object is a SimpleTimeZone,
- * the raw offsets and useDaylight are identical and if useDaylight
- * is true, also the start and end datas are identical.
- * @return true if this zone uses the same rule.
- */
- public boolean hasSameRules(TimeZone other)
- {
- if (this == other)
- return true;
- if (! (other instanceof SimpleTimeZone))
- return false;
- SimpleTimeZone zone = (SimpleTimeZone) other;
- if (zone.hashCode() != hashCode() || rawOffset != zone.rawOffset
- || useDaylight != zone.useDaylight)
- return false;
- if (! useDaylight)
- return true;
- return (startYear == zone.startYear && startMonth == zone.startMonth
- && startDay == zone.startDay
- && startDayOfWeek == zone.startDayOfWeek
- && startTime == zone.startTime
- && startTimeMode == zone.startTimeMode && endMonth == zone.endMonth
- && endDay == zone.endDay && endDayOfWeek == zone.endDayOfWeek
- && endTime == zone.endTime && endTimeMode == zone.endTimeMode);
- }
-
- /**
- * Returns a string representation of this SimpleTimeZone object.
- * @return a string representation of this SimpleTimeZone object.
- */
- public String toString()
- {
- // the test for useDaylight is an incompatibility to jdk1.2, but
- // I think this shouldn't hurt.
- return getClass().getName() + "[" + "id=" + getID() + ",offset="
- + rawOffset + ",dstSavings=" + dstSavings + ",useDaylight="
- + useDaylight
- + (useDaylight
- ? ",startYear=" + startYear + ",startMode=" + startMode
- + ",startMonth=" + startMonth + ",startDay=" + startDay
- + ",startDayOfWeek=" + startDayOfWeek + ",startTime="
- + startTime + ",startTimeMode=" + startTimeMode + ",endMode="
- + endMode + ",endMonth=" + endMonth + ",endDay=" + endDay
- + ",endDayOfWeek=" + endDayOfWeek + ",endTime=" + endTime
- + ",endTimeMode=" + endTimeMode : "") + "]";
- }
-
- /**
- * Reads a serialized simple time zone from stream.
- * @see #writeObject
- */
- private void readObject(java.io.ObjectInputStream input)
- throws java.io.IOException, ClassNotFoundException
- {
- input.defaultReadObject();
- if (serialVersionOnStream == 0)
- {
- // initialize the new fields to default values.
- dstSavings = 60 * 60 * 1000;
- endMode = DOW_IN_MONTH_MODE;
- startMode = DOW_IN_MONTH_MODE;
- startTimeMode = WALL_TIME;
- endTimeMode = WALL_TIME;
- serialVersionOnStream = 2;
- }
- else
- {
- int length = input.readInt();
- byte[] byteArray = new byte[length];
- input.read(byteArray, 0, length);
- if (length >= 4)
- {
- // Lets hope that Sun does extensions to the serialized
- // form in a sane manner.
- startDay = byteArray[0];
- startDayOfWeek = byteArray[1];
- endDay = byteArray[2];
- endDayOfWeek = byteArray[3];
- }
- }
- }
-
- /**
- * Serializes this object to a stream. @serialdata The object is
- * first written in the old JDK 1.1 format, so that it can be read
- * by by the old classes. This means, that the
- * <code>start/endDay(OfWeek)</code>-Fields are written in the
- * DOW_IN_MONTH_MODE rule, since this was the only supported rule
- * in 1.1.
- *
- * In the optional section, we write first the length of an byte
- * array as int and afterwards the byte array itself. The byte
- * array contains in this release four elements, namely the real
- * startDay, startDayOfWeek endDay, endDayOfWeek in that Order.
- * These fields are needed, because for compatibility reasons only
- * approximative values are written to the required section, as
- * described above.
- */
- private void writeObject(java.io.ObjectOutputStream output)
- throws java.io.IOException
- {
- byte[] byteArray = new byte[]
- {
- (byte) startDay, (byte) startDayOfWeek, (byte) endDay,
- (byte) endDayOfWeek
- };
-
- /* calculate the approximation for JDK 1.1 */
- switch (startMode)
- {
- case DOM_MODE:
- startDayOfWeek = Calendar.SUNDAY; // random day of week
-
- // fall through
- case DOW_GE_DOM_MODE:
- case DOW_LE_DOM_MODE:
- startDay = (startDay + 6) / 7;
- }
- switch (endMode)
- {
- case DOM_MODE:
- endDayOfWeek = Calendar.SUNDAY;
-
- // fall through
- case DOW_GE_DOM_MODE:
- case DOW_LE_DOM_MODE:
- endDay = (endDay + 6) / 7;
- }
-
- // the required part:
- output.defaultWriteObject();
- // the optional part:
- output.writeInt(byteArray.length);
- output.write(byteArray, 0, byteArray.length);
- }
-}
diff --git a/libjava/java/util/zip/ZipEntry.java b/libjava/java/util/zip/ZipEntry.java
deleted file mode 100644
index 04c5e01bb99..00000000000
--- a/libjava/java/util/zip/ZipEntry.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/* ZipEntry.java --
- Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util.zip;
-
-import java.util.Calendar;
-import java.util.Date;
-
-/**
- * This class represents a member of a zip archive. ZipFile and
- * ZipInputStream will give you instances of this class as information
- * about the members in an archive. On the other hand ZipOutputStream
- * needs an instance of this class to create a new member.
- *
- * @author Jochen Hoenicke
- */
-public class ZipEntry implements ZipConstants, Cloneable
-{
- private static final int KNOWN_SIZE = 1;
- private static final int KNOWN_CSIZE = 2;
- private static final int KNOWN_CRC = 4;
- private static final int KNOWN_TIME = 8;
-
- private static Calendar cal;
-
- private String name;
- private int size;
- private long compressedSize = -1;
- private int crc;
- private int dostime;
- private short known = 0;
- private short method = -1;
- private byte[] extra = null;
- private String comment = null;
-
- int flags; /* used by ZipOutputStream */
- int offset; /* used by ZipFile and ZipOutputStream */
-
- /**
- * Compression method. This method doesn't compress at all.
- */
- public static final int STORED = 0;
- /**
- * Compression method. This method uses the Deflater.
- */
- public static final int DEFLATED = 8;
-
- /**
- * Creates a zip entry with the given name.
- * @param name the name. May include directory components separated
- * by '/'.
- *
- * @exception NullPointerException when name is null.
- * @exception IllegalArgumentException when name is bigger then 65535 chars.
- */
- public ZipEntry(String name)
- {
- int length = name.length();
- if (length > 65535)
- throw new IllegalArgumentException("name length is " + length);
- this.name = name;
- }
-
- /**
- * Creates a copy of the given zip entry.
- * @param e the entry to copy.
- */
- public ZipEntry(ZipEntry e)
- {
- name = e.name;
- known = e.known;
- size = e.size;
- compressedSize = e.compressedSize;
- crc = e.crc;
- dostime = e.dostime;
- method = e.method;
- extra = e.extra;
- comment = e.comment;
- }
-
- final void setDOSTime(int dostime)
- {
- this.dostime = dostime;
- known |= KNOWN_TIME;
- }
-
- final int getDOSTime()
- {
- if ((known & KNOWN_TIME) == 0)
- return 0;
- else
- return dostime;
- }
-
- /**
- * Creates a copy of this zip entry.
- */
- /**
- * Clones the entry.
- */
- public Object clone()
- {
- try
- {
- // The JCL says that the `extra' field is also copied.
- ZipEntry clone = (ZipEntry) super.clone();
- if (extra != null)
- clone.extra = (byte[]) extra.clone();
- return clone;
- }
- catch (CloneNotSupportedException ex)
- {
- throw new InternalError();
- }
- }
-
- /**
- * Returns the entry name. The path components in the entry are
- * always separated by slashes ('/').
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Sets the time of last modification of the entry.
- * @time the time of last modification of the entry.
- */
- public void setTime(long time)
- {
- Calendar cal = getCalendar();
- synchronized (cal)
- {
- cal.setTime(new Date(time));
- dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25
- | (cal.get(Calendar.MONTH) + 1) << 21
- | (cal.get(Calendar.DAY_OF_MONTH)) << 16
- | (cal.get(Calendar.HOUR_OF_DAY)) << 11
- | (cal.get(Calendar.MINUTE)) << 5
- | (cal.get(Calendar.SECOND)) >> 1;
- }
- this.known |= KNOWN_TIME;
- }
-
- /**
- * Gets the time of last modification of the entry.
- * @return the time of last modification of the entry, or -1 if unknown.
- */
- public long getTime()
- {
- if ((known & KNOWN_TIME) == 0)
- return -1;
-
- int sec = 2 * (dostime & 0x1f);
- int min = (dostime >> 5) & 0x3f;
- int hrs = (dostime >> 11) & 0x1f;
- int day = (dostime >> 16) & 0x1f;
- int mon = ((dostime >> 21) & 0xf) - 1;
- int year = ((dostime >> 25) & 0x7f) + 1980; /* since 1900 */
-
- try
- {
- cal = getCalendar();
- synchronized (cal)
- {
- cal.set(year, mon, day, hrs, min, sec);
- return cal.getTime().getTime();
- }
- }
- catch (RuntimeException ex)
- {
- /* Ignore illegal time stamp */
- known &= ~KNOWN_TIME;
- return -1;
- }
- }
-
- private static synchronized Calendar getCalendar()
- {
- if (cal == null)
- cal = Calendar.getInstance();
-
- return cal;
- }
-
- /**
- * Sets the size of the uncompressed data.
- * @exception IllegalArgumentException if size is not in 0..0xffffffffL
- */
- public void setSize(long size)
- {
- if ((size & 0xffffffff00000000L) != 0)
- throw new IllegalArgumentException();
- this.size = (int) size;
- this.known |= KNOWN_SIZE;
- }
-
- /**
- * Gets the size of the uncompressed data.
- * @return the size or -1 if unknown.
- */
- public long getSize()
- {
- return (known & KNOWN_SIZE) != 0 ? size & 0xffffffffL : -1L;
- }
-
- /**
- * Sets the size of the compressed data.
- */
- public void setCompressedSize(long csize)
- {
- this.compressedSize = csize;
- }
-
- /**
- * Gets the size of the compressed data.
- * @return the size or -1 if unknown.
- */
- public long getCompressedSize()
- {
- return compressedSize;
- }
-
- /**
- * Sets the crc of the uncompressed data.
- * @exception IllegalArgumentException if crc is not in 0..0xffffffffL
- */
- public void setCrc(long crc)
- {
- if ((crc & 0xffffffff00000000L) != 0)
- throw new IllegalArgumentException();
- this.crc = (int) crc;
- this.known |= KNOWN_CRC;
- }
-
- /**
- * Gets the crc of the uncompressed data.
- * @return the crc or -1 if unknown.
- */
- public long getCrc()
- {
- return (known & KNOWN_CRC) != 0 ? crc & 0xffffffffL : -1L;
- }
-
- /**
- * Sets the compression method. Only DEFLATED and STORED are
- * supported.
- * @exception IllegalArgumentException if method is not supported.
- * @see ZipOutputStream#DEFLATED
- * @see ZipOutputStream#STORED
- */
- public void setMethod(int method)
- {
- if (method != ZipOutputStream.STORED
- && method != ZipOutputStream.DEFLATED)
- throw new IllegalArgumentException();
- this.method = (short) method;
- }
-
- /**
- * Gets the compression method.
- * @return the compression method or -1 if unknown.
- */
- public int getMethod()
- {
- return method;
- }
-
- /**
- * Sets the extra data.
- * @exception IllegalArgumentException if extra is longer than 0xffff bytes.
- */
- public void setExtra(byte[] extra)
- {
- if (extra == null)
- {
- this.extra = null;
- return;
- }
-
- if (extra.length > 0xffff)
- throw new IllegalArgumentException();
- this.extra = extra;
- try
- {
- int pos = 0;
- while (pos < extra.length)
- {
- int sig = (extra[pos++] & 0xff)
- | (extra[pos++] & 0xff) << 8;
- int len = (extra[pos++] & 0xff)
- | (extra[pos++] & 0xff) << 8;
- if (sig == 0x5455)
- {
- /* extended time stamp */
- int flags = extra[pos];
- if ((flags & 1) != 0)
- {
- long time = ((extra[pos+1] & 0xff)
- | (extra[pos+2] & 0xff) << 8
- | (extra[pos+3] & 0xff) << 16
- | (extra[pos+4] & 0xff) << 24);
- setTime(time);
- }
- }
- pos += len;
- }
- }
- catch (ArrayIndexOutOfBoundsException ex)
- {
- /* be lenient */
- return;
- }
- }
-
- /**
- * Gets the extra data.
- * @return the extra data or null if not set.
- */
- public byte[] getExtra()
- {
- return extra;
- }
-
- /**
- * Sets the entry comment.
- * @exception IllegalArgumentException if comment is longer than 0xffff.
- */
- public void setComment(String comment)
- {
- if (comment != null && comment.length() > 0xffff)
- throw new IllegalArgumentException();
- this.comment = comment;
- }
-
- /**
- * Gets the comment.
- * @return the comment or null if not set.
- */
- public String getComment()
- {
- return comment;
- }
-
- /**
- * Gets true, if the entry is a directory. This is solely
- * determined by the name, a trailing slash '/' marks a directory.
- */
- public boolean isDirectory()
- {
- int nlen = name.length();
- return nlen > 0 && name.charAt(nlen - 1) == '/';
- }
-
- /**
- * Gets the string representation of this ZipEntry. This is just
- * the name as returned by getName().
- */
- public String toString()
- {
- return name;
- }
-
- /**
- * Gets the hashCode of this ZipEntry. This is just the hashCode
- * of the name. Note that the equals method isn't changed, though.
- */
- public int hashCode()
- {
- return name.hashCode();
- }
-}
diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java
deleted file mode 100644
index 3fbff16c501..00000000000
--- a/libjava/java/util/zip/ZipFile.java
+++ /dev/null
@@ -1,551 +0,0 @@
-/* ZipFile.java --
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util.zip;
-
-import java.io.BufferedInputStream;
-import java.io.DataInput;
-import java.io.EOFException;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.RandomAccessFile;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-
-/**
- * This class represents a Zip archive. You can ask for the contained
- * entries, or get an input stream for a file entry. The entry is
- * automatically decompressed.
- *
- * This class is thread safe: You can open input streams for arbitrary
- * entries in different threads.
- *
- * @author Jochen Hoenicke
- * @author Artur Biesiadowski
- */
-public class ZipFile implements ZipConstants
-{
-
- /**
- * Mode flag to open a zip file for reading.
- */
- public static final int OPEN_READ = 0x1;
-
- /**
- * Mode flag to delete a zip file after reading.
- */
- public static final int OPEN_DELETE = 0x4;
-
- // Name of this zip file.
- private final String name;
-
- // File from which zip entries are read.
- private final RandomAccessFile raf;
-
- // The entries of this zip file when initialized and not yet closed.
- private HashMap entries;
-
- private boolean closed = false;
-
- /**
- * Opens a Zip file with the given name for reading.
- * @exception IOException if a i/o error occured.
- * @exception ZipException if the file doesn't contain a valid zip
- * archive.
- */
- public ZipFile(String name) throws ZipException, IOException
- {
- this.raf = new RandomAccessFile(name, "r");
- this.name = name;
- }
-
- /**
- * Opens a Zip file reading the given File.
- * @exception IOException if a i/o error occured.
- * @exception ZipException if the file doesn't contain a valid zip
- * archive.
- */
- public ZipFile(File file) throws ZipException, IOException
- {
- this.raf = new RandomAccessFile(file, "r");
- this.name = file.getPath();
- }
-
- /**
- * Opens a Zip file reading the given File in the given mode.
- *
- * If the OPEN_DELETE mode is specified, the zip file will be deleted at
- * some time moment after it is opened. It will be deleted before the zip
- * file is closed or the Virtual Machine exits.
- *
- * The contents of the zip file will be accessible until it is closed.
- *
- * @since JDK1.3
- * @param mode Must be one of OPEN_READ or OPEN_READ | OPEN_DELETE
- *
- * @exception IOException if a i/o error occured.
- * @exception ZipException if the file doesn't contain a valid zip
- * archive.
- */
- public ZipFile(File file, int mode) throws ZipException, IOException
- {
- if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE))
- throw new IllegalArgumentException("invalid mode");
- if ((mode & OPEN_DELETE) != 0)
- file.deleteOnExit();
- this.raf = new RandomAccessFile(file, "r");
- this.name = file.getPath();
- }
-
- /**
- * Read an unsigned short in little endian byte order from the given
- * DataInput stream using the given byte buffer.
- *
- * @param di DataInput stream to read from.
- * @param b the byte buffer to read in (must be at least 2 bytes long).
- * @return The value read.
- *
- * @exception IOException if a i/o error occured.
- * @exception EOFException if the file ends prematurely
- */
- private int readLeShort(DataInput di, byte[] b) throws IOException
- {
- di.readFully(b, 0, 2);
- return (b[0] & 0xff) | (b[1] & 0xff) << 8;
- }
-
- /**
- * Read an int in little endian byte order from the given
- * DataInput stream using the given byte buffer.
- *
- * @param di DataInput stream to read from.
- * @param b the byte buffer to read in (must be at least 4 bytes long).
- * @return The value read.
- *
- * @exception IOException if a i/o error occured.
- * @exception EOFException if the file ends prematurely
- */
- private int readLeInt(DataInput di, byte[] b) throws IOException
- {
- di.readFully(b, 0, 4);
- return ((b[0] & 0xff) | (b[1] & 0xff) << 8)
- | ((b[2] & 0xff) | (b[3] & 0xff) << 8) << 16;
- }
-
- /**
- * Read an unsigned short in little endian byte order from the given
- * byte buffer at the given offset.
- *
- * @param b the byte array to read from.
- * @param off the offset to read from.
- * @return The value read.
- */
- private int readLeShort(byte[] b, int off)
- {
- return (b[off] & 0xff) | (b[off+1] & 0xff) << 8;
- }
-
- /**
- * Read an int in little endian byte order from the given
- * byte buffer at the given offset.
- *
- * @param b the byte array to read from.
- * @param off the offset to read from.
- * @return The value read.
- */
- private int readLeInt(byte[] b, int off)
- {
- return ((b[off] & 0xff) | (b[off+1] & 0xff) << 8)
- | ((b[off+2] & 0xff) | (b[off+3] & 0xff) << 8) << 16;
- }
-
-
- /**
- * Read the central directory of a zip file and fill the entries
- * array. This is called exactly once when first needed. It is called
- * while holding the lock on <code>raf</code>.
- *
- * @exception IOException if a i/o error occured.
- * @exception ZipException if the central directory is malformed
- */
- private void readEntries() throws ZipException, IOException
- {
- /* Search for the End Of Central Directory. When a zip comment is
- * present the directory may start earlier.
- * FIXME: This searches the whole file in a very slow manner if the
- * file isn't a zip file.
- */
- long pos = raf.length() - ENDHDR;
- byte[] ebs = new byte[CENHDR];
-
- do
- {
- if (pos < 0)
- throw new ZipException
- ("central directory not found, probably not a zip file: " + name);
- raf.seek(pos--);
- }
- while (readLeInt(raf, ebs) != ENDSIG);
-
- if (raf.skipBytes(ENDTOT - ENDNRD) != ENDTOT - ENDNRD)
- throw new EOFException(name);
- int count = readLeShort(raf, ebs);
- if (raf.skipBytes(ENDOFF - ENDSIZ) != ENDOFF - ENDSIZ)
- throw new EOFException(name);
- int centralOffset = readLeInt(raf, ebs);
-
- entries = new HashMap(count+count/2);
- raf.seek(centralOffset);
-
- byte[] buffer = new byte[16];
- for (int i = 0; i < count; i++)
- {
- raf.readFully(ebs);
- if (readLeInt(ebs, 0) != CENSIG)
- throw new ZipException("Wrong Central Directory signature: " + name);
-
- int method = readLeShort(ebs, CENHOW);
- int dostime = readLeInt(ebs, CENTIM);
- int crc = readLeInt(ebs, CENCRC);
- int csize = readLeInt(ebs, CENSIZ);
- int size = readLeInt(ebs, CENLEN);
- int nameLen = readLeShort(ebs, CENNAM);
- int extraLen = readLeShort(ebs, CENEXT);
- int commentLen = readLeShort(ebs, CENCOM);
-
- int offset = readLeInt(ebs, CENOFF);
-
- int needBuffer = Math.max(nameLen, commentLen);
- if (buffer.length < needBuffer)
- buffer = new byte[needBuffer];
-
- raf.readFully(buffer, 0, nameLen);
- String name = new String(buffer, 0, 0, nameLen);
-
- ZipEntry entry = new ZipEntry(name);
- entry.setMethod(method);
- entry.setCrc(crc & 0xffffffffL);
- entry.setSize(size & 0xffffffffL);
- entry.setCompressedSize(csize & 0xffffffffL);
- entry.setDOSTime(dostime);
- if (extraLen > 0)
- {
- byte[] extra = new byte[extraLen];
- raf.readFully(extra);
- entry.setExtra(extra);
- }
- if (commentLen > 0)
- {
- raf.readFully(buffer, 0, commentLen);
- entry.setComment(new String(buffer, 0, commentLen));
- }
- entry.offset = offset;
- entries.put(name, entry);
- }
- }
-
- /**
- * Closes the ZipFile. This also closes all input streams given by
- * this class. After this is called, no further method should be
- * called.
- *
- * @exception IOException if a i/o error occured.
- */
- public void close() throws IOException
- {
- synchronized (raf)
- {
- closed = true;
- entries = null;
- raf.close();
- }
- }
-
- /**
- * Calls the <code>close()</code> method when this ZipFile has not yet
- * been explicitly closed.
- */
- protected void finalize() throws IOException
- {
- if (!closed && raf != null) close();
- }
-
- /**
- * Returns an enumeration of all Zip entries in this Zip file.
- */
- public Enumeration entries()
- {
- try
- {
- return new ZipEntryEnumeration(getEntries().values().iterator());
- }
- catch (IOException ioe)
- {
- return null;
- }
- }
-
- /**
- * Checks that the ZipFile is still open and reads entries when necessary.
- *
- * @exception IllegalStateException when the ZipFile has already been closed.
- * @exception IOEexception when the entries could not be read.
- */
- private HashMap getEntries() throws IOException
- {
- synchronized(raf)
- {
- if (closed)
- throw new IllegalStateException("ZipFile has closed: " + name);
-
- if (entries == null)
- readEntries();
-
- return entries;
- }
- }
-
- /**
- * Searches for a zip entry in this archive with the given name.
- *
- * @param the name. May contain directory components separated by
- * slashes ('/').
- * @return the zip entry, or null if no entry with that name exists.
- */
- public ZipEntry getEntry(String name)
- {
- try
- {
- HashMap entries = getEntries();
- ZipEntry entry = (ZipEntry) entries.get(name);
- return entry != null ? (ZipEntry) entry.clone() : null;
- }
- catch (IOException ioe)
- {
- return null;
- }
- }
-
-
- //access should be protected by synchronized(raf)
- private byte[] locBuf = new byte[LOCHDR];
-
- /**
- * Checks, if the local header of the entry at index i matches the
- * central directory, and returns the offset to the data.
- *
- * @param entry to check.
- * @return the start offset of the (compressed) data.
- *
- * @exception IOException if a i/o error occured.
- * @exception ZipException if the local header doesn't match the
- * central directory header
- */
- private long checkLocalHeader(ZipEntry entry) throws IOException
- {
- synchronized (raf)
- {
- raf.seek(entry.offset);
- raf.readFully(locBuf);
-
- if (readLeInt(locBuf, 0) != LOCSIG)
- throw new ZipException("Wrong Local header signature: " + name);
-
- if (entry.getMethod() != readLeShort(locBuf, LOCHOW))
- throw new ZipException("Compression method mismatch: " + name);
-
- if (entry.getName().length() != readLeShort(locBuf, LOCNAM))
- throw new ZipException("file name length mismatch: " + name);
-
- int extraLen = entry.getName().length() + readLeShort(locBuf, LOCEXT);
- return entry.offset + LOCHDR + extraLen;
- }
- }
-
- /**
- * Creates an input stream reading the given zip entry as
- * uncompressed data. Normally zip entry should be an entry
- * returned by getEntry() or entries().
- *
- * This implementation returns null if the requested entry does not
- * exist. This decision is not obviously correct, however, it does
- * appear to mirror Sun's implementation, and it is consistant with
- * their javadoc. On the other hand, the old JCL book, 2nd Edition,
- * claims that this should return a "non-null ZIP entry". We have
- * chosen for now ignore the old book, as modern versions of Ant (an
- * important application) depend on this behaviour. See discussion
- * in this thread:
- * http://gcc.gnu.org/ml/java-patches/2004-q2/msg00602.html
- *
- * @param entry the entry to create an InputStream for.
- * @return the input stream, or null if the requested entry does not exist.
- *
- * @exception IOException if a i/o error occured.
- * @exception ZipException if the Zip archive is malformed.
- */
- public InputStream getInputStream(ZipEntry entry) throws IOException
- {
- HashMap entries = getEntries();
- String name = entry.getName();
- ZipEntry zipEntry = (ZipEntry) entries.get(name);
- if (zipEntry == null)
- return null;
-
- long start = checkLocalHeader(zipEntry);
- int method = zipEntry.getMethod();
- InputStream is = new BufferedInputStream(new PartialInputStream
- (raf, start, zipEntry.getCompressedSize()));
- switch (method)
- {
- case ZipOutputStream.STORED:
- return is;
- case ZipOutputStream.DEFLATED:
- return new InflaterInputStream(is, new Inflater(true));
- default:
- throw new ZipException("Unknown compression method " + method);
- }
- }
-
- /**
- * Returns the (path) name of this zip file.
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Returns the number of entries in this zip file.
- */
- public int size()
- {
- try
- {
- return getEntries().size();
- }
- catch (IOException ioe)
- {
- return 0;
- }
- }
-
- private static class ZipEntryEnumeration implements Enumeration
- {
- private final Iterator elements;
-
- public ZipEntryEnumeration(Iterator elements)
- {
- this.elements = elements;
- }
-
- public boolean hasMoreElements()
- {
- return elements.hasNext();
- }
-
- public Object nextElement()
- {
- /* We return a clone, just to be safe that the user doesn't
- * change the entry.
- */
- return ((ZipEntry)elements.next()).clone();
- }
- }
-
- private static class PartialInputStream extends InputStream
- {
- private final RandomAccessFile raf;
- long filepos, end;
-
- public PartialInputStream(RandomAccessFile raf, long start, long len)
- {
- this.raf = raf;
- filepos = start;
- end = start + len;
- }
-
- public int available()
- {
- long amount = end - filepos;
- if (amount > Integer.MAX_VALUE)
- return Integer.MAX_VALUE;
- return (int) amount;
- }
-
- public int read() throws IOException
- {
- if (filepos == end)
- return -1;
- synchronized (raf)
- {
- raf.seek(filepos++);
- return raf.read();
- }
- }
-
- public int read(byte[] b, int off, int len) throws IOException
- {
- if (len > end - filepos)
- {
- len = (int) (end - filepos);
- if (len == 0)
- return -1;
- }
- synchronized (raf)
- {
- raf.seek(filepos);
- int count = raf.read(b, off, len);
- if (count > 0)
- filepos += len;
- return count;
- }
- }
-
- public long skip(long amount)
- {
- if (amount < 0)
- throw new IllegalArgumentException();
- if (amount > end - filepos)
- amount = end - filepos;
- filepos += amount;
- return amount;
- }
- }
-}
diff --git a/libjava/posix-threads.cc b/libjava/posix-threads.cc
index f77e2f4b75a..a596c77e131 100644
--- a/libjava/posix-threads.cc
+++ b/libjava/posix-threads.cc
@@ -311,6 +311,19 @@ _Jv_InitThreads (void)
// Block SIGCHLD here to ensure that any non-Java threads inherit the new
// signal mask.
block_sigchld();
+
+ // Check/set the thread stack size.
+ size_t min_ss = 32 * 1024;
+
+ if (sizeof (void *) == 8)
+ // Bigger default on 64-bit systems.
+ min_ss *= 2;
+
+ if (min_ss < PTHREAD_STACK_MIN)
+ min_ss = PTHREAD_STACK_MIN;
+
+ if (gcj::stack_size > 0 && gcj::stack_size < min_ss)
+ gcj::stack_size = min_ss;
}
_Jv_Thread_t *
@@ -430,6 +443,14 @@ _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data,
pthread_attr_init (&attr);
pthread_attr_setschedparam (&attr, &param);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+
+ // Set stack size if -Xss option was given.
+ if (gcj::stack_size > 0)
+ {
+ int e = pthread_attr_setstacksize (&attr, gcj::stack_size);
+ if (e != 0)
+ JvFail (strerror (e));
+ }
info = (struct starter *) _Jv_AllocBytes (sizeof (struct starter));
info->method = meth;
diff --git a/libjava/prims.cc b/libjava/prims.cc
index ba5c9efd260..490d2b1c127 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -959,6 +959,9 @@ namespace gcj
// When true, enable the bytecode verifier and BC-ABI type verification.
bool verifyClasses = true;
+
+ // Thread stack size specified by the -Xss runtime argument.
+ size_t stack_size = 0;
}
// We accept all non-standard options accepted by Sun's java command,
@@ -1045,7 +1048,7 @@ parse_x_arg (char* option_string)
}
else if (! strncmp (option_string, "ss", 2))
{
- // FIXME: set thread stack size
+ _Jv_SetStackSize (option_string + 2);
}
else if (! strcmp (option_string, "X:+UseAltSigs"))
{
@@ -1407,7 +1410,7 @@ JvRunMain (jclass klass, int argc, const char **argv)
// Parse a string and return a heap size.
static size_t
-parse_heap_size (const char *spec)
+parse_memory_size (const char *spec)
{
char *end;
unsigned long val = strtoul (spec, &end, 10);
@@ -1423,7 +1426,7 @@ parse_heap_size (const char *spec)
void
_Jv_SetInitialHeapSize (const char *arg)
{
- size_t size = parse_heap_size (arg);
+ size_t size = parse_memory_size (arg);
_Jv_GCSetInitialHeapSize (size);
}
@@ -1432,11 +1435,16 @@ _Jv_SetInitialHeapSize (const char *arg)
void
_Jv_SetMaximumHeapSize (const char *arg)
{
- size_t size = parse_heap_size (arg);
+ size_t size = parse_memory_size (arg);
_Jv_GCSetMaximumHeapSize (size);
}
-
+void
+_Jv_SetStackSize (const char *arg)
+{
+ size_t size = parse_memory_size (arg);
+ gcj::stack_size = size;
+}
void *
_Jv_Malloc (jsize size)
diff --git a/libjava/scripts/makemake.tcl b/libjava/scripts/makemake.tcl
index a5c075a62a7..b09888fdf7f 100755
--- a/libjava/scripts/makemake.tcl
+++ b/libjava/scripts/makemake.tcl
@@ -166,7 +166,7 @@ proc scan_directory {basedir subdir} {
set files {}
set here [pwd]
cd $basedir/$subdir
- foreach file [lsort [glob *]] {
+ foreach file [lsort [glob -nocomplain *]] {
if {[string match *.java $file]} {
lappend files $subdir/$file
} elseif {[file isdirectory $file]} {
diff --git a/libjava/sources.am b/libjava/sources.am
index e1531744b1a..6a0b3025f1c 100644
--- a/libjava/sources.am
+++ b/libjava/sources.am
@@ -46,6 +46,8 @@ gnu/awt/xlib/XFontPeer.java \
gnu/awt/xlib/XFramePeer.java \
gnu/awt/xlib/XGraphics.java \
gnu/awt/xlib/XGraphicsConfiguration.java \
+gnu/awt/xlib/XGraphicsDevice.java \
+gnu/awt/xlib/XGraphicsEnvironment.java \
gnu/awt/xlib/XOffScreenImage.java \
gnu/awt/xlib/XPanelPeer.java \
gnu/awt/xlib/XToolkit.java
@@ -64,6 +66,7 @@ gnu/awt/xlib.list: $(gnu_awt_xlib_source_files)
gnu_classpath_source_files = \
+classpath/gnu/classpath/ByteArray.java \
classpath/gnu/classpath/Configuration.java \
classpath/gnu/classpath/Pointer.java \
classpath/gnu/classpath/Pointer32.java \
@@ -103,6 +106,212 @@ gnu/classpath/debug.list: $(gnu_classpath_debug_source_files)
-include gnu/classpath/debug.deps
+gnu_classpath_jdwp_source_files = \
+classpath/gnu/classpath/jdwp/Jdwp.java \
+classpath/gnu/classpath/jdwp/JdwpConstants.java \
+gnu/classpath/jdwp/VMFrame.java \
+gnu/classpath/jdwp/VMIdManager.java \
+gnu/classpath/jdwp/VMVirtualMachine.java
+
+gnu_classpath_jdwp_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_source_files)))
+
+gnu/classpath/jdwp.list: $(gnu_classpath_jdwp_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp.list
+
+-include gnu/classpath/jdwp.deps
+
+
+gnu_classpath_jdwp_event_source_files = \
+classpath/gnu/classpath/jdwp/event/ClassPrepareEvent.java \
+classpath/gnu/classpath/jdwp/event/Event.java \
+classpath/gnu/classpath/jdwp/event/EventManager.java \
+classpath/gnu/classpath/jdwp/event/EventRequest.java \
+classpath/gnu/classpath/jdwp/event/ThreadEndEvent.java \
+classpath/gnu/classpath/jdwp/event/ThreadStartEvent.java \
+classpath/gnu/classpath/jdwp/event/VmDeathEvent.java \
+classpath/gnu/classpath/jdwp/event/VmInitEvent.java
+
+gnu_classpath_jdwp_event_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_event_source_files)))
+
+gnu/classpath/jdwp/event.list: $(gnu_classpath_jdwp_event_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_event_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/event.list
+
+-include gnu/classpath/jdwp/event.deps
+
+
+gnu_classpath_jdwp_event_filters_source_files = \
+classpath/gnu/classpath/jdwp/event/filters/ClassExcludeFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ClassMatchFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ConditionalFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/CountFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/IEventFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/StepFilter.java \
+classpath/gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java
+
+gnu_classpath_jdwp_event_filters_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_event_filters_source_files)))
+
+gnu/classpath/jdwp/event/filters.list: $(gnu_classpath_jdwp_event_filters_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_event_filters_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/event/filters.list
+
+-include gnu/classpath/jdwp/event/filters.deps
+
+
+gnu_classpath_jdwp_exception_source_files = \
+classpath/gnu/classpath/jdwp/exception/InvalidClassException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidClassLoaderException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidCountException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidEventTypeException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidFieldException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidLocationException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidMethodException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidObjectException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidStringException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidThreadException.java \
+classpath/gnu/classpath/jdwp/exception/InvalidThreadGroupException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpIllegalArgumentException.java \
+classpath/gnu/classpath/jdwp/exception/JdwpInternalErrorException.java \
+classpath/gnu/classpath/jdwp/exception/NotImplementedException.java \
+classpath/gnu/classpath/jdwp/exception/VmDeadException.java
+
+gnu_classpath_jdwp_exception_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_exception_source_files)))
+
+gnu/classpath/jdwp/exception.list: $(gnu_classpath_jdwp_exception_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_exception_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/exception.list
+
+-include gnu/classpath/jdwp/exception.deps
+
+
+gnu_classpath_jdwp_id_source_files = \
+classpath/gnu/classpath/jdwp/id/ArrayId.java \
+classpath/gnu/classpath/jdwp/id/ArrayReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/ClassLoaderId.java \
+classpath/gnu/classpath/jdwp/id/ClassObjectId.java \
+classpath/gnu/classpath/jdwp/id/ClassReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/InterfaceReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/JdwpId.java \
+classpath/gnu/classpath/jdwp/id/ObjectId.java \
+classpath/gnu/classpath/jdwp/id/ReferenceTypeId.java \
+classpath/gnu/classpath/jdwp/id/StringId.java \
+classpath/gnu/classpath/jdwp/id/ThreadGroupId.java \
+classpath/gnu/classpath/jdwp/id/ThreadId.java
+
+gnu_classpath_jdwp_id_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_id_source_files)))
+
+gnu/classpath/jdwp/id.list: $(gnu_classpath_jdwp_id_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_id_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/id.list
+
+-include gnu/classpath/jdwp/id.deps
+
+
+gnu_classpath_jdwp_processor_source_files = \
+classpath/gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ClassTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/CommandSet.java \
+classpath/gnu/classpath/jdwp/processor/EventRequestCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/FieldCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/MethodCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/PacketProcessor.java \
+classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/StackFrameCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/StringReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java \
+classpath/gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java
+
+gnu_classpath_jdwp_processor_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_processor_source_files)))
+
+gnu/classpath/jdwp/processor.list: $(gnu_classpath_jdwp_processor_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_processor_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/processor.list
+
+-include gnu/classpath/jdwp/processor.deps
+
+
+gnu_classpath_jdwp_transport_source_files = \
+classpath/gnu/classpath/jdwp/transport/ITransport.java \
+classpath/gnu/classpath/jdwp/transport/JdwpCommandPacket.java \
+classpath/gnu/classpath/jdwp/transport/JdwpConnection.java \
+classpath/gnu/classpath/jdwp/transport/JdwpPacket.java \
+classpath/gnu/classpath/jdwp/transport/JdwpReplyPacket.java \
+classpath/gnu/classpath/jdwp/transport/SocketTransport.java \
+classpath/gnu/classpath/jdwp/transport/TransportException.java \
+classpath/gnu/classpath/jdwp/transport/TransportFactory.java
+
+gnu_classpath_jdwp_transport_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_transport_source_files)))
+
+gnu/classpath/jdwp/transport.list: $(gnu_classpath_jdwp_transport_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_transport_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/transport.list
+
+-include gnu/classpath/jdwp/transport.deps
+
+
+gnu_classpath_jdwp_util_source_files = \
+classpath/gnu/classpath/jdwp/util/JdwpString.java \
+classpath/gnu/classpath/jdwp/util/LineTable.java \
+classpath/gnu/classpath/jdwp/util/Location.java \
+classpath/gnu/classpath/jdwp/util/MethodResult.java \
+classpath/gnu/classpath/jdwp/util/Signature.java \
+classpath/gnu/classpath/jdwp/util/Value.java \
+classpath/gnu/classpath/jdwp/util/VariableTable.java
+
+gnu_classpath_jdwp_util_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_classpath_jdwp_util_source_files)))
+
+gnu/classpath/jdwp/util.list: $(gnu_classpath_jdwp_util_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_classpath_jdwp_util_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/classpath/jdwp/util.list
+
+-include gnu/classpath/jdwp/util.deps
+
+
gnu_gcj_source_files = \
gnu/gcj/Core.java \
gnu/gcj/RawData.java \
@@ -265,7 +474,6 @@ classpath/gnu/java/awt/ClasspathToolkit.java \
classpath/gnu/java/awt/ComponentDataBlitOp.java \
classpath/gnu/java/awt/EmbeddedWindow.java \
classpath/gnu/java/awt/EventModifier.java \
-classpath/gnu/java/awt/FocusManager.java \
classpath/gnu/java/awt/GradientPaintContext.java
gnu_java_awt_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_awt_source_files)))
@@ -767,10 +975,10 @@ gnu/java/net.list: $(gnu_java_net_source_files)
gnu_java_net_protocol_file_source_files = \
-gnu/java/net/protocol/file/Connection.java \
-gnu/java/net/protocol/file/Handler.java
+classpath/gnu/java/net/protocol/file/Connection.java \
+classpath/gnu/java/net/protocol/file/Handler.java
-gnu_java_net_protocol_file_header_files = $(patsubst %.java,%.h,$(gnu_java_net_protocol_file_source_files))
+gnu_java_net_protocol_file_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_net_protocol_file_source_files)))
gnu/java/net/protocol/file.list: $(gnu_java_net_protocol_file_source_files)
@$(mkinstalldirs) $(dir $@)
@@ -817,7 +1025,6 @@ gnu/java/net/protocol/ftp.list: $(gnu_java_net_protocol_ftp_source_files)
gnu_java_net_protocol_http_source_files = \
classpath/gnu/java/net/protocol/http/Authenticator.java \
classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java \
-classpath/gnu/java/net/protocol/http/ByteArrayResponseBodyReader.java \
classpath/gnu/java/net/protocol/http/ChunkedInputStream.java \
classpath/gnu/java/net/protocol/http/Cookie.java \
classpath/gnu/java/net/protocol/http/CookieManager.java \
@@ -827,10 +1034,10 @@ classpath/gnu/java/net/protocol/http/HTTPDateFormat.java \
classpath/gnu/java/net/protocol/http/HTTPURLConnection.java \
classpath/gnu/java/net/protocol/http/Handler.java \
classpath/gnu/java/net/protocol/http/Headers.java \
+classpath/gnu/java/net/protocol/http/LimitedLengthInputStream.java \
classpath/gnu/java/net/protocol/http/Request.java \
classpath/gnu/java/net/protocol/http/RequestBodyWriter.java \
classpath/gnu/java/net/protocol/http/Response.java \
-classpath/gnu/java/net/protocol/http/ResponseBodyReader.java \
classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java \
classpath/gnu/java/net/protocol/http/SimpleCookieManager.java
@@ -847,25 +1054,6 @@ gnu/java/net/protocol/http.list: $(gnu_java_net_protocol_http_source_files)
-include gnu/java/net/protocol/http.deps
-gnu_java_net_protocol_http_event_source_files = \
-classpath/gnu/java/net/protocol/http/event/ConnectionEvent.java \
-classpath/gnu/java/net/protocol/http/event/ConnectionListener.java \
-classpath/gnu/java/net/protocol/http/event/RequestEvent.java \
-classpath/gnu/java/net/protocol/http/event/RequestListener.java
-
-gnu_java_net_protocol_http_event_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_net_protocol_http_event_source_files)))
-
-gnu/java/net/protocol/http/event.list: $(gnu_java_net_protocol_http_event_source_files)
- @$(mkinstalldirs) $(dir $@)
- @for file in $(gnu_java_net_protocol_http_event_source_files); do \
- if test -f $(srcdir)/$$file; then \
- echo $(srcdir)/$$file; \
- else echo $$file; fi; \
- done > gnu/java/net/protocol/http/event.list
-
--include gnu/java/net/protocol/http/event.deps
-
-
gnu_java_net_protocol_https_source_files = \
classpath/gnu/java/net/protocol/https/Handler.java
@@ -1092,6 +1280,7 @@ gnu/java/rmi/registry.list: $(gnu_java_rmi_registry_source_files)
gnu_java_rmi_server_source_files = \
classpath/gnu/java/rmi/server/ConnectionRunnerPool.java \
classpath/gnu/java/rmi/server/ProtocolConstants.java \
+classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java \
classpath/gnu/java/rmi/server/RMIDefaultSocketFactory.java \
classpath/gnu/java/rmi/server/RMIHashes.java \
classpath/gnu/java/rmi/server/RMIIncomingThread.java \
@@ -1220,6 +1409,8 @@ classpath/gnu/java/security/provider/DSAParameterGenerator.java \
classpath/gnu/java/security/provider/DSAParameters.java \
classpath/gnu/java/security/provider/DSASignature.java \
classpath/gnu/java/security/provider/DefaultPolicy.java \
+classpath/gnu/java/security/provider/DiffieHellmanKeyFactoryImpl.java \
+classpath/gnu/java/security/provider/DiffieHellmanKeyPairGeneratorImpl.java \
classpath/gnu/java/security/provider/EncodedKeyFactory.java \
classpath/gnu/java/security/provider/Gnu.java \
classpath/gnu/java/security/provider/GnuDHPublicKey.java \
@@ -1384,6 +1575,67 @@ gnu/java/util/prefs.list: $(gnu_java_util_prefs_source_files)
-include gnu/java/util/prefs.deps
+gnu_javax_crypto_source_files = \
+classpath/gnu/javax/crypto/DiffieHellmanImpl.java \
+classpath/gnu/javax/crypto/GnuDHPrivateKey.java \
+classpath/gnu/javax/crypto/RSACipherImpl.java
+
+gnu_javax_crypto_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_crypto_source_files)))
+
+gnu/javax/crypto.list: $(gnu_javax_crypto_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_javax_crypto_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/javax/crypto.list
+
+-include gnu/javax/crypto.deps
+
+
+gnu_javax_imageio_bmp_source_files = \
+classpath/gnu/javax/imageio/bmp/BMPDecoder.java \
+classpath/gnu/javax/imageio/bmp/BMPException.java \
+classpath/gnu/javax/imageio/bmp/BMPFileHeader.java \
+classpath/gnu/javax/imageio/bmp/BMPImageReader.java \
+classpath/gnu/javax/imageio/bmp/BMPImageReaderSpi.java \
+classpath/gnu/javax/imageio/bmp/BMPInfoHeader.java \
+classpath/gnu/javax/imageio/bmp/DecodeBF16.java \
+classpath/gnu/javax/imageio/bmp/DecodeBF32.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB1.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB24.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB4.java \
+classpath/gnu/javax/imageio/bmp/DecodeRGB8.java \
+classpath/gnu/javax/imageio/bmp/DecodeRLE4.java \
+classpath/gnu/javax/imageio/bmp/DecodeRLE8.java
+
+gnu_javax_imageio_bmp_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_imageio_bmp_source_files)))
+
+gnu/javax/imageio/bmp.list: $(gnu_javax_imageio_bmp_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(gnu_javax_imageio_bmp_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > gnu/javax/imageio/bmp.list
+
+-include gnu/javax/imageio/bmp.deps
+
+
+gnu_javax_sound_midi_source_files = \
+classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaMidiSequencerDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaOutputPortDevice.java \
+classpath/gnu/javax/sound/midi/alsa/AlsaPortDevice.java \
+classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java \
+classpath/gnu/javax/sound/midi/dssi/DSSISynthesizer.java
+
+gnu-javax-sound-midi.lo: $(gnu_javax_sound_midi_source_files)
+ @find classpath/lib/gnu/javax/sound/midi -name '*.class' > gnu-javax-sound-midi.list
+ $(LTGCJCOMPILE) -fjni -findirect-dispatch -c -o gnu-javax-sound-midi.lo @gnu-javax-sound-midi.list
+ @rm -f gnu-javax-sound-midi.list
+
gnu_javax_swing_text_html_parser_source_files = \
classpath/gnu/javax/swing/text/html/parser/HTML_401F.java \
classpath/gnu/javax/swing/text/html/parser/gnuDTD.java \
@@ -1668,6 +1920,33 @@ classpath/gnu/xml/pipeline/ValidationConsumer.java \
classpath/gnu/xml/pipeline/WellFormednessFilter.java \
classpath/gnu/xml/pipeline/XIncludeFilter.java \
classpath/gnu/xml/pipeline/XsltFilter.java \
+classpath/gnu/xml/stream/AttributeImpl.java \
+classpath/gnu/xml/stream/CharactersImpl.java \
+classpath/gnu/xml/stream/CommentImpl.java \
+classpath/gnu/xml/stream/DTDImpl.java \
+classpath/gnu/xml/stream/EndDocumentImpl.java \
+classpath/gnu/xml/stream/EndElementImpl.java \
+classpath/gnu/xml/stream/EndEntityImpl.java \
+classpath/gnu/xml/stream/EntityDeclarationImpl.java \
+classpath/gnu/xml/stream/EntityReferenceImpl.java \
+classpath/gnu/xml/stream/FilteredEventReader.java \
+classpath/gnu/xml/stream/FilteredStreamReader.java \
+classpath/gnu/xml/stream/LocationImpl.java \
+classpath/gnu/xml/stream/NamespaceImpl.java \
+classpath/gnu/xml/stream/NotationDeclarationImpl.java \
+classpath/gnu/xml/stream/ProcessingInstructionImpl.java \
+classpath/gnu/xml/stream/StartDocumentImpl.java \
+classpath/gnu/xml/stream/StartElementImpl.java \
+classpath/gnu/xml/stream/StartEntityImpl.java \
+classpath/gnu/xml/stream/XMLEventAllocatorImpl.java \
+classpath/gnu/xml/stream/XMLEventFactoryImpl.java \
+classpath/gnu/xml/stream/XMLEventImpl.java \
+classpath/gnu/xml/stream/XMLEventReaderImpl.java \
+classpath/gnu/xml/stream/XMLEventWriterImpl.java \
+classpath/gnu/xml/stream/XMLInputFactoryImpl.java \
+classpath/gnu/xml/stream/XMLOutputFactoryImpl.java \
+classpath/gnu/xml/stream/XMLStreamReaderImpl.java \
+classpath/gnu/xml/stream/XMLStreamWriterImpl.java \
classpath/gnu/xml/transform/AbstractNumberNode.java \
classpath/gnu/xml/transform/ApplyImportsNode.java \
classpath/gnu/xml/transform/ApplyTemplatesNode.java \
@@ -2469,7 +2748,7 @@ java/io/ObjectInputStream.java \
classpath/java/io/ObjectInputValidation.java \
classpath/java/io/ObjectOutput.java \
classpath/java/io/ObjectOutputStream.java \
-java/io/ObjectStreamClass.java \
+classpath/java/io/ObjectStreamClass.java \
classpath/java/io/ObjectStreamConstants.java \
classpath/java/io/ObjectStreamException.java \
classpath/java/io/ObjectStreamField.java \
@@ -2536,6 +2815,7 @@ classpath/java/lang/Comparable.java \
classpath/java/lang/Compiler.java \
java/lang/ConcreteProcess.java \
java/lang/Double.java \
+classpath/java/lang/EnumConstantNotPresentException.java \
classpath/java/lang/Error.java \
classpath/java/lang/Exception.java \
classpath/java/lang/ExceptionInInitializerError.java \
@@ -2729,7 +3009,7 @@ classpath/java/net/NoRouteToHostException.java \
classpath/java/net/PasswordAuthentication.java \
classpath/java/net/PortUnreachableException.java \
classpath/java/net/ProtocolException.java \
-java/net/ServerSocket.java \
+classpath/java/net/ServerSocket.java \
classpath/java/net/Socket.java \
classpath/java/net/SocketAddress.java \
classpath/java/net/SocketException.java \
@@ -2965,6 +3245,7 @@ classpath/java/rmi/activation/ActivationException.java \
classpath/java/rmi/activation/ActivationGroup.java \
classpath/java/rmi/activation/ActivationGroupDesc.java \
classpath/java/rmi/activation/ActivationGroupID.java \
+classpath/java/rmi/activation/ActivationGroup_Stub.java \
classpath/java/rmi/activation/ActivationID.java \
classpath/java/rmi/activation/ActivationInstantiator.java \
classpath/java/rmi/activation/ActivationMonitor.java \
@@ -3348,7 +3629,7 @@ classpath/java/text/NumberFormat.java \
classpath/java/text/ParseException.java \
classpath/java/text/ParsePosition.java \
classpath/java/text/RuleBasedCollator.java \
-java/text/SimpleDateFormat.java \
+classpath/java/text/SimpleDateFormat.java \
classpath/java/text/StringCharacterIterator.java
java_text_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_text_source_files)))
@@ -3379,7 +3660,7 @@ classpath/java/util/Collections.java \
classpath/java/util/Comparator.java \
classpath/java/util/ConcurrentModificationException.java \
java/util/Currency.java \
-java/util/Date.java \
+classpath/java/util/Date.java \
classpath/java/util/Dictionary.java \
classpath/java/util/EmptyStackException.java \
classpath/java/util/Enumeration.java \
@@ -3391,6 +3672,7 @@ classpath/java/util/HashMap.java \
classpath/java/util/HashSet.java \
classpath/java/util/Hashtable.java \
classpath/java/util/IdentityHashMap.java \
+classpath/java/util/InvalidPropertiesFormatException.java \
classpath/java/util/Iterator.java \
classpath/java/util/LinkedHashMap.java \
classpath/java/util/LinkedHashSet.java \
@@ -3413,7 +3695,7 @@ classpath/java/util/Random.java \
classpath/java/util/RandomAccess.java \
java/util/ResourceBundle.java \
classpath/java/util/Set.java \
-java/util/SimpleTimeZone.java \
+classpath/java/util/SimpleTimeZone.java \
classpath/java/util/SortedMap.java \
classpath/java/util/SortedSet.java \
classpath/java/util/Stack.java \
@@ -3550,9 +3832,9 @@ java/util/zip/GZIPOutputStream.java \
java/util/zip/Inflater.java \
java/util/zip/InflaterInputStream.java \
classpath/java/util/zip/ZipConstants.java \
-java/util/zip/ZipEntry.java \
+classpath/java/util/zip/ZipEntry.java \
classpath/java/util/zip/ZipException.java \
-java/util/zip/ZipFile.java \
+classpath/java/util/zip/ZipFile.java \
classpath/java/util/zip/ZipInputStream.java \
classpath/java/util/zip/ZipOutputStream.java
@@ -3709,15 +3991,12 @@ classpath/javax/imageio/event/IIOReadUpdateListener.java \
classpath/javax/imageio/event/IIOReadWarningListener.java \
classpath/javax/imageio/event/IIOWriteProgressListener.java \
classpath/javax/imageio/event/IIOWriteWarningListener.java \
-classpath/javax/imageio/metadata/IIOAttr.java \
classpath/javax/imageio/metadata/IIOInvalidTreeException.java \
classpath/javax/imageio/metadata/IIOMetadata.java \
classpath/javax/imageio/metadata/IIOMetadataController.java \
classpath/javax/imageio/metadata/IIOMetadataFormat.java \
classpath/javax/imageio/metadata/IIOMetadataFormatImpl.java \
classpath/javax/imageio/metadata/IIOMetadataNode.java \
-classpath/javax/imageio/metadata/IIONamedNodeMap.java \
-classpath/javax/imageio/metadata/IIONodeList.java \
classpath/javax/imageio/spi/IIORegistry.java \
classpath/javax/imageio/spi/IIOServiceProvider.java \
classpath/javax/imageio/spi/ImageInputStreamSpi.java \
@@ -4301,6 +4580,120 @@ javax/security/sasl.list: $(javax_security_sasl_source_files)
-include javax/security/sasl.deps
+javax_sound_midi_source_files = \
+classpath/javax/sound/midi/ControllerEventListener.java \
+classpath/javax/sound/midi/Instrument.java \
+classpath/javax/sound/midi/InvalidMidiDataException.java \
+classpath/javax/sound/midi/MetaEventListener.java \
+classpath/javax/sound/midi/MetaMessage.java \
+classpath/javax/sound/midi/MidiChannel.java \
+classpath/javax/sound/midi/MidiDevice.java \
+classpath/javax/sound/midi/MidiEvent.java \
+classpath/javax/sound/midi/MidiFileFormat.java \
+classpath/javax/sound/midi/MidiMessage.java \
+classpath/javax/sound/midi/MidiSystem.java \
+classpath/javax/sound/midi/MidiUnavailableException.java \
+classpath/javax/sound/midi/Patch.java \
+classpath/javax/sound/midi/Receiver.java \
+classpath/javax/sound/midi/Sequence.java \
+classpath/javax/sound/midi/Sequencer.java \
+classpath/javax/sound/midi/ShortMessage.java \
+classpath/javax/sound/midi/Soundbank.java \
+classpath/javax/sound/midi/SoundbankResource.java \
+classpath/javax/sound/midi/Synthesizer.java \
+classpath/javax/sound/midi/SysexMessage.java \
+classpath/javax/sound/midi/Track.java \
+classpath/javax/sound/midi/Transmitter.java \
+classpath/javax/sound/midi/VoiceStatus.java
+
+javax_sound_midi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_midi_source_files)))
+
+javax/sound/midi.list: $(javax_sound_midi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_midi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/midi.list
+
+-include javax/sound/midi.deps
+
+
+javax_sound_midi_spi_source_files = \
+classpath/javax/sound/midi/spi/MidiDeviceProvider.java \
+classpath/javax/sound/midi/spi/MidiFileReader.java \
+classpath/javax/sound/midi/spi/MidiFileWriter.java \
+classpath/javax/sound/midi/spi/SoundbankReader.java
+
+javax_sound_midi_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_midi_spi_source_files)))
+
+javax/sound/midi/spi.list: $(javax_sound_midi_spi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_midi_spi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/midi/spi.list
+
+-include javax/sound/midi/spi.deps
+
+
+javax_sound_sampled_source_files = \
+classpath/javax/sound/sampled/AudioFileFormat.java \
+classpath/javax/sound/sampled/AudioFormat.java \
+classpath/javax/sound/sampled/AudioInputStream.java \
+classpath/javax/sound/sampled/AudioPermission.java \
+classpath/javax/sound/sampled/AudioSystem.java \
+classpath/javax/sound/sampled/BooleanControl.java \
+classpath/javax/sound/sampled/Clip.java \
+classpath/javax/sound/sampled/CompoundControl.java \
+classpath/javax/sound/sampled/Control.java \
+classpath/javax/sound/sampled/DataLine.java \
+classpath/javax/sound/sampled/EnumControl.java \
+classpath/javax/sound/sampled/FloatControl.java \
+classpath/javax/sound/sampled/Line.java \
+classpath/javax/sound/sampled/LineEvent.java \
+classpath/javax/sound/sampled/LineListener.java \
+classpath/javax/sound/sampled/LineUnavailableException.java \
+classpath/javax/sound/sampled/Mixer.java \
+classpath/javax/sound/sampled/Port.java \
+classpath/javax/sound/sampled/ReverbType.java \
+classpath/javax/sound/sampled/SourceDataLine.java \
+classpath/javax/sound/sampled/TargetDataLine.java \
+classpath/javax/sound/sampled/UnsupportedAudioFileException.java
+
+javax_sound_sampled_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_sampled_source_files)))
+
+javax/sound/sampled.list: $(javax_sound_sampled_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_sampled_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/sampled.list
+
+-include javax/sound/sampled.deps
+
+
+javax_sound_sampled_spi_source_files = \
+classpath/javax/sound/sampled/spi/AudioFileReader.java \
+classpath/javax/sound/sampled/spi/AudioFileWriter.java \
+classpath/javax/sound/sampled/spi/FormatConversionProvider.java \
+classpath/javax/sound/sampled/spi/MixerProvider.java
+
+javax_sound_sampled_spi_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_sound_sampled_spi_source_files)))
+
+javax/sound/sampled/spi.list: $(javax_sound_sampled_spi_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ @for file in $(javax_sound_sampled_spi_source_files); do \
+ if test -f $(srcdir)/$$file; then \
+ echo $(srcdir)/$$file; \
+ else echo $$file; fi; \
+ done > javax/sound/sampled/spi.list
+
+-include javax/sound/sampled/spi.deps
+
+
javax_sql_source_files = \
classpath/javax/sql/ConnectionEvent.java \
classpath/javax/sql/ConnectionEventListener.java \
@@ -4414,6 +4807,7 @@ classpath/javax/swing/JTree.java \
classpath/javax/swing/JViewport.java \
classpath/javax/swing/JWindow.java \
classpath/javax/swing/KeyStroke.java \
+classpath/javax/swing/KeyboardManager.java \
classpath/javax/swing/LayoutFocusTraversalPolicy.java \
classpath/javax/swing/ListCellRenderer.java \
classpath/javax/swing/ListModel.java \
@@ -4724,22 +5118,28 @@ javax/swing/plaf/basic.list: $(javax_swing_plaf_basic_source_files)
javax_swing_plaf_metal_source_files = \
classpath/javax/swing/plaf/metal/DefaultMetalTheme.java \
classpath/javax/swing/plaf/metal/MetalBorders.java \
+classpath/javax/swing/plaf/metal/MetalButtonListener.java \
classpath/javax/swing/plaf/metal/MetalButtonUI.java \
classpath/javax/swing/plaf/metal/MetalCheckBoxIcon.java \
classpath/javax/swing/plaf/metal/MetalCheckBoxUI.java \
+classpath/javax/swing/plaf/metal/MetalComboBoxButton.java \
+classpath/javax/swing/plaf/metal/MetalComboBoxEditor.java \
classpath/javax/swing/plaf/metal/MetalComboBoxIcon.java \
classpath/javax/swing/plaf/metal/MetalComboBoxUI.java \
classpath/javax/swing/plaf/metal/MetalDesktopIconUI.java \
+classpath/javax/swing/plaf/metal/MetalFileChooserUI.java \
classpath/javax/swing/plaf/metal/MetalIconFactory.java \
classpath/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java \
classpath/javax/swing/plaf/metal/MetalInternalFrameUI.java \
classpath/javax/swing/plaf/metal/MetalLabelUI.java \
classpath/javax/swing/plaf/metal/MetalLookAndFeel.java \
+classpath/javax/swing/plaf/metal/MetalMenuBarUI.java \
classpath/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java \
classpath/javax/swing/plaf/metal/MetalProgressBarUI.java \
classpath/javax/swing/plaf/metal/MetalRadioButtonUI.java \
classpath/javax/swing/plaf/metal/MetalRootPaneUI.java \
classpath/javax/swing/plaf/metal/MetalScrollBarUI.java \
+classpath/javax/swing/plaf/metal/MetalScrollButton.java \
classpath/javax/swing/plaf/metal/MetalScrollPaneUI.java \
classpath/javax/swing/plaf/metal/MetalSeparatorUI.java \
classpath/javax/swing/plaf/metal/MetalSliderUI.java \
@@ -4752,7 +5152,8 @@ classpath/javax/swing/plaf/metal/MetalToggleButtonUI.java \
classpath/javax/swing/plaf/metal/MetalToolBarUI.java \
classpath/javax/swing/plaf/metal/MetalToolTipUI.java \
classpath/javax/swing/plaf/metal/MetalTreeUI.java \
-classpath/javax/swing/plaf/metal/MetalUtils.java
+classpath/javax/swing/plaf/metal/MetalUtils.java \
+classpath/javax/swing/plaf/metal/OceanTheme.java
javax_swing_plaf_metal_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_swing_plaf_metal_source_files)))
@@ -4854,6 +5255,7 @@ classpath/javax/swing/text/DefaultEditorKit.java \
classpath/javax/swing/text/DefaultFormatter.java \
classpath/javax/swing/text/DefaultHighlighter.java \
classpath/javax/swing/text/DefaultStyledDocument.java \
+classpath/javax/swing/text/DefaultTextUI.java \
classpath/javax/swing/text/Document.java \
classpath/javax/swing/text/DocumentFilter.java \
classpath/javax/swing/text/EditorKit.java \
@@ -4893,7 +5295,8 @@ classpath/javax/swing/text/TabableView.java \
classpath/javax/swing/text/TextAction.java \
classpath/javax/swing/text/Utilities.java \
classpath/javax/swing/text/View.java \
-classpath/javax/swing/text/ViewFactory.java
+classpath/javax/swing/text/ViewFactory.java \
+classpath/javax/swing/text/WrappedPlainView.java
javax_swing_text_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(javax_swing_text_source_files)))
@@ -4909,6 +5312,7 @@ javax/swing/text.list: $(javax_swing_text_source_files)
javax_swing_text_html_source_files = \
+classpath/javax/swing/text/html/CSS.java \
classpath/javax/swing/text/html/HTML.java \
classpath/javax/swing/text/html/HTMLDocument.java \
classpath/javax/swing/text/html/HTMLEditorKit.java \
@@ -5092,6 +5496,43 @@ classpath/javax/xml/parsers/FactoryConfigurationError.java \
classpath/javax/xml/parsers/ParserConfigurationException.java \
classpath/javax/xml/parsers/SAXParser.java \
classpath/javax/xml/parsers/SAXParserFactory.java \
+classpath/javax/xml/stream/EventFilter.java \
+classpath/javax/xml/stream/FactoryConfigurationError.java \
+classpath/javax/xml/stream/Location.java \
+classpath/javax/xml/stream/StreamFilter.java \
+classpath/javax/xml/stream/XMLEventFactory.java \
+classpath/javax/xml/stream/XMLEventReader.java \
+classpath/javax/xml/stream/XMLEventWriter.java \
+classpath/javax/xml/stream/XMLFilter.java \
+classpath/javax/xml/stream/XMLInputFactory.java \
+classpath/javax/xml/stream/XMLIterator.java \
+classpath/javax/xml/stream/XMLOutputFactory.java \
+classpath/javax/xml/stream/XMLReporter.java \
+classpath/javax/xml/stream/XMLResolver.java \
+classpath/javax/xml/stream/XMLStreamConstants.java \
+classpath/javax/xml/stream/XMLStreamException.java \
+classpath/javax/xml/stream/XMLStreamReader.java \
+classpath/javax/xml/stream/XMLStreamWriter.java \
+classpath/javax/xml/stream/events/Attribute.java \
+classpath/javax/xml/stream/events/Characters.java \
+classpath/javax/xml/stream/events/Comment.java \
+classpath/javax/xml/stream/events/DTD.java \
+classpath/javax/xml/stream/events/EndDocument.java \
+classpath/javax/xml/stream/events/EndElement.java \
+classpath/javax/xml/stream/events/EndEntity.java \
+classpath/javax/xml/stream/events/EntityDeclaration.java \
+classpath/javax/xml/stream/events/EntityReference.java \
+classpath/javax/xml/stream/events/Namespace.java \
+classpath/javax/xml/stream/events/NotationDeclaration.java \
+classpath/javax/xml/stream/events/ProcessingInstruction.java \
+classpath/javax/xml/stream/events/StartDocument.java \
+classpath/javax/xml/stream/events/StartElement.java \
+classpath/javax/xml/stream/events/StartEntity.java \
+classpath/javax/xml/stream/events/XMLEvent.java \
+classpath/javax/xml/stream/util/EventReaderDelegate.java \
+classpath/javax/xml/stream/util/ReaderDelegate.java \
+classpath/javax/xml/stream/util/XMLEventAllocator.java \
+classpath/javax/xml/stream/util/XMLEventConsumer.java \
classpath/javax/xml/transform/ErrorListener.java \
classpath/javax/xml/transform/OutputKeys.java \
classpath/javax/xml/transform/Result.java \
@@ -5361,6 +5802,14 @@ all_packages_source_files = \
gnu/awt/j2d.list \
gnu/classpath.list \
gnu/classpath/debug.list \
+ gnu/classpath/jdwp.list \
+ gnu/classpath/jdwp/event.list \
+ gnu/classpath/jdwp/event/filters.list \
+ gnu/classpath/jdwp/exception.list \
+ gnu/classpath/jdwp/id.list \
+ gnu/classpath/jdwp/processor.list \
+ gnu/classpath/jdwp/transport.list \
+ gnu/classpath/jdwp/util.list \
gnu/gcj.list \
gnu/gcj/convert.list \
gnu/gcj/io.list \
@@ -5379,7 +5828,6 @@ all_packages_source_files = \
gnu/java/net/protocol/file.list \
gnu/java/net/protocol/ftp.list \
gnu/java/net/protocol/http.list \
- gnu/java/net/protocol/http/event.list \
gnu/java/net/protocol/https.list \
gnu/java/net/protocol/jar.list \
gnu/java/nio.list \
@@ -5401,6 +5849,8 @@ all_packages_source_files = \
gnu/java/text.list \
gnu/java/util.list \
gnu/java/util/prefs.list \
+ gnu/javax/crypto.list \
+ gnu/javax/imageio/bmp.list \
gnu/javax/swing/text/html/parser.list \
gnu/javax/swing/text/html/parser/models.list \
gnu/javax/swing/text/html/parser/support.list \
@@ -5475,6 +5925,10 @@ all_packages_source_files = \
javax/security/auth/x500.list \
javax/security/cert.list \
javax/security/sasl.list \
+ javax/sound/midi.list \
+ javax/sound/midi/spi.list \
+ javax/sound/sampled.list \
+ javax/sound/sampled/spi.list \
javax/sql.list \
javax/swing.list \
javax/swing/border.list \
@@ -5501,6 +5955,14 @@ ordinary_header_files = \
$(gnu_awt_j2d_header_files) \
$(gnu_classpath_header_files) \
$(gnu_classpath_debug_header_files) \
+ $(gnu_classpath_jdwp_header_files) \
+ $(gnu_classpath_jdwp_event_header_files) \
+ $(gnu_classpath_jdwp_event_filters_header_files) \
+ $(gnu_classpath_jdwp_exception_header_files) \
+ $(gnu_classpath_jdwp_id_header_files) \
+ $(gnu_classpath_jdwp_processor_header_files) \
+ $(gnu_classpath_jdwp_transport_header_files) \
+ $(gnu_classpath_jdwp_util_header_files) \
$(gnu_gcj_header_files) \
$(gnu_gcj_convert_header_files) \
$(gnu_gcj_io_header_files) \
@@ -5519,7 +5981,6 @@ ordinary_header_files = \
$(gnu_java_net_protocol_file_header_files) \
$(gnu_java_net_protocol_ftp_header_files) \
$(gnu_java_net_protocol_http_header_files) \
- $(gnu_java_net_protocol_http_event_header_files) \
$(gnu_java_net_protocol_https_header_files) \
$(gnu_java_net_protocol_jar_header_files) \
$(gnu_java_nio_header_files) \
@@ -5541,6 +6002,8 @@ ordinary_header_files = \
$(gnu_java_text_header_files) \
$(gnu_java_util_header_files) \
$(gnu_java_util_prefs_header_files) \
+ $(gnu_javax_crypto_header_files) \
+ $(gnu_javax_imageio_bmp_header_files) \
$(gnu_javax_swing_text_html_parser_header_files) \
$(gnu_javax_swing_text_html_parser_models_header_files) \
$(gnu_javax_swing_text_html_parser_support_header_files) \
@@ -5615,6 +6078,10 @@ ordinary_header_files = \
$(javax_security_auth_x500_header_files) \
$(javax_security_cert_header_files) \
$(javax_security_sasl_header_files) \
+ $(javax_sound_midi_header_files) \
+ $(javax_sound_midi_spi_header_files) \
+ $(javax_sound_sampled_header_files) \
+ $(javax_sound_sampled_spi_header_files) \
$(javax_sql_header_files) \
$(javax_swing_header_files) \
$(javax_swing_border_header_files) \
@@ -5638,6 +6105,7 @@ ordinary_header_files = \
bc_objects = \
gnu-java-beans.lo \
+ gnu-javax-sound-midi.lo \
gnu-xml.lo \
javax-imageio.lo \
javax-xml.lo \
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f60ef609999..9b6a0b0a3e0 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,71 @@
+2005-11-18 Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/rc_string_base.h (__rc_string_base<>::_Rep): Avoid the
+ anonymous struct extension, adjust everywhere.
+
+ * include/ext/rc_string_base.h (__rc_string_base<>::_S_empty_rep()):
+ Just use a static member.
+ (__rc_string_base<>::__rc_string_base(), _S_construct): Adjust.
+
+ * include/ext/rc_string_base.h (__rc_string_base<>::_Rep): Use anonymous
+ union together with _CharT to fix alignment issues, rebind to _Rep and
+ rename _Raw_alloc to _Rep_alloc_type.
+ (__rc_string_base<>::_Rep::_S_create, _M_destroy): Adjust consistently.
+
+ * include/ext/vstring_util.h (__is_null_p): Move inside struct
+ __vstring_utility as static _S_is_null_pointer.
+ * include/ext/sso_string.h
+ (__sso_string_base<>::_M_construct(std::forward_iterator_tag): Adjust.
+ * include/ext/rc_string_base.h
+ (__rc_string_base<>::_S_construct(std::forward_iterator_tag): Likewise.
+
+ Implement Option 3 of DR 431 for ext/vstring - both available bases.
+ * include/bits/cpp_type_traits.h (struct __is_empty): Add.
+ * include/ext/vstring.h (__versa_string<>::swap): Delegate to
+ this->_M_swap.
+ * include/ext/vstring.tcc (__versa_string<>::swap): Remove.
+ * include/ext/vstring_util.h (struct __vstring_utility<>): Add struct
+ _Alloc_hider<>, augmented of allocator swapping facility, specialized
+ to nop for empty allocators.
+ * include/ext/rc_string_base.h (__rc_string_base<>::_M_swap): Use it.
+ (__rc_string_base<>::_M_is_leaked, _M_set_sharable): Change to private.
+ * include/ext/sso_string_base.h (__sso_string_base<>::_M_swap):
+ Likewise.
+ (__sso_string_base<>::_M_is_leaked, _M_set_sharable): Remove, unused.
+
+ * include/ext/rc_string_base.h (__rc_string_base<>::_M_data(_CharT*):
+ Return void.
+ * include/ext/sso_string_base.h (__sso_string_base<>::_M_data(_CharT*):
+ Likewise.
+
+2005-11-17 Geoffrey Keating <geoffk@apple.com>
+
+ * config/os/bsd/darwin/ppc-extra.ver: New.
+ * src/Makefile.am (libstdc++-symbol.ver): Move outside conditionals,
+ and make dependent on port symbol files.
+ (libstdc++-symbol.explist): Use the generated .ver file, not
+ the template.
+ * src/compatibility.cc [APPLE] (__eprintf): New.
+ * src/Makefile.in: Regenerate.
+ * configure.host (powerpc*-*-darwin*): Define
+ port_specific_symbol_files.
+
+2005-11-16 Nathan Sidwell <nathan@codesourcery.com>
+
+ * libsupc++/eh_arm.cc (__cxa_begin_cleanup): Remember a
+ foreign exception too.
+ (__gnu_end_cleanup): Recover a foreign exception too.
+ * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Cope
+ with forced unwinding.
+ * libsupc++/eh_throw.cc (__cxxabiv1::__cxa_rethrow): Use
+ _Unwind_Resume_or_Rethrow for ARM EABI.
+
+2005-11-14 Geoffrey Keating <geoffk@apple.com>
+
+ * acinclude.m4 (GLIBCXX_CHECK_LINKER_FEATURES): Don't check for
+ shared libgcc for darwin exports.
+ * configure: Regenerate.
+
2005-11-13 Jonathan Wakely <redi@gcc.gnu.org>
* include/tr1/boost_shared_ptr.h (get_deleter):
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index c4d31d93a13..f4d11bfabbf 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1711,8 +1711,9 @@ if test x$enable_symvers = xyes ; then
fi
fi
-# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
-if test $enable_symvers != no; then
+# Check to see if 'gnu' can win.
+if test $enable_symvers = gnu; then
+ # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
AC_MSG_CHECKING([for shared libgcc])
ac_save_CFLAGS="$CFLAGS"
CFLAGS=' -lgcc_s'
@@ -1736,25 +1737,18 @@ changequote([,])dnl
fi
fi
AC_MSG_RESULT($glibcxx_shared_libgcc)
-fi
-
-# If no shared libgcc, can't win.
-if test $glibcxx_shared_libgcc != yes &&
- test $enable_symvers != no ; then
- AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
- AC_MSG_WARN([=== you are not building a shared libgcc_s.])
- AC_MSG_WARN([=== Symbol versioning will be disabled.])
- enable_symvers=no
- enable_symvers=no
-fi
-# Check to see if 'gnu' can win.
-if test $enable_symvers = gnu; then
# For GNU ld, we need at least this version. The format is described in
# GLIBCXX_CHECK_LINKER_FEATURES above.
glibcxx_min_gnu_ld_version=21400
- if test $with_gnu_ld != yes ; then
+ # If no shared libgcc, can't win.
+ if test $glibcxx_shared_libgcc != yes; then
+ AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
+ AC_MSG_WARN([=== you are not building a shared libgcc_s.])
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ elif test $with_gnu_ld != yes ; then
# just fail for now
AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
AC_MSG_WARN([=== you are not using the GNU linker.])
diff --git a/libstdc++-v3/config/os/bsd/darwin/ppc-extra.ver b/libstdc++-v3/config/os/bsd/darwin/ppc-extra.ver
new file mode 100644
index 00000000000..ffe32b65658
--- /dev/null
+++ b/libstdc++-v3/config/os/bsd/darwin/ppc-extra.ver
@@ -0,0 +1 @@
+ __eprintf;
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index fb830d4a103..21a20bc427a 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -87275,8 +87275,9 @@ echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
fi
fi
-# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
-if test $enable_symvers != no; then
+# Check to see if 'gnu' can win.
+if test $enable_symvers = gnu; then
+ # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
echo "$as_me:$LINENO: checking for shared libgcc" >&5
echo $ECHO_N "checking for shared libgcc... $ECHO_C" >&6
ac_save_CFLAGS="$CFLAGS"
@@ -87399,28 +87400,21 @@ rm -f conftest.err conftest.$ac_objext \
fi
echo "$as_me:$LINENO: result: $glibcxx_shared_libgcc" >&5
echo "${ECHO_T}$glibcxx_shared_libgcc" >&6
-fi
-
-# If no shared libgcc, can't win.
-if test $glibcxx_shared_libgcc != yes &&
- test $enable_symvers != no ; then
- { echo "$as_me:$LINENO: WARNING: === You have requested some kind of symbol versioning, but" >&5
-echo "$as_me: WARNING: === You have requested some kind of symbol versioning, but" >&2;}
- { echo "$as_me:$LINENO: WARNING: === you are not building a shared libgcc_s." >&5
-echo "$as_me: WARNING: === you are not building a shared libgcc_s." >&2;}
- { echo "$as_me:$LINENO: WARNING: === Symbol versioning will be disabled." >&5
-echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
- enable_symvers=no
- enable_symvers=no
-fi
-# Check to see if 'gnu' can win.
-if test $enable_symvers = gnu; then
# For GNU ld, we need at least this version. The format is described in
# GLIBCXX_CHECK_LINKER_FEATURES above.
glibcxx_min_gnu_ld_version=21400
- if test $with_gnu_ld != yes ; then
+ # If no shared libgcc, can't win.
+ if test $glibcxx_shared_libgcc != yes; then
+ { echo "$as_me:$LINENO: WARNING: === You have requested GNU symbol versioning, but" >&5
+echo "$as_me: WARNING: === You have requested GNU symbol versioning, but" >&2;}
+ { echo "$as_me:$LINENO: WARNING: === you are not building a shared libgcc_s." >&5
+echo "$as_me: WARNING: === you are not building a shared libgcc_s." >&2;}
+ { echo "$as_me:$LINENO: WARNING: === Symbol versioning will be disabled." >&5
+echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;}
+ enable_symvers=no
+ elif test $with_gnu_ld != yes ; then
# just fail for now
{ echo "$as_me:$LINENO: WARNING: === You have requested GNU symbol versioning, but" >&5
echo "$as_me: WARNING: === You have requested GNU symbol versioning, but" >&2;}
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index aecdebc55d1..de48517144b 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -282,6 +282,9 @@ case "${host}" in
abi_baseline_pair="mips-linux-gnu"
cpu_include_dir="cpu/mips"
;;
+ powerpc*-*-darwin*)
+ port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
+ ;;
powerpc64-*-linux*)
abi_baseline_pair="powerpc64-linux-gnu"
;;
diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
index f02caab0311..5ac9c98e704 100644
--- a/libstdc++-v3/include/bits/cpp_type_traits.h
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -364,6 +364,26 @@ namespace std
};
};
+ //
+ // A stripped-down version of std::tr1::is_empty
+ //
+ template<typename _Tp>
+ struct __is_empty
+ {
+ private:
+ template<typename>
+ struct __first { };
+ template<typename _Up>
+ struct __second
+ : public _Up { };
+
+ public:
+ enum
+ {
+ __value = sizeof(__first<_Tp>) == sizeof(__second<_Tp>)
+ };
+ };
+
} // namespace std
#endif //_CPP_TYPE_TRAITS_H
diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h
index e462680eddf..58994222eae 100644
--- a/libstdc++-v3/include/ext/rc_string_base.h
+++ b/libstdc++-v3/include/ext/rc_string_base.h
@@ -92,8 +92,8 @@ namespace __gnu_cxx
typedef typename _Traits::char_type value_type;
typedef _Alloc allocator_type;
- typedef typename __vstring_utility<_CharT, _Traits, _Alloc>::
- _CharT_alloc_type _CharT_alloc_type;
+ typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base;
+ typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type;
typedef typename _CharT_alloc_type::size_type size_type;
private:
@@ -107,16 +107,25 @@ namespace __gnu_cxx
// -1: leaked, one reference, no ref-copies allowed, non-const.
// 0: one reference, non-const.
// n>0: n + 1 references, operations require a lock, const.
- // 4. All fields==0 is an empty string, given the extra storage
+ // 4. All fields == 0 is an empty string, given the extra storage
// beyond-the-end for a null terminator; thus, the shared
// empty string representation needs no constructor.
struct _Rep
{
- size_type _M_length;
- size_type _M_capacity;
- _Atomic_word _M_refcount;
+ union
+ {
+ struct
+ {
+ size_type _M_length;
+ size_type _M_capacity;
+ _Atomic_word _M_refcount;
+ } _M_info;
+
+ // Only for alignment purposes.
+ _CharT _M_align;
+ };
- typedef typename _Alloc::template rebind<size_type>::other _Raw_alloc;
+ typedef typename _Alloc::template rebind<_Rep>::other _Rep_alloc_type;
_CharT*
_M_refdata() throw()
@@ -125,15 +134,15 @@ namespace __gnu_cxx
_CharT*
_M_refcopy() throw()
{
- __atomic_add(&_M_refcount, 1);
+ __atomic_add(&_M_info._M_refcount, 1);
return _M_refdata();
} // XXX MT
void
_M_set_length(size_type __n)
{
- _M_refcount = 0; // One reference.
- _M_length = __n;
+ _M_info._M_refcount = 0; // One reference.
+ _M_info._M_length = __n;
// grrr. (per 21.3.4)
// You cannot leave those LWG people alone for a second.
traits_type::assign(_M_refdata()[__n], _CharT());
@@ -150,11 +159,14 @@ namespace __gnu_cxx
_M_clone(const _Alloc&, size_type __res = 0);
};
- struct _Rep_empty : _Rep
+ struct _Rep_empty
+ : public _Rep
{
- _CharT _M_terminal;
+ _CharT _M_terminal;
};
+ static _Rep_empty _S_empty_rep;
+
// The maximum number of individual char_type elements of an
// individual string is determined by _S_max_size. This is the
// value that will be returned by max_size(). (Whereas npos
@@ -169,28 +181,12 @@ namespace __gnu_cxx
enum { _S_max_size = (((static_cast<size_type>(-1) - sizeof(_Rep))
/ sizeof(_CharT)) - 1) / 4 };
- // Use empty-base optimization: http://www.cantrip.org/emptyopt.html
- struct _Alloc_hider : _Alloc
- {
- _Alloc_hider(_CharT* __dat, const _Alloc& __a)
- : _Alloc(__a), _M_p(__dat) { }
-
- _CharT* _M_p; // The actual data.
- };
-
// Data Member (private):
- mutable _Alloc_hider _M_dataplus;
-
- static _Rep_empty&
- _S_empty_rep()
- {
- static _Rep_empty _Empty_rep;
- return _Empty_rep;
- }
+ mutable typename _Util_Base::template _Alloc_hider<_Alloc> _M_dataplus;
- _CharT*
+ void
_M_data(_CharT* __p)
- { return (_M_dataplus._M_p = __p); }
+ { _M_dataplus._M_p = __p; }
_Rep*
_M_rep() const
@@ -206,15 +202,23 @@ namespace __gnu_cxx
void
_M_dispose(const _Alloc& __a)
{
- if (__exchange_and_add(&_M_rep()->_M_refcount, -1) <= 0)
+ if (__exchange_and_add(&_M_rep()->_M_info._M_refcount, -1) <= 0)
_M_rep()->_M_destroy(__a);
} // XXX MT
+ bool
+ _M_is_leaked() const
+ { return _M_rep()->_M_info._M_refcount < 0; }
+
+ void
+ _M_set_sharable()
+ { _M_rep()->_M_info._M_refcount = 0; }
+
void
_M_leak_hard();
// _S_construct_aux is used to implement the 21.3.1 para 15 which
- // requires special behaviour if _InIter is an integral type
+ // requires special behaviour if _InIterator is an integral type
template<class _InIterator>
static _CharT*
_S_construct_aux(_InIterator __beg, _InIterator __end,
@@ -266,31 +270,19 @@ namespace __gnu_cxx
size_type
_M_length() const
- { return _M_rep()->_M_length; }
+ { return _M_rep()->_M_info._M_length; }
size_type
_M_capacity() const
- { return _M_rep()->_M_capacity; }
+ { return _M_rep()->_M_info._M_capacity; }
bool
_M_is_shared() const
- { return _M_rep()->_M_refcount > 0; }
-
- bool
- _M_is_leaked() const
- { return _M_rep()->_M_refcount < 0; }
-
- void
- _M_set_sharable()
- { _M_rep()->_M_refcount = 0; }
+ { return _M_rep()->_M_info._M_refcount > 0; }
void
_M_set_leaked()
- { _M_rep()->_M_refcount = -1; }
-
- void
- _M_set_length(size_type __n)
- { _M_rep()->_M_set_length(__n); }
+ { _M_rep()->_M_info._M_refcount = -1; }
void
_M_leak() // for use in begin() & non-const op[]
@@ -299,8 +291,12 @@ namespace __gnu_cxx
_M_leak_hard();
}
+ void
+ _M_set_length(size_type __n)
+ { _M_rep()->_M_set_length(__n); }
+
__rc_string_base()
- : _M_dataplus(_S_empty_rep()._M_refcopy(), _Alloc()) { }
+ : _M_dataplus(_Alloc(), _S_empty_rep._M_refcopy()) { }
__rc_string_base(const _Alloc& __a);
@@ -310,7 +306,7 @@ namespace __gnu_cxx
template<typename _InputIterator>
__rc_string_base(_InputIterator __beg, _InputIterator __end,
- const _Alloc& __a);
+ const _Alloc& __a);
~__rc_string_base()
{ _M_dispose(_M_get_allocator()); }
@@ -320,12 +316,7 @@ namespace __gnu_cxx
{ return _M_dataplus; }
void
- _M_swap(__rc_string_base& __rcs)
- {
- _CharT* __tmp = _M_data();
- _M_data(__rcs._M_data());
- __rcs._M_data(__tmp);
- }
+ _M_swap(__rc_string_base& __rcs);
void
_M_assign(const __rc_string_base& __rcs);
@@ -338,6 +329,10 @@ namespace __gnu_cxx
};
template<typename _CharT, typename _Traits, typename _Alloc>
+ typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep_empty
+ __rc_string_base<_CharT, _Traits, _Alloc>::_S_empty_rep;
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep*
__rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
_S_create(size_type __capacity, size_type __old_capacity,
@@ -388,8 +383,8 @@ namespace __gnu_cxx
// plus sizeof(size_type) - 1 to upper round to a size multiple
// of sizeof(size_type).
// Whew. Seemingly so needy, yet so elemental.
- size_type __size = ((__capacity + 1) * sizeof(_CharT) + sizeof(_Rep)
- + sizeof(size_type) - 1);
+ size_type __size = ((__capacity + 1) * sizeof(_CharT)
+ + 2 * sizeof(_Rep) - 1);
const size_type __adj_size = __size + __malloc_header_size;
if (__adj_size > __pagesize && __capacity > __old_capacity)
@@ -399,16 +394,14 @@ namespace __gnu_cxx
// Never allocate a string bigger than _S_max_size.
if (__capacity > size_type(_S_max_size))
__capacity = size_type(_S_max_size);
- __size = ((__capacity + 1) * sizeof(_CharT) + sizeof(_Rep)
- + sizeof(size_type) - 1);
+ __size = (__capacity + 1) * sizeof(_CharT) + 2 * sizeof(_Rep) - 1;
}
// NB: Might throw, but no worries about a leak, mate: _Rep()
// does not throw.
- void* __place = _Raw_alloc(__alloc).allocate(__size
- / sizeof(size_type));
- _Rep *__p = new (__place) _Rep;
- __p->_M_capacity = __capacity;
+ _Rep* __place = _Rep_alloc_type(__alloc).allocate(__size / sizeof(_Rep));
+ _Rep* __p = new (__place) _Rep;
+ __p->_M_info._M_capacity = __capacity;
return __p;
}
@@ -417,10 +410,9 @@ namespace __gnu_cxx
__rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
_M_destroy(const _Alloc& __a) throw ()
{
- const size_type __size = ((_M_capacity + 1) * sizeof(_CharT)
- + sizeof(_Rep) + sizeof(size_type) - 1);
- _Raw_alloc(__a).deallocate(reinterpret_cast<size_type*>(this),
- __size / sizeof(size_type));
+ const size_type __size = ((_M_info._M_capacity + 1) * sizeof(_CharT)
+ + 2 * sizeof(_Rep) - 1);
+ _Rep_alloc_type(__a).deallocate(this, __size / sizeof(_Rep));
}
template<typename _CharT, typename _Traits, typename _Alloc>
@@ -429,41 +421,40 @@ namespace __gnu_cxx
_M_clone(const _Alloc& __alloc, size_type __res)
{
// Requested capacity of the clone.
- const size_type __requested_cap = _M_length + __res;
- _Rep* __r = _Rep::_S_create(__requested_cap, _M_capacity, __alloc);
+ const size_type __requested_cap = _M_info._M_length + __res;
+ _Rep* __r = _Rep::_S_create(__requested_cap, _M_info._M_capacity,
+ __alloc);
- if (_M_length)
- _S_copy(__r->_M_refdata(), _M_refdata(), _M_length);
+ if (_M_info._M_length)
+ _S_copy(__r->_M_refdata(), _M_refdata(), _M_info._M_length);
- __r->_M_set_length(_M_length);
+ __r->_M_set_length(_M_info._M_length);
return __r->_M_refdata();
}
template<typename _CharT, typename _Traits, typename _Alloc>
__rc_string_base<_CharT, _Traits, _Alloc>::
__rc_string_base(const _Alloc& __a)
- : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a) { }
+ : _M_dataplus(__a, _S_construct(size_type(), _CharT(), __a)) { }
template<typename _CharT, typename _Traits, typename _Alloc>
__rc_string_base<_CharT, _Traits, _Alloc>::
__rc_string_base(const __rc_string_base& __rcs)
- : _M_dataplus(__rcs._M_grab(_Alloc(__rcs._M_get_allocator()),
- __rcs._M_get_allocator()),
- __rcs._M_get_allocator()) { }
+ : _M_dataplus(__rcs._M_get_allocator(),
+ __rcs._M_grab(_Alloc(__rcs._M_get_allocator()),
+ __rcs._M_get_allocator())) { }
template<typename _CharT, typename _Traits, typename _Alloc>
__rc_string_base<_CharT, _Traits, _Alloc>::
__rc_string_base(size_type __n, _CharT __c, const _Alloc& __a)
- : _M_dataplus(_S_construct(__n, __c, __a), __a)
- { }
+ : _M_dataplus(__a, _S_construct(__n, __c, __a)) { }
template<typename _CharT, typename _Traits, typename _Alloc>
template<typename _InputIterator>
__rc_string_base<_CharT, _Traits, _Alloc>::
__rc_string_base(_InputIterator __beg, _InputIterator __end,
const _Alloc& __a)
- : _M_dataplus(_S_construct(__beg, __end, __a), __a)
- { }
+ : _M_dataplus(__a, _S_construct(__beg, __end, __a)) { }
template<typename _CharT, typename _Traits, typename _Alloc>
void
@@ -487,7 +478,7 @@ namespace __gnu_cxx
std::input_iterator_tag)
{
if (__beg == __end && __a == _Alloc())
- return _S_empty_rep()._M_refcopy();
+ return _S_empty_rep._M_refcopy();
// Avoid reallocation for common case.
_CharT __buf[128];
@@ -532,10 +523,10 @@ namespace __gnu_cxx
std::forward_iterator_tag)
{
if (__beg == __end && __a == _Alloc())
- return _S_empty_rep()._M_refcopy();
+ return _S_empty_rep._M_refcopy();
// NB: Not required, but considered best practice.
- if (__builtin_expect(__is_null_p(__beg) && __beg != __end, 0))
+ if (__builtin_expect(_S_is_null_pointer(__beg) && __beg != __end, 0))
std::__throw_logic_error(__N("__rc_string_base::"
"_S_construct NULL not valid"));
@@ -560,7 +551,7 @@ namespace __gnu_cxx
_S_construct(size_type __n, _CharT __c, const _Alloc& __a)
{
if (__n == 0 && __a == _Alloc())
- return _S_empty_rep()._M_refcopy();
+ return _S_empty_rep._M_refcopy();
// Check for out_of_range and length_error exceptions.
_Rep* __r = _Rep::_S_create(__n, size_type(0), __a);
@@ -574,6 +565,24 @@ namespace __gnu_cxx
template<typename _CharT, typename _Traits, typename _Alloc>
void
__rc_string_base<_CharT, _Traits, _Alloc>::
+ _M_swap(__rc_string_base& __rcs)
+ {
+ if (_M_is_leaked())
+ _M_set_sharable();
+ if (__rcs._M_is_leaked())
+ __rcs._M_set_sharable();
+
+ _CharT* __tmp = _M_data();
+ _M_data(__rcs._M_data());
+ __rcs._M_data(__tmp);
+
+ // NB: Implement Option 3 of DR 431 (see N1599).
+ _M_dataplus._M_alloc_swap(__rcs._M_dataplus);
+ }
+
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ void
+ __rc_string_base<_CharT, _Traits, _Alloc>::
_M_assign(const __rc_string_base& __rcs)
{
if (_M_rep() != __rcs._M_rep())
diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h
index c37bd88ca5a..bd29413eb83 100644
--- a/libstdc++-v3/include/ext/sso_string_base.h
+++ b/libstdc++-v3/include/ext/sso_string_base.h
@@ -47,8 +47,8 @@ namespace __gnu_cxx
typedef typename _Traits::char_type value_type;
typedef _Alloc allocator_type;
- typedef typename __vstring_utility<_CharT, _Traits, _Alloc>::
- _CharT_alloc_type _CharT_alloc_type;
+ typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base;
+ typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type;
typedef typename _CharT_alloc_type::size_type size_type;
private:
@@ -66,18 +66,9 @@ namespace __gnu_cxx
enum { _S_max_size = (((static_cast<size_type>(-1)
/ sizeof(_CharT)) - 1) / 4) };
- // Use empty-base optimization: http://www.cantrip.org/emptyopt.html
- struct _Alloc_hider : _Alloc
- {
- _Alloc_hider(const _Alloc& __a, _CharT* __ptr)
- : _Alloc(__a), _M_p(__ptr) { }
-
- _CharT* _M_p; // The actual data.
- };
-
// Data Members (private):
- _Alloc_hider _M_dataplus;
- size_type _M_string_length;
+ typename _Util_Base::template _Alloc_hider<_Alloc> _M_dataplus;
+ size_type _M_string_length;
enum { _S_local_capacity = 15 };
@@ -87,9 +78,9 @@ namespace __gnu_cxx
size_type _M_allocated_capacity;
};
- _CharT*
+ void
_M_data(_CharT* __p)
- { return (_M_dataplus._M_p = __p); }
+ { _M_dataplus._M_p = __p; }
void
_M_length(size_type __length)
@@ -118,7 +109,7 @@ namespace __gnu_cxx
_M_destroy(size_type) throw();
// _M_construct_aux is used to implement the 21.3.1 para 15 which
- // requires special behaviour if _InIter is an integral type
+ // requires special behaviour if _InIterator is an integral type
template<class _InIterator>
void
_M_construct_aux(_InIterator __beg, _InIterator __end, __false_type)
@@ -181,28 +172,19 @@ namespace __gnu_cxx
_M_is_shared() const
{ return false; }
- bool
- _M_is_leaked() const
- { return false; }
-
void
- _M_set_sharable() { }
+ _M_set_leaked() { }
void
- _M_set_leaked() { }
+ _M_leak() { }
void
_M_set_length(size_type __n)
{
_M_length(__n);
- // grrr. (per 21.3.4)
- // You cannot leave those LWG people alone for a second.
traits_type::assign(_M_data()[__n], _CharT());
}
- void
- _M_leak() { }
-
__sso_string_base()
: _M_dataplus(_Alloc(), _M_local_data)
{ _M_set_length(0); }
@@ -248,6 +230,9 @@ namespace __gnu_cxx
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_swap(__sso_string_base& __rcs)
{
+ // NB: Implement Option 3 of DR 431 (see N1599).
+ _M_dataplus._M_alloc_swap(__rcs._M_dataplus);
+
if (_M_is_local())
if (__rcs._M_is_local())
{
@@ -325,9 +310,6 @@ namespace __gnu_cxx
// The below implements an exponential growth policy, necessary to
// meet amortized linear time requirements of the library: see
// http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.
- // It's active for allocations requiring an amount of memory above
- // system pagesize. This is consistent with the requirements of the
- // standard: http://gcc.gnu.org/ml/libstdc++/2001-07/msg00130.html
if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)
__capacity = 2 * __old_capacity;
@@ -373,7 +355,6 @@ namespace __gnu_cxx
_M_construct(_InIterator __beg, _InIterator __end,
std::input_iterator_tag)
{
- // Avoid reallocation for common case.
size_type __len = 0;
size_type __capacity = size_type(_S_local_capacity);
@@ -418,7 +399,7 @@ namespace __gnu_cxx
std::forward_iterator_tag)
{
// NB: Not required, but considered best practice.
- if (__builtin_expect(__is_null_p(__beg) && __beg != __end, 0))
+ if (__builtin_expect(_S_is_null_pointer(__beg) && __beg != __end, 0))
std::__throw_logic_error(__N("__sso_string_base::"
"_M_construct NULL not valid"));
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index a7741949f64..1aaa87665e7 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -1214,7 +1214,8 @@ namespace __gnu_cxx
* time.
*/
void
- swap(__versa_string& __s);
+ swap(__versa_string& __s)
+ { this->_M_swap(__s); }
// String operations:
/**
diff --git a/libstdc++-v3/include/ext/vstring.tcc b/libstdc++-v3/include/ext/vstring.tcc
index b8d35e3aceb..76fa96bcbd3 100644
--- a/libstdc++-v3/include/ext/vstring.tcc
+++ b/libstdc++-v3/include/ext/vstring.tcc
@@ -222,30 +222,6 @@ namespace __gnu_cxx
template <typename, typename, typename> class _Base>
void
__versa_string<_CharT, _Traits, _Alloc, _Base>::
- swap(__versa_string& __s)
- {
- if (this->_M_is_leaked())
- this->_M_set_sharable();
- if (__s._M_is_leaked())
- __s._M_set_sharable();
- if (this->get_allocator() == __s.get_allocator())
- this->_M_swap(__s);
- // The code below can usually be optimized away.
- else
- {
- const __versa_string __tmp1(_M_ibegin(), _M_iend(),
- __s.get_allocator());
- const __versa_string __tmp2(__s._M_ibegin(), __s._M_iend(),
- this->get_allocator());
- *this = __tmp2;
- __s = __tmp1;
- }
- }
-
- template<typename _CharT, typename _Traits, typename _Alloc,
- template <typename, typename, typename> class _Base>
- void
- __versa_string<_CharT, _Traits, _Alloc, _Base>::
resize(size_type __n, _CharT __c)
{
const size_type __size = this->size();
diff --git a/libstdc++-v3/include/ext/vstring_util.h b/libstdc++-v3/include/ext/vstring_util.h
index 38c7c10976a..2a53fbdd4bd 100644
--- a/libstdc++-v3/include/ext/vstring_util.h
+++ b/libstdc++-v3/include/ext/vstring_util.h
@@ -1,4 +1,4 @@
-// Versatile string utilities -*- C++ -*-
+// Versatile string utility -*- C++ -*-
// Copyright (C) 2005 Free Software Foundation, Inc.
//
@@ -47,16 +47,6 @@
namespace __gnu_cxx
{
- template<typename _Type>
- inline bool
- __is_null_p(_Type* __ptr)
- { return __ptr == 0; }
-
- template<typename _Type>
- inline bool
- __is_null_p(_Type)
- { return false; }
-
template<typename _CharT, typename _Traits, typename _Alloc>
struct __vstring_utility
{
@@ -92,6 +82,53 @@ namespace __gnu_cxx
__rc_string_base> >
__const_rc_iterator;
+ // NB: When the allocator is empty, deriving from it saves space
+ // (http://www.cantrip.org/emptyopt.html). We do that anyway for
+ // consistency.
+ template<typename _Alloc1, bool = std::__is_empty<_Alloc1>::__value>
+ struct _Alloc_hider
+ : public _Alloc1
+ {
+ _Alloc_hider(const _Alloc1& __a, _CharT* __ptr)
+ : _Alloc1(__a), _M_p(__ptr) { }
+
+ void
+ _M_alloc_swap(_Alloc_hider& __ah)
+ {
+ // Implement Option 3 of DR 431 (see N1599).
+ // Precondition: swappable allocators.
+ _Alloc1& __this = static_cast<_Alloc1&>(*this);
+ _Alloc1& __that = static_cast<_Alloc1&>(__ah);
+ if (__this != __that)
+ swap(__this, __that);
+ }
+
+ _CharT* _M_p; // The actual data.
+ };
+
+ template<typename _Alloc1>
+ struct _Alloc_hider<_Alloc1, true>
+ : public _Alloc1
+ {
+ _Alloc_hider(const _Alloc1& __a, _CharT* __ptr)
+ : _Alloc1(__a), _M_p(__ptr) { }
+
+ void _M_alloc_swap(_Alloc_hider&) { }
+
+ _CharT* _M_p; // The actual data.
+ };
+
+ // For use in _M_construct (_S_construct) forward_iterator_tag.
+ template<typename _Type>
+ static bool
+ _S_is_null_pointer(_Type* __ptr)
+ { return __ptr == 0; }
+
+ template<typename _Type>
+ static bool
+ _S_is_null_pointer(_Type)
+ { return false; }
+
// When __n = 1 way faster than the general multichar
// traits_type::copy/move/assign.
static void
diff --git a/libstdc++-v3/libsupc++/eh_arm.cc b/libstdc++-v3/libsupc++/eh_arm.cc
index d87d82ad5a0..269b2ec95af 100644
--- a/libstdc++-v3/libsupc++/eh_arm.cc
+++ b/libstdc++-v3/libsupc++/eh_arm.cc
@@ -89,20 +89,31 @@ __cxa_begin_cleanup(_Unwind_Exception* ue_header)
{
__cxa_eh_globals *globals = __cxa_get_globals();
__cxa_exception *header = __get_exception_header_from_ue(ue_header);
+ bool native = __is_gxx_exception_class(header->unwindHeader.exception_class);
- if (!__is_gxx_exception_class(header->unwindHeader.exception_class))
+
+ if (native)
{
- // TODO: cleanups with foreign exceptions.
- return false;
+ header->propagationCount++;
+ // Add it to the chain if this is the first time we've seen this
+ // exception.
+ if (header->propagationCount == 1)
+ {
+ header->nextPropagatingException = globals->propagatingExceptions;
+ globals->propagatingExceptions = header;
+ }
}
- header->propagationCount++;
- // Add it to the chain if this is the first time we've seen this exception.
- if (header->propagationCount == 1)
+ else
{
- header->nextPropagatingException = globals->propagatingExceptions;
+ // Remember the exception object, so end_cleanup can return it.
+ // These cannot be stacked, so we must abort if we already have
+ // a propagating exception.
+ if (globals->propagatingExceptions)
+ std::terminate ();
globals->propagatingExceptions = header;
}
- return true;
+
+ return !native;
}
// Do the work for __cxa_end_cleanup. Returns the currently propagating
@@ -119,13 +130,19 @@ __gnu_end_cleanup(void)
if (!header)
std::terminate();
- header->propagationCount--;
- if (header->propagationCount == 0)
+ if (__is_gxx_exception_class(header->unwindHeader.exception_class))
{
- // Remove exception from chain.
- globals->propagatingExceptions = header->nextPropagatingException;
- header->nextPropagatingException = NULL;
+ header->propagationCount--;
+ if (header->propagationCount == 0)
+ {
+ // Remove exception from chain.
+ globals->propagatingExceptions = header->nextPropagatingException;
+ header->nextPropagatingException = NULL;
+ }
}
+ else
+ globals->propagatingExceptions = NULL;
+
return &header->unwindHeader;
}
diff --git a/libstdc++-v3/libsupc++/eh_personality.cc b/libstdc++-v3/libsupc++/eh_personality.cc
index 6205851a2c4..f07864f1d6f 100644
--- a/libstdc++-v3/libsupc++/eh_personality.cc
+++ b/libstdc++-v3/libsupc++/eh_personality.cc
@@ -369,7 +369,7 @@ PERSONALITY_FUNCTION (int version,
#ifdef __ARM_EABI_UNWINDER__
_Unwind_Action actions;
- switch (state)
+ switch (state & _US_ACTION_MASK)
{
case _US_VIRTUAL_UNWIND_FRAME:
actions = _UA_SEARCH_PHASE;
@@ -377,7 +377,8 @@ PERSONALITY_FUNCTION (int version,
case _US_UNWIND_FRAME_STARTING:
actions = _UA_CLEANUP_PHASE;
- if (ue_header->barrier_cache.sp == _Unwind_GetGR(context, 13))
+ if (!(state & _US_FORCE_UNWIND)
+ && ue_header->barrier_cache.sp == _Unwind_GetGR(context, 13))
actions |= _UA_HANDLER_FRAME;
break;
@@ -388,6 +389,7 @@ PERSONALITY_FUNCTION (int version,
default:
abort();
}
+ actions |= state & _US_FORCE_UNWIND;
// We don't know which runtime we're working with, so can't check this.
// However the ABI routines hide this from us, and we don't actually need
@@ -523,13 +525,13 @@ PERSONALITY_FUNCTION (int version,
// exception class, there's no exception type.
// ??? What to do about GNU Java and GNU Ada exceptions.
-#ifdef __ARM_EABI_UNWINDER__
- throw_type = ue_header;
-#else
if ((actions & _UA_FORCE_UNWIND)
|| foreign_exception)
throw_type = 0;
else
+#ifdef __ARM_EABI_UNWINDER__
+ throw_type = ue_header;
+#else
throw_type = xh->exceptionType;
#endif
@@ -613,7 +615,6 @@ PERSONALITY_FUNCTION (int version,
install_context:
-#ifndef __ARM_EABI_UNWINDER__
// We can't use any of the cxa routines with foreign exceptions,
// because they all expect ue_header to be a struct __cxa_exception.
// So in that case, call terminate or unexpected directly.
@@ -631,7 +632,6 @@ PERSONALITY_FUNCTION (int version,
}
}
else
-#endif
{
if (found_type == found_terminate)
__cxa_call_terminate(ue_header);
diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc
index 8b04f395c87..9f26be008ab 100644
--- a/libstdc++-v3/libsupc++/eh_throw.cc
+++ b/libstdc++-v3/libsupc++/eh_throw.cc
@@ -97,7 +97,7 @@ __cxxabiv1::__cxa_rethrow ()
#ifdef _GLIBCXX_SJLJ_EXCEPTIONS
_Unwind_SjLj_Resume_or_Rethrow (&header->unwindHeader);
#else
-#if defined(_LIBUNWIND_STD_ABI) || defined (__ARM_EABI_UNWINDER__)
+#if defined(_LIBUNWIND_STD_ABI)
_Unwind_RaiseException (&header->unwindHeader);
#else
_Unwind_Resume_or_Rethrow (&header->unwindHeader);
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 105db3718c8..903930a8180 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -28,10 +28,11 @@ include $(top_srcdir)/fragment.am
toolexeclib_LTLIBRARIES = libstdc++.la
# Symbol versioning for shared libraries.
-if ENABLE_SYMVERS_GNU
-version_arg = -Wl,--version-script=libstdc++-symbol.ver
-version_dep = libstdc++-symbol.ver
-libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP)
+# This could be conditional on
+# ENABLE_SYMVERS_GNU || ENABLE_SYMVERS_DARWIN_EXPORT
+# but automake doesn't support OR operations in conditionals.
+libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) \
+ $(port_specific_symbol_files)
cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
if test "x$(port_specific_symbol_files)" != x; then \
sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
@@ -39,15 +40,19 @@ libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP)
cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
rm tmp.top tmp.bottom; \
fi
+
+if ENABLE_SYMVERS_GNU
+version_arg = -Wl,--version-script=libstdc++-symbol.ver
+version_dep = libstdc++-symbol.ver
else
if ENABLE_SYMVERS_DARWIN_EXPORT
version_arg = -Wl,-exported_symbols_list,libstdc++-symbol.explist
version_dep = libstdc++-symbol.explist
-libstdc++-symbol.explist : ${glibcxx_srcdir}/$(SYMVER_MAP) \
+libstdc++-symbol.explist : libstdc++-symbol.ver \
${glibcxx_srcdir}/scripts/make_exports.pl \
$(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
perl ${glibcxx_srcdir}/scripts/make_exports.pl \
- ${glibcxx_srcdir}/$(SYMVER_MAP) \
+ libstdc++-symbol.ver \
$(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
`echo $(libstdc___la_LIBADD) | \
sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
@@ -169,7 +174,6 @@ libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
libstdc___la_LDFLAGS = \
-version-info $(libtool_VERSION) ${version_arg} -lm
-
# Use special rules for the deprecated source files so that they find
# deprecated include files.
GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index 84207702b36..188f46ce07d 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -276,8 +276,6 @@ AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
toolexeclib_LTLIBRARIES = libstdc++.la
@ENABLE_SYMVERS_DARWIN_EXPORT_FALSE@@ENABLE_SYMVERS_GNU_FALSE@version_arg =
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@version_arg = -Wl,-exported_symbols_list,libstdc++-symbol.explist
-
-# Symbol versioning for shared libraries.
@ENABLE_SYMVERS_GNU_TRUE@version_arg = -Wl,--version-script=libstdc++-symbol.ver
@ENABLE_SYMVERS_DARWIN_EXPORT_FALSE@@ENABLE_SYMVERS_GNU_FALSE@version_dep =
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@version_dep = libstdc++-symbol.explist
@@ -668,19 +666,25 @@ uninstall-am: uninstall-info-am uninstall-toolexeclibLTLIBRARIES
tags uninstall uninstall-am uninstall-info-am \
uninstall-toolexeclibLTLIBRARIES
-@ENABLE_SYMVERS_GNU_TRUE@libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP)
-@ENABLE_SYMVERS_GNU_TRUE@ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
-@ENABLE_SYMVERS_GNU_TRUE@ if test "x$(port_specific_symbol_files)" != x; then \
-@ENABLE_SYMVERS_GNU_TRUE@ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
-@ENABLE_SYMVERS_GNU_TRUE@ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
-@ENABLE_SYMVERS_GNU_TRUE@ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
-@ENABLE_SYMVERS_GNU_TRUE@ rm tmp.top tmp.bottom; \
-@ENABLE_SYMVERS_GNU_TRUE@ fi
-@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@libstdc++-symbol.explist : ${glibcxx_srcdir}/$(SYMVER_MAP) \
+
+# Symbol versioning for shared libraries.
+# This could be conditional on
+# ENABLE_SYMVERS_GNU || ENABLE_SYMVERS_DARWIN_EXPORT
+# but automake doesn't support OR operations in conditionals.
+libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP) \
+ $(port_specific_symbol_files)
+ cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
+ if test "x$(port_specific_symbol_files)" != x; then \
+ sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
+ sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
+ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
+ rm tmp.top tmp.bottom; \
+ fi
+@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@libstdc++-symbol.explist : libstdc++-symbol.ver \
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ ${glibcxx_srcdir}/scripts/make_exports.pl \
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ perl ${glibcxx_srcdir}/scripts/make_exports.pl \
-@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ ${glibcxx_srcdir}/$(SYMVER_MAP) \
+@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ libstdc++-symbol.ver \
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ `echo $(libstdc___la_LIBADD) | \
@ENABLE_SYMVERS_DARWIN_EXPORT_TRUE@@ENABLE_SYMVERS_GNU_FALSE@ sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
diff --git a/libstdc++-v3/src/compatibility.cc b/libstdc++-v3/src/compatibility.cc
index a43722f7722..613e8fbb8c6 100644
--- a/libstdc++-v3/src/compatibility.cc
+++ b/libstdc++-v3/src/compatibility.cc
@@ -361,3 +361,28 @@ namespace std
#undef _GLIBCXX_APPLY_SYMVER
#endif
+
+#ifdef __APPLE__
+#if (defined(__ppc__) || defined (__ppc64__)) && defined (PIC)
+/* __eprintf shouldn't have been made visible from libstdc++, or
+ anywhere, but on Mac OS X 10.4 it was defined in
+ libstdc++.6.0.3.dylib; so on that platform we have to keep defining
+ it to keep binary compatibility. We can't just put the libgcc
+ version in the export list, because that doesn't work; once a
+ symbol is marked as hidden, it stays that way. */
+
+#include <cstdio>
+#include <cstdlib>
+
+using namespace std;
+
+extern "C" void
+__eprintf (const char *string, const char *expression,
+ unsigned int line, const char *filename)
+{
+ fprintf (stderr, string, expression, line, filename);
+ fflush (stderr);
+ abort ();
+}
+#endif
+#endif /* __APPLE__ */